Subversion Repositories Kolibri OS

Rev

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