2008-07-16 08:55:19 +04:00
|
|
|
diff16 'tp-tabctl.asm',0,$
|
|
|
|
|
2007-01-03 21:22:05 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc flush_cur_tab ;///// SAVE CURRENT TAB DATA TO CONTROL ///////////////////
|
2007-01-03 21:22:05 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
; EBP = TABITEM*
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
push ecx esi edi
|
|
|
|
mov edi,[tab_bar.Current.Ptr]
|
2007-09-18 04:41:58 +04:00
|
|
|
or edi,edi
|
|
|
|
jz @f
|
|
|
|
mov esi,cur_tab
|
2007-01-03 21:22:05 +03:00
|
|
|
mov ecx,sizeof.TABITEM/4
|
|
|
|
cld
|
|
|
|
rep movsd
|
2007-09-18 04:41:58 +04:00
|
|
|
@@: pop edi esi ecx
|
2007-01-03 21:22:05 +03:00
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2007-01-03 21:22:05 +03:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc set_cur_tab ;///// SET SPECIFIED TAB CURRENT (FOCUS IT) /////////////////
|
2007-01-03 21:22:05 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
; EBP = TABITEM*
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
push ecx esi edi
|
|
|
|
call flush_cur_tab
|
2007-09-18 04:41:58 +04:00
|
|
|
mov esi,ebp
|
2007-01-03 21:22:05 +03:00
|
|
|
mov edi,cur_tab
|
|
|
|
mov ecx,sizeof.TABITEM/4
|
|
|
|
rep movsd
|
|
|
|
mov [tab_bar.Current.Ptr],ebp
|
2007-01-28 02:36:07 +03:00
|
|
|
; call update_caption
|
2007-01-03 21:22:05 +03:00
|
|
|
pop edi esi ecx
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2007-01-03 21:22:05 +03:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc make_tab_visible ;///// MAKE SPECIFIED TAB VISIBLE IF IT'S OFFSCREEN ////
|
2007-01-10 09:03:39 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
2007-01-28 02:36:07 +03:00
|
|
|
call flush_cur_tab
|
2007-01-10 09:03:39 +03:00
|
|
|
imul eax,[tab_bar.Items.Left],sizeof.TABITEM
|
|
|
|
add eax,[tab_bar.Items]
|
|
|
|
cmp eax,ebp
|
|
|
|
jb .go_right
|
|
|
|
ja .go_left
|
|
|
|
ret
|
|
|
|
|
|
|
|
.go_right:
|
2007-01-19 00:14:15 +03:00
|
|
|
push ebp
|
2007-01-10 09:03:39 +03:00
|
|
|
call get_hidden_tabitems_number
|
|
|
|
cmp ebp,[esp]
|
2007-01-28 02:36:07 +03:00
|
|
|
ja @f
|
2007-01-10 09:03:39 +03:00
|
|
|
@@: inc [tab_bar.Items.Left]
|
|
|
|
call get_hidden_tabitems_number
|
|
|
|
cmp ebp,[esp]
|
|
|
|
jbe @b
|
2007-01-28 02:36:07 +03:00
|
|
|
@@: pop ebp
|
2007-01-10 09:03:39 +03:00
|
|
|
ret
|
|
|
|
|
|
|
|
.go_left:
|
|
|
|
mov eax,ebp
|
|
|
|
sub eax,[tab_bar.Items]
|
|
|
|
jz @f
|
2007-01-28 02:36:07 +03:00
|
|
|
cdq
|
2007-01-10 09:03:39 +03:00
|
|
|
mov ebx,sizeof.TABITEM
|
|
|
|
div ebx
|
|
|
|
@@: mov [tab_bar.Items.Left],eax
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2007-01-10 09:03:39 +03:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc create_tab ;///// ADD TAB TO THE END ////////////////////////////////////
|
2007-01-03 21:22:05 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
push eax ecx esi edi
|
|
|
|
|
|
|
|
inc [tab_bar.Items.Count]
|
|
|
|
imul ebx,[tab_bar.Items.Count],sizeof.TABITEM
|
|
|
|
mov eax,[tab_bar.Items]
|
|
|
|
mov ecx,eax
|
2007-09-02 01:38:00 +04:00
|
|
|
stdcall mem.ReAlloc,eax,ebx
|
2007-01-03 21:22:05 +03:00
|
|
|
mov [tab_bar.Items],eax
|
|
|
|
sub ecx,eax
|
|
|
|
sub [tab_bar.Current.Ptr],ecx
|
2007-01-19 00:14:15 +03:00
|
|
|
cmp [tab_bar.Default.Ptr],0
|
|
|
|
je @f
|
|
|
|
sub [tab_bar.Default.Ptr],ecx
|
|
|
|
@@: lea ebp,[eax+ebx-sizeof.TABITEM]
|
2007-01-03 21:22:05 +03:00
|
|
|
call set_cur_tab
|
|
|
|
|
|
|
|
mov eax,1024
|
2007-01-19 00:14:15 +03:00
|
|
|
mov [cur_editor.Lines.Size],eax
|
2007-09-02 01:38:00 +04:00
|
|
|
stdcall mem.Alloc,eax
|
2007-01-10 09:03:39 +03:00
|
|
|
mov [cur_editor.Lines],eax
|
|
|
|
mov [cur_editor.Lines.Count],1
|
|
|
|
mov [cur_editor.Columns.Count],1
|
2007-01-03 21:22:05 +03:00
|
|
|
xor eax,eax
|
2007-01-10 09:03:39 +03:00
|
|
|
mov [cur_editor.TopLeft.X],eax
|
|
|
|
mov [cur_editor.TopLeft.Y],eax
|
|
|
|
mov [cur_editor.Caret.X],eax
|
|
|
|
mov [cur_editor.Caret.Y],eax
|
|
|
|
mov [cur_editor.SelStart.X],eax
|
|
|
|
mov [cur_editor.SelStart.Y],eax
|
|
|
|
mov edi,[cur_editor.Lines]
|
2008-12-29 22:08:59 +03:00
|
|
|
add edi,sizeof.EDITOR_LINE_DATA
|
2007-01-03 21:22:05 +03:00
|
|
|
mov ecx,10
|
2008-12-29 22:08:59 +03:00
|
|
|
mov [edi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size],ecx
|
2007-01-03 21:22:05 +03:00
|
|
|
mov [edi+10],eax
|
|
|
|
mov al,' '
|
|
|
|
cld
|
|
|
|
rep stosb
|
|
|
|
|
|
|
|
mov esi,s_defname
|
2007-07-29 06:06:58 +04:00
|
|
|
mov edi,cur_editor.FilePath + 1
|
2007-01-03 21:22:05 +03:00
|
|
|
mov ecx,s_defname.size
|
|
|
|
rep movsb
|
2007-07-29 06:06:58 +04:00
|
|
|
mov [cur_editor.FileName],1
|
2007-01-03 21:22:05 +03:00
|
|
|
|
2007-01-10 09:03:39 +03:00
|
|
|
mov [cur_editor.Modified],0
|
|
|
|
mov [cur_editor.AsmMode],0
|
2007-01-03 21:22:05 +03:00
|
|
|
|
|
|
|
call flush_cur_tab
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ebp,[tab_bar.Current.Ptr]
|
|
|
|
call make_tab_visible
|
2007-01-03 21:22:05 +03:00
|
|
|
call update_caption
|
2007-01-19 00:14:15 +03:00
|
|
|
cmp [do_not_draw],0
|
|
|
|
jne @f
|
|
|
|
call align_editor_in_tab
|
|
|
|
call draw_editor
|
|
|
|
call draw_tabctl
|
|
|
|
call draw_statusbar
|
2007-01-28 02:36:07 +03:00
|
|
|
call update_caption
|
2007-01-19 00:14:15 +03:00
|
|
|
@@:
|
2007-01-03 21:22:05 +03:00
|
|
|
mov ebp,cur_tab
|
|
|
|
pop edi esi ecx eax
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2007-01-03 21:22:05 +03:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc delete_tab ;///// DELETE SPECIFIED TAB //////////////////////////////////
|
2007-01-03 21:22:05 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
2007-01-19 00:14:15 +03:00
|
|
|
cmp [tab_bar.Default.Ptr],0
|
|
|
|
je @f
|
|
|
|
cmp ebp,[tab_bar.Default.Ptr]
|
|
|
|
je .lp1
|
|
|
|
ja @f
|
|
|
|
sub [tab_bar.Default.Ptr],sizeof.TABITEM
|
|
|
|
jmp @f
|
|
|
|
.lp1:
|
|
|
|
mov [tab_bar.Default.Ptr],0
|
|
|
|
|
2007-09-02 01:38:00 +04:00
|
|
|
@@: stdcall mem.Free,[ebp+TABITEM.Editor.Lines]
|
2007-01-10 09:03:39 +03:00
|
|
|
imul ecx,[tab_bar.Items.Count],sizeof.TABITEM
|
|
|
|
add ecx,[tab_bar.Items]
|
|
|
|
sub ecx,ebp
|
|
|
|
sub ecx,sizeof.TABITEM
|
|
|
|
jle @f
|
|
|
|
cld
|
|
|
|
shr ecx,2
|
|
|
|
mov edi,ebp
|
|
|
|
lea esi,[edi+sizeof.TABITEM]
|
|
|
|
rep movsd
|
|
|
|
@@: dec [tab_bar.Items.Count]
|
|
|
|
jz .no_tabs
|
|
|
|
imul ebx,[tab_bar.Items.Count],sizeof.TABITEM
|
|
|
|
push ebx
|
|
|
|
mov eax,[tab_bar.Items]
|
|
|
|
mov ecx,eax
|
2007-09-02 01:38:00 +04:00
|
|
|
stdcall mem.ReAlloc,eax,ebx
|
2007-01-10 09:03:39 +03:00
|
|
|
mov [tab_bar.Items],eax
|
|
|
|
sub ecx,eax
|
|
|
|
sub ebp,ecx
|
2007-01-19 00:14:15 +03:00
|
|
|
cmp [tab_bar.Default.Ptr],0
|
|
|
|
je @f
|
|
|
|
sub [tab_bar.Default.Ptr],ecx
|
|
|
|
@@:
|
2007-01-10 09:03:39 +03:00
|
|
|
pop ecx
|
|
|
|
add ecx,[tab_bar.Items]
|
|
|
|
sub ecx,ebp
|
|
|
|
ja @f
|
|
|
|
add ebp,-sizeof.TABITEM
|
|
|
|
|
|
|
|
@@: mov [tab_bar.Current.Ptr],0
|
|
|
|
call set_cur_tab
|
|
|
|
call make_tab_visible
|
2007-01-19 00:14:15 +03:00
|
|
|
call align_editor_in_tab
|
|
|
|
call draw_editor
|
|
|
|
call draw_tabctl
|
|
|
|
call draw_statusbar
|
2007-01-03 21:22:05 +03:00
|
|
|
ret
|
|
|
|
|
2007-01-10 09:03:39 +03:00
|
|
|
.no_tabs:
|
2007-09-02 01:38:00 +04:00
|
|
|
stdcall mem.Free,[tab_bar.Items]
|
2007-01-19 00:14:15 +03:00
|
|
|
xor eax,eax
|
|
|
|
mov [tab_bar.Items],eax
|
|
|
|
mov [tab_bar.Current.Ptr],eax
|
|
|
|
mov [tab_bar.Default.Ptr],eax
|
2007-01-03 21:22:05 +03:00
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2007-01-03 21:22:05 +03:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc draw_tabctl ;///// DRAW TAB CONTROL /////////////////////////////////////
|
2007-01-03 21:22:05 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
|
2007-01-10 09:03:39 +03:00
|
|
|
dec [tab_bar.Items.Left]
|
|
|
|
js .lp1
|
|
|
|
@@: call get_hidden_tabitems_number
|
|
|
|
or eax,eax
|
|
|
|
jnz .lp1
|
|
|
|
dec [tab_bar.Items.Left]
|
|
|
|
jns @b
|
|
|
|
.lp1: inc [tab_bar.Items.Left]
|
|
|
|
mov eax,[tab_bar.Items.Count]
|
|
|
|
cmp [tab_bar.Items.Left],eax
|
|
|
|
jb @f
|
|
|
|
dec eax
|
|
|
|
mov [tab_bar.Items.Left],eax
|
|
|
|
@@:
|
|
|
|
|
|
|
|
mov eax,8
|
|
|
|
mov edx,[tab_bar.Buttons.First]
|
|
|
|
@@: cmp edx,[tab_bar.Buttons.Last]
|
|
|
|
ja @f
|
|
|
|
push edx
|
|
|
|
or edx,0x80000000
|
|
|
|
mcall
|
|
|
|
pop edx
|
|
|
|
inc edx
|
|
|
|
jmp @b
|
|
|
|
@@:
|
|
|
|
|
2007-01-03 21:22:05 +03:00
|
|
|
mov ebx,[tab_bar.Bounds.Left-2]
|
|
|
|
mov bx,word[tab_bar.Bounds.Right]
|
|
|
|
sub bx,word[tab_bar.Bounds.Left]
|
|
|
|
inc ebx
|
|
|
|
mov ecx,[tab_bar.Bounds.Top-2]
|
|
|
|
mov cx,word[tab_bar.Bounds.Bottom]
|
|
|
|
sub cx,word[tab_bar.Bounds.Top]
|
|
|
|
inc ecx
|
|
|
|
mov edx,[cl_3d_normal]
|
|
|
|
call draw_framerect
|
|
|
|
|
|
|
|
mov al,[tab_bar.Style]
|
|
|
|
dec al
|
|
|
|
jz .tabs_on_top
|
|
|
|
dec al
|
|
|
|
jz .tabs_on_bottom
|
|
|
|
dec al
|
|
|
|
jz .tabs_on_left
|
|
|
|
dec al
|
|
|
|
jz .tabs_on_right
|
|
|
|
ret
|
|
|
|
|
|
|
|
.tabs_on_top:
|
|
|
|
add ebx,1*65536-2
|
|
|
|
mov ecx,[tab_bar.Bounds.Top-2]
|
|
|
|
xor cx,cx
|
|
|
|
add ecx,1*65536+TBARH
|
|
|
|
mcall 13
|
2007-01-10 09:03:39 +03:00
|
|
|
add ecx,(TBARH-1)*65536-(TBARH-1)
|
|
|
|
mcall ,,,[sc.work]
|
|
|
|
add ecx,-1*65536+2
|
2007-01-03 21:22:05 +03:00
|
|
|
mov edx,[cl_3d_inset]
|
|
|
|
call draw_framerect
|
2007-01-10 09:03:39 +03:00
|
|
|
|
|
|
|
mov esi,[tab_bar.Bounds.Left]
|
|
|
|
inc esi
|
|
|
|
mov edi,[tab_bar.Bounds.Top]
|
|
|
|
inc edi
|
|
|
|
push .curr_top .check_horz .next_horz
|
|
|
|
call .draw_tabs
|
2007-01-03 21:22:05 +03:00
|
|
|
ret
|
|
|
|
|
|
|
|
.tabs_on_bottom:
|
|
|
|
add ebx,1*65536-2
|
|
|
|
mov ecx,[tab_bar.Bounds.Bottom-2]
|
|
|
|
xor cx,cx
|
|
|
|
add ecx,-TBARH*65536+TBARH
|
|
|
|
mcall 13
|
|
|
|
mov cx,1
|
|
|
|
mcall ,,,[sc.work]
|
2007-01-10 09:03:39 +03:00
|
|
|
add ecx,-1*65536+2
|
2007-01-03 21:22:05 +03:00
|
|
|
mov edx,[cl_3d_inset]
|
|
|
|
call draw_framerect
|
|
|
|
|
|
|
|
mov esi,[tab_bar.Bounds.Left]
|
|
|
|
inc esi
|
|
|
|
mov edi,[tab_bar.Bounds.Bottom]
|
|
|
|
add edi,-TBARH+1
|
2007-01-10 09:03:39 +03:00
|
|
|
push .curr_bottom .check_horz .next_horz
|
|
|
|
call .draw_tabs
|
|
|
|
ret
|
|
|
|
|
|
|
|
.tabs_on_left:
|
|
|
|
call get_max_tab_width
|
|
|
|
mov ebx,[tab_bar.Bounds.Left-2]
|
|
|
|
mov bx,ax
|
|
|
|
add ebx,1*65536-1
|
|
|
|
add ecx,1*65536-2
|
|
|
|
push eax
|
|
|
|
mcall 13
|
|
|
|
pop ebx
|
|
|
|
shl ebx,16
|
|
|
|
add ebx,1*65536+1
|
|
|
|
mcall ,,,[sc.work]
|
|
|
|
add ebx,-1*65536+2
|
|
|
|
mov edx,[cl_3d_inset]
|
|
|
|
call draw_framerect
|
|
|
|
|
|
|
|
mov esi,[tab_bar.Bounds.Left]
|
|
|
|
inc esi
|
|
|
|
mov edi,[tab_bar.Bounds.Top]
|
|
|
|
inc edi
|
|
|
|
push .curr_left .check_vert .next_vert
|
|
|
|
call .draw_tabs
|
|
|
|
ret
|
|
|
|
|
|
|
|
.tabs_on_right:
|
|
|
|
call get_max_tab_width
|
|
|
|
push eax
|
|
|
|
mov ebx,[tab_bar.Bounds.Right-2]
|
|
|
|
mov bx,ax
|
|
|
|
shl eax,16
|
|
|
|
sub ebx,eax
|
|
|
|
add ecx,1*65536-2
|
|
|
|
mcall 13
|
|
|
|
add ebx,-1*65536
|
|
|
|
mov bx,1
|
|
|
|
mcall ,,,[sc.work]
|
|
|
|
add ebx,-1*65536+2
|
|
|
|
mov edx,[cl_3d_inset]
|
|
|
|
call draw_framerect
|
|
|
|
|
|
|
|
mov esi,[tab_bar.Bounds.Right]
|
|
|
|
pop eax
|
|
|
|
sub esi,eax
|
|
|
|
mov edi,[tab_bar.Bounds.Top]
|
|
|
|
inc edi
|
|
|
|
push .curr_right .check_vert .next_vert
|
|
|
|
call .draw_tabs
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
.draw_tabs:
|
|
|
|
mov ecx,[tab_bar.Items.Count]
|
|
|
|
mov ebx,[tab_bar.Items.Left]
|
|
|
|
imul ebp,ebx,sizeof.TABITEM
|
|
|
|
add ebp,[tab_bar.Items]
|
|
|
|
push ecx
|
|
|
|
sub [esp],ebx
|
|
|
|
add ebx,1000
|
|
|
|
mov [tab_bar.Buttons.First],ebx
|
|
|
|
dec ebx
|
|
|
|
mov [tab_bar.Buttons.Last],ebx
|
2007-01-03 21:22:05 +03:00
|
|
|
@@: push ecx
|
|
|
|
|
|
|
|
call get_tab_size
|
2007-01-10 09:03:39 +03:00
|
|
|
|
|
|
|
call dword[esp+(8+4)+4]
|
|
|
|
jc .draw_tabs.dontfit
|
|
|
|
|
2007-01-03 21:22:05 +03:00
|
|
|
rol ebx,16
|
|
|
|
mov bx,si
|
|
|
|
rol ebx,16
|
|
|
|
rol ecx,16
|
|
|
|
mov cx,di
|
|
|
|
rol ecx,16
|
|
|
|
mov edx,[cl_3d_inset]
|
|
|
|
call draw_framerect
|
|
|
|
|
2007-01-10 09:03:39 +03:00
|
|
|
mov edx,[sc.work_text]
|
2007-01-03 21:22:05 +03:00
|
|
|
cmp ebp,[tab_bar.Current.Ptr]
|
2007-01-10 09:03:39 +03:00
|
|
|
jne .draw_tabs.inactive
|
2007-01-03 21:22:05 +03:00
|
|
|
push ebx ecx
|
2007-01-10 09:03:39 +03:00
|
|
|
call dword[esp+(8+4)+8+8]
|
2007-01-03 21:22:05 +03:00
|
|
|
mcall 13,,,[sc.work]
|
|
|
|
pop ecx ebx
|
2007-09-02 01:38:00 +04:00
|
|
|
mov edx,[sc.work_text];[color_tbl.text]
|
2007-01-10 09:03:39 +03:00
|
|
|
.draw_tabs.inactive:
|
|
|
|
|
2007-01-19 00:14:15 +03:00
|
|
|
cmp ebp,[tab_bar.Default.Ptr]
|
|
|
|
jne .draw_tabs.notdefault
|
|
|
|
push ebx ecx edx
|
|
|
|
add ebx,3*65536
|
|
|
|
add ecx,(TBARH/2-6)*65536
|
|
|
|
mov bx,11
|
|
|
|
mov cx,bx
|
|
|
|
call draw_framerect
|
|
|
|
add ebx,1*65536-2
|
|
|
|
add ecx,1*65536-2
|
|
|
|
mcall 13,,,[sc.work]
|
|
|
|
shr ebx,16
|
|
|
|
shr ecx,16
|
|
|
|
add ebx,2
|
|
|
|
add ecx,3
|
|
|
|
mov edx,[esp]
|
|
|
|
call draw_check
|
|
|
|
pop edx ecx ebx
|
|
|
|
.draw_tabs.notdefault:
|
|
|
|
|
2007-01-10 09:03:39 +03:00
|
|
|
push ebx ecx esi edx
|
2007-01-03 21:22:05 +03:00
|
|
|
lea eax,[ebp+TABITEM.Editor.FilePath]
|
|
|
|
add eax,[ebp+TABITEM.Editor.FileName]
|
|
|
|
mov edx,eax
|
|
|
|
call strlen
|
|
|
|
mov esi,eax
|
|
|
|
shr ecx,16
|
|
|
|
mov bx,cx
|
2007-01-19 00:14:15 +03:00
|
|
|
add ebx,5*65536+TBARH/2-4
|
2007-01-10 09:03:39 +03:00
|
|
|
pop ecx
|
2007-01-19 00:14:15 +03:00
|
|
|
cmp ebp,[tab_bar.Default.Ptr]
|
|
|
|
jne .lp2
|
|
|
|
add ebx,13*65536
|
|
|
|
.lp2: mcall 4
|
2007-01-10 09:03:39 +03:00
|
|
|
pop esi ecx ebx
|
2007-01-03 21:22:05 +03:00
|
|
|
|
2007-01-10 09:03:39 +03:00
|
|
|
inc [tab_bar.Buttons.Last]
|
|
|
|
cmp ebp,[tab_bar.Current.Ptr]
|
|
|
|
je .draw_tabs.active
|
|
|
|
push ebx ecx
|
|
|
|
dec ebx
|
|
|
|
dec ecx
|
|
|
|
mov edx,[tab_bar.Buttons.Last]
|
|
|
|
or edx,0x40000000
|
|
|
|
mcall 8
|
|
|
|
pop ecx ebx
|
|
|
|
.draw_tabs.active:
|
|
|
|
|
|
|
|
call dword[esp+(8+4)+0]
|
2007-01-03 21:22:05 +03:00
|
|
|
add ebp,sizeof.TABITEM
|
|
|
|
|
|
|
|
pop ecx
|
|
|
|
dec ecx
|
2007-01-10 09:03:39 +03:00
|
|
|
dec dword[esp]
|
2007-01-03 21:22:05 +03:00
|
|
|
jnz @b
|
|
|
|
|
2007-01-10 09:03:39 +03:00
|
|
|
add esp,4
|
|
|
|
or ecx,ecx
|
|
|
|
jnz @f
|
2007-01-03 21:22:05 +03:00
|
|
|
|
2007-01-10 09:03:39 +03:00
|
|
|
ret 8
|
|
|
|
|
|
|
|
.draw_tabs.dontfit:
|
|
|
|
|
|
|
|
add esp,8
|
|
|
|
|
|
|
|
@@: mov ebx,[tab_bar.Bounds.Right]
|
|
|
|
shl ebx,16
|
|
|
|
mov ecx,[tab_bar.Bounds.Bottom]
|
|
|
|
shl ecx,16
|
|
|
|
add ecx,(-SCRLW-1)*65536+SCRLW
|
2007-01-03 21:22:05 +03:00
|
|
|
call get_max_tab_width
|
2007-01-10 09:03:39 +03:00
|
|
|
mov edx,eax
|
|
|
|
|
|
|
|
mov al,[tab_bar.Style]
|
|
|
|
dec al
|
|
|
|
jz .scroll_on_top
|
|
|
|
dec al
|
|
|
|
jz .scroll_on_bottom
|
|
|
|
dec al
|
|
|
|
jz .scroll_on_left
|
|
|
|
dec al
|
|
|
|
jz .scroll_on_right
|
|
|
|
ret
|
|
|
|
|
|
|
|
.scroll_on_top:
|
|
|
|
add ebx,(-SCRLW*2-1)*65536+SCRLW
|
|
|
|
mov ecx,[tab_bar.Bounds.Top]
|
|
|
|
shl ecx,16
|
|
|
|
add ecx,1*65536+SCRLW
|
|
|
|
jmp .draw_tabs.draw_scroll
|
|
|
|
.scroll_on_bottom:
|
|
|
|
add ebx,(-SCRLW*2-1)*65536+SCRLW
|
|
|
|
jmp .draw_tabs.draw_scroll
|
|
|
|
.scroll_on_left:
|
|
|
|
mov ebx,[tab_bar.Bounds.Left]
|
|
|
|
add ebx,edx
|
|
|
|
shl ebx,16
|
|
|
|
add ebx,(-SCRLW*2)*65536+SCRLW
|
|
|
|
jmp .draw_tabs.draw_scroll
|
|
|
|
.scroll_on_right:
|
|
|
|
shl edx,16
|
|
|
|
sub ebx,edx
|
|
|
|
add ebx,SCRLW
|
|
|
|
|
|
|
|
.draw_tabs.draw_scroll:
|
|
|
|
mcall 8,,,'TBG' or 0x40000000
|
|
|
|
push ebx
|
|
|
|
add ebx,SCRLW*65536
|
|
|
|
mcall 8,,,'TBL' or 0x40000000
|
|
|
|
pop ebx
|
|
|
|
push ebx ecx
|
|
|
|
sar ebx,16
|
|
|
|
sar ecx,16
|
|
|
|
push ebx ecx SCRLW SCRLW
|
|
|
|
call draw_3d_panel
|
|
|
|
add ebx,SCRLW
|
|
|
|
push ebx ecx SCRLW SCRLW
|
|
|
|
call draw_3d_panel
|
|
|
|
pop ecx ebx
|
|
|
|
|
|
|
|
push '<'
|
|
|
|
shr ecx,16
|
|
|
|
mov bx,cx
|
|
|
|
add ebx,(SCRLW/2-2)*65536+SCRLW/2-3
|
|
|
|
mcall 4,,[sc.work_text],esp,1
|
|
|
|
add ebx,0x00020000
|
|
|
|
mcall
|
|
|
|
add ebx,(SCRLW-2)*65536
|
|
|
|
mov byte[esp],'>'
|
|
|
|
mcall
|
|
|
|
add ebx,0x00020000
|
|
|
|
mcall
|
|
|
|
add esp,4
|
|
|
|
|
|
|
|
ret 8
|
|
|
|
|
|
|
|
.curr_left:
|
|
|
|
add ebx,0x00010000
|
|
|
|
add ecx,1*65536-2
|
|
|
|
ret
|
|
|
|
.curr_top:
|
|
|
|
add ebx,1*65536-2
|
|
|
|
add ecx,0x00010000
|
|
|
|
ret
|
|
|
|
.curr_right:
|
|
|
|
dec ebx
|
2007-01-03 21:22:05 +03:00
|
|
|
add ecx,1*65536-2
|
2007-01-10 09:03:39 +03:00
|
|
|
ret
|
|
|
|
.curr_bottom:
|
|
|
|
add ebx,1*65536-2
|
|
|
|
dec ecx
|
|
|
|
ret
|
|
|
|
|
|
|
|
.check_horz:
|
2007-01-28 02:36:07 +03:00
|
|
|
lea eax,[esi+ebx-1]
|
2007-01-10 09:03:39 +03:00
|
|
|
sub eax,[tab_bar.Bounds.Right]
|
|
|
|
jge .check.dontfit
|
|
|
|
add eax,SCRLW*2+2
|
|
|
|
jl .check.fit
|
|
|
|
cmp dword[esp+4],1
|
|
|
|
jbe .check.fit
|
|
|
|
.check.dontfit:
|
|
|
|
stc
|
|
|
|
ret
|
|
|
|
.check_vert:
|
2007-01-28 02:36:07 +03:00
|
|
|
lea eax,[edi+ecx-1]
|
2007-01-10 09:03:39 +03:00
|
|
|
sub eax,[tab_bar.Bounds.Bottom]
|
|
|
|
jge .check.dontfit
|
|
|
|
add eax,SCRLW+2
|
|
|
|
jl .check.fit
|
|
|
|
cmp dword[esp+4],1
|
|
|
|
ja .check.dontfit
|
|
|
|
.check.fit:
|
|
|
|
clc
|
|
|
|
ret
|
|
|
|
|
|
|
|
.next_horz:
|
|
|
|
movzx ebx,bx
|
|
|
|
lea esi,[esi+ebx+1]
|
|
|
|
ret
|
|
|
|
.next_vert:
|
|
|
|
movzx ecx,cx
|
|
|
|
lea edi,[edi+ecx+1]
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2007-01-10 09:03:39 +03:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc get_tab_size ;///// GET TAB WIDTH ///////////////////////////////////////
|
2007-01-10 09:03:39 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
; EBP = TABITEM*
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-01-03 21:22:05 +03:00
|
|
|
push eax
|
2007-01-10 09:03:39 +03:00
|
|
|
cmp [tab_bar.Style],3
|
|
|
|
jae .lp1
|
|
|
|
lea eax,[ebp+TABITEM.Editor.FilePath]
|
|
|
|
add eax,[ebp+TABITEM.Editor.FileName]
|
|
|
|
call strlen
|
|
|
|
imul ebx,eax,6
|
|
|
|
add ebx,9
|
2007-01-19 00:14:15 +03:00
|
|
|
cmp ebp,[tab_bar.Default.Ptr]
|
|
|
|
jne .lp2
|
|
|
|
add ebx,13
|
2007-01-10 09:03:39 +03:00
|
|
|
jmp .lp2
|
|
|
|
.lp1: call get_max_tab_width
|
|
|
|
mov ebx,eax
|
|
|
|
.lp2: mov ecx,TBARH-1
|
2007-01-03 21:22:05 +03:00
|
|
|
pop eax
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2007-01-03 21:22:05 +03:00
|
|
|
|
2007-01-10 09:03:39 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc get_max_tab_width ;///// GET WIDTH OF LONGEST TAB ///////////////////////
|
2007-01-10 09:03:39 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
push ebx ecx ebp
|
|
|
|
mov ecx,[tab_bar.Items.Count]
|
|
|
|
mov ebp,[tab_bar.Items]
|
|
|
|
xor ebx,ebx
|
|
|
|
@@: dec ecx
|
|
|
|
js @f
|
|
|
|
|
|
|
|
lea eax,[ebp+TABITEM.Editor.FilePath]
|
|
|
|
add eax,[ebp+TABITEM.Editor.FileName]
|
|
|
|
call strlen
|
|
|
|
imul eax,6
|
|
|
|
add eax,9
|
|
|
|
|
|
|
|
add ebp,sizeof.TABITEM
|
|
|
|
cmp ebx,eax
|
|
|
|
jae @b
|
|
|
|
mov ebx,eax
|
|
|
|
jmp @b
|
|
|
|
@@: mov eax,ebx
|
|
|
|
cmp eax,SCRLW*2+2
|
|
|
|
jae @f
|
|
|
|
mov eax,SCRLW*2+2
|
2007-01-19 00:14:15 +03:00
|
|
|
@@: cmp [tab_bar.Default.Ptr],0
|
|
|
|
je @f
|
|
|
|
add eax,13
|
2007-01-10 09:03:39 +03:00
|
|
|
@@: pop ebp ecx ebx
|
2007-01-03 21:22:05 +03:00
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2007-01-03 21:22:05 +03:00
|
|
|
|
2007-01-10 09:03:39 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc get_hidden_tabitems_number ;/////////////////////////////////////////////
|
2007-01-10 09:03:39 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
mov al,[tab_bar.Style]
|
|
|
|
dec al
|
|
|
|
dec al
|
|
|
|
jle .tabs_horz
|
|
|
|
dec al
|
|
|
|
dec al
|
|
|
|
jle .tabs_vert
|
|
|
|
ret
|
|
|
|
|
|
|
|
.tabs_horz:
|
|
|
|
push draw_tabctl.check_horz draw_tabctl.next_horz
|
|
|
|
call .calc_tabs
|
|
|
|
ret
|
|
|
|
|
|
|
|
.tabs_vert:
|
|
|
|
push draw_tabctl.check_vert draw_tabctl.next_vert
|
|
|
|
call .calc_tabs
|
2007-01-03 21:22:05 +03:00
|
|
|
ret
|
2007-01-10 09:03:39 +03:00
|
|
|
|
|
|
|
.calc_tabs:
|
|
|
|
mov esi,[tab_bar.Bounds.Left]
|
|
|
|
inc esi
|
|
|
|
mov edi,[tab_bar.Bounds.Top]
|
|
|
|
inc edi
|
|
|
|
mov ecx,[tab_bar.Items.Count]
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ebx,[tab_bar.Items.Left]
|
|
|
|
imul ebp,ebx,sizeof.TABITEM
|
2007-01-19 00:14:15 +03:00
|
|
|
add ebp,[tab_bar.Items]
|
2007-01-28 02:36:07 +03:00
|
|
|
push ecx
|
|
|
|
sub [esp],ebx
|
2007-01-10 09:03:39 +03:00
|
|
|
@@: push ecx
|
|
|
|
|
|
|
|
call get_tab_size
|
|
|
|
|
|
|
|
call dword[esp+(8+4)+4]
|
|
|
|
jc .calc_tabs.dontfit
|
|
|
|
|
|
|
|
call dword[esp+(8+4)+0]
|
|
|
|
add ebp,sizeof.TABITEM
|
|
|
|
|
|
|
|
pop ecx
|
|
|
|
dec ecx
|
|
|
|
dec dword[esp]
|
|
|
|
jnz @b
|
|
|
|
|
|
|
|
jmp @f
|
|
|
|
|
|
|
|
.calc_tabs.dontfit:
|
|
|
|
|
|
|
|
add esp,4
|
|
|
|
@@: pop ecx
|
|
|
|
mov eax,ecx
|
|
|
|
ret 8
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2007-01-03 21:22:05 +03:00
|
|
|
|
2007-01-10 09:03:39 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc align_editor_in_tab ;///// ADJUST EDITOR POSITION TO FIT IN TAB /////////
|
2007-01-10 09:03:39 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
m2m [cur_editor.Bounds.Left],[tab_bar.Bounds.Left]
|
|
|
|
m2m [cur_editor.Bounds.Top],[tab_bar.Bounds.Top]
|
|
|
|
m2m [cur_editor.Bounds.Right],[tab_bar.Bounds.Right]
|
|
|
|
m2m [cur_editor.Bounds.Bottom],[tab_bar.Bounds.Bottom]
|
|
|
|
|
|
|
|
inc [cur_editor.Bounds.Left]
|
|
|
|
inc [cur_editor.Bounds.Top]
|
|
|
|
dec [cur_editor.Bounds.Right]
|
|
|
|
dec [cur_editor.Bounds.Bottom]
|
2007-01-03 21:22:05 +03:00
|
|
|
|
2007-01-10 09:03:39 +03:00
|
|
|
call get_max_tab_width
|
|
|
|
lea ebx,[eax+1]
|
2007-01-03 21:22:05 +03:00
|
|
|
|
|
|
|
mov al,[tab_bar.Style]
|
|
|
|
dec al
|
|
|
|
jz .tabs_on_top
|
|
|
|
dec al
|
|
|
|
jz .tabs_on_bottom
|
|
|
|
dec al
|
|
|
|
jz .tabs_on_left
|
|
|
|
dec al
|
|
|
|
jz .tabs_on_right
|
|
|
|
ret
|
|
|
|
|
|
|
|
.tabs_on_top:
|
2007-01-10 09:03:39 +03:00
|
|
|
add [cur_editor.Bounds.Top],TBARH
|
2007-01-03 21:22:05 +03:00
|
|
|
ret
|
|
|
|
|
|
|
|
.tabs_on_bottom:
|
2007-01-10 09:03:39 +03:00
|
|
|
sub [cur_editor.Bounds.Bottom],TBARH
|
2007-01-03 21:22:05 +03:00
|
|
|
ret
|
|
|
|
|
|
|
|
.tabs_on_left:
|
2007-01-10 09:03:39 +03:00
|
|
|
add [cur_editor.Bounds.Left],ebx
|
2007-01-03 21:22:05 +03:00
|
|
|
ret
|
|
|
|
|
|
|
|
.tabs_on_right:
|
2007-01-10 09:03:39 +03:00
|
|
|
sub [cur_editor.Bounds.Right],ebx
|
2007-01-03 21:22:05 +03:00
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|