Subversion Repositories Kolibri OS

Rev

Rev 8984 | Rev 9039 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8984 Rev 9014
Line 23... Line 23...
23
                db      ?       ; align
23
                db      ?       ; align
24
.dataptr        dd      ?       ; used internally, ignored on input
24
.dataptr        dd      ?       ; used internally, ignored on input
25
.size = $
25
.size = $
26
end virtual
26
end virtual
Line -... Line 27...
-
 
27
 
27
 
28
align 16
28
GenericBox:
29
GenericBox:
29
        push    [cursor_x]
30
        push    [cursor_x]
30
        push    [cursor_y]
31
        push    [cursor_y]
31
        push    dword [esp+8+8]
32
        push    dword [esp+8+8]
Line 47... Line 48...
47
        dec     eax
48
        dec     eax
48
        jz      .redraw
49
        jz      .redraw
49
        dec     eax
50
        dec     eax
50
        jz      .key
51
        jz      .key
51
        sub     eax,4
52
        sub     eax,4
52
        jz      .event ;todo: mouse
53
        jz      .mouse
53
        jmp     exit
54
        jmp     exit
54
.redraw:
55
.redraw:
55
        call    draw_window
56
        call    draw_window
56
        jmp     .event
57
        jmp     .event
57
.key:
58
.key:
Line 84... Line 85...
84
        mov     ecx, [esp+28h+8]
85
        mov     ecx, [esp+28h+8]
85
        push    0
86
        push    0
86
        push    eax
87
        push    eax
87
        push    2
88
        push    2
88
        push    ebx
89
        push    ebx
89
        call    ecx
90
        call    ecx ;DlgProc
90
        test    eax, eax
91
        test    eax, eax
91
        jz      .event
92
        jz      .event
92
        mov     [esp+28], eax
93
        mov     [esp+28], eax
93
        jmp     .exit
94
        jmp     .exit
94
.ctrl_down:
95
.ctrl_down:
Line 137... Line 138...
137
        and     [ctrlstate], not 0x10
138
        and     [ctrlstate], not 0x10
138
        jmp     .event
139
        jmp     .event
139
.ralt_up:
140
.ralt_up:
140
        and     [ctrlstate], not 0x20
141
        and     [ctrlstate], not 0x20
141
        jmp     .event
142
        jmp     .event
-
 
143
align 4
-
 
144
.mouse:
-
 
145
        mov     eax,SF_MOUSE_GET
-
 
146
        mov     ebx,SSF_BUTTON_EXT
-
 
147
        int     0x40
-
 
148
        bt      eax,8 ;left but. down
-
 
149
        jnc     .event
-
 
150
 
-
 
151
        mov     eax,SF_MOUSE_GET
-
 
152
        mov     ebx,SSF_WINDOW_POSITION
-
 
153
        int     0x40
-
 
154
		cmp     ax, word[skinh]
-
 
155
		jl      .event
-
 
156
		sub     ax, word[skinh]
-
 
157
		xor     dx,dx
-
 
158
		mov     bx, font_height
-
 
159
		div     bx
-
 
160
		movzx   edx,ax
-
 
161
		shr     eax,16
-
 
162
        sub     eax, 5 ;window border
-
 
163
 
-
 
164
		push    edx
-
 
165
		xor     dx,dx
-
 
166
		mov     bx, font_width
-
 
167
		div     bx
-
 
168
		movzx   eax,ax
-
 
169
		pop     edx
-
 
170
 
-
 
171
        mov     ebx, [esp+24h+8] ;DLGTEMPLATE* dlg
-
 
172
		cmp     edx, [ebx+dlgtemplate.y]
-
 
173
		jl      .event
-
 
174
		cmp     eax, [ebx+dlgtemplate.x]
-
 
175
		jl      .event
-
 
176
		sub     edx, [ebx+dlgtemplate.y]
-
 
177
		sub     eax, [ebx+dlgtemplate.x]
-
 
178
		cmp     edx, [ebx+dlgtemplate.height]
-
 
179
		jge     .event
-
 
180
		cmp     eax, [ebx+dlgtemplate.width]
-
 
181
		jge     .event
-
 
182
 
