Fixing incorrect behaviour of tab save suggestion on close

Minor GUI fixes (tab close button is skinned now; incorrect popup height calculation)

git-svn-id: svn://kolibrios.org@629 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Mihail Semenyako (mike.dld) 2007-09-18 00:41:58 +00:00
parent 66417e61bd
commit 84bce0d4d8
11 changed files with 98 additions and 63 deletions

View File

@ -101,6 +101,7 @@ align 4
accel_table2 dd \ accel_table2 dd \
1 ,key.alt_x ,\ 1 ,key.alt_x ,\
2 ,key.ctrl_f4 ,\
'VSL',btn.vscroll_up ,\ 'VSL',btn.vscroll_up ,\
'VSG',btn.vscroll_down ,\ 'VSG',btn.vscroll_down ,\
'HSL',btn.hscroll_up ,\ 'HSL',btn.hscroll_up ,\
@ -117,6 +118,7 @@ accel_table2_botdlg dd \
20002,btn.bot.opensave ,\ 20002,btn.bot.opensave ,\
20003,btn.bot.find ,\ 20003,btn.bot.find ,\
20004,btn.bot.appearance,\ 20004,btn.bot.appearance,\
20007,btn.bot.no ,\
21001,btn.bot.tabpos ,\ 21001,btn.bot.tabpos ,\
0 0

View File

@ -52,6 +52,7 @@ sel.selected db ?
in_sel db ? in_sel db ?
do_not_draw db ? ; draw top and bottom buttons? do_not_draw db ? ; draw top and bottom buttons?
main_closing db ? ; main window closing?
main_closed db ? ; main window closed? main_closed db ? ; main window closed?
tb_casesen db ? ; focused textbox is case-sensitive? tb_casesen db ? ; focused textbox is case-sensitive?
@ -95,11 +96,13 @@ mouse_captured db ?
just_from_popup db ? just_from_popup db ?
bot_mode db ? bot_mode db ?
bot_mode2 db ?
align 4 align 4
bot_dlg_height dd ? bot_dlg_height dd ?
bot_dlg_mode2 db ? exit_tab_item dd ?
exit_tab_num dd ?
temp_buf dd ? temp_buf dd ?
copy_buf dd ? copy_buf dd ?

View File

@ -7,8 +7,8 @@ HISTORY:
(was opening in current tab if there was a new file, even modified) (was opening in current tab if there was a new file, even modified)
- show "save file" dialog for new files or files from Tinypad's home folder - show "save file" dialog for new files or files from Tinypad's home folder
new features: new features:
- prompt to save modified file before closing - prompt to save modified file before closing (+fixes)
- button to close current tab - button to close current tab (+fixes)
- mouse scroll wheel support - mouse scroll wheel support
4.0.4 (mike.dld) 4.0.4 (mike.dld)

View File

@ -1,9 +1,9 @@
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; project name: TINYPAD ; project name: TINYPAD
; compiler: flat assembler 1.67.18 ; compiler: flat assembler 1.67.21
; memory to compile: 3.0/9.0 MBytes (without/with size optimizations) ; memory to compile: 3.0/9.0 MBytes (without/with size optimizations)
; version: 4.0.4 ; version: 4.0.5
; last update: 2007-02-08 (Feb 08, 2007) ; last update: 2007-09-18 (Sep 18, 2007)
; minimal kernel: revision #270 (svn://kolibrios.org/kernel/trunk) ; minimal kernel: revision #270 (svn://kolibrios.org/kernel/trunk)
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; originally by: Ville Michael Turjanmaa >> villemt@aton.co.jyu.fi ; originally by: Ville Michael Turjanmaa >> villemt@aton.co.jyu.fi
@ -34,7 +34,7 @@ include 'tinypad.inc'
header '01',1,@CODE,TINYPAD_END,STATIC_MEM_END,MAIN_STACK,@PARAMS,self_path header '01',1,@CODE,TINYPAD_END,STATIC_MEM_END,MAIN_STACK,@PARAMS,self_path
APP_VERSION equ '4.0.4' APP_VERSION equ '4.0.5'
TRUE = 1 TRUE = 1
FALSE = 0 FALSE = 0

View File

