Subversion Repositories Kolibri OS

Rev

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