Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
310 heavyiron 1
set_rect_window:
1098 Lrz 2
        mov     ebx,set_rect_window_procinfo
3
        call    get_slot_n
310 heavyiron 4
 
1098 Lrz 5
        mov     [set_rect_window_slot],ecx
310 heavyiron 6
 
1098 Lrz 7
        set_events_mask (evm_redraw+evm_key+evm_button+evm_mouse)
310 heavyiron 8
.red:
1098 Lrz 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
310 heavyiron 13
.still:
1098 Lrz 14
        wait_event .red,.key,.button,.mouse
310 heavyiron 15
 
16
.key:
1098 Lrz 17
        get_key
310 heavyiron 18
 
1098 Lrz 19
        push    dword rect_input.left
20
        call    [edit_box_key]
310 heavyiron 21
 
1098 Lrz 22
        push    dword rect_input.top
23
        call    [edit_box_key]
310 heavyiron 24
 
1098 Lrz 25
        push    dword rect_input.width
26
        call    [edit_box_key]
310 heavyiron 27
 
1098 Lrz 28
        push    dword rect_input.height
29
        call    [edit_box_key]
30
;        key_edit_boxes rect_input,rect_input_end
31
 
32
        call    read_rect
33
        call    draw_rect_on_screen
34
 
35
        jmp     .still
36
 
310 heavyiron 37
.button:
1098 Lrz 38
        get_pressed_button
310 heavyiron 39
 
1098 Lrz 40
        cmp     ah,1
41
        jne     @f
42
        btr     dword [flags],3
43
        jmp     close
310 heavyiron 44
@@:
45
 
1098 Lrz 46
        jmp     .still
310 heavyiron 47
 
48
.mouse:
1098 Lrz 49
        get_active_window
50
        cmp     eax,[set_rect_window_slot]
51
        jne     .still
310 heavyiron 52
 
1098 Lrz 53
        push    dword rect_input.left
54
        call    [edit_box_mouse]
310 heavyiron 55
 
1098 Lrz 56
        push    dword rect_input.top
57
        call    [edit_box_mouse]
310 heavyiron 58
 
1098 Lrz 59
        push    dword rect_input.width
60
        call    [edit_box_mouse]
61
 
62
        push    dword rect_input.height
63
        call    [edit_box_mouse]
64
 
65
;;;;;;;;;;;;;;;;;;;;;;
66
        push    dword use_rect_active_window
67
        call    [check_box_mouse]
68
 
69
;        mouse_edit_boxes rect_input,rect_input_end
70
;        mouse_check_boxes riw_check_boxes,riw_check_boxes_end
71
 
72
        jmp     .still
73
 
310 heavyiron 74
.draw_window:
1098 Lrz 75
        start_draw_window
310 heavyiron 76
 
1098 Lrz 77
        xor     eax,eax
78
        mov     ebx,100*65536+250
79
        mov     ecx,100*65536+130
80
        mov     edx,[sc.work]
81
        add     edx,0x33000000
82
        mov     edi,riw_grab_text
83
        xor     esi,esi
84
        mcall
310 heavyiron 85
 
1098 Lrz 86
        draw_labels rect_input_labels,rect_input_labels_end
310 heavyiron 87
 
1098 Lrz 88
        push    dword rect_input.left
89
        call    [edit_box_draw]
310 heavyiron 90
 
1098 Lrz 91
        push    dword rect_input.top
92
        call    [edit_box_draw]
310 heavyiron 93
 
1098 Lrz 94
        push    dword rect_input.width
95
        call    [edit_box_draw]
310 heavyiron 96
 
1098 Lrz 97
        push    dword rect_input.height
98
        call    [edit_box_draw]
99
;;;;;;;;;;;;;;;;;;;;;;
100
        push    dword use_rect_active_window
101
        call    [check_box_draw]
