Rev 288 | Rev 327 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
259 | mikedld | 1 | ;----------------------------------------------------------------------------- |
267 | mikedld | 2 | func flush_cur_tab ;///// SAVE CURRENT TAB DATA TO CONTROL /////////////////// |
259 | mikedld | 3 | ;----------------------------------------------------------------------------- |
4 | ; EBP = TABITEM* |
||
5 | ;----------------------------------------------------------------------------- |
||
6 | push ecx esi edi |
||
7 | mov esi,cur_tab |
||
8 | mov edi,[tab_bar.Current.Ptr] |
||
9 | mov ecx,sizeof.TABITEM/4 |
||
10 | cld |
||
11 | rep movsd |
||
12 | pop edi esi ecx |
||
13 | ret |
||
14 | endf |
||
15 | |||
16 | ;----------------------------------------------------------------------------- |
||
267 | mikedld | 17 | func set_cur_tab ;///// SET SPECIFIED TAB CURRENT (FOCUS IT) ///////////////// |
259 | mikedld | 18 | ;----------------------------------------------------------------------------- |
19 | ; EBP = TABITEM* |
||
20 | ;----------------------------------------------------------------------------- |
||
21 | push ecx esi edi |
||
22 | cmp [tab_bar.Current.Ptr],0 |
||
23 | je @f |
||
24 | call flush_cur_tab |
||
25 | @@: mov esi,ebp |
||
26 | mov edi,cur_tab |
||
27 | mov ecx,sizeof.TABITEM/4 |
||
28 | rep movsd |
||
29 | mov [tab_bar.Current.Ptr],ebp |
||
297 | mikedld | 30 | ; call update_caption |
259 | mikedld | 31 | pop edi esi ecx |
32 | ret |
||
33 | endf |
||
34 | |||
35 | ;----------------------------------------------------------------------------- |
||
267 | mikedld | 36 | func make_tab_visible ;///// MAKE SPECIFIED TAB VISIBLE IF IT'S OFFSCREEN //// |
259 | mikedld | 37 | ;----------------------------------------------------------------------------- |
297 | mikedld | 38 | call flush_cur_tab |
267 | mikedld | 39 | imul eax,[tab_bar.Items.Left],sizeof.TABITEM |
40 | add eax,[tab_bar.Items] |
||
41 | cmp eax,ebp |
||
42 | jb .go_right |
||
43 | ja .go_left |
||
44 | ret |
||
45 | |||
46 | .go_right: |
||
280 | mikedld | 47 | push ebp |
267 | mikedld | 48 | call get_hidden_tabitems_number |
49 | cmp ebp,[esp] |
||
297 | mikedld | 50 | ja @f |
267 | mikedld | 51 | @@: inc [tab_bar.Items.Left] |
52 | call get_hidden_tabitems_number |
||
53 | cmp ebp,[esp] |
||
54 | jbe @b |
||
297 | mikedld | 55 | @@: pop ebp |
267 | mikedld | 56 | ret |
57 | |||
58 | .go_left: |
||
59 | mov eax,ebp |
||
60 | sub eax,[tab_bar.Items] |
||
61 | jz @f |
||
297 | mikedld | 62 | cdq |
267 | mikedld | 63 | mov ebx,sizeof.TABITEM |
64 | div ebx |
||
65 | @@: mov [tab_bar.Items.Left],eax |
||
66 | ret |
||
67 | endf |
||
68 | |||
69 | ;----------------------------------------------------------------------------- |
||
70 | func create_tab ;///// ADD TAB TO THE END //////////////////////////////////// |
||
71 | ;----------------------------------------------------------------------------- |
||
259 | mikedld | 72 | push eax ecx esi edi |
73 | |||
74 | inc [tab_bar.Items.Count] |
||
75 | imul ebx,[tab_bar.Items.Count],sizeof.TABITEM |
||
76 | mov eax,[tab_bar.Items] |
||
77 | mov ecx,eax |
||
78 | call mem.ReAlloc |
||
79 | mov [tab_bar.Items],eax |
||
80 | sub ecx,eax |
||
81 | sub [tab_bar.Current.Ptr],ecx |
||
280 | mikedld | 82 | cmp [tab_bar.Default.Ptr],0 |
83 | je @f |
||
84 | sub [tab_bar.Default.Ptr],ecx |
||
85 | @@: lea ebp,[eax+ebx-sizeof.TABITEM] |
||
259 | mikedld | 86 | call set_cur_tab |
87 | |||
88 | mov eax,1024 |
||
280 | mikedld | 89 | mov [cur_editor.Lines.Size],eax |
259 | mikedld | 90 | call mem.Alloc |
267 | mikedld | 91 | mov [cur_editor.Lines],eax |
92 | mov [cur_editor.Lines.Count],1 |
||
93 | mov [cur_editor.Columns.Count],1 |
||
259 | mikedld | 94 | xor eax,eax |
267 | mikedld | 95 | mov [cur_editor.TopLeft.X],eax |
96 | mov [cur_editor.TopLeft.Y],eax |
||
97 | mov [cur_editor.Caret.X],eax |
||
98 | mov [cur_editor.Caret.Y],eax |
||
99 | mov [cur_editor.SelStart.X],eax |
||
100 | mov [cur_editor.SelStart.Y],eax |
||
101 | mov edi,[cur_editor.Lines] |
||
259 | mikedld | 102 | add edi,4 |
103 | mov ecx,10 |
||
104 | mov [edi-4],ecx |
||
105 | mov [edi+10],eax |
||
106 | mov al,' ' |
||
107 | cld |
||
108 | rep stosb |
||
109 | |||
110 | mov esi,s_defname |
||
267 | mikedld | 111 | mov edi,cur_editor.FilePath |
259 | mikedld | 112 | mov ecx,s_defname.size |
113 | rep movsb |
||
267 | mikedld | 114 | mov [cur_editor.FileName],0 |
259 | mikedld | 115 | |
267 | mikedld | 116 | mov [cur_editor.Modified],0 |
117 | mov [cur_editor.AsmMode],0 |
||
259 | mikedld | 118 | |
119 | call flush_cur_tab |
||
297 | mikedld | 120 | mov ebp,[tab_bar.Current.Ptr] |
121 | call make_tab_visible |
||
259 | mikedld | 122 | call update_caption |
280 | mikedld | 123 | cmp [do_not_draw],0 |
124 | jne @f |
||
125 | call align_editor_in_tab |
||
126 | call draw_editor |
||
127 | call draw_tabctl |
||
128 | call draw_statusbar |
||
297 | mikedld | 129 | call update_caption |
280 | mikedld | 130 | @@: |
259 | mikedld | 131 | mov ebp,cur_tab |
132 | pop edi esi ecx eax |
||
133 | ret |
||
134 | endf |
||
135 | |||
136 | ;----------------------------------------------------------------------------- |
||
267 | mikedld | 137 | func delete_tab ;///// DELETE SPECIFIED TAB ////////////////////////////////// |
259 | mikedld | 138 | ;----------------------------------------------------------------------------- |
280 | mikedld | 139 | cmp [tab_bar.Default.Ptr],0 |
140 | je @f |
||
141 | cmp ebp,[tab_bar.Default.Ptr] |
||
142 | je .lp1 |
||
143 | ja @f |
||
144 | sub [tab_bar.Default.Ptr],sizeof.TABITEM |
||
145 | jmp @f |
||
146 | .lp1: |
||
147 | mov [tab_bar.Default.Ptr],0 |
||
148 | |||
149 | @@: mov eax,[ebp+TABITEM.Editor.Lines] |
||
267 | mikedld | 150 | call mem.Free |
151 | imul ecx,[tab_bar.Items.Count],sizeof.TABITEM |
||
152 | add ecx,[tab_bar.Items] |
||
153 | sub ecx,ebp |
||
154 | sub ecx,sizeof.TABITEM |
||
155 | jle @f |
||
156 | cld |
||
157 | shr ecx,2 |
||
158 | mov edi,ebp |
||
159 | lea esi,[edi+sizeof.TABITEM] |
||
160 | rep movsd |
||
161 | @@: dec [tab_bar.Items.Count] |
||
162 | jz .no_tabs |
||
163 | imul ebx,[tab_bar.Items.Count],sizeof.TABITEM |
||
164 | push ebx |
||
165 | mov eax,[tab_bar.Items] |
||
166 | mov ecx,eax |
||
167 | call mem.ReAlloc |
||
168 | mov [tab_bar.Items],eax |
||
169 | sub ecx,eax |
||
170 | sub ebp,ecx |
||
280 | mikedld | 171 | cmp [tab_bar.Default.Ptr],0 |
172 | je @f |
||
173 | sub [tab_bar.Default.Ptr],ecx |
||
174 | @@: |
||
267 | mikedld | 175 | pop ecx |
176 | add ecx,[tab_bar.Items] |
||
177 | sub ecx,ebp |
||
178 | ja @f |
||
179 | add ebp,-sizeof.TABITEM |
||
180 | |||
181 | @@: mov [tab_bar.Current.Ptr],0 |
||
182 | call set_cur_tab |
||
183 | call make_tab_visible |
||
280 | mikedld | 184 | call align_editor_in_tab |
185 | call draw_editor |
||
186 | call draw_tabctl |
||
187 | call draw_statusbar |
||
259 | mikedld | 188 | ret |
189 | |||
267 | mikedld | 190 | .no_tabs: |
191 | mov eax,[tab_bar.Items] |
||
192 | call mem.Free |
||
280 | mikedld | 193 | xor eax,eax |
194 | mov [tab_bar.Items],eax |
||
195 | mov [tab_bar.Current.Ptr],eax |
||
196 | mov [tab_bar.Default.Ptr],eax |
||
259 | mikedld | 197 | ret |
198 | endf |
||
199 | |||
200 | ;----------------------------------------------------------------------------- |
||
267 | mikedld | 201 | func draw_tabctl ;///// DRAW TAB CONTROL ///////////////////////////////////// |
259 | mikedld | 202 | ;----------------------------------------------------------------------------- |
203 | |||
267 | mikedld | 204 | dec [tab_bar.Items.Left] |
205 | js .lp1 |
||
206 | @@: call get_hidden_tabitems_number |
||
207 | or eax,eax |
||
208 | jnz .lp1 |
||
209 | dec [tab_bar.Items.Left] |
||
210 | jns @b |
||
211 | .lp1: inc [tab_bar.Items.Left] |
||
212 | mov eax,[tab_bar.Items.Count] |
||
213 | cmp [tab_bar.Items.Left],eax |
||
214 | jb @f |
||
215 | dec eax |
||
216 | mov [tab_bar.Items.Left],eax |
||
217 | @@: |
||
218 | |||
219 | mov eax,8 |
||
220 | mov edx,[tab_bar.Buttons.First] |
||
221 | @@: cmp edx,[tab_bar.Buttons.Last] |
||
222 | ja @f |
||
223 | push edx |
||
224 | or edx,0x80000000 |
||
225 | mcall |
||
226 | pop edx |
||
227 | inc edx |
||
228 | jmp @b |
||
229 | @@: |
||
230 | |||
259 | mikedld | 231 | mov ebx,[tab_bar.Bounds.Left-2] |
232 | mov bx,word[tab_bar.Bounds.Right] |
||
233 | sub bx,word[tab_bar.Bounds.Left] |
||
234 | inc ebx |
||
235 | mov ecx,[tab_bar.Bounds.Top-2] |
||
236 | mov cx,word[tab_bar.Bounds.Bottom] |
||
237 | sub cx,word[tab_bar.Bounds.Top] |
||
238 | inc ecx |
||
239 | mov edx,[cl_3d_normal] |
||
240 | call draw_framerect |
||
241 | |||
242 | mov al,[tab_bar.Style] |
||
243 | dec al |
||
244 | jz .tabs_on_top |
||
245 | dec al |
||
246 | jz .tabs_on_bottom |
||
247 | dec al |
||
248 | jz .tabs_on_left |
||
249 | dec al |
||
250 | jz .tabs_on_right |
||
251 | ret |
||
252 | |||
253 | .tabs_on_top: |
||
254 | add ebx,1*65536-2 |
||
255 | mov ecx,[tab_bar.Bounds.Top-2] |
||
256 | xor cx,cx |
||
257 | add ecx,1*65536+TBARH |
||
258 | mcall 13 |
||
267 | mikedld | 259 | add ecx,(TBARH-1)*65536-(TBARH-1) |
260 | mcall ,,,[sc.work] |
||
261 | add ecx,-1*65536+2 |
||
259 | mikedld | 262 | mov edx,[cl_3d_inset] |
263 | call draw_framerect |
||
267 | mikedld | 264 | |
265 | mov esi,[tab_bar.Bounds.Left] |
||
266 | inc esi |
||
267 | mov edi,[tab_bar.Bounds.Top] |
||
268 | inc edi |
||
269 | push .curr_top .check_horz .next_horz |
||
270 | call .draw_tabs |
||
259 | mikedld | 271 | ret |
272 | |||
273 | .tabs_on_bottom: |
||
274 | add ebx,1*65536-2 |
||
275 | mov ecx,[tab_bar.Bounds.Bottom-2] |
||
276 | xor cx,cx |
||
277 | add ecx,-TBARH*65536+TBARH |
||
278 | mcall 13 |
||
279 | mov cx,1 |
||
280 | mcall ,,,[sc.work] |
||
267 | mikedld | 281 | add ecx,-1*65536+2 |
259 | mikedld | 282 | mov edx,[cl_3d_inset] |
283 | call draw_framerect |
||
284 | |||
285 | mov esi,[tab_bar.Bounds.Left] |
||
286 | inc esi |
||
287 | mov edi,[tab_bar.Bounds.Bottom] |
||
288 | add edi,-TBARH+1 |
||
267 | mikedld | 289 | push .curr_bottom .check_horz .next_horz |
290 | call .draw_tabs |
||
291 | ret |
||
292 | |||
293 | .tabs_on_left: |
||
294 | call get_max_tab_width |
||
295 | mov ebx,[tab_bar.Bounds.Left-2] |
||
296 | mov bx,ax |
||
297 | add ebx,1*65536-1 |
||
298 | add ecx,1*65536-2 |
||
299 | push eax |
||
300 | mcall 13 |
||
301 | pop ebx |
||
302 | shl ebx,16 |
||
303 | add ebx,1*65536+1 |
||
304 | mcall ,,,[sc.work] |
||
305 | add ebx,-1*65536+2 |
||
306 | mov edx,[cl_3d_inset] |
||
307 | call draw_framerect |
||
308 | |||
309 | mov esi,[tab_bar.Bounds.Left] |
||
310 | inc esi |
||
311 | mov edi,[tab_bar.Bounds.Top] |
||
312 | inc edi |
||
313 | push .curr_left .check_vert .next_vert |
||
314 | call .draw_tabs |
||
315 | ret |
||
316 | |||
317 | .tabs_on_right: |
||
318 | call get_max_tab_width |
||
319 | push eax |
||
320 | mov ebx,[tab_bar.Bounds.Right-2] |
||
321 | mov bx,ax |
||
322 | shl eax,16 |
||
323 | sub ebx,eax |
||
324 | add ecx,1*65536-2 |
||
325 | mcall 13 |
||
326 | add ebx,-1*65536 |
||
327 | mov bx,1 |
||
328 | mcall ,,,[sc.work] |
||
329 | add ebx,-1*65536+2 |
||
330 | mov edx,[cl_3d_inset] |
||
331 | call draw_framerect |
||
332 | |||
333 | mov esi,[tab_bar.Bounds.Right] |
||
334 | pop eax |
||
335 | sub esi,eax |
||
336 | mov edi,[tab_bar.Bounds.Top] |
||
337 | inc edi |
||
338 | push .curr_right .check_vert .next_vert |
||
339 | call .draw_tabs |
||
340 | ret |
||
341 | |||
342 | |||
343 | .draw_tabs: |
||
344 | mov ecx,[tab_bar.Items.Count] |
||
345 | mov ebx,[tab_bar.Items.Left] |
||
346 | imul ebp,ebx,sizeof.TABITEM |
||
347 | add ebp,[tab_bar.Items] |
||
348 | push ecx |
||
349 | sub [esp],ebx |
||
350 | add ebx,1000 |
||
351 | mov [tab_bar.Buttons.First],ebx |
||
352 | dec ebx |
||
353 | mov [tab_bar.Buttons.Last],ebx |
||
259 | mikedld | 354 | @@: push ecx |
355 | |||
356 | call get_tab_size |
||
267 | mikedld | 357 | |
358 | call dword[esp+(8+4)+4] |
||
359 | jc .draw_tabs.dontfit |
||
360 | |||
259 | mikedld | 361 | rol ebx,16 |
362 | mov bx,si |
||
363 | rol ebx,16 |
||
364 | rol ecx,16 |
||
365 | mov cx,di |
||
366 | rol ecx,16 |
||
367 | mov edx,[cl_3d_inset] |
||
368 | call draw_framerect |
||
369 | |||
267 | mikedld | 370 | mov edx,[sc.work_text] |
259 | mikedld | 371 | cmp ebp,[tab_bar.Current.Ptr] |
267 | mikedld | 372 | jne .draw_tabs.inactive |
259 | mikedld | 373 | push ebx ecx |
267 | mikedld | 374 | call dword[esp+(8+4)+8+8] |
259 | mikedld | 375 | mcall 13,,,[sc.work] |
376 | pop ecx ebx |
||
297 | mikedld | 377 | mov edx,[color_tbl.text] |
267 | mikedld | 378 | .draw_tabs.inactive: |
379 | |||
280 | mikedld | 380 | cmp ebp,[tab_bar.Default.Ptr] |
381 | jne .draw_tabs.notdefault |
||
382 | push ebx ecx edx |
||
383 | add ebx,3*65536 |
||
384 | add ecx,(TBARH/2-6)*65536 |
||
385 | mov bx,11 |
||
386 | mov cx,bx |
||
387 | call draw_framerect |
||
388 | add ebx,1*65536-2 |
||
389 | add ecx,1*65536-2 |
||
390 | mcall 13,,,[sc.work] |
||
391 | shr ebx,16 |
||
392 | shr ecx,16 |
||
393 | add ebx,2 |
||
394 | add ecx,3 |
||
395 | mov edx,[esp] |
||
396 | call draw_check |
||
397 | pop edx ecx ebx |
||
398 | .draw_tabs.notdefault: |
||
399 | |||
267 | mikedld | 400 | push ebx ecx esi edx |
259 | mikedld | 401 | lea eax,[ebp+TABITEM.Editor.FilePath] |
402 | add eax,[ebp+TABITEM.Editor.FileName] |
||
403 | mov edx,eax |
||
404 | call strlen |
||
405 | mov esi,eax |
||
406 | shr ecx,16 |
||
407 | mov bx,cx |
||
280 | mikedld | 408 | add ebx,5*65536+TBARH/2-4 |
267 | mikedld | 409 | pop ecx |
280 | mikedld | 410 | cmp ebp,[tab_bar.Default.Ptr] |
411 | jne .lp2 |
||
412 | add ebx,13*65536 |
||
413 | .lp2: mcall 4 |
||
267 | mikedld | 414 | pop esi ecx ebx |
259 | mikedld | 415 | |
267 | mikedld | 416 | inc [tab_bar.Buttons.Last] |
417 | cmp ebp,[tab_bar.Current.Ptr] |
||
418 | je .draw_tabs.active |
||
419 | push ebx ecx |
||
420 | dec ebx |
||
421 | dec ecx |
||
422 | mov edx,[tab_bar.Buttons.Last] |
||
423 | or edx,0x40000000 |
||
424 | mcall 8 |
||
425 | pop ecx ebx |
||
426 | .draw_tabs.active: |
||
427 | |||
428 | call dword[esp+(8+4)+0] |
||
259 | mikedld | 429 | add ebp,sizeof.TABITEM |
430 | |||
431 | pop ecx |
||
432 | dec ecx |
||
267 | mikedld | 433 | dec dword[esp] |
259 | mikedld | 434 | jnz @b |
435 | |||
267 | mikedld | 436 | add esp,4 |
437 | or ecx,ecx |
||
438 | jnz @f |
||
439 | |||
440 | ret 8 |
||
441 | |||
442 | .draw_tabs.dontfit: |
||
443 | |||
444 | add esp,8 |
||
445 | |||
446 | @@: mov ebx,[tab_bar.Bounds.Right] |
||
447 | shl ebx,16 |
||
448 | mov ecx,[tab_bar.Bounds.Bottom] |
||
449 | shl ecx,16 |
||
450 | add ecx,(-SCRLW-1)*65536+SCRLW |
||
451 | call get_max_tab_width |
||
452 | mov edx,eax |
||
453 | |||
454 | mov al,[tab_bar.Style] |
||
455 | dec al |
||
456 | jz .scroll_on_top |
||
457 | dec al |
||
458 | jz .scroll_on_bottom |
||
459 | dec al |
||
460 | jz .scroll_on_left |
||
461 | dec al |
||
462 | jz .scroll_on_right |
||
259 | mikedld | 463 | ret |
464 | |||
267 | mikedld | 465 | .scroll_on_top: |
466 | add ebx,(-SCRLW*2-1)*65536+SCRLW |
||
467 | mov ecx,[tab_bar.Bounds.Top] |
||
468 | shl ecx,16 |
||
469 | add ecx,1*65536+SCRLW |
||
470 | jmp .draw_tabs.draw_scroll |
||
471 | .scroll_on_bottom: |
||
472 | add ebx,(-SCRLW*2-1)*65536+SCRLW |
||
473 | jmp .draw_tabs.draw_scroll |
||
474 | .scroll_on_left: |
||
475 | mov ebx,[tab_bar.Bounds.Left] |
||
476 | add ebx,edx |
||
477 | shl ebx,16 |
||
478 | add ebx,(-SCRLW*2)*65536+SCRLW |
||
479 | jmp .draw_tabs.draw_scroll |
||
480 | .scroll_on_right: |
||
481 | shl edx,16 |
||
482 | sub ebx,edx |
||
483 | add ebx,SCRLW |
||
484 | |||
485 | .draw_tabs.draw_scroll: |
||
486 | mcall 8,,,'TBG' or 0x40000000 |
||
487 | push ebx |
||
488 | add ebx,SCRLW*65536 |
||
489 | mcall 8,,,'TBL' or 0x40000000 |
||
490 | pop ebx |
||
491 | push ebx ecx |
||
492 | sar ebx,16 |
||
493 | sar ecx,16 |
||
494 | push ebx ecx SCRLW SCRLW |
||
495 | call draw_3d_panel |
||
496 | add ebx,SCRLW |
||
497 | push ebx ecx SCRLW SCRLW |
||
498 | call draw_3d_panel |
||
499 | pop ecx ebx |
||
500 | |||
501 | push '<' |
||
502 | shr ecx,16 |
||
503 | mov bx,cx |
||
504 | add ebx,(SCRLW/2-2)*65536+SCRLW/2-3 |
||
505 | mcall 4,,[sc.work_text],esp,1 |
||
506 | add ebx,0x00020000 |
||
507 | mcall |
||
508 | add ebx,(SCRLW-2)*65536 |
||
509 | mov byte[esp],'>' |
||
510 | mcall |
||
511 | add ebx,0x00020000 |
||
512 | mcall |
||
513 | add esp,4 |
||
514 | |||
515 | ret 8 |
||
516 | |||
517 | .curr_left: |
||
518 | add ebx,0x00010000 |
||
259 | mikedld | 519 | add ecx,1*65536-2 |
267 | mikedld | 520 | ret |
521 | .curr_top: |
||
522 | add ebx,1*65536-2 |
||
523 | add ecx,0x00010000 |
||
524 | ret |
||
525 | .curr_right: |
||
526 | dec ebx |
||
527 | add ecx,1*65536-2 |
||
528 | ret |
||
529 | .curr_bottom: |
||
530 | add ebx,1*65536-2 |
||
531 | dec ecx |
||
532 | ret |
||
533 | |||
534 | .check_horz: |
||
297 | mikedld | 535 | lea eax,[esi+ebx-1] |
267 | mikedld | 536 | sub eax,[tab_bar.Bounds.Right] |
537 | jge .check.dontfit |
||
538 | add eax,SCRLW*2+2 |
||
539 | jl .check.fit |
||
540 | cmp dword[esp+4],1 |
||
541 | jbe .check.fit |
||
542 | .check.dontfit: |
||
543 | stc |
||
544 | ret |
||
545 | .check_vert: |
||
297 | mikedld | 546 | lea eax,[edi+ecx-1] |
267 | mikedld | 547 | sub eax,[tab_bar.Bounds.Bottom] |
548 | jge .check.dontfit |
||
549 | add eax,SCRLW+2 |
||
550 | jl .check.fit |
||
551 | cmp dword[esp+4],1 |
||
552 | ja .check.dontfit |
||
553 | .check.fit: |
||
554 | clc |
||
555 | ret |
||
556 | |||
557 | .next_horz: |
||
558 | movzx ebx,bx |
||
559 | lea esi,[esi+ebx+1] |
||
560 | ret |
||
561 | .next_vert: |
||
562 | movzx ecx,cx |
||
563 | lea edi,[edi+ecx+1] |
||
564 | ret |
||
565 | endf |
||
566 | |||
567 | ;----------------------------------------------------------------------------- |
||
568 | func get_tab_size ;///// GET TAB WIDTH /////////////////////////////////////// |
||
569 | ;----------------------------------------------------------------------------- |
||
570 | ; EBP = TABITEM* |
||
571 | ;----------------------------------------------------------------------------- |
||
259 | mikedld | 572 | push eax |
267 | mikedld | 573 | cmp [tab_bar.Style],3 |
574 | jae .lp1 |
||
575 | lea eax,[ebp+TABITEM.Editor.FilePath] |
||
576 | add eax,[ebp+TABITEM.Editor.FileName] |
||
297 | mikedld | 577 | cmp byte[eax],0 |
578 | jne @f |
||
579 | int3 |
||
580 | @@: |
||
267 | mikedld | 581 | call strlen |
582 | imul ebx,eax,6 |
||
583 | add ebx,9 |
||
280 | mikedld | 584 | cmp ebp,[tab_bar.Default.Ptr] |
585 | jne .lp2 |
||
586 | add ebx,13 |
||
267 | mikedld | 587 | jmp .lp2 |
588 | .lp1: call get_max_tab_width |
||
589 | mov ebx,eax |
||
590 | .lp2: mov ecx,TBARH-1 |
||
259 | mikedld | 591 | pop eax |
592 | ret |
||
267 | mikedld | 593 | endf |
259 | mikedld | 594 | |
267 | mikedld | 595 | ;----------------------------------------------------------------------------- |
596 | func get_max_tab_width ;///// GET WIDTH OF LONGEST TAB /////////////////////// |
||
597 | ;----------------------------------------------------------------------------- |
||
598 | push ebx ecx ebp |
||
599 | mov ecx,[tab_bar.Items.Count] |
||
600 | mov ebp,[tab_bar.Items] |
||
601 | xor ebx,ebx |
||
602 | @@: dec ecx |
||
603 | js @f |
||
604 | |||
605 | lea eax,[ebp+TABITEM.Editor.FilePath] |
||
606 | add eax,[ebp+TABITEM.Editor.FileName] |
||
607 | call strlen |
||
608 | imul eax,6 |
||
609 | add eax,9 |
||
610 | |||
611 | add ebp,sizeof.TABITEM |
||
612 | cmp ebx,eax |
||
613 | jae @b |
||
614 | mov ebx,eax |
||
615 | jmp @b |
||
616 | @@: mov eax,ebx |
||
617 | cmp eax,SCRLW*2+2 |
||
618 | jae @f |
||
619 | mov eax,SCRLW*2+2 |
||
280 | mikedld | 620 | @@: cmp [tab_bar.Default.Ptr],0 |
621 | je @f |
||
622 | add eax,13 |
||
267 | mikedld | 623 | @@: pop ebp ecx ebx |
259 | mikedld | 624 | ret |
625 | endf |
||
626 | |||
267 | mikedld | 627 | ;----------------------------------------------------------------------------- |
628 | func get_hidden_tabitems_number ;///////////////////////////////////////////// |
||
629 | ;----------------------------------------------------------------------------- |
||
630 | mov al,[tab_bar.Style] |
||
631 | dec al |
||
632 | dec al |
||
633 | jle .tabs_horz |
||
634 | dec al |
||
635 | dec al |
||
636 | jle .tabs_vert |
||
259 | mikedld | 637 | ret |
267 | mikedld | 638 | |
639 | .tabs_horz: |
||
640 | push draw_tabctl.check_horz draw_tabctl.next_horz |
||
641 | call .calc_tabs |
||
642 | ret |
||
643 | |||
644 | .tabs_vert: |
||
645 | push draw_tabctl.check_vert draw_tabctl.next_vert |
||
646 | call .calc_tabs |
||
647 | ret |
||
648 | |||
649 | .calc_tabs: |
||
650 | mov esi,[tab_bar.Bounds.Left] |
||
651 | inc esi |
||
652 | mov edi,[tab_bar.Bounds.Top] |
||
653 | inc edi |
||
654 | mov ecx,[tab_bar.Items.Count] |
||
297 | mikedld | 655 | mov ebx,[tab_bar.Items.Left] |
656 | imul ebp,ebx,sizeof.TABITEM |
||
280 | mikedld | 657 | add ebp,[tab_bar.Items] |
297 | mikedld | 658 | push ecx |
659 | sub [esp],ebx |
||
267 | mikedld | 660 | @@: push ecx |
661 | |||
662 | call get_tab_size |
||
663 | |||
664 | call dword[esp+(8+4)+4] |
||
665 | jc .calc_tabs.dontfit |
||
666 | |||
667 | call dword[esp+(8+4)+0] |
||
668 | add ebp,sizeof.TABITEM |
||
669 | |||
670 | pop ecx |
||
671 | dec ecx |
||
672 | dec dword[esp] |
||
673 | jnz @b |
||
674 | |||
675 | jmp @f |
||
676 | |||
677 | .calc_tabs.dontfit: |
||
678 | |||
679 | add esp,4 |
||
680 | @@: pop ecx |
||
681 | mov eax,ecx |
||
682 | ret 8 |
||
259 | mikedld | 683 | endf |
684 | |||
267 | mikedld | 685 | ;----------------------------------------------------------------------------- |
686 | func align_editor_in_tab ;///// ADJUST EDITOR POSITION TO FIT IN TAB ///////// |
||
687 | ;----------------------------------------------------------------------------- |
||
688 | m2m [cur_editor.Bounds.Left],[tab_bar.Bounds.Left] |
||
689 | m2m [cur_editor.Bounds.Top],[tab_bar.Bounds.Top] |
||
690 | m2m [cur_editor.Bounds.Right],[tab_bar.Bounds.Right] |
||
691 | m2m [cur_editor.Bounds.Bottom],[tab_bar.Bounds.Bottom] |
||
259 | mikedld | 692 | |
267 | mikedld | 693 | inc [cur_editor.Bounds.Left] |
694 | inc [cur_editor.Bounds.Top] |
||
695 | dec [cur_editor.Bounds.Right] |
||
696 | dec [cur_editor.Bounds.Bottom] |
||
259 | mikedld | 697 | |
267 | mikedld | 698 | call get_max_tab_width |
699 | lea ebx,[eax+1] |
||
700 | |||
259 | mikedld | 701 | mov al,[tab_bar.Style] |
702 | dec al |
||
703 | jz .tabs_on_top |
||
704 | dec al |
||
705 | jz .tabs_on_bottom |
||
706 | dec al |
||
707 | jz .tabs_on_left |
||
708 | dec al |
||
709 | jz .tabs_on_right |
||
710 | ret |
||
711 | |||
712 | .tabs_on_top: |
||
267 | mikedld | 713 | add [cur_editor.Bounds.Top],TBARH |
259 | mikedld | 714 | ret |
715 | |||
716 | .tabs_on_bottom: |
||
267 | mikedld | 717 | sub [cur_editor.Bounds.Bottom],TBARH |
259 | mikedld | 718 | ret |
719 | |||
720 | .tabs_on_left: |
||
267 | mikedld | 721 | add [cur_editor.Bounds.Left],ebx |
259 | mikedld | 722 | ret |
723 | |||
724 | .tabs_on_right: |
||
267 | mikedld | 725 | sub [cur_editor.Bounds.Right],ebx |
259 | mikedld | 726 | ret |
267 | mikedld | 727 | endf' |