Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 259 → Rev 258

/programs/develop/tinypad/trunk/tp-locale.inc
File deleted
/programs/develop/tinypad/trunk/tp-tabctl.asm
File deleted
\ No newline at end of file
/programs/develop/tinypad/trunk/tp-defines.inc
File deleted
/programs/develop/tinypad/trunk/tp-editor.asm
File deleted
\ No newline at end of file
/programs/develop/tinypad/trunk/tinypad.asm
1,9 → 1,9
;-----------------------------------------------------------------------------
; project name: TINYPAD
; compiler: flat assembler 1.67.15
; compiler: flat assembler 1.67.1
; memory to compile: 2.0/7.0 MBytes (without/with size optimizations)
; version: 4.0.4 pre
; last update: 2007-01-03 (Jan 3, 2007)
; last update: 2006-12-30 (Dec 30, 2006)
; minimal kernel: revision #138 (svn://kolibrios.org/kernel)
;-----------------------------------------------------------------------------
; originally by: Ville Michael Turjanmaa >> villemt@aton.co.jyu.fi
10,33 → 10,22
; maintained by: Mike Semenyako >> mike.dld@gmail.com
; Ivan Poddubny >> ivan-yar@bk.ru
;-----------------------------------------------------------------------------
; TODO (FOR 4.1.0):
; TODO:
; - optimize drawing (reduce flickering)
; - add vertical selection, undo, goto position, overwrite mode
; - 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)
; - improve window drawing with small dimensions
; - other bug-fixes and speed/size optimizations
; - other bugfixes 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:
; - statusbar contained hint after dialog operation cancelled
; - small drawing fix for gutter and line saved/modified markers
; - clear statusbar text if dialog operation cancelled
; 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
143,14 → 132,22
; 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,STATIC_MEM_END,MAIN_STACK,@PARAMS,self_path
header '01',1,@CODE,TINYPAD_END,AREA_ENDMEM,MAIN_STACK,@PARAMS,self_path
 
APP_VERSION equ '4.0.4 pre'
 
158,15 → 155,15
 
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 = 256 ; maximum path length (chars) !!! don't change !!!
PATHL = 255 ; maximum path length (chars) !!! don't change !!!
AMINS = 8 ; minimal scroll thumb size (pixels)
LCHGW = 3 ; changed/saved marker width
LCHGW = 2 ; changed/saved marker width
 
STATH = 16 ; status bar height
TBARH = 18 ; tab bar height
STATH = 14 ; status bar height
 
MEV_LDOWN = 1
MEV_LUP = 2
187,8 → 184,8
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,238, 98) ; modified line marker
RGB(108,226,108) ; saved line marker
RGB(255,255, 0) ; modified line marker
RGB( 0,255, 0) ; saved line marker
 
ins_mode db 1
 
223,26 → 220,12
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
279,35 → 262,17
;// diamond ]
 
add edx,20
 
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 60,1,AREA_TEMP-16 ; 0x10000-16
mov dword[AREA_TEMP-16+4],8 ; [0x10000-16+4],8
mcall 40,1000000b
mcall 23,200
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
 
mov ecx,[ebp+12]
mov esi,ebp
call create_tab
call load_from_memory
 
mov eax,ebp
call mem.Free
 
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
jmp @f
.noipc:
 
327,9 → 292,9
mov [tb_opensave.length],al
 
no_params:
;call btn.load_file;do_load_file
;jnc @f
call create_tab
call btn.load_file;do_load_file
jnc @f
call new_file
 
@@:
dec [do_not_draw]
342,7 → 307,7
;-----------------------------------------------------------------------------
 
still:
call draw_statusbar ; write current position & number of strings
call writepos ; write current position & number of strings
 
.skip_write:
mcall 10;23,50; wait here until event
364,7 → 329,7
;-----------------------------------------------------------------------------
; BL = run after compile
;-----------------------------------------------------------------------------
cmp [cur_tab.Editor.AsmMode],0 ;! [asm_mode],0
cmp [asm_mode],0
jne @f
ret
@@: mov esi,f_info.path ; s_fname
493,37 → 458,48
; @@: ret
;endf
 
set_opt:
func set_opt
test [options],al
je @f
not al
and [options],al
ret
@@: or [options],al
ret
endf
 
.line_numbers:
func set_line_numbers
mov al,OPTS_LINENUMS
jmp .main
.optimal_fill:
call set_opt
ret
endf
 
func set_optimal_fill
mov al,OPTS_OPTIMSAVE
jmp .main
.auto_indents:
call set_opt
ret
endf
 
func set_auto_indents
mov al,OPTS_AUTOINDENT
jmp .main
.auto_braces:
call set_opt
ret
endf
 
func set_auto_braces
mov al,OPTS_AUTOBRACES
jmp .main
.secure_sel:
call set_opt
ret
endf
 
func set_secure_sel
mov al,OPTS_SECURESEL
 
.main:
xor [options],al
; test [options],al
; je @f
; not al
; and [options],al
; ret
; @@: or [options],al
call set_opt
ret
endf
 
;-----------------------------------------------------------------------------
 
include 'tp-defines.inc'
 
include 'tp-draw.asm'
include 'tp-key.asm'
include 'tp-button.asm'
533,8 → 509,6
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'
585,7 → 559,6
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
609,7 → 582,6
\;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
641,10 → 613,15
 
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 \
655,6 → 632,7
0
 
add_table:
; times $61 db -$00
times $1A db -$20
times $25 db -$00
times $10 db -$20
663,8 → 641,15
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
694,19 → 679,247
dd 0
db '/RD/1/DOCPAK',0
 
;sz setup ,'SETUP ' ; to change keyboard layout
 
sz sysfuncs_param,'g',0
 
include 'tp-locale.inc'
lsz sysfuncs_filename,\
ru,<'SYSFUNCR.TXT',0>,\
en,<'SYSFUNCS.TXT',0>
 
sz htext,'TINYPAD ',APP_VERSION
 
lszc help_text,b,\
ru,'ŠŽŒ€„›:',\
ru,' ',\
ru,' CTRL+F1 : â® ®ª­®',\
ru,' CTRL+S : ¥à¢ ï áâப  ¤«ï ª®¯¨à®¢ ­¨ï',\
ru,' CTRL+E : ®á«¥¤­ïï áâப  ¤«ï ª®¯¨à®¢ ­¨ï',\
ru,' CTRL+P : ‚áâ ¢¨âì ¢ë¡à ­­®¥ ­  ⥪ãéãî ¯®§¨æ¨î',\
ru,' CTRL+D : “¤ «¨âì áâபã',\
ru,' CTRL+L : ‚áâ ¢¨âì áâபã-à §¤¥«¨â¥«ì',\
ru,' CTRL+[ : ¥à¥©â¨ ¢ ­ ç «® ä ©« ',\
ru,' CTRL+] : ¥à¥©â¨ ¢ ª®­¥æ ä ©« ',\
ru,' CTRL+F2 : ‡ £à㧨âì ä ©«',\
ru,' CTRL+F3 : ®¨áª',\
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,'à ¢ª ' ,popup_edit ,onshow.edit ,\
ru,'®¨áª' ,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,'®¢ë©' ,'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,'¥à¥©â¨...' ,'Ctrl+G',key.ctrl_g,\
ru,'-' ,'' ,0 ,\
ru,' ©â¨...' ,'Ctrl+F',key.ctrl_f,\
ru,' ©â¨ ¤ «¥¥','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,'¥§®¯ á­®¥ ¢ë¤¥«¥­¨¥' ,'',set_secure_sel,\
ru,'€¢â®¬ â¨ç¥áª¨¥ ᪮¡ª¨' ,'',set_auto_braces,\
ru,'€¢â®¬ â¨ç¥áª¨© ®âáâã¯' ,'',set_auto_indents,\
ru,'“¬­ ï â ¡ã«ïæ¨ï' ,'',0,\
ru,'Ž¯â¨¬ «ì­®¥ á®åà ­¥­¨¥','',set_optimal_fill,\
ru,'-' ,'',0,\
ru,'®¬¥à  áâப' ,'',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,' ©â¨',\
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,<'¥¨§¢¥áâ­ ï ä ©«®¢ ï á¨á⥬  (3)',0>,\
ru,<'',0>,\
ru,<'¥¢®§¬®¦­® ®âªàëâì ä ©« (5)',0>,\
ru,<'Ž¯¥à æ¨ï § ¢¥à襭  ãᯥ譮 (6)',0>,\
ru,<'€¤à¥á ­ å®¤¨âáï §  £à ­¨æ ¬¨ ¯ ¬ï⨠¯à®£à ¬¬ë (7)',0>,\
ru,<'  ¤¨áª¥ ­¥â ᢮¡®¤­®£® ¬¥áâ  (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>
 
sz symbols_ex,';?.%"',"'"
sz symbols ,'#&*\:/<>|{}()[]=+-, '
 
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
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
 
TINYPAD_END: ; end of file
 
self_path rb PATHL
715,26 → 928,38
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
753,6 → 978,7
 
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?
795,14 → 1021,13
 
bot_mode db ?
 
modified db ?
 
align 4
 
bot_dlg_height dd ?
bot_dlg_mode2 db ?
 
temp_buf dd ?
copy_buf dd ?
 
;-----------------------------------------------------------------------------
section @PARAMS ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;-----------------------------------------------------------------------------
813,6 → 1038,22
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
820,13 → 1061,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
POPUP_STACK:
 
STATIC_MEM_END:
 
diff10 'Main memory size',0,$
/programs/develop/tinypad/trunk/tp-button.asm
22,44 → 22,64
 
