Subversion Repositories Kolibri OS

Rev

Rev 6706 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6706 Rev 6769
1
; ---------------------------------------------------------------------------- ;
1
; ---------------------------------------------------------------------------- ;
2
; Tooltip widget
2
; Tooltip widget
3
;
3
;
4
; Created by Siemargl, 2016
4
; Created by Siemargl, 2016
5
; 
5
; 
6
; Changelist
6
; Changelist
7
; 161107 - initial version + test
7
; 161107 - initial version + test
8
 
8
 
9
 
9
 
10
; http://stackoverflow.com/questions/8976600/fasm-how-to-send-struct-to-proc
10
; http://stackoverflow.com/questions/8976600/fasm-how-to-send-struct-to-proc
11
virtual at edi
11
virtual at edi
12
	ttip tooltip ?, ?, ?, ?, ?, ?, ?, ?, ?
12
	ttip tooltip ?, ?, ?, ?, ?, ?, ?, ?, ?
13
end virtual
13
end virtual
14
 
14
 
15
; ---------------------------------------------------------------------------- ;
15
; ---------------------------------------------------------------------------- ;
16
; ¨­¨æ¨ «¨§ æ¨ï ¢á¥© 楯®çª¨ âã«â¨¯®¢, ä®à¬¨à®¢ ­¨¥ à §¬¥à®¢ ¨ ¡ãä¥à®¢ ¯ ¬ïâ¨
16
; ¨­¨æ¨ «¨§ æ¨ï ¢á¥© 楯®çª¨ âã«â¨¯®¢, ä®à¬¨à®¢ ­¨¥ à §¬¥à®¢ ¨ ¡ãä¥à®¢ ¯ ¬ïâ¨
17
; return eax zero if fails
17
; return eax zero if fails
18
align 16
18
align 16
19
proc tooltip_init uses esi edi, ttip:dword
19
proc tooltip_init uses esi edi, ttip:dword
20
locals
20
locals
21
    max_len dw ? ;maximum chars in line
21
    max_len dw ? ;maximum chars in line
22
    lines   dw ? ;lines in tooltip
22
    lines   dw ? ;lines in tooltip
23
endl
23
endl
24
 
24
 
25
    mov edi, [ttip]
25
    mov edi, [ttip]
26
    jmp .tail_call
26
    jmp .tail_call
27
.list_next:
27
.list_next:
28
    ; init statics
28
    ; init statics
29
    mov [ttip.mouse], 0
29
    mov [ttip.mouse], 0
30
    mov [ttip.tm_strt], 0
30
    mov [ttip.tm_strt], 0
31
    mov [ttip.video_y], 0
31
    mov [ttip.video_y], 0
32
    mov [ttip.video_x], 0
32
    mov [ttip.video_x], 0
33
    mov [ttip.video], 0
33
    mov [ttip.video], 0
34
    stdcall get_font_size, [ttip.col_txt]
34
    stdcall get_font_size, [ttip.col_txt]
35
    mov [ttip.font_sz], eax
35
    mov [ttip.font_sz], eax
36
 
36
 
37
    ; count num of lines and max len
37
    ; count num of lines and max len
38
    mov esi, [ttip.txt]
38
    mov esi, [ttip.txt]
39
    mov [lines], 1  ; lines
39
    mov [lines], 1  ; lines
40
    mov [max_len], 0  ; max_len
40
    mov [max_len], 0  ; max_len
41
.line:
41
.line:
42
	mov ecx, 0  ; len
42
	mov ecx, 0  ; len
43
.symb:
43
.symb:
44
    mov al, [esi]
44
    mov al, [esi]
45
    cmp al, 0
45
    cmp al, 0
46
    je .eos
46
    je .eos
47
    cmp al, 13
47
    cmp al, 13
48
	jne .next
48
	jne .next
49
	inc [lines]
49
	inc [lines]
50
	inc esi
50
	inc esi
51
	cmp cx, [max_len]    ; detect max
51
	cmp cx, [max_len]    ; detect max
52
	jle @f
52
	jle @f
53
	    mov [max_len], cx
53
	    mov [max_len], cx
54
	@@:
54
	@@:
