Subversion Repositories Kolibri OS

Rev

Rev 7400 | Rev 7500 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7400 Rev 7404
1
macro use_key_no_process  up,down,esc,enter,tab,numl,capsl,scrolll
1
macro use_key_no_process  up,down,esc,enter,tab,numl,capsl,scrolll
2
{
2
{
3
if up eq
3
if up eq
4
else
4
else
5
        cmp     ah,177
5
        cmp     ah,177
6
        jz      edit_box.editbox_exit
6
        jz      edit_box.editbox_exit
7
end if
7
end if
8
if down eq
8
if down eq
9
else
9
else
10
        cmp     ah,178
10
        cmp     ah,178
11
        jz      edit_box.editbox_exit
11
        jz      edit_box.editbox_exit
12
end if
12
end if
13
if esc eq
13
if esc eq
14
else
14
else
15
        cmp     ah,27   ;ESC - ª« ¢¨è  ))
15
        cmp     ah,27   ;ESC - ª« ¢¨è  ))
16
        jz      edit_box.editbox_exit
16
        jz      edit_box.editbox_exit
17
end if
17
end if
18
if enter eq
18
if enter eq
19
else
19
else
20
        cmp     ah,13   ;ENTER - ª« ¢¨è  ))
20
        cmp     ah,13   ;ENTER - ª« ¢¨è  ))
21
        jz      edit_box.editbox_exit
21
        jz      edit_box.editbox_exit
22
end if
22
end if
23
if tab eq
23
if tab eq
24
else
24
else
25
        cmp     ah,9   ;TAB - ª« ¢¨è  ))
25
        cmp     ah,9   ;TAB - ª« ¢¨è  ))
26
        jz      edit_box.editbox_exit
26
        jz      edit_box.editbox_exit
27
end if
27
end if
28
if numl eq
28
if numl eq
29
else
29
else
30
        cmp     ah,4   ;Num Lock - ª« ¢¨è  ))
30
        cmp     ah,4   ;Num Lock - ª« ¢¨è  ))
31
        jz      edit_box.editbox_exit
31
        jz      edit_box.editbox_exit
32
end if
32
end if
33
if capsl eq
33
if capsl eq
34
else
34
else
35
        cmp     ah,2   ;Caps Lock - ª« ¢¨è  ))
35
        cmp     ah,2   ;Caps Lock - ª« ¢¨è  ))
36
        jz      edit_box.editbox_exit
36
        jz      edit_box.editbox_exit
37
end if
37
end if
38
if scrolll eq
38
if scrolll eq
39
else
39
else
40
        cmp     ah,1   ;Scroll Lock - ª« ¢¨è  ))
40
        cmp     ah,1   ;Scroll Lock - ª« ¢¨è  ))
41
        jz      edit_box.editbox_exit
41
        jz      edit_box.editbox_exit
42
end if
42
end if
43
}
43
}
44
 
44
 
45
 
45
 
46
align 16
46
align 16
47
edit_box:
47
edit_box:
48
.draw:
48
.draw:
49
        pushad
49
        pushad
50
        mov     edi,[esp+36]
50
        mov     edi,[esp+36]
51
        and     dword ed_text_color,17FFFFFFh
51
        and     dword ed_text_color,17FFFFFFh
52
        mov     ecx,ed_text_color
52
        mov     ecx,ed_text_color
53
        mov     ebx,ecx
53
        mov     ebx,ecx
54
        shr     ecx,28
54
        shr     ecx,28
55
        shl     ebx,4
55
        shl     ebx,4
56
        shr     ebx,28
56
        shr     ebx,28
57
        inc     ebx
57
        inc     ebx
58
        mov     eax,6
58
        mov     eax,6
59
        jecxz   @f
59
        jecxz   @f
60
        mov     al, 8
60
        mov     al, 8
61
@@:
61
@@:
62
        mul     bl
62
        mul     bl
63
        mov     ed_char_width,eax
63
        mov     ed_char_width,eax
64
        mov     al, 9
64
        mov     al, 9
65
        jecxz   @f
65
        jecxz   @f
66
        mov     al, 16
66
        mov     al, 16
67
@@:
67
@@:
68
        mul     bl
68
        mul     bl
69
        add     eax,4
69
        add     eax,4
70
        mov     ed_height,eax
70
        mov     ed_height,eax
71
        call    .draw_border
71
        call    .draw_border
72
.draw_bg_cursor_text:
72
.draw_bg_cursor_text:
73
        call    .check_offset
73
        call    .check_offset
74
        call    .draw_bg
74
        call    .draw_bg
75
        call    .draw_shift
75
        call    .draw_shift
76
.draw_cursor_text:
76
.draw_cursor_text:
77
        call    .draw_text
77
        call    .draw_text
78
        test    word ed_flags,ed_focus
78
        test    word ed_flags,ed_focus
79
        jz      .editbox_exit
79
        jz      .editbox_exit
80
        call    .draw_cursor
80
        call    .draw_cursor
81
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
81
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
82
;Ž¡é¨© ¢ë室 ¨§ editbox ¤«ï ¢á¥å ä㭪権 ¨ ¯®áâ ®¡à ¡®â稪®¢;;
82
;Ž¡é¨© ¢ë室 ¨§ editbox ¤«ï ¢á¥å ä㭪権 ¨ ¯®áâ ®¡à ¡®â稪®¢;;
83
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
83
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
84
.editbox_exit:
84
.editbox_exit:
85
        popad
85
        popad
86
        ret 4
86
        ret 4
87
 
87
 
88
;==========================================================
88
;==========================================================
89
;=== ®¡à ¡®âª  ª« ¢¨ âãàë =================================
89
;=== ®¡à ¡®âª  ª« ¢¨ âãàë =================================
90
;==========================================================
90
;==========================================================
91
align 16
91
align 16
92
edit_box_key:
92
edit_box_key:
93
        pushad
93
        pushad
94
        mov     edi,[esp+36]
94
        mov     edi,[esp+36]
95
        test    word ed_flags,ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
95
        test    word ed_flags,ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
96
        jz      edit_box.editbox_exit
96
        jz      edit_box.editbox_exit
97
        test    word ed_flags,ed_mouse_on or ed_disabled
97
        test    word ed_flags,ed_mouse_on or ed_disabled
98
        jnz     edit_box.editbox_exit
98
        jnz     edit_box.editbox_exit
99
;--------------------------------------
99
;--------------------------------------
100
; this code for Win-keys, works with
100
; this code for Win-keys, works with
101
; kernel SVN r.3356 or later
101
; kernel SVN r.3356 or later
102
        push    eax
102
        push    eax
103
        push    ebx
103
        push    ebx
104
        mcall   SF_KEYBOARD,SSF_GET_CONTROL_KEYS
104
        mcall   SF_KEYBOARD,SSF_GET_CONTROL_KEYS
105
        test    ax,0x200        ; LWin
105
        test    ax,0x200        ; LWin
106
        jnz     .win_key_pressed
106
        jnz     .win_key_pressed
107
        test    ax,0x400        ; RWin
107
        test    ax,0x400        ; RWin
108
        jz      @f
108
        jz      @f
109
.win_key_pressed:
109
.win_key_pressed:
110
        pop     ebx
110
        pop     ebx
111
        pop     eax
111
        pop     eax
112
        jmp     edit_box.editbox_exit
112
        jmp     edit_box.editbox_exit
113
 
113
 
114
@@:     pop     ebx
114
@@:     pop     ebx
115
        pop     eax
115
        pop     eax
116
;--------------------------------------
116
;--------------------------------------
117
;à®¢¥àª  ­ ¦ â shift ?
117
;à®¢¥àª  ­ ¦ â shift ?
118
        call    edit_box_key.check_shift_ctrl_alt
118
        call    edit_box_key.check_shift_ctrl_alt
119
;----------------------------------------------------------
119
;----------------------------------------------------------
120
;--- ¯à®¢¥à塞, çâ® ­ ¦ â® --------------------------------
120
;--- ¯à®¢¥à塞, çâ® ­ ¦ â® --------------------------------
121
;----------------------------------------------------------
121
;----------------------------------------------------------
122
        cmp     ah,8
122
        cmp     ah,8
123
        jz      edit_box_key.backspace
123
        jz      edit_box_key.backspace
124
        cmp     ah,0xb6
124
        cmp     ah,0xb6
125
        jz      edit_box_key.delete
125
        jz      edit_box_key.delete
126
        cmp     ah,176
126
        cmp     ah,176
127
        jz      edit_box_key.left
127
        jz      edit_box_key.left
128
        cmp     ah,179
128
        cmp     ah,179
129
        jz      edit_box_key.right
129
        jz      edit_box_key.right
130
        cmp     ah,180
130
        cmp     ah,180
131
        jz      edit_box_key.home
131
        jz      edit_box_key.home
132
        cmp     ah,181
132
        cmp     ah,181
133
        jz      edit_box_key.end
133
        jz      edit_box_key.end
134
        cmp     ah,185  ;insert
134
        cmp     ah,185  ;insert
135
        jz      edit_box_key.insert
135
        jz      edit_box_key.insert
136
; ª®¬¡¨­ æ¨¨ Ctrl + ª« ¢¨è 
136
; ª®¬¡¨­ æ¨¨ Ctrl + ª« ¢¨è 
137
        test    word ed_flags,ed_ctrl_on
137
        test    word ed_flags,ed_ctrl_on
138
        jz      @f
138
        jz      @f
139
; ¯à®¢¥àª  ᪠­ª®¤ 
139
; ¯à®¢¥àª  ᪠­ª®¤ 
140
        ror     eax,8
140
        ror     eax,8
141
        cmp     ah,45 ; Ctrl + X
141
        cmp     ah,45 ; Ctrl + X
142
        je      edit_box_key.ctrl_x        
142
        je      edit_box_key.ctrl_x        
143
        cmp     ah,46 ; Ctrl + C
143
        cmp     ah,46 ; Ctrl + C
144
        je      edit_box_key.ctrl_c
144
        je      edit_box_key.ctrl_c
145
        cmp     ah,47 ; Ctrl + V
145
        cmp     ah,47 ; Ctrl + V
146
        je      edit_box_key.ctrl_v
146
        je      edit_box_key.ctrl_v
147
        rol     eax,8
147
        rol     eax,8
148
@@:
148
@@:
149
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
149
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
150
;‡ £«ã誠 ­  ®¡à ¡®âªã ª« ¢¨è ¢¢¥àå ¨ ¢­¨§ â.¥. ¯à¨ ®¡­ à㦥­¨¨ íâ¨å ª®¤®¢ ¯à®¨á室¨â ¢ë室 ¨§ ®¡à ¡®â稪 
150
;‡ £«ã誠 ­  ®¡à ¡®âªã ª« ¢¨è ¢¢¥àå ¨ ¢­¨§ â.¥. ¯à¨ ®¡­ à㦥­¨¨ íâ¨å ª®¤®¢ ¯à®¨á室¨â ¢ë室 ¨§ ®¡à ¡®â稪 
151
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
151
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
152
use_key_no_process   up,down,esc,enter,tab,numl,capsl,scrolll
152
use_key_no_process   up,down,esc,enter,tab,numl,capsl,scrolll
153
;--- ­ ¦ â  ¤àã£ ï ª« ¢¨è  ---
153
;--- ­ ¦ â  ¤àã£ ï ª« ¢¨è  ---
154
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
154
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
155
;à®¢¥àª  ãáâ ­®¢«¥­ «¨ ä« £ ¯à¨ ª®â®à®¬ ­ã¦­® ¢ë¢®¤¨âì ⮫쪮 æ¨äàë ¢ ­ã¦­®¬ ¡®ªá¥, ¥á«¨ â ª®© ­¥®¡å®¤¨¬®á⨠­¥â, ­ã¦­® § ª®¬¥­â¨à®¢ âì ¬ ªà®á
155
;à®¢¥àª  ãáâ ­®¢«¥­ «¨ ä« £ ¯à¨ ª®â®à®¬ ­ã¦­® ¢ë¢®¤¨âì ⮫쪮 æ¨äàë ¢ ­ã¦­®¬ ¡®ªá¥, ¥á«¨ â ª®© ­¥®¡å®¤¨¬®á⨠­¥â, ­ã¦­® § ª®¬¥­â¨à®¢ âì ¬ ªà®á
156
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
156
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
157
        test    word ed_flags,ed_figure_only  ; ⮫쪮 æ¨äàë?
157
        test    word ed_flags,ed_figure_only  ; ⮫쪮 æ¨äàë?
158
        jz      @f
158
        jz      @f
159
        cmp     ah,'0'
159
        cmp     ah,'0'
160
        jb      edit_box.editbox_exit
160
        jb      edit_box.editbox_exit
161
        cmp     ah,'9'
161
        cmp     ah,'9'
162
        ja      edit_box.editbox_exit
162
        ja      edit_box.editbox_exit
163
@@:
163
@@:
164
 
164
 
165
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
165
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
166
;¯à®¢¥àª  ­  shift, ¡ë« «¨ ­ ¦ â
166
;¯à®¢¥àª  ­  shift, ¡ë« «¨ ­ ¦ â
167
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
167
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
168
        test    word ed_flags,ed_shift_on
168
        test    word ed_flags,ed_shift_on
169
        je      @f
169
        je      @f
170
; edx = ed_size, ecx = ed_pos
170
; edx = ed_size, ecx = ed_pos
171
        push    eax
171
        push    eax
172
        mov     edx,ed_size
172
        mov     edx,ed_size
173
        mov     ecx, ed_pos
173
        mov     ecx, ed_pos
174
        pusha
174
        pusha
175
; clear input area
175
; clear input area
176
        mov     ebp,ed_color
176
        mov     ebp,ed_color
177
        movzx   ebx, word ed_shift_pos
177
        movzx   ebx, word ed_shift_pos
178
        call    edit_box_key.sh_cl_
178
        call    edit_box_key.sh_cl_
179
        mov     ebp,ed_size
179
        mov     ebp,ed_size
180
        call    edit_box_key.clear_bg
180
        call    edit_box_key.clear_bg
181
        popa
181
        popa
182
        call    edit_box_key.del_char
182
        call    edit_box_key.del_char