-
 
183
        add     ebx, dlgtemplate.size+12
-
 
184
        mov     ecx, [ebx-4]
-
 
185
		or      ecx, ecx
-
 
186
		jz      .event
-
 
187
 
-
 
188
        push    ebx ecx
-
 
189
.m_loop:
-
 
190
		cmp     [ebx+dlgitemtemplate.type], 2 ;button
-
 
191
		je      .m_comp
-
 
192
		cmp     [ebx+dlgitemtemplate.type], 3 ;edit
-
 
193
		je      .m_comp
-
 
194
		;cmp     [ebx+dlgitemtemplate.type], 5 ;check
-
 
195
		;je      .m_comp
-
 
196
		jmp     .m_next
-
 
197
align 4
-
 
198
.m_comp:
-
 
199
		cmp     [ebx+dlgitemtemplate.x1], eax
-
 
200
		jg      .m_next
-
 
201
		cmp     [ebx+dlgitemtemplate.y1], edx
-
 
202
		jg      .m_next
-
 
203
		cmp     [ebx+dlgitemtemplate.x2], eax
-
 
204
		jl      .m_next
-
 
205
		cmp     [ebx+dlgitemtemplate.y2], edx
-
 
206
		jl      .m_next
-
 
207
		
-
 
208
		mov     eax, [ebx+dlgitemtemplate.flags]
-
 
209
		and     eax, 4
-
 
210
		jnz     .m_old_focus
-
 
211
		mov     eax, ebx
-
 
212
		jmp     .m_new_focus
-
 
213
align 4
-
 
214
.m_next:
-
 
215
		add     ebx, sizeof.DlgBtn
-
 
216
		loop    .m_loop
-
 
217
.m_old_focus:
-
 
218
		pop     ecx ebx
-
 
219
		jmp     .event
-
 
220
align 4
-
 
221
.m_new_focus:
-
 
222
		pop     ecx ebx
-
 
223
        call    DlgClearFocus
-
 
224
		or      dword[eax+dlgitemtemplate.flags], 4
-
 
225
 
-
 
226
		sub     ebx, dlgtemplate.size+12
-
 
227
        push    ebp
-
 
228
		mov     ebp, ebx
-
 
229
        call    ManagerDlgProc.dodraw
-
 
230
        pop     ebp
-
 
231
        call    draw_image
-
 
232
		jmp     .event
-
 
233
align 4
142
.exit:
234
.exit:
143
        popad
235
        popad
144
        push    eax
236
        push    eax
145
        push    0
237
        push    0
146
        push    dword [esp+12+8]
238
        push    dword [esp+12+8]
Line 151... Line 243...
151
        pushad
243
        pushad
152
        call    draw_image
244
        call    draw_image
153
        popad
245
        popad
154
        ret     8
246
        ret     8
Line -... Line 247...
-
 
247
 
-
 
248
;input:
-
 
249
; ebx - pointer to first item
-
 
250
; ecx - count items
-
 
251
align 4
-
 
252
DlgClearFocus:
-
 
253
        push    ebx ecx
-
 
254
@@:
-
 
255
        and     byte [ebx+dlgitemtemplate.flags], not 4
-
 
256
		add     ebx, sizeof.DlgBtn
-
 
257
		loop    @b
-
 
258
		pop     ecx ebx
-
 
259
		ret
155
 
260
 
-
 
261
; int __stdcall ShowGenericBox(DLGTEMPLATE* dlg, void* DlgProc);
156
; int __stdcall ShowGenericBox(DLGTEMPLATE* dlg, void* DlgProc);
262
align 16
157
ShowGenericBox:
263
ShowGenericBox:
158
        pushad
264
        pushad
159
        mov     ebx, [esp+20h+4]
265
        mov     ebx, [esp+20h+4]
160
; center window if required
266
; center window if required
Line 469... Line 575...
469
        call    draw_image
575
        call    draw_image
470
        popad
576
        popad
471
        ret     8
577
        ret     8
Line 472... Line 578...
472
 
578
 
-
 