55
	jmp .line
55
	jmp .line
56
.next:
56
.next:
57
    inc ecx
57
    inc ecx
58
    inc esi
58
    inc esi
59
    jmp .symb
59
    jmp .symb
60
.eos:; string ended, we have correct width and hight
60
.eos:; string ended, we have correct width and hight
61
    cmp cx, [max_len]	 ; detect max
61
    cmp cx, [max_len]	 ; detect max
62
    jle @f
62
    jle @f
63
       mov [max_len], cx
63
       mov [max_len], cx
64
    @@:
64
    @@:
65
 
65
 
66
    mov eax, [ttip.font_sz]
66
    mov eax, [ttip.font_sz]
67
    shr eax, 16
67
    shr eax, 16
68
    imul [max_len]
68
    imul [max_len]
69
    mov dx, ax	 ; width in pixels
69
    mov dx, ax	 ; width in pixels
70
    mov [ttip.video_w], ax
70
    mov [ttip.video_w], ax
71
    mov eax, [ttip.font_sz] ; lo word == h
71
    mov eax, [ttip.font_sz] ; lo word == h
72
    and eax, $FFFF
72
    and eax, $FFFF
73
    imul ax, [lines]
73
    imul ax, [lines]
74
    mov [ttip.video_h], ax
74
    mov [ttip.video_h], ax
75
    imul [ttip.video_w]
75
    imul [ttip.video_w]
76
    imul eax, 3  ; eax have now width * height in pixels *3
76
    imul eax, 3  ; eax have now width * height in pixels *3
77
    ; getmem
77
    ; getmem
78
    invoke mem.alloc, eax
78
    invoke mem.alloc, eax
79
    mov [ttip.video], eax
79
    mov [ttip.video], eax
80
    test eax, eax
80
    test eax, eax
81
    je .exitp	 ; malloc fails
81
    je .exitp	 ; malloc fails
82
 
82
 
83
    ; cycle list
83
    ; cycle list
84
    mov edi, [ttip.next]
84
    mov edi, [ttip.next]
85
.tail_call:
85
.tail_call:
86
    test edi, edi
86
    test edi, edi
87
    jne .list_next
87
    jne .list_next
88
    xor eax, eax
88
    xor eax, eax
89
    inc eax ; good return
89
    inc eax ; good return
90
.exitp:
90
.exitp:
91
	ret
91
	ret
92
endp
92
endp
93
 
93
 
94
; ---------------------------------------------------------------------------- ;
94
; ---------------------------------------------------------------------------- ;
95
; ®ç¨á⪠ ¯ ¬ï⨠¢á¥© 楯®çª¨ âã«â¨¯®¢
95
; ®ç¨á⪠ ¯ ¬ï⨠¢á¥© 楯®çª¨ âã«â¨¯®¢
96
align 4
96
align 4
97
proc tooltip_delete uses edi, ttip:dword
97
proc tooltip_delete uses edi, ttip:dword
98
    mov edi, [ttip]
98
    mov edi, [ttip]
99
    jmp .tail_call
99
    jmp .tail_call
100
.list_next:
100
.list_next:
101
    mov eax, [ttip.video]
101
    mov eax, [ttip.video]
102
    test eax, eax
102
    test eax, eax
103
    je @f
103
    je @f
104
	invoke mem.free, eax
104
	invoke mem.free, eax
105
    @@:
105
    @@:
106
    mov edi, [ttip.next]
106
    mov edi, [ttip.next]
107
.tail_call:
107
.tail_call:
108
    test edi, edi
108
    test edi, edi
109
    jne .list_next
109
    jne .list_next
110
    ret
110
    ret
111
endp
111
endp
112
 
112
 
113
; ---------------------------------------------------------------------------- ;
113
; ---------------------------------------------------------------------------- ;
114
; ¯®ª § ­ã¦­®£® ¨§ ¢á¥© 楯®çª¨ âã«â¨¯®¢ ¯à¨ ¡¥§¤¥©á⢨¨ (event 0)
114
; ¯®ª § ­ã¦­®£® ¨§ ¢á¥© 楯®çª¨ âã«â¨¯®¢ ¯à¨ ¡¥§¤¥©á⢨¨ (event 0)
115
align 4
115
align 4
116
proc tooltip_test_show uses edi ebx, ttip:dword
116
proc tooltip_test_show uses edi ebx, ttip:dword
117
    mov edi, [ttip]
