Tinypad: integer zoom feature

git-svn-id: svn://kolibrios.org@5838 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pathoswithin 2015-10-11 12:17:37 +00:00
parent 466bcbef1e
commit ffaece082b
8 changed files with 407 additions and 368 deletions

View File

@ -37,3 +37,5 @@ define mm.Options.AutoIndents set_opt.auto_indents
define mm.Options.SmartTabs 0
define mm.Options.OptimalFill set_opt.optimal_fill
define mm.Options.LineNumbers set_opt.line_numbers
define mm.Options.ZoomIn key.ctrl_plus
define mm.Options.ZoomOut key.ctrl_minus

View File

@ -2,10 +2,11 @@
vscrl_capt dd -1
hscrl_capt dd -1
body_capt dd -1
ins_mode db 1
s_status dd 0
lineHeight dd LINEH
charWidth dd 6
scale db 0
ins_mode db 1
sz app_fasm ,'/rd/1/develop/fasm',0
sz app_board ,'/rd/1/develop/board',0

View File

@ -161,45 +161,53 @@ popup_res mm.Encoding,\
@!,<'KOI8-R ',0x1A,' CP1251'>,'',KOI8R.CP1251
popup_res mm.Options,\
ru,'く・隴ィゥ 「ィ、...' ,'',Appearance ,\
ru,'討・ォィ遞粮' ,'Ctrl +',ZoomIn ,\
ru,'闘・ュ<EFBDA5>ィ粮' ,'Ctrl -',ZoomOut ,\
ru,'-','',,\
ru,'紺ャ・燿 矮牋ェ' ,'',LineNumbers ,\
ru,'<27>¥§®¯ á­®¥ ¢ë¤¥«¥­¨¥' ,'',SecureSel ,\
ru,'€¢â®¬ â¨ç¥áª¨¥ ᪮¡ª¨' ,'',AutoBrackets,\
ru,'€¢â®¬ â¨ç¥áª¨© ®âáâã¯' ,'',AutoIndents ,\
ru,'“¬­ ï â ¡ã«ïæ¨ï' ,'',SmartTabs ,\
ru,'Ž¯â¨¬ «ì­®¥ á®åà ­¥­¨¥' ,'',OptimalFill ,\
ru,'-','',,\
ru,'紺ャ・燿 矮牋ェ' ,'',LineNumbers ,\
ru,'く・隴ィゥ 「ィ、...' ,'',Appearance ,\
\
en,'Appearance...' ,'',Appearance ,\
en,'Zoom in' ,'Ctrl +',ZoomIn ,\
en,'Zoom out' ,'Ctrl -',ZoomOut ,\
en,'-','',,\
en,'Line numbers' ,'',LineNumbers ,\
en,'Secure selection' ,'',SecureSel ,\
en,'Automatic brackets' ,'',AutoBrackets,\
en,'Automatic indents' ,'',AutoIndents ,\
en,'Smart tabulation' ,'',SmartTabs ,\
en,'Optimal fill on saving' ,'',OptimalFill ,\
en,'-','',,\
en,'Line numbers' ,'',LineNumbers ,\
en,'Appearance...' ,'',Appearance ,\
\
et,'V舁imus...' ,'',Appearance ,\
et,'Zoom in' ,'Ctrl +',ZoomIn ,\
et,'Zoom out' ,'Ctrl -',ZoomOut ,\
et,'-','',,\
et,'Rea numbrid' ,'',LineNumbers ,\
et,'Turvaline valimine' ,'',SecureSel ,\
et,'Automaatsed sulud' ,'',AutoBrackets,\
et,'Automaatsed taandread' ,'',AutoIndents ,\
et,'Tark tabulatsioon' ,'',SmartTabs ,\
et,'Optimaalne täitmine salvestamisel','',OptimalFill,\
et,'-','',,\
et,'Rea numbrid' ,'',LineNumbers ,\
et,'V舁imus...' ,'',Appearance ,\
\
sp,'Apariencia...' ,'',Appearance ,\
sp,'Zoom in' ,'Ctrl +',ZoomIn ,\
sp,'Zoom out' ,'Ctrl -',ZoomOut ,\
sp,'-','',,\
sp,'N伹eros en l匤eas' ,'',LineNumbers ,\
sp,'Selección segura' ,'',SecureSel ,\
sp,'Paréntesis automáticos' ,'',AutoBrackets,\
sp,'Identación automática' ,'',AutoIndents ,\
sp,'Tabulación inteligente' ,'',SmartTabs ,\
sp,'Llenado óptimo al guardar','',OptimalFill ,\
sp,'-','',,\
sp,'N伹eros en l匤eas' ,'',LineNumbers
sp,'Apariencia...' ,'',Appearance
lsz s_defname,\
en,<'Untitled',0>,\