183
        mov     ebx,ed_size
183
        mov     ebx,ed_size
184
        sub     bx,ed_shift_pos
184
        sub     bx,ed_shift_pos
185
        mov     ed_size,ebx
185
        mov     ed_size,ebx
186
        pop     eax
186
        pop     eax
187
@@:
187
@@:
188
 
188
 
189
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
189
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
190
; ¯à®¢¥à塞, ­ å®¤¨âáï «¨ ªãàá®à ¢ ª®­æ¥ + ¤ «ì­¥©è ï ®¡à ¡®âª 
190
; ¯à®¢¥à塞, ­ å®¤¨âáï «¨ ªãàá®à ¢ ª®­æ¥ + ¤ «ì­¥©è ï ®¡à ¡®âª 
191
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
191
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
192
        mov     ecx,ed_size
192
        mov     ecx,ed_size
193
        mov     edx, ed_max
193
        mov     edx, ed_max
194
        test    word ed_flags,ed_insert
194
        test    word ed_flags,ed_insert
195
        jne     @f
195
        jne     @f
196
        cmp     ecx,edx
196
        cmp     ecx,edx
197
        jae     edit_box.editbox_exit
197
        jae     edit_box.editbox_exit
198
@@:     mov     ebx, ed_pos
198
@@:     mov     ebx, ed_pos
199
        cmp     ebx,edx
199
        cmp     ebx,edx
200
        jnl     edit_box.editbox_exit
200
        jnl     edit_box.editbox_exit
201
        mov     ecx,ed_size
201
        mov     ecx,ed_size
202
        push    edi eax
202
        push    edi eax
203
        mov     ebp,edi
203
        mov     ebp,edi
204
        mov     esi,ed_text
204
        mov     esi,ed_text
205
        add     esi,ecx
205
        add     esi,ecx
206
        mov     edi,esi
206
        mov     edi,esi
207
        cmp     ecx,ebx
207
        cmp     ecx,ebx
208
        je      edit_box_key.In_k
208
        je      edit_box_key.In_k
209
        test    dword bp_flags,ed_insert
209
        test    dword bp_flags,ed_insert
210
        jne     edit_box_key.ins_v
210
        jne     edit_box_key.ins_v
211
        pusha
211
        pusha
212
        mov     edi,ebp
212
        mov     edi,ebp
213
        mov     ebp,ed_size
213
        mov     ebp,ed_size
214
        call    edit_box_key.clear_bg
214
        call    edit_box_key.clear_bg
215
        popa
215
        popa
216
        sub     ecx,ebx
216
        sub     ecx,ebx
217
        inc     edi
217
        inc     edi
218
        std
218
        std
219
        inc     ecx
219
        inc     ecx
220
@@:
220
@@:
221
        lodsb
221
        lodsb
222
        stosb
222
        stosb
223
        loop    @b
223
        loop    @b
224
edit_box_key.In_k:
224
edit_box_key.In_k:
225
        cld
225
        cld
226
        pop     eax
226
        pop     eax
227
        mov     al,ah
227
        mov     al,ah
228
        stosb
228
        stosb
229
        pop     edi
229
        pop     edi
230
        inc     dword ed_size
230
        inc     dword ed_size
231
        inc     dword ed_pos
231
        inc     dword ed_pos
232
        call    edit_box_key.draw_all2
232
        call    edit_box_key.draw_all2
233
        jmp     edit_box_key.shift
233
        jmp     edit_box_key.shift
234
 
234
 
235
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
235
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
236
;Ž¡à ¡®âª  ª« ¢¨è insert,delete.backspace,home,end,left,right
236
;Ž¡à ¡®âª  ª« ¢¨è insert,delete.backspace,home,end,left,right
237
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
237
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
238
edit_box_key.insert:
238
edit_box_key.insert:
239
        test    word ed_flags,ed_insert
239
        test    word ed_flags,ed_insert
240
        je      @f
240
        je      @f
241
        and     word ed_flags,ed_insert_cl
241
        and     word ed_flags,ed_insert_cl
242
        jmp     edit_box.editbox_exit
242
        jmp     edit_box.editbox_exit
243
 
243
 
244
@@:     or      word ed_flags,ed_insert
244
@@:     or      word ed_flags,ed_insert
245
        jmp     edit_box.editbox_exit
245
        jmp     edit_box.editbox_exit
246
 
246
 
247
edit_box_key.ins_v:
247
edit_box_key.ins_v:
248
        dec     dword bp_size
248
        dec     dword bp_size
249
        sub     esi,ecx
249
        sub     esi,ecx
250
        add     esi,ebx
250
        add     esi,ebx
251
        mov     edi,esi
251
        mov     edi,esi
252
        pusha
252
        pusha
253
        mov     edi,ebp
253
        mov     edi,ebp
254
        mov     ebp,ed_pos
254
        mov     ebp,ed_pos
255
        call    edit_box_key.clear_bg
255
        call    edit_box_key.clear_bg
256
        popa
256
        popa
257
        jmp     edit_box_key.In_k
257
        jmp     edit_box_key.In_k
258
 
258
 
259
edit_box_key.delete:
259
edit_box_key.delete:
260
        mov     edx,ed_size
260
        mov     edx,ed_size
261
        mov     ecx,ed_pos
261
        mov     ecx,ed_pos
262
        cmp     edx,ecx
262
        cmp     edx,ecx
263
        jg      edit_box_key.bac_del
263
        jg      edit_box_key.bac_del
264
        test    word ed_flags,ed_shift_on
264
        test    word ed_flags,ed_shift_on
265
        jne     edit_box_key.del_bac
265
        jne     edit_box_key.del_bac
266
        popad
266
        popad
267
        ret     4
267
        ret     4
268
 
268
 
269
edit_box_key.bac_del:
269
edit_box_key.bac_del:
270
        call    edit_box_key.del_char
270
        call    edit_box_key.del_char
271
        jmp     edit_box_key.draw_all
271
        jmp     edit_box_key.draw_all
272
 
272
 
273
edit_box_key.backspace:
273
edit_box_key.backspace:
274
        test    word ed_flags,ed_shift_on
274
        test    word ed_flags,ed_shift_on
275
        jne     edit_box_key.delete
275
        jne     edit_box_key.delete
276
        mov     ecx,ed_pos
276
        mov     ecx,ed_pos
277
        test    ecx,ecx
277
        test    ecx,ecx
278
        jnz     edit_box_key.del_bac
278
        jnz     edit_box_key.del_bac
279
        popad
279
        popad
280
        ret     4
280
        ret     4
281
 
281
 
282
edit_box_key.del_bac:
282
edit_box_key.del_bac:
283
        mov     edx,ed_size
283
        mov     edx,ed_size
284
        cmp     edx,ecx ;if ed_pos=ed_size
284
        cmp     edx,ecx ;if ed_pos=ed_size
285
        je      @f
285
        je      @f
286
        dec     ecx
286
        dec     ecx
287
        call    edit_box_key.del_char
287
        call    edit_box_key.del_char
288
@@:     test    word ed_flags,ed_shift_on
288
@@:     test    word ed_flags,ed_shift_on
289
        jne     edit_box_key.bac_del
289
        jne     edit_box_key.bac_del
290
        dec     dword ed_pos
290
        dec     dword ed_pos
291
edit_box_key.draw_all:
291
edit_box_key.draw_all:
292
        push    edit_box_key.shift
292
        push    edit_box_key.shift
293
        test    word ed_flags,ed_shift_on
293
        test    word ed_flags,ed_shift_on
294
        je      @f
294
        je      @f
295
        movzx   eax, word ed_shift_pos
295
        movzx   eax, word ed_shift_pos
296
        mov     ebx,ed_size
296
        mov     ebx,ed_size
297
        sub     ebx,eax
297
        sub     ebx,eax
298
        mov     ed_size,ebx
298
        mov     ed_size,ebx
299
        mov     ebp,ed_color
299
        mov     ebp,ed_color
300
        call    edit_box.clear_cursor
300
        call    edit_box.clear_cursor
301
        call    edit_box.check_offset         
301
        call    edit_box.check_offset         
302
        and     word ed_flags,ed_shift_cl
302
        and     word ed_flags,ed_shift_cl
303
        jmp     edit_box.draw_bg
303
        jmp     edit_box.draw_bg
304
 
304
 
305
@@:     dec     dword ed_size
305
@@:     dec     dword ed_size
306
edit_box_key.draw_all2:
306
edit_box_key.draw_all2:
307
        and     word ed_flags,ed_shift_cl
307
        and     word ed_flags,ed_shift_cl
308
        mov     ebp,ed_color
308
        mov     ebp,ed_color
309
        call    edit_box.clear_cursor
309
        call    edit_box.clear_cursor
310
        call    edit_box.check_offset
310
        call    edit_box.check_offset
311
        mov     ebp,ed_size
311
        mov     ebp,ed_size
312
        jmp     edit_box_key.clear_bg
312
        jmp     edit_box_key.clear_bg
313
 
313
 
314
;--- ­ ¦ â  ª« ¢¨è  left ---
314
;--- ­ ¦ â  ª« ¢¨è  left ---
315
edit_box_key.left:
315
edit_box_key.left:
316
        mov     ebx,ed_pos
316
        mov     ebx,ed_pos
317
        test    ebx,ebx
317
        test    ebx,ebx
318
        jz      edit_box_key.sh_st_of
318
        jz      edit_box_key.sh_st_of
319
        or      word ed_flags,ed_left_fl
319
        or      word ed_flags,ed_left_fl
320
        call    edit_box_key.sh_first_sh
320
        call    edit_box_key.sh_first_sh
321
        dec     dword ed_pos
321
        dec     dword ed_pos
322
        call    edit_box.draw_bg
322
        call    edit_box.draw_bg
323
        call    edit_box.draw_shift
323
        call    edit_box.draw_shift
324
        call    edit_box_key.sh_enable
324
        call    edit_box_key.sh_enable
325
        jmp     edit_box.draw_cursor_text
325
        jmp     edit_box.draw_cursor_text
326
 
326
 
327
;--- ­ ¦ â  ª« ¢¨è  right ---
327
;--- ­ ¦ â  ª« ¢¨è  right ---
328
edit_box_key.right:
328
edit_box_key.right:
329
        mov     ebx,ed_pos
329
        mov     ebx,ed_pos
330
        cmp     ebx,ed_size
330
        cmp     ebx,ed_size
331
        je      edit_box_key.sh_st_of
331
        je      edit_box_key.sh_st_of
332
        and     word ed_flags,ed_right_fl
332
        and     word ed_flags,ed_right_fl
333
        call    edit_box_key.sh_first_sh
333
        call    edit_box_key.sh_first_sh
334
        inc     dword ed_pos
334
        inc     dword ed_pos
335
        call    edit_box.draw_bg
335
        call    edit_box.draw_bg
336
        call    edit_box.draw_shift
336
        call    edit_box.draw_shift
337
        call    edit_box_key.sh_enable
337
        call    edit_box_key.sh_enable
338
        jmp     edit_box.draw_cursor_text
338
        jmp     edit_box.draw_cursor_text
339
 
339
 
340
edit_box_key.home:
340
edit_box_key.home:
341
        mov     ebx,ed_pos
341
        mov     ebx,ed_pos
342
        test    ebx,ebx
342
        test    ebx,ebx
343
        jz      edit_box_key.sh_st_of
343
        jz      edit_box_key.sh_st_of
344
        call    edit_box_key.sh_first_sh
344
        call    edit_box_key.sh_first_sh
345
        xor     eax,eax
345
        xor     eax,eax
346
        mov     ed_pos,eax
346
        mov     ed_pos,eax
347
        call    edit_box.draw_bg
347
        call    edit_box.draw_bg
348
        call    edit_box.draw_shift
348
        call    edit_box.draw_shift
349
        call    edit_box_key.sh_home_end
349
        call    edit_box_key.sh_home_end
350
        jmp     edit_box.draw_cursor_text
350
        jmp     edit_box.draw_cursor_text
351
 
351
 
352
;--- ­ ¦ â  ª« ¢¨è  end ---
352
;--- ­ ¦ â  ª« ¢¨è  end ---
353
edit_box_key.end:
353
edit_box_key.end:
354
        mov     ebx,ed_pos
354
        mov     ebx,ed_pos
355
        cmp     ebx,ed_size
355
        cmp     ebx,ed_size
356
        je      edit_box_key.sh_st_of
356
        je      edit_box_key.sh_st_of
357
        call    edit_box_key.sh_first_sh
357
        call    edit_box_key.sh_first_sh
358
        mov     eax,ed_size
358
        mov     eax,ed_size
359
        mov     ed_pos,eax
359
        mov     ed_pos,eax
360
        call    edit_box.draw_bg
360
        call    edit_box.draw_bg
361
        call    edit_box.draw_shift
361
        call    edit_box.draw_shift
362
        call    edit_box_key.sh_home_end
362
        call    edit_box_key.sh_home_end
363
        jmp     edit_box.draw_cursor_text
363
        jmp     edit_box.draw_cursor_text
364
;----------------------------------------
364
;----------------------------------------
365
StrInsert:
365
StrInsert:
366
; SizeOf(TmpBuf) >= StrLen(Src) + StrLen(Dst) + 1              
366
; SizeOf(TmpBuf) >= StrLen(Src) + StrLen(Dst) + 1              
367
Dst    equ [esp + 20] ; - destination buffer
367
Dst    equ [esp + 16] ; - destination buffer
368
Src    equ [esp + 16] ; - source to insert from
368
Src    equ [esp + 12] ; - source to insert from
369
Pos    equ [esp + 12] ; - position for insert
369
Pos    equ [esp + 8] ; - position for insert
370
DstMax equ [esp + 8]  ; - maximum Dst length(exclude terminating null)
370
DstMax equ [esp + 4]  ; - maximum Dst length(exclude terminating null)
371
TmpBuf equ [esp + 4]  ; - temporary buffer              
-
 
372
        xor    edx, edx
371
SrcCount equ [esp - 4]
373
        mov    esi, Dst
372
DstCount equ [esp - 8]
374
        mov    edi, TmpBuf
373
TmpBuf   equ [esp - 12]  ; - temporary buffer 
375
        mov    ecx, Pos