117
    mov edi, [ttip]
118
    jmp .tail_call
118
    jmp .tail_call
119
.list_next:
119
.list_next:
120
    cmp [ttip.tm_strt], 0   ; â ©¬¥à 0, §­ ç¨â ¬ë ­¥ ¢ §®­¥
120
    cmp [ttip.tm_strt], 0   ; â ©¬¥à 0, §­ ç¨â ¬ë ­¥ ¢ §®­¥
121
    je .nextp
121
    je .nextp
122
    cmp [ttip.video_y], 0   ; âã«â¨¯ 㦥 ®â®¡à ¦¥­
122
    cmp [ttip.video_y], 0   ; âã«â¨¯ 㦥 ®â®¡à ¦¥­
123
 ;;;   jne .redraw
123
 ;;;   jne .redraw
124
    jne .nextp
124
    jne .nextp
125
    mcall SF_SYSTEM_GET, SSF_TIME_COUNT
125
    mcall SF_SYSTEM_GET, SSF_TIME_COUNT
126
    movzx ebx, [ttip.tm_wait]
126
    movzx ebx, [ttip.tm_wait]
127
    sub eax, ebx
127
    sub eax, ebx
128
    cmp eax, [ttip.tm_strt]
128
    cmp eax, [ttip.tm_strt]
129
    jl .exitp ; ¬®£ ¡ëâì ⮫쪮 ®¤¨­
129
    jl .exitp ; ¬®£ ¡ëâì ⮫쪮 ®¤¨­
130
    ; ¢à¥¬ï ®â⨪ «®, á®å࠭塞 ®¡« áâì ¨ à¨á㥬áï
130
    ; ¢à¥¬ï ®â⨪ «®, á®å࠭塞 ®¡« áâì ¨ à¨á㥬áï
131
;CopyScreen(shadow_buf, 5*skinned+x+wForm.left, GetSkinHeight()*skinned+y+wForm.top, w, h);
131
;CopyScreen(shadow_buf, 5*skinned+x+wForm.left, GetSkinHeight()*skinned+y+wForm.top, w, h);
132
    mcall SF_THREAD_INFO, proc_info, -1
132
    mcall SF_THREAD_INFO, proc_info, -1
133
    movzx edx, word [proc_info + 34] ; window x position
133
    movzx edx, word [proc_info + 34] ; window x position
134
    add edx, 5
134
    add edx, 5
135
    shl edx, 16
135
    shl edx, 16
136
    mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
136
    mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
137
    movzx ebx, word [proc_info + 38] ; window y position
137
    movzx ebx, word [proc_info + 38] ; window y position
138
    add eax, ebx
138
    add eax, ebx
139
    add edx, eax    ; x_y
139
    add edx, eax    ; x_y
140
    add edx, [ttip.mouse]
140
    add edx, [ttip.mouse]
141
    add edx, 20 ; pixels below mouse
141
    add edx, 20 ; pixels below mouse
142
    mov ecx, dword [ttip.video_h] ; w_h
142
    mov ecx, dword [ttip.video_h] ; w_h
143
    mcall SF_GET_IMAGE, [ttip.video]
143
    mcall SF_GET_IMAGE, [ttip.video]
144
 
144
 
145
    mov eax, [ttip.mouse]  ; á®åà ­¨¬ ¯®§¨æ¨î £¤¥ à¨á㥬áï
145
    mov eax, [ttip.mouse]  ; á®åà ­¨¬ ¯®§¨æ¨î £¤¥ à¨á㥬áï
146
    add eax, 20 ; pixels below mouse
146
    add eax, 20 ; pixels below mouse
147
    mov [ttip.video_y], ax
147
    mov [ttip.video_y], ax
148
    shr eax, 16
148
    shr eax, 16
149
    mov [ttip.video_x], ax
149
    mov [ttip.video_x], ax
150
 .redraw:    ; à¨á㥬áï ®â­®á¨â¥«ì­® ¬ëè¨!!!
