Tinypad 4.0.4 in progress (full tabbing)

git-svn-id: svn://kolibrios.org@267 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Mihail Semenyako (mike.dld) 2007-01-10 06:03:39 +00:00
parent fd12438007
commit da2d1b6055
15 changed files with 1271 additions and 838 deletions

View File

@ -3,7 +3,7 @@
; compiler: flat assembler 1.67.15 ; compiler: flat assembler 1.67.15
; memory to compile: 2.0/7.0 MBytes (without/with size optimizations) ; memory to compile: 2.0/7.0 MBytes (without/with size optimizations)
; version: 4.0.4 pre ; version: 4.0.4 pre
; last update: 2007-01-03 (Jan 3, 2007) ; last update: 2007-01-07 (Jan 7, 2007)
; minimal kernel: revision #138 (svn://kolibrios.org/kernel) ; minimal kernel: revision #138 (svn://kolibrios.org/kernel)
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; originally by: Ville Michael Turjanmaa >> villemt@aton.co.jyu.fi ; originally by: Ville Michael Turjanmaa >> villemt@aton.co.jyu.fi
@ -15,15 +15,17 @@
; - add vertical selection, undo, goto position, overwrite mode ; - add vertical selection, undo, goto position, overwrite mode
; - improve window drawing with small dimensions ; - improve window drawing with small dimensions
; - other bug-fixes and speed/size optimizations ; - other bug-fixes and speed/size optimizations
; - save settings to ini file, not to executable
; ;
; TODO (FOR 4.0.4, PLANNED FOR 2007-01-21): ; TODO (FOR 4.0.4, PLANNED FOR 2007-01-21):
; - finish tabbed interface [critical] ; - finish tabbed interface (some bug with tab switching) [critical]
; - add memory reallocation to keys handler [critical] ; - add memory reallocation to keys handler [critical]
; - rework save_file (memory manager) [critical] ; - rework save_file (memory manager) [critical]
; - reduce flickering (changes checker) [average] ; - fix scrollbars dragging coordinates calculation [critical]
; - incorrect saved/modified lines flags on copy/paste [normal] ; - fix parameters parsing (incl. DOCPAK) [average]
; - case-insensitive file extensions comparison (.asm/.inc) [normal] ; - reduce flickering (introduce changes checker) [normal]
; - prompt to save file before closing/opening [low] ; - fix incorrect saved/modified lines flags on copy/paste [normal]
; - add prompt to save file before closing/opening [low]
; ;
; HISTORY: ; HISTORY:
; 4.0.4 pre (mike.dld) ; 4.0.4 pre (mike.dld)
@ -31,12 +33,17 @@
; - statusbar contained hint after dialog operation cancelled ; - statusbar contained hint after dialog operation cancelled
; - small drawing fix for gutter and line saved/modified markers ; - small drawing fix for gutter and line saved/modified markers
; changes: ; changes:
; - editor and other modifications to ease parts placement changing
; - modified/saved colors now match those in MSVS ; - modified/saved colors now match those in MSVS
; - function 70 for *all* file operations (including diamond's fixes) ; - function 70 for *all* file operations (including diamond's fixes)
; - use memory manager instead of statically allocated region ; - use memory manager instead of statically allocated region
; - case-insensitive filenames input, to be able to open/save files with
; non-latin chars in name (russian etc.)
; - overall code cleanup
; new features: ; new features:
; - recode tables between CP866, CP1251 and KOI8-R (suggested by Victor) ; - recode tables between CP866, CP1251 and KOI8-R (suggested by Victor)
; - tabbed interface, ability to open several files in one app instance ; - tabbed interface, ability to open several files in one app instance
; (thanks IRC guys for ideas and testing)
; 4.0.3 (mike.dld) ; 4.0.3 (mike.dld)
; bug-fixes: ; bug-fixes:
; - 1-char selection if pressing <BS> out of real line length ; - 1-char selection if pressing <BS> out of real line length
@ -46,6 +53,7 @@
; - statusbar and textboxes drawing fixes (wrong colors) ; - statusbar and textboxes drawing fixes (wrong colors)
; - perform no redraw while pressing Shift, Ctrl, Alt keys ; - perform no redraw while pressing Shift, Ctrl, Alt keys
; - data length from DOCPAK in string representation (fixed by diamond) ; - data length from DOCPAK in string representation (fixed by diamond)
; - compare file extension case-insensitively (fixed by diamond)
; changes: ; changes:
; - function 70 instead of 58 for files loading/saving ; - function 70 instead of 58 for files loading/saving
; - clientarea-relative drawing (less code) ; - clientarea-relative drawing (less code)
@ -156,23 +164,17 @@ APP_VERSION equ '4.0.4 pre'
;include 'debug.inc' ;include 'debug.inc'
ASEPC = '-' ; separator character (char) ASEPC = '-' ; separator character (char)
ATOPH = POP_IHEIGHT+2 ; menu bar height (pixels) ATOPH = POP_IHEIGHT+2 ; menu bar height (pixels)
SCRLW = 16 ; scrollbar widht/height (pixels) SCRLW = 16 ; scrollbar widht/height (pixels)
ATABW = 8 ; tab width (chars) ATABW = 8 ; tab width (chars)
LINEH = 10 ; line height (pixels) LINEH = 10 ; line height (pixels)
PATHL = 256 ; maximum path length (chars) !!! don't change !!! PATHL = 256 ; maximum path length (chars) !!! don't change !!!
AMINS = 8 ; minimal scroll thumb size (pixels) AMINS = 8 ; minimal scroll thumb size (pixels)
LCHGW = 3 ; changed/saved marker width LCHGW = 3 ; changed/saved marker width
STATH = 16 ; status bar height STATH = 16 ; status bar height
TBARH = 18 ; tab bar height TBARH = 18 ; tab bar height
MEV_LDOWN = 1
MEV_LUP = 2
MEV_RDOWN = 3
MEV_RUP = 4
MEV_MOVE = 5
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
section @OPTIONS ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: section @OPTIONS ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@ -180,13 +182,13 @@ section @OPTIONS ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
label color_tbl dword label color_tbl dword
RGB( 0, 0, 0) ; RGB( 0, 0, 0) ; RGB( 0, 0, 0) ; text RGB( 0, 0, 0) ; RGB( 0, 0, 0) ; RGB( 0, 0, 0) ; text
RGB( 0,144, 0) ; RGB( 0,144, 0) ; RGB( 0,160, 0) ; numbers RGB( 0,144, 0) ; RGB( 0,160, 0) ; RGB( 0,144, 0) ; numbers
RGB(176, 0, 0) ; RGB(160, 0, 0) ; RGB( 0,128,255) ; strings RGB(176, 0, 0) ; RGB( 0,128,255) ; RGB(160, 0, 0) ; strings
RGB(128,128,128) ; RGB(144,144,144) ; RGB(160,160,160) ; comments RGB(128,128,128) ; RGB(160,160,160) ; RGB(144,144,144) ; comments
RGB( 48, 48,240) ; RGB( 48, 48,240) ; RGB(255, 0, 0) ; symbols RGB( 48, 48,240) ; RGB(255, 0, 0) ; RGB( 48, 48,240) ; symbols
RGB(255,255,255) ; RGB(224,224,224) ; RGB(255,255,255) ; background RGB(255,255,255) ; RGB(255,255,255) ; RGB(224,224,224) ; background
RGB(255,255,255) ; RGB(255,255,255) ; RGB(255,255,255) ; selection text RGB(255,255,255) ; RGB(255,255,255) ; RGB(255,255,255) ; selection text
RGB( 10, 36,106) ; RGB( 0, 0,128) ; RGB( 0, 64,128) ; selection background RGB( 10, 36,106) ; RGB( 0, 64,128) ; RGB( 0, 0,128) ; selection background
RGB(255,238, 98) ; modified line marker RGB(255,238, 98) ; modified line marker
RGB(108,226,108) ; saved line marker RGB(108,226,108) ; saved line marker
@ -195,7 +197,7 @@ ins_mode db 1
options db OPTS_AUTOINDENT+OPTS_OPTIMSAVE+OPTS_SMARTTAB options db OPTS_AUTOINDENT+OPTS_OPTIMSAVE+OPTS_SMARTTAB
mainwnd_pos: mainwnd_pos:
.x dd 100 .x dd 250
.y dd 75 .y dd 75
.w dd 6*80+6+SCRLW+5 .w dd 6*80+6+SCRLW+5
.h dd 402 .h dd 402
@ -235,7 +237,7 @@ section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
mov eax,65536 mov eax,65536
call mem.Alloc call mem.Alloc
mov [cur_tab.Editor.Data],eax mov [cur_editor.Lines],eax
inc [do_not_draw] inc [do_not_draw]
@ -364,7 +366,7 @@ func start_fasm ;/////////////////////////////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; BL = run after compile ; BL = run after compile
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
cmp [cur_tab.Editor.AsmMode],0 ;! [asm_mode],0 cmp [cur_editor.AsmMode],0 ;! [asm_mode],0
jne @f jne @f
ret ret
@@: mov esi,f_info.path ; s_fname @@: mov esi,f_info.path ; s_fname
@ -560,7 +562,7 @@ key0 db \
0x00,0x39,0x00,0x00,0x00,0x00,0x00,0x00 0x00,0x39,0x00,0x00,0x00,0x00,0x00,0x00
times 12*16 db 0x00 times 12*16 db 0x00
accel_table dd \ accel_table_main dd \
0x0000000E,key.bkspace ,\ ; BackSpace 0x0000000E,key.bkspace ,\ ; BackSpace
0x0000000F,key.tab ,\ ; Tab 0x0000000F,key.tab ,\ ; Tab
0x0000001C,key.return ,\ ; Return 0x0000001C,key.return ,\ ; Return
@ -599,6 +601,7 @@ accel_table dd \
0x0002002E,key.ctrl_c ,\ ; Ctrl+C 0x0002002E,key.ctrl_c ,\ ; Ctrl+C
0x0002002F,key.ctrl_v ,\ ; Ctrl+V 0x0002002F,key.ctrl_v ,\ ; Ctrl+V
0x00020031,key.ctrl_n ,\ ; Ctrl+N 0x00020031,key.ctrl_n ,\ ; Ctrl+N
0x0002003E,key.ctrl_f4 ,\ ; Ctrl+F4
0x00020043,key.ctrl_f9 ,\ ; Ctrl+F9 0x00020043,key.ctrl_f9 ,\ ; Ctrl+F9
0x00020147,key.ctrl_home ,\ ; Ctrl+Home 0x00020147,key.ctrl_home ,\ ; Ctrl+Home
\;0x00020148,key.ctrl_up ,\ ; Ctrl+Up \;0x00020148,key.ctrl_up ,\ ; Ctrl+Up
@ -641,10 +644,12 @@ accel_table_textbox dd \
accel_table2 dd \ accel_table2 dd \
1,btn.close_main_window ,\ 1,btn.close_main_window ,\
'UP',btn.scroll_up ,\ 'VSL',btn.vscroll_up ,\
'DN',btn.scroll_down ,\ 'VSG',btn.vscroll_down ,\
'LT',btn.scroll_left ,\ 'HSL',btn.hscroll_up ,\
'RT',btn.scroll_right ,\ 'HSG',btn.hscroll_down ,\
'TBL',btn.tabctl_right ,\
'TBG',btn.tabctl_left ,\
0 0
accel_table2_botdlg dd \ accel_table2_botdlg dd \
@ -725,7 +730,9 @@ file_info FILEINFO
tab_bar TABCTL tab_bar TABCTL
virtual at tab_bar.Current virtual at tab_bar.Current
cur_tab TABITEM cur_tab TABITEM
;cur_tab_addr dd ? end virtual
virtual at tab_bar.Current.Editor
cur_editor EDITOR
end virtual end virtual
lines.scr dd ? ; number of lines on the screen lines.scr dd ? ; number of lines on the screen

View File

@ -19,12 +19,12 @@ ends
struct EDITOR struct EDITOR
FilePath db PATHL dup(?) FilePath db PATHL dup(?)
FileName dd ? FileName dd ?
Data dd ?
Bounds RECT Bounds RECT
Lines dd ?
Lines.Count dd ?
Columns.Count dd ?
Caret POINT Caret POINT
SelStart POINT SelStart POINT
Lines dd ?
Columns dd ?
TopLeft POINT TopLeft POINT
VScroll SCROLLBAR VScroll SCROLLBAR
HScroll SCROLLBAR HScroll SCROLLBAR
@ -40,13 +40,16 @@ struct TABITEM
ends ends
struct TABCTL struct TABCTL
Bounds RECT Bounds RECT
Items dd ? Items dd ?
Items.Count dd ? Items.Count dd ?
Current TABITEM Items.Left dd ?
Current.Ptr dd ? Current TABITEM
Style db ? Current.Ptr dd ?
db 3 dup(?) Buttons.First dd ?
Buttons.Last dd ?
Style db ?
db 3 dup(?)
ends ends
@ -193,6 +196,14 @@ OPTS_SMARTTAB = 00001000b
OPTS_OPTIMSAVE = 00010000b OPTS_OPTIMSAVE = 00010000b
OPTS_LINENUMS = 00100000b OPTS_LINENUMS = 00100000b
;// MOUSE EVENTS
MEV_LDOWN = 1
MEV_LUP = 2
MEV_RDOWN = 3
MEV_RUP = 4
MEV_MOVE = 5
;// KEY MODIFIERS ;// KEY MODIFIERS
KM_SHIFT = 0x00010000 KM_SHIFT = 0x00010000

View File