jmp still.skip_write
 
; cmp eax,BUTTON_SCRLUP
; jne not_up
btn.scroll_up:
dec [cur_tab.Editor.TopLeft.Y] ;! [top_line]
dec [top_line]
jns @f
inc [cur_tab.Editor.TopLeft.Y] ;! [top_line]
ret
inc [top_line]
ret;jmp still.skip_write
@@: call check_inv_all.skip_check
ret
; not_up:
 
; cmp eax,BUTTON_SCRLDN
; jne not_down
btn.scroll_down:
inc [cur_tab.Editor.TopLeft.Y] ;! [top_line]
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines]
inc [top_line]
mov eax,[lines]
sub eax,[lines.scr]
cmp eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
cmp eax,[top_line]
jge @f
dec [cur_tab.Editor.TopLeft.Y] ;! [top_line]
ret
dec [top_line]
;dec eax
;mov [top_line],eax
ret;jmp still.skip_write
@@: call check_inv_all.skip_check
ret
; not_down:
 
; cmp eax,BUTTON_SCRLLT
; jne not_left
btn.scroll_left:
dec [cur_tab.Editor.TopLeft.X] ;! [left_col]
dec [left_col]
jns @f
inc [cur_tab.Editor.TopLeft.X] ;! [left_col]
inc [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 [cur_tab.Editor.TopLeft.X] ;! [left_col]
mov eax,[cur_tab.Editor.Columns] ;! eax,[columns]
inc [left_col]
mov eax,[columns]
sub eax,[columns.scr]
cmp eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
cmp eax,[left_col]
jge @f
dec [cur_tab.Editor.TopLeft.X] ;! [left_col]
ret
dec [left_col]
;dec eax
;mov [left_col],eax
ret;jmp still.skip_write
@@: call check_inv_all.skip_check
ret
; not_right:
 
; SEARCH {
; search:
; cmp al,BUTTON_SEARCH
; jne no_search
btn.search:
key.f3:
call search
70,7 → 90,7
 
func search
cld
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
mov ecx,[pos.y]
mov edx,ecx
call get_line_offset
cmp word[esi],0
80,9 → 100,11
or eax,eax
jz .end_line.2
mov ecx,eax
sub ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
sub ecx,[pos.x]
push esi
add esi,[cur_tab.Editor.Caret.X] ;! esi,[pos.x]
add esi,[pos.x]
;dec ecx
;inc esi
jmp @f
 
.next_line:
118,15 → 140,15
 
.found:
add esp,4
mov [cur_tab.Editor.Caret.Y],edx ;! [pos.y],edx
mov [cur_tab.Editor.SelStart.Y],edx ;! [sel.y],edx
mov [pos.y],edx
mov [sel.y],edx
mov ecx,edx
lea eax,[esi-4]
call get_line_offset
sub eax,esi
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
mov [sel.x],eax
add eax,[s_search.size]
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov [pos.x],eax
mov [s_status],0
clc
ret
148,87 → 170,136
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
mov bl,0;[run_outfile],0
call start_fasm
ret
ret;jmp still
; @@: dec eax
; jnz @f
btn.compile_run:
key.f9:
mov bl,1
mov bl,1;[run_outfile],1
call start_fasm
ret
ret;jmp still
; @@: dec eax
; jnz @f
btn.debug_board:
call open_debug_board
ret
ret;jmp still
; @@: dec eax
; jnz still
btn.sysfuncs_txt:
call open_sysfuncs_txt
ret
ret;jmp still
; TOOLBAR }
 
; 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 [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 [top_line],eax
mov [left_col],eax
mov [pos.x],eax
mov [pos.y],eax
mov [sel.x],eax
mov [sel.y],eax
 
mov [cur_tab.Editor.Modified],al ;! [modified],al
mov [modified],al
 
; enable color syntax for ASM and INC files:
mov [cur_tab.Editor.AsmMode],al ;! [asm_mode],al
mov [asm_mode],al
 
mov eax,[f_info.length]
add eax,f_info.path
mov eax,[f_info.length] ; [s_fname.size]
add eax,f_info.path ; s_fname
mov byte[eax],0
mov ecx, dword [eax-3]
or ecx, 0x202020
cmp ecx, 'asm'
jne @f
inc [cur_tab.Editor.AsmMode] ;! [asm_mode]
inc [asm_mode]
jmp .nocol
@@: cmp ecx, 'inc'
jne .nocol
inc [cur_tab.Editor.AsmMode] ;! [asm_mode]
inc [asm_mode]
.nocol:
 
update_caption:
lea esi,[cur_tab.Editor.FilePath] ;! mov esi,f_info.path
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
mov edi,s_title
 
@@: lodsb
cmp al,0
je @f
stosb
jmp @b
@@:
cld
mov ecx,[f_info.length] ; [s_fname.size]
jecxz @f
;lea eax,[ecx+10]
;mov [s_title.size],eax
;cld
;mov ecx,[f_info.length]
;jecxz @f
;rep movsb
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
 
; call drawwindow
clc
ret
ret;jmp still
; LOAD_FILE }
 
; 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
239,6 → 310,11
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
249,6 → 325,31
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
/programs/develop/tinypad/trunk/tp-common.asm
4,62 → 4,60
push eax ebx
xor bl,bl
.chk_y:
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
mov eax,[pos.y]
or eax,eax
jge @f
mov [cur_tab.Editor.Caret.Y],0 ;! [pos.y],0
mov [pos.y],0
jmp .chk_dy
@@: cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines]
@@: cmp eax,[lines]
jl .chk_dy
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines]
mov eax,[lines]
dec eax
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
mov [pos.y],eax
.chk_dy:
mov eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
cmp eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
mov eax,[top_line]
cmp eax,[pos.y]
jle @f
m2m [cur_tab.Editor.TopLeft.Y],[cur_tab.Editor.Caret.Y]
;! push [pos.y]
;! pop [top_line]
push [pos.y]
pop [top_line]
inc bl
@@: add eax,[lines.scr]
cmp eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
cmp eax,[pos.y]
jg .chk_x
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
mov eax,[pos.y]
sub eax,[lines.scr]
inc eax
mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax
mov [top_line],eax
inc bl
.chk_x:
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
mov eax,[pos.x]
or eax,eax
jge @f
mov [cur_tab.Editor.Caret.X],0 ;! [pos.x],0
mov [pos.x],0
jmp .chk_dx
@@: cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns]
@@: cmp eax,[columns]
jl .chk_dx
mov eax,[cur_tab.Editor.Columns] ;! eax,[columns]
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov eax,[columns]
mov [pos.x],eax
.chk_dx:
mov eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
mov eax,[left_col]
cmp eax,[pos.x]
jle @f
m2m [cur_tab.Editor.TopLeft.X],[cur_tab.Editor.Caret.X]
;! push [pos.x]
;! pop [left_col]
push [pos.x]
pop [left_col]
inc bl
@@: add eax,[columns.scr]
cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
cmp eax,[pos.x]
jg @f
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
mov eax,[pos.x]
sub eax,[columns.scr]
inc eax
mov [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax
mov [left_col],eax
inc bl
@@: cmp [mev],MEV_LDOWN
jne .exit
push [cur_tab.Editor.Caret.X] [cur_tab.Editor.Caret.Y] ;! [pos.x] [pos.y]
pop [cur_tab.Editor.SelStart.Y] [cur_tab.Editor.SelStart.X] ;! [sel.y] [sel.x]
push [pos.x] [pos.y]
pop [sel.y] [sel.x]
.exit:
or bl,bl
clc
74,13 → 72,13
func clear_selection ;////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push eax ebx
mov eax,[cur_tab.Editor.SelStart.Y] ;! eax,[sel.y]
mov ebx,[cur_tab.Editor.Caret.Y] ;! ebx,[pos.y]
mov eax,[sel.y]
mov ebx,[pos.y]
cmp eax,ebx
jle @f
xchg eax,ebx
@@: push [cur_tab.Editor.Caret.X] [cur_tab.Editor.Caret.Y] ;! [pos.x] [pos.y]
pop [cur_tab.Editor.SelStart.Y] [cur_tab.Editor.SelStart.X] ;! [sel.y] [sel.x]
@@: push [pos.x] [pos.y]
pop [sel.y] [sel.x]
call draw_file.ex
pop ebx eax
ret
107,24 → 105,24
func check_bottom_right ;/////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push eax
mov eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
mov eax,[top_line]
add eax,[lines.scr]
cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines]
cmp eax,[lines]
jbe .lp1
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines]
mov eax,[lines]
sub eax,[lines.scr]
jns @f
xor eax,eax
@@: mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax
.lp1: mov eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
@@: mov [top_line],eax
.lp1: mov eax,[left_col]
add eax,[columns.scr]
cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns]
cmp eax,[columns]
jbe .exit
mov eax,[cur_tab.Editor.Columns] ;! eax,[columns]
mov eax,[columns]
sub eax,[columns.scr]
jns @f
xor eax,eax
@@: mov [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax
@@: mov [left_col],eax
.exit:
pop eax
ret
150,12 → 148,12
;-----------------------------------------------------------------------------
func check_inv_all ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
mov eax,[pos.y]
mov ecx,[top_line]
.skip_init:
call check_cur_vis
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
mov [cur_tab.Editor.TopLeft.Y],ecx ;! [top_line],ecx
mov [pos.y],eax
mov [top_line],ecx
.skip_check:
; call clear_screen
call draw_file
169,9 → 167,9
jb .low
mov edx,ecx
add edx,[lines.scr]
cmp edx,[cur_tab.Editor.Lines] ;! edx,[lines]
cmp edx,[lines]
jbe @f
mov edx,[cur_tab.Editor.Lines] ;! edx,[lines]
mov edx,[lines]
@@: cmp eax,edx
jb @f
lea ecx,[eax+1]
182,9 → 180,9
.low: mov ecx,eax
@@: mov edx,ecx
add edx,[lines.scr]
cmp edx,[cur_tab.Editor.Lines] ;! edx,[lines]
cmp edx,[lines]
jbe @f
mov ecx,[cur_tab.Editor.Lines] ;! ecx,[lines]
mov ecx,[lines]
sub ecx,[lines.scr]
jns @f
xor ecx,ecx
191,8 → 189,8
@@:;mov [top_line],ecx
 
pushad
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
mov ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col]
mov eax,[pos.x]
mov ebx,[left_col]
mov ecx,ebx
add ecx,[columns.scr]
cmp eax,ebx
203,10 → 201,10
sub ebx,[columns.scr]
jmp @f
.lp1: mov ebx,eax
@@: mov [cur_tab.Editor.TopLeft.X],ebx ;! [left_col],ebx
@@: mov [left_col],ebx
 