579
; void __stdcall HideGenericBox(DLGTEMPLATE* dlg, int bRedrawWindow);
473
; void __stdcall HideGenericBox(DLGTEMPLATE* dlg, int bRedrawWindow);
580
align 16
474
HideGenericBox:
581
HideGenericBox:
475
; void __stdcall HideDialogBox(DLGDATA* dlg, int bRedrawWindow);
582
; void __stdcall HideDialogBox(DLGDATA* dlg, int bRedrawWindow);
476
HideDialogBox:
583
HideDialogBox:
477
        pushad
584
        pushad
Line 1102... Line 1209...
1102
        popad
1209
        popad
1103
; translate scancode to ASCII
1210
; translate scancode to ASCII
1104
        movzx   eax, byte [layout+eax]
1211
        movzx   eax, byte [layout+eax]
1105
        ret
1212
        ret
Line -... Line 1213...
-
 
1213
 
-
 
1214
struct DlgLbl
-
 
1215
type           dd      1
-
 
1216
x1             dd      ?
-
 
1217
y1             dd      ?
-
 
1218
x2             dd      ?
-
 
1219
y2             dd      ?
-
 
1220
text           dd      ?
-
 
1221
flags          dd      ?
-
 
1222
ends
-
 
1223
 
-
 
1224
struct DlgBtn
-
 
1225
type           dd      2
-
 
1226
x1             dd      ?
-
 
1227
y1             dd      ?
-
 
1228
x2             dd      ?
-
 
1229
y2             dd      ?
-
 
1230
text           dd      ?
-
 
1231
flags          dd      ?
-
 
1232
ends
-
 
1233
 
-
 
1234
struct DlgEdit
-
 
1235
type           dd      3
-
 
1236
x1             dd      ?
-
 
1237
y1             dd      ?
-
 
1238
x2             dd      ?
-
 
1239
y2             dd      ?
-
 
1240
text           dd      ?
-
 
1241
flags          dd      ?
-
 
1242
ends
-
 
1243
 
-
 
1244
struct DlgLine
-
 
1245
type           dd      4
-
 
1246
x1             dd      ?
-
 
1247
y1             dd      ?
-
 
1248
x2             dd      ?
-
 
1249
y2             dd      ?
-
 
1250
               dq      0
-
 
1251
ends
-
 
1252
 
-
 
1253
struct DlgCheck
-
 
1254
type           dd      5
-
 
1255
x1             dd      ?
-
 
1256
y1             dd      ?
-
 
1257
x2             dd      ?
-
 
1258
y2             dd      ?
-
 
1259
text           dd      ?
-
 
1260
flags          dd      ?
-
 
1261
ends
-
 
1262
 
-
 
1263
struct DlgList
-
 
1264
type           dd      6
-
 
1265
x1             dd      ?
-
 
1266
y1             dd      ?
-
 
1267
x2             dd      ?
-
 
1268
y2             dd      ?
-
 
1269
text           dd      ?
-
 
1270
flags          dd      ?
-
 
1271
ends
1106
 
1272
 
1107
virtual at 0
1273
virtual at 0
1108
dlgitemtemplate:
1274
dlgitemtemplate:
1109
; «¥¬¥­âë:
1275
; «¥¬¥­âë:
1110
;       1 = áâ â¨ç¥áª¨© ⥪áâ
1276
;       1 = áâ â¨ç¥áª¨© ⥪áâ
Line 1150... Line 1316...
1150
;               void* user_data;        /* arbitrary user data */
1316
;               void* user_data;        /* arbitrary user data */
1151
;               unsigned num_items;     /* number of items in the following array */
1317
;               unsigned num_items;     /* number of items in the following array */
1152
;               DLGITEMTEMPLATE items[]; /* array of dialog items */
1318
;               DLGITEMTEMPLATE items[]; /* array of dialog items */
1153
;       }
1319
;       }
1154
; int __stdcall DialogBox(DLGDATA* dlg);
1320
; int __stdcall DialogBox(DLGDATA* dlg);
-
 
1321
align 16
1155
DialogBox:
1322
DialogBox:
1156
        push    ManagerDlgProc
1323
        push    ManagerDlgProc
1157
        push    dword [esp+8]
1324
        push    dword [esp+8]
1158
        call    GenericBox
1325
        call    GenericBox