102
;        draw_edit_boxes rect_input,rect_input_end
103
;        draw_check_boxes riw_check_boxes,riw_check_boxes_end
104
 
105
        call    read_rect
106
        call    draw_rect_on_screen
107
 
108
        stop_draw_window
310 heavyiron 109
ret
110
 
111
;--------------------------------------------------------------------
112
;--- Считывание облати ----------------------------------------------
113
;--------------------------------------------------------------------
114
read_rect:
1098 Lrz 115
        bt      dword [use_rect_active_window.flags],1
116
        jc      read_rect_from_active_window
310 heavyiron 117
 
1098 Lrz 118
        mov     edi,rect_input_buffer.left
119
        call    zstr_to_int
120
        cmp     ax,[scr.width]
121
        jb      @f
122
        mov     ax,[scr.width]
310 heavyiron 123
@@:
1098 Lrz 124
        mov     [rect.left],ax
310 heavyiron 125
 
1098 Lrz 126
        mov     edi,rect_input_buffer.top
127
        call    zstr_to_int
128
        cmp     ax,[scr.height]
129
        jb      @f
130
        mov     ax,[scr.height]
310 heavyiron 131
@@:
1098 Lrz 132
        mov     [rect.top],ax
310 heavyiron 133
 
1098 Lrz 134
        mov     edi,rect_input_buffer.width
135
        call    zstr_to_int
136
        mov     bx,[scr.width]
137
        sub     bx,[rect.left]
138
        cmp     ax,bx
139
        jb      @f
140
        mov     ax,bx
310 heavyiron 141
@@:
1098 Lrz 142
        mov     [rect.width],ax
310 heavyiron 143
 
1098 Lrz 144
        mov     edi,rect_input_buffer.height
145
        call    zstr_to_int
146
        mov     bx,[scr.height]
147
        sub     bx,[rect.top]
148
        cmp     ax,bx
149
        jb      @f
150
        mov     ax,bx
310 heavyiron 151
@@:
1098 Lrz 152
        mov     [rect.height],ax
310 heavyiron 153
ret
154
 
155
read_rect_from_active_window:
1098 Lrz 156
        call    get_active_window_info
310 heavyiron 157
 
1098 Lrz 158
        mov     eax,[active_app.left]
159
        mov     [rect.left],ax
160
        mov     eax,[active_app.top]
161
        mov     [rect.top],ax
162
        mov     eax,[active_app.width]
163
        inc     eax
164
        mov     [rect.width],ax
165
        mov     eax,[active_app.height]
166
        inc     eax
167
        mov     [rect.height],ax
310 heavyiron 168
ret
169
 
170
draw_rect_on_screen:
171
 
1098 Lrz 172
        mov     eax,13
173
        mov     ebx,150*65536+80
174
        mov     ecx,5*65536+60
175
        xor     edx,edx
176
        mcall
310 heavyiron 177
 
1098 Lrz 178
        ;movzx   eax,word [rect.left]
179
        ;mul     word [scr.width]
180
        xor     edx,edx
181
        movzx   eax,word [scr.width]
182
        mov     ebx,80
183
        div     ebx
184
        mov     ebx,eax
310 heavyiron 185
 
1098 Lrz 186
        xor     edx,edx
187
        movzx   eax,word [rect.height]
188
        div     ebx
189
        push    ax
310 heavyiron 190
 
1098 Lrz 191
        xor     edx,edx
192
        movzx   eax,word [rect.width]
193
        div     ebx
194
        push    ax
310 heavyiron 195
 
1098 Lrz 196
        xor     edx,edx
197
        movzx   eax,word [rect.top]
198
        div     ebx
199
        push    ax
310 heavyiron 200
 
1098 Lrz 201
        xor     edx,edx
202
        movzx   eax,word [rect.left]
203
        div     ebx
204
        push    ax
310 heavyiron 205
 
1098 Lrz 206
        pop     bx
207
        add     bx,150
208
        shl    ebx,16