.exit:
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov [pos.x],eax
popad
 
ret
232,12 → 230,12
; ESI = line data offset
;-----------------------------------------------------------------------------
push eax ecx
mov esi,[cur_tab.Editor.Data] ;! AREA_EDIT
@@: dec ecx
js .exit
movzx eax,word[esi]
mov esi,AREA_EDIT
jecxz .exit
@@: movzx eax,word[esi]
dec ecx
lea esi,[esi+eax+4]
jmp @b
jnz @b
.exit:
pop ecx eax
ret
248,10 → 246,10
;-----------------------------------------------------------------------------
pushad
mov [sel.selected],1
mov eax,[cur_tab.Editor.SelStart.X] ;! eax,[sel.x]
mov ebx,[cur_tab.Editor.SelStart.Y] ;! ebx,[sel.y]
mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
mov edx,[cur_tab.Editor.Caret.Y] ;! edx,[pos.y]
mov eax,[sel.x]
mov ebx,[sel.y]
mov ecx,[pos.x]
mov edx,[pos.y]
cmp ebx,edx
jl .lp2
jne @f
355,20 → 353,6
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 ;////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push 0 eax
508,9 → 492,7
jbe .exit
sub ecx,edx
push ecx
mov edi,[cur_tab.Editor.Data] ;! AREA_TEMP2
add edi,[edi-4]
dec edi
mov edi,AREA_TEMP2
mov eax,esi
mov esi,edi
sub esi,ecx
520,7 → 502,6
neg ecx
lea ecx,[esi+ecx+1]
std
diff16 '32DC',0,$
rep movsb
pop edi ecx
add [eax],cx
535,8 → 516,6
;-----------------------------------------------------------------------------
func delete_selection ;///////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
; call init_sel_vars
 
cmp [sel.selected],0
je .exit.2
 
563,14 → 542,13
mov [edi-4],bx
add edi,[sel.begin.x]
lea esi,[esi+eax+4]
mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2
add ecx,[ecx-4]
mov ecx,AREA_TEMP2
sub ecx,esi
cld
rep movsb
mov eax,[sel.end.y]
sub eax,[sel.begin.y]
sub [cur_tab.Editor.Lines],eax ;! [lines],eax
sub [lines],eax
jmp .exit
 
.single_line:
589,8 → 567,7
lea edi,[esi+4]
add edi,[sel.begin.x]
lea esi,[edi+ecx]
mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2
add ecx,[ecx-4]
mov ecx,AREA_TEMP2
sub ecx,esi
cld
rep movsb
597,13 → 574,13
 
.exit:
mov eax,[sel.begin.x]
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
mov [pos.x],eax
mov [sel.x],eax
mov eax,[sel.begin.y]
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
mov [pos.y],eax
mov [sel.y],eax
popad
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [modified],1
clc
ret
 
611,103 → 588,3
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
/programs/develop/tinypad/trunk/tp-dialog.asm
266,7 → 266,7
jnc @f
.lp2:
ret
@@: ;call update_caption
@@: call update_caption
xor eax,eax
mov [bot_mode],al
mov [bot_dlg_height],eax
290,21 → 290,16
 
.found:
;---------------------------------------
push [copy_size] [copy_count] [copy_buf]
push [copy_size] [copy_count]
 
; mov esi,0 ;! AREA_CBUF
; mov edi,0 ;! AREA_CBUF-304
; mov ecx,300/4
; rep movsd
mov esi,AREA_CBUF
mov edi,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,[copy_buf] ;! AREA_CBUF
mov edi,AREA_CBUF
stosd
mov ecx,eax
jecxz .lp1
313,20 → 308,17
mov [copy_size],eax
mov [copy_count],1
 
push [cur_tab.Editor.SelStart.X] ;! [sel.x]
push [sel.x]
call init_sel_vars
call key.ctrl_v
pop [cur_tab.Editor.SelStart.X] ;! [sel.x]
pop [sel.x]
 
mov eax,[copy_buf]
call mem.Free
mov esi,AREA_CBUF-304
mov edi,AREA_CBUF
mov ecx,300/4
rep movsd
 
; mov esi,0 ;! AREA_CBUF-304
; mov edi,0 ;! AREA_CBUF
; mov ecx,300/4
; rep movsd
 
pop [copy_buf] [copy_count] [copy_size]
pop [copy_count] [copy_size]
;---------------------------------------
 
call check_inv_all
/programs/develop/tinypad/trunk/tp-mouse.asm
123,7 → 123,7
call check_mouse_in_edit_area
jnc still.skip_write
mcall 37,0
mov [mm.Edit+POPUP.pos],eax
mov [popup_edit+POPUP.pos],eax
@@: mcall 37,2
cmp eax,ebx
jnz @f
131,7 → 131,7
jmp @b
@@: and [mst],0xFD
call onshow.edit
mov dword[POPUP_STACK],mm.Edit
mov dword[POPUP_STACK],popup_edit
mcall 51,1,popup_thread_start,POPUP_STACK
mov [h_popup],eax
jmp still.skip_write
157,31 → 157,31
cdq;xor edx,edx
mov ecx,LINEH
idiv ecx
@@: add eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
@@: add eax,[top_line]
mov ebx,eax
pop eax
cdq;xor edx,edx
mov ecx,6
idiv ecx
@@: add eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
@@: add eax,[left_col]
 
cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns]
cmp eax,[columns]
jl @f
mov eax,[cur_tab.Editor.Columns] ;! eax,[columns]
@@: cmp ebx,[cur_tab.Editor.Lines] ;! ebx,[lines]
mov eax,[columns]
@@: cmp ebx,[lines]
jl @f
mov ebx,[cur_tab.Editor.Lines] ;! ebx,[lines]
mov ebx,[lines]
dec ebx
@@:
cmp [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
cmp [pos.x],eax
jne .change_cur_pos
cmp [cur_tab.Editor.Caret.Y],ebx ;! [pos.y],ebx
cmp [pos.y],ebx
je still.skip_write
 
.change_cur_pos:
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
mov [cur_tab.Editor.Caret.Y],ebx ;! [pos.y],ebx
mov [pos.x],eax
mov eax,[pos.y]
mov [pos.y],ebx
call check_cur_vis_inv
jc .check_ldown
; cmp eax,ebx
213,20 → 213,20
; sub ebx,[__rc+0x4]
cmp [vscrl_capt],0
jge .vcaptured
mov eax,[cur_tab.Editor.VScroll.Top] ;! eax,[vscrl_top]
mov eax,[vscrl_top]
cmp ebx,eax
jb .center_vcapture
add eax,[cur_tab.Editor.VScroll.Size] ;! eax,[vscrl_size]
add eax,[vscrl_size]
cmp ebx,eax
jae .center_vcapture
mov eax,ebx
sub eax,[cur_tab.Editor.VScroll.Top] ;! eax,[vscrl_top]
sub eax,[vscrl_top]
dec eax
mov [vscrl_capt],eax
dec ebx
jmp .vcaptured
.center_vcapture:
mov eax,[cur_tab.Editor.VScroll.Size] ;! eax,[vscrl_size]
mov eax,[vscrl_size]
shr eax,1
mov [vscrl_capt],eax
.vcaptured:
236,24 → 236,24
@@: mov [mouse_captured],1
mov eax,[bot_ofs]
sub eax,[top_ofs]
sub eax,[cur_tab.Editor.VScroll.Size] ;! eax,[vscrl_size]
sub eax,[vscrl_size]
sub eax,SCRLW*3-2
cmp eax,ebx
jge @f
mov ebx,eax
@@:
mov [cur_tab.Editor.VScroll.Top],ebx ;! [vscrl_top],ebx
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines]
mov [vscrl_top],ebx
mov eax,[lines]
sub eax,[lines.scr]
imul ebx
mov ebx,[bot_ofs]
sub ebx,[top_ofs]
sub ebx,SCRLW*3-2 ;**
sub ebx,[cur_tab.Editor.VScroll.Size] ;! ebx,[vscrl_size]
sub ebx,[vscrl_size]
idiv ebx
cmp eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
cmp eax,[top_line]
je still.skip_write
mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax
mov [top_line],eax
call check_bottom_right
call draw_file
jmp still.skip_write
274,20 → 274,20
; sub ebx,[__rc+0x0]
cmp [hscrl_capt],0
jge .hcaptured
mov eax,[cur_tab.Editor.HScroll.Top] ;! eax,[hscrl_top]
mov eax,[hscrl_top]
cmp ebx,eax
jl .center_hcapture
add eax,[cur_tab.Editor.HScroll.Size] ;! eax,[hscrl_size]
add eax,[hscrl_size]
cmp ebx,eax
jge .center_hcapture
mov eax,ebx
sub eax,[cur_tab.Editor.HScroll.Top] ;! eax,[hscrl_top]
sub eax,[hscrl_top]
dec eax
mov [hscrl_capt],eax
dec ebx
jmp .hcaptured
.center_hcapture:
mov eax,[cur_tab.Editor.HScroll.Size] ;! eax,[hscrl_size]
mov eax,[hscrl_size]
shr eax,1
mov [hscrl_capt],eax
.hcaptured:
296,23 → 296,23
xor ebx,ebx
@@: mov [mouse_captured],1
mov eax,[p_info.box.width]
sub eax,[cur_tab.Editor.HScroll.Size] ;! eax,[hscrl_size]
sub eax,[hscrl_size]
sub eax,SCRLW*3+10+1
cmp eax,ebx
jge @f
mov ebx,eax
@@:
mov [cur_tab.Editor.HScroll.Top],ebx ;! [hscrl_top],ebx
mov eax,[cur_tab.Editor.Columns] ;! eax,[columns]
mov [hscrl_top],ebx
mov eax,[columns]
sub eax,[columns.scr]
imul ebx
mov ebx,[p_info.box.width]
sub ebx,SCRLW*3+10+1 ;**
sub ebx,[cur_tab.Editor.HScroll.Size] ;! ebx,[hscrl_size]
sub ebx,[hscrl_size]
idiv ebx
cmp eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
cmp eax,[left_col]
je still.skip_write
mov [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax
mov [left_col],eax
call check_bottom_right
call draw_file
jmp still.skip_write
373,26 → 373,26
onshow:
 
.file:
or byte[mm.File+3],0x01
or byte[popup_file+3],0x01
cmp [f_info.length],0
jne @f
and byte[mm.File+3],0xFE
and byte[popup_file+3],0xFE
@@: ret
 
.edit:
or byte[mm.Edit+2],0x01
or byte[popup_edit+2],0x01
cmp [copy_size],0
jne @f
and byte[mm.Edit+2],0xFE
@@: or dword[mm.Edit+0],0x01000101
and byte[popup_edit+2],0xFE
@@: or dword[popup_edit+0],0x01000101
cmp [sel.selected],0
jne @f
and dword[mm.Edit+0],0xFEFFFEFE
and dword[popup_edit+0],0xFEFFFEFE
@@: ret
 
.search:
mov byte[mm.Search+0],0
;mov byte[mm.Search+4],0
mov byte[popup_search+0],0
;mov byte[popup_search+4],0
ret
.run:
ret
399,26 → 399,26
.recode:
ret
.options:
mov word[mm.Options+0],0
mov byte[mm.Options+5],0
or byte[mm.Options+2],0x02
mov word[popup_options+0],0
mov byte[popup_options+5],0
or byte[popup_options+2],0x02
test [options],OPTS_SECURESEL
jnz @f
and byte[mm.Options+2],0xFD
@@: or byte[mm.Options+3],0x02
and byte[popup_options+2],0xFD
@@: or byte[popup_options+3],0x02
test [options],OPTS_AUTOBRACES
jnz @f
and byte[mm.Options+3],0xFD
@@: or byte[mm.Options+4],0x02
and byte[popup_options+3],0xFD
@@: or byte[popup_options+4],0x02
test [options],OPTS_AUTOINDENT
jnz @f
and byte[mm.Options+4],0xFD
@@: or byte[mm.Options+6],0x02
and byte[popup_options+4],0xFD
@@: or byte[popup_options+6],0x02
test [options],OPTS_OPTIMSAVE
jnz @f
and byte[mm.Options+6],0xFD
@@: or byte[mm.Options+8],0x02
and byte[popup_options+6],0xFD
@@: or byte[popup_options+8],0x02
test [options],OPTS_LINENUMS
jnz @f
and byte[mm.Options+8],0xFD
and byte[popup_options+8],0xFD
@@: ret
/programs/develop/tinypad/trunk/tp-recode.asm
19,8 → 19,8
mov edi,table.koi.1251
 
.main:
mov ecx,[cur_tab.Editor.Lines] ;! ecx,[lines]
mov esi,[cur_tab.Editor.Data] ;! AREA_EDIT
mov ecx,[lines]
mov esi,AREA_EDIT
jecxz .exit
xor eax,eax
.lp0: dec ecx
/programs/develop/tinypad/trunk/macros.inc
210,7 → 210,7
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,26 → 372,7
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
 
; events
/programs/develop/tinypad/trunk/tinypad.inc
1,56 → 1,3
 
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 ?
82,13 → 29,13
dw ? ; x
_name:
forward
if (lang eq _lang) | (_lang eq @!)
if (lang eq _lang)
db 1
end if
common
.data:
forward
if (lang eq _lang) | (_lang eq @!)
if lang eq _lang
if _title eq '-'
db 1,'-'
c2 = c2+1
116,13 → 63,9
align 4
.actions:
forward
if (lang eq _lang) | (_lang eq @!)
if (_action eq )
dd 0
else
dd _name#.#_action
if lang eq _lang
dd _action
end if
end if
common
.size = $-_name+20
.max_title = m1
/programs/develop/tinypad/trunk/tp-draw.asm
10,6 → 10,22
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]
34,71 → 50,49
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,[cur_tab.Editor.Bounds.Right]
sub eax,[cur_tab.Editor.Bounds.Left]
sub eax,[cur_tab.Editor.Gutter.Width]
sub eax,SCRLW+LCHGW+4
mov eax,[p_info.client_box.width]
sub eax,SCRLW+1
sub eax,[left_ofs]
cdq
mov ebx,6
div ebx
mov [columns.scr],eax
 
mov eax,[cur_tab.Editor.Bounds.Bottom]
sub eax,[cur_tab.Editor.Bounds.Top]
sub eax,SCRLW+3
cdq
mov ebx,LINEH
div ebx
mov [lines.scr],eax
 
mov eax,[p_info.client_box.height]
add eax,-STATH+1;*3-2-2
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 [do_not_draw],1 ; do_not_draw = true
 
; mov ebx,eax
; sub ebx,[top_ofs]
; sub ebx,SCRLW*3+AMINS+5
; js .no_draw
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
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
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]
 
140,11 → 134,7
@@:
 
.exit:
;-- draw file --
;call draw_file
;++ draw editor control ++
call draw_editor
call draw_tabctl
call draw_file
.exit.2:
mcall 12,2
ret
187,8 → 177,6
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]
232,9 → 220,6
; EAX = start line
; EBX = end line
;-----------------------------------------------------------------------------
call draw_editor;_text
ret
macro unused {
cmp [p_info.client_box.height],LINEH
jge @f
ret
250,10 → 235,10
cmp eax,ebx
jle @f
xchg eax,ebx
@@: cmp eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
@@: cmp eax,[top_line]
jge @f
mov eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
@@: mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
mov eax,[top_line]
@@: mov ecx,[top_line]
add ecx,[lines.scr]
cmp ebx,ecx
jl @f
273,23 → 258,19
 
mov ebx,[top_ofs]
add ebx,[left_ofs-2]
sub eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
sub eax,[top_line]
imul eax,LINEH
add ebx,eax
 
imul ebp,[cur_tab.Editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536
imul ebp,[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
302,7 → 283,7
mov ebx,[top_ofs]
add ebx,[left_ofs-2]
 
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
mov ecx,[top_line]
push ecx
call get_line_offset
 
313,9 → 294,9
jle .exit
add esp,-4
 
imul ebp,[cur_tab.Editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536
imul ebp,[left_col],6*65536
mov eax,[lines.scr]
sub eax,[cur_tab.Editor.Lines] ;! eax,[lines]
sub eax,[lines]
mov [draw_blines],eax
 
.next_line:
346,7 → 327,7
cmp eax,[sel.end.y]
je .lp5
.lp2: mov eax,[sel.begin.x]
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
sub eax,[left_col]
jle .lp6.2
cmp eax,[columns.scr]
jge .lp6
369,7 → 350,7
cmp eax,[sel.end.y]
je .lp5
.lp4: mov eax,[sel.end.x]
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
sub eax,[left_col]
jle .lp6
cmp eax,[columns.scr]
jg .lp6.2
388,7 → 369,7
mov bx,ax
mov [in_sel],3
jmp .lp6
.lp5: mov eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
.lp5: mov eax,[left_col]
cmp eax,[sel.begin.x]
jge .lp4
add eax,[columns.scr]
397,7 → 378,7
mov eax,[sel.begin.x]
cmp eax,[sel.end.x]
je .lp6
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
sub eax,[left_col]
imul eax,6
pushad
mov ebx,[sel.end.x]
471,13 → 452,13
 
push esi ebx
mov eax,ebx
sub ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col]
sub ebx,[left_col]
cmp ebx,[columns.scr]
jge .skip_t
add ebx,esi
jle .skip_t
mov ebx,[esp+8+4*2] ;// 4*2=esi+ebx
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
sub eax,[left_col]
jge .qqq
sub edx,eax
add esi,eax
494,7 → 475,7
 
mov eax,[esp] ; ebx
add eax,[esp+4] ; esi
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
sub eax,[left_col]
sub eax,[columns.scr]
jle .qweqwe
sub esi,eax
518,7 → 499,7
mov esi,[sel.begin.x]
sub esi,[esp]
pushad
mov ecx,[cur_tab.Editor.TopLeft.X] ;! ecx,[left_col]
mov ecx,[left_col]
sub ecx,[esp+4*8]
jle @f
sub esi,ecx
548,7 → 529,7
sub eax,[esp]
push ebx
mov ebx,[esp+4]
sub ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col]
sub ebx,[left_col]
jge .ya2.1
add eax,ebx
.ya2.1:
580,7 → 561,7
sub esi,[esp]
push eax
mov eax,[esp+4]
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
sub eax,[left_col]
jge .nt3.1
add esi,eax
.nt3.1:
661,7 → 642,7
shl ebx,16
add ebx,[top_ofs]
mov edi,[sc.work_text]
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
mov ecx,[top_line]
inc ecx
mov edx,p_info+100
@@: pushad
679,10 → 660,10
popad
add ebx,LINEH
inc ecx
cmp ecx,[cur_tab.Editor.Lines] ;! ecx,[lines]
cmp ecx,[lines]
jg @f
mov esi,ecx
sub esi,[cur_tab.Editor.TopLeft.Y] ;! esi,[top_line]
sub esi,[top_line]
cmp esi,[lines.scr]
jbe @b
@@: add esp,4*8*2
707,8 → 688,8
add esp,4
cmp [bot_mode],0
jne @f
mov ebx,[cur_tab.Editor.Caret.X] ;! ebx,[pos.x]
sub ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col]
mov ebx,[pos.x]
sub ebx,[left_col]
js @f
cmp ebx,[columns.scr]
ja @f
718,8 → 699,8
push bx
shl ebx,16
pop bx
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
sub eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
mov eax,[pos.y]
sub eax,[top_line]
js @f
cmp eax,[lines.scr]
jge @f
805,15 → 786,15
; sub ebx,1*65536-2
 
push ebx
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines]
mov eax,[lines]
mov ebx,[lines.scr]
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
mov ecx,[top_line]
mov edx,[bot_ofs]
sub edx,[top_ofs]
add edx,-SCRLW*3+1
call get_scroll_vars
mov [cur_tab.Editor.VScroll.Top],eax ;! [vscrl_top],eax
mov [cur_tab.Editor.VScroll.Size],ebx ;! [vscrl_size],ebx
mov [vscrl_top],eax
mov [vscrl_size],ebx
pop ebx
 