@ -20,46 +20,79 @@ button:
cmp byte[esi],0 cmp byte[esi],0
jne .acc jne .acc
cmp eax,[tab_bar.Buttons.First]
jb @f
cmp eax,[tab_bar.Buttons.Last]
ja @f
;// TAB CONTROL BUTTONS
add eax,-1000
imul ebp,eax,sizeof.TABITEM
add ebp,[tab_bar.Items]
cmp ebp,[tab_bar.Current.Ptr]
je @f
call set_cur_tab
call align_editor_in_tab
call draw_editor
call draw_statusbar
call draw_tabctl
@@:
jmp still.skip_write jmp still.skip_write
btn.scroll_up: btn.vscroll_up:
dec [cur_tab.Editor.TopLeft.Y] ;! [top_line] dec [cur_editor.TopLeft.Y] ;! [top_line]
jns @f jns @f
inc [cur_tab.Editor.TopLeft.Y] ;! [top_line] inc [cur_editor.TopLeft.Y] ;! [top_line]
ret ret
@@: call check_inv_all.skip_check @@: call check_inv_all.skip_check
ret ret
btn.scroll_down: btn.vscroll_down:
inc [cur_tab.Editor.TopLeft.Y] ;! [top_line] inc [cur_editor.TopLeft.Y] ;! [top_line]
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] mov eax,[cur_editor.Lines.Count] ;! eax,[lines]
sub eax,[lines.scr] sub eax,[lines.scr]
cmp eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] cmp eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
jge @f jge @f
dec [cur_tab.Editor.TopLeft.Y] ;! [top_line] dec [cur_editor.TopLeft.Y] ;! [top_line]
ret ret
@@: call check_inv_all.skip_check @@: call check_inv_all.skip_check
ret ret
btn.scroll_left: btn.hscroll_up:
dec [cur_tab.Editor.TopLeft.X] ;! [left_col] dec [cur_editor.TopLeft.X] ;! [left_col]
jns @f jns @f
inc [cur_tab.Editor.TopLeft.X] ;! [left_col] inc [cur_editor.TopLeft.X] ;! [left_col]
ret;jmp still.skip_write ret;jmp still.skip_write
@@: call check_inv_all.skip_check @@: call check_inv_all.skip_check
ret ret
btn.scroll_right: btn.hscroll_down:
inc [cur_tab.Editor.TopLeft.X] ;! [left_col] inc [cur_editor.TopLeft.X] ;! [left_col]
mov eax,[cur_tab.Editor.Columns] ;! eax,[columns] mov eax,[cur_editor.Columns.Count] ;! eax,[columns]
sub eax,[columns.scr] sub eax,[columns.scr]
cmp eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] cmp eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
jge @f jge @f
dec [cur_tab.Editor.TopLeft.X] ;! [left_col] dec [cur_editor.TopLeft.X] ;! [left_col]
ret ret
@@: call check_inv_all.skip_check @@: call check_inv_all.skip_check
ret ret
btn.tabctl_right:
call get_hidden_tabitems_number
or eax,eax
jz @f
inc [tab_bar.Items.Left]
call draw_tabctl
@@: ret
btn.tabctl_left:
dec [tab_bar.Items.Left]
jns @f
inc [tab_bar.Items.Left]
@@: call draw_tabctl
ret
btn.search: btn.search:
key.f3: key.f3:
call search call search
@ -70,7 +103,7 @@ button:
func search func search
cld cld
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y] mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
mov edx,ecx mov edx,ecx
call get_line_offset call get_line_offset
cmp word[esi],0 cmp word[esi],0
@ -80,9 +113,9 @@ func search
or eax,eax or eax,eax
jz .end_line.2 jz .end_line.2
mov ecx,eax mov ecx,eax
sub ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x] sub ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
push esi push esi
add esi,[cur_tab.Editor.Caret.X] ;! esi,[pos.x] add esi,[cur_editor.Caret.X] ;! esi,[pos.x]
jmp @f jmp @f
.next_line: .next_line:
@ -118,15 +151,15 @@ func search
.found: .found:
add esp,4 add esp,4
mov [cur_tab.Editor.Caret.Y],edx ;! [pos.y],edx mov [cur_editor.Caret.Y],edx ;! [pos.y],edx
mov [cur_tab.Editor.SelStart.Y],edx ;! [sel.y],edx mov [cur_editor.SelStart.Y],edx ;! [sel.y],edx
mov ecx,edx mov ecx,edx
lea eax,[esi-4] lea eax,[esi-4]
call get_line_offset call get_line_offset
sub eax,esi sub eax,esi
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax mov [cur_editor.SelStart.X],eax ;! [sel.x],eax
add eax,[s_search.size] add eax,[s_search.size]
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax mov [cur_editor.Caret.X],eax ;! [pos.x],eax
mov [s_status],0 mov [s_status],0
clc clc
ret ret
@ -173,34 +206,37 @@ endf
@@: @@:
xor eax,eax xor eax,eax
mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax
mov [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax mov [cur_editor.TopLeft.X],eax ;! [left_col],eax
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax mov [cur_editor.Caret.X],eax ;! [pos.x],eax
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax mov [cur_editor.Caret.Y],eax ;! [pos.y],eax
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax mov [cur_editor.SelStart.X],eax ;! [sel.x],eax
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax
mov [cur_tab.Editor.Modified],al ;! [modified],al mov [cur_editor.Modified],al ;! [modified],al
; enable color syntax for ASM and INC files: ; enable color syntax for ASM and INC files:
mov [cur_tab.Editor.AsmMode],al ;! [asm_mode],al mov [cur_editor.AsmMode],al ;! [asm_mode],al
mov eax,[f_info.length] ; mov eax,[f_info.length]
add eax,f_info.path ; add eax,f_info.path
mov byte[eax],0 ; mov byte[eax],0
mov ecx, dword [eax-3] lea ebx,[cur_editor.FilePath]
or ecx, 0x202020 mov eax,ebx
cmp ecx, 'asm' call strlen
mov ecx,dword[ebx+eax-3]
or ecx,0x202020
cmp ecx,'asm'
jne @f jne @f
inc [cur_tab.Editor.AsmMode] ;! [asm_mode] inc [cur_editor.AsmMode] ;! [asm_mode]
jmp .nocol jmp .nocol
@@: cmp ecx, 'inc' @@: cmp ecx,'inc'
jne .nocol jne .nocol
inc [cur_tab.Editor.AsmMode] ;! [asm_mode] inc [cur_editor.AsmMode] ;! [asm_mode]
.nocol: .nocol:
update_caption: update_caption:
lea esi,[cur_tab.Editor.FilePath] ;! mov esi,f_info.path lea esi,[cur_editor.FilePath] ;! mov esi,f_info.path
mov edi,s_title mov edi,s_title
@@: lodsb @@: lodsb

View File

@ -4,62 +4,62 @@ func check_cur_vis_inv ;//////////////////////////////////////////////////////
push eax ebx push eax ebx
xor bl,bl xor bl,bl
.chk_y: .chk_y:
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
or eax,eax or eax,eax
jge @f jge @f
mov [cur_tab.Editor.Caret.Y],0 ;! [pos.y],0 mov [cur_editor.Caret.Y],0 ;! [pos.y],0
jmp .chk_dy jmp .chk_dy
@@: cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines] @@: cmp eax,[cur_editor.Lines.Count] ;! eax,[lines]
jl .chk_dy jl .chk_dy
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] mov eax,[cur_editor.Lines.Count] ;! eax,[lines]
dec eax dec eax
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax mov [cur_editor.Caret.Y],eax ;! [pos.y],eax
.chk_dy: .chk_dy:
mov eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] mov eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
cmp eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] cmp eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
jle @f jle @f
m2m [cur_tab.Editor.TopLeft.Y],[cur_tab.Editor.Caret.Y] m2m [cur_editor.TopLeft.Y],[cur_editor.Caret.Y]
;! push [pos.y] ;! push [pos.y]
;! pop [top_line] ;! pop [top_line]
inc bl inc bl
@@: add eax,[lines.scr] @@: add eax,[lines.scr]
cmp eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] cmp eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
jg .chk_x jg .chk_x
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
sub eax,[lines.scr] sub eax,[lines.scr]
inc eax inc eax
mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax
inc bl inc bl
.chk_x: .chk_x:
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] mov eax,[cur_editor.Caret.X] ;! eax,[pos.x]
or eax,eax or eax,eax
jge @f jge @f
mov [cur_tab.Editor.Caret.X],0 ;! [pos.x],0 mov [cur_editor.Caret.X],0 ;! [pos.x],0
jmp .chk_dx jmp .chk_dx
@@: cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns] @@: cmp eax,[cur_editor.Columns.Count] ;! eax,[columns]
jl .chk_dx jl .chk_dx
mov eax,[cur_tab.Editor.Columns] ;! eax,[columns] mov eax,[cur_editor.Columns.Count] ;! eax,[columns]
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax mov [cur_editor.Caret.X],eax ;! [pos.x],eax
.chk_dx: .chk_dx:
mov eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] mov eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] cmp eax,[cur_editor.Caret.X] ;! eax,[pos.x]
jle @f jle @f
m2m [cur_tab.Editor.TopLeft.X],[cur_tab.Editor.Caret.X] m2m [cur_editor.TopLeft.X],[cur_editor.Caret.X]
;! push [pos.x] ;! push [pos.x]
;! pop [left_col] ;! pop [left_col]
inc bl inc bl
@@: add eax,[columns.scr] @@: add eax,[columns.scr]
cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] cmp eax,[cur_editor.Caret.X] ;! eax,[pos.x]
jg @f jg @f
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] mov eax,[cur_editor.Caret.X] ;! eax,[pos.x]
sub eax,[columns.scr] sub eax,[columns.scr]
inc eax inc eax
mov [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax mov [cur_editor.TopLeft.X],eax ;! [left_col],eax
inc bl inc bl
@@: cmp [mev],MEV_LDOWN @@: cmp [mev],MEV_LDOWN
jne .exit jne .exit
push [cur_tab.Editor.Caret.X] [cur_tab.Editor.Caret.Y] ;! [pos.x] [pos.y] push [cur_editor.Caret.X] [cur_editor.Caret.Y] ;! [pos.x] [pos.y]
pop [cur_tab.Editor.SelStart.Y] [cur_tab.Editor.SelStart.X] ;! [sel.y] [sel.x] pop [cur_editor.SelStart.Y] [cur_editor.SelStart.X] ;! [sel.y] [sel.x]
.exit: .exit:
or bl,bl or bl,bl
clc clc
@ -74,13 +74,13 @@ endf
func clear_selection ;//////////////////////////////////////////////////////// func clear_selection ;////////////////////////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
push eax ebx push eax ebx
mov eax,[cur_tab.Editor.SelStart.Y] ;! eax,[sel.y] mov eax,[cur_editor.SelStart.Y] ;! eax,[sel.y]
mov ebx,[cur_tab.Editor.Caret.Y] ;! ebx,[pos.y] mov ebx,[cur_editor.Caret.Y] ;! ebx,[pos.y]
cmp eax,ebx cmp eax,ebx
jle @f jle @f
xchg eax,ebx xchg eax,ebx
@@: push [cur_tab.Editor.Caret.X] [cur_tab.Editor.Caret.Y] ;! [pos.x] [pos.y] @@: push [cur_editor.Caret.X] [cur_editor.Caret.Y] ;! [pos.x] [pos.y]
pop [cur_tab.Editor.SelStart.Y] [cur_tab.Editor.SelStart.X] ;! [sel.y] [sel.x] pop [cur_editor.SelStart.Y] [cur_editor.SelStart.X] ;! [sel.y] [sel.x]
call draw_file.ex call draw_file.ex
pop ebx eax pop ebx eax
ret ret
@ -107,24 +107,24 @@ endf
func check_bottom_right ;///////////////////////////////////////////////////// func check_bottom_right ;/////////////////////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
push eax push eax
mov eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] mov eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
add eax,[lines.scr] add eax,[lines.scr]
cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines] cmp eax,[cur_editor.Lines.Count] ;! eax,[lines]
jbe .lp1 jbe .lp1
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] mov eax,[cur_editor.Lines.Count] ;! eax,[lines]
sub eax,[lines.scr] sub eax,[lines.scr]
jns @f jns @f
xor eax,eax xor eax,eax
@@: mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax @@: mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax
.lp1: mov eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] .lp1: mov eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
add eax,[columns.scr] add eax,[columns.scr]
cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns] cmp eax,[cur_editor.Columns.Count] ;! eax,[columns]
jbe .exit jbe .exit
mov eax,[cur_tab.Editor.Columns] ;! eax,[columns] mov eax,[cur_editor.Columns.Count] ;! eax,[columns]
sub eax,[columns.scr] sub eax,[columns.scr]
jns @f jns @f
xor eax,eax xor eax,eax
@@: mov [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax @@: mov [cur_editor.TopLeft.X],eax ;! [left_col],eax
.exit: .exit:
pop eax pop eax
ret ret
@ -150,12 +150,12 @@ endf
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
func check_inv_all ;////////////////////////////////////////////////////////// func check_inv_all ;//////////////////////////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line] mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
.skip_init: .skip_init:
call check_cur_vis call check_cur_vis
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax mov [cur_editor.Caret.Y],eax ;! [pos.y],eax
mov [cur_tab.Editor.TopLeft.Y],ecx ;! [top_line],ecx mov [cur_editor.TopLeft.Y],ecx ;! [top_line],ecx
.skip_check: .skip_check:
; call clear_screen ; call clear_screen
call draw_file call draw_file
@ -169,9 +169,9 @@ func check_cur_vis ;//////////////////////////////////////////////////////////
jb .low jb .low
mov edx,ecx mov edx,ecx
add edx,[lines.scr] add edx,[lines.scr]
cmp edx,[cur_tab.Editor.Lines] ;! edx,[lines] cmp edx,[cur_editor.Lines.Count] ;! edx,[lines]
jbe @f jbe @f
mov edx,[cur_tab.Editor.Lines] ;! edx,[lines] mov edx,[cur_editor.Lines.Count] ;! edx,[lines]
@@: cmp eax,edx @@: cmp eax,edx
jb @f jb @f
lea ecx,[eax+1] lea ecx,[eax+1]
@ -182,17 +182,17 @@ func check_cur_vis ;//////////////////////////////////////////////////////////
.low: mov ecx,eax .low: mov ecx,eax
@@: mov edx,ecx @@: mov edx,ecx
add edx,[lines.scr] add edx,[lines.scr]
cmp edx,[cur_tab.Editor.Lines] ;! edx,[lines] cmp edx,[cur_editor.Lines.Count] ;! edx,[lines]
jbe @f jbe @f
mov ecx,[cur_tab.Editor.Lines] ;! ecx,[lines] mov ecx,[cur_editor.Lines.Count] ;! ecx,[lines]
sub ecx,[lines.scr] sub ecx,[lines.scr]
jns @f jns @f
xor ecx,ecx xor ecx,ecx
@@:;mov [top_line],ecx @@:;mov [top_line],ecx
pushad pushad
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] mov eax,[cur_editor.Caret.X] ;! eax,[pos.x]
mov ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col] mov ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col]
mov ecx,ebx mov ecx,ebx
add ecx,[columns.scr] add ecx,[columns.scr]
cmp eax,ebx cmp eax,ebx
@ -203,10 +203,10 @@ func check_cur_vis ;//////////////////////////////////////////////////////////
sub ebx,[columns.scr] sub ebx,[columns.scr]
jmp @f jmp @f
.lp1: mov ebx,eax .lp1: mov ebx,eax
@@: mov [cur_tab.Editor.TopLeft.X],ebx ;! [left_col],ebx @@: mov [cur_editor.TopLeft.X],ebx ;! [left_col],ebx
.exit: .exit:
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax mov [cur_editor.Caret.X],eax ;! [pos.x],eax
popad popad
ret ret
@ -232,7 +232,7 @@ func get_line_offset ;////////////////////////////////////////////////////////
; ESI = line data offset ; ESI = line data offset
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
push eax ecx push eax ecx
mov esi,[cur_tab.Editor.Data] ;! AREA_EDIT mov esi,[cur_editor.Lines] ;! AREA_EDIT
@@: dec ecx @@: dec ecx
js .exit js .exit
movzx eax,word[esi] movzx eax,word[esi]
@ -248,10 +248,10 @@ func init_sel_vars ;//////////////////////////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
pushad pushad
mov [sel.selected],1 mov [sel.selected],1
mov eax,[cur_tab.Editor.SelStart.X] ;! eax,[sel.x] mov eax,[cur_editor.SelStart.X] ;! eax,[sel.x]
mov ebx,[cur_tab.Editor.SelStart.Y] ;! ebx,[sel.y] mov ebx,[cur_editor.SelStart.Y] ;! ebx,[sel.y]
mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x] mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
mov edx,[cur_tab.Editor.Caret.Y] ;! edx,[pos.y] mov edx,[cur_editor.Caret.Y] ;! edx,[pos.y]
cmp ebx,edx cmp ebx,edx
jl .lp2 jl .lp2
jne @f jne @f
@ -508,7 +508,7 @@ func line_add_spaces ;////////////////////////////////////////////////////////
jbe .exit jbe .exit
sub ecx,edx sub ecx,edx
push ecx push ecx
mov edi,[cur_tab.Editor.Data] ;! AREA_TEMP2 mov edi,[cur_editor.Lines] ;! AREA_TEMP2
add edi,[edi-4] add edi,[edi-4]
dec edi dec edi
mov eax,esi mov eax,esi
@ -563,14 +563,14 @@ func delete_selection ;///////////////////////////////////////////////////////
mov [edi-4],bx mov [edi-4],bx
add edi,[sel.begin.x] add edi,[sel.begin.x]
lea esi,[esi+eax+4] lea esi,[esi+eax+4]
mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2 mov ecx,[cur_editor.Lines] ;! AREA_TEMP2
add ecx,[ecx-4] add ecx,[ecx-4]
sub ecx,esi sub ecx,esi
cld cld
rep movsb rep movsb
mov eax,[sel.end.y] mov eax,[sel.end.y]
sub eax,[sel.begin.y] sub eax,[sel.begin.y]
sub [cur_tab.Editor.Lines],eax ;! [lines],eax sub [cur_editor.Lines.Count],eax ;! [lines],eax
jmp .exit jmp .exit
.single_line: .single_line:
@ -589,7 +589,7 @@ func delete_selection ;///////////////////////////////////////////////////////
lea edi,[esi+4] lea edi,[esi+4]
add edi,[sel.begin.x] add edi,[sel.begin.x]
lea esi,[edi+ecx] lea esi,[edi+ecx]
mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2 mov ecx,[cur_editor.Lines] ;! AREA_TEMP2
add ecx,[ecx-4] add ecx,[ecx-4]
sub ecx,esi sub ecx,esi
cld cld
@ -597,13 +597,13 @@ func delete_selection ;///////////////////////////////////////////////////////
.exit: .exit:
mov eax,[sel.begin.x] mov eax,[sel.begin.x]
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax mov [cur_editor.Caret.X],eax ;! [pos.x],eax
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax mov [cur_editor.SelStart.X],eax ;! [sel.x],eax
mov eax,[sel.begin.y] mov eax,[sel.begin.y]
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax mov [cur_editor.Caret.Y],eax ;! [pos.y],eax
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax
popad popad
mov [cur_tab.Editor.Modified],1 ;! [modified],1 mov [cur_editor.Modified],1 ;! [modified],1
clc clc
ret ret

View File

@ -3,6 +3,7 @@ define mm.File.New key.ctrl_n
define mm.File.Open key.ctrl_o define mm.File.Open key.ctrl_o
define mm.File.Save key.ctrl_s define mm.File.Save key.ctrl_s
define mm.File.SaveAs key.shift_ctrl_s define mm.File.SaveAs key.shift_ctrl_s
define mm.File.Close key.ctrl_f4
define mm.File.Exit key.alt_x define mm.File.Exit key.alt_x
define mm.Edit.Cut key.ctrl_x define mm.Edit.Cut key.ctrl_x
@ -12,7 +13,7 @@ define mm.Edit.Delete key.del
define mm.Edit.SelAll key.ctrl_a define mm.Edit.SelAll key.ctrl_a
define mm.Search.Position key.ctrl_g define mm.Search.Position key.ctrl_g
define mm.Search.Find key.ctrl_f define mm.Search.Find key.ctrl_f
define mm.Search.FindNext key.f3 define mm.Search.FindNext key.f3
define mm.Search.Replace key.ctrl_h define mm.Search.Replace key.ctrl_h
@ -23,8 +24,8 @@ define mm.Run.SysFuncs open_sysfuncs_txt
define mm.Encoding.CP866.CP1251 recode.866.1251 define mm.Encoding.CP866.CP1251 recode.866.1251
define mm.Encoding.CP1251.CP866 recode.1251.866 define mm.Encoding.CP1251.CP866 recode.1251.866
define mm.Encoding.CP866.KOI8R recode.866.koi define mm.Encoding.CP866.KOI8R recode.866.koi
define mm.Encoding.KOI8R.CP866 recode.koi.866 define mm.Encoding.KOI8R.CP866 recode.koi.866
define mm.Encoding.CP1251.KOI8R recode.1251.koi define mm.Encoding.CP1251.KOI8R recode.1251.koi
define mm.Encoding.KOI8R.CP1251 recode.koi.1251 define mm.Encoding.KOI8R.CP1251 recode.koi.1251

View File

@ -313,10 +313,10 @@ botdlg.button:
mov [copy_size],eax mov [copy_size],eax
mov [copy_count],1 mov [copy_count],1
push [cur_tab.Editor.SelStart.X] ;! [sel.x] push [cur_editor.SelStart.X] ;! [sel.x]
call init_sel_vars call init_sel_vars
call key.ctrl_v call key.ctrl_v
pop [cur_tab.Editor.SelStart.X] ;! [sel.x] pop [cur_editor.SelStart.X] ;! [sel.x]
mov eax,[copy_buf] mov eax,[copy_buf]
call mem.Free call mem.Free

View File

