Subversion Repositories Kolibri OS

Rev

Rev 1098 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
310 heavyiron 1
set_rect_window:
2
	mov	ebx,set_rect_window_procinfo
3
	call	get_slot_n
4
 
5
	mov	[set_rect_window_slot],ecx
6
 
7
	set_events_mask (evm_redraw+evm_key+evm_button+evm_mouse)
8
.red:
9
	edit_boxes_set_sys_color rect_input,rect_input_end,sc
10
	labels_set_sys_color rect_input_labels,rect_input_labels_end,sc
11
	check_boxes_set_sys_color riw_check_boxes,riw_check_boxes_end,sc
12
	call	.draw_window
13
.still:
14
	wait_event .red,.key,.button,.mouse
15
 
16
.key:
17
	get_key
18
 
19
	key_edit_boxes rect_input,rect_input_end
20
 
21
	call	read_rect
22
	call	draw_rect_on_screen
23
 
24
	jmp	.still
25
 
26
.button:
27
	get_pressed_button
28
 
29
	cmp	ah,1
30
	jne	@f
31
	btr	dword [flags],3
32
	jmp	close
33
@@:
34
 
35
	jmp	.still
36
 
37
.mouse:
38
	get_active_window
39
	cmp	eax,[set_rect_window_slot]
40
	jne	.still
41
 
42
	mouse_edit_boxes rect_input,rect_input_end
43
	mouse_check_boxes riw_check_boxes,riw_check_boxes_end
44
 
45
	jmp	.still
46
 
47
.draw_window:
48
	start_draw_window
49
 
50
	xor	eax,eax
51
	mov	ebx,100*65536+250
52
	mov	ecx,100*65536+130
53
	mov	edx,[sc.work]
54
	add	edx,0x33000000
55
	mov	edi,riw_grab_text
56
	xor	esi,esi
57
	int	0x40
58
 
59
	draw_labels rect_input_labels,rect_input_labels_end
60
 
61
	draw_edit_boxes rect_input,rect_input_end
62
 
63
	draw_check_boxes riw_check_boxes,riw_check_boxes_end
64
 
65
	call	read_rect
66
	call	draw_rect_on_screen
67
 
68
	stop_draw_window
69
ret
70
 
71
;--------------------------------------------------------------------
72
;--- Считывание облати ----------------------------------------------
73
;--------------------------------------------------------------------
74
read_rect:
75
	bt	dword [use_rect_active_window.flags],1
76
	jc	read_rect_from_active_window
77
 
78
	mov	edi,rect_input_buffer.left
79
	call	zstr_to_int
80
	cmp	ax,[scr.width]
81
	jb	@f
82
	mov	ax,[scr.width]
83
@@:
84
	mov	[rect.left],ax
85
 
86
	mov	edi,rect_input_buffer.top
87
	call	zstr_to_int
88
	cmp	ax,[scr.height]
89
	jb	@f
90
	mov	ax,[scr.height]
91
@@:
92
	mov	[rect.top],ax
93
 
94
	mov	edi,rect_input_buffer.width
95
	call	zstr_to_int
96
	mov	bx,[scr.width]
97
	sub	bx,[rect.left]
98
	cmp	ax,bx
99
	jb	@f
100
	mov	ax,bx
101
@@:
102
	mov	[rect.width],ax
103
 
104
	mov	edi,rect_input_buffer.height
105
	call	zstr_to_int
106
	mov	bx,[scr.height]
107
	sub	bx,[rect.top]
108
	cmp	ax,bx
109
	jb	@f
110
	mov	ax,bx
111
@@:
112
	mov	[rect.height],ax
113
ret
114
 
115
read_rect_from_active_window:
116
	call	get_active_window_info
117
 
118
	mov	eax,[active_app.left]
119
	mov	[rect.left],ax
120
	mov	eax,[active_app.top]
121
	mov	[rect.top],ax
122
	mov	eax,[active_app.width]
123
	inc	eax
124
	mov	[rect.width],ax
125
	mov	eax,[active_app.height]
126
	inc	eax
127
	mov	[rect.height],ax
128
ret
129
 
130
draw_rect_on_screen:
131
 
132
	mov	eax,13
133
	mov	ebx,150*65536+80
134
	mov	ecx,5*65536+60
135
	xor	edx,edx
136
	int	0x40
137
 
138
	;movzx   eax,word [rect.left]
139
	;mul     word [scr.width]
140
	xor	edx,edx
141
	movzx	eax,word [scr.width]
142
	mov	ebx,80
143
	div	ebx
144
	mov	ebx,eax
145
 
146
	xor	edx,edx
147
	movzx	eax,word [rect.height]
148
	div	ebx
149
	push	ax
150
 
151
	xor	edx,edx
152
	movzx	eax,word [rect.width]
153
	div	ebx
154
	push	ax
155
 
156
	xor	edx,edx
157
	movzx	eax,word [rect.top]
158
	div	ebx
159
	push	ax
160
 
161
	xor	edx,edx
162
	movzx	eax,word [rect.left]
163
	div	ebx
164
	push	ax
165
 
166
	pop	bx
167
	add	bx,150
168
	shl    ebx,16
169
 
170
	pop	cx
171
	add	cx,5
172
	shl	ecx,16
173
 
174
	pop	bx
175
	pop	cx
176
 
177
	mov	edx,0xffffff
178
	mov	eax,13
179
	int	0x40
180
ret
181
 
182
rect_input:
183
.left	edit_box 35,95,5,cl_white,0,0,0,5,rect_input_buffer.left,\
184
ed_figure_only+ed_focus
185
.top	edit_box 35,95,25,cl_white,0,0,0,5,rect_input_buffer.top,\
186
ed_figure_only
187
.width	edit_box 35,95,45,cl_white,0,0,0,5,rect_input_buffer.width,\
188
ed_figure_only
189
.height edit_box 35,95,65,cl_white,0,0,0,5,rect_input_buffer.height,\
190
ed_figure_only
191
rect_input_end:
192
 
193
rect_input_labels:
194
.left label 10,10,0,rect_input_labels_text.left
195
.top label 10,30,0,rect_input_labels_text.top
196
.width label 10,50,0,rect_input_labels_text.width
197
.height label 10,70,0,rect_input_labels_text.height
198
rect_input_labels_end:
199
 
200
rect_input_labels_text:
201
.left db 'Отступ слева:',0
202
.top  db 'Отступ сверху:',0
203
.width	db 'Ширина:',0
204
.height db 'Высота:',0
205
 
206
riw_check_boxes:
207
use_rect_active_window check_box 10,85,cl_white,0,0,\
208
riw_check_boxes_text.1,\
209
riw_check_boxes_text.2-riw_check_boxes_text.1
210
riw_check_boxes_end:
211
 
212
riw_check_boxes_text:
213
.1 db 'Использовать область активного окна'
214
.2 db ''
215
 
216
riw_grab_text db 'Координаты и размеры области:',0