Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
6766 IgorA 1
align 4
310 heavyiron 2
set_rect_window:
1098 Lrz 3
        mov     ebx,set_rect_window_procinfo
4
        call    get_slot_n
310 heavyiron 5
 
1098 Lrz 6
        mov     [set_rect_window_slot],ecx
310 heavyiron 7
 
1098 Lrz 8
        set_events_mask (evm_redraw+evm_key+evm_button+evm_mouse)
6766 IgorA 9
        call    init_rect
10
        edit_boxes_set_sys_color rect_input,rect_input_end,sc
310 heavyiron 11
.red:
1098 Lrz 12
        labels_set_sys_color rect_input_labels,rect_input_labels_end,sc
3181 hidnplayr 13
        check_boxes_set_sys_color2 riw_check_boxes,riw_check_boxes_end,sc
1098 Lrz 14
        call    .draw_window
6766 IgorA 15
align 4
310 heavyiron 16
.still:
1098 Lrz 17
        wait_event .red,.key,.button,.mouse
310 heavyiron 18
 
19
.key:
1098 Lrz 20
        get_key
310 heavyiron 21
 
6763 IgorA 22
        stdcall    [edit_box_key], rect_input.left
23
        stdcall    [edit_box_key], rect_input.top
24
        stdcall    [edit_box_key], rect_input.width
25
        stdcall    [edit_box_key], rect_input.height
310 heavyiron 26
 
1098 Lrz 27
        call    read_rect
28
        call    draw_rect_on_screen
29
 
30
        jmp     .still
31
 
310 heavyiron 32
.button:
1098 Lrz 33
        get_pressed_button
310 heavyiron 34
 
1098 Lrz 35
        cmp     ah,1
36
        jne     @f
37
        btr     dword [flags],3
38
        jmp     close
310 heavyiron 39
@@:
40
 
1098 Lrz 41
        jmp     .still
310 heavyiron 42
 
43
.mouse:
1098 Lrz 44
        get_active_window
45
        cmp     eax,[set_rect_window_slot]
46
        jne     .still
310 heavyiron 47
 
6763 IgorA 48
        stdcall    [edit_box_mouse], rect_input.left
49
        stdcall    [edit_box_mouse], rect_input.top
50
        stdcall    [edit_box_mouse], rect_input.width
51
        stdcall    [edit_box_mouse], rect_input.height
310 heavyiron 52
 
1098 Lrz 53
;;;;;;;;;;;;;;;;;;;;;;
6763 IgorA 54
        stdcall    [check_box_mouse], use_rect_active_window
1098 Lrz 55
 
56
        jmp     .still
57
 
310 heavyiron 58
.draw_window:
1098 Lrz 59
        start_draw_window
310 heavyiron 60
 
1098 Lrz 61
        mov     edx,[sc.work]
62
        add     edx,0x33000000
63
        mov     edi,riw_grab_text
64
        xor     esi,esi
6763 IgorA 65
        mcall   SF_CREATE_WINDOW, 100*65536+250, 100*65536+130
310 heavyiron 66
 
1098 Lrz 67
        draw_labels rect_input_labels,rect_input_labels_end
310 heavyiron 68
 
6763 IgorA 69
        stdcall    [edit_box_draw], rect_input.left
70
        stdcall    [edit_box_draw], rect_input.top
71
        stdcall    [edit_box_draw], rect_input.width
72
        stdcall    [edit_box_draw], rect_input.height
1098 Lrz 73
;;;;;;;;;;;;;;;;;;;;;;
6763 IgorA 74
        stdcall    [check_box_draw], use_rect_active_window
1098 Lrz 75
 
76
        call    read_rect
77
        call    draw_rect_on_screen
78
 
79
        stop_draw_window
310 heavyiron 80
ret
81
 
6766 IgorA 82
align 4
83
init_rect:
84
        bt      dword [use_rect_active_window.flags],1
85
        jc      init_rect_from_active_window
86
pushad
87
        mov     edi,rect_input_buffer.left
88
        movsx   eax,word[rect.left]
89
		mov     ecx,rect_input.left
90
		call    init_editbox
91
        mov     edi,rect_input_buffer.top
92
        movsx   eax,word[rect.top]
93
		mov     ecx,rect_input.top
94
		call    init_editbox
95
        mov     edi,rect_input_buffer.width
96
        movsx   eax,word[rect.width]
97
		mov     ecx,rect_input.width
98
		call    init_editbox
99
        mov     edi,rect_input_buffer.height
100
        movsx   eax,word[rect.height]
101
		mov     ecx,rect_input.height
102
		call    init_editbox
103
popad
104
ret
105
 
106
align 4
107
init_rect_from_active_window:
108
 
109
ret
110
 