1159
        ret     4
1326
        ret     4
Line 1170... Line 1337...
1170
        push    ManagerDlgProc
1337
        push    ManagerDlgProc
1171
        push    dword [esp+8]
1338
        push    dword [esp+8]
1172
        call    DrawGenericBox
1339
        call    DrawGenericBox
1173
        ret     4
1340
        ret     4
Line -... Line 1341...
-
 
1341
 
1174
 
1342
align 16
1175
ManagerDlgProc:
1343
ManagerDlgProc:
1176
        mov     ebp, ebx
1344
        mov     ebp, ebx
1177
        mov     eax, [esp+8]
1345
        mov     eax, [esp+8]
1178
        dec     eax
1346
        dec     eax
Line 1397... Line 1565...
1397
        jae     @b
1565
        jae     @b
1398
        mov     [esi], al
1566
        mov     [esi], al
1399
        inc     dword [edx+4]
1567
        inc     dword [edx+4]
1400
@@:     jmp     .ret_test
1568
@@:     jmp     .ret_test
Line -... Line 1569...
-
 
1569
 
1401
 
1570
align 4
1402
.dodraw:
1571
.dodraw:
1403
        or      [cursor_x], -1
1572
        or      [cursor_x], -1
1404
        or      [cursor_y], -1
1573
        or      [cursor_y], -1
1405
        add     ebx, dlgtemplate.size+8
1574
        add     ebx, dlgtemplate.size+8
Line 1430... Line 1599...
1430
        dd      draw_checkbox
1599
        dd      draw_checkbox
1431
        dd      draw_listbox
1600
        dd      draw_listbox
1432
draw_functions_num = ($ - draw_functions) / 4
1601
draw_functions_num = ($ - draw_functions) / 4
1433
endg
1602
endg
Line -... Line 1603...
-
 
1603
 
1434
 
1604
align 4
1435
draw_static_text:
1605
draw_static_text:
1436
; à¨á㥬 áâ â¨ç¥áª¨© ⥪áâ
1606
; à¨á㥬 áâ â¨ç¥áª¨© ⥪áâ
1437
        mov     ah, [dialog_main_color]
1607
        mov     ah, [dialog_main_color]
1438
        test    byte [ebp+dlgtemplate.flags], 2
1608
        test    byte [ebp+dlgtemplate.flags], 2
Line 1531... Line 1701...
1531
        mov     al, ' '
1701
        mov     al, ' '
1532
        rep     stosw
1702
        rep     stosw
1533
.ret2:
1703
.ret2:
1534
        ret
1704
        ret
Line -... Line 1705...
-
 
1705
 
1535
 
1706
align 4
1536
draw_button:
1707
draw_button:
1537
        mov     ecx, dialog_colors
1708
        mov     ecx, dialog_colors
1538
        test    byte [ebp+dlgtemplate.flags], 2
1709
        test    byte [ebp+dlgtemplate.flags], 2
1539
        jz      @f
1710
        jz      @f
Line 1544... Line 1715...
1544
        jz      @f
1715
        jz      @f
1545
        mov     ah, [dialog_selected_btn_color-dialog_colors+ecx]
1716
        mov     ah, [dialog_selected_btn_color-dialog_colors+ecx]
1546
@@:
1717
@@:
1547
        jmp     draw_text
1718
        jmp     draw_text
Line -... Line 1719...
-
 
1719
 
1548
 
1720
align 4
1549
draw_editbox:
1721
draw_editbox:
1550
        mov     edx, [ebx+dlgitemtemplate.data]
1722
        mov     edx, [ebx+dlgitemtemplate.data]
1551
        test    [ebx+dlgitemtemplate.flags], 4
1723
        test    [ebx+dlgitemtemplate.flags], 4
1552
        jz      @f
1724
        jz      @f
Line 1572... Line 1744...
1572
        mov     esi, [ebx+dlgitemtemplate.data]
1744
        mov     esi, [ebx+dlgitemtemplate.data]
1573
        add     esi, [edx+8]
1745
        add     esi, [edx+8]
1574
        add     esi, 12
1746
        add     esi, 12
1575
        jmp     draw_text_esi
