Tinypad 4.0.4 (final release)

git-svn-id: svn://kolibrios.org@297 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Mihail Semenyako (mike.dld) 2007-01-27 23:36:07 +00:00
parent c3a36dffbc
commit b542bfb588
17 changed files with 1639 additions and 2023 deletions

View File

@ -110,6 +110,7 @@ macro szc name,elsz,[data] { ; from MFAR [mike.dld]
m = 0
if used name
label name
forward
virtual at 0
db data
s = $
@ -119,6 +120,7 @@ macro szc name,elsz,[data] { ; from MFAR [mike.dld]
m = s
end if
db data
common
.size = $-name
.maxl = m
end if
@ -210,7 +212,7 @@ macro section name { align 16
label name }
macro func name {
if ~used name
;display 'FUNC NOT USED: ',`name,13,10
display 'FUNC NOT USED: ',`name,13,10
else
align 4
name:

View File

@ -1,35 +1,29 @@
;-----------------------------------------------------------------------------
; project name: TINYPAD
; 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-18 (Jan 18, 2007)
; compiler: flat assembler 1.67.18
; memory to compile: 3.0/9.0 MBytes (without/with size optimizations)
; version: 4.0.4
; last update: 2007-01-28 (Jan 28, 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
; Ivan Poddubny >> ivan-yar@bk.ru
;-----------------------------------------------------------------------------
; TODO (FOR 4.1.0):
; TODO (4.1.0):
; - optimize drawing (reduce flickering)
; - 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 (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
; - add prompt to save file before closing/opening
; - other bug-fixes and speed/size optimizations
;
; HISTORY:
; 4.0.4 pre (mike.dld)
; 4.0.4 (mike.dld)
; bug-fixes:
; - statusbar contained hint after dialog operation cancelled
; - small drawing fix for gutter and line saved/modified markers
; (incorrect calculations)
; - incorrect lines marking on Ctrl+V
; changes:
; - editor and other modifications to ease parts placement changing,
@ -39,12 +33,14 @@
; - 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.)
; - reduced flickering (changes checker)
; - 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
; (thanks IRC guys for ideas and testing)
; - make any tab default to compile it disregarding currently active tab
; - configuration dialog (colors, tabs positioning)
; 4.0.3 (mike.dld)
; bug-fixes:
; - 1-char selection if pressing <BS> out of real line length
@ -157,11 +153,11 @@ include 'lang.inc'
include 'macros.inc' ; useful stuff
;include 'proc32.inc'
include 'tinypad.inc'
purge mov,add,sub ;  SPEED
;purge mov,add,sub ;  SPEED
header '01',1,@CODE,TINYPAD_END,STATIC_MEM_END,MAIN_STACK,@PARAMS,self_path
APP_VERSION equ '4.0.4 pre'
APP_VERSION equ '4.0.4'
;include 'debug.inc'
;define __DEBUG__ 1
@ -185,18 +181,19 @@ 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,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, 64,128) ; RGB( 0, 0,128) ; selection background
RGB(255,238, 98) ; modified line marker
RGB(108,226,108) ; saved line marker
.text: RGB( 0, 0, 0)
.back: RGB(255,255,255)
.text.sel: RGB(255,255,255)
.back.sel: RGB( 10, 36,106)
.symbol: RGB( 48, 48,240)
.number: RGB( 0,144, 0)
.string: RGB(176, 0, 0)
.comment: RGB(128,128,128)
.line.moded: RGB(255,238, 98)
.line.saved: RGB(108,226,108)
ins_mode db 1
tab_pos db 2
options db OPTS_AUTOINDENT+OPTS_OPTIMSAVE+OPTS_SMARTTAB
@ -229,7 +226,8 @@ section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
mov al,0
rep stosb
mov [tab_bar.Style],2
mov al,[tab_pos]
mov [tab_bar.Style],al
mcall 68,11
or eax,eax
@ -241,6 +239,8 @@ section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
inc [do_not_draw]
mov dword[app_start],7
mov esi,s_example
mov edi,tb_opensave.text
mov ecx,s_example.size
@ -253,8 +253,6 @@ section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
mov [s_search.size],ecx
rep movsb
; DEBUGF 1,"params: '%s'\n",@PARAMS
cmp byte[@PARAMS],0
jz no_params
@ -263,8 +261,6 @@ 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
@ -281,37 +277,21 @@ 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
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
;! mov byte[esi],1
;! mov eax,[esi+12]
mov byte[ebp],1
;! mov eax,[ebp+12]
;! inc eax
;! call load_file.file_found
; DEBUGF 1," creating new document\n"
mov ecx,[ebp+12]
lea esi,[ebp+16]
@ -322,14 +302,11 @@ section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
mov eax,ebp
call mem.Free
; DEBUGF 1," mem.Free(0x%x) returned %d\n",ebp,eax
jmp @f
.noipc:
;// Willow's code to support DOCPAK ]
; parameters are at @PARAMS
mov esi,@PARAMS
mov edi,tb_opensave.text
mov ecx,PATHL
@ -341,7 +318,7 @@ section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
jne key.alt_x.close
lea eax,[edi-tb_opensave.text-1]
mov [tb_opensave.length],al
call btn.load_file
call load_file
jnc @f
no_params:
@ -354,15 +331,14 @@ section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
mcall 40,00100111b
red:
call drawwindow
call check_inv_all.skip_check
;-----------------------------------------------------------------------------
still:
call draw_statusbar ; write current position & number of strings
call draw_statusbar ; write current position & number of strings
.skip_write:
mcall 10;23,50; wait here until event
mcall 10 ; wait here until event
cmp [main_closed],0
jne key.alt_x
dec eax ; redraw ?
@ -381,137 +357,112 @@ func start_fasm ;/////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; BL = run after compile
;-----------------------------------------------------------------------------
cmp [cur_editor.AsmMode],0 ;! [asm_mode],0
; FASM infile,outfile,/path/to/files[,run]
;-----------------------------------------------------------------------------
cmp [cur_editor.AsmMode],0
jne @f
ret
@@: mov esi,f_info.path ; s_fname
mov edi,fasm_parameters
cmp byte[esi],'/'
je .yes_systree
mov ecx,[f_info.length] ; [s_fname.size]
rep movsb
mov al,','
stosb
mov ecx,[f_info.length] ; [s_fname.size]
add ecx,-4
mov esi,f_info.path ; s_fname
rep movsb
mov al,','
stosb
mov dword[edi],'/RD/'
mov word[edi+4],'1/'
add edi,6
mov al,0
stosb
jmp .run
.yes_systree:
mov eax,[f_info.length]
add esi,eax ; [s_fname.size]
dec esi
xor ecx,ecx
mov al,'/'
@@: cmp [esi],al
@@:
mov eax,[tab_bar.Default.Ptr]
or eax,eax
jnz @f
mov eax,[tab_bar.Current.Ptr]
@@: cmp byte[eax+TABITEM.Editor.FilePath],'/'
je @f
dec esi
inc ecx
ret
@@:
mov edi,fasm_parameters
push eax
cld
lea esi,[eax+TABITEM.Editor.FilePath]
add esi,[eax+TABITEM.Editor.FileName]
push esi esi
@@: lodsb
cmp al,0
je @f
stosb
cmp al,'.'
jne @b
mov ecx,esi
jmp @b
@@: inc esi
push esi esi ecx
@@:
mov al,','
stosb
pop esi
sub ecx,esi
dec ecx
jz @f
rep movsb
@@:
mov al,','
stosb
pop ecx esi
add ecx,-4
rep movsb
mov al,','
stosb
pop ecx
sub ecx,f_info.path ; s_fname
mov esi,f_info.path ; s_fname
add esi,TABITEM.Editor.FilePath
sub ecx,esi
rep movsb
cmp bl,0 ; run outfile ?
je @f
mov dword[edi],',run'
add edi,4
@@:
mov al,0
stosb
.run:
cmp bl,0 ; run outfile ?
je @f
mov dword[edi-1],',run'
mov byte[edi+3],0
@@:
mov ebx, fasm_start
mov [app_start.filename],app_fasm
mov [app_start.params],fasm_parameters
start_ret:
mov eax, 70
int 0x40
mcall 70,app_start
ret
endf
;-----------------------------------------------------------------------------
func open_debug_board ;///////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov ebx, board_start
mov [app_start.filename],app_board
mov [app_start.params],0
jmp start_ret
endf
;-----------------------------------------------------------------------------
func open_sysfuncs_txt ;//////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov ebx, docpak_start
mov [app_start.filename],app_docpak
mov [app_start.params],sysfuncs_param
call start_ret
cmp eax,0xfffffff0
jb @f
mov ebx, tinypad_start
mov dword [ebx+8], sysfuncs_filename
mov [app_start.filename],app_tinypad
mov [app_start.params],sysfuncs_filename
call start_ret
@@: ret
endf
;-----------------------------------------------------------------------------
;func layout ;///// change keyboard layout ///////////////////////////////////
;-----------------------------------------------------------------------------
; mcall 19,setup,param_setup
; mcall 5,eax
;; call activate_me
;; ret
;;endf
;;func activate_me
; mcall 9,p_info,-1
; inc eax
; inc eax
; mov ecx,eax
; mov edi,[p_info.PID]
; mov ebx,p_info
; @@: dec ecx
; jz @f ; counter=0 => not found? => return
; mcall 9
; cmp edi,[p_info.PID]
; jne @b
; mcall 18,3
; mcall 5,eax
; @@: ret
;endf
set_opt:
.dialog:
mov [bot_mode],1
mov [bot_dlg_height],128
mov [bot_dlg_handler],optsdlg_handler
mov [focused_tb],tb_color
mov al,[tb_color.length]
mov [tb_color.pos.x],al
mov [tb_color.sel.x],0
mov [tb_casesen],1
mov [cur_part],0
m2m [cur_color],dword[color_tbl.text]
mov esi,color_tbl
mov edi,cur_colors
mov ecx,10
cld
rep movsd
call drawwindow
ret
.line_numbers:
mov al,OPTS_LINENUMS
jmp .main
@ -554,8 +505,6 @@ include 'tp-recode.asm'
section @DATA ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;-----------------------------------------------------------------------------
;addr dd s_fname ; address of input string
;temp dd 0xABCD ; used in read_string
vscrl_capt dd -1
hscrl_capt dd -1
body_capt dd -1
@ -652,8 +601,8 @@ accel_table_textbox dd \
0x00010153,key.tb.del ,\ ; Shift+Del
0
accel_table2 dd \
1,btn.close_main_window ,\
accel_table2 dd \
1 ,key.alt_x ,\
'VSL',btn.vscroll_up ,\
'VSG',btn.vscroll_down ,\
'HSL',btn.hscroll_up ,\
@ -663,10 +612,12 @@ accel_table2 dd \
0
accel_table2_botdlg dd \
1,btn.close_main_window ,\
1 ,key.alt_x ,\
20001,btn.bot.cancel ,\
20002,btn.bot.opensave ,\
20003,btn.bot.find ,\
20004,btn.bot.appearance,\
21001,btn.bot.tabpos ,\
0
add_table:
@ -680,6 +631,7 @@ add_table:
s_status dd 0
@^
fasm_start:
dd 7
dd 0
@ -708,11 +660,78 @@ docpak_start:
dd 0
dd 0
db '/RD/1/DOCPAK',0
^@
sz app_fasm ,'/RD/1/DEVELOP/FASM',0
sz app_board ,'/RD/1/BOARD',0
sz app_tinypad ,'/RD/1/TINYPAD',0
sz app_docpak ,'/RD/1/DOCPAK',0
sz sysfuncs_param,'g',0
include 'tp-locale.inc'
;// options dialog data [
label optsdlg_editor at $-EDITOR.Bounds
; rb PATHL ; FilePath db PATHL dup(?)
; dd 0 ; FileName dd ?
dd ?,?,?,? ; Bounds RECT
dd @f ; Lines dd ?
dd ? ; Lines.Size dd ?
dd 9 ; Lines.Count dd ?
dd 21 ; Columns.Count dd ?
dd 0,4 ; Caret POINT
dd 100,4 ; SelStart POINT
dd 0,0 ; TopLeft POINT
dd 0,0 ; VScroll SCROLLBAR
dd 0,0 ; HScroll SCROLLBAR
dd 0 ; Gutter.Width dd ?
db 0 ; Gutter.Visible db ?
db 1 ; AsmMode db ?
db 0 ; Modified db ?
@@:
dd 0x00000000+1
db ' '
dd 0x00010000+9
db ' org 100h'
dd 0x00000000+1
db ' '
dd 0x00000000+20
db ' mov ah,09h ; write'
dd 0x00000000+12
db ' mov dx,text'
dd 0x00000000+8
db ' int 21h'
dd 0x00030000+8
db ' int 20h'
dd 0x00000000+1
db ' '
dd 0x00000000+21
db ' text db "Hello!",24h'
dd 0
optsdlg_editor_parts: ; left,top,right,bottom,type
db 0, 12, 13, 29, 22
db 0, 12, 33, 47, 42
db 0, 12, 53, 29, 72
db 0, 12, 83, 53, 92
db 2, 12, 43, 77, 52
db 3, 4, 43,148, 52
db 4, 48, 33, 53, 42
db 4,108, 83,113, 92
db 5, 36, 13, 59, 22
db 5, 54, 33, 71, 42
db 5, 36, 53, 53, 72
db 5,114, 83,131, 92
db 6, 60, 83,107, 92
db 7, 84, 33,125, 42
db 8, 1, 13, 5, 22
db 9, 1, 63, 5, 72
db 1, 1, 1,148,105
db -1
;// ]
sz symbols_ex,';?.%"',"'"
sz symbols ,'#&*\:/<>|{}()[]=+-, '
@ -722,8 +741,6 @@ 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
@ -732,6 +749,13 @@ self_path rb PATHL
section @UDATA ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;-----------------------------------------------------------------------------
app_start:
dd ?,?
.params dd ?
dd ?,?
db ?
.filename dd ?
f_info.length dd ?
f_info.path:
times PATHL+1 db ?
@ -739,6 +763,8 @@ f_info70 rd 7
file_info FILEINFO
checker_ed EDITOR
tab_bar TABCTL
virtual at tab_bar.Current
cur_tab TABITEM
@ -774,6 +800,8 @@ do_not_draw db ? ; draw top and bottom buttons?
main_closed db ? ; main window closed?
tb_casesen db ? ; focused textbox is case-sensitive?
draw_blines db ?
align 4
s_fname.size dd ?
s_fname rb PATHL+1
@ -794,6 +822,7 @@ cl_3d_outset dd ?
cl_3d_inset dd ?
cl_3d_grayed dd ?
tb_color TBOX
tb_opensave TBOX
tb_find TBOX
tb_replace TBOX
@ -830,15 +859,6 @@ p_info process_information
p_info2 process_information
sc system_colors
;store dword '/hd/' at tb_opensave.text+4*0
;store dword '1/tp' at tb_opensave.text+4*1
;store dword 'ad4/' at tb_opensave.text+4*2
;store dword 'tiny' at tb_opensave.text+4*3
;store dword 'pad.' at tb_opensave.text+4*4
;store dword 'asm' at tb_opensave.text+4*5
;store byte 23 at tb_opensave.length
;rb 1024*36
rb 1024*4
MAIN_STACK:
rb 1024*4

View File

@ -11,6 +11,18 @@ struct RECT
Bottom dd ?
ends
struct TBOX
width dw ?
x dw ?
height dw ?
y dw ?
sel.x db ?
pos.x db ?
ofs.x db ?
length db ?
text rb 255
ends
struct SCROLLBAR
Top dd ?
Size dd ?

View File

@ -37,46 +37,47 @@ button:
call draw_editor
call draw_statusbar
call draw_tabctl
call update_caption
@@:
jmp still.skip_write
btn.vscroll_up:
dec [cur_editor.TopLeft.Y] ;! [top_line]
dec [cur_editor.TopLeft.Y]
jns @f
inc [cur_editor.TopLeft.Y] ;! [top_line]
inc [cur_editor.TopLeft.Y]
ret
@@: call check_inv_all.skip_check
@@: call editor_check_for_changes
ret
btn.vscroll_down:
inc [cur_editor.TopLeft.Y] ;! [top_line]
mov eax,[cur_editor.Lines.Count] ;! eax,[lines]
inc [cur_editor.TopLeft.Y]
mov eax,[cur_editor.Lines.Count]
sub eax,[lines.scr]
cmp eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
cmp eax,[cur_editor.TopLeft.Y]
jge @f
dec [cur_editor.TopLeft.Y] ;! [top_line]
dec [cur_editor.TopLeft.Y]
ret
@@: call check_inv_all.skip_check
@@: call editor_check_for_changes
ret
btn.hscroll_up:
dec [cur_editor.TopLeft.X] ;! [left_col]
dec [cur_editor.TopLeft.X]
jns @f
inc [cur_editor.TopLeft.X] ;! [left_col]
ret;jmp still.skip_write
@@: call check_inv_all.skip_check
inc [cur_editor.TopLeft.X]
ret
@@: call editor_check_for_changes
ret
btn.hscroll_down:
inc [cur_editor.TopLeft.X] ;! [left_col]
mov eax,[cur_editor.Columns.Count] ;! eax,[columns]
inc [cur_editor.TopLeft.X]
mov eax,[cur_editor.Columns.Count]
sub eax,[columns.scr]
cmp eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
cmp eax,[cur_editor.TopLeft.X]
jge @f
dec [cur_editor.TopLeft.X] ;! [left_col]
dec [cur_editor.TopLeft.X]
ret
@@: call check_inv_all.skip_check
@@: call editor_check_for_changes
ret
btn.tabctl_right:
@ -93,17 +94,16 @@ button:
@@: call draw_tabctl
ret
btn.search:
key.f3:
call search
jc @f
call check_inv_all
@@: ret
btn.debug_board:
call open_debug_board
ret
btn.sysfuncs_txt:
call open_sysfuncs_txt
ret
func search
cld
mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
mov ecx,[cur_editor.Caret.Y]
mov edx,ecx
call get_line_offset
cmp word[esi],0
@ -113,9 +113,9 @@ func search
or eax,eax
jz .end_line.2
mov ecx,eax
sub ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
sub ecx,[cur_editor.Caret.X]
push esi
add esi,[cur_editor.Caret.X] ;! esi,[pos.x]
add esi,[cur_editor.Caret.X]
jmp @f
.next_line:
@ -151,15 +151,15 @@ func search
.found:
add esp,4
mov [cur_editor.Caret.Y],edx ;! [pos.y],edx
mov [cur_editor.SelStart.Y],edx ;! [sel.y],edx
mov [cur_editor.Caret.Y],edx
mov [cur_editor.SelStart.Y],edx
mov ecx,edx
lea eax,[esi-4]
call get_line_offset
sub eax,esi
mov [cur_editor.SelStart.X],eax ;! [sel.x],eax
mov [cur_editor.SelStart.X],eax
add eax,[s_search.size]
mov [cur_editor.Caret.X],eax ;! [pos.x],eax
mov [cur_editor.Caret.X],eax
mov [s_status],0
clc
ret
@ -168,7 +168,7 @@ func search
pop esi
.end_line.2:
movzx eax,word[esi-4]
add esi,eax;[esi-4]
add esi,eax
inc edx
call get_real_length
mov ecx,eax
@ -180,111 +180,3 @@ func search
stc
ret
endf
btn.compile:
key.ctrl_f9:
mov bl,0
call start_fasm
ret
btn.compile_run:
key.f9:
mov bl,1
call start_fasm
ret
btn.debug_board:
call open_debug_board
ret
btn.sysfuncs_txt:
call open_sysfuncs_txt
ret
btn.load_file:
key.ctrl_l:
call load_file
jnc @f
ret
@@:
xor eax,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_editor.Modified],al ;! [modified],al
; enable color syntax for ASM and INC files:
mov [cur_editor.AsmMode],al ;! [asm_mode],al
; 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_editor.AsmMode] ;! [asm_mode]
jmp .nocol
@@: cmp ecx,'inc'
jne .nocol
inc [cur_editor.AsmMode] ;! [asm_mode]
.nocol:
update_caption:
lea esi,[cur_editor.FilePath] ;! mov esi,f_info.path
mov edi,s_title
@@: lodsb
cmp al,0
je @f
stosb
jmp @b
@@:
;cld
;mov ecx,[f_info.length]
;jecxz @f
;rep movsb
mov dword[edi],' - '
add edi,3
@@: mov esi,htext
mov ecx,htext.size
cld
rep movsb
mov al,0
stosb
mcall 71,1,s_title
clc
ret
btn.close_main_window:
key.alt_x:
mov esi,self_path
mov byte[esi+PATHL-1],0
mov edi,f_info.path
cld
@@: lodsb
stosb
or al,al
jnz @b
mov [f_info70+0],2
mov [f_info70+4],0
mov [f_info70+8],0
mov [f_info70+12],TINYPAD_END
mov [f_info70+16],0
mov byte[f_info70+20],0
mov [f_info70+21],f_info.path
mcall 70,f_info70
.close:
mov [main_closed],1
mcall -1

View File

@ -1,87 +1,14 @@
;-----------------------------------------------------------------------------
func check_cur_vis_inv ;//////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push eax ebx
xor bl,bl
.chk_y:
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
or eax,eax
jge @f
mov [cur_editor.Caret.Y],0 ;! [pos.y],0
jmp .chk_dy
@@: cmp eax,[cur_editor.Lines.Count] ;! eax,[lines]
jl .chk_dy
mov eax,[cur_editor.Lines.Count] ;! eax,[lines]
dec eax
mov [cur_editor.Caret.Y],eax ;! [pos.y],eax
.chk_dy:
mov eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
cmp eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
jle @f
m2m [cur_editor.TopLeft.Y],[cur_editor.Caret.Y]
;! push [pos.y]
;! pop [top_line]
inc bl
@@: add eax,[lines.scr]
cmp eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
jg .chk_x
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
sub eax,[lines.scr]
inc eax
mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax
inc bl
.chk_x:
mov eax,[cur_editor.Caret.X] ;! eax,[pos.x]
or eax,eax
jge @f
mov [cur_editor.Caret.X],0 ;! [pos.x],0
jmp .chk_dx
@@: cmp eax,[cur_editor.Columns.Count] ;! eax,[columns]
jl .chk_dx
mov eax,[cur_editor.Columns.Count] ;! eax,[columns]
mov [cur_editor.Caret.X],eax ;! [pos.x],eax
.chk_dx:
mov eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
cmp eax,[cur_editor.Caret.X] ;! eax,[pos.x]
jle @f
m2m [cur_editor.TopLeft.X],[cur_editor.Caret.X]
;! push [pos.x]
;! pop [left_col]
inc bl
@@: add eax,[columns.scr]
cmp eax,[cur_editor.Caret.X] ;! eax,[pos.x]
jg @f
mov eax,[cur_editor.Caret.X] ;! eax,[pos.x]
sub eax,[columns.scr]
inc eax
mov [cur_editor.TopLeft.X],eax ;! [left_col],eax
inc bl
@@: cmp [mev],MEV_LDOWN
jne .exit
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
jz @f
call draw_file
stc
@@: pop ebx eax
ret
endf
;-----------------------------------------------------------------------------
func clear_selection ;////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push eax ebx
mov eax,[cur_editor.SelStart.Y] ;! eax,[sel.y]
mov ebx,[cur_editor.Caret.Y] ;! ebx,[pos.y]
mov eax,[cur_editor.SelStart.Y]
mov ebx,[cur_editor.Caret.Y]
cmp eax,ebx
jle @f
xchg eax,ebx
@@: 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
@@: push [cur_editor.Caret.X] [cur_editor.Caret.Y]
pop [cur_editor.SelStart.Y] [cur_editor.SelStart.X]
pop ebx eax
ret
endf
@ -107,111 +34,29 @@ endf
func check_bottom_right ;/////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push eax
mov eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
mov eax,[cur_editor.TopLeft.Y]
add eax,[lines.scr]
cmp eax,[cur_editor.Lines.Count] ;! eax,[lines]
cmp eax,[cur_editor.Lines.Count]
jbe .lp1
mov eax,[cur_editor.Lines.Count] ;! eax,[lines]
mov eax,[cur_editor.Lines.Count]
sub eax,[lines.scr]
jns @f
xor eax,eax
@@: mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax
.lp1: mov eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
@@: mov [cur_editor.TopLeft.Y],eax
.lp1: mov eax,[cur_editor.TopLeft.X]
add eax,[columns.scr]
cmp eax,[cur_editor.Columns.Count] ;! eax,[columns]
cmp eax,[cur_editor.Columns.Count]
jbe .exit
mov eax,[cur_editor.Columns.Count] ;! eax,[columns]
mov eax,[cur_editor.Columns.Count]
sub eax,[columns.scr]
jns @f
xor eax,eax
@@: mov [cur_editor.TopLeft.X],eax ;! [left_col],eax
@@: mov [cur_editor.TopLeft.X],eax
.exit:
pop eax
ret
endf
;-----------------------------------------------------------------------------
func check_inv_str ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
@^
mov eax,[pos.y]
mov ecx,[top_line]
.skip_init:
call check_cur_vis
mov [pos.y],eax
mov [top_line],ecx
.skip_check:
; call invalidate_string
call drawfile
ret
^@
endf
;-----------------------------------------------------------------------------
func check_inv_all ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
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_editor.Caret.Y],eax ;! [pos.y],eax
mov [cur_editor.TopLeft.Y],ecx ;! [top_line],ecx
.skip_check:
; call clear_screen
call draw_file
ret
endf
;-----------------------------------------------------------------------------
func check_cur_vis ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
cmp eax,ecx
jb .low
mov edx,ecx
add edx,[lines.scr]
cmp edx,[cur_editor.Lines.Count] ;! edx,[lines]
jbe @f
mov edx,[cur_editor.Lines.Count] ;! edx,[lines]
@@: cmp eax,edx
jb @f
lea ecx,[eax+1]
sub ecx,[lines.scr]
jns @f
xor ecx,ecx
jmp @f
.low: mov ecx,eax
@@: mov edx,ecx
add edx,[lines.scr]
cmp edx,[cur_editor.Lines.Count] ;! edx,[lines]
jbe @f
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_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
jb .lp1
cmp eax,ecx
jb .exit
lea ebx,[eax]
sub ebx,[columns.scr]
jmp @f
.lp1: mov ebx,eax
@@: mov [cur_editor.TopLeft.X],ebx ;! [left_col],ebx
.exit:
mov [cur_editor.Caret.X],eax ;! [pos.x],eax
popad
ret
endf
;-----------------------------------------------------------------------------
func get_real_length ;////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
@ -232,7 +77,7 @@ func get_line_offset ;////////////////////////////////////////////////////////
; ESI = line data offset
;-----------------------------------------------------------------------------
push eax ecx
mov esi,[cur_editor.Lines] ;! AREA_EDIT
mov esi,[cur_editor.Lines]
@@: dec ecx
js .exit
movzx eax,word[esi]
@ -248,10 +93,10 @@ func init_sel_vars ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
pushad
mov [sel.selected],1
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]
mov eax,[ebp+EDITOR.SelStart.X]
mov ebx,[ebp+EDITOR.SelStart.Y]
mov ecx,[ebp+EDITOR.Caret.X]
mov edx,[ebp+EDITOR.Caret.Y]
cmp ebx,edx
jl .lp2
jne @f
@ -303,14 +148,10 @@ func get_scroll_vars ;////////////////////////////////////////////////////////
or eax,eax
jns @f
xor eax,eax
@@: mov [esp+8],eax ; scroller offset
@@: mov [esp+8],eax ; scroller offset
add eax,[esp+4]
cmp eax,[esp]
jle @f
; mov eax,[esp]
; sub eax,[esp+4]
; js @f
; mov [esp+8],eax
@@:
pop edx ebx eax
ret
@ -449,16 +290,16 @@ func get_active_popup_item ;//////////////////////////////////////////////////
mov dword[ecx+0x0],0
mov dword[ecx+0x4],0
movzx edx,[ebp+POPUP.width]
mov dword[ecx+0x8],edx;POP_WIDTH
mov dword[ecx+0x8],edx
movzx edx,[ebp+POPUP.height]
mov dword[ecx+0xC],edx;POP_HEIGHT
mov dword[ecx+0xC],edx
call pt_in_rect
jnc .outside_window
inc dword[ecx+0x0]
mov dword[ecx+0x4],3
dec dword[ecx+0x8]
mov dword[ecx+0xC],3+POP_IHEIGHT-1
mov edx,[ebp+POPUP.data];popup_text.data
mov edx,[ebp+POPUP.data]
@@: inc [pi_cur]
inc edx
movzx esi,byte[edx-1]
@ -475,7 +316,7 @@ func get_active_popup_item ;//////////////////////////////////////////////////
.lp1: call pt_in_rect
jnc .lp2
mov eax,[pi_cur]
test byte[ebp+eax-1],1;byte[popup_text+eax-1],1
test byte[ebp+eax-1],1
jnz .exit
jmp .separator
.lp2: add dword[ecx+0x4],POP_IHEIGHT
@ -516,14 +357,14 @@ func line_add_spaces ;////////////////////////////////////////////////////////
mov [esp+4*7],eax
add esi,eax
push ecx
mov edi,[cur_editor.Lines] ;! AREA_TEMP2
mov edi,[cur_editor.Lines]
add edi,[edi-4]
dec edi
mov eax,esi
mov esi,edi
sub esi,ecx
lea ecx,[eax+4]
add ecx,edx;[eax]
add ecx,edx
push ecx
neg ecx
lea ecx,[esi+ecx+1]
@ -571,14 +412,14 @@ func delete_selection ;///////////////////////////////////////////////////////
mov [edi-4],bx
add edi,[sel.begin.x]
lea esi,[esi+eax+4]
mov ecx,[cur_editor.Lines] ;! AREA_TEMP2
mov ecx,[cur_editor.Lines]
add ecx,[ecx-4]
sub ecx,esi
cld
rep movsb
mov eax,[sel.end.y]
sub eax,[sel.begin.y]
sub [cur_editor.Lines.Count],eax ;! [lines],eax
sub [cur_editor.Lines.Count],eax
jmp .exit
.single_line:
@ -597,7 +438,7 @@ func delete_selection ;///////////////////////////////////////////////////////
lea edi,[esi+4]
add edi,[sel.begin.x]
lea esi,[edi+ecx]
mov ecx,[cur_editor.Lines] ;! AREA_TEMP2
mov ecx,[cur_editor.Lines]
add ecx,[ecx-4]
sub ecx,esi
cld
@ -605,11 +446,11 @@ func delete_selection ;///////////////////////////////////////////////////////
.exit:
mov eax,[sel.begin.x]
mov [cur_editor.Caret.X],eax ;! [pos.x],eax
mov [cur_editor.SelStart.X],eax ;! [sel.x],eax
mov [cur_editor.Caret.X],eax
mov [cur_editor.SelStart.X],eax
mov eax,[sel.begin.y]
mov [cur_editor.Caret.Y],eax ;! [pos.y],eax
mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax
mov [cur_editor.Caret.Y],eax
mov [cur_editor.SelStart.Y],eax
mov ecx,[cur_editor.Lines.Count]
call get_line_offset
@ -622,7 +463,7 @@ func delete_selection ;///////////////////////////////////////////////////////
call editor_realloc_lines
popad
mov [cur_editor.Modified],1 ;! [modified],1
mov [cur_editor.Modified],1
clc
ret
@ -689,6 +530,34 @@ func get_lines_in_file ;//////////////////////////////////////////////////////
jmp .lp1
endf
;-----------------------------------------------------------------------------
func update_caption ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
lea esi,[cur_editor.FilePath]
mov edi,s_title
@@: lodsb
cmp al,0
je @f
stosb
jmp @b
@@:
mov dword[edi],' - '
add edi,3
@@: mov esi,htext
mov ecx,htext.size
cld
rep movsb
mov al,0
stosb
mcall 71,1,s_title
clc
ret
endf
;-----------------------------------------------------------------------------
func mem.Alloc ;//////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------