@ -48,17 +48,17 @@ func drawwindow ;///// DRAW WINDOW ///////////////////////////////////////////
mov [top_ofs],ATOPH;+1 mov [top_ofs],ATOPH;+1
mov eax,[cur_tab.Editor.Bounds.Right] mov eax,[cur_editor.Bounds.Right]
sub eax,[cur_tab.Editor.Bounds.Left] sub eax,[cur_editor.Bounds.Left]
sub eax,[cur_tab.Editor.Gutter.Width] sub eax,[cur_editor.Gutter.Width]
sub eax,SCRLW+LCHGW+4 sub eax,SCRLW+LCHGW+4
cdq cdq
mov ebx,6 mov ebx,6
div ebx div ebx
mov [columns.scr],eax mov [columns.scr],eax
mov eax,[cur_tab.Editor.Bounds.Bottom] mov eax,[cur_editor.Bounds.Bottom]
sub eax,[cur_tab.Editor.Bounds.Top] sub eax,[cur_editor.Bounds.Top]
sub eax,SCRLW+3 sub eax,SCRLW+3
cdq cdq
mov ebx,LINEH mov ebx,LINEH
@ -250,10 +250,10 @@ macro unused {
cmp eax,ebx cmp eax,ebx
jle @f jle @f
xchg eax,ebx xchg eax,ebx
@@: cmp eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] @@: cmp eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
jge @f jge @f
mov eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] mov eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
@@: mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line] @@: mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
add ecx,[lines.scr] add ecx,[lines.scr]
cmp ebx,ecx cmp ebx,ecx
jl @f jl @f
@ -273,11 +273,11 @@ macro unused {
mov ebx,[top_ofs] mov ebx,[top_ofs]
add ebx,[left_ofs-2] add ebx,[left_ofs-2]
sub eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] sub eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
imul eax,LINEH imul eax,LINEH
add ebx,eax add ebx,eax
imul ebp,[cur_tab.Editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536 imul ebp,[cur_editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536
or [draw_blines],-1 or [draw_blines],-1
jmp draw_file.next_line jmp draw_file.next_line
@ -302,7 +302,7 @@ macro unused {
mov ebx,[top_ofs] mov ebx,[top_ofs]
add ebx,[left_ofs-2] add ebx,[left_ofs-2]
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line] mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
push ecx push ecx
call get_line_offset call get_line_offset
@ -313,9 +313,9 @@ macro unused {
jle .exit jle .exit
add esp,-4 add esp,-4
imul ebp,[cur_tab.Editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536 imul ebp,[cur_editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536
mov eax,[lines.scr] mov eax,[lines.scr]
sub eax,[cur_tab.Editor.Lines] ;! eax,[lines] sub eax,[cur_editor.Lines] ;! eax,[lines]
mov [draw_blines],eax mov [draw_blines],eax
.next_line: .next_line:
@ -346,7 +346,7 @@ macro unused {
cmp eax,[sel.end.y] cmp eax,[sel.end.y]
je .lp5 je .lp5
.lp2: mov eax,[sel.begin.x] .lp2: mov eax,[sel.begin.x]
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
jle .lp6.2 jle .lp6.2
cmp eax,[columns.scr] cmp eax,[columns.scr]
jge .lp6 jge .lp6
@ -369,7 +369,7 @@ macro unused {
cmp eax,[sel.end.y] cmp eax,[sel.end.y]
je .lp5 je .lp5
.lp4: mov eax,[sel.end.x] .lp4: mov eax,[sel.end.x]
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
jle .lp6 jle .lp6
cmp eax,[columns.scr] cmp eax,[columns.scr]
jg .lp6.2 jg .lp6.2
@ -388,7 +388,7 @@ macro unused {
mov bx,ax mov bx,ax
mov [in_sel],3 mov [in_sel],3
jmp .lp6 jmp .lp6
.lp5: mov eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] .lp5: mov eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
cmp eax,[sel.begin.x] cmp eax,[sel.begin.x]
jge .lp4 jge .lp4
add eax,[columns.scr] add eax,[columns.scr]
@ -397,7 +397,7 @@ macro unused {
mov eax,[sel.begin.x] mov eax,[sel.begin.x]
cmp eax,[sel.end.x] cmp eax,[sel.end.x]
je .lp6 je .lp6
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
imul eax,6 imul eax,6
pushad pushad
mov ebx,[sel.end.x] mov ebx,[sel.end.x]
@ -471,13 +471,13 @@ macro unused {
push esi ebx push esi ebx
mov eax,ebx mov eax,ebx
sub ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col] sub ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col]
cmp ebx,[columns.scr] cmp ebx,[columns.scr]
jge .skip_t jge .skip_t
add ebx,esi add ebx,esi
jle .skip_t jle .skip_t
mov ebx,[esp+8+4*2] ;// 4*2=esi+ebx mov ebx,[esp+8+4*2] ;// 4*2=esi+ebx
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
jge .qqq jge .qqq
sub edx,eax sub edx,eax
add esi,eax add esi,eax
@ -494,7 +494,7 @@ macro unused {
mov eax,[esp] ; ebx mov eax,[esp] ; ebx
add eax,[esp+4] ; esi add eax,[esp+4] ; esi
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
sub eax,[columns.scr] sub eax,[columns.scr]
jle .qweqwe jle .qweqwe
sub esi,eax sub esi,eax
@ -518,7 +518,7 @@ macro unused {
mov esi,[sel.begin.x] mov esi,[sel.begin.x]
sub esi,[esp] sub esi,[esp]
pushad pushad
mov ecx,[cur_tab.Editor.TopLeft.X] ;! ecx,[left_col] mov ecx,[cur_editor.TopLeft.X] ;! ecx,[left_col]
sub ecx,[esp+4*8] sub ecx,[esp+4*8]
jle @f jle @f
sub esi,ecx sub esi,ecx
@ -548,7 +548,7 @@ macro unused {
sub eax,[esp] sub eax,[esp]
push ebx push ebx
mov ebx,[esp+4] mov ebx,[esp+4]
sub ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col] sub ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col]
jge .ya2.1 jge .ya2.1
add eax,ebx add eax,ebx
.ya2.1: .ya2.1:
@ -580,7 +580,7 @@ macro unused {
sub esi,[esp] sub esi,[esp]
push eax push eax
mov eax,[esp+4] mov eax,[esp+4]
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
jge .nt3.1 jge .nt3.1
add esi,eax add esi,eax
.nt3.1: .nt3.1:
@ -661,7 +661,7 @@ macro unused {
shl ebx,16 shl ebx,16
add ebx,[top_ofs] add ebx,[top_ofs]
mov edi,[sc.work_text] mov edi,[sc.work_text]
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line] mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
inc ecx inc ecx
mov edx,p_info+100 mov edx,p_info+100
@@: pushad @@: pushad
@ -679,10 +679,10 @@ macro unused {
popad popad
add ebx,LINEH add ebx,LINEH
inc ecx inc ecx
cmp ecx,[cur_tab.Editor.Lines] ;! ecx,[lines] cmp ecx,[cur_editor.Lines] ;! ecx,[lines]
jg @f jg @f
mov esi,ecx mov esi,ecx
sub esi,[cur_tab.Editor.TopLeft.Y] ;! esi,[top_line] sub esi,[cur_editor.TopLeft.Y] ;! esi,[top_line]
cmp esi,[lines.scr] cmp esi,[lines.scr]
jbe @b jbe @b
@@: add esp,4*8*2 @@: add esp,4*8*2
@ -707,8 +707,8 @@ macro unused {
add esp,4 add esp,4
cmp [bot_mode],0 cmp [bot_mode],0
jne @f jne @f
mov ebx,[cur_tab.Editor.Caret.X] ;! ebx,[pos.x] mov ebx,[cur_editor.Caret.X] ;! ebx,[pos.x]
sub ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col] sub ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col]
js @f js @f
cmp ebx,[columns.scr] cmp ebx,[columns.scr]
ja @f ja @f
@ -718,8 +718,8 @@ macro unused {
push bx push bx
shl ebx,16 shl ebx,16
pop bx pop bx
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
sub eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] sub eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
js @f js @f
cmp eax,[lines.scr] cmp eax,[lines.scr]
jge @f jge @f
@ -805,15 +805,15 @@ macro unused {
; sub ebx,1*65536-2 ; sub ebx,1*65536-2
push ebx push ebx
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] mov eax,[cur_editor.Lines] ;! eax,[lines]
mov ebx,[lines.scr] mov ebx,[lines.scr]
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line] mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
mov edx,[bot_ofs] mov edx,[bot_ofs]
sub edx,[top_ofs] sub edx,[top_ofs]
add edx,-SCRLW*3+1 add edx,-SCRLW*3+1
call get_scroll_vars call get_scroll_vars
mov [cur_tab.Editor.VScroll.Top],eax ;! [vscrl_top],eax mov [cur_editor.VScroll.Top],eax ;! [vscrl_top],eax
mov [cur_tab.Editor.VScroll.Size],ebx ;! [vscrl_size],ebx mov [cur_editor.VScroll.Size],ebx ;! [vscrl_size],ebx
pop ebx pop ebx
mov ecx,eax mov ecx,eax
@ -829,7 +829,7 @@ macro unused {
; rol ecx,16 ; rol ecx,16
; movsx eax,cx ; movsx eax,cx
; sar ecx,16 ; sar ecx,16
push ebx ecx SCRLW [cur_tab.Editor.VScroll.Size] ;! ebx ecx SCRLW [vscrl_size] push ebx ecx SCRLW [cur_editor.VScroll.Size] ;! ebx ecx SCRLW [vscrl_size]
dec dword[esp] dec dword[esp]
call draw_3d_panel call draw_3d_panel
popad popad
@ -838,7 +838,7 @@ macro unused {
inc ebx inc ebx
mov ecx,[top_ofs-2] mov ecx,[top_ofs-2]
mov cx,word[cur_tab.Editor.VScroll.Top] ;! cx,word[vscrl_top] mov cx,word[cur_editor.VScroll.Top] ;! cx,word[vscrl_top]
add ecx,(SCRLW-1)*65536 add ecx,(SCRLW-1)*65536
mov edx,[sc.work];[color_tbl+4*5] mov edx,[sc.work];[color_tbl+4*5]
or cx,cx or cx,cx
@ -846,8 +846,8 @@ macro unused {
mcall 13 mcall 13
@@: @@:
mov ecx,[top_ofs] mov ecx,[top_ofs]
add ecx,[cur_tab.Editor.VScroll.Top] ;! ecx,[vscrl_top] add ecx,[cur_editor.VScroll.Top] ;! ecx,[vscrl_top]
add ecx,[cur_tab.Editor.VScroll.Size] ;! ecx,[vscrl_size] add ecx,[cur_editor.VScroll.Size] ;! ecx,[vscrl_size]
add ecx,SCRLW-1 add ecx,SCRLW-1
mov di,cx mov di,cx
shl ecx,16 shl ecx,16
@ -934,20 +934,20 @@ macro unused {
; inc ecx ; inc ecx
push ecx push ecx
mov eax,[cur_tab.Editor.Columns] ;! eax,[columns] mov eax,[cur_editor.Columns] ;! eax,[columns]
mov ebx,[columns.scr] mov ebx,[columns.scr]
mov ecx,[cur_tab.Editor.TopLeft.X] ;! ecx,[left_col] mov ecx,[cur_editor.TopLeft.X] ;! ecx,[left_col]
mov edx,[p_info.client_box.width] mov edx,[p_info.client_box.width]
add edx,-(SCRLW*3) add edx,-(SCRLW*3)
call get_scroll_vars call get_scroll_vars
mov [cur_tab.Editor.HScroll.Top],eax ;! [hscrl_top],eax mov [cur_editor.HScroll.Top],eax ;! [hscrl_top],eax
mov [cur_tab.Editor.HScroll.Size],ebx ;! [hscrl_size],ebx mov [cur_editor.HScroll.Size],ebx ;! [hscrl_size],ebx
pop ecx pop ecx
mov ebx,eax mov ebx,eax
add ebx,1+SCRLW add ebx,1+SCRLW
shl ebx,16 shl ebx,16
mov bx,word[cur_tab.Editor.HScroll.Size] ;! bx,word[hscrl_size] mov bx,word[cur_editor.HScroll.Size] ;! bx,word[hscrl_size]
; mcall 13,,,[sc.work_button] ; mcall 13,,,[sc.work_button]
;!!!!!!!!!!!!!!!!!! ;!!!!!!!!!!!!!!!!!!
@ -963,11 +963,11 @@ macro unused {
;!!!!!!!!!!!!!!!!!! ;!!!!!!!!!!!!!!!!!!
mov ebx,(1+SCRLW)*65536 mov ebx,(1+SCRLW)*65536
mov bx,word[cur_tab.Editor.HScroll.Top] ;! bx,word[hscrl_top] mov bx,word[cur_editor.HScroll.Top] ;! bx,word[hscrl_top]
mcall 13,,,[sc.work];[color_tbl+4*5] mcall 13,,,[sc.work];[color_tbl+4*5]
mov ebx,1+SCRLW mov ebx,1+SCRLW
add ebx,[cur_tab.Editor.HScroll.Top] ;! ebx,[hscrl_top] add ebx,[cur_editor.HScroll.Top] ;! ebx,[hscrl_top]
add ebx,[cur_tab.Editor.HScroll.Size] ;! ebx,[hscrl_size] add ebx,[cur_editor.HScroll.Size] ;! ebx,[hscrl_size]
mov di,bx mov di,bx
shl ebx,16 shl ebx,16
mov bx,word[p_info.client_box.width] mov bx,word[p_info.client_box.width]
@ -1011,7 +1011,7 @@ func get_next_part ;//////////////////////////////////////////////////////////
; EDX = string ; EDX = string
; ESI = length ; ESI = length
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
cmp [cur_tab.Editor.AsmMode],0 ;! [asm_mode],0 cmp [cur_editor.AsmMode],0 ;! [asm_mode],0
je .plain.text je .plain.text
xor ebx,ebx xor ebx,ebx
mov edx,ecx mov edx,ecx
@ -1159,7 +1159,7 @@ func draw_statusbar ;///// WRITE POSITION ////////////////////////////////////
and ecx,0x0000FFFF and ecx,0x0000FFFF
push ecx push ecx
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
inc eax inc eax
mov ecx,10 mov ecx,10
mov edi,p_info+0x100;htext2.pos1 mov edi,p_info+0x100;htext2.pos1
@ -1167,7 +1167,7 @@ func draw_statusbar ;///// WRITE POSITION ////////////////////////////////////
call uint2str call uint2str
mov al,',' mov al,','
stosb stosb
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] mov eax,[cur_editor.Caret.X] ;! eax,[pos.x]
inc eax inc eax
call uint2str call uint2str
@ -1182,7 +1182,7 @@ func draw_statusbar ;///// WRITE POSITION ////////////////////////////////////
sub ebx,edi sub ebx,edi
mcall 4,,[sc.work_text],p_info+0x100 mcall 4,,[sc.work_text],p_info+0x100
cmp [cur_tab.Editor.Modified],0 ;! [modified],0 cmp [cur_editor.Modified],0 ;! [modified],0
je @f je @f
and ebx,0x0000FFFF and ebx,0x0000FFFF
; add ebx,[left_ofs-2] ; add ebx,[left_ofs-2]
@ -1233,4 +1233,88 @@ func draw_framerect ; ebx,ecx,edx
pop ecx ebx pop ecx ebx
ret ret
endf endf
func calc_middle
shr eax,1
shr ebx,1
and eax,0x007F7F7F
and ebx,0x007F7F7F
add eax,ebx
ret
endf
func calc_3d_colors
pushad
m2m [cl_3d_normal],[sc.work]
m2m [cl_3d_inset],[sc.work_graph]
push [cl_3d_normal]
add byte[esp],48
jnc @f
mov byte[esp],255
@@: add byte[esp+1],48
jnc @f
mov byte[esp+1],255
@@: add byte[esp+2],48
jnc @f
mov byte[esp+2],255
@@: pop [cl_3d_outset]
mov eax,[cl_3d_inset]
mov ebx,[cl_3d_outset]
call calc_middle
mov [cl_3d_pushed],eax
mov eax,[cl_3d_normal]
mov ebx,[sc.work_text]
call calc_middle
mov [cl_3d_grayed],eax
popad
ret
endf
func draw_3d_panel ; x,y,w,h
push eax ebx ecx edx
cmp dword[esp+16+8],4
jl .exit
cmp dword[esp+16+4],4
jl .exit
mov ebx,[esp+16+16-2]
mov bx,[esp+16+8]
inc ebx
mov ecx,[esp+16+12-2]
mov cx,[esp+16+4]
inc ecx
mcall 13,,,[cl_3d_normal]
dec ebx
add bx,[esp+16+16]
mov cx,[esp+16+12]
mcall 38,,,[cl_3d_inset]
add ecx,[esp+16+4-2]
add cx,[esp+16+4]
mcall
mov bx,[esp+16+16]
mov ecx,[esp+16+12-2]
mov cx,[esp+16+4]
add cx,[esp+16+12]
mcall
add ebx,[esp+16+8-2]
add bx,[esp+16+8]
mcall
mov ebx,[esp+16+16-2]
mov bx,[esp+16+8]
add bx,[esp+16+16]
add ebx,1*65536-1
mov ecx,[esp+16+12-2]
mov cx,[esp+16+12]
add ecx,0x00010001
mcall ,,,[cl_3d_outset]
mov bx,[esp+16+16]
inc ebx
mov ecx,[esp+16+12-2]
mov cx,[esp+16+4]
add cx,[esp+16+12]
add ecx,2*65536-1
mcall
.exit:
pop edx ecx ebx eax
ret 4*4
endf

View File

@ -1,43 +1,43 @@
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
func draw_editor ;//////////////////////////////////////////////////////////// func draw_editor ;///// DRAW EDITOR //////////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov ebx,[cur_tab.Editor.Bounds.Left-2] mov ebx,[cur_editor.Bounds.Left-2]
mov bx,word[cur_tab.Editor.Bounds.Right] mov bx,word[cur_editor.Bounds.Right]
sub bx,word[cur_tab.Editor.Bounds.Left] sub bx,word[cur_editor.Bounds.Left]
inc ebx inc ebx
mov ecx,[cur_tab.Editor.Bounds.Top-2] mov ecx,[cur_editor.Bounds.Top-2]
mov cx,word[cur_tab.Editor.Bounds.Bottom] mov cx,word[cur_editor.Bounds.Bottom]
sub cx,word[cur_tab.Editor.Bounds.Top] sub cx,word[cur_editor.Bounds.Top]
inc ecx inc ecx
mov edx,[cl_3d_inset] mov edx,[cl_3d_inset]
call draw_framerect call draw_framerect
@^ @^
mov ebx,[cur_tab.Editor.Bounds.Left-2] mov ebx,[cur_editor.Bounds.Left-2]
mov bx,word[cur_tab.Editor.Bounds.Right] mov bx,word[cur_editor.Bounds.Right]
mov ecx,[cur_tab.Editor.Bounds.Top-2] mov ecx,[cur_editor.Bounds.Top-2]
mov cx,word[cur_tab.Editor.Bounds.Top] mov cx,word[cur_editor.Bounds.Top]
mcall 38,,,[cl_3d_inset] mcall 38,,,[cl_3d_inset]
mov ecx,[cur_tab.Editor.Bounds.Bottom-2] mov ecx,[cur_editor.Bounds.Bottom-2]
mov cx,word[cur_tab.Editor.Bounds.Bottom] mov cx,word[cur_editor.Bounds.Bottom]
mcall mcall
mov bx,word[cur_tab.Editor.Bounds.Left] mov bx,word[cur_editor.Bounds.Left]
mov cx,word[cur_tab.Editor.Bounds.Top] mov cx,word[cur_editor.Bounds.Top]
mcall mcall
mov ebx,[cur_tab.Editor.Bounds.Right-2] mov ebx,[cur_editor.Bounds.Right-2]
mov bx,word[cur_tab.Editor.Bounds.Right] mov bx,word[cur_editor.Bounds.Right]
mov cx,word[cur_tab.Editor.Bounds.Top] mov cx,word[cur_editor.Bounds.Top]
mcall mcall
^@ ^@
mov [cur_tab.Editor.Gutter.Visible],0 mov [cur_editor.Gutter.Visible],0
test [options],OPTS_LINENUMS test [options],OPTS_LINENUMS
jnz @f jnz @f
xor eax,eax ;! mov eax,2+LCHGW xor eax,eax ;! mov eax,2+LCHGW
jmp .lp1 jmp .lp1
@@: inc [cur_tab.Editor.Gutter.Visible] @@: inc [cur_editor.Gutter.Visible]
mov edi,p_info+100 mov edi,p_info+100
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] mov eax,[cur_editor.Lines.Count] ;! eax,[lines]
mov ecx,10 mov ecx,10
call uint2str call uint2str
lea eax,[edi-p_info-100] lea eax,[edi-p_info-100]
@ -46,7 +46,7 @@ func draw_editor ;////////////////////////////////////////////////////////////
mov eax,3 mov eax,3
@@: imul eax,6 @@: imul eax,6
add eax,8 add eax,8
.lp1: mov [cur_tab.Editor.Gutter.Width],eax ;! [left_ofs],eax .lp1: mov [cur_editor.Gutter.Width],eax ;! [left_ofs],eax
mov [left_ofs],eax mov [left_ofs],eax
call draw_editor_gutter call draw_editor_gutter
@ -59,36 +59,36 @@ func draw_editor ;////////////////////////////////////////////////////////////
endf endf
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
func draw_editor_gutter ;///////////////////////////////////////////////////// func draw_editor_gutter ;///// DRAW EDITOR GUTTER (LEFT PANEL) ///////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
cmp [cur_tab.Editor.Gutter.Visible],0 cmp [cur_editor.Gutter.Visible],0
je .exit je .exit
add esp,-4*8*2 add esp,-4*8*2
mov ebx,[cur_tab.Editor.Bounds.Left-2] mov ebx,[cur_editor.Bounds.Left-2]
mov bx,word[cur_tab.Editor.Gutter.Width] mov bx,word[cur_editor.Gutter.Width]
add ebx,0x00010000 add ebx,0x00010000
mov ecx,[cur_tab.Editor.Bounds.Top-2] mov ecx,[cur_editor.Bounds.Top-2]
mov cx,word[cur_tab.Editor.Bounds.Bottom] mov cx,word[cur_editor.Bounds.Bottom]
sub cx,word[cur_tab.Editor.Bounds.Top] sub cx,word[cur_editor.Bounds.Top]
add cx,-SCRLW add cx,-SCRLW
add ecx,0x00010000 add ecx,0x00010000
dec cx dec cx
mcall 13,,,[cl_3d_normal] mcall 13,,,[cl_3d_normal]
add bx,word[cur_tab.Editor.Bounds.Left] add bx,word[cur_editor.Bounds.Left]
push bx push bx
shl ebx,16 shl ebx,16
pop bx pop bx
add ecx,[cur_tab.Editor.Bounds.Top] add ecx,[cur_editor.Bounds.Top]
mcall 38,,,[cl_3d_inset] mcall 38,,,[cl_3d_inset]
add ebx,-2*65536 add ebx,-2*65536
mov bx,word[cur_tab.Editor.Bounds.Top] mov bx,word[cur_editor.Bounds.Top]
add bx,3 add bx,3
mov edi,[sc.work_text] mov edi,[sc.work_text]
mov ecx,[cur_tab.Editor.TopLeft.Y] mov ecx,[cur_editor.TopLeft.Y]
inc ecx inc ecx
mov edx,p_info+100 mov edx,p_info+100
@@: pushad @@: pushad
@ -106,10 +106,10 @@ func draw_editor_gutter ;/////////////////////////////////////////////////////
popad popad
add ebx,LINEH add ebx,LINEH
inc ecx inc ecx
cmp ecx,[cur_tab.Editor.Lines] cmp ecx,[cur_editor.Lines.Count]
jg @f jg @f
mov esi,ecx mov esi,ecx
sub esi,[cur_tab.Editor.TopLeft.Y] sub esi,[cur_editor.TopLeft.Y]
cmp esi,[lines.scr] cmp esi,[lines.scr]
jbe @b jbe @b
@@: add esp,4*8*2 @@: add esp,4*8*2
@ -119,15 +119,14 @@ func draw_editor_gutter ;/////////////////////////////////////////////////////
endf endf
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
func draw_editor_vscroll ;//////////////////////////////////////////////////// func draw_editor_vscroll ;///// DRAW EDITOR VERTICAL SCROLL BAR //////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
;!!!!!!!!!!!!!!!!!! mov ebx,[cur_editor.Bounds.Right]
mov ebx,[cur_tab.Editor.Bounds.Right]
shl ebx,16 shl ebx,16
add ebx,(-SCRLW)*65536+SCRLW add ebx,(-SCRLW)*65536+SCRLW
mov ecx,[cur_tab.Editor.Bounds.Top-2] mov ecx,[cur_editor.Bounds.Top-2]
mov cx,SCRLW mov cx,SCRLW
mcall 8,,,'UP' or 0x40000000 mcall 8,,,'VSL' or 0x40000000
pushad pushad
sar ebx,16 sar ebx,16
sar ecx,16 sar ecx,16
@ -135,7 +134,6 @@ func draw_editor_vscroll ;////////////////////////////////////////////////////
call draw_3d_panel call draw_3d_panel
popad popad
mov eax,8 mov eax,8
;!!!!!!!!!!!!!!!!!!
pushad pushad
push 0x18 push 0x18
@ -146,11 +144,10 @@ func draw_editor_vscroll ;////////////////////////////////////////////////////
add esp,4 add esp,4
popad popad
;!!!!!!!!!!!!!!!!!! mov ecx,[cur_editor.Bounds.Bottom]
mov ecx,[cur_tab.Editor.Bounds.Bottom]
shl ecx,16 shl ecx,16
add ecx,(-SCRLW*2)*65536+SCRLW add ecx,(-SCRLW*2)*65536+SCRLW
mcall ,,,'DN' or 0x40000000 mcall ,,,'VSG' or 0x40000000
pushad pushad
sar ebx,16 sar ebx,16
sar ecx,16 sar ecx,16
@ -158,7 +155,6 @@ func draw_editor_vscroll ;////////////////////////////////////////////////////
call draw_3d_panel call draw_3d_panel
popad popad
mov eax,8 mov eax,8
;!!!!!!!!!!!!!!!!!!
pushad pushad
push 0x19 push 0x19
@ -170,47 +166,45 @@ func draw_editor_vscroll ;////////////////////////////////////////////////////
popad popad
push ebx push ebx
mov eax,[cur_tab.Editor.Lines] mov eax,[cur_editor.Lines.Count]
mov ebx,[lines.scr] mov ebx,[lines.scr]
mov ecx,[cur_tab.Editor.TopLeft.Y] mov ecx,[cur_editor.TopLeft.Y]
mov edx,[cur_tab.Editor.Bounds.Bottom] mov edx,[cur_editor.Bounds.Bottom]
sub edx,[cur_tab.Editor.Bounds.Top] sub edx,[cur_editor.Bounds.Top]
add edx,-SCRLW*3+1 add edx,-SCRLW*3+1
call get_scroll_vars call get_scroll_vars
mov [cur_tab.Editor.VScroll.Top],eax mov [cur_editor.VScroll.Top],eax
mov [cur_tab.Editor.VScroll.Size],ebx mov [cur_editor.VScroll.Size],ebx
pop ebx pop ebx
mov ecx,eax mov ecx,eax
add ecx,[cur_tab.Editor.Bounds.Top] add ecx,[cur_editor.Bounds.Top]
add ecx,SCRLW+1 add ecx,SCRLW+1
;!!!!!!!!!!!!!!!!!!
pushad pushad
sar ebx,16 sar ebx,16
push ebx ecx SCRLW [cur_tab.Editor.VScroll.Size] push ebx ecx SCRLW [cur_editor.VScroll.Size]
dec dword[esp] dec dword[esp]
call draw_3d_panel call draw_3d_panel
popad popad
mov eax,13 mov eax,13
;!!!!!!!!!!!!!!!!!!
add ebx,1*65536-1 add ebx,1*65536-1
mov ecx,[cur_tab.Editor.Bounds.Top-2] mov ecx,[cur_editor.Bounds.Top-2]
mov cx,word[cur_tab.Editor.VScroll.Top] mov cx,word[cur_editor.VScroll.Top]
add ecx,(SCRLW+1)*65536 add ecx,(SCRLW+1)*65536
mov edx,[sc.work] mov edx,[sc.work]
or cx,cx or cx,cx
jle @f jle @f
mcall 13 mcall 13
@@: @@:
mov ecx,[cur_tab.Editor.Bounds.Top] mov ecx,[cur_editor.Bounds.Top]
add ecx,[cur_tab.Editor.VScroll.Top] add ecx,[cur_editor.VScroll.Top]
add ecx,[cur_tab.Editor.VScroll.Size] add ecx,[cur_editor.VScroll.Size]
add ecx,SCRLW+1 add ecx,SCRLW+1
mov di,cx mov di,cx
shl ecx,16 shl ecx,16
mov cx,word[cur_tab.Editor.Bounds.Bottom] mov cx,word[cur_editor.Bounds.Bottom]
sub cx,di sub cx,di
sub cx,SCRLW*2;+1 sub cx,SCRLW*2;+1
jle @f jle @f
@ -221,8 +215,8 @@ func draw_editor_vscroll ;////////////////////////////////////////////////////
push bx push bx
rol ebx,16 rol ebx,16
pop bx pop bx
mov ecx,[cur_tab.Editor.Bounds.Top-2] mov ecx,[cur_editor.Bounds.Top-2]
mov cx,word[cur_tab.Editor.Bounds.Bottom] mov cx,word[cur_editor.Bounds.Bottom]
add ecx,(SCRLW)*65536-SCRLW*2-1 add ecx,(SCRLW)*65536-SCRLW*2-1
mcall 38,,,[cl_3d_inset] mcall 38,,,[cl_3d_inset]
@ -230,21 +224,20 @@ func draw_editor_vscroll ;////////////////////////////////////////////////////
endf endf
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
func draw_editor_hscroll ;//////////////////////////////////////////////////// func draw_editor_hscroll ;///// DRAW EDITOR HORIZONTAL SCROLL BAR ////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov ebx,[cur_tab.Editor.Bounds.Left-2] mov ebx,[cur_editor.Bounds.Left-2]
mov bx,SCRLW mov bx,SCRLW
mov ecx,[cur_tab.Editor.Bounds.Bottom] mov ecx,[cur_editor.Bounds.Bottom]
shl ecx,16 shl ecx,16
add ecx,(-SCRLW)*65536+SCRLW add ecx,(-SCRLW)*65536+SCRLW
mcall 8,,,'LT' or 0x40000000 mcall 8,,,'HSL' or 0x40000000
pushad pushad
sar ebx,16 sar ebx,16
sar ecx,16 sar ecx,16
push ebx ecx SCRLW SCRLW push ebx ecx SCRLW SCRLW
call draw_3d_panel call draw_3d_panel
popad popad
;!!!!!!!!!!!!!!!!!!
pushad pushad
push 0x1B push 0x1B
@ -255,18 +248,16 @@ func draw_editor_hscroll ;////////////////////////////////////////////////////
add esp,4 add esp,4
popad popad
;!!!!!!!!!!!!!!!!!! mov ebx,[cur_editor.Bounds.Right]
mov ebx,[cur_tab.Editor.Bounds.Right]
shl ebx,16 shl ebx,16
add ebx,(-SCRLW*2)*65536+SCRLW add ebx,(-SCRLW*2)*65536+SCRLW
mcall 8,,,'RT' or 0x40000000 mcall 8,,,'HSG' or 0x40000000
pushad pushad
sar ebx,16 sar ebx,16
sar ecx,16 sar ecx,16
push ebx ecx SCRLW SCRLW push ebx ecx SCRLW SCRLW
call draw_3d_panel call draw_3d_panel
popad popad
;!!!!!!!!!!!!!!!!!!
pushad pushad
push 0x1A push 0x1A
@ -278,23 +269,22 @@ func draw_editor_hscroll ;////////////////////////////////////////////////////
popad popad
push ecx push ecx
mov eax,[cur_tab.Editor.Columns] mov eax,[cur_editor.Columns.Count]
mov ebx,[columns.scr] mov ebx,[columns.scr]
mov ecx,[cur_tab.Editor.TopLeft.X] mov ecx,[cur_editor.TopLeft.X]
mov edx,[cur_tab.Editor.Bounds.Right] mov edx,[cur_editor.Bounds.Right]
add edx,-(SCRLW*3) add edx,-(SCRLW*3)
call get_scroll_vars call get_scroll_vars
mov [cur_tab.Editor.HScroll.Top],eax mov [cur_editor.HScroll.Top],eax
mov [cur_tab.Editor.HScroll.Size],ebx mov [cur_editor.HScroll.Size],ebx
pop ecx pop ecx
mov ebx,eax mov ebx,eax
add ebx,[cur_tab.Editor.Bounds.Left] add ebx,[cur_editor.Bounds.Left]
add ebx,SCRLW+1 add ebx,SCRLW+1
shl ebx,16 shl ebx,16
mov bx,word[cur_tab.Editor.HScroll.Size] mov bx,word[cur_editor.HScroll.Size]
;!!!!!!!!!!!!!!!!!!
pushad pushad
sar ecx,16 sar ecx,16
rol ebx,16 rol ebx,16
@ -304,28 +294,27 @@ func draw_editor_hscroll ;////////////////////////////////////////////////////
push eax ecx ebx SCRLW push eax ecx ebx SCRLW
call draw_3d_panel call draw_3d_panel
popad popad
;!!!!!!!!!!!!!!!!!!
add ecx,1*65536-1 add ecx,1*65536-1
mov ebx,[cur_tab.Editor.Bounds.Left-2] mov ebx,[cur_editor.Bounds.Left-2]
mov bx,word[cur_tab.Editor.Bounds.Left] mov bx,word[cur_editor.Bounds.Left]
mov bx,word[cur_tab.Editor.HScroll.Top] mov bx,word[cur_editor.HScroll.Top]
add ebx,(1+SCRLW)*65536 add ebx,(1+SCRLW)*65536
mcall 13,,,[sc.work] mcall 13,,,[sc.work]
mov ebx,[cur_tab.Editor.Bounds.Left] mov ebx,[cur_editor.Bounds.Left]
add ebx,1+SCRLW add ebx,1+SCRLW
add ebx,[cur_tab.Editor.HScroll.Top] add ebx,[cur_editor.HScroll.Top]
add ebx,[cur_tab.Editor.HScroll.Size] add ebx,[cur_editor.HScroll.Size]
mov di,bx mov di,bx
shl ebx,16 shl ebx,16
mov bx,word[cur_tab.Editor.Bounds.Right] mov bx,word[cur_editor.Bounds.Right]
sub bx,di sub bx,di
sub bx,SCRLW*2 sub bx,SCRLW*2
jle @f jle @f
mcall mcall
@@: @@:
mov ebx,[cur_tab.Editor.Bounds.Left-2] mov ebx,[cur_editor.Bounds.Left-2]
mov bx,word[cur_tab.Editor.Bounds.Right] mov bx,word[cur_editor.Bounds.Right]
add ebx,(SCRLW)*65536-SCRLW*2-1 add ebx,(SCRLW)*65536-SCRLW*2-1
rol ecx,16 rol ecx,16
dec cx dec cx
@ -338,10 +327,10 @@ func draw_editor_hscroll ;////////////////////////////////////////////////////
endf endf
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
func draw_editor_text ;/////////////////////////////////////////////////////// func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Bounds.Bottom] mov eax,[cur_editor.Bounds.Bottom]
sub eax,[cur_tab.Editor.Bounds.Top] sub eax,[cur_editor.Bounds.Top]
cmp eax,LINEH cmp eax,LINEH
jge @f jge @f
ret ret
@ -351,18 +340,18 @@ func draw_editor_text ;///////////////////////////////////////////////////////
pushad pushad
mov eax,[cur_tab.Editor.Bounds.Left] mov eax,[cur_editor.Bounds.Left]
add eax,[cur_tab.Editor.Gutter.Width] add eax,[cur_editor.Gutter.Width]
add eax,LCHGW+3 add eax,LCHGW+3
mov [left_ofs],eax mov [left_ofs],eax
mov eax,[cur_tab.Editor.Bounds.Top] mov eax,[cur_editor.Bounds.Top]
add eax,3 add eax,3
mov [top_ofs],eax mov [top_ofs],eax
mov ebx,[top_ofs] mov ebx,[top_ofs]
add ebx,[left_ofs-2] add ebx,[left_ofs-2]
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line] mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
push ecx push ecx
call get_line_offset call get_line_offset
@ -373,9 +362,9 @@ func draw_editor_text ;///////////////////////////////////////////////////////
jle .exit jle .exit
add esp,-4 add esp,-4
imul ebp,[cur_tab.Editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536 imul ebp,[cur_editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536
mov eax,[lines.scr] mov eax,[lines.scr]
sub eax,[cur_tab.Editor.Lines] ;! eax,[lines] sub eax,[cur_editor.Lines.Count] ;! eax,[lines]
mov [draw_blines],eax mov [draw_blines],eax
.next_line: .next_line:
@ -385,8 +374,8 @@ func draw_editor_text ;///////////////////////////////////////////////////////
mov ecx,ebx mov ecx,ebx
shl ecx,16 shl ecx,16
mov cl,LINEH mov cl,LINEH
mov ebx,[cur_tab.Editor.Bounds.Right] mov ebx,[cur_editor.Bounds.Right]
;sub ebx,[cur_tab.Editor.Bounds.Left] ;sub ebx,[cur_editor.Bounds.Left]
add ebx,-SCRLW add ebx,-SCRLW
add ebx,[left_ofs-2] add ebx,[left_ofs-2]
sub ebx,[left_ofs] sub ebx,[left_ofs]
@ -407,7 +396,7 @@ func draw_editor_text ;///////////////////////////////////////////////////////
cmp eax,[sel.end.y] cmp eax,[sel.end.y]
je .lp5 je .lp5
.lp2: mov eax,[sel.begin.x] .lp2: mov eax,[sel.begin.x]
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
jle .lp6.2 jle .lp6.2
cmp eax,[columns.scr] cmp eax,[columns.scr]
jge .lp6 jge .lp6
@ -429,7 +418,7 @@ func draw_editor_text ;///////////////////////////////////////////////////////
cmp eax,[sel.end.y] cmp eax,[sel.end.y]
je .lp5 je .lp5
.lp4: mov eax,[sel.end.x] .lp4: mov eax,[sel.end.x]
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
jle .lp6 jle .lp6
cmp eax,[columns.scr] cmp eax,[columns.scr]
jg .lp6.2 jg .lp6.2
@ -448,7 +437,7 @@ func draw_editor_text ;///////////////////////////////////////////////////////
mov bx,ax mov bx,ax
mov [in_sel],3 mov [in_sel],3
jmp .lp6 jmp .lp6
.lp5: mov eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] .lp5: mov eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
cmp eax,[sel.begin.x] cmp eax,[sel.begin.x]
jge .lp4 jge .lp4
add eax,[columns.scr] add eax,[columns.scr]
@ -457,7 +446,7 @@ func draw_editor_text ;///////////////////////////////////////////////////////
mov eax,[sel.begin.x] mov eax,[sel.begin.x]
cmp eax,[sel.end.x] cmp eax,[sel.end.x]
je .lp6 je .lp6
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
imul eax,6 imul eax,6
pushad pushad
mov ebx,[sel.end.x] mov ebx,[sel.end.x]
@ -504,6 +493,7 @@ func draw_editor_text ;///////////////////////////////////////////////////////
jz @f jz @f
mov edx,[color_tbl+4*9] mov edx,[color_tbl+4*9]
@@: mov ebx,[left_ofs] @@: mov ebx,[left_ofs]
add ebx,-LCHGW-2;-4 add ebx,-LCHGW-2;-4
shl ebx,16 shl ebx,16
mov bx,LCHGW mov bx,LCHGW
@ -530,13 +520,13 @@ func draw_editor_text ;///////////////////////////////////////////////////////
push esi ebx push esi ebx
mov eax,ebx mov eax,ebx
sub ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col] sub ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col]
cmp ebx,[columns.scr] cmp ebx,[columns.scr]
jge .skip_t jge .skip_t
add ebx,esi add ebx,esi
jle .skip_t jle .skip_t
mov ebx,[esp+8+4*2] ;// 4*2=esi+ebx mov ebx,[esp+8+4*2] ;// 4*2=esi+ebx
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
jge .qqq jge .qqq
sub edx,eax sub edx,eax
add esi,eax add esi,eax
@ -553,7 +543,7 @@ func draw_editor_text ;///////////////////////////////////////////////////////
mov eax,[esp] ; ebx mov eax,[esp] ; ebx
add eax,[esp+4] ; esi add eax,[esp+4] ; esi
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
sub eax,[columns.scr] sub eax,[columns.scr]
jle .qweqwe jle .qweqwe
sub esi,eax sub esi,eax
@ -577,7 +567,7 @@ func draw_editor_text ;///////////////////////////////////////////////////////
mov esi,[sel.begin.x] mov esi,[sel.begin.x]
sub esi,[esp] sub esi,[esp]
pushad pushad
mov ecx,[cur_tab.Editor.TopLeft.X] ;! ecx,[left_col] mov ecx,[cur_editor.TopLeft.X] ;! ecx,[left_col]
sub ecx,[esp+4*8] sub ecx,[esp+4*8]
jle @f jle @f
sub esi,ecx sub esi,ecx
@ -607,7 +597,7 @@ func draw_editor_text ;///////////////////////////////////////////////////////
sub eax,[esp] sub eax,[esp]
push ebx push ebx
mov ebx,[esp+4] mov ebx,[esp+4]
sub ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col] sub ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col]
jge .ya2.1 jge .ya2.1
add eax,ebx add eax,ebx
.ya2.1: .ya2.1:
@ -639,7 +629,7 @@ func draw_editor_text ;///////////////////////////////////////////////////////
sub esi,[esp] sub esi,[esp]
push eax push eax
mov eax,[esp+4] mov eax,[esp+4]
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
jge .nt3.1 jge .nt3.1
add esi,eax add esi,eax
.nt3.1: .nt3.1:
@ -697,15 +687,15 @@ func draw_editor_text ;///////////////////////////////////////////////////////
jl @f jl @f
mov ecx,[esp-8] mov ecx,[esp-8]
shl ecx,16 shl ecx,16
mov cx,word[cur_tab.Editor.Bounds.Bottom] mov cx,word[cur_editor.Bounds.Bottom]
sub cx,[esp-8] sub cx,[esp-8]
add cx,-SCRLW add cx,-SCRLW
mov eax,[cur_tab.Editor.Bounds.Left] mov eax,[cur_editor.Bounds.Left]
add eax,[cur_tab.Editor.Gutter.Width] add eax,[cur_editor.Gutter.Width]
inc eax inc eax
mov ebx,eax mov ebx,eax
shl ebx,16 shl ebx,16
mov bx,word[cur_tab.Editor.Bounds.Right] mov bx,word[cur_editor.Bounds.Right]
sub bx,ax sub bx,ax
add ebx,-SCRLW add ebx,-SCRLW
mcall 13,,,[color_tbl+4*5] mcall 13,,,[color_tbl+4*5]
@ -717,12 +707,12 @@ func draw_editor_text ;///////////////////////////////////////////////////////
endf endf
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
func draw_editor_caret ;////////////////////////////////////////////////////// func draw_editor_caret ;///// DRAW EDITOR TEXT CARET /////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
cmp [bot_mode],0 cmp [bot_mode],0
jne @f jne @f
mov ebx,[cur_tab.Editor.Caret.X] mov ebx,[cur_editor.Caret.X]
sub ebx,[cur_tab.Editor.TopLeft.X] sub ebx,[cur_editor.TopLeft.X]
js @f js @f
cmp ebx,[columns.scr] cmp ebx,[columns.scr]
ja @f ja @f
@ -732,8 +722,8 @@ func draw_editor_caret ;//////////////////////////////////////////////////////
push bx push bx
shl ebx,16 shl ebx,16
pop bx pop bx
mov eax,[cur_tab.Editor.Caret.Y] mov eax,[cur_editor.Caret.Y]
sub eax,[cur_tab.Editor.TopLeft.Y] sub eax,[cur_editor.TopLeft.Y]
js @f js @f
cmp eax,[lines.scr] cmp eax,[lines.scr]
jge @f jge @f

View File

@ -1,6 +1,7 @@
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
func save_file ;////////////////////////////////////////////////////////////// func save_file ;//////////////////////////////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
ret ; DISALLOW FOR NOW
mov esi,tb_opensave.text mov esi,tb_opensave.text
mov edi,f_info.path mov edi,f_info.path
@ -10,7 +11,7 @@ func save_file ;//////////////////////////////////////////////////////////////
rep movsb rep movsb
mov byte[edi],0 mov byte[edi],0
mov esi,[cur_tab.Editor.Data] ;! AREA_EDIT ; 0x70000 = 448 Kbytes (maximum) mov esi,[cur_editor.Lines] ;! AREA_EDIT ; 0x70000 = 448 Kbytes (maximum)
mov edi,0 ;!!! AREA_TEMP mov edi,0 ;!!! AREA_TEMP
.new_string: .new_string:
@ -28,16 +29,6 @@ func save_file ;//////////////////////////////////////////////////////////////
jmp .exit.2 jmp .exit.2
.systree_save: .systree_save:
;! mov eax,[filelen]
; mov [f_info+8],edi ;! eax
; mov [f_info+0],1
; mov esi,s_fname
; mov edi,f_info.path
; mov ecx,PATHL
; cld
; rep movsb
;mcall 58,f_info
mov [f_info70+0],2 mov [f_info70+0],2
mov [f_info70+12],edi mov [f_info70+12],edi
mov [f_info70+16],0 ;!!! AREA_TEMP mov [f_info70+16],0 ;!!! AREA_TEMP
@ -51,7 +42,7 @@ func save_file ;//////////////////////////////////////////////////////////////
jnz .exit.2 jnz .exit.2
.exit: .exit:
mov [cur_tab.Editor.Modified],0 ;! [modified],0 mov [cur_editor.Modified],0 ;! [modified],0
clc clc
ret ret
@ -197,7 +188,6 @@ func load_file ;//////////////////////////////////////////////////////////////
push ecx esi edi push ecx esi edi
mov esi,tb_opensave.text mov esi,tb_opensave.text
lea edi,[ebp+TABITEM.Editor.FilePath] lea edi,[ebp+TABITEM.Editor.FilePath]
;mov ecx,[f_info.length]
movzx ecx,[tb_opensave.length] movzx ecx,[tb_opensave.length]
rep movsb rep movsb
mov byte[edi],0 mov byte[edi],0
@ -225,14 +215,15 @@ func load_from_memory ;///////////////////////////////////////////////////////
; EBP = EDITOR* ; EBP = EDITOR*
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
call get_lines_in_file call get_lines_in_file
mov [ebp+EDITOR.Lines],eax inc eax
mov [ebp+EDITOR.Lines.Count],eax
imul ebx,eax,14 imul ebx,eax,14
add ebx,ecx add ebx,ecx
mov eax,[ebp+EDITOR.Data] mov eax,[ebp+EDITOR.Lines]
call mem.ReAlloc call mem.ReAlloc
mov [ebp+EDITOR.Data],eax mov [ebp+EDITOR.Lines],eax
mov [ebp+EDITOR.Columns],0 mov [ebp+EDITOR.Columns.Count],0
mov edi,eax mov edi,eax
mov edx,ecx mov edx,ecx
@ -266,9 +257,9 @@ func load_from_memory ;///////////////////////////////////////////////////////
sub eax,10 sub eax,10
jnz @f jnz @f
inc eax inc eax
@@: cmp eax,[ebp+EDITOR.Columns] ;! eax,[columns] @@: cmp eax,[ebp+EDITOR.Columns.Count] ;! eax,[columns]
jbe @f jbe @f
mov [ebp+EDITOR.Columns],eax ;! [columns],eax mov [ebp+EDITOR.Columns.Count],eax ;! [columns],eax
@@: mov [ebp+EDITOR.Modified],0 ;! [modified],0 @@: mov [ebp+EDITOR.Modified],0 ;! [modified],0
ret ret
@ -282,11 +273,11 @@ func load_from_memory ;///////////////////////////////////////////////////////
lea eax,[edi-4] lea eax,[edi-4]
sub eax,ebx sub eax,ebx
mov [ebx],eax mov [ebx],eax
;inc [cur_tab.Editor.Lines] ;! [lines] ; inc [cur_editor.Lines] ;! [lines]
add eax,-10 add eax,-10
cmp eax,[ebp+EDITOR.Columns] ;! eax,[columns] cmp eax,[ebp+EDITOR.Columns.Count] ;! eax,[columns]
jbe .next_line jbe .next_line
mov [ebp+EDITOR.Columns],eax ;! [columns],eax mov [ebp+EDITOR.Columns.Count],eax ;! [columns],eax
jmp .next_line jmp .next_line
.TB: lea eax,[edi-4] .TB: lea eax,[edi-4]

View File

@ -46,13 +46,13 @@ key:
jmp still jmp still
@@: @@:
mov esi,accel_table mov esi,accel_table_main
.acc: cmp eax,[esi] .acc: cmp eax,[esi]
jne @f jne @f
test [options],OPTS_SECURESEL test [options],OPTS_SECURESEL
jz .lp1 jz .lp1
m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x] m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y] m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
.lp1: mov [s_status],0 .lp1: mov [s_status],0
call dword[esi+4] call dword[esi+4]
jmp still jmp still
@ -74,8 +74,8 @@ key:
test [options],OPTS_SECURESEL test [options],OPTS_SECURESEL
jz .lp2 jz .lp2
m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x] m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y] m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
jmp .put jmp .put
.lp2: call delete_selection .lp2: call delete_selection
@ -85,24 +85,24 @@ key:
jne @f jne @f
mov al,']' mov al,']'
call .lp3 call .lp3
dec [cur_tab.Editor.Caret.X] ;! [pos.x] dec [cur_editor.Caret.X] ;! [pos.x]
jmp .put jmp .put
@@: cmp al,'(' @@: cmp al,'('
jne @f jne @f
mov al,')' mov al,')'
call .lp3 call .lp3
dec [cur_tab.Editor.Caret.X] ;! [pos.x] dec [cur_editor.Caret.X] ;! [pos.x]
jmp .put jmp .put
@@: cmp al,'{' @@: cmp al,'{'
jne .put jne .put
mov al,'}' mov al,'}'
call .lp3 call .lp3
dec [cur_tab.Editor.Caret.X] ;! [pos.x] dec [cur_editor.Caret.X] ;! [pos.x]
.put: pop eax .put: pop eax
push still push still
inc [cur_tab.Editor.SelStart.X] ;! [sel.x] inc [cur_editor.SelStart.X] ;! [sel.x]
.lp3: push [cur_tab.Editor.Caret.X] eax ;! [pos.x] eax .lp3: push [cur_editor.Caret.X] eax ;! [pos.x] eax
inc dword[esp+4] inc dword[esp+4]
mov eax,1 mov eax,1
jmp key.tab.direct jmp key.tab.direct
@ -111,14 +111,14 @@ key:
func key.ctrl_a ;///// SELECT ALL DOCUMENT /////////////////////////////////// func key.ctrl_a ;///// SELECT ALL DOCUMENT ///////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
xor eax,eax xor eax,eax
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax mov [cur_editor.SelStart.X],eax ;! [sel.x],eax
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax
mov ecx,[cur_tab.Editor.Lines] ;! ecx,[lines] mov ecx,[cur_editor.Lines.Count] ;! ecx,[lines]
dec ecx dec ecx
mov [cur_tab.Editor.Caret.Y],ecx ;! [pos.y],ecx mov [cur_editor.Caret.Y],ecx ;! [pos.y],ecx
call get_line_offset call get_line_offset
call get_real_length call get_real_length
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax mov [cur_editor.Caret.X],eax ;! [pos.x],eax
call draw_file call draw_file
ret ret
endf endf
@ -147,7 +147,7 @@ func key.ctrl_o ;///// ENTER OPEN FILENAME ///////////////////////////////////
@@: mov al,[tb_opensave.length] @@: mov al,[tb_opensave.length]
mov [tb_opensave.pos.x],al mov [tb_opensave.pos.x],al
mov [tb_opensave.sel.x],0 mov [tb_opensave.sel.x],0
mov [tb_casesen],1 mov [tb_casesen],0;1
call drawwindow call drawwindow
ret ret
endf endf
@ -155,7 +155,7 @@ endf
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
func key.ctrl_s ;///// ENTER SAVE FILENAME /////////////////////////////////// func key.ctrl_s ;///// ENTER SAVE FILENAME ///////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
cmp [cur_tab.Editor.Modified],0 ;! [modified],0 cmp [cur_editor.Modified],0 ;! [modified],0
je .exit je .exit
cmp [f_info.length],0 cmp [f_info.length],0
je key.shift_ctrl_s je key.shift_ctrl_s
@ -170,7 +170,7 @@ func key.ctrl_s ;///// ENTER SAVE FILENAME ///////////////////////////////////
endf endf
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
func key.ctrl_n ;///// ENTER SAVE FILENAME /////////////////////////////////// func key.ctrl_n ;///// CREATE NEW FILE (TAB) /////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
call create_tab call create_tab
ret ret
@ -248,8 +248,8 @@ func key.ctrl_left ;///// GO TO PREVIOUS WORD ////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
key.shift_ctrl_left: ;///// GO TO PREVIOUS WORD, WITH SELECTION ///////// key.shift_ctrl_left: ;///// GO TO PREVIOUS WORD, WITH SELECTION /////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov ebx,[cur_tab.Editor.Caret.Y] ;! ebx,[pos.y] mov ebx,[cur_editor.Caret.Y] ;! ebx,[pos.y]
mov edx,[cur_tab.Editor.Caret.X] ;! edx,[pos.x] mov edx,[cur_editor.Caret.X] ;! edx,[pos.x]
cld cld
mov ecx,ebx mov ecx,ebx
call get_line_offset call get_line_offset
@ -307,26 +307,26 @@ func key.ctrl_left ;///// GO TO PREVIOUS WORD ////////////////////////////////
jmp .lp2 jmp .lp2
@@: @@:
inc edx inc edx
mov [cur_tab.Editor.Caret.Y],ebx ;! [pos.y],ebx mov [cur_editor.Caret.Y],ebx ;! [pos.y],ebx
mov [cur_tab.Editor.Caret.X],edx ;! [pos.x],edx mov [cur_editor.Caret.X],edx ;! [pos.x],edx
test byte[shi+2],0x01 test byte[shi+2],0x01
jnz @f jnz @f
mov [cur_tab.Editor.SelStart.Y],ebx ;! [sel.y],ebx mov [cur_editor.SelStart.Y],ebx ;! [sel.y],ebx
mov [cur_tab.Editor.SelStart.X],edx ;! [sel.x],edx mov [cur_editor.SelStart.X],edx ;! [sel.x],edx
@@: sub ebx,[cur_tab.Editor.TopLeft.Y] ;! ebx,[top_line] @@: sub ebx,[cur_editor.TopLeft.Y] ;! ebx,[top_line]
jge @f jge @f
add [cur_tab.Editor.TopLeft.Y],ebx ;! [top_line],ebx add [cur_editor.TopLeft.Y],ebx ;! [top_line],ebx
@@: mov eax,edx @@: mov eax,edx
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
cmp eax,[columns.scr] cmp eax,[columns.scr]
jl @f jl @f
sub eax,[columns.scr] sub eax,[columns.scr]
inc eax inc eax
add [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax add [cur_editor.TopLeft.X],eax ;! [left_col],eax
jmp .exit jmp .exit
@@: cmp edx,[cur_tab.Editor.TopLeft.X] ;! edx,[left_col] @@: cmp edx,[cur_editor.TopLeft.X] ;! edx,[left_col]
jge .exit jge .exit
mov [cur_tab.Editor.TopLeft.X],edx ;! [left_col],edx mov [cur_editor.TopLeft.X],edx ;! [left_col],edx
.exit: .exit:
call draw_file call draw_file
.exit.2: .exit.2:
@ -341,8 +341,8 @@ func key.ctrl_right ;///// GO TO NEXT WORD ///////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
key.shift_ctrl_right: ;///// GO TO NEXT WORD, WITH SELECTION //////////// key.shift_ctrl_right: ;///// GO TO NEXT WORD, WITH SELECTION ////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov ebx,[cur_tab.Editor.Caret.Y] ;! ebx,[pos.y] mov ebx,[cur_editor.Caret.Y] ;! ebx,[pos.y]
mov edx,[cur_tab.Editor.Caret.X] ;! edx,[pos.x] mov edx,[cur_editor.Caret.X] ;! edx,[pos.x]
cld cld
.lp1: mov ecx,ebx .lp1: mov ecx,ebx
call get_line_offset call get_line_offset
@ -363,7 +363,7 @@ func key.ctrl_right ;///// GO TO NEXT WORD ///////////////////////////////////
dec ecx dec ecx
jnz @b jnz @b
.nx1: inc ebx .nx1: inc ebx
cmp ebx,[cur_tab.Editor.Lines] ;! ebx,[lines] cmp ebx,[cur_editor.Lines.Count] ;! ebx,[lines]
jge .exit.2 jge .exit.2
xor edx,edx xor edx,edx
jmp .lp1 jmp .lp1
@ -388,34 +388,34 @@ func key.ctrl_right ;///// GO TO NEXT WORD ///////////////////////////////////
dec ecx dec ecx
jnz @b jnz @b
.nx2: inc ebx .nx2: inc ebx
cmp ebx,[cur_tab.Editor.Lines] ;! ebx,[lines] cmp ebx,[cur_editor.Lines.Count] ;! ebx,[lines]
jge .exit.2 jge .exit.2
xor edx,edx xor edx,edx
jmp .lp2 jmp .lp2
@@: @@:
mov [cur_tab.Editor.Caret.Y],ebx ;! [pos.y],ebx mov [cur_editor.Caret.Y],ebx ;! [pos.y],ebx
mov [cur_tab.Editor.Caret.X],edx ;! [pos.x],edx mov [cur_editor.Caret.X],edx ;! [pos.x],edx
test byte[shi+2],0x01 test byte[shi+2],0x01
jnz @f jnz @f
mov [cur_tab.Editor.SelStart.Y],ebx ;! [sel.y],ebx mov [cur_editor.SelStart.Y],ebx ;! [sel.y],ebx
mov [cur_tab.Editor.SelStart.X],edx ;! [sel.x],edx mov [cur_editor.SelStart.X],edx ;! [sel.x],edx
@@: sub ebx,[cur_tab.Editor.TopLeft.Y] ;! ebx,[top_line] @@: sub ebx,[cur_editor.TopLeft.Y] ;! ebx,[top_line]
cmp ebx,[lines.scr] cmp ebx,[lines.scr]
jl @f jl @f
sub ebx,[lines.scr] sub ebx,[lines.scr]
inc ebx inc ebx
add [cur_tab.Editor.TopLeft.Y],ebx ;! [top_line],ebx add [cur_editor.TopLeft.Y],ebx ;! [top_line],ebx
@@: mov eax,edx @@: mov eax,edx
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
cmp eax,[columns.scr] cmp eax,[columns.scr]
jl @f jl @f
sub eax,[columns.scr] sub eax,[columns.scr]
inc eax inc eax
add [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax add [cur_editor.TopLeft.X],eax ;! [left_col],eax
jmp .exit jmp .exit
@@: cmp edx,[cur_tab.Editor.TopLeft.X] ;! edx,[left_col] @@: cmp edx,[cur_editor.TopLeft.X] ;! edx,[left_col]
jge .exit jge .exit
mov [cur_tab.Editor.TopLeft.X],edx ;! [left_col],edx mov [cur_editor.TopLeft.X],edx ;! [left_col],edx
.exit: .exit:
call draw_file call draw_file
.exit.2: .exit.2:
@ -428,7 +428,7 @@ func key.ctrl_x
je @f je @f
call key.ctrl_c call key.ctrl_c
call key.del call key.del
mov [cur_tab.Editor.Modified],1 ;! [modified],1 mov [cur_editor.Modified],1 ;! [modified],1
@@: ret @@: ret
endf endf
@ -537,21 +537,21 @@ func key.ctrl_v
call delete_selection call delete_selection
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y] mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
call get_line_offset call get_line_offset
pushd [esi] esi pushd [esi] esi
mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x] mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
call line_add_spaces call line_add_spaces
mov ecx,[copy_size] mov ecx,[copy_size]
sub ecx,4 sub ecx,4
mov edi,[cur_tab.Editor.Data] ;! AREA_TEMP2 mov edi,[cur_editor.Lines] ;! AREA_TEMP2
add edi,[edi-4] add edi,[edi-4]
dec edi dec edi
mov eax,esi mov eax,esi
mov esi,edi mov esi,edi
sub esi,ecx sub esi,ecx
lea ecx,[eax+4] lea ecx,[eax+4]
add ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x] add ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
neg ecx neg ecx
lea ecx,[esi+ecx+1] lea ecx,[esi+ecx+1]
std std
@ -567,7 +567,7 @@ func key.ctrl_v
mov esi,[copy_buf] ;! AREA_CBUF mov esi,[copy_buf] ;! AREA_CBUF
lodsd lodsd
mov ebx,[cur_tab.Editor.Caret.X] ;! ebx,[pos.x] mov ebx,[cur_editor.Caret.X] ;! ebx,[pos.x]
add eax,ebx add eax,ebx
mov [edi-4],ax mov [edi-4],ax
sub eax,ebx sub eax,ebx
@ -590,16 +590,16 @@ func key.ctrl_v
mov ecx,eax mov ecx,eax
rep movsb rep movsb
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax mov [cur_editor.Caret.X],eax ;! [pos.x],eax
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax mov [cur_editor.SelStart.X],eax ;! [sel.x],eax
mov eax,[copy_count] mov eax,[copy_count]
dec eax dec eax
add [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax add [cur_editor.Caret.Y],eax ;! [pos.y],eax
add [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax add [cur_editor.SelStart.Y],eax ;! [sel.y],eax
add [cur_tab.Editor.Lines],eax ;! [lines],eax add [cur_editor.Lines.Count],eax ;! [lines],eax
call check_inv_all call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1 mov [cur_editor.Modified],1 ;! [modified],1
jmp .exit jmp .exit
.single_line: .single_line:
@ -612,16 +612,16 @@ func key.ctrl_v
and dword[edi-4],not 0x00020000 and dword[edi-4],not 0x00020000
or dword[edi-4],0x00010000 or dword[edi-4],0x00010000
call .check_columns call .check_columns
add edi,[cur_tab.Editor.Caret.X] ;! edi,[pos.x] add edi,[cur_editor.Caret.X] ;! edi,[pos.x]
add esp,4 add esp,4
mov ecx,eax mov ecx,eax
rep movsb rep movsb
add [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax add [cur_editor.Caret.X],eax ;! [pos.x],eax
add [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax add [cur_editor.SelStart.X],eax ;! [sel.x],eax
call check_inv_all call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1 mov [cur_editor.Modified],1 ;! [modified],1
.exit: .exit:
ret ret
@ -629,9 +629,9 @@ func key.ctrl_v
.check_columns: .check_columns:
push eax push eax
movzx eax,word[edi-4] movzx eax,word[edi-4]
cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns] cmp eax,[cur_editor.Columns.Count] ;! eax,[columns]
jbe @f jbe @f
mov [cur_tab.Editor.Columns],eax ;! [columns],eax mov [cur_editor.Columns.Count],eax ;! [columns],eax
@@: pop eax @@: pop eax
ret ret
; push eax ebx esi ; push eax ebx esi
@ -656,11 +656,11 @@ endf
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
func key.ctrl_d ;///// INSERT SEPARATOR ////////////////////////////////////// func key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y] mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
call get_line_offset call get_line_offset
mov ebx,esi mov ebx,esi
mov ecx,[cur_tab.Editor.Lines] ;! ecx,[lines] mov ecx,[cur_editor.Lines.Count] ;! ecx,[lines]
call get_line_offset call get_line_offset
lea edi,[esi+90+4] lea edi,[esi+90+4]
lea ecx,[esi+4] lea ecx,[esi+4]
@ -679,12 +679,12 @@ func key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
rep stosb rep stosb
mov byte[ebx+4],';' mov byte[ebx+4],';'
inc [cur_tab.Editor.Lines] ;! [lines] inc [cur_editor.Lines.Count] ;! [lines]
inc [cur_tab.Editor.Caret.Y] ;! [pos.y] inc [cur_editor.Caret.Y] ;! [pos.y]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y] m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
call check_inv_all call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1 mov [cur_editor.Modified],1 ;! [modified],1
.exit: .exit:
ret ret
@ -693,25 +693,25 @@ endf
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
func key.ctrl_y ;///// DELETE CURRENT LINE /////////////////////////////////// func key.ctrl_y ;///// DELETE CURRENT LINE ///////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
inc eax inc eax
cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines] cmp eax,[cur_editor.Lines.Count] ;! eax,[lines]
jge .exit jge .exit
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y] mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
call get_line_offset call get_line_offset
mov edi,esi mov edi,esi
lodsd lodsd
add esi,eax add esi,eax
dec [cur_tab.Editor.Lines] ;! [lines] dec [cur_editor.Lines.Count] ;! [lines]
mov ecx,[temp_buf] ;! AREA_TEMP2 mov ecx,[temp_buf] ;! AREA_TEMP2
sub ecx,esi sub ecx,esi
shr ecx,2 ;// fixed (was 4) shr ecx,2 ;// fixed (was 4)
cld cld
rep movsd rep movsd
call check_inv_all call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1 mov [cur_editor.Modified],1 ;! [modified],1
.exit: .exit:
ret ret
@ -725,11 +725,11 @@ func key.up ;///// GO TO PREVIOUS LINE ///////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
key.shift_up: ;///// GO TO PREVIOUS LINE, WITH SELECTION //////////////// key.shift_up: ;///// GO TO PREVIOUS LINE, WITH SELECTION ////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
dec eax dec eax
jns @f jns @f
xor eax,eax xor eax,eax
@@: mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line] @@: mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
cmp eax,ecx cmp eax,ecx
jae @f jae @f
dec ecx dec ecx
@ -737,7 +737,7 @@ func key.up ;///// GO TO PREVIOUS LINE ///////////////////////////////////////
xor ecx,ecx xor ecx,ecx
@@: test byte[shi+2],0x01 @@: test byte[shi+2],0x01
jnz @f jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax
@@: call check_inv_all.skip_init @@: call check_inv_all.skip_init
.exit: .exit:
@ -753,12 +753,12 @@ func key.down ;///// GO TO NEXT LINE /////////////////////////////////////////
key.shift_down: ;///// GO TO NEXT LINE, WITH SELECTION ////////////////// key.shift_down: ;///// GO TO NEXT LINE, WITH SELECTION //////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
inc eax inc eax
cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines] cmp eax,[cur_editor.Lines.Count] ;! eax,[lines]
jb @f jb @f
dec eax dec eax
@@: mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line] @@: mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
mov edx,eax mov edx,eax
sub edx,ecx sub edx,ecx
cmp edx,[lines.scr] cmp edx,[lines.scr]
@ -766,7 +766,7 @@ func key.down ;///// GO TO NEXT LINE /////////////////////////////////////////
inc ecx inc ecx
@@: test byte[shi+2],0x01 @@: test byte[shi+2],0x01
jnz @f jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax
@@: call check_inv_all.skip_init @@: call check_inv_all.skip_init
.exit: .exit:
@ -781,14 +781,14 @@ func key.left ;///// GO TO PREVIOUS CHAR /////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
key.shift_left: ;///// GO TO PREVIOUS CHAR, WITH SELECTION ////////////// key.shift_left: ;///// GO TO PREVIOUS CHAR, WITH SELECTION //////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] mov eax,[cur_editor.Caret.X] ;! eax,[pos.x]
dec eax dec eax
jns @f jns @f
inc eax inc eax
@@: test byte[shi+2],0x01 @@: test byte[shi+2],0x01
jnz @f jnz @f
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax mov [cur_editor.SelStart.X],eax ;! [sel.x],eax
@@: mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax @@: mov [cur_editor.Caret.X],eax ;! [pos.x],eax
call check_inv_all call check_inv_all
.exit: .exit:
@ -803,15 +803,15 @@ func key.right ;///// GO TO NEXT CHAR ////////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
key.shift_right: ;///// GO TO NEXT CHAR, WITH SELECTION ///////////////// key.shift_right: ;///// GO TO NEXT CHAR, WITH SELECTION /////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] mov eax,[cur_editor.Caret.X] ;! eax,[pos.x]
inc eax inc eax
cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns] cmp eax,[cur_editor.Columns.Count] ;! eax,[columns]
jbe @f jbe @f
dec eax dec eax
@@: test byte[shi+2],0x01 @@: test byte[shi+2],0x01
jnz @f jnz @f
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax mov [cur_editor.SelStart.X],eax ;! [sel.x],eax
@@: mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax @@: mov [cur_editor.Caret.X],eax ;! [pos.x],eax
call check_inv_all call check_inv_all
.exit: .exit:
@ -828,8 +828,8 @@ func key.pgup ;///// GO TO PREVIOUS PAGE /////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov edx,[lines.scr] mov edx,[lines.scr]
dec edx dec edx
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line] mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
sub eax,edx sub eax,edx
jns @f jns @f
xor eax,eax xor eax,eax
@ -838,7 +838,7 @@ func key.pgup ;///// GO TO PREVIOUS PAGE /////////////////////////////////////
xor ecx,ecx xor ecx,ecx
@@: test byte[shi+2],0x01 @@: test byte[shi+2],0x01
jnz @f jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax
@@: call check_inv_all.skip_init @@: call check_inv_all.skip_init
.exit: .exit:
@ -855,17 +855,17 @@ func key.pgdn ;///// GO TO NEXT PAGE /////////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov edx,[lines.scr] mov edx,[lines.scr]
dec edx dec edx
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line] mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
add eax,edx add eax,edx
add ecx,edx add ecx,edx
cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines] cmp eax,[cur_editor.Lines.Count] ;! eax,[lines]
jb @f jb @f
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] mov eax,[cur_editor.Lines.Count] ;! eax,[lines]
dec eax dec eax
@@: test byte[shi+2],0x01 @@: test byte[shi+2],0x01
jnz @f jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax
@@: call check_inv_all.skip_init @@: call check_inv_all.skip_init
.exit: .exit:
@ -880,10 +880,10 @@ func key.home ;///// GO TO LINE START ////////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
key.shift_home: ;///// GO TO LINE START, WITH SELECTION ///////////////// key.shift_home: ;///// GO TO LINE START, WITH SELECTION /////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov [cur_tab.Editor.Caret.X],0 ;! [pos.x],0 mov [cur_editor.Caret.X],0 ;! [pos.x],0
test byte[shi+2],0x01 test byte[shi+2],0x01
jnz @f jnz @f
mov [cur_tab.Editor.SelStart.X],0 ;! [sel.x],0 mov [cur_editor.SelStart.X],0 ;! [sel.x],0
@@: call check_inv_all @@: call check_inv_all
.exit: .exit:
@ -898,13 +898,13 @@ func key.end ;///// GO TO LINE END ///////////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
key.shift_end: ;///// GO TO LINE END, WITH SELECTION //////////////////// key.shift_end: ;///// GO TO LINE END, WITH SELECTION ////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y] mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
call get_line_offset call get_line_offset
call get_real_length call get_real_length
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax mov [cur_editor.Caret.X],eax ;! [pos.x],eax
test byte[shi+2],0x01 test byte[shi+2],0x01
jnz @f jnz @f
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax mov [cur_editor.SelStart.X],eax ;! [sel.x],eax
@@: call check_inv_all @@: call check_inv_all
.exit: .exit:
@ -919,11 +919,11 @@ func key.ctrl_home ;///// GO TO PAGE START ///////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
key.shift_ctrl_home: ;///// GO TO PAGE START, WITH SELECTION //////////// key.shift_ctrl_home: ;///// GO TO PAGE START, WITH SELECTION ////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] mov eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
mov ecx,eax mov ecx,eax
test byte[shi+2],0x01 test byte[shi+2],0x01
jnz @f jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax
@@: call check_inv_all.skip_init @@: call check_inv_all.skip_init
.exit: .exit:
@ -938,16 +938,16 @@ func key.ctrl_end ;///// GO TO PAGE END //////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
key.shift_ctrl_end: ;///// GO TO PAGE END, WITH SELECTION /////////////// key.shift_ctrl_end: ;///// GO TO PAGE END, WITH SELECTION ///////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line] mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
mov eax,[lines.scr] mov eax,[lines.scr]
cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines] cmp eax,[cur_editor.Lines.Count] ;! eax,[lines]
jle @f jle @f
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] mov eax,[cur_editor.Lines.Count] ;! eax,[lines]
@@: add eax,ecx @@: add eax,ecx
dec eax dec eax
test byte[shi+2],0x01 test byte[shi+2],0x01
jnz @f jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax
@@: call check_inv_all.skip_init @@: call check_inv_all.skip_init
.exit: .exit:
@ -963,11 +963,11 @@ func key.ctrl_pgup ;///// GO TO DOCUMENT START ///////////////////////////////
key.shift_ctrl_pgup: ;///// GO TO DOCUMENT START, WITH SELECTION //////// key.shift_ctrl_pgup: ;///// GO TO DOCUMENT START, WITH SELECTION ////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
xor eax,eax xor eax,eax
mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax mov [cur_editor.Caret.Y],eax ;! [pos.y],eax
test byte[shi+2],0x01 test byte[shi+2],0x01
jnz @f jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax
@@: call check_inv_all.skip_check @@: call check_inv_all.skip_check
.exit: .exit:
@ -982,16 +982,16 @@ func key.ctrl_pgdn ;///// GO TO DOCUMENT END /////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
key.shift_ctrl_pgdn: ;///// GO TO DOCUMENT END, WITH SELECTION ////////// key.shift_ctrl_pgdn: ;///// GO TO DOCUMENT END, WITH SELECTION //////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] ; eax = lines in the file mov eax,[cur_editor.Lines.Count] ;! eax,[lines] ; eax = lines in the file
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax mov [cur_editor.Caret.Y],eax ;! [pos.y],eax
sub eax,[lines.scr] ; eax -= lines on the screen sub eax,[lines.scr] ; eax -= lines on the screen
jns @f jns @f
xor eax,eax xor eax,eax
@@: mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax @@: mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax
dec [cur_tab.Editor.Caret.Y] ;! [pos.y] dec [cur_editor.Caret.Y] ;! [pos.y]
test byte[shi+2],0x01 test byte[shi+2],0x01
jnz @f jnz @f
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y]
;! push [pos.y] ;! push [pos.y]
;! pop [sel.y] ;! pop [sel.y]
@@: call check_inv_all.skip_check @@: call check_inv_all.skip_check
@ -1006,7 +1006,7 @@ func key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
call delete_selection call delete_selection
jnc .exit.2 jnc .exit.2
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y] mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
call get_line_offset call get_line_offset
and dword[esi],not 0x00020000 and dword[esi],not 0x00020000
or dword[esi],0x00010000 or dword[esi],0x00010000
@ -1017,7 +1017,7 @@ func key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
or eax,eax or eax,eax
je .line_up je .line_up
mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x] mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
cmp ecx,eax cmp ecx,eax
jae .line_up jae .line_up
lea edi,[ebx+ecx] lea edi,[ebx+ecx]
@ -1028,7 +1028,7 @@ func key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
je .line_up je .line_up
mov edi,ebx mov edi,ebx
mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x] mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
add edi,ecx add edi,ecx
lea esi,[edi+1] lea esi,[edi+1]
neg ecx neg ecx
@ -1038,23 +1038,23 @@ func key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
rep movsb rep movsb
mov byte[edi],' ' mov byte[edi],' '
m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x] m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y] m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
call check_inv_all call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1 mov [cur_editor.Modified],1 ;! [modified],1
ret ret
.line_up: .line_up:
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] mov eax,[cur_editor.Lines.Count] ;! eax,[lines]
dec eax dec eax
cmp eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] cmp eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
je .exit je .exit
mov edi,[temp_buf] ;! AREA_TEMP+4 mov edi,[temp_buf] ;! AREA_TEMP+4
add edi,4 add edi,4
mov esi,ebx mov esi,ebx
mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x] mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
rep movsb rep movsb
mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x] mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
mov eax,[temp_buf] mov eax,[temp_buf]
mov [eax],ecx ;! [AREA_TEMP],ecx mov [eax],ecx ;! [AREA_TEMP],ecx
cmp cx,[ebp] cmp cx,[ebp]
@ -1078,12 +1078,12 @@ func key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
mov esi,[temp_buf] ;! AREA_TEMP mov esi,[temp_buf] ;! AREA_TEMP
call get_real_length call get_real_length
cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns] cmp eax,[cur_editor.Columns.Count] ;! eax,[columns]
jbe @f jbe @f
mov [cur_tab.Editor.Columns],eax ;! [columns],eax mov [cur_editor.Columns.Count],eax ;! [columns],eax
@@: @@:
push ecx push ecx
mov edi,[cur_tab.Editor.Data] ;! AREA_TEMP2 mov edi,[cur_editor.Lines] ;! AREA_TEMP2
add edi,[edi-4] add edi,[edi-4]
dec edi dec edi
lea esi,[edi+8] lea esi,[edi+8]
@ -1108,7 +1108,7 @@ func key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
add esi,eax;[esi-8] add esi,eax;[esi-8]
movzx eax,word[esi-4] movzx eax,word[esi-4]
add esi,eax;[esi-4] add esi,eax;[esi-4]
mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2 mov ecx,[cur_editor.Lines] ;! AREA_TEMP2
add ecx,[ecx-4] add ecx,[ecx-4]
sub ecx,esi sub ecx,esi
cld cld
@ -1120,16 +1120,16 @@ func key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
rep movsb rep movsb
.ok.dec.lines: .ok.dec.lines:
dec [cur_tab.Editor.Lines] ;! [lines] dec [cur_editor.Lines.Count] ;! [lines]
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] mov eax,[cur_editor.Lines.Count] ;! eax,[lines]
cmp [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax cmp [cur_editor.Caret.Y],eax ;! [pos.y],eax
jb @f jb @f
dec eax dec eax
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax mov [cur_editor.Caret.Y],eax ;! [pos.y],eax
@@: m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x] @@: m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y] m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
mov [cur_tab.Editor.Modified],1 ;! [modified],1 mov [cur_editor.Modified],1 ;! [modified],1
.exit.2: .exit.2:
call check_inv_all call check_inv_all
@ -1152,23 +1152,23 @@ func key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION ////////////////////
call delete_selection call delete_selection
jnc key.del.exit.2 jnc key.del.exit.2
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] mov eax,[cur_editor.Caret.X] ;! eax,[pos.x]
dec eax dec eax
js .line_up js .line_up
dec [cur_tab.Editor.Caret.X] ;! [pos.x] dec [cur_editor.Caret.X] ;! [pos.x]
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y] mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
call get_line_offset call get_line_offset
and dword[esi],not 0x00020000 and dword[esi],not 0x00020000
or dword[esi],0x00010000 or dword[esi],0x00010000
mov ebx,eax mov ebx,eax
call get_real_length call get_real_length
cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] cmp eax,[cur_editor.Caret.X] ;! eax,[pos.x]
jae @f jae @f
m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x] m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
call check_inv_all call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1 mov [cur_editor.Modified],1 ;! [modified],1
ret ret
@@: lea edi,[esi+4+ebx] @@: lea edi,[esi+4+ebx]
@ -1182,17 +1182,17 @@ func key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION ////////////////////
rep movsb rep movsb
mov byte[edi],' ' mov byte[edi],' '
m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x] m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y] m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
call check_inv_str call check_inv_str
mov [cur_tab.Editor.Modified],1 ;! [modified],1 mov [cur_editor.Modified],1 ;! [modified],1
ret ret
.line_up: .line_up:
cmp [cur_tab.Editor.Caret.Y],0 ;! [pos.y],0 cmp [cur_editor.Caret.Y],0 ;! [pos.y],0
jne @f jne @f
ret ret
@@: mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y] @@: mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
dec ecx dec ecx
call get_line_offset call get_line_offset
and dword[esi],not 0x00020000 and dword[esi],not 0x00020000
@ -1205,8 +1205,8 @@ func key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION ////////////////////
jne @f jne @f
dec ecx dec ecx
jg @b jg @b
@@: mov [cur_tab.Editor.Caret.X],ecx ;! [pos.x],ecx @@: mov [cur_editor.Caret.X],ecx ;! [pos.x],ecx
dec [cur_tab.Editor.Caret.Y] ;! [pos.y] dec [cur_editor.Caret.Y] ;! [pos.y]
cld cld
jmp key.del.line_up jmp key.del.line_up
endf endf
@ -1215,7 +1215,7 @@ endf
func key.tab ;///// TABULATE ///////////////////////////////////////////////// func key.tab ;///// TABULATE /////////////////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
call delete_selection call delete_selection
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] mov eax,[cur_editor.Caret.X] ;! eax,[pos.x]
mov ecx,eax mov ecx,eax
add eax,ATABW add eax,ATABW
@ -1223,7 +1223,7 @@ func key.tab ;///// TABULATE /////////////////////////////////////////////////
push eax ' ' push eax ' '
sub eax,ecx sub eax,ecx
.direct: .direct:
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y] mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
call get_line_offset call get_line_offset
and dword[esi],not 0x00020000 and dword[esi],not 0x00020000
or dword[esi],0x00010000 or dword[esi],0x00010000
@ -1231,15 +1231,15 @@ func key.tab ;///// TABULATE /////////////////////////////////////////////////
xchg eax,ecx xchg eax,ecx
call get_real_length call get_real_length
cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] cmp eax,[cur_editor.Caret.X] ;! eax,[pos.x]
jae @f jae @f
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] mov eax,[cur_editor.Caret.X] ;! eax,[pos.x]
@@: movzx edx,word[esi] @@: movzx edx,word[esi]
sub edx,eax sub edx,eax
cmp ecx,edx cmp ecx,edx
jl @f jl @f
pushad; esi ecx eax pushad; esi ecx eax
mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2-10+1 mov ecx,[cur_editor.Lines] ;! AREA_TEMP2-10+1
add ecx,[ecx-4] add ecx,[ecx-4]
dec ecx dec ecx
mov edi,ecx ;! AREA_TEMP2 mov edi,ecx ;! AREA_TEMP2
@ -1268,26 +1268,26 @@ func key.tab ;///// TABULATE /////////////////////////////////////////////////
sub esi,ecx sub esi,ecx
lea ecx,[esi+1] lea ecx,[esi+1]
sub ecx,ebx sub ecx,ebx
sub ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x] sub ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
std std
rep movsb rep movsb
.ok: pop ecx ;******* .ok: pop ecx ;*******
pop eax pop eax
rep stosb rep stosb
cld cld
pop [cur_tab.Editor.Caret.X] ;! [pos.x] pop [cur_editor.Caret.X] ;! [pos.x]
lea esi,[ebx-4] lea esi,[ebx-4]
call get_real_length call get_real_length
cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] cmp eax,[cur_editor.Caret.X] ;! eax,[pos.x]
jae @f jae @f
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] mov eax,[cur_editor.Caret.X] ;! eax,[pos.x]
@@: cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns] @@: cmp eax,[cur_editor.Columns.Count] ;! eax,[columns]
jbe @f jbe @f
mov [cur_tab.Editor.Columns],eax ;! [columns],eax mov [cur_editor.Columns.Count],eax ;! [columns],eax
@@: m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x] @@: m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y] m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
call check_inv_all call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1 mov [cur_editor.Modified],1 ;! [modified],1
.exit: .exit:
ret ret
@ -1298,10 +1298,10 @@ func key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
call delete_selection call delete_selection
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y] mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
call get_line_offset call get_line_offset
mov ebx,[cur_tab.Editor.Caret.X] ;! ebx,[pos.x] mov ebx,[cur_editor.Caret.X] ;! ebx,[pos.x]
cmp bx,[esi] cmp bx,[esi]
jb @f jb @f
movzx ebx,word[esi] movzx ebx,word[esi]
@ -1362,7 +1362,7 @@ func key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
.lp2: xor eax,eax .lp2: xor eax,eax
@@: mov edx,edi @@: mov edx,edi
add edi,4 add edi,4
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax mov [cur_editor.Caret.X],eax ;! [pos.x],eax
jecxz @f jecxz @f
push ecx push ecx
mov ecx,eax mov ecx,eax
@ -1384,7 +1384,7 @@ func key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
sub ecx,[temp_buf] sub ecx,[temp_buf]
push ecx push ecx
mov edi,[cur_tab.Editor.Data] ;! AREA_TEMP2 mov edi,[cur_editor.Lines] ;! AREA_TEMP2
add edi,[edi-4] add edi,[edi-4]
dec edi dec edi
lea esi,[edi+4] lea esi,[edi+4]
@ -1402,7 +1402,7 @@ func key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
lea edi,[esi+eax-4] lea edi,[esi+eax-4]
movzx ecx,word[ebp] movzx ecx,word[ebp]
add esi,ecx;[ebp] add esi,ecx;[ebp]
mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2 mov ecx,[cur_editor.Lines] ;! AREA_TEMP2
add ecx,[ecx-4] add ecx,[ecx-4]
sub ecx,esi sub ecx,esi
cld cld
@ -1413,14 +1413,14 @@ func key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
cld cld
rep movsb rep movsb
inc [cur_tab.Editor.Caret.Y] ;! [pos.y] inc [cur_editor.Caret.Y] ;! [pos.y]
inc [cur_tab.Editor.SelStart.Y] ;! [sel.y] inc [cur_editor.SelStart.Y] ;! [sel.y]
inc [cur_tab.Editor.Lines] ;! [lines] inc [cur_editor.Lines.Count] ;! [lines]
m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x] m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
call check_inv_all call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1 mov [cur_editor.Modified],1 ;! [modified],1
.exit: .exit:
ret ret
@ -1444,6 +1444,7 @@ func key.ctrl_tab ;///// SWITCH TO NEXT TAB //////////////////////////////////
jb @f jb @f
mov ebp,[tab_bar.Items] mov ebp,[tab_bar.Items]
@@: call set_cur_tab @@: call set_cur_tab
call make_tab_visible
call align_editor_in_tab call align_editor_in_tab
call draw_editor call draw_editor
call draw_tabctl call draw_tabctl
@ -1470,9 +1471,21 @@ func key.shift_ctrl_tab ;///// SWITCH TO PREVIOUS TAB ////////////////////////
add eax,[tab_bar.Items] add eax,[tab_bar.Items]
lea ebp,[eax-sizeof.TABITEM] lea ebp,[eax-sizeof.TABITEM]
@@: call set_cur_tab @@: call set_cur_tab
call make_tab_visible
call align_editor_in_tab call align_editor_in_tab
call draw_editor call draw_editor
call draw_tabctl call draw_tabctl
.exit: .exit:
ret ret
endf endf
;-----------------------------------------------------------------------------
func key.ctrl_f4 ;///// CLOSE CURRENT TAB ////////////////////////////////////
;-----------------------------------------------------------------------------
mov ebp,[tab_bar.Current.Ptr]
call delete_tab
cmp [tab_bar.Items.Count],0
jne @f
call create_tab
@@: ret
endf