-
 
376
        add    edx, ecx
-
 
377
        rep movsb 
-
 
378
        mov    edi, Src
374
        mov    edi, Src
379
        mov    ecx, -1
375
        mov    ecx, -1
380
        xor    eax, eax
376
        xor    eax, eax
381
        repne scasb 
377
        repne scasb 
382
        mov    eax, -2
378
        mov    eax, -2
383
        sub    eax, ecx
379
        sub    eax, ecx
384
        add    edx, eax
-
 
385
        mov    esi, Src
-
 
386
        mov    edi, TmpBuf
-
 
387
        add    edi, Pos
-
 
388
        mov    ecx, eax
380
        mov    SrcCount, eax                
389
        rep movsb 
-
 
390
        mov    ebx, edi
-
 
391
        mov    edi, Dst
381
        mov    edi, Dst
392
        add    edi, Pos
382
        add    edi, Pos
393
        mov    ecx, -1
383
        mov    ecx, -1
394
        xor    eax, eax
384
        xor    eax, eax
395
        repne scasb 
385
        repne scasb 
396
        mov    eax, -2
386
        mov    eax, -2
397
        sub    eax, ecx
387
        sub    eax, ecx
398
        inc    eax
388
        inc    eax
-
 
389
        mov    DstCount, eax                
-
 
390
        mov    ecx, eax
-
 
391
        add    ecx, SrcCount
399
        add    edx, eax
392
        add    ecx, Pos
-
 
393
        mcall   SF_SYS_MISC,SSF_MEM_ALLOC
-
 
394
        mov    TmpBuf, eax          
-
 
395
        mov    esi, Dst
-
 
396
        mov    edi, TmpBuf
-
 
397
        mov    ecx, Pos
400
        mov    edi, ebx
398
        mov    edx, ecx
-
 
399
        rep movsb         
-
 
400
        mov    esi, Src
-
 
401
        mov    edi, TmpBuf
-
 
402
        add    edi, Pos
-
 
403
        mov    ecx, SrcCount
-
 
404
        add    edx, ecx
-
 
405
        rep movsb         
401
        mov    esi, Pos
406
        mov    esi, Pos
402
        add    esi, Dst
407
        add    esi, Dst
-
 
408
        mov    ecx, DstCount
403
        mov    ecx, eax
409
        add    edx, ecx
404
        rep movsb 
410
        rep movsb         
405
        mov    esi, TmpBuf
411
        mov    esi, TmpBuf
406
        mov    edi, Dst
412
        mov    edi, Dst
407
; ecx = MIN(edx, DstSize)        
413
; ecx = MIN(edx, DstSize)        
408
        cmp    edx, DstMax
414
        cmp    edx, DstMax
409
        sbb    ecx, ecx                                   
415
        sbb    ecx, ecx                                   
410
        and    edx, ecx
416
        and    edx, ecx
411
        not    ecx
417
        not    ecx
412
        and    ecx, DstMax
418
        and    ecx, DstMax
413
        add    ecx, edx                                   
419
        add    ecx, edx                                   
414
        mov    eax, ecx ; return total length
420
        mov    eax, ecx ; return total length
415
        rep movsb
421
        rep movsb        
-
 
422
        mov    ecx, TmpBuf
-
 
423
        mcall   SF_SYS_MISC,SSF_MEM_FREE                                
416
        ret    20
424
        ret    16
417
restore Dst    
425
restore Dst    
418
restore Src      
426
restore Src      
419
restore Pos    
427
restore Pos    
420
restore DstSize
428
restore DstSize
421
restore TmpBuf 
429
restore TmpBuf 
-
 
430
restore SrcCount
-
 
431
restore DstCount
422
;----------------------------------------         
432
;----------------------------------------         
423
edit_box_key.ctrl_x:
433
edit_box_key.ctrl_x:
424
        test   word ed_flags,ed_shift_on
434
        test   word ed_flags,ed_shift_on
425
        jz     edit_box.editbox_exit        
435
        jz     edit_box.editbox_exit        
426
        push    dword 'X'  ; this value need below to determine which action is used
436
        push    dword 'X'  ; this value need below to determine which action is used
427
        jmp     edit_box_key.ctrl_c.pushed
437
        jmp     edit_box_key.ctrl_c.pushed
428
        
438
        
429
edit_box_key.ctrl_c:
439
edit_box_key.ctrl_c:
430
        test   word ed_flags,ed_shift_on
440
        test   word ed_flags,ed_shift_on
431
        jz     edit_box.editbox_exit
441
        jz     edit_box.editbox_exit
432
        push    dword 'C'  ; this value need below to determine which action is used
442
        push    dword 'C'  ; this value need below to determine which action is used
433
.pushed:        
443
.pushed:        
434
; add memory area
444
; add memory area
435
        mov     ecx,ed_size
445
        mov     ecx,ed_size
436
        add     ecx,3*4
446
        add     ecx,3*4
437
        mcall   SF_SYS_MISC,SSF_MEM_ALLOC
447
        mcall   SF_SYS_MISC,SSF_MEM_ALLOC
438
; building the clipboard slot header
448
; building the clipboard slot header
439
        xor     ecx,ecx
449
        xor     ecx,ecx
440
        mov     [eax+4],ecx ; type 'text'
450
        mov     [eax+4],ecx ; type 'text'
441
        inc     ecx
451
        inc     ecx
442
        mov     [eax+8],ecx ; cp866 text encoding
452
        mov     [eax+8],ecx ; cp866 text encoding
443
        mov     ecx,ed_pos       
453
        mov     ecx,ed_pos       
444
        movzx   ebx,word ed_shift_pos
454
        movzx   ebx,word ed_shift_pos
445
        sub     ecx,ebx
455
        sub     ecx,ebx
446
.abs: ; make ecx = abs(ecx)
456
.abs: ; make ecx = abs(ecx)
447
	       neg     ecx
457
	       neg     ecx
448
	       jl	     .abs
458
	       jl	     .abs
449
        add     ecx,3*4
459
        add     ecx,3*4
450
        mov     [eax],ecx
460
        mov     [eax],ecx
451
        sub     ecx,3*4        
461
        sub     ecx,3*4        
452
        mov     edx,ed_pos
462
        mov     edx,ed_pos
453
        movzx   ebx,word ed_shift_pos
463
        movzx   ebx,word ed_shift_pos
454
        cmp     edx,ebx
464
        cmp     edx,ebx
455
        jle     @f
465
        jle     @f
456
        mov     edx,ebx
466
        mov     edx,ebx
457
@@:        
467
@@:        
458
; copy data
468
; copy data
459
        mov     esi,ed_text
469
        mov     esi,ed_text
460
        add     esi,edx
470
        add     esi,edx
461
        push    edi
471
        push    edi
462
        mov     edi,eax
472
        mov     edi,eax
463
        add     edi,3*4
473
        add     edi,3*4
464
        cld
474
        cld
465
        rep     movsb
475
        rep     movsb
466
        pop     edi
476
        pop     edi
467
; put slot to the kernel clipboard
477
; put slot to the kernel clipboard
468
        mov     edx,eax
478
        mov     edx,eax
469
        mov     ecx,[edx]
479
        mov     ecx,[edx]
470
        push    eax
480
        push    eax
471
        mcall   SF_CLIPBOARD,SSF_WRITE_CB
481
        mcall   SF_CLIPBOARD,SSF_WRITE_CB
472
        pop     ecx
482
        pop     ecx
473
; remove unnecessary memory area
483
; remove unnecessary memory area
474
        mcall   SF_SYS_MISC,SSF_MEM_FREE
484
        mcall   SF_SYS_MISC,SSF_MEM_FREE
475
.exit:
485
.exit:
476
        pop     eax        ; determine current action (ctrl+X or ctrl+C)
486
        pop     eax        ; determine current action (ctrl+X or ctrl+C)
477
        cmp     eax, 'X'
487
        cmp     eax, 'X'
478
        je      edit_box_key.delete
488
        je      edit_box_key.delete
479
        jmp     edit_box.editbox_exit
489
        jmp     edit_box.editbox_exit
480
 
490
 
481
edit_box_key.ctrl_v:
491
edit_box_key.ctrl_v:
482
        mcall   SF_CLIPBOARD,SSF_GET_SLOT_COUNT
492
        mcall   SF_CLIPBOARD,SSF_GET_SLOT_COUNT
483
; no slots of clipboard ?
493
; no slots of clipboard ?
484
        test    eax,eax
494
        test    eax,eax
485
        jz      .exit
495
        jz      .exit
486
; main list area not found ?
496
; main list area not found ?
487
        inc     eax
497
        inc     eax
488
        test    eax,eax
498
        test    eax,eax
489
        jz      .exit
499
        jz      .exit
490
        sub     eax,2
500
        sub     eax,2
491
        mov     ecx,eax
501
        mov     ecx,eax
492
        mcall   SF_CLIPBOARD,SSF_READ_CB
502
        mcall   SF_CLIPBOARD,SSF_READ_CB
493
; main list area not found ?
503
; main list area not found ?
494
        inc     eax
504
        inc     eax
495
        test    eax,eax
505
        test    eax,eax
496
        jz      .exit
506
        jz      .exit
497
; error ?
507
; error ?
498
        sub     eax,2
508
        sub     eax,2
499
        test    eax,eax
509
        test    eax,eax
500
        jz      .exit
510
        jz      .exit
501
        inc     eax
511
        inc     eax
502
; check contents of container
512
; check contents of container
503
        mov     ebx,[eax+4]
513
        mov     ebx,[eax+4]
504
; check for text
514
; check for text
505
        test    ebx,ebx
515
        test    ebx,ebx
506
        jnz     .no_valid_text
516
        jnz     .no_valid_text
507
        mov     ebx,[eax+8]
517
        mov     ebx,[eax+8]
508
; check for cp866
518
; check for cp866
509
        cmp     bl,1
519
        cmp     bl,1
510
        jnz     .no_valid_text
520
        jnz     .no_valid_text
511
; if something selected then need to delete it        
521
; if something selected then need to delete it        
512
        test   word ed_flags,ed_shift_on
522
        test   word ed_flags,ed_shift_on
513
        jz     .selected_done 
523
        jz     .selected_done 
514
        push   eax; dummy parameter ; need to
524
        push   eax; dummy parameter ; need to
515
        push   dword .selected_done ; correctly return
525
        push   dword .selected_done ; correctly return
516
        pushad                      ; from edit_box_key.delete
526
        pushad                      ; from edit_box_key.delete
517
        jmp    edit_box_key.delete
527
        jmp    edit_box_key.delete
518
.selected_done:        
528
.selected_done:        
519
        mov     ecx,[eax]
529
        mov     ecx,[eax]
520
        sub     ecx,3*4
530
        sub     ecx,3*4
521
; in ecx size of string to insert   
531
; in ecx size of string to insert   
522
        add     ecx,ed_size
532
        add     ecx,ed_size
523
        mov     edx,ed_max
533
        mov     edx,ed_max
524
        cmp     ecx,edx
534
        cmp     ecx,edx
525
        jb      @f
535
        jb      @f
526
        mov     ecx,edx
536
        mov     ecx,edx
527
@@:
537
@@:
528
        mov     esi,eax
538
        mov     esi,eax
529
        add     esi,3*4
539
        add     esi,3*4
530
        push    eax edi
540
        push    eax edi
531
;---------------------------------------;         
541
;---------------------------------------;         
532
        mov     ed_size,ecx
542
        mov     ed_size,ecx        
533
        inc     ecx        
-
 
534
        mcall   SF_SYS_MISC,SSF_MEM_ALLOC
-
 
535
        push    eax ; save mem pointer
-
 
536
                
-
 
537
        mov     edx, ed_max
-
 
538
        
543
        
539
        push   dword ed_text ; Dst   
544
        push   dword ed_text ; Dst   
540
        push   esi           ; Src   
545
        push   esi           ; Src   
541
        push   dword ed_pos  ; Pos in Dst
546
        push   dword ed_pos  ; Pos in Dst
542
        push   edx           ; DstMax
547
        push   dword ed_max  ; DstMax
543
        push   eax           ; TmpBuf
-
 
544
        call   StrInsert  
548
        call   StrInsert          
545
        
-
 
546
        pop    eax ; restore mem pointer
-
 
547
        mcall   SF_SYS_MISC,SSF_MEM_FREE
-
 
548
;---------------------------------------;        
549
;---------------------------------------;        
549
;        mov     edi,ed_text
550
;        mov     edi,ed_text
550
;        cld
551
;        cld
551
;@@:
552
;@@:
552
;        lodsb
553
;        lodsb
553
;        cmp     al,0x0d ; EOS (end of string)
554
;        cmp     al,0x0d ; EOS (end of string)
554
;        je      .replace
555
;        je      .replace
555
;        cmp     al,0x0a ; EOS (end of string)
556
;        cmp     al,0x0a ; EOS (end of string)
556
;        jne     .continue
557
;        jne     .continue
557
;.replace:
558
;.replace:
558
;        mov     al,0x20 ; space
559
;        mov     al,0x20 ; space
559
;.continue:
560
;.continue:
560
;        stosb
561
;        stosb
561
;        dec     ecx
562
;        dec     ecx
562
;        jnz     @b
563
;        jnz     @b
563
        pop     edi eax
564
        pop     edi eax
564
.no_valid_text:
565
.no_valid_text:
565
; remove unnecessary memory area
566
; remove unnecessary memory area
566
        mov     ecx,eax
567
        mov     ecx,eax
567
        mcall   SF_SYS_MISC,SSF_MEM_FREE
568
        mcall   SF_SYS_MISC,SSF_MEM_FREE
568
.exit:
569
.exit:
569
        jmp     edit_box.draw_bg_cursor_text
570
        jmp     edit_box.draw_bg_cursor_text
570
 
571
 
571
;==========================================================
572
;==========================================================
572
;=== ®¡à ¡®âª  ¬ëè¨ =======================================
573
;=== ®¡à ¡®âª  ¬ëè¨ =======================================
573
;==========================================================
574
;==========================================================
574
;save for stdcall ebx,esi,edi,ebp
575
;save for stdcall ebx,esi,edi,ebp
575
align 16
576
align 16
576
edit_box_mouse:
577
edit_box_mouse:
577
        pushad
