Subversion Repositories Kolibri OS

Rev

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