150
 .redraw:    ; à¨á㥬áï ®â­®á¨â¥«ì­® ¬ëè¨!!!
151
    stdcall tooltip_draw, edi
151
    stdcall tooltip_draw, edi
152
 
152
 
153
    jmp .exitp	 ; ¬®£ ¡ëâì ⮫쪮 ®¤¨­
153
    jmp .exitp	 ; ¬®£ ¡ëâì ⮫쪮 ®¤¨­
154
.nextp:
154
.nextp:
155
    mov edi, [ttip.next]
155
    mov edi, [ttip.next]
156
.tail_call:
156
.tail_call:
157
    test edi, edi
157
    test edi, edi
158
    jne .list_next
158
    jne .list_next
159
.exitp:
159
.exitp:
160
    ret
160
    ret
161
endp
161
endp
162
 
162
 
163
; à¨á㥬áï ®â­®á¨â¥«ì­® ¬ëè¨!!!
163
; à¨á㥬áï ®â­®á¨â¥«ì­® ¬ëè¨!!!
164
; internal func
164
; internal func
165
proc tooltip_draw uses esi edi ebx, ttip:dword
165
proc tooltip_draw uses esi edi ebx, ttip:dword
166
locals
166
locals
167
    line   dw ? ;line # drawing
167
    line   dw ? ;line # drawing
168
    ptr_li dd ? ;line begin
168
    ptr_li dd ? ;line begin
169
endl
169
endl
170
    mov edi, [ttip]
170
    mov edi, [ttip]
171
    ; draw square
171
    ; draw square
172
    movzx ebx, [ttip.video_x]
172
    movzx ebx, [ttip.video_x]
173
    shl ebx, 16
173
    shl ebx, 16
174
    mov bx, [ttip.video_w]
174
    mov bx, [ttip.video_w]
175
    movzx ecx, [ttip.video_y]
175
    movzx ecx, [ttip.video_y]
176
    shl ecx, 16
176
    shl ecx, 16
177
    mov cx, [ttip.video_h]
177
    mov cx, [ttip.video_h]
178
    mcall SF_DRAW_RECT, , , [ttip.col_bkg]
178
    mcall SF_DRAW_RECT, , , [ttip.col_bkg]
179
 
179
 
180
    ; 横« ¯® áâப ¬
180
    ; 横« ¯® áâப ¬
181
    ; count num of lines and max len
181
    ; count num of lines and max len
182
    mov esi, [ttip.txt]
182
    mov esi, [ttip.txt]
183
    mov [line], 0  ; line #
183
    mov [line], 0  ; line #
184
.line:
184
.line:
185
    mov ecx, 0	; len
185
    mov ecx, 0	; len
186
    mov [ptr_li], esi
186
    mov [ptr_li], esi
187
.symb:
187
.symb:
188
    mov al, [esi]
188
    mov al, [esi]
189
    cmp al, 0
189
    cmp al, 0
190
    je @f
190
    je @f
191
	cmp al, 13
191
	cmp al, 13
192
	jne .next
192
	jne .next
193
    @@:
193
    @@:
194
    ; draw line if len > 0
194
    ; draw line if len > 0
195
    test ecx, ecx
195
    test ecx, ecx
196
    je @f
196
    je @f
197
       ; draw single line
197
       ; draw single line
198
	pushad
198
	pushad
199
	mov esi, ecx ; length
199
	mov esi, ecx ; length
200
	movzx ebx, [ttip.video_x]
200
	movzx ebx, [ttip.video_x]
201
	shl ebx, 16
201
	shl ebx, 16
202
	mov eax, [ttip.font_sz]
202
	mov eax, [ttip.font_sz]
203
	and eax, $FFFF
203
	and eax, $FFFF
204
	imul ax, [line]
204
	imul ax, [line]
205
	add ax, [ttip.video_y]
205
	add ax, [ttip.video_y]
206
	add ebx, eax
206
	add ebx, eax
207
	mov ecx, [ttip.col_txt]
207
	mov ecx, [ttip.col_txt]
208
	and ecx, $37FFFFFF
208
	and ecx, $37FFFFFF