578
        pushad
578
        mov     edi,[esp+36]
579
        mov     edi,[esp+36]
579
        test    word ed_flags,ed_disabled
580
        test    word ed_flags,ed_disabled
580
        jnz     edit_box.editbox_exit
581
        jnz     edit_box.editbox_exit
581
 
582
 
582
;----------------------------------------------------------
583
;----------------------------------------------------------
583
;--- ¯®«ãç ¥¬ á®áâ®ï­¨¥ ª­®¯®ª ¬ëè¨ -----------------------
584
;--- ¯®«ãç ¥¬ á®áâ®ï­¨¥ ª­®¯®ª ¬ëè¨ -----------------------
584
;----------------------------------------------------------
585
;----------------------------------------------------------
585
        mcall   SF_MOUSE_GET,SSF_BUTTON
586
        mcall   SF_MOUSE_GET,SSF_BUTTON
586
;----------------------------------------------------------
587
;----------------------------------------------------------
587
;--- ¯à®¢¥à塞 á®áâ®ï­¨¥ ----------------------------------
588
;--- ¯à®¢¥à塞 á®áâ®ï­¨¥ ----------------------------------
588
;----------------------------------------------------------
589
;----------------------------------------------------------
589
        test    eax,1
590
        test    eax,1
590
        jnz     edit_box_mouse.mouse_left_button
591
        jnz     edit_box_mouse.mouse_left_button
591
        and     word ed_flags,ed_mouse_on_off
592
        and     word ed_flags,ed_mouse_on_off
592
        mov     ebx,ed_mouse_variable
593
        mov     ebx,ed_mouse_variable
593
        push    0
594
        push    0
594
        pop     dword [ebx]
595
        pop     dword [ebx]
595
        jmp     edit_box.editbox_exit
596
        jmp     edit_box.editbox_exit
596
 
597
 
597
.mouse_left_button:
598
.mouse_left_button:
598
;----------------------------------------------------------
599
;----------------------------------------------------------
599
;--- ¡«®ª¨à®¢ª  ®â 䮪ãá¨à®¢ª¨ ¢ ¤àã£¨å ¡®ªá å ¯à¨ ¯®¯ ¤ ­¨¨ ­  ­¨å ªãàá®à 
600
;--- ¡«®ª¨à®¢ª  ®â 䮪ãá¨à®¢ª¨ ¢ ¤àã£¨å ¡®ªá å ¯à¨ ¯®¯ ¤ ­¨¨ ­  ­¨å ªãàá®à 
600
;----------------------------------------------------------
601
;----------------------------------------------------------
601
        mov     eax,ed_mouse_variable
602
        mov     eax,ed_mouse_variable
602
        push    dword [eax]
603
        push    dword [eax]
603
        pop     eax
604
        pop     eax
604
        test    eax,eax
605
        test    eax,eax
605
        jz      @f
606
        jz      @f
606
        cmp     eax,edi
607
        cmp     eax,edi
607
        je      @f
608
        je      @f
608
        jmp     edit_box_mouse._blur
609
        jmp     edit_box_mouse._blur
609
;----------------------------------------------------------
610
;----------------------------------------------------------
610
;--- ¯®«ãç ¥¬ ª®®à¤¨­ âë ¬ëè¨ ®â­®á¨â¥«ì­® 0 â.¥ ¢á¥© ®¡« á⨠íªà ­ 
611
;--- ¯®«ãç ¥¬ ª®®à¤¨­ âë ¬ëè¨ ®â­®á¨â¥«ì­® 0 â.¥ ¢á¥© ®¡« á⨠íªà ­ 
611
;----------------------------------------------------------
612
;----------------------------------------------------------
612
@@:
613
@@:
613
        mcall   SF_MOUSE_GET,SSF_WINDOW_POSITION
614
        mcall   SF_MOUSE_GET,SSF_WINDOW_POSITION
614
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
615
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
615
;”ã­ªæ¨ï ®¡à ¡®âª¨  ¬ë誨 ¯®«ã祭¨¥ ª®®à¤¨­ â ¨ ¯à®¢¥àª  ¨å + ¢ë¤¥«¥­¨ï
616
;”ã­ªæ¨ï ®¡à ¡®âª¨  ¬ë誨 ¯®«ã祭¨¥ ª®®à¤¨­ â ¨ ¯à®¢¥àª  ¨å + ¢ë¤¥«¥­¨ï
616
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
617
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
617
; ¥ 㤥ন¢ ¥¬ «¨ ¬ë ª« ¢¨èã ¬ë誨, ¯¥à¥¬¥é ï ªãàá®à?
618
; ¥ 㤥ন¢ ¥¬ «¨ ¬ë ª« ¢¨èã ¬ë誨, ¯¥à¥¬¥é ï ªãàá®à?
618
        test    word ed_flags,ed_mouse_on
619
        test    word ed_flags,ed_mouse_on
619
        jne     edit_box_mouse.mouse_wigwag
620
        jne     edit_box_mouse.mouse_wigwag
620
; ¯à®¢¥à塞, ¯®¯ ¤ ¥â «¨ ªãàá®à ¢ edit box
621
; ¯à®¢¥à塞, ¯®¯ ¤ ¥â «¨ ªãàá®à ¢ edit box
621
        mov     ebx,ed_top
622
        mov     ebx,ed_top
622
        cmp     ax,bx
623
        cmp     ax,bx
623
        jl      edit_box_mouse._blur
624
        jl      edit_box_mouse._blur
624
        add     ebx,ed_height
625
        add     ebx,ed_height
625
        cmp     ax,bx
626
        cmp     ax,bx
626
        jg      edit_box_mouse._blur
627
        jg      edit_box_mouse._blur
627
        shr     eax,16
628
        shr     eax,16
628
        mov     ebx,ed_left
629
        mov     ebx,ed_left
629
        cmp     ax,bx
630
        cmp     ax,bx
630
        jl      edit_box_mouse._blur
631
        jl      edit_box_mouse._blur
631
        add     ebx,ed_width
632
        add     ebx,ed_width
632
        cmp     ax,bx
633
        cmp     ax,bx
633
        jg      edit_box_mouse._blur
634
        jg      edit_box_mouse._blur
634
; ¨§¬¥­ï¥¬ ¯®§¨æ¨î ªãàá®à 
635
; ¨§¬¥­ï¥¬ ¯®§¨æ¨î ªãàá®à 
635
        push    eax
636
        push    eax
636
        mov     ebp,ed_color
637
        mov     ebp,ed_color
637
        call    edit_box.clear_cursor
638
        call    edit_box.clear_cursor
638
        pop     eax
639
        pop     eax
639
edit_box_mouse._mvpos:
640
edit_box_mouse._mvpos:
640
        xor     edx,edx
641
        xor     edx,edx
641
        sub     eax,ed_left
642
        sub     eax,ed_left
642
        div     word ed_char_width
643
        div     word ed_char_width
643
        add     eax,ed_offset
644
        add     eax,ed_offset
644
        cmp     eax,ed_size
645
        cmp     eax,ed_size
645
        jna     edit_box_mouse._mshift
646
        jna     edit_box_mouse._mshift
646
        mov     eax,ed_size
647
        mov     eax,ed_size
647
edit_box_mouse._mshift:
648
edit_box_mouse._mshift:
648
; ᥪæ¨ï ®¡à ¡®âª¨ shift ¨ ¢ë¤¥«¥­¨ï ¯® shift
649
; ᥪæ¨ï ®¡à ¡®âª¨ shift ¨ ¢ë¤¥«¥­¨ï ¯® shift
649
        test    word ed_flags,ed_shift_bac
650
        test    word ed_flags,ed_shift_bac
650
        je      @f
651
        je      @f
651
        mov     ebp,ed_color
652
        mov     ebp,ed_color
652
        movzx   ebx, word ed_shift_pos
653
        movzx   ebx, word ed_shift_pos
653
        push    eax
654
        push    eax
654
        call    edit_box_key.sh_cl_
655
        call    edit_box_key.sh_cl_
655
        and     word ed_flags,ed_shift_bac_cl
656
        and     word ed_flags,ed_shift_bac_cl
656
        pop     eax
657
        pop     eax
657
@@:
658
@@:
658
        test    word ed_flags,ed_mouse_on
659
        test    word ed_flags,ed_mouse_on
659
        jne     @f
660
        jne     @f
660
        mov     ed_shift_pos,ax
661
        mov     ed_shift_pos,ax
661
        or      word  ed_flags,ed_mouse_on
662
        or      word  ed_flags,ed_mouse_on
662
        mov     ed_pos,eax
663
        mov     ed_pos,eax
663
        mov     ebx,ed_mouse_variable
664
        mov     ebx,ed_mouse_variable
664
        push    edi
665
        push    edi
665
        pop     dword [ebx]
666
        pop     dword [ebx]
666
        bts     word ed_flags,1
667
        bts     word ed_flags,1
667
        call    edit_box.draw_bg
668
        call    edit_box.draw_bg
668
        jmp     edit_box_mouse.m_sh
669
        jmp     edit_box_mouse.m_sh
669
 
670
 
670
@@:     cmp     ax,ed_shift_pos
671
@@:     cmp     ax,ed_shift_pos
671
        je      edit_box.editbox_exit
672
        je      edit_box.editbox_exit
672
        mov     ed_pos,eax
673
        mov     ed_pos,eax
673
        call    edit_box.draw_bg
674
        call    edit_box.draw_bg
674
        mov     ebp,shift_color
675
        mov     ebp,shift_color
675
        movzx   ebx, word ed_shift_pos
676
        movzx   ebx, word ed_shift_pos
676
        call    edit_box_key.sh_cl_
677
        call    edit_box_key.sh_cl_
677
        or      word ed_flags,ed_mous_adn_b
678
        or      word ed_flags,ed_mous_adn_b
678
edit_box_mouse.m_sh:
679
edit_box_mouse.m_sh:
679
        call    edit_box.draw_text
680
        call    edit_box.draw_text
680
        call    edit_box.draw_cursor
681
        call    edit_box.draw_cursor
681
; ¯à®æ¥¤ãà  ãáâ ­®¢ª¨ 䮪ãá 
682
; ¯à®æ¥¤ãà  ãáâ ­®¢ª¨ 䮪ãá 
682
        jmp     edit_box_mouse.drc
683
        jmp     edit_box_mouse.drc
683
 
684
 
684
edit_box_mouse._blur:
685
edit_box_mouse._blur:
685
        test    word ed_flags,ed_always_focus
686
        test    word ed_flags,ed_always_focus
686
        jne     edit_box.editbox_exit
687
        jne     edit_box.editbox_exit
687
        btr     word ed_flags,1 ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
688
        btr     word ed_flags,1 ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
688
        jnc     edit_box.editbox_exit
689
        jnc     edit_box.editbox_exit
689
        mov     ebp,ed_color
690
        mov     ebp,ed_color
690
        call    edit_box.clear_cursor
691
        call    edit_box.clear_cursor
691
edit_box_mouse.drc:
692
edit_box_mouse.drc:
692
        call    edit_box.draw_border
693
        call    edit_box.draw_border
693
        jmp     edit_box.editbox_exit
694
        jmp     edit_box.editbox_exit
694
 
695
 
695
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
696
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
696
;Ž¡é¨¥ ä㭪樨 ®¡à ¡®âª¨
697
;Ž¡é¨¥ ä㭪樨 ®¡à ¡®âª¨
697
;----------------------------------------------------------
698
;----------------------------------------------------------
698
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ¢ë¤¥«¥­­®© ç á⨠----------------
699
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ¢ë¤¥«¥­­®© ç á⨠----------------
699
;----------------------------------------------------------
700
;----------------------------------------------------------
700
edit_box.draw_shift:
701
edit_box.draw_shift:
701
        test    word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
702
        test    word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
702
        jz      @f
703
        jz      @f
703
        mov     ebp,shift_color
704
        mov     ebp,shift_color
704
        movzx   ebx, word ed_shift_pos
705
        movzx   ebx, word ed_shift_pos
705
        call    edit_box_key.sh_cl_
706
        call    edit_box_key.sh_cl_
706
@@:     ret
707
@@:     ret
707
;----------------------------------------------------------
708
;----------------------------------------------------------
708
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ⥪áâ  --------------------------
709
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ⥪áâ  --------------------------
709
;----------------------------------------------------------
710
;----------------------------------------------------------
710
edit_box.draw_text:
711
edit_box.draw_text:
711
        call    edit_box.get_n
712
        call    edit_box.get_n
712
        mov     esi,ed_size
713
        mov     esi,ed_size
713
        sub     esi,ed_offset
714
        sub     esi,ed_offset
714
        cmp     eax,esi
715
        cmp     eax,esi
715
        jae     @f
716
        jae     @f
716
        mov     esi,eax
717
        mov     esi,eax
717
@@:
718
@@:
718
        test    esi,esi
719
        test    esi,esi
719
        jz      @f
720
        jz      @f
720
        mov     eax,SF_DRAW_TEXT
721
        mov     eax,SF_DRAW_TEXT
721
        mov     ebx,ed_left
722
        mov     ebx,ed_left
722
        add     ebx,2
723
        add     ebx,2
723
        shl     ebx,16
724
        shl     ebx,16
724
        add     ebx,ed_top
725
        add     ebx,ed_top
725
        add     ebx,3
726
        add     ebx,3
726
        mov     ecx,ed_text_color
727
        mov     ecx,ed_text_color
727
        test    dword ed_flags,ed_pass
728
        test    dword ed_flags,ed_pass
728
        jnz     .password
729
        jnz     .password
729
        mov     edx,ed_text
730
        mov     edx,ed_text
730
        add     edx,ed_offset
731
        add     edx,ed_offset
731
        mcall
732
        mcall
732
@@:
733
@@:
733
        ret
734
        ret
734
 
735
 
735
.password:
736
.password:
736
        mov     ebp,esi
737
        mov     ebp,esi
737
        mov     esi,1
738
        mov     esi,1
738
        mov     edx,txt_pass
739
        mov     edx,txt_pass
739
@@:
740
@@:
740
        mcall
