Rev 1373 | Rev 1610 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1608 | mario79 | 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 | ;--------------------------------------------------------------------- |
||
1373 | IgorA | 10 | ; 01.06.09 - Компоненты беруться из системной библиотеки |
205 | heavyiron | 11 | ; Автор программы Евтихов Максим (Maxxxx32) |
833 | Lrz | 12 | ; 24.07.2008 |
307 | Lrz | 13 | ; 01.02.07 - обновлён editbox |
14 | ; 31.01.07 - всё теперь рисуется относительно клиентской области |
||
205 | heavyiron | 15 | |
1608 | mario79 | 16 | title equ 'Screenshooter v 1.0' ; Заголовок окна |
1109 | Lrz | 17 | include '../../develop/libraries/box_lib/load_lib.mac' |
1373 | IgorA | 18 | include '../../develop/libraries/box_lib/trunk/box_lib.mac' |
1098 | Lrz | 19 | ;include '../../develop/examples/editbox/trunk/editbox.inc' |
20 | include '../../macros.inc' |
||
21 | include 'txtbut.inc' |
||
22 | include 'label.inc' |
||
23 | include 'textwork.inc' |
||
1228 | Lrz | 24 | include 'scrshoot.mac' |
205 | heavyiron | 25 | |
1098 | Lrz | 26 | ;include 'macros.inc' ; вставляем макросы |
27 | ; meos_header cmdstr ; вставляем заголовок программы |
||
1373 | IgorA | 28 | use32 |
1098 | Lrz | 29 | org 0x0 |
30 | db 'MENUET01' |
||
31 | dd 0x1 |
||
32 | dd start |
||
1608 | mario79 | 33 | dd IM_END |
1098 | Lrz | 34 | dd i_end |
1608 | mario79 | 35 | dd stacktop |
1098 | Lrz | 36 | dd cmdstr |
37 | dd cur_dir_path |
||
38 | |||
39 | align 4 |
||
1373 | IgorA | 40 | @use_library |
41 | use_txt_button ; | |
||
42 | use_label ; |-- GUI компоненты и некоторые процедуры |
||
43 | use_text_work ; / |
||
1228 | Lrz | 44 | include 'scrwin.inc' ; вставляем код окна прдпросмотра |
45 | include 'scrsavef.inc'; вставляем процедуру сохранения файла |
||
46 | |||
307 | Lrz | 47 | include 'gp.inc' |
48 | include 'srectwin.inc' |
||
310 | heavyiron | 49 | include 'lang.inc' |
1373 | IgorA | 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 | |||
205 | heavyiron | 68 | ;--- начало программы --- |
1098 | Lrz | 69 | align 4 |
70 | start: |
||
1608 | mario79 | 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 | |||
1098 | Lrz | 76 | ;if return code =-1 then exit, else nornary work |
77 | ; cmp eax,-1 |
||
1373 | IgorA | 78 | inc eax |
79 | test eax,eax |
||
80 | jz close |
||
1098 | Lrz | 81 | ;;;;;;;;;;;;;;;; init memory 68/11 |
1373 | IgorA | 82 | mov eax,68 |
83 | mov ebx,11 |
||
84 | mcall |
||
85 | test eax,eax |
||
86 | jz close |
||
1098 | Lrz | 87 | |
1608 | mario79 | 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 | ;--------------------------------------------------------------------- |
||
1373 | IgorA | 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 |
||
205 | heavyiron | 128 | |
1373 | IgorA | 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 |
||
205 | heavyiron | 136 | |
1373 | IgorA | 137 | mov ebx,app |
138 | call get_slot_n |
||
139 | mov [slot_n],ecx |
||
205 | heavyiron | 140 | |
1373 | IgorA | 141 | ; устанавливаем маску событий |
142 | set_events_mask (evm_redraw+evm_key+evm_button+evm_mouse+evm_ipc) |
||
205 | heavyiron | 143 | |
144 | ; сюда прыгаем при каждой перерисовке |
||
145 | red: |
||
1373 | IgorA | 146 | get_procinfo app ; получаем информацию о процессе |
147 | get_sys_colors sc ; получаем системные цвета |
||
205 | heavyiron | 148 | |
1373 | IgorA | 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 ; / |
||
205 | heavyiron | 154 | |
1373 | IgorA | 155 | get_screen_prop scr ; получаем информацию об экране |
156 | call draw_window ; перерисовываем окно |
||
205 | heavyiron | 157 | still: |
1373 | IgorA | 158 | wait_event red,key,button,mouse,ipc,still ; ждем событий |
205 | heavyiron | 159 | |
160 | key: |
||
1373 | IgorA | 161 | get_key |
162 | cmp al,2 |
||
163 | jne @f |
||
164 | cmp ah,55 |
||
1608 | mario79 | 165 | jne still |
166 | mov [PrintScreen],1 |
||
1373 | IgorA | 167 | call shoot |
1608 | mario79 | 168 | mov [PrintScreen],0 |
1373 | IgorA | 169 | jmp still |
205 | heavyiron | 170 | @@: |
1098 | Lrz | 171 | ; key_edit_boxes editboxes,editboxes_end |
1608 | mario79 | 172 | ; push dword edit1 |
173 | ; call [edit_box_key] |
||
1098 | Lrz | 174 | |
1373 | IgorA | 175 | push dword edit2 |
176 | call [edit_box_key] |
||
1098 | Lrz | 177 | |
1373 | IgorA | 178 | push dword edit3 |
179 | call [edit_box_key] |
||
1098 | Lrz | 180 | |
1373 | IgorA | 181 | push dword edit4 |
182 | call [edit_box_key] |
||
1098 | Lrz | 183 | |
1373 | IgorA | 184 | jmp still |
205 | heavyiron | 185 | button: |
1373 | IgorA | 186 | get_pressed_button |
187 | cmp ah,1 |
||
188 | je p_close |
||
189 | txt_but_ev buttons,buttons_end |
||
190 | jmp still |
||
205 | heavyiron | 191 | mouse: |
1373 | IgorA | 192 | get_active_window |
193 | cmp eax,[slot_n] |
||
194 | jne still |
||
1098 | Lrz | 195 | ;---------------------------------- |
1608 | mario79 | 196 | ; push dword edit1 |
197 | ; call [edit_box_mouse] |
||
1373 | IgorA | 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] |
||
1098 | Lrz | 204 | ;---------------------------------- |
1373 | IgorA | 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] |
||
1098 | Lrz | 219 | ;----------------------------------- |
220 | ; mouse_check_boxes check_boxes,check_boxes_end |
||
221 | ; mouse_edit_boxes editboxes,editboxes_end |
||
1373 | IgorA | 222 | jmp still |
205 | heavyiron | 223 | ipc: |
1373 | IgorA | 224 | cmp word [app_ipc+8],2 |
225 | jne @f |
||
226 | min_window |
||
227 | jmp .clear_ipc |
||
205 | heavyiron | 228 | @@: |
1373 | IgorA | 229 | cmp word [app_ipc+8],3 |
230 | jne @f |
||
231 | mov ecx,[slot_n] |
||
232 | activ_window |
||
233 | jmp .clear_ipc |
||
1100 | Lrz | 234 | @@: |
1373 | IgorA | 235 | call draw_number |
236 | call dr_st |
||
205 | heavyiron | 237 | |
238 | .clear_ipc: |
||
1373 | IgorA | 239 | cld |
240 | xor eax,eax |
||
241 | mov ecx,32/4 |
||
242 | mov edi,app_ipc |
||
243 | rep stosd |
||
244 | jmp still |
||
205 | heavyiron | 245 | |
246 | p_close: |
||
1373 | IgorA | 247 | btr dword [flags],1 |
307 | Lrz | 248 | |
1373 | IgorA | 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 |
||
307 | Lrz | 255 | @@: |
256 | |||
205 | heavyiron | 257 | close: |
1373 | IgorA | 258 | app_close |
205 | heavyiron | 259 | |
1608 | mario79 | 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 |
||
205 | heavyiron | 269 | ;-------------------------------------------------------------------- |
270 | ;--- прооцедура перерисовки главного окна --------------------------- |
||
271 | ;-------------------------------------------------------------------- |
||
272 | draw_window: |
||
1373 | IgorA | 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 |
||
205 | heavyiron | 286 | |
1373 | IgorA | 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 |
||
205 | heavyiron | 312 | |
1373 | IgorA | 313 | call draw_number ; прорисовываем номер снимка |
314 | call dr_st |
||
205 | heavyiron | 315 | |
1373 | IgorA | 316 | draw_labels labels,labels_end ; метки |
1098 | Lrz | 317 | ; draw_edit_boxes editboxes,editboxes_end ; edit_box |
318 | ;------ show check editbox ----------- |
||
1608 | mario79 | 319 | ; push dword edit1 |
320 | ; call [edit_box_draw] |
||
1373 | IgorA | 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] |
||
1098 | Lrz | 327 | ;------ end check all editbox ------- |
328 | |||
1608 | mario79 | 329 | call draw_PathShow |
330 | |||
1373 | IgorA | 331 | draw_txt_buttons buttons,buttons_end ; кнопки |
1098 | Lrz | 332 | ; draw_check_boxes check_boxes,check_boxes_end ; флажки |
333 | ;------ check all checkbox --------- |
||
1373 | IgorA | 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] |
||
1098 | Lrz | 348 | ;------ end check all checkbox ------ |
349 | |||
205 | heavyiron | 350 | stop_draw_window ; конец перерисовки |
351 | ret |
||
352 | |||
353 | shoot: |
||
1373 | IgorA | 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 |
||
205 | heavyiron | 361 | @@: |
1373 | IgorA | 362 | call get_mem_for_shoot; получаем память для снимка |
205 | heavyiron | 363 | |
364 | |||
1373 | IgorA | 365 | bts dword [flags],0 ; нулевой флаг - снимок есть в памяти |
205 | heavyiron | 366 | |
1373 | IgorA | 367 | ; делаем снимок |
368 | draw_status shooting |
||
369 | mov esi,scr |
||
370 | mov edi,[scr_buf.ptr] |
||
371 | call copy_screen_to_image |
||
205 | heavyiron | 372 | |
1373 | IgorA | 373 | bt dword [use_rect.flags],1 |
374 | jc .use_rect |
||
375 | push dword [scr] |
||
376 | jmp @f |
||
307 | Lrz | 377 | .use_rect: |
1373 | IgorA | 378 | push dword [rect.height] |
307 | Lrz | 379 | @@: |
1373 | IgorA | 380 | pop dword [scr_buf.size] |
205 | heavyiron | 381 | |
1373 | IgorA | 382 | draw_status shooted_ok |
205 | heavyiron | 383 | |
1373 | IgorA | 384 | bt dword [flags],1 |
385 | jnc @f |
||
386 | ret |
||
205 | heavyiron | 387 | @@: |
388 | |||
1373 | IgorA | 389 | bt dword [ch2.flags],1 ; показать окно предпросмотра ? |
390 | jnc @f |
||
1608 | mario79 | 391 | cmp [PrintScreen],0 |
392 | jne @f |
||
1373 | IgorA | 393 | call show_scr_window |
1100 | Lrz | 394 | ret |
205 | heavyiron | 395 | @@: |
1608 | mario79 | 396 | bt dword [ch5.flags],1 ; включено ли автосохранение ? |
397 | jnc @f |
||
398 | |||
399 | ; invoke OpenDialog |
||
400 | push dword OpenDialog_data |
||
401 | call [OpenDialog_Start] |
||
402 | cmp [OpenDialog_data.status],1 |
||
403 | je .1 |
||
404 | ret |
||
405 | .1: |
||
406 | ; prepare for PathShow |
||
407 | push dword PathShow_data_1 |
||
408 | call [PathShow_prepare] |
||
409 | |||
410 | call save_file |
||
411 | @@: |
||
412 | |||
1373 | IgorA | 413 | bt word [ch3.flags],1 ; восстановить окно ? |
414 | jnc @f |
||
205 | heavyiron | 415 | |
1373 | IgorA | 416 | delay 100 |
417 | mov ecx,[slot_n] |
||
418 | activ_window |
||
205 | heavyiron | 419 | @@: |
420 | ret |
||
421 | |||
307 | Lrz | 422 | ;--- получить память для снимка --- |
205 | heavyiron | 423 | get_mem_for_shoot: |
1098 | Lrz | 424 | ;clean memory |
1373 | IgorA | 425 | mov ecx,dword [scr_buf.ptr] |
426 | mov ebx,13 |
||
427 | mov eax,68 |
||
428 | mcall |
||
1098 | Lrz | 429 | |
1373 | IgorA | 430 | bt dword [use_rect.flags],1 ; фоткать область экрана |
431 | jc .use_area |
||
432 | movzx ecx, word [scr.width] |
||
433 | movzx ebx, word [scr.height] |
||
434 | jmp @f |
||
307 | Lrz | 435 | .use_area: |
1373 | IgorA | 436 | call read_rect |
437 | movzx ecx, word [rect.width] |
||
438 | movzx ebx, word [rect.height] |
||
307 | Lrz | 439 | @@: |
1373 | IgorA | 440 | imul ecx,ebx |
441 | lea ecx,[ecx*3] |
||
1098 | Lrz | 442 | ; add ecx,i_end |
1373 | IgorA | 443 | mov ebx,12 |
444 | mov eax,68 |
||
445 | mcall |
||
446 | mov [scr_buf.ptr],eax |
||
447 | add eax,ecx |
||
448 | mov [scr_buf.end_ptr],ecx |
||
205 | heavyiron | 449 | ret |
450 | |||
451 | ;--- содать окно проедпросмотра --- |
||
452 | show_scr_window: |
||
453 | pusha |
||
1373 | IgorA | 454 | bt dword [flags],0 |
455 | jnc @f |
||
456 | mov eax,51 |
||
457 | xor ebx,ebx |
||
458 | inc ebx |
||
459 | mov ecx,scr_window |
||
460 | mov edx,i_end_tread-1000 |
||
461 | mcall |
||
205 | heavyiron | 462 | @@: |
463 | popa |
||
464 | ret |
||
465 | |||
466 | ;--- прочитать и нарисовать текущий номер --- |
||
467 | apply_number: |
||
1373 | IgorA | 468 | mov edi,ed_buffer.3 |
469 | call zstr_to_int |
||
470 | mov [cur_number],eax |
||
471 | call draw_number |
||
205 | heavyiron | 472 | ret |
473 | |||
474 | ;--- процедура прорисовки текущего номера --- |
||
475 | draw_number: |
||
1373 | IgorA | 476 | mov edi,sign_n_input |
477 | call zstr_to_int |
||
478 | mov [sign_n],al |
||
479 | mov eax,13 |
||
480 | mov ebx,150*65536+96 |
||
481 | mov cx,[label9.top] |
||
482 | shl ecx,16 |
||
483 | mov cx,10 |
||
484 | mov edx,[sc.work] |
||
485 | mcall |
||
486 | mov eax,47 |
||
487 | movsx bx,byte [sign_n] |
||
488 | shl ebx,16 |
||
489 | mov ecx,[cur_number] |
||
490 | mov dx,150 |
||
491 | shl edx,16 |
||
492 | mov dx,[label9.top] |
||
493 | mov esi,[sc.work_text] |
||
494 | mcall |
||
205 | heavyiron | 495 | ret |
496 | |||
497 | ;--- процедура, запускающая поток автосъемки --- |
||
498 | start_autoshoot: |
||
1373 | IgorA | 499 | bts dword [flags],1 |
500 | jc @f |
||
501 | mov eax,51 |
||
502 | ;mov ebx,1 |
||
503 | xor ebx,ebx |
||
504 | inc ebx |
||
505 | mov ecx,autoshoot |
||
506 | mov edx,i_end_tread-512 |
||
507 | mcall |
||
205 | heavyiron | 508 | @@: |
509 | ret |
||
510 | |||
511 | ;--- останавливает этот поток --- |
||
512 | stop_autoshoot: |
||
1373 | IgorA | 513 | btr dword [flags],1 |
205 | heavyiron | 514 | ret |
515 | |||
516 | ;--- цикл потока автосъемки --- |
||
517 | autoshoot: |
||
1373 | IgorA | 518 | mov ecx,[slot_n] |
519 | activ_window |
||
205 | heavyiron | 520 | .next: |
1373 | IgorA | 521 | bt dword [flags],1 |
522 | jnc close |
||
523 | mov eax,60 |
||
524 | mov ebx,2 |
||
525 | mov ecx,[app.pid] |
||
526 | mov edx,messages.draw_number |
||
527 | mov esi,2 |
||
528 | mcall |
||
529 | call shoot |
||
530 | jmp autoshoot.next |
||
205 | heavyiron | 531 | |
532 | ;--- процедура прорисовки строки состояния --- |
||
533 | ; (должна вызываться потоком главного окна) |
||
534 | dr_st: |
||
1373 | IgorA | 535 | mov eax,38 ; отрезок |
536 | mov ebx,0*65536+310 |
||
537 | mov ecx,198*65536+198 |
||
538 | mov edx,[sc.work_graph] |
||
539 | mcall |
||
205 | heavyiron | 540 | |
1373 | IgorA | 541 | mov eax,13 ; полоска |
542 | mov bx,310 |
||
543 | mov ecx,199*65536+15 |
||
544 | mov edx,[sc.work] |
||
545 | mcall |
||
205 | heavyiron | 546 | |
1373 | IgorA | 547 | mov edi,status |
548 | call draw_label |
||
205 | heavyiron | 549 | ret |
550 | |||
551 | ;--- процедура получения номера слота потока --- |
||
552 | ; вход ebx - буффер 1024 байт |
||
553 | ; выход ecx - номер слота |
||
554 | get_slot_n: |
||
1373 | IgorA | 555 | mov eax,9 |
556 | xor ecx,ecx |
||
557 | dec ecx |
||
558 | mcall |
||
205 | heavyiron | 559 | |
1373 | IgorA | 560 | mov edx,[ebx+30] |
561 | xor ecx,ecx |
||
205 | heavyiron | 562 | @@: |
1373 | IgorA | 563 | mov eax,9 |
564 | inc ecx |
||
565 | mcall |
||
566 | cmp [ebx+30],edx |
||
567 | je @f |
||
568 | jmp @b |
||
205 | heavyiron | 569 | @@: |
570 | ret |
||
571 | |||
307 | Lrz | 572 | ;--- процедура, запускающая поток, делающий 1 снимок --- |
205 | heavyiron | 573 | one_shoot: |
1373 | IgorA | 574 | mov ecx,one_shoot_thread |
575 | mov edx,shoot_esp |
||
576 | jmp @f |
||
307 | Lrz | 577 | ;--- процедра, запускающая поток, сохраняющий снимок --- |
205 | heavyiron | 578 | save_shoot: |
1608 | mario79 | 579 | ; invoke OpenDialog |
580 | push dword OpenDialog_data |
||
581 | call [OpenDialog_Start] |
||
582 | cmp [OpenDialog_data.status],1 |
||
583 | je .1 |
||
584 | ret |
||
585 | .1: |
||
586 | ; prepare for PathShow |
||
587 | push dword PathShow_data_1 |
||
588 | call [PathShow_prepare] |
||
589 | |||
590 | call draw_PathShow |
||
591 | |||
1373 | IgorA | 592 | mov ecx,save_shoot_thread |
593 | mov edx,shoot_esp |
||
205 | heavyiron | 594 | @@: |
1373 | IgorA | 595 | bts dword [flags],2 |
596 | jc .running |
||
597 | bt dword [flags],1 |
||
598 | jc .running |
||
205 | heavyiron | 599 | |
1373 | IgorA | 600 | mov eax,51 |
601 | ;mov ebx,1 |
||
602 | xor ebx,ebx |
||
603 | inc ebx |
||
604 | mcall |
||
205 | heavyiron | 605 | .running: |
606 | ret |
||
607 | |||
307 | Lrz | 608 | ;--- поток, делающий 1 снимок --- |
205 | heavyiron | 609 | one_shoot_thread: |
1373 | IgorA | 610 | mov ecx,[slot_n] |
611 | activ_window |
||
612 | bt dword [ch1.flags],1 ; минимизировать окно ? |
||
613 | jnc @f |
||
614 | mov eax,60 |
||
615 | mov ebx,2 |
||
616 | mov ecx,[app.pid] |
||
617 | mov edx,messages.min_window |
||
618 | mov esi,2 |
||
619 | mcall |
||
205 | heavyiron | 620 | @@: |
1373 | IgorA | 621 | call shoot |
622 | btr dword [flags],2 |
||
623 | jmp close |
||
205 | heavyiron | 624 | |
307 | Lrz | 625 | ;--- процедура, отправляющая главному окну сообщение о перерисовке |
626 | ; строки состояния --- |
||
205 | heavyiron | 627 | send_draw_status: |
1373 | IgorA | 628 | mov eax,60 |
629 | mov ebx,2 |
||
630 | mov ecx,[app.pid] |
||
631 | mov edx,messages.draw_status |
||
632 | mov esi,2 |
||
633 | mcall |
||
205 | heavyiron | 634 | ret |
635 | |||
307 | Lrz | 636 | ;--- поток, сохраняюий файл --- |
205 | heavyiron | 637 | save_shoot_thread: |
1373 | IgorA | 638 | mov ecx,[slot_n] |
639 | activ_window |
||
640 | call save_file |
||
641 | btr dword [flags],2 |
||
642 | jmp close |
||
205 | heavyiron | 643 | |
307 | Lrz | 644 | ;--- процедура, запускающая поток окна установки области съемки --- |
645 | show_set_rect_window: |
||
1373 | IgorA | 646 | bts dword [flags],3 |
647 | jc @f |
||
648 | mov eax,51 |
||
649 | xor ebx,ebx |
||
650 | inc ebx |
||
651 | mov ecx,set_rect_window |
||
652 | mov edx,set_rect_window_esp |
||
653 | mcall |
||
307 | Lrz | 654 | |
1373 | IgorA | 655 | mov [set_rect_window_pid],eax |
307 | Lrz | 656 | ret |
657 | |||
658 | @@: |
||
1373 | IgorA | 659 | mov eax,18 |
660 | mov ebx,eax |
||
661 | mov ecx,[set_rect_window_pid] |
||
662 | mcall |
||
663 | btr dword [flags],3 |
||
307 | Lrz | 664 | ret |
665 | |||
666 | ;--- получение информации об активном окне --- |
||
667 | get_active_window_info: |
||
1373 | IgorA | 668 | mov eax,18 |
669 | mov ebx,7 |
||
670 | mcall |
||
307 | Lrz | 671 | |
1373 | IgorA | 672 | mov ecx,eax |
673 | mov eax,9 |
||
674 | mov ebx,active_app |
||
675 | mcall |
||
307 | Lrz | 676 | ret |
677 | |||
205 | heavyiron | 678 | ;==================================================================== |
679 | ;=== данные программы =============================================== |
||
680 | ;==================================================================== |
||
681 | messages: |
||
682 | .draw_number dw 0 |
||
683 | .draw_status dw 1 |
||
684 | .min_window dw 2 |
||
1100 | Lrz | 685 | .act_window dw 3 |
205 | heavyiron | 686 | |
687 | grab_text: |
||
1373 | IgorA | 688 | db title,0 |
307 | Lrz | 689 | |
205 | heavyiron | 690 | labels: |
307 | Lrz | 691 | label1 label 5,5,0,text.1 ; ширина экрана |
692 | label2 label 5,15,0,text.2 ; высота экрана |
||
693 | label3 label 5,25,0,text.3 ; введите имя файла |
||
694 | label4 label 150,5,0,text.4 ; бит на пиксель |
||
695 | label5 label 150,15,0,text.5 ; байт на строку |
||
696 | label6 label 115,138,0,text.6 ; 100 = 1 сек. |
||
205 | heavyiron | 697 | ;label7 label 10,190,0,text.7 |
698 | ;label8 label 10,225,0,text.8 |
||
307 | Lrz | 699 | label9 label 5,52,0,text.9 ; номер текущего симка |
700 | label10 label 5,185,0,text.10 |
||
701 | status label 5,201,0,no_shoot |
||
205 | heavyiron | 702 | labels_end: |
703 | |||
1608 | mario79 | 704 | ;--------------------------------------------------------------------- |
705 | l_libs_start: |
||
706 | |||
707 | library01 l_libs system_dir_Boxlib+9, cur_dir_path, library_path, system_dir_Boxlib, \ |
||
708 | err_message_found_lib1, head_f_l, Box_lib_import, err_message_import1, head_f_i |
||
709 | |||
710 | library02 l_libs system_dir_ProcLib+9, cur_dir_path, library_path, system_dir_ProcLib, \ |
||
711 | err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i |
||
712 | |||
713 | end_l_libs: |
||
714 | ;--------------------------------------------------------------------- |
||
205 | heavyiron | 715 | editboxes: |
1608 | mario79 | 716 | ;edit1 edit_box 300,5,35,cl_white,0,0,0,0,300,ed_buffer.1,mouse_dd,ed_focus,10,10 ; путь к файлу |
1373 | IgorA | 717 | edit2 edit_box 35,75,134,cl_white,0,0,0,0,9,ed_buffer.2,mouse_dd,ed_figure_only,3,3 ; задержка |
1228 | Lrz | 718 | edit3 edit_box 35,165,164,cl_white,0,0,0,0,9,ed_buffer.3,mouse_dd,ed_figure_only ; автонумерация |
719 | edit4 edit_box 16,165,181,cl_white,0,0,0,0,1,sign_n_input,mouse_dd,ed_figure_only,1 |
||
205 | heavyiron | 720 | editboxes_end: |
1608 | mario79 | 721 | ;--------------------------------------------------------------------- |
205 | heavyiron | 722 | buttons: |
1373 | IgorA | 723 | but1 txt_button 150,5,15,65,2,0,0,but_text.1,one_shoot ; сделать снимок |
724 | but2 txt_button 145,160,15,65,3,0,0,but_text.2,save_shoot ; сохранить снимок |
||
307 | Lrz | 725 | but3 txt_button 140,115,12,120,4,0,0,but_text.3,show_scr_window ; показать снимок |
1373 | IgorA | 726 | but4 txt_button 80,205,15,163,5,0,0,but_text.4,apply_number ; применить номер |
727 | but5 txt_button 150,5,15,85,6,0,0,but_text.5,start_autoshoot ; начать автосъёмку |
||
728 | but6 txt_button 145,160,15,85,7,0,0,but_text.6,stop_autoshoot ; остановить автосъёмку |
||
307 | Lrz | 729 | but7 txt_button 40,205,10,150,8,0,0,but_text.7,show_set_rect_window ; задать область |
205 | heavyiron | 730 | buttons_end: |
1608 | mario79 | 731 | ;--------------------------------------------------------------------- |
205 | heavyiron | 732 | check_boxes: |
1098 | Lrz | 733 | ch1 check_box 5,105,5,11,cl_white,0,0,ch_text.1,(ch_text.2-ch_text.1),ch_flag_en ; свернуть окно |
734 | ch2 check_box 5,120,5,11,cl_white,0,0,ch_text.2,(ch_text.3-ch_text.2),ch_flag_en ; затем сделать активным |
||
735 | ch3 check_box 145,105,5,11,cl_white,0,0,ch_text.3,(ch_text.4-ch_text.3),ch_flag_en ; показать снимок |
||
736 | ch4 check_box 5,135,5,11,cl_white,0,0,ch_text.4,(ch_text.5-ch_text.4),ch_flag_en ; задержка |
||
1608 | mario79 | 737 | ch5 check_box 5,150,5,11,cl_white,0,0,ch_text.5,(ch_text.6-ch_text.5),ch_flag_en |
1098 | Lrz | 738 | ch6 check_box 5,165,5,11,cl_white,0,0,ch_text.6,(ch_text.7-ch_text.6),ch_flag_en |
739 | use_rect check_box 145,150,5,11,cl_white,0,0,ch_text.7,(ch_text.8-ch_text.7) ; исп. область |
||
205 | heavyiron | 740 | ; автонумерация |
741 | check_boxes_end: |
||
1608 | mario79 | 742 | ;--------------------------------------------------------------------- |
205 | heavyiron | 743 | if lang eq ru |
744 | text: |
||
307 | Lrz | 745 | .2 db 'Высота экрана:',0 |
746 | .1 db 'Ширина экрана:',0 |
||
747 | .3 db 'Введите полный путь к файлу:',0 |
||
748 | .4 db 'Бит на пиксель:',0 |
||
749 | .5 db 'Байт на строку:',0 |
||
750 | .6 db '100 = 1 секунда',0 |
||
205 | heavyiron | 751 | ;.7: db 'Введите имя файла:',0 |
752 | ;.8: db 'Вместо "*" в имени файла будет вставляться номер.',0 |
||
307 | Lrz | 753 | .9 db 'Номер текущего снимка:',0 |
754 | .10 db 'Количество знаков в номере:',0 |
||
205 | heavyiron | 755 | |
756 | but_text: |
||
307 | Lrz | 757 | .1 db 'Сделать снимок экрана',0 |
758 | .2 db 'Сохранить снимок экрана',0 |
||
759 | .3 db 'Показать снимок сейчас',0 |
||
760 | .4 db 'Применить',0 |
||
761 | .5 db 'Начать автосъемку',0 |
||
762 | .6 db 'Остановить автосъемку',0 |
||
763 | .7 db 'задать',0 |
||
205 | heavyiron | 764 | |
765 | ch_text: |
||
766 | .1 db 'Свернуть окно';,0 |
||
767 | .2 db 'Показать снимок';,0 |
||
768 | .3 db 'затем сделать активным';,0 |
||
307 | Lrz | 769 | .4 db 'Задержка:';,0 |
770 | .5 db 'Автосохранение';,0 |
||
771 | .6 db 'Автонумерация, начиная с';,0 |
||
772 | .7 db 'Область' |
||
773 | .8: |
||
205 | heavyiron | 774 | |
775 | no_shoot db 'Снимок не сделан',0 |
||
776 | shooting db 'Фотографирование...',0 |
||
777 | shooted_ok db 'Снимок сделан',0 |
||
778 | saving db 'Сохранение...',0 |
||
779 | saved_ok db 'Снимок сохранен',0 |
||
780 | delay_now db 'Задержка...',0 |
||
781 | bad_file_name db 'Имя файла введено неверно',0 |
||
782 | disk_filled db 'Диск заполнен',0 |
||
783 | bad_fat_table db 'Таблица FAT разрушена',0 |
||
784 | ac_den db 'Доступ запрещен',0 |
||
785 | device_er db 'Ошибка устройства',0 |
||
786 | not_shooted db 'Сделайте снимок !!!',0 |
||
787 | no_file_name db 'Введите имя файла !!!',0 |
||
307 | Lrz | 788 | invalid_rect db 'Недопустимые размеры области',0 |
310 | heavyiron | 789 | |
790 | else |
||
791 | text: |
||
792 | .2 db 'Screen width:',0 |
||
793 | .1 db 'Screen height:',0 |
||
794 | .3 db 'Enter full path to the file:',0 |
||
795 | .4 db 'Bits per pixel:',0 |
||
796 | .5 db 'Bytes per line:',0 |
||
797 | .6 db '100 = 1 second',0 |
||
798 | ;.7: db 'Enter name of file:',0 |
||
799 | ;.8: db 'Instead of "*" in filename the number will be included.',0 |
||
800 | .9 db 'Current photo number:',0 |
||
801 | .10 db 'Amount of digits in number:',0 |
||
802 | |||
803 | but_text: |
||
804 | .1 db 'Make screen photo',0 |
||
805 | .2 db 'Save screen photo',0 |
||
806 | .3 db 'Show photo now',0 |
||
807 | .4 db 'Apply',0 |
||
808 | .5 db 'Start autoshooting',0 |
||
809 | .6 db 'Stop autoshooting',0 |
||
810 | .7 db 'Set',0 |
||
811 | |||
812 | ch_text: |
||
813 | .1 db 'Minimize window';,0 |
||
814 | .2 db 'Show photo';,0 |
||
815 | .3 db 'then make active';,0 |
||
816 | .4 db 'Delay:';,0 |
||
817 | .5 db 'Autosave';,0 |
||
818 | .6 db 'Start numeration from';,0 |
||
819 | .7 db 'Area' |
||
820 | .8: |
||
821 | |||
822 | no_shoot db 'There is no photo',0 |
||
823 | shooting db 'Photographing...',0 |
||
824 | shooted_ok db 'Photo created',0 |
||
825 | saving db 'Saving...',0 |
||
826 | saved_ok db 'Photo saved',0 |
||
827 | delay_now db 'Delay...',0 |
||
828 | bad_file_name db 'File name is wrong',0 |
||
829 | disk_filled db 'Disk is full',0 |
||
830 | bad_fat_table db 'FAT table destroyed',0 |
||
831 | ac_den db 'Access denied',0 |
||
832 | device_er db 'Device error',0 |
||
1098 | Lrz | 833 | not_shooted db 'Make a photo !!!',0 |
310 | heavyiron | 834 | no_file_name db 'Enter file name !!!',0 |
835 | invalid_rect db 'Wrong area size',0 |
||
836 | |||
205 | heavyiron | 837 | end if |
838 | |||
1608 | mario79 | 839 | ;--------------------------------------------------------------------- |
840 | PathShow_data_1: |
||
841 | .type dd 0 ;+0 |
||
842 | .start_y dw 38 ;+4 |
||
843 | .start_x dw 6 ;+6 |
||
844 | .font_size_x dw 6 ;+8 ; 6 - for font 0, 8 - for font 1 |
||
845 | .area_size_x dw 300 ;+10 |
||
846 | .font_number dd 0 ;+12 ; 0 - monospace, 1 - variable |
||
847 | .background_flag dd 0 ;+16 |
||
848 | .font_color dd 0x0 ;+20 |
||
849 | .background_color dd 0x0 ;+24 |
||
850 | .text_pointer dd fname_buf ;+28 |
||
851 | .work_area_pointer dd text_work_area ;+32 |
||
852 | .temp_text_length dd 0 ;+36 |
||
853 | ;--------------------------------------------------------------------- |
||
854 | OpenDialog_data: |
||
855 | .type dd 1 ; Save |
||
856 | .procinfo dd procinfo ;+4 |
||
857 | .com_area_name dd communication_area_name ;+8 |
||
858 | .com_area dd 0 ;+12 |
||
859 | .opendir_pach dd temp_dir_pach ;+16 |
||
860 | .dir_default_pach dd communication_area_default_pach ;+20 |
||
861 | .start_path dd open_dialog_path ;+24 |
||
862 | .draw_window dd draw_window ;+28 |
||
863 | .status dd 0 ;+32 |
||
864 | .openfile_pach dd fname_buf ;+36 |
||
865 | .filename_area dd filename_area ;+40 |
||
866 | .filter_area dd Filter |
||
867 | .x: |
||
868 | .x_size dw 420 ;+48 ; Window X size |
||
869 | .x_start dw 10 ;+50 ; Window X position |
||
870 | .y: |
||
871 | .y_size dw 320 ;+52 ; Window y size |
||
872 | .y_start dw 10 ;+54 ; Window Y position |
||
873 | |||
874 | communication_area_name: |
||
875 | db 'FFFFFFFF_open_dialog',0 |
||
876 | open_dialog_path: |
||
877 | db '/sys/File Managers/opendial',0 |
||
878 | communication_area_default_pach: |
||
879 | db '/sys',0 |
||
880 | |||
881 | Filter: |
||
882 | dd Filter.end - Filter |
||
883 | .1: |
||
884 | db 'BMP',0 |
||
885 | .end: |
||
886 | db 0 |
||
887 | |||
888 | start_temp_file_name: db '1.bmp',0 |
||
889 | |||
890 | ;--------------------------------------------------------------------- |
||
205 | heavyiron | 891 | sign_n_input: |
1373 | IgorA | 892 | db '2',0 |
205 | heavyiron | 893 | |
1608 | mario79 | 894 | PrintScreen db 0 |
895 | |||
205 | heavyiron | 896 | app_ipc ipc_buffer 32 |
1098 | Lrz | 897 | align 4 |
205 | heavyiron | 898 | |
451 | heavyiron | 899 | mouse_flag: dd 0x0 |
1608 | mario79 | 900 | ;--------------------------------------------------------------------- |
901 | align 4 |
||
902 | |||
903 | ed_buffer: |
||
904 | .1: db '/sys/1.bmp',0 |
||
905 | ;rb 287 |
||
906 | .2: |
||
907 | db '100',0 |
||
908 | rb 6 |
||
909 | .3: |
||
910 | rb 10 |
||
911 | ;--------------------------------------------------------------------- |
||
912 | IM_END: |
||
913 | ;--------------------------------------------------------------------- |
||
451 | heavyiron | 914 | structure_of_potock: |
915 | rb 100 |
||
1608 | mario79 | 916 | ;--------------------------------------------------------------------- |
1098 | Lrz | 917 | align 4 |
918 | |||
1373 | IgorA | 919 | cur_number dd ? |
205 | heavyiron | 920 | |
1373 | IgorA | 921 | sign_n db ? |
205 | heavyiron | 922 | |
1373 | IgorA | 923 | slot_n dd ? |
205 | heavyiron | 924 | |
1373 | IgorA | 925 | flags dd ? |
205 | heavyiron | 926 | |
927 | scr_buf: |
||
1373 | IgorA | 928 | .ptr dd ? |
929 | .end_ptr dd ? |
||
205 | heavyiron | 930 | .size: |
931 | .height dw ? |
||
1373 | IgorA | 932 | .width dw ? |
205 | heavyiron | 933 | |
934 | fs_struc: |
||
935 | .funk_n dd ? |
||
1373 | IgorA | 936 | dd ? |
937 | dd ? |
||
938 | .bytes_to_write dd ? |
||
939 | .data_ptr dd ?,? |
||
205 | heavyiron | 940 | .fn_ptr dd ? |
941 | |||
942 | sf_buf: |
||
943 | .bmp_header dd ? |
||
944 | .bmp_area dd ? |
||
1373 | IgorA | 945 | .end dd ? |
205 | heavyiron | 946 | |
307 | Lrz | 947 | set_rect_window_pid dd ? |
948 | set_rect_window_slot dd ? |
||
1608 | mario79 | 949 | ;--------------------------------------------------------------------- |
1098 | Lrz | 950 | align 4 |
307 | Lrz | 951 | rect_input_buffer: |
952 | .left rb 6 |
||
953 | .top rb 6 |
||
1373 | IgorA | 954 | .width rb 6 |
307 | Lrz | 955 | .height rb 6 |
956 | |||
205 | heavyiron | 957 | cmdstr rb 257 |
1608 | mario79 | 958 | ;--------------------------------------------------------------------- |
1098 | Lrz | 959 | align 4 |
205 | heavyiron | 960 | |
961 | file_name: |
||
1373 | IgorA | 962 | rb 1058 |
205 | heavyiron | 963 | |
964 | scr screen_prop |
||
307 | Lrz | 965 | rect: |
966 | .left dw ? |
||
967 | .top dw ? |
||
968 | .height dw ? |
||
969 | .width dw ? |
||
970 | |||
205 | heavyiron | 971 | sc sys_color_table |
1373 | IgorA | 972 | app procinfo ; информация о главном окне |
307 | Lrz | 973 | active_app procinfo ; информация об активном окне |
974 | set_rect_window_procinfo procinfo ; информация об окне области |
||
1608 | mario79 | 975 | ;--------------------------------------------------------------------- |
976 | rb 512 ; стек потока фотканья |
||
977 | shoot_esp: |
||
978 | ;--------------------------------------------------------------------- |
||
979 | rb 512 ; стек окна области |
||
980 | set_rect_window_esp: |
||
981 | ;--------------------------------------------------------------------- |
||
1098 | Lrz | 982 | ; app_end ; конец программы |
1214 | Lrz | 983 | mouse_dd rd 1 |
1608 | mario79 | 984 | ;--------------------------------------------------------------------- |
1098 | Lrz | 985 | align 4 |
1608 | mario79 | 986 | cur_dir_path: |
987 | rb 4096 |
||
988 | ;--------------------------------------------------------------------- |
||
989 | library_path: |
||
990 | rb 4096 |
||
991 | ;--------------------------------------------------------------------- |
||
992 | temp_dir_pach: |
||
993 | rb 4096 |
||
994 | ;--------------------------------------------------------------------- |
||
995 | text_work_area: |
||
996 | rb 1024 |
||
997 | ;--------------------------------------------------------------------- |
||
998 | fname_buf: |
||
999 | rb 4096 |
||
1000 | ;--------------------------------------------------------------------- |
||
1001 | procinfo: |
||
1002 | rb 1024 |
||
1003 | ;--------------------------------------------------------------------- |
||
1004 | filename_area: |
||
1005 | rb 256 |
||
1006 | ;--------------------------------------------------------------------- |
||
1007 | rb 1024 |
||
1098 | Lrz | 1008 | i_end_tread: |
1608 | mario79 | 1009 | ;--------------------------------------------------------------------- |
1010 | rb 1024 |
||
1011 | stacktop: |
||
1012 | ;--------------------------------------------------------------------- |
||
1098 | Lrz | 1013 | i_end:35,15>4,302> |