209
	mov edx, [ptr_li]
209
	mov edx, [ptr_li]
210
	mcall SF_DRAW_TEXT
210
	mcall SF_DRAW_TEXT
211
	popad
211
	popad
212
    @@:
212
    @@:
213
    cmp byte ptr esi, 0
213
    cmp byte ptr esi, 0
214
    je .exitp
214
    je .exitp
215
       inc [line]
215
       inc [line]
216
       inc esi
216
       inc esi
217
       jmp .line
217
       jmp .line
218
.next:
218
.next:
219
    inc ecx
219
    inc ecx
220
    inc esi
220
    inc esi
221
    jmp .symb
221
    jmp .symb
222
.exitp:
222
.exitp:
223
    ret
223
    ret
224
endp
224
endp
225
 
225
 
226
; ---------------------------------------------------------------------------- ;
226
; ---------------------------------------------------------------------------- ;
227
; ã¡à âì âã«â¨¯ë ¯à¨ 饫窥 ¬ëè¨ ¨«¨ áꥧ¤¥ ¨§ §®­ë. ¤«ï ¢á¥© 楯®çª¨ âã«â¨¯®¢ ¯à¨ ᮡë⨨ ¬ëè¨
227
; ã¡à âì âã«â¨¯ë ¯à¨ 饫窥 ¬ëè¨ ¨«¨ áꥧ¤¥ ¨§ §®­ë. ¤«ï ¢á¥© 楯®çª¨ âã«â¨¯®¢ ¯à¨ ᮡë⨨ ¬ëè¨
228
; ¥á«¨ mouse_coord == -1 ®¯à®á¨â ¬ëèì
228
; ¥á«¨ mouse_coord == -1 ®¯à®á¨â ¬ëèì
229
align 4
229
align 4
230
proc tooltip_mouse, ttip:dword
230
proc tooltip_mouse, ttip:dword
231
locals
231
locals
232
    mouse_coord dd ?
232
    mouse_coord dd ?
233
    mouse_but	dd ?
233
    mouse_but	dd ?
234
endl
234
endl
235
    pushad
235
    pushad
236
    ; ®¯à®á¨¬ ¬ëèì ¨ à áá㥬 ¯® âã«â¨¯ ¬
236
    ; ®¯à®á¨¬ ¬ëèì ¨ à áá㥬 ¯® âã«â¨¯ ¬
237
    mcall SF_MOUSE_GET, SSF_WINDOW_POSITION
237
    mcall SF_MOUSE_GET, SSF_WINDOW_POSITION
238
    mov [mouse_coord], eax
238
    mov [mouse_coord], eax
239
    mcall SF_MOUSE_GET, SSF_BUTTON
239
    mcall SF_MOUSE_GET, SSF_BUTTON
240
    mov [mouse_but], eax
240
    mov [mouse_but], eax
241
    mov edi, [ttip]
241
    mov edi, [ttip]
242
.list_next:
242
.list_next:
243
    test edi, edi
243
    test edi, edi
244
    je .exitp
244
    je .exitp
245
    cmp [mouse_but], 0	; ¯à¨ 饫窥 áâ¨à ¥¬áï
245
    cmp [mouse_but], 0	; ¯à¨ 饫窥 áâ¨à ¥¬áï
246
    jne @f
246
    jne @f
247
	; ¯®¯ ¤ ¥¬ «¨ ¢ §®­ã ª®­â஫ï
247
	; ¯®¯ ¤ ¥¬ «¨ ¢ §®­ã ª®­â஫ï
248
	mov eax, [mouse_coord]
248
	mov eax, [mouse_coord]
249
	mov [ttip.mouse], eax ; ¬¥áâ® £¤¥ ¡ë«  § ¬¥ç¥­  ¬ëèì! (å§ § ç¥¬)
249
	mov [ttip.mouse], eax ; ¬¥áâ® £¤¥ ¡ë«  § ¬¥ç¥­  ¬ëèì! (å§ § ç¥¬)
250
	mov ecx, eax
250
	mov ecx, eax
251
	shr ecx, 16
251
	shr ecx, 16
252
	cmp cx, [ttip.zone_x] ; zone_x is higher word
