Subversion Repositories Kolibri OS

Rev

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