Subversion Repositories Kolibri OS

Rev

Rev 6328 | Rev 6352 | 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.         mov     [Scroll1CoordinatX],9
  172.         mov     [Scroll2CoordinatY],89
  173.         and     [number_panel],0
  174.         and     [number_menu],0
  175.         jmp     still
  176. ;---------------------------------------------------------------------
  177. no_open:
  178.  ;<<<<<<<<<<<SAVE>>>>>>>>>>>>
  179.         cmp     [number_menu],3
  180.         jne     no_save_
  181.  
  182.         mov     al,[save_flag]
  183.         test    al,al
  184.         jz      no_save_file
  185.         jmp     save_enter
  186. ;---------------------------------------------------------------------
  187. no_save_file:
  188.         and     [number_panel],0
  189.         and     [number_menu],0
  190.         jmp     still
  191. ;---------------------------------------------------------------------
  192. no_save_:
  193.  ;<<<<<<<<<SAVE AS>>>>>>>>>>>
  194.         cmp     [number_menu],4
  195.         jne     no_save
  196.  
  197. ; savedialog drawwin,save1,save2,file_path
  198. ;---------------------------------------------------------------------
  199. ; replace extension to '.bmp'
  200.         push    eax esi
  201.         mov     esi,[OpenDialog_data.filename_area]
  202.         xor     eax,eax
  203.         cld
  204. @@:
  205.         lodsb
  206.         test    eax,eax
  207.         jnz     @r
  208.         sub     esi,5
  209.         cmp     [esi],byte '.'
  210.         jne     @f
  211.         mov     [esi],dword '.bmp'
  212. @@:
  213.         pop     esi eax
  214. ;---------------------------------------------------------------------
  215.         mov     [OpenDialog_data.type],1 ; save
  216.        
  217.         push    dword OpenDialog_data
  218.         call    [OpenDialog_Start]
  219.  
  220.         cmp     [OpenDialog_data.status],1
  221.         jne     still
  222. ;---------------------------------------------------------------------
  223. save1:
  224. save_enter:
  225.         mcall SF_SET_EVENTS_MASK,0x80000027 ;100111b
  226.  
  227.         call    analizing_picture_to_palette
  228.  
  229.         ;eax => number of colors in picture
  230.         mov     ebx,[PointerToPicture]
  231.         mov     ecx,[PointerToEditBufer]
  232.         mov     edx,[PointerToPalette]
  233.         mov     esi,[Picture_SizeX]
  234.         mov     edi,[Picture_SizeY]
  235.  
  236.         call    coding_bmp
  237.  
  238.         mov     eax,file_path
  239.         mov     ecx,ebx
  240.         mov     ebx,[PointerToEditBufer]
  241.  
  242.         call    save_file
  243.  
  244.         mov     [save_flag],1
  245.         and     [number_panel],0
  246.         and     [number_menu],0
  247.         call    drawwin
  248.         jmp     still
  249. ;---------------------------------------------------------------------
  250. ;save2:
  251. ;       and     [number_panel],0
  252. ;       and     [number_menu],0
  253. ;       jmp     still
  254. ;---------------------------------------------------------------------
  255. no_save:
  256.  ;<<<<<<EXIT>>>>>>>
  257.         cmp     [number_menu],5
  258.         jne     no_exit_program
  259.  
  260.         mov     eax,-1
  261.         mcall
  262. ;---------------------------------------------------------------------
  263. no_exit_program:
  264. no_file:
  265. ;|||||||||||||||||||||||||||||EDIT|||||||||||||||||||||||||
  266. ;<<<<<<<<<<UNDO>>>>>>>>>>
  267.         cmp     [number_panel],6
  268.         jne     still   ;no_edit
  269.  
  270.         cmp     [number_menu],1
  271.         jne     no_undo
  272.  
  273.         cmp     [number_undo],1
  274.         jne     no_one____
  275.  
  276.         mov     esi,[PointerToCopyPicture]
  277.  
  278. no_one____:
  279.         cmp     [number_undo],2
  280.         jne     no_two____
  281.  
  282.         mov     esi,[PointerToCopyPicture2]
  283.  
  284. no_two____:
  285.         mov     edi,[PointerToPicture]
  286.         mov     ecx,[Picture_SizeX]
  287.         imul    ecx,[Picture_SizeY]
  288.         lea     ecx,[ecx+ecx*2]
  289.         add     ecx,4
  290.         shr     ecx,2
  291.         cld
  292.         rep     movsd
  293.         call    MovePictureToWorkScreen
  294.  
  295.         dec     [number_undo]
  296.         jnz     no_null_undo
  297.  
  298.         mov     [number_undo],1
  299.  
  300. no_null_undo:
  301.         and     [number_panel],0
  302.         and     [number_menu],0
  303.         jmp     still
  304. ;---------------------------------------------------------------------
  305. no_undo:
  306. ;<<<<<<<<<<COPY>>>>>>>>>>
  307.         cmp     [number_menu],2
  308.         jne     no_copy
  309.  
  310.         cmp     [instrument_used],1
  311.         jne     no_copy
  312.         cmp     [Activate_instrument],0
  313.         jne     no_copy
  314.  
  315.         mov     eax,[OldX]
  316.         mov     ebx,[OldY]
  317.  
  318.         cmp     eax,[rectangular_shade_x]
  319.         jl      no_remove_x_copy
  320.  
  321.         mov     ecx,[rectangular_shade_x]
  322.         mov     [OldX],ecx                       ; OldX <-----> rectangulare_shade_x
  323.         mov     [rectangular_shade_x],eax
  324.  
  325. no_remove_x_copy:
  326.         cmp     ebx,[rectangular_shade_y]
  327.         jl      no_remove_y_copy
  328.  
  329.         mov     ecx,[rectangular_shade_y]
  330.         mov     [OldY],ecx                       ; OldY <-----> rectangulare_shade_y
  331.         mov     [rectangular_shade_y],ebx
  332.  
  333. no_remove_y_copy:
  334.         mov     eax,[OldX]
  335.         mov     ebx,[OldY]
  336.         mov     ecx,[rectangular_shade_x]
  337.         mov     edx,[rectangular_shade_y]
  338.         inc     eax
  339.         inc     ebx
  340.         dec     ecx
  341.         dec     edx
  342.  
  343.         mov     [x],eax
  344.         mov     [y],ebx
  345.         mov     esi,eax
  346.         mov     edi,ebx
  347.         mov     [Dx_],1
  348.         mov     [Dy_],1
  349.  
  350.         sub     ecx,eax
  351.         jnz     no_signum_fill_r_x_copy
  352.  
  353.         mov     [Dx_],-1
  354.  
  355. no_signum_fill_r_x_copy:
  356.         sub     edx,ebx
  357.         jnz     no_signum_fill_r_y_copy
  358.  
  359.         mov     [Dy_],-1
  360.  
  361. no_signum_fill_r_y_copy:
  362.         mov     ebx,[rectangular_shade_y]
  363.         sub     ebx,edi
  364.  
  365.         mov     edx,[PointerToEditBufer]
  366.         mov     [y],edi
  367.  
  368. loop_fill_rectangle_y_copy:
  369.         mov     [x],esi
  370.  
  371. loop_fill_rectangle_x_copy:
  372.         push    esi edi
  373.         mov     eax,[PointerToPicture]
  374.         mov     ebx,[Picture_SizeX]
  375.         mov     esi,[x]
  376.         mov     edi,[y]
  377.         call    GetColorOfPixel
  378.         mov     [edx],ax
  379.         shr     eax,16
  380.         mov     [edx+2],al
  381.         pop     edi esi
  382.  
  383.         add     edx,3
  384.         mov     eax,[x]
  385.         add     eax,[Dx_]
  386.         mov     [x],eax
  387.  
  388.         cmp     eax,[rectangular_shade_x]
  389.         jl      loop_fill_rectangle_x_copy
  390.  
  391.         mov     eax,[y]
  392.         add     eax,[Dy_]
  393.         mov     [y],eax
  394.  
  395.         cmp     eax,[rectangular_shade_y]
  396.         jl      loop_fill_rectangle_y_copy
  397.  
  398.         call    MovePictureToWorkScreen
  399.  
  400.         and     [number_panel],0
  401.         and     [number_menu],0
  402.         mov     [DrawSprite_flag],1
  403.         jmp     still
  404. ;---------------------------------------------------------------------
  405. no_copy:
  406. ;<<<<<<<<<<PASTE>>>>>>>>
  407.         cmp     [number_menu],3
  408.         jne     no_paste
  409.  
  410.         cmp     [instrument_used],1
  411.         jne     no_paste
  412.  
  413.         cmp     [Activate_instrument],0
  414.         jne     no_paste
  415.  
  416.         mov     eax,[OldX]
  417.         mov     ebx,[OldY]
  418.  
  419.         cmp     eax,[rectangular_shade_x]
  420.         jl      no_remove_x_paste
  421.  
  422.         mov     ecx,[rectangular_shade_x]
  423.         mov     [OldX],ecx                ; OldX <-----> rectangulare_shade_x
  424.         mov     [rectangular_shade_x],eax
  425.  
  426. no_remove_x_paste:
  427.         cmp     ebx,[rectangular_shade_y]
  428.         jl      no_remove_y_paste
  429.  
  430.         mov     ecx,[rectangular_shade_y]
  431.         mov     [OldY],ecx                ; OldY <-----> rectangulare_shade_y
  432.         mov     [rectangular_shade_y],ebx
  433.  
  434. no_remove_y_paste:
  435.         mov     eax,[OldX]
  436.         mov     ebx,[OldY]
  437.         mov     ecx,[rectangular_shade_x]
  438.         mov     edx,[rectangular_shade_y]
  439.         inc     eax
  440.         inc     ebx
  441.         dec     ecx
  442.         dec     edx
  443.  
  444.         mov     [x],eax
  445.         mov     [y],ebx
  446.         mov     esi,eax
  447.         mov     edi,ebx
  448.         mov     [Dx_],1
  449.         mov     [Dy_],1
  450.  
  451.         sub     ecx,eax
  452.         jnz     no_signum_fill_r_x_paste
  453.  
  454.         mov     [Dx_],-1
  455.  
  456. no_signum_fill_r_x_paste:
  457.         sub     edx,ebx
  458.         jnz     no_signum_fill_r_y_paste
  459.  
  460.         mov     [Dy_],-1
  461.  
  462. no_signum_fill_r_y_paste:
  463.         mov     edx,[PointerToEditBufer]
  464.         mov     [y],edi
  465.  
  466. loop_fill_rectangle_y_paste:
  467.         mov     [x],esi
  468.  
  469. loop_fill_rectangle_x_paste:
  470.         push    esi edi
  471.         mov     ecx,[edx]
  472.         and     ecx,0xffffff ;color
  473.         mov     eax,[PointerToPicture]
  474.         mov     ebx,[Picture_SizeX]
  475.         mov     esi,[x]
  476.         mov     edi,[y]
  477.         call    PutPixel
  478.         pop     edi esi
  479.  
  480.         add     edx,3
  481.  
  482.         mov     eax,[x]
  483.         add     eax,[Dx_]
  484.         mov     [x],eax
  485.         cmp     eax,[rectangular_shade_x]
  486.         jl      loop_fill_rectangle_x_paste
  487.  
  488.         mov     eax,[y]
  489.         add     eax,[Dy_]
  490.         mov     [y],eax
  491.         cmp     eax,[rectangular_shade_y]
  492.         jl      loop_fill_rectangle_y_paste
  493.  
  494.         call    MovePictureToWorkScreen
  495.         and     [number_panel],0
  496.         and     [number_menu],0
  497.         mov     [Paste_flag],1
  498.         jmp     still
  499. ;---------------------------------------------------------------------
  500. no_paste:
  501. ;<<<<<<<<<<CUT>>>>>>>>>>
  502.         cmp     [number_menu],4
  503.         jne     no_cut
  504.  
  505.         cmp     [instrument_used],1
  506.         jne     no_cut
  507.  
  508.         cmp     [Activate_instrument],0
  509.         jne     no_cut
  510.  
  511.         mov     eax,[OldX]
  512.         mov     ebx,[OldY]
  513.  
  514.         cmp     eax,[rectangular_shade_x]
  515.         jl      no_remove_x_cut
  516.  
  517.         mov     ecx,[rectangular_shade_x]
  518.         mov     [OldX],ecx                ; OldX <-----> rectangulare_shade_x
  519.         mov     [rectangular_shade_x],eax
  520.  
  521. no_remove_x_cut:
  522.         cmp     ebx,[rectangular_shade_y]
  523.         jl      no_remove_y_cut
  524.  
  525.         mov     ecx,[rectangular_shade_y]
  526.         mov     [OldY],ecx                ; OldY <-----> rectangulare_shade_y
  527.         mov     [rectangular_shade_y],ebx
  528.  
  529. no_remove_y_cut:
  530.         mov     eax,[OldX]
  531.         mov     ebx,[OldY]
  532.         mov     ecx,[rectangular_shade_x]
  533.         mov     edx,[rectangular_shade_y]
  534.         inc     eax
  535.         inc     ebx
  536.         dec     ecx
  537.         dec     edx
  538.  
  539.         mov     [x],eax
  540.         mov     [y],ebx
  541.         mov     esi,eax
  542.         mov     edi,ebx
  543.         mov     [Dx_],1
  544.         mov     [Dy_],1
  545.  
  546.         sub     ecx,eax
  547.         jnz     no_signum_fill_r_x
  548.  
  549.         mov     [Dx_],-1
  550.  
  551. no_signum_fill_r_x:
  552.         sub     edx,ebx
  553.         jnz     no_signum_fill_r_y
  554.  
  555.         mov     [Dy_],-1
  556.  
  557. no_signum_fill_r_y:
  558.         mov     [y],edi
  559.  
  560. loop_fill_rectangle_y:
  561.         mov     [x],esi
  562.  
  563. loop_fill_rectangle_x:
  564.         push    esi edi
  565.         mov     eax,[PointerToPicture]
  566.         mov     ebx,[Picture_SizeX]
  567.         mov     ecx,dword 0xffffff
  568.         mov     esi,[x]
  569.         mov     edi,[y]
  570.         call    PutPixel
  571.         pop     edi esi
  572.  
  573.         mov     eax,[x]
  574.         add     eax,[Dx_]
  575.         mov     [x],eax
  576.  
  577.         cmp     eax,[rectangular_shade_x]
  578.         jl      loop_fill_rectangle_x
  579.  
  580.         mov     eax,[y]
  581.         add     eax,[Dy_]
  582.         mov     [y],eax
  583.  
  584.         cmp     eax,[rectangular_shade_y]
  585.         jl      loop_fill_rectangle_y
  586.  
  587.         call    MovePictureToWorkScreen
  588.  
  589.         and     [number_panel],0
  590.         and     [number_menu],0
  591.         jmp     still
  592. ;---------------------------------------------------------------------
  593. no_cut:
  594. ;<<<<<<CLEARE ALL>>>>>>
  595.         cmp     [number_menu],5
  596.         jne     no_cleare_all
  597.  
  598.         call    cleare_work_arrea
  599.         call    MovePictureToWorkScreen
  600.  
  601.         and     [number_panel],0
  602.         and     [number_menu],0
  603.         jmp     still
  604. ;---------------------------------------------------------------------
  605. no_cleare_all:
  606. ;<<<<<<TO ALLOCATE ALL>>>>>>
  607.         cmp     [number_menu],6
  608.         jne     still   ;no_to_allocate_all
  609.  
  610.         mov     [OldX],1
  611.         mov     [OldY],1
  612.         mov     eax,[Picture_SizeX]
  613.         mov     ebx,[Picture_SizeY]
  614.         dec     eax
  615.         dec     ebx
  616.         mov     [rectangular_shade_x],eax
  617.         mov     [rectangular_shade_y],ebx
  618.         mov     [instrument_used],1
  619.         mov     [Activate_instrument],1
  620.         mov     [Current_instrument],30
  621.         mov     [crossing],0
  622.         and     [number_panel],0
  623.         and     [number_menu],0
  624. ;       call    TakeButtonInstruments
  625. ;       call    MovePictureToWorkScreen
  626.         jmp     still
  627. ;---------------------------------------------------------------------
  628. ;no_to_allocate_all:
  629. ;no_edit:
  630. ;       jmp     still
  631. ;---------------------------------------------------------------------