View File

@ -2,17 +2,17 @@
sz htext,'TINYPAD ',APP_VERSION sz htext,'TINYPAD ',APP_VERSION
menubar_res main_menu,\ menubar_res main_menu,\
ru,'” ©«' ,mm.File ,onshow.file ,\ ru,'” ©«' ,mm.File ,onshow.file ,\
ru,'<27>à ¢ª ' ,mm.Edit ,onshow.edit ,\ ru,'<27>à ¢ª ' ,mm.Edit ,onshow.edit ,\
ru,'<27>®¨áª' ,mm.Search ,onshow.search ,\ ru,'<27>®¨áª' ,mm.Search ,onshow.search ,\
ru,'‡ ¯ãáª' ,mm.Run ,onshow.run ,\ ru,'‡ ¯ãáª' ,mm.Run ,onshow.run ,\
ru,'Š®¤¨à®¢ª ',mm.Encoding,onshow.recode ,\ ru,'Š®¤¨à®¢ª ',mm.Encoding,onshow.recode ,\
ru,'Ž¯æ¨¨' ,mm.Options ,onshow.options,\ ru,'Ž¯æ¨¨' ,mm.Options ,onshow.options,\
\ \
en,'File' ,mm.File ,onshow.file ,\ en,'File' ,mm.File ,onshow.file ,\
en,'Edit' ,mm.Edit ,onshow.edit ,\ en,'Edit' ,mm.Edit ,onshow.edit ,\
en,'Search' ,mm.Search ,onshow.search ,\ en,'Search' ,mm.Search ,onshow.search ,\
en,'Run' ,mm.Run ,onshow.run ,\ en,'Run' ,mm.Run ,onshow.run ,\
en,'Encoding',mm.Encoding,onshow.recode ,\ en,'Encoding',mm.Encoding,onshow.recode ,\
en,'Options' ,mm.Options ,onshow.options en,'Options' ,mm.Options ,onshow.options
@ -22,13 +22,17 @@ popup_res mm.File,\
ru,'‘®åà ­¨âì' ,'Ctrl+S' ,Save ,\ ru,'‘®åà ­¨âì' ,'Ctrl+S' ,Save ,\
ru,'‘®åà ­¨âì ª ª...','Ctrl+Shift+S',SaveAs,\ ru,'‘®åà ­¨âì ª ª...','Ctrl+Shift+S',SaveAs,\
ru,'-' ,'' , ,\ ru,'-' ,'' , ,\
ru,'‡ ªàëâì' ,'Ctrl+F4' ,Close ,\
ru,'-' ,'' , ,\
ru,'‚ë室' ,'Alt+X' ,Exit ,\ ru,'‚ë室' ,'Alt+X' ,Exit ,\
\ \
en,'New' ,'Ctrl+N' ,New ,\ en,'New' ,'Ctrl+N' ,New ,\
en,'Open...' ,'Ctrl+O' ,Open ,\ en,'Open...' ,'Ctrl+O' ,Open ,\
en,'Save' ,'Ctrl+S' ,Save ,\ en,'Save' ,'Ctrl+S' ,Save ,\
en,'Save as...','Ctrl+Shift+S',SaveAs,\ en,'Save as...','Ctrl+Shift+S',SaveAs,\
en,'-' ,'' , ,\ en,'-' ,'' , ,\
en,'Close' ,'Ctrl+F4' ,Close ,\
en,'-' ,'' , ,\
en,'Exit' ,'Alt+X' ,Exit en,'Exit' ,'Alt+X' ,Exit
popup_res mm.Edit,\ popup_res mm.Edit,\
@ -36,71 +40,71 @@ popup_res mm.Edit,\
ru,'Š®¯¨à®¢ âì' ,'Ctrl+C',Copy ,\ ru,'Š®¯¨à®¢ âì' ,'Ctrl+C',Copy ,\
ru,'‚áâ ¢¨âì' ,'Ctrl+V',Insert,\ ru,'‚áâ ¢¨âì' ,'Ctrl+V',Insert,\
ru,'“¤ «¨âì' ,'' ,Delete,\ ru,'“¤ «¨âì' ,'' ,Delete,\
ru,'-' ,'' , ,\ ru,'-' ,'' , ,\
ru,'‚뤥«¨âì ¢áñ','Ctrl+A',SelAll,\ ru,'‚뤥«¨âì ¢áñ','Ctrl+A',SelAll,\
\ \
en,'Cut' ,'Ctrl+X',Cut ,\ en,'Cut' ,'Ctrl+X',Cut ,\
en,'Copy' ,'Ctrl+C',Copy ,\ en,'Copy' ,'Ctrl+C',Copy ,\
en,'Paste' ,'Ctrl+V',Insert,\ en,'Paste' ,'Ctrl+V',Insert,\
en,'Delete' ,'' ,Delete,\ en,'Delete' ,'' ,Delete,\
en,'-' ,'' , ,\ en,'-' ,'' , ,\
en,'Select all','Ctrl+A',SelAll en,'Select all','Ctrl+A',SelAll
popup_res mm.Search,\ popup_res mm.Search,\
ru,'<27>¥à¥©â¨...' ,'Ctrl+G',Position,\ ru,'<27>¥à¥©â¨...' ,'Ctrl+G',Position,\
ru,'-' ,'' , ,\ ru,'-' ,'' , ,\
ru,'<27> ©â¨...' ,'Ctrl+F',Find ,\ ru,'<27> ©â¨...' ,'Ctrl+F',Find ,\
ru,'<27> ©â¨ ¤ «¥¥','F3' ,FindNext,\ ru,'<27> ©â¨ ¤ «¥¥','F3' ,FindNext,\
ru,'‡ ¬¥­¨âì...','Ctrl+H',Replace ,\ ru,'‡ ¬¥­¨âì...','Ctrl+H',Replace ,\
\ \
en,'Position...','Ctrl+G',Position,\ en,'Position...','Ctrl+G',Position,\
en,'-' ,'' , ,\ en,'-' ,'' , ,\
en,'Find...' ,'Ctrl+F',Find ,\ en,'Find...' ,'Ctrl+F',Find ,\
en,'Find next' ,'F3' ,FindNext,\ en,'Find next' ,'F3' ,FindNext,\
en,'Replace...' ,'Ctrl+H',Replace en,'Replace...' ,'Ctrl+H',Replace
popup_res mm.Run,\ popup_res mm.Run,\
ru,'‡ ¯ãáâ¨âì' ,'F9' ,Run ,\ ru,'‡ ¯ãáâ¨âì' ,'F9' ,Run ,\
ru,'Š®¬¯¨«¨à®¢ âì' ,'Ctrl+F9',Compile ,\ ru,'Š®¬¯¨«¨à®¢ âì' ,'Ctrl+F9',Compile ,\
ru,'-' ,'' , ,\ ru,'-' ,'' , ,\
ru,'„®áª  ®â« ¤ª¨' ,'' ,DbgBoard,\ ru,'„®áª  ®â« ¤ª¨' ,'' ,DbgBoard,\
ru,'‘¨á⥬­ë¥ ä㭪樨','' ,SysFuncs,\ ru,'‘¨á⥬­ë¥ ä㭪樨','' ,SysFuncs,\
\ \
en,'Run' ,'F9' ,Run ,\ en,'Run' ,'F9' ,Run ,\
en,'Compile' ,'Ctrl+F9',Compile ,\ en,'Compile' ,'Ctrl+F9',Compile ,\
en,'-' ,'' , ,\ en,'-' ,'' , ,\
en,'Debug board' ,'' ,DbgBoard,\ en,'Debug board' ,'' ,DbgBoard,\
en,'System functions' ,'' ,SysFuncs en,'System functions' ,'' ,SysFuncs
popup_res mm.Encoding,\ popup_res mm.Encoding,\
@!,'CP866 -> CP1251','',CP866.CP1251,\ @!,<'CP866 ',0x1A,' CP1251'>,'',CP866.CP1251,\
@!,'CP1251 -> CP866' ,'',CP1251.CP866,\ @!,<'CP1251 ',0x1A,' CP866' >,'',CP1251.CP866,\
@!,'-' ,'', ,\ @!,<'-' >,'', ,\
@!,'CP866 -> KOI8-R','',CP866.KOI8R ,\ @!,<'CP866 ',0x1A,' KOI8-R'>,'',CP866.KOI8R ,\
@!,'KOI8-R -> CP866' ,'',KOI8R.CP866 ,\ @!,<'KOI8-R ',0x1A,' CP866' >,'',KOI8R.CP866 ,\
@!,'-' ,'', ,\ @!,<'-' >,'', ,\
@!,'CP1251 -> KOI8-R','',CP1251.KOI8R,\ @!,<'CP1251 ',0x1A,' KOI8-R'>,'',CP1251.KOI8R,\
@!,'KOI8-R -> CP1251','',KOI8R.CP1251 @!,<'KOI8-R ',0x1A,' CP1251'>,'',KOI8R.CP1251
popup_res mm.Options,\ popup_res mm.Options,\
ru,'‚­¥è­¨© ¢¨¤...' ,'',Appearance ,\ ru,'‚­¥è­¨© ¢¨¤...' ,'',Appearance ,\
ru,'-' ,'', ,\ ru,'-' ,'', ,\
ru,'<27>¥§®¯ á­®¥ ¢ë¤¥«¥­¨¥' ,'',SecureSel ,\ ru,'<27>¥§®¯ á­®¥ ¢ë¤¥«¥­¨¥' ,'',SecureSel ,\
ru,'€¢â®¬ â¨ç¥áª¨¥ ᪮¡ª¨' ,'',AutoBrackets,\ ru,'€¢â®¬ â¨ç¥áª¨¥ ᪮¡ª¨' ,'',AutoBrackets,\
ru,'€¢â®¬ â¨ç¥áª¨© ®âáâã¯' ,'',AutoIndents ,\ ru,'€¢â®¬ â¨ç¥áª¨© ®âáâã¯' ,'',AutoIndents ,\
ru,'“¬­ ï â ¡ã«ïæ¨ï' ,'',SmartTabs ,\ ru,'“¬­ ï â ¡ã«ïæ¨ï' ,'',SmartTabs ,\
ru,'Ž¯â¨¬ «ì­®¥ á®åà ­¥­¨¥','',OptimalFill ,\ ru,'Ž¯â¨¬ «ì­®¥ á®åà ­¥­¨¥','',OptimalFill ,\
ru,'-' ,'', ,\ ru,'-' ,'', ,\
ru,'<27>®¬¥à  áâப' ,'',LineNumbers ,\ ru,'<27>®¬¥à  áâப' ,'',LineNumbers ,\
\ \
en,'Appearance...' ,'',Appearance ,\ en,'Appearance...' ,'',Appearance ,\
en,'-' ,'', ,\ en,'-' ,'', ,\
en,'Secure selection' ,'',SecureSel ,\ en,'Secure selection' ,'',SecureSel ,\
en,'Automatic brackets' ,'',AutoBrackets,\ en,'Automatic brackets' ,'',AutoBrackets,\
en,'Automatic indents' ,'',AutoIndents ,\ en,'Automatic indents' ,'',AutoIndents ,\
en,'Smart tabulation' ,'',SmartTabs ,\ en,'Smart tabulation' ,'',SmartTabs ,\
en,'Optimal fill on saving','',OptimalFill ,\ en,'Optimal fill on saving','',OptimalFill ,\
en,'-' ,'', ,\ en,'-' ,'', ,\
en,'Line numbers' ,'',LineNumbers en,'Line numbers' ,'',LineNumbers
lsz s_modified,\ lsz s_modified,\

