Tinypad: update tab/window title and highlighting mode after file save

git-svn-id: svn://kolibrios.org@827 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Mihail Semenyako (mike.dld) 2008-07-18 04:52:49 +00:00
parent 4def1db832
commit a3f173ceb4
3 changed files with 52 additions and 37 deletions

View File

@ -8,6 +8,7 @@ HISTORY:
- show "save file" dialog for new files or files from Tinypad's home folder
- line is redrawn after lining up a single char and then deleting it
(pressing Del twice) [#1]
- update tab/window title and highlighting mode after file save
new features:
- prompt to save modified file before closing (+fixes)
- button to close current tab (+fixes)

View File

@ -2,9 +2,9 @@
; project name: TINYPAD
; compiler: flat assembler 1.67.21
; memory to compile: 3.0/9.0 MBytes (without/with size optimizations)
; version: 4.0.5
; last update: 2007-09-18 (Sep 18, 2007)
; minimal kernel: revision #270 (svn://kolibrios.org/kernel/trunk)
; version: SVN (4.0.5)
; last update: 2008-07-18 (Jul 18, 2008)
; minimal kernel: revision #823 (svn://kolibrios.org/kernel/trunk)
;-----------------------------------------------------------------------------
; originally by: Ville Michael Turjanmaa >> villemt@aton.co.jyu.fi
; maintained by: Mike Semenyako >> mike.dld@gmail.com
@ -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.5'
APP_VERSION equ 'SVN (4.0.5)'
TRUE = 1
FALSE = 0
@ -449,6 +449,8 @@ include 'external/dll.inc'
section @DATA ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;-----------------------------------------------------------------------------
;include_debug_strings
include 'data/tp-idata.inc'
;-----------------------------------------------------------------------------

View File

@ -50,6 +50,8 @@ proc save_file ;//////////////////////////////////////////////////////////////
jnz .exit.2
.exit:
mov ebp,cur_editor
call update_tab_filename
mov [cur_editor.Modified],0
clc
ret
@ -204,23 +206,7 @@ proc load_file ;//////////////////////////////////////////////////////////////
@@: inc [do_not_draw]
call create_tab
dec [do_not_draw]
.lp1: push ecx esi edi
mov esi,tb_opensave.text
lea edi,[ebp+TABITEM.Editor.FilePath]
movzx ecx,[tb_opensave.length]
cld
rep movsb
mov byte[edi],0
lea edi,[ebp+TABITEM.Editor.FilePath]
movzx ecx,[tb_opensave.length]
inc ecx
@@: dec ecx
jz @f
cmp byte[edi+ecx-1],'/'
jne @b
@@: mov [ebp+TABITEM.Editor.FileName],ecx
call flush_cur_tab
pop edi esi ecx
.lp1: call update_tab_filename
call load_from_memory
stdcall mem.Free,[f_info70+16]
@ -232,22 +218,6 @@ proc load_file ;//////////////////////////////////////////////////////////////
mov [cur_editor.SelStart.X],eax
mov [cur_editor.SelStart.Y],eax
mov [cur_editor.Modified],al
mov [cur_editor.AsmMode],al
lea ebx,[cur_editor.FilePath]
mov eax,ebx
call strlen
mov ecx,dword[ebx+eax-3]
or ecx,0x202020
cmp ecx,'asm'
jne @f
inc [cur_editor.AsmMode]
jmp .nocol
@@: cmp ecx,'inc'
jne .nocol
inc [cur_editor.AsmMode]
.nocol:
call update_caption
clc
ret
@ -335,3 +305,45 @@ proc load_from_memory ;///////////////////////////////////////////////////////
rep stosb
jmp .next_char
endp
;-----------------------------------------------------------------------------
proc update_tab_filename ;////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; EBP = TABITEM*
;-----------------------------------------------------------------------------
push ecx esi edi
inc [do_not_draw]
mov esi,tb_opensave.text
lea edi,[ebp+TABITEM.Editor.FilePath]
movzx ecx,[tb_opensave.length]
cld
rep movsb
mov byte[edi],0
lea edi,[ebp+TABITEM.Editor.FilePath]
movzx ecx,[tb_opensave.length]
inc ecx
@@: dec ecx
jz @f
cmp byte[edi+ecx-1],'/'
jne @b
@@: mov [ebp+TABITEM.Editor.FileName],ecx
call flush_cur_tab
call update_caption
dec [do_not_draw]
mov [cur_editor.AsmMode],0
movzx ecx,[tb_opensave.length]
mov ecx,dword[ecx+tb_opensave.text-3]
or ecx,0x202020
cmp ecx,'asm'
jne @f
inc [cur_editor.AsmMode]
jmp .exit
@@: cmp ecx,'inc'
jne .exit
inc [cur_editor.AsmMode]
.exit:
pop edi esi ecx
ret
endp