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