310 heavyiron 209
 
1098 Lrz 210
        pop     cx
211
        add     cx,5
212
        shl     ecx,16
310 heavyiron 213
 
1098 Lrz 214
        pop     bx
215
        pop     cx
310 heavyiron 216
 
1098 Lrz 217
        mov     edx,0xffffff
218
        mov     eax,13
219
        mcall
310 heavyiron 220
ret
221
 
1098 Lrz 222
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
223
;DATA данные
224
;Всегда соблюдать последовательность в имени.
225
system_path      db '/sys/lib/'
226
library_name     db 'box_lib.obj',0
227
err_message_found_lib   db 'Sorry I cannot load library box_lib.obj',0
228
head_f_i:
229
head_f_l        db 'System error',0
230
err_message_import      db 'Error on load import library box_lib.obj',0
231
 
232
myimport:
233
 
234
edit_box_draw   dd      aEdit_box_draw
235
edit_box_key    dd      aEdit_box_key
236
edit_box_mouse  dd      aEdit_box_mouse
237
version_ed      dd      aVersion_ed
238
 
239
check_box_draw  dd      aCheck_box_draw
240
check_box_mouse dd      aCheck_box_mouse
241
version_ch      dd      aVersion_ch
242
 
243
option_box_draw  dd      aOption_box_draw
244
option_box_mouse dd      aOption_box_mouse
245
version_op       dd      aVersion_op
246
 
247
                dd      0
248
                dd      0
249
 
250
aEdit_box_draw  db 'edit_box',0
251
aEdit_box_key   db 'edit_box_key',0
252
aEdit_box_mouse db 'edit_box_mouse',0
253
aVersion_ed     db 'version_ed',0
254
 
255
aCheck_box_draw  db 'check_box_draw',0
256
aCheck_box_mouse db 'check_box_mouse',0
257
aVersion_ch      db 'version_ch',0
258
 
259
aOption_box_draw  db 'option_box_draw',0
260
aOption_box_mouse db 'option_box_mouse',0
261
aVersion_op       db 'version_op',0
262
 
263
 
264
 
310 heavyiron 265
rect_input:
1098 Lrz 266
.left   edit_box 35,95,5,cl_white,0,0,0,5,rect_input_buffer.left,\
310 heavyiron 267
ed_figure_only+ed_focus
1098 Lrz 268
.top    edit_box 35,95,25,cl_white,0,0,0,5,rect_input_buffer.top,\
310 heavyiron 269
ed_figure_only
1098 Lrz 270
.width  edit_box 35,95,45,cl_white,0,0,0,5,rect_input_buffer.width,\
310 heavyiron 271
ed_figure_only
272
.height edit_box 35,95,65,cl_white,0,0,0,5,rect_input_buffer.height,\
273
ed_figure_only
274
rect_input_end:
275
 
276
rect_input_labels:
277
.left label 10,10,0,rect_input_labels_text.left
278
.top label 10,30,0,rect_input_labels_text.top
279
.width label 10,50,0,rect_input_labels_text.width
280
.height label 10,70,0,rect_input_labels_text.height
281
rect_input_labels_end:
282
 
283
rect_input_labels_text:
284
.left db 'Отступ слева:',0
285
.top  db 'Отступ сверху:',0
1098 Lrz 286
.width  db 'Ширина:',0
310 heavyiron 287
.height db 'Высота:',0
288
 
289
riw_check_boxes:
1098 Lrz 290
use_rect_active_window check_box 10,85,5,11,cl_white,0,0,\
310 heavyiron 291
riw_check_boxes_text.1,\
292
riw_check_boxes_text.2-riw_check_boxes_text.1
293
riw_check_boxes_end:
294
 
295
riw_check_boxes_text:
296
.1 db 'Использовать область активного окна'
297
.2 db ''
298
 
299
riw_grab_text db 'Координаты и размеры области:',0