mov ecx,eax
829,7 → 810,7
; rol ecx,16
; movsx eax,cx
; sar ecx,16
push ebx ecx SCRLW [cur_tab.Editor.VScroll.Size] ;! ebx ecx SCRLW [vscrl_size]
push ebx ecx SCRLW [vscrl_size]
dec dword[esp]
call draw_3d_panel
popad
838,7 → 819,7
inc ebx
 
mov ecx,[top_ofs-2]
mov cx,word[cur_tab.Editor.VScroll.Top] ;! cx,word[vscrl_top]
mov cx,word[vscrl_top]
add ecx,(SCRLW-1)*65536
mov edx,[sc.work];[color_tbl+4*5]
or cx,cx
846,8 → 827,8
mcall 13
@@:
mov ecx,[top_ofs]
add ecx,[cur_tab.Editor.VScroll.Top] ;! ecx,[vscrl_top]
add ecx,[cur_tab.Editor.VScroll.Size] ;! ecx,[vscrl_size]
add ecx,[vscrl_top]
add ecx,[vscrl_size]
add ecx,SCRLW-1
mov di,cx
shl ecx,16
934,20 → 915,20
; inc ecx
 
push ecx
mov eax,[cur_tab.Editor.Columns] ;! eax,[columns]
mov eax,[columns]
mov ebx,[columns.scr]
mov ecx,[cur_tab.Editor.TopLeft.X] ;! ecx,[left_col]
mov ecx,[left_col]
mov edx,[p_info.client_box.width]
add edx,-(SCRLW*3)
call get_scroll_vars
mov [cur_tab.Editor.HScroll.Top],eax ;! [hscrl_top],eax
mov [cur_tab.Editor.HScroll.Size],ebx ;! [hscrl_size],ebx
mov [hscrl_top],eax
mov [hscrl_size],ebx
pop ecx
 
mov ebx,eax
add ebx,1+SCRLW
shl ebx,16
mov bx,word[cur_tab.Editor.HScroll.Size] ;! bx,word[hscrl_size]
mov bx,word[hscrl_size]
 
; mcall 13,,,[sc.work_button]
;!!!!!!!!!!!!!!!!!!
963,11 → 944,11
;!!!!!!!!!!!!!!!!!!
 
mov ebx,(1+SCRLW)*65536
mov bx,word[cur_tab.Editor.HScroll.Top] ;! bx,word[hscrl_top]
mov bx,word[hscrl_top]
mcall 13,,,[sc.work];[color_tbl+4*5]
mov ebx,1+SCRLW
add ebx,[cur_tab.Editor.HScroll.Top] ;! ebx,[hscrl_top]
add ebx,[cur_tab.Editor.HScroll.Size] ;! ebx,[hscrl_size]
add ebx,[hscrl_top]
add ebx,[hscrl_size]
mov di,bx
shl ebx,16
mov bx,word[p_info.client_box.width]
997,7 → 978,6
.exit:
popad
ret
}
endf
 
;-----------------------------------------------------------------------------
1011,7 → 991,7
; EDX = string
; ESI = length
;-----------------------------------------------------------------------------
cmp [cur_tab.Editor.AsmMode],0 ;! [asm_mode],0
cmp [asm_mode],0
je .plain.text
xor ebx,ebx
mov edx,ecx
1119,17 → 1099,12
endf
 
;-----------------------------------------------------------------------------
func draw_statusbar ;///// WRITE POSITION ////////////////////////////////////
func writepos ;///// 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]
1141,10 → 1116,9
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
mov cx,STATH+1
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
1159,7 → 1133,7
and ecx,0x0000FFFF
push ecx
 
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
mov eax,[pos.y]
inc eax
mov ecx,10
mov edi,p_info+0x100;htext2.pos1
1167,7 → 1141,7
call uint2str
mov al,','
stosb
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
mov eax,[pos.x]
inc eax
call uint2str
 
1182,7 → 1156,7
sub ebx,edi
mcall 4,,[sc.work_text],p_info+0x100
 
cmp [cur_tab.Editor.Modified],0 ;! [modified],0
cmp [modified],0
je @f
and ebx,0x0000FFFF
; add ebx,[left_ofs-2]
1202,17 → 1176,58
ret
endf
 
func draw_framerect ; ebx,ecx,edx
;-----------------------------------------------------------------------------
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
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
mcall 38,,,[cl_3d_inset]
add cx,[esp]
rol ecx,16
add cx,[esp]
1231,6 → 1246,6
sub ebx,0x00010001
mcall
 
pop ecx ebx
add esp,8
ret
endf
/programs/develop/tinypad/trunk/tp-files.asm
10,18 → 10,18
rep movsb
mov byte[edi],0
 
mov esi,[cur_tab.Editor.Data] ;! AREA_EDIT ; 0x70000 = 448 Kbytes (maximum)
mov edi,0 ;!!! AREA_TEMP
mov esi,AREA_EDIT ; 0x70000 = 448 Kbytes (maximum)
mov edi,AREA_TEMP
 
.new_string:
call save_string
cmp dword[esi],0
jne .new_string
sub edi,0 ;!!! AREA_TEMP+2 ; minus last CRLF
sub edi,AREA_TEMP+2 ; minus last CRLF
;! 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
mcall 33,f_info.path,AREA_TEMP,edi,0;[filelen],0
or eax,eax
jz .exit
; call file_not_found
40,7 → 40,7
 
mov [f_info70+0],2
mov [f_info70+12],edi
mov [f_info70+16],0 ;!!! AREA_TEMP
mov [f_info70+16],AREA_TEMP
mov byte[f_info70+20],0
mov [f_info70+21],f_info.path
mcall 70,f_info70
51,7 → 51,7
jnz .exit.2
 
.exit:
mov [cur_tab.Editor.Modified],0 ;! [modified],0
mov [modified],0
clc
ret
 
145,97 → 145,75
@@: inc esi
mov [s_status],esi
pop eax
call draw_statusbar
call writepos
ret
endf
 
;-----------------------------------------------------------------------------
func load_file ;//////////////////////////////////////////////////////////////
func load_hd_file ;///////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
mov esi,tb_opensave.text
mov edi,f_info.path
movzx ecx,[tb_opensave.length]
mov [f_info.length],ecx
cld
rep movsb
mov byte[edi],0
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
 
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+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
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
 
call set_status_fs_error
 
mov esi,[f_info70+16]
 
xchg eax,ebx
inc eax
test ebx,ebx
je .file_found
je load_file.file_found
cmp ebx,6 ;// ATV driver fix (6 instead of 5)
je .file_found
 
mov eax,[f_info70+16]
call mem.Free
je load_file.file_found
; jmp file_not_found
stc
ret
endf
 
.file_found:
mov ecx,eax
call create_tab
push ecx esi edi
;-----------------------------------------------------------------------------
func load_file ;//////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
 
mov esi,tb_opensave.text
lea edi,[ebp+TABITEM.Editor.FilePath]
;mov ecx,[f_info.length]
mov edi,f_info.path
movzx ecx,[tb_opensave.length]
mov [f_info.length],ecx
cld
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
 