View File

@ -83,6 +83,8 @@ accel_table_main dd \
0x00010150,key.shift_down ,\ ; Shift+Down
0x00010151,key.shift_pgdn ,\ ; Shift+PageDown
0x00010153,key.del ,\ ; Shift+Delete
0x0002000C,key.ctrl_minus ,\ ; Ctrl+Minus
0x0002000D,key.ctrl_plus ,\ ; Ctrl+Plus
0x0002000F,key.ctrl_tab ,\ ; Ctrl+Tab
0x00020015,key.ctrl_y ,\ ; Ctrl+Y
0x00020018,key.ctrl_o ,\ ; Ctrl+O
@ -108,6 +110,7 @@ accel_table_main dd \
\;0x00020150,key.ctrl_down ,\ ; Ctrl+Down
0x00020151,key.ctrl_pgdn ,\ ; Ctrl+PageDown
0x00020153,key.del ,\ ; Ctrl+Del
0x0003000D,key.ctrl_plus ,\ ; Ctrl+Plus
0x0003000F,key.shift_ctrl_tab ,\ ; Shift+Ctrl+Tab
0x0003001F,key.shift_ctrl_s ,\ ; Shift+Ctrl+S
0x00030147,key.shift_ctrl_home ,\ ; Shift+Ctrl+Home

View File

@ -38,7 +38,8 @@ proc drawwindow ;///// DRAW WINDOW ///////////////////////////////////////////
cld
rep movsd
cmp [p_info.client_box.height],LINEH
mov eax,[lineHeight]
cmp [p_info.client_box.height],eax
jl .exit.2
mov [tab_bar.Bounds.Left],0
@ -61,21 +62,6 @@ proc drawwindow ;///// DRAW WINDOW ///////////////////////////////////////////
call draw_bottom_dialog
; mov [do_not_draw],1 ; do_not_draw = true
; mov ebx,eax
; sub ebx,[top_ofs]
; sub ebx,SCRLW*3+AMINS+5
; js .no_draw
; dec [do_not_draw] ; do_not_draw = false
; sub eax,SCRLW+3
; sub eax,[top_ofs]
; cdq
; mov ebx,LINEH
; div ebx
; mov [lines.scr],eax
inc [top_ofs]
call draw_main_menu
@ -91,7 +77,7 @@ proc drawwindow ;///// DRAW WINDOW ///////////////////////////////////////////
push eax
add eax,-2-SCRLW
cdq
mov ebx,LINEH
mov ebx,[lineHeight]
idiv ebx
mov [lines.scr],eax
pop eax
@ -104,13 +90,13 @@ proc drawwindow ;///// DRAW WINDOW ///////////////////////////////////////////
dec eax
cdq
mov ebx,LINEH
mov ebx,[lineHeight]
idiv ebx
mov [lines.scr],eax
mov eax,[p_info.client_box.width]
cdq
mov ebx,6
mov ebx,[charWidth]
idiv ebx
mov [columns.scr],eax
@@:

View File