1747
        jmp     draw_text_esi
Line -... Line 1748...
-
 
1748
 
1576
 
1749
align 4
1577
dlgitem_get_console_ptr:
1750
dlgitem_get_console_ptr:
1578
        mov     eax, [ebx+dlgitemtemplate.x1]
1751
        mov     eax, [ebx+dlgitemtemplate.x1]
1579
        mov     edx, [ebx+dlgitemtemplate.y1]
1752
        mov     edx, [ebx+dlgitemtemplate.y1]
1580
        mov     ecx, eax
1753
        mov     ecx, eax
1581
        add     eax, [ebp+dlgtemplate.x]
1754
        add     eax, [ebp+dlgtemplate.x]
1582
        add     edx, [ebp+dlgtemplate.y]
1755
        add     edx, [ebp+dlgtemplate.y]
Line -... Line 1756...
-
 
1756
        jmp     get_console_ptr
1583
        jmp     get_console_ptr
1757
 
1584
 
1758
align 4
1585
draw_h_separator:
1759
draw_h_separator:
1586
; à¨á㥬 £®à¨§®­â «ì­ë© à §¤¥«¨â¥«ì
1760
; à¨á㥬 £®à¨§®­â «ì­ë© à §¤¥«¨â¥«ì
1587
        call    dlgitem_get_console_ptr
1761
        call    dlgitem_get_console_ptr
Line 1601... Line 1775...
1601
        cmp     ecx, [ebx+dlgitemtemplate.x2]
1775
        cmp     ecx, [ebx+dlgitemtemplate.x2]
1602
        jb      .scan
1776
        jb      .scan
1603
.done:
1777
.done:
1604
        ret
1778
        ret
Line -... Line 1779...
-
 
1779
 
1605
 
1780
align 4
1606
draw_checkbox:
1781
draw_checkbox:
1607
; à¨á㥬 ä« ¦®ª
1782
; à¨á㥬 ä« ¦®ª
1608
        call    dlgitem_get_console_ptr
1783
        call    dlgitem_get_console_ptr
1609
        test    byte [ebx+dlgitemtemplate.flags], 4
1784
        test    byte [ebx+dlgitemtemplate.flags], 4
Line 1642... Line 1817...
1642
        stosw
1817
        stosw
1643
        loop    @b
1818
        loop    @b
1644
.ret:
1819
.ret:
1645
        ret
1820
        ret
Line -... Line 1821...
-
 
1821
 
1646
 
1822
align 4
1647
draw_listbox:
1823
draw_listbox:
1648
; à¨á㥬 ᯨ᮪
1824
; à¨á㥬 ᯨ᮪
1649
        call    dlgitem_get_console_ptr
1825
        call    dlgitem_get_console_ptr
1650
        mov     edx, [ebx+dlgitemtemplate.data]
1826
        mov     edx, [ebx+dlgitemtemplate.data]
Line 1750... Line 1926...
1750
        mov     al, 0x1F
1926
        mov     al, 0x1F
1751
        stosw
1927
        stosw
1752
.noscrollbar:
1928
.noscrollbar:
1753
        ret
1929
        ret
Line -... Line 1930...
-
 
1930
 
1754
 
1931
align 4
1755
listbox_key:
1932
listbox_key:
1756
        mov     edx, [ebx+dlgitemtemplate.data]
1933
        mov     edx, [ebx+dlgitemtemplate.data]
1757
        cmp     al, 0x48
1934
        cmp     al, 0x48
1758
        jz      .prev
1935
        jz      .prev
Line 1912... Line 2089...
1912
        jmp     @f
2089
        jmp     @f
Line 1913... Line 2090...
1913
 
2090
 
1914
; int __stdcall Message(const char* title,
2091
; int __stdcall Message(const char* title,
1915
;                       int num_strings, const char* strings[],
2092
;                       int num_strings, const char* strings[],
-
 
2093
;                       int num_buttons, const char* buttons[]);
1916
;                       int num_buttons, const char* buttons[]);
2094
align 16
1917
Message:
2095
Message:
1918
        push    1
2096
        push    1
1919
@@:
2097
@@:
1920
        pop     eax
2098
        pop     eax