111
align 4
112
init_editbox:
113
		push    edi
114
		push    ecx
115
		xor     ebx,ebx
116
		inc     ebx
117
		cmp     eax,10
118
		jl @f
119
		inc     ebx
120
		@@:
121
		cmp     eax,100
122
		jl @f
123
		inc     ebx
124
		@@:
125
		cmp     eax,1000
126
		jl @f
127
		inc     ebx
128
		@@:
129
		call    int_to_str
130
		call    [edit_box_set_text] ;ecx,edi
131
ret
310 heavyiron 132
;--------------------------------------------------------------------
133
;--- Считывание облати ----------------------------------------------
134
;--------------------------------------------------------------------
135
read_rect:
1098 Lrz 136
        bt      dword [use_rect_active_window.flags],1
137
        jc      read_rect_from_active_window
310 heavyiron 138
 
1098 Lrz 139
        mov     edi,rect_input_buffer.left
140
        call    zstr_to_int
141
        cmp     ax,[scr.width]
142
        jb      @f
143
        mov     ax,[scr.width]
310 heavyiron 144
@@:
1098 Lrz 145
        mov     [rect.left],ax
310 heavyiron 146
 
1098 Lrz 147
        mov     edi,rect_input_buffer.top
148
        call    zstr_to_int
149
        cmp     ax,[scr.height]
150
        jb      @f
151
        mov     ax,[scr.height]
310 heavyiron 152
@@:
1098 Lrz 153
        mov     [rect.top],ax
310 heavyiron 154
 
1098 Lrz 155
        mov     edi,rect_input_buffer.width
156
        call    zstr_to_int
157
        mov     bx,[scr.width]
158
        sub     bx,[rect.left]
159
        cmp     ax,bx
160
        jb      @f
161
        mov     ax,bx
310 heavyiron 162
@@:
1098 Lrz 163
        mov     [rect.width],ax
310 heavyiron 164
 
1098 Lrz 165
        mov     edi,rect_input_buffer.height
166
        call    zstr_to_int
167
        mov     bx,[scr.height]
168
        sub     bx,[rect.top]
169
        cmp     ax,bx
170
        jb      @f
171
        mov     ax,bx
310 heavyiron 172
@@:
1098 Lrz 173
        mov     [rect.height],ax
310 heavyiron 174
ret
175
 
176
read_rect_from_active_window:
1098 Lrz 177
        call    get_active_window_info
310 heavyiron 178
 
1098 Lrz 179
        mov     eax,[active_app.left]
180
        mov     [rect.left],ax
181
        mov     eax,[active_app.top]
182
        mov     [rect.top],ax
183
        mov     eax,[active_app.width]
184
        inc     eax
185
        mov     [rect.width],ax
186
        mov     eax,[active_app.height]
187
        inc     eax
188
        mov     [rect.height],ax
310 heavyiron 189
ret
190
 
191
draw_rect_on_screen:
192
 
1098 Lrz 193
        xor     edx,edx
6763 IgorA 194
        mcall   SF_DRAW_RECT, 150*65536+80, 5*65536+60
310 heavyiron 195
 
1098 Lrz 196
        ;movzx   eax,word [rect.left]
197
        ;mul     word [scr.width]
198
        xor     edx,edx
199
        movzx   eax,word [scr.width]
200
        mov     ebx,80
201
        div     ebx
202
        mov     ebx,eax
310 heavyiron 203
 
1098 Lrz 204
        xor     edx,edx
205
        movzx   eax,word [rect.height]
206
        div     ebx
207
        push    ax
310 heavyiron 208
 
1098 Lrz 209
        xor     edx,edx
210
        movzx   eax,word [rect.width]
211
        div     ebx
212
        push    ax
310 heavyiron 213
 
1098 Lrz 214
        xor     edx,edx
215
        movzx   eax,word [rect.top]
216
        div     ebx
217
        push    ax
310 heavyiron 218
 
1098 Lrz 219
        xor     edx,edx
220
        movzx   eax,word [rect.left]
221
        div     ebx
222
        push    ax
310 heavyiron 223
 
1098 Lrz 224
        pop     bx
225
        add     bx,150
226
        shl    ebx,16
310 heavyiron 227
 
1098 Lrz 228
        pop     cx
229
        add     cx,5
230
        shl     ecx,16
310 heavyiron 231
 
1098 Lrz 232
        pop     bx
233
        pop     cx
310 heavyiron 234
 
6763 IgorA 235
        mcall   SF_DRAW_RECT,,,0xffffff
310 heavyiron 236
ret
237
 
1098 Lrz 238
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
239
;DATA данные
240
;Всегда соблюдать последовательность в имени.
1608 mario79 241
 