741
        mcall
741
        rol     ebx,16
742
        rol     ebx,16
742
        add     ebx,ed_char_width
743
        add     ebx,ed_char_width
743
        rol     ebx,16
744
        rol     ebx,16
744
        dec     ebp
745
        dec     ebp
745
        jnz     @b
746
        jnz     @b
746
        ret
747
        ret
747
 
748
 
748
txt_pass db '*'
749
txt_pass db '*'
749
;----------------------------------------------------------
750
;----------------------------------------------------------
750
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ä®­  ----------------------------
751
;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ä®­  ----------------------------
751
;----------------------------------------------------------
752
;----------------------------------------------------------
752
edit_box.draw_bg:
753
edit_box.draw_bg:
753
        mov     ebx,ed_left
754
        mov     ebx,ed_left
754
        inc     ebx
755
        inc     ebx
755
        shl     ebx,16
756
        shl     ebx,16
756
        add     ebx,ed_width
757
        add     ebx,ed_width
757
        dec     ebx
758
        dec     ebx
758
        mov     edx,ed_color
759
        mov     edx,ed_color
759
        test    word ed_flags, ed_disabled
760
        test    word ed_flags, ed_disabled
760
        jz      edit_box.draw_bg_eax
761
        jz      edit_box.draw_bg_eax
761
        mov     edx, 0xCACACA   ; TODO: add disabled_color field to editbox struct
762
        mov     edx, 0xCACACA   ; TODO: add disabled_color field to editbox struct
762
edit_box.draw_bg_eax:
763
edit_box.draw_bg_eax:
763
        mov     ecx,ed_top
764
        mov     ecx,ed_top
764
        inc     ecx
765
        inc     ecx
765
        shl     ecx,16
766
        shl     ecx,16
766
        add     ecx,ed_height
767
        add     ecx,ed_height
767
        mcall   SF_DRAW_RECT
768
        mcall   SF_DRAW_RECT
768
        ret
769
        ret
769
 
770
 
770
;----------------------------------------------------------
771
;----------------------------------------------------------
771
;--- ¯à®æ¥¤ãà  ¯®«ã祭¨ï ª®«¨ç¥á⢠ ᨬ¢®«®¢ ¢ ⥪ã饩 è¨à¨­¥ ª®¬¯®­¥­â 
772
;--- ¯à®æ¥¤ãà  ¯®«ã祭¨ï ª®«¨ç¥á⢠ ᨬ¢®«®¢ ¢ ⥪ã饩 è¨à¨­¥ ª®¬¯®­¥­â 
772
;----------------------------------------------------------
773
;----------------------------------------------------------
773
edit_box.get_n:
774
edit_box.get_n:
774
        mov     eax,ed_width
775
        mov     eax,ed_width
775
        sub     eax,4
776
        sub     eax,4
776
        xor     edx,edx
777
        xor     edx,edx
777
        div     word ed_char_width
778
        div     word ed_char_width
778
        ret
779
        ret
779
 
780
 
780
;----------------------------------------------------------
781
;----------------------------------------------------------
781
;------------------ Draw Cursor Procedure -----------------
782
;------------------ Draw Cursor Procedure -----------------
782
;----------------------------------------------------------
783
;----------------------------------------------------------
783
; in: ebp = Color
784
; in: ebp = Color
784
edit_box.clear_cursor:
785
edit_box.clear_cursor:
785
        movzx   ebx, word cl_curs_x
786
        movzx   ebx, word cl_curs_x
786
        cmp     ebx, ed_left ;¯®¯ ¤ ¥â «¨ ªãàá®à ⥪á⮢®¥ ¯®«¥?
787
        cmp     ebx, ed_left ;¯®¯ ¤ ¥â «¨ ªãàá®à ⥪á⮢®¥ ¯®«¥?
787
        jle     @f
788
        jle     @f
788
        mov     edx, ebp
789
        mov     edx, ebp
789
        movzx   ecx, word cl_curs_y
790
        movzx   ecx, word cl_curs_y
790
        cmp     ecx, ed_top
791
        cmp     ecx, ed_top
791
        jg      edit_box.draw_curs
792
        jg      edit_box.draw_curs
792
@@:
793
@@:
793
        ret
794
        ret
794
 
795
 
795
edit_box.draw_cursor:
796
edit_box.draw_cursor:
796
        mov     edx, ed_text_color
797
        mov     edx, ed_text_color
797
        mov     eax, ed_pos
798
        mov     eax, ed_pos
798
        sub     eax, ed_offset
799
        sub     eax, ed_offset
799
        mul     dword ed_char_width
800
        mul     dword ed_char_width
800
        mov     ebx, eax
801
        mov     ebx, eax
801
        add     ebx, ed_left
802
        add     ebx, ed_left
802
        inc     ebx
803
        inc     ebx
803
        mov     ecx, ed_top
804
        mov     ecx, ed_top
804
        add     ecx, 2
805
        add     ecx, 2
805
        mov     cl_curs_x, bx
806
        mov     cl_curs_x, bx
806
        mov     cl_curs_y, cx
807
        mov     cl_curs_y, cx
807
edit_box.draw_curs:
808
edit_box.draw_curs:
808
        mov     eax, ebx
809
        mov     eax, ebx
809
        shl     ebx, 16
810
        shl     ebx, 16
810
        or      ebx, eax
811
        or      ebx, eax
811
        mov     eax, ecx
812
        mov     eax, ecx
812
        shl     ecx, 16
813
        shl     ecx, 16
813
        or      ecx, eax
814
        or      ecx, eax
814
        add     ecx, ed_height
815
        add     ecx, ed_height
815
        sub     ecx, 3
816
        sub     ecx, 3
816
        mcall   SF_DRAW_LINE
817
        mcall   SF_DRAW_LINE
817
        ret
818
        ret
818
 
819
 
819
;----------------------------------------------------------
820
;----------------------------------------------------------
820
;--- ¯à®æ¥¤ãà  à¨á®¢ ­¨ï à ¬ª¨ ----------------------------
821
;--- ¯à®æ¥¤ãà  à¨á®¢ ­¨ï à ¬ª¨ ----------------------------
821
;----------------------------------------------------------
822
;----------------------------------------------------------
822
edit_box.draw_border:
823
edit_box.draw_border:
823
        test    word ed_flags,ed_focus
824
        test    word ed_flags,ed_focus
824
        mov     edx,ed_focus_border_color
825
        mov     edx,ed_focus_border_color
825
        jne     @f
826
        jne     @f
826
        mov     edx,ed_blur_border_color
827
        mov     edx,ed_blur_border_color
827
@@:
828
@@:
828
        mov     ebx,ed_left
829
        mov     ebx,ed_left
829
        mov     ecx,ebx
830
        mov     ecx,ebx
830
        shl     ebx,16
831
        shl     ebx,16
831
        add     ebx,ecx
832
        add     ebx,ecx
832
        add     ebx,ed_width
833
        add     ebx,ed_width
833
        mov     ecx,ed_top
834
        mov     ecx,ed_top
834
        mov     esi,ecx
835
        mov     esi,ecx
835
        shl     ecx,16
836
        shl     ecx,16
836
        add     ecx,esi
837
        add     ecx,esi
837
        mcall   SF_DRAW_LINE ; top
838
        mcall   SF_DRAW_LINE ; top
838
        mov     esi,ecx
839
        mov     esi,ecx
839
        inc     ecx
840
        inc     ecx
840
        add     ecx,ed_height
841
        add     ecx,ed_height
841
        mov     ebp,ecx
842
        mov     ebp,ecx
842
        shl     ecx,16
843
        shl     ecx,16
843
        mov     cx,bp
844
        mov     cx,bp
844
        mcall   ; bottom
845
        mcall   ; bottom
845
        mov     cx,si
846
        mov     cx,si
846
        mov     ebp,ebx
847
        mov     ebp,ebx
847
        sub     ebx,ed_width
848
        sub     ebx,ed_width
848
        mcall   ; left
849
        mcall   ; left
849
        mov     ebx,ebp
850
        mov     ebx,ebp
850
        shl     ebx,16
851
        shl     ebx,16
851
        mov     bx,bp
852
        mov     bx,bp
852
        mcall   ; right
853
        mcall   ; right
853
        ret
854
        ret
854
 
855
 
855
;----------------------------------------------------------
856
;----------------------------------------------------------
856
;--- ¯à®¢¥àª , § è¥« «¨ ªãàá®à §  £à ­¨æë ¨, ¥á«¨ ­ ¤®, ---
857
;--- ¯à®¢¥àª , § è¥« «¨ ªãàá®à §  £à ­¨æë ¨, ¥á«¨ ­ ¤®, ---
857
;--- ¨§¬¥­ï¥¬ ᬥ饭¨¥ ------------------------------------
858
;--- ¨§¬¥­ï¥¬ ᬥ饭¨¥ ------------------------------------
858
;--- ¥á«¨ ᬥ饭¨¥ ¡ë«®, ãáâ ­®¢ª  ä« £  ed_offset_cl, ¨­ ç¥,
859
;--- ¥á«¨ ᬥ饭¨¥ ¡ë«®, ãáâ ­®¢ª  ä« £  ed_offset_cl, ¨­ ç¥,
859
; ¥á«¨ ­¨ç¥£® ­¥ ¨§¬¥­¨«®áì, â® ¢ëáâ ¢«¥­¨¥ ed_offset_fl
860
; ¥á«¨ ­¨ç¥£® ­¥ ¨§¬¥­¨«®áì, â® ¢ëáâ ¢«¥­¨¥ ed_offset_fl
860
; ¢ ®¡é¥© ¡¨â®¢®© ¬ âà¨æ¥ á®áâ®ï­¨ï ª®¬¯®­¥­â®¢ word ed_flags
861
; ¢ ®¡é¥© ¡¨â®¢®© ¬ âà¨æ¥ á®áâ®ï­¨ï ª®¬¯®­¥­â®¢ word ed_flags
861
;----------------------------------------------------------
862
;----------------------------------------------------------
862
edit_box.check_offset:
863
edit_box.check_offset:
863
        pushad
864
        pushad
864
        mov     ecx,ed_pos
865
        mov     ecx,ed_pos
865
        mov     ebx,ed_offset
866
        mov     ebx,ed_offset
866
        cmp     ebx,ecx
867
        cmp     ebx,ecx
867
        ja      edit_box.sub_8
868
        ja      edit_box.sub_8
868
        push    ebx
869
        push    ebx
869
        call    edit_box.get_n
870
        call    edit_box.get_n
870
        pop     ebx
871
        pop     ebx
871
        mov     edx,ebx
872
        mov     edx,ebx
872
        add     edx,eax
873
        add     edx,eax
873
        inc     edx     ;­¥®¡å®¤¨¬® ¤«ï ­®à¬ «ì­®£® ¯®«®¦¥­¨ï ªãàá®à  ¢ ªà ©­¥© «¥¢®© ¯®§¨æ¨¨
874
        inc     edx     ;­¥®¡å®¤¨¬® ¤«ï ­®à¬ «ì­®£® ¯®«®¦¥­¨ï ªãàá®à  ¢ ªà ©­¥© «¥¢®© ¯®§¨æ¨¨
874
        cmp     edx,ecx
875
        cmp     edx,ecx
875
        ja      @f
876
        ja      @f
876
        mov     edx,ed_size
877
        mov     edx,ed_size
877
        cmp     edx,ecx
878
        cmp     edx,ecx
878
        je      edit_box.add_end
879
        je      edit_box.add_end
879
        sub     edx,ecx
880
        sub     edx,ecx
880
        cmp     edx,8
881
        cmp     edx,8
881
        jbe     edit_box.add_8
882
        jbe     edit_box.add_8
882
        add     ebx,8
883
        add     ebx,8
883
        jmp     edit_box.chk_d
884
        jmp     edit_box.chk_d
884
 
885
 
885
@@:     or      word ed_flags,ed_offset_fl
886
@@:     or      word ed_flags,ed_offset_fl
886
        popad
887
        popad
887
        ret
888
        ret
888
 
889
 
889
edit_box.sub_8:
890
edit_box.sub_8:
890
        test    ecx,ecx
891
        test    ecx,ecx
891
        jz      @f
892
        jz      @f
892
        sub     ebx,8   ;ebx=ed_offset
893
        sub     ebx,8   ;ebx=ed_offset
893
        ja      edit_box.chk_d
894
        ja      edit_box.chk_d
894
@@:
895
@@:
895
        xor     ebx,ebx
896
        xor     ebx,ebx
896
        jmp     edit_box.chk_d
897
        jmp     edit_box.chk_d
897
 
898
 
898
edit_box.add_end:
899
edit_box.add_end:
899
        sub     edx,eax
900
        sub     edx,eax
900
        mov     ebx,edx
901
        mov     ebx,edx
901
        jmp     edit_box.chk_d
902
        jmp     edit_box.chk_d
902
 
903
 
903
edit_box.add_8:
904
edit_box.add_8:
904
        add     ebx,edx
905
        add     ebx,edx
905
edit_box.chk_d:
906
edit_box.chk_d:
906
        mov     ed_offset,ebx
907
        mov     ed_offset,ebx
907
        call    edit_box.draw_bg
908
        call    edit_box.draw_bg
908
        and     word ed_flags,ed_offset_cl
909
        and     word ed_flags,ed_offset_cl
909
        popad
910
        popad
910
        ret
911
        ret
911
 
912
 
912
align 4
913
align 4
913
proc edit_box_set_text, edit:dword, text:dword
914
proc edit_box_set_text, edit:dword, text:dword
914
        pushad
915
        pushad
915
        mov     edi,[edit]
916
        mov     edi,[edit]
916
        mov     ecx,ed_max
917
        mov     ecx,ed_max
917
        inc     ecx
918
        inc     ecx
918
        mov     edi,[text]
919
        mov     edi,[text]
919
        xor     al,al
920
        xor     al,al
920
        cld
921
        cld
921
        repne scasb
922
        repne scasb
922
        mov     ecx,edi
923
        mov     ecx,edi
923
        mov     edi,[edit]
924
        mov     edi,[edit]
924
        mov     esi,[text]
925
        mov     esi,[text]
