Subversion Repositories Kolibri OS

Rev

Rev 6342 | 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.         mov     eax,-1
  259.         mcall
  260. ;---------------------------------------------------------------------
  261. no_exit_program:
  262. no_file:
  263. ;|||||||||||||||||||||||||||||EDIT|||||||||||||||||||||||||
  264. ;<<<<<<<<<<UNDO>>>>>>>>>>
  265.         cmp     [number_panel],6
  266.         jne     still   ;no_edit
  267.  
  268.         cmp     [number_menu],1
  269.         jne     no_undo
  270.  
  271.         cmp     [number_undo],1
  272.         jne     no_one____
  273.  
  274.         mov     esi,[PointerToCopyPicture]
  275.  
  276. no_one____:
  277.         cmp     [number_undo],2
  278.         jne     no_two____
  279.  
  280.         mov     esi,[PointerToCopyPicture2]
  281.  
  282. no_two____:
  283.         mov     edi,[PointerToPicture]
  284.         mov     ecx,[Picture_SizeX]
  285.         imul    ecx,[Picture_SizeY]
  286.         lea     ecx,[ecx+ecx*2]
  287.         add     ecx,4
  288.         shr     ecx,2
  289.         cld
  290.         rep     movsd
  291.         call    MovePictureToWorkScreen
  292.  
  293.         dec     [number_undo]
  294.         jnz     no_null_undo
  295.  
  296.         mov     [number_undo],1
  297.  
  298. no_null_undo:
  299.         and     [number_panel],0
  300.         and     [number_menu],0
  301.         jmp     still
  302. ;---------------------------------------------------------------------
  303. no_undo:
  304. ;<<<<<<<<<<COPY>>>>>>>>>>
  305.         cmp     [number_menu],2
  306.         jne     no_copy
  307.  
  308.         cmp     [instrument_used],1
  309.         jne     no_copy
  310.         cmp     [Activate_instrument],0
  311.         jne     no_copy
  312.  
  313.         mov     eax,[OldX]
  314.         mov     ebx,[OldY]
  315.  
  316.         cmp     eax,[rectangular_shade_x]
  317.         jl      no_remove_x_copy
  318.  
  319.         mov     ecx,[rectangular_shade_x]
  320.         mov     [OldX],ecx                       ; OldX <-----> rectangulare_shade_x
  321.         mov     [rectangular_shade_x],eax
  322.  
  323. no_remove_x_copy:
  324.         cmp     ebx,[rectangular_shade_y]
  325.         jl      no_remove_y_copy
  326.  
  327.         mov     ecx,[rectangular_shade_y]
  328.         mov     [OldY],ecx                       ; OldY <-----> rectangulare_shade_y
  329.         mov     [rectangular_shade_y],ebx
  330.  
  331. no_remove_y_copy:
  332.         mov     eax,[OldX]
  333.         mov     ebx,[OldY]
  334.         mov     ecx,[rectangular_shade_x]
  335.         mov     edx,[rectangular_shade_y]
  336.         inc     eax
  337.         inc     ebx
  338.         dec     ecx
  339.         dec     edx
  340.  
  341.         mov     [x],eax
  342.         mov     [y],ebx
  343.         mov     esi,eax
  344.         mov     edi,ebx
  345.         mov     [Dx_],1
  346.         mov     [Dy_],1
  347.  
  348.         sub     ecx,eax
  349.         jnz     no_signum_fill_r_x_copy
  350.  
  351.         mov     [Dx_],-1
  352.  
  353. no_signum_fill_r_x_copy:
  354.         sub     edx,ebx
  355.         jnz     no_signum_fill_r_y_copy
  356.  
  357.         mov     [Dy_],-1
  358.  
  359. no_signum_fill_r_y_copy:
  360.         mov     ebx,[rectangular_shade_y]
  361.         sub     ebx,edi
  362.  
  363.         mov     edx,[PointerToEditBufer]
  364.         mov     [y],edi
  365.  
  366. loop_fill_rectangle_y_copy:
  367.         mov     [x],esi
  368.  
  369. loop_fill_rectangle_x_copy:
  370.         push    esi edi
  371.         mov     eax,[PointerToPicture]
  372.         mov     ebx,[Picture_SizeX]
  373.         mov     esi,[x]
  374.         mov     edi,[y]
  375.         call    GetColorOfPixel
  376.         mov     [edx],ax
  377.         shr     eax,16
  378.         mov     [edx+2],al
  379.         pop     edi esi
  380.  
  381.         add     edx,3
  382.         mov     eax,[x]
  383.         add     eax,[Dx_]
  384.         mov     [x],eax
  385.  
  386.         cmp     eax,[rectangular_shade_x]
  387.         jl      loop_fill_rectangle_x_copy
  388.  
  389.         mov     eax,[y]
  390.         add     eax,[Dy_]
  391.         mov     [y],eax
  392.  
  393.         cmp     eax,[rectangular_shade_y]
  394.         jl      loop_fill_rectangle_y_copy
  395.  
  396.         call    MovePictureToWorkScreen
  397.  
  398.         and     [number_panel],0
  399.         and     [number_menu],0
  400.         mov     [DrawSprite_flag],1
  401.         jmp     still
  402. ;---------------------------------------------------------------------
  403. no_copy:
  404. ;<<<<<<<<<<PASTE>>>>>>>>
  405.         cmp     [number_menu],3
  406.         jne     no_paste
  407.  
  408.         cmp     [instrument_used],1
  409.         jne     no_paste
  410.  
  411.         cmp     [Activate_instrument],0
  412.         jne     no_paste
  413.  
  414.         mov     eax,[OldX]
  415.         mov     ebx,[OldY]
  416.  
  417.         cmp     eax,[rectangular_shade_x]
  418.         jl      no_remove_x_paste
  419.  
  420.         mov     ecx,[rectangular_shade_x]
  421.         mov     [OldX],ecx                ; OldX <-----> rectangulare_shade_x
  422.         mov     [rectangular_shade_x],eax
  423.  
  424. no_remove_x_paste:
  425.         cmp     ebx,[rectangular_shade_y]
  426.         jl      no_remove_y_paste
  427.  
  428.         mov     ecx,[rectangular_shade_y]
  429.         mov     [OldY],ecx                ; OldY <-----> rectangulare_shade_y
  430.         mov     [rectangular_shade_y],ebx
  431.  
  432. no_remove_y_paste:
  433.         mov     eax,[OldX]
  434.         mov     ebx,[OldY]
  435.         mov     ecx,[rectangular_shade_x]
  436.         mov     edx,[rectangular_shade_y]
  437.         inc     eax
  438.         inc     ebx
  439.         dec     ecx
  440.         dec     edx
  441.  
  442.         mov     [x],eax
  443.         mov     [y],ebx
  444.         mov     esi,eax
  445.         mov     edi,ebx
  446.         mov     [Dx_],1
  447.         mov     [Dy_],1
  448.  
  449.         sub     ecx,eax
  450.         jnz     no_signum_fill_r_x_paste
  451.  
  452.         mov     [Dx_],-1
  453.  
  454. no_signum_fill_r_x_paste:
  455.         sub     edx,ebx
  456.         jnz     no_signum_fill_r_y_paste
  457.  
  458.         mov     [Dy_],-1
  459.  
  460. no_signum_fill_r_y_paste:
  461.         mov     edx,[PointerToEditBufer]
  462.         mov     [y],edi
  463.  
  464. loop_fill_rectangle_y_paste:
  465.         mov     [x],esi
  466.  
  467. loop_fill_rectangle_x_paste:
  468.         push    esi edi
  469.         mov     ecx,[edx]
  470.         and     ecx,0xffffff ;color
  471.         mov     eax,[PointerToPicture]
  472.         mov     ebx,[Picture_SizeX]
  473.         mov     esi,[x]
  474.         mov     edi,[y]
  475.         call    PutPixel
  476.         pop     edi esi
  477.  
  478.         add     edx,3
  479.  
  480.         mov     eax,[x]
  481.         add     eax,[Dx_]
  482.         mov     [x],eax
  483.         cmp     eax,[rectangular_shade_x]
  484.         jl      loop_fill_rectangle_x_paste
  485.  
  486.         mov     eax,[y]
  487.         add     eax,[Dy_]
  488.         mov     [y],eax
  489.         cmp     eax,[rectangular_shade_y]
  490.         jl      loop_fill_rectangle_y_paste
  491.  
  492.         call    MovePictureToWorkScreen
  493.         and     [number_panel],0
  494.         and     [number_menu],0
  495.         mov     [Paste_flag],1
  496.         jmp     still
  497. ;---------------------------------------------------------------------
  498. no_paste:
  499. ;<<<<<<<<<<CUT>>>>>>>>>>
  500.         cmp     [number_menu],4
  501.         jne     no_cut
  502.  
  503.         cmp     [instrument_used],1
  504.         jne     no_cut
  505.  
  506.         cmp     [Activate_instrument],0
  507.         jne     no_cut
  508.  
  509.         mov     eax,[OldX]
  510.         mov     ebx,[OldY]
  511.  
  512.         cmp     eax,[rectangular_shade_x]
  513.         jl      no_remove_x_cut
  514.  
  515.         mov     ecx,[rectangular_shade_x]
  516.         mov     [OldX],ecx                ; OldX <-----> rectangulare_shade_x
  517.         mov     [rectangular_shade_x],eax
  518.  
  519. no_remove_x_cut:
  520.         cmp     ebx,[rectangular_shade_y]
  521.         jl      no_remove_y_cut
  522.  
  523.         mov     ecx,[rectangular_shade_y]
  524.         mov     [OldY],ecx                ; OldY <-----> rectangulare_shade_y
  525.         mov     [rectangular_shade_y],ebx
  526.  
  527. no_remove_y_cut:
  528.         mov     eax,[OldX]
  529.         mov     ebx,[OldY]
  530.         mov     ecx,[rectangular_shade_x]
  531.         mov     edx,[rectangular_shade_y]
  532.         inc     eax
  533.         inc     ebx
  534.         dec     ecx
  535.         dec     edx
  536.  
  537.         mov     [x],eax
  538.         mov     [y],ebx
  539.         mov     esi,eax
  540.         mov     edi,ebx
  541.         mov     [Dx_],1
  542.         mov     [Dy_],1
  543.  
  544.         sub     ecx,eax
  545.         jnz     no_signum_fill_r_x
  546.  
  547.         mov     [Dx_],-1
  548.  
  549. no_signum_fill_r_x:
  550.         sub     edx,ebx
  551.         jnz     no_signum_fill_r_y
  552.  
  553.         mov     [Dy_],-1
  554.  
  555. no_signum_fill_r_y:
  556.         mov     [y],edi
  557.  
  558. loop_fill_rectangle_y:
  559.         mov     [x],esi
  560.  
  561. loop_fill_rectangle_x:
  562.         push    esi edi
  563.         mov     eax,[PointerToPicture]
  564.         mov     ebx,[Picture_SizeX]
  565.         mov     ecx,dword 0xffffff
  566.         mov     esi,[x]
  567.         mov     edi,[y]
  568.         call    PutPixel
  569.         pop     edi esi
  570.  
  571.         mov     eax,[x]
  572.         add     eax,[Dx_]
  573.         mov     [x],eax
  574.  
  575.         cmp     eax,[rectangular_shade_x]
  576.         jl      loop_fill_rectangle_x
  577.  
  578.         mov     eax,[y]
  579.         add     eax,[Dy_]
  580.         mov     [y],eax
  581.  
  582.         cmp     eax,[rectangular_shade_y]
  583.         jl      loop_fill_rectangle_y
  584.  
  585.         call    MovePictureToWorkScreen
  586.  
  587.         and     [number_panel],0
  588.         and     [number_menu],0
  589.         jmp     still
  590. ;---------------------------------------------------------------------
  591. no_cut:
  592. ;<<<<<<CLEARE ALL>>>>>>
  593.         cmp     [number_menu],5
  594.         jne     no_cleare_all
  595.  
  596.         call    cleare_work_arrea
  597.         call    MovePictureToWorkScreen
  598.  
  599.         and     [number_panel],0
  600.         and     [number_menu],0
  601.         jmp     still
  602. ;---------------------------------------------------------------------
  603. no_cleare_all:
  604. ;<<<<<<TO ALLOCATE ALL>>>>>>
  605.         cmp     [number_menu],6
  606.         jne     still   ;no_to_allocate_all
  607.  
  608.         mov     [OldX],1
  609.         mov     [OldY],1
  610.         mov     eax,[Picture_SizeX]
  611.         mov     ebx,[Picture_SizeY]
  612.         dec     eax
  613.         dec     ebx
  614.         mov     [rectangular_shade_x],eax
  615.         mov     [rectangular_shade_y],ebx
  616.         mov     [instrument_used],1
  617.         mov     [Activate_instrument],1
  618.         mov     [Current_instrument],30
  619.         mov     [crossing],0
  620.         and     [number_panel],0
  621.         and     [number_menu],0
  622. ;       call    TakeButtonInstruments
  623. ;       call    MovePictureToWorkScreen
  624.         jmp     still
  625. ;---------------------------------------------------------------------
  626. ;no_to_allocate_all:
  627. ;no_edit:
  628. ;       jmp     still
  629. ;---------------------------------------------------------------------