diff --git a/programs/develop/tinypad/trunk/data/tp-tables.inc b/programs/develop/tinypad/trunk/data/tp-tables.inc index c94e6eaf79..4cbbaa05fd 100644 --- a/programs/develop/tinypad/trunk/data/tp-tables.inc +++ b/programs/develop/tinypad/trunk/data/tp-tables.inc @@ -101,6 +101,7 @@ align 4 accel_table2 dd \ 1 ,key.alt_x ,\ + 2 ,key.ctrl_f4 ,\ 'VSL',btn.vscroll_up ,\ 'VSG',btn.vscroll_down ,\ 'HSL',btn.hscroll_up ,\ @@ -117,6 +118,7 @@ accel_table2_botdlg dd \ 20002,btn.bot.opensave ,\ 20003,btn.bot.find ,\ 20004,btn.bot.appearance,\ + 20007,btn.bot.no ,\ 21001,btn.bot.tabpos ,\ 0 diff --git a/programs/develop/tinypad/trunk/data/tp-udata.inc b/programs/develop/tinypad/trunk/data/tp-udata.inc index a50a73c802..79de2eb5d9 100644 --- a/programs/develop/tinypad/trunk/data/tp-udata.inc +++ b/programs/develop/tinypad/trunk/data/tp-udata.inc @@ -52,6 +52,7 @@ sel.selected db ? in_sel db ? do_not_draw db ? ; draw top and bottom buttons? +main_closing db ? ; main window closing? main_closed db ? ; main window closed? tb_casesen db ? ; focused textbox is case-sensitive? @@ -94,12 +95,14 @@ mev db ? mouse_captured db ? just_from_popup db ? -bot_mode db ? +bot_mode db ? +bot_mode2 db ? align 4 bot_dlg_height dd ? -bot_dlg_mode2 db ? +exit_tab_item dd ? +exit_tab_num dd ? temp_buf dd ? copy_buf dd ? diff --git a/programs/develop/tinypad/trunk/history.txt b/programs/develop/tinypad/trunk/history.txt index 766542657e..c3c4cf9f87 100644 --- a/programs/develop/tinypad/trunk/history.txt +++ b/programs/develop/tinypad/trunk/history.txt @@ -7,8 +7,8 @@ HISTORY: (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 new features: - - prompt to save modified file before closing - - button to close current tab + - prompt to save modified file before closing (+fixes) + - button to close current tab (+fixes) - mouse scroll wheel support 4.0.4 (mike.dld) diff --git a/programs/develop/tinypad/trunk/tinypad.asm b/programs/develop/tinypad/trunk/tinypad.asm index 9046ee1c3d..d3be4c938d 100644 --- a/programs/develop/tinypad/trunk/tinypad.asm +++ b/programs/develop/tinypad/trunk/tinypad.asm @@ -1,9 +1,9 @@ ;----------------------------------------------------------------------------- ; 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) -; version: 4.0.4 -; last update: 2007-02-08 (Feb 08, 2007) +; version: 4.0.5 +; last update: 2007-09-18 (Sep 18, 2007) ; minimal kernel: revision #270 (svn://kolibrios.org/kernel/trunk) ;----------------------------------------------------------------------------- ; 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 -APP_VERSION equ '4.0.4' +APP_VERSION equ '4.0.5' TRUE = 1 FALSE = 0 diff --git a/programs/develop/tinypad/trunk/tinypad.inc b/programs/develop/tinypad/trunk/tinypad.inc index 0070c694ca..7a6a385599 100644 --- a/programs/develop/tinypad/trunk/tinypad.inc +++ b/programs/develop/tinypad/trunk/tinypad.inc @@ -108,7 +108,7 @@ macro popup_res _name,[_lang,_title,_accel,_action] if (lang eq _lang) | (_lang eq @!) if _title eq '-' db 1,'-' - c2 = c2+1 + c2 = c2+2 else virtual at 0 db _title @@ -150,7 +150,7 @@ macro popup_res _name,[_lang,_title,_accel,_action] m2 = -2 end if 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 end if } diff --git a/programs/develop/tinypad/trunk/tp-common.asm b/programs/develop/tinypad/trunk/tp-common.asm index 308a2f5393..6be371e7e9 100644 --- a/programs/develop/tinypad/trunk/tp-common.asm +++ b/programs/develop/tinypad/trunk/tp-common.asm @@ -609,10 +609,12 @@ proc mem.ReAlloc,mptr,size ;////////////////////////////////////////////////// jz @f add edx,-4 @@: mcall 68,20 + or eax,eax + jz @f add ecx,-4 mov [eax],ecx add eax,4 - pop edx ecx ebx + @@: pop edx ecx ebx ret endp diff --git a/programs/develop/tinypad/trunk/tp-dialog.asm b/programs/develop/tinypad/trunk/tp-dialog.asm index 8e4e92a409..70090fefea 100644 --- a/programs/develop/tinypad/trunk/tp-dialog.asm +++ b/programs/develop/tinypad/trunk/tp-dialog.asm @@ -46,7 +46,7 @@ finddlg_handler: add ecx,(3+17)*65536+15 push ecx - cmp [bot_dlg_mode2],0 + cmp [bot_mode2],0 je @f add ebx,18 mcall 4,,[sc.work_text],s_2replace,s_2replace.size+1 @@ -58,7 +58,7 @@ finddlg_handler: shl ebx,16 push 20003 - cmp [bot_dlg_mode2],0 + cmp [bot_mode2],0 jne .draw.lp1 add ebx,-(2+6*(s_2find.size+2))*65536+6*(s_2find.size+2) push s_2find s_2find.size @@ -87,7 +87,7 @@ finddlg_handler: pop ecx - cmp [bot_dlg_mode2],0 + cmp [bot_mode2],0 je @f mov ebp,tb_replace mov eax,[p_info.client_box.width] @@ -114,7 +114,7 @@ finddlg_handler: ret ..tab: - cmp [bot_dlg_mode2],0 + cmp [bot_mode2],0 je @f mov eax,tb_replace cmp eax,[focused_tb] @@ -145,7 +145,7 @@ osdlg_handler: add ecx,(2+18)*65536+15 push 20002 - cmp [bot_dlg_mode2],0 + cmp [bot_mode2],0 jne .draw.lp1 add ebx,-(2+6*(s_2open.size+2))*65536+6*(s_2open.size+2) push s_2open s_2open.size @@ -160,7 +160,7 @@ osdlg_handler: push 20001 s_2cancel s_2cancel.size call define_3d_button - cmp [bot_dlg_mode2], 2 ; exit-save dialog + cmp [bot_mode2], 2 ; exit-save dialog jne @f sub ebx,(6*(s_2save_no.size+2)+3)*65536 @@ -209,7 +209,7 @@ gotodlg_handler: add ecx,(2+18)*65536+15 push 20002 - cmp [bot_dlg_mode2],0 + cmp [bot_mode2],0 jne .draw.lp1 add ebx,-(2+6*(s_2open.size+2))*65536+6*(s_2open.size+2) push s_2open s_2open.size @@ -590,13 +590,14 @@ botdlg.button: btn.bot.cancel: xor eax,eax mov [bot_mode],al + mov [main_closing],al mov [bot_dlg_height],eax mov [s_status],eax call drawwindow ret btn.bot.opensave: - cmp [bot_dlg_mode2],0 + cmp [bot_mode2],0 je .lp1 call save_file jnc @f @@ -613,12 +614,17 @@ botdlg.button: ret btn.bot.no: - call key.ctrl_f4.close xor eax,eax mov [bot_mode],al mov [bot_dlg_height],eax mov [s_status],eax 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 btn.bot.find: @@ -629,7 +635,7 @@ botdlg.button: cld rep movsb - cmp [bot_dlg_mode2],0 + cmp [bot_mode2],0 je @f call search jnc .found @@ -641,7 +647,7 @@ botdlg.button: movzx eax,[tb_replace.length] add eax,10 - stdcall mem.Alloc,eax + stdcall mem.Alloc,eax mov [copy_buf],eax movzx eax,[tb_replace.length] @@ -661,7 +667,7 @@ botdlg.button: call key.ctrl_v pop [cur_editor.SelStart.X] - stdcall mem.Free,[copy_buf] + stdcall mem.Free,[copy_buf] pop [copy_buf] [copy_count] [copy_size] diff --git a/programs/develop/tinypad/trunk/tp-draw.asm b/programs/develop/tinypad/trunk/tp-draw.asm index 27f6781afc..f3827a54ac 100644 --- a/programs/develop/tinypad/trunk/tp-draw.asm +++ b/programs/develop/tinypad/trunk/tp-draw.asm @@ -209,30 +209,20 @@ proc draw_main_menu ;///////////////////////////////////////////////////////// jmp @b .exit: - mov eax, 8 - mov bx, word [mainwnd_pos.w] - sub bx, 25 - shl ebx, 16 - add ebx, 12 - - mov ecx, 3 * 65536 + 12 - mov edx, 177 - mov esi, 0x00bcbec6 - 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 + mov ebx,[mainwnd_pos.w] + add ebx,-10-(ATOPH-6)-3 + push ebx 2 (ATOPH-6) (ATOPH-6) + call draw_3d_panel + shl ebx,16 + add ebx,ATOPH-6 + mcall 8,,<2,ATOPH-6>,<0x4000,2> + and ebx,0xFFFF0000 + add ebx,(ATOPH-8)/2*65536+(ATOPH-8)/2 + mcall 4,,[sc.work_text],.cross,1 ret -cross: - db 'X' +.cross db 'x' endp ;----------------------------------------------------------------------------- diff --git a/programs/develop/tinypad/trunk/tp-key.asm b/programs/develop/tinypad/trunk/tp-key.asm index 921257c5a3..106a79f432 100644 --- a/programs/develop/tinypad/trunk/tp-key.asm +++ b/programs/develop/tinypad/trunk/tp-key.asm @@ -127,10 +127,10 @@ endp ;----------------------------------------------------------------------------- proc key.ctrl_o ;///// ENTER OPEN FILENAME /////////////////////////////////// ;----------------------------------------------------------------------------- - mov [bot_dlg_mode2],0 + mov [bot_mode2],0 .direct: - cmp [bot_dlg_mode2], 2 + cmp [bot_mode2], 2 je .ask mov [s_status],s_enter_filename jmp .ask1 @@ -164,7 +164,7 @@ proc key.ctrl_s ;///// ENTER SAVE FILENAME /////////////////////////////////// ret key.shift_ctrl_s: - mov [bot_dlg_mode2],1 + mov [bot_mode2],1 jmp key.ctrl_o.direct endp @@ -178,7 +178,7 @@ endp ;----------------------------------------------------------------------------- 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 [s_status],s_enter_text_to_find @@ -205,7 +205,7 @@ proc key.ctrl_f ;///// ENTER KEYWORD TO FIND ///////////////////////////////// endp proc key.ctrl_h - mov [bot_dlg_mode2],1 + mov [bot_mode2],1 mov [bot_dlg_height],16*3+4*2+1 mov [s_status],s_enter_text_to_replace @@ -216,7 +216,7 @@ endp proc key.ctrl_g ret @^ - mov [bot_dlg_mode2],0 + mov [bot_mode2],0 mov [bot_dlg_height],16*2+4*2-1 mov [bot_mode],1 @@ -1490,9 +1490,9 @@ endp ;----------------------------------------------------------------------------- proc key.ctrl_f4 ;///// CLOSE CURRENT TAB //////////////////////////////////// ;----------------------------------------------------------------------------- - cmp [cur_editor.Modified], 0 + cmp [cur_editor.Modified],0 je .close - mov [bot_dlg_mode2], 2 + mov [bot_mode2],2 jmp key.ctrl_o.direct .close: mov [do_not_draw],1 @@ -1556,6 +1556,19 @@ endp ;----------------------------------------------------------------------------- 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 byte[esi+PATHL-1],0 mov edi,f_info.path @@ -1574,11 +1587,30 @@ proc key.alt_x ;///// EXIT PROGRAM /////////////////////////////////////////// mov [f_info70+21],f_info.path mcall 70,f_info70 - .bgn_rp: - call key.ctrl_f4 - .close: - cmp [tab_bar.Items.Count],1 - jne .bgn_rp mov [main_closed],1 mcall -1 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 diff --git a/programs/develop/tinypad/trunk/tp-popup.asm b/programs/develop/tinypad/trunk/tp-popup.asm index 0b993f9a9b..6ab72d2292 100644 --- a/programs/develop/tinypad/trunk/tp-popup.asm +++ b/programs/develop/tinypad/trunk/tp-popup.asm @@ -1,7 +1,7 @@ ;POP_WIDTH = (popup_text.max_title+popup_text.max_accel+6)*6 POP_IHEIGHT = 16 -POP_SHEIGHT = 3 +POP_SHEIGHT = 2 ;POP_HEIGHT = popup_text.cnt_item*POP_IHEIGHT+popup_text.cnt_sep*4+4 popup_thread_start: diff --git a/programs/develop/tinypad/trunk/tp-tabctl.asm b/programs/develop/tinypad/trunk/tp-tabctl.asm index 77ad3260c4..b641516c45 100644 --- a/programs/develop/tinypad/trunk/tp-tabctl.asm +++ b/programs/develop/tinypad/trunk/tp-tabctl.asm @@ -4,12 +4,14 @@ proc flush_cur_tab ;///// SAVE CURRENT TAB DATA TO CONTROL /////////////////// ; EBP = TABITEM* ;----------------------------------------------------------------------------- push ecx esi edi - mov esi,cur_tab mov edi,[tab_bar.Current.Ptr] + or edi,edi + jz @f + mov esi,cur_tab mov ecx,sizeof.TABITEM/4 cld rep movsd - pop edi esi ecx + @@: pop edi esi ecx ret endp @@ -19,10 +21,8 @@ proc set_cur_tab ;///// SET SPECIFIED TAB CURRENT (FOCUS IT) ///////////////// ; EBP = TABITEM* ;----------------------------------------------------------------------------- push ecx esi edi - cmp [tab_bar.Current.Ptr],0 - je @f call flush_cur_tab - @@: mov esi,ebp + mov esi,ebp mov edi,cur_tab mov ecx,sizeof.TABITEM/4 rep movsd