Subversion Repositories Kolibri OS

Rev

Rev 1632 | Rev 3951 | 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.  
  6.          ;|||||||||||||||||||FILE||||||||||||||||||||||
  7.          cmp [number_panel],7
  8.          jne no_file
  9.  
  10.          ;<<<<<NEW>>>>>>>
  11.          cmp [number_menu],1
  12.          jne no_new
  13.  
  14.          mov eax,80
  15.          mov ebx,100
  16.          mov ecx,150
  17.          mov edx,90
  18.          mov  esi,1
  19.          call draw_volume_rectangle
  20.  
  21.          mov eax,177
  22.          mov ebx,115
  23.          mov ecx,40
  24.          mov edx,14
  25.          mov  esi,4
  26.          call draw_volume_rectangle
  27.  
  28.          mov eax,177
  29.          mov ebx,115+24
  30.          mov ecx,40
  31.          mov edx,14
  32.          mov  esi,4
  33.          call draw_volume_rectangle
  34.  
  35.          mov eax,175
  36.          mov ebx,170
  37.          mov ecx,40
  38.          mov edx,15
  39.          mov  esi,1
  40.          call draw_volume_rectangle
  41.  
  42.          mov eax,90
  43.          mov ebx,118
  44.          mov ecx,0xffffff
  45.          mov edx,new_text1
  46.          mov esi,14
  47.          call print_text
  48.  
  49.          mov eax,90
  50.          mov ebx,118+24
  51.          mov ecx,0xffffff
  52.          mov edx,new_text2
  53.          mov esi,14
  54.          call print_text
  55.  
  56.          mov eax,185
  57.          mov ebx,175
  58.          mov ecx,0xffffff
  59.          mov edx,ok_text
  60.          mov esi,2
  61.          call print_text
  62.  
  63.          mov eax,8
  64.          mov ebx,177*65536+40
  65.          mov ecx,115*65536+14
  66.          mov edx,1000000000000000000000000000000b
  67.          add edx,1000
  68.          mcall
  69.  
  70.          mov eax,8
  71.          mov ebx,177*65536+40
  72.          mov ecx,139*65536+14
  73.          mov edx,1000000000000000000000000000000b
  74.          add edx,1001
  75.          mcall
  76.  
  77.          mov eax,8
  78.          mov ebx,175*65536+40
  79.          mov ecx,170*65536+15
  80.          mov edx,1000000000000000000000000000000b
  81.          add edx,1002
  82.          mcall
  83.  
  84.          no_activate_space:
  85.  
  86.          mov eax,10
  87.          mcall
  88.  
  89.          cmp eax,1
  90.          je exit_new
  91.  
  92.          cmp eax,3
  93.          jne no_activate_space
  94.  
  95.          mov eax,17
  96.          mcall
  97.          shr eax,8
  98.  
  99.          cmp eax,1000
  100.          jl no_activate_space
  101.  
  102.          cmp eax,1000
  103.          jne no_picture_size_x
  104.  
  105.          mov eax,180
  106.          mov ebx,119
  107.          mov ecx,5
  108.          call dialog_line
  109.  
  110.          mov eax,string_
  111.          mov ebx,13
  112.          call find_symvol
  113.  
  114.          dec eax
  115.          mov [length_number],eax
  116.          mov eax,string_
  117.          call value
  118.  
  119.          mov [Picture_SizeX],eax
  120.  
  121.          jmp no_activate_space
  122.  
  123.          no_picture_size_x:
  124.  
  125.          cmp eax,1001
  126.          jne no_picture_size_y
  127.  
  128.          mov eax,180
  129.          mov ebx,119+24
  130.          mov ecx,5
  131.          call dialog_line
  132.  
  133.          mov eax,string_
  134.          mov ebx,13
  135.          call find_symvol
  136.  
  137.          dec eax
  138.          mov [length_number],eax
  139.          mov eax,string_
  140.          call value
  141.  
  142.          mov [Picture_SizeY],eax
  143.  
  144.          jmp no_activate_space
  145.  
  146.          no_picture_size_y:
  147.  
  148.          cmp eax,1002
  149.          jne no_activate_space
  150.  
  151.          exit_new:
  152.  
  153.          mov eax,8
  154.          mov ebx,175*65536+40
  155.          mov ecx,170*65536+15
  156.          mov edx,11100000000000000000000000000000b
  157.          add edx,1002
  158.          mcall
  159.  
  160.          mov eax,8
  161.          mov ebx,177*65536+40
  162.          mov ecx,139*65536+14
  163.          mov edx,11100000000000000000000000000000b
  164.          add edx,1001
  165.          mcall
  166.  
  167.          mov eax,8
  168.          mov ebx,177*65536+40
  169.          mov ecx,115*65536+14
  170.          mov edx,11100000000000000000000000000000b
  171.          add edx,1000
  172.          mcall
  173.  
  174.          ;get memory for new picture
  175.  
  176.          call GetMemory
  177.  
  178.          and [save_flag],0
  179.          and [number_panel],0
  180.          and [number_menu],0
  181.  
  182.          call cleare_work_arrea
  183.          call drawwin
  184.  
  185.          jmp still
  186.          no_new:
  187.  
  188.          ;<<<<<OPEN>>>>>>>
  189.         cmp [number_menu],2
  190.          jne no_open
  191.  
  192. ;        opendialog drawwin,open_1,open_2,file_path
  193. ;---------------------------------------------------------------------
  194.         mov     [OpenDialog_data.type],0 ; open
  195.        
  196.         push    dword OpenDialog_data
  197.         call    [OpenDialog_Start]
  198.        
  199.         cmp     [OpenDialog_data.status],1
  200.         jne     still
  201. ;---------------------------------------------------------------------
  202.  
  203.          open_1:
  204.  
  205.          mov eax,40
  206.          mov ebx,100111b
  207.          mcall
  208.  
  209.          mov eax,file_path
  210.          mov ebx,[ScreenPointer]
  211.          add ebx,0x10000
  212.  
  213.          call load_heading_of_file
  214.  
  215.          mov esi,[ScreenPointer]
  216.          add esi,0x10000
  217.          ;-------------is this BMP file ?----------------
  218.          xor eax,eax
  219.          mov ax,[esi]
  220.          mov [type],ax
  221.  
  222.          cmp [type],word 'BM'
  223.          jne no_bmp_file
  224.  
  225.          xor eax,eax
  226.          xor ebx,ebx
  227.          mov eax,[esi+18]
  228.          mov ebx,[esi+22]
  229.          mov [Picture_SizeX],eax
  230.          mov [Picture_SizeY],ebx
  231.  
  232.          jmp exit_type
  233.  
  234.          no_bmp_file:
  235.  
  236.          ;-------------is this GIF file ?----------------
  237.          xor eax,eax
  238.          mov ax,[esi]
  239.          mov [type],ax
  240.  
  241.          cmp [type],'GI'
  242.          jne no_gif_file
  243.  
  244.          add esi,6
  245.          xor eax,eax
  246.          xor ebx,ebx
  247.          mov ax,word[esi]
  248.          mov bx,word[esi+2]
  249.          mov [Picture_SizeX],eax
  250.          mov [Picture_SizeY],ebx
  251.  
  252.          jmp exit_type
  253.  
  254.          no_gif_file:
  255.  
  256.          jmp no_unpakcing_file
  257.  
  258.          exit_type:
  259.  
  260.          ;----------------------------------------------------------
  261.          ;Get momory for unpacking picture and for picture's bufers
  262.          ;----------------------------------------------------------
  263.          call GetMemory
  264.          ;----------------------------------------------------------
  265.          ;--------------------Load file in memory-------------------
  266.          ;----------------------------------------------------------
  267.  
  268.          mov eax,file_path
  269.          mov ebx,[PointerToCopyPicture]
  270.          add ebx,1000
  271.  
  272.          call load_file
  273.  
  274.          ;----------------------------------------------------------
  275.          ;-------------------Unpacking picture----------------------
  276.          ;----------------------------------------------------------
  277.          mov esi,[PointerToCopyPicture]
  278.          add esi,1000
  279.          mov edi,[PointerToPicture]
  280.          mov eax,[ScreenPointer]
  281.  
  282.          cmp [type],'BM'
  283.          jne no_unpakcing_bmp_file
  284.             ;BMP DECODER
  285.             call bmptoimg
  286.             mov [save_flag],1
  287.                 jmp     draw_1
  288.                
  289.          no_unpakcing_bmp_file:
  290.  
  291.  
  292.          cmp [type],'GI'
  293.          jne no_unpakcing_file
  294.            ;GIF DECODER
  295.            sub edi,8
  296.            call ReadGIF
  297.            mov [save_flag],1
  298.          no_unpakcing_file:
  299.  
  300.          call load_icons
  301. draw_1:
  302.          call drawwin
  303.  
  304.          open_2:
  305.  
  306.          mov [Scroll1CoordinatX],9
  307.          mov [Scroll2CoordinatY],89
  308.          and [number_panel],0
  309.          and [number_menu],0
  310.  
  311.          jmp still
  312.  
  313.          no_open:
  314.  
  315.          ;<<<<<<<<<<<SAVE>>>>>>>>>>>>
  316.          cmp [number_menu],3
  317.          jne no_save_
  318.  
  319.          mov al,[save_flag]
  320.  
  321.          test al,al
  322.          jz no_save_file
  323.  
  324.          jmp save_enter
  325.  
  326.          no_save_file:
  327.  
  328.          and [number_panel],0
  329.          and [number_menu],0
  330.  
  331.          jmp still
  332.  
  333.          no_save_:
  334.  
  335.          ;<<<<<<<<<SAVE AS>>>>>>>>>>>
  336.          cmp [number_menu],4
  337.          jne no_save
  338.  
  339. ;        savedialog drawwin,save1,save2,file_path
  340. ;---------------------------------------------------------------------
  341. ; replace extension to '.bmp'
  342.         push    eax esi
  343.         mov     esi,[OpenDialog_data.filename_area]
  344.         xor     eax,eax
  345.         cld
  346. @@:
  347.         lodsb
  348.         test    eax,eax
  349.         jnz     @r
  350.         sub esi,5
  351.         cmp     [esi],byte '.'
  352.         jne     @f
  353.         mov [esi],dword '.bmp'
  354. @@:
  355.         pop     esi eax
  356. ;---------------------------------------------------------------------
  357.         mov     [OpenDialog_data.type],1 ; save
  358.        
  359.         push    dword OpenDialog_data
  360.         call    [OpenDialog_Start]
  361.        
  362.         cmp     [OpenDialog_data.status],1
  363.         jne     still
  364. ;---------------------------------------------------------------------
  365.  
  366.          save1:
  367.  
  368.          save_enter:
  369.          mov eax,40
  370.          mov ebx,100111b
  371.          mcall
  372.  
  373.          call analizing_picture_to_palette
  374.          ;eax => number of colors in picture
  375.          mov ebx,[PointerToPicture]
  376.          mov ecx,[PointerToEditBufer]
  377.          mov edx,[PointerToPalette]
  378.          mov esi,[Picture_SizeX]
  379.          mov edi,[Picture_SizeY]
  380.  
  381.          call coding_bmp
  382.  
  383.          mov eax,file_path
  384.          mov ecx,ebx
  385.          mov ebx,[PointerToEditBufer]
  386.          push eax
  387.          push ebx
  388.          push ecx
  389.  
  390.          call save_file
  391.  
  392.          mov [save_flag],1
  393.          and [number_panel],0
  394.          and [number_menu],0
  395.          call drawwin
  396.  
  397.          jmp still
  398.  
  399.          save2:
  400.  
  401.          and [number_panel],0
  402.          and [number_menu],0
  403.  
  404.          jmp still
  405.          no_save:
  406.  
  407.          ;<<<<<<EXIT>>>>>>>
  408.          cmp [number_menu],5
  409.          jne no_exit_program
  410.  
  411.          mov eax,-1
  412.          mcall
  413.  
  414.          no_exit_program:
  415.  
  416.          no_file:
  417.  
  418.          ;|||||||||||||||||||||||||||||EDIT|||||||||||||||||||||||||
  419.  
  420.          ;<<<<<<<<<<UNDO>>>>>>>>>>
  421.          cmp [number_panel],6
  422.          jne no_edit
  423.  
  424.          cmp [number_menu],1
  425.          jne no_undo
  426.  
  427.          cmp [number_undo],1
  428.          jne no_one____
  429.  
  430.          mov esi,[PointerToCopyPicture]
  431.  
  432.          no_one____:
  433.  
  434.          cmp [number_undo],2
  435.          jne no_two____
  436.  
  437.          mov esi,[PointerToCopyPicture2]
  438.  
  439.          no_two____:
  440.  
  441.          mov edi,[PointerToPicture]
  442.          mov ecx,[Picture_SizeX]
  443.          imul ecx,[Picture_SizeY]
  444.          lea ecx,[ecx+ecx*2]
  445.          add ecx,4
  446.          shr ecx,2
  447.          cld
  448.          rep movsd
  449.          call MovePictureToWorkScreen
  450.  
  451.          dec [number_undo]
  452.          jnz no_null_undo
  453.  
  454.          mov [number_undo],1
  455.  
  456.          no_null_undo:
  457.  
  458.          and [number_panel],0
  459.          and [number_menu],0
  460.          jmp still
  461.          no_undo:
  462.  
  463.          ;<<<<<<<<<<COPY>>>>>>>>>>
  464.  
  465.          cmp [number_menu],2
  466.          jne no_copy
  467.  
  468.          cmp [instrument_used],1
  469.          jne no_copy
  470.          cmp [Activate_instrument],0
  471.          jne no_copy
  472.  
  473.         mov eax,[OldX]
  474.         mov ebx,[OldY]
  475.  
  476.         cmp eax,[rectangular_shade_x]
  477.         jl no_remove_x_copy
  478.  
  479.         mov ecx,[rectangular_shade_x]
  480.         mov [OldX],ecx                    ; OldX <-----> rectangulare_shade_x
  481.         mov [rectangular_shade_x],eax
  482.  
  483.         no_remove_x_copy:
  484.  
  485.         cmp ebx,[rectangular_shade_y]
  486.         jl no_remove_y_copy
  487.  
  488.         mov ecx,[rectangular_shade_y]
  489.         mov [OldY],ecx                    ; OldY <-----> rectangulare_shade_y
  490.         mov [rectangular_shade_y],ebx
  491.  
  492.         no_remove_y_copy:
  493.  
  494.          mov eax,[OldX]
  495.          mov ebx,[OldY]
  496.          mov ecx,[rectangular_shade_x]
  497.          mov edx,[rectangular_shade_y]
  498.          inc eax
  499.          inc ebx
  500.          dec ecx
  501.          dec edx
  502.  
  503.          mov [x],eax
  504.          mov [y],ebx
  505.          mov esi,eax
  506.          mov edi,ebx
  507.          mov [Dx_],1
  508.          mov [Dy_],1
  509.  
  510.          sub ecx,eax
  511.          jnz no_signum_fill_r_x_copy
  512.  
  513.          mov [Dx_],-1
  514.  
  515.          no_signum_fill_r_x_copy:
  516.  
  517.          sub edx,ebx
  518.          jnz no_signum_fill_r_y_copy
  519.  
  520.          mov [Dy_],-1
  521.  
  522.          no_signum_fill_r_y_copy:
  523.  
  524.          mov ebx,[rectangular_shade_y]
  525.          sub ebx,edi
  526.  
  527.          mov edx,[PointerToEditBufer]
  528.          mov [y],edi
  529.          loop_fill_rectangle_y_copy:
  530.  
  531.          mov [x],esi
  532.          loop_fill_rectangle_x_copy:
  533.  
  534.          push esi
  535.          push edi
  536.  
  537.          mov eax,[PointerToPicture]
  538.          mov ebx,[Picture_SizeX]
  539.          mov esi,[x]
  540.          mov edi,[y]
  541.          call GetColorOfPixel
  542.  
  543.          mov [edx],ax
  544.          shr eax,16
  545.          mov [edx+2],al
  546.  
  547.          pop edi
  548.          pop esi
  549.  
  550.          add edx,3
  551.  
  552.          mov eax,[x]
  553.          add eax,[Dx_]
  554.          mov [x],eax
  555.  
  556.          cmp eax,[rectangular_shade_x]
  557.          jl loop_fill_rectangle_x_copy
  558.  
  559.          mov eax,[y]
  560.          add eax,[Dy_]
  561.          mov [y],eax
  562.  
  563.          cmp eax,[rectangular_shade_y]
  564.          jl loop_fill_rectangle_y_copy
  565.  
  566.          call MovePictureToWorkScreen
  567.  
  568.          and [number_panel],0
  569.          and [number_menu],0
  570.          mov [DrawSprite_flag],1
  571.  
  572.          jmp still
  573.  
  574.          no_copy:
  575.  
  576.          ;<<<<<<<<<<PASTE>>>>>>>>
  577.          cmp [number_menu],3
  578.          jne no_paste
  579.  
  580.          cmp [instrument_used],1
  581.          jne no_paste
  582.  
  583.          cmp [Activate_instrument],0
  584.          jne no_paste
  585.  
  586.          mov eax,[OldX]
  587.          mov ebx,[OldY]
  588.  
  589.          cmp eax,[rectangular_shade_x]
  590.          jl no_remove_x_paste
  591.  
  592.          mov ecx,[rectangular_shade_x]
  593.          mov [OldX],ecx                    ; OldX <-----> rectangulare_shade_x
  594.          mov [rectangular_shade_x],eax
  595.  
  596.          no_remove_x_paste:
  597.  
  598.          cmp ebx,[rectangular_shade_y]
  599.          jl no_remove_y_paste
  600.  
  601.          mov ecx,[rectangular_shade_y]
  602.          mov [OldY],ecx                    ; OldY <-----> rectangulare_shade_y
  603.          mov [rectangular_shade_y],ebx
  604.  
  605.          no_remove_y_paste:
  606.  
  607.          mov eax,[OldX]
  608.          mov ebx,[OldY]
  609.          mov ecx,[rectangular_shade_x]
  610.          mov edx,[rectangular_shade_y]
  611.          inc eax
  612.          inc ebx
  613.          dec ecx
  614.          dec edx
  615.  
  616.          mov [x],eax
  617.          mov [y],ebx
  618.          mov esi,eax
  619.          mov edi,ebx
  620.          mov [Dx_],1
  621.          mov [Dy_],1
  622.  
  623.          sub ecx,eax
  624.          jnz no_signum_fill_r_x_paste
  625.  
  626.          mov [Dx_],-1
  627.  
  628.          no_signum_fill_r_x_paste:
  629.  
  630.          sub edx,ebx
  631.          jnz no_signum_fill_r_y_paste
  632.  
  633.          mov [Dy_],-1
  634.  
  635.          no_signum_fill_r_y_paste:
  636.  
  637.          mov edx,[PointerToEditBufer]
  638.          mov [y],edi
  639.  
  640.          loop_fill_rectangle_y_paste:
  641.  
  642.          mov [x],esi
  643.          loop_fill_rectangle_x_paste:
  644.  
  645.          push esi
  646.          push edi
  647.  
  648.          mov ecx,[edx]
  649.          and ecx,0xffffff ;color
  650.  
  651.          mov eax,[PointerToPicture]
  652.          mov ebx,[Picture_SizeX]
  653.          mov esi,[x]
  654.          mov edi,[y]
  655.          call PutPixel
  656.  
  657.          pop edi
  658.          pop esi
  659.  
  660.          add edx,3
  661.  
  662.          mov eax,[x]
  663.          add eax,[Dx_]
  664.          mov [x],eax
  665.          cmp eax,[rectangular_shade_x]
  666.          jl loop_fill_rectangle_x_paste
  667.  
  668.          mov eax,[y]
  669.          add eax,[Dy_]
  670.          mov [y],eax
  671.          cmp eax,[rectangular_shade_y]
  672.  
  673.          jl loop_fill_rectangle_y_paste
  674.  
  675.          call MovePictureToWorkScreen
  676.          and [number_panel],0
  677.          and [number_menu],0
  678.          mov [Paste_flag],1
  679.  
  680.          jmp still
  681.  
  682.          no_paste:
  683.  
  684.          ;<<<<<<<<<<CUT>>>>>>>>>>
  685.          cmp [number_menu],4
  686.          jne no_cut
  687.  
  688.          cmp [instrument_used],1
  689.          jne no_cut
  690.  
  691.          cmp [Activate_instrument],0
  692.          jne no_cut
  693.  
  694.          mov eax,[OldX]
  695.          mov ebx,[OldY]
  696.  
  697.          cmp eax,[rectangular_shade_x]
  698.          jl no_remove_x_cut
  699.  
  700.          mov ecx,[rectangular_shade_x]
  701.          mov [OldX],ecx                    ; OldX <-----> rectangulare_shade_x
  702.          mov [rectangular_shade_x],eax
  703.  
  704.          no_remove_x_cut:
  705.  
  706.          cmp ebx,[rectangular_shade_y]
  707.          jl no_remove_y_cut
  708.  
  709.          mov ecx,[rectangular_shade_y]
  710.          mov [OldY],ecx                    ; OldY <-----> rectangulare_shade_y
  711.          mov [rectangular_shade_y],ebx
  712.  
  713.          no_remove_y_cut:
  714.  
  715.          mov eax,[OldX]
  716.          mov ebx,[OldY]
  717.          mov ecx,[rectangular_shade_x]
  718.          mov edx,[rectangular_shade_y]
  719.          inc eax
  720.          inc ebx
  721.          dec ecx
  722.          dec edx
  723.  
  724.          mov [x],eax
  725.          mov [y],ebx
  726.          mov esi,eax
  727.          mov edi,ebx
  728.          mov [Dx_],1
  729.          mov [Dy_],1
  730.  
  731.          sub ecx,eax
  732.          jnz no_signum_fill_r_x
  733.  
  734.          mov [Dx_],-1
  735.  
  736.          no_signum_fill_r_x:
  737.  
  738.          sub edx,ebx
  739.          jnz no_signum_fill_r_y
  740.  
  741.          mov [Dy_],-1
  742.  
  743.          no_signum_fill_r_y:
  744.  
  745.          mov [y],edi
  746.          loop_fill_rectangle_y:
  747.  
  748.          mov [x],esi
  749.          loop_fill_rectangle_x:
  750.  
  751.          push esi
  752.          push edi
  753.  
  754.          mov eax,[PointerToPicture]
  755.          mov ebx,[Picture_SizeX]
  756.          mov ecx,dword 0xffffff
  757.          mov esi,[x]
  758.          mov edi,[y]
  759.          call PutPixel
  760.  
  761.          pop edi
  762.          pop esi
  763.  
  764.          mov eax,[x]
  765.          add eax,[Dx_]
  766.          mov [x],eax
  767.  
  768.          cmp eax,[rectangular_shade_x]
  769.          jl loop_fill_rectangle_x
  770.  
  771.          mov eax,[y]
  772.          add eax,[Dy_]
  773.          mov [y],eax
  774.  
  775.          cmp eax,[rectangular_shade_y]
  776.          jl loop_fill_rectangle_y
  777.  
  778.          call MovePictureToWorkScreen
  779.  
  780.          and [number_panel],0
  781.          and [number_menu],0
  782.  
  783.          jmp still
  784.          no_cut:
  785.  
  786.          ;<<<<<<CLEARE ALL>>>>>>
  787.          cmp [number_menu],5
  788.          jne no_cleare_all
  789.  
  790.          call cleare_work_arrea
  791.  
  792.          call MovePictureToWorkScreen
  793.  
  794.          and [number_panel],0
  795.          and [number_menu],0
  796.  
  797.          jmp still
  798.          no_cleare_all:
  799.          ;<<<<<<TO ALLOCATE ALL>>>>>>
  800.  
  801.          cmp [number_menu],6
  802.          jne no_to_allocate_all
  803.  
  804.          mov [OldX],1
  805.          mov [OldY],1
  806.          mov eax,[Picture_SizeX]
  807.          mov ebx,[Picture_SizeY]
  808.          dec eax
  809.          dec ebx
  810.          mov [rectangular_shade_x],eax
  811.          mov [rectangular_shade_y],ebx
  812.          mov [instrument_used],1
  813.          mov [Activate_instrument],1
  814.          mov [Current_instrument],30
  815.          mov [crossing],0
  816.          and [number_panel],0
  817.          and [number_menu],0
  818.          ;call TakeButtonInstruments
  819.          ;call MovePictureToWorkScreen
  820.          jmp still
  821.  
  822.          no_to_allocate_all:
  823.  
  824.          no_edit:
  825.  
  826.  
  827.          jmp still
  828.  
  829.          ret
  830.