925
        sub     ecx,esi
926
        sub     ecx,esi
926
        dec     ecx
927
        dec     ecx
927
        mov     ed_size,ecx
928
        mov     ed_size,ecx
928
        mov     ed_pos,ecx
929
        mov     ed_pos,ecx
929
        and     word ed_flags,ed_shift_cl
930
        and     word ed_flags,ed_shift_cl
930
        mov     edi,ed_text
931
        mov     edi,ed_text
931
        repne movsb
932
        repne movsb
932
        mov     byte[edi],0
933
        mov     byte[edi],0
933
        popad
934
        popad
934
        ret
935
        ret
935
endp
936
endp
936
 
937
 
937
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
938
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
938
;”㭪樨 ¤«ï à ¡®âë á key
939
;”㭪樨 ¤«ï à ¡®âë á key
939
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
940
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
940
 
941
 
941
;Ž¡à ¡®âª  Shift ¤«ï á­ïâ¨ï ¢ë¤¥«¥­¨ï ­¥¨§¢¥áâ­®© ®¡« áâ¨
942
;Ž¡à ¡®âª  Shift ¤«ï á­ïâ¨ï ¢ë¤¥«¥­¨ï ­¥¨§¢¥áâ­®© ®¡« áâ¨
942
edit_box_key.shift:
943
edit_box_key.shift:
943
        call    edit_box.draw_bg
944
        call    edit_box.draw_bg
944
        test    word ed_flags,ed_shift
945
        test    word ed_flags,ed_shift
945
        je      edit_box_key.f_exit
946
        je      edit_box_key.f_exit
946
        mov     ebp,shift_color
947
        mov     ebp,shift_color
947
        or      word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
948
        or      word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
948
        movzx   ebx, word ed_shift_pos
949
        movzx   ebx, word ed_shift_pos
949
        call    edit_box_key.sh_cl_
950
        call    edit_box_key.sh_cl_
950
        jmp     edit_box.draw_cursor_text
951
        jmp     edit_box.draw_cursor_text
951
 
952
 
952
edit_box_key.f_exit:
953
edit_box_key.f_exit:
953
        call    edit_box.check_offset
954
        call    edit_box.check_offset
954
        and     word ed_flags,ed_shift_cl
955
        and     word ed_flags,ed_shift_cl
955
        call    edit_box_key.enable_null
956
        call    edit_box_key.enable_null
956
        jmp     edit_box.draw_cursor_text
957
        jmp     edit_box.draw_cursor_text
957
 
958
 
958
edit_box_key.sh_cl_:
959
edit_box_key.sh_cl_:
959
;®¡à ¡®âª  ®ç¨á⪨, ¯à¨ «¥¢®¬ - ¯à ¢®¬ ¤¢¨¦¥­¨¨ ¢ë¤¥«¥­¨ï
960
;®¡à ¡®âª  ®ç¨á⪨, ¯à¨ «¥¢®¬ - ¯à ¢®¬ ¤¢¨¦¥­¨¨ ¢ë¤¥«¥­¨ï
960
;¤«ï ®¡à ¡®âª¨ á­ïâ¨ï ¢ë¤¥«¥­¨ï
961
;¤«ï ®¡à ¡®âª¨ á­ïâ¨ï ¢ë¤¥«¥­¨ï
961
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
962
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
962
        mov     eax,ed_pos
963
        mov     eax,ed_pos
963
        cmp     eax,ebx
964
        cmp     eax,ebx
964
        jae     edit_box_key.sh_n
965
        jae     edit_box_key.sh_n
965
        push    eax  ;¬¥­ì襥 ¢ eax
966
        push    eax  ;¬¥­ì襥 ¢ eax
966
        push    ebx  ;¡®«ì襥
967
        push    ebx  ;¡®«ì襥
967
        jmp     edit_box_key.sh_n1
968
        jmp     edit_box_key.sh_n1
968
 
969
 
969
edit_box_key.sh_n:
970
edit_box_key.sh_n:
970
        push    ebx
971
        push    ebx
971
        push    eax
972
        push    eax
972
edit_box_key.sh_n1:
973
edit_box_key.sh_n1:
973
        call    edit_box.check_offset
974
        call    edit_box.check_offset
974
        call    edit_box.get_n
975
        call    edit_box.get_n
975
        mov     edx,eax ;size of ed_box
976
        mov     edx,eax ;size of ed_box
976
        mov     ecx,ed_offset
977
        mov     ecx,ed_offset
977
        add     eax,ecx ;eax = w_off= ed_offset+width
978
        add     eax,ecx ;eax = w_off= ed_offset+width
978
        mov     edx,eax ;save
979
        mov     edx,eax ;save
979
        pop     ebx     ;¡®«ì襥
980
        pop     ebx     ;¡®«ì襥
980
        pop     eax     ;¬¥­ì襥
981
        pop     eax     ;¬¥­ì襥
981
        cmp     eax,ecx         ;áà ¢­¥­¨¥ ¬¥­ì襣® á offset.
982
        cmp     eax,ecx         ;áà ¢­¥­¨¥ ¬¥­ì襣® á offset.
982
        jae     edit_box_key.f_f            ;¥á«¨ ¡®«ìè¥
983
        jae     edit_box_key.f_f            ;¥á«¨ ¡®«ìè¥
983
        xor     eax,eax
984
        xor     eax,eax
984
        cmp     edx,ebx         ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
985
        cmp     edx,ebx         ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
985
        jnb     @f
986
        jnb     @f
986
        mov     ebx,edx
987
        mov     ebx,edx
987
@@:
988
@@:
988
        sub     ebx,ecx
989
        sub     ebx,ecx
989
        jmp     edit_box_key.nxt_f
990
        jmp     edit_box_key.nxt_f
990
 
991
 
991
edit_box_key.f_f:
992
edit_box_key.f_f:
992
        sub     eax,ecx
993
        sub     eax,ecx
993
        cmp     edx,ebx         ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
994
        cmp     edx,ebx         ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
994
        jle     @f
995
        jle     @f
995
        sub     ebx,ecx
996
        sub     ebx,ecx
996
        sub     ebx,eax
997
        sub     ebx,eax
997
        jmp     edit_box_key.nxt_f
998
        jmp     edit_box_key.nxt_f
998
 
999
 
999
@@:     mov     ebx,edx
1000
@@:     mov     ebx,edx
1000
        sub     ebx,ecx
1001
        sub     ebx,ecx
1001
        sub     ebx,eax
1002
        sub     ebx,eax
1002
edit_box_key.nxt_f:
1003
edit_box_key.nxt_f:
1003
        mul     dword ed_char_width
1004
        mul     dword ed_char_width
1004
        xchg    eax,ebx
1005
        xchg    eax,ebx
1005
        mul     dword ed_char_width
1006
        mul     dword ed_char_width
1006
        add     ebx,ed_left
1007
        add     ebx,ed_left
1007
        inc     ebx
1008
        inc     ebx
1008
        shl     ebx,16
1009
        shl     ebx,16
1009
        inc     eax
1010
        inc     eax
1010
        mov     bx, ax
1011
        mov     bx, ax
1011
        mov     edx,ebp ;shift_color
1012
        mov     edx,ebp ;shift_color
1012
        call    edit_box.draw_bg_eax
1013
        call    edit_box.draw_bg_eax
1013
        jmp     edit_box_key.enable_null
1014
        jmp     edit_box_key.enable_null
1014
 
1015
 
1015
;“áâ ­®¢ª - á­ï⨥ ¢ë¤¥«¥­¨ï ¢ ®¤¨­ ᨬ¢®«
1016
;“áâ ­®¢ª - á­ï⨥ ¢ë¤¥«¥­¨ï ¢ ®¤¨­ ᨬ¢®«
1016
edit_box_key.drw_sim:
1017
edit_box_key.drw_sim:
1017
        mov     eax,ed_pos
1018
        mov     eax,ed_pos
1018
        call    edit_box_key.draw_rectangle
1019
        call    edit_box_key.draw_rectangle
1019
        jmp     edit_box_key.enable_null
1020
        jmp     edit_box_key.enable_null
1020
 
1021
 
1021
;”ã­ªæ¨ï ãáâ ­®¢ª¨ ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨¨ ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
1022
;”ã­ªæ¨ï ãáâ ­®¢ª¨ ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨¨ ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
1022
edit_box_key.draw_wigwag:
1023
edit_box_key.draw_wigwag:
1023
        mov     ebp,shift_color
1024
        mov     ebp,shift_color
1024
        call    edit_box.clear_cursor
1025
        call    edit_box.clear_cursor
1025
        or      word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £  ¢ë¤¥«¥­­®© ®¡« áâ¨
1026
        or      word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £  ¢ë¤¥«¥­­®© ®¡« áâ¨
1026
        mov     ebp,shift_color
1027
        mov     ebp,shift_color
1027
        mov     eax,ed_pos
1028
        mov     eax,ed_pos
1028
        test    word ed_flags,ed_left_fl
1029
        test    word ed_flags,ed_left_fl
1029
        jnz     edit_box_key.draw_rectangle
1030
        jnz     edit_box_key.draw_rectangle
1030
        dec     eax
1031
        dec     eax
1031
        jmp     edit_box_key.draw_rectangle
1032
        jmp     edit_box_key.draw_rectangle
1032
 
1033
 
1033
;”ã­ªæ¨ï 㤠«¥­¨ï ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨¨ ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
1034
;”ã­ªæ¨ï 㤠«¥­¨ï ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨¨ ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
1034
edit_box_key.draw_wigwag_cl:
1035
edit_box_key.draw_wigwag_cl:
1035
        mov     ebp,ed_color
1036
        mov     ebp,ed_color
1036
        call    edit_box.clear_cursor
1037
        call    edit_box.clear_cursor
1037
        mov     ebp,ed_color
1038
        mov     ebp,ed_color
1038
        mov     eax,ed_pos
1039
        mov     eax,ed_pos
1039
        test    word ed_flags,ed_left_fl
1040
        test    word ed_flags,ed_left_fl
1040
        jnz     edit_box_key.draw_rectangle
1041
        jnz     edit_box_key.draw_rectangle
1041
        dec     eax
1042
        dec     eax
1042
        jmp     edit_box_key.draw_rectangle
1043
        jmp     edit_box_key.draw_rectangle
1043
 
1044
 
1044
;¢å®¤­®© ¯ à ¬¥âà ebx - ed_pos
1045
;¢å®¤­®© ¯ à ¬¥âà ebx - ed_pos
1045
edit_box_key.sh_first_sh:
1046
edit_box_key.sh_first_sh:
1046
        test    word ed_flags,ed_shift
1047
        test    word ed_flags,ed_shift
1047
        je      @f
1048
        je      @f
1048
        mov     ed_shift_pos_old,bx
1049
        mov     ed_shift_pos_old,bx
1049
        test    word ed_flags,ed_shift_on
1050
        test    word ed_flags,ed_shift_on
1050
        jne     @f
1051
        jne     @f
1051
        mov     ed_shift_pos,bx
1052
        mov     ed_shift_pos,bx
1052
        or      word ed_flags,ed_shift_on
1053
        or      word ed_flags,ed_shift_on
1053
@@:     ret
1054
@@:     ret
1054
;Ž¡à ¡®âª  ªà ©­¨å ¯®«®¦¥­¨© ¢ editbox ¯à¨ ­ ¦ â®¬ shift
1055
;Ž¡à ¡®âª  ªà ©­¨å ¯®«®¦¥­¨© ¢ editbox ¯à¨ ­ ¦ â®¬ shift
1055
;¯à®¨§¢®¤¨â á­ï⨥ ¢ë¤¥«¥­¨ï, ¥á«¨ ­¥â shift
1056
;¯à®¨§¢®¤¨â á­ï⨥ ¢ë¤¥«¥­¨ï, ¥á«¨ ­¥â shift
1056
;¨­ ç¥ ¢®®¡é¥ ¢ë室¨â
1057
;¨­ ç¥ ¢®®¡é¥ ¢ë室¨â
1057
edit_box_key.sh_st_of:
1058
edit_box_key.sh_st_of:
1058
        test    word ed_flags,ed_shift
1059
        test    word ed_flags,ed_shift
1059
        jne     @f
1060
        jne     @f
1060
        test    word ed_flags,ed_shift_bac
1061
        test    word ed_flags,ed_shift_bac
1061
        je      @f
1062
        je      @f
1062
        call    edit_box.draw_bg
1063
        call    edit_box.draw_bg
1063
        mov     ebp,ed_color
1064
        mov     ebp,ed_color
1064
        movzx   ebx, word ed_shift_pos
1065
        movzx   ebx, word ed_shift_pos
1065
        call    edit_box_key.sh_cl_  ;®ç¨á⪠ ¢ë¤¥«¥­®£® äà £¬¥­â 
1066
        call    edit_box_key.sh_cl_  ;®ç¨á⪠ ¢ë¤¥«¥­®£® äà £¬¥­â 
1066
        and     word ed_flags,ed_shift_cl ; ®ç¨á⪠ ®â ⮣®, çâ® ã¡à «¨ ¢ë¤¥«¥­¨¥
1067
        and     word ed_flags,ed_shift_cl ; ®ç¨á⪠ ®â ⮣®, çâ® ã¡à «¨ ¢ë¤¥«¥­¨¥
1067
        jmp     edit_box.draw_cursor_text
1068
        jmp     edit_box.draw_cursor_text
1068
 
1069
 
1069
@@:     and     word ed_flags,ed_shift_off
1070
@@:     and     word ed_flags,ed_shift_off
1070
        popad
1071
        popad
1071
        ret     4
1072
        ret     4
1072
;¯à®¢¥àª  á®áâ®ï­¨ï shift, ¡ë« «¨ ®­ ­ ¦ â à ­ìè¥?
1073
;¯à®¢¥àª  á®áâ®ï­¨ï shift, ¡ë« «¨ ®­ ­ ¦ â à ­ìè¥?
1073
edit_box_key.sh_enable:
1074
edit_box_key.sh_enable:
1074
        test    word ed_flags,ed_shift
1075
        test    word ed_flags,ed_shift