cmp byte[f_info.path],'/'
je load_hd_file
 
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
stc
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
.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 [ebp+EDITOR.Columns],0
mov edi,eax
mov edx,ecx
 
.next_line:
mov ebx,edi
add edi,4
266,10 → 244,11
sub eax,10
jnz @f
inc eax
@@: cmp eax,[ebp+EDITOR.Columns] ;! eax,[columns]
@@: cmp eax,[columns]
jbe @f
mov [ebp+EDITOR.Columns],eax ;! [columns],eax
@@: mov [ebp+EDITOR.Modified],0 ;! [modified],0
mov [columns],eax
@@: mov [modified],0
clc
ret
 
.CR: cmp byte[esi],10
282,11 → 261,11
lea eax,[edi-4]
sub eax,ebx
mov [ebx],eax
;inc [cur_tab.Editor.Lines] ;! [lines]
inc [lines]
add eax,-10
cmp eax,[ebp+EDITOR.Columns] ;! eax,[columns]
cmp eax,[columns]
jbe .next_line
mov [ebp+EDITOR.Columns],eax ;! [columns],eax
mov [columns],eax
jmp .next_line
 
.TB: lea eax,[edi-4]
299,3 → 278,30
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
/programs/develop/tinypad/trunk/tp-key.asm
51,8 → 51,8
jne @f
test [options],OPTS_SECURESEL
jz .lp1
m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
m2m [sel.x],[pos.x]
m2m [sel.y],[pos.y]
.lp1: mov [s_status],0
call dword[esi+4]
jmp still
74,8 → 74,8
 
test [options],OPTS_SECURESEL
jz .lp2
m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
m2m [sel.x],[pos.x]
m2m [sel.y],[pos.y]
jmp .put
.lp2: call delete_selection
 
85,24 → 85,24
jne @f
mov al,']'
call .lp3
dec [cur_tab.Editor.Caret.X] ;! [pos.x]
dec [pos.x]
jmp .put
@@: cmp al,'('
jne @f
mov al,')'
call .lp3
dec [cur_tab.Editor.Caret.X] ;! [pos.x]
dec [pos.x]
jmp .put
@@: cmp al,'{'
jne .put
mov al,'}'
call .lp3
dec [cur_tab.Editor.Caret.X] ;! [pos.x]
dec [pos.x]
 
.put: pop eax
push still
inc [cur_tab.Editor.SelStart.X] ;! [sel.x]
.lp3: push [cur_tab.Editor.Caret.X] eax ;! [pos.x] eax
inc [sel.x]
.lp3: push [pos.x] eax
inc dword[esp+4]
mov eax,1
jmp key.tab.direct
111,14 → 111,14
func key.ctrl_a ;///// SELECT ALL DOCUMENT ///////////////////////////////////
;-----------------------------------------------------------------------------
xor eax,eax
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
mov ecx,[cur_tab.Editor.Lines] ;! ecx,[lines]
mov [sel.x],eax
mov [sel.y],eax
mov ecx,[lines]
dec ecx
mov [cur_tab.Editor.Caret.Y],ecx ;! [pos.y],ecx
mov [pos.y],ecx
call get_line_offset
call get_real_length
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov [pos.x],eax
call draw_file
ret
endf
155,7 → 155,7
;-----------------------------------------------------------------------------
func key.ctrl_s ;///// ENTER SAVE FILENAME ///////////////////////////////////
;-----------------------------------------------------------------------------
cmp [cur_tab.Editor.Modified],0 ;! [modified],0
cmp [modified],0
je .exit
cmp [f_info.length],0
je key.shift_ctrl_s
172,7 → 172,7
;-----------------------------------------------------------------------------
func key.ctrl_n ;///// ENTER SAVE FILENAME ///////////////////////////////////
;-----------------------------------------------------------------------------
call create_tab
call new_file
ret
endf
 
