/programs/develop/tinypad/trunk/macros.inc |
---|
110,6 → 110,7 |
m = 0 |
if used name |
label name |
forward |
virtual at 0 |
db data |
s = $ |
119,6 → 120,7 |
m = s |
end if |
db data |
common |
.size = $-name |
.maxl = m |
end if |
210,7 → 212,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: |
/programs/develop/tinypad/trunk/tinypad.asm |
---|
1,9 → 1,9 |
;----------------------------------------------------------------------------- |
; project name: TINYPAD |
; compiler: flat assembler 1.67.15 |
; memory to compile: 2.0/7.0 MBytes (without/with size optimizations) |
; version: 4.0.4 pre |
; last update: 2007-01-18 (Jan 18, 2007) |
; compiler: flat assembler 1.67.18 |
; memory to compile: 3.0/9.0 MBytes (without/with size optimizations) |
; version: 4.0.4 |
; last update: 2007-01-28 (Jan 28, 2007) |
; minimal kernel: revision #270 (svn://kolibrios.org/kernel) |
;----------------------------------------------------------------------------- |
; originally by: Ville Michael Turjanmaa >> villemt@aton.co.jyu.fi |
10,26 → 10,20 |
; maintained by: Mike Semenyako >> mike.dld@gmail.com |
; Ivan Poddubny >> ivan-yar@bk.ru |
;----------------------------------------------------------------------------- |
; TODO (FOR 4.1.0): |
; TODO (4.1.0): |
; - optimize drawing (reduce flickering) |
; - add vertical selection, undo, goto position, overwrite mode |
; - improve window drawing with small dimensions |
; - other bug-fixes and speed/size optimizations |
; - save settings to ini file, not to executable |
; |
; TODO (4.0.4, PLANNED FOR 2007-01-21): |
; normal: |
; - finish tabbed interface (tab switching, Ctrl+F4) |
; - reduce flickering (introduce changes checker) |
; - compile default file if selected |
; low: |
; - add prompt to save file before closing/opening |
; - other bug-fixes and speed/size optimizations |
; |
; HISTORY: |
; 4.0.4 pre (mike.dld) |
; 4.0.4 (mike.dld) |
; bug-fixes: |
; - statusbar contained hint after dialog operation cancelled |
; - small drawing fix for gutter and line saved/modified markers |
; (incorrect calculations) |
; - incorrect lines marking on Ctrl+V |
; changes: |
; - editor and other modifications to ease parts placement changing, |
39,12 → 33,14 |
; - use memory manager instead of statically allocated region |
; - case-insensitive filenames input, to be able to open/save files with |
; non-latin chars in name (russian etc.) |
; - reduced flickering (changes checker) |
; - overall code cleanup |
; new features: |
; - recode tables between CP866, CP1251 and KOI8-R (suggested by Victor) |
; - tabbed interface, ability to open several files in one app instance |
; (thanks IRC guys for ideas and testing |
; (thanks IRC guys for ideas and testing) |
; - make any tab default to compile it disregarding currently active tab |
; - configuration dialog (colors, tabs positioning) |
; 4.0.3 (mike.dld) |
; bug-fixes: |
; - 1-char selection if pressing <BS> out of real line length |
157,11 → 153,11 |
include 'macros.inc' ; useful stuff |
;include 'proc32.inc' |
include 'tinypad.inc' |
purge mov,add,sub ; SPEED |
;purge mov,add,sub ; SPEED |
header '01',1,@CODE,TINYPAD_END,STATIC_MEM_END,MAIN_STACK,@PARAMS,self_path |
APP_VERSION equ '4.0.4 pre' |
APP_VERSION equ '4.0.4' |
;include 'debug.inc' |
;define __DEBUG__ 1 |
185,18 → 181,19 |
;----------------------------------------------------------------------------- |
label color_tbl dword |
RGB( 0, 0, 0) ; RGB( 0, 0, 0) ; RGB( 0, 0, 0) ; text |
RGB( 0,144, 0) ; RGB( 0,160, 0) ; RGB( 0,144, 0) ; numbers |
RGB(176, 0, 0) ; RGB( 0,128,255) ; RGB(160, 0, 0) ; strings |
RGB(128,128,128) ; RGB(160,160,160) ; RGB(144,144,144) ; comments |
RGB( 48, 48,240) ; RGB(255, 0, 0) ; RGB( 48, 48,240) ; symbols |
RGB(255,255,255) ; RGB(255,255,255) ; RGB(224,224,224) ; background |
RGB(255,255,255) ; RGB(255,255,255) ; RGB(255,255,255) ; selection text |
RGB( 10, 36,106) ; RGB( 0, 64,128) ; RGB( 0, 0,128) ; selection background |
RGB(255,238, 98) ; modified line marker |
RGB(108,226,108) ; saved line marker |
.text: RGB( 0, 0, 0) |
.back: RGB(255,255,255) |
.text.sel: RGB(255,255,255) |
.back.sel: RGB( 10, 36,106) |
.symbol: RGB( 48, 48,240) |
.number: RGB( 0,144, 0) |
.string: RGB(176, 0, 0) |
.comment: RGB(128,128,128) |
.line.moded: RGB(255,238, 98) |
.line.saved: RGB(108,226,108) |
ins_mode db 1 |
tab_pos db 2 |
options db OPTS_AUTOINDENT+OPTS_OPTIMSAVE+OPTS_SMARTTAB |
229,7 → 226,8 |
mov al,0 |
rep stosb |
mov [tab_bar.Style],2 |
mov al,[tab_pos] |
mov [tab_bar.Style],al |
mcall 68,11 |
or eax,eax |
241,6 → 239,8 |
inc [do_not_draw] |
mov dword[app_start],7 |
mov esi,s_example |
mov edi,tb_opensave.text |
mov ecx,s_example.size |
253,8 → 253,6 |
mov [s_search.size],ecx |
rep movsb |
; DEBUGF 1,"params: '%s'\n",@PARAMS |
cmp byte[@PARAMS],0 |
jz no_params |
263,8 → 261,6 |
cmp byte[@PARAMS],'*' |
jne .noipc |
; DEBUGF 1," started by DOCPAK\n" |
;// diamond [ (convert size from decimal representation to dword) |
;-- mov edx,dword[@PARAMS+1] |
mov esi,@PARAMS+1 |
281,38 → 277,22 |
add edx,20 |
; DEBUGF 1," data size (+20) = %d\n",edx |
mov eax,edx |
call mem.Alloc |
mov ebp,eax |
push eax |
; DEBUGF 1," mem.Alloc() returned 0x%x, allocated size = %d\n",eax,[eax-4] |
;! mcall 60,1,AREA_TEMP-16 ; 0x10000-16 |
;! mov dword[AREA_TEMP-16+4],8 ; [0x10000-16+4],8 |
mov dword[ebp+0],0 |
mov dword[ebp+4],8 |
mcall 60,1,ebp |
mcall 40,1000000b |
; DEBUGF 1," got IPC message within 2 secs? " |
mcall 23,200 |
; DEBUGF 1,"%b\n",eax == 7 |
cmp eax,7 |
jne key.alt_x.close |
;! mov esi,AREA_TEMP-16 ; 0x10000-16 |
;! mov byte[esi],1 |
;! mov eax,[esi+12] |
mov byte[ebp],1 |
;! mov eax,[ebp+12] |
;! inc eax |
;! call load_file.file_found |
; DEBUGF 1," creating new document\n" |
mov ecx,[ebp+12] |
lea esi,[ebp+16] |
call create_tab |
322,14 → 302,11 |
mov eax,ebp |
call mem.Free |
; DEBUGF 1," mem.Free(0x%x) returned %d\n",ebp,eax |
jmp @f |
.noipc: |
;// Willow's code to support DOCPAK ] |
; parameters are at @PARAMS |
mov esi,@PARAMS |
mov edi,tb_opensave.text |
mov ecx,PATHL |
341,7 → 318,7 |
jne key.alt_x.close |
lea eax,[edi-tb_opensave.text-1] |
mov [tb_opensave.length],al |
call btn.load_file |
call load_file |
jnc @f |
no_params: |
354,7 → 331,6 |
mcall 40,00100111b |
red: |
call drawwindow |
call check_inv_all.skip_check |
;----------------------------------------------------------------------------- |
362,7 → 338,7 |
call draw_statusbar ; write current position & number of strings |
.skip_write: |
mcall 10;23,50; wait here until event |
mcall 10 ; wait here until event |
cmp [main_closed],0 |
jne key.alt_x |
dec eax ; redraw ? |
381,86 → 357,66 |
;----------------------------------------------------------------------------- |
; BL = run after compile |
;----------------------------------------------------------------------------- |
cmp [cur_editor.AsmMode],0 ;! [asm_mode],0 |
; FASM infile,outfile,/path/to/files[,run] |
;----------------------------------------------------------------------------- |
cmp [cur_editor.AsmMode],0 |
jne @f |
ret |
@@: mov esi,f_info.path ; s_fname |
@@: |
mov eax,[tab_bar.Default.Ptr] |
or eax,eax |
jnz @f |
mov eax,[tab_bar.Current.Ptr] |
@@: cmp byte[eax+TABITEM.Editor.FilePath],'/' |
je @f |
ret |
@@: |
mov edi,fasm_parameters |
push eax |
cmp byte[esi],'/' |
je .yes_systree |
cld |
mov ecx,[f_info.length] ; [s_fname.size] |
rep movsb |
mov al,',' |
lea esi,[eax+TABITEM.Editor.FilePath] |
add esi,[eax+TABITEM.Editor.FileName] |
push esi esi |
@@: lodsb |
cmp al,0 |
je @f |
stosb |
mov ecx,[f_info.length] ; [s_fname.size] |
add ecx,-4 |
mov esi,f_info.path ; s_fname |
rep movsb |
cmp al,'.' |
jne @b |
mov ecx,esi |
jmp @b |
@@: |
mov al,',' |
stosb |
mov dword[edi],'/RD/' |
mov word[edi+4],'1/' |
add edi,6 |
mov al,0 |
stosb |
jmp .run |
.yes_systree: |
mov eax,[f_info.length] |
add esi,eax ; [s_fname.size] |
dec esi |
xor ecx,ecx |
mov al,'/' |
@@: cmp [esi],al |
je @f |
dec esi |
inc ecx |
jmp @b |
@@: inc esi |
push esi esi ecx |
pop esi |
sub ecx,esi |
dec ecx |
jz @f |
rep movsb |
@@: |
mov al,',' |
stosb |
pop ecx esi |
add ecx,-4 |
add esi,TABITEM.Editor.FilePath |
sub ecx,esi |
rep movsb |
mov al,',' |
stosb |
pop ecx |
sub ecx,f_info.path ; s_fname |
mov esi,f_info.path ; s_fname |
rep movsb |
cmp bl,0 ; run outfile ? |
je @f |
mov dword[edi],',run' |
add edi,4 |
@@: |
mov al,0 |
stosb |
.run: |
cmp bl,0 ; run outfile ? |
je @f |
mov dword[edi-1],',run' |
mov byte[edi+3],0 |
@@: |
mov ebx, fasm_start |
mov [app_start.filename],app_fasm |
mov [app_start.params],fasm_parameters |
start_ret: |
mov eax, 70 |
int 0x40 |
mcall 70,app_start |
ret |
endf |
467,7 → 423,8 |
;----------------------------------------------------------------------------- |
func open_debug_board ;/////////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
mov ebx, board_start |
mov [app_start.filename],app_board |
mov [app_start.params],0 |
jmp start_ret |
endf |
474,44 → 431,38 |
;----------------------------------------------------------------------------- |
func open_sysfuncs_txt ;////////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
mov ebx, docpak_start |
mov [app_start.filename],app_docpak |
mov [app_start.params],sysfuncs_param |
call start_ret |
cmp eax,0xfffffff0 |
jb @f |
mov ebx, tinypad_start |
mov dword [ebx+8], sysfuncs_filename |
mov [app_start.filename],app_tinypad |
mov [app_start.params],sysfuncs_filename |
call start_ret |
@@: ret |
endf |
;----------------------------------------------------------------------------- |
;func layout ;///// change keyboard layout /////////////////////////////////// |
;----------------------------------------------------------------------------- |
; mcall 19,setup,param_setup |
; mcall 5,eax |
;; call activate_me |
;; ret |
;;endf |
set_opt: |
;;func activate_me |
; mcall 9,p_info,-1 |
; inc eax |
; inc eax |
; mov ecx,eax |
; mov edi,[p_info.PID] |
; mov ebx,p_info |
; @@: dec ecx |
; jz @f ; counter=0 => not found? => return |
; mcall 9 |
; cmp edi,[p_info.PID] |
; jne @b |
; mcall 18,3 |
; mcall 5,eax |
; @@: ret |
;endf |
.dialog: |
mov [bot_mode],1 |
mov [bot_dlg_height],128 |
mov [bot_dlg_handler],optsdlg_handler |
mov [focused_tb],tb_color |
mov al,[tb_color.length] |
mov [tb_color.pos.x],al |
mov [tb_color.sel.x],0 |
mov [tb_casesen],1 |
mov [cur_part],0 |
m2m [cur_color],dword[color_tbl.text] |
mov esi,color_tbl |
mov edi,cur_colors |
mov ecx,10 |
cld |
rep movsd |
call drawwindow |
ret |
set_opt: |
.line_numbers: |
mov al,OPTS_LINENUMS |
jmp .main |
554,8 → 505,6 |
section @DATA ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
;----------------------------------------------------------------------------- |
;addr dd s_fname ; address of input string |
;temp dd 0xABCD ; used in read_string |
vscrl_capt dd -1 |
hscrl_capt dd -1 |
body_capt dd -1 |
653,7 → 602,7 |
0 |
accel_table2 dd \ |
1,btn.close_main_window ,\ |
1 ,key.alt_x ,\ |
'VSL',btn.vscroll_up ,\ |
'VSG',btn.vscroll_down ,\ |
'HSL',btn.hscroll_up ,\ |
663,10 → 612,12 |
0 |
accel_table2_botdlg dd \ |
1,btn.close_main_window ,\ |
1 ,key.alt_x ,\ |
20001,btn.bot.cancel ,\ |
20002,btn.bot.opensave ,\ |
20003,btn.bot.find ,\ |
20004,btn.bot.appearance,\ |
21001,btn.bot.tabpos ,\ |
0 |
add_table: |
680,6 → 631,7 |
s_status dd 0 |
@^ |
fasm_start: |
dd 7 |
dd 0 |
708,11 → 660,78 |
dd 0 |
dd 0 |
db '/RD/1/DOCPAK',0 |
^@ |
sz app_fasm ,'/RD/1/DEVELOP/FASM',0 |
sz app_board ,'/RD/1/BOARD',0 |
sz app_tinypad ,'/RD/1/TINYPAD',0 |
sz app_docpak ,'/RD/1/DOCPAK',0 |
sz sysfuncs_param,'g',0 |
include 'tp-locale.inc' |
;// options dialog data [ |
label optsdlg_editor at $-EDITOR.Bounds |
; rb PATHL ; FilePath db PATHL dup(?) |
; dd 0 ; FileName dd ? |
dd ?,?,?,? ; Bounds RECT |
dd @f ; Lines dd ? |
dd ? ; Lines.Size dd ? |
dd 9 ; Lines.Count dd ? |
dd 21 ; Columns.Count dd ? |
dd 0,4 ; Caret POINT |
dd 100,4 ; SelStart POINT |
dd 0,0 ; TopLeft POINT |
dd 0,0 ; VScroll SCROLLBAR |
dd 0,0 ; HScroll SCROLLBAR |
dd 0 ; Gutter.Width dd ? |
db 0 ; Gutter.Visible db ? |
db 1 ; AsmMode db ? |
db 0 ; Modified db ? |
@@: |
dd 0x00000000+1 |
db ' ' |
dd 0x00010000+9 |
db ' org 100h' |
dd 0x00000000+1 |
db ' ' |
dd 0x00000000+20 |
db ' mov ah,09h ; write' |
dd 0x00000000+12 |
db ' mov dx,text' |
dd 0x00000000+8 |
db ' int 21h' |
dd 0x00030000+8 |
db ' int 20h' |
dd 0x00000000+1 |
db ' ' |
dd 0x00000000+21 |
db ' text db "Hello!",24h' |
dd 0 |
optsdlg_editor_parts: ; left,top,right,bottom,type |
db 0, 12, 13, 29, 22 |
db 0, 12, 33, 47, 42 |
db 0, 12, 53, 29, 72 |
db 0, 12, 83, 53, 92 |
db 2, 12, 43, 77, 52 |
db 3, 4, 43,148, 52 |
db 4, 48, 33, 53, 42 |
db 4,108, 83,113, 92 |
db 5, 36, 13, 59, 22 |
db 5, 54, 33, 71, 42 |
db 5, 36, 53, 53, 72 |
db 5,114, 83,131, 92 |
db 6, 60, 83,107, 92 |
db 7, 84, 33,125, 42 |
db 8, 1, 13, 5, 22 |
db 9, 1, 63, 5, 72 |
db 1, 1, 1,148,105 |
db -1 |
;// ] |
sz symbols_ex,';?.%"',"'" |
sz symbols ,'#&*\:/<>|{}()[]=+-, ' |
722,8 → 741,6 |
sz ini_window_right ,'Right',0 |
sz ini_window_bottom,'Bottom',0 |
;include_debug_strings |
TINYPAD_END: ; end of file |
self_path rb PATHL |
732,6 → 749,13 |
section @UDATA ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
;----------------------------------------------------------------------------- |
app_start: |
dd ?,? |
.params dd ? |
dd ?,? |
db ? |
.filename dd ? |
f_info.length dd ? |
f_info.path: |
times PATHL+1 db ? |
739,6 → 763,8 |
file_info FILEINFO |
checker_ed EDITOR |
tab_bar TABCTL |
virtual at tab_bar.Current |
cur_tab TABITEM |
774,6 → 800,8 |
main_closed db ? ; main window closed? |
tb_casesen db ? ; focused textbox is case-sensitive? |
draw_blines db ? |
align 4 |
s_fname.size dd ? |
s_fname rb PATHL+1 |
794,6 → 822,7 |
cl_3d_inset dd ? |
cl_3d_grayed dd ? |
tb_color TBOX |
tb_opensave TBOX |
tb_find TBOX |
tb_replace TBOX |
830,15 → 859,6 |
p_info2 process_information |
sc system_colors |
;store dword '/hd/' at tb_opensave.text+4*0 |
;store dword '1/tp' at tb_opensave.text+4*1 |
;store dword 'ad4/' at tb_opensave.text+4*2 |
;store dword 'tiny' at tb_opensave.text+4*3 |
;store dword 'pad.' at tb_opensave.text+4*4 |
;store dword 'asm' at tb_opensave.text+4*5 |
;store byte 23 at tb_opensave.length |
;rb 1024*36 |
rb 1024*4 |
MAIN_STACK: |
rb 1024*4 |
/programs/develop/tinypad/trunk/tinypad.inc |
---|
11,6 → 11,18 |
Bottom dd ? |
ends |
struct TBOX |
width dw ? |
x dw ? |
height dw ? |
y dw ? |
sel.x db ? |
pos.x db ? |
ofs.x db ? |
length db ? |
text rb 255 |
ends |
struct SCROLLBAR |
Top dd ? |
Size dd ? |
/programs/develop/tinypad/trunk/tp-button.asm |
---|
37,46 → 37,47 |
call draw_editor |
call draw_statusbar |
call draw_tabctl |
call update_caption |
@@: |
jmp still.skip_write |
btn.vscroll_up: |
dec [cur_editor.TopLeft.Y] ;! [top_line] |
dec [cur_editor.TopLeft.Y] |
jns @f |
inc [cur_editor.TopLeft.Y] ;! [top_line] |
inc [cur_editor.TopLeft.Y] |
ret |
@@: call check_inv_all.skip_check |
@@: call editor_check_for_changes |
ret |
btn.vscroll_down: |
inc [cur_editor.TopLeft.Y] ;! [top_line] |
mov eax,[cur_editor.Lines.Count] ;! eax,[lines] |
inc [cur_editor.TopLeft.Y] |
mov eax,[cur_editor.Lines.Count] |
sub eax,[lines.scr] |
cmp eax,[cur_editor.TopLeft.Y] ;! eax,[top_line] |
cmp eax,[cur_editor.TopLeft.Y] |
jge @f |
dec [cur_editor.TopLeft.Y] ;! [top_line] |
dec [cur_editor.TopLeft.Y] |
ret |
@@: call check_inv_all.skip_check |
@@: call editor_check_for_changes |
ret |
btn.hscroll_up: |
dec [cur_editor.TopLeft.X] ;! [left_col] |
dec [cur_editor.TopLeft.X] |
jns @f |
inc [cur_editor.TopLeft.X] ;! [left_col] |
ret;jmp still.skip_write |
@@: call check_inv_all.skip_check |
inc [cur_editor.TopLeft.X] |
ret |
@@: call editor_check_for_changes |
ret |
btn.hscroll_down: |
inc [cur_editor.TopLeft.X] ;! [left_col] |
mov eax,[cur_editor.Columns.Count] ;! eax,[columns] |
inc [cur_editor.TopLeft.X] |
mov eax,[cur_editor.Columns.Count] |
sub eax,[columns.scr] |
cmp eax,[cur_editor.TopLeft.X] ;! eax,[left_col] |
cmp eax,[cur_editor.TopLeft.X] |
jge @f |
dec [cur_editor.TopLeft.X] ;! [left_col] |
dec [cur_editor.TopLeft.X] |
ret |
@@: call check_inv_all.skip_check |
@@: call editor_check_for_changes |
ret |
btn.tabctl_right: |
93,17 → 94,16 |
@@: call draw_tabctl |
ret |
btn.search: |
key.f3: |
call search |
jc @f |
call check_inv_all |
@@: ret |
btn.debug_board: |
call open_debug_board |
ret |
btn.sysfuncs_txt: |
call open_sysfuncs_txt |
ret |
func search |
cld |
mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y] |
mov ecx,[cur_editor.Caret.Y] |
mov edx,ecx |
call get_line_offset |
cmp word[esi],0 |
113,9 → 113,9 |
or eax,eax |
jz .end_line.2 |
mov ecx,eax |
sub ecx,[cur_editor.Caret.X] ;! ecx,[pos.x] |
sub ecx,[cur_editor.Caret.X] |
push esi |
add esi,[cur_editor.Caret.X] ;! esi,[pos.x] |
add esi,[cur_editor.Caret.X] |
jmp @f |
.next_line: |
151,15 → 151,15 |
.found: |
add esp,4 |
mov [cur_editor.Caret.Y],edx ;! [pos.y],edx |
mov [cur_editor.SelStart.Y],edx ;! [sel.y],edx |
mov [cur_editor.Caret.Y],edx |
mov [cur_editor.SelStart.Y],edx |
mov ecx,edx |
lea eax,[esi-4] |
call get_line_offset |
sub eax,esi |
mov [cur_editor.SelStart.X],eax ;! [sel.x],eax |
mov [cur_editor.SelStart.X],eax |
add eax,[s_search.size] |
mov [cur_editor.Caret.X],eax ;! [pos.x],eax |
mov [cur_editor.Caret.X],eax |
mov [s_status],0 |
clc |
ret |
168,7 → 168,7 |
pop esi |
.end_line.2: |
movzx eax,word[esi-4] |
add esi,eax;[esi-4] |
add esi,eax |
inc edx |
call get_real_length |
mov ecx,eax |
180,111 → 180,3 |
stc |
ret |
endf |
btn.compile: |
key.ctrl_f9: |
mov bl,0 |
call start_fasm |
ret |
btn.compile_run: |
key.f9: |
mov bl,1 |
call start_fasm |
ret |
btn.debug_board: |
call open_debug_board |
ret |
btn.sysfuncs_txt: |
call open_sysfuncs_txt |
ret |
btn.load_file: |
key.ctrl_l: |
call load_file |
jnc @f |
ret |
@@: |
xor eax,eax |
mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax |
mov [cur_editor.TopLeft.X],eax ;! [left_col],eax |
mov [cur_editor.Caret.X],eax ;! [pos.x],eax |
mov [cur_editor.Caret.Y],eax ;! [pos.y],eax |
mov [cur_editor.SelStart.X],eax ;! [sel.x],eax |
mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax |
mov [cur_editor.Modified],al ;! [modified],al |
; enable color syntax for ASM and INC files: |
mov [cur_editor.AsmMode],al ;! [asm_mode],al |
; mov eax,[f_info.length] |
; add eax,f_info.path |
; mov byte[eax],0 |
lea ebx,[cur_editor.FilePath] |
mov eax,ebx |
call strlen |
mov ecx,dword[ebx+eax-3] |
or ecx,0x202020 |
cmp ecx,'asm' |
jne @f |
inc [cur_editor.AsmMode] ;! [asm_mode] |
jmp .nocol |
@@: cmp ecx,'inc' |
jne .nocol |
inc [cur_editor.AsmMode] ;! [asm_mode] |
.nocol: |
update_caption: |
lea esi,[cur_editor.FilePath] ;! mov esi,f_info.path |
mov edi,s_title |
@@: lodsb |
cmp al,0 |
je @f |
stosb |
jmp @b |
@@: |
;cld |
;mov ecx,[f_info.length] |
;jecxz @f |
;rep movsb |
mov dword[edi],' - ' |
add edi,3 |
@@: mov esi,htext |
mov ecx,htext.size |
cld |
rep movsb |
mov al,0 |
stosb |
mcall 71,1,s_title |
clc |
ret |
btn.close_main_window: |
key.alt_x: |
mov esi,self_path |
mov byte[esi+PATHL-1],0 |
mov edi,f_info.path |
cld |
@@: lodsb |
stosb |
or al,al |
jnz @b |
mov [f_info70+0],2 |
mov [f_info70+4],0 |
mov [f_info70+8],0 |
mov [f_info70+12],TINYPAD_END |
mov [f_info70+16],0 |
mov byte[f_info70+20],0 |
mov [f_info70+21],f_info.path |
mcall 70,f_info70 |
.close: |
mov [main_closed],1 |
mcall -1 |
/programs/develop/tinypad/trunk/tp-common.asm |
---|
1,87 → 1,14 |
;----------------------------------------------------------------------------- |
func check_cur_vis_inv ;////////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
push eax ebx |
xor bl,bl |
.chk_y: |
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] |
or eax,eax |
jge @f |
mov [cur_editor.Caret.Y],0 ;! [pos.y],0 |
jmp .chk_dy |
@@: cmp eax,[cur_editor.Lines.Count] ;! eax,[lines] |
jl .chk_dy |
mov eax,[cur_editor.Lines.Count] ;! eax,[lines] |
dec eax |
mov [cur_editor.Caret.Y],eax ;! [pos.y],eax |
.chk_dy: |
mov eax,[cur_editor.TopLeft.Y] ;! eax,[top_line] |
cmp eax,[cur_editor.Caret.Y] ;! eax,[pos.y] |
jle @f |
m2m [cur_editor.TopLeft.Y],[cur_editor.Caret.Y] |
;! push [pos.y] |
;! pop [top_line] |
inc bl |
@@: add eax,[lines.scr] |
cmp eax,[cur_editor.Caret.Y] ;! eax,[pos.y] |
jg .chk_x |
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] |
sub eax,[lines.scr] |
inc eax |
mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax |
inc bl |
.chk_x: |
mov eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
or eax,eax |
jge @f |
mov [cur_editor.Caret.X],0 ;! [pos.x],0 |
jmp .chk_dx |
@@: cmp eax,[cur_editor.Columns.Count] ;! eax,[columns] |
jl .chk_dx |
mov eax,[cur_editor.Columns.Count] ;! eax,[columns] |
mov [cur_editor.Caret.X],eax ;! [pos.x],eax |
.chk_dx: |
mov eax,[cur_editor.TopLeft.X] ;! eax,[left_col] |
cmp eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
jle @f |
m2m [cur_editor.TopLeft.X],[cur_editor.Caret.X] |
;! push [pos.x] |
;! pop [left_col] |
inc bl |
@@: add eax,[columns.scr] |
cmp eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
jg @f |
mov eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
sub eax,[columns.scr] |
inc eax |
mov [cur_editor.TopLeft.X],eax ;! [left_col],eax |
inc bl |
@@: cmp [mev],MEV_LDOWN |
jne .exit |
push [cur_editor.Caret.X] [cur_editor.Caret.Y] ;! [pos.x] [pos.y] |
pop [cur_editor.SelStart.Y] [cur_editor.SelStart.X] ;! [sel.y] [sel.x] |
.exit: |
or bl,bl |
clc |
jz @f |
call draw_file |
stc |
@@: pop ebx eax |
ret |
endf |
;----------------------------------------------------------------------------- |
func clear_selection ;//////////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
push eax ebx |
mov eax,[cur_editor.SelStart.Y] ;! eax,[sel.y] |
mov ebx,[cur_editor.Caret.Y] ;! ebx,[pos.y] |
mov eax,[cur_editor.SelStart.Y] |
mov ebx,[cur_editor.Caret.Y] |
cmp eax,ebx |
jle @f |
xchg eax,ebx |
@@: push [cur_editor.Caret.X] [cur_editor.Caret.Y] ;! [pos.x] [pos.y] |
pop [cur_editor.SelStart.Y] [cur_editor.SelStart.X] ;! [sel.y] [sel.x] |
call draw_file.ex |
@@: push [cur_editor.Caret.X] [cur_editor.Caret.Y] |
pop [cur_editor.SelStart.Y] [cur_editor.SelStart.X] |
pop ebx eax |
ret |
endf |
107,24 → 34,24 |
func check_bottom_right ;///////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
push eax |
mov eax,[cur_editor.TopLeft.Y] ;! eax,[top_line] |
mov eax,[cur_editor.TopLeft.Y] |
add eax,[lines.scr] |
cmp eax,[cur_editor.Lines.Count] ;! eax,[lines] |
cmp eax,[cur_editor.Lines.Count] |
jbe .lp1 |
mov eax,[cur_editor.Lines.Count] ;! eax,[lines] |
mov eax,[cur_editor.Lines.Count] |
sub eax,[lines.scr] |
jns @f |
xor eax,eax |
@@: mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax |
.lp1: mov eax,[cur_editor.TopLeft.X] ;! eax,[left_col] |
@@: mov [cur_editor.TopLeft.Y],eax |
.lp1: mov eax,[cur_editor.TopLeft.X] |
add eax,[columns.scr] |
cmp eax,[cur_editor.Columns.Count] ;! eax,[columns] |
cmp eax,[cur_editor.Columns.Count] |
jbe .exit |
mov eax,[cur_editor.Columns.Count] ;! eax,[columns] |
mov eax,[cur_editor.Columns.Count] |
sub eax,[columns.scr] |
jns @f |
xor eax,eax |
@@: mov [cur_editor.TopLeft.X],eax ;! [left_col],eax |
@@: mov [cur_editor.TopLeft.X],eax |
.exit: |
pop eax |
ret |
131,88 → 58,6 |
endf |
;----------------------------------------------------------------------------- |
func check_inv_str ;////////////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
@^ |
mov eax,[pos.y] |
mov ecx,[top_line] |
.skip_init: |
call check_cur_vis |
mov [pos.y],eax |
mov [top_line],ecx |
.skip_check: |
; call invalidate_string |
call drawfile |
ret |
^@ |
endf |
;----------------------------------------------------------------------------- |
func check_inv_all ;////////////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] |
mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line] |
.skip_init: |
call check_cur_vis |
mov [cur_editor.Caret.Y],eax ;! [pos.y],eax |
mov [cur_editor.TopLeft.Y],ecx ;! [top_line],ecx |
.skip_check: |
; call clear_screen |
call draw_file |
ret |
endf |
;----------------------------------------------------------------------------- |
func check_cur_vis ;////////////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
cmp eax,ecx |
jb .low |
mov edx,ecx |
add edx,[lines.scr] |
cmp edx,[cur_editor.Lines.Count] ;! edx,[lines] |
jbe @f |
mov edx,[cur_editor.Lines.Count] ;! edx,[lines] |
@@: cmp eax,edx |
jb @f |
lea ecx,[eax+1] |
sub ecx,[lines.scr] |
jns @f |
xor ecx,ecx |
jmp @f |
.low: mov ecx,eax |
@@: mov edx,ecx |
add edx,[lines.scr] |
cmp edx,[cur_editor.Lines.Count] ;! edx,[lines] |
jbe @f |
mov ecx,[cur_editor.Lines.Count] ;! ecx,[lines] |
sub ecx,[lines.scr] |
jns @f |
xor ecx,ecx |
@@:;mov [top_line],ecx |
pushad |
mov eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
mov ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col] |
mov ecx,ebx |
add ecx,[columns.scr] |
cmp eax,ebx |
jb .lp1 |
cmp eax,ecx |
jb .exit |
lea ebx,[eax] |
sub ebx,[columns.scr] |
jmp @f |
.lp1: mov ebx,eax |
@@: mov [cur_editor.TopLeft.X],ebx ;! [left_col],ebx |
.exit: |
mov [cur_editor.Caret.X],eax ;! [pos.x],eax |
popad |
ret |
endf |
;----------------------------------------------------------------------------- |
func get_real_length ;//////////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
movzx eax,word[esi] |
232,7 → 77,7 |
; ESI = line data offset |
;----------------------------------------------------------------------------- |
push eax ecx |
mov esi,[cur_editor.Lines] ;! AREA_EDIT |
mov esi,[cur_editor.Lines] |
@@: dec ecx |
js .exit |
movzx eax,word[esi] |
248,10 → 93,10 |
;----------------------------------------------------------------------------- |
pushad |
mov [sel.selected],1 |
mov eax,[cur_editor.SelStart.X] ;! eax,[sel.x] |
mov ebx,[cur_editor.SelStart.Y] ;! ebx,[sel.y] |
mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x] |
mov edx,[cur_editor.Caret.Y] ;! edx,[pos.y] |
mov eax,[ebp+EDITOR.SelStart.X] |
mov ebx,[ebp+EDITOR.SelStart.Y] |
mov ecx,[ebp+EDITOR.Caret.X] |
mov edx,[ebp+EDITOR.Caret.Y] |
cmp ebx,edx |
jl .lp2 |
jne @f |
307,10 → 152,6 |
add eax,[esp+4] |
cmp eax,[esp] |
jle @f |
; mov eax,[esp] |
; sub eax,[esp+4] |
; js @f |
; mov [esp+8],eax |
@@: |
pop edx ebx eax |
ret |
449,9 → 290,9 |
mov dword[ecx+0x0],0 |
mov dword[ecx+0x4],0 |
movzx edx,[ebp+POPUP.width] |
mov dword[ecx+0x8],edx;POP_WIDTH |
mov dword[ecx+0x8],edx |
movzx edx,[ebp+POPUP.height] |
mov dword[ecx+0xC],edx;POP_HEIGHT |
mov dword[ecx+0xC],edx |
call pt_in_rect |
jnc .outside_window |
inc dword[ecx+0x0] |
458,7 → 299,7 |
mov dword[ecx+0x4],3 |
dec dword[ecx+0x8] |
mov dword[ecx+0xC],3+POP_IHEIGHT-1 |
mov edx,[ebp+POPUP.data];popup_text.data |
mov edx,[ebp+POPUP.data] |
@@: inc [pi_cur] |
inc edx |
movzx esi,byte[edx-1] |
475,7 → 316,7 |
.lp1: call pt_in_rect |
jnc .lp2 |
mov eax,[pi_cur] |
test byte[ebp+eax-1],1;byte[popup_text+eax-1],1 |
test byte[ebp+eax-1],1 |
jnz .exit |
jmp .separator |
.lp2: add dword[ecx+0x4],POP_IHEIGHT |
516,7 → 357,7 |
mov [esp+4*7],eax |
add esi,eax |
push ecx |
mov edi,[cur_editor.Lines] ;! AREA_TEMP2 |
mov edi,[cur_editor.Lines] |
add edi,[edi-4] |
dec edi |
mov eax,esi |
523,7 → 364,7 |
mov esi,edi |
sub esi,ecx |
lea ecx,[eax+4] |
add ecx,edx;[eax] |
add ecx,edx |
push ecx |
neg ecx |
lea ecx,[esi+ecx+1] |
571,7 → 412,7 |
mov [edi-4],bx |
add edi,[sel.begin.x] |
lea esi,[esi+eax+4] |
mov ecx,[cur_editor.Lines] ;! AREA_TEMP2 |
mov ecx,[cur_editor.Lines] |
add ecx,[ecx-4] |
sub ecx,esi |
cld |
578,7 → 419,7 |
rep movsb |
mov eax,[sel.end.y] |
sub eax,[sel.begin.y] |
sub [cur_editor.Lines.Count],eax ;! [lines],eax |
sub [cur_editor.Lines.Count],eax |
jmp .exit |
.single_line: |
597,7 → 438,7 |
lea edi,[esi+4] |
add edi,[sel.begin.x] |
lea esi,[edi+ecx] |
mov ecx,[cur_editor.Lines] ;! AREA_TEMP2 |
mov ecx,[cur_editor.Lines] |
add ecx,[ecx-4] |
sub ecx,esi |
cld |
605,11 → 446,11 |
.exit: |
mov eax,[sel.begin.x] |
mov [cur_editor.Caret.X],eax ;! [pos.x],eax |
mov [cur_editor.SelStart.X],eax ;! [sel.x],eax |
mov [cur_editor.Caret.X],eax |
mov [cur_editor.SelStart.X],eax |
mov eax,[sel.begin.y] |
mov [cur_editor.Caret.Y],eax ;! [pos.y],eax |
mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax |
mov [cur_editor.Caret.Y],eax |
mov [cur_editor.SelStart.Y],eax |
mov ecx,[cur_editor.Lines.Count] |
call get_line_offset |
622,7 → 463,7 |
call editor_realloc_lines |
popad |
mov [cur_editor.Modified],1 ;! [modified],1 |
mov [cur_editor.Modified],1 |
clc |
ret |
690,6 → 531,34 |
endf |
;----------------------------------------------------------------------------- |
func update_caption ;///////////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
lea esi,[cur_editor.FilePath] |
mov edi,s_title |
@@: lodsb |
cmp al,0 |
je @f |
stosb |
jmp @b |
@@: |
mov dword[edi],' - ' |
add edi,3 |
@@: mov esi,htext |
mov ecx,htext.size |
cld |
rep movsb |
mov al,0 |
stosb |
mcall 71,1,s_title |
clc |
ret |
endf |
;----------------------------------------------------------------------------- |
func mem.Alloc ;////////////////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
push ebx ecx |
/programs/develop/tinypad/trunk/tp-defines.inc |
---|
29,7 → 29,7 |
define mm.Encoding.CP1251.KOI8R recode.1251.koi |
define mm.Encoding.KOI8R.CP1251 recode.koi.1251 |
define mm.Options.Appearance 0 |
define mm.Options.Appearance set_opt.dialog |
define mm.Options.SecureSel set_opt.secure_sel |
define mm.Options.AutoBrackets set_opt.auto_braces |
define mm.Options.AutoIndents set_opt.auto_indents |
/programs/develop/tinypad/trunk/tp-dialog.asm |
---|
80,9 → 80,9 |
mov eax,[p_info.client_box.width] |
sub eax,6*(s_2find.size+2)+1 |
add eax,6*(s_2find.size+2)*65536 |
mov dword[tbox.x],eax |
mov dword[tbox.width],eax |
add ecx,-18*65536+1 |
mov dword[tbox.y],ecx |
mov dword[tbox.height],ecx |
call textbox.draw |
pop ecx |
93,9 → 93,9 |
mov eax,[p_info.client_box.width] |
sub eax,6*(s_2replace.size+2)+1 |
add eax,6*(s_2replace.size+2)*65536 |
mov dword[tbox.x],eax |
mov dword[tbox.width],eax |
inc ecx |
mov dword[tbox.y],ecx |
mov dword[tbox.height],ecx |
call textbox.draw |
@@: |
164,9 → 164,9 |
mov eax,[p_info.client_box.width] |
sub eax,6*(s_2filename.size+1)+1 |
add eax,6*(s_2filename.size+1)*65536 |
mov dword[tbox.x],eax |
mov dword[tbox.width],eax |
add ecx,-18*65536+1 |
mov dword[tbox.y],ecx |
mov dword[tbox.height],ecx |
call textbox.draw |
ret |
220,11 → 220,16 |
mov eax,[p_info.box.width] |
sub eax,6*(s_2filename.size+3) |
add eax,6*(s_2filename.size+2)*65536 |
mov dword[tbox.x],eax |
mov dword[tbox.width],eax |
add ecx,-18*65536+1 |
mov dword[tbox.y],ecx |
mov dword[tbox.height],ecx |
call textbox.draw |
sub ebx,(6*(s_2cancel.size+2)+3)*65536 |
mov bx,6*(s_2cancel.size+2) |
push 20010 s_2cancel s_2cancel.size |
call define_3d_button |
ret |
.key: |
237,6 → 242,332 |
call textbox.key |
ret |
cur_part dd ? |
cur_color dd ? |
cur_colors rd 10 |
optsdlg_handler: |
cmp al,1 |
je .draw |
cmp al,2 |
je .key |
cmp al,3 |
je botdlg.button |
cmp al,4 |
je .mouse |
ret |
.xchg_colors: |
mov ecx,10 |
mov esi,color_tbl |
mov edi,cur_colors |
@@: lodsd |
xchg eax,[edi] |
mov [esi-4],eax |
add edi,4 |
loop @b |
ret |
.draw: |
call .draw_editor |
mov ecx,[bot_ofs-2] |
mov cx,word[bot_ofs] |
push ecx |
add ecx,128 |
mcall 38,<2+3+165,2+3+165>,,[cl_3d_inset] |
mov bx,word[p_info.client_box.width] |
pop ecx |
add ecx,35*65536+35 |
mcall |
add ecx,0x00240024 |
mcall |
shr ecx,16 |
mov bx,cx |
add ebx,38*65536-21 |
mcall 4,,[sc.work_text],s_tabpos,s_tabpos.size |
call .draw_tabpos |
mov ebx,[bot_ofs] |
add ebx,(2+6+165+35)*65536+5+16 |
mcall 4,,[sc.work_text],s_color,s_color.size |
mov dword[tb_color.width],(2+6+6*s_color.size+165+35)*65536+(6*6+8) |
mov eax,ebx |
add ax,-3 |
shl eax,16 |
mov ax,14 |
mov dword[tb_color.height],eax |
call .draw_color |
mov ebx,[p_info.client_box.width] |
shl ebx,16 |
mov ecx,[p_info.client_box.height] |
shl ecx,16 |
add ecx,(-34)*65536+15 |
add ebx,-(2+6*(s_2save.size+2))*65536+6*(s_2save.size+2) |
push 20004 s_2save s_2save.size |
call define_3d_button |
sub ebx,(6*(s_2cancel.size+2)+3)*65536 |
mov bx,6*(s_2cancel.size+2) |
push 20001 s_2cancel s_2cancel.size |
call define_3d_button |
ret |
.get_color: |
movzx ecx,[tb_color.length] |
mov esi,tb_color.text |
xor eax,eax |
xor ebx,ebx |
jecxz .lp2 |
.lp1: lodsb |
cmp al,'9' |
mov dl,-'0' |
jbe @f |
mov dl,-'A'+10 |
@@: add al,dl |
shl ebx,4 |
add bl,al |
loop .lp1 |
.lp2: mov eax,[cur_part] |
mov [cur_colors+eax*4],ebx |
mov [cur_color],ebx |
jmp .draw_color.2 |
.draw_editor: |
push dword[options] [tab_bar.Current.Ptr] |
mov [options],0 |
mov ebp,optsdlg_editor |
call set_cur_tab |
call .xchg_colors |
mov [cur_editor.Bounds.Left],2 |
mov [cur_editor.Bounds.Right],2+165 |
mov eax,[p_info.client_box.height] |
add eax,-125-STATH |
mov [cur_editor.Bounds.Top],eax |
add eax,122 |
mov [cur_editor.Bounds.Bottom],eax |
call draw_editor |
call .xchg_colors |
pop ebp eax |
mov [options],al |
call set_cur_tab |
ret |
.draw_tabpos: |
mov ecx,[bot_ofs-2] |
xor cx,cx |
mov ebx,(2+3+165+3)*65536+31 |
add ecx,38*65536+31 |
mov edx,[cl_3d_inset] |
mov esi,[sc.work] |
call draw_fillrect |
dec ebx |
dec ecx |
mcall 8,,,0x40000000+21001 |
mov esi,[cl_3d_normal] |
mov al,[tab_pos] |
TPOSH = 6 |
TPOSW = 10 |
dec al |
jnz @f |
;// top |
inc ebx |
mov cx,TPOSH |
call draw_fillrect |
add ecx,2*65536-2 |
jmp .lp3 |
@@: dec al |
jnz @f |
;// bottom |
inc ebx |
mov cx,TPOSH |
add ecx,(31-TPOSH)*65536 |
call draw_fillrect |
add ecx,-2 |
jmp .lp3 |
@@: dec al |
jnz @f |
;// left |
inc ecx |
mov bx,TPOSW |
call draw_fillrect |
add ebx,2*65536-2 |
jmp .lp4 |
@@: dec al |
jnz @f |
;// right |
inc ecx |
mov bx,TPOSW |
add ebx,(31-TPOSW)*65536 |
call draw_fillrect |
add ebx,-2 |
jmp .lp4 |
.lp3: |
add ebx,(2+TPOSW-2+1)*65536-31+TPOSW-2 |
call draw_fillrect |
add ebx,-(TPOSW-2+1)*65536 |
mov esi,[sc.work] |
call draw_fillrect |
ret |
.lp4: |
add ecx,7*65536-31+4 |
call draw_fillrect |
add ecx,-5*65536 |
mov esi,[sc.work] |
call draw_fillrect |
ret |
.draw_color: |
mov ecx,[cur_part] |
mov edx,s_appearance+1 |
@@: dec ecx |
js @f |
movzx eax,byte[edx-1] |
lea edx,[edx+eax+1] |
jmp @b |
@@: |
movzx esi,byte[edx-1] |
mov ebx,[bot_ofs] |
add ebx,(2+6+165+35)*65536+8 |
push ebx ecx edx |
mov ecx,ebx |
shl ecx,16 |
mov bx,s_appearance.maxl*6 |
mov cx,10 |
mcall 13,,,[cl_3d_normal] |
pop edx ecx ebx |
mcall 4,,[sc.work_text] |
mov eax,[cur_color] |
mov edi,tb_color.text |
mov ebx,6 |
mov ecx,16 |
call uint2strz |
mov [tb_color.length],6 |
mov [tb_color.sel.x],0 |
mov [tb_color.pos.x],6 |
mov ebp,tb_color |
call textbox.draw |
.draw_color.2: |
mov ecx,[p_info.client_box.height] |
sub ecx,[bot_dlg_height] |
add ecx,-STATH |
shl ecx,16 |
add ecx,3*65536+31 |
mov ebx,(2+6+165)*65536+31 |
mov edx,[cl_3d_inset] |
mov esi,[cur_color] |
call draw_fillrect |
ret |
.key: |
cmp ebx,KEY_ESCAPE |
je btn.bot.cancel |
cmp ebx,KEY_RETURN |
je btn.bot.appearance |
cmp ebx,KEY_NUMRETURN |
je btn.bot.appearance |
cmp ebx,KEY_BACKSPACE |
je .key.tb.2 |
cmp ebx,KEY_TAB |
je .key.tb.2 |
cmp bx,0x00FF |
ja .key.tb.2 |
;cmp ebx,KEY_LSHIFT |
;je .key.tb.2 |
;cmp ebx,KEY_RSHIFT |
;je .key.tb.2 |
;cmp ebx,0x00000147 |
;jb .key.exit |
;cmp ebx,0x00000153 |
;jbe .key.tb.2 |
test dword[shi],KM_CTRLALT |
jnz .key.exit |
movzx eax,[chr] |
movzx eax,[eax+key0] |
or al,al |
jz .key.exit |
movzx eax,[eax+key1] |
cmp al,'0' |
jb @f |
cmp al,'9' |
jbe .key.tb |
@@: cmp al,'A' |
jb @f |
cmp al,'F' |
jbe .key.tb |
@@: cmp al,'a' |
jb @f |
cmp al,'f' |
jbe .key.tb |
@@: ret |
.key.tb: |
cmp [tb_color.length],6 |
jb @f |
mov al,[tb_color.sel.x] |
cmp al,[tb_color.pos.x] |
jne @f |
ret |
.key.tb.2: |
@@: call textbox.key |
call .get_color |
call .draw_editor |
.key.exit: |
ret |
.mouse: |
cmp ah,MEV_LDOWN |
jne .mouse.exit |
mcall 37,1 |
movsx ebx,ax |
sar eax,16 |
cmp eax,[optsdlg_editor+EDITOR.Bounds.Right] |
jg .mouse.exit |
cmp ebx,[optsdlg_editor+EDITOR.Bounds.Bottom] |
jg .mouse.exit |
sub eax,[optsdlg_editor+EDITOR.Bounds.Left] |
js .mouse.exit |
sub ebx,[optsdlg_editor+EDITOR.Bounds.Top] |
js .mouse.exit |
mov esi,optsdlg_editor_parts-5 |
@@: add esi,5 |
cmp byte[esi+0],-1 |
je .mouse.exit |
cmp al,byte[esi+1] |
jb @b |
cmp bl,byte[esi+2] |
jb @b |
cmp al,byte[esi+3] |
ja @b |
cmp bl,byte[esi+4] |
ja @b |
movzx ebp,byte[esi+0] |
mov [cur_part],ebp |
m2m [cur_color],[cur_colors+ebp*4] |
;mcall 13,<200,30>,<250,30>,[color_tbl+ebp*4] |
;call .draw_color |
call .draw |
.mouse.exit: |
ret |
botdlg.button: |
mov esi,accel_table2_botdlg |
.acc: cmp ebx,[esi] |
262,7 → 593,7 |
call save_file |
jnc @f |
jmp .lp2 |
.lp1: call btn.load_file |
.lp1: call load_file |
jnc @f |
.lp2: |
ret |
285,18 → 616,12 |
je @f |
call search |
jnc .found |
call check_inv_all |
call editor_check_for_changes |
ret |
.found: |
;--------------------------------------- |
push [copy_size] [copy_count] [copy_buf] |
; mov esi,0 ;! AREA_CBUF |
; mov edi,0 ;! AREA_CBUF-304 |
; mov ecx,300/4 |
; rep movsd |
movzx eax,[tb_replace.length] |
add eax,10 |
call mem.Alloc |
304,7 → 629,7 |
movzx eax,[tb_replace.length] |
mov esi,tb_replace.text |
mov edi,[copy_buf] ;! AREA_CBUF |
mov edi,[copy_buf] |
stosd |
mov ecx,eax |
jecxz .lp1 |
313,27 → 638,41 |
mov [copy_size],eax |
mov [copy_count],1 |
push [cur_editor.SelStart.X] ;! [sel.x] |
push [cur_editor.SelStart.X] |
mov ebp,cur_editor |
call init_sel_vars |
call key.ctrl_v |
pop [cur_editor.SelStart.X] ;! [sel.x] |
pop [cur_editor.SelStart.X] |
mov eax,[copy_buf] |
call mem.Free |
; mov esi,0 ;! AREA_CBUF-304 |
; mov edi,0 ;! AREA_CBUF |
; mov ecx,300/4 |
; rep movsd |
pop [copy_buf] [copy_count] [copy_size] |
;--------------------------------------- |
call check_inv_all |
call editor_check_for_changes |
ret |
@@: xor eax,eax |
mov [bot_mode],al |
mov [bot_dlg_height],eax |
call btn.search |
call key.f3 |
call drawwindow |
ret |
btn.bot.appearance: |
@@: xor eax,eax |
mov [bot_mode],al |
mov [bot_dlg_height],eax |
call optsdlg_handler.xchg_colors |
mov al,[tab_pos] |
mov [tab_bar.Style],al |
call drawwindow |
ret |
tabpos_round db 4,3,1,2 |
btn.bot.tabpos: |
movzx eax,[tab_pos] |
mov al,[tabpos_round+eax-1] |
mov [tab_pos],al |
@@: call optsdlg_handler.draw_tabpos |
ret |
/programs/develop/tinypad/trunk/tp-draw.asm |
---|
12,8 → 12,7 |
mcall 12,1 |
push [color_tbl+4*5] |
pop [sc.work] |
m2m [sc.work],dword[color_tbl.back] |
mov edx,[sc.work] |
add edx,0x33000000 |
30,11 → 29,9 |
cld |
rep movsd |
; 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] |
48,8 → 45,6 |
mov [top_ofs],ATOPH;+1 |
;// --- columns.scr and lines.scr calculation --- |
mov eax,[p_info.client_box.height] |
add eax,-STATH+1;*3-2-2 |
sub eax,[bot_dlg_height] |
72,19 → 67,6 |
; 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] |
call draw_main_menu |
125,9 → 107,6 |
@@: |
.exit: |
;-- draw file -- |
;call draw_file |
;++ draw editor control ++ |
call draw_editor |
call draw_tabctl |
.exit.2: |
176,7 → 155,6 |
mov edx,main_menu |
mov ebx,9*65536+ATOPH/2-3;4 |
;mov ecx,[sc.work_text] |
mov [mi_sel],0 |
mov edi,[mi_cur] |
@@: inc [mi_sel] |
187,10 → 165,9 |
jne .lp1 |
pushad |
push edx |
;mov ebx,[edx+0] |
mov ecx,[edx+4] |
add ecx,2*65536-2 |
mcall 13,[edx+0],,[sc.work];[cl_3d_pushed] |
mcall 13,[edx+0],,[sc.work] |
mov edx,[esp] |
mov cx,[edx+6] |
add ecx,-1*65536+1 |
201,7 → 178,7 |
add cx,[edx+4] |
add cx,-2 |
mov bx,[edx+2] |
mcall 38,,,[cl_3d_inset] |
mcall ,,,[cl_3d_inset] |
pop edx |
movzx eax,word[edx] |
add ebx,eax |
209,7 → 186,7 |
add ebx,eax |
mcall 38,,,[cl_3d_inset] |
popad |
mov ecx,[color_tbl+4*0] |
mov ecx,[color_tbl.text] |
.lp1: add edx,8+1 |
movzx esi,byte[edx-1] |
mcall 4 |
224,901 → 201,8 |
endf |
;----------------------------------------------------------------------------- |
func draw_file.ex ;/////////////////////////////////////////////////////////// |
func draw_statusbar ;///// DRAW POSITION, MODIFIED STATE, HINT /////////////// |
;----------------------------------------------------------------------------- |
; Input: |
; EAX = start line |
; EBX = end line |
;----------------------------------------------------------------------------- |
call draw_editor;_text |
ret |
macro unused { |
cmp [p_info.client_box.height],LINEH |
jge @f |
ret |
@@: |
call init_sel_vars |
call check_bottom_right |
pushad |
cmp [lines.scr],0 |
jle draw_file.exit |
cmp eax,ebx |
jle @f |
xchg eax,ebx |
@@: cmp eax,[cur_editor.TopLeft.Y] ;! eax,[top_line] |
jge @f |
mov eax,[cur_editor.TopLeft.Y] ;! eax,[top_line] |
@@: mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line] |
add ecx,[lines.scr] |
cmp ebx,ecx |
jl @f |
dec ecx |
mov ebx,ecx |
@@: cmp eax,ebx |
jg draw_file.exit |
mov ecx,eax |
push eax |
call get_line_offset |
.start: |
mov ecx,ebx |
sub ecx,eax |
inc ecx |
mov ebx,[top_ofs] |
add ebx,[left_ofs-2] |
sub eax,[cur_editor.TopLeft.Y] ;! eax,[top_line] |
imul eax,LINEH |
add ebx,eax |
imul ebp,[cur_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 |
@@: |
call init_sel_vars |
call check_bottom_right |
pushad |
mov ebx,[top_ofs] |
add ebx,[left_ofs-2] |
mov ecx,[cur_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_editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536 |
mov eax,[lines.scr] |
sub eax,[cur_editor.Lines] ;! eax,[lines] |
mov [draw_blines],eax |
.next_line: |
push ecx ebx |
mov ecx,ebx |
shl ecx,16 |
mov cl,LINEH |
mov ebx,[p_info.client_box.width] |
add ebx,-SCRLW |
add ebx,[left_ofs-2] |
sub ebx,[left_ofs] |
add ebx,-1*65536+1 |
; 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_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];OLEFT-1 |
dec ebx |
rol ebx,16 |
mov edx,[color_tbl+4*7] |
mcall 13 |
popad |
; inc eax |
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_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 |
dec eax |
mov bx,ax |
rol ebx,16 |
; inc ebx |
mcall 13 |
popad |
mov edx,[color_tbl+4*7] |
mov bx,ax |
mov [in_sel],3 |
jmp .lp6 |
.lp5: mov eax,[cur_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_editor.TopLeft.X] ;! eax,[left_col] |
imul eax,6 |
pushad |
mov ebx,[sel.end.x] |
sub ebx,[sel.begin.x] |
; inc ebx |
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] |
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,-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 .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_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_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_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_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_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_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 |
;------------------------------------------------ |
.draw_cursor: |
;------------------------------------------------ |
mov ebx,[left_ofs] |
cmp ebx,2+LCHGW |
je .no_gutter |
add esp,-4*8*2 |
sub ebx,3+LCHGW |
mov ecx,[top_ofs] |
dec ecx |
shl ecx,16 |
add ecx,[bot_ofs] |
sub ecx,[top_ofs] |
sub ecx,SCRLW |
mcall 13,,,[cl_3d_normal] |
push bx |
shl ebx,16 |
pop bx |
add ecx,[top_ofs] |
dec ecx |
mcall 38,,,[cl_3d_inset] |
mov ebx,[left_ofs] |
add ebx,-3-LCHGW |
shl ebx,16 |
add ebx,[top_ofs] |
mov edi,[sc.work_text] |
mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line] |
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_editor.Lines] ;! ecx,[lines] |
jg @f |
mov esi,ecx |
sub esi,[cur_editor.TopLeft.Y] ;! esi,[top_line] |
cmp esi,[lines.scr] |
jbe @b |
@@: add esp,4*8*2 |
.no_gutter: |
;------------------------------------------------ |
mov ebx,[draw_blines] |
or ebx,ebx |
js @f |
imul ebx,LINEH |
mov ecx,[esp-8] |
shl ecx,16 |
mov cx,bx |
mov ebx,[p_info.client_box.width] |
add ebx,[left_ofs-2] |
sub ebx,[left_ofs] |
add ebx,-1*65536-SCRLW+1 ; <OLEFT-1,LINE_WIDTH*6+2> |
mcall 13,,,[color_tbl+4*5] |
@@: |
add esp,4 |
cmp [bot_mode],0 |
jne @f |
mov ebx,[cur_editor.Caret.X] ;! ebx,[pos.x] |
sub ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col] |
js @f |
cmp ebx,[columns.scr] |
ja @f |
imul ebx,6 |
add ebx,[left_ofs] |
dec ebx |
push bx |
shl ebx,16 |
pop bx |
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] |
sub eax,[cur_editor.TopLeft.Y] ;! eax,[top_line] |
js @f |
cmp eax,[lines.scr] |
jge @f |
imul eax,LINEH |
add eax,[top_ofs] |
; inc eax |
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 |
@@: |
;------------------------------------------------ |
cmp [do_not_draw],2 |
je .exit |
; mov ebx,[p_info.x_size] |
; shl ebx,16 |
; add ebx,(-SCRLW-5+2)*65536+SCRLW-2 |
; mov ecx,[top_ofs-2] |
; mov cx,SCRLW-1 |
; mcall 8,,,'UP',[sc.work_button] |
;!!!!!!!!!!!!!!!!!! |
mov ebx,[p_info.client_box.width] |
shl ebx,16 |
add ebx,(-SCRLW)*65536+SCRLW |
mov ecx,[top_ofs-2] |
mov cx,SCRLW |
sub ecx,0x00020000 |
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,[bot_ofs] |
; shl ecx,16 |
; add ecx,(-SCRLW*2-1)*65536+SCRLW-1 |
; mcall ,,,'DN' |
;!!!!!!!!!!!!!!!!!! |
mov ecx,[bot_ofs] |
shl ecx,16 |
add ecx,(-SCRLW*2-1)*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 |
; sub ebx,1*65536-2 |
push ebx |
mov eax,[cur_editor.Lines] ;! eax,[lines] |
mov ebx,[lines.scr] |
mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line] |
mov edx,[bot_ofs] |
sub edx,[top_ofs] |
add edx,-SCRLW*3+1 |
call get_scroll_vars |
mov [cur_editor.VScroll.Top],eax ;! [vscrl_top],eax |
mov [cur_editor.VScroll.Size],ebx ;! [vscrl_size],ebx |
pop ebx |
mov ecx,eax |
add ecx,[top_ofs] |
add ecx,SCRLW-1 |
; shl ecx,16 |
; mov cx,word[vscrl_size] |
; mcall 13,,,[sc.work_button] |
;!!!!!!!!!!!!!!!!!! |
pushad |
sar ebx,16 |
; rol ecx,16 |
; movsx eax,cx |
; sar ecx,16 |
push ebx ecx SCRLW [cur_editor.VScroll.Size] ;! ebx ecx SCRLW [vscrl_size] |
dec dword[esp] |
call draw_3d_panel |
popad |
mov eax,13 |
;!!!!!!!!!!!!!!!!!! |
inc ebx |
mov ecx,[top_ofs-2] |
mov cx,word[cur_editor.VScroll.Top] ;! cx,word[vscrl_top] |
add ecx,(SCRLW-1)*65536 |
mov edx,[sc.work];[color_tbl+4*5] |
or cx,cx |
jle @f |
mcall 13 |
@@: |
mov ecx,[top_ofs] |
add ecx,[cur_editor.VScroll.Top] ;! ecx,[vscrl_top] |
add ecx,[cur_editor.VScroll.Size] ;! ecx,[vscrl_size] |
add ecx,SCRLW-1 |
mov di,cx |
shl ecx,16 |
mov cx,word[bot_ofs] |
sub cx,di |
sub cx,SCRLW*2+1 |
jle @f |
mcall |
@@: |
;----------------------- |
; mov eax,ebx |
; shr eax,16 |
; add bx,ax |
; mov ecx,[top_ofs-2] |
; mov cx,word[top_ofs] |
; add ecx,SCRLW*65536+SCRLW |
; mcall 38,,,[sc.work_graph];[sc.work_text] |
; mov ecx,[bot_ofs-2] |
; mov cx,word[bot_ofs] |
; sub ecx,(SCRLW*2+2)*65536+(SCRLW*2+2) |
; mcall |
rol ebx,16 |
push bx |
rol ebx,16 |
pop bx |
mov ecx,[top_ofs-2] |
mov cx,word[bot_ofs] |
add ecx,(SCRLW-1)*65536-SCRLW*2-2 |
mcall 38,,,[cl_3d_inset] |
;------------------------------------------------ |
; mov ebx,5*65536+SCRLW-1 |
; mov ecx,[bot_ofs] |
; shl ecx,16 |
; add ecx,(-SCRLW)*65536+SCRLW-2 |
; mcall 8,,,'LT',[sc.work_button] |
;!!!!!!!!!!!!!!!!!! |
mov ebx,SCRLW |
mov ecx,[bot_ofs] |
shl ecx,16 |
add ecx,(-SCRLW-1)*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,[p_info.x_size] |
; shl ebx,16 |
; add ebx,(-SCRLW*2-5)*65536+SCRLW |
; mcall ,,,'RT' |
;!!!!!!!!!!!!!!!!!! |
mov ebx,[p_info.client_box.width] |
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 |
; inc ecx |
push ecx |
mov eax,[cur_editor.Columns] ;! eax,[columns] |
mov ebx,[columns.scr] |
mov ecx,[cur_editor.TopLeft.X] ;! ecx,[left_col] |
mov edx,[p_info.client_box.width] |
add edx,-(SCRLW*3) |
call get_scroll_vars |
mov [cur_editor.HScroll.Top],eax ;! [hscrl_top],eax |
mov [cur_editor.HScroll.Size],ebx ;! [hscrl_size],ebx |
pop ecx |
mov ebx,eax |
add ebx,1+SCRLW |
shl ebx,16 |
mov bx,word[cur_editor.HScroll.Size] ;! bx,word[hscrl_size] |
; mcall 13,,,[sc.work_button] |
;!!!!!!!!!!!!!!!!!! |
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 |
;!!!!!!!!!!!!!!!!!! |
mov ebx,(1+SCRLW)*65536 |
mov bx,word[cur_editor.HScroll.Top] ;! bx,word[hscrl_top] |
mcall 13,,,[sc.work];[color_tbl+4*5] |
mov ebx,1+SCRLW |
add ebx,[cur_editor.HScroll.Top] ;! ebx,[hscrl_top] |
add ebx,[cur_editor.HScroll.Size] ;! ebx,[hscrl_size] |
mov di,bx |
shl ebx,16 |
mov bx,word[p_info.client_box.width] |
sub bx,di |
sub bx,SCRLW*2 |
jle @f |
mcall |
@@: |
; mov eax,ebx |
; shr eax,16 |
; add bx,ax |
; mov ecx,[bot_ofs-2] |
; mov cx,word[bot_ofs] |
; sub ecx,SCRLW*65536+2 |
; mcall 38,<OLEFT+SCRLW-1,OLEFT+SCRLW-1>,,[sc.work_graph];[sc.work_text] |
; mov ebx,[p_info.x_size-2] |
; mov bx,word[p_info.x_size] |
; sub ebx,(SCRLW*2+6)*65536+(SCRLW*2+6) |
; mcall |
mov ebx,[p_info.client_box.width] |
; add ebx,5*65536-5 |
mov ecx,[bot_ofs-2] |
mov cx,word[bot_ofs] |
sub ecx,(SCRLW+1)*65536+(SCRLW+1) |
mcall 38,,,[cl_3d_inset] |
;------------------------------------------------ |
.exit: |
popad |
ret |
} |
endf |
;----------------------------------------------------------------------------- |
func get_next_part ;////////////////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; Input: |
; ECX = current letter |
; ESI = string |
; Output: |
; ECX = color |
; EDX = string |
; ESI = length |
;----------------------------------------------------------------------------- |
cmp [cur_editor.AsmMode],0 ;! [asm_mode],0 |
je .plain.text |
xor ebx,ebx |
mov edx,ecx |
add esi,ecx |
mov edi,symbols |
mov al,[esi] |
cmp al,';' |
je .comment |
mov ecx,symbols.size |
repne scasb |
je .symbol |
cmp al,'$' |
jne @f |
mov edi,symbols |
mov al,[esi+1] |
mov ecx,symbols.size |
repne scasb |
je .not_symbol |
jmp .number |
@@: cmp al,'0' |
jb @f |
cmp al,'9' |
jbe .number |
@@: cmp al,"'" |
je .string |
cmp al,'"' |
je .string |
.not_symbol: |
inc ebx |
inc edx |
cmp edx,[cur_line_len];LINE_WIDTH |
jge @f |
mov edi,symbols |
mov al,[esi+ebx] |
cmp al,';' |
je @f |
mov ecx,symbols.size |
repne scasb |
jne .not_symbol |
@@: mov ecx,edx |
mov edx,esi |
mov esi,ebx |
mov eax,[color_tbl+4*0] |
ret |
.symbol: |
inc ebx |
inc edx |
cmp edx,[cur_line_len];LINE_WIDTH |
jge @f |
mov edi,symbols |
mov al,[esi+ebx] |
mov ecx,symbols.size |
repne scasb |
je .symbol |
@@: mov ecx,edx |
mov edx,esi |
mov esi,ebx |
mov eax,[color_tbl+4*4] |
ret |
.comment: |
neg edx |
add edx,[cur_line_len];LINE_WIDTH |
xchg edx,esi |
mov ecx,[cur_line_len];LINE_WIDTH |
mov eax,[color_tbl+4*3] |
ret |
.number: |
inc ebx |
inc edx |
cmp edx,[cur_line_len];LINE_WIDTH |
jge @f |
mov edi,symbols |
mov al,[esi+ebx] |
cmp al,';' |
je @f |
mov ecx,symbols.size |
repne scasb |
jne .number |
@@: mov ecx,edx |
mov edx,esi |
mov esi,ebx |
mov eax,[color_tbl+4*1] |
ret |
.string: |
inc ebx |
inc edx |
cmp edx,[cur_line_len];LINE_WIDTH |
jge @f |
cmp [esi+ebx],al |
jne .string |
inc ebx |
inc edx |
@@: |
mov ecx,edx |
mov edx,esi |
mov esi,ebx |
mov eax,[color_tbl+4*2] |
ret |
.plain.text: |
mov edx,[cur_line_len];LINE_WIDTH |
xchg edx,esi |
mov ecx,[cur_line_len];LINE_WIDTH |
mov eax,[color_tbl+4*0] |
ret |
endf |
;----------------------------------------------------------------------------- |
func draw_statusbar ;///// WRITE POSITION //////////////////////////////////// |
;----------------------------------------------------------------------------- |
cmp [do_not_draw],1 ; return if drawing is not permitted |
jae .exit |
pusha |
1133,15 → 217,10 |
mov ecx,[p_info.client_box.height-2] |
mov cx,word[p_info.client_box.height] |
sub ecx,STATH*65536 |
; mpack ebx,6*13,6*13 |
; add ebx,[left_ofs-2] |
; add ebx,[left_ofs] |
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 |
mcall 13,<0,6*13>,,[cl_3d_normal] |
mcall ,<6*13+1,6*(s_modified.size+2)-1> |
1157,15 → 236,15 |
and ecx,0x0000FFFF |
push ecx |
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] |
mov eax,[cur_editor.Caret.Y] |
inc eax |
mov ecx,10 |
mov edi,p_info+0x100;htext2.pos1 |
mov edi,p_info+0x100 |
cld |
call uint2str |
mov al,',' |
stosb |
mov eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
mov eax,[cur_editor.Caret.X] |
inc eax |
call uint2str |
1175,15 → 254,13 |
lea edi,[esi*3] |
shl edi,16 |
; add ebx,[left_ofs-2] |
add ebx,(1+6*6+3)*65536-STATH/2-3 |
sub ebx,edi |
mcall 4,,[sc.work_text],p_info+0x100 |
cmp [cur_editor.Modified],0 ;! [modified],0 |
cmp [cur_editor.Modified],0 |
je @f |
and ebx,0x0000FFFF |
; add ebx,[left_ofs-2] |
add ebx,(1+12*6+12+1)*65536 |
mcall ,,,s_modified,s_modified.size |
1200,26 → 277,36 |
ret |
endf |
func draw_fillrect ; ebx,ecx,edx |
; ebx = <left,width> |
; ecx = <top,height> |
push ebx ecx edx |
call draw_framerect |
add ebx,1*65536-2 |
add ecx,1*65536-2 |
mcall 13,,,esi |
pop edx ecx ebx |
ret |
endf |
func draw_framerect ; ebx,ecx,edx |
; ebx = <left,width> |
; ecx = <top,height> |
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] |
add bx,[esp+6] ; ebx = <left,right> |
mov cx,[esp+2] ; ecx = <top,top> |
dec ebx |
mcall 38 |
add cx,[esp] |
add cx,[esp] ; ecx = <top,bottom> |
rol ecx,16 |
add cx,[esp] |
add cx,[esp] ; ecx = <bottom,bottom> |
sub ecx,0x00010001 |
mcall |
mov ebx,[esp+4] |
mov ecx,[esp] |
mov bx,[esp+6] |
mov ebx,[esp+4] ; ebx = <width,left> |
mov ecx,[esp] ; ecx = <height,top> |
mov bx,[esp+6] ; ebx = <width,> |
add cx,[esp+2] |
dec ecx |
mcall |
1242,9 → 329,6 |
shl ecx,16 |
pop cx |
add ecx,0x00020001 |
; add ecx,0x00040003 |
; sub ebx,0x000A000B |
mcall 38 |
add ecx,0x00010001 |
mcall |
/programs/develop/tinypad/trunk/tp-editor.asm |
---|
17,11 → 17,11 |
mov [cur_editor.Gutter.Visible],0 |
test [options],OPTS_LINENUMS |
jnz @f |
xor eax,eax ;! mov eax,2+LCHGW |
xor eax,eax |
jmp .lp1 |
@@: inc [cur_editor.Gutter.Visible] |
mov edi,p_info+100 |
mov eax,[cur_editor.Lines.Count] ;! eax,[lines] |
mov eax,[cur_editor.Lines.Count] |
mov ecx,10 |
call uint2str |
lea eax,[edi-p_info-100] |
30,7 → 30,7 |
mov eax,3 |
@@: imul eax,6 |
add eax,8 |
.lp1: mov [cur_editor.Gutter.Width],eax ;! [left_ofs],eax |
.lp1: mov [cur_editor.Gutter.Width],eax |
mov [left_ofs],eax |
mov eax,[cur_editor.Bounds.Right] |
131,8 → 131,10 |
add ebx,(-SCRLW)*65536+SCRLW |
mov ecx,[cur_editor.Bounds.Top-2] |
mov cx,SCRLW |
cmp [bot_mode],0 |
jne @f |
mcall 8,,,'VSL' or 0x40000000 |
pushad |
@@: pushad |
sar ebx,16 |
sar ecx,16 |
push ebx ecx SCRLW SCRLW |
152,8 → 154,10 |
mov ecx,[cur_editor.Bounds.Bottom] |
shl ecx,16 |
add ecx,(-SCRLW*2)*65536+SCRLW |
cmp [bot_mode],0 |
jne @f |
mcall ,,,'VSG' or 0x40000000 |
pushad |
@@: pushad |
sar ebx,16 |
sar ecx,16 |
push ebx ecx SCRLW SCRLW |
236,8 → 240,10 |
mov ecx,[cur_editor.Bounds.Bottom] |
shl ecx,16 |
add ecx,(-SCRLW)*65536+SCRLW |
cmp [bot_mode],0 |
jne @f |
mcall 8,,,'HSL' or 0x40000000 |
pushad |
@@: pushad |
sar ebx,16 |
sar ecx,16 |
push ebx ecx SCRLW SCRLW |
256,8 → 262,10 |
mov ebx,[cur_editor.Bounds.Right] |
shl ebx,16 |
add ebx,(-SCRLW*2)*65536+SCRLW |
cmp [bot_mode],0 |
jne @f |
mcall 8,,,'HSG' or 0x40000000 |
pushad |
@@: pushad |
sar ebx,16 |
sar ecx,16 |
push ebx ecx SCRLW SCRLW |
333,6 → 341,82 |
endf |
;----------------------------------------------------------------------------- |
func draw_editor_text.part ;///// DRAW EDITOR TEXT (PARTLY) ////////////////// |
;----------------------------------------------------------------------------- |
; EAX = start line |
; EBX = end line |
;----------------------------------------------------------------------------- |
cmp [cur_editor.Lines],0 |
jne @f |
ret |
@@: push eax |
mov eax,[cur_editor.Bounds.Bottom] |
sub eax,[cur_editor.Bounds.Top] |
cmp eax,LINEH |
pop eax |
jge @f |
ret |
@@: |
mov ebp,cur_editor |
call init_sel_vars |
call check_bottom_right |
pushad |
push eax |
mov eax,[cur_editor.Bounds.Left] |
add eax,[cur_editor.Gutter.Width] |
add eax,LCHGW+3 |
mov [left_ofs],eax |
mov eax,[cur_editor.Bounds.Top] |
add eax,3 |
mov [top_ofs],eax |
pop eax |
cmp [lines.scr],0 |
jle .exit |
cmp eax,ebx |
jle @f |
xchg eax,ebx |
@@: cmp eax,[cur_editor.TopLeft.Y] |
jge @f |
mov eax,[cur_editor.TopLeft.Y] |
@@: mov ecx,[cur_editor.TopLeft.Y] |
add ecx,[lines.scr] |
cmp ebx,ecx |
jl @f |
dec ecx |
mov ebx,ecx |
@@: cmp eax,ebx |
jg .exit |
mov ecx,eax |
push eax |
call get_line_offset |
.start: |
mov ecx,ebx |
sub ecx,eax |
inc ecx |
mov ebx,[top_ofs] |
add ebx,[left_ofs-2] |
sub eax,[cur_editor.TopLeft.Y] |
imul eax,LINEH |
add ebx,eax |
imul ebp,[cur_editor.TopLeft.X],6*65536 |
mov [draw_blines],0 |
jmp draw_editor_text.next_line |
.exit: |
popad |
ret |
endf |
;----------------------------------------------------------------------------- |
func draw_editor_text ;///// DRAW EDITOR TEXT //////////////////////////////// |
;----------------------------------------------------------------------------- |
cmp [cur_editor.Lines],0 |
344,6 → 428,7 |
jge @f |
ret |
@@: |
mov ebp,cur_editor |
call init_sel_vars |
call check_bottom_right |
360,7 → 445,7 |
mov ebx,[top_ofs] |
add ebx,[left_ofs-2] |
mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line] |
mov ecx,[cur_editor.TopLeft.Y] |
push ecx |
call get_line_offset |
371,7 → 456,8 |
jle .exit |
add esp,-4 |
imul ebp,[cur_editor.TopLeft.X],6*65536 ;! ebp,[left_col],6*65536 |
imul ebp,[cur_editor.TopLeft.X],6*65536 |
mov [draw_blines],1 |
.next_line: |
381,7 → 467,6 |
shl ecx,16 |
mov cl,LINEH |
mov ebx,[cur_editor.Bounds.Right] |
;sub ebx,[cur_editor.Bounds.Left] |
add ebx,-SCRLW |
add ebx,[left_ofs-2] |
sub ebx,[left_ofs] |
389,7 → 474,7 |
; selection (text background) |
mov [in_sel],0 |
mov edx,[color_tbl+4*5] |
mov edx,[color_tbl.back] |
mov eax,[esp+4*2] |
cmp eax,[sel.begin.y] |
jl .lp6 |
402,7 → 487,7 |
cmp eax,[sel.end.y] |
je .lp5 |
.lp2: mov eax,[sel.begin.x] |
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col] |
sub eax,[cur_editor.TopLeft.X] |
jle .lp6.2 |
cmp eax,[columns.scr] |
jge .lp6 |
414,7 → 499,7 |
add ebx,[left_ofs] |
add ebx,-2 |
rol ebx,16 |
mov edx,[color_tbl+4*7] |
mov edx,[color_tbl.back.sel] |
mcall 13 |
popad |
mov bx,ax |
424,7 → 509,7 |
cmp eax,[sel.end.y] |
je .lp5 |
.lp4: mov eax,[sel.end.x] |
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col] |
sub eax,[cur_editor.TopLeft.X] |
jle .lp6 |
cmp eax,[columns.scr] |
jg .lp6.2 |
432,7 → 517,7 |
pushad |
sub bx,ax |
rol ebx,16 |
add eax,[left_ofs];OLEFT-1 |
add eax,[left_ofs] |
add eax,-2 |
mov bx,ax |
rol ebx,16 |
439,11 → 524,11 |
mcall 13 |
popad |
inc eax |
mov edx,[color_tbl+4*7] |
mov edx,[color_tbl.back.sel] |
mov bx,ax |
mov [in_sel],3 |
jmp .lp6 |
.lp5: mov eax,[cur_editor.TopLeft.X] ;! eax,[left_col] |
.lp5: mov eax,[cur_editor.TopLeft.X] |
cmp eax,[sel.begin.x] |
jge .lp4 |
add eax,[columns.scr] |
452,7 → 537,7 |
mov eax,[sel.begin.x] |
cmp eax,[sel.end.x] |
je .lp6 |
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col] |
sub eax,[cur_editor.TopLeft.X] |
imul eax,6 |
pushad |
mov ebx,[sel.end.x] |
463,7 → 548,7 |
add eax,[left_ofs] |
mov bx,ax |
rol ebx,16 |
mov edx,[color_tbl+4*7] |
mov edx,[color_tbl.back.sel] |
mcall 13 |
movzx eax,bx |
sar ebx,16 |
475,7 → 560,7 |
add ax,word[left_ofs] |
add ax,-2 |
mov bx,ax |
mov edx,[color_tbl+4*5] |
mov edx,[color_tbl.back] |
mcall 13 |
popad |
mov bx,ax |
483,7 → 568,7 |
jmp .lp6 |
.lp6.2: |
mov edx,[color_tbl+4*7] |
mov edx,[color_tbl.back.sel] |
inc [in_sel] |
.lp6: |
mcall 13 |
491,13 → 576,13 |
lodsd |
pushad |
mov edx,[color_tbl+4*5] |
mov edx,[color_tbl.back] |
test eax,0x00010000 |
jz @f |
mov edx,[color_tbl+4*8] |
mov edx,[color_tbl.line.moded] |
test eax,0x00020000 |
jz @f |
mov edx,[color_tbl+4*9] |
mov edx,[color_tbl.line.saved] |
@@: mov ebx,[left_ofs] |
add ebx,-LCHGW-2;-4 |
513,12 → 598,12 |
or eax,eax |
ja .next_block |
add esp,4*2 |
jmp .exit ; .draw_cursor |
jmp .exit |
.next_block: |
push esi ecx |
call get_next_part |
call .get_next_part |
pop ebx |
push ecx |
526,30 → 611,28 |
push esi ebx |
mov eax,ebx |
sub ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col] |
sub ebx,[cur_editor.TopLeft.X] |
cmp ebx,[columns.scr] |
jge .skip_t |
add ebx,esi |
jle .skip_t |
mov ebx,[esp+8+4*2] ;// 4*2=esi+ebx |
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col] |
sub eax,[cur_editor.TopLeft.X] |
jge .qqq |
sub edx,eax |
add esi,eax |
; mov eax,OLEFT*65536 |
xor eax,eax |
jmp .qqq2 |
.qqq: |
; inc eax |
imul eax,6*65536 |
.qqq2: |
and ebx,0x0000FFFF |
add eax,[left_ofs-2];OLEFT*65536 |
add eax,[left_ofs-2] |
add ebx,eax |
mov eax,[esp] ; ebx |
add eax,[esp+4] ; esi |
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col] |
sub eax,[cur_editor.TopLeft.X] |
sub eax,[columns.scr] |
jle .qweqwe |
sub esi,eax |
573,7 → 656,7 |
mov esi,[sel.begin.x] |
sub esi,[esp] |
pushad |
mov ecx,[cur_editor.TopLeft.X] ;! ecx,[left_col] |
mov ecx,[cur_editor.TopLeft.X] |
sub ecx,[esp+4*8] |
jle @f |
sub esi,ecx |
585,7 → 668,7 |
add bx,si |
rol ebx,16 |
mov esi,eax |
mov ecx,[color_tbl+4*6] |
mov ecx,[color_tbl.text.sel] |
mcall 4 |
popad |
jmp .draw_t |
603,7 → 686,7 |
sub eax,[esp] |
push ebx |
mov ebx,[esp+4] |
sub ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col] |
sub ebx,[cur_editor.TopLeft.X] |
jge .ya2.1 |
add eax,ebx |
.ya2.1: |
610,7 → 693,7 |
pop ebx |
pushad |
mov esi,eax |
mov ecx,[color_tbl+4*6] |
mov ecx,[color_tbl.text.sel] |
mcall 4 |
popad |
sub esi,eax |
635,7 → 718,7 |
sub esi,[esp] |
push eax |
mov eax,[esp+4] |
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col] |
sub eax,[cur_editor.TopLeft.X] |
jge .nt3.1 |
add esi,eax |
.nt3.1: |
647,7 → 730,7 |
add ebx,esi |
mov esi,[sel.end.x] |
sub esi,[sel.begin.x] |
mov ecx,[color_tbl+4*6] |
mov ecx,[color_tbl.text.sel] |
sub eax,esi |
push eax |
mcall 4 |
665,17 → 748,17 |
cmp eax,[sel.end.x] |
jge .ya2 |
;---[ block inside selection ]-----------------(- |
.ya4: mov ecx,[color_tbl+4*6] |
.ya4: mov ecx,[color_tbl.text.sel] |
;----------------------------------------------)- |
.draw_t: |
mcall 4;[esp+8] |
mcall 4 |
.skip_t: |
pop eax eax ; ebx esi |
imul eax,6 |
add [esp+4*2+2],ax |
pop ecx esi |
cmp ecx,[cur_line_len];LINE_WIDTH |
cmp ecx,[cur_line_len] |
jl .next_block |
pop ebx ecx |
682,7 → 765,7 |
and ebx,0x0000FFFF |
add ebx,[left_ofs-2] |
add ebx,LINEH |
add esi,[cur_line_len];LINE_WIDTH |
add esi,[cur_line_len] |
inc dword[esp] |
dec ecx |
jg .next_line |
689,6 → 772,8 |
.exit: |
cmp [draw_blines],0 |
je .exit.2 |
mov eax,[cur_editor.Bounds.Left] |
add eax,[cur_editor.Gutter.Width] |
inc eax |
697,7 → 782,7 |
mov bx,word[cur_editor.Bounds.Right] |
sub bx,ax |
add ebx,-SCRLW |
mov edx,[color_tbl+4*5] |
mov edx,[color_tbl.back] |
mov eax,13 |
mov ecx,[esp-8] |
add ecx,LINEH |
719,6 → 804,7 |
add ecx,-(SCRLW-1)*65536+SCRLW-1 |
mcall |
.exit.2: |
popad |
add esp,4 |
ret |
725,6 → 811,124 |
endf |
;----------------------------------------------------------------------------- |
func draw_editor_text.get_next_part ;///////////////////////////////////////// |
;----------------------------------------------------------------------------- |
; Input: |
; ECX = current letter |
; ESI = string |
; Output: |
; ECX = color |
; EDX = string |
; ESI = length |
;----------------------------------------------------------------------------- |
cmp [cur_editor.AsmMode],0 |
je .plain.text |
xor ebx,ebx |
mov edx,ecx |
add esi,ecx |
mov edi,symbols |
mov al,[esi] |
cmp al,';' |
je .comment |
mov ecx,symbols.size |
repne scasb |
je .symbol |
cmp al,'$' |
jne @f |
mov edi,symbols |
mov al,[esi+1] |
mov ecx,symbols.size |
repne scasb |
je .not_symbol |
jmp .number |
@@: cmp al,'0' |
jb @f |
cmp al,'9' |
jbe .number |
@@: cmp al,"'" |
je .string |
cmp al,'"' |
je .string |
.not_symbol: |
inc ebx |
inc edx |
cmp edx,[cur_line_len] |
jge @f |
mov edi,symbols |
mov al,[esi+ebx] |
cmp al,';' |
je @f |
mov ecx,symbols.size |
repne scasb |
jne .not_symbol |
@@: mov ecx,edx |
mov edx,esi |
mov esi,ebx |
mov eax,[color_tbl.text] |
ret |
.symbol: |
inc ebx |
inc edx |
cmp edx,[cur_line_len] |
jge @f |
mov edi,symbols |
mov al,[esi+ebx] |
mov ecx,symbols.size |
repne scasb |
je .symbol |
@@: mov ecx,edx |
mov edx,esi |
mov esi,ebx |
mov eax,[color_tbl.symbol] |
ret |
.comment: |
neg edx |
add edx,[cur_line_len] |
xchg edx,esi |
mov ecx,[cur_line_len] |
mov eax,[color_tbl.comment] |
ret |
.number: |
inc ebx |
inc edx |
cmp edx,[cur_line_len] |
jge @f |
mov edi,symbols |
mov al,[esi+ebx] |
cmp al,';' |
je @f |
mov ecx,symbols.size |
repne scasb |
jne .number |
@@: mov ecx,edx |
mov edx,esi |
mov esi,ebx |
mov eax,[color_tbl.number] |
ret |
.string: |
inc ebx |
inc edx |
cmp edx,[cur_line_len] |
jge @f |
cmp [esi+ebx],al |
jne .string |
inc ebx |
inc edx |
@@: |
mov ecx,edx |
mov edx,esi |
mov esi,ebx |
mov eax,[color_tbl.string] |
ret |
.plain.text: |
mov edx,[cur_line_len] |
xchg edx,esi |
mov ecx,[cur_line_len] |
mov eax,[color_tbl.text] |
ret |
endf |
;----------------------------------------------------------------------------- |
func draw_editor_caret ;///// DRAW EDITOR TEXT CARET ///////////////////////// |
;----------------------------------------------------------------------------- |
cmp [bot_mode],0 |
781,3 → 985,188 |
pop ecx ebx |
ret |
endf |
REDRAW_TEXT = 00000001b |
REDRAW_HSCROLL = 00000010b |
REDRAW_VSCROLL = 00000100b |
REDRAW_ONELINE = 00001000b |
REDRAW_TWOLINES = 00010000b |
;----------------------------------------------------------------------------- |
func editor_check_for_changes ;///// EDITOR CHANGES CHECKER ////////////////// |
;----------------------------------------------------------------------------- |
call .check_cursor_visibility |
xor edx,edx |
mov eax,[cur_editor.TopLeft.Y] |
cmp eax,[checker_ed.TopLeft.Y] |
je @f |
or dl,REDRAW_TEXT+REDRAW_VSCROLL |
@@: mov eax,[cur_editor.TopLeft.X] |
cmp eax,[checker_ed.TopLeft.X] |
je @f |
or dl,REDRAW_TEXT+REDRAW_HSCROLL |
@@: or dl,dl |
jnz .redraw |
mov eax,[cur_editor.Caret.Y] |
cmp eax,[checker_ed.Caret.Y] |
je @f |
or dl,REDRAW_TWOLINES |
@@: mov eax,[cur_editor.Caret.X] |
cmp eax,[checker_ed.Caret.X] |
je @f |
or dl,REDRAW_ONELINE |
@@: mov ebp,cur_editor |
call init_sel_vars |
mov al,[sel.selected] |
mov ebp,checker_ed |
call init_sel_vars |
cmp al,[sel.selected] |
je @f |
cmp al,0 |
je .clear_sel |
jmp .draw_sel |
@@: cmp al,0 |
jne .redraw_sel |
or dl,dl |
jz .exit |
test dl,REDRAW_TWOLINES |
jz .one_line |
push edx |
mov eax,[checker_ed.Caret.Y] |
mov ebx,eax |
call draw_editor_text.part |
pop edx |
.one_line: |
mov eax,[cur_editor.Caret.Y] |
mov ebx,eax |
call draw_editor_text.part |
call draw_editor_caret |
jmp .exit |
.clear_sel: |
;// use checker_ed |
mov eax,[sel.begin.y] |
mov ebx,[sel.end.y] |
push eax ebx |
call draw_editor_text.part |
pop edx ecx |
mov eax,[cur_editor.Caret.Y] |
cmp eax,ecx |
jb @f |
cmp eax,edx |
jbe .lp1 |
@@: mov ebx,eax |
call draw_editor_text.part |
.lp1: call draw_editor_caret |
jmp .exit |
.draw_sel: |
;// use cur_editor |
mov ebp,cur_editor |
call init_sel_vars |
mov eax,[sel.begin.y] |
mov ebx,[sel.end.y] |
push eax ebx |
call draw_editor_text.part |
pop edx ecx |
mov eax,[checker_ed.Caret.Y] |
cmp eax,ecx |
jb @f |
cmp eax,edx |
jbe .lp2 |
@@: mov ebx,eax |
call draw_editor_text.part |
.lp2: call draw_editor_caret |
jmp .exit |
.redraw_sel: |
;// use checker_ed and cur_editor |
mov eax,[checker_ed.Caret.Y] |
mov ebx,[cur_editor.Caret.Y] |
cmp eax,ebx |
jb @f |
xchg eax,ebx |
@@: call draw_editor_text.part |
call draw_editor_caret |
jmp .exit |
.redraw: |
push edx |
call draw_editor_gutter |
call draw_editor_text |
call draw_editor_caret |
test byte[esp],REDRAW_VSCROLL |
jz @f |
call draw_editor_vscroll |
@@: pop edx |
test dl,REDRAW_HSCROLL |
jz @f |
call draw_editor_hscroll |
@@: jmp .exit |
.exit: |
mov esi,cur_editor |
mov edi,checker_ed |
mov ecx,sizeof.EDITOR/4 |
cld |
rep movsd |
ret |
.check_cursor_visibility: |
push eax ebx |
.chk_y: |
mov eax,[cur_editor.Caret.Y] |
or eax,eax |
jge @f |
mov [cur_editor.Caret.Y],0 |
jmp .chk_dy |
@@: cmp eax,[cur_editor.Lines.Count] |
jl .chk_dy |
mov eax,[cur_editor.Lines.Count] |
dec eax |
mov [cur_editor.Caret.Y],eax |
.chk_dy: |
mov eax,[cur_editor.TopLeft.Y] |
cmp eax,[cur_editor.Caret.Y] |
jle @f |
m2m [cur_editor.TopLeft.Y],[cur_editor.Caret.Y] |
@@: add eax,[lines.scr] |
cmp eax,[cur_editor.Caret.Y] |
jg .chk_x |
mov eax,[cur_editor.Caret.Y] |
sub eax,[lines.scr] |
inc eax |
mov [cur_editor.TopLeft.Y],eax |
.chk_x: |
mov eax,[cur_editor.Caret.X] |
or eax,eax |
jge @f |
mov [cur_editor.Caret.X],0 |
jmp .chk_dx |
@@: cmp eax,[cur_editor.Columns.Count] |
jl .chk_dx |
mov eax,[cur_editor.Columns.Count] |
mov [cur_editor.Caret.X],eax |
.chk_dx: |
mov eax,[cur_editor.TopLeft.X] |
cmp eax,[cur_editor.Caret.X] |
jle @f |
m2m [cur_editor.TopLeft.X],[cur_editor.Caret.X] |
@@: add eax,[columns.scr] |
cmp eax,[cur_editor.Caret.X] |
jg @f |
mov eax,[cur_editor.Caret.X] |
sub eax,[columns.scr] |
inc eax |
mov [cur_editor.TopLeft.X],eax |
@@: cmp [mev],MEV_LDOWN |
jne @f |
push [cur_editor.Caret.X] [cur_editor.Caret.Y] |
pop [cur_editor.SelStart.Y] [cur_editor.SelStart.X] |
@@: pop ebx eax |
ret |
endf |
/programs/develop/tinypad/trunk/tp-files.asm |
---|
9,7 → 9,7 |
rep movsb |
mov byte[edi],0 |
mov esi,[cur_editor.Lines] ;! AREA_EDIT ; 0x70000 = 448 Kbytes (maximum) |
mov esi,[cur_editor.Lines] |
xor ebx,ebx |
mov ecx,[cur_editor.Lines.Count] |
24,31 → 24,20 |
call mem.Alloc |
push eax |
mov esi,[cur_editor.Lines] |
mov edi,eax ;!!! AREA_TEMP |
mov edi,eax |
; pop eax |
; ret ; DISALLOW FOR NOW |
.new_string: |
call save_string |
cmp dword[esi],0 |
jne .new_string |
pop eax |
sub edi,eax ;!!! AREA_TEMP+2 ; minus last CRLF |
add edi,-2 |
;! mov [filelen],edi |
; cmp byte[f_info.path],'/' |
; je .systree_save |
; mcall 33,f_info.path,0,edi,0 ;!!! AREA_TEMP,edi,0;[filelen],0 |
; or eax,eax |
; jz .exit |
; call file_not_found |
; jmp .exit.2 |
sub edi,eax |
add edi,-2 ; minus last CRLF |
.systree_save: |
mov [f_info70+0],2 |
mov [f_info70+12],edi |
mov [f_info70+16],eax ;!!! AREA_TEMP |
mov [f_info70+16],eax |
mov byte[f_info70+20],0 |
mov [f_info70+21],f_info.path |
mcall 70,f_info70 |
59,7 → 48,7 |
jnz .exit.2 |
.exit: |
mov [cur_editor.Modified],0 ;! [modified],0 |
mov [cur_editor.Modified],0 |
clc |
ret |
76,7 → 65,6 |
jz @f |
or dword[esi],0x00020000 |
@@: add esi,4 |
; mov ecx,eax |
@@: cmp byte[esi+ecx-1],' ' |
jne @f |
89,8 → 77,6 |
.next_char: |
mov al,[esi+ebx] |
inc ebx |
; cmp [asm_mode],0 |
; je .put |
test [options],OPTS_OPTIMSAVE |
jz .put |
test ah,00000001b |
206,8 → 192,16 |
.file_found: |
mov ecx,eax |
call create_tab |
push ecx esi edi |
cmp [tab_bar.Items.Count],1 |
jne @f |
cmp [cur_editor.FilePath],'/' |
je @f |
cmp [cur_editor.Modified],0 |
jne @f |
mov ebp,cur_editor |
jmp .lp1 |
@@: call create_tab |
.lp1: push ecx esi edi |
mov esi,tb_opensave.text |
lea edi,[ebp+TABITEM.Editor.FilePath] |
movzx ecx,[tb_opensave.length] |
225,6 → 219,32 |
call load_from_memory |
mov eax,[f_info70+16] |
call mem.Free |
xor eax,eax |
mov [cur_editor.TopLeft.Y],eax |
mov [cur_editor.TopLeft.X],eax |
mov [cur_editor.Caret.X],eax |
mov [cur_editor.Caret.Y],eax |
mov [cur_editor.SelStart.X],eax |
mov [cur_editor.SelStart.Y],eax |
mov [cur_editor.Modified],al |
mov [cur_editor.AsmMode],al |
lea ebx,[cur_editor.FilePath] |
mov eax,ebx |
call strlen |
mov ecx,dword[ebx+eax-3] |
or ecx,0x202020 |
cmp ecx,'asm' |
jne @f |
inc [cur_editor.AsmMode] |
jmp .nocol |
@@: cmp ecx,'inc' |
jne .nocol |
inc [cur_editor.AsmMode] |
.nocol: |
call update_caption |
clc |
ret |
endf |
236,22 → 256,14 |
; ESI = data pointer |
; EBP = EDITOR* |
;----------------------------------------------------------------------------- |
; DEBUGF 1,<">>> load_from_memory\n" # \ |
; " data length = %d\n" # \ |
; " data pointer = 0x%x\n" # \ |
; " EDITOR* = 0x%x\n">,ecx,esi,ebp |
call get_lines_in_file |
; DEBUGF 1,"lines in file: %d\n",eax |
mov [ebp+EDITOR.Lines.Count],eax |
lea edx,[ebx+ecx] |
imul ebx,eax,14 |
add ebx,edx |
; DEBUGF 1,"36522: %d\n",ebx |
mov eax,[ebp+EDITOR.Lines] |
mov [ebp+EDITOR.Lines.Size],ebx |
call mem.ReAlloc |
; DEBUGF 1,"mem.ReAlloc: 0x%x\n",eax |
mov [ebp+EDITOR.Lines],eax |
mov [ebp+EDITOR.Columns.Count],0 |
288,10 → 300,10 |
sub eax,10 |
jnz @f |
inc eax |
@@: cmp eax,[ebp+EDITOR.Columns.Count] ;! eax,[columns] |
@@: cmp eax,[ebp+EDITOR.Columns.Count] |
jbe @f |
mov [ebp+EDITOR.Columns.Count],eax ;! [columns],eax |
@@: mov [ebp+EDITOR.Modified],0 ;! [modified],0 |
mov [ebp+EDITOR.Columns.Count],eax |
@@: mov [ebp+EDITOR.Modified],0 |
ret |
.CR: cmp byte[esi],10 |
304,11 → 316,10 |
lea eax,[edi-4] |
sub eax,ebx |
mov [ebx],eax |
; inc [cur_editor.Lines] ;! [lines] |
add eax,-10 |
cmp eax,[ebp+EDITOR.Columns.Count] ;! eax,[columns] |
cmp eax,[ebp+EDITOR.Columns.Count] |
jbe .next_line |
mov [ebp+EDITOR.Columns.Count],eax ;! [columns],eax |
mov [ebp+EDITOR.Columns.Count],eax |
jmp .next_line |
.TB: lea eax,[edi-4] |
/programs/develop/tinypad/trunk/tp-key.asm |
---|
51,10 → 51,11 |
jne @f |
test [options],OPTS_SECURESEL |
jz .lp1 |
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x] |
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y] |
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] |
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] |
.lp1: mov [s_status],0 |
call dword[esi+4] |
call editor_check_for_changes |
jmp still |
@@: add esi,8 |
cmp byte[esi],0 |
74,8 → 75,8 |
test [options],OPTS_SECURESEL |
jz .lp2 |
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x] |
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y] |
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] |
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] |
jmp .put |
.lp2: call delete_selection |
85,24 → 86,24 |
jne @f |
mov al,']' |
call .lp3 |
dec [cur_editor.Caret.X] ;! [pos.x] |
dec [cur_editor.Caret.X] |
jmp .put |
@@: cmp al,'(' |
jne @f |
mov al,')' |
call .lp3 |
dec [cur_editor.Caret.X] ;! [pos.x] |
dec [cur_editor.Caret.X] |
jmp .put |
@@: cmp al,'{' |
jne .put |
mov al,'}' |
call .lp3 |
dec [cur_editor.Caret.X] ;! [pos.x] |
dec [cur_editor.Caret.X] |
.put: pop eax |
push still |
inc [cur_editor.SelStart.X] ;! [sel.x] |
.lp3: push [cur_editor.Caret.X] eax ;! [pos.x] eax |
push still editor_check_for_changes |
inc [cur_editor.SelStart.X] |
.lp3: push [cur_editor.Caret.X] eax |
inc dword[esp+4] |
mov eax,1 |
jmp key.tab.direct |
111,15 → 112,15 |
func key.ctrl_a ;///// SELECT ALL DOCUMENT /////////////////////////////////// |
;----------------------------------------------------------------------------- |
xor eax,eax |
mov [cur_editor.SelStart.X],eax ;! [sel.x],eax |
mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax |
mov ecx,[cur_editor.Lines.Count] ;! ecx,[lines] |
mov [cur_editor.SelStart.X],eax |
mov [cur_editor.SelStart.Y],eax |
mov ecx,[cur_editor.Lines.Count] |
dec ecx |
mov [cur_editor.Caret.Y],ecx ;! [pos.y],ecx |
mov [cur_editor.Caret.Y],ecx |
call get_line_offset |
call get_real_length |
mov [cur_editor.Caret.X],eax ;! [pos.x],eax |
call draw_file |
mov [cur_editor.Caret.X],eax |
call draw_editor |
ret |
endf |
157,10 → 158,8 |
;----------------------------------------------------------------------------- |
cmp [cur_editor.FilePath],'/' |
jne key.shift_ctrl_s |
cmp [cur_editor.Modified],0 ;! [modified],0 |
cmp [cur_editor.Modified],0 |
je .exit |
;cmp [f_info.length],0 |
;je key.shift_ctrl_s |
call save_file |
call drawwindow |
.exit: |
218,7 → 217,7 |
func key.ctrl_g |
ret |
macro comment { |
@^ |
mov [bot_dlg_mode2],0 |
mov [bot_dlg_height],16*2+4*2-1 |
232,16 → 231,9 |
mov [tb_casesen],0 |
call drawwindow |
ret |
} |
^@ |
endf |
; CHANGE_LANG_LAYOUT { ; Ctrl + F8 |
; 3 times english -> russian |
; 2 times russian -> english |
; call layout |
; jmp still |
; CHANGE_LANG_LAYOUT } |
;----------------------------------------------------------------------------- |
func key.ctrl_left ;///// GO TO PREVIOUS WORD //////////////////////////////// |
;----------------------------------------------------------------------------- |
250,8 → 242,8 |
;----------------------------------------------------------------------------- |
key.shift_ctrl_left: ;///// GO TO PREVIOUS WORD, WITH SELECTION ///////// |
;----------------------------------------------------------------------------- |
mov ebx,[cur_editor.Caret.Y] ;! ebx,[pos.y] |
mov edx,[cur_editor.Caret.X] ;! edx,[pos.x] |
mov ebx,[cur_editor.Caret.Y] |
mov edx,[cur_editor.Caret.X] |
cld |
mov ecx,ebx |
call get_line_offset |
309,28 → 301,28 |
jmp .lp2 |
@@: |
inc edx |
mov [cur_editor.Caret.Y],ebx ;! [pos.y],ebx |
mov [cur_editor.Caret.X],edx ;! [pos.x],edx |
mov [cur_editor.Caret.Y],ebx |
mov [cur_editor.Caret.X],edx |
test byte[shi+2],0x01 |
jnz @f |
mov [cur_editor.SelStart.Y],ebx ;! [sel.y],ebx |
mov [cur_editor.SelStart.X],edx ;! [sel.x],edx |
@@: sub ebx,[cur_editor.TopLeft.Y] ;! ebx,[top_line] |
mov [cur_editor.SelStart.Y],ebx |
mov [cur_editor.SelStart.X],edx |
@@: sub ebx,[cur_editor.TopLeft.Y] |
jge @f |
add [cur_editor.TopLeft.Y],ebx ;! [top_line],ebx |
add [cur_editor.TopLeft.Y],ebx |
@@: mov eax,edx |
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col] |
sub eax,[cur_editor.TopLeft.X] |
cmp eax,[columns.scr] |
jl @f |
sub eax,[columns.scr] |
inc eax |
add [cur_editor.TopLeft.X],eax ;! [left_col],eax |
add [cur_editor.TopLeft.X],eax |
jmp .exit |
@@: cmp edx,[cur_editor.TopLeft.X] ;! edx,[left_col] |
@@: cmp edx,[cur_editor.TopLeft.X] |
jge .exit |
mov [cur_editor.TopLeft.X],edx ;! [left_col],edx |
mov [cur_editor.TopLeft.X],edx |
.exit: |
call draw_file |
call editor_check_for_changes |
.exit.2: |
ret |
endf |
343,8 → 335,8 |
;----------------------------------------------------------------------------- |
key.shift_ctrl_right: ;///// GO TO NEXT WORD, WITH SELECTION //////////// |
;----------------------------------------------------------------------------- |
mov ebx,[cur_editor.Caret.Y] ;! ebx,[pos.y] |
mov edx,[cur_editor.Caret.X] ;! edx,[pos.x] |
mov ebx,[cur_editor.Caret.Y] |
mov edx,[cur_editor.Caret.X] |
cld |
.lp1: mov ecx,ebx |
call get_line_offset |
365,7 → 357,7 |
dec ecx |
jnz @b |
.nx1: inc ebx |
cmp ebx,[cur_editor.Lines.Count] ;! ebx,[lines] |
cmp ebx,[cur_editor.Lines.Count] |
jge .exit.2 |
xor edx,edx |
jmp .lp1 |
390,36 → 382,36 |
dec ecx |
jnz @b |
.nx2: inc ebx |
cmp ebx,[cur_editor.Lines.Count] ;! ebx,[lines] |
cmp ebx,[cur_editor.Lines.Count] |
jge .exit.2 |
xor edx,edx |
jmp .lp2 |
@@: |
mov [cur_editor.Caret.Y],ebx ;! [pos.y],ebx |
mov [cur_editor.Caret.X],edx ;! [pos.x],edx |
mov [cur_editor.Caret.Y],ebx |
mov [cur_editor.Caret.X],edx |
test byte[shi+2],0x01 |
jnz @f |
mov [cur_editor.SelStart.Y],ebx ;! [sel.y],ebx |
mov [cur_editor.SelStart.X],edx ;! [sel.x],edx |
@@: sub ebx,[cur_editor.TopLeft.Y] ;! ebx,[top_line] |
mov [cur_editor.SelStart.Y],ebx |
mov [cur_editor.SelStart.X],edx |
@@: sub ebx,[cur_editor.TopLeft.Y] |
cmp ebx,[lines.scr] |
jl @f |
sub ebx,[lines.scr] |
inc ebx |
add [cur_editor.TopLeft.Y],ebx ;! [top_line],ebx |
add [cur_editor.TopLeft.Y],ebx |
@@: mov eax,edx |
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col] |
sub eax,[cur_editor.TopLeft.X] |
cmp eax,[columns.scr] |
jl @f |
sub eax,[columns.scr] |
inc eax |
add [cur_editor.TopLeft.X],eax ;! [left_col],eax |
add [cur_editor.TopLeft.X],eax |
jmp .exit |
@@: cmp edx,[cur_editor.TopLeft.X] ;! edx,[left_col] |
@@: cmp edx,[cur_editor.TopLeft.X] |
jge .exit |
mov [cur_editor.TopLeft.X],edx ;! [left_col],edx |
mov [cur_editor.TopLeft.X],edx |
.exit: |
call draw_file |
call editor_check_for_changes |
.exit.2: |
ret |
endf |
430,7 → 422,7 |
je @f |
call key.ctrl_c |
call key.del |
mov [cur_editor.Modified],1 ;! [modified],1 |
mov [cur_editor.Modified],1 |
@@: ret |
endf |
454,7 → 446,7 |
call get_line_offset |
inc ecx |
push ecx |
mov edi,[copy_buf] ;! AREA_CBUF |
mov edi,[copy_buf] |
call get_real_length |
sub eax,[sel.begin.x] |
jge @f |
479,13 → 471,11 |
@@: call get_line_offset |
movzx eax,word[esi] |
add esi,4 |
; lodsd |
cmp eax,[sel.end.x] |
jle @f |
mov eax,[sel.end.x] |
@@: mov ebx,edi |
stosd |
; add esi,eax |
mov ecx,eax |
jecxz @f |
rep movsb |
496,7 → 486,7 |
add [ebx],eax |
mov al,' ' |
rep stosb |
@@: sub edi,[copy_buf] ;! AREA_CBUF |
@@: sub edi,[copy_buf] |
mov [copy_size],edi |
mov eax,[sel.end.y] |
sub eax,[sel.begin.y] |
508,7 → 498,7 |
.single_line: |
mov eax,[sel.end.x] |
sub eax,[sel.begin.x] |
mov edi,[copy_buf] ;! AREA_CBUF |
mov edi,[copy_buf] |
stosd |
mov ecx,[sel.begin.y] |
call get_line_offset |
549,16 → 539,16 |
call mem.ReAlloc |
mov [cur_editor.Lines],eax |
mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y] |
mov ecx,[cur_editor.Caret.Y] |
call get_line_offset |
pushd [esi] esi |
mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x] |
mov ecx,[cur_editor.Caret.X] |
call line_add_spaces |
add [esp],eax ;!!! |
add esi,eax ;!!! |
add [esp],eax |
add esi,eax |
mov ecx,[copy_size] |
sub ecx,4 |
mov edi,[cur_editor.Lines] ;! AREA_TEMP2 |
mov edi,[cur_editor.Lines] |
add edi,[edi-4] |
dec edi |
mov eax,esi |
565,7 → 555,7 |
mov esi,edi |
sub esi,ecx |
lea ecx,[eax+4] |
add ecx,[cur_editor.Caret.X] ;! ecx,[pos.x] |
add ecx,[cur_editor.Caret.X] |
neg ecx |
lea ecx,[esi+ecx+1] |
std |
578,10 → 568,10 |
cld |
pop edi |
add edi,4 |
mov esi,[copy_buf] ;! AREA_CBUF |
mov esi,[copy_buf] |
lodsd |
mov ebx,[cur_editor.Caret.X] ;! ebx,[pos.x] |
mov ebx,[cur_editor.Caret.X] |
add eax,ebx |
mov [edi-4],ax |
mov byte[edi-4+2],0x0001 |
605,16 → 595,15 |
mov ecx,eax |
rep movsb |
mov [cur_editor.Caret.X],eax ;! [pos.x],eax |
mov [cur_editor.SelStart.X],eax ;! [sel.x],eax |
mov [cur_editor.Caret.X],eax |
mov [cur_editor.SelStart.X],eax |
mov eax,[copy_count] |
dec eax |
add [cur_editor.Caret.Y],eax ;! [pos.y],eax |
add [cur_editor.SelStart.Y],eax ;! [sel.y],eax |
add [cur_editor.Lines.Count],eax ;! [lines],eax |
add [cur_editor.Caret.Y],eax |
add [cur_editor.SelStart.Y],eax |
add [cur_editor.Lines.Count],eax |
call check_inv_all |
mov [cur_editor.Modified],1 ;! [modified],1 |
mov [cur_editor.Modified],1 |
jmp .exit |
.single_line: |
621,22 → 610,21 |
cld |
pop edi |
add edi,4 |
mov esi,[copy_buf] ;! AREA_CBUF |
mov esi,[copy_buf] |
lodsd |
add [edi-4],ax |
and dword[edi-4],not 0x00020000 |
or dword[edi-4],0x00010000 |
call .check_columns |
add edi,[cur_editor.Caret.X] ;! edi,[pos.x] |
add edi,[cur_editor.Caret.X] |
add esp,4 |
mov ecx,eax |
rep movsb |
add [cur_editor.Caret.X],eax ;! [pos.x],eax |
add [cur_editor.SelStart.X],eax ;! [sel.x],eax |
add [cur_editor.Caret.X],eax |
add [cur_editor.SelStart.X],eax |
call check_inv_all |
mov [cur_editor.Modified],1 ;! [modified],1 |
mov [cur_editor.Modified],1 |
.exit: |
ret |
644,28 → 632,11 |
.check_columns: |
push eax |
movzx eax,word[edi-4] |
cmp eax,[cur_editor.Columns.Count] ;! eax,[columns] |
cmp eax,[cur_editor.Columns.Count] |
jbe @f |
mov [cur_editor.Columns.Count],eax ;! [columns],eax |
mov [cur_editor.Columns.Count],eax |
@@: pop eax |
ret |
; push eax ebx esi |
; add esi,eax |
; xor ebx,ebx |
; neg eax |
; jz .lp1 |
; @@: cmp byte[esi+ebx-1],' ' |
; jne .lp1 |
; dec ebx |
; cmp ebx,eax |
; jg @b |
; .lp1: add ebx,[edi-4] |
; cmp [columns],ebx |
; jae @f |
; mov [columns],ebx |
; @@: pop esi ebx eax |
; ret |
endf |
;----------------------------------------------------------------------------- |
674,11 → 645,11 |
mov eax,94 |
call editor_realloc_lines |
mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y] |
mov ecx,[cur_editor.Caret.Y] |
call get_line_offset |
mov ebx,esi |
mov ecx,[cur_editor.Lines.Count] ;! ecx,[lines] |
mov ecx,[cur_editor.Lines.Count] |
call get_line_offset |
lea edi,[esi+90+4] |
lea ecx,[esi+4] |
697,12 → 668,11 |
rep stosb |
mov byte[ebx+4],';' |
inc [cur_editor.Lines.Count] ;! [lines] |
inc [cur_editor.Caret.Y] ;! [pos.y] |
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y] |
inc [cur_editor.Lines.Count] |
inc [cur_editor.Caret.Y] |
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] |
call check_inv_all |
mov [cur_editor.Modified],1 ;! [modified],1 |
mov [cur_editor.Modified],1 |
.exit: |
ret |
711,12 → 681,12 |
;----------------------------------------------------------------------------- |
func key.ctrl_y ;///// DELETE CURRENT LINE /////////////////////////////////// |
;----------------------------------------------------------------------------- |
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] |
mov eax,[cur_editor.Caret.Y] |
inc eax |
cmp eax,[cur_editor.Lines.Count] ;! eax,[lines] |
cmp eax,[cur_editor.Lines.Count] |
jge .exit |
mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y] |
mov ecx,[cur_editor.Caret.Y] |
call get_line_offset |
mov edi,esi |
lodsd |
724,12 → 694,11 |
add esi,eax |
push eax |
dec [cur_editor.Lines.Count] ;! [lines] |
;mov ecx,[temp_buf] ;! AREA_TEMP2 |
dec [cur_editor.Lines.Count] |
mov ecx,[cur_editor.Lines] |
add ecx,[ecx-4] |
sub ecx,esi |
shr ecx,2 ;// fixed (was 4) |
shr ecx,2 |
cld |
rep movsd |
741,8 → 710,7 |
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] |
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] |
call check_inv_all |
mov [cur_editor.Modified],1 ;! [modified],1 |
mov [cur_editor.Modified],1 |
.exit: |
ret |
756,11 → 724,11 |
;----------------------------------------------------------------------------- |
key.shift_up: ;///// GO TO PREVIOUS LINE, WITH SELECTION //////////////// |
;----------------------------------------------------------------------------- |
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] |
mov eax,[cur_editor.Caret.Y] |
dec eax |
jns @f |
xor eax,eax |
@@: mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line] |
@@: mov ecx,[cur_editor.TopLeft.Y] |
cmp eax,ecx |
jae @f |
dec ecx |
768,8 → 736,9 |
xor ecx,ecx |
@@: test byte[shi+2],0x01 |
jnz @f |
mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax |
@@: call check_inv_all.skip_init |
mov [cur_editor.SelStart.Y],eax |
@@: mov [cur_editor.Caret.Y],eax |
mov [cur_editor.TopLeft.Y],ecx |
.exit: |
ret |
784,12 → 753,12 |
key.shift_down: ;///// GO TO NEXT LINE, WITH SELECTION ////////////////// |
;----------------------------------------------------------------------------- |
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] |
mov eax,[cur_editor.Caret.Y] |
inc eax |
cmp eax,[cur_editor.Lines.Count] ;! eax,[lines] |
cmp eax,[cur_editor.Lines.Count] |
jb @f |
dec eax |
@@: mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line] |
@@: mov ecx,[cur_editor.TopLeft.Y] |
mov edx,eax |
sub edx,ecx |
cmp edx,[lines.scr] |
797,8 → 766,9 |
inc ecx |
@@: test byte[shi+2],0x01 |
jnz @f |
mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax |
@@: call check_inv_all.skip_init |
mov [cur_editor.SelStart.Y],eax |
@@: mov [cur_editor.Caret.Y],eax |
mov [cur_editor.TopLeft.Y],ecx |
.exit: |
ret |
812,15 → 782,14 |
;----------------------------------------------------------------------------- |
key.shift_left: ;///// GO TO PREVIOUS CHAR, WITH SELECTION ////////////// |
;----------------------------------------------------------------------------- |
mov eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
mov eax,[cur_editor.Caret.X] |
dec eax |
jns @f |
inc eax |
@@: test byte[shi+2],0x01 |
jnz @f |
mov [cur_editor.SelStart.X],eax ;! [sel.x],eax |
@@: mov [cur_editor.Caret.X],eax ;! [pos.x],eax |
call check_inv_all |
mov [cur_editor.SelStart.X],eax |
@@: mov [cur_editor.Caret.X],eax |
.exit: |
ret |
834,16 → 803,15 |
;----------------------------------------------------------------------------- |
key.shift_right: ;///// GO TO NEXT CHAR, WITH SELECTION ///////////////// |
;----------------------------------------------------------------------------- |
mov eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
mov eax,[cur_editor.Caret.X] |
inc eax |
cmp eax,[cur_editor.Columns.Count] ;! eax,[columns] |
cmp eax,[cur_editor.Columns.Count] |
jbe @f |
dec eax |
@@: test byte[shi+2],0x01 |
jnz @f |
mov [cur_editor.SelStart.X],eax ;! [sel.x],eax |
@@: mov [cur_editor.Caret.X],eax ;! [pos.x],eax |
call check_inv_all |
mov [cur_editor.SelStart.X],eax |
@@: mov [cur_editor.Caret.X],eax |
.exit: |
ret |
859,8 → 827,8 |
;----------------------------------------------------------------------------- |
mov edx,[lines.scr] |
dec edx |
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] |
mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line] |
mov eax,[cur_editor.Caret.Y] |
mov ecx,[cur_editor.TopLeft.Y] |
sub eax,edx |
jns @f |
xor eax,eax |
869,8 → 837,9 |
xor ecx,ecx |
@@: test byte[shi+2],0x01 |
jnz @f |
mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax |
@@: call check_inv_all.skip_init |
mov [cur_editor.SelStart.Y],eax |
@@: mov [cur_editor.Caret.Y],eax |
mov [cur_editor.TopLeft.Y],ecx |
.exit: |
ret |
886,18 → 855,19 |
;----------------------------------------------------------------------------- |
mov edx,[lines.scr] |
dec edx |
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] |
mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line] |
mov eax,[cur_editor.Caret.Y] |
mov ecx,[cur_editor.TopLeft.Y] |
add eax,edx |
add ecx,edx |
cmp eax,[cur_editor.Lines.Count] ;! eax,[lines] |
cmp eax,[cur_editor.Lines.Count] |
jb @f |
mov eax,[cur_editor.Lines.Count] ;! eax,[lines] |
mov eax,[cur_editor.Lines.Count] |
dec eax |
@@: test byte[shi+2],0x01 |
jnz @f |
mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax |
@@: call check_inv_all.skip_init |
mov [cur_editor.SelStart.Y],eax |
@@: mov [cur_editor.Caret.Y],eax |
mov [cur_editor.TopLeft.Y],ecx |
.exit: |
ret |
911,11 → 881,11 |
;----------------------------------------------------------------------------- |
key.shift_home: ;///// GO TO LINE START, WITH SELECTION ///////////////// |
;----------------------------------------------------------------------------- |
mov [cur_editor.Caret.X],0 ;! [pos.x],0 |
mov [cur_editor.Caret.X],0 |
test byte[shi+2],0x01 |
jnz @f |
mov [cur_editor.SelStart.X],0 ;! [sel.x],0 |
@@: call check_inv_all |
mov [cur_editor.SelStart.X],0 |
@@: |
.exit: |
ret |
929,14 → 899,14 |
;----------------------------------------------------------------------------- |
key.shift_end: ;///// GO TO LINE END, WITH SELECTION //////////////////// |
;----------------------------------------------------------------------------- |
mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y] |
mov ecx,[cur_editor.Caret.Y] |
call get_line_offset |
call get_real_length |
mov [cur_editor.Caret.X],eax ;! [pos.x],eax |
mov [cur_editor.Caret.X],eax |
test byte[shi+2],0x01 |
jnz @f |
mov [cur_editor.SelStart.X],eax ;! [sel.x],eax |
@@: call check_inv_all |
mov [cur_editor.SelStart.X],eax |
@@: |
.exit: |
ret |
950,12 → 920,13 |
;----------------------------------------------------------------------------- |
key.shift_ctrl_home: ;///// GO TO PAGE START, WITH SELECTION //////////// |
;----------------------------------------------------------------------------- |
mov eax,[cur_editor.TopLeft.Y] ;! eax,[top_line] |
mov eax,[cur_editor.TopLeft.Y] |
mov ecx,eax |
test byte[shi+2],0x01 |
jnz @f |
mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax |
@@: call check_inv_all.skip_init |
mov [cur_editor.SelStart.Y],eax |
@@: mov [cur_editor.Caret.Y],eax |
mov [cur_editor.TopLeft.Y],ecx |
.exit: |
ret |
969,17 → 940,18 |
;----------------------------------------------------------------------------- |
key.shift_ctrl_end: ;///// GO TO PAGE END, WITH SELECTION /////////////// |
;----------------------------------------------------------------------------- |
mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line] |
mov ecx,[cur_editor.TopLeft.Y] |
mov eax,[lines.scr] |
cmp eax,[cur_editor.Lines.Count] ;! eax,[lines] |
cmp eax,[cur_editor.Lines.Count] |
jle @f |
mov eax,[cur_editor.Lines.Count] ;! eax,[lines] |
mov eax,[cur_editor.Lines.Count] |
@@: add eax,ecx |
dec eax |
test byte[shi+2],0x01 |
jnz @f |
mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax |
@@: call check_inv_all.skip_init |
mov [cur_editor.SelStart.Y],eax |
@@: mov [cur_editor.Caret.Y],eax |
mov [cur_editor.TopLeft.Y],ecx |
.exit: |
ret |
994,12 → 966,12 |
key.shift_ctrl_pgup: ;///// GO TO DOCUMENT START, WITH SELECTION //////// |
;----------------------------------------------------------------------------- |
xor eax,eax |
mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax |
mov [cur_editor.Caret.Y],eax ;! [pos.y],eax |
mov [cur_editor.TopLeft.Y],eax |
mov [cur_editor.Caret.Y],eax |
test byte[shi+2],0x01 |
jnz @f |
mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax |
@@: call check_inv_all.skip_check |
mov [cur_editor.SelStart.Y],eax |
@@: |
.exit: |
ret |
1013,19 → 985,17 |
;----------------------------------------------------------------------------- |
key.shift_ctrl_pgdn: ;///// GO TO DOCUMENT END, WITH SELECTION ////////// |
;----------------------------------------------------------------------------- |
mov eax,[cur_editor.Lines.Count] ;! eax,[lines] ; eax = lines in the file |
mov [cur_editor.Caret.Y],eax ;! [pos.y],eax |
sub eax,[lines.scr] ; eax -= lines on the screen |
mov eax,[cur_editor.Lines.Count] |
mov [cur_editor.Caret.Y],eax |
sub eax,[lines.scr] |
jns @f |
xor eax,eax |
@@: mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax |
dec [cur_editor.Caret.Y] ;! [pos.y] |
@@: mov [cur_editor.TopLeft.Y],eax |
dec [cur_editor.Caret.Y] |
test byte[shi+2],0x01 |
jnz @f |
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] |
;! push [pos.y] |
;! pop [sel.y] |
@@: call check_inv_all.skip_check |
@@: |
.exit: |
ret |
1035,9 → 1005,9 |
func key.del ;///// DELETE NEXT CHAR OR SELECTION //////////////////////////// |
;----------------------------------------------------------------------------- |
call delete_selection |
jnc .exit.2 |
jnc .exit |
mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y] |
mov ecx,[cur_editor.Caret.Y] |
call get_line_offset |
and dword[esi],not 0x00020000 |
or dword[esi],0x00010000 |
1048,7 → 1018,7 |
or eax,eax |
je .line_up |
mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x] |
mov ecx,[cur_editor.Caret.X] |
cmp ecx,eax |
jae .line_up |
lea edi,[ebx+ecx] |
1059,7 → 1029,7 |
je .line_up |
mov edi,ebx |
mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x] |
mov ecx,[cur_editor.Caret.X] |
add edi,ecx |
lea esi,[edi+1] |
neg ecx |
1069,63 → 1039,60 |
rep movsb |
mov byte[edi],' ' |
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x] |
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y] |
call check_inv_all |
mov [cur_editor.Modified],1 ;! [modified],1 |
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] |
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] |
mov [cur_editor.Modified],1 |
ret |
.line_up: |
mov eax,[cur_editor.Lines.Count] ;! eax,[lines] |
mov eax,[cur_editor.Lines.Count] |
dec eax |
cmp eax,[cur_editor.Caret.Y] ;! eax,[pos.y] |
cmp eax,[cur_editor.Caret.Y] |
je .exit |
mov edi,[temp_buf] ;! AREA_TEMP+4 |
mov edi,[temp_buf] |
add edi,4 |
mov esi,ebx |
mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x] |
mov ecx,[cur_editor.Caret.X] |
rep movsb |
mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x] |
mov ecx,[cur_editor.Caret.X] |
mov eax,[temp_buf] |
mov [eax],ecx ;! [AREA_TEMP],ecx |
mov [eax],ecx |
cmp cx,[ebp] |
jbe @f |
movzx eax,word[ebp] |
sub ecx,eax;[ebp] |
sub ecx,eax |
sub edi,ecx |
mov al,' ' |
rep stosb |
@@: lea esi,[ebx+4] |
movzx eax,word[ebp] |
add esi,eax;[ebp] |
add esi,eax |
movzx ecx,word[esi-4] |
mov eax,[temp_buf] |
add [eax],ecx ;! [AREA_TEMP],ecx |
or dword[eax],0x00010000 ;! dword[AREA_TEMP],0x00010000 |
add [eax],ecx |
or dword[eax],0x00010000 |
rep movsb |
mov ecx,edi ;! [edi-AREA_TEMP] |
mov ecx,edi |
sub ecx,[temp_buf] |
mov esi,[temp_buf] ;! AREA_TEMP |
mov esi,[temp_buf] |
call get_real_length |
cmp eax,[cur_editor.Columns.Count] ;! eax,[columns] |
cmp eax,[cur_editor.Columns.Count] |
jbe @f |
mov [cur_editor.Columns.Count],eax ;! [columns],eax |
mov [cur_editor.Columns.Count],eax |
@@: |
push ecx |
mov edi,[cur_editor.Lines] ;! AREA_TEMP2 |
mov edi,[cur_editor.Lines] |
add edi,[edi-4] |
dec edi |
lea esi,[edi+8] |
sub esi,ecx |
movzx eax,word[ebp] |
add esi,eax;[ebp] |
; lea eax,[ebp+4] |
; add eax,[ebp] |
add esi,eax |
movzx eax,word[ebp] |
movzx eax,word[ebp+eax+4] |
add esi,eax;[eax] |
add esi,eax |
lea ecx,[esi-4] |
sub ecx,ebp |
std |
1136,29 → 1103,29 |
add edi,[esp] |
lea esi,[ebp+8] |
movzx eax,word[esi-8] |
add esi,eax;[esi-8] |
add esi,eax |
movzx eax,word[esi-4] |
add esi,eax;[esi-4] |
mov ecx,[cur_editor.Lines] ;! AREA_TEMP2 |
add esi,eax |
mov ecx,[cur_editor.Lines] |
add ecx,[ecx-4] |
sub ecx,esi |
cld |
@@: rep movsb |
.lp1: pop ecx |
mov esi,[temp_buf] ;! AREA_TEMP |
mov esi,[temp_buf] |
mov edi,ebp |
cld |
rep movsb |
.ok.dec.lines: |
dec [cur_editor.Lines.Count] ;! [lines] |
mov eax,[cur_editor.Lines.Count] ;! eax,[lines] |
cmp [cur_editor.Caret.Y],eax ;! [pos.y],eax |
dec [cur_editor.Lines.Count] |
mov eax,[cur_editor.Lines.Count] |
cmp [cur_editor.Caret.Y],eax |
jb @f |
dec eax |
mov [cur_editor.Caret.Y],eax ;! [pos.y],eax |
@@: m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x] |
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y] |
mov [cur_editor.Caret.Y],eax |
@@: m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] |
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] |
mov ecx,[cur_editor.Lines.Count] |
call get_line_offset |
1170,9 → 1137,7 |
lea eax,[esi+4096] |
call editor_realloc_lines |
mov [cur_editor.Modified],1 ;! [modified],1 |
.exit.2: |
call check_inv_all |
mov [cur_editor.Modified],1 |
.exit: |
ret |
1179,26 → 1144,27 |
endf |
;----------------------------------------------------------------------------- |
; INSERT { |
key.ins: |
;// ... toggle insert/overwrite mode here ... |
xor [ins_mode],1 |
call check_inv_str |
mov eax,[cur_editor.Caret.Y] |
mov ebx,eax |
call draw_editor_text.part |
call draw_editor_caret |
ret |
; INSERT } |
;----------------------------------------------------------------------------- |
func key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION //////////////////// |
;----------------------------------------------------------------------------- |
call delete_selection |
jnc key.del.exit.2 |
jnc key.del.exit |
mov eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
mov eax,[cur_editor.Caret.X] |
dec eax |
js .line_up |
dec [cur_editor.Caret.X] ;! [pos.x] |
mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y] |
dec [cur_editor.Caret.X] |
mov ecx,[cur_editor.Caret.Y] |
call get_line_offset |
and dword[esi],not 0x00020000 |
or dword[esi],0x00010000 |
1205,11 → 1171,10 |
mov ebx,eax |
call get_real_length |
cmp eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
cmp eax,[cur_editor.Caret.X] |
jae @f |
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x] |
call check_inv_all |
mov [cur_editor.Modified],1 ;! [modified],1 |
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] |
mov [cur_editor.Modified],1 |
ret |
@@: lea edi,[esi+4+ebx] |
1216,7 → 1181,7 |
mov ecx,ebx |
neg ecx |
movzx eax,word[esi] |
add ecx,eax;[esi] |
add ecx,eax |
dec ecx |
lea esi,[edi+1] |
cld |
1223,17 → 1188,16 |
rep movsb |
mov byte[edi],' ' |
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x] |
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y] |
call check_inv_str |
mov [cur_editor.Modified],1 ;! [modified],1 |
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] |
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] |
mov [cur_editor.Modified],1 |
ret |
.line_up: |
cmp [cur_editor.Caret.Y],0 ;! [pos.y],0 |
cmp [cur_editor.Caret.Y],0 |
jne @f |
ret |
@@: mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y] |
@@: mov ecx,[cur_editor.Caret.Y] |
dec ecx |
call get_line_offset |
and dword[esi],not 0x00020000 |
1246,8 → 1210,8 |
jne @f |
dec ecx |
jg @b |
@@: mov [cur_editor.Caret.X],ecx ;! [pos.x],ecx |
dec [cur_editor.Caret.Y] ;! [pos.y] |
@@: mov [cur_editor.Caret.X],ecx |
dec [cur_editor.Caret.Y] |
cld |
jmp key.del.line_up |
endf |
1256,7 → 1220,7 |
func key.tab ;///// TABULATE ///////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
call delete_selection |
mov eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
mov eax,[cur_editor.Caret.X] |
mov ecx,eax |
add eax,ATABW |
1267,7 → 1231,7 |
push eax |
call editor_realloc_lines |
pop eax |
mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y] |
mov ecx,[cur_editor.Caret.Y] |
call get_line_offset |
and dword[esi],not 0x00020000 |
or dword[esi],0x00010000 |
1275,9 → 1239,9 |
xchg eax,ecx |
call get_real_length |
cmp eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
cmp eax,[cur_editor.Caret.X] |
jae @f |
mov eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
mov eax,[cur_editor.Caret.X] |
@@: movzx edx,word[esi] |
sub edx,eax |
cmp ecx,edx |
1287,30 → 1251,26 |
call editor_realloc_lines |
add esi,eax |
pop eax |
pushad; esi ecx eax |
mov ecx,[cur_editor.Lines] ;! AREA_TEMP2-10+1 |
pushad |
mov ecx,[cur_editor.Lines] |
add ecx,[ecx-4] |
dec ecx |
mov edi,ecx ;! AREA_TEMP2 |
mov edi,ecx |
add ecx,-10+1 |
; lea eax,[esi+4] |
; add eax,[esi] |
movzx eax,word[esi] |
lea eax,[esi+eax+4] |
sub ecx,eax |
lea esi,[edi-10] ;! AREA_TEMP2-10 |
lea esi,[edi-10] |
std |
rep movsb |
mov ecx,10 |
mov al,' ' |
rep stosb |
popad; eax ecx esi |
popad |
add word[esi],10 |
jmp @b |
@@: lea ebx,[esi+4] |
push ecx |
; lea edi,[ebx-1] |
; add edi,[esi] |
movzx edi,word[esi] |
lea edi,[ebx+edi-1] |
mov esi,edi |
1317,26 → 1277,25 |
sub esi,ecx |
lea ecx,[esi+1] |
sub ecx,ebx |
sub ecx,[cur_editor.Caret.X] ;! ecx,[pos.x] |
sub ecx,[cur_editor.Caret.X] |
std |
rep movsb |
.ok: pop ecx ;******* |
.ok: pop ecx |
pop eax |
rep stosb |
cld |
pop [cur_editor.Caret.X] ;! [pos.x] |
pop [cur_editor.Caret.X] |
lea esi,[ebx-4] |
call get_real_length |
cmp eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
cmp eax,[cur_editor.Caret.X] |
jae @f |
mov eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
@@: cmp eax,[cur_editor.Columns.Count] ;! eax,[columns] |
mov eax,[cur_editor.Caret.X] |
@@: cmp eax,[cur_editor.Columns.Count] |
jbe @f |
mov [cur_editor.Columns.Count],eax ;! [columns],eax |
@@: m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x] |
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y] |
call check_inv_all |
mov [cur_editor.Modified],1 ;! [modified],1 |
mov [cur_editor.Columns.Count],eax |
@@: m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] |
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] |
mov [cur_editor.Modified],1 |
.exit: |
ret |
1350,10 → 1309,10 |
mov eax,14 |
call editor_realloc_lines |
mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y] |
mov ecx,[cur_editor.Caret.Y] |
call get_line_offset |
mov ebx,[cur_editor.Caret.X] ;! ebx,[pos.x] |
mov ebx,[cur_editor.Caret.X] |
cmp bx,[esi] |
jb @f |
movzx ebx,word[esi] |
1363,7 → 1322,7 |
@@: |
cld |
mov edi,[temp_buf] ;! AREA_TEMP |
mov edi,[temp_buf] |
mov ebp,esi |
lea ecx,[ebx+1] |
@@: dec ecx |
1383,8 → 1342,8 |
rep stosb |
movzx ecx,word[esi] |
sub ecx,ebx;[pos.x] |
add esi,ebx;[pos.x] |
sub ecx,ebx |
add esi,ebx |
add esi,4 |
inc ecx |
@@: dec ecx |
1414,7 → 1373,7 |
.lp2: xor eax,eax |
@@: mov edx,edi |
add edi,4 |
mov [cur_editor.Caret.X],eax ;! [pos.x],eax |
mov [cur_editor.Caret.X],eax |
jecxz @f |
push ecx |
mov ecx,eax |
1432,17 → 1391,17 |
or eax,0x00010000 |
mov [edx],eax |
mov ecx,edi ;! [edi-AREA_TEMP] |
mov ecx,edi |
sub ecx,[temp_buf] |
push ecx |
mov edi,[cur_editor.Lines] ;! AREA_TEMP2 |
mov edi,[cur_editor.Lines] |
add edi,[edi-4] |
dec edi |
lea esi,[edi+4] |
sub esi,ecx |
movzx ecx,word[ebp] |
add esi,ecx;[ebp] |
add esi,ecx |
lea ecx,[esi-4] |
sub ecx,ebp |
std |
1453,26 → 1412,25 |
mov eax,[esp] |
lea edi,[esi+eax-4] |
movzx ecx,word[ebp] |
add esi,ecx;[ebp] |
mov ecx,[cur_editor.Lines] ;! AREA_TEMP2 |
add esi,ecx |
mov ecx,[cur_editor.Lines] |
add ecx,[ecx-4] |
sub ecx,esi |
cld |
@@: rep movsb |
.lp3: pop ecx |
mov esi,[temp_buf] ;! AREA_TEMP |
mov esi,[temp_buf] |
mov edi,ebp |
cld |
rep movsb |
inc [cur_editor.Caret.Y] ;! [pos.y] |
inc [cur_editor.SelStart.Y] ;! [sel.y] |
inc [cur_editor.Lines.Count] ;! [lines] |
inc [cur_editor.Caret.Y] |
inc [cur_editor.SelStart.Y] |
inc [cur_editor.Lines.Count] |
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x] |
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] |
call check_inv_all |
mov [cur_editor.Modified],1 ;! [modified],1 |
mov [cur_editor.Modified],1 |
.exit: |
ret |
1500,6 → 1458,7 |
call align_editor_in_tab |
call draw_editor |
call draw_tabctl |
call update_caption |
.exit: |
ret |
endf |
1527,6 → 1486,7 |
call align_editor_in_tab |
call draw_editor |
call draw_tabctl |
call update_caption |
.exit: |
ret |
endf |
1534,12 → 1494,19 |
;----------------------------------------------------------------------------- |
func key.ctrl_f4 ;///// CLOSE CURRENT TAB //////////////////////////////////// |
;----------------------------------------------------------------------------- |
mov ebp,[tab_bar.Current.Ptr] |
call delete_tab |
cmp [tab_bar.Items.Count],0 |
mov [do_not_draw],1 |
push [tab_bar.Current.Ptr] |
cmp [tab_bar.Items.Count],1 |
jne @f |
call create_tab |
@@: ret |
@@: pop ebp |
call delete_tab |
dec [do_not_draw] |
call align_editor_in_tab |
call draw_editor |
call draw_tabctl |
call draw_statusbar |
ret |
endf |
;----------------------------------------------------------------------------- |
1559,3 → 1526,53 |
@@: call draw_tabctl |
ret |
endf |
;----------------------------------------------------------------------------- |
func key.f3 ;///// FIND NEXT MATCH /////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
call search |
jc @f |
@@: ret |
endf |
;----------------------------------------------------------------------------- |
func key.f9 ;///// COMPILE AND RUN /////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
mov bl,1 |
call start_fasm |
ret |
endf |
;----------------------------------------------------------------------------- |
func key.ctrl_f9 ;///// COMPILE ////////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
mov bl,0 |
call start_fasm |
ret |
endf |
;----------------------------------------------------------------------------- |
func key.alt_x ;///// EXIT PROGRAM /////////////////////////////////////////// |
;----------------------------------------------------------------------------- |
mov esi,self_path |
mov byte[esi+PATHL-1],0 |
mov edi,f_info.path |
cld |
@@: lodsb |
stosb |
or al,al |
jnz @b |
mov [f_info70+0],2 |
mov [f_info70+4],0 |
mov [f_info70+8],0 |
mov [f_info70+12],TINYPAD_END |
mov [f_info70+16],0 |
mov byte[f_info70+20],0 |
mov [f_info70+21],f_info.path |
mcall 70,f_info70 |
.close: |
mov [main_closed],1 |
mcall -1 |
endf |
/programs/develop/tinypad/trunk/tp-locale.inc |
---|
152,6 → 152,11 |
et,'-' ,'', ,\ |
et,'Rea numbrid' ,'',LineNumbers |
lsz s_defname,\ |
en,<'Untitled',0>,\ |
ru,<'¥§ë¬ïë©',0>,\ |
et,<'Nimetu',0> |
lsz s_modified,\ |
ru,'§¬¥¥®',\ |
en,'Modified',\ |
183,6 → 188,14 |
ru,'⬥ ',\ |
en,'Cancel',\ |
et,'Tühista' |
lsz s_color,\ |
ru,'¢¥â: 0x',\ |
en,'Color: 0x',\ |
et,'Color: 0x' |
lsz s_tabpos,\ |
ru,' ᯮ«®¦¥¨¥ § ª« ¤®ª',\ |
en,'Tabs placement',\ |
et,'Tabs placement' |
lsz s_enter_filename,\ |
ru,<'¢¥¤¨â¥ ¨¬ï ä ©« ',0>,\ |
244,6 → 257,28 |
et,<'Juurdepääs keelatud (10)',0>,\ |
et,<'Seadme viga (11)',0> |
lszc s_appearance,b,\ |
ru,'¥ªáâ',\ |
ru,'®',\ |
ru,'¥ªá⠢뤥«¥¨ï',\ |
ru,'® ¢ë¤¥«¥¨ï',\ |
ru,'¨¬¢®«ë',\ |
ru,'¨á« ',\ |
ru,'âப¨',\ |
ru,'®¬¬¥â ਨ',\ |
ru,'§¬¥ñë¥ áâப¨',\ |
ru,'®åà ñë¥ áâப¨',\ |
\ |
en,'Text',\ |
en,'Background',\ |
en,'Selection text',\ |
en,'Selection background',\ |
en,'Symbols',\ |
en,'Numbers',\ |
en,'Strings',\ |
en,'Comments',\ |
en,'Modified lines',\ |
en,'Saved lines' |
lsz sysfuncs_filename,\ |
ru,<'SYSFUNCR.TXT',0>,\ |
/programs/develop/tinypad/trunk/tp-mouse.asm |
---|
3,9 → 3,9 |
mov ebx,eax |
and ebx,0x0000FFFF |
shr eax,16 |
mov ecx,[cur_editor.Bounds.Top] ; ecx,[top_ofs] |
mov ecx,[cur_editor.Bounds.Top] |
inc ecx |
pushd [cur_editor.Bounds.Left] ecx [cur_editor.Bounds.Right] ecx ; [left_ofs] ATOPH [p_info.client_box.width] ATOPH |
pushd [cur_editor.Bounds.Left] ecx [cur_editor.Bounds.Right] ecx |
popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0] |
sub [__rc+0x8],SCRLW+6 |
mov ecx,[cur_editor.Gutter.Width] |
69,10 → 69,10 |
pop eax |
jne still.skip_write |
@@: |
cmp [just_from_popup],0 |
je @f |
cmp al,MEV_LUP |
jne still.skip_write |
;!!! cmp [just_from_popup],0 |
;!!! je @f |
;!!! cmp al,MEV_LUP |
;!!! jne still.skip_write |
@@: mov [mev],al |
jmp [mouse_ev+eax*4-4] |
101,7 → 101,6 |
pop [mi_cur] |
cmp [popup_active],0 |
je still.skip_write |
; mcall 18,2,[h_popup] |
mov ecx,[mi_cur] |
or ecx,ecx |
js still.skip_write |
110,7 → 109,6 |
call dword[main_menu.onshow+ecx*4-4] |
call setup_main_menu_popup |
mcall 60,2,[h_popup],POPUP_STACK,4 |
; mcall 51,1,popup_thread_start,POPUP_STACK |
jmp still.skip_write |
150,88 → 148,76 |
call clear_selection |
.check_body.2: |
sub eax,[cur_editor.Bounds.Left] ; eax,[left_ofs] |
sub ebx,[cur_editor.Bounds.Top] ; ebx,[top_ofs] |
sub eax,[cur_editor.Bounds.Left] |
sub ebx,[cur_editor.Bounds.Top] |
sub eax,[cur_editor.Gutter.Width] |
sub eax,LCHGW |
sub ebx,2 |
; sub ebx,[__rc+0x4] |
push eax |
mov eax,ebx |
cdq;xor edx,edx |
cdq |
mov ecx,LINEH |
idiv ecx |
@@: add eax,[cur_editor.TopLeft.Y] ;! eax,[top_line] |
@@: add eax,[cur_editor.TopLeft.Y] |
mov ebx,eax |
pop eax |
cdq;xor edx,edx |
cdq |
mov ecx,6 |
idiv ecx |
@@: add eax,[cur_editor.TopLeft.X] ;! eax,[left_col] |
@@: add eax,[cur_editor.TopLeft.X] |
cmp eax,[cur_editor.Columns.Count] ;! eax,[columns] |
cmp eax,[cur_editor.Columns.Count] |
jl @f |
mov eax,[cur_editor.Columns.Count] ;! eax,[columns] |
@@: cmp ebx,[cur_editor.Lines.Count] ;! ebx,[lines] |
mov eax,[cur_editor.Columns.Count] |
@@: cmp ebx,[cur_editor.Lines.Count] |
jl @f |
mov ebx,[cur_editor.Lines.Count] ;! ebx,[lines] |
mov ebx,[cur_editor.Lines.Count] |
dec ebx |
@@: |
cmp [cur_editor.Caret.X],eax ;! [pos.x],eax |
cmp [cur_editor.Caret.X],eax |
jne .change_cur_pos |
cmp [cur_editor.Caret.Y],ebx ;! [pos.y],ebx |
je still.skip_write |
cmp [cur_editor.Caret.Y],ebx |
jne .change_cur_pos |
call editor_check_for_changes |
jmp still.skip_write |
.change_cur_pos: |
mov [cur_editor.Caret.X],eax ;! [pos.x],eax |
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] |
mov [cur_editor.Caret.Y],ebx ;! [pos.y],ebx |
call check_cur_vis_inv |
jc .check_ldown |
; cmp eax,ebx |
; je @f |
; push ebx |
; mov ebx,eax |
; call drawfile.ex |
; pop eax |
; @@: mov ebx,eax |
call draw_file.ex |
.check_ldown: |
mov [cur_editor.Caret.X],eax |
mov [cur_editor.Caret.Y],ebx |
call editor_check_for_changes |
jmp still |
.check_vscroll: |
;mov ecx,[p_info.client_box.width] |
mov ecx,[cur_editor.Bounds.Right] |
sub ecx,SCRLW-1;2 |
pushd ecx [cur_editor.Bounds.Top] ecx [cur_editor.Bounds.Bottom] ;ecx [top_ofs] ecx [bot_ofs] |
sub ecx,SCRLW-1 |
pushd ecx [cur_editor.Bounds.Top] ecx [cur_editor.Bounds.Bottom] |
popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0] |
add [__rc+0x8],SCRLW-2;!!!!!!!!!!!!!!-2 |
add [__rc+0x4],SCRLW-1;!!!!!!!!!!!!!!+1 |
sub [__rc+0xC],SCRLW*2+1;3 |
add [__rc+0x8],SCRLW-2 |
add [__rc+0x4],SCRLW-1 |
sub [__rc+0xC],SCRLW*2+1 |
mov ecx,__rc |
call pt_in_rect |
jnc .check_hscroll |
.check_vscroll.2: |
sub ebx,[cur_editor.Bounds.Top] ; ebx,[top_ofs] |
sub ebx,SCRLW;!!!!!!!!!!!!!!+1 |
; sub ebx,[__rc+0x4] |
sub ebx,[cur_editor.Bounds.Top] |
sub ebx,SCRLW |
cmp [vscrl_capt],0 |
jge .vcaptured |
mov eax,[cur_editor.VScroll.Top] ;! eax,[vscrl_top] |
mov eax,[cur_editor.VScroll.Top] |
cmp ebx,eax |
jb .center_vcapture |
add eax,[cur_editor.VScroll.Size] ;! eax,[vscrl_size] |
add eax,[cur_editor.VScroll.Size] |
cmp ebx,eax |
jae .center_vcapture |
mov eax,ebx |
sub eax,[cur_editor.VScroll.Top] ;! eax,[vscrl_top] |
sub eax,[cur_editor.VScroll.Top] |
dec eax |
mov [vscrl_capt],eax |
dec ebx |
jmp .vcaptured |
.center_vcapture: |
mov eax,[cur_editor.VScroll.Size] ;! eax,[vscrl_size] |
mov eax,[cur_editor.VScroll.Size] |
shr eax,1 |
mov [vscrl_capt],eax |
.vcaptured: |
239,32 → 225,32 |
jns @f |
xor ebx,ebx |
@@: mov [mouse_captured],1 |
mov eax,[cur_editor.Bounds.Bottom] ; eax,[bot_ofs] |
sub eax,[cur_editor.Bounds.Top] ; eax,[top_ofs] |
sub eax,[cur_editor.VScroll.Size] ;! eax,[vscrl_size] |
sub eax,SCRLW*3;-2 |
mov eax,[cur_editor.Bounds.Bottom] |
sub eax,[cur_editor.Bounds.Top] |
sub eax,[cur_editor.VScroll.Size] |
sub eax,SCRLW*3 |
cmp eax,ebx |
jge @f |
mov ebx,eax |
@@: |
mov [cur_editor.VScroll.Top],ebx ;! [vscrl_top],ebx |
mov eax,[cur_editor.Lines.Count] ;! eax,[lines] |
mov [cur_editor.VScroll.Top],ebx |
mov eax,[cur_editor.Lines.Count] |
sub eax,[lines.scr] |
imul ebx |
mov ebx,[cur_editor.Bounds.Bottom] ; ebx,[bot_ofs] |
sub ebx,[cur_editor.Bounds.Top] ; ebx,[top_ofs] |
sub ebx,SCRLW*3;-2 ;** |
sub ebx,[cur_editor.VScroll.Size] ;! ebx,[vscrl_size] |
mov ebx,[cur_editor.Bounds.Bottom] |
sub ebx,[cur_editor.Bounds.Top] |
sub ebx,SCRLW*3 |
sub ebx,[cur_editor.VScroll.Size] |
idiv ebx |
cmp eax,[cur_editor.TopLeft.Y] ;! eax,[top_line] |
cmp eax,[cur_editor.TopLeft.Y] |
je still.skip_write |
mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax |
mov [cur_editor.TopLeft.Y],eax |
call check_bottom_right |
call draw_file |
call draw_editor |
jmp still.skip_write |
.check_hscroll: |
pushd [cur_editor.Bounds.Left] [cur_editor.Bounds.Bottom] [cur_editor.Bounds.Right] [cur_editor.Bounds.Bottom] ; (5+SCRLW+1) [bot_ofs] [p_info.box.width] [bot_ofs] |
pushd [cur_editor.Bounds.Left] [cur_editor.Bounds.Bottom] [cur_editor.Bounds.Right] [cur_editor.Bounds.Bottom] |
popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0] |
add [__rc+0x8],-SCRLW*2-1 |
add [__rc+0x4],-SCRLW+1 |
276,26 → 262,24 |
.check_hscroll.2: |
mov ebx,eax |
;sub ebx,(5+SCRLW+1) |
sub ebx,SCRLW+1 |
sub ebx,[cur_editor.Bounds.Left] |
; sub ebx,[__rc+0x0] |
cmp [hscrl_capt],0 |
jge .hcaptured |
mov eax,[cur_editor.HScroll.Top] ;! eax,[hscrl_top] |
mov eax,[cur_editor.HScroll.Top] |
cmp ebx,eax |
jl .center_hcapture |
add eax,[cur_editor.HScroll.Size] ;! eax,[hscrl_size] |
add eax,[cur_editor.HScroll.Size] |
cmp ebx,eax |
jge .center_hcapture |
mov eax,ebx |
sub eax,[cur_editor.HScroll.Top] ;! eax,[hscrl_top] |
sub eax,[cur_editor.HScroll.Top] |
dec eax |
mov [hscrl_capt],eax |
dec ebx |
jmp .hcaptured |
.center_hcapture: |
mov eax,[cur_editor.HScroll.Size] ;! eax,[hscrl_size] |
mov eax,[cur_editor.HScroll.Size] |
shr eax,1 |
mov [hscrl_capt],eax |
.hcaptured: |
303,26 → 287,26 |
jns @f |
xor ebx,ebx |
@@: mov [mouse_captured],1 |
mov eax,[cur_editor.Bounds.Right] ; eax,[p_info.box.width] |
sub eax,[cur_editor.HScroll.Size] ;! eax,[hscrl_size] |
sub eax,SCRLW*3+1 ; eax,SCRLW*3+10+1 |
mov eax,[cur_editor.Bounds.Right] |
sub eax,[cur_editor.HScroll.Size] |
sub eax,SCRLW*3+1 |
cmp eax,ebx |
jge @f |
mov ebx,eax |
@@: |
mov [cur_editor.HScroll.Top],ebx ;! [hscrl_top],ebx |
mov eax,[cur_editor.Columns.Count] ;! eax,[columns] |
mov [cur_editor.HScroll.Top],ebx |
mov eax,[cur_editor.Columns.Count] |
sub eax,[columns.scr] |
imul ebx |
mov ebx,[cur_editor.Bounds.Right] ; ebx,[p_info.box.width] |
sub ebx,SCRLW*3+1 ; ebx,SCRLW*3+10+1 ;** |
sub ebx,[cur_editor.HScroll.Size] ;! ebx,[hscrl_size] |
mov ebx,[cur_editor.Bounds.Right] |
sub ebx,SCRLW*3+1 |
sub ebx,[cur_editor.HScroll.Size] |
idiv ebx |
cmp eax,[cur_editor.TopLeft.X] ;! eax,[left_col] |
cmp eax,[cur_editor.TopLeft.X] |
je still.skip_write |
mov [cur_editor.TopLeft.X],eax ;! [left_col],eax |
mov [cur_editor.TopLeft.X],eax |
call check_bottom_right |
call draw_file |
call draw_editor |
jmp still.skip_write |
.check_main_menu: |
353,5 → 337,5 |
mov [hscrl_capt],eax |
mov [body_capt],eax |
mov [mouse_captured],0 |
mov [just_from_popup],0 |
;!!! mov [just_from_popup],0 |
jmp still.skip_write |
/programs/develop/tinypad/trunk/tp-popup.asm |
---|
1,3 → 1,4 |
;POP_WIDTH = (popup_text.max_title+popup_text.max_accel+6)*6 |
POP_IHEIGHT = 16 |
;POP_HEIGHT = popup_text.cnt_item*POP_IHEIGHT+popup_text.cnt_sep*4+4 |
44,7 → 45,7 |
cmp eax,7 |
jne still_popup |
mov ebp,[POPUP_STACK];-32+12+4] |
mov ebp,[POPUP_STACK] |
mov dword[POPUP_STACK-32+4],8 |
movzx ebx,[ebp+POPUP.x] |
movzx ecx,[ebp+POPUP.y] |
51,7 → 52,6 |
movzx edx,[ebp+POPUP.width] |
movzx esi,[ebp+POPUP.height] |
mcall 67 |
; call draw_popup_wnd |
jmp still_popup |
mouse_popup: |
75,7 → 75,7 |
jz still_popup |
mov ebx,[ebp+POPUP.actions] |
mov [just_from_popup],1 |
call dword[ebx+eax*4-4];dword[popup_text.actions+eax*4-4] |
call dword[ebx+eax*4-4] |
inc [just_from_popup] |
jmp close_popup |
98,18 → 98,12 |
close_popup: |
mcall 18,3,[p_info.PID] |
mov [popup_active],0 |
mov [mi_cur],0 |
mcall -1 |
func draw_popup_wnd |
mcall 12,1 |
; mcall 48,3,sc,sizeof.system_colors |
; call calc_3d_colors |
; mov ebx,[p_pos] |
; mov ecx,[p_pos-2] |
; mov bx,POP_WIDTH |
; mov cx,POP_HEIGHT |
mov ebx,dword[ebp+POPUP.x-2] |
mov bx,[ebp+POPUP.width] |
mov ecx,dword[ebp+POPUP.y-2] |
118,20 → 112,14 |
movzx ebx,bx |
movzx ecx,cx |
pushd 0 0 ebx ecx ;POP_WIDTH POP_HEIGHT |
pushd 0 0 ebx ecx |
call draw_3d_panel |
mov [pi_sel],0 |
; mcall 37,1 |
; movsx ebx,ax |
; sar eax,16 |
; mov [c_pos.x],eax |
; mov [c_pos.y],ebx |
mov eax,4 |
mpack ebx,3*6,3 |
mov ecx,[sc.work_text] |
mov edx,[ebp+POPUP.data];popup_text.data |
mov edx,[ebp+POPUP.data] |
@@: inc [pi_sel] |
inc edx |
movzx esi,byte[edx-1] |
143,11 → 131,10 |
mov cx,bx |
movzx ebx,[ebp+POPUP.width] |
add ebx,0x00010000-1 |
; mpack ebx,1,POP_WIDTH-1 |
add ecx,0x00010001 |
mcall 38,,,[cl_3d_inset];0x006382BF;[sc.work_text] |
mcall 38,,,[cl_3d_inset] |
add ecx,0x00010001 |
mcall ,,,[cl_3d_outset];0x00FFFFFF |
mcall ,,,[cl_3d_outset] |
popad |
add ebx,4 |
jmp .lp2 |
154,7 → 141,7 |
.lp1: mov edi,[pi_sel] |
cmp edi,[pi_cur] |
jne .lp3 |
test byte[ebp+edi-1],0x01 ; byte[popup_text+edi-1],0x01 |
test byte[ebp+edi-1],0x01 |
jz .lp3 |
pushad |
movzx ecx,bx |
162,15 → 149,14 |
mov cl,POP_IHEIGHT-1 |
movzx ebx,[ebp+POPUP.width] |
add ebx,0x00010000-1 |
; mpack ebx,1,POP_WIDTH-1 |
mcall 13,,,[cl_3d_pushed];0x00A3B8CC |
mcall 13,,,[cl_3d_pushed] |
rol ecx,16 |
mov ax,cx |
rol ecx,16 |
mov cx,ax |
mcall 38,,,[cl_3d_inset];0x006382BF |
mcall 38,,,[cl_3d_inset] |
add ecx,(POP_IHEIGHT-1)*65536+POP_IHEIGHT-1 |
mcall ,,,[cl_3d_outset];0x00FFFFFF |
mcall ,,,[cl_3d_outset] |
popad |
.lp3: add ebx,(POP_IHEIGHT-7)/2 |
185,8 → 171,8 |
call draw_check |
.lp8: popad |
mov ecx,[sc.work_text];0x00000000 |
test byte[ebp+edi-1],0x01 ; byte[popup_text+edi-1],0x01 |
mov ecx,[sc.work_text] |
test byte[ebp+edi-1],0x01 |
jnz .lp5 |
add ebx,0x00010001 |
mov ecx,[cl_3d_outset] |
193,17 → 179,16 |
mcall |
sub ebx,0x00010001 |
mov ecx,[cl_3d_inset] |
;mov ecx,[sc.grab_text];0x007F7F7F |
.lp5: mcall |
push ebx |
add edx,esi |
inc edx |
movzx esi,byte[edx-1] |
add ebx,[ebp+POPUP.acc_ofs] ; ((popup_text.max_title+2)*6-1)*65536 |
add ebx,[ebp+POPUP.acc_ofs] |
cmp edi,[pi_cur] |
je .lp4 |
mov ecx,[cl_3d_inset];0x006382BF |
.lp4: test byte[ebp+edi-1],0x01 ; byte[popup_text+edi-1],0x01 |
mov ecx,[cl_3d_inset] |
.lp4: test byte[ebp+edi-1],0x01 |
jnz .lp6 |
add ebx,0x00010001 |
mov ecx,[cl_3d_outset] |
210,7 → 195,6 |
mcall |
sub ebx,0x00010001 |
mov ecx,[cl_3d_inset] |
;mov ecx,[sc.grab_text];0x007F7F7F |
.lp6: mcall |
pop ebx |
add ebx,POP_IHEIGHT-(POP_IHEIGHT-7)/2 |
271,7 → 255,7 |
.recode: |
ret |
.options: |
mov word[mm.Options+0],0 |
;mov word[mm.Options+0],0 |
mov byte[mm.Options+5],0 |
or byte[mm.Options+2],0x02 |
test [options],OPTS_SECURESEL |
/programs/develop/tinypad/trunk/tp-recode.asm |
---|
19,8 → 19,8 |
mov edi,table.koi.1251 |
.main: |
mov ecx,[cur_editor.Lines.Count] ;! ecx,[lines] |
mov esi,[cur_editor.Lines] ;! AREA_EDIT |
mov ecx,[cur_editor.Lines.Count] |
mov esi,[cur_editor.Lines] |
jecxz .exit |
xor eax,eax |
.lp0: dec ecx |
/programs/develop/tinypad/trunk/tp-tabctl.asm |
---|
1,9 → 1,3 |
lsz s_defname,\ |
en,<'Untitled',0>,\ |
ru,<'Untitled',0>,\ |
et,<'Nimetu',0> |
;----------------------------------------------------------------------------- |
func flush_cur_tab ;///// SAVE CURRENT TAB DATA TO CONTROL /////////////////// |
;----------------------------------------------------------------------------- |
33,7 → 27,7 |
mov ecx,sizeof.TABITEM/4 |
rep movsd |
mov [tab_bar.Current.Ptr],ebp |
call update_caption |
; call update_caption |
pop edi esi ecx |
ret |
endf |
41,6 → 35,7 |
;----------------------------------------------------------------------------- |
func make_tab_visible ;///// MAKE SPECIFIED TAB VISIBLE IF IT'S OFFSCREEN //// |
;----------------------------------------------------------------------------- |
call flush_cur_tab |
imul eax,[tab_bar.Items.Left],sizeof.TABITEM |
add eax,[tab_bar.Items] |
cmp eax,ebp |
52,13 → 47,12 |
push ebp |
call get_hidden_tabitems_number |
cmp ebp,[esp] |
ja .lp1 |
ja @f |
@@: inc [tab_bar.Items.Left] |
call get_hidden_tabitems_number |
cmp ebp,[esp] |
jbe @b |
@@: inc [tab_bar.Items.Left] |
.lp1: pop ebp |
@@: pop ebp |
ret |
.go_left: |
65,7 → 59,7 |
mov eax,ebp |
sub eax,[tab_bar.Items] |
jz @f |
cwde |
cdq |
mov ebx,sizeof.TABITEM |
div ebx |
@@: mov [tab_bar.Items.Left],eax |
75,7 → 69,6 |
;----------------------------------------------------------------------------- |
func create_tab ;///// ADD TAB TO THE END //////////////////////////////////// |
;----------------------------------------------------------------------------- |
; DEBUGF 1,"items count before addition: %d\n",[tab_bar.Items.Count] |
push eax ecx esi edi |
inc [tab_bar.Items.Count] |
91,7 → 84,6 |
sub [tab_bar.Default.Ptr],ecx |
@@: lea ebp,[eax+ebx-sizeof.TABITEM] |
call set_cur_tab |
call make_tab_visible |
mov eax,1024 |
mov [cur_editor.Lines.Size],eax |
125,8 → 117,9 |
mov [cur_editor.AsmMode],0 |
call flush_cur_tab |
mov ebp,[tab_bar.Current.Ptr] |
call make_tab_visible |
call update_caption |
;call drawwindow |
cmp [do_not_draw],0 |
jne @f |
call align_editor_in_tab |
133,6 → 126,7 |
call draw_editor |
call draw_tabctl |
call draw_statusbar |
call update_caption |
@@: |
mov ebp,cur_tab |
pop edi esi ecx eax |
142,7 → 136,6 |
;----------------------------------------------------------------------------- |
func delete_tab ;///// DELETE SPECIFIED TAB ////////////////////////////////// |
;----------------------------------------------------------------------------- |
; DEBUGF 1,"items count before deletion: %d\n",[tab_bar.Items.Count] |
cmp [tab_bar.Default.Ptr],0 |
je @f |
cmp ebp,[tab_bar.Default.Ptr] |
188,7 → 181,6 |
@@: mov [tab_bar.Current.Ptr],0 |
call set_cur_tab |
call make_tab_visible |
;call drawwindow |
call align_editor_in_tab |
call draw_editor |
call draw_tabctl |
382,7 → 374,7 |
call dword[esp+(8+4)+8+8] |
mcall 13,,,[sc.work] |
pop ecx ebx |
mov edx,[color_tbl+4*0] |
mov edx,[color_tbl.text] |
.draw_tabs.inactive: |
cmp ebp,[tab_bar.Default.Ptr] |
540,8 → 532,7 |
ret |
.check_horz: |
lea eax,[ebx-1] |
add eax,esi |
lea eax,[esi+ebx-1] |
sub eax,[tab_bar.Bounds.Right] |
jge .check.dontfit |
add eax,SCRLW*2+2 |
552,8 → 543,7 |
stc |
ret |
.check_vert: |
lea eax,[ecx-1] |
add eax,edi |
lea eax,[edi+ecx-1] |
sub eax,[tab_bar.Bounds.Bottom] |
jge .check.dontfit |
add eax,SCRLW+2 |
584,6 → 574,10 |
jae .lp1 |
lea eax,[ebp+TABITEM.Editor.FilePath] |
add eax,[ebp+TABITEM.Editor.FileName] |
cmp byte[eax],0 |
jne @f |
int3 |
@@: |
call strlen |
imul ebx,eax,6 |
add ebx,9 |
658,11 → 652,11 |
mov edi,[tab_bar.Bounds.Top] |
inc edi |
mov ecx,[tab_bar.Items.Count] |
imul ebp,[tab_bar.Items.Left],sizeof.TABITEM |
mov ebx,[tab_bar.Items.Left] |
imul ebp,ebx,sizeof.TABITEM |
add ebp,[tab_bar.Items] |
mov eax,ecx |
sub eax,[tab_bar.Items.Left] |
push eax |
push ecx |
sub [esp],ebx |
@@: push ecx |
call get_tab_size |
/programs/develop/tinypad/trunk/tp-tbox.asm |
---|
1,15 → 1,3 |
struct TBOX |
x dw ? |
width dw ? |
y dw ? |
height dw ? |
sel.x db ? |
pos.x db ? |
ofs.x db ? |
length db ? |
text rb 255 |
ends |
virtual at ebp |
tbox TBOX |
end virtual |
20,7 → 8,7 |
func textbox.get_width |
push ebx edx |
movzx eax,[tbox.width-2] |
movzx eax,[tbox.width] |
add eax,-6 |
xor edx,edx |
mov ebx,6 |
84,7 → 72,7 |
@@: mov [tb.pos.x],al |
mov [tb.sel.x],ah |
mcall 13,dword[tbox.x],dword[tbox.y],[color_tbl+4*5];[sc.work] |
mcall 13,dword[tbox.width],dword[tbox.height],[color_tbl.back] |
mov edx,[cl_3d_inset] |
call draw_framerect |
94,15 → 82,14 |
cmp ebp,[focused_tb] |
je @f |
mov ebx,dword[tbox.x] |
mov bx,[tbox.y+2] |
movzx eax,[tbox.height-2] |
mov ebx,dword[tbox.x-2] |
mov bx,[tbox.y] |
movzx eax,[tbox.height] |
shr eax,1 |
add eax,4*65536-4 |
add ebx,eax |
lea edx,[tbox.text] |
; movzx esi,[tbox.length] |
mcall 4,,[color_tbl+4*0];[sc.work_text] |
mcall 4,,[color_tbl.text] |
ret |
@@: movzx eax,[tb.pos.x] |
123,26 → 110,25 |
mov eax,ecx |
.lp2: imul eax,6 |
imul ebx,6 |
movzx ecx,[tbox.x+2] |
movzx ecx,[tbox.x] |
add ecx,3 |
; sub eax,ebx |
add ebx,ecx |
shl ebx,16 |
add ebx,eax |
movzx ecx,[tbox.height-2] |
movzx ecx,[tbox.height] |
shr ecx,1 |
add cx,[tbox.y+2] |
add cx,[tbox.y] |
shl ecx,16 |
add ecx,-5*65536+10 |
mcall 13,,,[color_tbl+4*7];0x0000007F |
mcall 13,,,[color_tbl.back.sel] |
mov esi,[esp] |
lea edx,[tbox.text] |
movzx eax,[tbox.ofs.x] |
add edx,eax |
mov ebx,dword[tbox.x] |
mov bx,[tbox.y+2] |
movzx eax,[tbox.height-2] |
mov ebx,dword[tbox.x-2] |
mov bx,[tbox.y] |
movzx eax,[tbox.height] |
shr eax,1 |
add eax,4*65536-4 |
add ebx,eax |
149,7 → 135,7 |
mov eax,4 |
or esi,esi |
jz .lp3 |
mcall ,,[color_tbl+4*0];[sc.work_text] |
mcall ,,[color_tbl.text] |
.lp3: sub edi,esi |
jnz .lp4 |
add esp,8 |
164,7 → 150,7 |
jbe .lp5 |
mov esi,edi |
.lp5: |
mcall ,,[color_tbl+4*6];0x00FFFFFF |
mcall ,,[color_tbl.text.sel] |
sub edi,esi |
jz .exit |
add edx,esi |
171,17 → 157,15 |
imul esi,6*65536 |
add ebx,esi |
lea ecx,[tbox.text] |
; sub ecx,edx |
; add edi,ecx |
mcall ,,[color_tbl+4*0],,edi;[sc.work_text],,edi |
mcall ,,[color_tbl.text],,edi |
jmp .exit |
@@: lea edx,[tbox.text] |
movzx eax,[tbox.ofs.x] |
add edx,eax |
mov ebx,dword[tbox.x] |
mov bx,[tbox.y+2] |
movzx eax,[tbox.height-2] |
mov ebx,dword[tbox.x-2] |
mov bx,[tbox.y] |
movzx eax,[tbox.height] |
shr eax,1 |
add eax,4*65536-4 |
add ebx,eax |
188,7 → 172,7 |
movzx eax,[tbox.ofs.x] |
call textbox.get_width |
mov esi,eax |
mcall 4,,[color_tbl+4*0];[sc.work_text] |
mcall 4,,[color_tbl.text] |
.exit: |
movzx ebx,[tbox.pos.x] |
195,15 → 179,15 |
movzx eax,[tbox.ofs.x] |
sub ebx,eax |
imul ebx,6 |
movzx eax,[tbox.x+2] |
movzx eax,[tbox.x] |
add eax,3 |
add ebx,eax |
push bx |
shl ebx,16 |
pop bx |
movzx ecx,[tbox.height-2] |
movzx ecx,[tbox.height] |
shr ecx,1 |
add cx,[tbox.y+2] |
add cx,[tbox.y] |
push cx |
shl ecx,16 |
pop cx |