Subversion Repositories Kolibri OS

Rev

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