@ -108,7 +108,7 @@ macro popup_res _name,[_lang,_title,_accel,_action]
if (lang eq _lang) | (_lang eq @!) if (lang eq _lang) | (_lang eq @!)
if _title eq '-' if _title eq '-'
db 1,'-' db 1,'-'
c2 = c2+1 c2 = c2+2
else else
virtual at 0 virtual at 0
db _title db _title
@ -150,7 +150,7 @@ macro popup_res _name,[_lang,_title,_accel,_action]
m2 = -2 m2 = -2
end if end if
store word (m1*6+m2*6+6*8) at _name+POPUP.width store word (m1*6+m2*6+6*8) at _name+POPUP.width
store word (c1*POP_IHEIGHT+c2*POP_SHEIGHT+3) at _name+POPUP.height store word (c1*POP_IHEIGHT+c2*POP_SHEIGHT+4) at _name+POPUP.height
store dword (((m1+2)*6-1)*65536) at _name+POPUP.acc_ofs store dword (((m1+2)*6-1)*65536) at _name+POPUP.acc_ofs
end if end if
} }

View File

@ -609,10 +609,12 @@ proc mem.ReAlloc,mptr,size ;//////////////////////////////////////////////////
jz @f jz @f
add edx,-4 add edx,-4
@@: mcall 68,20 @@: mcall 68,20
or eax,eax
jz @f
add ecx,-4 add ecx,-4
mov [eax],ecx mov [eax],ecx
add eax,4 add eax,4
pop edx ecx ebx @@: pop edx ecx ebx
ret ret
endp endp

View File

@ -46,7 +46,7 @@ finddlg_handler:
add ecx,(3+17)*65536+15 add ecx,(3+17)*65536+15
push ecx push ecx
cmp [bot_dlg_mode2],0 cmp [bot_mode2],0
je @f je @f
add ebx,18 add ebx,18
mcall 4,,[sc.work_text],s_2replace,s_2replace.size+1 mcall 4,,[sc.work_text],s_2replace,s_2replace.size+1
@ -58,7 +58,7 @@ finddlg_handler:
shl ebx,16 shl ebx,16
push 20003 push 20003
cmp [bot_dlg_mode2],0 cmp [bot_mode2],0
jne .draw.lp1 jne .draw.lp1
add ebx,-(2+6*(s_2find.size+2))*65536+6*(s_2find.size+2) add ebx,-(2+6*(s_2find.size+2))*65536+6*(s_2find.size+2)
push s_2find s_2find.size push s_2find s_2find.size
@ -87,7 +87,7 @@ finddlg_handler:
pop ecx pop ecx
cmp [bot_dlg_mode2],0 cmp [bot_mode2],0
je @f je @f
mov ebp,tb_replace mov ebp,tb_replace
mov eax,[p_info.client_box.width] mov eax,[p_info.client_box.width]
@ -114,7 +114,7 @@ finddlg_handler:
ret ret
..tab: ..tab:
cmp [bot_dlg_mode2],0 cmp [bot_mode2],0
je @f je @f
mov eax,tb_replace mov eax,tb_replace
cmp eax,[focused_tb] cmp eax,[focused_tb]
@ -145,7 +145,7 @@ osdlg_handler:
add ecx,(2+18)*65536+15 add ecx,(2+18)*65536+15
push 20002 push 20002
cmp [bot_dlg_mode2],0 cmp [bot_mode2],0
jne .draw.lp1 jne .draw.lp1
add ebx,-(2+6*(s_2open.size+2))*65536+6*(s_2open.size+2) add ebx,-(2+6*(s_2open.size+2))*65536+6*(s_2open.size+2)
push s_2open s_2open.size push s_2open s_2open.size
@ -160,7 +160,7 @@ osdlg_handler:
push 20001 s_2cancel s_2cancel.size push 20001 s_2cancel s_2cancel.size
call define_3d_button call define_3d_button
cmp [bot_dlg_mode2], 2 ; exit-save dialog cmp [bot_mode2], 2 ; exit-save dialog
jne @f jne @f
sub ebx,(6*(s_2save_no.size+2)+3)*65536 sub ebx,(6*(s_2save_no.size+2)+3)*65536
@ -209,7 +209,7 @@ gotodlg_handler:
add ecx,(2+18)*65536+15 add ecx,(2+18)*65536+15
push 20002 push 20002
cmp [bot_dlg_mode2],0 cmp [bot_mode2],0
jne .draw.lp1 jne .draw.lp1
add ebx,-(2+6*(s_2open.size+2))*65536+6*(s_2open.size+2) add ebx,-(2+6*(s_2open.size+2))*65536+6*(s_2open.size+2)
push s_2open s_2open.size push s_2open s_2open.size
@ -590,13 +590,14 @@ botdlg.button:
btn.bot.cancel: btn.bot.cancel:
xor eax,eax xor eax,eax
mov [bot_mode],al mov [bot_mode],al
mov [main_closing],al
mov [bot_dlg_height],eax mov [bot_dlg_height],eax
mov [s_status],eax mov [s_status],eax
call drawwindow call drawwindow
ret ret
btn.bot.opensave: btn.bot.opensave:
cmp [bot_dlg_mode2],0 cmp [bot_mode2],0
je .lp1 je .lp1
call save_file call save_file
jnc @f jnc @f
@ -613,12 +614,17 @@ botdlg.button:
ret ret
btn.bot.no: btn.bot.no:
call key.ctrl_f4.close
xor eax,eax xor eax,eax
mov [bot_mode],al mov [bot_mode],al
mov [bot_dlg_height],eax mov [bot_dlg_height],eax
mov [s_status],eax mov [s_status],eax
call drawwindow call drawwindow
cmp [main_closing],0
je @f
add [exit_tab_item],sizeof.TABITEM
jmp key.alt_x.direct
ret
@@: call key.ctrl_f4.close
ret ret
btn.bot.find: btn.bot.find:
@ -629,7 +635,7 @@ botdlg.button:
cld cld
rep movsb rep movsb
cmp [bot_dlg_mode2],0 cmp [bot_mode2],0
je @f je @f
call search call search
jnc .found jnc .found