1075
        jne     edit_box_key.sh_ext_en ;­ à¨á®¢ âì § ªà è¥­­ë© ¯àאַ㣮«ì­¨ª
1076
        jne     edit_box_key.sh_ext_en ;­ à¨á®¢ âì § ªà è¥­­ë© ¯àאַ㣮«ì­¨ª
1076
        test    word ed_flags,ed_shift_bac
1077
        test    word ed_flags,ed_shift_bac
1077
        je      @f
1078
        je      @f
1078
        call    edit_box.check_offset
1079
        call    edit_box.check_offset
1079
        mov     ebp,ed_color
1080
        mov     ebp,ed_color
1080
        movzx   ebx, word ed_shift_pos
1081
        movzx   ebx, word ed_shift_pos
1081
        call    edit_box_key.sh_cl_  ;®ç¨á⪠ ¢ë¤¥«¥­­®£® äà £¬¥­â 
1082
        call    edit_box_key.sh_cl_  ;®ç¨á⪠ ¢ë¤¥«¥­­®£® äà £¬¥­â 
1082
        call    edit_box_key.draw_wigwag_cl
1083
        call    edit_box_key.draw_wigwag_cl
1083
        and     word ed_flags,ed_shift_cl ; 1¢ à ­¥ ­ã¦­®
1084
        and     word ed_flags,ed_shift_cl ; 1¢ à ­¥ ­ã¦­®
1084
        ret
1085
        ret
1085
 
1086
 
1086
@@:     mov     ebp,ed_color
1087
@@:     mov     ebp,ed_color
1087
        call    edit_box.clear_cursor
1088
        call    edit_box.clear_cursor
1088
        jmp     edit_box.check_offset
1089
        jmp     edit_box.check_offset
1089
 
1090
 
1090
edit_box_key.sh_ext_en:
1091
edit_box_key.sh_ext_en:
1091
        call    edit_box.check_offset
1092
        call    edit_box.check_offset
1092
        test    word ed_flags,ed_offset_fl
1093
        test    word ed_flags,ed_offset_fl
1093
        je      @f
1094
        je      @f
1094
;¨á®¢ ­¨¥ § ªà è¥­­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ¨å ®ç¨á⪠
1095
;¨á®¢ ­¨¥ § ªà è¥­­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ¨å ®ç¨á⪠
1095
        movzx   eax, word ed_shift_pos
1096
        movzx   eax, word ed_shift_pos
1096
        mov     ebx,ed_pos
1097
        mov     ebx,ed_pos
1097
        movzx   ecx, word ed_shift_pos_old
1098
        movzx   ecx, word ed_shift_pos_old
1098
;¯à®¢¥àª  ¨ à¨á®¢ ­¨¥ § ªà è¥­­ëå ®¡« á⥩
1099
;¯à®¢¥àª  ¨ à¨á®¢ ­¨¥ § ªà è¥­­ëå ®¡« á⥩
1099
        cmp     eax,ecx
1100
        cmp     eax,ecx
1100
        je      edit_box_key.1_shem
1101
        je      edit_box_key.1_shem
1101
        jb      edit_box_key.smaller
1102
        jb      edit_box_key.smaller
1102
        cmp     ecx,ebx
1103
        cmp     ecx,ebx
1103
        ja      edit_box_key.1_shem
1104
        ja      edit_box_key.1_shem
1104
        call    edit_box_key.draw_wigwag_cl ;clear
1105
        call    edit_box_key.draw_wigwag_cl ;clear
1105
        jmp     edit_box_key.sh_e_end
1106
        jmp     edit_box_key.sh_e_end
1106
 
1107
 
1107
edit_box_key.smaller:
1108
edit_box_key.smaller:
1108
        cmp     ecx,ebx
1109
        cmp     ecx,ebx
1109
        jb      edit_box_key.1_shem
1110
        jb      edit_box_key.1_shem
1110
        call    edit_box_key.draw_wigwag_cl ;clear
1111
        call    edit_box_key.draw_wigwag_cl ;clear
1111
        jmp     edit_box_key.sh_e_end
1112
        jmp     edit_box_key.sh_e_end
1112
 
1113
 
1113
edit_box_key.1_shem:
1114
edit_box_key.1_shem:
1114
        call    edit_box_key.draw_wigwag
1115
        call    edit_box_key.draw_wigwag
1115
edit_box_key.sh_e_end:
1116
edit_box_key.sh_e_end:
1116
        and     word ed_flags,ed_shift_off
1117
        and     word ed_flags,ed_shift_off
1117
        ret
1118
        ret
1118
 
1119
 
1119
@@:     mov     ebp,shift_color
1120
@@:     mov     ebp,shift_color
1120
        movzx   ebx, word ed_shift_pos
1121
        movzx   ebx, word ed_shift_pos
1121
        call    edit_box_key.sh_cl_
1122
        call    edit_box_key.sh_cl_
1122
        jmp     edit_box_key.sh_e_end
1123
        jmp     edit_box_key.sh_e_end
1123
;äã­ªæ¨ï ¤«ï ®¡à ¡®âª¨ shift ¯à¨ ­ ¦ â¨¨ home and end
1124
;äã­ªæ¨ï ¤«ï ®¡à ¡®âª¨ shift ¯à¨ ­ ¦ â¨¨ home and end
1124
edit_box_key.sh_home_end:
1125
edit_box_key.sh_home_end:
1125
        mov     ebp,ed_color
1126
        mov     ebp,ed_color
1126
        call    edit_box.clear_cursor
1127
        call    edit_box.clear_cursor
1127
        test    word ed_flags,ed_shift_bac
1128
        test    word ed_flags,ed_shift_bac
1128
        je      @f
1129
        je      @f
1129
        mov     ebp,ed_color
1130
        mov     ebp,ed_color
1130
        movzx   ebx, word ed_shift_pos_old
1131
        movzx   ebx, word ed_shift_pos_old
1131
        call    edit_box_key.sh_cl_
1132
        call    edit_box_key.sh_cl_
1132
@@:
1133
@@:
1133
        test    word ed_flags,ed_shift
1134
        test    word ed_flags,ed_shift
1134
        je      edit_box_key.sh_exit_ ;¢ë©â¨
1135
        je      edit_box_key.sh_exit_ ;¢ë©â¨
1135
        mov     ebp,shift_color
1136
        mov     ebp,shift_color
1136
        movzx   ebx, word ed_shift_pos
1137
        movzx   ebx, word ed_shift_pos
1137
        call    edit_box_key.sh_cl_
1138
        call    edit_box_key.sh_cl_
1138
        or      word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
1139
        or      word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
1139
        jmp     edit_box_key.sh_e_end
1140
        jmp     edit_box_key.sh_e_end
1140
 
1141
 
1141
edit_box_key.sh_exit_:
1142
edit_box_key.sh_exit_:
1142
        call    edit_box.draw_bg
1143
        call    edit_box.draw_bg
1143
        jmp     edit_box.check_offset
1144
        jmp     edit_box.check_offset
1144
 
1145
 
1145
;äã­ªæ¨ï ¢­¥á¥­¨ï 0 ¯®  ¤à¥áã ed_size+1
1146
;äã­ªæ¨ï ¢­¥á¥­¨ï 0 ¯®  ¤à¥áã ed_size+1
1146
edit_box_key.enable_null:
1147
edit_box_key.enable_null:
1147
        pusha
1148
        pusha
1148
        mov     eax,ed_size
1149
        mov     eax,ed_size
1149
        mov     ebx,ed_text
1150
        mov     ebx,ed_text
1150
        test    eax,eax
1151
        test    eax,eax
1151
        add     eax,ebx
1152
        add     eax,ebx
1152
        jne     @f
1153
        jne     @f
1153
        inc     eax
1154
        inc     eax
1154
@@:     xor     ebx,ebx
1155
@@:     xor     ebx,ebx
1155
        mov     [eax],bl
1156
        mov     [eax],bl
1156
        popad
1157
        popad
1157
        ret
1158
        ret
1158
 
1159
 
1159
;- 㤠«¥­¨¥ ᨬ¢®« 
1160
;- 㤠«¥­¨¥ ᨬ¢®« 
1160
;‚室­ë¥ ¤ ­­ë¥ edx=ed_size;ecx=ed_pos
1161
;‚室­ë¥ ¤ ­­ë¥ edx=ed_size;ecx=ed_pos
1161
edit_box_key.del_char:
1162
edit_box_key.del_char:
1162
        mov     esi,ed_text
1163
        mov     esi,ed_text
1163
        test    word ed_flags,ed_shift_on
1164
        test    word ed_flags,ed_shift_on
1164
        je      @f
1165
        je      @f
1165
        movzx   eax, word ed_shift_pos
1166
        movzx   eax, word ed_shift_pos
1166
        mov     ebx,esi
1167
        mov     ebx,esi
1167
        cmp     eax,ecx
1168
        cmp     eax,ecx
1168
        jae     edit_box_key.dh_n
1169
        jae     edit_box_key.dh_n
1169
        mov     ed_pos,eax      ;çâ®¡ë ­¥ ¡ë«® ã¡¥£ ­¨ï ªãàá®à 
1170
        mov     ed_pos,eax      ;çâ®¡ë ­¥ ¡ë«® ã¡¥£ ­¨ï ªãàá®à 
1170
        mov     ebp,ecx
1171
        mov     ebp,ecx
1171
        sub     ebp,eax
1172
        sub     ebp,eax
1172
        add     ebx,eax  ;eax ¬¥­ìè¥
1173
        add     ebx,eax  ;eax ¬¥­ìè¥
1173
        sub     edx,ecx
1174
        sub     edx,ecx
1174
        add     esi,ecx
1175
        add     esi,ecx
1175
        mov     ed_shift_pos,bp
1176
        mov     ed_shift_pos,bp
1176
        jmp     edit_box_key.del_ch_sh
1177
        jmp     edit_box_key.del_ch_sh
1177
 
1178
 
1178
edit_box_key.dh_n:
1179
edit_box_key.dh_n:
1179
        mov     ebp,eax
1180
        mov     ebp,eax
1180
        sub     ebp,ecx
1181
        sub     ebp,ecx
1181
        add     ebx,ecx
1182
        add     ebx,ecx
1182
        sub     edx,eax
1183
        sub     edx,eax
1183
        add     esi,eax
1184
        add     esi,eax
1184
        mov     ed_shift_pos,bp
1185
        mov     ed_shift_pos,bp
1185
        jmp     edit_box_key.del_ch_sh
1186
        jmp     edit_box_key.del_ch_sh
1186
 
1187
 
1187
@@:     add     esi,ecx ;㪠§ â¥«ì + ᬥ饭¨¥ ª ॠ«ì­®¬ã ¡ãä¥àã
1188
@@:     add     esi,ecx ;㪠§ â¥«ì + ᬥ饭¨¥ ª ॠ«ì­®¬ã ¡ãä¥àã
1188
        mov     ebx,esi
1189
        mov     ebx,esi
1189
        inc     esi
1190
        inc     esi
1190
        cld
1191
        cld
1191
        sub     edx,ecx
1192
        sub     edx,ecx
1192
edit_box_key.del_ch_sh:
1193
edit_box_key.del_ch_sh:
1193
        push    edi
1194
        push    edi
1194
        mov     edi,ebx
1195
        mov     edi,ebx
1195
@@:
1196
@@:
1196
        lodsb
1197
        lodsb
1197
        stosb
1198
        stosb
1198
        dec     edx
1199
        dec     edx
1199
        jns     @b
1200
        jns     @b
1200
        pop     edi
1201
        pop     edi
1201
        ret
1202
        ret
1202
;¢ëç¨á«¨âì § ªà è¨¢ ¥¬ãî ®¡« áâì
1203
;¢ëç¨á«¨âì § ªà è¨¢ ¥¬ãî ®¡« áâì
1203
;ᮣ« è¥­¨¥ ¢ ebp - ¯¥à¥¤ ¥âáï ed_size
1204
;ᮣ« è¥­¨¥ ¢ ebp - ¯¥à¥¤ ¥âáï ed_size
1204
edit_box_key.clear_bg:
1205
edit_box_key.clear_bg:
1205
        call    edit_box.get_n  ;¯®«ãç¨âì à §¬¥à ¢ ᨬ¢®« å è¨à¨­ë ª®¬¯®­¥­â 
1206
        call    edit_box.get_n  ;¯®«ãç¨âì à §¬¥à ¢ ᨬ¢®« å è¨à¨­ë ª®¬¯®­¥­â 
1206
        push    eax
1207
        push    eax
1207
        mov     ebx,ed_offset
1208
        mov     ebx,ed_offset
1208
        add     eax,ebx ;eax = w_off= ed_offset+width
1209
        add     eax,ebx ;eax = w_off= ed_offset+width
1209
        mov     ebx,ebp ;ed_size
1210
        mov     ebx,ebp ;ed_size
1210
        cmp     eax,ebx
1211
        cmp     eax,ebx
1211
        jb      @f
1212
        jb      @f
1212
        mov     eax,ed_pos
1213
        mov     eax,ed_pos
1213
        sub     ebx,eax
1214
        sub     ebx,eax
1214
        mov     ecx,ed_offset
1215
        mov     ecx,ed_offset
1215
        sub     eax,ecx
1216
        sub     eax,ecx
1216
        jmp     edit_box_key.nxt
1217
        jmp     edit_box_key.nxt
1217
 
1218
 
1218
@@:     mov     ebx,ed_pos
1219
@@:     mov     ebx,ed_pos
1219
        push    ebx
1220
        push    ebx
1220
        sub     eax,ebx
1221
        sub     eax,ebx
1221
        mov     ebx,eax ;It is not optimal
1222
        mov     ebx,eax ;It is not optimal
1222
        pop     eax     ;ed_pos
1223
        pop     eax     ;ed_pos
1223
        mov     ecx,ed_offset
1224
        mov     ecx,ed_offset
1224
        sub     eax,ecx
1225
        sub     eax,ecx
1225
edit_box_key.nxt:
1226
edit_box_key.nxt:
1226
        mov     ebp,eax  ;¯à®¢¥àª  ­  ¢ë室 § ªà è¨¢ ¥¬®© ®¡« á⨠§  ¯à¥¤¥«ë ¤«¨­ë