View File

@ -29,7 +29,7 @@ define mm.Encoding.KOI8R.CP866 recode.koi.866
define mm.Encoding.CP1251.KOI8R recode.1251.koi
define mm.Encoding.KOI8R.CP1251 recode.koi.1251
define mm.Options.Appearance 0
define mm.Options.Appearance set_opt.dialog
define mm.Options.SecureSel set_opt.secure_sel
define mm.Options.AutoBrackets set_opt.auto_braces
define mm.Options.AutoIndents set_opt.auto_indents

View File

@ -80,9 +80,9 @@ finddlg_handler:
mov eax,[p_info.client_box.width]
sub eax,6*(s_2find.size+2)+1
add eax,6*(s_2find.size+2)*65536
mov dword[tbox.x],eax
mov dword[tbox.width],eax
add ecx,-18*65536+1
mov dword[tbox.y],ecx
mov dword[tbox.height],ecx
call textbox.draw
pop ecx
@ -93,9 +93,9 @@ finddlg_handler:
mov eax,[p_info.client_box.width]
sub eax,6*(s_2replace.size+2)+1
add eax,6*(s_2replace.size+2)*65536
mov dword[tbox.x],eax
mov dword[tbox.width],eax
inc ecx
mov dword[tbox.y],ecx
mov dword[tbox.height],ecx
call textbox.draw
@@:
@ -164,9 +164,9 @@ osdlg_handler:
mov eax,[p_info.client_box.width]
sub eax,6*(s_2filename.size+1)+1
add eax,6*(s_2filename.size+1)*65536
mov dword[tbox.x],eax
mov dword[tbox.width],eax
add ecx,-18*65536+1
mov dword[tbox.y],ecx
mov dword[tbox.height],ecx
call textbox.draw
ret
@ -220,11 +220,16 @@ gotodlg_handler:
mov eax,[p_info.box.width]
sub eax,6*(s_2filename.size+3)
add eax,6*(s_2filename.size+2)*65536
mov dword[tbox.x],eax
mov dword[tbox.width],eax
add ecx,-18*65536+1
mov dword[tbox.y],ecx
mov dword[tbox.height],ecx
call textbox.draw
sub ebx,(6*(s_2cancel.size+2)+3)*65536
mov bx,6*(s_2cancel.size+2)
push 20010 s_2cancel s_2cancel.size
call define_3d_button
ret
.key:
@ -237,6 +242,332 @@ gotodlg_handler:
call textbox.key
ret
cur_part dd ?
cur_color dd ?
cur_colors rd 10
optsdlg_handler:
cmp al,1
je .draw
cmp al,2
je .key
cmp al,3
je botdlg.button
cmp al,4
je .mouse
ret
.xchg_colors:
mov ecx,10
mov esi,color_tbl
mov edi,cur_colors
@@: lodsd
xchg eax,[edi]
mov [esi-4],eax
add edi,4
loop @b
ret
.draw:
call .draw_editor
mov ecx,[bot_ofs-2]
mov cx,word[bot_ofs]
push ecx
add ecx,128
mcall 38,<2+3+165,2+3+165>,,[cl_3d_inset]
mov bx,word[p_info.client_box.width]
pop ecx
add ecx,35*65536+35
mcall
add ecx,0x00240024
mcall
shr ecx,16
mov bx,cx
add ebx,38*65536-21
mcall 4,,[sc.work_text],s_tabpos,s_tabpos.size
call .draw_tabpos
mov ebx,[bot_ofs]
add ebx,(2+6+165+35)*65536+5+16
mcall 4,,[sc.work_text],s_color,s_color.size
mov dword[tb_color.width],(2+6+6*s_color.size+165+35)*65536+(6*6+8)
mov eax,ebx
add ax,-3
shl eax,16
mov ax,14
mov dword[tb_color.height],eax
call .draw_color
mov ebx,[p_info.client_box.width]
shl ebx,16
mov ecx,[p_info.client_box.height]
shl ecx,16
add ecx,(-34)*65536+15
add ebx,-(2+6*(s_2save.size+2))*65536+6*(s_2save.size+2)
push 20004 s_2save s_2save.size
call define_3d_button
sub ebx,(6*(s_2cancel.size+2)+3)*65536
mov bx,6*(s_2cancel.size+2)
push 20001 s_2cancel s_2cancel.size
call define_3d_button
ret
.get_color:
movzx ecx,[tb_color.length]
mov esi,tb_color.text
xor eax,eax
xor ebx,ebx
jecxz .lp2
.lp1: lodsb
cmp al,'9'
mov dl,-'0'
jbe @f
mov dl,-'A'+10
@@: add al,dl
shl ebx,4
add bl,al
loop .lp1
.lp2: mov eax,[cur_part]
mov [cur_colors+eax*4],ebx
mov [cur_color],ebx
jmp .draw_color.2
.draw_editor:
push dword[options] [tab_bar.Current.Ptr]
mov [options],0
mov ebp,optsdlg_editor
call set_cur_tab
call .xchg_colors
mov [cur_editor.Bounds.Left],2
mov [cur_editor.Bounds.Right],2+165
mov eax,[p_info.client_box.height]
add eax,-125-STATH
mov [cur_editor.Bounds.Top],eax
add eax,122
mov [cur_editor.Bounds.Bottom],eax
call draw_editor
call .xchg_colors
pop ebp eax
mov [options],al
call set_cur_tab
ret
.draw_tabpos:
mov ecx,[bot_ofs-2]
xor cx,cx
mov ebx,(2+3+165+3)*65536+31
add ecx,38*65536+31
mov edx,[cl_3d_inset]
mov esi,[sc.work]
call draw_fillrect
dec ebx
dec ecx
mcall 8,,,0x40000000+21001
mov esi,[cl_3d_normal]
mov al,[tab_pos]
TPOSH = 6
TPOSW = 10
dec al
jnz @f
;// top
inc ebx
mov cx,TPOSH
call draw_fillrect
add ecx,2*65536-2
jmp .lp3
@@: dec al
jnz @f
;// bottom
inc ebx
mov cx,TPOSH
add ecx,(31-TPOSH)*65536
call draw_fillrect
add ecx,-2
jmp .lp3
@@: dec al
jnz @f
;// left
inc ecx
mov bx,TPOSW
call draw_fillrect
add ebx,2*65536-2
jmp .lp4
@@: dec al
jnz @f
;// right
inc ecx
mov bx,TPOSW
add ebx,(31-TPOSW)*65536
call draw_fillrect
add ebx,-2
jmp .lp4
.lp3:
add ebx,(2+TPOSW-2+1)*65536-31+TPOSW-2
call draw_fillrect
add ebx,-(TPOSW-2+1)*65536
mov esi,[sc.work]
call draw_fillrect
ret
.lp4:
add ecx,7*65536-31+4
call draw_fillrect
add ecx,-5*65536
mov esi,[sc.work]
call draw_fillrect
ret
.draw_color:
mov ecx,[cur_part]
mov edx,s_appearance+1
@@: dec ecx
js @f
movzx eax,byte[edx-1]
lea edx,[edx+eax+1]
jmp @b
@@:
movzx esi,byte[edx-1]
mov ebx,[bot_ofs]
add ebx,(2+6+165+35)*65536+8
push ebx ecx edx
mov ecx,ebx
shl ecx,16
mov bx,s_appearance.maxl*6
mov cx,10
mcall 13,,,[cl_3d_normal]
pop edx ecx ebx
mcall 4,,[sc.work_text]
mov eax,[cur_color]
mov edi,tb_color.text
mov ebx,6
mov ecx,16
call uint2strz
mov [tb_color.length],6
mov [tb_color.sel.x],0
mov [tb_color.pos.x],6
mov ebp,tb_color
call textbox.draw
.draw_color.2:
mov ecx,[p_info.client_box.height]
sub ecx,[bot_dlg_height]
add ecx,-STATH
shl ecx,16
add ecx,3*65536+31
mov ebx,(2+6+165)*65536+31
mov edx,[cl_3d_inset]
mov esi,[cur_color]
call draw_fillrect
ret
.key:
cmp ebx,KEY_ESCAPE
je btn.bot.cancel
cmp ebx,KEY_RETURN
je btn.bot.appearance
cmp ebx,KEY_NUMRETURN
je btn.bot.appearance
cmp ebx,KEY_BACKSPACE
je .key.tb.2
cmp ebx,KEY_TAB
je .key.tb.2
cmp bx,0x00FF
ja .key.tb.2
;cmp ebx,KEY_LSHIFT
;je .key.tb.2
;cmp ebx,KEY_RSHIFT
;je .key.tb.2
;cmp ebx,0x00000147
;jb .key.exit
;cmp ebx,0x00000153
;jbe .key.tb.2
test dword[shi],KM_CTRLALT
jnz .key.exit
movzx eax,[chr]
movzx eax,[eax+key0]
or al,al
jz .key.exit
movzx eax,[eax+key1]
cmp al,'0'
jb @f
cmp al,'9'
jbe .key.tb
@@: cmp al,'A'
jb @f
cmp al,'F'
jbe .key.tb
@@: cmp al,'a'
jb @f
cmp al,'f'
jbe .key.tb
@@: ret
.key.tb:
cmp [tb_color.length],6
jb @f
mov al,[tb_color.sel.x]
cmp al,[tb_color.pos.x]
jne @f
ret
.key.tb.2:
@@: call textbox.key
call .get_color
call .draw_editor
.key.exit:
ret
.mouse:
cmp ah,MEV_LDOWN
jne .mouse.exit
mcall 37,1
movsx ebx,ax
sar eax,16
cmp eax,[optsdlg_editor+EDITOR.Bounds.Right]
jg .mouse.exit
cmp ebx,[optsdlg_editor+EDITOR.Bounds.Bottom]
jg .mouse.exit
sub eax,[optsdlg_editor+EDITOR.Bounds.Left]
js .mouse.exit
sub ebx,[optsdlg_editor+EDITOR.Bounds.Top]
js .mouse.exit
mov esi,optsdlg_editor_parts-5
@@: add esi,5
cmp byte[esi+0],-1
je .mouse.exit
cmp al,byte[esi+1]
jb @b
cmp bl,byte[esi+2]
jb @b
cmp al,byte[esi+3]
ja @b
cmp bl,byte[esi+4]
ja @b
movzx ebp,byte[esi+0]
mov [cur_part],ebp
m2m [cur_color],[cur_colors+ebp*4]
;mcall 13,<200,30>,<250,30>,[color_tbl+ebp*4]
;call .draw_color
call .draw
.mouse.exit:
ret
botdlg.button:
mov esi,accel_table2_botdlg
.acc: cmp ebx,[esi]
@ -262,7 +593,7 @@ botdlg.button:
call save_file
jnc @f
jmp .lp2
.lp1: call btn.load_file
.lp1: call load_file
jnc @f
.lp2:
ret
@ -285,18 +616,12 @@ botdlg.button:
je @f
call search
jnc .found
call check_inv_all
call editor_check_for_changes
ret
.found:
;---------------------------------------
push [copy_size] [copy_count] [copy_buf]
; mov esi,0 ;! AREA_CBUF
; mov edi,0 ;! AREA_CBUF-304
; mov ecx,300/4
; rep movsd
movzx eax,[tb_replace.length]
add eax,10
call mem.Alloc
@ -304,7 +629,7 @@ botdlg.button:
movzx eax,[tb_replace.length]
mov esi,tb_replace.text
mov edi,[copy_buf] ;! AREA_CBUF
mov edi,[copy_buf]
stosd
mov ecx,eax
jecxz .lp1
@ -313,27 +638,41 @@ botdlg.button:
mov [copy_size],eax
mov [copy_count],1
push [cur_editor.SelStart.X] ;! [sel.x]
push [cur_editor.SelStart.X]
mov ebp,cur_editor
call init_sel_vars
call key.ctrl_v
pop [cur_editor.SelStart.X] ;! [sel.x]
pop [cur_editor.SelStart.X]
mov eax,[copy_buf]
call mem.Free
; mov esi,0 ;! AREA_CBUF-304
; mov edi,0 ;! AREA_CBUF
; mov ecx,300/4
; rep movsd
pop [copy_buf] [copy_count] [copy_size]
;---------------------------------------
call check_inv_all
call editor_check_for_changes
ret
@@: xor eax,eax
mov [bot_mode],al
mov [bot_dlg_height],eax
call btn.search
call key.f3
call drawwindow
ret
btn.bot.appearance:
@@: xor eax,eax
mov [bot_mode],al
mov [bot_dlg_height],eax
call optsdlg_handler.xchg_colors
mov al,[tab_pos]
mov [tab_bar.Style],al
call drawwindow
ret
tabpos_round db 4,3,1,2
btn.bot.tabpos:
movzx eax,[tab_pos]
mov al,[tabpos_round+eax-1]
mov [tab_pos],al
@@: call optsdlg_handler.draw_tabpos
ret

File diff suppressed because it is too large Load Diff

View File

@ -17,11 +17,11 @@ func draw_editor ;///// DRAW EDITOR //////////////////////////////////////////
mov [cur_editor.Gutter.Visible],0
test [options],OPTS_LINENUMS
jnz @f
xor eax,eax ;! mov eax,2+LCHGW
xor eax,eax
jmp .lp1
@@: inc [cur_editor.Gutter.Visible]
mov edi,p_info+100
mov eax,[cur_editor.Lines.Count] ;! eax,[lines]
mov eax,[cur_editor.Lines.Count]
mov ecx,10
call uint2str
lea eax,[edi-p_info-100]
@ -30,7 +30,7 @@ func draw_editor ;///// DRAW EDITOR //////////////////////////////////////////
mov eax,3
@@: imul eax,6
add eax,8
.lp1: mov [cur_editor.Gutter.Width],eax ;! [left_ofs],eax
.lp1: mov [cur_editor.Gutter.Width],eax
mov [left_ofs],eax
mov eax,[cur_editor.Bounds.Right]
@ -131,8 +131,10 @@ func draw_editor_vscroll ;///// DRAW EDITOR VERTICAL SCROLL BAR //////////////
add ebx,(-SCRLW)*65536+SCRLW
mov ecx,[cur_editor.Bounds.Top-2]
mov cx,SCRLW
cmp [bot_mode],0
jne @f
mcall 8,,,'VSL' or 0x40000000
pushad
@@: pushad
sar ebx,16
sar ecx,16
push ebx ecx SCRLW SCRLW
@ -152,8 +154,10 @@ func draw_editor_vscroll ;///// DRAW EDITOR VERTICAL SCROLL BAR //////////////
mov ecx,[cur_editor.Bounds.Bottom]
shl ecx,16
add ecx,(-SCRLW*2)*65536+SCRLW
cmp [bot_mode],0
jne @f
mcall ,,,'VSG' or 0x40000000
pushad
@@: pushad
sar ebx,16
sar ecx,16
push ebx ecx SCRLW SCRLW
@ -236,8 +240,10 @@ func draw_editor_hscroll ;///// DRAW EDITOR HORIZONTAL SCROLL BAR ////////////
mov ecx,[cur_editor.Bounds.Bottom]
shl ecx,16
add ecx,(-SCRLW)*65536+SCRLW
cmp [bot_mode],0
jne @f
mcall 8,,,'HSL' or 0x40000000
pushad
@@: pushad
sar ebx,16
sar ecx,16
push ebx ecx SCRLW SCRLW
@ -256,8 +262,10 @@ func draw_editor_hscroll ;///// DRAW EDITOR HORIZONTAL SCROLL BAR ////////////
mov ebx,[cur_editor.Bounds.Right]
shl ebx,16
add ebx,(-SCRLW*2)*65536+SCRLW
cmp [bot_mode],0
jne @f
mcall 8,,,'HSG' or 0x40000000
pushad
@@: pushad
sar ebx,16
sar ecx,16
push ebx ecx SCRLW SCRLW
@ -332,6 +340,82 @@ func draw_editor_hscroll ;///// DRAW EDITOR HORIZONTAL SCROLL BAR ////////////
ret
endf
;-----------------------------------------------------------------------------
func draw_editor_text.part ;///// DRAW EDITOR TEXT (PARTLY) //////////////////
;-----------------------------------------------------------------------------
; EAX = start line
; EBX = end line
;-----------------------------------------------------------------------------
cmp [cur_editor.Lines],0
jne @f
ret
@@: push eax
mov eax,[cur_editor.Bounds.Bottom]
sub eax,[cur_editor.Bounds.Top]
cmp eax,LINEH
pop eax
jge @f
ret
@@:
mov ebp,cur_editor
call init_sel_vars
call check_bottom_right
pushad
push eax
mov eax,[cur_editor.Bounds.Left]
add eax,[cur_editor.Gutter.Width]
add eax,LCHGW+3
mov [left_ofs],eax
mov eax,[cur_editor.Bounds.Top]
add eax,3
mov [top_ofs],eax
pop eax
cmp [lines.scr],0
jle .exit
cmp eax,ebx
jle @f
xchg eax,ebx
@@: cmp eax,[cur_editor.TopLeft.Y]
jge @f
mov eax,[cur_editor.TopLeft.Y]
@@: mov ecx,[cur_editor.TopLeft.Y]
add ecx,[lines.scr]
cmp ebx,ecx
jl @f
dec ecx
mov ebx,ecx
@@: cmp eax,ebx
jg .exit
mov ecx,eax
push eax
call get_line_offset
.start:
mov ecx,ebx
sub ecx,eax
inc ecx
mov ebx,[top_ofs]
add ebx,[left_ofs-2]
sub eax,[cur_editor.TopLeft.Y]
imul eax,LINEH
add ebx,eax
imul ebp,[cur_editor.TopLeft.X],6*65536
mov [draw_blines],0
jmp draw_editor_text.next_line
.exit:
popad
ret
endf
;-----------------------------------------------------------------------------
func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
;-----------------------------------------------------------------------------
@ -344,6 +428,7 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
jge @f
ret
@@:
mov ebp,cur_editor
call init_sel_vars
call check_bottom_right
@ -360,7 +445,7 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
mov ebx,[top_ofs]
add ebx,[left_ofs-2]
mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
mov ecx,[cur_editor.TopLeft.Y]
push ecx
call get_line_offset
@ -371,7 +456,8 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
jle .exit
add esp,-4
imul ebp,[cur_editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536
imul ebp,[cur_editor.TopLeft.X],6*65536
mov [draw_blines],1
.next_line:
@ -381,7 +467,6 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
shl ecx,16
mov cl,LINEH
mov ebx,[cur_editor.Bounds.Right]
;sub ebx,[cur_editor.Bounds.Left]
add ebx,-SCRLW
add ebx,[left_ofs-2]
sub ebx,[left_ofs]
@ -389,7 +474,7 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
; selection (text background)
mov [in_sel],0
mov edx,[color_tbl+4*5]
mov edx,[color_tbl.back]
mov eax,[esp+4*2]
cmp eax,[sel.begin.y]
jl .lp6
@ -402,7 +487,7 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
cmp eax,[sel.end.y]
je .lp5
.lp2: mov eax,[sel.begin.x]
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
sub eax,[cur_editor.TopLeft.X]
jle .lp6.2
cmp eax,[columns.scr]
jge .lp6
@ -414,7 +499,7 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
add ebx,[left_ofs]
add ebx,-2
rol ebx,16
mov edx,[color_tbl+4*7]
mov edx,[color_tbl.back.sel]
mcall 13
popad
mov bx,ax
@ -424,7 +509,7 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
cmp eax,[sel.end.y]
je .lp5
.lp4: mov eax,[sel.end.x]
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
sub eax,[cur_editor.TopLeft.X]
jle .lp6
cmp eax,[columns.scr]
jg .lp6.2
@ -432,18 +517,18 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
pushad
sub bx,ax
rol ebx,16
add eax,[left_ofs];OLEFT-1
add eax,[left_ofs]
add eax,-2
mov bx,ax
rol ebx,16
mcall 13
popad
inc eax
mov edx,[color_tbl+4*7]
mov edx,[color_tbl.back.sel]
mov bx,ax
mov [in_sel],3
jmp .lp6
.lp5: mov eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
.lp5: mov eax,[cur_editor.TopLeft.X]
cmp eax,[sel.begin.x]
jge .lp4
add eax,[columns.scr]
@ -452,7 +537,7 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
mov eax,[sel.begin.x]
cmp eax,[sel.end.x]
je .lp6
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
sub eax,[cur_editor.TopLeft.X]
imul eax,6
pushad
mov ebx,[sel.end.x]
@ -463,7 +548,7 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
add eax,[left_ofs]
mov bx,ax
rol ebx,16
mov edx,[color_tbl+4*7]
mov edx,[color_tbl.back.sel]
mcall 13
movzx eax,bx
sar ebx,16
@ -475,7 +560,7 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
add ax,word[left_ofs]
add ax,-2
mov bx,ax
mov edx,[color_tbl+4*5]
mov edx,[color_tbl.back]
mcall 13
popad
mov bx,ax
@ -483,7 +568,7 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
jmp .lp6
.lp6.2:
mov edx,[color_tbl+4*7]
mov edx,[color_tbl.back.sel]
inc [in_sel]
.lp6:
mcall 13
@ -491,13 +576,13 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
lodsd
pushad
mov edx,[color_tbl+4*5]
mov edx,[color_tbl.back]
test eax,0x00010000
jz @f
mov edx,[color_tbl+4*8]
mov edx,[color_tbl.line.moded]
test eax,0x00020000
jz @f
mov edx,[color_tbl+4*9]
mov edx,[color_tbl.line.saved]
@@: mov ebx,[left_ofs]
add ebx,-LCHGW-2;-4
@ -513,12 +598,12 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
or eax,eax
ja .next_block
add esp,4*2
jmp .exit ; .draw_cursor
jmp .exit
.next_block:
push esi ecx
call get_next_part
call .get_next_part
pop ebx
push ecx
@ -526,30 +611,28 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
push esi ebx
mov eax,ebx
sub ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col]
sub ebx,[cur_editor.TopLeft.X]
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_editor.TopLeft.X] ;! eax,[left_col]
sub eax,[cur_editor.TopLeft.X]
jge .qqq
sub edx,eax
add esi,eax
; mov eax,OLEFT*65536
xor eax,eax
jmp .qqq2
.qqq:
; inc eax
imul eax,6*65536
.qqq2:
and ebx,0x0000FFFF
add eax,[left_ofs-2];OLEFT*65536
add eax,[left_ofs-2]
add ebx,eax
mov eax,[esp] ; ebx
add eax,[esp+4] ; esi
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
sub eax,[cur_editor.TopLeft.X]
sub eax,[columns.scr]
jle .qweqwe
sub esi,eax
@ -573,7 +656,7 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
mov esi,[sel.begin.x]
sub esi,[esp]
pushad
mov ecx,[cur_editor.TopLeft.X] ;! ecx,[left_col]
mov ecx,[cur_editor.TopLeft.X]
sub ecx,[esp+4*8]
jle @f
sub esi,ecx
@ -585,7 +668,7 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
add bx,si
rol ebx,16
mov esi,eax
mov ecx,[color_tbl+4*6]
mov ecx,[color_tbl.text.sel]
mcall 4
popad
jmp .draw_t
@ -603,14 +686,14 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
sub eax,[esp]
push ebx
mov ebx,[esp+4]
sub ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col]
sub ebx,[cur_editor.TopLeft.X]
jge .ya2.1
add eax,ebx
.ya2.1:
pop ebx
pushad
mov esi,eax
mov ecx,[color_tbl+4*6]
mov ecx,[color_tbl.text.sel]
mcall 4
popad
sub esi,eax
@ -635,7 +718,7 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
sub esi,[esp]
push eax
mov eax,[esp+4]
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
sub eax,[cur_editor.TopLeft.X]
jge .nt3.1
add esi,eax
.nt3.1:
@ -647,7 +730,7 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
add ebx,esi
mov esi,[sel.end.x]
sub esi,[sel.begin.x]
mov ecx,[color_tbl+4*6]
mov ecx,[color_tbl.text.sel]
sub eax,esi
push eax
mcall 4
@ -665,30 +748,32 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
cmp eax,[sel.end.x]
jge .ya2
;---[ block inside selection ]-----------------(-
.ya4: mov ecx,[color_tbl+4*6]
.ya4: mov ecx,[color_tbl.text.sel]
;----------------------------------------------)-
.draw_t:
mcall 4;[esp+8]
mcall 4
.skip_t:
pop eax eax ; ebx esi
imul eax,6
add [esp+4*2+2],ax
pop ecx esi
cmp ecx,[cur_line_len];LINE_WIDTH
cmp ecx,[cur_line_len]
jl .next_block
pop ebx ecx
and ebx,0x0000FFFF
add ebx,[left_ofs-2]
add ebx,LINEH
add esi,[cur_line_len];LINE_WIDTH
add esi,[cur_line_len]
inc dword[esp]
dec ecx
jg .next_line
.exit:
cmp [draw_blines],0
je .exit.2
mov eax,[cur_editor.Bounds.Left]
add eax,[cur_editor.Gutter.Width]
inc eax
@ -697,7 +782,7 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
mov bx,word[cur_editor.Bounds.Right]
sub bx,ax
add ebx,-SCRLW
mov edx,[color_tbl+4*5]
mov edx,[color_tbl.back]
mov eax,13
mov ecx,[esp-8]
add ecx,LINEH
@ -719,11 +804,130 @@ func draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
add ecx,-(SCRLW-1)*65536+SCRLW-1
mcall
.exit.2:
popad
add esp,4
ret
endf
;-----------------------------------------------------------------------------
func draw_editor_text.get_next_part ;/////////////////////////////////////////
;-----------------------------------------------------------------------------
; Input:
; ECX = current letter
; ESI = string
; Output:
; ECX = color
; EDX = string
; ESI = length
;-----------------------------------------------------------------------------
cmp [cur_editor.AsmMode],0
je .plain.text
xor ebx,ebx
mov edx,ecx
add esi,ecx
mov edi,symbols
mov al,[esi]
cmp al,';'
je .comment
mov ecx,symbols.size
repne scasb
je .symbol
cmp al,'$'
jne @f
mov edi,symbols
mov al,[esi+1]
mov ecx,symbols.size
repne scasb
je .not_symbol
jmp .number
@@: cmp al,'0'
jb @f
cmp al,'9'
jbe .number
@@: cmp al,"'"
je .string
cmp al,'"'
je .string
.not_symbol:
inc ebx
inc edx
cmp edx,[cur_line_len]
jge @f
mov edi,symbols
mov al,[esi+ebx]
cmp al,';'
je @f
mov ecx,symbols.size
repne scasb
jne .not_symbol
@@: mov ecx,edx
mov edx,esi
mov esi,ebx
mov eax,[color_tbl.text]
ret
.symbol:
inc ebx
inc edx
cmp edx,[cur_line_len]
jge @f
mov edi,symbols
mov al,[esi+ebx]
mov ecx,symbols.size
repne scasb
je .symbol
@@: mov ecx,edx
mov edx,esi
mov esi,ebx
mov eax,[color_tbl.symbol]
ret
.comment:
neg edx
add edx,[cur_line_len]
xchg edx,esi
mov ecx,[cur_line_len]
mov eax,[color_tbl.comment]
ret
.number:
inc ebx
inc edx
cmp edx,[cur_line_len]
jge @f
mov edi,symbols
mov al,[esi+ebx]
cmp al,';'
je @f
mov ecx,symbols.size
repne scasb
jne .number
@@: mov ecx,edx
mov edx,esi
mov esi,ebx
mov eax,[color_tbl.number]
ret
.string:
inc ebx
inc edx
cmp edx,[cur_line_len]
jge @f
cmp [esi+ebx],al
jne .string
inc ebx
inc edx
@@:
mov ecx,edx
mov edx,esi
mov esi,ebx
mov eax,[color_tbl.string]
ret
.plain.text:
mov edx,[cur_line_len]
xchg edx,esi
mov ecx,[cur_line_len]
mov eax,[color_tbl.text]
ret
endf
;-----------------------------------------------------------------------------
func draw_editor_caret ;///// DRAW EDITOR TEXT CARET /////////////////////////
;-----------------------------------------------------------------------------
@ -781,3 +985,188 @@ func editor_realloc_lines ;///// ADD $DELTA$ TO LINES SIZE ///////////////////
pop ecx ebx
ret
endf
REDRAW_TEXT = 00000001b
REDRAW_HSCROLL = 00000010b
REDRAW_VSCROLL = 00000100b
REDRAW_ONELINE = 00001000b
REDRAW_TWOLINES = 00010000b
;-----------------------------------------------------------------------------
func editor_check_for_changes ;///// EDITOR CHANGES CHECKER //////////////////
;-----------------------------------------------------------------------------
call .check_cursor_visibility
xor edx,edx
mov eax,[cur_editor.TopLeft.Y]
cmp eax,[checker_ed.TopLeft.Y]
je @f
or dl,REDRAW_TEXT+REDRAW_VSCROLL
@@: mov eax,[cur_editor.TopLeft.X]
cmp eax,[checker_ed.TopLeft.X]
je @f
or dl,REDRAW_TEXT+REDRAW_HSCROLL
@@: or dl,dl
jnz .redraw
mov eax,[cur_editor.Caret.Y]
cmp eax,[checker_ed.Caret.Y]
je @f
or dl,REDRAW_TWOLINES
@@: mov eax,[cur_editor.Caret.X]
cmp eax,[checker_ed.Caret.X]
je @f
or dl,REDRAW_ONELINE
@@: mov ebp,cur_editor
call init_sel_vars
mov al,[sel.selected]
mov ebp,checker_ed
call init_sel_vars
cmp al,[sel.selected]
je @f
cmp al,0
je .clear_sel
jmp .draw_sel
@@: cmp al,0
jne .redraw_sel
or dl,dl
jz .exit
test dl,REDRAW_TWOLINES
jz .one_line
push edx
mov eax,[checker_ed.Caret.Y]
mov ebx,eax
call draw_editor_text.part
pop edx
.one_line:
mov eax,[cur_editor.Caret.Y]
mov ebx,eax
call draw_editor_text.part
call draw_editor_caret
jmp .exit
.clear_sel:
;// use checker_ed
mov eax,[sel.begin.y]
mov ebx,[sel.end.y]
push eax ebx
call draw_editor_text.part
pop edx ecx
mov eax,[cur_editor.Caret.Y]
cmp eax,ecx
jb @f
cmp eax,edx
jbe .lp1
@@: mov ebx,eax
call draw_editor_text.part
.lp1: call draw_editor_caret
jmp .exit
.draw_sel:
;// use cur_editor
mov ebp,cur_editor
call init_sel_vars
mov eax,[sel.begin.y]
mov ebx,[sel.end.y]
push eax ebx
call draw_editor_text.part
pop edx ecx
mov eax,[checker_ed.Caret.Y]
cmp eax,ecx
jb @f
cmp eax,edx
jbe .lp2
@@: mov ebx,eax
call draw_editor_text.part
.lp2: call draw_editor_caret
jmp .exit
.redraw_sel:
;// use checker_ed and cur_editor
mov eax,[checker_ed.Caret.Y]
mov ebx,[cur_editor.Caret.Y]
cmp eax,ebx
jb @f
xchg eax,ebx
@@: call draw_editor_text.part
call draw_editor_caret
jmp .exit
.redraw:
push edx
call draw_editor_gutter
call draw_editor_text
call draw_editor_caret
test byte[esp],REDRAW_VSCROLL
jz @f
call draw_editor_vscroll
@@: pop edx
test dl,REDRAW_HSCROLL
jz @f
call draw_editor_hscroll
@@: jmp .exit
.exit:
mov esi,cur_editor
mov edi,checker_ed
mov ecx,sizeof.EDITOR/4
cld
rep movsd
ret
.check_cursor_visibility:
push eax ebx
.chk_y:
mov eax,[cur_editor.Caret.Y]
or eax,eax
jge @f
mov [cur_editor.Caret.Y],0
jmp .chk_dy
@@: cmp eax,[cur_editor.Lines.Count]
jl .chk_dy
mov eax,[cur_editor.Lines.Count]
dec eax
mov [cur_editor.Caret.Y],eax
.chk_dy:
mov eax,[cur_editor.TopLeft.Y]
cmp eax,[cur_editor.Caret.Y]
jle @f
m2m [cur_editor.TopLeft.Y],[cur_editor.Caret.Y]
@@: add eax,[lines.scr]
cmp eax,[cur_editor.Caret.Y]
jg .chk_x
mov eax,[cur_editor.Caret.Y]
sub eax,[lines.scr]
inc eax
mov [cur_editor.TopLeft.Y],eax
.chk_x:
mov eax,[cur_editor.Caret.X]
or eax,eax
jge @f
mov [cur_editor.Caret.X],0
jmp .chk_dx
@@: cmp eax,[cur_editor.Columns.Count]
jl .chk_dx
mov eax,[cur_editor.Columns.Count]
mov [cur_editor.Caret.X],eax
.chk_dx:
mov eax,[cur_editor.TopLeft.X]
cmp eax,[cur_editor.Caret.X]
jle @f
m2m [cur_editor.TopLeft.X],[cur_editor.Caret.X]
@@: add eax,[columns.scr]
cmp eax,[cur_editor.Caret.X]
jg @f
mov eax,[cur_editor.Caret.X]
sub eax,[columns.scr]
inc eax
mov [cur_editor.TopLeft.X],eax
@@: cmp [mev],MEV_LDOWN
jne @f
push [cur_editor.Caret.X] [cur_editor.Caret.Y]
pop [cur_editor.SelStart.Y] [cur_editor.SelStart.X]
@@: pop ebx eax
ret
endf

View File

@ -9,7 +9,7 @@ func save_file ;//////////////////////////////////////////////////////////////
rep movsb
mov byte[edi],0
mov esi,[cur_editor.Lines] ;! AREA_EDIT ; 0x70000 = 448 Kbytes (maximum)
mov esi,[cur_editor.Lines]
xor ebx,ebx
mov ecx,[cur_editor.Lines.Count]
@ -24,31 +24,20 @@ func save_file ;//////////////////////////////////////////////////////////////
call mem.Alloc
push eax
mov esi,[cur_editor.Lines]
mov edi,eax ;!!! AREA_TEMP
; pop eax
; ret ; DISALLOW FOR NOW
mov edi,eax
.new_string:
call save_string
cmp dword[esi],0
jne .new_string
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
; call file_not_found
; jmp .exit.2
sub edi,eax
add edi,-2 ; minus last CRLF
.systree_save:
mov [f_info70+0],2
mov [f_info70+12],edi
mov [f_info70+16],eax ;!!! AREA_TEMP
mov [f_info70+16],eax
mov byte[f_info70+20],0
mov [f_info70+21],f_info.path
mcall 70,f_info70
@ -59,7 +48,7 @@ func save_file ;//////////////////////////////////////////////////////////////
jnz .exit.2
.exit:
mov [cur_editor.Modified],0 ;! [modified],0
mov [cur_editor.Modified],0
clc
ret
@ -76,7 +65,6 @@ func save_string ;////////////////////////////////////////////////////////////
jz @f
or dword[esi],0x00020000
@@: add esi,4
; mov ecx,eax
@@: cmp byte[esi+ecx-1],' '
jne @f
@ -89,8 +77,6 @@ func save_string ;////////////////////////////////////////////////////////////
.next_char:
mov al,[esi+ebx]
inc ebx
; cmp [asm_mode],0
; je .put
test [options],OPTS_OPTIMSAVE
jz .put
test ah,00000001b
@ -206,8 +192,16 @@ func load_file ;//////////////////////////////////////////////////////////////
.file_found:
mov ecx,eax
call create_tab
push ecx esi edi
cmp [tab_bar.Items.Count],1
jne @f
cmp [cur_editor.FilePath],'/'
je @f
cmp [cur_editor.Modified],0
jne @f
mov ebp,cur_editor
jmp .lp1
@@: call create_tab
.lp1: push ecx esi edi
mov esi,tb_opensave.text
lea edi,[ebp+TABITEM.Editor.FilePath]
movzx ecx,[tb_opensave.length]
@ -225,6 +219,32 @@ func load_file ;//////////////////////////////////////////////////////////////
call load_from_memory
mov eax,[f_info70+16]
call mem.Free
xor eax,eax
mov [cur_editor.TopLeft.Y],eax
mov [cur_editor.TopLeft.X],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 [cur_editor.Modified],al
mov [cur_editor.AsmMode],al
lea ebx,[cur_editor.FilePath]
mov eax,ebx
call strlen
mov ecx,dword[ebx+eax-3]
or ecx,0x202020
cmp ecx,'asm'
jne @f
inc [cur_editor.AsmMode]
jmp .nocol
@@: cmp ecx,'inc'
jne .nocol
inc [cur_editor.AsmMode]
.nocol:
call update_caption
clc
ret
endf
@ -236,22 +256,14 @@ 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
; DEBUGF 1,"lines in file: %d\n",eax
mov [ebp+EDITOR.Lines.Count],eax
lea edx,[ebx+ecx]
imul ebx,eax,14
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
@ -288,10 +300,10 @@ func load_from_memory ;///////////////////////////////////////////////////////
sub eax,10
jnz @f
inc eax
@@: cmp eax,[ebp+EDITOR.Columns.Count] ;! eax,[columns]
@@: cmp eax,[ebp+EDITOR.Columns.Count]
jbe @f
mov [ebp+EDITOR.Columns.Count],eax ;! [columns],eax
@@: mov [ebp+EDITOR.Modified],0 ;! [modified],0
mov [ebp+EDITOR.Columns.Count],eax
@@: mov [ebp+EDITOR.Modified],0
ret
.CR: cmp byte[esi],10
@ -304,11 +316,10 @@ func load_from_memory ;///////////////////////////////////////////////////////
lea eax,[edi-4]
sub eax,ebx
mov [ebx],eax
; inc [cur_editor.Lines] ;! [lines]
add eax,-10
cmp eax,[ebp+EDITOR.Columns.Count] ;! eax,[columns]
cmp eax,[ebp+EDITOR.Columns.Count]
jbe .next_line
mov [ebp+EDITOR.Columns.Count],eax ;! [columns],eax
mov [ebp+EDITOR.Columns.Count],eax
jmp .next_line
.TB: lea eax,[edi-4]

File diff suppressed because it is too large Load Diff

View File

@ -17,9 +17,9 @@ menubar_res main_menu,\
en,'Options' ,mm.Options ,onshow.options,\
\
et,'Fail' ,mm.File ,onshow.file ,\
et,'Muuda' ,mm.Edit ,onshow.edit ,\
et,'Muuda' ,mm.Edit ,onshow.edit ,\
et,'Otsi' ,mm.Search ,onshow.search ,\
et,'Käivita' ,mm.Run ,onshow.run ,\
et,'Käivita' ,mm.Run ,onshow.run ,\
et,'Kodeering',mm.Encoding,onshow.recode ,\
et,'Seaded' ,mm.Options ,onshow.options
@ -42,14 +42,14 @@ popup_res mm.File,\
en,'-' ,'' , ,\
en,'Exit' ,'Alt+X' ,Exit,\
\
et,'Uus' ,'Ctrl+N' ,New ,\
et,'Ava...' ,'Ctrl+O' ,Open ,\
et,'Salvesta' ,'Ctrl+S' ,Save ,\
et,'Uus' ,'Ctrl+N' ,New ,\
et,'Ava...' ,'Ctrl+O' ,Open ,\
et,'Salvesta' ,'Ctrl+S' ,Save ,\
et,'Salvesta nimega...','Ctrl+Shift+S',SaveAs,\
et,'-' ,'' , ,\
et,'Sulge' ,'Ctrl+F4' ,Close ,\
et,'-' ,'' , ,\
et,'Välju' ,'Alt+X' ,Exit
et,'-' ,'' , ,\
et,'Sulge' ,'Ctrl+F4' ,Close ,\
et,'-' ,'' , ,\
et,'Välju' ,'Alt+X' ,Exit
popup_res mm.Edit,\
ru,'‚ë१ âì' ,'Ctrl+X',Cut ,\
@ -87,7 +87,7 @@ popup_res mm.Search,\
en,'Replace...' ,'Ctrl+H',Replace ,\
\
et,'Positsioon...','Ctrl+G',Position,\
et,'-' ,'' , ,\
et,'-' ,'' , ,\
et,'Leia...' ,'Ctrl+F',Find ,\
et,'Leia järgmine','F3' ,FindNext,\
et,'Asenda...' ,'Ctrl+H',Replace
@ -152,6 +152,11 @@ popup_res mm.Options,\
et,'-' ,'', ,\
et,'Rea numbrid' ,'',LineNumbers
lsz s_defname,\
en,<'Untitled',0>,\
ru,<'<27>¥§ë¬ï­­ë©',0>,\
et,<'Nimetu',0>
lsz s_modified,\
ru,'ˆ§¬¥­¥­®',\
en,'Modified',\
@ -183,6 +188,14 @@ lsz s_2cancel,\
ru,'Žâ¬¥­ ',\
en,'Cancel',\
et,'Tühista'
lsz s_color,\
ru,'–¢¥â: 0x',\
en,'Color: 0x',\
et,'Color: 0x'
lsz s_tabpos,\
ru,'<27> á¯®«®¦¥­¨¥ § ª« ¤®ª',\
en,'Tabs placement',\
et,'Tabs placement'
lsz s_enter_filename,\
ru,<'‚¢¥¤¨â¥ ¨¬ï ä ©« ',0>,\
@ -244,6 +257,28 @@ lszc s_fs_error,b,\
et,<'Juurdepääs keelatud (10)',0>,\
et,<'Seadme viga (11)',0>
lszc s_appearance,b,\
ru,'’¥ªáâ',\
ru,'”®­',\
ru,'’¥ªá⠢뤥«¥­¨ï',\
ru,'”®­ ¢ë¤¥«¥­¨ï',\
ru,'‘¨¬¢®«ë',\
ru,'—¨á« ',\
ru,'‘âப¨',\
ru,'Š®¬¬¥­â à¨¨',\
ru,'ˆ§¬¥­ñ­ë¥ áâப¨',\
ru,'‘®åà ­ñ­­ë¥ áâப¨',\
\
en,'Text',\
en,'Background',\
en,'Selection text',\
en,'Selection background',\
en,'Symbols',\
en,'Numbers',\
en,'Strings',\
en,'Comments',\
en,'Modified lines',\
en,'Saved lines'
lsz sysfuncs_filename,\
ru,<'SYSFUNCR.TXT',0>,\

View File

@ -3,9 +3,9 @@ func check_mouse_in_edit_area
mov ebx,eax
and ebx,0x0000FFFF
shr eax,16
mov ecx,[cur_editor.Bounds.Top] ; ecx,[top_ofs]
mov ecx,[cur_editor.Bounds.Top]
inc ecx
pushd [cur_editor.Bounds.Left] ecx [cur_editor.Bounds.Right] ecx ; [left_ofs] ATOPH [p_info.client_box.width] ATOPH
pushd [cur_editor.Bounds.Left] ecx [cur_editor.Bounds.Right] ecx
popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
sub [__rc+0x8],SCRLW+6
mov ecx,[cur_editor.Gutter.Width]
@ -69,10 +69,10 @@ mouse:
pop eax
jne still.skip_write
@@:
cmp [just_from_popup],0
je @f
cmp al,MEV_LUP
jne still.skip_write
;!!! cmp [just_from_popup],0
;!!! je @f
;!!! cmp al,MEV_LUP
;!!! jne still.skip_write
@@: mov [mev],al
jmp [mouse_ev+eax*4-4]
@ -101,7 +101,6 @@ mouse:
pop [mi_cur]
cmp [popup_active],0
je still.skip_write
; mcall 18,2,[h_popup]
mov ecx,[mi_cur]
or ecx,ecx
js still.skip_write
@ -110,7 +109,6 @@ mouse:
call dword[main_menu.onshow+ecx*4-4]
call setup_main_menu_popup
mcall 60,2,[h_popup],POPUP_STACK,4
; mcall 51,1,popup_thread_start,POPUP_STACK
jmp still.skip_write
@ -150,88 +148,76 @@ mouse:
call clear_selection
.check_body.2:
sub eax,[cur_editor.Bounds.Left] ; eax,[left_ofs]
sub ebx,[cur_editor.Bounds.Top] ; ebx,[top_ofs]
sub eax,[cur_editor.Bounds.Left]
sub ebx,[cur_editor.Bounds.Top]
sub eax,[cur_editor.Gutter.Width]
sub eax,LCHGW
sub ebx,2
; sub ebx,[__rc+0x4]
push eax
mov eax,ebx
cdq;xor edx,edx
cdq
mov ecx,LINEH
idiv ecx
@@: add eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
@@: add eax,[cur_editor.TopLeft.Y]
mov ebx,eax
pop eax
cdq;xor edx,edx
cdq
mov ecx,6
idiv ecx
@@: add eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
@@: add eax,[cur_editor.TopLeft.X]
cmp eax,[cur_editor.Columns.Count] ;! eax,[columns]
cmp eax,[cur_editor.Columns.Count]
jl @f
mov eax,[cur_editor.Columns.Count] ;! eax,[columns]
@@: cmp ebx,[cur_editor.Lines.Count] ;! ebx,[lines]
mov eax,[cur_editor.Columns.Count]
@@: cmp ebx,[cur_editor.Lines.Count]
jl @f
mov ebx,[cur_editor.Lines.Count] ;! ebx,[lines]
mov ebx,[cur_editor.Lines.Count]
dec ebx
@@:
cmp [cur_editor.Caret.X],eax ;! [pos.x],eax
cmp [cur_editor.Caret.X],eax
jne .change_cur_pos
cmp [cur_editor.Caret.Y],ebx ;! [pos.y],ebx
je still.skip_write
cmp [cur_editor.Caret.Y],ebx
jne .change_cur_pos
call editor_check_for_changes
jmp still.skip_write
.change_cur_pos:
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
; je @f
; push ebx
; mov ebx,eax
; call drawfile.ex
; pop eax
; @@: mov ebx,eax
call draw_file.ex
.check_ldown:
mov [cur_editor.Caret.X],eax
mov [cur_editor.Caret.Y],ebx
call editor_check_for_changes
jmp still
.check_vscroll:
;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]
sub ecx,SCRLW-1
pushd ecx [cur_editor.Bounds.Top] ecx [cur_editor.Bounds.Bottom]
popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
add [__rc+0x8],SCRLW-2;!!!!!!!!!!!!!!-2
add [__rc+0x4],SCRLW-1;!!!!!!!!!!!!!!+1
sub [__rc+0xC],SCRLW*2+1;3
add [__rc+0x8],SCRLW-2
add [__rc+0x4],SCRLW-1
sub [__rc+0xC],SCRLW*2+1
mov ecx,__rc
call pt_in_rect
jnc .check_hscroll
.check_vscroll.2:
sub ebx,[cur_editor.Bounds.Top] ; ebx,[top_ofs]
sub ebx,SCRLW;!!!!!!!!!!!!!!+1
; sub ebx,[__rc+0x4]
sub ebx,[cur_editor.Bounds.Top]
sub ebx,SCRLW
cmp [vscrl_capt],0
jge .vcaptured
mov eax,[cur_editor.VScroll.Top] ;! eax,[vscrl_top]
mov eax,[cur_editor.VScroll.Top]
cmp ebx,eax
jb .center_vcapture
add eax,[cur_editor.VScroll.Size] ;! eax,[vscrl_size]
add eax,[cur_editor.VScroll.Size]
cmp ebx,eax
jae .center_vcapture
mov eax,ebx
sub eax,[cur_editor.VScroll.Top] ;! eax,[vscrl_top]
sub eax,[cur_editor.VScroll.Top]
dec eax
mov [vscrl_capt],eax
dec ebx
jmp .vcaptured
.center_vcapture:
mov eax,[cur_editor.VScroll.Size] ;! eax,[vscrl_size]
mov eax,[cur_editor.VScroll.Size]
shr eax,1
mov [vscrl_capt],eax
.vcaptured:
@ -239,32 +225,32 @@ mouse:
jns @f
xor ebx,ebx
@@: mov [mouse_captured],1
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
mov eax,[cur_editor.Bounds.Bottom]
sub eax,[cur_editor.Bounds.Top]
sub eax,[cur_editor.VScroll.Size]
sub eax,SCRLW*3
cmp eax,ebx
jge @f
mov ebx,eax
@@:
mov [cur_editor.VScroll.Top],ebx ;! [vscrl_top],ebx
mov eax,[cur_editor.Lines.Count] ;! eax,[lines]
mov [cur_editor.VScroll.Top],ebx
mov eax,[cur_editor.Lines.Count]
sub eax,[lines.scr]
imul ebx
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]
mov ebx,[cur_editor.Bounds.Bottom]
sub ebx,[cur_editor.Bounds.Top]
sub ebx,SCRLW*3
sub ebx,[cur_editor.VScroll.Size]
idiv ebx
cmp eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
cmp eax,[cur_editor.TopLeft.Y]
je still.skip_write
mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax
mov [cur_editor.TopLeft.Y],eax
call check_bottom_right
call draw_file
call draw_editor
jmp still.skip_write
.check_hscroll:
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]
pushd [cur_editor.Bounds.Left] [cur_editor.Bounds.Bottom] [cur_editor.Bounds.Right] [cur_editor.Bounds.Bottom]
popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
add [__rc+0x8],-SCRLW*2-1
add [__rc+0x4],-SCRLW+1
@ -276,26 +262,24 @@ mouse:
.check_hscroll.2:
mov ebx,eax
;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
mov eax,[cur_editor.HScroll.Top] ;! eax,[hscrl_top]
mov eax,[cur_editor.HScroll.Top]
cmp ebx,eax
jl .center_hcapture
add eax,[cur_editor.HScroll.Size] ;! eax,[hscrl_size]
add eax,[cur_editor.HScroll.Size]
cmp ebx,eax
jge .center_hcapture
mov eax,ebx
sub eax,[cur_editor.HScroll.Top] ;! eax,[hscrl_top]
sub eax,[cur_editor.HScroll.Top]
dec eax
mov [hscrl_capt],eax
dec ebx
jmp .hcaptured
.center_hcapture:
mov eax,[cur_editor.HScroll.Size] ;! eax,[hscrl_size]
mov eax,[cur_editor.HScroll.Size]
shr eax,1
mov [hscrl_capt],eax
.hcaptured:
@ -303,26 +287,26 @@ mouse:
jns @f
xor ebx,ebx
@@: mov [mouse_captured],1
mov eax,[cur_editor.Bounds.Right] ; eax,[p_info.box.width]
sub eax,[cur_editor.HScroll.Size] ;! eax,[hscrl_size]
sub eax,SCRLW*3+1 ; eax,SCRLW*3+10+1
mov eax,[cur_editor.Bounds.Right]
sub eax,[cur_editor.HScroll.Size]
sub eax,SCRLW*3+1
cmp eax,ebx
jge @f
mov ebx,eax
@@:
mov [cur_editor.HScroll.Top],ebx ;! [hscrl_top],ebx
mov eax,[cur_editor.Columns.Count] ;! eax,[columns]
mov [cur_editor.HScroll.Top],ebx
mov eax,[cur_editor.Columns.Count]
sub eax,[columns.scr]
imul ebx
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]
mov ebx,[cur_editor.Bounds.Right]
sub ebx,SCRLW*3+1
sub ebx,[cur_editor.HScroll.Size]
idiv ebx
cmp eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
cmp eax,[cur_editor.TopLeft.X]
je still.skip_write
mov [cur_editor.TopLeft.X],eax ;! [left_col],eax
mov [cur_editor.TopLeft.X],eax
call check_bottom_right
call draw_file
call draw_editor
jmp still.skip_write
.check_main_menu:
@ -353,5 +337,5 @@ mouse:
mov [hscrl_capt],eax
mov [body_capt],eax
mov [mouse_captured],0
mov [just_from_popup],0
;!!! mov [just_from_popup],0
jmp still.skip_write

View File

@ -1,3 +1,4 @@
;POP_WIDTH = (popup_text.max_title+popup_text.max_accel+6)*6
POP_IHEIGHT = 16
;POP_HEIGHT = popup_text.cnt_item*POP_IHEIGHT+popup_text.cnt_sep*4+4
@ -44,14 +45,13 @@ popup_thread_start:
cmp eax,7
jne still_popup
mov ebp,[POPUP_STACK];-32+12+4]
mov ebp,[POPUP_STACK]
mov dword[POPUP_STACK-32+4],8
movzx ebx,[ebp+POPUP.x]
movzx ecx,[ebp+POPUP.y]
movzx edx,[ebp+POPUP.width]
movzx esi,[ebp+POPUP.height]
mcall 67
; call draw_popup_wnd
jmp still_popup
mouse_popup:
@ -75,7 +75,7 @@ popup_thread_start:
jz still_popup
mov ebx,[ebp+POPUP.actions]
mov [just_from_popup],1
call dword[ebx+eax*4-4];dword[popup_text.actions+eax*4-4]
call dword[ebx+eax*4-4]
inc [just_from_popup]
jmp close_popup
@ -98,18 +98,12 @@ popup_thread_start:
close_popup:
mcall 18,3,[p_info.PID]
mov [popup_active],0
mov [mi_cur],0
mcall -1
func draw_popup_wnd
mcall 12,1
; mcall 48,3,sc,sizeof.system_colors
; call calc_3d_colors
; mov ebx,[p_pos]
; mov ecx,[p_pos-2]
; mov bx,POP_WIDTH
; mov cx,POP_HEIGHT
mov ebx,dword[ebp+POPUP.x-2]
mov bx,[ebp+POPUP.width]
mov ecx,dword[ebp+POPUP.y-2]
@ -118,20 +112,14 @@ func draw_popup_wnd
movzx ebx,bx
movzx ecx,cx
pushd 0 0 ebx ecx ;POP_WIDTH POP_HEIGHT
pushd 0 0 ebx ecx
call draw_3d_panel
mov [pi_sel],0
; mcall 37,1
; movsx ebx,ax
; sar eax,16
; mov [c_pos.x],eax
; mov [c_pos.y],ebx
mov eax,4
mpack ebx,3*6,3
mov ecx,[sc.work_text]
mov edx,[ebp+POPUP.data];popup_text.data
mov edx,[ebp+POPUP.data]
@@: inc [pi_sel]
inc edx
movzx esi,byte[edx-1]
@ -143,18 +131,17 @@ func draw_popup_wnd
mov cx,bx
movzx ebx,[ebp+POPUP.width]
add ebx,0x00010000-1
; mpack ebx,1,POP_WIDTH-1
add ecx,0x00010001
mcall 38,,,[cl_3d_inset];0x006382BF;[sc.work_text]
mcall 38,,,[cl_3d_inset]
add ecx,0x00010001
mcall ,,,[cl_3d_outset];0x00FFFFFF
mcall ,,,[cl_3d_outset]
popad
add ebx,4
jmp .lp2
.lp1: mov edi,[pi_sel]
cmp edi,[pi_cur]
jne .lp3
test byte[ebp+edi-1],0x01 ; byte[popup_text+edi-1],0x01
test byte[ebp+edi-1],0x01
jz .lp3
pushad
movzx ecx,bx
@ -162,15 +149,14 @@ func draw_popup_wnd
mov cl,POP_IHEIGHT-1
movzx ebx,[ebp+POPUP.width]
add ebx,0x00010000-1
; mpack ebx,1,POP_WIDTH-1
mcall 13,,,[cl_3d_pushed];0x00A3B8CC
mcall 13,,,[cl_3d_pushed]
rol ecx,16
mov ax,cx
rol ecx,16
mov cx,ax
mcall 38,,,[cl_3d_inset];0x006382BF
mcall 38,,,[cl_3d_inset]
add ecx,(POP_IHEIGHT-1)*65536+POP_IHEIGHT-1
mcall ,,,[cl_3d_outset];0x00FFFFFF
mcall ,,,[cl_3d_outset]
popad
.lp3: add ebx,(POP_IHEIGHT-7)/2
@ -185,32 +171,30 @@ func draw_popup_wnd
call draw_check
.lp8: popad
mov ecx,[sc.work_text];0x00000000
test byte[ebp+edi-1],0x01 ; byte[popup_text+edi-1],0x01
mov ecx,[sc.work_text]
test byte[ebp+edi-1],0x01
jnz .lp5
add ebx,0x00010001
mov ecx,[cl_3d_outset]
mcall
sub ebx,0x00010001
mov ecx,[cl_3d_inset]
;mov ecx,[sc.grab_text];0x007F7F7F
.lp5: mcall
push ebx
add edx,esi
inc edx
movzx esi,byte[edx-1]
add ebx,[ebp+POPUP.acc_ofs] ; ((popup_text.max_title+2)*6-1)*65536
add ebx,[ebp+POPUP.acc_ofs]
cmp edi,[pi_cur]
je .lp4
mov ecx,[cl_3d_inset];0x006382BF
.lp4: test byte[ebp+edi-1],0x01 ; byte[popup_text+edi-1],0x01
mov ecx,[cl_3d_inset]
.lp4: test byte[ebp+edi-1],0x01
jnz .lp6
add ebx,0x00010001
mov ecx,[cl_3d_outset]
mcall
sub ebx,0x00010001
mov ecx,[cl_3d_inset]
;mov ecx,[sc.grab_text];0x007F7F7F
.lp6: mcall
pop ebx
add ebx,POP_IHEIGHT-(POP_IHEIGHT-7)/2
@ -271,7 +255,7 @@ onshow:
.recode:
ret
.options:
mov word[mm.Options+0],0
;mov word[mm.Options+0],0
mov byte[mm.Options+5],0
or byte[mm.Options+2],0x02
test [options],OPTS_SECURESEL
@ -298,4 +282,4 @@ onshow:
pi_sel dd ?
pi_cur dd ?
p_pos dd ?
popup_active db 0
popup_active db 0

View File

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

View File

@ -1,9 +1,3 @@
lsz s_defname,\
en,<'Untitled',0>,\
ru,<'Untitled',0>,\
et,<'Nimetu',0>
;-----------------------------------------------------------------------------
func flush_cur_tab ;///// SAVE CURRENT TAB DATA TO CONTROL ///////////////////
;-----------------------------------------------------------------------------
@ -33,7 +27,7 @@ func set_cur_tab ;///// SET SPECIFIED TAB CURRENT (FOCUS IT) /////////////////
mov ecx,sizeof.TABITEM/4
rep movsd
mov [tab_bar.Current.Ptr],ebp
call update_caption
; call update_caption
pop edi esi ecx
ret
endf
@ -41,6 +35,7 @@ endf
;-----------------------------------------------------------------------------
func make_tab_visible ;///// MAKE SPECIFIED TAB VISIBLE IF IT'S OFFSCREEN ////
;-----------------------------------------------------------------------------
call flush_cur_tab
imul eax,[tab_bar.Items.Left],sizeof.TABITEM
add eax,[tab_bar.Items]
cmp eax,ebp
@ -52,20 +47,19 @@ func make_tab_visible ;///// MAKE SPECIFIED TAB VISIBLE IF IT'S OFFSCREEN ////
push ebp
call get_hidden_tabitems_number
cmp ebp,[esp]
ja .lp1
ja @f
@@: inc [tab_bar.Items.Left]
call get_hidden_tabitems_number
cmp ebp,[esp]
jbe @b
@@: inc [tab_bar.Items.Left]
.lp1: pop ebp
@@: pop ebp
ret
.go_left:
mov eax,ebp
sub eax,[tab_bar.Items]
jz @f
cwde
cdq
mov ebx,sizeof.TABITEM
div ebx
@@: mov [tab_bar.Items.Left],eax
@ -75,7 +69,6 @@ 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]
@ -91,7 +84,6 @@ func create_tab ;///// ADD TAB TO THE END ////////////////////////////////////
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
@ -125,14 +117,16 @@ func create_tab ;///// ADD TAB TO THE END ////////////////////////////////////
mov [cur_editor.AsmMode],0
call flush_cur_tab
mov ebp,[tab_bar.Current.Ptr]
call make_tab_visible
call update_caption
;call drawwindow
cmp [do_not_draw],0
jne @f
call align_editor_in_tab
call draw_editor
call draw_tabctl
call draw_statusbar
call update_caption
@@:
mov ebp,cur_tab
pop edi esi ecx eax
@ -142,7 +136,6 @@ endf
;-----------------------------------------------------------------------------
func delete_tab ;///// DELETE SPECIFIED TAB //////////////////////////////////
;-----------------------------------------------------------------------------
; 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]
@ -188,7 +181,6 @@ func delete_tab ;///// DELETE SPECIFIED TAB //////////////////////////////////
@@: mov [tab_bar.Current.Ptr],0
call set_cur_tab
call make_tab_visible
;call drawwindow
call align_editor_in_tab
call draw_editor
call draw_tabctl
@ -382,7 +374,7 @@ func draw_tabctl ;///// DRAW TAB CONTROL /////////////////////////////////////
call dword[esp+(8+4)+8+8]
mcall 13,,,[sc.work]
pop ecx ebx
mov edx,[color_tbl+4*0]
mov edx,[color_tbl.text]
.draw_tabs.inactive:
cmp ebp,[tab_bar.Default.Ptr]
@ -540,8 +532,7 @@ func draw_tabctl ;///// DRAW TAB CONTROL /////////////////////////////////////
ret
.check_horz:
lea eax,[ebx-1]
add eax,esi
lea eax,[esi+ebx-1]
sub eax,[tab_bar.Bounds.Right]
jge .check.dontfit
add eax,SCRLW*2+2
@ -552,8 +543,7 @@ func draw_tabctl ;///// DRAW TAB CONTROL /////////////////////////////////////
stc
ret
.check_vert:
lea eax,[ecx-1]
add eax,edi
lea eax,[edi+ecx-1]
sub eax,[tab_bar.Bounds.Bottom]
jge .check.dontfit
add eax,SCRLW+2
@ -584,6 +574,10 @@ func get_tab_size ;///// GET TAB WIDTH ///////////////////////////////////////
jae .lp1
lea eax,[ebp+TABITEM.Editor.FilePath]
add eax,[ebp+TABITEM.Editor.FileName]
cmp byte[eax],0
jne @f
int3
@@:
call strlen
imul ebx,eax,6
add ebx,9
@ -658,11 +652,11 @@ func get_hidden_tabitems_number ;/////////////////////////////////////////////
mov edi,[tab_bar.Bounds.Top]
inc edi
mov ecx,[tab_bar.Items.Count]
imul ebp,[tab_bar.Items.Left],sizeof.TABITEM
mov ebx,[tab_bar.Items.Left]
imul ebp,ebx,sizeof.TABITEM
add ebp,[tab_bar.Items]
mov eax,ecx
sub eax,[tab_bar.Items.Left]
push eax
push ecx
sub [esp],ebx
@@: push ecx
call get_tab_size

View File

@ -1,15 +1,3 @@
struct TBOX
x dw ?
width dw ?
y dw ?
height dw ?
sel.x db ?
pos.x db ?
ofs.x db ?
length db ?
text rb 255
ends
virtual at ebp
tbox TBOX
end virtual
@ -20,7 +8,7 @@ tb.sel.selected db ?
func textbox.get_width
push ebx edx
movzx eax,[tbox.width-2]
movzx eax,[tbox.width]
add eax,-6
xor edx,edx
mov ebx,6
@ -84,7 +72,7 @@ func textbox.draw ; TBOX* ebp
@@: mov [tb.pos.x],al
mov [tb.sel.x],ah
mcall 13,dword[tbox.x],dword[tbox.y],[color_tbl+4*5];[sc.work]
mcall 13,dword[tbox.width],dword[tbox.height],[color_tbl.back]
mov edx,[cl_3d_inset]
call draw_framerect
@ -94,15 +82,14 @@ func textbox.draw ; TBOX* ebp
cmp ebp,[focused_tb]
je @f
mov ebx,dword[tbox.x]
mov bx,[tbox.y+2]
movzx eax,[tbox.height-2]
mov ebx,dword[tbox.x-2]
mov bx,[tbox.y]
movzx eax,[tbox.height]
shr eax,1
add eax,4*65536-4
add ebx,eax
lea edx,[tbox.text]
; movzx esi,[tbox.length]
mcall 4,,[color_tbl+4*0];[sc.work_text]
mcall 4,,[color_tbl.text]
ret
@@: movzx eax,[tb.pos.x]
@ -123,33 +110,32 @@ func textbox.draw ; TBOX* ebp
mov eax,ecx
.lp2: imul eax,6
imul ebx,6
movzx ecx,[tbox.x+2]
movzx ecx,[tbox.x]
add ecx,3
; sub eax,ebx
add ebx,ecx
shl ebx,16
add ebx,eax
movzx ecx,[tbox.height-2]
movzx ecx,[tbox.height]
shr ecx,1
add cx,[tbox.y+2]
add cx,[tbox.y]
shl ecx,16
add ecx,-5*65536+10
mcall 13,,,[color_tbl+4*7];0x0000007F
mcall 13,,,[color_tbl.back.sel]
mov esi,[esp]
lea edx,[tbox.text]
movzx eax,[tbox.ofs.x]
add edx,eax
mov ebx,dword[tbox.x]
mov bx,[tbox.y+2]
movzx eax,[tbox.height-2]
mov ebx,dword[tbox.x-2]
mov bx,[tbox.y]
movzx eax,[tbox.height]
shr eax,1
add eax,4*65536-4
add ebx,eax
mov eax,4
or esi,esi
jz .lp3
mcall ,,[color_tbl+4*0];[sc.work_text]
mcall ,,[color_tbl.text]
.lp3: sub edi,esi
jnz .lp4
add esp,8
@ -164,46 +150,44 @@ func textbox.draw ; TBOX* ebp
jbe .lp5
mov esi,edi
.lp5:
mcall ,,[color_tbl+4*6];0x00FFFFFF
mcall ,,[color_tbl.text.sel]
sub edi,esi
jz .exit
add edx,esi
imul esi,6*65536
add ebx,esi
lea ecx,[tbox.text]
; sub ecx,edx
; add edi,ecx
mcall ,,[color_tbl+4*0],,edi;[sc.work_text],,edi
mcall ,,[color_tbl.text],,edi
jmp .exit
@@: lea edx,[tbox.text]
movzx eax,[tbox.ofs.x]
add edx,eax
mov ebx,dword[tbox.x]
mov bx,[tbox.y+2]
movzx eax,[tbox.height-2]
mov ebx,dword[tbox.x-2]
mov bx,[tbox.y]
movzx eax,[tbox.height]
shr eax,1
add eax,4*65536-4
add ebx,eax
movzx eax,[tbox.ofs.x]
call textbox.get_width
mov esi,eax
mcall 4,,[color_tbl+4*0];[sc.work_text]
mcall 4,,[color_tbl.text]
.exit:
movzx ebx,[tbox.pos.x]
movzx eax,[tbox.ofs.x]
sub ebx,eax
imul ebx,6
movzx eax,[tbox.x+2]
movzx eax,[tbox.x]
add eax,3
add ebx,eax
push bx
shl ebx,16
pop bx
movzx ecx,[tbox.height-2]
movzx ecx,[tbox.height]
shr ecx,1
add cx,[tbox.y+2]
add cx,[tbox.y]
push cx
shl ecx,16
pop cx