View File

@ -209,30 +209,20 @@ proc draw_main_menu ;/////////////////////////////////////////////////////////
jmp @b jmp @b
.exit: .exit:
mov eax, 8 mov ebx,[mainwnd_pos.w]
mov bx, word [mainwnd_pos.w] add ebx,-10-(ATOPH-6)-3
sub bx, 25 push ebx 2 (ATOPH-6) (ATOPH-6)
call draw_3d_panel
shl ebx,16 shl ebx,16
add ebx, 12 add ebx,ATOPH-6
mcall 8,,<2,ATOPH-6>,<0x4000,2>
mov ecx, 3 * 65536 + 12 and ebx,0xFFFF0000
mov edx, 177 add ebx,(ATOPH-8)/2*65536+(ATOPH-8)/2
mov esi, 0x00bcbec6 mcall 4,,[sc.work_text],.cross,1
int 0x40
;mov eax, 4
shr eax, 1
sub ebx, -4 * 65536
mov bx, 6
mov ecx, 0
mov edx, cross
mov esi, 1
int 0x40
ret ret
cross: .cross db 'x'
db 'X'
endp endp
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------

View File

@ -127,10 +127,10 @@ endp
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
proc key.ctrl_o ;///// ENTER OPEN FILENAME /////////////////////////////////// proc key.ctrl_o ;///// ENTER OPEN FILENAME ///////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov [bot_dlg_mode2],0 mov [bot_mode2],0
.direct: .direct:
cmp [bot_dlg_mode2], 2 cmp [bot_mode2], 2
je .ask je .ask
mov [s_status],s_enter_filename mov [s_status],s_enter_filename
jmp .ask1 jmp .ask1
@ -164,7 +164,7 @@ proc key.ctrl_s ;///// ENTER SAVE FILENAME ///////////////////////////////////
ret ret
key.shift_ctrl_s: key.shift_ctrl_s:
mov [bot_dlg_mode2],1 mov [bot_mode2],1
jmp key.ctrl_o.direct jmp key.ctrl_o.direct
endp endp
@ -178,7 +178,7 @@ endp
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
proc key.ctrl_f ;///// ENTER KEYWORD TO FIND ///////////////////////////////// proc key.ctrl_f ;///// ENTER KEYWORD TO FIND /////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov [bot_dlg_mode2],0 mov [bot_mode2],0
mov [bot_dlg_height],16*2+4*2-1 mov [bot_dlg_height],16*2+4*2-1
mov [s_status],s_enter_text_to_find mov [s_status],s_enter_text_to_find
@ -205,7 +205,7 @@ proc key.ctrl_f ;///// ENTER KEYWORD TO FIND /////////////////////////////////
endp endp
proc key.ctrl_h proc key.ctrl_h
mov [bot_dlg_mode2],1 mov [bot_mode2],1
mov [bot_dlg_height],16*3+4*2+1 mov [bot_dlg_height],16*3+4*2+1
mov [s_status],s_enter_text_to_replace mov [s_status],s_enter_text_to_replace
@ -216,7 +216,7 @@ endp
proc key.ctrl_g proc key.ctrl_g
ret ret
@^ @^
mov [bot_dlg_mode2],0 mov [bot_mode2],0
mov [bot_dlg_height],16*2+4*2-1 mov [bot_dlg_height],16*2+4*2-1
mov [bot_mode],1 mov [bot_mode],1
@ -1492,7 +1492,7 @@ proc key.ctrl_f4 ;///// CLOSE CURRENT TAB ////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
cmp [cur_editor.Modified],0 cmp [cur_editor.Modified],0
je .close je .close
mov [bot_dlg_mode2], 2 mov [bot_mode2],2
jmp key.ctrl_o.direct jmp key.ctrl_o.direct
.close: .close:
mov [do_not_draw],1 mov [do_not_draw],1
@ -1556,6 +1556,19 @@ endp
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
proc key.alt_x ;///// EXIT PROGRAM /////////////////////////////////////////// proc key.alt_x ;///// EXIT PROGRAM ///////////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov [main_closing],1
mov eax,[tab_bar.Items]
mov [exit_tab_item],eax
mov eax,[tab_bar.Items.Count]
mov [exit_tab_num],eax
.direct:
call try_to_close_tabs
or eax,eax
jz .close
mov [bot_mode2],2
jmp key.ctrl_o.direct
.close:
mov esi,self_path mov esi,self_path
mov byte[esi+PATHL-1],0 mov byte[esi+PATHL-1],0
mov edi,f_info.path mov edi,f_info.path
@ -1574,11 +1587,30 @@ proc key.alt_x ;///// EXIT PROGRAM ///////////////////////////////////////////
mov [f_info70+21],f_info.path mov [f_info70+21],f_info.path
mcall 70,f_info70 mcall 70,f_info70
.bgn_rp:
call key.ctrl_f4
.close:
cmp [tab_bar.Items.Count],1
jne .bgn_rp
mov [main_closed],1 mov [main_closed],1
mcall -1 mcall -1
endp endp
;-----------------------------------------------------------------------------
proc try_to_close_tabs ;///// FIND TABS TO BE SAVED BEFORE CLOSE /////////////
;-----------------------------------------------------------------------------
push ecx ebp
call flush_cur_tab
mov ebp,[exit_tab_item] ; [tab_bar.Items]
add ebp,-sizeof.TABITEM
@@: dec [exit_tab_num]
js .ok
add ebp,sizeof.TABITEM
mov al,[ebp+TABITEM.Editor.Modified]
cmp [ebp+TABITEM.Editor.Modified],0
je @b
mov [exit_tab_item],ebp
call set_cur_tab
call make_tab_visible
xor eax,eax
inc eax
@@: pop ebp ecx
ret
.ok: xor eax,eax
jmp @b
endp

