Rev 4128 | Rev 4308 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1456 | IgorA | 1 | align 4 |
1457 | IgorA | 2 | draw_but_toolbar: ;функция для рисования панели инструментов |
3 | pushad |
||
1456 | IgorA | 4 | mov edi,tedit0 |
1338 | IgorA | 5 | |
6 | mov ecx,0x40000000 |
||
7 | ; mov edx,5*65536+25 |
||
8 | mov edx,85*65536+2 |
||
9 | call draw_but_icon |
||
10 | |||
11 | inc cx |
||
12 | ; mov edx,30*65536+25 |
||
13 | mov edx,110*65536+2 |
||
14 | call draw_but_icon |
||
15 | |||
1457 | IgorA | 16 | stdcall [ted_can_save],edi |
1338 | IgorA | 17 | cmp al,1 |
18 | je @f |
||
19 | and ecx,0xffff |
||
20 | @@: |
||
21 | inc cx |
||
22 | ; mov edx,55*65536+25 |
||
23 | mov edx,135*65536+2 |
||
24 | call draw_but_icon |
||
25 | or ecx,0x40000000 |
||
26 | |||
27 | inc cx |
||
28 | mov edx,85*65536+25 |
||
29 | call draw_but_icon |
||
30 | |||
1457 | IgorA | 31 | call [ted_is_select] |
1338 | IgorA | 32 | cmp al,0 |
33 | jne @f |
||
34 | and ecx,0xffff |
||
35 | @@: |
||
36 | inc cx ; Cut |
||
37 | mov edx,110*65536+25 |
||
38 | call draw_but_icon |
||
39 | |||
40 | inc cx ; Copy |
||
41 | mov edx,135*65536+25 |
||
42 | call draw_but_icon |
||
43 | |||
44 | mov cx,10 ; Upper |
||
45 | mov edx,265*65536+25 |
||
46 | call draw_but_icon |
||
47 | |||
48 | inc cx ; Lower |
||
49 | mov edx,290*65536+25 |
||
50 | call draw_but_icon |
||
51 | |||
1457 | IgorA | 52 | inc cx ; reverse |
1338 | IgorA | 53 | mov edx,315*65536+25 |
54 | call draw_but_icon |
||
55 | or ecx,0x40000000 |
||
56 | |||
4228 | IgorA | 57 | cmp dword[buf],0 |
1338 | IgorA | 58 | jne @f |
59 | and ecx,0xffff |
||
60 | @@: |
||
61 | mov cx,6 ; Paste |
||
62 | mov edx,160*65536+25 |
||
63 | call draw_but_icon |
||
64 | or ecx,0x40000000 |
||
65 | |||
66 | inc cx |
||
67 | mov edx,185*65536+25 |
||
68 | call draw_but_icon |
||
69 | |||
70 | inc cx |
||
71 | mov edx,210*65536+25 |
||
72 | call draw_but_icon |
||
73 | |||
74 | inc cx |
||
75 | mov edx,235*65536+25 |
||
76 | call draw_but_icon |
||
77 | |||
1456 | IgorA | 78 | mov ebx,ted_tim_undo |
79 | cmp ted_tim_ch,ebx |
||
1338 | IgorA | 80 | jg @f |
81 | and ecx,0xffff |
||
82 | @@: |
||
83 | mov cx,13 |
||
84 | mov edx,345*65536+25 |
||
85 | call draw_but_icon |
||
86 | or ecx,0x40000000 |
||
87 | |||
1456 | IgorA | 88 | cmp ted_tim_undo,1 |
1338 | IgorA | 89 | jge @f |
90 | and ecx,0xffff |
||
91 | @@: |
||
92 | inc cx |
||
93 | mov edx,370*65536+25 |
||
94 | call draw_but_icon |
||
95 | or ecx,0x40000000 |
||
96 | |||
97 | inc cx |
||
98 | mov edx,400*65536+25 |
||
99 | call draw_but_icon |
||
100 | |||
101 | inc cx |
||
102 | mov edx,425*65536+25 |
||
103 | call draw_but_icon |
||
104 | |||
105 | mov cx,17 |
||
106 | mov edx,450*65536+25 |
||
107 | call draw_but_icon |
||
108 | |||
1449 | IgorA | 109 | popad |
1338 | IgorA | 110 | ret |
111 | |||
112 | ;txtBUp db 24 |
||
113 | ;txtBDn db 25 |
||
114 | ;txtBRi db 26 |
||
115 | ;txtBLe db 27 |
||
1457 | IgorA | 116 | |
117 | ;input: |
||
118 | ; edi = pointer to tedit struct |
||
1456 | IgorA | 119 | align 4 |
1457 | IgorA | 120 | proc draw_panel_find |
121 | ;push edi |
||
122 | ;mov edi,dword[edit] |
||
123 | cmp ted_panel_id,TED_PANEL_FIND ;if not panel |
||
1338 | IgorA | 124 | jne @f |
125 | push eax ebx ecx edx |
||
126 | |||
127 | mov eax,13 ;рисование прямоугольника |
||
1457 | IgorA | 128 | mov ebx,TED_PANEL_WIDTH |
1449 | IgorA | 129 | mov ecx,ted_wnd_t |
1338 | IgorA | 130 | shl ecx,16 |
131 | mov cx,20 |
||
132 | mov edx,[sc.work] |
||
133 | int 0x40 |
||
134 | |||
135 | mov eax,4 ;рисование текста |
||
136 | mov ebx,30*65536+5 |
||
1449 | IgorA | 137 | add ebx,ted_wnd_t |
1338 | IgorA | 138 | mov ecx,[sc.work_text] |
139 | or ecx,0x80000000 |
||
140 | mov edx,txtFindCapt |
||
141 | int 0x40 |
||
142 | |||
1456 | IgorA | 143 | stdcall [edit_box_draw], dword edit2 |
1338 | IgorA | 144 | |
145 | mov eax,13 ;рисование прямоугольника |
||
1457 | IgorA | 146 | mov ebx,TED_PANEL_WIDTH |
1449 | IgorA | 147 | mov ecx,ted_wnd_t |
1338 | IgorA | 148 | add cx,20+15 ; 15 - height text box |
149 | shl ecx,16 |
||
1449 | IgorA | 150 | add ecx,ted_wnd_h |
1457 | IgorA | 151 | mov edx,ted_scr_h |
152 | add cx,word[edx+sb_offs_size_y] |
||
1338 | IgorA | 153 | sub cx,20+15-1 ; 15 - height text box |
154 | mov edx,[sc.work] |
||
155 | int 0x40 |
||
156 | |||
157 | mov eax,8 ;кнопка |
||
158 | mov ebx,5*65536+85 |
||
1449 | IgorA | 159 | mov ecx,ted_wnd_t |
1338 | IgorA | 160 | add cx,20+15+5 |
161 | shl ecx,16 |
||
162 | mov cx,20 |
||
163 | mov edx,201 ;button id |
||
164 | mov esi,[sc.work_button] |
||
165 | int 0x40 |
||
166 | |||
167 | mov eax,4 ;рисование текста |
||
168 | mov ebx,15*65536+(20+15+10) |
||
1449 | IgorA | 169 | add ebx,ted_wnd_t |
1338 | IgorA | 170 | mov ecx,[sc.work_text] |
171 | or ecx,0x80000000 |
||
172 | mov edx,txtFindNext |
||
173 | int 0x40 |
||
174 | |||
175 | pop edx ecx ebx eax |
||
1449 | IgorA | 176 | jmp .end_f |
1338 | IgorA | 177 | @@: |
178 | push eax edx |
||
179 | mov eax,8 |
||
180 | mov edx,201 |
||
181 | or edx,0x80000000 |
||
182 | int 0x40 |
||
183 | pop edx eax |
||
1449 | IgorA | 184 | .end_f: |
1457 | IgorA | 185 | ;pop edi |
1338 | IgorA | 186 | ret |
1449 | IgorA | 187 | endp |
1338 | IgorA | 188 | |
1457 | IgorA | 189 | ;input: |
190 | ; edi = pointer to tedit struct |
||
1456 | IgorA | 191 | align 4 |
1457 | IgorA | 192 | proc draw_panel_syntax |
193 | ;push edi |
||
194 | ;mov edi,dword[edit] |
||
195 | cmp ted_panel_id,TED_PANEL_SYNTAX ;if not panel |
||
1338 | IgorA | 196 | jne @f |
1457 | IgorA | 197 | pushad |
1338 | IgorA | 198 | |
199 | mov eax,13 ;рисование прямоугольника |
||
1457 | IgorA | 200 | mov ebx,TED_PANEL_WIDTH |
1449 | IgorA | 201 | mov ecx,ted_wnd_t |
1338 | IgorA | 202 | shl ecx,16 |
203 | mov cx,20 |
||
204 | mov edx,[sc.work] |
||
1449 | IgorA | 205 | int 0x40 ;рисование верхнего фонового прямоугольника |
1338 | IgorA | 206 | |
1456 | IgorA | 207 | stdcall dword[tl_draw], tree1 |
1449 | IgorA | 208 | mov [ws_dir_lbox.all_redraw],1 ;для полной перерисовки дочернего скроллинга |
209 | stdcall dword[scrollbar_ver_draw], dword ws_dir_lbox |
||
1338 | IgorA | 210 | |
211 | ror ecx,16 |
||
212 | add ecx,dword[tree1.box_height] |
||
213 | add ecx,20 |
||
1449 | IgorA | 214 | and ecx,0xffff |
1338 | IgorA | 215 | ror ecx,16 |
1449 | IgorA | 216 | add ecx,ted_wnd_h |
1457 | IgorA | 217 | mov esi,ted_scr_h |
218 | add cx,word[esi+sb_offs_size_y] |
||
1338 | IgorA | 219 | sub cx,20 |
220 | sub ecx,dword[tree1.box_height] |
||
221 | inc cx |
||
1449 | IgorA | 222 | int 0x40 ;рисование нижнего фонового прямоугольника |
1338 | IgorA | 223 | |
224 | mov eax,8 ;кнопка |
||
225 | mov ebx,5*65536+65 |
||
1449 | IgorA | 226 | mov ecx,ted_wnd_t |
227 | add ecx,25 |
||
1338 | IgorA | 228 | add ecx,dword[tree1.box_height] |
229 | shl ecx,16 |
||
230 | mov cx,20 |
||
231 | mov edx,200 ;button id |
||
232 | mov esi,[sc.work_button] |
||
233 | int 0x40 |
||
234 | |||
235 | mov eax,4 ;рисование текста |
||
236 | mov ebx,30*65536+5 |
||
1449 | IgorA | 237 | add ebx,ted_wnd_t |
1338 | IgorA | 238 | mov ecx,[sc.work_text] |
239 | or ecx,0x80000000 |
||
240 | mov edx,txtFormatCapt |
||
241 | int 0x40 |
||
242 | |||
243 | mov ebx,10*65536+30 |
||
244 | add ebx,dword[tree1.box_height] |
||
1449 | IgorA | 245 | add ebx,ted_wnd_t |
1338 | IgorA | 246 | mov edx,txtFormatApply |
247 | int 0x40 |
||
248 | |||
1457 | IgorA | 249 | popad |
1449 | IgorA | 250 | jmp .end_f |
1338 | IgorA | 251 | @@: |
1449 | IgorA | 252 | push eax edx |
253 | mov eax,8 |
||
254 | mov edx,200 |
||
255 | or edx,0x80000000 |
||
256 | int 0x40 ;если нет панели то удаляем кнопку |
||
257 | pop edx eax |
||
258 | .end_f: |
||
1457 | IgorA | 259 | ;pop edi |
1338 | IgorA | 260 | ret |
1449 | IgorA | 261 | endp |
1338 | IgorA | 262 | |
2125 | IgorA | 263 | MIN_M_WND_H equ 100 ;минимальная высота главного окна |
264 | ;input: |
||
265 | ; edi = pointer to tedit struct |
||
1456 | IgorA | 266 | align 4 |
2125 | IgorA | 267 | EvSize: |
1457 | IgorA | 268 | pushad |
269 | mov ebx,ted_scr_h |
||
270 | mov esi,ted_scr_w |
||
1338 | IgorA | 271 | |
1449 | IgorA | 272 | m2m ted_wnd_w,[procinfo.client_box.width] ;ставим ширину окна редактора равной ширине всего окна |
273 | mov eax,ted_wnd_l |
||
274 | sub ted_wnd_w,eax ;отнимаем отступ слева |
||
1457 | IgorA | 275 | mov eax,dword[esi+sb_offs_size_x] |
1449 | IgorA | 276 | and eax,0xffff |
277 | sub ted_wnd_w,eax ;отнимаем ширину верт. скроллинга |
||
278 | |||
279 | m2m ted_wnd_h,[procinfo.client_box.height] ;ставим высоту окна редактора равной высоте всего окна |
||
280 | cmp ted_wnd_h,MIN_M_WND_H |
||
1338 | IgorA | 281 | jg @f |
1449 | IgorA | 282 | mov ted_wnd_h,MIN_M_WND_H |
1338 | IgorA | 283 | @@: |
284 | |||
1457 | IgorA | 285 | mov ax,word[ebx+sb_offs_size_y] |
1449 | IgorA | 286 | and eax,0xffff |
287 | sub ted_wnd_h,eax ;отнимаем высоту гориз. скроллинга |
||
288 | mov eax,ted_wnd_t |
||
289 | sub ted_wnd_h,eax ;отнимаем отступ сверху |
||
1338 | IgorA | 290 | |
1458 | IgorA | 291 | stdcall [ted_init_scroll_bars], tedit0,2 |
1338 | IgorA | 292 | |
1449 | IgorA | 293 | mov eax,ted_wnd_t |
1338 | IgorA | 294 | mov edi,dword tree1 |
1449 | IgorA | 295 | mov tl_box_top,eax ;=ted_wnd_t |
1338 | IgorA | 296 | add tl_box_top,20 |
297 | |||
1449 | IgorA | 298 | mov dword[edit2.top],eax ;=ted_wnd_t |
1338 | IgorA | 299 | add dword[edit2.top],20 |
300 | |||
1449 | IgorA | 301 | popad |
1338 | IgorA | 302 | ret |
303 | |||
1456 | IgorA | 304 | ;input: |
1338 | IgorA | 305 | ; ecx = 0x4000____ |
306 | ; cx = icon index |
||
307 | ; edx = x*2^16+y |
||
1456 | IgorA | 308 | align 4 |
1338 | IgorA | 309 | draw_but_icon: |
1457 | IgorA | 310 | push eax ebx |
1338 | IgorA | 311 | |
1457 | IgorA | 312 | mov eax,8 ;кнопка |
313 | push ecx edx esi |
||
314 | mov ebx,edx |
||
315 | mov edx,ecx |
||
316 | add edx,3 |
||
317 | mov cx,bx |
||
318 | shl ecx,16 |
||
319 | mov cx,19 ;=20-1 |
||
320 | mov bx,19 ;=20-1 |
||
321 | mov esi,ebx |
||
322 | shr esi,16 |
||
323 | add esi,20 |
||
324 | cmp esi,[procinfo.client_box.width] |
||
4128 | IgorA | 325 | jge @f ;кнопка не влезла в окно |
1457 | IgorA | 326 | mov esi,[sc.work_button] |
327 | int 0x40 ;ставим кнопку |
||
328 | mov eax,7 ;bmp |
||
329 | @@: |
||
330 | pop esi edx ecx |
||
1338 | IgorA | 331 | |
1457 | IgorA | 332 | cmp eax,7 |
4128 | IgorA | 333 | jne @f ;кнопка не влезла в окно |
1457 | IgorA | 334 | mov ebx,[bmp_icon] |
4128 | IgorA | 335 | bt ecx,30 ;if (ecx or 0x40000000) |
336 | jc .gray |
||
337 | add ebx,TOOLBAR_ICONS_SIZE ;перемещаемся на серые кнопки |
||
338 | .gray: |
||
1457 | IgorA | 339 | push ecx |
340 | and ecx,0xffff |
||
341 | imul ecx,1200 |
||
342 | add ebx,ecx |
||
343 | mov ecx,20 |
||
344 | shl ecx,16 |
||
345 | add ecx,20 |
||
346 | int 0x40 ;ставим рисунок на кнопку |
||
347 | pop ecx |
||
348 | @@: |
||
349 | pop ebx eax |
||
350 | ret |
||
1338 | IgorA | 351 | |
4128 | IgorA | 352 | ;descrition: |
353 | ; функция для генерирования серых иконок |
||
354 | ;input: |
||
355 | ; buf_rgb - буфер с входным 24 битным цветным изображением |
||
356 | ; buf_g24 - буфер с выходным 24 битным серым изображением |
||
357 | ; pixels - число пикселей в изображении |
||
358 | align 4 |
||
4228 | IgorA | 359 | proc img_to_gray, buf_rgb:dword, buf_g24:dword, pixels:dword |
360 | pushad |
||
4128 | IgorA | 361 | mov esi,[buf_rgb] |
362 | mov edi,[buf_g24] |
||
363 | mov ecx,[pixels] |
||
4228 | IgorA | 364 | mov ebx,3 |
4128 | IgorA | 365 | @@: |
366 | movzx eax,byte[esi] |
||
4228 | IgorA | 367 | movzx edx,byte[esi+1] |
368 | add eax,edx |
||
369 | movzx edx,byte[esi+2] |
||
370 | add eax,edx |
||
371 | xor edx,edx |
||
372 | div ebx ;shr eax,2 |
||
4128 | IgorA | 373 | mov ah,al |
374 | mov word[edi],ax |
||
375 | mov byte[edi+2],al |
||
376 | add esi,3 |
||
377 | add edi,3 |
||
378 | loop @b |
||
4228 | IgorA | 379 | popad |
4128 | IgorA | 380 | ret |
381 | endp |
||
382 |