242
system_dir_Boxlib	db '/sys/lib/box_lib.obj',0
243
system_dir_ProcLib	db '/sys/lib/proc_lib.obj',0
6763 IgorA 244
system_dir_LibImg   db '/sys/lib/libimg.obj',0
1608 mario79 245
 
6763 IgorA 246
if lang eq ru
1098 Lrz 247
head_f_i:
6763 IgorA 248
head_f_l	db 'Системная ошибка',0
249
 
250
err_message_found_lib1	db 'box_lib.obj - не найдена!',0
251
err_message_found_lib2	db 'proc_lib.obj - не найдена!',0
252
err_message_found_lib3	db 'libimg.obj - не найдена!',0
253
 
254
err_message_import1	db 'box_lib.obj - ошибка импорта!',0
255
err_message_import2	db 'proc_lib.obj - ошибка импорта!',0
256
err_message_import3	db 'libimg.obj - ошибка импорта!',0
257
 
258
else
259
 
260
head_f_i:
1608 mario79 261
head_f_l	db 'System error',0
1098 Lrz 262
 
1608 mario79 263
err_message_found_lib1	db 'box_lib.obj - Not found!',0
264
err_message_found_lib2	db 'proc_lib.obj - Not found!',0
6763 IgorA 265
err_message_found_lib3	db 'libimg.obj - Not found!',0
1098 Lrz 266
 
1608 mario79 267
err_message_import1	db 'box_lib.obj - Wrong import!',0
268
err_message_import2	db 'proc_lib.obj - Wrong import!',0
6763 IgorA 269
err_message_import3	db 'libimg.obj - Wrong import!',0
270
end if
1608 mario79 271
;---------------------------------------------------------------------
272
align 4
273
ProcLib_import:
274
OpenDialog_Init		dd aOpenDialog_Init
275
OpenDialog_Start	dd aOpenDialog_Start
276
;OpenDialog__Version	dd aOpenDialog_Version
277
        dd      0
278
        dd      0
279
aOpenDialog_Init	db 'OpenDialog_init',0
280
aOpenDialog_Start	db 'OpenDialog_start',0
281
;aOpenDialog_Version	db 'Version_OpenDialog',0
282
;---------------------------------------------------------------------
283
align 4
284
Box_lib_import:
285
;init_lib		dd a_init
286
;version_lib		dd a_version
1098 Lrz 287
 
1608 mario79 288
edit_box_draw		dd aEdit_box_draw
289
edit_box_key		dd aEdit_box_key
290
edit_box_mouse		dd aEdit_box_mouse
6766 IgorA 291
edit_box_set_text	dd aEdit_box_set_text
1608 mario79 292
;version_ed		dd aVersion_ed
1098 Lrz 293
 
1685 lrz 294
init_checkbox		dd aInit_checkbox
1608 mario79 295
check_box_draw		dd aCheck_box_draw
1685 lrz 296
check_box_mouse 	dd aCheck_box_mouse
297
;version_ch	dd	aVersion_ch
298
 
1608 mario79 299
option_box_draw	dd aOption_box_draw
300
option_box_mouse	dd aOption_box_mouse
301
;version_op		dd aVersion_op
1098 Lrz 302
 
1608 mario79 303
PathShow_prepare	dd sz_PathShow_prepare
304
PathShow_draw		dd sz_PathShow_draw
305
;Version_path_show	dd szVersion_path_show
6763 IgorA 306
			dd 0,0
1608 mario79 307
 
308
;a_init			db 'lib_init',0
309
;a_version		db 'version',0
310
 
311
aEdit_box_draw		db 'edit_box',0
312
aEdit_box_key		db 'edit_box_key',0
1685 lrz 313
aEdit_box_mouse		db 'edit_box_mouse',0
6766 IgorA 314
aEdit_box_set_text	db 'edit_box_set_text',0
1608 mario79 315
;aVersion_ed		db 'version_ed',0
316
 
1685 lrz 317
 
318
aInit_checkbox	 db 'init_checkbox2',0
319
aCheck_box_draw  db 'check_box_draw2',0
320
aCheck_box_mouse db 'check_box_mouse2',0
321
;aVersion_ch	 db 'version_ch2',0
322
 
1608 mario79 323
aOption_box_draw	db 'option_box_draw',0
324
aOption_box_mouse	db 'option_box_mouse',0
325
;aVersion_op		db 'version_op',0
326
 
327
sz_PathShow_prepare	db 'PathShow_prepare',0
328
sz_PathShow_draw	db 'PathShow_draw',0
329
;szVersion_path_show	db 'version_PathShow',0
330
;---------------------------------------------------------------------
6763 IgorA 331
align 4
332
import_libimg:
333
	dd alib_init1
334
	img_is_img  dd aimg_is_img