252
	cmp cx, [ttip.zone_x] ; zone_x is higher word
253
	jl @f
253
	jl @f
254
	cmp ax, [ttip.zone_y]
254
	cmp ax, [ttip.zone_y]
255
	jl @f
255
	jl @f
256
	mov cx, [ttip.zone_w]
256
	mov cx, [ttip.zone_w]
257
	add cx, [ttip.zone_x]
257
	add cx, [ttip.zone_x]
258
	shl ecx, 16
258
	shl ecx, 16
259
	cmp eax, ecx	; x+w < mouse_x (mouse_y in low word ignored)
259
	cmp eax, ecx	; x+w < mouse_x (mouse_y in low word ignored)
260
	jge @f
260
	jge @f
261
	mov cx, [ttip.zone_y]
261
	mov cx, [ttip.zone_y]
262
	add cx, [ttip.zone_h]
262
	add cx, [ttip.zone_h]
263
	cmp ax, cx
263
	cmp ax, cx
264
	jge @f
264
	jge @f
265
	; ¬ë ¢ §®­¥ - § á¥ª ¥¬ áâ àâ, ¥á«¨ ¥£® ­¥ ¡ë«®
265
	; ¬ë ¢ §®­¥ - § á¥ª ¥¬ áâ àâ, ¥á«¨ ¥£® ­¥ ¡ë«®
266
	cmp [ttip.tm_strt], 0
266
	cmp [ttip.tm_strt], 0
267
	jne .nextp
267
	jne .nextp
268
	    mcall SF_SYSTEM_GET, SSF_TIME_COUNT
268
	    mcall SF_SYSTEM_GET, SSF_TIME_COUNT
269
	    mov [ttip.tm_strt], eax
269
	    mov [ttip.tm_strt], eax
270
	    jmp .nextp
270
	    jmp .nextp
271
    @@:
271
    @@:
272
    ; ¥á«¨ ¥áâì ¡ãä¥à, ¢¥à­ãâì ª à⨭ªã ¢§ ¤, ¨­ ç¥ ¨¤¥¬ ¤ «ìè¥ ¯® 楯®çª¥
272
    ; ¥á«¨ ¥áâì ¡ãä¥à, ¢¥à­ãâì ª à⨭ªã ¢§ ¤, ¨­ ç¥ ¨¤¥¬ ¤ «ìè¥ ¯® 楯®çª¥
273
    mov [ttip.tm_strt], 0
273
    mov [ttip.tm_strt], 0
274
    cmp [ttip.video_y], 0
274
    cmp [ttip.video_y], 0
275
    je .nextp
275
    je .nextp
276
	movzx ecx, [ttip.video_w]
276
	movzx ecx, [ttip.video_w]
277
	shl ecx, 16
277
	shl ecx, 16
278
	mov cx, [ttip.video_h]
278
	mov cx, [ttip.video_h]
279
	movzx edx, [ttip.video_x]
279
	movzx edx, [ttip.video_x]
280
	shl edx, 16
280
	shl edx, 16
281
	mov dx, [ttip.video_y]
281
	mov dx, [ttip.video_y]
282
	mcall SF_PUT_IMAGE, [ttip.video]
282
	mcall SF_PUT_IMAGE, [ttip.video]
283
	mov [ttip.video_y], 0
283
	mov [ttip.video_y], 0
284
	;jmp exitp   ; ¬®£ ¡ëâì ⮫쪮 ®¤¨­ - ®â¬¥­  - ®¡à ¡®â âì ­ã¦­® ¢á¥ á¡à®áë â ©¬¥à®¢
284
	;jmp exitp   ; ¬®£ ¡ëâì ⮫쪮 ®¤¨­ - ®â¬¥­  - ®¡à ¡®â âì ­ã¦­® ¢á¥ á¡à®áë â ©¬¥à®¢
285
.nextp:
285
.nextp:
286
    ;mov eax, [ttip].next
286
    ;mov eax, [ttip].next
287
    ;stdcall tooltip_mouse, [ttip].next, [mouse_coord], [mouse_but]
287
    ;stdcall tooltip_mouse, [ttip].next, [mouse_coord], [mouse_but]
