Rev 7833 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1608 | mario79 | 1 | ; |
2 | ; Screenshooter for Kolibri |
||
3 | ; |
||
6763 | IgorA | 4 | ;--------------------------------------------------------------------- |
5 | ; Автор программы Евтихов Максим (Maxxxx32) |
||
6 | ; |
||
7 | ; 26.11.16 - IgorA снимки сохраняються в формате *.png |
||
8 | ; 02.11.10 - Используется checkbox версии 2 |
||
9 | ; |
||
2246 | leency | 10 | ; version: 1.2 |
1608 | mario79 | 11 | ; last update: 08/09/2010 |
12 | ; written by: Marat Zakiyanov aka Mario79, aka Mario |
||
13 | ; changes: select path for save with OpenDialog, |
||
14 | ; bag fix for threads stacks |
||
6763 | IgorA | 15 | ; 01.06.09 - |
16 | ; 24.07.08 - |
||
307 | Lrz | 17 | ; 01.02.07 - обновлён editbox |
18 | ; 31.01.07 - всё теперь рисуется относительно клиентской области |
||
205 | heavyiron | 19 | |
6763 | IgorA | 20 | |
5158 | hidnplayr | 21 | format binary as "" |
22 | |||
7832 | leency | 23 | title equ 'Screenshooter v1.21' ; Заголовок окна |
8346 | IgorA | 24 | include '../../load_lib.mac' |
1373 | IgorA | 25 | include '../../develop/libraries/box_lib/trunk/box_lib.mac' |
1702 | Lrz | 26 | include '../../config.inc' ;for nightbuild |
6763 | IgorA | 27 | include '../../proc32.inc' |
1098 | Lrz | 28 | include '../../macros.inc' |
6763 | IgorA | 29 | include '../../KOSfuncs.inc' |
30 | include '../../develop/libraries/libs-dev/libimg/libimg.inc' |
||
1098 | Lrz | 31 | include 'txtbut.inc' |
32 | include 'label.inc' |
||
33 | include 'textwork.inc' |
||
1228 | Lrz | 34 | include 'scrshoot.mac' |
205 | heavyiron | 35 | |
1373 | IgorA | 36 | use32 |
8346 | IgorA | 37 | org 0 |
1098 | Lrz | 38 | db 'MENUET01' |
8346 | IgorA | 39 | dd 1, start, IM_END, i_end, stacktop, cmdstr, cur_dir_path |
1098 | Lrz | 40 | |
6766 | IgorA | 41 | include 'lang.inc' |
6763 | IgorA | 42 | include '../../dll.inc' |
43 | |||
1098 | Lrz | 44 | align 4 |
8346 | IgorA | 45 | @use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load |
1373 | IgorA | 46 | use_txt_button ; | |
47 | use_label ; |-- GUI компоненты и некоторые процедуры |
||
48 | use_text_work ; / |
||
6766 | IgorA | 49 | |
1228 | Lrz | 50 | include 'scrwin.inc' ; вставляем код окна прдпросмотра |
51 | include 'scrsavef.inc'; вставляем процедуру сохранения файла |
||
307 | Lrz | 52 | include 'gp.inc' |
53 | include 'srectwin.inc' |
||
1373 | IgorA | 54 | |
55 | macro get_sys_colors col_buf |
||
56 | { |
||
6763 | IgorA | 57 | mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, col_buf, 40 |
1373 | IgorA | 58 | } |
59 | |||
205 | heavyiron | 60 | ;--- начало программы --- |
1098 | Lrz | 61 | align 4 |
62 | start: |
||
1608 | mario79 | 63 | |
64 | load_libraries l_libs_start,end_l_libs |
||
65 | |||
1098 | Lrz | 66 | ;if return code =-1 then exit, else nornary work |
67 | ; cmp eax,-1 |
||
1373 | IgorA | 68 | inc eax |
69 | test eax,eax |
||
70 | jz close |
||
1098 | Lrz | 71 | ;;;;;;;;;;;;;;;; init memory 68/11 |
6763 | IgorA | 72 | mcall SF_SYS_MISC, SSF_HEAP_INIT |
1373 | IgorA | 73 | test eax,eax |
74 | jz close |
||
1098 | Lrz | 75 | |
1608 | mario79 | 76 | ;--------------------------------------------------------------------- |
77 | mov edi,filename_area |
||
78 | mov esi,start_temp_file_name |
||
79 | xor eax,eax |
||
80 | cld |
||
81 | @@: |
||
82 | lodsb |
||
83 | stosb |
||
84 | test eax,eax |
||
85 | jnz @b |
||
86 | |||
87 | |||
88 | mov edi,fname_buf |
||
89 | mov esi,ed_buffer.1 |
||
90 | xor eax,eax |
||
91 | cld |
||
92 | @@: |
||
93 | lodsb |
||
94 | stosb |
||
95 | test eax,eax |
||
96 | jnz @b |
||
97 | |||
98 | ;OpenDialog initialisation |
||
6763 | IgorA | 99 | stdcall [OpenDialog_Init], OpenDialog_data |
1608 | mario79 | 100 | |
101 | ; prepare for PathShow |
||
6763 | IgorA | 102 | stdcall [PathShow_prepare], PathShow_data_1 |
1608 | mario79 | 103 | ;--------------------------------------------------------------------- |
1373 | IgorA | 104 | ;mov al,[gs:1280*4*1024] |
105 | ; устанавливаем ipc буффер |
||
106 | xor ebx,ebx |
||
107 | inc ebx |
||
6763 | IgorA | 108 | mcall SF_IPC,, app_ipc, 32 |
205 | heavyiron | 109 | |
6763 | IgorA | 110 | ; устанавливаем глобальную горячую клавишу |
1373 | IgorA | 111 | mov cl,55 ; 55 - PrintScrn |
112 | xor edx,edx |
||
6763 | IgorA | 113 | mcall SF_KEYBOARD, SSF_SET_SYS_HOTKEY |
205 | heavyiron | 114 | |
1373 | IgorA | 115 | mov ebx,app |
116 | call get_slot_n |
||
117 | mov [slot_n],ecx |
||
205 | heavyiron | 118 | |
1373 | IgorA | 119 | ; устанавливаем маску событий |
120 | set_events_mask (evm_redraw+evm_key+evm_button+evm_mouse+evm_ipc) |
||
1685 | lrz | 121 | ;инициализация checkboxes |
122 | init_checkboxes2 check_boxes,check_boxes_end |
||
205 | heavyiron | 123 | |
124 | ; сюда прыгаем при каждой перерисовке |
||
125 | red: |
||
1373 | IgorA | 126 | get_procinfo app ; получаем информацию о процессе |
127 | get_sys_colors sc ; получаем системные цвета |
||
205 | heavyiron | 128 | |
1373 | IgorA | 129 | ; устанавливаем системные цвета у GUI компонентов |
130 | txt_but_set_sys_color buttons,buttons_end,sc ; \ |
||
131 | labels_set_sys_color labels,labels_end,sc ; | |
||
1685 | lrz | 132 | check_boxes_set_sys_color2 check_boxes,check_boxes_end,sc; | |
1373 | IgorA | 133 | edit_boxes_set_sys_color editboxes,editboxes_end,sc ; / |
205 | heavyiron | 134 | |
1373 | IgorA | 135 | get_screen_prop scr ; получаем информацию об экране |
2628 | mario79 | 136 | ;------------------------------------------------------------------------------ |
137 | ; Boot with "DIRECT" parameter - get screen and save |
||
138 | mov eax,cmdstr |
||
139 | cmp [eax],byte 0 |
||
140 | je no_boot |
||
141 | |||
142 | cmp [eax],dword 'DIRE' |
||
143 | jne no_boot |
||
144 | |||
145 | cmp [eax+4],word 'CT' |
||
146 | jne no_boot |
||
147 | |||
148 | and [ch2.flags],dword 0 |
||
149 | or [ch5.flags],dword 1 |
||
150 | mov [OpenDialog_data.draw_window],dword draw_window_direct |
||
151 | |||
152 | call shoot |
||
153 | jmp close |
||
154 | ;------------------------------------------------------------------------------ |
||
155 | draw_window_direct: |
||
6763 | IgorA | 156 | mcall SF_REDRAW, SSF_BEGIN_DRAW |
157 | mcall SF_GET_SCREEN_SIZE |
||
2628 | mario79 | 158 | ; eax = [xsize]*65536 + [ysize] |
159 | mov ebx,eax |
||
160 | shr ebx,17 |
||
161 | sub ebx,100 |
||
162 | shl ebx,16 |
||
163 | mov bx,200 |
||
164 | mov ecx,eax |
||
165 | and ecx,0xffff |
||
166 | shr ecx,1 |
||
167 | sub ecx,50 |
||
168 | shl ecx,16 |
||
169 | mov cx,100 |
||
170 | xor esi,esi |
||
6763 | IgorA | 171 | mcall SF_CREATE_WINDOW,,,0x34ffffff,,grab_text |
2628 | mario79 | 172 | |
6763 | IgorA | 173 | mcall SF_DRAW_TEXT, <10,30>,0x90000000,saving |
2628 | mario79 | 174 | |
6763 | IgorA | 175 | mcall SF_REDRAW, SSF_END_DRAW |
2628 | mario79 | 176 | ret |
177 | ;------------------------------------------------------------------------------ |
||
178 | no_boot: |
||
1373 | IgorA | 179 | call draw_window ; перерисовываем окно |
205 | heavyiron | 180 | still: |
1373 | IgorA | 181 | wait_event red,key,button,mouse,ipc,still ; ждем событий |
205 | heavyiron | 182 | |
183 | key: |
||
1373 | IgorA | 184 | get_key |
185 | cmp al,2 |
||
186 | jne @f |
||
187 | cmp ah,55 |
||
1608 | mario79 | 188 | jne still |
189 | mov [PrintScreen],1 |
||
1373 | IgorA | 190 | call shoot |
1608 | mario79 | 191 | mov [PrintScreen],0 |
1373 | IgorA | 192 | jmp still |
205 | heavyiron | 193 | @@: |
6763 | IgorA | 194 | ; stdcall [edit_box_key], edit1 |
195 | stdcall [edit_box_key], edit2 |
||
196 | stdcall [edit_box_key], edit3 |
||
1098 | Lrz | 197 | |
1373 | IgorA | 198 | jmp still |
205 | heavyiron | 199 | button: |
1373 | IgorA | 200 | get_pressed_button |
201 | cmp ah,1 |
||
202 | je p_close |
||
203 | txt_but_ev buttons,buttons_end |
||
204 | jmp still |
||
205 | heavyiron | 205 | mouse: |
1373 | IgorA | 206 | get_active_window |
207 | cmp eax,[slot_n] |
||
208 | jne still |
||
1098 | Lrz | 209 | ;---------------------------------- |
6763 | IgorA | 210 | ; stdcall [edit_box_mouse], edit1 |
211 | stdcall [edit_box_mouse], edit2 |
||
212 | stdcall [edit_box_mouse], edit3 |
||
1098 | Lrz | 213 | ;---------------------------------- |
1685 | lrz | 214 | checkboxes_mouse2 check_boxes,check_boxes_end |
1098 | Lrz | 215 | ;----------------------------------- |
1373 | IgorA | 216 | jmp still |
205 | heavyiron | 217 | ipc: |
1373 | IgorA | 218 | cmp word [app_ipc+8],2 |
219 | jne @f |
||
220 | min_window |
||
221 | jmp .clear_ipc |
||
205 | heavyiron | 222 | @@: |
1373 | IgorA | 223 | cmp word [app_ipc+8],3 |
224 | jne @f |
||
225 | mov ecx,[slot_n] |
||
226 | activ_window |
||
227 | jmp .clear_ipc |
||
1100 | Lrz | 228 | @@: |
1373 | IgorA | 229 | call draw_number |
230 | call dr_st |
||
205 | heavyiron | 231 | |
232 | .clear_ipc: |
||
1373 | IgorA | 233 | cld |
234 | xor eax,eax |
||
235 | mov ecx,32/4 |
||
236 | mov edi,app_ipc |
||
237 | rep stosd |
||
238 | jmp still |
||
205 | heavyiron | 239 | |
240 | p_close: |
||
1373 | IgorA | 241 | btr dword [flags],1 |
307 | Lrz | 242 | |
1373 | IgorA | 243 | bt dword [flags],3 |
244 | jnc @f |
||
6763 | IgorA | 245 | mcall SF_SYSTEM, SSF_TERMINATE_THREAD_ID, [set_rect_window_pid] |
307 | Lrz | 246 | @@: |
247 | |||
205 | heavyiron | 248 | close: |
1373 | IgorA | 249 | app_close |
205 | heavyiron | 250 | |
1608 | mario79 | 251 | ;--------------------------------------------------------------------- |
252 | draw_PathShow: |
||
253 | pusha |
||
6763 | IgorA | 254 | mcall SF_DRAW_RECT, <4,302>, <35,15>, 0xffffff |
1608 | mario79 | 255 | ; draw for PathShow |
256 | push dword PathShow_data_1 |
||
257 | call [PathShow_draw] |
||
258 | popa |
||
259 | ret |
||
205 | heavyiron | 260 | ;-------------------------------------------------------------------- |
261 | ;--- прооцедура перерисовки главного окна --------------------------- |
||
262 | ;-------------------------------------------------------------------- |
||
263 | draw_window: |
||
1373 | IgorA | 264 | start_draw_window ; начало перерисовки |
265 | ; определяем окно |
||
266 | get_skin_height |
||
267 | mov ecx,100*65536+220 |
||
268 | add cx,ax |
||
269 | mov edx,[sc.work] |
||
270 | or edx,0x34000000;0x33000000 |
||
271 | xor esi,esi |
||
272 | ;xor edi,edi |
||
273 | mov edi,grab_text |
||
6763 | IgorA | 274 | mcall SF_CREATE_WINDOW, 100*65536+320 |
205 | heavyiron | 275 | |
6763 | IgorA | 276 | ; выводим числа в окно |
1373 | IgorA | 277 | movsx ecx,word [scr.width] ; ширина экрана |
7832 | leency | 278 | mcall SF_DRAW_NUMBER, <4,0>, , <188,[label1.top]>, [sc.work_text] |
1373 | IgorA | 279 | movsx ecx,word [scr.height] ; высота экрана |
7832 | leency | 280 | add edx, 37 shl 16 |
1373 | IgorA | 281 | mcall |
7832 | leency | 282 | add edx, 36 shl 16 |
6763 | IgorA | 283 | mov ebx,2 shl 16 |
1373 | IgorA | 284 | movsx ecx,word [scr.bitspp] ; бит на пиксель |
285 | mcall |
||
205 | heavyiron | 286 | |
1373 | IgorA | 287 | call draw_number ; прорисовываем номер снимка |
288 | call dr_st |
||
205 | heavyiron | 289 | |
1373 | IgorA | 290 | draw_labels labels,labels_end ; метки |
1098 | Lrz | 291 | ;------ show check editbox ----------- |
6763 | IgorA | 292 | ; stdcall [edit_box_draw], edit1 |
293 | stdcall [edit_box_draw], edit2 |
||
294 | stdcall [edit_box_draw], edit3 |
||
1098 | Lrz | 295 | ;------ end check all editbox ------- |
296 | |||
1608 | mario79 | 297 | call draw_PathShow |
298 | |||
1373 | IgorA | 299 | draw_txt_buttons buttons,buttons_end ; кнопки |
1098 | Lrz | 300 | ;------ check all checkbox --------- |
1685 | lrz | 301 | |
302 | checkboxes_draw2 check_boxes,check_boxes_end |
||
303 | |||
1098 | Lrz | 304 | ;------ end check all checkbox ------ |
305 | |||
205 | heavyiron | 306 | stop_draw_window ; конец перерисовки |
307 | ret |
||
308 | |||
309 | shoot: |
||
1373 | IgorA | 310 | bt dword [ch4.flags],1 ; включена ли задержка ? |
311 | jnc @f |
||
312 | draw_status delay_now |
||
313 | mov edi,ed_buffer.2 |
||
314 | call zstr_to_int |
||
315 | mov ebx,eax |
||
316 | delay |
||
205 | heavyiron | 317 | @@: |
1373 | IgorA | 318 | call get_mem_for_shoot; получаем память для снимка |
205 | heavyiron | 319 | |
320 | |||
1373 | IgorA | 321 | bts dword [flags],0 ; нулевой флаг - снимок есть в памяти |
205 | heavyiron | 322 | |
1373 | IgorA | 323 | ; делаем снимок |
324 | draw_status shooting |
||
325 | mov esi,scr |
||
326 | mov edi,[scr_buf.ptr] |
||
327 | call copy_screen_to_image |
||
205 | heavyiron | 328 | |
1373 | IgorA | 329 | bt dword [use_rect.flags],1 |
330 | jc .use_rect |
||
331 | push dword [scr] |
||
332 | jmp @f |
||
307 | Lrz | 333 | .use_rect: |
1373 | IgorA | 334 | push dword [rect.height] |
307 | Lrz | 335 | @@: |
1373 | IgorA | 336 | pop dword [scr_buf.size] |
205 | heavyiron | 337 | |
1610 | mario79 | 338 | cmp [autoshoot_flag],1 |
339 | jne .2 |
||
340 | |||
341 | bt dword [ch5.flags],1 ; включено ли автосохранение ? |
||
342 | jnc @f |
||
343 | call save_file |
||
344 | @@: |
||
1373 | IgorA | 345 | draw_status shooted_ok |
1610 | mario79 | 346 | .2: |
1373 | IgorA | 347 | bt dword [flags],1 |
348 | jnc @f |
||
349 | ret |
||
205 | heavyiron | 350 | @@: |
1373 | IgorA | 351 | bt dword [ch2.flags],1 ; показать окно предпросмотра ? |
352 | jnc @f |
||
1610 | mario79 | 353 | cmp [PrintScreen],0 |
1608 | mario79 | 354 | jne @f |
1373 | IgorA | 355 | call show_scr_window |
1100 | Lrz | 356 | ret |
205 | heavyiron | 357 | @@: |
1608 | mario79 | 358 | bt dword [ch5.flags],1 ; включено ли автосохранение ? |
359 | jnc @f |
||
360 | |||
2628 | mario79 | 361 | call [OpenDialog_data.draw_window] |
1608 | mario79 | 362 | ; invoke OpenDialog |
6763 | IgorA | 363 | stdcall [OpenDialog_Start], OpenDialog_data |
1608 | mario79 | 364 | cmp [OpenDialog_data.status],1 |
365 | je .1 |
||
366 | ret |
||
367 | .1: |
||
368 | ; prepare for PathShow |
||
6763 | IgorA | 369 | stdcall [PathShow_prepare], PathShow_data_1 |
2628 | mario79 | 370 | call [OpenDialog_data.draw_window] |
1608 | mario79 | 371 | call save_file |
372 | @@: |
||
7832 | leency | 373 | ret |
205 | heavyiron | 374 | |
307 | Lrz | 375 | ;--- получить память для снимка --- |
205 | heavyiron | 376 | get_mem_for_shoot: |
1098 | Lrz | 377 | ;clean memory |
6763 | IgorA | 378 | mcall SF_SYS_MISC, SSF_MEM_FREE, [scr_buf.ptr] |
1098 | Lrz | 379 | |
1373 | IgorA | 380 | bt dword [use_rect.flags],1 ; фоткать область экрана |
381 | jc .use_area |
||
382 | movzx ecx, word [scr.width] |
||
383 | movzx ebx, word [scr.height] |
||
384 | jmp @f |
||
307 | Lrz | 385 | .use_area: |
1373 | IgorA | 386 | call read_rect |
387 | movzx ecx, word [rect.width] |
||
388 | movzx ebx, word [rect.height] |
||
307 | Lrz | 389 | @@: |
1373 | IgorA | 390 | imul ecx,ebx |
391 | lea ecx,[ecx*3] |
||
1098 | Lrz | 392 | ; add ecx,i_end |
6763 | IgorA | 393 | mcall SF_SYS_MISC, SSF_MEM_ALLOC |
1373 | IgorA | 394 | mov [scr_buf.ptr],eax |
395 | add eax,ecx |
||
396 | mov [scr_buf.end_ptr],ecx |
||
205 | heavyiron | 397 | ret |
398 | |||
6766 | IgorA | 399 | ;--- содать окно предпросмотра --- |
205 | heavyiron | 400 | show_scr_window: |
401 | pusha |
||
1373 | IgorA | 402 | bt dword [flags],0 |
403 | jnc @f |
||
404 | xor ebx,ebx |
||
405 | inc ebx |
||
6763 | IgorA | 406 | mcall SF_CREATE_THREAD,, scr_window, i_end_tread-512 |
205 | heavyiron | 407 | @@: |
408 | popa |
||
409 | ret |
||
410 | |||
411 | ;--- прочитать и нарисовать текущий номер --- |
||
412 | apply_number: |
||
1373 | IgorA | 413 | mov edi,ed_buffer.3 |
414 | call zstr_to_int |
||
415 | mov [cur_number],eax |
||
416 | call draw_number |
||
205 | heavyiron | 417 | ret |
418 | |||
419 | ;--- процедура прорисовки текущего номера --- |
||
420 | draw_number: |
||
7832 | leency | 421 | mov [sign_n],4 |
1373 | IgorA | 422 | mov cx,[label9.top] |
423 | shl ecx,16 |
||
424 | mov cx,10 |
||
425 | mov edx,[sc.work] |
||
6763 | IgorA | 426 | mcall SF_DRAW_RECT, 150*65536+96 |
1373 | IgorA | 427 | movsx bx,byte [sign_n] |
428 | shl ebx,16 |
||
6763 | IgorA | 429 | mov edx,150 shl 16 |
1373 | IgorA | 430 | mov dx,[label9.top] |
431 | mov esi,[sc.work_text] |
||
6763 | IgorA | 432 | mcall SF_DRAW_NUMBER,, [cur_number] |
205 | heavyiron | 433 | ret |
434 | |||
435 | ;--- процедура, запускающая поток автосъемки --- |
||
436 | start_autoshoot: |
||
1373 | IgorA | 437 | bts dword [flags],1 |
438 | jc @f |
||
439 | xor ebx,ebx |
||
440 | inc ebx |
||
6763 | IgorA | 441 | mcall SF_CREATE_THREAD,, autoshoot, i_end_tread |
205 | heavyiron | 442 | @@: |
443 | ret |
||
444 | |||
445 | ;--- останавливает этот поток --- |
||
446 | stop_autoshoot: |
||
1373 | IgorA | 447 | btr dword [flags],1 |
205 | heavyiron | 448 | ret |
449 | |||
450 | ;--- цикл потока автосъемки --- |
||
451 | autoshoot: |
||
1610 | mario79 | 452 | mov [autoshoot_flag],1 |
1373 | IgorA | 453 | mov ecx,[slot_n] |
454 | activ_window |
||
205 | heavyiron | 455 | .next: |
1373 | IgorA | 456 | bt dword [flags],1 |
457 | jnc close |
||
458 | mov esi,2 |
||
6763 | IgorA | 459 | mcall SF_IPC, SSF_SEND_MESSAGE, [app.pid], messages.draw_number |
1373 | IgorA | 460 | call shoot |
461 | jmp autoshoot.next |
||
1610 | mario79 | 462 | .close: |
463 | mov [autoshoot_flag],0 |
||
464 | jmp close |
||
205 | heavyiron | 465 | ;--- процедура прорисовки строки состояния --- |
466 | ; (должна вызываться потоком главного окна) |
||
467 | dr_st: |
||
6763 | IgorA | 468 | mcall SF_DRAW_LINE, 0*65536+310, 198*65536+198, [sc.work_graph] |
205 | heavyiron | 469 | |
1373 | IgorA | 470 | mov bx,310 |
471 | mov ecx,199*65536+15 |
||
472 | mov edx,[sc.work] |
||
6763 | IgorA | 473 | mcall SF_DRAW_RECT ; полоска |
205 | heavyiron | 474 | |
1373 | IgorA | 475 | mov edi,status |
476 | call draw_label |
||
205 | heavyiron | 477 | ret |
478 | |||
479 | ;--- процедура получения номера слота потока --- |
||
480 | ; вход ebx - буффер 1024 байт |
||
481 | ; выход ecx - номер слота |
||
482 | get_slot_n: |
||
1373 | IgorA | 483 | xor ecx,ecx |
484 | dec ecx |
||
6763 | IgorA | 485 | mcall SF_THREAD_INFO |
205 | heavyiron | 486 | |
1373 | IgorA | 487 | mov edx,[ebx+30] |
488 | xor ecx,ecx |
||
205 | heavyiron | 489 | @@: |
1373 | IgorA | 490 | inc ecx |
6763 | IgorA | 491 | mcall SF_THREAD_INFO |
1373 | IgorA | 492 | cmp [ebx+30],edx |
493 | je @f |
||
494 | jmp @b |
||
205 | heavyiron | 495 | @@: |
496 | ret |
||
497 | |||
307 | Lrz | 498 | ;--- процедура, запускающая поток, делающий 1 снимок --- |
205 | heavyiron | 499 | one_shoot: |
1373 | IgorA | 500 | mov ecx,one_shoot_thread |
501 | mov edx,shoot_esp |
||
502 | jmp @f |
||
307 | Lrz | 503 | ;--- процедра, запускающая поток, сохраняющий снимок --- |
205 | heavyiron | 504 | save_shoot: |
1608 | mario79 | 505 | ; invoke OpenDialog |
6763 | IgorA | 506 | stdcall [OpenDialog_Start], OpenDialog_data |
1608 | mario79 | 507 | cmp [OpenDialog_data.status],1 |
508 | je .1 |
||
509 | ret |
||
510 | .1: |
||
511 | ; prepare for PathShow |
||
6763 | IgorA | 512 | stdcall [PathShow_prepare], PathShow_data_1 |
1608 | mario79 | 513 | |
514 | call draw_PathShow |
||
515 | |||
1373 | IgorA | 516 | mov ecx,save_shoot_thread |
517 | mov edx,shoot_esp |
||
205 | heavyiron | 518 | @@: |
1373 | IgorA | 519 | bts dword [flags],2 |
520 | jc .running |
||
521 | bt dword [flags],1 |
||
522 | jc .running |
||
205 | heavyiron | 523 | |
1373 | IgorA | 524 | xor ebx,ebx |
525 | inc ebx |
||
6763 | IgorA | 526 | mcall SF_CREATE_THREAD |
205 | heavyiron | 527 | .running: |
528 | ret |
||
529 | |||
307 | Lrz | 530 | ;--- поток, делающий 1 снимок --- |
205 | heavyiron | 531 | one_shoot_thread: |
1373 | IgorA | 532 | mov ecx,[slot_n] |
533 | activ_window |
||
534 | bt dword [ch1.flags],1 ; минимизировать окно ? |
||
535 | jnc @f |
||
536 | mov esi,2 |
||
6763 | IgorA | 537 | mcall SF_IPC, SSF_SEND_MESSAGE, [app.pid], messages.min_window |
205 | heavyiron | 538 | @@: |
1373 | IgorA | 539 | call shoot |
540 | btr dword [flags],2 |
||
541 | jmp close |
||
205 | heavyiron | 542 | |
307 | Lrz | 543 | ;--- процедура, отправляющая главному окну сообщение о перерисовке |
544 | ; строки состояния --- |
||
205 | heavyiron | 545 | send_draw_status: |
1373 | IgorA | 546 | mov esi,2 |
6763 | IgorA | 547 | mcall SF_IPC, SSF_SEND_MESSAGE, [app.pid], messages.draw_status |
205 | heavyiron | 548 | ret |
549 | |||
307 | Lrz | 550 | ;--- поток, сохраняюий файл --- |
205 | heavyiron | 551 | save_shoot_thread: |
1373 | IgorA | 552 | mov ecx,[slot_n] |
553 | activ_window |
||
554 | call save_file |
||
555 | btr dword [flags],2 |
||
556 | jmp close |
||
205 | heavyiron | 557 | |
307 | Lrz | 558 | ;--- процедура, запускающая поток окна установки области съемки --- |
559 | show_set_rect_window: |
||
1373 | IgorA | 560 | bts dword [flags],3 |
561 | jc @f |
||
562 | xor ebx,ebx |
||
563 | inc ebx |
||
6763 | IgorA | 564 | mcall SF_CREATE_THREAD,, set_rect_window, set_rect_window_esp |
307 | Lrz | 565 | |
1373 | IgorA | 566 | mov [set_rect_window_pid],eax |
307 | Lrz | 567 | ret |
568 | |||
569 | @@: |
||
6763 | IgorA | 570 | mcall SF_SYSTEM, SSF_TERMINATE_THREAD_ID, [set_rect_window_pid] |
1373 | IgorA | 571 | btr dword [flags],3 |
307 | Lrz | 572 | ret |
573 | |||
574 | ;--- получение информации об активном окне --- |
||
575 | get_active_window_info: |
||
6763 | IgorA | 576 | mcall SF_SYSTEM, SSF_GET_ACTIVE_WINDOW |
307 | Lrz | 577 | |
1373 | IgorA | 578 | mov ecx,eax |
6763 | IgorA | 579 | mcall SF_THREAD_INFO, active_app |
307 | Lrz | 580 | ret |
581 | |||
205 | heavyiron | 582 | ;==================================================================== |
583 | ;=== данные программы =============================================== |
||
584 | ;==================================================================== |
||
585 | messages: |
||
586 | .draw_number dw 0 |
||
587 | .draw_status dw 1 |
||
588 | .min_window dw 2 |
||
1100 | Lrz | 589 | .act_window dw 3 |
205 | heavyiron | 590 | |
591 | grab_text: |
||
1373 | IgorA | 592 | db title,0 |
307 | Lrz | 593 | |
205 | heavyiron | 594 | labels: |
7832 | leency | 595 | label1 label 5,8,0,text.1 ; screen size and color depth |
307 | Lrz | 596 | label3 label 5,25,0,text.3 ; введите имя файла |
597 | label9 label 5,52,0,text.9 ; номер текущего симка |
||
598 | status label 5,201,0,no_shoot |
||
205 | heavyiron | 599 | labels_end: |
600 | |||
1608 | mario79 | 601 | ;--------------------------------------------------------------------- |
602 | l_libs_start: |
||
603 | |||
8346 | IgorA | 604 | library01 l_libs system_dir_Boxlib+9, library_path, system_dir_Boxlib, \ |
605 | Box_lib_import |
||
1608 | mario79 | 606 | |
8346 | IgorA | 607 | library02 l_libs system_dir_ProcLib+9, library_path, system_dir_ProcLib, \ |
608 | ProcLib_import |
||
1608 | mario79 | 609 | |
8346 | IgorA | 610 | library03 l_libs system_dir_LibImg+9, library_path, system_dir_LibImg, \ |
611 | import_libimg |
||
6763 | IgorA | 612 | |
1608 | mario79 | 613 | end_l_libs: |
614 | ;--------------------------------------------------------------------- |
||
205 | heavyiron | 615 | editboxes: |
7832 | leency | 616 | ;edit1 edit_box 300,5,35,cl_white,0,0,0,0,300,ed_buffer.1,mouse_dd,ed_focus,10,10 ; путь к файлу |
617 | edit2 edit_box 35,170,134,cl_white,0,0,0,0,9,ed_buffer.2,mouse_dd,ed_figure_only,3,3 ; задержка |
||
618 | edit3 edit_box 35,165,164,cl_white,0,0,0,0,9,ed_buffer.3,mouse_dd,ed_figure_only ; автонумерация |
||
205 | heavyiron | 619 | editboxes_end: |
1608 | mario79 | 620 | ;--------------------------------------------------------------------- |
205 | heavyiron | 621 | buttons: |
1373 | IgorA | 622 | but1 txt_button 150,5,15,65,2,0,0,but_text.1,one_shoot ; сделать снимок |
7832 | leency | 623 | but2 txt_button 34,274,15,34,3,0,0,but_text.2,save_shoot ; "..." - выбрать путь сохранения |
624 | but3 txt_button 145,160,15,65,3,0,0,but_text.3,show_scr_window ; показать снимок |
||
1373 | IgorA | 625 | but4 txt_button 80,205,15,163,5,0,0,but_text.4,apply_number ; применить номер |
626 | but5 txt_button 150,5,15,85,6,0,0,but_text.5,start_autoshoot ; начать автосъёмку |
||
627 | but6 txt_button 145,160,15,85,7,0,0,but_text.6,stop_autoshoot ; остановить автосъёмку |
||
7832 | leency | 628 | but7 txt_button 40,70,10,180,8,0,0,but_text.7,show_set_rect_window ; задать область |
205 | heavyiron | 629 | buttons_end: |
1608 | mario79 | 630 | ;--------------------------------------------------------------------- |
205 | heavyiron | 631 | check_boxes: |
2246 | leency | 632 | 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 ; свернуть окно |
7832 | leency | 633 | 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 ; show screenshot |
2246 | leency | 634 | 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 ; задержка |
635 | 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 |
||
636 | 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 |
||
7832 | leency | 637 | use_rect check_box2 (5 shl 16+11),(180 shl 16 +11),5,cl_white,0,0x80000000,ch_text.7,ch_flag_middle ; исп. область |
205 | heavyiron | 638 | ; автонумерация |
639 | check_boxes_end: |
||
1608 | mario79 | 640 | ;--------------------------------------------------------------------- |
205 | heavyiron | 641 | if lang eq ru |
642 | text: |
||
7832 | leency | 643 | .1 db 'Размер экрана и глубина цвета: х х bit',0 |
644 | .3 db 'Путь для сохранения снимка:',0 |
||
307 | Lrz | 645 | .9 db 'Номер текущего снимка:',0 |
205 | heavyiron | 646 | |
647 | but_text: |
||
307 | Lrz | 648 | .1 db 'Сделать снимок экрана',0 |
7832 | leency | 649 | .2 db '...',0 |
307 | Lrz | 650 | .3 db 'Показать снимок сейчас',0 |
651 | .4 db 'Применить',0 |
||
652 | .5 db 'Начать автосъемку',0 |
||
653 | .6 db 'Остановить автосъемку',0 |
||
654 | .7 db 'задать',0 |
||
205 | heavyiron | 655 | |
656 | ch_text: |
||
1685 | lrz | 657 | .1 db 'Свернуть окно',0 |
658 | .2 db 'Показать снимок',0 |
||
7832 | leency | 659 | .4 db 'Задержка в миллисекундах:',0 |
1685 | lrz | 660 | .5 db 'Автосохранение',0 |
661 | .6 db 'Автонумерация, начиная с',0 |
||
662 | .7 db 'Область',0 |
||
205 | heavyiron | 663 | |
664 | no_shoot db 'Снимок не сделан',0 |
||
665 | shooting db 'Фотографирование...',0 |
||
666 | shooted_ok db 'Снимок сделан',0 |
||
667 | saving db 'Сохранение...',0 |
||
668 | saved_ok db 'Снимок сохранен',0 |
||
669 | delay_now db 'Задержка...',0 |
||
670 | bad_file_name db 'Имя файла введено неверно',0 |
||
671 | disk_filled db 'Диск заполнен',0 |
||
672 | bad_fat_table db 'Таблица FAT разрушена',0 |
||
673 | ac_den db 'Доступ запрещен',0 |
||
674 | device_er db 'Ошибка устройства',0 |
||
7832 | leency | 675 | not_shooted db 'Ошибка: вначале сделайте снимок',0 |
676 | no_file_name db 'Ошибка: следует ввести имя файла',0 |
||
307 | Lrz | 677 | invalid_rect db 'Недопустимые размеры области',0 |
2431 | leency | 678 | keyforexit db 'Это ваш снимок. Выход - любая клавиша.',0 |
310 | heavyiron | 679 | |
2431 | leency | 680 | |
310 | heavyiron | 681 | else |
682 | text: |
||
7832 | leency | 683 | .1 db 'Screen size and color depth: х х bit',0 |
684 | .3 db 'Screenshot save path:',0 |
||
310 | heavyiron | 685 | .9 db 'Current photo number:',0 |
686 | |||
687 | but_text: |
||
688 | .1 db 'Make screen photo',0 |
||
689 | .2 db 'Save screen photo',0 |
||
690 | .3 db 'Show photo now',0 |
||
691 | .4 db 'Apply',0 |
||
692 | .5 db 'Start autoshooting',0 |
||
693 | .6 db 'Stop autoshooting',0 |
||
694 | .7 db 'Set',0 |
||
695 | |||
696 | ch_text: |
||
1685 | lrz | 697 | .1 db 'Minimize window',0 |
698 | .2 db 'Show photo',0 |
||
7832 | leency | 699 | .4 db 'Delay in milliseconds:',0 |
1685 | lrz | 700 | .5 db 'Autosave',0 |
701 | .6 db 'Start numeration from',0 |
||
702 | .7 db 'Area',0 |
||
310 | heavyiron | 703 | |
704 | no_shoot db 'There is no photo',0 |
||
705 | shooting db 'Photographing...',0 |
||
706 | shooted_ok db 'Photo created',0 |
||
707 | saving db 'Saving...',0 |
||
708 | saved_ok db 'Photo saved',0 |
||
709 | delay_now db 'Delay...',0 |
||
710 | bad_file_name db 'File name is wrong',0 |
||
711 | disk_filled db 'Disk is full',0 |
||
712 | bad_fat_table db 'FAT table destroyed',0 |
||
713 | ac_den db 'Access denied',0 |
||
714 | device_er db 'Device error',0 |
||
7832 | leency | 715 | not_shooted db 'Error: you need to make a photo first',0 |
716 | no_file_name db 'Please, enter file name.',0 |
||
310 | heavyiron | 717 | invalid_rect db 'Wrong area size',0 |
2432 | leency | 718 | keyforexit db 'This is your screenshot. Press any key.',0 |
310 | heavyiron | 719 | |
205 | heavyiron | 720 | end if |
721 | |||
2431 | leency | 722 | |
723 | |||
724 | |||
1608 | mario79 | 725 | ;--------------------------------------------------------------------- |
726 | PathShow_data_1: |
||
727 | .type dd 0 ;+0 |
||
728 | .start_y dw 38 ;+4 |
||
729 | .start_x dw 6 ;+6 |
||
730 | .font_size_x dw 6 ;+8 ; 6 - for font 0, 8 - for font 1 |
||
731 | .area_size_x dw 300 ;+10 |
||
732 | .font_number dd 0 ;+12 ; 0 - monospace, 1 - variable |
||
733 | .background_flag dd 0 ;+16 |
||
734 | .font_color dd 0x0 ;+20 |
||
735 | .background_color dd 0x0 ;+24 |
||
736 | .text_pointer dd fname_buf ;+28 |
||
737 | .work_area_pointer dd text_work_area ;+32 |
||
738 | .temp_text_length dd 0 ;+36 |
||
739 | ;--------------------------------------------------------------------- |
||
740 | OpenDialog_data: |
||
741 | .type dd 1 ; Save |
||
742 | .procinfo dd procinfo ;+4 |
||
743 | .com_area_name dd communication_area_name ;+8 |
||
744 | .com_area dd 0 ;+12 |
||
745 | .opendir_pach dd temp_dir_pach ;+16 |
||
746 | .dir_default_pach dd communication_area_default_pach ;+20 |
||
747 | .start_path dd open_dialog_path ;+24 |
||
748 | .draw_window dd draw_window ;+28 |
||
749 | .status dd 0 ;+32 |
||
750 | .openfile_pach dd fname_buf ;+36 |
||
751 | .filename_area dd filename_area ;+40 |
||
752 | .filter_area dd Filter |
||
753 | .x: |
||
754 | .x_size dw 420 ;+48 ; Window X size |
||
755 | .x_start dw 10 ;+50 ; Window X position |
||
756 | .y: |
||
757 | .y_size dw 320 ;+52 ; Window y size |
||
758 | .y_start dw 10 ;+54 ; Window Y position |
||
759 | |||
760 | communication_area_name: |
||
761 | db 'FFFFFFFF_open_dialog',0 |
||
762 | open_dialog_path: |
||
1702 | Lrz | 763 | if __nightbuild eq yes |
764 | db '/sys/MANAGERS/opendial',0 |
||
765 | else |
||
1608 | mario79 | 766 | db '/sys/File Managers/opendial',0 |
1702 | Lrz | 767 | end if |
1608 | mario79 | 768 | communication_area_default_pach: |
769 | db '/sys',0 |
||
770 | |||
771 | Filter: |
||
772 | dd Filter.end - Filter |
||
773 | .1: |
||
6763 | IgorA | 774 | db 'PNG',0 |
1608 | mario79 | 775 | .end: |
776 | db 0 |
||
777 | |||
6763 | IgorA | 778 | start_temp_file_name: db '1.png',0 |
1608 | mario79 | 779 | |
780 | ;--------------------------------------------------------------------- |
||
205 | heavyiron | 781 | |
1608 | mario79 | 782 | PrintScreen db 0 |
1610 | mario79 | 783 | autoshoot_flag db 0 |
1608 | mario79 | 784 | |
205 | heavyiron | 785 | app_ipc ipc_buffer 32 |
1098 | Lrz | 786 | align 4 |
205 | heavyiron | 787 | |
451 | heavyiron | 788 | mouse_flag: dd 0x0 |
1608 | mario79 | 789 | ;--------------------------------------------------------------------- |
790 | align 4 |
||
791 | |||
792 | ed_buffer: |
||
6763 | IgorA | 793 | .1: db '/sys/1.png',0 |
1608 | mario79 | 794 | ;rb 287 |
795 | .2: |
||
796 | db '100',0 |
||
797 | rb 6 |
||
798 | .3: |
||
799 | rb 10 |
||
800 | ;--------------------------------------------------------------------- |
||
801 | IM_END: |
||
802 | ;--------------------------------------------------------------------- |
||
451 | heavyiron | 803 | structure_of_potock: |
804 | rb 100 |
||
1608 | mario79 | 805 | ;--------------------------------------------------------------------- |
1098 | Lrz | 806 | align 4 |
807 | |||
1373 | IgorA | 808 | cur_number dd ? |
205 | heavyiron | 809 | |
1373 | IgorA | 810 | sign_n db ? |
205 | heavyiron | 811 | |
1373 | IgorA | 812 | slot_n dd ? |
205 | heavyiron | 813 | |
1373 | IgorA | 814 | flags dd ? |
205 | heavyiron | 815 | |
816 | scr_buf: |
||
1373 | IgorA | 817 | .ptr dd ? |
818 | .end_ptr dd ? |
||
205 | heavyiron | 819 | .size: |
820 | .height dw ? |
||
1373 | IgorA | 821 | .width dw ? |
205 | heavyiron | 822 | |
823 | fs_struc: |
||
824 | .funk_n dd ? |
||
1373 | IgorA | 825 | dd ? |
826 | dd ? |
||
827 | .bytes_to_write dd ? |
||
828 | .data_ptr dd ?,? |
||
205 | heavyiron | 829 | .fn_ptr dd ? |
830 | |||
831 | sf_buf: |
||
832 | .bmp_header dd ? |
||
833 | .bmp_area dd ? |
||
1373 | IgorA | 834 | .end dd ? |
205 | heavyiron | 835 | |
307 | Lrz | 836 | set_rect_window_pid dd ? |
837 | set_rect_window_slot dd ? |
||
1608 | mario79 | 838 | ;--------------------------------------------------------------------- |
1098 | Lrz | 839 | align 4 |
307 | Lrz | 840 | rect_input_buffer: |
6766 | IgorA | 841 | .left rb 8 |
842 | .top rb 8 |
||
843 | .width rb 8 |
||
844 | .height rb 8 |
||
307 | Lrz | 845 | |
205 | heavyiron | 846 | cmdstr rb 257 |
1608 | mario79 | 847 | ;--------------------------------------------------------------------- |
1098 | Lrz | 848 | align 4 |
205 | heavyiron | 849 | |
850 | file_name: |
||
1373 | IgorA | 851 | rb 1058 |
205 | heavyiron | 852 | |
853 | scr screen_prop |
||
307 | Lrz | 854 | rect: |
855 | .left dw ? |
||
856 | .top dw ? |
||
857 | .height dw ? |
||
858 | .width dw ? |
||
859 | |||
205 | heavyiron | 860 | sc sys_color_table |
1373 | IgorA | 861 | app procinfo ; информация о главном окне |
307 | Lrz | 862 | active_app procinfo ; информация об активном окне |
863 | set_rect_window_procinfo procinfo ; информация об окне области |
||
1608 | mario79 | 864 | ;--------------------------------------------------------------------- |
865 | rb 512 ; стек потока фотканья |
||
866 | shoot_esp: |
||
867 | ;--------------------------------------------------------------------- |
||
868 | rb 512 ; стек окна области |
||
869 | set_rect_window_esp: |
||
870 | ;--------------------------------------------------------------------- |
||
1098 | Lrz | 871 | ; app_end ; конец программы |
1214 | Lrz | 872 | mouse_dd rd 1 |
1608 | mario79 | 873 | ;--------------------------------------------------------------------- |
1098 | Lrz | 874 | align 4 |
6763 | IgorA | 875 | cur_dir_path rb 4096 |
876 | library_path rb 4096 |
||
877 | temp_dir_pach rb 4096 |
||
878 | text_work_area rb 1024 |
||
879 | fname_buf rb 4096 |
||
880 | procinfo rb 1024 |
||
881 | filename_area rb 256 |
||
1608 | mario79 | 882 | ;--------------------------------------------------------------------- |
883 | rb 1024 |
||
1098 | Lrz | 884 | i_end_tread: |
1608 | mario79 | 885 | ;--------------------------------------------------------------------- |
886 | rb 1024 |
||
887 | stacktop: |
||
888 | ;--------------------------------------------------------------------- |
||
1098 | Lrz | 889 | i_end:188,[label1.top]>4,0>35,15>4,302>10,30> |