Subversion Repositories Kolibri OS

Rev

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