288
    ; tail call unroll recursion
288
    ; tail call unroll recursion
289
    mov edi, [ttip.next]
289
    mov edi, [ttip.next]
290
    jmp .list_next
290
    jmp .list_next
291
.exitp:
291
.exitp:
292
    popad
292
    popad
293
    ret
293
    ret
294
endp
294
endp
295
 
295
 
296
; ---------------------------------------------------------------------------- ;
296
; ---------------------------------------------------------------------------- ;
297
; decrypt font size as of SysFn 4
297
; decrypt font size as of SysFn 4
298
; returns eax = (x,y)
298
; returns eax = (x,y)
299
align 4
299
align 4
300
proc get_font_size, color:dword  ; x86 calling convention uses eax ecx edx
300
proc get_font_size, color:dword  ; x86 calling convention uses eax ecx edx
301
    ;font = color >> 24;
301
    ;font = color >> 24;
302
    ;int font_multipl = (font & 7) + 1;
302
    ;int font_multipl = (font & 7) + 1;
303
    ;if (font & 0x10) // 8x16
303
    ;if (font & 0x10) // 8x16
304
    ;{
304
    ;{
305
    ;    ed->width_sym = 8 * font_multipl;
305
    ;    ed->width_sym = 8 * font_multipl;
306
    ;    ed->hight_sym = 16 * font_multipl;
306
    ;    ed->hight_sym = 16 * font_multipl;
307
    ;} else   // 6x9
307
    ;} else   // 6x9
308
    ;{
308
    ;{
309
    ;    ed->width_sym = 6 * font_multipl;
309
    ;    ed->width_sym = 6 * font_multipl;
310
    ;    ed->hight_sym = 9 * font_multipl;
310
    ;    ed->hight_sym = 9 * font_multipl;
311
    ;}
311
    ;}
312
    mov edx, [color]
312
    mov edx, [color]
313
    shr edx, 24     ; font
313
    shr edx, 24     ; font
314
 
314
 
315
    mov ecx, edx    ; font_multipl
315
    mov ecx, edx    ; font_multipl
316
    and ecx, 7
316
    and ecx, 7
317
    inc ecx
317
    inc ecx
318
 
318
 
319
    test edx, $10
319
    test edx, $10
320
	mov edx, ecx
320
	mov edx, ecx
321
    jz @f
321
    jz @f
322
	; 8x16
322
	; 8x16
323
	shl edx, 3 + 16 ; x == width
323
	shl edx, 3 + 16 ; x == width
324
	mov eax, edx
324
	mov eax, edx
325
	mov edx, ecx
325
	mov edx, ecx
326
	shl edx, 4	; y == hight
326
	shl edx, 4	; y == hight
327
	jmp .exitp
327
	jmp .exitp
328
    @@:
328
    @@:
329
	; 6x9
329
	; 6x9
330
	imul edx, 6 ; x == width
330
	imul edx, 6 ; x == width
331
	shl edx, 16
331
	shl edx, 16
332
	mov eax, edx
332
	mov eax, edx
333
	mov edx, ecx
333
	mov edx, ecx
334
	imul edx, 9	 ; y == hight
334
	imul edx, 9	 ; y == hight
335
.exitp:
335
.exitp:
336
	or  eax, edx
336
	or  eax, edx
337
    ret
337
    ret
338
endp
338
endp
339
 
-
 
340
CODE_END: ; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë; ---------------------------------------------------------------------------- ;
-
 
341
; ---------------------------------------------------------------------------- ;
339
 
342
;---------------------------------------------------------------------
340
;---------------------------------------------------------------------
343
;--- „€›… Žƒ€ŒŒ› ----------------------------------------------
341
;--- „€›… Žƒ€ŒŒ› ----------------------------------------------
344
;---------------------------------------------------------------------
342
;---------------------------------------------------------------------
345
 
343
 
346
proc_info   rd 1024
344
proc_info   rd 1024
347
 
-
 
348
DATA_END: ; ¬¥âª  ª®­æ  ¤ ­­ëå ¯à®£à ¬¬ë; ---------------------------------------------------------------------------- ;
-