335
	img_info    dd aimg_info
336
	img_from_file dd aimg_from_file
337
	img_to_file dd aimg_to_file
338
	img_from_rgb dd aimg_from_rgb
339
	img_to_rgb  dd aimg_to_rgb
340
	img_to_rgb2 dd aimg_to_rgb2
341
	img_decode  dd aimg_decode
342
	img_encode  dd aimg_encode
343
	img_create  dd aimg_create
344
	img_destroy dd aimg_destroy
345
	img_destroy_layer dd aimg_destroy_layer
346
	img_count   dd aimg_count
347
	img_lock_bits dd aimg_lock_bits
348
	img_unlock_bits dd aimg_unlock_bits
349
	img_flip    dd aimg_flip
350
	img_flip_layer dd aimg_flip_layer
351
	img_rotate  dd aimg_rotate
352
	img_rotate_layer dd aimg_rotate_layer
353
	img_draw    dd aimg_draw
354
dd 0,0
355
	alib_init1   db 'lib_init',0
356
	aimg_is_img  db 'img_is_img',0
357
	aimg_info    db 'img_info',0
358
	aimg_from_file db 'img_from_file',0
359
	aimg_to_file db 'img_to_file',0
360
	aimg_from_rgb db 'img_from_rgb',0
361
	aimg_to_rgb  db 'img_to_rgb',0
362
	aimg_to_rgb2 db 'img_to_rgb2',0
363
	aimg_decode  db 'img_decode',0
364
	aimg_encode  db 'img_encode',0
365
	aimg_create  db 'img_create',0
366
	aimg_destroy db 'img_destroy',0
367
	aimg_destroy_layer db 'img_destroy_layer',0
368
	aimg_count   db 'img_count',0
369
	aimg_lock_bits db 'img_lock_bits',0
370
	aimg_unlock_bits db 'img_unlock_bits',0
371
	aimg_flip    db 'img_flip',0
372
	aimg_flip_layer db 'img_flip_layer',0
373
	aimg_rotate  db 'img_rotate',0
374
	aimg_rotate_layer db 'img_rotate_layer',0
375
	aimg_draw    db 'img_draw',0
376
;---------------------------------------------------------------------
1228 Lrz 377
;width,left,top,color,shift_color,focus_border_color,\
378
;       blur_border_color,text_color,max,text,mouse_variable,flags,size,pos
1098 Lrz 379
 
310 heavyiron 380
rect_input:
6766 IgorA 381
.left   edit_box 35,95,5, cl_white,0,0,0,0,5,rect_input_buffer.left,  mouse_dd1,ed_figure_only ;+ed_focus
382
.top    edit_box 35,95,25,cl_white,0,0,0,0,5,rect_input_buffer.top,   mouse_dd1,ed_figure_only
383
.width  edit_box 35,95,45,cl_white,0,0,0,0,5,rect_input_buffer.width, mouse_dd1,ed_figure_only
384
.height edit_box 35,95,65,cl_white,0,0,0,0,5,rect_input_buffer.height,mouse_dd1,ed_figure_only
310 heavyiron 385
rect_input_end:
1214 Lrz 386
mouse_dd1	rd 1
310 heavyiron 387
rect_input_labels:
6763 IgorA 388
.left   label 10,10,0,rect_input_labels_text.left
389
.top    label 10,30,0,rect_input_labels_text.top
390
.width  label 10,50,0,rect_input_labels_text.width
310 heavyiron 391
.height label 10,70,0,rect_input_labels_text.height
392
rect_input_labels_end:
393
 
394
rect_input_labels_text:
6763 IgorA 395
if lang eq ru
310 heavyiron 396
.left db 'Отступ слева:',0
397
.top  db 'Отступ сверху:',0
1098 Lrz 398
.width  db 'Ширина:',0
310 heavyiron 399
.height db 'Высота:',0
6763 IgorA 400
else
401
.left db 'Left:',0
402
.top  db 'Top:',0
403
.width  db 'Width:',0
404
.height db 'Height:',0
405
end if
310 heavyiron 406
 
407
riw_check_boxes:
3181 hidnplayr 408
use_rect_active_window check_box2 (10 shl 16)+10,(85 shl 16) +10,5,cl_white,0,0,\
3182 hidnplayr 409
riw_check_boxes_text, ch_flag_bottom
310 heavyiron 410
riw_check_boxes_end:
411
 
6763 IgorA 412
if lang eq ru
413
riw_check_boxes_text db 'Использовать область активного окна',0
414
riw_grab_text db 'Координаты и размеры области:',0
415
else
416
riw_check_boxes_text db 'Use area of the active window',0
417
riw_grab_text db 'Coordinates and size of the field:',0
418
end if