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