Subversion Repositories Kolibri OS

Rev

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