1227
        mov     ebp,eax  ;¯à®¢¥àª  ­  ¢ë室 § ªà è¨¢ ¥¬®© ®¡« á⨠§  ¯à¥¤¥«ë ¤«¨­ë
1227
        add     ebp,ebx
1228
        add     ebp,ebx
1228
        pop     edx
1229
        pop     edx
1229
        cmp     ebp,edx
1230
        cmp     ebp,edx
1230
        je      @f
1231
        je      @f
1231
        inc     ebx
1232
        inc     ebx
1232
@@:
1233
@@:
1233
        mul     dword ed_char_width
1234
        mul     dword ed_char_width
1234
        xchg    eax,ebx
1235
        xchg    eax,ebx
1235
        mul     dword ed_char_width
1236
        mul     dword ed_char_width
1236
        add     ebx,ed_left
1237
        add     ebx,ed_left
1237
        inc     ebx
1238
        inc     ebx
1238
        shl     ebx,16
1239
        shl     ebx,16
1239
        inc     eax
1240
        inc     eax
1240
        mov     bx, ax
1241
        mov     bx, ax
1241
        mov     edx,ed_color
1242
        mov     edx,ed_color
1242
        jmp     edit_box.draw_bg_eax
1243
        jmp     edit_box.draw_bg_eax
1243
 
1244
 
1244
;;;;;;;;;;;;;;;;;;;
1245
;;;;;;;;;;;;;;;;;;;
1245
;;; Ž¡à ¡®âª  ¯à¨¬¨â¨¢®¢
1246
;;; Ž¡à ¡®âª  ¯à¨¬¨â¨¢®¢
1246
;;;;;;;;;;;;;;;;;;;;
1247
;;;;;;;;;;;;;;;;;;;;
1247
; à¨á®¢ âì ¯àאַ㣮«ì­¨ª, 梥⠯¥à¥¤ ¥âáï ¢ ebp
1248
; à¨á®¢ âì ¯àאַ㣮«ì­¨ª, 梥⠯¥à¥¤ ¥âáï ¢ ebp
1248
;¢å®¤­ë¥ ¯ à ¬¥âàë:
1249
;¢å®¤­ë¥ ¯ à ¬¥âàë:
1249
;eax=dword ed_pos
1250
;eax=dword ed_pos
1250
;ebp=-梥â ed_color or shift_color
1251
;ebp=-梥â ed_color or shift_color
1251
edit_box_key.draw_rectangle:
1252
edit_box_key.draw_rectangle:
1252
        sub     eax,ed_offset
1253
        sub     eax,ed_offset
1253
        mul     dword ed_char_width
1254
        mul     dword ed_char_width
1254
        add     eax,ed_left
1255
        add     eax,ed_left
1255
        inc     eax
1256
        inc     eax
1256
        shl     eax,16
1257
        shl     eax,16
1257
        add     eax,ed_char_width
1258
        add     eax,ed_char_width
1258
        mov     ebx,eax
1259
        mov     ebx,eax
1259
        mov     edx,ebp
1260
        mov     edx,ebp
1260
        jmp     edit_box.draw_bg_eax
1261
        jmp     edit_box.draw_bg_eax
1261
 
1262
 
1262
;;;;;;;;;;;;;;;;;;
1263
;;;;;;;;;;;;;;;;;;
1263
;;à®¢¥àª  ­ ¦ â «¨ shift
1264
;;à®¢¥àª  ­ ¦ â «¨ shift
1264
;;;;;;;;;;;;;;;;;;
1265
;;;;;;;;;;;;;;;;;;
1265
edit_box_key.check_shift_ctrl_alt:
1266
edit_box_key.check_shift_ctrl_alt:
1266
        pusha
1267
        pusha
1267
        mcall   SF_KEYBOARD,SSF_GET_CONTROL_KEYS
1268
        mcall   SF_KEYBOARD,SSF_GET_CONTROL_KEYS
1268
        test    al,11b
1269
        test    al,11b
1269
        je      @f
1270
        je      @f
1270
        or      word ed_flags,ed_shift   ;ãáâ ­®¢¨¬ ä« £ Shift
1271
        or      word ed_flags,ed_shift   ;ãáâ ­®¢¨¬ ä« £ Shift
1271
@@:
1272
@@:
1272
        and     word ed_flags,ed_ctrl_off ; ®ç¨á⨬ ä« £ Ctrl
1273
        and     word ed_flags,ed_ctrl_off ; ®ç¨á⨬ ä« £ Ctrl
1273
        test    al,1100b
1274
        test    al,1100b
1274
        je      @f
1275
        je      @f
1275
        or      word ed_flags,ed_ctrl_on   ;ãáâ ­®¢¨¬ ä« £ Ctrl
1276
        or      word ed_flags,ed_ctrl_on   ;ãáâ ­®¢¨¬ ä« £ Ctrl
1276
@@:
1277
@@:
1277
        and     word ed_flags,ed_alt_off ; ®ç¨á⨬ ä« £ Alt
1278
        and     word ed_flags,ed_alt_off ; ®ç¨á⨬ ä« £ Alt
1278
        test    al,110000b
1279
        test    al,110000b
1279
        je      @f
1280
        je      @f
1280
        or      word ed_flags,ed_alt_on   ;ãáâ ­®¢¨¬ ä« £ Alt
1281
        or      word ed_flags,ed_alt_on   ;ãáâ ­®¢¨¬ ä« £ Alt
1281
@@:
1282
@@:
1282
        popad
1283
        popad
1283
        ret
1284
        ret
1284
 
1285
 
1285
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1286
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1286
;”㭪樨 ¤«ï à ¡®âë á mouse
1287
;”㭪樨 ¤«ï à ¡®âë á mouse
1287
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1288
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1288
edit_box_mouse.mouse_wigwag:
1289
edit_box_mouse.mouse_wigwag:
1289
        push    eax
1290
        push    eax
1290
        call    edit_box.draw_bg
1291
        call    edit_box.draw_bg
1291
        call    edit_box.draw_shift
1292
        call    edit_box.draw_shift
1292
        pop     eax
1293
        pop     eax
1293
        or      word ed_flags,ed_shift_bac+ed_shift_on+ed_shift
1294
        or      word ed_flags,ed_shift_bac+ed_shift_on+ed_shift
1294
;Ž¡à ¡®âª  ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ª®£¤  ¯à®¨á室¨â ¢ë室 §  ¯à¥¤¥«ë editbox
1295
;Ž¡à ¡®âª  ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ª®£¤  ¯à®¨á室¨â ¢ë室 §  ¯à¥¤¥«ë editbox
1295
        test    eax,eax
1296
        test    eax,eax
1296
        js      edit_box_mouse.mleft
1297
        js      edit_box_mouse.mleft
1297
        shr     eax,16
1298
        shr     eax,16
1298
        sub     eax,ed_left
1299
        sub     eax,ed_left
1299
        jc      edit_box_mouse.mleft
1300
        jc      edit_box_mouse.mleft
1300
        cmp     ed_width,eax
1301
        cmp     ed_width,eax
1301
        jc      edit_box_mouse.mright
1302
        jc      edit_box_mouse.mright
1302
        xor     edx,edx
1303
        xor     edx,edx
1303
        div     word ed_char_width
1304
        div     word ed_char_width
1304
;Ž¡à ¡®âª  ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ¢ ¯à¥¤¥« å ®¡« á⨠editbox
1305
;Ž¡à ¡®âª  ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ¢ ¯à¥¤¥« å ®¡« á⨠editbox
1305
;®«ã稫¨ ª®®à¤¨­ âë ¢ eax ¬ë誨, â.¥. ªã¤  ®­  ¯¥à¥¬¥á⨫ áì
1306
;®«ã稫¨ ª®®à¤¨­ âë ¢ eax ¬ë誨, â.¥. ªã¤  ®­  ¯¥à¥¬¥á⨫ áì
1306
;¨á®¢ ­¨¥ § ªà è¥­­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ¨å ®ç¨á⪠
1307
;¨á®¢ ­¨¥ § ªà è¥­­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ¨å ®ç¨á⪠
1307
        add     eax,ed_offset
1308
        add     eax,ed_offset
1308
        cmp     eax,ed_size
1309
        cmp     eax,ed_size
1309
        ja      edit_box_mouse.mwigvag
1310
        ja      edit_box_mouse.mwigvag
1310
edit_box_mouse.mdraw:
1311
edit_box_mouse.mdraw:
1311
        mov     ed_pos,eax
1312
        mov     ed_pos,eax
1312
;¨á®¢ ­¨¥ § ªà è¥­­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ¨å ®ç¨á⪠
1313
;¨á®¢ ­¨¥ § ªà è¥­­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ¨å ®ç¨á⪠
1313
        movzx   ecx, word ed_shift_pos
1314
        movzx   ecx, word ed_shift_pos
1314
        movzx   ebx, word ed_shift_pos_old
1315
        movzx   ebx, word ed_shift_pos_old
1315
        mov     ed_shift_pos_old,ax
1316
        mov     ed_shift_pos_old,ax
1316
;¯à®¢¥àª  ¨ à¨á®¢ ­¨¥ § ªà è¥­­ëå ®¡« á⥩
1317
;¯à®¢¥àª  ¨ à¨á®¢ ­¨¥ § ªà è¥­­ëå ®¡« á⥩
1317
        cmp     ecx,ebx
1318
        cmp     ecx,ebx
1318
        je      edit_box_mouse.m1_shem  ;¤¢¨¦¥­¨ï ­¥ ¡ë«® à ­¥¥
1319
        je      edit_box_mouse.m1_shem  ;¤¢¨¦¥­¨ï ­¥ ¡ë«® à ­¥¥
1319
        jb      edit_box_mouse.msmaller ;¡ë«® ¤¢¨¦¥­¨¥ ->
1320
        jb      edit_box_mouse.msmaller ;¡ë«® ¤¢¨¦¥­¨¥ ->
1320
        cmp     ebx,eax
1321
        cmp     ebx,eax
1321
        ja      edit_box_mouse.m1_shem  ;¡ë«® ¤¢¨¦¥­¨¥ <-
1322
        ja      edit_box_mouse.m1_shem  ;¡ë«® ¤¢¨¦¥­¨¥ <-
1322
        je      edit_box_mouse.mwigvag
1323
        je      edit_box_mouse.mwigvag
1323
        mov     ebp,ed_color
1324
        mov     ebp,ed_color
1324
        call    edit_box_key.sh_cl_     ;®ç¨áâ¨âì ®¡« áâì c ed_pos ed_shift_pos_old
1325
        call    edit_box_key.sh_cl_     ;®ç¨áâ¨âì ®¡« áâì c ed_pos ed_shift_pos_old
1325
        jmp     edit_box_mouse.mwigvag
1326
        jmp     edit_box_mouse.mwigvag
1326
 
1327
 
1327
edit_box_mouse.msmaller:
1328
edit_box_mouse.msmaller:
1328
        cmp     ebx,eax
1329
        cmp     ebx,eax
1329
        jb      edit_box_mouse.m1_shem
1330
        jb      edit_box_mouse.m1_shem
1330
        mov     ebp,ed_color
1331
        mov     ebp,ed_color
1331
        call    edit_box_key.sh_cl_
1332
        call    edit_box_key.sh_cl_
1332
        jmp     edit_box_mouse.mwigvag
1333
        jmp     edit_box_mouse.mwigvag
1333
 
1334
 
1334
edit_box_mouse.m1_shem:
1335
edit_box_mouse.m1_shem:
1335
        mov     ebp,shift_color
1336
        mov     ebp,shift_color
1336
        mov     ebx,ecx
1337
        mov     ebx,ecx
1337
        call    edit_box_key.sh_cl_
1338
        call    edit_box_key.sh_cl_
1338
edit_box_mouse.mwigvag:
1339
edit_box_mouse.mwigvag:
1339
        and     word ed_flags,ed_shift_mcl
1340
        and     word ed_flags,ed_shift_mcl
1340
        jmp     edit_box.draw_cursor_text
1341
        jmp     edit_box.draw_cursor_text
1341
 
1342
 
1342
edit_box_mouse.mleft:
1343
edit_box_mouse.mleft:
1343
        mov     eax,ed_pos
1344
        mov     eax,ed_pos
1344
        cmp     eax,0
1345
        cmp     eax,0
1345
        jbe     edit_box_mouse.mwigvag
1346
        jbe     edit_box_mouse.mwigvag
1346
        dec     eax
1347
        dec     eax
1347
        call    edit_box.check_offset
1348
        call    edit_box.check_offset
1348
        push    eax
1349
        push    eax
1349
        movzx   ebx, word ed_shift_pos
1350
        movzx   ebx, word ed_shift_pos
1350
        mov     ebp,shift_color
1351
        mov     ebp,shift_color
1351
        call    edit_box_key.sh_cl_
1352
        call    edit_box_key.sh_cl_
1352
        pop     eax
1353
        pop     eax
1353
        jmp     edit_box_mouse.mdraw
1354
        jmp     edit_box_mouse.mdraw
1354
 
1355
 
1355
edit_box_mouse.mright:
1356
edit_box_mouse.mright:
1356
        mov     eax,ed_pos
1357
        mov     eax,ed_pos
1357
        mov     ebx,ed_size
1358
        mov     ebx,ed_size
1358
        cmp     eax,ebx
1359
        cmp     eax,ebx
1359
        jae     edit_box_mouse.mwigvag
1360
        jae     edit_box_mouse.mwigvag
1360
        inc     eax
1361
        inc     eax
1361
        call    edit_box.check_offset
1362
        call    edit_box.check_offset
1362
        movzx   ebx, word ed_shift_pos
1363
        movzx   ebx, word ed_shift_pos
1363
        mov     ebp,shift_color
1364
        mov     ebp,shift_color
1364
        push    eax
1365
        push    eax
1365
        call    edit_box_key.sh_cl_
1366
        call    edit_box_key.sh_cl_
1366
        pop     eax
1367
        pop     eax
1367
        jmp     edit_box_mouse.mdraw
1368
        jmp     edit_box_mouse.mdraw
1368
 
1369
 
1369
 
1370
 
1370
ed_struc_size=84
1371
ed_struc_size=84
1371
>
1372
>