View File

@ -157,31 +157,31 @@ mouse:
cdq;xor edx,edx cdq;xor edx,edx
mov ecx,LINEH mov ecx,LINEH
idiv ecx idiv ecx
@@: add eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] @@: add eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
mov ebx,eax mov ebx,eax
pop eax pop eax
cdq;xor edx,edx cdq;xor edx,edx
mov ecx,6 mov ecx,6
idiv ecx idiv ecx
@@: add eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] @@: add eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns] cmp eax,[cur_editor.Columns.Count] ;! eax,[columns]
jl @f jl @f
mov eax,[cur_tab.Editor.Columns] ;! eax,[columns] mov eax,[cur_editor.Columns.Count] ;! eax,[columns]
@@: cmp ebx,[cur_tab.Editor.Lines] ;! ebx,[lines] @@: cmp ebx,[cur_editor.Lines.Count] ;! ebx,[lines]
jl @f jl @f
mov ebx,[cur_tab.Editor.Lines] ;! ebx,[lines] mov ebx,[cur_editor.Lines.Count] ;! ebx,[lines]
dec ebx dec ebx
@@: @@:
cmp [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax cmp [cur_editor.Caret.X],eax ;! [pos.x],eax
jne .change_cur_pos jne .change_cur_pos
cmp [cur_tab.Editor.Caret.Y],ebx ;! [pos.y],ebx cmp [cur_editor.Caret.Y],ebx ;! [pos.y],ebx
je still.skip_write je still.skip_write
.change_cur_pos: .change_cur_pos:
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax mov [cur_editor.Caret.X],eax ;! [pos.x],eax
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
mov [cur_tab.Editor.Caret.Y],ebx ;! [pos.y],ebx mov [cur_editor.Caret.Y],ebx ;! [pos.y],ebx
call check_cur_vis_inv call check_cur_vis_inv
jc .check_ldown jc .check_ldown
; cmp eax,ebx ; cmp eax,ebx
@ -213,20 +213,20 @@ mouse:
; sub ebx,[__rc+0x4] ; sub ebx,[__rc+0x4]
cmp [vscrl_capt],0 cmp [vscrl_capt],0
jge .vcaptured jge .vcaptured
mov eax,[cur_tab.Editor.VScroll.Top] ;! eax,[vscrl_top] mov eax,[cur_editor.VScroll.Top] ;! eax,[vscrl_top]
cmp ebx,eax cmp ebx,eax
jb .center_vcapture jb .center_vcapture
add eax,[cur_tab.Editor.VScroll.Size] ;! eax,[vscrl_size] add eax,[cur_editor.VScroll.Size] ;! eax,[vscrl_size]
cmp ebx,eax cmp ebx,eax
jae .center_vcapture jae .center_vcapture
mov eax,ebx mov eax,ebx
sub eax,[cur_tab.Editor.VScroll.Top] ;! eax,[vscrl_top] sub eax,[cur_editor.VScroll.Top] ;! eax,[vscrl_top]
dec eax dec eax
mov [vscrl_capt],eax mov [vscrl_capt],eax
dec ebx dec ebx
jmp .vcaptured jmp .vcaptured
.center_vcapture: .center_vcapture:
mov eax,[cur_tab.Editor.VScroll.Size] ;! eax,[vscrl_size] mov eax,[cur_editor.VScroll.Size] ;! eax,[vscrl_size]
shr eax,1 shr eax,1
mov [vscrl_capt],eax mov [vscrl_capt],eax
.vcaptured: .vcaptured:
@ -236,24 +236,24 @@ mouse:
@@: mov [mouse_captured],1 @@: mov [mouse_captured],1
mov eax,[bot_ofs] mov eax,[bot_ofs]
sub eax,[top_ofs] sub eax,[top_ofs]
sub eax,[cur_tab.Editor.VScroll.Size] ;! eax,[vscrl_size] sub eax,[cur_editor.VScroll.Size] ;! eax,[vscrl_size]
sub eax,SCRLW*3-2 sub eax,SCRLW*3-2
cmp eax,ebx cmp eax,ebx
jge @f jge @f
mov ebx,eax mov ebx,eax
@@: @@:
mov [cur_tab.Editor.VScroll.Top],ebx ;! [vscrl_top],ebx mov [cur_editor.VScroll.Top],ebx ;! [vscrl_top],ebx
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] mov eax,[cur_editor.Lines.Count] ;! eax,[lines]
sub eax,[lines.scr] sub eax,[lines.scr]
imul ebx imul ebx
mov ebx,[bot_ofs] mov ebx,[bot_ofs]
sub ebx,[top_ofs] sub ebx,[top_ofs]
sub ebx,SCRLW*3-2 ;** sub ebx,SCRLW*3-2 ;**
sub ebx,[cur_tab.Editor.VScroll.Size] ;! ebx,[vscrl_size] sub ebx,[cur_editor.VScroll.Size] ;! ebx,[vscrl_size]
idiv ebx idiv ebx
cmp eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] cmp eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
je still.skip_write je still.skip_write
mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax
call check_bottom_right call check_bottom_right
call draw_file call draw_file
jmp still.skip_write jmp still.skip_write
@ -274,20 +274,20 @@ mouse:
; sub ebx,[__rc+0x0] ; sub ebx,[__rc+0x0]
cmp [hscrl_capt],0 cmp [hscrl_capt],0
jge .hcaptured jge .hcaptured
mov eax,[cur_tab.Editor.HScroll.Top] ;! eax,[hscrl_top] mov eax,[cur_editor.HScroll.Top] ;! eax,[hscrl_top]
cmp ebx,eax cmp ebx,eax
jl .center_hcapture jl .center_hcapture
add eax,[cur_tab.Editor.HScroll.Size] ;! eax,[hscrl_size] add eax,[cur_editor.HScroll.Size] ;! eax,[hscrl_size]
cmp ebx,eax cmp ebx,eax
jge .center_hcapture jge .center_hcapture
mov eax,ebx mov eax,ebx
sub eax,[cur_tab.Editor.HScroll.Top] ;! eax,[hscrl_top] sub eax,[cur_editor.HScroll.Top] ;! eax,[hscrl_top]
dec eax dec eax
mov [hscrl_capt],eax mov [hscrl_capt],eax
dec ebx dec ebx
jmp .hcaptured jmp .hcaptured
.center_hcapture: .center_hcapture:
mov eax,[cur_tab.Editor.HScroll.Size] ;! eax,[hscrl_size] mov eax,[cur_editor.HScroll.Size] ;! eax,[hscrl_size]
shr eax,1 shr eax,1
mov [hscrl_capt],eax mov [hscrl_capt],eax
.hcaptured: .hcaptured:
@ -296,23 +296,23 @@ mouse:
xor ebx,ebx xor ebx,ebx
@@: mov [mouse_captured],1 @@: mov [mouse_captured],1
mov eax,[p_info.box.width] mov eax,[p_info.box.width]
sub eax,[cur_tab.Editor.HScroll.Size] ;! eax,[hscrl_size] sub eax,[cur_editor.HScroll.Size] ;! eax,[hscrl_size]
sub eax,SCRLW*3+10+1 sub eax,SCRLW*3+10+1
cmp eax,ebx cmp eax,ebx
jge @f jge @f
mov ebx,eax mov ebx,eax
@@: @@:
mov [cur_tab.Editor.HScroll.Top],ebx ;! [hscrl_top],ebx mov [cur_editor.HScroll.Top],ebx ;! [hscrl_top],ebx
mov eax,[cur_tab.Editor.Columns] ;! eax,[columns] mov eax,[cur_editor.Columns.Count] ;! eax,[columns]
sub eax,[columns.scr] sub eax,[columns.scr]
imul ebx imul ebx
mov ebx,[p_info.box.width] mov ebx,[p_info.box.width]
sub ebx,SCRLW*3+10+1 ;** sub ebx,SCRLW*3+10+1 ;**
sub ebx,[cur_tab.Editor.HScroll.Size] ;! ebx,[hscrl_size] sub ebx,[cur_editor.HScroll.Size] ;! ebx,[hscrl_size]
idiv ebx idiv ebx
cmp eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] cmp eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
je still.skip_write je still.skip_write
mov [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax mov [cur_editor.TopLeft.X],eax ;! [left_col],eax
call check_bottom_right call check_bottom_right
call draw_file call draw_file
jmp still.skip_write jmp still.skip_write
@ -347,78 +347,3 @@ mouse:
mov [mouse_captured],0 mov [mouse_captured],0
mov [just_from_popup],0 mov [just_from_popup],0
jmp still.skip_write jmp still.skip_write
func setup_main_menu_popup
mov ebx,[p_info.box.left]
add ebx,[p_info.client_box.left]
@@: dec ecx
jz @f
add edx,8+1
movzx esi,byte[edx-1]
add edx,esi
jmp @b
@@: movzx ecx,word[edx+2]
add ebx,ecx
mov [eax+POPUP.x],bx
mov ebx,[p_info.box.top]
add ebx,[p_info.client_box.top]
add ebx,ATOPH-1
mov [eax+POPUP.y],bx
mov [POPUP_STACK],eax
ret
endf
onshow:
.file:
or byte[mm.File+3],0x01
cmp [f_info.length],0
jne @f
and byte[mm.File+3],0xFE
@@: ret
.edit:
or byte[mm.Edit+2],0x01
cmp [copy_size],0
jne @f
and byte[mm.Edit+2],0xFE
@@: or dword[mm.Edit+0],0x01000101
cmp [sel.selected],0
jne @f
and dword[mm.Edit+0],0xFEFFFEFE
@@: ret
.search:
mov byte[mm.Search+0],0
;mov byte[mm.Search+4],0
ret
.run:
ret
.recode:
ret
.options:
mov word[mm.Options+0],0
mov byte[mm.Options+5],0
or byte[mm.Options+2],0x02
test [options],OPTS_SECURESEL
jnz @f
and byte[mm.Options+2],0xFD
@@: or byte[mm.Options+3],0x02
test [options],OPTS_AUTOBRACES
jnz @f
and byte[mm.Options+3],0xFD
@@: or byte[mm.Options+4],0x02
test [options],OPTS_AUTOINDENT
jnz @f
and byte[mm.Options+4],0xFD
@@: or byte[mm.Options+6],0x02
test [options],OPTS_OPTIMSAVE
jnz @f
and byte[mm.Options+6],0xFD
@@: or byte[mm.Options+8],0x02
test [options],OPTS_LINENUMS
jnz @f
and byte[mm.Options+8],0xFD
@@: ret

View File

@ -2,88 +2,6 @@
POP_IHEIGHT = 16 POP_IHEIGHT = 16
;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
func calc_middle
shr eax,1
shr ebx,1
and eax,0x007F7F7F
and ebx,0x007F7F7F
add eax,ebx
ret
endf
func calc_3d_colors
pushad
m2m [cl_3d_normal],[sc.work]
m2m [cl_3d_inset],[sc.work_graph]
push [cl_3d_normal]
add byte[esp],48
jnc @f
mov byte[esp],255
@@: add byte[esp+1],48
jnc @f
mov byte[esp+1],255
@@: add byte[esp+2],48
jnc @f
mov byte[esp+2],255
@@: pop [cl_3d_outset]
mov eax,[cl_3d_inset]
mov ebx,[cl_3d_outset]
call calc_middle
mov [cl_3d_pushed],eax
mov eax,[cl_3d_normal]
mov ebx,[sc.work_text]
call calc_middle
mov [cl_3d_grayed],eax
popad
ret
endf
func draw_3d_panel ; x,y,w,h
cmp dword[esp+8],4
jl .exit
cmp dword[esp+4],4
jl .exit
mov ebx,[esp+16-2]
mov bx,[esp+8]
inc ebx
mov ecx,[esp+12-2]
mov cx,[esp+4]
inc ecx
mcall 13,,,[cl_3d_normal];0x00EEEEEE;[sc.work]
dec ebx
add bx,[esp+16]
mov cx,[esp+12]
mcall 38,,,[cl_3d_inset];0x006382BF;[sc.work_text]
add ecx,[esp+4-2]
add cx,[esp+4]
mcall
mov bx,[esp+16]
mov ecx,[esp+12-2]
mov cx,[esp+4]
add cx,[esp+12]
mcall
add ebx,[esp+8-2]
add bx,[esp+8]
mcall
mov ebx,[esp+16-2]
mov bx,[esp+8]
add bx,[esp+16]
add ebx,1*65536-1
mov ecx,[esp+12-2]
mov cx,[esp+12]
add ecx,0x00010001
mcall ,,,[cl_3d_outset]
mov bx,[esp+16]
inc ebx
mov ecx,[esp+12-2]
mov cx,[esp+4]
add cx,[esp+12]
add ecx,2*65536-1
mcall
.exit:
ret 4*4
endf
popup_thread_start: popup_thread_start:
mov [popup_active],1 mov [popup_active],1
mov [pi_cur],0 mov [pi_cur],0
@ -315,6 +233,79 @@ func draw_popup_wnd
ret ret
endf endf
func setup_main_menu_popup
mov ebx,[p_info.box.left]
add ebx,[p_info.client_box.left]
@@: dec ecx
jz @f
add edx,8+1
movzx esi,byte[edx-1]
add edx,esi
jmp @b
@@: movzx ecx,word[edx+2]
add ebx,ecx
mov [eax+POPUP.x],bx
mov ebx,[p_info.box.top]
add ebx,[p_info.client_box.top]
add ebx,ATOPH-1
mov [eax+POPUP.y],bx
mov [POPUP_STACK],eax
ret
endf
onshow:
.file:
or byte[mm.File+3],0x01
cmp [f_info.length],0
jne @f
and byte[mm.File+3],0xFE
@@: ret
.edit:
or byte[mm.Edit+2],0x01
cmp [copy_size],0
jne @f
and byte[mm.Edit+2],0xFE
@@: or dword[mm.Edit+0],0x01000101
cmp [sel.selected],0
jne @f
and dword[mm.Edit+0],0xFEFFFEFE
@@: ret
.search:
mov byte[mm.Search+0],0
ret
.run:
ret
.recode:
ret
.options:
mov word[mm.Options+0],0
mov byte[mm.Options+5],0
or byte[mm.Options+2],0x02
test [options],OPTS_SECURESEL
jnz @f
and byte[mm.Options+2],0xFD
@@: or byte[mm.Options+3],0x02
test [options],OPTS_AUTOBRACES
jnz @f
and byte[mm.Options+3],0xFD
@@: or byte[mm.Options+4],0x02
test [options],OPTS_AUTOINDENT
jnz @f
and byte[mm.Options+4],0xFD
@@: or byte[mm.Options+6],0x02
test [options],OPTS_OPTIMSAVE
jnz @f
and byte[mm.Options+6],0xFD
@@: or byte[mm.Options+8],0x02
test [options],OPTS_LINENUMS
jnz @f
and byte[mm.Options+8],0xFD
@@: ret
pi_sel dd ? pi_sel dd ?
pi_cur dd ? pi_cur dd ?
p_pos dd ? p_pos dd ?

View File

@ -19,8 +19,8 @@ recode:
mov edi,table.koi.1251 mov edi,table.koi.1251
.main: .main:
mov ecx,[cur_tab.Editor.Lines] ;! ecx,[lines] mov ecx,[cur_editor.Lines.Count] ;! ecx,[lines]
mov esi,[cur_tab.Editor.Data] ;! AREA_EDIT mov esi,[cur_editor.Lines] ;! AREA_EDIT
jecxz .exit jecxz .exit
xor eax,eax xor eax,eax
.lp0: dec ecx .lp0: dec ecx

View File

@ -2,7 +2,7 @@
sz s_defname,'Untitled',0 sz s_defname,'Untitled',0
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
func flush_cur_tab ;////////////////////////////////////////////////////////// func flush_cur_tab ;///// SAVE CURRENT TAB DATA TO CONTROL ///////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; EBP = TABITEM* ; EBP = TABITEM*
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
@ -17,7 +17,7 @@ func flush_cur_tab ;//////////////////////////////////////////////////////////
endf endf
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
func set_cur_tab ;//////////////////////////////////////////////////////////// func set_cur_tab ;///// SET SPECIFIED TAB CURRENT (FOCUS IT) /////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; EBP = TABITEM* ; EBP = TABITEM*
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
@ -36,7 +36,43 @@ func set_cur_tab ;////////////////////////////////////////////////////////////
endf endf
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
func create_tab ;///////////////////////////////////////////////////////////// func make_tab_visible ;///// MAKE SPECIFIED TAB VISIBLE IF IT'S OFFSCREEN ////
;-----------------------------------------------------------------------------
push ebp
imul eax,[tab_bar.Items.Left],sizeof.TABITEM
add eax,[tab_bar.Items]
cmp eax,ebp
jb .go_right
ja .go_left
add esp,4
ret
.go_right:
call get_hidden_tabitems_number
cmp ebp,[esp]
ja .lp1
@@: inc [tab_bar.Items.Left]
call get_hidden_tabitems_number
cmp ebp,[esp]
jbe @b
@@: inc [tab_bar.Items.Left]
.lp1: pop ebp
ret
.go_left:
mov eax,ebp
sub eax,[tab_bar.Items]
jz @f
cwde
mov ebx,sizeof.TABITEM
div ebx
@@: mov [tab_bar.Items.Left],eax
add esp,4
ret
endf
;-----------------------------------------------------------------------------
func create_tab ;///// ADD TAB TO THE END ////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
push eax ecx esi edi push eax ecx esi edi
@ -50,20 +86,21 @@ func create_tab ;/////////////////////////////////////////////////////////////
sub [tab_bar.Current.Ptr],ecx sub [tab_bar.Current.Ptr],ecx
lea ebp,[eax+ebx-sizeof.TABITEM] lea ebp,[eax+ebx-sizeof.TABITEM]
call set_cur_tab call set_cur_tab
call make_tab_visible
mov eax,1024 mov eax,1024
call mem.Alloc call mem.Alloc
mov [cur_tab.Editor.Data],eax mov [cur_editor.Lines],eax
mov [cur_tab.Editor.Lines],1 mov [cur_editor.Lines.Count],1
mov [cur_tab.Editor.Columns],1 mov [cur_editor.Columns.Count],1
xor eax,eax xor eax,eax
mov [cur_tab.Editor.TopLeft.X],eax mov [cur_editor.TopLeft.X],eax
mov [cur_tab.Editor.TopLeft.Y],eax mov [cur_editor.TopLeft.Y],eax
mov [cur_tab.Editor.Caret.X],eax mov [cur_editor.Caret.X],eax
mov [cur_tab.Editor.Caret.Y],eax mov [cur_editor.Caret.Y],eax
mov [cur_tab.Editor.SelStart.X],eax mov [cur_editor.SelStart.X],eax
mov [cur_tab.Editor.SelStart.Y],eax mov [cur_editor.SelStart.Y],eax
mov edi,[cur_tab.Editor.Data] mov edi,[cur_editor.Lines]
add edi,4 add edi,4
mov ecx,10 mov ecx,10
mov [edi-4],ecx mov [edi-4],ecx
@ -73,14 +110,14 @@ func create_tab ;/////////////////////////////////////////////////////////////
rep stosb rep stosb
mov esi,s_defname mov esi,s_defname
mov edi,cur_tab.Editor.FilePath mov edi,cur_editor.FilePath
mov ecx,s_defname.size mov ecx,s_defname.size
rep movsb rep movsb
mov [cur_tab.Editor.FileName],0 mov [cur_editor.FileName],0
mov [f_info.length],0 mov [f_info.length],0
mov [cur_tab.Editor.Modified],0 mov [cur_editor.Modified],0
mov [cur_tab.Editor.AsmMode],0 mov [cur_editor.AsmMode],0
call flush_cur_tab call flush_cur_tab
call update_caption call update_caption
@ -92,35 +129,81 @@ func create_tab ;/////////////////////////////////////////////////////////////
endf endf
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
func delete_tab ;///////////////////////////////////////////////////////////// func delete_tab ;///// DELETE SPECIFIED TAB //////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
mov eax,[ebp+TABITEM.Editor.Lines]
call mem.Free
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
call mem.ReAlloc
mov [tab_bar.Items],eax
sub ecx,eax
sub ebp,ecx
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
call drawwindow
ret
.no_tabs:
mov eax,[tab_bar.Items]
call mem.Free
mov [tab_bar.Items],0
mov [tab_bar.Current.Ptr],0
ret ret
endf endf
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
func get_tab_size ;/////////////////////////////////////////////////////////// func draw_tabctl ;///// DRAW TAB CONTROL /////////////////////////////////////
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; EBP = TABITEM*
;-----------------------------------------------------------------------------
push eax
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
jmp .lp2
.lp1: call get_max_tab_width
mov ebx,eax
.lp2: mov ecx,TBARH-1
pop eax
ret
endf
;----------------------------------------------------------------------------- dec [tab_bar.Items.Left]
func draw_tabctl ;//////////////////////////////////////////////////////////// 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
@@:
mov ebx,[tab_bar.Bounds.Left-2] mov ebx,[tab_bar.Bounds.Left-2]
mov bx,word[tab_bar.Bounds.Right] mov bx,word[tab_bar.Bounds.Right]
@ -150,9 +233,18 @@ func draw_tabctl ;////////////////////////////////////////////////////////////
xor cx,cx xor cx,cx
add ecx,1*65536+TBARH add ecx,1*65536+TBARH
mcall 13 mcall 13
add ecx,(TBARH-2)*65536-(TBARH-3) add ecx,(TBARH-1)*65536-(TBARH-1)
mcall ,,,[sc.work]
add ecx,-1*65536+2
mov edx,[cl_3d_inset] mov edx,[cl_3d_inset]
call draw_framerect call draw_framerect
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
ret ret
.tabs_on_bottom: .tabs_on_bottom:
@ -163,19 +255,86 @@ func draw_tabctl ;////////////////////////////////////////////////////////////
mcall 13 mcall 13
mov cx,1 mov cx,1
mcall ,,,[sc.work] mcall ,,,[sc.work]
add ecx,-1*65536+2;-(TBARH-3) add ecx,-1*65536+2
mov edx,[cl_3d_inset] mov edx,[cl_3d_inset]
call draw_framerect call draw_framerect
mov ecx,[tab_bar.Items.Count]
mov ebp,[tab_bar.Items]
mov esi,[tab_bar.Bounds.Left] mov esi,[tab_bar.Bounds.Left]
inc esi inc esi
mov edi,[tab_bar.Bounds.Bottom] mov edi,[tab_bar.Bounds.Bottom]
add edi,-TBARH+1 add edi,-TBARH+1
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
@@: push ecx @@: push ecx
call get_tab_size call get_tab_size
call dword[esp+(8+4)+4]
jc .draw_tabs.dontfit
rol ebx,16 rol ebx,16
mov bx,si mov bx,si
rol ebx,16 rol ebx,16
@ -185,15 +344,17 @@ func draw_tabctl ;////////////////////////////////////////////////////////////
mov edx,[cl_3d_inset] mov edx,[cl_3d_inset]
call draw_framerect call draw_framerect
mov edx,[sc.work_text]
cmp ebp,[tab_bar.Current.Ptr] cmp ebp,[tab_bar.Current.Ptr]
jne .lp1 jne .draw_tabs.inactive
push ebx ecx push ebx ecx
add ebx,1*65536-2 call dword[esp+(8+4)+8+8]
dec ecx
mcall 13,,,[sc.work] mcall 13,,,[sc.work]
pop ecx ebx pop ecx ebx
.lp1: mov edx,[color_tbl+4*0]
pushad .draw_tabs.inactive:
push ebx ecx esi edx
lea eax,[ebp+TABITEM.Editor.FilePath] lea eax,[ebp+TABITEM.Editor.FilePath]
add eax,[ebp+TABITEM.Editor.FileName] add eax,[ebp+TABITEM.Editor.FileName]
mov edx,eax mov edx,eax
@ -202,66 +363,287 @@ func draw_tabctl ;////////////////////////////////////////////////////////////
shr ecx,16 shr ecx,16
mov bx,cx mov bx,cx
add ebx,0x00050005 add ebx,0x00050005
mcall 4,,0x00000000 pop ecx
popad mcall 4
pop esi ecx ebx
movzx ebx,bx inc [tab_bar.Buttons.Last]
lea esi,[esi+ebx+1] 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]
add ebp,sizeof.TABITEM add ebp,sizeof.TABITEM
pop ecx pop ecx
dec ecx dec ecx
dec dword[esp]
jnz @b jnz @b
add esp,4
or ecx,ecx
jnz @f
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
call get_max_tab_width
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 ret
.tabs_on_left: .scroll_on_top:
call get_max_tab_width add ebx,(-SCRLW*2-1)*65536+SCRLW
mov ebx,[tab_bar.Bounds.Left-2] mov ecx,[tab_bar.Bounds.Top]
mov bx,ax shl ecx,16
add ebx,1*65536 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 add ecx,1*65536-2
ret
.curr_top:
add ebx,1*65536-2
add ecx,0x00010000
ret
.curr_right:
dec ebx
add ecx,1*65536-2
ret
.curr_bottom:
add ebx,1*65536-2
dec ecx
ret
.check_horz:
lea eax,[ebx-1]
add eax,esi
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:
lea eax,[ecx-1]
add eax,edi
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
endf
;-----------------------------------------------------------------------------
func get_tab_size ;///// GET TAB WIDTH ///////////////////////////////////////
;-----------------------------------------------------------------------------
; EBP = TABITEM*
;-----------------------------------------------------------------------------
push eax push eax
mcall 13 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
jmp .lp2
.lp1: call get_max_tab_width
mov ebx,eax
.lp2: mov ecx,TBARH-1
pop eax pop eax
add eax,-2 ret
shl eax,16 endf
add ebx,eax
mov bx,3 ;-----------------------------------------------------------------------------
mov edx,[cl_3d_inset] func get_max_tab_width ;///// GET WIDTH OF LONGEST TAB ///////////////////////
call draw_framerect ;-----------------------------------------------------------------------------
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
@@: pop ebp ecx ebx
ret
endf
;-----------------------------------------------------------------------------
func get_hidden_tabitems_number ;/////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov al,[tab_bar.Style]
dec al
dec al
jle .tabs_horz
dec al
dec al
jle .tabs_vert
ret ret
.tabs_on_right: .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
ret
.calc_tabs:
mov esi,[tab_bar.Bounds.Left]
inc esi
mov edi,[tab_bar.Bounds.Top]
inc edi
mov ecx,[tab_bar.Items.Count]
mov ebp,[tab_bar.Items]
imul eax,[tab_bar.Items.Left],sizeof.TABITEM
add ebp,eax
mov eax,ecx
sub eax,[tab_bar.Items.Left]
push eax
@@: 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
endf
;-----------------------------------------------------------------------------
func align_editor_in_tab ;///// ADJUST EDITOR POSITION TO FIT IN TAB /////////
;-----------------------------------------------------------------------------
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]
call get_max_tab_width call get_max_tab_width
mov ebx,[tab_bar.Bounds.Right-2] lea ebx,[eax+1]
mov bx,ax
shl eax,16
sub ebx,eax
add ecx,1*65536-2
mcall 13
add ebx,-1*65536
mov bx,3
mov edx,[cl_3d_inset]
call draw_framerect
ret
endf
func get_max_tab_width
mov eax,100
ret
endf
func align_editor_in_tab
m2m [cur_tab.Editor.Bounds.Left],[tab_bar.Bounds.Left]
m2m [cur_tab.Editor.Bounds.Top],[tab_bar.Bounds.Top]
m2m [cur_tab.Editor.Bounds.Right],[tab_bar.Bounds.Right]
m2m [cur_tab.Editor.Bounds.Bottom],[tab_bar.Bounds.Bottom]
inc [cur_tab.Editor.Bounds.Left]
inc [cur_tab.Editor.Bounds.Top]
dec [cur_tab.Editor.Bounds.Right]
dec [cur_tab.Editor.Bounds.Bottom]
mov al,[tab_bar.Style] mov al,[tab_bar.Style]
dec al dec al
@ -275,20 +657,18 @@ func align_editor_in_tab
ret ret
.tabs_on_top: .tabs_on_top:
add [cur_tab.Editor.Bounds.Top],TBARH add [cur_editor.Bounds.Top],TBARH
ret ret
.tabs_on_bottom: .tabs_on_bottom:
sub [cur_tab.Editor.Bounds.Bottom],TBARH sub [cur_editor.Bounds.Bottom],TBARH
ret ret
.tabs_on_left: .tabs_on_left:
call get_max_tab_width add [cur_editor.Bounds.Left],ebx
add [cur_tab.Editor.Bounds.Left],eax
ret ret
.tabs_on_right: .tabs_on_right:
call get_max_tab_width sub [cur_editor.Bounds.Right],ebx
sub [cur_tab.Editor.Bounds.Right],eax
ret ret
endf endf