Subversion Repositories Kolibri OS

Rev

Rev 6352 | Rev 6359 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;-----------------------------------------------------------
  2. ;-----------instruments of menu-----------------------------
  3. ;-----------------------------------------------------------
  4. TakeInstruments:
  5. ;|||||||||||||||||||FILE||||||||||||||||||||||
  6.         cmp     [number_panel],7
  7.         jne     no_file
  8.  
  9. ;<<<<<NEW>>>>>>>
  10.         cmp     [number_menu],1
  11.         jne     no_new
  12.  
  13.         mov     eax,80
  14.         mov     ebx,100
  15.         mov     ecx,150
  16.         mov     edx,90
  17.         mov      esi,1
  18.         call    draw_volume_rectangle
  19.  
  20.         mov     eax,177
  21.         mov     ebx,115
  22.         mov     ecx,40
  23.         mov     edx,14
  24.         mov      esi,4
  25.         call    draw_volume_rectangle
  26.  
  27.         mov     eax,177
  28.         mov     ebx,115+24
  29.         mov     ecx,40
  30.         mov     edx,14
  31.         mov      esi,4
  32.         call    draw_volume_rectangle
  33.  
  34.         mov     eax,175
  35.         mov     ebx,170
  36.         mov     ecx,40
  37.         mov     edx,15
  38.         mov     esi,1
  39.         call    draw_volume_rectangle
  40.  
  41.         mov     eax,90
  42.         mov     ebx,118
  43.         mov     ecx,0xffffff
  44.         mov     edx,new_text1
  45.         mov     esi,14
  46.         call    print_text
  47.  
  48.         mov     eax,90
  49.         mov     ebx,118+24
  50.         mov     ecx,0xffffff
  51.         mov     edx,new_text2
  52.         mov     esi,14
  53.         call    print_text
  54.  
  55.         mov     eax,185
  56.         mov     ebx,175
  57.         mov     ecx,0xffffff
  58.         mov     edx,ok_text
  59.         mov     esi,2
  60.         call    print_text
  61.  
  62.         mov     edx,1000000000000000000000000000000b+1000
  63.         mcall SF_DEFINE_BUTTON,<177,40>,<115,14>,
  64.  
  65.         mov     edx,1000000000000000000000000000000b+1001
  66.         mcall   ,,<139,14>,
  67.  
  68.         mov     edx,1000000000000000000000000000000b+1002
  69.         mcall   ,<175,40>,<170,15>
  70.  
  71. no_activate_space:
  72.         mcall SF_WAIT_EVENT
  73.  
  74.         cmp     eax,1
  75.         je      exit_new
  76.  
  77.         cmp     eax,3
  78.         jne     no_activate_space
  79.  
  80.         mcall SF_GET_BUTTON
  81.         shr     eax,8
  82.  
  83.         cmp     eax,1000
  84.         jl      no_activate_space
  85.  
  86.         cmp     eax,1000
  87.         jne     no_picture_size_x
  88.  
  89.         mov     eax,180
  90.         mov     ebx,119
  91.         mov     ecx,5
  92.         call    dialog_line
  93.  
  94.         mov     eax,string_
  95.         mov     ebx,13
  96.         call    find_symvol
  97.  
  98.         dec     eax
  99.         mov     [length_number],eax
  100.         mov     eax,string_
  101.         call    value
  102.  
  103.         mov     [Picture_SizeX],eax
  104.         jmp     no_activate_space
  105. ;---------------------------------------------------------------------
  106. no_picture_size_x:
  107.         cmp     eax,1001
  108.         jne     no_picture_size_y
  109.  
  110.         mov     eax,180
  111.         mov     ebx,119+24
  112.         mov     ecx,5
  113.         call    dialog_line
  114.  
  115.         mov     eax,string_
  116.         mov     ebx,13
  117.         call    find_symvol
  118.  
  119.         dec     eax
  120.         mov     [length_number],eax
  121.         mov     eax,string_
  122.         call    value
  123.  
  124.         mov     [Picture_SizeY],eax
  125.         jmp     no_activate_space
  126. ;---------------------------------------------------------------------
  127. no_picture_size_y:
  128.         cmp     eax,1002
  129.         jne     no_activate_space
  130.  
  131. exit_new:
  132.         mov     edx,11100000000000000000000000000000b+1002
  133.         mcall SF_DEFINE_BUTTON,<175,40>,<170,15>
  134.  
  135.         mov     edx,11100000000000000000000000000000b+1001
  136.         mcall   ,<177,40>,<139,14>
  137.  
  138.         mov     edx,11100000000000000000000000000000b+1000
  139.         mcall   ,,<115,14>
  140.  
  141. ;get memory for new picture
  142.         call    GetMemory
  143.  
  144.         and     [save_flag],0
  145.         and     [number_panel],0
  146.         and     [number_menu],0
  147.  
  148.         call    cleare_work_arrea
  149.         call    drawwin
  150.         jmp     still
  151. ;---------------------------------------------------------------------
  152. no_new:
  153. ;<<<<<OPEN>>>>>>>
  154.         cmp     [number_menu],2
  155.         jne     no_open
  156.  
  157. ;---------------------------------------------------------------------
  158.         mov     [OpenDialog_data.type],0 ; open
  159.        
  160.         push    dword OpenDialog_data
  161.         call    [OpenDialog_Start]
  162.        
  163.         cmp     [OpenDialog_data.status],1
  164.         jne     still
  165. ;---------------------------------------------------------------------
  166.         mcall SF_SET_EVENTS_MASK,0x80000027 ;100111b
  167.  
  168.         call load_picture
  169.         call drawwin
  170.  
  171.         and     [number_panel],0
  172.         and     [number_menu],0
  173.         jmp     still
  174. ;---------------------------------------------------------------------
  175. no_open:
  176.  ;<<<<<<<<<<<SAVE>>>>>>>>>>>>
  177.         cmp     [number_menu],3
  178.         jne     no_save_
  179.  
  180.         mov     al,[save_flag]
  181.         test    al,al
  182.         jz      no_save_file
  183.         jmp     save_enter
  184. ;---------------------------------------------------------------------
  185. no_save_file:
  186.         and     [number_panel],0
  187.         and     [number_menu],0
  188.         jmp     still
  189. ;---------------------------------------------------------------------
  190. no_save_:
  191.  ;<<<<<<<<<SAVE AS>>>>>>>>>>>
  192.         cmp     [number_menu],4
  193.         jne     no_save
  194.  
  195. ; savedialog drawwin,save1,save2,file_path
  196. ;---------------------------------------------------------------------
  197. ; replace extension to '.bmp'
  198.         push    eax esi
  199.         mov     esi,[OpenDialog_data.filename_area]
  200.         xor     eax,eax
  201.         cld
  202. @@:
  203.         lodsb
  204.         test    eax,eax
  205.         jnz     @r
  206.         sub     esi,5
  207.         cmp     [esi],byte '.'
  208.         jne     @f
  209.         mov     [esi],dword '.bmp'
  210. @@:
  211.         pop     esi eax
  212. ;---------------------------------------------------------------------
  213.         mov     [OpenDialog_data.type],1 ; save
  214.        
  215.         push    dword OpenDialog_data
  216.         call    [OpenDialog_Start]
  217.  
  218.         cmp     [OpenDialog_data.status],1
  219.         jne     still
  220. ;---------------------------------------------------------------------
  221. save1:
  222. save_enter:
  223.         mcall SF_SET_EVENTS_MASK,0x80000027 ;100111b
  224.  
  225.         call    analizing_picture_to_palette
  226.  
  227.         ;eax => number of colors in picture
  228.         mov     ebx,[PointerToPicture]
  229.         mov     ecx,[PointerToEditBufer]
  230.         mov     edx,[PointerToPalette]
  231.         mov     esi,[Picture_SizeX]
  232.         mov     edi,[Picture_SizeY]
  233.  
  234.         call    coding_bmp
  235.  
  236.         mov     eax,file_path
  237.         mov     ecx,ebx
  238.         mov     ebx,[PointerToEditBufer]
  239.  
  240.         call    save_file
  241.  
  242.         mov     [save_flag],1
  243.         and     [number_panel],0
  244.         and     [number_menu],0
  245.         call    drawwin
  246.         jmp     still
  247. ;---------------------------------------------------------------------
  248. ;save2:
  249. ;       and     [number_panel],0
  250. ;       and     [number_menu],0
  251. ;       jmp     still
  252. ;---------------------------------------------------------------------
  253. no_save:
  254.  ;<<<<<<EXIT>>>>>>>
  255.         cmp     [number_menu],5
  256.         jne     no_exit_program
  257.  
  258.         mcall SF_TERMINATE_PROCESS
  259. ;---------------------------------------------------------------------
  260. no_exit_program:
  261. no_file:
  262. ;|||||||||||||||||||||||||||||EDIT|||||||||||||||||||||||||
  263. ;<<<<<<<<<<UNDO>>>>>>>>>>
  264.         cmp     [number_panel],6
  265.         jne     still ;no_edit
  266.  
  267.         cmp     [number_menu],1
  268.         jne     no_undo
  269.  
  270.         cmp     [number_undo],2 ;2 - maximum undo count
  271.         jge     no_undo
  272.  
  273. ;rotate bufers -1
  274.         inc     [number_undo]
  275.         mov eax,[PointerToPicture]
  276.         mov ebx,[PointerToCopyPicture]
  277.         mov ecx,[PointerToCopyPicture2]
  278.         mov [PointerToPicture],ebx
  279.         mov [PointerToCopyPicture],ecx
  280.         mov [PointerToCopyPicture2],eax
  281.  
  282.         call MovePictureToWorkScreen
  283.         and     [number_panel],0
  284.         and     [number_menu],0
  285.         jmp     still
  286. ;---------------------------------------------------------------------
  287. no_undo:
  288. ;<<<<<<<<<<COPY>>>>>>>>>>
  289.         cmp     [number_menu],2
  290.         jne     no_copy
  291.  
  292.         cmp     [instrument_used],1
  293.         jne     no_copy
  294.         cmp     [Activate_instrument],0
  295.         jne     no_copy
  296.  
  297.         mov     eax,[OldX]
  298.         mov     ebx,[OldY]
  299.  
  300.         cmp     eax,[rectangular_shade_x]
  301.         jl      no_remove_x_copy
  302.  
  303.         mov     ecx,[rectangular_shade_x]
  304.         mov     [OldX],ecx                       ; OldX <-----> rectangulare_shade_x
  305.         mov     [rectangular_shade_x],eax
  306.  
  307. no_remove_x_copy:
  308.         cmp     ebx,[rectangular_shade_y]
  309.         jl      no_remove_y_copy
  310.  
  311.         mov     ecx,[rectangular_shade_y]
  312.         mov     [OldY],ecx                       ; OldY <-----> rectangulare_shade_y
  313.         mov     [rectangular_shade_y],ebx
  314.  
  315. no_remove_y_copy:
  316.         mov     eax,[OldX]
  317.         mov     ebx,[OldY]
  318.         mov     ecx,[rectangular_shade_x]
  319.         mov     edx,[rectangular_shade_y]
  320.         inc     eax
  321.         inc     ebx
  322.         dec     ecx
  323.         dec     edx
  324.  
  325.         mov     [x],eax
  326.         mov     [y],ebx
  327.         mov     esi,eax
  328.         mov     edi,ebx
  329.         mov     [Dx_],1
  330.         mov     [Dy_],1
  331.  
  332.         sub     ecx,eax
  333.         jnz     no_signum_fill_r_x_copy
  334.  
  335.         mov     [Dx_],-1
  336.  
  337. no_signum_fill_r_x_copy:
  338.         sub     edx,ebx
  339.         jnz     no_signum_fill_r_y_copy
  340.  
  341.         mov     [Dy_],-1
  342.  
  343. no_signum_fill_r_y_copy:
  344.         mov     ebx,[rectangular_shade_y]
  345.         sub     ebx,edi
  346.  
  347.         mov     edx,[PointerToEditBufer]
  348.         mov     [y],edi
  349.  
  350. loop_fill_rectangle_y_copy:
  351.         mov     [x],esi
  352.  
  353. loop_fill_rectangle_x_copy:
  354.         push    esi edi
  355.         mov     eax,[PointerToPicture]
  356.         mov     ebx,[Picture_SizeX]
  357.         mov     esi,[x]
  358.         mov     edi,[y]
  359.         call    GetColorOfPixel
  360.         mov     [edx],ax
  361.         shr     eax,16
  362.         mov     [edx+2],al
  363.         pop     edi esi
  364.  
  365.         add     edx,3
  366.         mov     eax,[x]
  367.         add     eax,[Dx_]
  368.         mov     [x],eax
  369.  
  370.         cmp     eax,[rectangular_shade_x]
  371.         jl      loop_fill_rectangle_x_copy
  372.  
  373.         mov     eax,[y]
  374.         add     eax,[Dy_]
  375.         mov     [y],eax
  376.  
  377.         cmp     eax,[rectangular_shade_y]
  378.         jl      loop_fill_rectangle_y_copy
  379.  
  380.         call    MovePictureToWorkScreen
  381.  
  382.         and     [number_panel],0
  383.         and     [number_menu],0
  384.         mov     [DrawSprite_flag],1
  385.         jmp     still
  386. ;---------------------------------------------------------------------
  387. no_copy:
  388. ;<<<<<<<<<<PASTE>>>>>>>>
  389.         cmp     [number_menu],3
  390.         jne     no_paste
  391.  
  392.         cmp     [instrument_used],1
  393.         jne     no_paste
  394.  
  395.         cmp     [Activate_instrument],0
  396.         jne     no_paste
  397.  
  398.         mov     eax,[OldX]
  399.         mov     ebx,[OldY]
  400.  
  401.         cmp     eax,[rectangular_shade_x]
  402.         jl      no_remove_x_paste
  403.  
  404.         mov     ecx,[rectangular_shade_x]
  405.         mov     [OldX],ecx                ; OldX <-----> rectangulare_shade_x
  406.         mov     [rectangular_shade_x],eax
  407.  
  408. no_remove_x_paste:
  409.         cmp     ebx,[rectangular_shade_y]
  410.         jl      no_remove_y_paste
  411.  
  412.         mov     ecx,[rectangular_shade_y]
  413.         mov     [OldY],ecx                ; OldY <-----> rectangulare_shade_y
  414.         mov     [rectangular_shade_y],ebx
  415.  
  416. no_remove_y_paste:
  417.         mov     eax,[OldX]
  418.         mov     ebx,[OldY]
  419.         mov     ecx,[rectangular_shade_x]
  420.         mov     edx,[rectangular_shade_y]
  421.         inc     eax
  422.         inc     ebx
  423.         dec     ecx
  424.         dec     edx
  425.  
  426.         mov     [x],eax
  427.         mov     [y],ebx
  428.         mov     esi,eax
  429.         mov     edi,ebx
  430.         mov     [Dx_],1
  431.         mov     [Dy_],1
  432.  
  433.         sub     ecx,eax
  434.         jnz     no_signum_fill_r_x_paste
  435.  
  436.         mov     [Dx_],-1
  437.  
  438. no_signum_fill_r_x_paste:
  439.         sub     edx,ebx
  440.         jnz     no_signum_fill_r_y_paste
  441.  
  442.         mov     [Dy_],-1
  443.  
  444. no_signum_fill_r_y_paste:
  445.         mov     edx,[PointerToEditBufer]
  446.         mov     [y],edi
  447.  
  448. loop_fill_rectangle_y_paste:
  449.         mov     [x],esi
  450.  
  451. loop_fill_rectangle_x_paste:
  452.         push    esi edi
  453.         mov     ecx,[edx]
  454.         and     ecx,0xffffff ;color
  455.         mov     eax,[PointerToPicture]
  456.         mov     ebx,[Picture_SizeX]
  457.         mov     esi,[x]
  458.         mov     edi,[y]
  459.         call    PutPixel
  460.         pop     edi esi
  461.  
  462.         add     edx,3
  463.  
  464.         mov     eax,[x]
  465.         add     eax,[Dx_]
  466.         mov     [x],eax
  467.         cmp     eax,[rectangular_shade_x]
  468.         jl      loop_fill_rectangle_x_paste
  469.  
  470.         mov     eax,[y]
  471.         add     eax,[Dy_]
  472.         mov     [y],eax
  473.         cmp     eax,[rectangular_shade_y]
  474.         jl      loop_fill_rectangle_y_paste
  475.  
  476.         call    MovePictureToWorkScreen
  477.         and     [number_panel],0
  478.         and     [number_menu],0
  479.         mov     [Paste_flag],1
  480.         jmp     still
  481. ;---------------------------------------------------------------------
  482. no_paste:
  483. ;<<<<<<<<<<CUT>>>>>>>>>>
  484.         cmp     [number_menu],4
  485.         jne     no_cut
  486.  
  487.         cmp     [instrument_used],1
  488.         jne     no_cut
  489.  
  490.         cmp     [Activate_instrument],0
  491.         jne     no_cut
  492.  
  493.         mov     eax,[OldX]
  494.         mov     ebx,[OldY]
  495.  
  496.         cmp     eax,[rectangular_shade_x]
  497.         jl      no_remove_x_cut
  498.  
  499.         mov     ecx,[rectangular_shade_x]
  500.         mov     [OldX],ecx                ; OldX <-----> rectangulare_shade_x
  501.         mov     [rectangular_shade_x],eax
  502.  
  503. no_remove_x_cut:
  504.         cmp     ebx,[rectangular_shade_y]
  505.         jl      no_remove_y_cut
  506.  
  507.         mov     ecx,[rectangular_shade_y]
  508.         mov     [OldY],ecx                ; OldY <-----> rectangulare_shade_y
  509.         mov     [rectangular_shade_y],ebx
  510.  
  511. no_remove_y_cut:
  512.         mov     eax,[OldX]
  513.         mov     ebx,[OldY]
  514.         mov     ecx,[rectangular_shade_x]
  515.         mov     edx,[rectangular_shade_y]
  516.         inc     eax
  517.         inc     ebx
  518.         dec     ecx
  519.         dec     edx
  520.  
  521.         mov     [x],eax
  522.         mov     [y],ebx
  523.         mov     esi,eax
  524.         mov     edi,ebx
  525.         mov     [Dx_],1
  526.         mov     [Dy_],1
  527.  
  528.         sub     ecx,eax
  529.         jnz     no_signum_fill_r_x
  530.  
  531.         mov     [Dx_],-1
  532.  
  533. no_signum_fill_r_x:
  534.         sub     edx,ebx
  535.         jnz     no_signum_fill_r_y
  536.  
  537.         mov     [Dy_],-1
  538.  
  539. no_signum_fill_r_y:
  540.         mov     [y],edi
  541.  
  542. loop_fill_rectangle_y:
  543.         mov     [x],esi
  544.  
  545. loop_fill_rectangle_x:
  546.         push    esi edi
  547.         mov     eax,[PointerToPicture]
  548.         mov     ebx,[Picture_SizeX]
  549.         mov     ecx,dword 0xffffff
  550.         mov     esi,[x]
  551.         mov     edi,[y]
  552.         call    PutPixel
  553.         pop     edi esi
  554.  
  555.         mov     eax,[x]
  556.         add     eax,[Dx_]
  557.         mov     [x],eax
  558.  
  559.         cmp     eax,[rectangular_shade_x]
  560.         jl      loop_fill_rectangle_x
  561.  
  562.         mov     eax,[y]
  563.         add     eax,[Dy_]
  564.         mov     [y],eax
  565.  
  566.         cmp     eax,[rectangular_shade_y]
  567.         jl      loop_fill_rectangle_y
  568.  
  569.         call    MovePictureToWorkScreen
  570.  
  571.         and     [number_panel],0
  572.         and     [number_menu],0
  573.         jmp     still
  574. ;---------------------------------------------------------------------
  575. no_cut:
  576. ;<<<<<<CLEARE ALL>>>>>>
  577.         cmp     [number_menu],5
  578.         jne     no_cleare_all
  579.  
  580.         call    cleare_work_arrea
  581.         call    MovePictureToWorkScreen
  582.  
  583.         and     [number_panel],0
  584.         and     [number_menu],0
  585.         jmp     still
  586. ;---------------------------------------------------------------------
  587. no_cleare_all:
  588. ;<<<<<<TO ALLOCATE ALL>>>>>>
  589.         cmp     [number_menu],6
  590.         jne     still   ;no_to_allocate_all
  591.  
  592.         mov     [OldX],1
  593.         mov     [OldY],1
  594.         mov     eax,[Picture_SizeX]
  595.         mov     ebx,[Picture_SizeY]
  596.         dec     eax
  597.         dec     ebx
  598.         mov     [rectangular_shade_x],eax
  599.         mov     [rectangular_shade_y],ebx
  600.         mov     [instrument_used],1
  601.         mov     [Activate_instrument],1
  602.         mov     [Current_instrument],30
  603.         mov     [crossing],0
  604.         and     [number_panel],0
  605.         and     [number_menu],0
  606. ;       call    TakeButtonInstruments
  607. ;       call    MovePictureToWorkScreen
  608.         jmp     still
  609. ;---------------------------------------------------------------------
  610. ;no_to_allocate_all:
  611. ;no_edit:
  612. ;       jmp     still
  613. ;---------------------------------------------------------------------