248,8 → 248,8
;-----------------------------------------------------------------------------
key.shift_ctrl_left: ;///// GO TO PREVIOUS WORD, WITH SELECTION /////////
;-----------------------------------------------------------------------------
mov ebx,[cur_tab.Editor.Caret.Y] ;! ebx,[pos.y]
mov edx,[cur_tab.Editor.Caret.X] ;! edx,[pos.x]
mov ebx,[pos.y]
mov edx,[pos.x]
cld
mov ecx,ebx
call get_line_offset
307,26 → 307,26
jmp .lp2
@@:
inc edx
mov [cur_tab.Editor.Caret.Y],ebx ;! [pos.y],ebx
mov [cur_tab.Editor.Caret.X],edx ;! [pos.x],edx
mov [pos.y],ebx
mov [pos.x],edx
test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.Y],ebx ;! [sel.y],ebx
mov [cur_tab.Editor.SelStart.X],edx ;! [sel.x],edx
@@: sub ebx,[cur_tab.Editor.TopLeft.Y] ;! ebx,[top_line]
mov [sel.y],ebx
mov [sel.x],edx
@@: sub ebx,[top_line]
jge @f
add [cur_tab.Editor.TopLeft.Y],ebx ;! [top_line],ebx
add [top_line],ebx
@@: mov eax,edx
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
sub eax,[left_col]
cmp eax,[columns.scr]
jl @f
sub eax,[columns.scr]
inc eax
add [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax
add [left_col],eax
jmp .exit
@@: cmp edx,[cur_tab.Editor.TopLeft.X] ;! edx,[left_col]
@@: cmp edx,[left_col]
jge .exit
mov [cur_tab.Editor.TopLeft.X],edx ;! [left_col],edx
mov [left_col],edx
.exit:
call draw_file
.exit.2:
341,8 → 341,8
;-----------------------------------------------------------------------------
key.shift_ctrl_right: ;///// GO TO NEXT WORD, WITH SELECTION ////////////
;-----------------------------------------------------------------------------
mov ebx,[cur_tab.Editor.Caret.Y] ;! ebx,[pos.y]
mov edx,[cur_tab.Editor.Caret.X] ;! edx,[pos.x]
mov ebx,[pos.y]
mov edx,[pos.x]
cld
.lp1: mov ecx,ebx
call get_line_offset
363,7 → 363,7
dec ecx
jnz @b
.nx1: inc ebx
cmp ebx,[cur_tab.Editor.Lines] ;! ebx,[lines]
cmp ebx,[lines]
jge .exit.2
xor edx,edx
jmp .lp1
388,34 → 388,34
dec ecx
jnz @b
.nx2: inc ebx
cmp ebx,[cur_tab.Editor.Lines] ;! ebx,[lines]
cmp ebx,[lines]
jge .exit.2
xor edx,edx
jmp .lp2
@@:
mov [cur_tab.Editor.Caret.Y],ebx ;! [pos.y],ebx
mov [cur_tab.Editor.Caret.X],edx ;! [pos.x],edx
mov [pos.y],ebx
mov [pos.x],edx
test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.Y],ebx ;! [sel.y],ebx
mov [cur_tab.Editor.SelStart.X],edx ;! [sel.x],edx
@@: sub ebx,[cur_tab.Editor.TopLeft.Y] ;! ebx,[top_line]
mov [sel.y],ebx
mov [sel.x],edx
@@: sub ebx,[top_line]
cmp ebx,[lines.scr]
jl @f
sub ebx,[lines.scr]
inc ebx
add [cur_tab.Editor.TopLeft.Y],ebx ;! [top_line],ebx
add [top_line],ebx
@@: mov eax,edx
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
sub eax,[left_col]
cmp eax,[columns.scr]
jl @f
sub eax,[columns.scr]
inc eax
add [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax
add [left_col],eax
jmp .exit
@@: cmp edx,[cur_tab.Editor.TopLeft.X] ;! edx,[left_col]
@@: cmp edx,[left_col]
jge .exit
mov [cur_tab.Editor.TopLeft.X],edx ;! [left_col],edx
mov [left_col],edx
.exit:
call draw_file
.exit.2:
428,7 → 428,7
je @f
call key.ctrl_c
call key.del
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [modified],1
@@: ret
endf
 
437,13 → 437,6
mov [copy_size],0
cmp [sel.selected],0
je .exit
 
call get_selection_size
mov ebx,eax
mov eax,[copy_buf]
call mem.ReAlloc
mov [copy_buf],eax
 
cld
mov eax,[sel.begin.y]
cmp eax,[sel.end.y]
452,7 → 445,7
call get_line_offset
inc ecx
push ecx
mov edi,[copy_buf] ;! AREA_CBUF
mov edi,AREA_CBUF
call get_real_length
sub eax,[sel.begin.x]
jge @f
494,7 → 487,7
add [ebx],eax
mov al,' '
rep stosb
@@: sub edi,[copy_buf] ;! AREA_CBUF
@@: sub edi,AREA_CBUF
mov [copy_size],edi
mov eax,[sel.end.y]
sub eax,[sel.begin.y]
506,7 → 499,7
.single_line:
mov eax,[sel.end.x]
sub eax,[sel.begin.x]
mov edi,[copy_buf] ;! AREA_CBUF
mov edi,AREA_CBUF
stosd
mov ecx,[sel.begin.y]
call get_line_offset
537,21 → 530,19
 
call delete_selection
 
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
mov ecx,[pos.y]
call get_line_offset
pushd [esi] esi
mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
mov ecx,[pos.x]
call line_add_spaces
mov ecx,[copy_size]
sub ecx,4
mov edi,[cur_tab.Editor.Data] ;! AREA_TEMP2
add edi,[edi-4]
dec edi
mov edi,AREA_TEMP2
mov eax,esi
mov esi,edi
sub esi,ecx
lea ecx,[eax+4]
add ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
add ecx,[pos.x]
neg ecx
lea ecx,[esi+ecx+1]
std
564,10 → 555,10
cld
pop edi
add edi,4
mov esi,[copy_buf] ;! AREA_CBUF
mov esi,AREA_CBUF
lodsd
 
mov ebx,[cur_tab.Editor.Caret.X] ;! ebx,[pos.x]
mov ebx,[pos.x]
add eax,ebx
mov [edi-4],ax
sub eax,ebx
590,16 → 581,16
mov ecx,eax
rep movsb
 
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
mov [pos.x],eax
mov [sel.x],eax
mov eax,[copy_count]
dec eax
add [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
add [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
add [cur_tab.Editor.Lines],eax ;! [lines],eax
add [pos.y],eax
add [sel.y],eax
add [lines],eax
 
call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [modified],1
jmp .exit
 
.single_line:
606,22 → 597,22
cld
pop edi
add edi,4
mov esi,[copy_buf] ;! AREA_CBUF
mov esi,AREA_CBUF
lodsd
add [edi-4],ax
and dword[edi-4],not 0x00020000
or dword[edi-4],0x00010000
call .check_columns
add edi,[cur_tab.Editor.Caret.X] ;! edi,[pos.x]
add edi,[pos.x]
add esp,4
mov ecx,eax
rep movsb
 
add [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
add [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
add [pos.x],eax
add [sel.x],eax
 
call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [modified],1
 
.exit:
ret
629,9 → 620,9
.check_columns:
push eax
movzx eax,word[edi-4]
cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns]
cmp eax,[columns]
jbe @f
mov [cur_tab.Editor.Columns],eax ;! [columns],eax
mov [columns],eax
@@: pop eax
ret
; push eax ebx esi
656,11 → 647,11
;-----------------------------------------------------------------------------
func key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
;-----------------------------------------------------------------------------
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
mov ecx,[pos.y]
call get_line_offset
mov ebx,esi
 
mov ecx,[cur_tab.Editor.Lines] ;! ecx,[lines]
mov ecx,[lines]
call get_line_offset
lea edi,[esi+90+4]
lea ecx,[esi+4]
679,12 → 670,12
rep stosb
mov byte[ebx+4],';'
 
inc [cur_tab.Editor.Lines] ;! [lines]
inc [cur_tab.Editor.Caret.Y] ;! [pos.y]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
inc [lines]
inc [pos.y]
m2m [sel.y],[pos.y]
 
call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [modified],1
 
.exit:
ret
693,25 → 684,25
;-----------------------------------------------------------------------------
func key.ctrl_y ;///// DELETE CURRENT LINE ///////////////////////////////////
;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
mov eax,[pos.y]
inc eax
cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines]
cmp eax,[lines]
jge .exit
 
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
mov ecx,[pos.y]
call get_line_offset
mov edi,esi
lodsd
add esi,eax
 
dec [cur_tab.Editor.Lines] ;! [lines]
mov ecx,[temp_buf] ;! AREA_TEMP2
dec [lines]
mov ecx,AREA_TEMP2
sub ecx,esi
shr ecx,2 ;// fixed (was 4)
cld
rep movsd
call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [modified],1
 
.exit:
ret
725,11 → 716,11
;-----------------------------------------------------------------------------
key.shift_up: ;///// GO TO PREVIOUS LINE, WITH SELECTION ////////////////
;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
mov eax,[pos.y]
dec eax
jns @f
xor eax,eax
@@: mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
@@: mov ecx,[top_line]
cmp eax,ecx
jae @f
dec ecx
737,7 → 728,7
xor ecx,ecx
@@: test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
mov [sel.y],eax
@@: call check_inv_all.skip_init
 
.exit:
753,12 → 744,12
key.shift_down: ;///// GO TO NEXT LINE, WITH SELECTION //////////////////
;-----------------------------------------------------------------------------
 
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
mov eax,[pos.y]
inc eax
cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines]
cmp eax,[lines]
jb @f
dec eax
@@: mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
@@: mov ecx,[top_line]
mov edx,eax
sub edx,ecx
cmp edx,[lines.scr]
766,7 → 757,7
inc ecx
@@: test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
mov [sel.y],eax
@@: call check_inv_all.skip_init
 
.exit:
781,14 → 772,14
;-----------------------------------------------------------------------------
key.shift_left: ;///// GO TO PREVIOUS CHAR, WITH SELECTION //////////////
;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
mov eax,[pos.x]
dec eax
jns @f
inc eax
@@: test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
@@: mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov [sel.x],eax
@@: mov [pos.x],eax
call check_inv_all
 
.exit:
803,15 → 794,15
;-----------------------------------------------------------------------------
key.shift_right: ;///// GO TO NEXT CHAR, WITH SELECTION /////////////////
;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
mov eax,[pos.x]
inc eax
cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns]
cmp eax,[columns]
jbe @f
dec eax
@@: test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
@@: mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov [sel.x],eax
@@: mov [pos.x],eax
call check_inv_all
 
.exit:
828,8 → 819,8
;-----------------------------------------------------------------------------
mov edx,[lines.scr]
dec edx
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
mov eax,[pos.y]
mov ecx,[top_line]
sub eax,edx
jns @f
xor eax,eax
838,7 → 829,7
xor ecx,ecx
@@: test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
mov [sel.y],eax
@@: call check_inv_all.skip_init
 
.exit:
855,17 → 846,17
;-----------------------------------------------------------------------------
mov edx,[lines.scr]
dec edx
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
mov eax,[pos.y]
mov ecx,[top_line]
add eax,edx
add ecx,edx
cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines]
cmp eax,[lines]
jb @f
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines]
mov eax,[lines]
dec eax
@@: test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
mov [sel.y],eax
@@: call check_inv_all.skip_init
 
.exit:
880,10 → 871,10
;-----------------------------------------------------------------------------
key.shift_home: ;///// GO TO LINE START, WITH SELECTION /////////////////
;-----------------------------------------------------------------------------
mov [cur_tab.Editor.Caret.X],0 ;! [pos.x],0
mov [pos.x],0
test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.X],0 ;! [sel.x],0
mov [sel.x],0
@@: call check_inv_all
 
.exit:
898,13 → 889,13
;-----------------------------------------------------------------------------
key.shift_end: ;///// GO TO LINE END, WITH SELECTION ////////////////////
;-----------------------------------------------------------------------------
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
mov ecx,[pos.y]
call get_line_offset
call get_real_length
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov [pos.x],eax
test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
mov [sel.x],eax
@@: call check_inv_all
 
.exit:
919,11 → 910,11
;-----------------------------------------------------------------------------
key.shift_ctrl_home: ;///// GO TO PAGE START, WITH SELECTION ////////////
;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
mov eax,[top_line]
mov ecx,eax
test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
mov [sel.y],eax
@@: call check_inv_all.skip_init
 
.exit:
938,16 → 929,16
;-----------------------------------------------------------------------------
key.shift_ctrl_end: ;///// GO TO PAGE END, WITH SELECTION ///////////////
;-----------------------------------------------------------------------------
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
mov ecx,[top_line]
mov eax,[lines.scr]
cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines]
cmp eax,[lines]
jle @f
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines]
mov eax,[lines]
@@: add eax,ecx
dec eax
test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
mov [sel.y],eax
@@: call check_inv_all.skip_init
 
.exit:
963,11 → 954,11
key.shift_ctrl_pgup: ;///// GO TO DOCUMENT START, WITH SELECTION ////////
;-----------------------------------------------------------------------------
xor eax,eax
mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
mov [top_line],eax
mov [pos.y],eax
test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
mov [sel.y],eax
@@: call check_inv_all.skip_check
 
.exit:
982,18 → 973,17
;-----------------------------------------------------------------------------
key.shift_ctrl_pgdn: ;///// GO TO DOCUMENT END, WITH SELECTION //////////
;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] ; eax = lines in the file
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
mov eax,[lines] ; eax = lines in the file
mov [pos.y],eax
sub eax,[lines.scr] ; eax -= lines on the screen
jns @f
xor eax,eax
@@: mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax
dec [cur_tab.Editor.Caret.Y] ;! [pos.y]
@@: mov [top_line],eax
dec [pos.y]
test byte[shi+2],0x01
jnz @f
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y]
;! push [pos.y]
;! pop [sel.y]
push [pos.y]
pop [sel.y]
@@: call check_inv_all.skip_check
 
.exit:
1006,7 → 996,7
call delete_selection
jnc .exit.2
 
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
mov ecx,[pos.y]
call get_line_offset
and dword[esi],not 0x00020000
or dword[esi],0x00010000
1017,7 → 1007,7
or eax,eax
je .line_up
 
mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
mov ecx,[pos.x]
cmp ecx,eax
jae .line_up
lea edi,[ebx+ecx]
1028,7 → 1018,7
je .line_up
 
mov edi,ebx
mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
mov ecx,[pos.x]
add edi,ecx
lea esi,[edi+1]
neg ecx
1038,25 → 1028,23
rep movsb
mov byte[edi],' '
 
m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
m2m [sel.x],[pos.x]
m2m [sel.y],[pos.y]
call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [modified],1
ret
 
