Subversion Repositories Kolibri OS

Rev

Rev 1685 | Rev 2246 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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