@ -29,7 +29,7 @@ proc draw_editor ;///// DRAW EDITOR //////////////////////////////////////////
cmp eax,3
jae @f
mov eax,3
@@: imul eax,6
@@: imul eax,[charWidth]
add eax,8
.lp1: mov [cur_editor.Gutter.Width],eax
mov [left_ofs],eax
@ -40,7 +40,7 @@ proc draw_editor ;///// DRAW EDITOR //////////////////////////////////////////
sub eax,SCRLW+LCHGW+4
js .exit
cdq
mov ebx,6
mov ebx,[charWidth]
div ebx
mov [columns.scr],eax
@ -50,7 +50,7 @@ proc draw_editor ;///// DRAW EDITOR //////////////////////////////////////////
sub eax,SCRLW+3
js .exit
cdq
mov ebx,LINEH
mov ebx,[lineHeight]
div ebx
mov [lines.scr],eax
@ -106,11 +106,16 @@ proc draw_editor_gutter ;///// DRAW EDITOR GUTTER (LEFT PANEL) ///////////////
mov esi,edi
pop edi edx eax
sub esi,edx
imul eax,esi,6*65536
mov eax,esi
imul eax,[charWidth]
shl eax,16
sub ebx,eax
mcall 4,,edi
mov cl, [scale]
shl ecx,24
or ecx,edi
mcall 4
popad
add ebx,LINEH
add ebx,[lineHeight]
inc ecx
cmp ecx,[cur_editor.Lines.Count]
jg @f
@ -353,7 +358,7 @@ proc draw_editor_text.part ;///// DRAW EDITOR TEXT (PARTLY) //////////////////
@@: push eax
mov eax,[cur_editor.Bounds.Bottom]
sub eax,[cur_editor.Bounds.Top]
cmp eax,LINEH
cmp eax,[lineHeight]
pop eax
jge @f
ret
@ -404,7 +409,7 @@ proc draw_editor_text.part ;///// DRAW EDITOR TEXT (PARTLY) //////////////////
mov ebx,[top_ofs]
add ebx,[left_ofs-2]
sub eax,[cur_editor.TopLeft.Y]
imul eax,LINEH
imul eax,[lineHeight]
add ebx,eax
imul ebp,[cur_editor.TopLeft.X],6*65536
@ -425,7 +430,7 @@ proc draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
ret
@@: mov eax,[cur_editor.Bounds.Bottom]
sub eax,[cur_editor.Bounds.Top]
cmp eax,LINEH
cmp eax,[lineHeight]
jge @f
ret
@@:
@ -466,7 +471,7 @@ proc draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
mov ecx,ebx
shl ecx,16
mov cl,LINEH
mov cl,byte[lineHeight]
mov ebx,[cur_editor.Bounds.Right]
add ebx,-SCRLW
add ebx,[left_ofs-2]
@ -492,7 +497,7 @@ proc draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
jle .lp6.2
cmp eax,[columns.scr]
jge .lp6
imul eax,6
imul eax,[charWidth]
pushad
sub bx,ax
rol ebx,16
@ -514,7 +519,7 @@ proc draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
jle .lp6
cmp eax,[columns.scr]
jg .lp6.2
imul eax,6
imul eax,[charWidth]
pushad
sub bx,ax
rol ebx,16
@ -539,11 +544,11 @@ proc draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
cmp eax,[sel.end.x]
je .lp6
sub eax,[cur_editor.TopLeft.X]
imul eax,6
imul eax,[charWidth]
pushad
mov ebx,[sel.end.x]
sub ebx,[sel.begin.x]
imul ebx,6
imul ebx,[charWidth]
sal ebx,16
dec eax
add eax,[left_ofs]
@ -607,7 +612,9 @@ proc draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
pop ebx
push ecx
mov ecx,eax
mov cl, [scale]
shl ecx,24
or ecx,eax
push esi ebx
mov eax,ebx
@ -624,7 +631,8 @@ proc draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
xor eax,eax
jmp .qqq2
.qqq:
imul eax,6*65536
imul eax,[charWidth]
shl eax,16
.qqq2:
and ebx,0x0000FFFF
add eax,[left_ofs-2]
@ -663,12 +671,14 @@ proc draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
sub [esp+4],ecx
@@: sub eax,esi
add edx,esi
imul esi,6
imul esi,[charWidth]
rol ebx,16
add bx,si
rol ebx,16
mov esi,eax
mov ecx,[color_tbl.text.sel]
mov cl, [scale]
shl ecx,24
or ecx,[color_tbl.text.sel]
mcall 4
popad
jmp .draw_t
@ -693,12 +703,15 @@ proc draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
pop ebx
pushad
mov esi,eax
mov ecx,[color_tbl.text.sel]
mov cl, [scale]
shl ecx,24
or ecx,[color_tbl.text.sel]
mcall 4
popad
sub esi,eax
add edx,eax
imul eax,6*65536
imul eax,[charWidth]
shl eax,16
add ebx,eax
jmp .draw_t
;----------------------------------------------)-
@ -726,16 +739,20 @@ proc draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
sub eax,esi
pushad
add edx,esi
imul esi,6*65536
imul esi,[charWidth]
shl esi,16
add ebx,esi
mov esi,[sel.end.x]
sub esi,[sel.begin.x]
mov ecx,[color_tbl.text.sel]
mov cl, [scale]
shl ecx,24
or ecx,[color_tbl.text.sel]
sub eax,esi
push eax
mcall 4
add edx,esi
imul esi,6*65536
imul esi,[charWidth]
shl esi,16
add ebx,esi
pop esi
mov ecx,[esp+4*6]
@ -748,14 +765,16 @@ proc draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
cmp eax,[sel.end.x]
jge .ya2
;---[ block inside selection ]-----------------(-
.ya4: mov ecx,[color_tbl.text.sel]
.ya4: mov cl, [scale]
shl ecx,24
or ecx,[color_tbl.text.sel]
;----------------------------------------------)-
.draw_t:
mcall 4
.skip_t:
pop eax eax ; ebx esi
imul eax,6
imul eax,[charWidth]
add [esp+4*2+2],ax
pop ecx esi
cmp ecx,[cur_line_len]
@ -764,7 +783,7 @@ proc draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
pop ebx ecx
and ebx,0x0000FFFF
add ebx,[left_ofs-2]
add ebx,LINEH
add ebx,[lineHeight]
add esi,[cur_line_len]
inc dword[esp]
dec ecx
@ -785,12 +804,13 @@ proc draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
mov edx,[color_tbl.back]
mov eax,13
mov ecx,[esp-8]
add ecx,LINEH
add ecx,[lineHeight]
shl ecx,16
mov cx,word[cur_editor.Bounds.Bottom]
sub cx,[esp-8]
add cx,-SCRLW-LINEH
jle @f
sub cx,word[lineHeight]
sub cx,SCRLW
js @f
mcall
@@: mov ecx,[cur_editor.Bounds.Top-2]
mov cx,2
@ -938,7 +958,7 @@ proc draw_editor_caret ;///// DRAW EDITOR TEXT CARET /////////////////////////
js @f
cmp ebx,[columns.scr]
ja @f
imul ebx,6
imul ebx,[charWidth]
add ebx,[left_ofs]
dec ebx
push bx
@ -949,11 +969,12 @@ proc draw_editor_caret ;///// DRAW EDITOR TEXT CARET /////////////////////////
js @f
cmp eax,[lines.scr]
jge @f
imul eax,LINEH
imul eax,[lineHeight]
add eax,[top_ofs]
mov esi,eax
shl esi,16
add eax,LINEH-2
add eax,[lineHeight]
sub eax,2
mov si,ax
mov ecx,2
cmp [ins_mode],0