.line_up:
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines]
mov eax,[lines]
dec eax
cmp eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
cmp eax,[pos.y]
je .exit
mov edi,[temp_buf] ;! AREA_TEMP+4
add edi,4
mov edi,AREA_TEMP+4
mov esi,ebx
mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
mov ecx,[pos.x]
rep movsb
mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
mov eax,[temp_buf]
mov [eax],ecx ;! [AREA_TEMP],ecx
mov ecx,[pos.x]
mov [AREA_TEMP],ecx
cmp cx,[ebp]
jbe @f
movzx eax,word[ebp]
1068,24 → 1056,20
movzx eax,word[ebp]
add esi,eax;[ebp]
movzx ecx,word[esi-4]
mov eax,[temp_buf]
add [eax],ecx ;! [AREA_TEMP],ecx
or dword[eax],0x00010000 ;! dword[AREA_TEMP],0x00010000
add [AREA_TEMP],ecx
or dword[AREA_TEMP],0x00010000
rep movsb
 
mov ecx,edi ;! [edi-AREA_TEMP]
sub ecx,[temp_buf]
lea ecx,[edi-AREA_TEMP]
 
mov esi,[temp_buf] ;! AREA_TEMP
mov esi,AREA_TEMP
call get_real_length
cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns]
cmp eax,[columns]
jbe @f
mov [cur_tab.Editor.Columns],eax ;! [columns],eax
mov [columns],eax
@@:
push ecx
mov edi,[cur_tab.Editor.Data] ;! AREA_TEMP2
add edi,[edi-4]
dec edi
mov edi,AREA_TEMP2
lea esi,[edi+8]
sub esi,ecx
movzx eax,word[ebp]
1108,28 → 1092,27
add esi,eax;[esi-8]
movzx eax,word[esi-4]
add esi,eax;[esi-4]
mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2
add ecx,[ecx-4]
mov ecx,AREA_TEMP2
sub ecx,esi
cld
@@: rep movsb
.lp1: pop ecx
mov esi,[temp_buf] ;! AREA_TEMP
mov esi,AREA_TEMP
mov edi,ebp
cld
rep movsb
 
.ok.dec.lines:
dec [cur_tab.Editor.Lines] ;! [lines]
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines]
cmp [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
dec [lines]
mov eax,[lines]
cmp [pos.y],eax
jb @f
dec eax
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
@@: m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
mov [pos.y],eax
@@: m2m [sel.x],[pos.x]
m2m [sel.y],[pos.y]
 
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [modified],1
.exit.2:
call check_inv_all
 
1152,12 → 1135,12
call delete_selection
jnc key.del.exit.2
 
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
mov eax,[pos.x]
dec eax
js .line_up
 
dec [cur_tab.Editor.Caret.X] ;! [pos.x]
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
dec [pos.x]
mov ecx,[pos.y]
call get_line_offset
and dword[esi],not 0x00020000
or dword[esi],0x00010000
1164,11 → 1147,11
 
mov ebx,eax
call get_real_length
cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
cmp eax,[pos.x]
jae @f
m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
m2m [sel.x],[pos.x]
call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [modified],1
ret
 
@@: lea edi,[esi+4+ebx]
1182,17 → 1165,17
rep movsb
mov byte[edi],' '
 
m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
m2m [sel.x],[pos.x]
m2m [sel.y],[pos.y]
call check_inv_str
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [modified],1
ret
 
.line_up:
cmp [cur_tab.Editor.Caret.Y],0 ;! [pos.y],0
cmp [pos.y],0
jne @f
ret
@@: mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
@@: mov ecx,[pos.y]
dec ecx
call get_line_offset
and dword[esi],not 0x00020000
1205,8 → 1188,8
jne @f
dec ecx
jg @b
@@: mov [cur_tab.Editor.Caret.X],ecx ;! [pos.x],ecx
dec [cur_tab.Editor.Caret.Y] ;! [pos.y]
@@: mov [pos.x],ecx
dec [pos.y]
cld
jmp key.del.line_up
endf
1215,7 → 1198,7
func key.tab ;///// TABULATE /////////////////////////////////////////////////
;-----------------------------------------------------------------------------
call delete_selection
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
mov eax,[pos.x]
 
mov ecx,eax
add eax,ATABW
1223,7 → 1206,7
push eax ' '
sub eax,ecx
.direct:
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
mov ecx,[pos.y]
call get_line_offset
and dword[esi],not 0x00020000
or dword[esi],0x00010000
1231,25 → 1214,22
xchg eax,ecx
 
call get_real_length
cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
cmp eax,[pos.x]
jae @f
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
mov eax,[pos.x]
@@: movzx edx,word[esi]
sub edx,eax
cmp ecx,edx
jl @f
pushad; esi ecx eax
mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2-10+1
add ecx,[ecx-4]
dec ecx
mov edi,ecx ;! AREA_TEMP2
add ecx,-10+1
mov ecx,AREA_TEMP2-10+1
; lea eax,[esi+4]
; add eax,[esi]
movzx eax,word[esi]
lea eax,word[esi+eax+4]
sub ecx,eax
lea esi,[edi-10] ;! AREA_TEMP2-10
mov edi,AREA_TEMP2
mov esi,AREA_TEMP2-10
std
rep movsb
mov ecx,10
1268,7 → 1248,7
sub esi,ecx
lea ecx,[esi+1]
sub ecx,ebx
sub ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
sub ecx,[pos.x]
std
rep movsb
.ok: pop ecx ;*******
1275,19 → 1255,19
pop eax
rep stosb
cld
pop [cur_tab.Editor.Caret.X] ;! [pos.x]
pop [pos.x]
lea esi,[ebx-4]
call get_real_length
cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
cmp eax,[pos.x]
jae @f
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
@@: cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns]
mov eax,[pos.x]
@@: cmp eax,[columns]
jbe @f
mov [cur_tab.Editor.Columns],eax ;! [columns],eax
@@: m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
mov [columns],eax
@@: m2m [sel.x],[pos.x]
m2m [sel.y],[pos.y]
call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [modified],1
 
.exit:
ret
1298,10 → 1278,10
;-----------------------------------------------------------------------------
call delete_selection
 
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
mov ecx,[pos.y]
call get_line_offset
 
mov ebx,[cur_tab.Editor.Caret.X] ;! ebx,[pos.x]
mov ebx,[pos.x]
cmp bx,[esi]
jb @f
movzx ebx,word[esi]
1311,9 → 1291,10
@@:
cld
 
mov edi,[temp_buf] ;! AREA_TEMP
mov edi,AREA_TEMP
mov ebp,esi
lea ecx,[ebx+1]
mov ecx,ebx
inc ecx
@@: dec ecx
jz @f
cmp byte[esi+ecx+4-1],' '
1362,7 → 1343,7
.lp2: xor eax,eax
@@: mov edx,edi
add edi,4
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov [pos.x],eax
jecxz @f
push ecx
mov ecx,eax
1380,13 → 1361,10
or eax,0x00010000
mov [edx],eax
 
mov ecx,edi ;! [edi-AREA_TEMP]
sub ecx,[temp_buf]
lea ecx,[edi-AREA_TEMP]
 
push ecx
mov edi,[cur_tab.Editor.Data] ;! AREA_TEMP2
add edi,[edi-4]
dec edi
mov edi,AREA_TEMP2
lea esi,[edi+4]
sub esi,ecx
movzx ecx,word[ebp]
1402,77 → 1380,25
lea edi,[esi+eax-4]
movzx ecx,word[ebp]
add esi,ecx;[ebp]
mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2
add ecx,[ecx-4]
mov ecx,AREA_TEMP2
sub ecx,esi
cld
@@: rep movsb
.lp3: pop ecx
mov esi,[temp_buf] ;! AREA_TEMP
mov esi,AREA_TEMP
mov edi,ebp
cld
rep movsb
 
inc [cur_tab.Editor.Caret.Y] ;! [pos.y]
inc [cur_tab.Editor.SelStart.Y] ;! [sel.y]
inc [cur_tab.Editor.Lines] ;! [lines]
inc [pos.y]
inc [sel.y]
inc [lines]
 
m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
m2m [sel.x],[pos.x]
 
call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [modified],1
 
.exit:
ret
endf
 
;-----------------------------------------------------------------------------
func key.ctrl_tab ;///// SWITCH TO NEXT TAB //////////////////////////////////
;-----------------------------------------------------------------------------
cmp [tab_bar.Items.Count],1
je .exit
xor eax,eax
mov ebp,[tab_bar.Items]
@@: cmp ebp,[tab_bar.Current.Ptr]
je @f
inc eax
add ebp,sizeof.TABITEM
jmp @b
@@: add ebp,sizeof.TABITEM
inc eax
cmp eax,[tab_bar.Items.Count]
jb @f
mov ebp,[tab_bar.Items]
@@: call set_cur_tab
call align_editor_in_tab
call draw_editor
call draw_tabctl
.exit:
ret
endf
 
;-----------------------------------------------------------------------------
func key.shift_ctrl_tab ;///// SWITCH TO PREVIOUS TAB ////////////////////////
;-----------------------------------------------------------------------------
cmp [tab_bar.Items.Count],1
je .exit
xor eax,eax
mov ebp,[tab_bar.Items]
@@: cmp ebp,[tab_bar.Current.Ptr]
je @f
inc eax
add ebp,sizeof.TABITEM
jmp @b
@@: add ebp,-sizeof.TABITEM
dec eax
jge @f
imul eax,[tab_bar.Items.Count],sizeof.TABITEM
add eax,[tab_bar.Items]
lea ebp,[eax-sizeof.TABITEM]
@@: call set_cur_tab
call align_editor_in_tab
call draw_editor
call draw_tabctl
.exit:
ret
endf
endf
/programs/develop/tinypad/trunk/tp-tbox.asm
85,7 → 85,6
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