View File

@ -1,7 +1,7 @@
;POP_WIDTH = (popup_text.max_title+popup_text.max_accel+6)*6 ;POP_WIDTH = (popup_text.max_title+popup_text.max_accel+6)*6
POP_IHEIGHT = 16 POP_IHEIGHT = 16
POP_SHEIGHT = 3 POP_SHEIGHT = 2
;POP_HEIGHT = popup_text.cnt_item*POP_IHEIGHT+popup_text.cnt_sep*4+4 ;POP_HEIGHT = popup_text.cnt_item*POP_IHEIGHT+popup_text.cnt_sep*4+4
popup_thread_start: popup_thread_start:

View File

@ -4,12 +4,14 @@ proc flush_cur_tab ;///// SAVE CURRENT TAB DATA TO CONTROL ///////////////////
; EBP = TABITEM* ; EBP = TABITEM*
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
push ecx esi edi push ecx esi edi
mov esi,cur_tab
mov edi,[tab_bar.Current.Ptr] mov edi,[tab_bar.Current.Ptr]
or edi,edi
jz @f
mov esi,cur_tab
mov ecx,sizeof.TABITEM/4 mov ecx,sizeof.TABITEM/4
cld cld
rep movsd rep movsd
pop edi esi ecx @@: pop edi esi ecx
ret ret
endp endp
@ -19,10 +21,8 @@ proc set_cur_tab ;///// SET SPECIFIED TAB CURRENT (FOCUS IT) /////////////////
; EBP = TABITEM* ; EBP = TABITEM*
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
push ecx esi edi push ecx esi edi
cmp [tab_bar.Current.Ptr],0
je @f
call flush_cur_tab call flush_cur_tab
@@: mov esi,ebp mov esi,ebp
mov edi,cur_tab mov edi,cur_tab
mov ecx,sizeof.TABITEM/4 mov ecx,sizeof.TABITEM/4
rep movsd rep movsd