View File

@ -69,7 +69,7 @@ key:
.lp0: test al,0x80
jnz still.skip_write
;--------------------------------------
; it is CAPS LOCK correct processing for chars
; CAPS LOCK correct processing for chars
test [shi], 0x00000040 ; CAPS LOCK is on?
jz .no_caps_lock
cmp ecx,1
@ -81,13 +81,11 @@ key:
jnz .no_caps_lock
dec ecx
.no_caps_lock:
;--------------------------------------
; alt gr pressed?
test [shi], 0x00000020
jz .no_alt_gr
mov ecx, 3
.no_alt_gr:
;--------------------------------------
push eax
mcall 26,2,,key1
pop eax
@ -164,9 +162,9 @@ key:
mov eax,1
jmp key.tab.direct
;-----------------------------------------------------------------------------
proc key.ctrl_a ;///// SELECT ALL DOCUMENT ///////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.ctrl_a ;///// SELECT ALL DOCUMENT /////////////////////
;---------------------------------------------------------------
xor eax,eax
mov [cur_editor.SelStart.X],eax
mov [cur_editor.SelStart.Y],eax
@ -180,9 +178,9 @@ proc key.ctrl_a ;///// SELECT ALL DOCUMENT ///////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.ctrl_o ;///// ENTER OPEN FILENAME ///////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.ctrl_o ;///// ENTER OPEN FILENAME /////////////////////
;---------------------------------------------------------------
mov [bot_mode2],0
.direct:
@ -207,9 +205,9 @@ proc key.ctrl_o ;///// ENTER OPEN FILENAME ///////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.ctrl_s ;///// ENTER SAVE FILENAME ///////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.ctrl_s ;///// ENTER SAVE FILENAME /////////////////////
;---------------------------------------------------------------
cmp [cur_editor.FilePath], 0
je key.shift_ctrl_s
cmp [cur_editor.Modified],0
@ -224,16 +222,16 @@ proc key.ctrl_s ;///// ENTER SAVE FILENAME ///////////////////////////////////
jmp key.ctrl_o.direct
endp
;-----------------------------------------------------------------------------
proc key.ctrl_n ;///// CREATE NEW FILE (TAB) /////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.ctrl_n ;///// CREATE NEW FILE (TAB) ///////////////////
;---------------------------------------------------------------
call create_tab
ret
endp
;-----------------------------------------------------------------------------
proc key.ctrl_f ;///// ENTER KEYWORD TO FIND /////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.ctrl_f ;///// ENTER KEYWORD TO FIND ///////////////////
;---------------------------------------------------------------
mov [bot_mode2],0
mov [bot_dlg_height],16*2+4*2-1
@ -260,42 +258,39 @@ proc key.ctrl_f ;///// ENTER KEYWORD TO FIND /////////////////////////////////
ret
endp
;---------------------------------------------------------------
proc key.ctrl_h
;---------------------------------------------------------------
mov [bot_mode2],1
mov [bot_dlg_height],16*3+4*2+1
mov [s_status],s_enter_text_to_replace
jmp key.ctrl_f.direct
endp
;---------------------------------------------------------------
proc key.ctrl_g
;---------------------------------------------------------------
ret
@^
mov [bot_mode2],0
mov [bot_dlg_height],16*2+4*2-1
mov [bot_mode],1
mov [bot_dlg_handler],gotodlg_handler
mov [focused_tb],tb_gotorow
mov al,[tb_gotorow.length]
mov [tb_gotorow.pos.x],al
mov [tb_gotorow.sel.x],0
mov [tb_casesen],0
call drawwindow
ret
^@
; mov [bot_mode2],0
; mov [bot_dlg_height],16*2+4*2-1
; mov [bot_mode],1
; mov [bot_dlg_handler],gotodlg_handler
; mov [focused_tb],tb_gotorow
; mov al,[tb_gotorow.length]
; mov [tb_gotorow.pos.x],al
; mov [tb_gotorow.sel.x],0
; mov [tb_casesen],0
; call drawwindow
; ret
endp
;-----------------------------------------------------------------------------
proc key.ctrl_left ;///// GO TO PREVIOUS WORD ////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.ctrl_left ;///// GO TO PREVIOUS WORD //////////////////
;---------------------------------------------------------------
call clear_selection
;-----------------------------------------------------------------------------
key.shift_ctrl_left: ;///// GO TO PREVIOUS WORD, WITH SELECTION /////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
key.shift_ctrl_left: ; GO TO PREVIOUS WORD, WITH SELECTION
;---------------------------------------------------------------
mov ebx,[cur_editor.Caret.Y]
mov edx,[cur_editor.Caret.X]
cld
@ -381,14 +376,13 @@ proc key.ctrl_left ;///// GO TO PREVIOUS WORD ////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.ctrl_right ;///// GO TO NEXT WORD ///////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.ctrl_right ;///// GO TO NEXT WORD /////////////////////
;---------------------------------------------------------------
call clear_selection
;-----------------------------------------------------------------------------
key.shift_ctrl_right: ;///// GO TO NEXT WORD, WITH SELECTION ////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
key.shift_ctrl_right: ;/ GO TO NEXT WORD, WITH SELECTION //
;---------------------------------------------------------------
mov ebx,[cur_editor.Caret.Y]
mov edx,[cur_editor.Caret.X]
cld
@ -470,8 +464,9 @@ proc key.ctrl_right ;///// GO TO NEXT WORD ///////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.ctrl_x
;---------------------------------------------------------------
proc key.ctrl_x ;///// CUT /////////////////////////////////////
;---------------------------------------------------------------
cmp [sel.selected],0
je @f
call key.ctrl_c
@ -480,8 +475,9 @@ proc key.ctrl_x
@@: ret
endp
;-----------------------------------------------------------------------------
proc key.ctrl_c
;---------------------------------------------------------------
proc key.ctrl_c ;///// COPY ////////////////////////////////////
;---------------------------------------------------------------
mov [copy_size],0
cmp [sel.selected],0
je .exit
@ -582,8 +578,9 @@ proc key.ctrl_c
jmp @b
endp
;-----------------------------------------------------------------------------
proc key.ctrl_v
;---------------------------------------------------------------
proc key.ctrl_v ;///// PASTE ///////////////////////////////////
;---------------------------------------------------------------
cmp [replace_mode],0
jne @f
call get_from_clipboard
@ -690,9 +687,9 @@ proc key.ctrl_v
pop eax
ret
endp
;-----------------------------------------------------------------------------
proc key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.ctrl_d ;///// INSERT SEPARATOR ////////////////////////
;---------------------------------------------------------------
mov eax,90+sizeof.EDITOR_LINE_DATA
call editor_realloc_lines
@ -729,9 +726,9 @@ proc key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.ctrl_y ;///// DELETE CURRENT LINE ///////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.ctrl_y ;///// DELETE CURRENT LINE /////////////////////
;---------------------------------------------------------------
mov eax,[cur_editor.Caret.Y]
inc eax
cmp eax,[cur_editor.Lines.Count]
@ -766,14 +763,15 @@ proc key.ctrl_y ;///// DELETE CURRENT LINE ///////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.up ;///// GO TO PREVIOUS LINE ///////////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.up ;///// GO TO PREVIOUS LINE /////////////////////////
;---------------------------------------------------------------
call key.shift_up
jmp clear_selection
;-----------------------------------------------------------------------------
key.shift_up: ;///// GO TO PREVIOUS LINE, WITH SELECTION ////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
key.shift_up: ;/// GO TO PREVIOUS LINE, WITH SELECTION ////
;---------------------------------------------------------------
mov ecx,[cur_editor.Caret.Y]
dec ecx
js .exit
@ -787,14 +785,15 @@ proc key.up ;///// GO TO PREVIOUS LINE ///////////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.down ;///// GO TO NEXT LINE /////////////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.down ;///// GO TO NEXT LINE ///////////////////////////
;---------------------------------------------------------------
call key.shift_down
jmp clear_selection
;-----------------------------------------------------------------------------
key.shift_down: ;///// GO TO NEXT LINE, WITH SELECTION //////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
key.shift_down: ;//// GO TO NEXT LINE, WITH SELECTION /////
;---------------------------------------------------------------
mov ecx,[cur_editor.Caret.Y]
inc ecx
cmp [cur_editor.Lines.Count],ecx
@ -809,14 +808,15 @@ proc key.down ;///// GO TO NEXT LINE /////////////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.left ;///// GO TO PREVIOUS CHAR /////////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.left ;///// GO TO PREVIOUS CHAR ///////////////////////
;---------------------------------------------------------------
call key.shift_left
jmp clear_selection
;-----------------------------------------------------------------------------
key.shift_left: ;///// GO TO PREVIOUS CHAR, WITH SELECTION //////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
key.shift_left: ;// GO TO PREVIOUS CHAR, WITH SELECTION ///
;---------------------------------------------------------------
mov eax,[cur_editor.Caret.X]
dec eax
jns @f
@ -832,14 +832,15 @@ proc key.left ;///// GO TO PREVIOUS CHAR /////////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.right ;///// GO TO NEXT CHAR ////////////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.right ;///// GO TO NEXT CHAR //////////////////////////
;---------------------------------------------------------------
call key.shift_right
jmp clear_selection
;-----------------------------------------------------------------------------
key.shift_right: ;///// GO TO NEXT CHAR, WITH SELECTION /////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
key.shift_right: ;//// GO TO NEXT CHAR, WITH SELECTION ////
;---------------------------------------------------------------
mov ecx,[cur_editor.Caret.Y]
call get_line_offset
mov eax,[cur_editor.Caret.X]
@ -857,14 +858,13 @@ proc key.right ;///// GO TO NEXT CHAR ////////////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.pgup ;///// GO TO PREVIOUS PAGE /////////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.pgup ;///// GO TO PREVIOUS PAGE ///////////////////////
;---------------------------------------------------------------
call clear_selection
;-----------------------------------------------------------------------------
key.shift_pgup: ;///// GO TO PREVIOUS PAGE, WITH SELECTION //////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
key.shift_pgup: ;// GO TO PREVIOUS PAGE, WITH SELECTION ///
;---------------------------------------------------------------
mov edx,[lines.scr]
dec edx
mov eax,[cur_editor.Caret.Y]
@ -885,14 +885,13 @@ proc key.pgup ;///// GO TO PREVIOUS PAGE /////////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.pgdn ;///// GO TO NEXT PAGE /////////////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.pgdn ;///// GO TO NEXT PAGE ///////////////////////////
;---------------------------------------------------------------
call clear_selection
;-----------------------------------------------------------------------------
key.shift_pgdn: ;///// GO TO NEXT PAGE, WITH SELECTION //////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
key.shift_pgdn: ;//// GO TO NEXT PAGE, WITH SELECTION /////
;---------------------------------------------------------------
mov edx,[lines.scr]
dec edx
mov eax,[cur_editor.Caret.Y]
@ -913,14 +912,13 @@ proc key.pgdn ;///// GO TO NEXT PAGE /////////////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.home ;///// GO TO LINE START ////////////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.home ;///// GO TO LINE START //////////////////////////
;---------------------------------------------------------------
call clear_selection
;-----------------------------------------------------------------------------
key.shift_home: ;///// GO TO LINE START, WITH SELECTION /////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
key.shift_home: ;//// GO TO LINE START, WITH SELECTION ////
;---------------------------------------------------------------
mov [cur_editor.Caret.X],0
test [chr],KM_SHIFT
jnz @f
@ -931,14 +929,13 @@ proc key.home ;///// GO TO LINE START ////////////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.end ;///// GO TO LINE END ///////////////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.end ;///// GO TO LINE END /////////////////////////////
;---------------------------------------------------------------
call clear_selection
;-----------------------------------------------------------------------------
key.shift_end: ;///// GO TO LINE END, WITH SELECTION ////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
key.shift_end: ;///// GO TO LINE END, WITH SELECTION //////
;---------------------------------------------------------------
mov ecx,[cur_editor.Caret.Y]
call get_line_offset
call get_real_length
@ -952,14 +949,13 @@ proc key.end ;///// GO TO LINE END ///////////////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.ctrl_home ;///// GO TO PAGE START ///////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.ctrl_home ;///// GO TO PAGE START /////////////////////
;---------------------------------------------------------------
call clear_selection
;-----------------------------------------------------------------------------
key.shift_ctrl_home: ;///// GO TO PAGE START, WITH SELECTION ////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
key.shift_ctrl_home: ;/ GO TO PAGE START, WITH SELECTION //
;---------------------------------------------------------------
mov eax,[cur_editor.TopLeft.Y]
mov ecx,eax
test [chr],KM_SHIFT
@ -972,14 +968,13 @@ proc key.ctrl_home ;///// GO TO PAGE START ///////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.ctrl_end ;///// GO TO PAGE END //////////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.ctrl_end ;///// GO TO PAGE END ////////////////////////
;---------------------------------------------------------------
call clear_selection
;-----------------------------------------------------------------------------
key.shift_ctrl_end: ;///// GO TO PAGE END, WITH SELECTION ///////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
key.shift_ctrl_end: ;/// GO TO PAGE END, WITH SELECTION ///
;---------------------------------------------------------------
mov ecx,[cur_editor.TopLeft.Y]
mov eax,[lines.scr]
cmp eax,[cur_editor.Lines.Count]
@ -997,14 +992,13 @@ proc key.ctrl_end ;///// GO TO PAGE END //////////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.ctrl_pgup ;///// GO TO DOCUMENT START ///////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.ctrl_pgup ;///// GO TO DOCUMENT START /////////////////
;---------------------------------------------------------------
call clear_selection
;-----------------------------------------------------------------------------
key.shift_ctrl_pgup: ;///// GO TO DOCUMENT START, WITH SELECTION ////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
key.shift_ctrl_pgup: ; GO TO DOCUMENT START, WITH SELECTION
;---------------------------------------------------------------
xor eax,eax
mov [cur_editor.TopLeft.Y],eax
mov [cur_editor.Caret.Y],eax
@ -1017,14 +1011,13 @@ proc key.ctrl_pgup ;///// GO TO DOCUMENT START ///////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.ctrl_pgdn ;///// GO TO DOCUMENT END /////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.ctrl_pgdn ;///// GO TO DOCUMENT END ///////////////////
;---------------------------------------------------------------
call clear_selection
;-----------------------------------------------------------------------------
key.shift_ctrl_pgdn: ;///// GO TO DOCUMENT END, WITH SELECTION //////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
key.shift_ctrl_pgdn: ; GO TO DOCUMENT END, WITH SELECTION /
;---------------------------------------------------------------
mov eax,[cur_editor.Lines.Count]
mov [cur_editor.Caret.Y],eax
sub eax,[lines.scr]
@ -1041,9 +1034,9 @@ proc key.ctrl_pgdn ;///// GO TO DOCUMENT END /////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.del ;///// DELETE NEXT CHAR OR SELECTION //////////////
;---------------------------------------------------------------
call delete_selection
jnc .exit
@ -1182,9 +1175,9 @@ proc key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.ins ;///// TOGGLE INSERT/OVERWRITE MODE /////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.ins ;///// TOGGLE INSERT/OVERWRITE MODE ///////////////
;---------------------------------------------------------------
xor [ins_mode],1
mov eax,[cur_editor.Caret.Y]
mov ebx,eax
@ -1193,9 +1186,9 @@ proc key.ins ;///// TOGGLE INSERT/OVERWRITE MODE /////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION ////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION //////
;---------------------------------------------------------------
call delete_selection
jnc key.del.exit
@ -1256,9 +1249,9 @@ proc key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION ////////////////////
jmp key.del.line_up
endp
;-----------------------------------------------------------------------------
proc key.tab ;///// TABULATE /////////////////////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.tab ;///// TABULATE ///////////////////////////////////
;---------------------------------------------------------------
call delete_selection
mov eax,[cur_editor.Caret.X]
@ -1341,9 +1334,9 @@ proc key.tab ;///// TABULATE /////////////////////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.return ;///// CARRIAGE RETURN /////////////////////////
;---------------------------------------------------------------
call delete_selection
; unknown how many times the user wants to press "Enter",
; so you should do a little more value
@ -1478,9 +1471,9 @@ proc key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.ctrl_tab ;///// SWITCH TO NEXT TAB //////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.ctrl_tab ;///// SWITCH TO NEXT TAB ////////////////////
;---------------------------------------------------------------
cmp [tab_bar.Items.Count],1
je .exit
xor eax,eax
@ -1505,9 +1498,9 @@ proc key.ctrl_tab ;///// SWITCH TO NEXT TAB //////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.shift_ctrl_tab ;///// SWITCH TO PREVIOUS TAB ////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.shift_ctrl_tab ;///// SWITCH TO PREVIOUS TAB //////////
;---------------------------------------------------------------
cmp [tab_bar.Items.Count],1
je .exit
xor eax,eax
@ -1533,9 +1526,9 @@ proc key.shift_ctrl_tab ;///// SWITCH TO PREVIOUS TAB ////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.ctrl_f4 ;///// CLOSE CURRENT TAB ////////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.ctrl_f4 ;///// CLOSE CURRENT TAB //////////////////////
;---------------------------------------------------------------
cmp [cur_editor.Modified],0
je .close
mov [bot_mode2],2
@ -1557,9 +1550,9 @@ proc key.ctrl_f4 ;///// CLOSE CURRENT TAB ////////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.shift_f9 ;///// SET DEFAULT TAB /////////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.shift_f9 ;///// SET DEFAULT TAB ///////////////////////
;---------------------------------------------------------------
mov eax,[tab_bar.Current.Ptr]
cmp eax,[tab_bar.Default.Ptr]
jne @f
@ -1575,36 +1568,36 @@ proc key.shift_f9 ;///// SET DEFAULT TAB /////////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc key.f3 ;///// FIND NEXT MATCH ///////////////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.f3 ;///// FIND NEXT MATCH /////////////////////////////
;---------------------------------------------------------------
jmp search
endp
;-----------------------------------------------------------------------------
proc key.ctrl_f9 ;///// COMPILE //////////////////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.ctrl_f9 ;///// COMPILE ////////////////////////////////
;---------------------------------------------------------------
mov bl,0
jmp start_fasm
endp
;-----------------------------------------------------------------------------
proc key.f9 ;///// COMPILE AND RUN ///////////////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.f9 ;///// COMPILE AND RUN /////////////////////////////
;---------------------------------------------------------------
mov bl,1
jmp start_fasm
endp
;-----------------------------------------------------------------------------
proc key.f10 ;///// COMPILE AND RUN UNDER DEBUG //////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.f10 ;///// COMPILE AND RUN UNDER DEBUG ////////////////
;---------------------------------------------------------------
mov bl,2
jmp start_fasm
endp
;-----------------------------------------------------------------------------
proc key.alt_x ;///// EXIT PROGRAM ///////////////////////////////////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.alt_x ;///// EXIT PROGRAM /////////////////////////////
;---------------------------------------------------------------
mov [main_closing],1
mov eax,[tab_bar.Items]
mov [exit_tab_item],eax
@ -1624,9 +1617,33 @@ proc key.alt_x ;///// EXIT PROGRAM ///////////////////////////////////////////
mcall -1
endp
;-----------------------------------------------------------------------------
proc try_to_close_tabs ;///// FIND TABS TO BE SAVED BEFORE CLOSE /////////////
;-----------------------------------------------------------------------------
;---------------------------------------------------------------
proc key.ctrl_plus ;///// ZOOM IN //////////////////////////////
;---------------------------------------------------------------
cmp [scale],7
jz @f
inc [scale]
add [lineHeight],LINEH
add [charWidth],6
jmp draw_editor
endp
;---------------------------------------------------------------
proc key.ctrl_minus ;///// ZOOM OUT ////////////////////////////
;---------------------------------------------------------------
cmp [scale],0
jz @f
dec [scale]
sub [lineHeight],LINEH
sub [charWidth],6
jmp draw_editor
@@:
ret
endp
;---------------------------------------------------------------
proc try_to_close_tabs ;// FIND TABS TO BE SAVED BEFORE CLOSE //
;---------------------------------------------------------------
push ecx ebp
call flush_cur_tab
mov ebp,[exit_tab_item] ; [tab_bar.Items]

View File

@ -12,7 +12,8 @@ proc check_mouse_in_edit_area
sub [__rc+0x8],SCRLW+6
mov ecx,[cur_editor.Gutter.Width]
add [__rc+0x0],ecx
imul ecx,[lines.scr],LINEH
mov ecx,[lines.scr]
imul ecx,[lineHeight]
dec ecx
add [__rc+0xC],ecx
mov ecx,__rc
@ -188,13 +189,13 @@ mouse:
push eax
mov eax,ebx
cdq
mov ecx,LINEH
mov ecx,[lineHeight]
idiv ecx
@@: add eax,[cur_editor.TopLeft.Y]
mov ebx,eax
pop eax
cdq
mov ecx,6
mov ecx,[charWidth]
idiv ecx
@@: add eax,[cur_editor.TopLeft.X]
mov ecx, ebx