From c6080c59e94d82af10f0339f26a30f28eb1124cf Mon Sep 17 00:00:00 2001 From: "Mihail Semenyako (mike.dld)" Date: Thu, 18 Jan 2007 21:14:15 +0000 Subject: [PATCH] Tinypad 4.0.4 in progress (further fixing) git-svn-id: svn://kolibrios.org@280 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/tinypad/trunk/tinypad.asm | 122 ++++++++++--------- programs/develop/tinypad/trunk/tinypad.inc | 2 + programs/develop/tinypad/trunk/tp-common.asm | 55 +++++++-- programs/develop/tinypad/trunk/tp-draw.asm | 65 ++++++---- programs/develop/tinypad/trunk/tp-editor.asm | 100 ++++++++++----- programs/develop/tinypad/trunk/tp-files.asm | 59 ++++++--- programs/develop/tinypad/trunk/tp-key.asm | 80 +++++++++++- programs/develop/tinypad/trunk/tp-mouse.asm | 62 ++++++---- programs/develop/tinypad/trunk/tp-popup.asm | 19 +-- programs/develop/tinypad/trunk/tp-tabctl.asm | 90 +++++++++++--- 10 files changed, 457 insertions(+), 197 deletions(-) diff --git a/programs/develop/tinypad/trunk/tinypad.asm b/programs/develop/tinypad/trunk/tinypad.asm index 5d237d1278..e5237c9a1d 100644 --- a/programs/develop/tinypad/trunk/tinypad.asm +++ b/programs/develop/tinypad/trunk/tinypad.asm @@ -3,8 +3,8 @@ ; 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-07 (Jan 7, 2007) -; minimal kernel: revision #138 (svn://kolibrios.org/kernel) +; last update: 2007-01-18 (Jan 18, 2007) +; minimal kernel: revision #270 (svn://kolibrios.org/kernel) ;----------------------------------------------------------------------------- ; originally by: Ville Michael Turjanmaa >> villemt@aton.co.jyu.fi ; maintained by: Mike Semenyako >> mike.dld@gmail.com @@ -17,23 +17,23 @@ ; - 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 (some bug with tab switching) [critical] -; - add memory reallocation to keys handler [critical] -; - rework save_file (memory manager) [critical] -; - 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] +; TODO (4.0.4, PLANNED FOR 2007-01-21): +; normal: +; - finish tabbed interface (tab switching, Ctrl+F4) +; - reduce flickering (introduce changes checker) +; - compile default file if selected +; low: +; - add prompt to save file before closing/opening ; ; HISTORY: ; 4.0.4 pre (mike.dld) ; bug-fixes: ; - statusbar contained hint after dialog operation cancelled ; - small drawing fix for gutter and line saved/modified markers +; - incorrect lines marking on Ctrl+V ; changes: -; - editor and other modifications to ease parts placement changing +; - editor and other modifications to ease parts placement changing, +; including changes in look ; - 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 @@ -43,7 +43,8 @@ ; 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) +; (thanks IRC guys for ideas and testing +; - make any tab default to compile it disregarding currently active tab ; 4.0.3 (mike.dld) ; bug-fixes: ; - 1-char selection if pressing out of real line length @@ -163,18 +164,21 @@ header '01',1,@CODE,TINYPAD_END,STATIC_MEM_END,MAIN_STACK,@PARAMS,self_path APP_VERSION equ '4.0.4 pre' ;include 'debug.inc' +;define __DEBUG__ 1 +;define __DEBUG_LEVEL__ 1 +;include 'debug-fdo.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 = 19 ; menu bar height (pixels) +SCRLW = 16 ; scrollbar widht/height (pixels) +ATABW = 8 ; tab key indent 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 (pixels) -STATH = 16 ; status bar height -TBARH = 18 ; tab bar height +STATH = 16 ; status bar height (pixels) +TBARH = 18 ; tab bar height (pixels) ;----------------------------------------------------------------------------- section @OPTIONS ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @@ -199,8 +203,8 @@ options db OPTS_AUTOINDENT+OPTS_OPTIMSAVE+OPTS_SMARTTAB mainwnd_pos: .x dd 250 .y dd 75 - .w dd 6*80+6+SCRLW+5 - .h dd 402 + .w dd 6*80+6+SCRLW+5 ;- 220 + .h dd 402 ;- 220 ;----------------------------------------------------------------------------- section @CODE ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @@ -208,16 +212,16 @@ section @CODE ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ; fninit -; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_left,50 -; mov [mainwnd_pos.x],eax -; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_top,50 -; mov [mainwnd_pos.y],eax -; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_right,350 -; sub eax,[mainwnd_pos.x] -; mov [mainwnd_pos.w],eax -; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_bottom,450 -; sub eax,[mainwnd_pos.y] -; mov [mainwnd_pos.h],eax +; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_left,50 +; mov [mainwnd_pos.x],eax +; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_top,50 +; mov [mainwnd_pos.y],eax +; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_right,350 +; sub eax,[mainwnd_pos.x] +; mov [mainwnd_pos.w],eax +; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_bottom,450 +; sub eax,[mainwnd_pos.y] +; mov [mainwnd_pos.h],eax cld mov edi,@UDATA @@ -235,17 +239,8 @@ section @CODE ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: call mem.Alloc mov [temp_buf],eax - mov eax,65536 - call mem.Alloc - mov [cur_editor.Lines],eax - inc [do_not_draw] - mov [left_ofs],40+1 -; mov [f_info+4],0 -; mov [f_info+12],AREA_TEMP -; mov [f_info+16],AREA_EDIT-AREA_TEMP - mov esi,s_example mov edi,tb_opensave.text mov ecx,s_example.size @@ -258,6 +253,8 @@ section @CODE ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: mov [s_search.size],ecx rep movsb +; DEBUGF 1,"params: '%s'\n",@PARAMS + cmp byte[@PARAMS],0 jz no_params @@ -266,6 +263,8 @@ section @CODE ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: cmp byte[@PARAMS],'*' jne .noipc +; DEBUGF 1," started by DOCPAK\n" + ;// diamond [ (convert size from decimal representation to dword) ;-- mov edx,dword[@PARAMS+1] mov esi,@PARAMS+1 @@ -282,16 +281,26 @@ section @CODE ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: add edx,20 +; DEBUGF 1," data size (+20) = %d\n",edx + mov eax,edx call mem.Alloc mov ebp,eax + push eax + +; DEBUGF 1," mem.Alloc() returned 0x%x, allocated size = %d\n",eax,[eax-4] ;! mcall 60,1,AREA_TEMP-16 ; 0x10000-16 ;! mov dword[AREA_TEMP-16+4],8 ; [0x10000-16+4],8 - mcall 60,1,ebp + mov dword[ebp+0],0 mov dword[ebp+4],8 + mcall 60,1,ebp mcall 40,1000000b + +; DEBUGF 1," got IPC message within 2 secs? " mcall 23,200 +; DEBUGF 1,"%b\n",eax == 7 + cmp eax,7 jne key.alt_x.close ;! mov esi,AREA_TEMP-16 ; 0x10000-16 @@ -302,14 +311,19 @@ section @CODE ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ;! inc eax ;! call load_file.file_found +; DEBUGF 1," creating new document\n" + mov ecx,[ebp+12] - mov esi,ebp + lea esi,[ebp+16] call create_tab call load_from_memory + pop ebp mov eax,ebp call mem.Free +; DEBUGF 1," mem.Free(0x%x) returned %d\n",ebp,eax + jmp @f .noipc: @@ -327,13 +341,14 @@ section @CODE ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: jne key.alt_x.close lea eax,[edi-tb_opensave.text-1] mov [tb_opensave.length],al + call btn.load_file + jnc @f no_params: - ;call btn.load_file;do_load_file - ;jnc @f call create_tab @@: + mov [s_status],0 dec [do_not_draw] mcall 66,1,1 mcall 40,00100111b @@ -514,12 +529,6 @@ set_opt: .main: xor [options],al -; test [options],al -; je @f -; not al -; and [options],al -; ret -; @@: or [options],al ret ;----------------------------------------------------------------------------- @@ -578,6 +587,7 @@ accel_table_main dd \ 0x00000151,key.pgdn ,\ ; PageDown 0x00000152,key.ins ,\ ; Insert 0x00000153,key.del ,\ ; Delete + 0x00010043,key.shift_f9 ,\ ; Shift+F9 0x00010147,key.shift_home ,\ ; Shift+Home 0x00010148,key.shift_up ,\ ; Shift+Up 0x00010149,key.shift_pgup ,\ ; Shift+PageUp @@ -712,6 +722,8 @@ sz ini_window_left ,'Left',0 sz ini_window_right ,'Right',0 sz ini_window_bottom,'Bottom',0 +;include_debug_strings + TINYPAD_END: ; end of file self_path rb PATHL @@ -746,8 +758,6 @@ copy_count dd ? ; number of lines for copying (Ctrl+E) copy_size dd ? ; size of data to copy s_title.size dd ? ; caption length -draw_blines dd ? ; last line to draw - cur_line_len dd ? h_popup dd ? bot_dlg_handler dd ? diff --git a/programs/develop/tinypad/trunk/tinypad.inc b/programs/develop/tinypad/trunk/tinypad.inc index e6ff760f7d..f3ef6859c7 100644 --- a/programs/develop/tinypad/trunk/tinypad.inc +++ b/programs/develop/tinypad/trunk/tinypad.inc @@ -21,6 +21,7 @@ struct EDITOR FileName dd ? Bounds RECT Lines dd ? + Lines.Size dd ? Lines.Count dd ? Columns.Count dd ? Caret POINT @@ -46,6 +47,7 @@ struct TABCTL Items.Left dd ? Current TABITEM Current.Ptr dd ? + Default.Ptr dd ? Buttons.First dd ? Buttons.Last dd ? Style db ? diff --git a/programs/develop/tinypad/trunk/tp-common.asm b/programs/develop/tinypad/trunk/tp-common.asm index dded9e7ff2..42f79eca08 100644 --- a/programs/develop/tinypad/trunk/tp-common.asm +++ b/programs/develop/tinypad/trunk/tp-common.asm @@ -499,14 +499,22 @@ endf ;----------------------------------------------------------------------------- func line_add_spaces ;//////////////////////////////////////////////////////// ;----------------------------------------------------------------------------- -; esi = line offset -; ecx = needed line length +; Input: +; ESI = line offset +; ECX = needed line length +; Output: +; EAX = delta ;----------------------------------------------------------------------------- + xor eax,eax pushad movzx edx,word[esi] cmp ecx,edx jbe .exit sub ecx,edx + lea eax,[ecx+4] + call editor_realloc_lines + mov [esp+4*7],eax + add esi,eax push ecx mov edi,[cur_editor.Lines] ;! AREA_TEMP2 add edi,[edi-4] @@ -520,7 +528,6 @@ func line_add_spaces ;//////////////////////////////////////////////////////// neg ecx lea ecx,[esi+ecx+1] std -diff16 '32DC',0,$ rep movsb pop edi ecx add [eax],cx @@ -549,6 +556,7 @@ func delete_selection ;/////////////////////////////////////////////////////// or dword[esi],0x00010000 mov ecx,[sel.begin.x] call line_add_spaces + add esi,eax lea edi,[esi+4] mov ecx,[sel.end.y] call get_line_offset @@ -602,6 +610,17 @@ func delete_selection ;/////////////////////////////////////////////////////// mov eax,[sel.begin.y] mov [cur_editor.Caret.Y],eax ;! [pos.y],eax mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax + + mov ecx,[cur_editor.Lines.Count] + call get_line_offset + movzx eax,word[esi] + lea esi,[esi+eax+4] + mov eax,[cur_editor.Lines] + add eax,[eax-4] + sub esi,eax + lea eax,[esi+4096] + call editor_realloc_lines + popad mov [cur_editor.Modified],1 ;! [modified],1 clc @@ -630,28 +649,44 @@ endf ;----------------------------------------------------------------------------- func get_lines_in_file ;////////////////////////////////////////////////////// ;----------------------------------------------------------------------------- -; ESI = data pointer -; ECX = data length +; Input: +; ESI = data pointer +; ECX = data length +; Output: +; EAX = lines number +; EBX = extra length after tabs expansion ;----------------------------------------------------------------------------- - push ebx ecx esi + push ecx edx esi 0 or ebx,-1 + xor edx,edx .lp0: inc ebx .lp1: dec ecx jle .lp2 lodsb + cmp al,0 + je .lp2 + cmp al,9 + je .TB cmp al,10 je .LF cmp al,13 je .CR + inc edx jmp .lp1 - .lp2: mov eax,ebx - pop esi ecx ebx + .lp2: lea eax,[ebx+1] + pop ebx esi edx ecx ret .CR: cmp byte[esi],10 - jne .lp0 + jne .LF lodsb - .LF: jmp .lp0 + .LF: xor edx,edx + jmp .lp0 + .TB: and edx,00000111b + add dword[esp],ATABW + sub [esp],edx + xor edx,edx + jmp .lp1 endf ;----------------------------------------------------------------------------- diff --git a/programs/develop/tinypad/trunk/tp-draw.asm b/programs/develop/tinypad/trunk/tp-draw.asm index 81554f14ee..756ff52837 100644 --- a/programs/develop/tinypad/trunk/tp-draw.asm +++ b/programs/develop/tinypad/trunk/tp-draw.asm @@ -48,22 +48,7 @@ func drawwindow ;///// DRAW WINDOW /////////////////////////////////////////// mov [top_ofs],ATOPH;+1 - 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_editor.Bounds.Bottom] - sub eax,[cur_editor.Bounds.Top] - sub eax,SCRLW+3 - cdq - mov ebx,LINEH - div ebx - mov [lines.scr],eax + ;// --- columns.scr and lines.scr calculation --- mov eax,[p_info.client_box.height] add eax,-STATH+1;*3-2-2 @@ -187,22 +172,34 @@ func draw_main_menu ;///////////////////////////////////////////////////////// inc ebx mcall 13,,ATOPH-1,[cl_3d_normal] - mcall 38,[p_info.client_box.width],,[sc.frame];[cl_3d_pushed] + mcall 38,[p_info.client_box.width],,[cl_3d_inset] mov edx,main_menu - mov ebx,9*65536+ATOPH/2-4 - mov ecx,[sc.work_text] + mov ebx,9*65536+ATOPH/2-3;4 + ;mov ecx,[sc.work_text] mov [mi_sel],0 mov edi,[mi_cur] @@: inc [mi_sel] cmp [mi_sel],main_menu.cnt_item ja .exit + mov ecx,[sc.work_text] cmp edi,[mi_sel] jne .lp1 pushad push edx - mcall 13,[edx+0],[edx+4],[cl_3d_pushed] + ;mov ebx,[edx+0] + mov ecx,[edx+4] + add ecx,2*65536-2 + mcall 13,[edx+0],,[sc.work];[cl_3d_pushed] mov edx,[esp] + mov cx,[edx+6] + add ecx,-1*65536+1 + add bx,[edx+2] + mcall 38,,,[cl_3d_inset] + + mov edx,[esp] + add cx,[edx+4] + add cx,-2 mov bx,[edx+2] mcall 38,,,[cl_3d_inset] pop edx @@ -212,6 +209,7 @@ func draw_main_menu ;///////////////////////////////////////////////////////// add ebx,eax mcall 38,,,[cl_3d_inset] popad + mov ecx,[color_tbl+4*0] .lp1: add edx,8+1 movzx esi,byte[edx-1] mcall 4 @@ -1128,7 +1126,7 @@ func draw_statusbar ;///// WRITE POSITION //////////////////////////////////// mov ecx,[p_info.client_box.height-2] mov cx,word[p_info.client_box.height] sub ecx,STATH*65536+STATH - mcall 38,[p_info.client_box.width],,[sc.frame];[cl_3d_pushed] + mcall 38,[p_info.client_box.width],,[cl_3d_inset] ; mcall 9,p_info,-1 @@ -1235,6 +1233,29 @@ func draw_framerect ; ebx,ecx,edx ret endf +func draw_check + push bx + shl ebx,16 + pop bx + add ebx,0x00010000 + push cx + shl ecx,16 + pop cx + add ecx,0x00020001 + +; add ecx,0x00040003 +; sub ebx,0x000A000B + mcall 38 + add ecx,0x00010001 + mcall + add ebx,4 + sub ecx,2 + mcall + sub ecx,0x00010001 + mcall + ret +endf + func calc_middle shr eax,1 shr ebx,1 @@ -1262,6 +1283,8 @@ func calc_3d_colors mov eax,[cl_3d_inset] mov ebx,[cl_3d_outset] call calc_middle + mov ebx,[cl_3d_normal] + call calc_middle mov [cl_3d_pushed],eax mov eax,[cl_3d_normal] mov ebx,[sc.work_text] diff --git a/programs/develop/tinypad/trunk/tp-editor.asm b/programs/develop/tinypad/trunk/tp-editor.asm index 4391907fdb..64a26a5d35 100644 --- a/programs/develop/tinypad/trunk/tp-editor.asm +++ b/programs/develop/tinypad/trunk/tp-editor.asm @@ -13,23 +13,7 @@ func draw_editor ;///// DRAW EDITOR ////////////////////////////////////////// inc ecx mov edx,[cl_3d_inset] call draw_framerect -@^ - 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_editor.Bounds.Bottom-2] - mov cx,word[cur_editor.Bounds.Bottom] - mcall - mov bx,word[cur_editor.Bounds.Left] - mov cx,word[cur_editor.Bounds.Top] - mcall - mov ebx,[cur_editor.Bounds.Right-2] - mov bx,word[cur_editor.Bounds.Right] - mov cx,word[cur_editor.Bounds.Top] - mcall -^@ + mov [cur_editor.Gutter.Visible],0 test [options],OPTS_LINENUMS jnz @f @@ -49,12 +33,33 @@ func draw_editor ;///// DRAW EDITOR ////////////////////////////////////////// .lp1: mov [cur_editor.Gutter.Width],eax ;! [left_ofs],eax mov [left_ofs],eax + mov eax,[cur_editor.Bounds.Right] + sub eax,[cur_editor.Bounds.Left] + sub eax,[cur_editor.Gutter.Width] + sub eax,SCRLW+LCHGW+4 + js .exit + cdq + mov ebx,6 + div ebx + mov [columns.scr],eax + + mov eax,[cur_editor.Bounds.Bottom] + sub eax,[cur_editor.Bounds.Top] + + sub eax,SCRLW+3 + js .exit + cdq + mov ebx,LINEH + div ebx + mov [lines.scr],eax + call draw_editor_gutter call draw_editor_vscroll call draw_editor_hscroll call draw_editor_text call draw_editor_caret + .exit: ret endf @@ -171,7 +176,7 @@ func draw_editor_vscroll ;///// DRAW EDITOR VERTICAL SCROLL BAR ////////////// mov ecx,[cur_editor.TopLeft.Y] mov edx,[cur_editor.Bounds.Bottom] sub edx,[cur_editor.Bounds.Top] - add edx,-SCRLW*3+1 + add edx,-SCRLW*3;+1 call get_scroll_vars mov [cur_editor.VScroll.Top],eax mov [cur_editor.VScroll.Size],ebx @@ -273,6 +278,7 @@ func draw_editor_hscroll ;///// DRAW EDITOR HORIZONTAL SCROLL BAR //////////// mov ebx,[columns.scr] mov ecx,[cur_editor.TopLeft.X] mov edx,[cur_editor.Bounds.Right] + sub edx,[cur_editor.Bounds.Left] add edx,-(SCRLW*3) call get_scroll_vars mov [cur_editor.HScroll.Top],eax @@ -329,7 +335,10 @@ endf ;----------------------------------------------------------------------------- func draw_editor_text ;///// DRAW EDITOR TEXT //////////////////////////////// ;----------------------------------------------------------------------------- - mov eax,[cur_editor.Bounds.Bottom] + cmp [cur_editor.Lines],0 + jne @f + ret + @@: mov eax,[cur_editor.Bounds.Bottom] sub eax,[cur_editor.Bounds.Top] cmp eax,LINEH jge @f @@ -363,9 +372,6 @@ func draw_editor_text ;///// DRAW EDITOR TEXT //////////////////////////////// add esp,-4 imul ebp,[cur_editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536 - mov eax,[lines.scr] - sub eax,[cur_editor.Lines.Count] ;! eax,[lines] - mov [draw_blines],eax .next_line: @@ -683,13 +689,6 @@ func draw_editor_text ;///// DRAW EDITOR TEXT //////////////////////////////// .exit: - cmp [draw_blines],0 - jl @f - mov ecx,[esp-8] - shl ecx,16 - mov cx,word[cur_editor.Bounds.Bottom] - sub cx,[esp-8] - add cx,-SCRLW mov eax,[cur_editor.Bounds.Left] add eax,[cur_editor.Gutter.Width] inc eax @@ -698,8 +697,27 @@ func draw_editor_text ;///// DRAW EDITOR TEXT //////////////////////////////// mov bx,word[cur_editor.Bounds.Right] sub bx,ax add ebx,-SCRLW - mcall 13,,,[color_tbl+4*5] - @@: + mov edx,[color_tbl+4*5] + mov eax,13 + mov ecx,[esp-8] + add ecx,LINEH + shl ecx,16 + mov cx,word[cur_editor.Bounds.Bottom] + sub cx,[esp-8] + add cx,-SCRLW-LINEH + jle @f + mcall + @@: mov ecx,[cur_editor.Bounds.Top-2] + mov cx,2 + add ecx,0x00010000 + mcall + mov ebx,[cur_editor.Bounds.Right] + mov ecx,[cur_editor.Bounds.Bottom] + shl ebx,16 + shl ecx,16 + add ebx,-(SCRLW-1)*65536+SCRLW-1 + add ecx,-(SCRLW-1)*65536+SCRLW-1 + mcall popad add esp,4 @@ -744,4 +762,22 @@ func draw_editor_caret ;///// DRAW EDITOR TEXT CARET ///////////////////////// loop .lp8 @@: ret -endf \ No newline at end of file +endf + +;----------------------------------------------------------------------------- +func editor_realloc_lines ;///// ADD $DELTA$ TO LINES SIZE /////////////////// +;----------------------------------------------------------------------------- +; EAX = delta +;----------------------------------------------------------------------------- + push ebx ecx + mov ebx,[cur_editor.Lines.Size] + add ebx,eax + mov eax,[cur_editor.Lines] + mov [cur_editor.Lines.Size],ebx + mov ecx,eax + call mem.ReAlloc + mov [cur_editor.Lines],eax + sub eax,ecx + pop ecx ebx + ret +endf diff --git a/programs/develop/tinypad/trunk/tp-files.asm b/programs/develop/tinypad/trunk/tp-files.asm index 8e7474c7cf..1219c7780c 100644 --- a/programs/develop/tinypad/trunk/tp-files.asm +++ b/programs/develop/tinypad/trunk/tp-files.asm @@ -1,8 +1,6 @@ ;----------------------------------------------------------------------------- func save_file ;////////////////////////////////////////////////////////////// ;----------------------------------------------------------------------------- - ret ; DISALLOW FOR NOW - mov esi,tb_opensave.text mov edi,f_info.path movzx ecx,[tb_opensave.length] @@ -12,26 +10,45 @@ func save_file ;////////////////////////////////////////////////////////////// mov byte[edi],0 mov esi,[cur_editor.Lines] ;! AREA_EDIT ; 0x70000 = 448 Kbytes (maximum) - mov edi,0 ;!!! AREA_TEMP + + xor ebx,ebx + mov ecx,[cur_editor.Lines.Count] + @@: call get_real_length + add ebx,eax + movzx eax,word[esi] + lea esi,[esi+eax+4] + loop @b + mov eax,[cur_editor.Lines.Count] + shl eax,1 + lea eax,[eax+ebx+1024] + call mem.Alloc + push eax + mov esi,[cur_editor.Lines] + mov edi,eax ;!!! AREA_TEMP + +; pop eax +; ret ; DISALLOW FOR NOW .new_string: call save_string cmp dword[esi],0 jne .new_string - sub edi,0 ;!!! AREA_TEMP+2 ; minus last CRLF + pop eax + sub edi,eax ;!!! AREA_TEMP+2 ; minus last CRLF + add edi,-2 ;! mov [filelen],edi - cmp byte[f_info.path],'/' - je .systree_save - mcall 33,f_info.path,0,edi,0 ;!!! AREA_TEMP,edi,0;[filelen],0 - or eax,eax - jz .exit +; cmp byte[f_info.path],'/' +; je .systree_save +; mcall 33,f_info.path,0,edi,0 ;!!! AREA_TEMP,edi,0;[filelen],0 +; or eax,eax +; jz .exit ; call file_not_found - jmp .exit.2 +; jmp .exit.2 .systree_save: mov [f_info70+0],2 mov [f_info70+12],edi - mov [f_info70+16],0 ;!!! AREA_TEMP + mov [f_info70+16],eax ;!!! AREA_TEMP mov byte[f_info70+20],0 mov [f_info70+21],f_info.path mcall 70,f_info70 @@ -143,7 +160,12 @@ endf ;----------------------------------------------------------------------------- func load_file ;////////////////////////////////////////////////////////////// ;----------------------------------------------------------------------------- - mov esi,tb_opensave.text + cmp [tb_opensave.text],0 + jne @f + stc + ret + + @@: mov esi,tb_opensave.text mov edi,f_info.path movzx ecx,[tb_opensave.length] mov [f_info.length],ecx @@ -214,13 +236,22 @@ func load_from_memory ;/////////////////////////////////////////////////////// ; ESI = data pointer ; EBP = EDITOR* ;----------------------------------------------------------------------------- +; DEBUGF 1,<">>> load_from_memory\n" # \ +; " data length = %d\n" # \ +; " data pointer = 0x%x\n" # \ +; " EDITOR* = 0x%x\n">,ecx,esi,ebp + call get_lines_in_file - inc eax +; DEBUGF 1,"lines in file: %d\n",eax mov [ebp+EDITOR.Lines.Count],eax + lea edx,[ebx+ecx] imul ebx,eax,14 - add ebx,ecx + add ebx,edx +; DEBUGF 1,"36522: %d\n",ebx mov eax,[ebp+EDITOR.Lines] + mov [ebp+EDITOR.Lines.Size],ebx call mem.ReAlloc +; DEBUGF 1,"mem.ReAlloc: 0x%x\n",eax mov [ebp+EDITOR.Lines],eax mov [ebp+EDITOR.Columns.Count],0 diff --git a/programs/develop/tinypad/trunk/tp-key.asm b/programs/develop/tinypad/trunk/tp-key.asm index d885e80bf7..5846cf217a 100644 --- a/programs/develop/tinypad/trunk/tp-key.asm +++ b/programs/develop/tinypad/trunk/tp-key.asm @@ -155,10 +155,12 @@ endf ;----------------------------------------------------------------------------- func key.ctrl_s ;///// ENTER SAVE FILENAME /////////////////////////////////// ;----------------------------------------------------------------------------- + cmp [cur_editor.FilePath],'/' + jne key.shift_ctrl_s cmp [cur_editor.Modified],0 ;! [modified],0 je .exit - cmp [f_info.length],0 - je key.shift_ctrl_s + ;cmp [f_info.length],0 + ;je key.shift_ctrl_s call save_file call drawwindow .exit: @@ -537,11 +539,23 @@ func key.ctrl_v call delete_selection + mov eax,[copy_size] + call editor_realloc_lines + + mov eax,[cur_editor.Lines] + mov ebx,[cur_editor.Lines.Size] + add ebx,[copy_size] + mov [cur_editor.Lines.Size],ebx + call mem.ReAlloc + mov [cur_editor.Lines],eax + mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y] call get_line_offset pushd [esi] esi mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x] call line_add_spaces + add [esp],eax ;!!! + add esi,eax ;!!! mov ecx,[copy_size] sub ecx,4 mov edi,[cur_editor.Lines] ;! AREA_TEMP2 @@ -570,6 +584,7 @@ func key.ctrl_v mov ebx,[cur_editor.Caret.X] ;! ebx,[pos.x] add eax,ebx mov [edi-4],ax + mov byte[edi-4+2],0x0001 sub eax,ebx call .check_columns add edi,ebx @@ -579,7 +594,7 @@ func key.ctrl_v lodsd and eax,0x0000FFFF stosd - or dword[edi-4],0x00010000 + mov byte[edi-4+2],0x0001 pop ecx loop @b @@ -656,6 +671,9 @@ endf ;----------------------------------------------------------------------------- func key.ctrl_d ;///// INSERT SEPARATOR ////////////////////////////////////// ;----------------------------------------------------------------------------- + mov eax,94 + call editor_realloc_lines + mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y] call get_line_offset mov ebx,esi @@ -702,14 +720,27 @@ func key.ctrl_y ;///// DELETE CURRENT LINE /////////////////////////////////// call get_line_offset mov edi,esi lodsd + and eax,0x0000FFFF add esi,eax + push eax dec [cur_editor.Lines.Count] ;! [lines] - mov ecx,[temp_buf] ;! AREA_TEMP2 + ;mov ecx,[temp_buf] ;! AREA_TEMP2 + mov ecx,[cur_editor.Lines] + add ecx,[ecx-4] sub ecx,esi shr ecx,2 ;// fixed (was 4) cld rep movsd + + pop eax + add eax,4 + neg eax + call editor_realloc_lines + + m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] + m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] + call check_inv_all mov [cur_editor.Modified],1 ;! [modified],1 @@ -1129,6 +1160,16 @@ func key.del ;///// DELETE NEXT CHAR OR SELECTION //////////////////////////// @@: 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 ecx,[cur_editor.Lines.Count] + call get_line_offset + movzx eax,word[esi] + lea esi,[esi+eax+4] + mov eax,[cur_editor.Lines] + add eax,[eax-4] + sub esi,eax + lea eax,[esi+4096] + call editor_realloc_lines + mov [cur_editor.Modified],1 ;! [modified],1 .exit.2: call check_inv_all @@ -1223,6 +1264,9 @@ func key.tab ;///// TABULATE ///////////////////////////////////////////////// push eax ' ' sub eax,ecx .direct: + push eax + call editor_realloc_lines + pop eax mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y] call get_line_offset and dword[esi],not 0x00020000 @@ -1238,6 +1282,11 @@ func key.tab ;///// TABULATE ///////////////////////////////////////////////// sub edx,eax cmp ecx,edx jl @f + push eax + mov eax,10 + call editor_realloc_lines + add esi,eax + pop eax pushad; esi ecx eax mov ecx,[cur_editor.Lines] ;! AREA_TEMP2-10+1 add ecx,[ecx-4] @@ -1247,7 +1296,7 @@ func key.tab ;///// TABULATE ///////////////////////////////////////////////// ; lea eax,[esi+4] ; add eax,[esi] movzx eax,word[esi] - lea eax,word[esi+eax+4] + lea eax,[esi+eax+4] sub ecx,eax lea esi,[edi-10] ;! AREA_TEMP2-10 std @@ -1298,6 +1347,9 @@ func key.return ;///// CARRIAGE RETURN /////////////////////////////////////// ;----------------------------------------------------------------------------- call delete_selection + mov eax,14 + call editor_realloc_lines + mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y] call get_line_offset @@ -1489,3 +1541,21 @@ func key.ctrl_f4 ;///// CLOSE CURRENT TAB //////////////////////////////////// call create_tab @@: ret endf + +;----------------------------------------------------------------------------- +func key.shift_f9 ;///// SET DEFAULT TAB ///////////////////////////////////// +;----------------------------------------------------------------------------- + mov eax,[tab_bar.Current.Ptr] + cmp eax,[tab_bar.Default.Ptr] + jne @f + xor eax,eax + @@: mov [tab_bar.Default.Ptr],eax + mov ebp,[tab_bar.Current.Ptr] + call make_tab_visible + cmp [tab_bar.Style],2 + jbe @f + call align_editor_in_tab + call draw_editor + @@: call draw_tabctl + ret +endf diff --git a/programs/develop/tinypad/trunk/tp-mouse.asm b/programs/develop/tinypad/trunk/tp-mouse.asm index 6e83ceb474..72f92f7df3 100644 --- a/programs/develop/tinypad/trunk/tp-mouse.asm +++ b/programs/develop/tinypad/trunk/tp-mouse.asm @@ -3,11 +3,13 @@ func check_mouse_in_edit_area mov ebx,eax and ebx,0x0000FFFF shr eax,16 - mov ecx,[top_ofs] + mov ecx,[cur_editor.Bounds.Top] ; ecx,[top_ofs] inc ecx - pushd [left_ofs] ATOPH [p_info.client_box.width] ATOPH + pushd [cur_editor.Bounds.Left] ecx [cur_editor.Bounds.Right] ecx ; [left_ofs] ATOPH [p_info.client_box.width] ATOPH popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0] sub [__rc+0x8],SCRLW+6 + mov ecx,[cur_editor.Gutter.Width] + add [__rc+0x0],ecx imul ecx,[lines.scr],LINEH dec ecx add [__rc+0xC],ecx @@ -148,9 +150,11 @@ mouse: call clear_selection .check_body.2: - sub eax,[left_ofs] - sub ebx,[top_ofs] - dec ebx + sub eax,[cur_editor.Bounds.Left] ; eax,[left_ofs] + sub ebx,[cur_editor.Bounds.Top] ; ebx,[top_ofs] + sub eax,[cur_editor.Gutter.Width] + sub eax,LCHGW + sub ebx,2 ; sub ebx,[__rc+0x4] push eax mov eax,ebx @@ -196,19 +200,20 @@ mouse: jmp still .check_vscroll: - mov ecx,[p_info.client_box.width] - sub ecx,SCRLW-2 - pushd ecx [top_ofs] ecx [bot_ofs] + ;mov ecx,[p_info.client_box.width] + mov ecx,[cur_editor.Bounds.Right] + sub ecx,SCRLW-1;2 + pushd ecx [cur_editor.Bounds.Top] ecx [cur_editor.Bounds.Bottom] ;ecx [top_ofs] ecx [bot_ofs] popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0] - add [__rc+0x8],SCRLW-1;!!!!!!!!!!!!!!-2 - add [__rc+0x4],SCRLW;!!!!!!!!!!!!!!+1 - sub [__rc+0xC],SCRLW*2+3 + add [__rc+0x8],SCRLW-2;!!!!!!!!!!!!!!-2 + add [__rc+0x4],SCRLW-1;!!!!!!!!!!!!!!+1 + sub [__rc+0xC],SCRLW*2+1;3 mov ecx,__rc call pt_in_rect jnc .check_hscroll .check_vscroll.2: - sub ebx,[top_ofs] + sub ebx,[cur_editor.Bounds.Top] ; ebx,[top_ofs] sub ebx,SCRLW;!!!!!!!!!!!!!!+1 ; sub ebx,[__rc+0x4] cmp [vscrl_capt],0 @@ -234,10 +239,10 @@ mouse: jns @f xor ebx,ebx @@: mov [mouse_captured],1 - mov eax,[bot_ofs] - sub eax,[top_ofs] + mov eax,[cur_editor.Bounds.Bottom] ; eax,[bot_ofs] + sub eax,[cur_editor.Bounds.Top] ; eax,[top_ofs] sub eax,[cur_editor.VScroll.Size] ;! eax,[vscrl_size] - sub eax,SCRLW*3-2 + sub eax,SCRLW*3;-2 cmp eax,ebx jge @f mov ebx,eax @@ -246,9 +251,9 @@ mouse: 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 ;** + mov ebx,[cur_editor.Bounds.Bottom] ; ebx,[bot_ofs] + sub ebx,[cur_editor.Bounds.Top] ; ebx,[top_ofs] + sub ebx,SCRLW*3;-2 ;** sub ebx,[cur_editor.VScroll.Size] ;! ebx,[vscrl_size] idiv ebx cmp eax,[cur_editor.TopLeft.Y] ;! eax,[top_line] @@ -259,18 +264,21 @@ mouse: jmp still.skip_write .check_hscroll: - pushd (5+SCRLW+1) [bot_ofs] [p_info.box.width] [bot_ofs] + pushd [cur_editor.Bounds.Left] [cur_editor.Bounds.Bottom] [cur_editor.Bounds.Right] [cur_editor.Bounds.Bottom] ; (5+SCRLW+1) [bot_ofs] [p_info.box.width] [bot_ofs] popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0] - add [__rc+0x8],-SCRLW*2-10-1 - add [__rc+0x4],-SCRLW - add [__rc+0xC],-2 + add [__rc+0x8],-SCRLW*2-1 + add [__rc+0x4],-SCRLW+1 + add [__rc+0xC],-1 + add [__rc+0x0],SCRLW+1 mov ecx,__rc call pt_in_rect jnc .check_main_menu .check_hscroll.2: mov ebx,eax - sub ebx,(5+SCRLW+1) + ;sub ebx,(5+SCRLW+1) + sub ebx,SCRLW+1 + sub ebx,[cur_editor.Bounds.Left] ; sub ebx,[__rc+0x0] cmp [hscrl_capt],0 jge .hcaptured @@ -295,9 +303,9 @@ mouse: jns @f xor ebx,ebx @@: mov [mouse_captured],1 - mov eax,[p_info.box.width] + mov eax,[cur_editor.Bounds.Right] ; eax,[p_info.box.width] sub eax,[cur_editor.HScroll.Size] ;! eax,[hscrl_size] - sub eax,SCRLW*3+10+1 + sub eax,SCRLW*3+1 ; eax,SCRLW*3+10+1 cmp eax,ebx jge @f mov ebx,eax @@ -306,8 +314,8 @@ mouse: 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 ;** + mov ebx,[cur_editor.Bounds.Right] ; ebx,[p_info.box.width] + sub ebx,SCRLW*3+1 ; ebx,SCRLW*3+10+1 ;** sub ebx,[cur_editor.HScroll.Size] ;! ebx,[hscrl_size] idiv ebx cmp eax,[cur_editor.TopLeft.X] ;! eax,[left_col] diff --git a/programs/develop/tinypad/trunk/tp-popup.asm b/programs/develop/tinypad/trunk/tp-popup.asm index 4fe3c6652c..5a9aa3c0d7 100644 --- a/programs/develop/tinypad/trunk/tp-popup.asm +++ b/programs/develop/tinypad/trunk/tp-popup.asm @@ -178,22 +178,11 @@ func draw_popup_wnd test byte[ebp+edi-1],0x02 jz .lp8 movzx ecx,bx - shl ecx,16 - mov cx,bx shr ebx,16 - push bx - shl ebx,16 - pop bx - add ecx,0x00040003 - sub ebx,0x000A000B - mcall 38,,,[sc.work_text] - add ecx,0x00010001 - mcall - add ebx,4 - sub ecx,2 - mcall - sub ecx,0x00010001 - mcall + add ebx,-11 + add ecx,2 + mov edx,[sc.work_text] + call draw_check .lp8: popad mov ecx,[sc.work_text];0x00000000 diff --git a/programs/develop/tinypad/trunk/tp-tabctl.asm b/programs/develop/tinypad/trunk/tp-tabctl.asm index e2e93573b8..ce6edf3ca6 100644 --- a/programs/develop/tinypad/trunk/tp-tabctl.asm +++ b/programs/develop/tinypad/trunk/tp-tabctl.asm @@ -38,16 +38,15 @@ endf ;----------------------------------------------------------------------------- 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: + push ebp call get_hidden_tabitems_number cmp ebp,[esp] ja .lp1 @@ -67,13 +66,13 @@ func make_tab_visible ;///// MAKE SPECIFIED TAB VISIBLE IF IT'S OFFSCREEN //// 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 //////////////////////////////////// ;----------------------------------------------------------------------------- +; DEBUGF 1,"items count before addition: %d\n",[tab_bar.Items.Count] push eax ecx esi edi inc [tab_bar.Items.Count] @@ -84,11 +83,15 @@ func create_tab ;///// ADD TAB TO THE END //////////////////////////////////// mov [tab_bar.Items],eax sub ecx,eax sub [tab_bar.Current.Ptr],ecx - lea ebp,[eax+ebx-sizeof.TABITEM] + cmp [tab_bar.Default.Ptr],0 + je @f + sub [tab_bar.Default.Ptr],ecx + @@: lea ebp,[eax+ebx-sizeof.TABITEM] call set_cur_tab call make_tab_visible mov eax,1024 + mov [cur_editor.Lines.Size],eax call mem.Alloc mov [cur_editor.Lines],eax mov [cur_editor.Lines.Count],1 @@ -115,14 +118,19 @@ func create_tab ;///// ADD TAB TO THE END //////////////////////////////////// rep movsb mov [cur_editor.FileName],0 - mov [f_info.length],0 mov [cur_editor.Modified],0 mov [cur_editor.AsmMode],0 call flush_cur_tab call update_caption - call drawwindow - + ;call drawwindow + cmp [do_not_draw],0 + jne @f + call align_editor_in_tab + call draw_editor + call draw_tabctl + call draw_statusbar + @@: mov ebp,cur_tab pop edi esi ecx eax ret @@ -131,7 +139,18 @@ endf ;----------------------------------------------------------------------------- func delete_tab ;///// DELETE SPECIFIED TAB ////////////////////////////////// ;----------------------------------------------------------------------------- - mov eax,[ebp+TABITEM.Editor.Lines] +; DEBUGF 1,"items count before deletion: %d\n",[tab_bar.Items.Count] + cmp [tab_bar.Default.Ptr],0 + je @f + cmp ebp,[tab_bar.Default.Ptr] + je .lp1 + ja @f + sub [tab_bar.Default.Ptr],sizeof.TABITEM + jmp @f + .lp1: + mov [tab_bar.Default.Ptr],0 + + @@: mov eax,[ebp+TABITEM.Editor.Lines] call mem.Free imul ecx,[tab_bar.Items.Count],sizeof.TABITEM add ecx,[tab_bar.Items] @@ -153,7 +172,10 @@ func delete_tab ;///// DELETE SPECIFIED TAB ////////////////////////////////// mov [tab_bar.Items],eax sub ecx,eax sub ebp,ecx - + cmp [tab_bar.Default.Ptr],0 + je @f + sub [tab_bar.Default.Ptr],ecx + @@: pop ecx add ecx,[tab_bar.Items] sub ecx,ebp @@ -163,14 +185,20 @@ func delete_tab ;///// DELETE SPECIFIED TAB ////////////////////////////////// @@: mov [tab_bar.Current.Ptr],0 call set_cur_tab call make_tab_visible - call drawwindow + ;call drawwindow + call align_editor_in_tab + call draw_editor + call draw_tabctl + call draw_statusbar ret .no_tabs: mov eax,[tab_bar.Items] call mem.Free - mov [tab_bar.Items],0 - mov [tab_bar.Current.Ptr],0 + xor eax,eax + mov [tab_bar.Items],eax + mov [tab_bar.Current.Ptr],eax + mov [tab_bar.Default.Ptr],eax ret endf @@ -354,6 +382,26 @@ func draw_tabctl ;///// DRAW TAB CONTROL ///////////////////////////////////// mov edx,[color_tbl+4*0] .draw_tabs.inactive: + cmp ebp,[tab_bar.Default.Ptr] + jne .draw_tabs.notdefault + push ebx ecx edx + add ebx,3*65536 + add ecx,(TBARH/2-6)*65536 + mov bx,11 + mov cx,bx + call draw_framerect + add ebx,1*65536-2 + add ecx,1*65536-2 + mcall 13,,,[sc.work] + shr ebx,16 + shr ecx,16 + add ebx,2 + add ecx,3 + mov edx,[esp] + call draw_check + pop edx ecx ebx + .draw_tabs.notdefault: + push ebx ecx esi edx lea eax,[ebp+TABITEM.Editor.FilePath] add eax,[ebp+TABITEM.Editor.FileName] @@ -362,9 +410,12 @@ func draw_tabctl ;///// DRAW TAB CONTROL ///////////////////////////////////// mov esi,eax shr ecx,16 mov bx,cx - add ebx,0x00050005 + add ebx,5*65536+TBARH/2-4 pop ecx - mcall 4 + cmp ebp,[tab_bar.Default.Ptr] + jne .lp2 + add ebx,13*65536 + .lp2: mcall 4 pop esi ecx ebx inc [tab_bar.Buttons.Last] @@ -533,6 +584,9 @@ func get_tab_size ;///// GET TAB WIDTH /////////////////////////////////////// call strlen imul ebx,eax,6 add ebx,9 + cmp ebp,[tab_bar.Default.Ptr] + jne .lp2 + add ebx,13 jmp .lp2 .lp1: call get_max_tab_width mov ebx,eax @@ -566,6 +620,9 @@ func get_max_tab_width ;///// GET WIDTH OF LONGEST TAB /////////////////////// cmp eax,SCRLW*2+2 jae @f mov eax,SCRLW*2+2 + @@: cmp [tab_bar.Default.Ptr],0 + je @f + add eax,13 @@: pop ebp ecx ebx ret endf @@ -598,9 +655,8 @@ func get_hidden_tabitems_number ;///////////////////////////////////////////// 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 + imul ebp,[tab_bar.Items.Left],sizeof.TABITEM + add ebp,[tab_bar.Items] mov eax,ecx sub eax,[tab_bar.Items.Left] push eax