From da2d1b6055f90401583475e01d55da11401af34f Mon Sep 17 00:00:00 2001 From: "Mihail Semenyako (mike.dld)" Date: Wed, 10 Jan 2007 06:03:39 +0000 Subject: [PATCH] Tinypad 4.0.4 in progress (full tabbing) git-svn-id: svn://kolibrios.org@267 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/tinypad/trunk/tinypad.asm | 81 +-- programs/develop/tinypad/trunk/tinypad.inc | 31 +- programs/develop/tinypad/trunk/tp-button.asm | 118 ++-- programs/develop/tinypad/trunk/tp-common.asm | 124 ++-- programs/develop/tinypad/trunk/tp-defines.inc | 7 +- programs/develop/tinypad/trunk/tp-dialog.asm | 4 +- programs/develop/tinypad/trunk/tp-draw.asm | 186 ++++-- programs/develop/tinypad/trunk/tp-editor.asm | 230 ++++--- programs/develop/tinypad/trunk/tp-files.asm | 35 +- programs/develop/tinypad/trunk/tp-key.asm | 357 +++++------ programs/develop/tinypad/trunk/tp-locale.inc | 60 +- programs/develop/tinypad/trunk/tp-mouse.asm | 137 +---- programs/develop/tinypad/trunk/tp-popup.asm | 155 +++-- programs/develop/tinypad/trunk/tp-recode.asm | 4 +- programs/develop/tinypad/trunk/tp-tabctl.asm | 580 +++++++++++++++--- 15 files changed, 1271 insertions(+), 838 deletions(-) diff --git a/programs/develop/tinypad/trunk/tinypad.asm b/programs/develop/tinypad/trunk/tinypad.asm index df241279bf..5d237d1278 100644 --- a/programs/develop/tinypad/trunk/tinypad.asm +++ b/programs/develop/tinypad/trunk/tinypad.asm @@ -3,7 +3,7 @@ ; compiler: flat assembler 1.67.15 ; memory to compile: 2.0/7.0 MBytes (without/with size optimizations) ; 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) ;----------------------------------------------------------------------------- ; originally by: Ville Michael Turjanmaa >> villemt@aton.co.jyu.fi @@ -15,15 +15,17 @@ ; - add vertical selection, undo, goto position, overwrite mode ; - improve window drawing with small dimensions ; - 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): -; - finish tabbed interface [critical] +; - finish tabbed interface (some bug with tab switching) [critical] ; - add memory reallocation to keys handler [critical] ; - rework save_file (memory manager) [critical] -; - reduce flickering (changes checker) [average] -; - incorrect saved/modified lines flags on copy/paste [normal] -; - case-insensitive file extensions comparison (.asm/.inc) [normal] -; - prompt to save file before closing/opening [low] +; - fix scrollbars dragging coordinates calculation [critical] +; - fix parameters parsing (incl. DOCPAK) [average] +; - reduce flickering (introduce changes checker) [normal] +; - fix incorrect saved/modified lines flags on copy/paste [normal] +; - add prompt to save file before closing/opening [low] ; ; HISTORY: ; 4.0.4 pre (mike.dld) @@ -31,12 +33,17 @@ ; - statusbar contained hint after dialog operation cancelled ; - small drawing fix for gutter and line saved/modified markers ; changes: +; - editor and other modifications to ease parts placement changing ; - modified/saved colors now match those in MSVS ; - function 70 for *all* file operations (including diamond's fixes) ; - 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: ; - recode tables between CP866, CP1251 and KOI8-R (suggested by Victor) ; - tabbed interface, ability to open several files in one app instance +; (thanks IRC guys for ideas and testing) ; 4.0.3 (mike.dld) ; bug-fixes: ; - 1-char selection if pressing out of real line length @@ -46,6 +53,7 @@ ; - statusbar and textboxes drawing fixes (wrong colors) ; - perform no redraw while pressing Shift, Ctrl, Alt keys ; - data length from DOCPAK in string representation (fixed by diamond) +; - compare file extension case-insensitively (fixed by diamond) ; changes: ; - function 70 instead of 58 for files loading/saving ; - clientarea-relative drawing (less code) @@ -156,23 +164,17 @@ APP_VERSION equ '4.0.4 pre' ;include 'debug.inc' -ASEPC = '-' ; separator character (char) -ATOPH = POP_IHEIGHT+2 ; menu bar height (pixels) -SCRLW = 16 ; scrollbar widht/height (pixels) -ATABW = 8 ; tab width (chars) -LINEH = 10 ; line height (pixels) -PATHL = 256 ; maximum path length (chars) !!! don't change !!! -AMINS = 8 ; minimal scroll thumb size (pixels) -LCHGW = 3 ; changed/saved marker width +ASEPC = '-' ; separator character (char) +ATOPH = POP_IHEIGHT+2 ; menu bar height (pixels) +SCRLW = 16 ; scrollbar widht/height (pixels) +ATABW = 8 ; tab width (chars) +LINEH = 10 ; line height (pixels) +PATHL = 256 ; maximum path length (chars) !!! don't change !!! +AMINS = 8 ; minimal scroll thumb size (pixels) +LCHGW = 3 ; changed/saved marker width -STATH = 16 ; status bar height -TBARH = 18 ; tab bar height - -MEV_LDOWN = 1 -MEV_LUP = 2 -MEV_RDOWN = 3 -MEV_RUP = 4 -MEV_MOVE = 5 +STATH = 16 ; status bar height +TBARH = 18 ; tab bar height ;----------------------------------------------------------------------------- section @OPTIONS ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @@ -180,13 +182,13 @@ section @OPTIONS ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: label color_tbl dword 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(176, 0, 0) ; RGB(160, 0, 0) ; RGB( 0,128,255) ; strings - RGB(128,128,128) ; RGB(144,144,144) ; RGB(160,160,160) ; comments - RGB( 48, 48,240) ; RGB( 48, 48,240) ; RGB(255, 0, 0) ; symbols - RGB(255,255,255) ; RGB(224,224,224) ; RGB(255,255,255) ; background + RGB( 0,144, 0) ; RGB( 0,160, 0) ; RGB( 0,144, 0) ; numbers + RGB(176, 0, 0) ; RGB( 0,128,255) ; RGB(160, 0, 0) ; strings + RGB(128,128,128) ; RGB(160,160,160) ; RGB(144,144,144) ; comments + RGB( 48, 48,240) ; RGB(255, 0, 0) ; RGB( 48, 48,240) ; symbols + 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( 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(108,226,108) ; saved line marker @@ -195,7 +197,7 @@ ins_mode db 1 options db OPTS_AUTOINDENT+OPTS_OPTIMSAVE+OPTS_SMARTTAB mainwnd_pos: - .x dd 100 + .x dd 250 .y dd 75 .w dd 6*80+6+SCRLW+5 .h dd 402 @@ -235,7 +237,7 @@ section @CODE ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: mov eax,65536 call mem.Alloc - mov [cur_tab.Editor.Data],eax + mov [cur_editor.Lines],eax inc [do_not_draw] @@ -364,7 +366,7 @@ func start_fasm ;///////////////////////////////////////////////////////////// ;----------------------------------------------------------------------------- ; BL = run after compile ;----------------------------------------------------------------------------- - cmp [cur_tab.Editor.AsmMode],0 ;! [asm_mode],0 + cmp [cur_editor.AsmMode],0 ;! [asm_mode],0 jne @f ret @@: mov esi,f_info.path ; s_fname @@ -560,7 +562,7 @@ key0 db \ 0x00,0x39,0x00,0x00,0x00,0x00,0x00,0x00 times 12*16 db 0x00 -accel_table dd \ +accel_table_main dd \ 0x0000000E,key.bkspace ,\ ; BackSpace 0x0000000F,key.tab ,\ ; Tab 0x0000001C,key.return ,\ ; Return @@ -599,6 +601,7 @@ accel_table dd \ 0x0002002E,key.ctrl_c ,\ ; Ctrl+C 0x0002002F,key.ctrl_v ,\ ; Ctrl+V 0x00020031,key.ctrl_n ,\ ; Ctrl+N + 0x0002003E,key.ctrl_f4 ,\ ; Ctrl+F4 0x00020043,key.ctrl_f9 ,\ ; Ctrl+F9 0x00020147,key.ctrl_home ,\ ; Ctrl+Home \;0x00020148,key.ctrl_up ,\ ; Ctrl+Up @@ -641,10 +644,12 @@ accel_table_textbox dd \ accel_table2 dd \ 1,btn.close_main_window ,\ - 'UP',btn.scroll_up ,\ - 'DN',btn.scroll_down ,\ - 'LT',btn.scroll_left ,\ - 'RT',btn.scroll_right ,\ + 'VSL',btn.vscroll_up ,\ + 'VSG',btn.vscroll_down ,\ + 'HSL',btn.hscroll_up ,\ + 'HSG',btn.hscroll_down ,\ + 'TBL',btn.tabctl_right ,\ + 'TBG',btn.tabctl_left ,\ 0 accel_table2_botdlg dd \ @@ -725,7 +730,9 @@ file_info FILEINFO tab_bar TABCTL virtual at tab_bar.Current cur_tab TABITEM - ;cur_tab_addr dd ? +end virtual +virtual at tab_bar.Current.Editor + cur_editor EDITOR end virtual lines.scr dd ? ; number of lines on the screen diff --git a/programs/develop/tinypad/trunk/tinypad.inc b/programs/develop/tinypad/trunk/tinypad.inc index a3467f3e3c..e6ff760f7d 100644 --- a/programs/develop/tinypad/trunk/tinypad.inc +++ b/programs/develop/tinypad/trunk/tinypad.inc @@ -19,12 +19,12 @@ ends struct EDITOR FilePath db PATHL dup(?) FileName dd ? - Data dd ? Bounds RECT + Lines dd ? + Lines.Count dd ? + Columns.Count dd ? Caret POINT SelStart POINT - Lines dd ? - Columns dd ? TopLeft POINT VScroll SCROLLBAR HScroll SCROLLBAR @@ -40,13 +40,16 @@ struct TABITEM ends struct TABCTL - Bounds RECT - Items dd ? - Items.Count dd ? - Current TABITEM - Current.Ptr dd ? - Style db ? - db 3 dup(?) + Bounds RECT + Items dd ? + Items.Count dd ? + Items.Left dd ? + Current TABITEM + Current.Ptr dd ? + Buttons.First dd ? + Buttons.Last dd ? + Style db ? + db 3 dup(?) ends @@ -193,6 +196,14 @@ OPTS_SMARTTAB = 00001000b OPTS_OPTIMSAVE = 00010000b OPTS_LINENUMS = 00100000b +;// MOUSE EVENTS + +MEV_LDOWN = 1 +MEV_LUP = 2 +MEV_RDOWN = 3 +MEV_RUP = 4 +MEV_MOVE = 5 + ;// KEY MODIFIERS KM_SHIFT = 0x00010000 diff --git a/programs/develop/tinypad/trunk/tp-button.asm b/programs/develop/tinypad/trunk/tp-button.asm index 24890f2620..6f8af04ec2 100644 --- a/programs/develop/tinypad/trunk/tp-button.asm +++ b/programs/develop/tinypad/trunk/tp-button.asm @@ -20,46 +20,79 @@ button: cmp byte[esi],0 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 - btn.scroll_up: - dec [cur_tab.Editor.TopLeft.Y] ;! [top_line] + btn.vscroll_up: + dec [cur_editor.TopLeft.Y] ;! [top_line] jns @f - inc [cur_tab.Editor.TopLeft.Y] ;! [top_line] + inc [cur_editor.TopLeft.Y] ;! [top_line] ret @@: call check_inv_all.skip_check ret - btn.scroll_down: - inc [cur_tab.Editor.TopLeft.Y] ;! [top_line] - mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] + btn.vscroll_down: + inc [cur_editor.TopLeft.Y] ;! [top_line] + mov eax,[cur_editor.Lines.Count] ;! eax,[lines] 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 - dec [cur_tab.Editor.TopLeft.Y] ;! [top_line] + dec [cur_editor.TopLeft.Y] ;! [top_line] ret @@: call check_inv_all.skip_check ret - btn.scroll_left: - dec [cur_tab.Editor.TopLeft.X] ;! [left_col] + btn.hscroll_up: + dec [cur_editor.TopLeft.X] ;! [left_col] jns @f - inc [cur_tab.Editor.TopLeft.X] ;! [left_col] + inc [cur_editor.TopLeft.X] ;! [left_col] ret;jmp still.skip_write @@: call check_inv_all.skip_check ret - btn.scroll_right: - inc [cur_tab.Editor.TopLeft.X] ;! [left_col] - mov eax,[cur_tab.Editor.Columns] ;! eax,[columns] + btn.hscroll_down: + inc [cur_editor.TopLeft.X] ;! [left_col] + mov eax,[cur_editor.Columns.Count] ;! eax,[columns] 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 - dec [cur_tab.Editor.TopLeft.X] ;! [left_col] + dec [cur_editor.TopLeft.X] ;! [left_col] ret @@: call check_inv_all.skip_check 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: key.f3: call search @@ -70,7 +103,7 @@ button: func search cld - mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y] + mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y] mov edx,ecx call get_line_offset cmp word[esi],0 @@ -80,9 +113,9 @@ func search or eax,eax jz .end_line.2 mov ecx,eax - sub ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x] + sub ecx,[cur_editor.Caret.X] ;! ecx,[pos.x] push esi - add esi,[cur_tab.Editor.Caret.X] ;! esi,[pos.x] + add esi,[cur_editor.Caret.X] ;! esi,[pos.x] jmp @f .next_line: @@ -118,15 +151,15 @@ func search .found: add esp,4 - mov [cur_tab.Editor.Caret.Y],edx ;! [pos.y],edx - mov [cur_tab.Editor.SelStart.Y],edx ;! [sel.y],edx + mov [cur_editor.Caret.Y],edx ;! [pos.y],edx + mov [cur_editor.SelStart.Y],edx ;! [sel.y],edx mov ecx,edx lea eax,[esi-4] call get_line_offset 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] - mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax + mov [cur_editor.Caret.X],eax ;! [pos.x],eax mov [s_status],0 clc ret @@ -173,34 +206,37 @@ endf @@: xor eax,eax - mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax - mov [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax - mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax - mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax - mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax - mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax + mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax + mov [cur_editor.TopLeft.X],eax ;! [left_col],eax + mov [cur_editor.Caret.X],eax ;! [pos.x],eax + mov [cur_editor.Caret.Y],eax ;! [pos.y],eax + mov [cur_editor.SelStart.X],eax ;! [sel.x],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: - mov [cur_tab.Editor.AsmMode],al ;! [asm_mode],al + mov [cur_editor.AsmMode],al ;! [asm_mode],al - mov eax,[f_info.length] - add eax,f_info.path - mov byte[eax],0 - mov ecx, dword [eax-3] - or ecx, 0x202020 - cmp ecx, 'asm' +; mov eax,[f_info.length] +; add eax,f_info.path +; mov byte[eax],0 + lea ebx,[cur_editor.FilePath] + mov eax,ebx + call strlen + mov ecx,dword[ebx+eax-3] + or ecx,0x202020 + cmp ecx,'asm' jne @f - inc [cur_tab.Editor.AsmMode] ;! [asm_mode] + inc [cur_editor.AsmMode] ;! [asm_mode] jmp .nocol - @@: cmp ecx, 'inc' + @@: cmp ecx,'inc' jne .nocol - inc [cur_tab.Editor.AsmMode] ;! [asm_mode] + inc [cur_editor.AsmMode] ;! [asm_mode] .nocol: 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 @@: lodsb diff --git a/programs/develop/tinypad/trunk/tp-common.asm b/programs/develop/tinypad/trunk/tp-common.asm index 538a4759dc..dded9e7ff2 100644 --- a/programs/develop/tinypad/trunk/tp-common.asm +++ b/programs/develop/tinypad/trunk/tp-common.asm @@ -4,62 +4,62 @@ func check_cur_vis_inv ;////////////////////////////////////////////////////// push eax ebx xor bl,bl .chk_y: - mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] + mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] or eax,eax jge @f - mov [cur_tab.Editor.Caret.Y],0 ;! [pos.y],0 + mov [cur_editor.Caret.Y],0 ;! [pos.y],0 jmp .chk_dy - @@: cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines] + @@: cmp eax,[cur_editor.Lines.Count] ;! eax,[lines] jl .chk_dy - mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] + mov eax,[cur_editor.Lines.Count] ;! eax,[lines] dec eax - mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax + mov [cur_editor.Caret.Y],eax ;! [pos.y],eax .chk_dy: - mov eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] - cmp eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] + mov eax,[cur_editor.TopLeft.Y] ;! eax,[top_line] + cmp eax,[cur_editor.Caret.Y] ;! eax,[pos.y] 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] ;! pop [top_line] inc bl @@: 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 - mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] + mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] sub eax,[lines.scr] inc eax - mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax + mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax inc bl .chk_x: - mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] + mov eax,[cur_editor.Caret.X] ;! eax,[pos.x] or eax,eax jge @f - mov [cur_tab.Editor.Caret.X],0 ;! [pos.x],0 + mov [cur_editor.Caret.X],0 ;! [pos.x],0 jmp .chk_dx - @@: cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns] + @@: cmp eax,[cur_editor.Columns.Count] ;! eax,[columns] jl .chk_dx - mov eax,[cur_tab.Editor.Columns] ;! eax,[columns] - mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax + mov eax,[cur_editor.Columns.Count] ;! eax,[columns] + mov [cur_editor.Caret.X],eax ;! [pos.x],eax .chk_dx: - mov eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] - cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] + mov eax,[cur_editor.TopLeft.X] ;! eax,[left_col] + cmp eax,[cur_editor.Caret.X] ;! eax,[pos.x] 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] ;! pop [left_col] inc bl @@: 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 - mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] + mov eax,[cur_editor.Caret.X] ;! eax,[pos.x] sub eax,[columns.scr] inc eax - mov [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax + mov [cur_editor.TopLeft.X],eax ;! [left_col],eax inc bl @@: cmp [mev],MEV_LDOWN jne .exit - push [cur_tab.Editor.Caret.X] [cur_tab.Editor.Caret.Y] ;! [pos.x] [pos.y] - pop [cur_tab.Editor.SelStart.Y] [cur_tab.Editor.SelStart.X] ;! [sel.y] [sel.x] + push [cur_editor.Caret.X] [cur_editor.Caret.Y] ;! [pos.x] [pos.y] + pop [cur_editor.SelStart.Y] [cur_editor.SelStart.X] ;! [sel.y] [sel.x] .exit: or bl,bl clc @@ -74,13 +74,13 @@ endf func clear_selection ;//////////////////////////////////////////////////////// ;----------------------------------------------------------------------------- push eax ebx - mov eax,[cur_tab.Editor.SelStart.Y] ;! eax,[sel.y] - mov ebx,[cur_tab.Editor.Caret.Y] ;! ebx,[pos.y] + mov eax,[cur_editor.SelStart.Y] ;! eax,[sel.y] + mov ebx,[cur_editor.Caret.Y] ;! ebx,[pos.y] cmp eax,ebx jle @f xchg eax,ebx - @@: push [cur_tab.Editor.Caret.X] [cur_tab.Editor.Caret.Y] ;! [pos.x] [pos.y] - pop [cur_tab.Editor.SelStart.Y] [cur_tab.Editor.SelStart.X] ;! [sel.y] [sel.x] + @@: push [cur_editor.Caret.X] [cur_editor.Caret.Y] ;! [pos.x] [pos.y] + pop [cur_editor.SelStart.Y] [cur_editor.SelStart.X] ;! [sel.y] [sel.x] call draw_file.ex pop ebx eax ret @@ -107,24 +107,24 @@ endf func check_bottom_right ;///////////////////////////////////////////////////// ;----------------------------------------------------------------------------- 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] - cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines] + cmp eax,[cur_editor.Lines.Count] ;! eax,[lines] jbe .lp1 - mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] + mov eax,[cur_editor.Lines.Count] ;! eax,[lines] sub eax,[lines.scr] jns @f xor eax,eax - @@: mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax - .lp1: mov eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] + @@: mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax + .lp1: mov eax,[cur_editor.TopLeft.X] ;! eax,[left_col] add eax,[columns.scr] - cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns] + cmp eax,[cur_editor.Columns.Count] ;! eax,[columns] jbe .exit - mov eax,[cur_tab.Editor.Columns] ;! eax,[columns] + mov eax,[cur_editor.Columns.Count] ;! eax,[columns] sub eax,[columns.scr] jns @f xor eax,eax - @@: mov [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax + @@: mov [cur_editor.TopLeft.X],eax ;! [left_col],eax .exit: pop eax ret @@ -150,12 +150,12 @@ endf ;----------------------------------------------------------------------------- func check_inv_all ;////////////////////////////////////////////////////////// ;----------------------------------------------------------------------------- - mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] - mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line] + mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] + mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line] .skip_init: call check_cur_vis - mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax - mov [cur_tab.Editor.TopLeft.Y],ecx ;! [top_line],ecx + mov [cur_editor.Caret.Y],eax ;! [pos.y],eax + mov [cur_editor.TopLeft.Y],ecx ;! [top_line],ecx .skip_check: ; call clear_screen call draw_file @@ -169,9 +169,9 @@ func check_cur_vis ;////////////////////////////////////////////////////////// jb .low mov edx,ecx add edx,[lines.scr] - cmp edx,[cur_tab.Editor.Lines] ;! edx,[lines] + cmp edx,[cur_editor.Lines.Count] ;! edx,[lines] jbe @f - mov edx,[cur_tab.Editor.Lines] ;! edx,[lines] + mov edx,[cur_editor.Lines.Count] ;! edx,[lines] @@: cmp eax,edx jb @f lea ecx,[eax+1] @@ -182,17 +182,17 @@ func check_cur_vis ;////////////////////////////////////////////////////////// .low: mov ecx,eax @@: mov edx,ecx add edx,[lines.scr] - cmp edx,[cur_tab.Editor.Lines] ;! edx,[lines] + cmp edx,[cur_editor.Lines.Count] ;! edx,[lines] jbe @f - mov ecx,[cur_tab.Editor.Lines] ;! ecx,[lines] + mov ecx,[cur_editor.Lines.Count] ;! ecx,[lines] sub ecx,[lines.scr] jns @f xor ecx,ecx @@:;mov [top_line],ecx pushad - mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] - mov ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col] + mov eax,[cur_editor.Caret.X] ;! eax,[pos.x] + mov ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col] mov ecx,ebx add ecx,[columns.scr] cmp eax,ebx @@ -203,10 +203,10 @@ func check_cur_vis ;////////////////////////////////////////////////////////// sub ebx,[columns.scr] jmp @f .lp1: mov ebx,eax - @@: mov [cur_tab.Editor.TopLeft.X],ebx ;! [left_col],ebx + @@: mov [cur_editor.TopLeft.X],ebx ;! [left_col],ebx .exit: - mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax + mov [cur_editor.Caret.X],eax ;! [pos.x],eax popad ret @@ -232,7 +232,7 @@ func get_line_offset ;//////////////////////////////////////////////////////// ; ESI = line data offset ;----------------------------------------------------------------------------- push eax ecx - mov esi,[cur_tab.Editor.Data] ;! AREA_EDIT + mov esi,[cur_editor.Lines] ;! AREA_EDIT @@: dec ecx js .exit movzx eax,word[esi] @@ -248,10 +248,10 @@ func init_sel_vars ;////////////////////////////////////////////////////////// ;----------------------------------------------------------------------------- pushad mov [sel.selected],1 - mov eax,[cur_tab.Editor.SelStart.X] ;! eax,[sel.x] - mov ebx,[cur_tab.Editor.SelStart.Y] ;! ebx,[sel.y] - mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x] - mov edx,[cur_tab.Editor.Caret.Y] ;! edx,[pos.y] + mov eax,[cur_editor.SelStart.X] ;! eax,[sel.x] + mov ebx,[cur_editor.SelStart.Y] ;! ebx,[sel.y] + mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x] + mov edx,[cur_editor.Caret.Y] ;! edx,[pos.y] cmp ebx,edx jl .lp2 jne @f @@ -508,7 +508,7 @@ func line_add_spaces ;//////////////////////////////////////////////////////// jbe .exit sub ecx,edx push ecx - mov edi,[cur_tab.Editor.Data] ;! AREA_TEMP2 + mov edi,[cur_editor.Lines] ;! AREA_TEMP2 add edi,[edi-4] dec edi mov eax,esi @@ -563,14 +563,14 @@ func delete_selection ;/////////////////////////////////////////////////////// mov [edi-4],bx add edi,[sel.begin.x] lea esi,[esi+eax+4] - mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2 + mov ecx,[cur_editor.Lines] ;! AREA_TEMP2 add ecx,[ecx-4] sub ecx,esi cld rep movsb mov eax,[sel.end.y] sub eax,[sel.begin.y] - sub [cur_tab.Editor.Lines],eax ;! [lines],eax + sub [cur_editor.Lines.Count],eax ;! [lines],eax jmp .exit .single_line: @@ -589,7 +589,7 @@ func delete_selection ;/////////////////////////////////////////////////////// lea edi,[esi+4] add edi,[sel.begin.x] lea esi,[edi+ecx] - mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2 + mov ecx,[cur_editor.Lines] ;! AREA_TEMP2 add ecx,[ecx-4] sub ecx,esi cld @@ -597,13 +597,13 @@ func delete_selection ;/////////////////////////////////////////////////////// .exit: mov eax,[sel.begin.x] - mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax - mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax + mov [cur_editor.Caret.X],eax ;! [pos.x],eax + mov [cur_editor.SelStart.X],eax ;! [sel.x],eax mov eax,[sel.begin.y] - mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax - mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax + mov [cur_editor.Caret.Y],eax ;! [pos.y],eax + mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax popad - mov [cur_tab.Editor.Modified],1 ;! [modified],1 + mov [cur_editor.Modified],1 ;! [modified],1 clc ret diff --git a/programs/develop/tinypad/trunk/tp-defines.inc b/programs/develop/tinypad/trunk/tp-defines.inc index 7d01315732..cfba3580e9 100644 --- a/programs/develop/tinypad/trunk/tp-defines.inc +++ b/programs/develop/tinypad/trunk/tp-defines.inc @@ -3,6 +3,7 @@ define mm.File.New key.ctrl_n define mm.File.Open key.ctrl_o define mm.File.Save key.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.Edit.Cut key.ctrl_x @@ -12,7 +13,7 @@ define mm.Edit.Delete key.del define mm.Edit.SelAll key.ctrl_a 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.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.CP1251.CP866 recode.1251.866 -define mm.Encoding.CP866.KOI8R recode.866.koi -define mm.Encoding.KOI8R.CP866 recode.koi.866 +define mm.Encoding.CP866.KOI8R recode.866.koi +define mm.Encoding.KOI8R.CP866 recode.koi.866 define mm.Encoding.CP1251.KOI8R recode.1251.koi define mm.Encoding.KOI8R.CP1251 recode.koi.1251 diff --git a/programs/develop/tinypad/trunk/tp-dialog.asm b/programs/develop/tinypad/trunk/tp-dialog.asm index cd207e5364..394be012f7 100644 --- a/programs/develop/tinypad/trunk/tp-dialog.asm +++ b/programs/develop/tinypad/trunk/tp-dialog.asm @@ -313,10 +313,10 @@ botdlg.button: mov [copy_size],eax mov [copy_count],1 - push [cur_tab.Editor.SelStart.X] ;! [sel.x] + push [cur_editor.SelStart.X] ;! [sel.x] call init_sel_vars call key.ctrl_v - pop [cur_tab.Editor.SelStart.X] ;! [sel.x] + pop [cur_editor.SelStart.X] ;! [sel.x] mov eax,[copy_buf] call mem.Free diff --git a/programs/develop/tinypad/trunk/tp-draw.asm b/programs/develop/tinypad/trunk/tp-draw.asm index d7ebeb6633..81554f14ee 100644 --- a/programs/develop/tinypad/trunk/tp-draw.asm +++ b/programs/develop/tinypad/trunk/tp-draw.asm @@ -48,17 +48,17 @@ func drawwindow ;///// DRAW WINDOW /////////////////////////////////////////// mov [top_ofs],ATOPH;+1 - mov eax,[cur_tab.Editor.Bounds.Right] - sub eax,[cur_tab.Editor.Bounds.Left] - sub eax,[cur_tab.Editor.Gutter.Width] + mov eax,[cur_editor.Bounds.Right] + sub eax,[cur_editor.Bounds.Left] + sub eax,[cur_editor.Gutter.Width] sub eax,SCRLW+LCHGW+4 cdq mov ebx,6 div ebx mov [columns.scr],eax - mov eax,[cur_tab.Editor.Bounds.Bottom] - sub eax,[cur_tab.Editor.Bounds.Top] + mov eax,[cur_editor.Bounds.Bottom] + sub eax,[cur_editor.Bounds.Top] sub eax,SCRLW+3 cdq mov ebx,LINEH @@ -250,10 +250,10 @@ macro unused { cmp eax,ebx jle @f xchg eax,ebx - @@: cmp eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] + @@: cmp eax,[cur_editor.TopLeft.Y] ;! eax,[top_line] jge @f - mov eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] - @@: mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line] + mov eax,[cur_editor.TopLeft.Y] ;! eax,[top_line] + @@: mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line] add ecx,[lines.scr] cmp ebx,ecx jl @f @@ -273,11 +273,11 @@ macro unused { mov ebx,[top_ofs] 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 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 jmp draw_file.next_line @@ -302,7 +302,7 @@ macro unused { mov ebx,[top_ofs] 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 call get_line_offset @@ -313,9 +313,9 @@ macro unused { jle .exit 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] - sub eax,[cur_tab.Editor.Lines] ;! eax,[lines] + sub eax,[cur_editor.Lines] ;! eax,[lines] mov [draw_blines],eax .next_line: @@ -346,7 +346,7 @@ macro unused { cmp eax,[sel.end.y] je .lp5 .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 cmp eax,[columns.scr] jge .lp6 @@ -369,7 +369,7 @@ macro unused { cmp eax,[sel.end.y] je .lp5 .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 cmp eax,[columns.scr] jg .lp6.2 @@ -388,7 +388,7 @@ macro unused { mov bx,ax mov [in_sel],3 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] jge .lp4 add eax,[columns.scr] @@ -397,7 +397,7 @@ macro unused { mov eax,[sel.begin.x] cmp eax,[sel.end.x] je .lp6 - sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] + sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col] imul eax,6 pushad mov ebx,[sel.end.x] @@ -471,13 +471,13 @@ macro unused { push esi 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] jge .skip_t add ebx,esi jle .skip_t 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 sub edx,eax add esi,eax @@ -494,7 +494,7 @@ macro unused { mov eax,[esp] ; ebx 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] jle .qweqwe sub esi,eax @@ -518,7 +518,7 @@ macro unused { mov esi,[sel.begin.x] sub esi,[esp] 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] jle @f sub esi,ecx @@ -548,7 +548,7 @@ macro unused { sub eax,[esp] push ebx 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 add eax,ebx .ya2.1: @@ -580,7 +580,7 @@ macro unused { sub esi,[esp] push eax 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 add esi,eax .nt3.1: @@ -661,7 +661,7 @@ macro unused { shl ebx,16 add ebx,[top_ofs] 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 mov edx,p_info+100 @@: pushad @@ -679,10 +679,10 @@ macro unused { popad add ebx,LINEH inc ecx - cmp ecx,[cur_tab.Editor.Lines] ;! ecx,[lines] + cmp ecx,[cur_editor.Lines] ;! ecx,[lines] jg @f 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] jbe @b @@: add esp,4*8*2 @@ -707,8 +707,8 @@ macro unused { add esp,4 cmp [bot_mode],0 jne @f - mov ebx,[cur_tab.Editor.Caret.X] ;! ebx,[pos.x] - sub ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col] + mov ebx,[cur_editor.Caret.X] ;! ebx,[pos.x] + sub ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col] js @f cmp ebx,[columns.scr] ja @f @@ -718,8 +718,8 @@ macro unused { push bx shl ebx,16 pop bx - mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] - sub eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] + mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] + sub eax,[cur_editor.TopLeft.Y] ;! eax,[top_line] js @f cmp eax,[lines.scr] jge @f @@ -805,15 +805,15 @@ macro unused { ; sub ebx,1*65536-2 push ebx - mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] + mov eax,[cur_editor.Lines] ;! eax,[lines] 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] sub edx,[top_ofs] add edx,-SCRLW*3+1 call get_scroll_vars - mov [cur_tab.Editor.VScroll.Top],eax ;! [vscrl_top],eax - mov [cur_tab.Editor.VScroll.Size],ebx ;! [vscrl_size],ebx + mov [cur_editor.VScroll.Top],eax ;! [vscrl_top],eax + mov [cur_editor.VScroll.Size],ebx ;! [vscrl_size],ebx pop ebx mov ecx,eax @@ -829,7 +829,7 @@ macro unused { ; rol ecx,16 ; movsx eax,cx ; 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] call draw_3d_panel popad @@ -838,7 +838,7 @@ macro unused { inc ebx 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 mov edx,[sc.work];[color_tbl+4*5] or cx,cx @@ -846,8 +846,8 @@ macro unused { mcall 13 @@: mov ecx,[top_ofs] - add ecx,[cur_tab.Editor.VScroll.Top] ;! ecx,[vscrl_top] - add ecx,[cur_tab.Editor.VScroll.Size] ;! ecx,[vscrl_size] + add ecx,[cur_editor.VScroll.Top] ;! ecx,[vscrl_top] + add ecx,[cur_editor.VScroll.Size] ;! ecx,[vscrl_size] add ecx,SCRLW-1 mov di,cx shl ecx,16 @@ -934,20 +934,20 @@ macro unused { ; inc ecx push ecx - mov eax,[cur_tab.Editor.Columns] ;! eax,[columns] + mov eax,[cur_editor.Columns] ;! eax,[columns] 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] add edx,-(SCRLW*3) call get_scroll_vars - mov [cur_tab.Editor.HScroll.Top],eax ;! [hscrl_top],eax - mov [cur_tab.Editor.HScroll.Size],ebx ;! [hscrl_size],ebx + mov [cur_editor.HScroll.Top],eax ;! [hscrl_top],eax + mov [cur_editor.HScroll.Size],ebx ;! [hscrl_size],ebx pop ecx mov ebx,eax add ebx,1+SCRLW 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] ;!!!!!!!!!!!!!!!!!! @@ -963,11 +963,11 @@ macro unused { ;!!!!!!!!!!!!!!!!!! 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] mov ebx,1+SCRLW - add ebx,[cur_tab.Editor.HScroll.Top] ;! ebx,[hscrl_top] - add ebx,[cur_tab.Editor.HScroll.Size] ;! ebx,[hscrl_size] + add ebx,[cur_editor.HScroll.Top] ;! ebx,[hscrl_top] + add ebx,[cur_editor.HScroll.Size] ;! ebx,[hscrl_size] mov di,bx shl ebx,16 mov bx,word[p_info.client_box.width] @@ -1011,7 +1011,7 @@ func get_next_part ;////////////////////////////////////////////////////////// ; EDX = string ; ESI = length ;----------------------------------------------------------------------------- - cmp [cur_tab.Editor.AsmMode],0 ;! [asm_mode],0 + cmp [cur_editor.AsmMode],0 ;! [asm_mode],0 je .plain.text xor ebx,ebx mov edx,ecx @@ -1159,7 +1159,7 @@ func draw_statusbar ;///// WRITE POSITION //////////////////////////////////// and ecx,0x0000FFFF push ecx - mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] + mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] inc eax mov ecx,10 mov edi,p_info+0x100;htext2.pos1 @@ -1167,7 +1167,7 @@ func draw_statusbar ;///// WRITE POSITION //////////////////////////////////// call uint2str mov al,',' stosb - mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] + mov eax,[cur_editor.Caret.X] ;! eax,[pos.x] inc eax call uint2str @@ -1182,7 +1182,7 @@ func draw_statusbar ;///// WRITE POSITION //////////////////////////////////// sub ebx,edi 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 and ebx,0x0000FFFF ; add ebx,[left_ofs-2] @@ -1233,4 +1233,88 @@ func draw_framerect ; ebx,ecx,edx pop ecx ebx ret -endf \ No newline at end of file +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 diff --git a/programs/develop/tinypad/trunk/tp-editor.asm b/programs/develop/tinypad/trunk/tp-editor.asm index 32c0f57187..4391907fdb 100644 --- a/programs/develop/tinypad/trunk/tp-editor.asm +++ b/programs/develop/tinypad/trunk/tp-editor.asm @@ -1,43 +1,43 @@ ;----------------------------------------------------------------------------- -func draw_editor ;//////////////////////////////////////////////////////////// +func draw_editor ;///// DRAW EDITOR ////////////////////////////////////////// ;----------------------------------------------------------------------------- - mov ebx,[cur_tab.Editor.Bounds.Left-2] - mov bx,word[cur_tab.Editor.Bounds.Right] - sub bx,word[cur_tab.Editor.Bounds.Left] + mov ebx,[cur_editor.Bounds.Left-2] + mov bx,word[cur_editor.Bounds.Right] + sub bx,word[cur_editor.Bounds.Left] inc ebx - mov ecx,[cur_tab.Editor.Bounds.Top-2] - mov cx,word[cur_tab.Editor.Bounds.Bottom] - sub cx,word[cur_tab.Editor.Bounds.Top] + mov ecx,[cur_editor.Bounds.Top-2] + mov cx,word[cur_editor.Bounds.Bottom] + sub cx,word[cur_editor.Bounds.Top] inc ecx mov edx,[cl_3d_inset] call draw_framerect @^ - mov ebx,[cur_tab.Editor.Bounds.Left-2] - mov bx,word[cur_tab.Editor.Bounds.Right] - mov ecx,[cur_tab.Editor.Bounds.Top-2] - mov cx,word[cur_tab.Editor.Bounds.Top] + mov ebx,[cur_editor.Bounds.Left-2] + mov bx,word[cur_editor.Bounds.Right] + mov ecx,[cur_editor.Bounds.Top-2] + mov cx,word[cur_editor.Bounds.Top] mcall 38,,,[cl_3d_inset] - mov ecx,[cur_tab.Editor.Bounds.Bottom-2] - mov cx,word[cur_tab.Editor.Bounds.Bottom] + mov ecx,[cur_editor.Bounds.Bottom-2] + mov cx,word[cur_editor.Bounds.Bottom] mcall - mov bx,word[cur_tab.Editor.Bounds.Left] - mov cx,word[cur_tab.Editor.Bounds.Top] + mov bx,word[cur_editor.Bounds.Left] + mov cx,word[cur_editor.Bounds.Top] mcall - mov ebx,[cur_tab.Editor.Bounds.Right-2] - mov bx,word[cur_tab.Editor.Bounds.Right] - mov cx,word[cur_tab.Editor.Bounds.Top] + mov ebx,[cur_editor.Bounds.Right-2] + mov bx,word[cur_editor.Bounds.Right] + mov cx,word[cur_editor.Bounds.Top] mcall ^@ - mov [cur_tab.Editor.Gutter.Visible],0 + mov [cur_editor.Gutter.Visible],0 test [options],OPTS_LINENUMS jnz @f xor eax,eax ;! mov eax,2+LCHGW jmp .lp1 - @@: inc [cur_tab.Editor.Gutter.Visible] + @@: inc [cur_editor.Gutter.Visible] mov edi,p_info+100 - mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] + mov eax,[cur_editor.Lines.Count] ;! eax,[lines] mov ecx,10 call uint2str lea eax,[edi-p_info-100] @@ -46,7 +46,7 @@ func draw_editor ;//////////////////////////////////////////////////////////// mov eax,3 @@: imul eax,6 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 call draw_editor_gutter @@ -59,36 +59,36 @@ func draw_editor ;//////////////////////////////////////////////////////////// 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 add esp,-4*8*2 - mov ebx,[cur_tab.Editor.Bounds.Left-2] - mov bx,word[cur_tab.Editor.Gutter.Width] + mov ebx,[cur_editor.Bounds.Left-2] + mov bx,word[cur_editor.Gutter.Width] add ebx,0x00010000 - mov ecx,[cur_tab.Editor.Bounds.Top-2] - mov cx,word[cur_tab.Editor.Bounds.Bottom] - sub cx,word[cur_tab.Editor.Bounds.Top] + mov ecx,[cur_editor.Bounds.Top-2] + mov cx,word[cur_editor.Bounds.Bottom] + sub cx,word[cur_editor.Bounds.Top] add cx,-SCRLW add ecx,0x00010000 dec cx mcall 13,,,[cl_3d_normal] - add bx,word[cur_tab.Editor.Bounds.Left] + add bx,word[cur_editor.Bounds.Left] push bx shl ebx,16 pop bx - add ecx,[cur_tab.Editor.Bounds.Top] + add ecx,[cur_editor.Bounds.Top] mcall 38,,,[cl_3d_inset] add ebx,-2*65536 - mov bx,word[cur_tab.Editor.Bounds.Top] + mov bx,word[cur_editor.Bounds.Top] add bx,3 mov edi,[sc.work_text] - mov ecx,[cur_tab.Editor.TopLeft.Y] + mov ecx,[cur_editor.TopLeft.Y] inc ecx mov edx,p_info+100 @@: pushad @@ -106,10 +106,10 @@ func draw_editor_gutter ;///////////////////////////////////////////////////// popad add ebx,LINEH inc ecx - cmp ecx,[cur_tab.Editor.Lines] + cmp ecx,[cur_editor.Lines.Count] jg @f mov esi,ecx - sub esi,[cur_tab.Editor.TopLeft.Y] + sub esi,[cur_editor.TopLeft.Y] cmp esi,[lines.scr] jbe @b @@: add esp,4*8*2 @@ -119,15 +119,14 @@ func draw_editor_gutter ;///////////////////////////////////////////////////// endf ;----------------------------------------------------------------------------- -func draw_editor_vscroll ;//////////////////////////////////////////////////// +func draw_editor_vscroll ;///// DRAW EDITOR VERTICAL SCROLL BAR ////////////// ;----------------------------------------------------------------------------- -;!!!!!!!!!!!!!!!!!! - mov ebx,[cur_tab.Editor.Bounds.Right] + mov ebx,[cur_editor.Bounds.Right] shl ebx,16 add ebx,(-SCRLW)*65536+SCRLW - mov ecx,[cur_tab.Editor.Bounds.Top-2] + mov ecx,[cur_editor.Bounds.Top-2] mov cx,SCRLW - mcall 8,,,'UP' or 0x40000000 + mcall 8,,,'VSL' or 0x40000000 pushad sar ebx,16 sar ecx,16 @@ -135,7 +134,6 @@ func draw_editor_vscroll ;//////////////////////////////////////////////////// call draw_3d_panel popad mov eax,8 -;!!!!!!!!!!!!!!!!!! pushad push 0x18 @@ -146,11 +144,10 @@ func draw_editor_vscroll ;//////////////////////////////////////////////////// add esp,4 popad -;!!!!!!!!!!!!!!!!!! - mov ecx,[cur_tab.Editor.Bounds.Bottom] + mov ecx,[cur_editor.Bounds.Bottom] shl ecx,16 add ecx,(-SCRLW*2)*65536+SCRLW - mcall ,,,'DN' or 0x40000000 + mcall ,,,'VSG' or 0x40000000 pushad sar ebx,16 sar ecx,16 @@ -158,7 +155,6 @@ func draw_editor_vscroll ;//////////////////////////////////////////////////// call draw_3d_panel popad mov eax,8 -;!!!!!!!!!!!!!!!!!! pushad push 0x19 @@ -170,47 +166,45 @@ func draw_editor_vscroll ;//////////////////////////////////////////////////// popad push ebx - mov eax,[cur_tab.Editor.Lines] + mov eax,[cur_editor.Lines.Count] mov ebx,[lines.scr] - mov ecx,[cur_tab.Editor.TopLeft.Y] - mov edx,[cur_tab.Editor.Bounds.Bottom] - sub edx,[cur_tab.Editor.Bounds.Top] + mov ecx,[cur_editor.TopLeft.Y] + mov edx,[cur_editor.Bounds.Bottom] + sub edx,[cur_editor.Bounds.Top] add edx,-SCRLW*3+1 call get_scroll_vars - mov [cur_tab.Editor.VScroll.Top],eax - mov [cur_tab.Editor.VScroll.Size],ebx + mov [cur_editor.VScroll.Top],eax + mov [cur_editor.VScroll.Size],ebx pop ebx mov ecx,eax - add ecx,[cur_tab.Editor.Bounds.Top] + add ecx,[cur_editor.Bounds.Top] add ecx,SCRLW+1 -;!!!!!!!!!!!!!!!!!! pushad sar ebx,16 - push ebx ecx SCRLW [cur_tab.Editor.VScroll.Size] + push ebx ecx SCRLW [cur_editor.VScroll.Size] dec dword[esp] call draw_3d_panel popad mov eax,13 -;!!!!!!!!!!!!!!!!!! add ebx,1*65536-1 - mov ecx,[cur_tab.Editor.Bounds.Top-2] - mov cx,word[cur_tab.Editor.VScroll.Top] + mov ecx,[cur_editor.Bounds.Top-2] + mov cx,word[cur_editor.VScroll.Top] add ecx,(SCRLW+1)*65536 mov edx,[sc.work] or cx,cx jle @f mcall 13 @@: - mov ecx,[cur_tab.Editor.Bounds.Top] - add ecx,[cur_tab.Editor.VScroll.Top] - add ecx,[cur_tab.Editor.VScroll.Size] + mov ecx,[cur_editor.Bounds.Top] + add ecx,[cur_editor.VScroll.Top] + add ecx,[cur_editor.VScroll.Size] add ecx,SCRLW+1 mov di,cx shl ecx,16 - mov cx,word[cur_tab.Editor.Bounds.Bottom] + mov cx,word[cur_editor.Bounds.Bottom] sub cx,di sub cx,SCRLW*2;+1 jle @f @@ -221,8 +215,8 @@ func draw_editor_vscroll ;//////////////////////////////////////////////////// push bx rol ebx,16 pop bx - mov ecx,[cur_tab.Editor.Bounds.Top-2] - mov cx,word[cur_tab.Editor.Bounds.Bottom] + mov ecx,[cur_editor.Bounds.Top-2] + mov cx,word[cur_editor.Bounds.Bottom] add ecx,(SCRLW)*65536-SCRLW*2-1 mcall 38,,,[cl_3d_inset] @@ -230,21 +224,20 @@ func draw_editor_vscroll ;//////////////////////////////////////////////////// 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 ecx,[cur_tab.Editor.Bounds.Bottom] + mov ecx,[cur_editor.Bounds.Bottom] shl ecx,16 add ecx,(-SCRLW)*65536+SCRLW - mcall 8,,,'LT' or 0x40000000 + mcall 8,,,'HSL' or 0x40000000 pushad sar ebx,16 sar ecx,16 push ebx ecx SCRLW SCRLW call draw_3d_panel popad -;!!!!!!!!!!!!!!!!!! pushad push 0x1B @@ -255,18 +248,16 @@ func draw_editor_hscroll ;//////////////////////////////////////////////////// add esp,4 popad -;!!!!!!!!!!!!!!!!!! - mov ebx,[cur_tab.Editor.Bounds.Right] + mov ebx,[cur_editor.Bounds.Right] shl ebx,16 add ebx,(-SCRLW*2)*65536+SCRLW - mcall 8,,,'RT' or 0x40000000 + mcall 8,,,'HSG' or 0x40000000 pushad sar ebx,16 sar ecx,16 push ebx ecx SCRLW SCRLW call draw_3d_panel popad -;!!!!!!!!!!!!!!!!!! pushad push 0x1A @@ -278,23 +269,22 @@ func draw_editor_hscroll ;//////////////////////////////////////////////////// popad push ecx - mov eax,[cur_tab.Editor.Columns] + mov eax,[cur_editor.Columns.Count] mov ebx,[columns.scr] - mov ecx,[cur_tab.Editor.TopLeft.X] - mov edx,[cur_tab.Editor.Bounds.Right] + mov ecx,[cur_editor.TopLeft.X] + mov edx,[cur_editor.Bounds.Right] add edx,-(SCRLW*3) call get_scroll_vars - mov [cur_tab.Editor.HScroll.Top],eax - mov [cur_tab.Editor.HScroll.Size],ebx + mov [cur_editor.HScroll.Top],eax + mov [cur_editor.HScroll.Size],ebx pop ecx mov ebx,eax - add ebx,[cur_tab.Editor.Bounds.Left] + add ebx,[cur_editor.Bounds.Left] add ebx,SCRLW+1 shl ebx,16 - mov bx,word[cur_tab.Editor.HScroll.Size] + mov bx,word[cur_editor.HScroll.Size] -;!!!!!!!!!!!!!!!!!! pushad sar ecx,16 rol ebx,16 @@ -304,28 +294,27 @@ func draw_editor_hscroll ;//////////////////////////////////////////////////// push eax ecx ebx SCRLW call draw_3d_panel popad -;!!!!!!!!!!!!!!!!!! add ecx,1*65536-1 - mov ebx,[cur_tab.Editor.Bounds.Left-2] - mov bx,word[cur_tab.Editor.Bounds.Left] - mov bx,word[cur_tab.Editor.HScroll.Top] + mov ebx,[cur_editor.Bounds.Left-2] + mov bx,word[cur_editor.Bounds.Left] + mov bx,word[cur_editor.HScroll.Top] add ebx,(1+SCRLW)*65536 mcall 13,,,[sc.work] - mov ebx,[cur_tab.Editor.Bounds.Left] + mov ebx,[cur_editor.Bounds.Left] add ebx,1+SCRLW - add ebx,[cur_tab.Editor.HScroll.Top] - add ebx,[cur_tab.Editor.HScroll.Size] + add ebx,[cur_editor.HScroll.Top] + add ebx,[cur_editor.HScroll.Size] mov di,bx shl ebx,16 - mov bx,word[cur_tab.Editor.Bounds.Right] + mov bx,word[cur_editor.Bounds.Right] sub bx,di sub bx,SCRLW*2 jle @f mcall @@: - mov ebx,[cur_tab.Editor.Bounds.Left-2] - mov bx,word[cur_tab.Editor.Bounds.Right] + mov ebx,[cur_editor.Bounds.Left-2] + mov bx,word[cur_editor.Bounds.Right] add ebx,(SCRLW)*65536-SCRLW*2-1 rol ecx,16 dec cx @@ -338,10 +327,10 @@ func draw_editor_hscroll ;//////////////////////////////////////////////////// endf ;----------------------------------------------------------------------------- -func draw_editor_text ;/////////////////////////////////////////////////////// +func draw_editor_text ;///// DRAW EDITOR TEXT //////////////////////////////// ;----------------------------------------------------------------------------- - mov eax,[cur_tab.Editor.Bounds.Bottom] - sub eax,[cur_tab.Editor.Bounds.Top] + mov eax,[cur_editor.Bounds.Bottom] + sub eax,[cur_editor.Bounds.Top] cmp eax,LINEH jge @f ret @@ -351,18 +340,18 @@ func draw_editor_text ;/////////////////////////////////////////////////////// pushad - mov eax,[cur_tab.Editor.Bounds.Left] - add eax,[cur_tab.Editor.Gutter.Width] + mov eax,[cur_editor.Bounds.Left] + add eax,[cur_editor.Gutter.Width] add eax,LCHGW+3 mov [left_ofs],eax - mov eax,[cur_tab.Editor.Bounds.Top] + mov eax,[cur_editor.Bounds.Top] add eax,3 mov [top_ofs],eax mov ebx,[top_ofs] 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 call get_line_offset @@ -373,9 +362,9 @@ func draw_editor_text ;/////////////////////////////////////////////////////// jle .exit 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] - sub eax,[cur_tab.Editor.Lines] ;! eax,[lines] + sub eax,[cur_editor.Lines.Count] ;! eax,[lines] mov [draw_blines],eax .next_line: @@ -385,8 +374,8 @@ func draw_editor_text ;/////////////////////////////////////////////////////// mov ecx,ebx shl ecx,16 mov cl,LINEH - mov ebx,[cur_tab.Editor.Bounds.Right] - ;sub ebx,[cur_tab.Editor.Bounds.Left] + mov ebx,[cur_editor.Bounds.Right] + ;sub ebx,[cur_editor.Bounds.Left] add ebx,-SCRLW add ebx,[left_ofs-2] sub ebx,[left_ofs] @@ -407,7 +396,7 @@ func draw_editor_text ;/////////////////////////////////////////////////////// cmp eax,[sel.end.y] je .lp5 .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 cmp eax,[columns.scr] jge .lp6 @@ -429,7 +418,7 @@ func draw_editor_text ;/////////////////////////////////////////////////////// cmp eax,[sel.end.y] je .lp5 .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 cmp eax,[columns.scr] jg .lp6.2 @@ -448,7 +437,7 @@ func draw_editor_text ;/////////////////////////////////////////////////////// mov bx,ax mov [in_sel],3 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] jge .lp4 add eax,[columns.scr] @@ -457,7 +446,7 @@ func draw_editor_text ;/////////////////////////////////////////////////////// mov eax,[sel.begin.x] cmp eax,[sel.end.x] je .lp6 - sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] + sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col] imul eax,6 pushad mov ebx,[sel.end.x] @@ -504,6 +493,7 @@ func draw_editor_text ;/////////////////////////////////////////////////////// jz @f mov edx,[color_tbl+4*9] @@: mov ebx,[left_ofs] + add ebx,-LCHGW-2;-4 shl ebx,16 mov bx,LCHGW @@ -530,13 +520,13 @@ func draw_editor_text ;/////////////////////////////////////////////////////// push esi 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] jge .skip_t add ebx,esi jle .skip_t 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 sub edx,eax add esi,eax @@ -553,7 +543,7 @@ func draw_editor_text ;/////////////////////////////////////////////////////// mov eax,[esp] ; ebx 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] jle .qweqwe sub esi,eax @@ -577,7 +567,7 @@ func draw_editor_text ;/////////////////////////////////////////////////////// mov esi,[sel.begin.x] sub esi,[esp] 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] jle @f sub esi,ecx @@ -607,7 +597,7 @@ func draw_editor_text ;/////////////////////////////////////////////////////// sub eax,[esp] push ebx 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 add eax,ebx .ya2.1: @@ -639,7 +629,7 @@ func draw_editor_text ;/////////////////////////////////////////////////////// sub esi,[esp] push eax 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 add esi,eax .nt3.1: @@ -697,15 +687,15 @@ func draw_editor_text ;/////////////////////////////////////////////////////// jl @f mov ecx,[esp-8] shl ecx,16 - mov cx,word[cur_tab.Editor.Bounds.Bottom] + mov cx,word[cur_editor.Bounds.Bottom] sub cx,[esp-8] add cx,-SCRLW - mov eax,[cur_tab.Editor.Bounds.Left] - add eax,[cur_tab.Editor.Gutter.Width] + mov eax,[cur_editor.Bounds.Left] + add eax,[cur_editor.Gutter.Width] inc eax mov ebx,eax shl ebx,16 - mov bx,word[cur_tab.Editor.Bounds.Right] + mov bx,word[cur_editor.Bounds.Right] sub bx,ax add ebx,-SCRLW mcall 13,,,[color_tbl+4*5] @@ -717,12 +707,12 @@ func draw_editor_text ;/////////////////////////////////////////////////////// endf ;----------------------------------------------------------------------------- -func draw_editor_caret ;////////////////////////////////////////////////////// +func draw_editor_caret ;///// DRAW EDITOR TEXT CARET ///////////////////////// ;----------------------------------------------------------------------------- cmp [bot_mode],0 jne @f - mov ebx,[cur_tab.Editor.Caret.X] - sub ebx,[cur_tab.Editor.TopLeft.X] + mov ebx,[cur_editor.Caret.X] + sub ebx,[cur_editor.TopLeft.X] js @f cmp ebx,[columns.scr] ja @f @@ -732,8 +722,8 @@ func draw_editor_caret ;////////////////////////////////////////////////////// push bx shl ebx,16 pop bx - mov eax,[cur_tab.Editor.Caret.Y] - sub eax,[cur_tab.Editor.TopLeft.Y] + mov eax,[cur_editor.Caret.Y] + sub eax,[cur_editor.TopLeft.Y] js @f cmp eax,[lines.scr] jge @f diff --git a/programs/develop/tinypad/trunk/tp-files.asm b/programs/develop/tinypad/trunk/tp-files.asm index 1e965a5bc2..8e7474c7cf 100644 --- a/programs/develop/tinypad/trunk/tp-files.asm +++ b/programs/develop/tinypad/trunk/tp-files.asm @@ -1,6 +1,7 @@ ;----------------------------------------------------------------------------- func save_file ;////////////////////////////////////////////////////////////// ;----------------------------------------------------------------------------- + ret ; DISALLOW FOR NOW mov esi,tb_opensave.text mov edi,f_info.path @@ -10,7 +11,7 @@ func save_file ;////////////////////////////////////////////////////////////// rep movsb 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 .new_string: @@ -28,16 +29,6 @@ func save_file ;////////////////////////////////////////////////////////////// jmp .exit.2 .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+12],edi mov [f_info70+16],0 ;!!! AREA_TEMP @@ -51,7 +42,7 @@ func save_file ;////////////////////////////////////////////////////////////// jnz .exit.2 .exit: - mov [cur_tab.Editor.Modified],0 ;! [modified],0 + mov [cur_editor.Modified],0 ;! [modified],0 clc ret @@ -197,7 +188,6 @@ func load_file ;////////////////////////////////////////////////////////////// push ecx esi edi mov esi,tb_opensave.text lea edi,[ebp+TABITEM.Editor.FilePath] - ;mov ecx,[f_info.length] movzx ecx,[tb_opensave.length] rep movsb mov byte[edi],0 @@ -225,14 +215,15 @@ func load_from_memory ;/////////////////////////////////////////////////////// ; EBP = EDITOR* ;----------------------------------------------------------------------------- call get_lines_in_file - mov [ebp+EDITOR.Lines],eax + inc eax + mov [ebp+EDITOR.Lines.Count],eax imul ebx,eax,14 add ebx,ecx - mov eax,[ebp+EDITOR.Data] + mov eax,[ebp+EDITOR.Lines] 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 edx,ecx @@ -266,9 +257,9 @@ func load_from_memory ;/////////////////////////////////////////////////////// sub eax,10 jnz @f inc eax - @@: cmp eax,[ebp+EDITOR.Columns] ;! eax,[columns] + @@: cmp eax,[ebp+EDITOR.Columns.Count] ;! eax,[columns] jbe @f - mov [ebp+EDITOR.Columns],eax ;! [columns],eax + mov [ebp+EDITOR.Columns.Count],eax ;! [columns],eax @@: mov [ebp+EDITOR.Modified],0 ;! [modified],0 ret @@ -282,11 +273,11 @@ func load_from_memory ;/////////////////////////////////////////////////////// lea eax,[edi-4] sub eax,ebx mov [ebx],eax - ;inc [cur_tab.Editor.Lines] ;! [lines] +; inc [cur_editor.Lines] ;! [lines] add eax,-10 - cmp eax,[ebp+EDITOR.Columns] ;! eax,[columns] + cmp eax,[ebp+EDITOR.Columns.Count] ;! eax,[columns] jbe .next_line - mov [ebp+EDITOR.Columns],eax ;! [columns],eax + mov [ebp+EDITOR.Columns.Count],eax ;! [columns],eax jmp .next_line .TB: lea eax,[edi-4] diff --git a/programs/develop/tinypad/trunk/tp-key.asm b/programs/develop/tinypad/trunk/tp-key.asm index 1fe35bfea4..d885e80bf7 100644 --- a/programs/develop/tinypad/trunk/tp-key.asm +++ b/programs/develop/tinypad/trunk/tp-key.asm @@ -46,13 +46,13 @@ key: jmp still @@: - mov esi,accel_table + mov esi,accel_table_main .acc: cmp eax,[esi] jne @f test [options],OPTS_SECURESEL jz .lp1 - m2m [cur_tab.Editor.SelStart.X],[cur_tab.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.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x] + m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y] .lp1: mov [s_status],0 call dword[esi+4] jmp still @@ -74,8 +74,8 @@ key: test [options],OPTS_SECURESEL jz .lp2 - m2m [cur_tab.Editor.SelStart.X],[cur_tab.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.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x] + m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y] jmp .put .lp2: call delete_selection @@ -85,24 +85,24 @@ key: jne @f mov al,']' call .lp3 - dec [cur_tab.Editor.Caret.X] ;! [pos.x] + dec [cur_editor.Caret.X] ;! [pos.x] jmp .put @@: cmp al,'(' jne @f mov al,')' call .lp3 - dec [cur_tab.Editor.Caret.X] ;! [pos.x] + dec [cur_editor.Caret.X] ;! [pos.x] jmp .put @@: cmp al,'{' jne .put mov al,'}' call .lp3 - dec [cur_tab.Editor.Caret.X] ;! [pos.x] + dec [cur_editor.Caret.X] ;! [pos.x] .put: pop eax push still - inc [cur_tab.Editor.SelStart.X] ;! [sel.x] - .lp3: push [cur_tab.Editor.Caret.X] eax ;! [pos.x] eax + inc [cur_editor.SelStart.X] ;! [sel.x] + .lp3: push [cur_editor.Caret.X] eax ;! [pos.x] eax inc dword[esp+4] mov eax,1 jmp key.tab.direct @@ -111,14 +111,14 @@ key: func key.ctrl_a ;///// SELECT ALL DOCUMENT /////////////////////////////////// ;----------------------------------------------------------------------------- xor eax,eax - mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax - mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax - mov ecx,[cur_tab.Editor.Lines] ;! ecx,[lines] + mov [cur_editor.SelStart.X],eax ;! [sel.x],eax + mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax + mov ecx,[cur_editor.Lines.Count] ;! ecx,[lines] 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_real_length - mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax + mov [cur_editor.Caret.X],eax ;! [pos.x],eax call draw_file ret endf @@ -147,7 +147,7 @@ func key.ctrl_o ;///// ENTER OPEN FILENAME /////////////////////////////////// @@: mov al,[tb_opensave.length] mov [tb_opensave.pos.x],al mov [tb_opensave.sel.x],0 - mov [tb_casesen],1 + mov [tb_casesen],0;1 call drawwindow ret endf @@ -155,7 +155,7 @@ endf ;----------------------------------------------------------------------------- func key.ctrl_s ;///// ENTER SAVE FILENAME /////////////////////////////////// ;----------------------------------------------------------------------------- - cmp [cur_tab.Editor.Modified],0 ;! [modified],0 + cmp [cur_editor.Modified],0 ;! [modified],0 je .exit cmp [f_info.length],0 je key.shift_ctrl_s @@ -170,7 +170,7 @@ func key.ctrl_s ;///// ENTER SAVE FILENAME /////////////////////////////////// endf ;----------------------------------------------------------------------------- -func key.ctrl_n ;///// ENTER SAVE FILENAME /////////////////////////////////// +func key.ctrl_n ;///// CREATE NEW FILE (TAB) ///////////////////////////////// ;----------------------------------------------------------------------------- call create_tab ret @@ -248,8 +248,8 @@ func key.ctrl_left ;///// GO TO PREVIOUS WORD //////////////////////////////// ;----------------------------------------------------------------------------- key.shift_ctrl_left: ;///// GO TO PREVIOUS WORD, WITH SELECTION ///////// ;----------------------------------------------------------------------------- - mov ebx,[cur_tab.Editor.Caret.Y] ;! ebx,[pos.y] - mov edx,[cur_tab.Editor.Caret.X] ;! edx,[pos.x] + mov ebx,[cur_editor.Caret.Y] ;! ebx,[pos.y] + mov edx,[cur_editor.Caret.X] ;! edx,[pos.x] cld mov ecx,ebx call get_line_offset @@ -307,26 +307,26 @@ func key.ctrl_left ;///// GO TO PREVIOUS WORD //////////////////////////////// jmp .lp2 @@: inc edx - mov [cur_tab.Editor.Caret.Y],ebx ;! [pos.y],ebx - mov [cur_tab.Editor.Caret.X],edx ;! [pos.x],edx + mov [cur_editor.Caret.Y],ebx ;! [pos.y],ebx + mov [cur_editor.Caret.X],edx ;! [pos.x],edx test byte[shi+2],0x01 jnz @f - mov [cur_tab.Editor.SelStart.Y],ebx ;! [sel.y],ebx - mov [cur_tab.Editor.SelStart.X],edx ;! [sel.x],edx - @@: sub ebx,[cur_tab.Editor.TopLeft.Y] ;! ebx,[top_line] + mov [cur_editor.SelStart.Y],ebx ;! [sel.y],ebx + mov [cur_editor.SelStart.X],edx ;! [sel.x],edx + @@: sub ebx,[cur_editor.TopLeft.Y] ;! ebx,[top_line] jge @f - add [cur_tab.Editor.TopLeft.Y],ebx ;! [top_line],ebx + add [cur_editor.TopLeft.Y],ebx ;! [top_line],ebx @@: 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] jl @f sub eax,[columns.scr] inc eax - add [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax + add [cur_editor.TopLeft.X],eax ;! [left_col],eax jmp .exit - @@: cmp edx,[cur_tab.Editor.TopLeft.X] ;! edx,[left_col] + @@: cmp edx,[cur_editor.TopLeft.X] ;! edx,[left_col] jge .exit - mov [cur_tab.Editor.TopLeft.X],edx ;! [left_col],edx + mov [cur_editor.TopLeft.X],edx ;! [left_col],edx .exit: call draw_file .exit.2: @@ -341,8 +341,8 @@ func key.ctrl_right ;///// GO TO NEXT WORD /////////////////////////////////// ;----------------------------------------------------------------------------- key.shift_ctrl_right: ;///// GO TO NEXT WORD, WITH SELECTION //////////// ;----------------------------------------------------------------------------- - mov ebx,[cur_tab.Editor.Caret.Y] ;! ebx,[pos.y] - mov edx,[cur_tab.Editor.Caret.X] ;! edx,[pos.x] + mov ebx,[cur_editor.Caret.Y] ;! ebx,[pos.y] + mov edx,[cur_editor.Caret.X] ;! edx,[pos.x] cld .lp1: mov ecx,ebx call get_line_offset @@ -363,7 +363,7 @@ func key.ctrl_right ;///// GO TO NEXT WORD /////////////////////////////////// dec ecx jnz @b .nx1: inc ebx - cmp ebx,[cur_tab.Editor.Lines] ;! ebx,[lines] + cmp ebx,[cur_editor.Lines.Count] ;! ebx,[lines] jge .exit.2 xor edx,edx jmp .lp1 @@ -388,34 +388,34 @@ func key.ctrl_right ;///// GO TO NEXT WORD /////////////////////////////////// dec ecx jnz @b .nx2: inc ebx - cmp ebx,[cur_tab.Editor.Lines] ;! ebx,[lines] + cmp ebx,[cur_editor.Lines.Count] ;! ebx,[lines] jge .exit.2 xor edx,edx jmp .lp2 @@: - mov [cur_tab.Editor.Caret.Y],ebx ;! [pos.y],ebx - mov [cur_tab.Editor.Caret.X],edx ;! [pos.x],edx + mov [cur_editor.Caret.Y],ebx ;! [pos.y],ebx + mov [cur_editor.Caret.X],edx ;! [pos.x],edx test byte[shi+2],0x01 jnz @f - mov [cur_tab.Editor.SelStart.Y],ebx ;! [sel.y],ebx - mov [cur_tab.Editor.SelStart.X],edx ;! [sel.x],edx - @@: sub ebx,[cur_tab.Editor.TopLeft.Y] ;! ebx,[top_line] + mov [cur_editor.SelStart.Y],ebx ;! [sel.y],ebx + mov [cur_editor.SelStart.X],edx ;! [sel.x],edx + @@: sub ebx,[cur_editor.TopLeft.Y] ;! ebx,[top_line] cmp ebx,[lines.scr] jl @f sub ebx,[lines.scr] inc ebx - add [cur_tab.Editor.TopLeft.Y],ebx ;! [top_line],ebx + add [cur_editor.TopLeft.Y],ebx ;! [top_line],ebx @@: 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] jl @f sub eax,[columns.scr] inc eax - add [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax + add [cur_editor.TopLeft.X],eax ;! [left_col],eax jmp .exit - @@: cmp edx,[cur_tab.Editor.TopLeft.X] ;! edx,[left_col] + @@: cmp edx,[cur_editor.TopLeft.X] ;! edx,[left_col] jge .exit - mov [cur_tab.Editor.TopLeft.X],edx ;! [left_col],edx + mov [cur_editor.TopLeft.X],edx ;! [left_col],edx .exit: call draw_file .exit.2: @@ -428,7 +428,7 @@ func key.ctrl_x je @f call key.ctrl_c call key.del - mov [cur_tab.Editor.Modified],1 ;! [modified],1 + mov [cur_editor.Modified],1 ;! [modified],1 @@: ret endf @@ -537,21 +537,21 @@ func key.ctrl_v 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 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 mov ecx,[copy_size] sub ecx,4 - mov edi,[cur_tab.Editor.Data] ;! AREA_TEMP2 + mov edi,[cur_editor.Lines] ;! AREA_TEMP2 add edi,[edi-4] dec edi mov eax,esi mov esi,edi sub esi,ecx 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 lea ecx,[esi+ecx+1] std @@ -567,7 +567,7 @@ func key.ctrl_v mov esi,[copy_buf] ;! AREA_CBUF lodsd - mov ebx,[cur_tab.Editor.Caret.X] ;! ebx,[pos.x] + mov ebx,[cur_editor.Caret.X] ;! ebx,[pos.x] add eax,ebx mov [edi-4],ax sub eax,ebx @@ -590,16 +590,16 @@ func key.ctrl_v mov ecx,eax rep movsb - mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax - mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax + mov [cur_editor.Caret.X],eax ;! [pos.x],eax + mov [cur_editor.SelStart.X],eax ;! [sel.x],eax mov eax,[copy_count] dec eax - add [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax - add [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax - add [cur_tab.Editor.Lines],eax ;! [lines],eax + add [cur_editor.Caret.Y],eax ;! [pos.y],eax + add [cur_editor.SelStart.Y],eax ;! [sel.y],eax + add [cur_editor.Lines.Count],eax ;! [lines],eax call check_inv_all - mov [cur_tab.Editor.Modified],1 ;! [modified],1 + mov [cur_editor.Modified],1 ;! [modified],1 jmp .exit .single_line: @@ -612,16 +612,16 @@ func key.ctrl_v and dword[edi-4],not 0x00020000 or dword[edi-4],0x00010000 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 mov ecx,eax rep movsb - add [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax - add [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax + add [cur_editor.Caret.X],eax ;! [pos.x],eax + add [cur_editor.SelStart.X],eax ;! [sel.x],eax call check_inv_all - mov [cur_tab.Editor.Modified],1 ;! [modified],1 + mov [cur_editor.Modified],1 ;! [modified],1 .exit: ret @@ -629,9 +629,9 @@ func key.ctrl_v .check_columns: push eax movzx eax,word[edi-4] - cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns] + cmp eax,[cur_editor.Columns.Count] ;! eax,[columns] jbe @f - mov [cur_tab.Editor.Columns],eax ;! [columns],eax + mov [cur_editor.Columns.Count],eax ;! [columns],eax @@: pop eax ret ; push eax ebx esi @@ -656,11 +656,11 @@ endf ;----------------------------------------------------------------------------- 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 mov ebx,esi - mov ecx,[cur_tab.Editor.Lines] ;! ecx,[lines] + mov ecx,[cur_editor.Lines.Count] ;! ecx,[lines] call get_line_offset lea edi,[esi+90+4] lea ecx,[esi+4] @@ -679,12 +679,12 @@ func key.ctrl_d ;///// INSERT SEPARATOR ////////////////////////////////////// rep stosb mov byte[ebx+4],';' - inc [cur_tab.Editor.Lines] ;! [lines] - inc [cur_tab.Editor.Caret.Y] ;! [pos.y] - m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y] + inc [cur_editor.Lines.Count] ;! [lines] + inc [cur_editor.Caret.Y] ;! [pos.y] + m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y] call check_inv_all - mov [cur_tab.Editor.Modified],1 ;! [modified],1 + mov [cur_editor.Modified],1 ;! [modified],1 .exit: ret @@ -693,25 +693,25 @@ endf ;----------------------------------------------------------------------------- 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 - cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines] + cmp eax,[cur_editor.Lines.Count] ;! eax,[lines] 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 mov edi,esi lodsd add esi,eax - dec [cur_tab.Editor.Lines] ;! [lines] + dec [cur_editor.Lines.Count] ;! [lines] mov ecx,[temp_buf] ;! AREA_TEMP2 sub ecx,esi shr ecx,2 ;// fixed (was 4) cld rep movsd call check_inv_all - mov [cur_tab.Editor.Modified],1 ;! [modified],1 + mov [cur_editor.Modified],1 ;! [modified],1 .exit: ret @@ -725,11 +725,11 @@ func key.up ;///// GO TO PREVIOUS LINE /////////////////////////////////////// ;----------------------------------------------------------------------------- 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 jns @f 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 jae @f dec ecx @@ -737,7 +737,7 @@ func key.up ;///// GO TO PREVIOUS LINE /////////////////////////////////////// xor ecx,ecx @@: test byte[shi+2],0x01 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 .exit: @@ -753,12 +753,12 @@ func key.down ;///// GO TO NEXT LINE ///////////////////////////////////////// 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 - cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines] + cmp eax,[cur_editor.Lines.Count] ;! eax,[lines] jb @f dec eax - @@: mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line] + @@: mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line] mov edx,eax sub edx,ecx cmp edx,[lines.scr] @@ -766,7 +766,7 @@ func key.down ;///// GO TO NEXT LINE ///////////////////////////////////////// inc ecx @@: test byte[shi+2],0x01 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 .exit: @@ -781,14 +781,14 @@ func key.left ;///// GO TO PREVIOUS CHAR ///////////////////////////////////// ;----------------------------------------------------------------------------- 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 jns @f inc eax @@: test byte[shi+2],0x01 jnz @f - mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax - @@: mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax + mov [cur_editor.SelStart.X],eax ;! [sel.x],eax + @@: mov [cur_editor.Caret.X],eax ;! [pos.x],eax call check_inv_all .exit: @@ -803,15 +803,15 @@ func key.right ;///// GO TO NEXT CHAR //////////////////////////////////////// ;----------------------------------------------------------------------------- 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 - cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns] + cmp eax,[cur_editor.Columns.Count] ;! eax,[columns] jbe @f dec eax @@: test byte[shi+2],0x01 jnz @f - mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax - @@: mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax + mov [cur_editor.SelStart.X],eax ;! [sel.x],eax + @@: mov [cur_editor.Caret.X],eax ;! [pos.x],eax call check_inv_all .exit: @@ -828,8 +828,8 @@ func key.pgup ;///// GO TO PREVIOUS PAGE ///////////////////////////////////// ;----------------------------------------------------------------------------- mov edx,[lines.scr] dec edx - mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] - mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line] + mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] + mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line] sub eax,edx jns @f xor eax,eax @@ -838,7 +838,7 @@ func key.pgup ;///// GO TO PREVIOUS PAGE ///////////////////////////////////// xor ecx,ecx @@: test byte[shi+2],0x01 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 .exit: @@ -855,17 +855,17 @@ func key.pgdn ;///// GO TO NEXT PAGE ///////////////////////////////////////// ;----------------------------------------------------------------------------- mov edx,[lines.scr] dec edx - mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] - mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line] + mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] + mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line] add eax,edx add ecx,edx - cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines] + cmp eax,[cur_editor.Lines.Count] ;! eax,[lines] jb @f - mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] + mov eax,[cur_editor.Lines.Count] ;! eax,[lines] dec eax @@: test byte[shi+2],0x01 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 .exit: @@ -880,10 +880,10 @@ func key.home ;///// GO TO LINE START //////////////////////////////////////// ;----------------------------------------------------------------------------- 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 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 .exit: @@ -898,13 +898,13 @@ func key.end ;///// GO TO LINE END /////////////////////////////////////////// ;----------------------------------------------------------------------------- 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_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 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 .exit: @@ -919,11 +919,11 @@ func key.ctrl_home ;///// GO TO PAGE START /////////////////////////////////// ;----------------------------------------------------------------------------- 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 test byte[shi+2],0x01 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 .exit: @@ -938,16 +938,16 @@ func key.ctrl_end ;///// GO TO PAGE END ////////////////////////////////////// ;----------------------------------------------------------------------------- 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] - cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines] + cmp eax,[cur_editor.Lines.Count] ;! eax,[lines] jle @f - mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] + mov eax,[cur_editor.Lines.Count] ;! eax,[lines] @@: add eax,ecx dec eax test byte[shi+2],0x01 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 .exit: @@ -963,11 +963,11 @@ func key.ctrl_pgup ;///// GO TO DOCUMENT START /////////////////////////////// key.shift_ctrl_pgup: ;///// GO TO DOCUMENT START, WITH SELECTION //////// ;----------------------------------------------------------------------------- xor eax,eax - mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax - mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax + mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax + mov [cur_editor.Caret.Y],eax ;! [pos.y],eax test byte[shi+2],0x01 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 .exit: @@ -982,16 +982,16 @@ func key.ctrl_pgdn ;///// GO TO DOCUMENT END ///////////////////////////////// ;----------------------------------------------------------------------------- key.shift_ctrl_pgdn: ;///// GO TO DOCUMENT END, WITH SELECTION ////////// ;----------------------------------------------------------------------------- - mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] ; eax = lines in the file - mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax + mov eax,[cur_editor.Lines.Count] ;! eax,[lines] ; eax = lines in the file + mov [cur_editor.Caret.Y],eax ;! [pos.y],eax sub eax,[lines.scr] ; eax -= lines on the screen jns @f xor eax,eax - @@: mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax - dec [cur_tab.Editor.Caret.Y] ;! [pos.y] + @@: mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax + dec [cur_editor.Caret.Y] ;! [pos.y] test byte[shi+2],0x01 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] ;! pop [sel.y] @@: call check_inv_all.skip_check @@ -1006,7 +1006,7 @@ func key.del ;///// DELETE NEXT CHAR OR SELECTION //////////////////////////// call delete_selection 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 and dword[esi],not 0x00020000 or dword[esi],0x00010000 @@ -1017,7 +1017,7 @@ func key.del ;///// DELETE NEXT CHAR OR SELECTION //////////////////////////// or eax,eax 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 jae .line_up lea edi,[ebx+ecx] @@ -1028,7 +1028,7 @@ func key.del ;///// DELETE NEXT CHAR OR SELECTION //////////////////////////// je .line_up 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 lea esi,[edi+1] neg ecx @@ -1038,23 +1038,23 @@ func key.del ;///// DELETE NEXT CHAR OR SELECTION //////////////////////////// rep movsb mov byte[edi],' ' - m2m [cur_tab.Editor.SelStart.X],[cur_tab.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.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x] + m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y] call check_inv_all - mov [cur_tab.Editor.Modified],1 ;! [modified],1 + mov [cur_editor.Modified],1 ;! [modified],1 ret .line_up: - mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] + mov eax,[cur_editor.Lines.Count] ;! eax,[lines] dec eax - cmp eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] + cmp eax,[cur_editor.Caret.Y] ;! eax,[pos.y] je .exit mov edi,[temp_buf] ;! AREA_TEMP+4 add edi,4 mov esi,ebx - mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x] + mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x] 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],ecx ;! [AREA_TEMP],ecx cmp cx,[ebp] @@ -1078,12 +1078,12 @@ func key.del ;///// DELETE NEXT CHAR OR SELECTION //////////////////////////// mov esi,[temp_buf] ;! AREA_TEMP call get_real_length - cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns] + cmp eax,[cur_editor.Columns.Count] ;! eax,[columns] jbe @f - mov [cur_tab.Editor.Columns],eax ;! [columns],eax + mov [cur_editor.Columns.Count],eax ;! [columns],eax @@: push ecx - mov edi,[cur_tab.Editor.Data] ;! AREA_TEMP2 + mov edi,[cur_editor.Lines] ;! AREA_TEMP2 add edi,[edi-4] dec edi lea esi,[edi+8] @@ -1108,7 +1108,7 @@ func key.del ;///// DELETE NEXT CHAR OR SELECTION //////////////////////////// add esi,eax;[esi-8] movzx eax,word[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] sub ecx,esi cld @@ -1120,16 +1120,16 @@ func key.del ;///// DELETE NEXT CHAR OR SELECTION //////////////////////////// rep movsb .ok.dec.lines: - dec [cur_tab.Editor.Lines] ;! [lines] - mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] - cmp [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax + dec [cur_editor.Lines.Count] ;! [lines] + mov eax,[cur_editor.Lines.Count] ;! eax,[lines] + cmp [cur_editor.Caret.Y],eax ;! [pos.y],eax jb @f dec eax - mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax - @@: m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x] - m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y] + mov [cur_editor.Caret.Y],eax ;! [pos.y],eax + @@: m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x] + 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: call check_inv_all @@ -1152,23 +1152,23 @@ func key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION //////////////////// call delete_selection 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 js .line_up - dec [cur_tab.Editor.Caret.X] ;! [pos.x] - mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y] + dec [cur_editor.Caret.X] ;! [pos.x] + mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y] call get_line_offset and dword[esi],not 0x00020000 or dword[esi],0x00010000 mov ebx,eax 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 - 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 - mov [cur_tab.Editor.Modified],1 ;! [modified],1 + mov [cur_editor.Modified],1 ;! [modified],1 ret @@: lea edi,[esi+4+ebx] @@ -1182,17 +1182,17 @@ func key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION //////////////////// rep movsb mov byte[edi],' ' - m2m [cur_tab.Editor.SelStart.X],[cur_tab.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.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x] + m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y] call check_inv_str - mov [cur_tab.Editor.Modified],1 ;! [modified],1 + mov [cur_editor.Modified],1 ;! [modified],1 ret .line_up: - cmp [cur_tab.Editor.Caret.Y],0 ;! [pos.y],0 + cmp [cur_editor.Caret.Y],0 ;! [pos.y],0 jne @f ret - @@: mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y] + @@: mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y] dec ecx call get_line_offset and dword[esi],not 0x00020000 @@ -1205,8 +1205,8 @@ func key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION //////////////////// jne @f dec ecx jg @b - @@: mov [cur_tab.Editor.Caret.X],ecx ;! [pos.x],ecx - dec [cur_tab.Editor.Caret.Y] ;! [pos.y] + @@: mov [cur_editor.Caret.X],ecx ;! [pos.x],ecx + dec [cur_editor.Caret.Y] ;! [pos.y] cld jmp key.del.line_up endf @@ -1215,7 +1215,7 @@ endf func key.tab ;///// TABULATE ///////////////////////////////////////////////// ;----------------------------------------------------------------------------- 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 add eax,ATABW @@ -1223,7 +1223,7 @@ func key.tab ;///// TABULATE ///////////////////////////////////////////////// push eax ' ' sub eax,ecx .direct: - mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y] + mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y] call get_line_offset and dword[esi],not 0x00020000 or dword[esi],0x00010000 @@ -1231,15 +1231,15 @@ func key.tab ;///// TABULATE ///////////////////////////////////////////////// xchg eax,ecx 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 - mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] + mov eax,[cur_editor.Caret.X] ;! eax,[pos.x] @@: movzx edx,word[esi] sub edx,eax cmp ecx,edx jl @f 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] dec ecx mov edi,ecx ;! AREA_TEMP2 @@ -1268,26 +1268,26 @@ func key.tab ;///// TABULATE ///////////////////////////////////////////////// sub esi,ecx lea ecx,[esi+1] sub ecx,ebx - sub ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x] + sub ecx,[cur_editor.Caret.X] ;! ecx,[pos.x] std rep movsb .ok: pop ecx ;******* pop eax rep stosb cld - pop [cur_tab.Editor.Caret.X] ;! [pos.x] + pop [cur_editor.Caret.X] ;! [pos.x] lea esi,[ebx-4] 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 - mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] - @@: cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns] + mov eax,[cur_editor.Caret.X] ;! eax,[pos.x] + @@: cmp eax,[cur_editor.Columns.Count] ;! eax,[columns] jbe @f - mov [cur_tab.Editor.Columns],eax ;! [columns],eax - @@: m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x] - m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y] + mov [cur_editor.Columns.Count],eax ;! [columns],eax + @@: m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x] + m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y] call check_inv_all - mov [cur_tab.Editor.Modified],1 ;! [modified],1 + mov [cur_editor.Modified],1 ;! [modified],1 .exit: ret @@ -1298,10 +1298,10 @@ func key.return ;///// CARRIAGE RETURN /////////////////////////////////////// ;----------------------------------------------------------------------------- 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 - mov ebx,[cur_tab.Editor.Caret.X] ;! ebx,[pos.x] + mov ebx,[cur_editor.Caret.X] ;! ebx,[pos.x] cmp bx,[esi] jb @f movzx ebx,word[esi] @@ -1362,7 +1362,7 @@ func key.return ;///// CARRIAGE RETURN /////////////////////////////////////// .lp2: xor eax,eax @@: mov edx,edi add edi,4 - mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax + mov [cur_editor.Caret.X],eax ;! [pos.x],eax jecxz @f push ecx mov ecx,eax @@ -1384,7 +1384,7 @@ func key.return ;///// CARRIAGE RETURN /////////////////////////////////////// sub ecx,[temp_buf] push ecx - mov edi,[cur_tab.Editor.Data] ;! AREA_TEMP2 + mov edi,[cur_editor.Lines] ;! AREA_TEMP2 add edi,[edi-4] dec edi lea esi,[edi+4] @@ -1402,7 +1402,7 @@ func key.return ;///// CARRIAGE RETURN /////////////////////////////////////// lea edi,[esi+eax-4] movzx ecx,word[ebp] add esi,ecx;[ebp] - mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2 + mov ecx,[cur_editor.Lines] ;! AREA_TEMP2 add ecx,[ecx-4] sub ecx,esi cld @@ -1413,14 +1413,14 @@ func key.return ;///// CARRIAGE RETURN /////////////////////////////////////// cld rep movsb - inc [cur_tab.Editor.Caret.Y] ;! [pos.y] - inc [cur_tab.Editor.SelStart.Y] ;! [sel.y] - inc [cur_tab.Editor.Lines] ;! [lines] + inc [cur_editor.Caret.Y] ;! [pos.y] + inc [cur_editor.SelStart.Y] ;! [sel.y] + 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 - mov [cur_tab.Editor.Modified],1 ;! [modified],1 + mov [cur_editor.Modified],1 ;! [modified],1 .exit: ret @@ -1444,6 +1444,7 @@ func key.ctrl_tab ;///// SWITCH TO NEXT TAB ////////////////////////////////// jb @f mov ebp,[tab_bar.Items] @@: call set_cur_tab + call make_tab_visible call align_editor_in_tab call draw_editor call draw_tabctl @@ -1470,9 +1471,21 @@ func key.shift_ctrl_tab ;///// SWITCH TO PREVIOUS TAB //////////////////////// add eax,[tab_bar.Items] lea ebp,[eax-sizeof.TABITEM] @@: call set_cur_tab + call make_tab_visible call align_editor_in_tab call draw_editor call draw_tabctl .exit: ret 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 diff --git a/programs/develop/tinypad/trunk/tp-locale.inc b/programs/develop/tinypad/trunk/tp-locale.inc index 7f87b8f9c9..b37b8d98ce 100644 --- a/programs/develop/tinypad/trunk/tp-locale.inc +++ b/programs/develop/tinypad/trunk/tp-locale.inc @@ -2,17 +2,17 @@ sz htext,'TINYPAD ',APP_VERSION menubar_res main_menu,\ - ru,'Файл' ,mm.File ,onshow.file ,\ - ru,'Правка' ,mm.Edit ,onshow.edit ,\ - ru,'Поиск' ,mm.Search ,onshow.search ,\ - ru,'Запуск' ,mm.Run ,onshow.run ,\ + ru,'Файл' ,mm.File ,onshow.file ,\ + ru,'Правка' ,mm.Edit ,onshow.edit ,\ + ru,'Поиск' ,mm.Search ,onshow.search ,\ + ru,'Запуск' ,mm.Run ,onshow.run ,\ ru,'Кодировка',mm.Encoding,onshow.recode ,\ - ru,'Опции' ,mm.Options ,onshow.options,\ + ru,'Опции' ,mm.Options ,onshow.options,\ \ en,'File' ,mm.File ,onshow.file ,\ en,'Edit' ,mm.Edit ,onshow.edit ,\ 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,'Options' ,mm.Options ,onshow.options @@ -22,13 +22,17 @@ popup_res mm.File,\ ru,'Сохранить' ,'Ctrl+S' ,Save ,\ ru,'Сохранить как...','Ctrl+Shift+S',SaveAs,\ ru,'-' ,'' , ,\ + ru,'Закрыть' ,'Ctrl+F4' ,Close ,\ + ru,'-' ,'' , ,\ ru,'Выход' ,'Alt+X' ,Exit ,\ \ - en,'New' ,'Ctrl+N' ,New ,\ + en,'New' ,'Ctrl+N' ,New ,\ en,'Open...' ,'Ctrl+O' ,Open ,\ en,'Save' ,'Ctrl+S' ,Save ,\ en,'Save as...','Ctrl+Shift+S',SaveAs,\ en,'-' ,'' , ,\ + en,'Close' ,'Ctrl+F4' ,Close ,\ + en,'-' ,'' , ,\ en,'Exit' ,'Alt+X' ,Exit popup_res mm.Edit,\ @@ -36,71 +40,71 @@ popup_res mm.Edit,\ ru,'Копировать' ,'Ctrl+C',Copy ,\ ru,'Вставить' ,'Ctrl+V',Insert,\ ru,'Удалить' ,'' ,Delete,\ - ru,'-' ,'' , ,\ + ru,'-' ,'' , ,\ ru,'Выделить всё','Ctrl+A',SelAll,\ \ - en,'Cut' ,'Ctrl+X',Cut ,\ + en,'Cut' ,'Ctrl+X',Cut ,\ en,'Copy' ,'Ctrl+C',Copy ,\ en,'Paste' ,'Ctrl+V',Insert,\ en,'Delete' ,'' ,Delete,\ - en,'-' ,'' , ,\ + en,'-' ,'' , ,\ en,'Select all','Ctrl+A',SelAll popup_res mm.Search,\ ru,'Перейти...' ,'Ctrl+G',Position,\ - ru,'-' ,'' , ,\ + ru,'-' ,'' , ,\ ru,'Найти...' ,'Ctrl+F',Find ,\ ru,'Найти далее','F3' ,FindNext,\ ru,'Заменить...','Ctrl+H',Replace ,\ \ en,'Position...','Ctrl+G',Position,\ - en,'-' ,'' , ,\ + en,'-' ,'' , ,\ en,'Find...' ,'Ctrl+F',Find ,\ en,'Find next' ,'F3' ,FindNext,\ en,'Replace...' ,'Ctrl+H',Replace popup_res mm.Run,\ - ru,'Запустить' ,'F9' ,Run ,\ + ru,'Запустить' ,'F9' ,Run ,\ ru,'Компилировать' ,'Ctrl+F9',Compile ,\ - ru,'-' ,'' , ,\ + ru,'-' ,'' , ,\ ru,'Доска отладки' ,'' ,DbgBoard,\ ru,'Системные функции','' ,SysFuncs,\ \ - en,'Run' ,'F9' ,Run ,\ + en,'Run' ,'F9' ,Run ,\ en,'Compile' ,'Ctrl+F9',Compile ,\ - en,'-' ,'' , ,\ + en,'-' ,'' , ,\ en,'Debug board' ,'' ,DbgBoard,\ en,'System functions' ,'' ,SysFuncs popup_res mm.Encoding,\ - @!,'CP866 -> CP1251','',CP866.CP1251,\ - @!,'CP1251 -> CP866' ,'',CP1251.CP866,\ - @!,'-' ,'', ,\ - @!,'CP866 -> KOI8-R','',CP866.KOI8R ,\ - @!,'KOI8-R -> CP866' ,'',KOI8R.CP866 ,\ - @!,'-' ,'', ,\ - @!,'CP1251 -> KOI8-R','',CP1251.KOI8R,\ - @!,'KOI8-R -> CP1251','',KOI8R.CP1251 + @!,<'CP866 ',0x1A,' CP1251'>,'',CP866.CP1251,\ + @!,<'CP1251 ',0x1A,' CP866' >,'',CP1251.CP866,\ + @!,<'-' >,'', ,\ + @!,<'CP866 ',0x1A,' KOI8-R'>,'',CP866.KOI8R ,\ + @!,<'KOI8-R ',0x1A,' CP866' >,'',KOI8R.CP866 ,\ + @!,<'-' >,'', ,\ + @!,<'CP1251 ',0x1A,' KOI8-R'>,'',CP1251.KOI8R,\ + @!,<'KOI8-R ',0x1A,' CP1251'>,'',KOI8R.CP1251 popup_res mm.Options,\ ru,'Внешний вид...' ,'',Appearance ,\ - ru,'-' ,'', ,\ + ru,'-' ,'', ,\ ru,'Безопасное выделение' ,'',SecureSel ,\ ru,'Автоматические скобки' ,'',AutoBrackets,\ ru,'Автоматический отступ' ,'',AutoIndents ,\ ru,'Умная табуляция' ,'',SmartTabs ,\ ru,'Оптимальное сохранение','',OptimalFill ,\ - ru,'-' ,'', ,\ + ru,'-' ,'', ,\ ru,'Номера строк' ,'',LineNumbers ,\ \ en,'Appearance...' ,'',Appearance ,\ - en,'-' ,'', ,\ + en,'-' ,'', ,\ en,'Secure selection' ,'',SecureSel ,\ en,'Automatic brackets' ,'',AutoBrackets,\ en,'Automatic indents' ,'',AutoIndents ,\ en,'Smart tabulation' ,'',SmartTabs ,\ en,'Optimal fill on saving','',OptimalFill ,\ - en,'-' ,'', ,\ + en,'-' ,'', ,\ en,'Line numbers' ,'',LineNumbers lsz s_modified,\ diff --git a/programs/develop/tinypad/trunk/tp-mouse.asm b/programs/develop/tinypad/trunk/tp-mouse.asm index 1372b9600a..6e83ceb474 100644 --- a/programs/develop/tinypad/trunk/tp-mouse.asm +++ b/programs/develop/tinypad/trunk/tp-mouse.asm @@ -157,31 +157,31 @@ mouse: cdq;xor edx,edx mov ecx,LINEH idiv ecx - @@: add eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] + @@: add eax,[cur_editor.TopLeft.Y] ;! eax,[top_line] mov ebx,eax pop eax cdq;xor edx,edx mov ecx,6 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 - mov eax,[cur_tab.Editor.Columns] ;! eax,[columns] - @@: cmp ebx,[cur_tab.Editor.Lines] ;! ebx,[lines] + mov eax,[cur_editor.Columns.Count] ;! eax,[columns] + @@: cmp ebx,[cur_editor.Lines.Count] ;! ebx,[lines] jl @f - mov ebx,[cur_tab.Editor.Lines] ;! ebx,[lines] + mov ebx,[cur_editor.Lines.Count] ;! ebx,[lines] 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 - cmp [cur_tab.Editor.Caret.Y],ebx ;! [pos.y],ebx + cmp [cur_editor.Caret.Y],ebx ;! [pos.y],ebx je still.skip_write .change_cur_pos: - mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax - mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] - mov [cur_tab.Editor.Caret.Y],ebx ;! [pos.y],ebx + mov [cur_editor.Caret.X],eax ;! [pos.x],eax + mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] + mov [cur_editor.Caret.Y],ebx ;! [pos.y],ebx call check_cur_vis_inv jc .check_ldown ; cmp eax,ebx @@ -213,20 +213,20 @@ mouse: ; sub ebx,[__rc+0x4] cmp [vscrl_capt],0 jge .vcaptured - mov eax,[cur_tab.Editor.VScroll.Top] ;! eax,[vscrl_top] + mov eax,[cur_editor.VScroll.Top] ;! eax,[vscrl_top] cmp ebx,eax 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 jae .center_vcapture mov eax,ebx - sub eax,[cur_tab.Editor.VScroll.Top] ;! eax,[vscrl_top] + sub eax,[cur_editor.VScroll.Top] ;! eax,[vscrl_top] dec eax mov [vscrl_capt],eax dec ebx jmp .vcaptured .center_vcapture: - mov eax,[cur_tab.Editor.VScroll.Size] ;! eax,[vscrl_size] + mov eax,[cur_editor.VScroll.Size] ;! eax,[vscrl_size] shr eax,1 mov [vscrl_capt],eax .vcaptured: @@ -236,24 +236,24 @@ mouse: @@: mov [mouse_captured],1 mov eax,[bot_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 cmp eax,ebx jge @f mov ebx,eax @@: - mov [cur_tab.Editor.VScroll.Top],ebx ;! [vscrl_top],ebx - mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] + mov [cur_editor.VScroll.Top],ebx ;! [vscrl_top],ebx + mov eax,[cur_editor.Lines.Count] ;! eax,[lines] sub eax,[lines.scr] imul ebx mov ebx,[bot_ofs] sub ebx,[top_ofs] 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 - cmp eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] + cmp eax,[cur_editor.TopLeft.Y] ;! eax,[top_line] 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 draw_file jmp still.skip_write @@ -274,20 +274,20 @@ mouse: ; sub ebx,[__rc+0x0] cmp [hscrl_capt],0 jge .hcaptured - mov eax,[cur_tab.Editor.HScroll.Top] ;! eax,[hscrl_top] + mov eax,[cur_editor.HScroll.Top] ;! eax,[hscrl_top] cmp ebx,eax 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 jge .center_hcapture mov eax,ebx - sub eax,[cur_tab.Editor.HScroll.Top] ;! eax,[hscrl_top] + sub eax,[cur_editor.HScroll.Top] ;! eax,[hscrl_top] dec eax mov [hscrl_capt],eax dec ebx jmp .hcaptured .center_hcapture: - mov eax,[cur_tab.Editor.HScroll.Size] ;! eax,[hscrl_size] + mov eax,[cur_editor.HScroll.Size] ;! eax,[hscrl_size] shr eax,1 mov [hscrl_capt],eax .hcaptured: @@ -296,23 +296,23 @@ mouse: xor ebx,ebx @@: mov [mouse_captured],1 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 cmp eax,ebx jge @f mov ebx,eax @@: - mov [cur_tab.Editor.HScroll.Top],ebx ;! [hscrl_top],ebx - mov eax,[cur_tab.Editor.Columns] ;! eax,[columns] + mov [cur_editor.HScroll.Top],ebx ;! [hscrl_top],ebx + mov eax,[cur_editor.Columns.Count] ;! eax,[columns] sub eax,[columns.scr] imul ebx mov ebx,[p_info.box.width] 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 - cmp eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] + cmp eax,[cur_editor.TopLeft.X] ;! eax,[left_col] 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 draw_file jmp still.skip_write @@ -347,78 +347,3 @@ mouse: mov [mouse_captured],0 mov [just_from_popup],0 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 \ No newline at end of file diff --git a/programs/develop/tinypad/trunk/tp-popup.asm b/programs/develop/tinypad/trunk/tp-popup.asm index 307cbb4e43..4fe3c6652c 100644 --- a/programs/develop/tinypad/trunk/tp-popup.asm +++ b/programs/develop/tinypad/trunk/tp-popup.asm @@ -2,88 +2,6 @@ POP_IHEIGHT = 16 ;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: mov [popup_active],1 mov [pi_cur],0 @@ -315,6 +233,79 @@ func draw_popup_wnd ret 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_cur dd ? p_pos dd ? diff --git a/programs/develop/tinypad/trunk/tp-recode.asm b/programs/develop/tinypad/trunk/tp-recode.asm index 1dde7fc81b..7c765fce98 100644 --- a/programs/develop/tinypad/trunk/tp-recode.asm +++ b/programs/develop/tinypad/trunk/tp-recode.asm @@ -19,8 +19,8 @@ recode: mov edi,table.koi.1251 .main: - mov ecx,[cur_tab.Editor.Lines] ;! ecx,[lines] - mov esi,[cur_tab.Editor.Data] ;! AREA_EDIT + mov ecx,[cur_editor.Lines.Count] ;! ecx,[lines] + mov esi,[cur_editor.Lines] ;! AREA_EDIT jecxz .exit xor eax,eax .lp0: dec ecx diff --git a/programs/develop/tinypad/trunk/tp-tabctl.asm b/programs/develop/tinypad/trunk/tp-tabctl.asm index e808d2b69f..e2e93573b8 100644 --- a/programs/develop/tinypad/trunk/tp-tabctl.asm +++ b/programs/develop/tinypad/trunk/tp-tabctl.asm @@ -2,7 +2,7 @@ sz s_defname,'Untitled',0 ;----------------------------------------------------------------------------- -func flush_cur_tab ;////////////////////////////////////////////////////////// +func flush_cur_tab ;///// SAVE CURRENT TAB DATA TO CONTROL /////////////////// ;----------------------------------------------------------------------------- ; EBP = TABITEM* ;----------------------------------------------------------------------------- @@ -17,7 +17,7 @@ func flush_cur_tab ;////////////////////////////////////////////////////////// endf ;----------------------------------------------------------------------------- -func set_cur_tab ;//////////////////////////////////////////////////////////// +func set_cur_tab ;///// SET SPECIFIED TAB CURRENT (FOCUS IT) ///////////////// ;----------------------------------------------------------------------------- ; EBP = TABITEM* ;----------------------------------------------------------------------------- @@ -36,7 +36,43 @@ func set_cur_tab ;//////////////////////////////////////////////////////////// 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 @@ -50,20 +86,21 @@ func create_tab ;///////////////////////////////////////////////////////////// sub [tab_bar.Current.Ptr],ecx lea ebp,[eax+ebx-sizeof.TABITEM] call set_cur_tab + call make_tab_visible mov eax,1024 call mem.Alloc - mov [cur_tab.Editor.Data],eax - mov [cur_tab.Editor.Lines],1 - mov [cur_tab.Editor.Columns],1 + mov [cur_editor.Lines],eax + mov [cur_editor.Lines.Count],1 + mov [cur_editor.Columns.Count],1 xor eax,eax - mov [cur_tab.Editor.TopLeft.X],eax - mov [cur_tab.Editor.TopLeft.Y],eax - mov [cur_tab.Editor.Caret.X],eax - mov [cur_tab.Editor.Caret.Y],eax - mov [cur_tab.Editor.SelStart.X],eax - mov [cur_tab.Editor.SelStart.Y],eax - mov edi,[cur_tab.Editor.Data] + mov [cur_editor.TopLeft.X],eax + mov [cur_editor.TopLeft.Y],eax + mov [cur_editor.Caret.X],eax + mov [cur_editor.Caret.Y],eax + mov [cur_editor.SelStart.X],eax + mov [cur_editor.SelStart.Y],eax + mov edi,[cur_editor.Lines] add edi,4 mov ecx,10 mov [edi-4],ecx @@ -73,14 +110,14 @@ func create_tab ;///////////////////////////////////////////////////////////// rep stosb mov esi,s_defname - mov edi,cur_tab.Editor.FilePath + mov edi,cur_editor.FilePath mov ecx,s_defname.size rep movsb - mov [cur_tab.Editor.FileName],0 + mov [cur_editor.FileName],0 mov [f_info.length],0 - mov [cur_tab.Editor.Modified],0 - mov [cur_tab.Editor.AsmMode],0 + mov [cur_editor.Modified],0 + mov [cur_editor.AsmMode],0 call flush_cur_tab call update_caption @@ -92,35 +129,81 @@ func create_tab ;///////////////////////////////////////////////////////////// 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 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 -;----------------------------------------------------------------------------- -func draw_tabctl ;//////////////////////////////////////////////////////////// -;----------------------------------------------------------------------------- + dec [tab_bar.Items.Left] + js .lp1 + @@: call get_hidden_tabitems_number + or eax,eax + jnz .lp1 + dec [tab_bar.Items.Left] + jns @b + .lp1: inc [tab_bar.Items.Left] + mov eax,[tab_bar.Items.Count] + cmp [tab_bar.Items.Left],eax + jb @f + dec eax + mov [tab_bar.Items.Left],eax + @@: + + mov eax,8 + mov edx,[tab_bar.Buttons.First] + @@: cmp edx,[tab_bar.Buttons.Last] + ja @f + push edx + or edx,0x80000000 + mcall + pop edx + inc edx + jmp @b + @@: mov ebx,[tab_bar.Bounds.Left-2] mov bx,word[tab_bar.Bounds.Right] @@ -150,9 +233,18 @@ func draw_tabctl ;//////////////////////////////////////////////////////////// xor cx,cx add ecx,1*65536+TBARH 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] 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 .tabs_on_bottom: @@ -163,19 +255,86 @@ func draw_tabctl ;//////////////////////////////////////////////////////////// mcall 13 mov cx,1 mcall ,,,[sc.work] - add ecx,-1*65536+2;-(TBARH-3) + add ecx,-1*65536+2 mov edx,[cl_3d_inset] call draw_framerect - mov ecx,[tab_bar.Items.Count] - mov ebp,[tab_bar.Items] mov esi,[tab_bar.Bounds.Left] inc esi mov edi,[tab_bar.Bounds.Bottom] 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 call get_tab_size + + call dword[esp+(8+4)+4] + jc .draw_tabs.dontfit + rol ebx,16 mov bx,si rol ebx,16 @@ -185,15 +344,17 @@ func draw_tabctl ;//////////////////////////////////////////////////////////// mov edx,[cl_3d_inset] call draw_framerect + mov edx,[sc.work_text] cmp ebp,[tab_bar.Current.Ptr] - jne .lp1 + jne .draw_tabs.inactive push ebx ecx - add ebx,1*65536-2 - dec ecx + call dword[esp+(8+4)+8+8] mcall 13,,,[sc.work] pop ecx ebx - .lp1: - pushad + mov edx,[color_tbl+4*0] + .draw_tabs.inactive: + + push ebx ecx esi edx lea eax,[ebp+TABITEM.Editor.FilePath] add eax,[ebp+TABITEM.Editor.FileName] mov edx,eax @@ -202,66 +363,287 @@ func draw_tabctl ;//////////////////////////////////////////////////////////// shr ecx,16 mov bx,cx add ebx,0x00050005 - mcall 4,,0x00000000 - popad + pop ecx + mcall 4 + pop esi ecx ebx - movzx ebx,bx - lea esi,[esi+ebx+1] + inc [tab_bar.Buttons.Last] + cmp ebp,[tab_bar.Current.Ptr] + je .draw_tabs.active + push ebx ecx + dec ebx + dec ecx + mov edx,[tab_bar.Buttons.Last] + or edx,0x40000000 + mcall 8 + pop ecx ebx + .draw_tabs.active: + + call dword[esp+(8+4)+0] add ebp,sizeof.TABITEM pop ecx dec ecx + dec dword[esp] 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 - .tabs_on_left: - call get_max_tab_width - mov ebx,[tab_bar.Bounds.Left-2] - mov bx,ax - add ebx,1*65536 + .scroll_on_top: + add ebx,(-SCRLW*2-1)*65536+SCRLW + mov ecx,[tab_bar.Bounds.Top] + shl ecx,16 + add ecx,1*65536+SCRLW + jmp .draw_tabs.draw_scroll + .scroll_on_bottom: + add ebx,(-SCRLW*2-1)*65536+SCRLW + jmp .draw_tabs.draw_scroll + .scroll_on_left: + mov ebx,[tab_bar.Bounds.Left] + add ebx,edx + shl ebx,16 + add ebx,(-SCRLW*2)*65536+SCRLW + jmp .draw_tabs.draw_scroll + .scroll_on_right: + shl edx,16 + sub ebx,edx + add ebx,SCRLW + + .draw_tabs.draw_scroll: + mcall 8,,,'TBG' or 0x40000000 + push ebx + add ebx,SCRLW*65536 + mcall 8,,,'TBL' or 0x40000000 + pop ebx + push ebx ecx + sar ebx,16 + sar ecx,16 + push ebx ecx SCRLW SCRLW + call draw_3d_panel + add ebx,SCRLW + push ebx ecx SCRLW SCRLW + call draw_3d_panel + pop ecx ebx + + push '<' + shr ecx,16 + mov bx,cx + add ebx,(SCRLW/2-2)*65536+SCRLW/2-3 + mcall 4,,[sc.work_text],esp,1 + add ebx,0x00020000 + mcall + add ebx,(SCRLW-2)*65536 + mov byte[esp],'>' + mcall + add ebx,0x00020000 + mcall + add esp,4 + + ret 8 + + .curr_left: + add ebx,0x00010000 add ecx,1*65536-2 + ret + .curr_top: + add ebx,1*65536-2 + add ecx,0x00010000 + ret + .curr_right: + dec ebx + 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 - 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 - add eax,-2 - shl eax,16 - add ebx,eax - mov bx,3 - mov edx,[cl_3d_inset] - call draw_framerect + ret +endf + +;----------------------------------------------------------------------------- +func get_max_tab_width ;///// GET WIDTH OF LONGEST TAB /////////////////////// +;----------------------------------------------------------------------------- + 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 - .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 - 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,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] + lea ebx,[eax+1] mov al,[tab_bar.Style] dec al @@ -275,20 +657,18 @@ func align_editor_in_tab ret .tabs_on_top: - add [cur_tab.Editor.Bounds.Top],TBARH + add [cur_editor.Bounds.Top],TBARH ret .tabs_on_bottom: - sub [cur_tab.Editor.Bounds.Bottom],TBARH + sub [cur_editor.Bounds.Bottom],TBARH ret .tabs_on_left: - call get_max_tab_width - add [cur_tab.Editor.Bounds.Left],eax + add [cur_editor.Bounds.Left],ebx ret .tabs_on_right: - call get_max_tab_width - sub [cur_tab.Editor.Bounds.Right],eax + sub [cur_editor.Bounds.Right],ebx ret -endf \ No newline at end of file +endf