Subversion Repositories Kolibri OS

Rev

Rev 1608 | Rev 1685 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;
  2. ;   Screenshooter for Kolibri
  3. ;
  4. ; version:      1.0
  5. ; last update:  08/09/2010
  6. ; written by:   Marat Zakiyanov aka Mario79, aka Mario
  7. ; changes:      select path for save with OpenDialog,
  8. ;               bag fix for threads stacks
  9. ;---------------------------------------------------------------------
  10. ; 01.06.09 - Š®¬¯®­¥­âë ¡¥àãâìáï ¨§ á¨á⥬­®© ¡¨¡«¨®â¥ª¨ <Lrz>
  11. ; €¢â®à ¯à®£à ¬¬ë …¢â¨å®¢ Œ ªá¨¬ (Maxxxx32)
  12. ; 24.07.2008 <Lrz> ®¡­®¢«¥­ editbox
  13. ; 01.02.07 - ®¡­®¢«ñ­ editbox
  14. ; 31.01.07 - ¢áñ ⥯¥àì à¨áã¥âáï ®â­®á¨â¥«ì­® ª«¨¥­â᪮© ®¡« áâ¨
  15.  
  16. title equ 'Screenshooter v 1.0' ; ‡ £®«®¢®ª ®ª­ 
  17. include '../../develop/libraries/box_lib/load_lib.mac'
  18. include '../../develop/libraries/box_lib/trunk/box_lib.mac'
  19. ;include '../../develop/examples/editbox/trunk/editbox.inc'
  20. include '../../macros.inc'
  21. include 'txtbut.inc'
  22. include 'label.inc'
  23. include 'textwork.inc'
  24. include 'scrshoot.mac'
  25.  
  26. ;include 'macros.inc'  ; ¢áâ ¢«ï¥¬ ¬ ªà®áë
  27. ;        meos_header  cmdstr ; ¢áâ ¢«ï¥¬ § £®«®¢®ª ¯à®£à ¬¬ë
  28. use32                
  29.     org 0x0
  30.     db 'MENUET01'
  31.     dd 0x1
  32.     dd start
  33.     dd IM_END
  34.     dd i_end
  35.     dd stacktop
  36.     dd cmdstr
  37.     dd cur_dir_path
  38.  
  39. align 4
  40.         @use_library
  41.         use_txt_button                          ;  |
  42.         use_label                               ;  |-- GUI ª®¬¯®­¥­âë ¨ ­¥ª®â®àë¥ ¯à®æ¥¤ãàë
  43.         use_text_work                           ; /
  44. include 'scrwin.inc'  ; ¢áâ ¢«ï¥¬ ª®¤ ®ª­  ¯à¤¯à®á¬®âà 
  45. include 'scrsavef.inc'; ¢áâ ¢«ï¥¬ ¯à®æ¥¤ãàã á®åà ­¥­¨ï ä ©« 
  46.  
  47. include 'gp.inc'
  48. include 'srectwin.inc'
  49. include 'lang.inc'
  50.  
  51. macro get_sys_colors col_buf
  52. {
  53.         ;mov     eax,48
  54.         push    48
  55.         pop     eax
  56.         ;mov     ebx,3
  57.         push    3
  58.         pop     ebx
  59.         ;mov     ecx,col_buf
  60.         push    col_buf
  61.         pop     ecx
  62.         ;mov     edx,40
  63.         push    40
  64.         pop     edx
  65.         mcall
  66. }
  67.  
  68. ;--- ­ ç «® ¯à®£à ¬¬ë ---
  69. align 4
  70. start:
  71. ;sys_load_library  library_name, cur_dir_path, library_path, system_path, \
  72. ;err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
  73.  
  74. load_libraries l_libs_start,end_l_libs
  75.  
  76. ;if return code =-1 then exit, else nornary work
  77. ;        cmp     eax,-1
  78.         inc     eax
  79.         test    eax,eax
  80.         jz      close
  81. ;;;;;;;;;;;;;;;; init memory 68/11
  82.         mov     eax,68
  83.         mov     ebx,11
  84.         mcall
  85.         test    eax,eax
  86.         jz      close
  87.  
  88. ;--------------------------------------------------------------------- 
  89.         mov     edi,filename_area
  90.         mov     esi,start_temp_file_name
  91.         xor     eax,eax
  92.         cld
  93. @@:
  94.         lodsb
  95.         stosb
  96.         test    eax,eax
  97.         jnz     @b
  98.  
  99.  
  100.         mov     edi,fname_buf
  101.         mov     esi,ed_buffer.1
  102.         xor     eax,eax
  103.         cld
  104. @@:
  105.         lodsb
  106.         stosb
  107.         test    eax,eax
  108.         jnz     @b
  109.        
  110. ;OpenDialog     initialisation
  111.         push    dword OpenDialog_data
  112.         call    [OpenDialog_Init]
  113.  
  114. ; prepare for PathShow
  115.         push    dword PathShow_data_1
  116.         call    [PathShow_prepare]
  117. ;--------------------------------------------------------------------- 
  118.         ;mov     al,[gs:1280*4*1024]
  119.                     ; ãáâ ­ ¢«¨¢ ¥¬ ipc ¡ãää¥à
  120.         push    60
  121.         pop     eax
  122.         ;mov     ebx,1
  123.         xor     ebx,ebx
  124.         inc     ebx
  125.         mov     ecx,app_ipc
  126.         mov     edx,32
  127.         mcall
  128.  
  129.         push    66   ; ãáâ ­ ¢«¨¢ ¥¬ £«®¡ «ì­ãî £®àïçãî ª« ¢¨èã
  130.         pop     eax
  131.         push    eax
  132.         mov     ebx,4
  133.         mov     cl,55    ; 55 - PrintScrn
  134.         xor     edx,edx
  135.         mcall
  136.  
  137.         mov     ebx,app
  138.         call    get_slot_n
  139.         mov     [slot_n],ecx
  140.  
  141.         ; ãáâ ­ ¢«¨¢ ¥¬ ¬ áªã ᮡë⨩
  142.         set_events_mask (evm_redraw+evm_key+evm_button+evm_mouse+evm_ipc)
  143.  
  144. ; á ¯à룠¥¬ ¯à¨ ª ¦¤®© ¯¥à¥à¨á®¢ª¥
  145. red:
  146.         get_procinfo app   ; ¯®«ãç ¥¬ ¨­ä®à¬ æ¨î ® ¯à®æ¥áá¥
  147.         get_sys_colors sc  ; ¯®«ãç ¥¬ á¨á⥬­ë¥ 梥â 
  148.  
  149.         ; ãáâ ­ ¢«¨¢ ¥¬ á¨á⥬­ë¥ æ¢¥â  ã GUI ª®¬¯®­¥­â®¢
  150.         txt_but_set_sys_color buttons,buttons_end,sc             ; \
  151.         labels_set_sys_color labels,labels_end,sc                ; |
  152.         check_boxes_set_sys_color check_boxes,check_boxes_end,sc ; |
  153.         edit_boxes_set_sys_color editboxes,editboxes_end,sc      ; /
  154.  
  155.         get_screen_prop scr ; ¯®«ãç ¥¬ ¨­ä®à¬ æ¨î ®¡ íªà ­¥
  156.         call    draw_window ; ¯¥à¥à¨á®¢ë¢ ¥¬ ®ª­®
  157. still:
  158.         wait_event red,key,button,mouse,ipc,still ; ¦¤¥¬ ᮡë⨩
  159.  
  160. key:
  161.         get_key
  162.         cmp     al,2
  163.         jne     @f
  164.         cmp     ah,55
  165.         jne     still
  166.         mov     [PrintScreen],1
  167.         call    shoot
  168.         mov     [PrintScreen],0
  169.         jmp     still
  170. @@:
  171. ;        key_edit_boxes editboxes,editboxes_end
  172. ;       push    dword edit1
  173. ;       call    [edit_box_key]
  174.  
  175.         push    dword edit2
  176.         call    [edit_box_key]
  177.  
  178.         push    dword edit3
  179.         call    [edit_box_key]
  180.  
  181.         push    dword edit4
  182.         call    [edit_box_key]
  183.  
  184.         jmp     still
  185. button:
  186.         get_pressed_button
  187.         cmp     ah,1
  188.         je      p_close
  189.         txt_but_ev buttons,buttons_end
  190.         jmp     still
  191. mouse:
  192.         get_active_window
  193.         cmp     eax,[slot_n]
  194.         jne     still
  195. ;----------------------------------
  196. ;       push    dword edit1
  197. ;       call    [edit_box_mouse]
  198.         push    dword edit2
  199.         call    [edit_box_mouse]
  200.         push    dword edit3
  201.         call    [edit_box_mouse]
  202.         push    dword edit4
  203.         call    [edit_box_mouse]
  204. ;----------------------------------
  205.         push    dword ch1
  206.         call    [check_box_mouse]
  207.         push    dword ch2
  208.         call    [check_box_mouse]
  209.         push    dword ch3
  210.         call    [check_box_mouse]
  211.         push    dword ch4
  212.         call    [check_box_mouse]
  213.         push    dword ch5
  214.         call    [check_box_mouse]
  215.         push    dword ch6
  216.         call    [check_box_mouse]
  217.         push    dword use_rect
  218.         call    [check_box_mouse]
  219. ;-----------------------------------
  220. ;        mouse_check_boxes check_boxes,check_boxes_end
  221. ;        mouse_edit_boxes editboxes,editboxes_end
  222.         jmp     still
  223. ipc:
  224.         cmp     word [app_ipc+8],2
  225.         jne     @f
  226.         min_window
  227.         jmp     .clear_ipc
  228. @@:
  229.         cmp     word [app_ipc+8],3
  230.         jne     @f
  231.         mov     ecx,[slot_n]
  232.         activ_window
  233.         jmp     .clear_ipc
  234. @@:
  235.         call    draw_number
  236.         call    dr_st
  237.  
  238. .clear_ipc:
  239.         cld
  240.         xor     eax,eax
  241.         mov     ecx,32/4
  242.         mov     edi,app_ipc
  243.         rep     stosd
  244.         jmp     still
  245.  
  246. p_close:
  247.         btr     dword [flags],1
  248.  
  249.         bt      dword [flags],3
  250.         jnc     @f
  251.         mov    eax,18
  252.         mov     ebx,eax
  253.         mov     ecx,[set_rect_window_pid]
  254.         mcall
  255. @@:
  256.  
  257. close:
  258.         app_close
  259.  
  260. ;---------------------------------------------------------------------
  261. draw_PathShow:
  262.         pusha
  263.         mcall   13,<4,302>,<35,15>,0xffffff
  264. ; draw for PathShow
  265.         push    dword PathShow_data_1
  266.         call    [PathShow_draw]
  267.         popa
  268.         ret
  269. ;--------------------------------------------------------------------
  270. ;--- ¯à®®æ¥¤ãà  ¯¥à¥à¨á®¢ª¨ £« ¢­®£® ®ª­  ---------------------------
  271. ;--------------------------------------------------------------------
  272. draw_window:
  273. start_draw_window        ; ­ ç «® ¯¥à¥à¨á®¢ª¨
  274.         ; ®¯à¥¤¥«ï¥¬ ®ª­®
  275.         get_skin_height
  276.         mov     ebx,100*65536+320
  277.         mov     ecx,100*65536+220
  278.         add     cx,ax
  279.         mov     edx,[sc.work]
  280.         or      edx,0x34000000;0x33000000
  281.         xor     esi,esi
  282.         ;xor     edi,edi
  283.         mov     edi,grab_text
  284.         xor     eax,eax
  285.         mcall
  286.  
  287.         mov     eax,47             ; ¢ë¢®¤¨¬ ç¨á«  ¢ ®ª­®
  288.         mov     bx,4
  289.         shl     ebx,16
  290.         movsx   ecx,word [scr.width] ; è¨à¨­  íªà ­ 
  291.         mov     dx,95
  292.         shl     edx,16
  293.         mov     dx,[label1.top]
  294.         push    dx
  295.         mov     esi,[sc.work_text]
  296.         mcall
  297.         movsx   ecx,word [scr.height]   ; ¢ëá®â  íªà ­ 
  298.         mov     dx,[label2.top]
  299.         mcall
  300.         mov     bx,2
  301.         shl     ebx,16
  302.         movsx   ecx,word [scr.bitspp]   ; ¡¨â ­  ¯¨ªá¥«ì
  303.         mov     dx,240
  304.         shl     edx,16
  305.         pop     dx
  306.         mcall
  307.         mov     bx,6
  308.         shl     ebx,16
  309.         mov     ecx,[scr.bytesps]       ; ¡ ©â ­  áâபã
  310.         mov     dx,[label2.top]
  311.         mcall
  312.  
  313.         call    draw_number      ; ¯à®à¨á®¢ë¢ ¥¬ ­®¬¥à á­¨¬ª 
  314.         call    dr_st
  315.  
  316.         draw_labels labels,labels_end            ; ¬¥âª¨
  317. ;        draw_edit_boxes editboxes,editboxes_end  ; edit_box
  318. ;------ show check editbox -----------
  319. ;       push    dword edit1
  320. ;       call    [edit_box_draw]
  321.         push    dword edit2                                                                                                  
  322.         call    [edit_box_draw]
  323.         push    dword edit3
  324.         call    [edit_box_draw]
  325.         push    dword edit4
  326.         call    [edit_box_draw]
  327. ;------ end check all editbox -------
  328.  
  329.         call    draw_PathShow
  330.  
  331.         draw_txt_buttons buttons,buttons_end     ; ª­®¯ª¨
  332. ;        draw_check_boxes check_boxes,check_boxes_end ; ä« ¦ª¨
  333. ;------ check all checkbox ---------
  334.         push    dword ch1
  335.         call    [check_box_draw]
  336.         push    dword ch2
  337.         call    [check_box_draw]       
  338.         push    dword ch3
  339.         call    [check_box_draw]
  340.         push    dword ch4
  341.         call    [check_box_draw]
  342.         push    dword ch5
  343.         call    [check_box_draw]
  344.         push    dword ch6
  345.         call    [check_box_draw]
  346.         push    dword use_rect
  347.         call    [check_box_draw]
  348. ;------ end check all checkbox ------
  349.  
  350. stop_draw_window      ; ª®­¥æ ¯¥à¥à¨á®¢ª¨
  351. ret
  352.  
  353. shoot:
  354.         bt      dword [ch4.flags],1   ; ¢ª«î祭  «¨ § ¤¥à¦ª  ?
  355.         jnc     @f
  356.         draw_status delay_now
  357.         mov     edi,ed_buffer.2
  358.         call    zstr_to_int
  359.         mov     ebx,eax
  360.         delay
  361. @@:
  362.         call    get_mem_for_shoot; ¯®«ãç ¥¬ ¯ ¬ïâì ¤«ï á­¨¬ª 
  363.  
  364.  
  365.         bts     dword [flags],0       ; ­ã«¥¢®© ä« £ - á­¨¬®ª ¥áâì ¢ ¯ ¬ïâ¨
  366.  
  367.         ; ¤¥« ¥¬ á­¨¬®ª
  368.         draw_status shooting
  369.         mov     esi,scr
  370.         mov     edi,[scr_buf.ptr]
  371.         call    copy_screen_to_image
  372.  
  373.         bt      dword [use_rect.flags],1
  374.         jc      .use_rect
  375.         push    dword [scr]
  376.         jmp     @f
  377. .use_rect:
  378.         push    dword [rect.height]
  379. @@:
  380.         pop     dword [scr_buf.size]
  381.  
  382.         cmp     [autoshoot_flag],1
  383.         jne     .2
  384.        
  385.         bt      dword [ch5.flags],1  ; ¢ª«î祭® «¨  ¢â®á®åà ­¥­¨¥ ?
  386.         jnc     @f
  387.         call    save_file
  388. @@:
  389.         draw_status     shooted_ok
  390. .2:
  391.         bt      dword [flags],1
  392.         jnc     @f
  393.         ret
  394. @@:
  395.  
  396.         bt      dword [ch2.flags],1  ; ¯®ª § âì ®ª­® ¯à¥¤¯à®á¬®âà  ?
  397.         jnc     @f
  398.         cmp     [PrintScreen],0
  399.         jne     @f
  400.         call    show_scr_window
  401.         ret
  402. @@:
  403.         bt      dword [ch5.flags],1  ; ¢ª«î祭® «¨  ¢â®á®åà ­¥­¨¥ ?
  404.         jnc     @f
  405.        
  406. ; invoke OpenDialog
  407.         push    dword OpenDialog_data
  408.         call    [OpenDialog_Start]
  409.         cmp     [OpenDialog_data.status],1
  410.         je      .1
  411.         ret
  412. .1:
  413. ; prepare for PathShow
  414.         push    dword PathShow_data_1
  415.         call    [PathShow_prepare]
  416.  
  417.         call    save_file
  418. @@:
  419.        
  420.         bt      word [ch3.flags],1   ; ¢®ááâ ­®¢¨âì ®ª­® ?
  421.         jnc     @f
  422.  
  423.         delay 100
  424.         mov     ecx,[slot_n]
  425.         activ_window
  426. @@:
  427. ret
  428.  
  429. ;--- ¯®«ãç¨âì ¯ ¬ïâì ¤«ï á­¨¬ª  ---
  430. get_mem_for_shoot:
  431. ;clean memory
  432.         mov     ecx,dword [scr_buf.ptr]
  433.         mov     ebx,13
  434.         mov     eax,68
  435.         mcall
  436.  
  437.         bt      dword [use_rect.flags],1 ; ä®âª âì ®¡« áâì íªà ­ 
  438.         jc      .use_area
  439.         movzx   ecx, word [scr.width]
  440.         movzx   ebx, word [scr.height]
  441.         jmp     @f
  442. .use_area:
  443.         call    read_rect
  444.         movzx   ecx, word [rect.width]
  445.         movzx   ebx, word [rect.height]
  446. @@:
  447.         imul    ecx,ebx
  448.         lea     ecx,[ecx*3]
  449. ;        add     ecx,i_end
  450.         mov     ebx,12
  451.         mov     eax,68
  452.         mcall
  453.         mov     [scr_buf.ptr],eax
  454.         add     eax,ecx
  455.         mov     [scr_buf.end_ptr],ecx
  456. ret
  457.  
  458. ;--- ᮤ âì ®ª­® ¯à®¥¤¯à®á¬®âà  ---
  459. show_scr_window:
  460. pusha
  461.         bt      dword [flags],0
  462.         jnc     @f
  463.         mov     eax,51
  464.         xor     ebx,ebx
  465.         inc     ebx
  466.         mov     ecx,scr_window
  467.         mov     edx,i_end_tread-512
  468.         mcall
  469. @@:
  470. popa
  471. ret
  472.  
  473. ;--- ¯à®ç¨â âì ¨ ­ à¨á®¢ âì ⥪ã騩 ­®¬¥à ---
  474. apply_number:
  475.         mov     edi,ed_buffer.3
  476.         call    zstr_to_int
  477.         mov     [cur_number],eax
  478.         call    draw_number
  479. ret
  480.  
  481. ;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ⥪ã饣® ­®¬¥à  ---
  482. draw_number:
  483.         mov     edi,sign_n_input
  484.         call    zstr_to_int
  485.         mov     [sign_n],al
  486.         mov     eax,13
  487.         mov     ebx,150*65536+96
  488.         mov     cx,[label9.top]
  489.         shl     ecx,16
  490.         mov     cx,10
  491.         mov     edx,[sc.work]
  492.         mcall
  493.         mov     eax,47
  494.         movsx   bx,byte [sign_n]
  495.         shl     ebx,16
  496.         mov     ecx,[cur_number]
  497.         mov     dx,150
  498.         shl     edx,16
  499.         mov     dx,[label9.top]
  500.         mov     esi,[sc.work_text]
  501.         mcall
  502. ret
  503.  
  504. ;--- ¯à®æ¥¤ãà , § ¯ã᪠îé ï ¯®â®ª  ¢â®áꥬª¨ ---
  505. start_autoshoot:
  506.         bts     dword [flags],1
  507.         jc      @f
  508.         mov     eax,51
  509.         ;mov     ebx,1
  510.         xor     ebx,ebx
  511.         inc     ebx
  512.         mov     ecx,autoshoot
  513.         mov     edx,i_end_tread
  514.         mcall
  515. @@:
  516. ret
  517.  
  518. ;--- ®áâ ­ ¢«¨¢ ¥â íâ®â ¯®â®ª ---
  519. stop_autoshoot:
  520.         btr     dword [flags],1
  521. ret
  522.  
  523. ;--- 横« ¯®â®ª   ¢â®áꥬª¨ ---
  524. autoshoot:
  525.         mov     [autoshoot_flag],1
  526.         mov     ecx,[slot_n]
  527.         activ_window
  528. .next:
  529.         bt      dword [flags],1
  530.         jnc     close
  531.         mov     eax,60
  532.         mov     ebx,2
  533.         mov     ecx,[app.pid]
  534.         mov     edx,messages.draw_number
  535.         mov     esi,2
  536.         mcall
  537.         call    shoot
  538.         jmp     autoshoot.next
  539. .close:
  540.         mov     [autoshoot_flag],0
  541.         jmp     close
  542. ;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ áâப¨ á®áâ®ï­¨ï ---
  543. ; (¤®«¦­  ¢ë§ë¢ âìáï ¯®â®ª®¬ £« ¢­®£® ®ª­ )
  544. dr_st:
  545.         mov     eax,38              ; ®â१®ª
  546.         mov     ebx,0*65536+310
  547.         mov     ecx,198*65536+198
  548.         mov     edx,[sc.work_graph]
  549.         mcall
  550.  
  551.         mov     eax,13              ; ¯®«®áª 
  552.         mov     bx,310
  553.         mov     ecx,199*65536+15
  554.         mov     edx,[sc.work]
  555.         mcall
  556.  
  557.         mov     edi,status
  558.         call    draw_label
  559. ret
  560.  
  561. ;--- ¯à®æ¥¤ãà  ¯®«ã祭¨ï ­®¬¥à  á«®â  ¯®â®ª  ---
  562. ; ¢å®¤ ebx - ¡ãää¥à 1024 ¡ ©â
  563. ; ¢ë室 ecx - ­®¬¥à á«®â 
  564. get_slot_n:
  565.         mov     eax,9
  566.         xor     ecx,ecx
  567.         dec     ecx
  568.         mcall
  569.  
  570.         mov     edx,[ebx+30]
  571.         xor     ecx,ecx
  572. @@:
  573.         mov     eax,9
  574.         inc     ecx
  575.         mcall
  576.         cmp     [ebx+30],edx
  577.         je      @f
  578.         jmp     @b
  579. @@:
  580. ret
  581.  
  582. ;--- ¯à®æ¥¤ãà , § ¯ã᪠îé ï ¯®â®ª, ¤¥« î騩 1 á­¨¬®ª ---
  583. one_shoot:
  584.         mov     ecx,one_shoot_thread
  585.         mov     edx,shoot_esp
  586.         jmp     @f
  587. ;--- ¯à®æ¥¤à , § ¯ã᪠îé ï ¯®â®ª, á®åà ­ïî騩 á­¨¬®ª ---
  588. save_shoot:
  589. ; invoke OpenDialog
  590.         push    dword OpenDialog_data
  591.         call    [OpenDialog_Start]
  592.         cmp     [OpenDialog_data.status],1
  593.         je      .1
  594.         ret
  595. .1:
  596. ; prepare for PathShow
  597.         push    dword PathShow_data_1
  598.         call    [PathShow_prepare]
  599.  
  600.         call    draw_PathShow
  601.  
  602.         mov     ecx,save_shoot_thread
  603.         mov     edx,shoot_esp
  604. @@:
  605.         bts     dword [flags],2
  606.         jc      .running
  607.         bt      dword [flags],1
  608.         jc      .running
  609.  
  610.         mov     eax,51
  611.         ;mov     ebx,1
  612.         xor     ebx,ebx
  613.         inc     ebx
  614.         mcall
  615. .running:
  616. ret
  617.  
  618. ;--- ¯®â®ª, ¤¥« î騩 1 á­¨¬®ª ---
  619. one_shoot_thread:
  620.         mov     ecx,[slot_n]
  621.         activ_window
  622.         bt      dword [ch1.flags],1   ; ¬¨­¨¬¨§¨à®¢ âì ®ª­® ?
  623.         jnc      @f
  624.         mov     eax,60
  625.         mov     ebx,2
  626.         mov     ecx,[app.pid]
  627.         mov     edx,messages.min_window
  628.         mov     esi,2
  629.         mcall
  630. @@:
  631.         call    shoot
  632.         btr     dword [flags],2
  633.         jmp     close
  634.  
  635. ;--- ¯à®æ¥¤ãà , ®â¯à ¢«ïîé ï £« ¢­®¬ã ®ª­ã á®®¡é¥­¨¥ ® ¯¥à¥à¨á®¢ª¥
  636. ; áâப¨ á®áâ®ï­¨ï ---
  637. send_draw_status:
  638.         mov     eax,60
  639.         mov     ebx,2
  640.         mov     ecx,[app.pid]
  641.         mov     edx,messages.draw_status
  642.         mov     esi,2
  643.         mcall
  644. ret
  645.  
  646. ;--- ¯®â®ª, á®åà ­ï ä ©« ---
  647. save_shoot_thread:
  648.         mov     ecx,[slot_n]
  649.         activ_window
  650.         call    save_file
  651.         btr     dword [flags],2
  652.         jmp     close
  653.  
  654. ;--- ¯à®æ¥¤ãà , § ¯ã᪠îé ï ¯®â®ª ®ª­  ãáâ ­®¢ª¨ ®¡« á⨠áꥬª¨ ---
  655. show_set_rect_window:
  656.         bts     dword [flags],3
  657.         jc      @f
  658.         mov     eax,51
  659.         xor     ebx,ebx
  660.         inc     ebx
  661.         mov     ecx,set_rect_window
  662.         mov     edx,set_rect_window_esp
  663.         mcall
  664.  
  665.         mov     [set_rect_window_pid],eax
  666. ret
  667.  
  668. @@:
  669.         mov     eax,18
  670.         mov     ebx,eax
  671.         mov     ecx,[set_rect_window_pid]
  672.         mcall
  673.         btr     dword [flags],3
  674. ret
  675.  
  676. ;--- ¯®«ã祭¨¥ ¨­ä®à¬ æ¨¨ ®¡  ªâ¨¢­®¬ ®ª­¥ ---
  677. get_active_window_info:
  678.         mov    eax,18
  679.         mov    ebx,7
  680.         mcall
  681.  
  682.         mov     ecx,eax
  683.         mov     eax,9
  684.         mov     ebx,active_app
  685.         mcall
  686. ret
  687.  
  688. ;====================================================================
  689. ;=== ¤ ­­ë¥ ¯à®£à ¬¬ë ===============================================
  690. ;====================================================================
  691. messages:
  692. .draw_number dw 0
  693. .draw_status dw 1
  694. .min_window  dw 2
  695. .act_window  dw 3
  696.  
  697. grab_text:
  698.         db      title,0
  699.  
  700. labels:
  701. label1 label 5,5,0,text.1   ; è¨à¨­  íªà ­ 
  702. label2 label 5,15,0,text.2   ; ¢ëá®â  íªà ­ 
  703. label3 label 5,25,0,text.3   ; ¢¢¥¤¨â¥ ¨¬ï ä ©« 
  704. label4 label 150,5,0,text.4  ; ¡¨â ­  ¯¨ªá¥«ì
  705. label5 label 150,15,0,text.5  ; ¡ ©â ­  áâபã
  706. label6 label 115,138,0,text.6  ; 100 = 1 ᥪ.
  707. ;label7 label 10,190,0,text.7
  708. ;label8 label 10,225,0,text.8
  709. label9 label 5,52,0,text.9   ; ­®¬¥à ⥪ã饣® ᨬª 
  710. label10 label 5,185,0,text.10
  711. status label 5,201,0,no_shoot
  712. labels_end:
  713.  
  714. ;---------------------------------------------------------------------
  715. l_libs_start:
  716.  
  717. library01  l_libs system_dir_Boxlib+9, cur_dir_path, library_path, system_dir_Boxlib, \
  718. err_message_found_lib1, head_f_l, Box_lib_import, err_message_import1, head_f_i
  719.  
  720. library02  l_libs system_dir_ProcLib+9, cur_dir_path, library_path, system_dir_ProcLib, \
  721. err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i
  722.  
  723. end_l_libs:
  724. ;---------------------------------------------------------------------
  725. editboxes:
  726. ;edit1 edit_box 300,5,35,cl_white,0,0,0,0,300,ed_buffer.1,mouse_dd,ed_focus,10,10       ; ¯ãâì ª ä ©«ã
  727. edit2 edit_box 35,75,134,cl_white,0,0,0,0,9,ed_buffer.2,mouse_dd,ed_figure_only,3,3         ; § ¤¥à¦ª 
  728. edit3 edit_box 35,165,164,cl_white,0,0,0,0,9,ed_buffer.3,mouse_dd,ed_figure_only    ;  ¢â®­ã¬¥à æ¨ï
  729. edit4 edit_box 16,165,181,cl_white,0,0,0,0,1,sign_n_input,mouse_dd,ed_figure_only,1
  730. editboxes_end:
  731. ;---------------------------------------------------------------------
  732. buttons:
  733. but1 txt_button 150,5,15,65,2,0,0,but_text.1,one_shoot             ; ᤥ« âì á­¨¬®ª
  734. but2 txt_button 145,160,15,65,3,0,0,but_text.2,save_shoot          ; á®åà ­¨âì á­¨¬®ª
  735. but3 txt_button 140,115,12,120,4,0,0,but_text.3,show_scr_window    ; ¯®ª § âì á­¨¬®ª
  736. but4 txt_button 80,205,15,163,5,0,0,but_text.4,apply_number        ; ¯à¨¬¥­¨âì ­®¬¥à
  737. but5 txt_button 150,5,15,85,6,0,0,but_text.5,start_autoshoot       ; ­ ç âì  ¢â®áêñ¬ªã
  738. but6 txt_button 145,160,15,85,7,0,0,but_text.6,stop_autoshoot      ; ®áâ ­®¢¨âì  ¢â®áêñ¬ªã
  739. but7 txt_button 40,205,10,150,8,0,0,but_text.7,show_set_rect_window ; § ¤ âì ®¡« áâì
  740. buttons_end:
  741. ;---------------------------------------------------------------------
  742. check_boxes:
  743. ch1 check_box 5,105,5,11,cl_white,0,0,ch_text.1,(ch_text.2-ch_text.1),ch_flag_en  ; ᢥà­ãâì ®ª­®
  744. ch2 check_box 5,120,5,11,cl_white,0,0,ch_text.2,(ch_text.3-ch_text.2),ch_flag_en  ; § â¥¬ ᤥ« âì  ªâ¨¢­ë¬
  745. ch3 check_box 145,105,5,11,cl_white,0,0,ch_text.3,(ch_text.4-ch_text.3),ch_flag_en ; ¯®ª § âì á­¨¬®ª
  746. ch4 check_box 5,135,5,11,cl_white,0,0,ch_text.4,(ch_text.5-ch_text.4),ch_flag_en   ; § ¤¥à¦ª 
  747. ch5 check_box 5,150,5,11,cl_white,0,0,ch_text.5,(ch_text.6-ch_text.5),ch_flag_en
  748. ch6 check_box 5,165,5,11,cl_white,0,0,ch_text.6,(ch_text.7-ch_text.6),ch_flag_en
  749. use_rect check_box 145,150,5,11,cl_white,0,0,ch_text.7,(ch_text.8-ch_text.7) ; ¨á¯. ®¡« áâì
  750. ;  ¢â®­ã¬¥à æ¨ï
  751. check_boxes_end:
  752. ;---------------------------------------------------------------------
  753. if lang eq ru
  754. text:
  755. .2 db '‚ëá®â  íªà ­ :',0
  756. .1 db '˜¨à¨­  íªà ­ :',0
  757. .3 db '‚¢¥¤¨â¥ ¯®«­ë© ¯ãâì ª ä ©«ã:',0
  758. .4 db '¨â ­  ¯¨ªá¥«ì:',0
  759. .5 db ' ©â ­  áâபã:',0
  760. .6 db '100 = 1 ᥪ㭤 ',0
  761. ;.7: db '‚¢¥¤¨â¥ ¨¬ï ä ©« :',0
  762. ;.8: db '‚¬¥áâ® "*" ¢ ¨¬¥­¨ ä ©«  ¡ã¤¥â ¢áâ ¢«ïâìáï ­®¬¥à.',0
  763. .9 db '®¬¥à ⥪ã饣® á­¨¬ª :',0
  764. .10 db 'Š®«¨ç¥á⢮ §­ ª®¢ ¢ ­®¬¥à¥:',0
  765.  
  766. but_text:
  767. .1 db '‘¤¥« âì á­¨¬®ª íªà ­ ',0
  768. .2 db '‘®åà ­¨âì á­¨¬®ª íªà ­ ',0
  769. .3 db '®ª § âì á­¨¬®ª ᥩç á',0
  770. .4 db 'à¨¬¥­¨âì',0
  771. .5 db ' ç âì  ¢â®áꥬªã',0
  772. .6 db 'Žáâ ­®¢¨âì  ¢â®áꥬªã',0
  773. .7 db '§ ¤ âì',0
  774.  
  775. ch_text:
  776. .1 db '‘¢¥à­ãâì ®ª­®';,0
  777. .2 db '®ª § âì á­¨¬®ª';,0
  778. .3 db '§ â¥¬ ᤥ« âì  ªâ¨¢­ë¬';,0
  779. .4 db '‡ ¤¥à¦ª :';,0
  780. .5 db '€¢â®á®åà ­¥­¨¥';,0
  781. .6 db '€¢â®­ã¬¥à æ¨ï, ­ ç¨­ ï á';,0
  782. .7 db 'Ž¡« áâì'
  783. .8:
  784.  
  785. no_shoot db '‘­¨¬®ª ­¥ ᤥ« ­',0
  786. shooting db '”®â®£à ä¨à®¢ ­¨¥...',0
  787. shooted_ok db '‘­¨¬®ª ᤥ« ­',0
  788. saving db '‘®åà ­¥­¨¥...',0
  789. saved_ok db '‘­¨¬®ª á®åà ­¥­',0
  790. delay_now db '‡ ¤¥à¦ª ...',0
  791. bad_file_name db 'ˆ¬ï ä ©«  ¢¢¥¤¥­® ­¥¢¥à­®',0
  792. disk_filled db '„¨áª § ¯®«­¥­',0
  793. bad_fat_table db '’ ¡«¨æ  FAT à §àã襭 ',0
  794. ac_den db '„®áâ㯠§ ¯à¥é¥­',0
  795. device_er db 'Žè¨¡ª  ãáâனá⢠',0
  796. not_shooted db '‘¤¥« ©â¥ á­¨¬®ª !!!',0
  797. no_file_name db '‚¢¥¤¨â¥ ¨¬ï ä ©«  !!!',0
  798. invalid_rect db '¥¤®¯ãáâ¨¬ë¥ à §¬¥àë ®¡« áâ¨',0
  799.  
  800. else
  801. text:
  802. .2 db 'Screen width:',0
  803. .1 db 'Screen height:',0
  804. .3 db 'Enter full path to the file:',0
  805. .4 db 'Bits per pixel:',0
  806. .5 db 'Bytes per line:',0
  807. .6 db '100 = 1 second',0
  808. ;.7: db 'Enter name of file:',0
  809. ;.8: db 'Instead of "*" in filename the number will be included.',0
  810. .9 db 'Current photo number:',0
  811. .10 db 'Amount of digits in number:',0
  812.  
  813. but_text:
  814. .1 db 'Make screen photo',0
  815. .2 db 'Save screen photo',0
  816. .3 db 'Show photo now',0
  817. .4 db 'Apply',0
  818. .5 db 'Start autoshooting',0
  819. .6 db 'Stop autoshooting',0
  820. .7 db 'Set',0
  821.  
  822. ch_text:
  823. .1 db 'Minimize window';,0
  824. .2 db 'Show photo';,0
  825. .3 db 'then make active';,0
  826. .4 db 'Delay:';,0
  827. .5 db 'Autosave';,0
  828. .6 db 'Start numeration from';,0
  829. .7 db 'Area'
  830. .8:
  831.  
  832. no_shoot db 'There is no photo',0
  833. shooting db 'Photographing...',0
  834. shooted_ok db 'Photo created',0
  835. saving db 'Saving...',0
  836. saved_ok db 'Photo saved',0
  837. delay_now db 'Delay...',0
  838. bad_file_name db 'File name is wrong',0
  839. disk_filled db 'Disk is full',0
  840. bad_fat_table db 'FAT table destroyed',0
  841. ac_den db 'Access denied',0
  842. device_er db 'Device error',0
  843. not_shooted db 'Make a photo !!!',0
  844. no_file_name db 'Enter file name !!!',0
  845. invalid_rect db 'Wrong area size',0
  846.  
  847. end if
  848.  
  849. ;---------------------------------------------------------------------
  850. PathShow_data_1:
  851. .type                   dd 0    ;+0
  852. .start_y                dw 38   ;+4
  853. .start_x                dw 6    ;+6
  854. .font_size_x            dw 6    ;+8     ; 6 - for font 0, 8 - for font 1
  855. .area_size_x            dw 300  ;+10
  856. .font_number            dd 0    ;+12    ; 0 - monospace, 1 - variable
  857. .background_flag        dd 0    ;+16
  858. .font_color             dd 0x0  ;+20
  859. .background_color       dd 0x0  ;+24
  860. .text_pointer           dd fname_buf    ;+28
  861. .work_area_pointer      dd text_work_area       ;+32
  862. .temp_text_length       dd 0    ;+36
  863. ;---------------------------------------------------------------------
  864. OpenDialog_data:
  865. .type                   dd 1    ; Save
  866. .procinfo               dd procinfo     ;+4
  867. .com_area_name          dd communication_area_name      ;+8
  868. .com_area               dd 0    ;+12
  869. .opendir_pach           dd temp_dir_pach        ;+16
  870. .dir_default_pach       dd communication_area_default_pach      ;+20
  871. .start_path             dd open_dialog_path     ;+24
  872. .draw_window            dd draw_window  ;+28
  873. .status                 dd 0    ;+32
  874. .openfile_pach          dd fname_buf    ;+36
  875. .filename_area          dd filename_area        ;+40
  876. .filter_area            dd Filter
  877. .x:
  878. .x_size                 dw 420 ;+48 ; Window X size
  879. .x_start                dw 10 ;+50 ; Window X position
  880. .y:
  881. .y_size                 dw 320 ;+52 ; Window y size
  882. .y_start                dw 10 ;+54 ; Window Y position
  883.  
  884. communication_area_name:
  885.         db 'FFFFFFFF_open_dialog',0
  886. open_dialog_path:
  887.         db '/sys/File Managers/opendial',0
  888. communication_area_default_pach:
  889.         db '/sys',0
  890.  
  891. Filter:
  892. dd      Filter.end - Filter
  893. .1:
  894. db      'BMP',0
  895. .end:
  896. db      0
  897.  
  898. start_temp_file_name:   db '1.bmp',0
  899.  
  900. ;---------------------------------------------------------------------
  901. sign_n_input:
  902.         db      '2',0
  903.  
  904. PrintScreen     db  0
  905. autoshoot_flag  db  0
  906.        
  907. app_ipc ipc_buffer 32
  908. align 4
  909.  
  910. mouse_flag: dd 0x0
  911. ;---------------------------------------------------------------------
  912. align 4
  913.  
  914. ed_buffer:
  915. .1: db '/sys/1.bmp',0
  916. ;rb 287
  917. .2:
  918.         db '100',0
  919.         rb 6
  920. .3:
  921.         rb 10
  922. ;--------------------------------------------------------------------- 
  923. IM_END:
  924. ;---------------------------------------------------------------------
  925. structure_of_potock:
  926. rb 100
  927. ;---------------------------------------------------------------------
  928. align 4
  929.  
  930. cur_number        dd      ?
  931.  
  932. sign_n        db      ?
  933.  
  934. slot_n        dd ?
  935.  
  936. flags        dd ?
  937.  
  938. scr_buf:
  939. .ptr        dd      ?
  940. .end_ptr        dd      ?
  941. .size:
  942. .height        dw      ?
  943. .width        dw      ?
  944.  
  945. fs_struc:
  946. .funk_n        dd      ?
  947.         dd      ?
  948.         dd      ?
  949. .bytes_to_write  dd      ?
  950. .data_ptr        dd    ?,?
  951. .fn_ptr        dd      ?
  952.  
  953. sf_buf:
  954. .bmp_header   dd      ?
  955. .bmp_area     dd      ?
  956. .end          dd      ?
  957.  
  958. set_rect_window_pid dd ?
  959. set_rect_window_slot dd ?
  960. ;---------------------------------------------------------------------
  961. align 4
  962. rect_input_buffer:
  963. .left rb 6
  964. .top  rb 6
  965. .width  rb 6
  966. .height rb 6
  967.  
  968. cmdstr rb 257
  969. ;---------------------------------------------------------------------
  970. align 4
  971.  
  972. file_name:
  973.         rb      1058
  974.  
  975. scr screen_prop
  976. rect:
  977. .left dw ?
  978. .top dw ?
  979. .height dw ?
  980. .width dw ?
  981.  
  982. sc sys_color_table
  983. app procinfo        ; ¨­ä®à¬ æ¨ï ® £« ¢­®¬ ®ª­¥
  984. active_app procinfo ; ¨­ä®à¬ æ¨ï ®¡  ªâ¨¢­®¬ ®ª­¥
  985. set_rect_window_procinfo procinfo  ; ¨­ä®à¬ æ¨ï ®¡ ®ª­¥ ®¡« áâ¨
  986. ;---------------------------------------------------------------------
  987.         rb 512             ; á⥪ ¯®â®ª  ä®âª ­ìï
  988. shoot_esp:
  989. ;---------------------------------------------------------------------
  990.         rb 512     ; á⥪ ®ª­  ®¡« áâ¨
  991. set_rect_window_esp:
  992. ;---------------------------------------------------------------------
  993. ;        app_end    ; ª®­¥æ ¯à®£à ¬¬ë
  994. mouse_dd        rd 1
  995. ;---------------------------------------------------------------------
  996. align 4
  997. cur_dir_path:
  998.         rb 4096
  999. ;---------------------------------------------------------------------
  1000. library_path:
  1001.         rb 4096
  1002. ;---------------------------------------------------------------------
  1003. temp_dir_pach:
  1004.         rb 4096
  1005. ;---------------------------------------------------------------------
  1006. text_work_area:
  1007.         rb 1024
  1008. ;---------------------------------------------------------------------
  1009. fname_buf:
  1010.         rb 4096
  1011. ;---------------------------------------------------------------------
  1012. procinfo:
  1013.         rb 1024
  1014. ;---------------------------------------------------------------------
  1015. filename_area:
  1016.         rb 256
  1017. ;---------------------------------------------------------------------
  1018.         rb 1024
  1019. i_end_tread:
  1020. ;---------------------------------------------------------------------
  1021.         rb 1024
  1022. stacktop:
  1023. ;---------------------------------------------------------------------
  1024. i_end: