Tinypad 4.0.4 in progress (tabs + memory manager)

git-svn-id: svn://kolibrios.org@259 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Mihail Semenyako (mike.dld) 2007-01-03 18:22:05 +00:00
parent 82ef5da45f
commit ce67c673a0
16 changed files with 2282 additions and 1086 deletions

View File

@ -210,7 +210,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:
@ -372,6 +372,25 @@ struct system_colors
work_graph dd ?
ends
struct FILEDATE
Second db ?
Minute db ?
Hour db ?
db ?
Day db ?
Month db ?
Year dw ?
ends
struct FILEINFO
Attributes dd ?
IsUnicode db ?
db 3 dup(?)
DateCreate FILEDATE
DateAccess FILEDATE
DateModify FILEDATE
Size dq ?
ends
; constants

View File

@ -1,31 +1,42 @@
;-----------------------------------------------------------------------------
; project name: TINYPAD
; compiler: flat assembler 1.67.1
; 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: 2006-12-30 (Dec 30, 2006)
; last update: 2007-01-03 (Jan 3, 2007)
; minimal kernel: revision #138 (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:
; TODO (FOR 4.1.0):
; - optimize drawing (reduce flickering)
; - optimize memory usage (allocate only needed amount, not static 3 Mbytes)
; - add block selection ability, undo action, goto position
; - working with multiple files (add tabs)
; - add vertical selection, undo, goto position, overwrite mode
; - improve window drawing with small dimensions
; - other bugfixes and speed/size optimizations
; - other bug-fixes and speed/size optimizations
;
; TODO (FOR 4.0.4, PLANNED FOR 2007-01-21):
; - finish tabbed interface [critical]
; - add memory reallocation to keys handler [critical]
; - rework save_file (memory manager) [critical]
; - reduce flickering (changes checker) [average]
; - incorrect saved/modified lines flags on copy/paste [normal]
; - case-insensitive file extensions comparison (.asm/.inc) [normal]
; - prompt to save file before closing/opening [low]
;
; HISTORY:
; 4.0.4 pre (mike.dld)
; bug-fixes:
; - clear statusbar text if dialog operation cancelled
; - statusbar contained hint after dialog operation cancelled
; - small drawing fix for gutter and line saved/modified markers
; changes:
; - 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
; new features:
; - recode tables between CP866, CP1251 and KOI8-R (suggested by Victor)
; - tabbed interface, ability to open several files in one app instance
; 4.0.3 (mike.dld)
; bug-fixes:
; - 1-char selection if pressing <BS> out of real line length
@ -132,22 +143,14 @@
; auto-indent
; Ctrl+L - insert comment string
;-----------------------------------------------------------------------------
; Memory 0x300000:
; stack for popup 0x00dff0 -
; stack for help 0x00eff0 -
; stack 0x00fff0 -
; load position 0x010000 +
; edit area 0x080000 +
; copy/paste area 0x2f0000 +
;-----------------------------------------------------------------------------
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,AREA_ENDMEM,MAIN_STACK,@PARAMS,self_path
header '01',1,@CODE,TINYPAD_END,STATIC_MEM_END,MAIN_STACK,@PARAMS,self_path
APP_VERSION equ '4.0.4 pre'
@ -155,15 +158,15 @@ APP_VERSION equ '4.0.4 pre'
ASEPC = '-' ; separator character (char)
ATOPH = POP_IHEIGHT+2 ; menu bar height (pixels)
;OLEFT = 50+1 ; left offset (pixels) !!! don't change !!!
SCRLW = 16 ; scrollbar widht/height (pixels)
ATABW = 8 ; tab width (chars)
LINEH = 10 ; line height (pixels)
PATHL = 255 ; maximum path length (chars) !!! don't change !!!
PATHL = 256 ; maximum path length (chars) !!! don't change !!!
AMINS = 8 ; minimal scroll thumb size (pixels)
LCHGW = 2 ; changed/saved marker width
LCHGW = 3 ; changed/saved marker width
STATH = 14 ; status bar height
STATH = 16 ; status bar height
TBARH = 18 ; tab bar height
MEV_LDOWN = 1
MEV_LUP = 2
@ -184,8 +187,8 @@ label color_tbl dword
RGB(255,255,255) ; RGB(224,224,224) ; RGB(255,255,255) ; background
RGB(255,255,255) ; RGB(255,255,255) ; RGB(255,255,255) ; selection text
RGB( 10, 36,106) ; RGB( 0, 0,128) ; RGB( 0, 64,128) ; selection background
RGB(255,255, 0) ; modified line marker
RGB( 0,255, 0) ; saved line marker
RGB(255,238, 98) ; modified line marker
RGB(108,226,108) ; saved line marker
ins_mode db 1
@ -220,12 +223,26 @@ section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
mov al,0
rep stosb
mov [tab_bar.Style],2
mcall 68,11
or eax,eax
jz key.alt_x.close
mov eax,65536
call mem.Alloc
mov [temp_buf],eax
mov eax,65536
call mem.Alloc
mov [cur_tab.Editor.Data],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 [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
@ -262,17 +279,35 @@ section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;// diamond ]
add edx,20
mcall 60,1,AREA_TEMP-16 ; 0x10000-16
mov dword[AREA_TEMP-16+4],8 ; [0x10000-16+4],8
mov eax,edx
call mem.Alloc
mov ebp,eax
;! 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+4],8
mcall 40,1000000b
mcall 23,200
cmp eax,7
jne key.alt_x.close ; ýòî íà mcall -1 ìåòêà
mov esi,AREA_TEMP-16 ; 0x10000-16
mov byte[esi],1
mov eax,[esi+12]
inc eax
call load_file.file_found
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
mov ecx,[ebp+12]
mov esi,ebp
call create_tab
call load_from_memory
mov eax,ebp
call mem.Free
jmp @f
.noipc:
@ -292,9 +327,9 @@ section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
mov [tb_opensave.length],al
no_params:
call btn.load_file;do_load_file
jnc @f
call new_file
;call btn.load_file;do_load_file
;jnc @f
call create_tab
@@:
dec [do_not_draw]
@ -307,7 +342,7 @@ red:
;-----------------------------------------------------------------------------
still:
call writepos ; 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
@ -329,7 +364,7 @@ func start_fasm ;/////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; BL = run after compile
;-----------------------------------------------------------------------------
cmp [asm_mode],0
cmp [cur_tab.Editor.AsmMode],0 ;! [asm_mode],0
jne @f
ret
@@: mov esi,f_info.path ; s_fname
@ -458,48 +493,37 @@ endf
; @@: ret
;endf
func set_opt
test [options],al
je @f
not al
and [options],al
ret
@@: or [options],al
ret
endf
set_opt:
func set_line_numbers
.line_numbers:
mov al,OPTS_LINENUMS
call set_opt
ret
endf
func set_optimal_fill
jmp .main
.optimal_fill:
mov al,OPTS_OPTIMSAVE
call set_opt
ret
endf
func set_auto_indents
jmp .main
.auto_indents:
mov al,OPTS_AUTOINDENT
call set_opt
ret
endf
func set_auto_braces
jmp .main
.auto_braces:
mov al,OPTS_AUTOBRACES
call set_opt
ret
endf
func set_secure_sel
jmp .main
.secure_sel:
mov al,OPTS_SECURESEL
call set_opt
.main:
xor [options],al
; test [options],al
; je @f
; not al
; and [options],al
; ret
; @@: or [options],al
ret
endf
;-----------------------------------------------------------------------------
include 'tp-defines.inc'
include 'tp-draw.asm'
include 'tp-key.asm'
include 'tp-button.asm'
@ -509,6 +533,8 @@ include 'tp-common.asm'
include 'tp-dialog.asm'
include 'tp-popup.asm'
include 'tp-tbox.asm'
include 'tp-tabctl.asm'
include 'tp-editor.asm'
include 'tp-recode.asm'
;include 'lib-ini.asm'
@ -559,6 +585,7 @@ accel_table dd \
0x00010150,key.shift_down ,\ ; Shift+Down
0x00010151,key.shift_pgdn ,\ ; Shift+PageDown
0x00010153,key.del ,\ ; Shift+Delete
0x0002000F,key.ctrl_tab ,\ ; Ctrl+Tab
0x00020015,key.ctrl_y ,\ ; Ctrl+Y
0x00020018,key.ctrl_o ,\ ; Ctrl+O
0x0002001E,key.ctrl_a ,\ ; Ctrl+A
@ -582,6 +609,7 @@ accel_table dd \
\;0x00020150,key.ctrl_down ,\ ; Ctrl+Down
0x00020151,key.ctrl_pgdn ,\ ; Ctrl+PageDown
0x00020153,key.del ,\ ; Ctrl+Del
0x0003000F,key.shift_ctrl_tab ,\ ; Shift+Ctrl+Tab
0x0003001F,key.shift_ctrl_s ,\ ; Shift+Ctrl+S
0x00030147,key.shift_ctrl_home ,\ ; Shift+Ctrl+Home
\;0x00030148,key.shift_ctrl_up ,\ ; Shift+Ctrl+Up
@ -613,15 +641,10 @@ accel_table_textbox dd \
accel_table2 dd \
1,btn.close_main_window ,\
\;10000,btn.compile ,\
\;10001,btn.compile_run ,\
\;10002,btn.debug_board ,\
\;10003,btn.sysfuncs_txt ,\
'UP',btn.scroll_up ,\
'DN',btn.scroll_down ,\
'LT',btn.scroll_left ,\
'RT',btn.scroll_right ,\
\;5,key.ctrl_o ,\
0
accel_table2_botdlg dd \
@ -632,7 +655,6 @@ accel_table2_botdlg dd \
0
add_table:
; times $61 db -$00
times $1A db -$20
times $25 db -$00
times $10 db -$20
@ -641,15 +663,8 @@ add_table:
times $04 db -$00,-$01
times $08 db -$00
;error_beep db 0xA0,0x30,0
s_status dd 0
sz s_example,'EXAMPLE.ASM'
sz s_still ,'still'
;sz param_setup,'LANG',0 ; parameter for SETUP
fasm_start:
dd 7
dd 0
@ -679,246 +694,18 @@ docpak_start:
dd 0
db '/RD/1/DOCPAK',0
;sz setup ,'SETUP ' ; to change keyboard layout
sz sysfuncs_param,'g',0
lsz sysfuncs_filename,\
ru,<'SYSFUNCR.TXT',0>,\
en,<'SYSFUNCS.TXT',0>
sz htext,'TINYPAD ',APP_VERSION
lszc help_text,b,\
ru,'ŠŽŒ€<C592>:',\
ru,' ',\
ru,' CTRL+F1 : <20>â® ®ª­®',\
ru,' CTRL+S : <20>¥à¢ ï áâப  ¤«ï ª®¯¨à®¢ ­¨ï',\
ru,' CTRL+E : <20>®á«¥¤­ïï áâப  ¤«ï ª®¯¨à®¢ ­¨ï',\
ru,' CTRL+P : ‚áâ ¢¨âì ¢ë¡à ­­®¥ ­  ⥪ãéãî ¯®§¨æ¨î',\
ru,' CTRL+D : “¤ «¨âì áâபã',\
ru,' CTRL+L : ‚áâ ¢¨âì áâபã-à §¤¥«¨â¥«ì',\
ru,' CTRL+[ : <20>¥à¥©â¨ ¢ ­ ç «® ä ©« ',\
ru,' CTRL+] : <20>¥à¥©â¨ ¢ ª®­¥æ ä ©« ',\
ru,' CTRL+F2 : ‡ £à㧨âì ä ©«',\
ru,' CTRL+F3 : <20>®¨áª',\
ru,' CTRL+F4 : ‘®åà ­¨âì ä ©«',\
ru,' CTRL+F5 : ‚¢¥á⨠¨¬ï ä ©« ',\
ru,' CTRL+F6 : ‚¢¥á⨠áâப㠤«ï ¯®¨áª ',\
ru,' CTRL+F8 : ‘¬¥­¨âì à áª« ¤ªã ª« ¢¨ âãàë',\
\
en,'COMMANDS:',\
en,' ',\
en,' CTRL+F1 : SHOW THIS WINDOW',\
en,' CTRL+S : SELECT FIRST STRING TO COPY',\
en,' CTRL+E : SELECT LAST STRING TO COPY',\
en,' CTRL+P : PASTE SELECTED TO CURRENT POSITION',\
en,' CTRL+D : DELETE CURRENT LINE',\
en,' CTRL+L : INSERT SEPARATOR LINE',\
en,' CTRL+[ : GO TO THE BEGINNING OF FILE',\
en,' CTRL+] : GO TO THE END OF FILE',\
en,' CTRL+F2 : LOAD FILE',\
en,' CTRL+F3 : SEARCH',\
en,' CTRL+F4 : SAVE FILE',\
en,' CTRL+F5 : ENTER FILENAME',\
en,' CTRL+F6 : ENTER SEARCH STRING',\
en,' CTRL+F8 : CHANGE KEYBOARD LAYOUT'
db 0
menubar_res main_menu,\
ru,'” ©«' ,popup_file ,onshow.file ,\
ru,'<27>à ¢ª ' ,popup_edit ,onshow.edit ,\
ru,'<27>®¨áª' ,popup_search ,onshow.search ,\
ru,'‡ ¯ãáª' ,popup_run ,onshow.run ,\
ru,'Š®¤¨à®¢ª ',popup_recode ,onshow.recode ,\
ru,'Ž¯æ¨¨' ,popup_options,onshow.options,\
\
en,'File' ,popup_file ,onshow.file ,\
en,'Edit' ,popup_edit ,onshow.edit ,\
en,'Search' ,popup_search ,onshow.search ,\
en,'Run' ,popup_run ,onshow.run ,\
en,'Encoding',popup_recode ,onshow.recode ,\
en,'Options' ,popup_options,onshow.options
popup_res popup_file,\
ru,'<27>®¢ë©' ,'Ctrl+N' ,key.ctrl_n ,\
ru,'Žâªàëâì...' ,'Ctrl+O' ,key.ctrl_o ,\
ru,'‘®åà ­¨âì' ,'Ctrl+S' ,key.ctrl_s ,\
ru,'‘®åà ­¨âì ª ª...','Ctrl+Shift+S',key.shift_ctrl_s,\
ru,'-' ,'' ,0 ,\
ru,'‚ë室' ,'Alt+X' ,key.alt_x ,\
\
en,'New' ,'Ctrl+N' ,key.ctrl_n ,\
en,'Open...' ,'Ctrl+O' ,key.ctrl_o ,\
en,'Save' ,'Ctrl+S' ,key.ctrl_s ,\
en,'Save as...','Ctrl+Shift+S',key.shift_ctrl_s,\
en,'-' ,'' ,0 ,\
en,'Exit' ,'Alt+X' ,key.alt_x
popup_res popup_edit,\
ru,'‚ë१ âì' ,'Ctrl+X',key.ctrl_x,\
ru,'Š®¯¨à®¢ âì' ,'Ctrl+C',key.ctrl_c,\
ru,'‚áâ ¢¨âì' ,'Ctrl+V',key.ctrl_v,\
ru,'“¤ «¨âì' ,'' ,key.del ,\
ru,'-' ,'' ,0 ,\
ru,'‚뤥«¨âì ¢áñ','Ctrl+A',key.ctrl_a,\
\; ru,'-' ,'' ,0 ,\
\; ru,'‚¥à⨪ «ì­®¥ ¢ë¤¥«¥­¨¥','Alt+Ins',0 ,\
\
en,'Cut' ,'Ctrl+X',key.ctrl_x,\
en,'Copy' ,'Ctrl+C',key.ctrl_c,\
en,'Paste' ,'Ctrl+V',key.ctrl_v,\
en,'Delete' ,'' ,key.del ,\
en,'-' ,'' ,0 ,\
en,'Select all','Ctrl+A',key.ctrl_a;,\
; en,'-' ,'' ,0 ,\
; en,'Vertical selection','Alt+Ins',0
popup_res popup_search,\
ru,'<27>¥à¥©â¨...' ,'Ctrl+G',key.ctrl_g,\
ru,'-' ,'' ,0 ,\
ru,'<27> ©â¨...' ,'Ctrl+F',key.ctrl_f,\
ru,'<27> ©â¨ ¤ «¥¥','F3' ,key.f3 ,\
ru,'‡ ¬¥­¨âì...','Ctrl+H',key.ctrl_h,\
\
en,'Position...','Ctrl+G',key.ctrl_g,\
en,'-' ,'' ,0 ,\
en,'Find...' ,'Ctrl+F',key.ctrl_f,\
en,'Find next' ,'F3' ,key.f3 ,\
en,'Replace...' ,'Ctrl+H',key.ctrl_h
popup_res popup_run,\
ru,'‡ ¯ãáâ¨âì' ,'F9' ,key.f9 ,\
ru,'Š®¬¯¨«¨à®¢ âì' ,'Ctrl+F9',key.ctrl_f9 ,\
ru,'-' ,'' ,0 ,\
ru,'„®áª  ®â« ¤ª¨' ,'' ,open_debug_board ,\
ru,'‘¨á⥬­ë¥ ä㭪樨','' ,open_sysfuncs_txt,\
\
en,'Run' ,'F9' ,key.f9 ,\
en,'Compile' ,'Ctrl+F9',key.ctrl_f9 ,\
en,'-' ,'' ,0 ,\
en,'Debug board' ,'' ,open_debug_board ,\
en,'System functions' ,'' ,open_sysfuncs_txt
popup_res popup_recode,\
ru,'CP866 -> CP1251' ,'',recode.866.1251,\
ru,'CP1251 -> CP866' ,'',recode.1251.866,\
ru,'-' ,'',0,\
ru,'CP866 -> KOI8-R' ,'',recode.866.koi,\
ru,'KOI8-R -> CP866' ,'',recode.koi.866,\
ru,'-' ,'',0,\
ru,'CP1251 -> KOI8-R' ,'',recode.1251.koi,\
ru,'KOI8-R -> CP1251' ,'',recode.koi.1251,\
\
en,'CP866 -> CP1251' ,'',recode.866.1251,\
en,'CP1251 -> CP866' ,'',recode.1251.866,\
en,'-' ,'',0,\
en,'CP866 -> KOI8-R' ,'',recode.866.koi,\
en,'KOI8-R -> CP866' ,'',recode.koi.866,\
en,'-' ,'',0,\
en,'CP1251 -> KOI8-R' ,'',recode.1251.koi,\
en,'KOI8-R -> CP1251' ,'',recode.koi.1251
popup_res popup_options,\
ru,'‚­¥è­¨© ¢¨¤...' ,'',0,\
ru,'-' ,'',0,\
ru,'<27>¥§®¯ á­®¥ ¢ë¤¥«¥­¨¥' ,'',set_secure_sel,\
ru,'€¢â®¬ â¨ç¥áª¨¥ ᪮¡ª¨' ,'',set_auto_braces,\
ru,'€¢â®¬ â¨ç¥áª¨© ®âáâã¯' ,'',set_auto_indents,\
ru,'“¬­ ï â ¡ã«ïæ¨ï' ,'',0,\
ru,'Ž¯â¨¬ «ì­®¥ á®åà ­¥­¨¥','',set_optimal_fill,\
ru,'-' ,'',0,\
ru,'<27>®¬¥à  áâப' ,'',set_line_numbers,\
\
en,'Appearance...' ,'',0,\
en,'-' ,'',0,\
en,'Secure selection' ,'',set_secure_sel,\
en,'Automatic brackets' ,'',set_auto_braces,\
en,'Automatic indents' ,'',set_auto_indents,\
en,'Smart tabulation' ,'',0,\
en,'Optimal fill on saving','',set_optimal_fill,\
en,'-' ,'',0,\
en,'Line numbers' ,'',set_line_numbers
lsz s_modified,\
ru,'ˆ§¬¥­¥­®',\
en,'Modified'
lsz s_2filename,\
ru,'ˆ¬ï ä ©« :',\
en,'Filename:'
lsz s_2open,\
ru,'Žâªàëâì',\
en,'Open'
lsz s_2save,\
ru,'‘®åà ­¨âì',\
en,'Save'
lsz s_2find,\
ru,'<27> ©â¨',\
en,'Find'
db ':'
lsz s_2replace,\
ru,'‡ ¬¥­¨âì',\
en,'Replace'
db ':'
lsz s_2cancel,\
ru,'Žâ¬¥­ ',\
en,'Cancel'
lsz s_enter_filename,\
ru,<'‚¢¥¤¨â¥ ¨¬ï ä ©« ',0>,\
en,<'Enter filename',0>
lsz s_enter_text_to_find,\
ru,<'‚¢¥¤¨â¥ ⥪áâ ¤«ï ¯®¨áª ',0>,\
en,<'Enter text to find',0>
lsz s_enter_text_to_replace,\
ru,<'‚¢¥¤¨â¥ ⥪áâ ¤«ï § ¬¥­ë',0>,\
en,<'Enter text to replace',0>
lsz s_text_not_found,\
ru,<'„®á⨣­ãâ ª®­¥æ ä ©« , ⥪áâ ­¥ ­ ©¤¥­',0>,\
en,<'Reached end of file, text not found',0>
lszc s_fs_error,b,\
ru,<'Ž¯¥à æ¨ï § ¢¥à襭  ãᯥ譮 (0)',0>,\
ru,<'',0>,\
ru,<'”ã­ªæ¨ï ­¥ ¯®¤¤¥à¦¨¢ ¥âáï ¤«ï ¤ ­­®© ä ©«®¢®© á¨á⥬ë (2)',0>,\
ru,<'<27>¥¨§¢¥áâ­ ï ä ©«®¢ ï á¨á⥬  (3)',0>,\
ru,<'',0>,\
ru,<'<27>¥¢®§¬®¦­® ®âªàëâì ä ©« (5)',0>,\
ru,<'Ž¯¥à æ¨ï § ¢¥à襭  ãᯥ譮 (6)',0>,\
ru,<'€¤à¥á ­ å®¤¨âáï §  £à ­¨æ ¬¨ ¯ ¬ï⨠¯à®£à ¬¬ë (7)',0>,\
ru,<'<27>  ¤¨áª¥ ­¥â ᢮¡®¤­®£® ¬¥áâ  (8)',0>,\
ru,<'’ ¡«¨æ  FAT ã­¨ç⮦¥­  (9)',0>,\
ru,<'„®áâ㯠§ ¯à¥éñ­ (10)',0>,\
ru,<'Žè¨¡ª  ãáâனá⢠ (11)',0>,\
\
en,<'Operation executed successfully (0)',0>,\
en,<'',0>,\
en,<'Function is not supported for the given filesystem (2)',0>,\
en,<'Unknown filesystem (3)',0>,\
en,<'',0>,\
en,<'Unable to open file (5)',0>,\
en,<'Operation executed successfully (6)',0>,\
en,<'Pointer lies outside of application memory (7)',0>,\
en,<'Disk is full (8)',0>,\
en,<'FAT table is destroyed (9)',0>,\
en,<'Access denied (10)',0>,\
en,<'Device error (11)',0>
include 'tp-locale.inc'
sz symbols_ex,';?.%"',"'"
sz symbols ,'#&*\:/<>|{}()[]=+-, '
ini_sec_window db 'Window',0
ini_window_top db 'Top',0
ini_window_left db 'Left',0
ini_window_right db 'Right',0
ini_window_bottom db 'Bottom',0
finfo_ini dd ?,?,?,AREA_TEMP,AREA_EDIT-AREA_TEMP
db '/rd/1/tinypad.ini',0
sz ini_sec_window ,'Window',0
sz ini_window_top ,'Top',0
sz ini_window_left ,'Left',0
sz ini_window_right ,'Right',0
sz ini_window_bottom,'Bottom',0
TINYPAD_END: ; end of file
@ -928,38 +715,26 @@ self_path rb PATHL
section @UDATA ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;-----------------------------------------------------------------------------
f_info70 rd 7
f_info.length dd ?
f_info dd ?,?,?,?,?;?,0,?,AREA_TEMP,AREA_EDIT-AREA_TEMP
f_info.path:
times PATHL+1 db ?
f_info70 rd 7
file_info FILEINFO
tab_bar TABCTL
virtual at tab_bar.Current
cur_tab TABITEM
;cur_tab_addr dd ?
end virtual
pos.x dd ? ; global X position (cursor)
pos.y dd ? ; global Y position (cursor)
sel.x dd ? ; global X position (selection start)
sel.y dd ? ; global Y position (selection start)
lines dd ? ; number of lines in file
lines.scr dd ? ; number of lines on the screen
columns dd ? ; number of columns in file
columns.scr dd ? ; number of columns on the screen
top_ofs dd ? ; height occupied by top buttons
bot_ofs dd ? ; height occupied by bottom buttons
dw ?
left_ofs dd ? ;
top_line dd ? ; topmost visible line on screen
left_col dd ? ; leftmost visible char on line
vscrl_top dd ?
vscrl_size dd ?
hscrl_top dd ?
hscrl_size dd ?
;skinh dd ? ; skin height
__rc dd ?,?,?,?
;filelen dd ? ; file size (on save) ???
filesize dd ? ; file size (on load) ???
ya dd ? ; for read_string
;copy_start dd ? ; first line for copying (Ctrl+S)
copy_count dd ? ; number of lines for copying (Ctrl+E)
copy_size dd ? ; size of data to copy
s_title.size dd ? ; caption length
@ -978,7 +753,6 @@ sel.selected db ?
in_sel db ?
asm_mode db ? ; ASM highlight?
do_not_draw db ? ; draw top and bottom buttons?
main_closed db ? ; main window closed?
tb_casesen db ? ; focused textbox is case-sensitive?
@ -1021,13 +795,14 @@ just_from_popup db ?
bot_mode db ?
modified db ?
align 4
bot_dlg_height dd ?
bot_dlg_mode2 db ?
temp_buf dd ?
copy_buf dd ?
;-----------------------------------------------------------------------------
section @PARAMS ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;-----------------------------------------------------------------------------
@ -1038,22 +813,6 @@ p_info process_information
p_info2 process_information
sc system_colors
diff16 'Main memory size',0,$
MAIN_STACK = 0x0000FFF0
POPUP_STACK = 0x0000EFF0
AREA_TEMP = 0x00010000 ; 0x00010000
AREA_EDIT = 0x000C0000 ; 0x00080000
AREA_TEMP2 = 0x00190000 ; 0x002E0000
AREA_CBUF = 0x001A0000 ; 0x002F0000
AREA_ENDMEM = 0x001B0000 ; 0x00300000
diff10 'Header+options size',0,@CODE
diff10 'Load area size',AREA_TEMP,AREA_EDIT
diff10 'Edit area size',AREA_EDIT,AREA_TEMP2
diff10 'Total memory usage',0,AREA_ENDMEM
;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
@ -1061,3 +820,13 @@ diff10 'Total memory usage',0,AREA_ENDMEM
;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
POPUP_STACK:
STATIC_MEM_END:
diff10 'Main memory size',0,$

View File

@ -1,3 +1,56 @@
struct POINT
X dd ?
Y dd ?
ends
struct RECT
Left dd ?
Top dd ?
Right dd ?
Bottom dd ?
ends
struct SCROLLBAR
Top dd ?
Size dd ?
ends
struct EDITOR
FilePath db PATHL dup(?)
FileName dd ?
Data dd ?
Bounds RECT
Caret POINT
SelStart POINT
Lines dd ?
Columns dd ?
TopLeft POINT
VScroll SCROLLBAR
HScroll SCROLLBAR
Gutter.Width dd ?
Gutter.Visible db ?
AsmMode db ?
Modified db ?
db ?
ends
struct TABITEM
Editor EDITOR
ends
struct TABCTL
Bounds RECT
Items dd ?
Items.Count dd ?
Current TABITEM
Current.Ptr dd ?
Style db ?
db 3 dup(?)
ends
virtual at -20
POPUP:
.actions dd ?
@ -29,13 +82,13 @@ macro popup_res _name,[_lang,_title,_accel,_action]
dw ? ; x
_name:
forward
if (lang eq _lang)
if (lang eq _lang) | (_lang eq @!)
db 1
end if
common
.data:
forward
if lang eq _lang
if (lang eq _lang) | (_lang eq @!)
if _title eq '-'
db 1,'-'
c2 = c2+1
@ -63,8 +116,12 @@ macro popup_res _name,[_lang,_title,_accel,_action]
align 4
.actions:
forward
if lang eq _lang
dd _action
if (lang eq _lang) | (_lang eq @!)
if (_action eq )
dd 0
else
dd _name#.#_action
end if
end if
common
.size = $-_name+20

View File

@ -22,64 +22,44 @@ button:
jmp still.skip_write
; cmp eax,BUTTON_SCRLUP
; jne not_up
btn.scroll_up:
dec [top_line]
dec [cur_tab.Editor.TopLeft.Y] ;! [top_line]
jns @f
inc [top_line]
ret;jmp still.skip_write
inc [cur_tab.Editor.TopLeft.Y] ;! [top_line]
ret
@@: call check_inv_all.skip_check
ret
; not_up:
; cmp eax,BUTTON_SCRLDN
; jne not_down
btn.scroll_down:
inc [top_line]
mov eax,[lines]
inc [cur_tab.Editor.TopLeft.Y] ;! [top_line]
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines]
sub eax,[lines.scr]
cmp eax,[top_line]
cmp eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
jge @f
dec [top_line]
;dec eax
;mov [top_line],eax
ret;jmp still.skip_write
dec [cur_tab.Editor.TopLeft.Y] ;! [top_line]
ret
@@: call check_inv_all.skip_check
ret
; not_down:
; cmp eax,BUTTON_SCRLLT
; jne not_left
btn.scroll_left:
dec [left_col]
dec [cur_tab.Editor.TopLeft.X] ;! [left_col]
jns @f
inc [left_col]
inc [cur_tab.Editor.TopLeft.X] ;! [left_col]
ret;jmp still.skip_write
@@: call check_inv_all.skip_check
ret
; not_left:
; cmp eax,BUTTON_SCRLRT
; jne not_right
btn.scroll_right:
inc [left_col]
mov eax,[columns]
inc [cur_tab.Editor.TopLeft.X] ;! [left_col]
mov eax,[cur_tab.Editor.Columns] ;! eax,[columns]
sub eax,[columns.scr]
cmp eax,[left_col]
cmp eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
jge @f
dec [left_col]
;dec eax
;mov [left_col],eax
ret;jmp still.skip_write
dec [cur_tab.Editor.TopLeft.X] ;! [left_col]
ret
@@: call check_inv_all.skip_check
ret
; not_right:
; SEARCH {
; search:
; cmp al,BUTTON_SEARCH
; jne no_search
btn.search:
key.f3:
call search
@ -90,7 +70,7 @@ button:
func search
cld
mov ecx,[pos.y]
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
mov edx,ecx
call get_line_offset
cmp word[esi],0
@ -100,11 +80,9 @@ func search
or eax,eax
jz .end_line.2
mov ecx,eax
sub ecx,[pos.x]
sub ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
push esi
add esi,[pos.x]
;dec ecx
;inc esi
add esi,[cur_tab.Editor.Caret.X] ;! esi,[pos.x]
jmp @f
.next_line:
@ -140,15 +118,15 @@ func search
.found:
add esp,4
mov [pos.y],edx
mov [sel.y],edx
mov [cur_tab.Editor.Caret.Y],edx ;! [pos.y],edx
mov [cur_tab.Editor.SelStart.Y],edx ;! [sel.y],edx
mov ecx,edx
lea eax,[esi-4]
call get_line_offset
sub eax,esi
mov [sel.x],eax
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
add eax,[s_search.size]
mov [pos.x],eax
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov [s_status],0
clc
ret
@ -170,136 +148,87 @@ func search
ret
endf
; SEARCH }
; no_search:
; TOOLBAR {
; cmp eax,10000
; jb no_toolbar
; add eax,-10000
; jnz @f
btn.compile:
key.ctrl_f9:
mov bl,0;[run_outfile],0
mov bl,0
call start_fasm
ret;jmp still
; @@: dec eax
; jnz @f
ret
btn.compile_run:
key.f9:
mov bl,1;[run_outfile],1
mov bl,1
call start_fasm
ret;jmp still
; @@: dec eax
; jnz @f
ret
btn.debug_board:
call open_debug_board
ret;jmp still
; @@: dec eax
; jnz still
ret
btn.sysfuncs_txt:
call open_sysfuncs_txt
ret;jmp still
; TOOLBAR }
ret
; no_toolbar:
; cmp al,4
; jne noid4
; LOAD_FILE {
; do_load_file:
btn.load_file:
key.ctrl_l:
; cmp [s_fname],'/'
; jne @f
; call load_hd_file
; jmp .restorecursor
; @@: call load_file
call load_file
jnc @f
ret
; .restorecursor:
@@:
xor eax,eax
mov [top_line],eax
mov [left_col],eax
mov [pos.x],eax
mov [pos.y],eax
mov [sel.x],eax
mov [sel.y],eax
mov [modified],al
xor eax,eax
mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax
mov [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
mov [cur_tab.Editor.Modified],al ;! [modified],al
; enable color syntax for ASM and INC files:
mov [asm_mode],al
mov [cur_tab.Editor.AsmMode],al ;! [asm_mode],al
mov eax,[f_info.length] ; [s_fname.size]
add eax,f_info.path ; s_fname
mov eax,[f_info.length]
add eax,f_info.path
mov byte[eax],0
mov ecx, dword [eax-3]
or ecx, 0x202020
cmp ecx, 'asm'
mov ecx, dword [eax-3]
or ecx, 0x202020
cmp ecx, 'asm'
jne @f
inc [asm_mode]
inc [cur_tab.Editor.AsmMode] ;! [asm_mode]
jmp .nocol
@@: cmp ecx, 'inc'
jne .nocol
inc [asm_mode]
inc [cur_tab.Editor.AsmMode] ;! [asm_mode]
.nocol:
update_caption:
macro unused {
movzx ecx,[f_info.length] ; [s_fname.size]
add ecx,10 ; strlen(" - TINYPAD");
cmp ecx,[s_title.size]
jne @f
add ecx,-10
mov esi,f_info.path ; s_fname ; strcmp(s_fname,header);
mov edi,s_title
repe cmpsb
jne @f
; call draw_file
clc
ret;jmp still
@@:
}
; set window title:
mov esi,f_info.path ; s_fname
lea esi,[cur_tab.Editor.FilePath] ;! mov esi,f_info.path
mov edi,s_title
cld
mov ecx,[f_info.length] ; [s_fname.size]
jecxz @f
;lea eax,[ecx+10]
;mov [s_title.size],eax
@@: lodsb
cmp al,0
je @f
stosb
jmp @b
@@:
;cld
rep movsb
;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
; call drawwindow
mcall 71,1,s_title
clc
ret;jmp still
; LOAD_FILE }
ret
; noid4:
; cmp al, 2
; jz yessave
; dec al ; close if butid == 1
; jnz nosave
; EXIT:
btn.close_main_window:
key.alt_x:
mov esi,self_path
@ -310,11 +239,6 @@ macro unused {
stosb
or al,al
jnz @b
; mov ebx,f_info
; mov dword[ebx+0],1
; mov dword[ebx+8],self_path
; mov dword[ebx+12],0
; mcall 58
mov [f_info70+0],2
mov [f_info70+4],0
@ -325,31 +249,6 @@ macro unused {
mov [f_info70+21],f_info.path
mcall 70,f_info70
; test eax,eax
; je .close
; cmp eax,6
; je .close
; ret
.close:
mov [main_closed],1
mcall -1
; SAVE_FILE {
; yessave:
; btn.save_file:
; key.ctrl_s:
; mov [bot_mode],1
; mov [bot_save_mode],1
; mov [bot_dlg_height],16*2+4*2-1
; mov [bot_dlg_handler],osdlg_handler
; call drawwindow
; call save_file
; ret;jmp still
; SAVE_FILE }
; nosave:
; btn.save_enter_name:
; inc al
; call read_string
; ret;jmp still

View File

@ -4,60 +4,62 @@ func check_cur_vis_inv ;//////////////////////////////////////////////////////
push eax ebx
xor bl,bl
.chk_y:
mov eax,[pos.y]
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
or eax,eax
jge @f
mov [pos.y],0
mov [cur_tab.Editor.Caret.Y],0 ;! [pos.y],0
jmp .chk_dy
@@: cmp eax,[lines]
@@: cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines]
jl .chk_dy
mov eax,[lines]
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines]
dec eax
mov [pos.y],eax
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
.chk_dy:
mov eax,[top_line]
cmp eax,[pos.y]
mov eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
cmp eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
jle @f
push [pos.y]
pop [top_line]
m2m [cur_tab.Editor.TopLeft.Y],[cur_tab.Editor.Caret.Y]
;! push [pos.y]
;! pop [top_line]
inc bl
@@: add eax,[lines.scr]
cmp eax,[pos.y]
cmp eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
jg .chk_x
mov eax,[pos.y]
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
sub eax,[lines.scr]
inc eax
mov [top_line],eax
mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax
inc bl
.chk_x:
mov eax,[pos.x]
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
or eax,eax
jge @f
mov [pos.x],0
mov [cur_tab.Editor.Caret.X],0 ;! [pos.x],0
jmp .chk_dx
@@: cmp eax,[columns]
@@: cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns]
jl .chk_dx
mov eax,[columns]
mov [pos.x],eax
mov eax,[cur_tab.Editor.Columns] ;! eax,[columns]
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
.chk_dx:
mov eax,[left_col]
cmp eax,[pos.x]
mov eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
jle @f
push [pos.x]
pop [left_col]
m2m [cur_tab.Editor.TopLeft.X],[cur_tab.Editor.Caret.X]
;! push [pos.x]
;! pop [left_col]
inc bl
@@: add eax,[columns.scr]
cmp eax,[pos.x]
cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
jg @f
mov eax,[pos.x]
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
sub eax,[columns.scr]
inc eax
mov [left_col],eax
mov [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax
inc bl
@@: cmp [mev],MEV_LDOWN
jne .exit
push [pos.x] [pos.y]
pop [sel.y] [sel.x]
push [cur_tab.Editor.Caret.X] [cur_tab.Editor.Caret.Y] ;! [pos.x] [pos.y]
pop [cur_tab.Editor.SelStart.Y] [cur_tab.Editor.SelStart.X] ;! [sel.y] [sel.x]
.exit:
or bl,bl
clc
@ -72,13 +74,13 @@ endf
func clear_selection ;////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push eax ebx
mov eax,[sel.y]
mov ebx,[pos.y]
mov eax,[cur_tab.Editor.SelStart.Y] ;! eax,[sel.y]
mov ebx,[cur_tab.Editor.Caret.Y] ;! ebx,[pos.y]
cmp eax,ebx
jle @f
xchg eax,ebx
@@: push [pos.x] [pos.y]
pop [sel.y] [sel.x]
@@: push [cur_tab.Editor.Caret.X] [cur_tab.Editor.Caret.Y] ;! [pos.x] [pos.y]
pop [cur_tab.Editor.SelStart.Y] [cur_tab.Editor.SelStart.X] ;! [sel.y] [sel.x]
call draw_file.ex
pop ebx eax
ret
@ -105,24 +107,24 @@ endf
func check_bottom_right ;/////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push eax
mov eax,[top_line]
mov eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
add eax,[lines.scr]
cmp eax,[lines]
cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines]
jbe .lp1
mov eax,[lines]
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines]
sub eax,[lines.scr]
jns @f
xor eax,eax
@@: mov [top_line],eax
.lp1: mov eax,[left_col]
@@: mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax
.lp1: mov eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
add eax,[columns.scr]
cmp eax,[columns]
cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns]
jbe .exit
mov eax,[columns]
mov eax,[cur_tab.Editor.Columns] ;! eax,[columns]
sub eax,[columns.scr]
jns @f
xor eax,eax
@@: mov [left_col],eax
@@: mov [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax
.exit:
pop eax
ret
@ -148,12 +150,12 @@ endf
;-----------------------------------------------------------------------------
func check_inv_all ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov eax,[pos.y]
mov ecx,[top_line]
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
.skip_init:
call check_cur_vis
mov [pos.y],eax
mov [top_line],ecx
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
mov [cur_tab.Editor.TopLeft.Y],ecx ;! [top_line],ecx
.skip_check:
; call clear_screen
call draw_file
@ -167,9 +169,9 @@ func check_cur_vis ;//////////////////////////////////////////////////////////
jb .low
mov edx,ecx
add edx,[lines.scr]
cmp edx,[lines]
cmp edx,[cur_tab.Editor.Lines] ;! edx,[lines]
jbe @f
mov edx,[lines]
mov edx,[cur_tab.Editor.Lines] ;! edx,[lines]
@@: cmp eax,edx
jb @f
lea ecx,[eax+1]
@ -180,17 +182,17 @@ func check_cur_vis ;//////////////////////////////////////////////////////////
.low: mov ecx,eax
@@: mov edx,ecx
add edx,[lines.scr]
cmp edx,[lines]
cmp edx,[cur_tab.Editor.Lines] ;! edx,[lines]
jbe @f
mov ecx,[lines]
mov ecx,[cur_tab.Editor.Lines] ;! ecx,[lines]
sub ecx,[lines.scr]
jns @f
xor ecx,ecx
@@:;mov [top_line],ecx
pushad
mov eax,[pos.x]
mov ebx,[left_col]
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
mov ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col]
mov ecx,ebx
add ecx,[columns.scr]
cmp eax,ebx
@ -201,10 +203,10 @@ func check_cur_vis ;//////////////////////////////////////////////////////////
sub ebx,[columns.scr]
jmp @f
.lp1: mov ebx,eax
@@: mov [left_col],ebx
@@: mov [cur_tab.Editor.TopLeft.X],ebx ;! [left_col],ebx
.exit:
mov [pos.x],eax
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
popad
ret
@ -230,12 +232,12 @@ func get_line_offset ;////////////////////////////////////////////////////////
; ESI = line data offset
;-----------------------------------------------------------------------------
push eax ecx
mov esi,AREA_EDIT
jecxz .exit
@@: movzx eax,word[esi]
dec ecx
mov esi,[cur_tab.Editor.Data] ;! AREA_EDIT
@@: dec ecx
js .exit
movzx eax,word[esi]
lea esi,[esi+eax+4]
jnz @b
jmp @b
.exit:
pop ecx eax
ret
@ -246,10 +248,10 @@ func init_sel_vars ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
pushad
mov [sel.selected],1
mov eax,[sel.x]
mov ebx,[sel.y]
mov ecx,[pos.x]
mov edx,[pos.y]
mov eax,[cur_tab.Editor.SelStart.X] ;! eax,[sel.x]
mov ebx,[cur_tab.Editor.SelStart.Y] ;! ebx,[sel.y]
mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
mov edx,[cur_tab.Editor.Caret.Y] ;! edx,[pos.y]
cmp ebx,edx
jl .lp2
jne @f
@ -352,6 +354,20 @@ func uint2str ;///////////////////////////////////////////////////////////////
ret
endf
;-----------------------------------------------------------------------------
func strlen ;/////////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx
mov ebx,eax
xor eax,eax
@@: cmp byte[ebx+eax],0
je @f
inc eax
jmp @b
@@: pop ebx
ret
endf
;-----------------------------------------------------------------------------
func rgb_to_gray ;////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
@ -492,7 +508,9 @@ func line_add_spaces ;////////////////////////////////////////////////////////
jbe .exit
sub ecx,edx
push ecx
mov edi,AREA_TEMP2
mov edi,[cur_tab.Editor.Data] ;! AREA_TEMP2
add edi,[edi-4]
dec edi
mov eax,esi
mov esi,edi
sub esi,ecx
@ -502,6 +520,7 @@ func line_add_spaces ;////////////////////////////////////////////////////////
neg ecx
lea ecx,[esi+ecx+1]
std
diff16 '32DC',0,$
rep movsb
pop edi ecx
add [eax],cx
@ -516,6 +535,8 @@ endf
;-----------------------------------------------------------------------------
func delete_selection ;///////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; call init_sel_vars
cmp [sel.selected],0
je .exit.2
@ -542,13 +563,14 @@ func delete_selection ;///////////////////////////////////////////////////////
mov [edi-4],bx
add edi,[sel.begin.x]
lea esi,[esi+eax+4]
mov ecx,AREA_TEMP2
mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2
add ecx,[ecx-4]
sub ecx,esi
cld
rep movsb
mov eax,[sel.end.y]
sub eax,[sel.begin.y]
sub [lines],eax
sub [cur_tab.Editor.Lines],eax ;! [lines],eax
jmp .exit
.single_line:
@ -567,20 +589,21 @@ func delete_selection ;///////////////////////////////////////////////////////
lea edi,[esi+4]
add edi,[sel.begin.x]
lea esi,[edi+ecx]
mov ecx,AREA_TEMP2
mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2
add ecx,[ecx-4]
sub ecx,esi
cld
rep movsb
.exit:
mov eax,[sel.begin.x]
mov [pos.x],eax
mov [sel.x],eax
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
mov eax,[sel.begin.y]
mov [pos.y],eax
mov [sel.y],eax
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
popad
mov [modified],1
mov [cur_tab.Editor.Modified],1 ;! [modified],1
clc
ret
@ -588,3 +611,103 @@ func delete_selection ;///////////////////////////////////////////////////////
stc
ret
endf
;-----------------------------------------------------------------------------
func get_selection_size ;/////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ecx esi
mov ecx,[sel.end.y]
inc ecx
call get_line_offset
mov eax,esi
mov ecx,[sel.begin.y]
call get_line_offset
sub eax,esi
pop esi ecx
ret
endf
;-----------------------------------------------------------------------------
func get_lines_in_file ;//////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; ESI = data pointer
; ECX = data length
;-----------------------------------------------------------------------------
push ebx ecx esi
or ebx,-1
.lp0: inc ebx
.lp1: dec ecx
jle .lp2
lodsb
cmp al,10
je .LF
cmp al,13
je .CR
jmp .lp1
.lp2: mov eax,ebx
pop esi ecx ebx
ret
.CR: cmp byte[esi],10
jne .lp0
lodsb
.LF: jmp .lp0
endf
;-----------------------------------------------------------------------------
func mem.Alloc ;//////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
lea ecx,[eax+4+4095]
and ecx,not 4095
mcall 68,12
add ecx,-4
mov [eax],ecx
add eax,4
pop ecx ebx
ret
endf
;-----------------------------------------------------------------------------
func mem.ReAlloc ;////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx esi edi eax
or eax,eax
jz @f
lea ecx,[ebx+4+4095]
and ecx,not 4095
add ecx,-4
cmp ecx,[eax-4]
je .exit
@@: mov eax,ebx
call mem.Alloc
xchg eax,[esp]
or eax,eax
jz .exit
mov esi,eax
xchg eax,[esp]
mov edi,eax
mov ecx,[esi-4]
cmp ecx,[edi-4]
jbe @f
mov ecx,[edi-4]
@@: add ecx,3
shr ecx,2
cld
rep movsd
xchg eax,[esp]
call mem.Free
.exit:
pop eax edi esi ecx ebx
ret
endf
;-----------------------------------------------------------------------------
func mem.Free ;///////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
lea ecx,[eax-4]
mcall 68,13
pop ecx ebx
ret
endf

View File

@ -0,0 +1,37 @@
define mm.File.New key.ctrl_n
define mm.File.Open key.ctrl_o
define mm.File.Save key.ctrl_s
define mm.File.SaveAs key.shift_ctrl_s
define mm.File.Exit key.alt_x
define mm.Edit.Cut key.ctrl_x
define mm.Edit.Copy key.ctrl_c
define mm.Edit.Insert key.ctrl_d
define mm.Edit.Delete key.del
define mm.Edit.SelAll key.ctrl_a
define mm.Search.Position key.ctrl_g
define mm.Search.Find key.ctrl_f
define mm.Search.FindNext key.f3
define mm.Search.Replace key.ctrl_h
define mm.Run.Run key.f9
define mm.Run.Compile key.ctrl_f9
define mm.Run.DbgBoard open_debug_board
define mm.Run.SysFuncs open_sysfuncs_txt
define mm.Encoding.CP866.CP1251 recode.866.1251
define mm.Encoding.CP1251.CP866 recode.1251.866
define mm.Encoding.CP866.KOI8R recode.866.koi
define mm.Encoding.KOI8R.CP866 recode.koi.866
define mm.Encoding.CP1251.KOI8R recode.1251.koi
define mm.Encoding.KOI8R.CP1251 recode.koi.1251
define mm.Options.Appearance 0
define mm.Options.SecureSel set_opt.secure_sel
define mm.Options.AutoBrackets set_opt.auto_braces
define mm.Options.AutoIndents set_opt.auto_indents
define mm.Options.SmartTabs 0
define mm.Options.OptimalFill set_opt.optimal_fill
define mm.Options.LineNumbers set_opt.line_numbers

View File

@ -266,7 +266,7 @@ botdlg.button:
jnc @f
.lp2:
ret
@@: call update_caption
@@: ;call update_caption
xor eax,eax
mov [bot_mode],al
mov [bot_dlg_height],eax
@ -290,16 +290,21 @@ botdlg.button:
.found:
;---------------------------------------
push [copy_size] [copy_count]
push [copy_size] [copy_count] [copy_buf]
mov esi,AREA_CBUF
mov edi,AREA_CBUF-304
mov ecx,300/4
rep movsd
; 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
mov [copy_buf],eax
movzx eax,[tb_replace.length]
mov esi,tb_replace.text
mov edi,AREA_CBUF
mov edi,[copy_buf] ;! AREA_CBUF
stosd
mov ecx,eax
jecxz .lp1
@ -308,17 +313,20 @@ botdlg.button:
mov [copy_size],eax
mov [copy_count],1
push [sel.x]
push [cur_tab.Editor.SelStart.X] ;! [sel.x]
call init_sel_vars
call key.ctrl_v
pop [sel.x]
pop [cur_tab.Editor.SelStart.X] ;! [sel.x]
mov esi,AREA_CBUF-304
mov edi,AREA_CBUF
mov ecx,300/4
rep movsd
mov eax,[copy_buf]
call mem.Free
pop [copy_count] [copy_size]
; 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

View File

@ -10,22 +10,6 @@ func drawwindow ;///// DRAW WINDOW ///////////////////////////////////////////
mcall 48,3,sc,sizeof.system_colors
call calc_3d_colors
test [options],OPTS_LINENUMS
jnz @f
mov eax,2+LCHGW
jmp .lp1
@@: mov edi,p_info+100
mov eax,[lines]
mov ecx,10
call uint2str
lea eax,[edi-p_info-100]
cmp eax,3
jae @f
mov eax,3
@@: imul eax,6
add eax,2+4+LCHGW
.lp1: mov [left_ofs],eax
mcall 12,1
push [color_tbl+4*5]
@ -46,53 +30,75 @@ func drawwindow ;///// DRAW WINDOW ///////////////////////////////////////////
cld
rep movsd
; mcall 9,p_info,-1
; mcall 9,p_info,-1
cmp [p_info.client_box.height],LINEH
jl .exit.2
;++ calculate editor bounds ++
mov [tab_bar.Bounds.Left],0
mov [tab_bar.Bounds.Top],ATOPH
mov eax,[p_info.client_box.width]
mov [tab_bar.Bounds.Right],eax
mov eax,[p_info.client_box.height]
sub eax,[bot_dlg_height]
add eax,-STATH-1
mov [tab_bar.Bounds.Bottom],eax
call align_editor_in_tab
mov [top_ofs],ATOPH;+1
mov eax,[p_info.client_box.width]
sub eax,SCRLW+1
sub eax,[left_ofs]
mov eax,[cur_tab.Editor.Bounds.Right]
sub eax,[cur_tab.Editor.Bounds.Left]
sub eax,[cur_tab.Editor.Gutter.Width]
sub eax,SCRLW+LCHGW+4
cdq
mov ebx,6
div ebx
mov [columns.scr],eax
mov eax,[p_info.client_box.height] ; calculate buttons position
add eax,-STATH;*3-2-2
sub eax,[bot_dlg_height]
mov [bot_ofs],eax
call draw_bottom_dialog
mov [do_not_draw],1 ; do_not_draw = true
mov ebx,eax
sub ebx,[top_ofs]
sub ebx,SCRLW*3+AMINS+5
js .no_draw
dec [do_not_draw] ; do_not_draw = false
mov eax,[cur_tab.Editor.Bounds.Bottom]
sub eax,[cur_tab.Editor.Bounds.Top]
sub eax,SCRLW+3
sub eax,[top_ofs]
cdq
mov ebx,LINEH
div ebx
mov [lines.scr],eax
mov ebx,[p_info.client_box.width]
mov ecx,[top_ofs-2]
mov cx,word[top_ofs]
sub ecx,1*65536+1
mcall 38,,,[cl_3d_inset];[sc.work_text]
mov ecx,[p_info.client_box.height]
sub ecx,STATH+1
push cx
shl ecx,16
pop cx
mcall
mov eax,[p_info.client_box.height]
add eax,-STATH+1;*3-2-2
sub eax,[bot_dlg_height]
mov [bot_ofs],eax
call draw_bottom_dialog
; mov [do_not_draw],1 ; do_not_draw = true
; mov ebx,eax
; sub ebx,[top_ofs]
; sub ebx,SCRLW*3+AMINS+5
; js .no_draw
; dec [do_not_draw] ; do_not_draw = false
; sub eax,SCRLW+3
; sub eax,[top_ofs]
; cdq
; mov ebx,LINEH
; div ebx
; mov [lines.scr],eax
;-- horizontal lines for menubar and statusbar --
;mov ebx,[p_info.client_box.width]
;mov ecx,[top_ofs-2]
;mov cx,word[top_ofs]
;sub ecx,1*65536+1
;mcall 38,,,[cl_3d_inset];[sc.work_text]
;mov ecx,[p_info.client_box.height]
;sub ecx,STATH+1
;push cx
;shl ecx,16
;pop cx
;mcall
inc [top_ofs]
@ -134,7 +140,11 @@ func drawwindow ;///// DRAW WINDOW ///////////////////////////////////////////
@@:
.exit:
call draw_file
;-- draw file --
;call draw_file
;++ draw editor control ++
call draw_editor
call draw_tabctl
.exit.2:
mcall 12,2
ret
@ -177,6 +187,8 @@ func draw_main_menu ;/////////////////////////////////////////////////////////
inc ebx
mcall 13,,ATOPH-1,[cl_3d_normal]
mcall 38,[p_info.client_box.width],<ATOPH-1,ATOPH-1>,[sc.frame];[cl_3d_pushed]
mov edx,main_menu
mov ebx,9*65536+ATOPH/2-4
mov ecx,[sc.work_text]
@ -220,6 +232,9 @@ func draw_file.ex ;///////////////////////////////////////////////////////////
; EAX = start line
; EBX = end line
;-----------------------------------------------------------------------------
call draw_editor;_text
ret
macro unused {
cmp [p_info.client_box.height],LINEH
jge @f
ret
@ -235,10 +250,10 @@ func draw_file.ex ;///////////////////////////////////////////////////////////
cmp eax,ebx
jle @f
xchg eax,ebx
@@: cmp eax,[top_line]
@@: cmp eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
jge @f
mov eax,[top_line]
@@: mov ecx,[top_line]
mov eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
@@: mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
add ecx,[lines.scr]
cmp ebx,ecx
jl @f
@ -258,19 +273,23 @@ func draw_file.ex ;///////////////////////////////////////////////////////////
mov ebx,[top_ofs]
add ebx,[left_ofs-2]
sub eax,[top_line]
sub eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
imul eax,LINEH
add ebx,eax
imul ebp,[left_col],6*65536
imul ebp,[cur_tab.Editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536
or [draw_blines],-1
jmp draw_file.next_line
}
endf
;-----------------------------------------------------------------------------
func draw_file ;//////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
call draw_editor;_text
ret
macro unused {
cmp [p_info.client_box.height],LINEH
jge @f
ret
@ -283,7 +302,7 @@ func draw_file ;//////////////////////////////////////////////////////////////
mov ebx,[top_ofs]
add ebx,[left_ofs-2]
mov ecx,[top_line]
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
push ecx
call get_line_offset
@ -294,9 +313,9 @@ func draw_file ;//////////////////////////////////////////////////////////////
jle .exit
add esp,-4
imul ebp,[left_col],6*65536
imul ebp,[cur_tab.Editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536
mov eax,[lines.scr]
sub eax,[lines]
sub eax,[cur_tab.Editor.Lines] ;! eax,[lines]
mov [draw_blines],eax
.next_line:
@ -327,7 +346,7 @@ func draw_file ;//////////////////////////////////////////////////////////////
cmp eax,[sel.end.y]
je .lp5
.lp2: mov eax,[sel.begin.x]
sub eax,[left_col]
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
jle .lp6.2
cmp eax,[columns.scr]
jge .lp6
@ -350,7 +369,7 @@ func draw_file ;//////////////////////////////////////////////////////////////
cmp eax,[sel.end.y]
je .lp5
.lp4: mov eax,[sel.end.x]
sub eax,[left_col]
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
jle .lp6
cmp eax,[columns.scr]
jg .lp6.2
@ -369,7 +388,7 @@ func draw_file ;//////////////////////////////////////////////////////////////
mov bx,ax
mov [in_sel],3
jmp .lp6
.lp5: mov eax,[left_col]
.lp5: mov eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
cmp eax,[sel.begin.x]
jge .lp4
add eax,[columns.scr]
@ -378,7 +397,7 @@ func draw_file ;//////////////////////////////////////////////////////////////
mov eax,[sel.begin.x]
cmp eax,[sel.end.x]
je .lp6
sub eax,[left_col]
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
imul eax,6
pushad
mov ebx,[sel.end.x]
@ -452,13 +471,13 @@ func draw_file ;//////////////////////////////////////////////////////////////
push esi ebx
mov eax,ebx
sub ebx,[left_col]
sub ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col]
cmp ebx,[columns.scr]
jge .skip_t
add ebx,esi
jle .skip_t
mov ebx,[esp+8+4*2] ;// 4*2=esi+ebx
sub eax,[left_col]
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
jge .qqq
sub edx,eax
add esi,eax
@ -475,7 +494,7 @@ func draw_file ;//////////////////////////////////////////////////////////////
mov eax,[esp] ; ebx
add eax,[esp+4] ; esi
sub eax,[left_col]
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
sub eax,[columns.scr]
jle .qweqwe
sub esi,eax
@ -499,7 +518,7 @@ func draw_file ;//////////////////////////////////////////////////////////////
mov esi,[sel.begin.x]
sub esi,[esp]
pushad
mov ecx,[left_col]
mov ecx,[cur_tab.Editor.TopLeft.X] ;! ecx,[left_col]
sub ecx,[esp+4*8]
jle @f
sub esi,ecx
@ -529,7 +548,7 @@ func draw_file ;//////////////////////////////////////////////////////////////
sub eax,[esp]
push ebx
mov ebx,[esp+4]
sub ebx,[left_col]
sub ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col]
jge .ya2.1
add eax,ebx
.ya2.1:
@ -561,7 +580,7 @@ func draw_file ;//////////////////////////////////////////////////////////////
sub esi,[esp]
push eax
mov eax,[esp+4]
sub eax,[left_col]
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
jge .nt3.1
add esi,eax
.nt3.1:
@ -642,7 +661,7 @@ func draw_file ;//////////////////////////////////////////////////////////////
shl ebx,16
add ebx,[top_ofs]
mov edi,[sc.work_text]
mov ecx,[top_line]
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
inc ecx
mov edx,p_info+100
@@: pushad
@ -660,10 +679,10 @@ func draw_file ;//////////////////////////////////////////////////////////////
popad
add ebx,LINEH
inc ecx
cmp ecx,[lines]
cmp ecx,[cur_tab.Editor.Lines] ;! ecx,[lines]
jg @f
mov esi,ecx
sub esi,[top_line]
sub esi,[cur_tab.Editor.TopLeft.Y] ;! esi,[top_line]
cmp esi,[lines.scr]
jbe @b
@@: add esp,4*8*2
@ -688,8 +707,8 @@ func draw_file ;//////////////////////////////////////////////////////////////
add esp,4
cmp [bot_mode],0
jne @f
mov ebx,[pos.x]
sub ebx,[left_col]
mov ebx,[cur_tab.Editor.Caret.X] ;! ebx,[pos.x]
sub ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col]
js @f
cmp ebx,[columns.scr]
ja @f
@ -699,8 +718,8 @@ func draw_file ;//////////////////////////////////////////////////////////////
push bx
shl ebx,16
pop bx
mov eax,[pos.y]
sub eax,[top_line]
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
sub eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
js @f
cmp eax,[lines.scr]
jge @f
@ -786,15 +805,15 @@ func draw_file ;//////////////////////////////////////////////////////////////
; sub ebx,1*65536-2
push ebx
mov eax,[lines]
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines]
mov ebx,[lines.scr]
mov ecx,[top_line]
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
mov edx,[bot_ofs]
sub edx,[top_ofs]
add edx,-SCRLW*3+1
call get_scroll_vars
mov [vscrl_top],eax
mov [vscrl_size],ebx
mov [cur_tab.Editor.VScroll.Top],eax ;! [vscrl_top],eax
mov [cur_tab.Editor.VScroll.Size],ebx ;! [vscrl_size],ebx
pop ebx
mov ecx,eax
@ -810,7 +829,7 @@ func draw_file ;//////////////////////////////////////////////////////////////
; rol ecx,16
; movsx eax,cx
; sar ecx,16
push ebx ecx SCRLW [vscrl_size]
push ebx ecx SCRLW [cur_tab.Editor.VScroll.Size] ;! ebx ecx SCRLW [vscrl_size]
dec dword[esp]
call draw_3d_panel
popad
@ -819,7 +838,7 @@ func draw_file ;//////////////////////////////////////////////////////////////
inc ebx
mov ecx,[top_ofs-2]
mov cx,word[vscrl_top]
mov cx,word[cur_tab.Editor.VScroll.Top] ;! cx,word[vscrl_top]
add ecx,(SCRLW-1)*65536
mov edx,[sc.work];[color_tbl+4*5]
or cx,cx
@ -827,8 +846,8 @@ func draw_file ;//////////////////////////////////////////////////////////////
mcall 13
@@:
mov ecx,[top_ofs]
add ecx,[vscrl_top]
add ecx,[vscrl_size]
add ecx,[cur_tab.Editor.VScroll.Top] ;! ecx,[vscrl_top]
add ecx,[cur_tab.Editor.VScroll.Size] ;! ecx,[vscrl_size]
add ecx,SCRLW-1
mov di,cx
shl ecx,16
@ -915,20 +934,20 @@ func draw_file ;//////////////////////////////////////////////////////////////
; inc ecx
push ecx
mov eax,[columns]
mov eax,[cur_tab.Editor.Columns] ;! eax,[columns]
mov ebx,[columns.scr]
mov ecx,[left_col]
mov ecx,[cur_tab.Editor.TopLeft.X] ;! ecx,[left_col]
mov edx,[p_info.client_box.width]
add edx,-(SCRLW*3)
call get_scroll_vars
mov [hscrl_top],eax
mov [hscrl_size],ebx
mov [cur_tab.Editor.HScroll.Top],eax ;! [hscrl_top],eax
mov [cur_tab.Editor.HScroll.Size],ebx ;! [hscrl_size],ebx
pop ecx
mov ebx,eax
add ebx,1+SCRLW
shl ebx,16
mov bx,word[hscrl_size]
mov bx,word[cur_tab.Editor.HScroll.Size] ;! bx,word[hscrl_size]
; mcall 13,,,[sc.work_button]
;!!!!!!!!!!!!!!!!!!
@ -944,11 +963,11 @@ func draw_file ;//////////////////////////////////////////////////////////////
;!!!!!!!!!!!!!!!!!!
mov ebx,(1+SCRLW)*65536
mov bx,word[hscrl_top]
mov bx,word[cur_tab.Editor.HScroll.Top] ;! bx,word[hscrl_top]
mcall 13,,,[sc.work];[color_tbl+4*5]
mov ebx,1+SCRLW
add ebx,[hscrl_top]
add ebx,[hscrl_size]
add ebx,[cur_tab.Editor.HScroll.Top] ;! ebx,[hscrl_top]
add ebx,[cur_tab.Editor.HScroll.Size] ;! ebx,[hscrl_size]
mov di,bx
shl ebx,16
mov bx,word[p_info.client_box.width]
@ -978,6 +997,7 @@ func draw_file ;//////////////////////////////////////////////////////////////
.exit:
popad
ret
}
endf
;-----------------------------------------------------------------------------
@ -991,7 +1011,7 @@ func get_next_part ;//////////////////////////////////////////////////////////
; EDX = string
; ESI = length
;-----------------------------------------------------------------------------
cmp [asm_mode],0
cmp [cur_tab.Editor.AsmMode],0 ;! [asm_mode],0
je .plain.text
xor ebx,ebx
mov edx,ecx
@ -1099,12 +1119,17 @@ func get_next_part ;//////////////////////////////////////////////////////////
endf
;-----------------------------------------------------------------------------
func writepos ;///// WRITE POSITION //////////////////////////////////////////
func draw_statusbar ;///// WRITE POSITION ////////////////////////////////////
;-----------------------------------------------------------------------------
cmp [do_not_draw],1 ; return if drawing is not permitted
jae .exit
pusha
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 9,p_info,-1
mov ecx,[p_info.client_box.height-2]
@ -1116,9 +1141,10 @@ func writepos ;///// WRITE POSITION //////////////////////////////////////////
mcall 38,<6*13,6*13>,,[cl_3d_inset]
pushad
add ecx,1*65536
; sub ebx,(6*13+1)*65536-1
; sub ebx,[left_ofs]
mov cx,STATH+1
mov cx,STATH
mcall 13,<0,6*13>,,[cl_3d_normal]
mcall ,<6*13+1,6*(s_modified.size+2)-1>
mov ebx,(6*(s_modified.size+15)+1)*65536
@ -1133,7 +1159,7 @@ func writepos ;///// WRITE POSITION //////////////////////////////////////////
and ecx,0x0000FFFF
push ecx
mov eax,[pos.y]
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
inc eax
mov ecx,10
mov edi,p_info+0x100;htext2.pos1
@ -1141,7 +1167,7 @@ func writepos ;///// WRITE POSITION //////////////////////////////////////////
call uint2str
mov al,','
stosb
mov eax,[pos.x]
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
inc eax
call uint2str
@ -1156,7 +1182,7 @@ func writepos ;///// WRITE POSITION //////////////////////////////////////////
sub ebx,edi
mcall 4,,[sc.work_text],p_info+0x100
cmp [modified],0
cmp [cur_tab.Editor.Modified],0 ;! [modified],0
je @f
and ebx,0x0000FFFF
; add ebx,[left_ofs-2]
@ -1176,58 +1202,17 @@ func writepos ;///// WRITE POSITION //////////////////////////////////////////
ret
endf
;-----------------------------------------------------------------------------
func print_text ;/////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
pusha
; mov ebx,(LBTNW+5+2)*65536
mov bx,word[p_info.box.width]
; sub bx,LBTNW+RBTNW+10+3
mov ecx,[ya-2]
; mov cx,ABTNH+1
mcall 13,,,[sc.work]
; mov ebx,(LBTNW+5+2+4)*65536+ABTNH/2-3
add ebx,[ya]
mov eax,[p_info.box.width]
; sub eax,LBTNW+RBTNW+10+8
push eax
cdq
mov ecx,6
div ecx
cmp eax,PATHL
jbe @f
mov eax,PATHL
@@: mov esi,eax
mcall 4,,[color_tbl+0],[addr]
mov eax,[ya]
mov ebx,eax
; add eax,ABTNH/2-6
shl eax,16
add eax,ebx
; add eax,ABTNH/2-6+11
mov ecx,eax
imul eax,[temp],6
pop ebx
cmp eax,ebx
jae @f
; add eax,LBTNW+5+2+4
mov ebx,eax
shl eax,16
add ebx,eax
mcall 38,,,[color_tbl+0]
@@: popa
ret
endf
func draw_framerect ; ebx,ecx
func draw_framerect ; ebx,ecx,edx
push ebx ecx
; x1 = esp+6
; x2 = esp+4 (width)
; y1 = esp+2
; y2 = esp+0 (height)
add bx,[esp+6]
mov cx,[esp+2]
dec ebx
mcall 38,,,[cl_3d_inset]
mcall 38
add cx,[esp]
rol ecx,16
add cx,[esp]
@ -1246,6 +1231,6 @@ func draw_framerect ; ebx,ecx
sub ebx,0x00010001
mcall
add esp,8
pop ecx ebx
ret
endf

View File

@ -0,0 +1,757 @@
;-----------------------------------------------------------------------------
func draw_editor ;////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov ebx,[cur_tab.Editor.Bounds.Left-2]
mov bx,word[cur_tab.Editor.Bounds.Right]
sub bx,word[cur_tab.Editor.Bounds.Left]
inc ebx
mov ecx,[cur_tab.Editor.Bounds.Top-2]
mov cx,word[cur_tab.Editor.Bounds.Bottom]
sub cx,word[cur_tab.Editor.Bounds.Top]
inc ecx
mov edx,[cl_3d_inset]
call draw_framerect
@^
mov ebx,[cur_tab.Editor.Bounds.Left-2]
mov bx,word[cur_tab.Editor.Bounds.Right]
mov ecx,[cur_tab.Editor.Bounds.Top-2]
mov cx,word[cur_tab.Editor.Bounds.Top]
mcall 38,,,[cl_3d_inset]
mov ecx,[cur_tab.Editor.Bounds.Bottom-2]
mov cx,word[cur_tab.Editor.Bounds.Bottom]
mcall
mov bx,word[cur_tab.Editor.Bounds.Left]
mov cx,word[cur_tab.Editor.Bounds.Top]
mcall
mov ebx,[cur_tab.Editor.Bounds.Right-2]
mov bx,word[cur_tab.Editor.Bounds.Right]
mov cx,word[cur_tab.Editor.Bounds.Top]
mcall
^@
mov [cur_tab.Editor.Gutter.Visible],0
test [options],OPTS_LINENUMS
jnz @f
xor eax,eax ;! mov eax,2+LCHGW
jmp .lp1
@@: inc [cur_tab.Editor.Gutter.Visible]
mov edi,p_info+100
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines]
mov ecx,10
call uint2str
lea eax,[edi-p_info-100]
cmp eax,3
jae @f
mov eax,3
@@: imul eax,6
add eax,8
.lp1: mov [cur_tab.Editor.Gutter.Width],eax ;! [left_ofs],eax
mov [left_ofs],eax
call draw_editor_gutter
call draw_editor_vscroll
call draw_editor_hscroll
call draw_editor_text
call draw_editor_caret
ret
endf
;-----------------------------------------------------------------------------
func draw_editor_gutter ;/////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
cmp [cur_tab.Editor.Gutter.Visible],0
je .exit
add esp,-4*8*2
mov ebx,[cur_tab.Editor.Bounds.Left-2]
mov bx,word[cur_tab.Editor.Gutter.Width]
add ebx,0x00010000
mov ecx,[cur_tab.Editor.Bounds.Top-2]
mov cx,word[cur_tab.Editor.Bounds.Bottom]
sub cx,word[cur_tab.Editor.Bounds.Top]
add cx,-SCRLW
add ecx,0x00010000
dec cx
mcall 13,,,[cl_3d_normal]
add bx,word[cur_tab.Editor.Bounds.Left]
push bx
shl ebx,16
pop bx
add ecx,[cur_tab.Editor.Bounds.Top]
mcall 38,,,[cl_3d_inset]
add ebx,-2*65536
mov bx,word[cur_tab.Editor.Bounds.Top]
add bx,3
mov edi,[sc.work_text]
mov ecx,[cur_tab.Editor.TopLeft.Y]
inc ecx
mov edx,p_info+100
@@: pushad
push eax edx edi
mov eax,ecx
mov ecx,10
mov edi,edx
call uint2str
mov esi,edi
pop edi edx eax
sub esi,edx
imul eax,esi,6*65536
sub ebx,eax
mcall 4,,edi
popad
add ebx,LINEH
inc ecx
cmp ecx,[cur_tab.Editor.Lines]
jg @f
mov esi,ecx
sub esi,[cur_tab.Editor.TopLeft.Y]
cmp esi,[lines.scr]
jbe @b
@@: add esp,4*8*2
.exit:
ret
endf
;-----------------------------------------------------------------------------
func draw_editor_vscroll ;////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
;!!!!!!!!!!!!!!!!!!
mov ebx,[cur_tab.Editor.Bounds.Right]
shl ebx,16
add ebx,(-SCRLW)*65536+SCRLW
mov ecx,[cur_tab.Editor.Bounds.Top-2]
mov cx,SCRLW
mcall 8,,,'UP' or 0x40000000
pushad
sar ebx,16
sar ecx,16
push ebx ecx SCRLW SCRLW
call draw_3d_panel
popad
mov eax,8
;!!!!!!!!!!!!!!!!!!
pushad
push 0x18
shr ecx,16
mov bx,cx
add ebx,(SCRLW/2-2)*65536+SCRLW/2-3
mcall 4,,[sc.work_text],esp,1
add esp,4
popad
;!!!!!!!!!!!!!!!!!!
mov ecx,[cur_tab.Editor.Bounds.Bottom]
shl ecx,16
add ecx,(-SCRLW*2)*65536+SCRLW
mcall ,,,'DN' or 0x40000000
pushad
sar ebx,16
sar ecx,16
push ebx ecx SCRLW SCRLW
call draw_3d_panel
popad
mov eax,8
;!!!!!!!!!!!!!!!!!!
pushad
push 0x19
shr ecx,16
mov bx,cx
add ebx,(SCRLW/2-2)*65536+SCRLW/2-3
mcall 4,,[sc.work_text],esp,1
add esp,4
popad
push ebx
mov eax,[cur_tab.Editor.Lines]
mov ebx,[lines.scr]
mov ecx,[cur_tab.Editor.TopLeft.Y]
mov edx,[cur_tab.Editor.Bounds.Bottom]
sub edx,[cur_tab.Editor.Bounds.Top]
add edx,-SCRLW*3+1
call get_scroll_vars
mov [cur_tab.Editor.VScroll.Top],eax
mov [cur_tab.Editor.VScroll.Size],ebx
pop ebx
mov ecx,eax
add ecx,[cur_tab.Editor.Bounds.Top]
add ecx,SCRLW+1
;!!!!!!!!!!!!!!!!!!
pushad
sar ebx,16
push ebx ecx SCRLW [cur_tab.Editor.VScroll.Size]
dec dword[esp]
call draw_3d_panel
popad
mov eax,13
;!!!!!!!!!!!!!!!!!!
add ebx,1*65536-1
mov ecx,[cur_tab.Editor.Bounds.Top-2]
mov cx,word[cur_tab.Editor.VScroll.Top]
add ecx,(SCRLW+1)*65536
mov edx,[sc.work]
or cx,cx
jle @f
mcall 13
@@:
mov ecx,[cur_tab.Editor.Bounds.Top]
add ecx,[cur_tab.Editor.VScroll.Top]
add ecx,[cur_tab.Editor.VScroll.Size]
add ecx,SCRLW+1
mov di,cx
shl ecx,16
mov cx,word[cur_tab.Editor.Bounds.Bottom]
sub cx,di
sub cx,SCRLW*2;+1
jle @f
mcall
@@:
rol ebx,16
dec bx
push bx
rol ebx,16
pop bx
mov ecx,[cur_tab.Editor.Bounds.Top-2]
mov cx,word[cur_tab.Editor.Bounds.Bottom]
add ecx,(SCRLW)*65536-SCRLW*2-1
mcall 38,,,[cl_3d_inset]
ret
endf
;-----------------------------------------------------------------------------
func draw_editor_hscroll ;////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov ebx,[cur_tab.Editor.Bounds.Left-2]
mov bx,SCRLW
mov ecx,[cur_tab.Editor.Bounds.Bottom]
shl ecx,16
add ecx,(-SCRLW)*65536+SCRLW
mcall 8,,,'LT' or 0x40000000
pushad
sar ebx,16
sar ecx,16
push ebx ecx SCRLW SCRLW
call draw_3d_panel
popad
;!!!!!!!!!!!!!!!!!!
pushad
push 0x1B
shr ecx,16
mov bx,cx
add ebx,(SCRLW/2-2)*65536+SCRLW/2-3
mcall 4,,[sc.work_text],esp,1
add esp,4
popad
;!!!!!!!!!!!!!!!!!!
mov ebx,[cur_tab.Editor.Bounds.Right]
shl ebx,16
add ebx,(-SCRLW*2)*65536+SCRLW
mcall 8,,,'RT' or 0x40000000
pushad
sar ebx,16
sar ecx,16
push ebx ecx SCRLW SCRLW
call draw_3d_panel
popad
;!!!!!!!!!!!!!!!!!!
pushad
push 0x1A
shr ecx,16
mov bx,cx
add ebx,(SCRLW/2-2)*65536+SCRLW/2-3
mcall 4,,[sc.work_text],esp,1
add esp,4
popad
push ecx
mov eax,[cur_tab.Editor.Columns]
mov ebx,[columns.scr]
mov ecx,[cur_tab.Editor.TopLeft.X]
mov edx,[cur_tab.Editor.Bounds.Right]
add edx,-(SCRLW*3)
call get_scroll_vars
mov [cur_tab.Editor.HScroll.Top],eax
mov [cur_tab.Editor.HScroll.Size],ebx
pop ecx
mov ebx,eax
add ebx,[cur_tab.Editor.Bounds.Left]
add ebx,SCRLW+1
shl ebx,16
mov bx,word[cur_tab.Editor.HScroll.Size]
;!!!!!!!!!!!!!!!!!!
pushad
sar ecx,16
rol ebx,16
movsx eax,bx
sar ebx,16
dec ebx
push eax ecx ebx SCRLW
call draw_3d_panel
popad
;!!!!!!!!!!!!!!!!!!
add ecx,1*65536-1
mov ebx,[cur_tab.Editor.Bounds.Left-2]
mov bx,word[cur_tab.Editor.Bounds.Left]
mov bx,word[cur_tab.Editor.HScroll.Top]
add ebx,(1+SCRLW)*65536
mcall 13,,,[sc.work]
mov ebx,[cur_tab.Editor.Bounds.Left]
add ebx,1+SCRLW
add ebx,[cur_tab.Editor.HScroll.Top]
add ebx,[cur_tab.Editor.HScroll.Size]
mov di,bx
shl ebx,16
mov bx,word[cur_tab.Editor.Bounds.Right]
sub bx,di
sub bx,SCRLW*2
jle @f
mcall
@@:
mov ebx,[cur_tab.Editor.Bounds.Left-2]
mov bx,word[cur_tab.Editor.Bounds.Right]
add ebx,(SCRLW)*65536-SCRLW*2-1
rol ecx,16
dec cx
push cx
rol ecx,16
pop cx
mcall 38,,,[cl_3d_inset]
ret
endf
;-----------------------------------------------------------------------------
func draw_editor_text ;///////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Bounds.Bottom]
sub eax,[cur_tab.Editor.Bounds.Top]
cmp eax,LINEH
jge @f
ret
@@:
call init_sel_vars
call check_bottom_right
pushad
mov eax,[cur_tab.Editor.Bounds.Left]
add eax,[cur_tab.Editor.Gutter.Width]
add eax,LCHGW+3
mov [left_ofs],eax
mov eax,[cur_tab.Editor.Bounds.Top]
add eax,3
mov [top_ofs],eax
mov ebx,[top_ofs]
add ebx,[left_ofs-2]
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
push ecx
call get_line_offset
.start:
add esp,4
mov ecx,[lines.scr]
or ecx,ecx
jle .exit
add esp,-4
imul ebp,[cur_tab.Editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536
mov eax,[lines.scr]
sub eax,[cur_tab.Editor.Lines] ;! eax,[lines]
mov [draw_blines],eax
.next_line:
push ecx ebx
mov ecx,ebx
shl ecx,16
mov cl,LINEH
mov ebx,[cur_tab.Editor.Bounds.Right]
;sub ebx,[cur_tab.Editor.Bounds.Left]
add ebx,-SCRLW
add ebx,[left_ofs-2]
sub ebx,[left_ofs]
add ebx,-2*65536+2
; selection (text background)
mov [in_sel],0
mov edx,[color_tbl+4*5]
mov eax,[esp+4*2]
cmp eax,[sel.begin.y]
jl .lp6
je .lp1
cmp eax,[sel.end.y]
jg .lp6
je .lp3
jmp .lp6.2
.lp1: mov eax,[sel.begin.y]
cmp eax,[sel.end.y]
je .lp5
.lp2: mov eax,[sel.begin.x]
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
jle .lp6.2
cmp eax,[columns.scr]
jge .lp6
imul eax,6
pushad
sub bx,ax
rol ebx,16
mov bx,ax
add ebx,[left_ofs]
add ebx,-2
rol ebx,16
mov edx,[color_tbl+4*7]
mcall 13
popad
mov bx,ax
mov [in_sel],2
jmp .lp6
.lp3: mov eax,[sel.begin.y]
cmp eax,[sel.end.y]
je .lp5
.lp4: mov eax,[sel.end.x]
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
jle .lp6
cmp eax,[columns.scr]
jg .lp6.2
imul eax,6
pushad
sub bx,ax
rol ebx,16
add eax,[left_ofs];OLEFT-1
add eax,-2
mov bx,ax
rol ebx,16
mcall 13
popad
inc eax
mov edx,[color_tbl+4*7]
mov bx,ax
mov [in_sel],3
jmp .lp6
.lp5: mov eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
cmp eax,[sel.begin.x]
jge .lp4
add eax,[columns.scr]
cmp eax,[sel.end.x]
jl .lp2
mov eax,[sel.begin.x]
cmp eax,[sel.end.x]
je .lp6
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
imul eax,6
pushad
mov ebx,[sel.end.x]
sub ebx,[sel.begin.x]
imul ebx,6
sal ebx,16
dec eax
add eax,[left_ofs]
mov bx,ax
rol ebx,16
mov edx,[color_tbl+4*7]
mcall 13
movzx eax,bx
sar ebx,16
add eax,ebx
mov ebx,eax
sal ebx,16
sub ax,[esp+4*4]
neg ax
add ax,word[left_ofs]
add ax,-2
mov bx,ax
mov edx,[color_tbl+4*5]
mcall 13
popad
mov bx,ax
mov [in_sel],4
jmp .lp6
.lp6.2:
mov edx,[color_tbl+4*7]
inc [in_sel]
.lp6:
mcall 13
lodsd
pushad
mov edx,[color_tbl+4*5]
test eax,0x00010000
jz @f
mov edx,[color_tbl+4*8]
test eax,0x00020000
jz @f
mov edx,[color_tbl+4*9]
@@: mov ebx,[left_ofs]
add ebx,-LCHGW-2;-4
shl ebx,16
mov bx,LCHGW
mcall 13
popad
xor ecx,ecx
and eax,0x0000FFFF
mov [cur_line_len],eax
or eax,eax
ja .next_block
add esp,4*2
jmp .exit ; .draw_cursor
.next_block:
push esi ecx
call get_next_part
pop ebx
push ecx
mov ecx,eax
push esi ebx
mov eax,ebx
sub ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col]
cmp ebx,[columns.scr]
jge .skip_t
add ebx,esi
jle .skip_t
mov ebx,[esp+8+4*2] ;// 4*2=esi+ebx
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
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 ebx,eax
mov eax,[esp] ; ebx
add eax,[esp+4] ; esi
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
sub eax,[columns.scr]
jle .qweqwe
sub esi,eax
.qweqwe:
mov al,[in_sel]
cmp al,0
je .draw_t
dec al
jz .ya4
.nt1: dec al
jnz .nt2
mov eax,[esp]
cmp eax,[sel.begin.x]
jge .ya4
add eax,[esp+4]
cmp eax,[sel.begin.x]
jl .draw_t
;---[ selection crosses block from the right ]-(-
.ya1: mov eax,esi
mov esi,[sel.begin.x]
sub esi,[esp]
pushad
mov ecx,[cur_tab.Editor.TopLeft.X] ;! ecx,[left_col]
sub ecx,[esp+4*8]
jle @f
sub esi,ecx
sub [esp+4],ecx
@@: sub eax,esi
add edx,esi
imul esi,6
rol ebx,16
add bx,si
rol ebx,16
mov esi,eax
mov ecx,[color_tbl+4*6]
mcall 4
popad
jmp .draw_t
;----------------------------------------------)-
.nt2: dec al
jnz .nt3
mov eax,[esp]
cmp eax,[sel.end.x]
jge .draw_t
add eax,[esp+4]
cmp eax,[sel.end.x]
jl .ya4
;---[ selection crosses block from the left ]--(-
.ya2: mov eax,[sel.end.x]
sub eax,[esp]
push ebx
mov ebx,[esp+4]
sub ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col]
jge .ya2.1
add eax,ebx
.ya2.1:
pop ebx
pushad
mov esi,eax
mov ecx,[color_tbl+4*6]
mcall 4
popad
sub esi,eax
add edx,eax
imul eax,6*65536
add ebx,eax
jmp .draw_t
;----------------------------------------------)-
.nt3: mov eax,[esp]
cmp eax,[sel.end.x]
jge .draw_t
cmp eax,[sel.begin.x]
jge @f
add eax,[esp+4]
cmp eax,[sel.begin.x]
jl .draw_t
cmp eax,[sel.end.x]
jl .ya1
;---[ selection inside block ]-----------------(-
mov eax,esi
mov esi,[sel.begin.x]
sub esi,[esp]
push eax
mov eax,[esp+4]
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
jge .nt3.1
add esi,eax
.nt3.1:
pop eax
sub eax,esi
pushad
add edx,esi
imul esi,6*65536
add ebx,esi
mov esi,[sel.end.x]
sub esi,[sel.begin.x]
mov ecx,[color_tbl+4*6]
sub eax,esi
push eax
mcall 4
add edx,esi
imul esi,6*65536
add ebx,esi
pop esi
mov ecx,[esp+4*6]
mcall 4
popad
jmp .draw_t
;----------------------------------------------)-
@@: add eax,esi
dec eax
cmp eax,[sel.end.x]
jge .ya2
;---[ block inside selection ]-----------------(-
.ya4: mov ecx,[color_tbl+4*6]
;----------------------------------------------)-
.draw_t:
mcall 4;[esp+8]
.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
jl .next_block
pop ebx ecx
and ebx,0x0000FFFF
add ebx,[left_ofs-2]
add ebx,LINEH
add esi,[cur_line_len];LINE_WIDTH
inc dword[esp]
dec ecx
jg .next_line
.exit:
cmp [draw_blines],0
jl @f
mov ecx,[esp-8]
shl ecx,16
mov cx,word[cur_tab.Editor.Bounds.Bottom]
sub cx,[esp-8]
add cx,-SCRLW
mov eax,[cur_tab.Editor.Bounds.Left]
add eax,[cur_tab.Editor.Gutter.Width]
inc eax
mov ebx,eax
shl ebx,16
mov bx,word[cur_tab.Editor.Bounds.Right]
sub bx,ax
add ebx,-SCRLW
mcall 13,,,[color_tbl+4*5]
@@:
popad
add esp,4
ret
endf
;-----------------------------------------------------------------------------
func draw_editor_caret ;//////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
cmp [bot_mode],0
jne @f
mov ebx,[cur_tab.Editor.Caret.X]
sub ebx,[cur_tab.Editor.TopLeft.X]
js @f
cmp ebx,[columns.scr]
ja @f
imul ebx,6
add ebx,[left_ofs]
dec ebx
push bx
shl ebx,16
pop bx
mov eax,[cur_tab.Editor.Caret.Y]
sub eax,[cur_tab.Editor.TopLeft.Y]
js @f
cmp eax,[lines.scr]
jge @f
imul eax,LINEH
add eax,[top_ofs]
mov esi,eax
shl esi,16
add eax,LINEH-2
mov si,ax
mov ecx,2
cmp [ins_mode],0
jne .lp8
add cl,4
.lp8: push ecx
mcall 38,,esi,0x01000000
add ebx,0x00010001
pop ecx
loop .lp8
@@:
ret
endf

View File

@ -10,18 +10,18 @@ func save_file ;//////////////////////////////////////////////////////////////
rep movsb
mov byte[edi],0
mov esi,AREA_EDIT ; 0x70000 = 448 Kbytes (maximum)
mov edi,AREA_TEMP
mov esi,[cur_tab.Editor.Data] ;! AREA_EDIT ; 0x70000 = 448 Kbytes (maximum)
mov edi,0 ;!!! AREA_TEMP
.new_string:
call save_string
cmp dword[esi],0
jne .new_string
sub edi,AREA_TEMP+2 ; minus last CRLF
sub edi,0 ;!!! AREA_TEMP+2 ; minus last CRLF
;! mov [filelen],edi
cmp byte[f_info.path],'/'
je .systree_save
mcall 33,f_info.path,AREA_TEMP,edi,0;[filelen],0
mcall 33,f_info.path,0,edi,0 ;!!! AREA_TEMP,edi,0;[filelen],0
or eax,eax
jz .exit
; call file_not_found
@ -40,7 +40,7 @@ func save_file ;//////////////////////////////////////////////////////////////
mov [f_info70+0],2
mov [f_info70+12],edi
mov [f_info70+16],AREA_TEMP
mov [f_info70+16],0 ;!!! AREA_TEMP
mov byte[f_info70+20],0
mov [f_info70+21],f_info.path
mcall 70,f_info70
@ -51,7 +51,7 @@ func save_file ;//////////////////////////////////////////////////////////////
jnz .exit.2
.exit:
mov [modified],0
mov [cur_tab.Editor.Modified],0 ;! [modified],0
clc
ret
@ -145,48 +145,13 @@ func set_status_fs_error
@@: inc esi
mov [s_status],esi
pop eax
call writepos
ret
endf
;-----------------------------------------------------------------------------
func load_hd_file ;///////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov [f_info+0],0
mov [f_info+8],300000/512
; mov esi,s_fname
; mov edi,f_info.path;pathfile_read
; mov ecx,PATHL
; cld
; rep movsb
;mcall 58,f_info ; fileinfo_read
mov [f_info70+0],0
mov [f_info70+4],0
mov [f_info70+8],0
mov [f_info70+12],300000;/512
mov [f_info70+16],AREA_TEMP
mov byte[f_info70+20],0
mov [f_info70+21],f_info.path
mcall 70,f_info70
call set_status_fs_error
xchg eax,ebx
inc eax
test ebx,ebx
je load_file.file_found
cmp ebx,6 ;// ATV driver fix (6 instead of 5)
je load_file.file_found
; jmp file_not_found
stc
call draw_statusbar
ret
endf
;-----------------------------------------------------------------------------
func load_file ;//////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov esi,tb_opensave.text
mov edi,f_info.path
movzx ecx,[tb_opensave.length]
@ -195,24 +160,81 @@ func load_file ;//////////////////////////////////////////////////////////////
rep movsb
mov byte[edi],0
cmp byte[f_info.path],'/'
je load_hd_file
xor eax,eax
mov [f_info70+0],5
mov [f_info70+4],eax
mov [f_info70+8],eax
mov [f_info70+12],eax
mov [f_info70+16],file_info
mov byte[f_info70+20],al
mov [f_info70+21],f_info.path
mcall 70,f_info70
mov [f_info70+0],0
mov eax,dword[file_info.Size]
mov [f_info70+12],eax
call mem.Alloc
mov [f_info70+16],eax
mcall 70,f_info70
mcall 6,f_info.path,0,16800,AREA_TEMP ; 6 = open file
inc eax ; eax = -1 -> file not found
jnz .file_found
; jmp file_not_found
call set_status_fs_error
mov esi,[f_info70+16]
xchg eax,ebx
test ebx,ebx
je .file_found
cmp ebx,6 ;// ATV driver fix (6 instead of 5)
je .file_found
mov eax,[f_info70+16]
call mem.Free
stc
ret
.file_found:
dec eax
mov [filesize],eax
mov [lines],1
mov [columns],0
mov esi,AREA_TEMP
mov edi,AREA_EDIT
mov edx,eax
mov ecx,eax
call create_tab
push ecx esi edi
mov esi,tb_opensave.text
lea edi,[ebp+TABITEM.Editor.FilePath]
;mov ecx,[f_info.length]
movzx ecx,[tb_opensave.length]
rep movsb
mov byte[edi],0
lea edi,[ebp+TABITEM.Editor.FilePath]
movzx ecx,[tb_opensave.length]
@@: cmp byte[edi+ecx-1],'/'
je @f
dec ecx
jmp @b
@@: mov [ebp+TABITEM.Editor.FileName],ecx
call flush_cur_tab
pop edi esi ecx
call load_from_memory
mov eax,[f_info70+16]
call mem.Free
clc
ret
endf
;-----------------------------------------------------------------------------
func load_from_memory ;///////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; ECX = data length
; ESI = data pointer
; EBP = EDITOR*
;-----------------------------------------------------------------------------
call get_lines_in_file
mov [ebp+EDITOR.Lines],eax
imul ebx,eax,14
add ebx,ecx
mov eax,[ebp+EDITOR.Data]
call mem.ReAlloc
mov [ebp+EDITOR.Data],eax
mov [ebp+EDITOR.Columns],0
mov edi,eax
mov edx,ecx
.next_line:
mov ebx,edi
@ -244,11 +266,10 @@ func load_file ;//////////////////////////////////////////////////////////////
sub eax,10
jnz @f
inc eax
@@: cmp eax,[columns]
@@: cmp eax,[ebp+EDITOR.Columns] ;! eax,[columns]
jbe @f
mov [columns],eax
@@: mov [modified],0
clc
mov [ebp+EDITOR.Columns],eax ;! [columns],eax
@@: mov [ebp+EDITOR.Modified],0 ;! [modified],0
ret
.CR: cmp byte[esi],10
@ -261,11 +282,11 @@ func load_file ;//////////////////////////////////////////////////////////////
lea eax,[edi-4]
sub eax,ebx
mov [ebx],eax
inc [lines]
;inc [cur_tab.Editor.Lines] ;! [lines]
add eax,-10
cmp eax,[columns]
cmp eax,[ebp+EDITOR.Columns] ;! eax,[columns]
jbe .next_line
mov [columns],eax
mov [ebp+EDITOR.Columns],eax ;! [columns],eax
jmp .next_line
.TB: lea eax,[edi-4]
@ -278,30 +299,3 @@ func load_file ;//////////////////////////////////////////////////////////////
rep stosb
jmp .next_char
endf
;-----------------------------------------------------------------------------
func new_file ;///////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; mcall 55,eax,error_beep ; beep
mov [lines],1 ; open empty document
mov [columns],1
xor eax,eax
mov [top_line],eax
mov [pos.x],eax
mov [pos.y],eax
mov edi,AREA_EDIT+4
mov ecx,10
mov [edi-4],ecx
mov [edi+10],eax
mov al,' '
cld
rep stosb
mov [f_info.length],0
mov [modified],0
mov [asm_mode],0
call update_caption
call drawwindow
ret
endf

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,179 @@
sz htext,'TINYPAD ',APP_VERSION
menubar_res main_menu,\
ru,'” ©«' ,mm.File ,onshow.file ,\
ru,'<27>à ¢ª ' ,mm.Edit ,onshow.edit ,\
ru,'<27>®¨áª' ,mm.Search ,onshow.search ,\
ru,'‡ ¯ãáª' ,mm.Run ,onshow.run ,\
ru,'Š®¤¨à®¢ª ',mm.Encoding,onshow.recode ,\
ru,'Ž¯æ¨¨' ,mm.Options ,onshow.options,\
\
en,'File' ,mm.File ,onshow.file ,\
en,'Edit' ,mm.Edit ,onshow.edit ,\
en,'Search' ,mm.Search ,onshow.search ,\
en,'Run' ,mm.Run ,onshow.run ,\
en,'Encoding',mm.Encoding,onshow.recode ,\
en,'Options' ,mm.Options ,onshow.options
popup_res mm.File,\
ru,'<27>®¢ë©' ,'Ctrl+N' ,New ,\
ru,'Žâªàëâì...' ,'Ctrl+O' ,Open ,\
ru,'‘®åà ­¨âì' ,'Ctrl+S' ,Save ,\
ru,'‘®åà ­¨âì ª ª...','Ctrl+Shift+S',SaveAs,\
ru,'-' ,'' , ,\
ru,'‚ë室' ,'Alt+X' ,Exit ,\
\
en,'New' ,'Ctrl+N' ,New ,\
en,'Open...' ,'Ctrl+O' ,Open ,\
en,'Save' ,'Ctrl+S' ,Save ,\
en,'Save as...','Ctrl+Shift+S',SaveAs,\
en,'-' ,'' , ,\
en,'Exit' ,'Alt+X' ,Exit
popup_res mm.Edit,\
ru,'‚ë१ âì' ,'Ctrl+X',Cut ,\
ru,'Š®¯¨à®¢ âì' ,'Ctrl+C',Copy ,\
ru,'‚áâ ¢¨âì' ,'Ctrl+V',Insert,\
ru,'“¤ «¨âì' ,'' ,Delete,\
ru,'-' ,'' , ,\
ru,'‚뤥«¨âì ¢áñ','Ctrl+A',SelAll,\
\
en,'Cut' ,'Ctrl+X',Cut ,\
en,'Copy' ,'Ctrl+C',Copy ,\
en,'Paste' ,'Ctrl+V',Insert,\
en,'Delete' ,'' ,Delete,\
en,'-' ,'' , ,\
en,'Select all','Ctrl+A',SelAll
popup_res mm.Search,\
ru,'<27>¥à¥©â¨...' ,'Ctrl+G',Position,\
ru,'-' ,'' , ,\
ru,'<27> ©â¨...' ,'Ctrl+F',Find ,\
ru,'<27> ©â¨ ¤ «¥¥','F3' ,FindNext,\
ru,'‡ ¬¥­¨âì...','Ctrl+H',Replace ,\
\
en,'Position...','Ctrl+G',Position,\
en,'-' ,'' , ,\
en,'Find...' ,'Ctrl+F',Find ,\
en,'Find next' ,'F3' ,FindNext,\
en,'Replace...' ,'Ctrl+H',Replace
popup_res mm.Run,\
ru,'‡ ¯ãáâ¨âì' ,'F9' ,Run ,\
ru,'Š®¬¯¨«¨à®¢ âì' ,'Ctrl+F9',Compile ,\
ru,'-' ,'' , ,\
ru,'„®áª  ®â« ¤ª¨' ,'' ,DbgBoard,\
ru,'‘¨á⥬­ë¥ ä㭪樨','' ,SysFuncs,\
\
en,'Run' ,'F9' ,Run ,\
en,'Compile' ,'Ctrl+F9',Compile ,\
en,'-' ,'' , ,\
en,'Debug board' ,'' ,DbgBoard,\
en,'System functions' ,'' ,SysFuncs
popup_res mm.Encoding,\
@!,'CP866 -> CP1251','',CP866.CP1251,\
@!,'CP1251 -> CP866' ,'',CP1251.CP866,\
@!,'-' ,'', ,\
@!,'CP866 -> KOI8-R','',CP866.KOI8R ,\
@!,'KOI8-R -> CP866' ,'',KOI8R.CP866 ,\
@!,'-' ,'', ,\
@!,'CP1251 -> KOI8-R','',CP1251.KOI8R,\
@!,'KOI8-R -> CP1251','',KOI8R.CP1251
popup_res mm.Options,\
ru,'‚­¥è­¨© ¢¨¤...' ,'',Appearance ,\
ru,'-' ,'', ,\
ru,'<27>¥§®¯ á­®¥ ¢ë¤¥«¥­¨¥' ,'',SecureSel ,\
ru,'€¢â®¬ â¨ç¥áª¨¥ ᪮¡ª¨' ,'',AutoBrackets,\
ru,'€¢â®¬ â¨ç¥áª¨© ®âáâã¯' ,'',AutoIndents ,\
ru,'“¬­ ï â ¡ã«ïæ¨ï' ,'',SmartTabs ,\
ru,'Ž¯â¨¬ «ì­®¥ á®åà ­¥­¨¥','',OptimalFill ,\
ru,'-' ,'', ,\
ru,'<27>®¬¥à  áâப' ,'',LineNumbers ,\
\
en,'Appearance...' ,'',Appearance ,\
en,'-' ,'', ,\
en,'Secure selection' ,'',SecureSel ,\
en,'Automatic brackets' ,'',AutoBrackets,\
en,'Automatic indents' ,'',AutoIndents ,\
en,'Smart tabulation' ,'',SmartTabs ,\
en,'Optimal fill on saving','',OptimalFill ,\
en,'-' ,'', ,\
en,'Line numbers' ,'',LineNumbers
lsz s_modified,\
ru,'ˆ§¬¥­¥­®',\
en,'Modified'
lsz s_2filename,\
ru,'ˆ¬ï ä ©« :',\
en,'Filename:'
lsz s_2open,\
ru,'Žâªàëâì',\
en,'Open'
lsz s_2save,\
ru,'‘®åà ­¨âì',\
en,'Save'
lsz s_2find,\
ru,'<27> ©â¨',\
en,'Find'
db ':'
lsz s_2replace,\
ru,'‡ ¬¥­¨âì',\
en,'Replace'
db ':'
lsz s_2cancel,\
ru,'Žâ¬¥­ ',\
en,'Cancel'
lsz s_enter_filename,\
ru,<'‚¢¥¤¨â¥ ¨¬ï ä ©« ',0>,\
en,<'Enter filename',0>
lsz s_enter_text_to_find,\
ru,<'‚¢¥¤¨â¥ ⥪áâ ¤«ï ¯®¨áª ',0>,\
en,<'Enter text to find',0>
lsz s_enter_text_to_replace,\
ru,<'‚¢¥¤¨â¥ ⥪áâ ¤«ï § ¬¥­ë',0>,\
en,<'Enter text to replace',0>
lsz s_text_not_found,\
ru,<'„®á⨣­ãâ ª®­¥æ ä ©« , ⥪áâ ­¥ ­ ©¤¥­',0>,\
en,<'Reached end of file, text not found',0>
lszc s_fs_error,b,\
ru,<'Ž¯¥à æ¨ï § ¢¥à襭  ãᯥ譮 (0)',0>,\
ru,<'',0>,\
ru,<'”ã­ªæ¨ï ­¥ ¯®¤¤¥à¦¨¢ ¥âáï ¤«ï ¤ ­­®© ä ©«®¢®© á¨á⥬ë (2)',0>,\
ru,<'<27>¥¨§¢¥áâ­ ï ä ©«®¢ ï á¨á⥬  (3)',0>,\
ru,<'',0>,\
ru,<'<27>¥¢®§¬®¦­® ®âªàëâì ä ©« (5)',0>,\
ru,<'Ž¯¥à æ¨ï § ¢¥à襭  ãᯥ譮 (6)',0>,\
ru,<'€¤à¥á ­ å®¤¨âáï §  £à ­¨æ ¬¨ ¯ ¬ï⨠¯à®£à ¬¬ë (7)',0>,\
ru,<'<27>  ¤¨áª¥ ­¥â ᢮¡®¤­®£® ¬¥áâ  (8)',0>,\
ru,<'’ ¡«¨æ  FAT ã­¨ç⮦¥­  (9)',0>,\
ru,<'„®áâ㯠§ ¯à¥éñ­ (10)',0>,\
ru,<'Žè¨¡ª  ãáâனá⢠ (11)',0>,\
\
en,<'Operation executed successfully (0)',0>,\
en,<'',0>,\
en,<'Function is not supported for the given filesystem (2)',0>,\
en,<'Unknown filesystem (3)',0>,\
en,<'',0>,\
en,<'Unable to open file (5)',0>,\
en,<'Operation executed successfully (6)',0>,\
en,<'Pointer lies outside of application memory (7)',0>,\
en,<'Disk is full (8)',0>,\
en,<'FAT table is destroyed (9)',0>,\
en,<'Access denied (10)',0>,\
en,<'Device error (11)',0>
lsz sysfuncs_filename,\
ru,<'SYSFUNCR.TXT',0>,\
en,<'SYSFUNCS.TXT',0>
sz s_example,'EXAMPLE.ASM'
sz s_still ,'still'

View File

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

View File

@ -19,8 +19,8 @@ recode:
mov edi,table.koi.1251
.main:
mov ecx,[lines]
mov esi,AREA_EDIT
mov ecx,[cur_tab.Editor.Lines] ;! ecx,[lines]
mov esi,[cur_tab.Editor.Data] ;! AREA_EDIT
jecxz .exit
xor eax,eax
.lp0: dec ecx
@ -30,7 +30,7 @@ recode:
@@: dec edx
js .lp0
lodsb
add al,-$80
add al,-$80
js @b
mov al,[edi+eax]
mov [esi-1],al

View File

@ -0,0 +1,294 @@
sz s_defname,'Untitled',0
;-----------------------------------------------------------------------------
func flush_cur_tab ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; EBP = TABITEM*
;-----------------------------------------------------------------------------
push ecx esi edi
mov esi,cur_tab
mov edi,[tab_bar.Current.Ptr]
mov ecx,sizeof.TABITEM/4
cld
rep movsd
pop edi esi ecx
ret
endf
;-----------------------------------------------------------------------------
func set_cur_tab ;////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; EBP = TABITEM*
;-----------------------------------------------------------------------------
push ecx esi edi
cmp [tab_bar.Current.Ptr],0
je @f
call flush_cur_tab
@@: mov esi,ebp
mov edi,cur_tab
mov ecx,sizeof.TABITEM/4
rep movsd
mov [tab_bar.Current.Ptr],ebp
call update_caption
pop edi esi ecx
ret
endf
;-----------------------------------------------------------------------------
func create_tab ;/////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push eax ecx esi edi
inc [tab_bar.Items.Count]
imul ebx,[tab_bar.Items.Count],sizeof.TABITEM
mov eax,[tab_bar.Items]
mov ecx,eax
call mem.ReAlloc
mov [tab_bar.Items],eax
sub ecx,eax
sub [tab_bar.Current.Ptr],ecx
lea ebp,[eax+ebx-sizeof.TABITEM]
call set_cur_tab
mov eax,1024
call mem.Alloc
mov [cur_tab.Editor.Data],eax
mov [cur_tab.Editor.Lines],1
mov [cur_tab.Editor.Columns],1
xor eax,eax
mov [cur_tab.Editor.TopLeft.X],eax
mov [cur_tab.Editor.TopLeft.Y],eax
mov [cur_tab.Editor.Caret.X],eax
mov [cur_tab.Editor.Caret.Y],eax
mov [cur_tab.Editor.SelStart.X],eax
mov [cur_tab.Editor.SelStart.Y],eax
mov edi,[cur_tab.Editor.Data]
add edi,4
mov ecx,10
mov [edi-4],ecx
mov [edi+10],eax
mov al,' '
cld
rep stosb
mov esi,s_defname
mov edi,cur_tab.Editor.FilePath
mov ecx,s_defname.size
rep movsb
mov [cur_tab.Editor.FileName],0
mov [f_info.length],0
mov [cur_tab.Editor.Modified],0
mov [cur_tab.Editor.AsmMode],0
call flush_cur_tab
call update_caption
call drawwindow
mov ebp,cur_tab
pop edi esi ecx eax
ret
endf
;-----------------------------------------------------------------------------
func delete_tab ;/////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
ret
endf
;-----------------------------------------------------------------------------
func get_tab_size ;///////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; EBP = TABITEM*
;-----------------------------------------------------------------------------
push eax
cmp [tab_bar.Style],3
jae .lp1
lea eax,[ebp+TABITEM.Editor.FilePath]
add eax,[ebp+TABITEM.Editor.FileName]
call strlen
imul ebx,eax,6
add ebx,9
jmp .lp2
.lp1: call get_max_tab_width
mov ebx,eax
.lp2: mov ecx,TBARH-1
pop eax
ret
endf
;-----------------------------------------------------------------------------
func draw_tabctl ;////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov ebx,[tab_bar.Bounds.Left-2]
mov bx,word[tab_bar.Bounds.Right]
sub bx,word[tab_bar.Bounds.Left]
inc ebx
mov ecx,[tab_bar.Bounds.Top-2]
mov cx,word[tab_bar.Bounds.Bottom]
sub cx,word[tab_bar.Bounds.Top]
inc ecx
mov edx,[cl_3d_normal]
call draw_framerect
mov al,[tab_bar.Style]
dec al
jz .tabs_on_top
dec al
jz .tabs_on_bottom
dec al
jz .tabs_on_left
dec al
jz .tabs_on_right
ret
.tabs_on_top:
add ebx,1*65536-2
mov ecx,[tab_bar.Bounds.Top-2]
xor cx,cx
add ecx,1*65536+TBARH
mcall 13
add ecx,(TBARH-2)*65536-(TBARH-3)
mov edx,[cl_3d_inset]
call draw_framerect
ret
.tabs_on_bottom:
add ebx,1*65536-2
mov ecx,[tab_bar.Bounds.Bottom-2]
xor cx,cx
add ecx,-TBARH*65536+TBARH
mcall 13
mov cx,1
mcall ,,,[sc.work]
add ecx,-1*65536+2;-(TBARH-3)
mov edx,[cl_3d_inset]
call draw_framerect
mov ecx,[tab_bar.Items.Count]
mov ebp,[tab_bar.Items]
mov esi,[tab_bar.Bounds.Left]
inc esi
mov edi,[tab_bar.Bounds.Bottom]
add edi,-TBARH+1
@@: push ecx
call get_tab_size
rol ebx,16
mov bx,si
rol ebx,16
rol ecx,16
mov cx,di
rol ecx,16
mov edx,[cl_3d_inset]
call draw_framerect
cmp ebp,[tab_bar.Current.Ptr]
jne .lp1
push ebx ecx
add ebx,1*65536-2
dec ecx
mcall 13,,,[sc.work]
pop ecx ebx
.lp1:
pushad
lea eax,[ebp+TABITEM.Editor.FilePath]
add eax,[ebp+TABITEM.Editor.FileName]
mov edx,eax
call strlen
mov esi,eax
shr ecx,16
mov bx,cx
add ebx,0x00050005
mcall 4,,0x00000000
popad
movzx ebx,bx
lea esi,[esi+ebx+1]
add ebp,sizeof.TABITEM
pop ecx
dec ecx
jnz @b
ret
.tabs_on_left:
call get_max_tab_width
mov ebx,[tab_bar.Bounds.Left-2]
mov bx,ax
add ebx,1*65536
add ecx,1*65536-2
push eax
mcall 13
pop eax
add eax,-2
shl eax,16
add ebx,eax
mov bx,3
mov edx,[cl_3d_inset]
call draw_framerect
ret
.tabs_on_right:
call get_max_tab_width
mov ebx,[tab_bar.Bounds.Right-2]
mov bx,ax
shl eax,16
sub ebx,eax
add ecx,1*65536-2
mcall 13
add ebx,-1*65536
mov bx,3
mov edx,[cl_3d_inset]
call draw_framerect
ret
endf
func get_max_tab_width
mov eax,100
ret
endf
func align_editor_in_tab
m2m [cur_tab.Editor.Bounds.Left],[tab_bar.Bounds.Left]
m2m [cur_tab.Editor.Bounds.Top],[tab_bar.Bounds.Top]
m2m [cur_tab.Editor.Bounds.Right],[tab_bar.Bounds.Right]
m2m [cur_tab.Editor.Bounds.Bottom],[tab_bar.Bounds.Bottom]
inc [cur_tab.Editor.Bounds.Left]
inc [cur_tab.Editor.Bounds.Top]
dec [cur_tab.Editor.Bounds.Right]
dec [cur_tab.Editor.Bounds.Bottom]
mov al,[tab_bar.Style]
dec al
jz .tabs_on_top
dec al
jz .tabs_on_bottom
dec al
jz .tabs_on_left
dec al
jz .tabs_on_right
ret
.tabs_on_top:
add [cur_tab.Editor.Bounds.Top],TBARH
ret
.tabs_on_bottom:
sub [cur_tab.Editor.Bounds.Bottom],TBARH
ret
.tabs_on_left:
call get_max_tab_width
add [cur_tab.Editor.Bounds.Left],eax
ret
.tabs_on_right:
call get_max_tab_width
sub [cur_tab.Editor.Bounds.Right],eax
ret
endf

View File

@ -85,6 +85,7 @@ func textbox.draw ; TBOX* ebp
mov [tb.sel.x],ah
mcall 13,dword[tbox.x],dword[tbox.y],[color_tbl+4*5];[sc.work]
mov edx,[cl_3d_inset]
call draw_framerect
call textbox.get_width