forked from KolibriOS/kolibrios
Tinypad from 0.6.0.0
git-svn-id: svn://kolibrios.org@178 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
5a16823ef7
commit
95366971d1
@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm tinypad.asm tinypad
|
||||
@erase lang.inc
|
||||
@pause
|
@ -1,4 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm tinypad.asm tinypad
|
||||
@erase lang.inc
|
||||
@pause
|
@ -1,6 +1,3 @@
|
||||
; language for programs
|
||||
lang fix en ; ru en fr ge fi
|
||||
|
||||
@^ fix macro comment {
|
||||
^@ fix }
|
||||
|
||||
@ -331,21 +328,34 @@ struc POINT _t,_dx,_dy {
|
||||
; structure definition helper
|
||||
include 'struct.inc'
|
||||
|
||||
struct RECT
|
||||
left dd ?
|
||||
top dd ?
|
||||
right dd ?
|
||||
bottom dd ?
|
||||
ends
|
||||
|
||||
struct BOX
|
||||
left dd ?
|
||||
top dd ?
|
||||
width dd ?
|
||||
height dd ?
|
||||
ends
|
||||
|
||||
; structures used in MeOS
|
||||
struct process_information
|
||||
cpu_usage dd ? ; +0
|
||||
window_stack_position dw ? ; +4
|
||||
window_stack_value dw ? ; +6
|
||||
not_used1 dw ? ; +8
|
||||
dw ? ; +8
|
||||
process_name rb 12 ; +10
|
||||
memory_start dd ? ; +22
|
||||
used_memory dd ? ; +26
|
||||
PID dd ? ; +30
|
||||
x_start dd ? ; +34
|
||||
y_start dd ? ; +38
|
||||
x_size dd ? ; +42
|
||||
y_size dd ? ; +46
|
||||
box BOX ; +34
|
||||
slot_state dw ? ; +50
|
||||
dw ? ; +52
|
||||
client_box BOX ; +54
|
||||
rb (1024-52)
|
||||
ends
|
||||
|
||||
|
@ -1,22 +1,46 @@
|
||||
;-----------------------------------------------------------------------------
|
||||
; project name: TINYPAD
|
||||
; compiler: flat assembler 1.64
|
||||
; memory to compile: 3.0/11.5 MBytes (without/with size optimizations)
|
||||
; version: 4.0
|
||||
; last update: 2006-04-13 (Apr 13, 2006)
|
||||
; compiler: flat assembler 1.67.1
|
||||
; memory to compile: 2.0/7.0 MBytes (without/with size optimizations)
|
||||
; version: 4.0.3
|
||||
; last update: 2006-08-28 (Aug 28, 2006)
|
||||
; minimal kernel: revision #138 (svn://kolibrios.org/kernel)
|
||||
;-----------------------------------------------------------------------------
|
||||
; originally by: Ville Michael Turjanmaa >> villemt@aton.co.jyu.fi
|
||||
; maintained by: Ivan Poddubny >> ivan-yar@bk.ru
|
||||
; Mike Semenyako >> mike.dld@gmail.com
|
||||
;-----------------------------------------------------------------------------
|
||||
; TODO:
|
||||
; optimize drawing (reduce flickering);
|
||||
; optimize memory usage (allocate only needed amount, not static 3 Mbytes);
|
||||
; add block selection ability, undo action;
|
||||
; working with multiple files (add tabs);
|
||||
; other bugfixes and speed/size optimizations
|
||||
; - optimize drawing (reduce flickering)
|
||||
; - optimize memory usage (allocate only needed amount, not static 3 Mbytes)
|
||||
; - add block selection ability, undo action, goto position
|
||||
; - working with multiple files (add tabs)
|
||||
; - improve window drawing with small dimensions
|
||||
; - other bugfixes and speed/size optimizations
|
||||
;
|
||||
; HISTORY:
|
||||
; 4.0.3 (mike.dld)
|
||||
; bug-fixes:
|
||||
; - 1-char selection if pressing <BS> out of real line length
|
||||
; - fault in `writepos`, added call to function 9
|
||||
; - main menu items weren't highlighted if popup opened and cursor
|
||||
; isn't in menu item's area
|
||||
; - statusbar and textboxes drawing fixes (wrong colors)
|
||||
; - perform no redraw while pressing Shift, Ctrl, Alt keys
|
||||
; - data length from DOCPAK in string representation (fix by diamond)
|
||||
; changes:
|
||||
; - function 70 instead of 58 for files loading/saving
|
||||
; - clientarea-relative drawing (less code)
|
||||
; - every line's dword is now splitted into 2 words;
|
||||
; low word - line block length, so max line length is 65535 now
|
||||
; high word - various flags. for now, only 2 of 16 bits are used:
|
||||
; if bit #0 is set, line was modified since file open
|
||||
; if bit #1 is set, line was saved after last modification
|
||||
; high word could also be further used for code collapsing and different
|
||||
; line marking features (breakpoints, errors, bookmarks, etc.)
|
||||
; new features:
|
||||
; - line markers for modified and saved lines
|
||||
; - status messages for various actions
|
||||
; 4.0.2 (mike.dld)
|
||||
; bug-fixes:
|
||||
; - program terminates if started with parameters (fine for DOCPAK)
|
||||
@ -68,7 +92,7 @@
|
||||
; 3.77 (mike.dld)
|
||||
; changed save_string to collapse SPACEs into TABs;
|
||||
; rewrote drawfile from scratch (speed++)
|
||||
; through some drawing improvements still needed
|
||||
; through some drawing improvements needed
|
||||
; (some checkups to reduce flickering);
|
||||
; writepos (size--);
|
||||
; fixed drawing window while height < 100px, and for non-asm files;
|
||||
@ -110,9 +134,11 @@
|
||||
; copy/paste area 0x2f0000 +
|
||||
;-----------------------------------------------------------------------------
|
||||
|
||||
include 'lang.inc'
|
||||
include 'macros.inc' ; useful stuff
|
||||
;include 'proc32.inc'
|
||||
include 'tinypad.inc'
|
||||
purge mov,add,sub ; SPEED
|
||||
;purge mov,add,sub ; SPEED
|
||||
|
||||
header '01',1,@CODE,TINYPAD_END,AREA_ENDMEM,MAIN_STACK,@PARAMS,self_path
|
||||
|
||||
@ -126,6 +152,7 @@ ATABW = 8 ; tab width (chars)
|
||||
LINEH = 10 ; line height (pixels)
|
||||
PATHL = 255 ; maximum path length (chars) !!! don't change !!!
|
||||
AMINS = 8 ; minimal scroll thumb size (pixels)
|
||||
LCHGW = 2 ; changed/saved marker width
|
||||
|
||||
STATH = 14 ; status bar height
|
||||
|
||||
@ -148,6 +175,8 @@ label color_tbl dword
|
||||
RGB(255,255,255) ; RGB(224,224,224) ; RGB(255,255,255) ; background
|
||||
RGB(255,255,255) ; RGB(255,255,255) ; RGB(255,255,255) ; selection text
|
||||
RGB( 10, 36,106) ; RGB( 0, 0,128) ; RGB( 0, 64,128) ; selection background
|
||||
RGB( 0,255, 0) ; modified line marker
|
||||
RGB(255,255, 0) ; saved line marker
|
||||
|
||||
ins_mode db 1
|
||||
|
||||
@ -165,22 +194,30 @@ section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
|
||||
; fninit
|
||||
|
||||
; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_left,50
|
||||
; mov [mainwnd_pos.x],eax
|
||||
; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_top,50
|
||||
; mov [mainwnd_pos.y],eax
|
||||
; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_right,350
|
||||
; sub eax,[mainwnd_pos.x]
|
||||
; mov [mainwnd_pos.w],eax
|
||||
; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_bottom,450
|
||||
; sub eax,[mainwnd_pos.y]
|
||||
; mov [mainwnd_pos.h],eax
|
||||
|
||||
cld
|
||||
mov edi,@UDATA
|
||||
mov ecx,@PARAMS-@UDATA
|
||||
mov al,0
|
||||
rep stosb
|
||||
|
||||
inc [do_not_draw]
|
||||
|
||||
mov [left_ofs],40+1
|
||||
mov [f_info+4],0
|
||||
mov [f_info+12],AREA_TEMP
|
||||
mov [f_info+16],AREA_EDIT-AREA_TEMP
|
||||
|
||||
; mov esi,s_example
|
||||
; mov edi,s_fname
|
||||
; mov ecx,s_example.size
|
||||
; mov [s_fname.size],ecx
|
||||
; rep movsb
|
||||
mov esi,s_example
|
||||
mov edi,tb_opensave.text
|
||||
mov ecx,s_example.size
|
||||
@ -200,18 +237,21 @@ section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
|
||||
cmp byte[@PARAMS],'*'
|
||||
jne .noipc
|
||||
; convert size from decimal representation to dword
|
||||
mov esi, @PARAMS+1
|
||||
xor edx, edx
|
||||
xor eax, eax
|
||||
@@:
|
||||
lodsb
|
||||
test al, al
|
||||
|
||||
;// diamond [ (convert size from decimal representation to dword)
|
||||
;-- mov edx,dword[@PARAMS+1]
|
||||
mov esi,@PARAMS+1
|
||||
xor edx,edx
|
||||
xor eax,eax
|
||||
@@: lodsb
|
||||
test al,al
|
||||
jz @f
|
||||
lea edx, [edx*4+edx]
|
||||
lea edx, [edx*2+eax]
|
||||
lea edx,[edx*4+edx]
|
||||
lea edx,[edx*2+eax-'0']
|
||||
jmp @b
|
||||
@@:
|
||||
@@:
|
||||
;// diamond ]
|
||||
|
||||
add edx,20
|
||||
mcall 60,1,AREA_TEMP-16 ; 0x10000-16
|
||||
mov dword[AREA_TEMP-16+4],8 ; [0x10000-16+4],8
|
||||
@ -225,8 +265,6 @@ section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
inc eax
|
||||
call load_file.file_found
|
||||
jmp @f
|
||||
; call file_found ; çàãðóçêà ôàéëà
|
||||
; jmp do_load_file.restorecursor ; îòîáðàæåíèå
|
||||
.noipc:
|
||||
|
||||
;// Willow's code to support DOCPAK ]
|
||||
@ -250,9 +288,12 @@ section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
call new_file
|
||||
|
||||
@@:
|
||||
call drawwindow
|
||||
dec [do_not_draw]
|
||||
mcall 66,1,1
|
||||
mcall 40,00100111b
|
||||
red:
|
||||
call drawwindow
|
||||
call check_inv_all.skip_check
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
|
||||
@ -274,14 +315,6 @@ still:
|
||||
|
||||
jmp still.skip_write
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func red ;///// window redraw ////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
call drawwindow
|
||||
call check_inv_all.skip_check
|
||||
jmp still
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func start_fasm ;/////////////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
@ -362,53 +395,60 @@ func start_fasm ;/////////////////////////////////////////////////////////////
|
||||
je @f
|
||||
mov dword[edi-1],',run'
|
||||
mov byte[edi+3],0
|
||||
@@: mcall 19,fasm_filename,fasm_parameters
|
||||
@@:
|
||||
mov ebx, fasm_start
|
||||
start_ret:
|
||||
mov eax, 70
|
||||
int 0x40
|
||||
ret
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func open_debug_board ;///////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
mcall 19,debug_filename,0
|
||||
ret
|
||||
mov ebx, board_start
|
||||
jmp start_ret
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func open_sysfuncs_txt ;//////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
mcall 19,docpak_filename,sysfuncs_param
|
||||
mov ebx, docpak_start
|
||||
call start_ret
|
||||
cmp eax,0xfffffff0
|
||||
jb @f
|
||||
mcall 19,tinypad_filename,sysfuncs_filename
|
||||
mov ebx, tinypad_start
|
||||
mov dword [ebx+8], sysfuncs_filename
|
||||
call start_ret
|
||||
@@: ret
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func layout ;///// change keyboard layout ///////////////////////////////////
|
||||
;func layout ;///// change keyboard layout ///////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
mcall 19,setup,param_setup
|
||||
mcall 5,eax
|
||||
; call activate_me
|
||||
; ret
|
||||
; mcall 19,setup,param_setup
|
||||
; mcall 5,eax
|
||||
;; call activate_me
|
||||
;; ret
|
||||
;;endf
|
||||
|
||||
;;func activate_me
|
||||
; mcall 9,p_info,-1
|
||||
; inc eax
|
||||
; inc eax
|
||||
; mov ecx,eax
|
||||
; mov edi,[p_info.PID]
|
||||
; mov ebx,p_info
|
||||
; @@: dec ecx
|
||||
; jz @f ; counter=0 => not found? => return
|
||||
; mcall 9
|
||||
; cmp edi,[p_info.PID]
|
||||
; jne @b
|
||||
; mcall 18,3
|
||||
; mcall 5,eax
|
||||
; @@: ret
|
||||
;endf
|
||||
|
||||
;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
|
||||
|
||||
func set_opt
|
||||
test [options],al
|
||||
je @f
|
||||
@ -453,16 +493,16 @@ endf
|
||||
|
||||
include 'tp-draw.asm'
|
||||
include 'tp-key.asm'
|
||||
;include 'tp-key2.asm'
|
||||
include 'tp-butto.asm'
|
||||
include 'tp-mouse.asm'
|
||||
include 'tp-files.asm'
|
||||
include 'tp-commo.asm'
|
||||
include 'tp-dialo.asm'
|
||||
;include 'tp-find.asm'
|
||||
include 'tp-popup.asm'
|
||||
include 'tp-tbox.asm'
|
||||
|
||||
;include 'lib-ini.asm'
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
section @DATA ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
;-----------------------------------------------------------------------------
|
||||
@ -593,15 +633,42 @@ add_table:
|
||||
|
||||
;error_beep db 0xA0,0x30,0
|
||||
|
||||
s_status dd 0
|
||||
|
||||
sz s_example,'EXAMPLE.ASM'
|
||||
sz s_still ,'still'
|
||||
|
||||
;sz param_setup,'LANG',0 ; parameter for SETUP
|
||||
|
||||
sz fasm_filename ,'FASM '
|
||||
sz debug_filename ,'BOARD '
|
||||
sz tinypad_filename,'TINYPAD '
|
||||
sz docpak_filename ,'DOCPAK '
|
||||
fasm_start:
|
||||
dd 7
|
||||
dd 0
|
||||
dd fasm_parameters
|
||||
dd 0
|
||||
dd 0
|
||||
db '/RD/1/FASM',0
|
||||
board_start:
|
||||
dd 7
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
db '/RD/1/BOARD',0
|
||||
tinypad_start:
|
||||
dd 7
|
||||
dd 0
|
||||
dd ?
|
||||
dd 0
|
||||
dd 0
|
||||
db '/RD/1/TINYPAD',0
|
||||
docpak_start:
|
||||
dd 7
|
||||
dd 0
|
||||
dd sysfuncs_param
|
||||
dd 0
|
||||
dd 0
|
||||
db '/RD/1/DOCPAK',0
|
||||
|
||||
;sz setup ,'SETUP ' ; to change keyboard layout
|
||||
|
||||
sz sysfuncs_param,'g',0
|
||||
@ -610,7 +677,7 @@ lsz sysfuncs_filename,\
|
||||
ru,<'SYSFUNCR.TXT',0>,\
|
||||
en,<'SYSFUNCS.TXT',0>
|
||||
|
||||
sz htext,'TINYPAD'
|
||||
sz htext,'TINYPAD 4.0.3'
|
||||
|
||||
lszc help_text,b,\
|
||||
ru,'ŠŽŒ€<C592>„›:',\
|
||||
@ -662,19 +729,19 @@ menubar_res main_menu,\
|
||||
en,'Options',popup_options,onshow.options
|
||||
|
||||
popup_res popup_file,\
|
||||
ru,'<27>®¢ë©' ,'Ctrl+N',key.ctrl_n ,\
|
||||
ru,'Žâªàëâì...' ,'Ctrl+O',key.ctrl_o ,\
|
||||
ru,'‘®åà ¨âì' ,'Ctrl+S',key.ctrl_s ,\
|
||||
ru,'‘®åà ¨âì ª ª...','' ,key.shift_ctrl_s,\
|
||||
ru,'-' ,'' ,0 ,\
|
||||
ru,'‚ë室' ,'Alt+X' ,key.alt_x ,\
|
||||
ru,'<27>®¢ë©' ,'Ctrl+N' ,key.ctrl_n ,\
|
||||
ru,'Žâªàëâì...' ,'Ctrl+O' ,key.ctrl_o ,\
|
||||
ru,'‘®åà ¨âì' ,'Ctrl+S' ,key.ctrl_s ,\
|
||||
ru,'‘®åà ¨âì ª ª...','Ctrl+Shift+S',key.shift_ctrl_s,\
|
||||
ru,'-' ,'' ,0 ,\
|
||||
ru,'‚ë室' ,'Alt+X' ,key.alt_x ,\
|
||||
\
|
||||
en,'New' ,'Ctrl+N',key.ctrl_n ,\
|
||||
en,'Open...' ,'Ctrl+O',key.ctrl_o ,\
|
||||
en,'Save' ,'Ctrl+S',key.ctrl_s ,\
|
||||
en,'Save as...','' ,key.shift_ctrl_s,\
|
||||
en,'-' ,'' ,0 ,\
|
||||
en,'Exit' ,'Alt+X' ,key.alt_x
|
||||
en,'New' ,'Ctrl+N' ,key.ctrl_n ,\
|
||||
en,'Open...' ,'Ctrl+O' ,key.ctrl_o ,\
|
||||
en,'Save' ,'Ctrl+S' ,key.ctrl_s ,\
|
||||
en,'Save as...','Ctrl+Shift+S',key.shift_ctrl_s,\
|
||||
en,'-' ,'' ,0 ,\
|
||||
en,'Exit' ,'Alt+X' ,key.alt_x
|
||||
|
||||
popup_res popup_edit,\
|
||||
ru,'‚ë१ âì' ,'Ctrl+X',key.ctrl_x,\
|
||||
@ -683,13 +750,17 @@ popup_res popup_edit,\
|
||||
ru,'“¤ «¨âì' ,'' ,key.del ,\
|
||||
ru,'-' ,'' ,0 ,\
|
||||
ru,'‚뤥«¨âì ¢áñ','Ctrl+A',key.ctrl_a,\
|
||||
\; ru,'-' ,'' ,0 ,\
|
||||
\; ru,'‚¥à⨪ «ì®¥ ¢ë¤¥«¥¨¥','Alt+Ins',0 ,\
|
||||
\
|
||||
en,'Cut' ,'Ctrl+X',key.ctrl_x,\
|
||||
en,'Copy' ,'Ctrl+C',key.ctrl_c,\
|
||||
en,'Paste' ,'Ctrl+V',key.ctrl_v,\
|
||||
en,'Delete' ,'' ,key.del ,\
|
||||
en,'-' ,'' ,0 ,\
|
||||
en,'Select all','Ctrl+A',key.ctrl_a
|
||||
en,'Select all','Ctrl+A',key.ctrl_a;,\
|
||||
; en,'-' ,'' ,0 ,\
|
||||
; en,'Vertical selection','Alt+Ins',0
|
||||
|
||||
popup_res popup_search,\
|
||||
ru,'<27>¥à¥©â¨...' ,'Ctrl+G',key.ctrl_g,\
|
||||
@ -763,9 +834,61 @@ lsz s_2cancel,\
|
||||
ru,'Žâ¬¥ ',\
|
||||
en,'Cancel'
|
||||
|
||||
lsz s_enter_filename,\
|
||||
ru,<'‚¢¥¤¨â¥ ¨¬ï ä ©« ',0>,\
|
||||
en,<'Enter filename',0>
|
||||
|
||||
lsz s_enter_text_to_find,\
|
||||
ru,<'‚¢¥¤¨â¥ ⥪áâ ¤«ï ¯®¨áª ',0>,\
|
||||
en,<'Enter text to find',0>
|
||||
|
||||
lsz s_enter_text_to_replace,\
|
||||
ru,<'‚¢¥¤¨â¥ ⥪áâ ¤«ï § ¬¥ë',0>,\
|
||||
en,<'Enter text to replace',0>
|
||||
|
||||
lsz s_text_not_found,\
|
||||
ru,<'„®á⨣ãâ ª®¥æ ä ©« , ⥪áâ ¥ ©¤¥',0>,\
|
||||
en,<'Reached end of file, text not found',0>
|
||||
|
||||
lszc s_fs_error,b,\
|
||||
ru,<'Ž¯¥à æ¨ï § ¢¥àè¥ ãá¯¥è® (0)',0>,\
|
||||
ru,<'',0>,\
|
||||
ru,<'”ãªæ¨ï ¥ ¯®¤¤¥à¦¨¢ ¥âáï ¤«ï ¤ ®© ä ©«®¢®© á¨á⥬ë (2)',0>,\
|
||||
ru,<'<27>¥¨§¢¥áâ ï ä ©«®¢ ï á¨á⥬ (3)',0>,\
|
||||
ru,<'',0>,\
|
||||
ru,<'<27>¥¢®§¬®¦® ®âªàëâì ä ©« (5)',0>,\
|
||||
ru,<'Ž¯¥à æ¨ï § ¢¥àè¥ ãá¯¥è® (6)',0>,\
|
||||
ru,<'€¤à¥á 室¨âáï § £à ¨æ ¬¨ ¯ ¬ï⨠¯à®£à ¬¬ë (7)',0>,\
|
||||
ru,<'<27> ¤¨áª¥ ¥â ᢮¡®¤®£® ¬¥áâ (8)',0>,\
|
||||
ru,<'’ ¡«¨æ FAT ã¨ç⮦¥ (9)',0>,\
|
||||
ru,<'„®áâ㯠§ ¯à¥éñ (10)',0>,\
|
||||
ru,<'Žè¨¡ª ãáâனá⢠(11)',0>,\
|
||||
\
|
||||
en,<'Operation executed successfully (0)',0>,\
|
||||
en,<'',0>,\
|
||||
en,<'Function is not supported for the given filesystem (2)',0>,\
|
||||
en,<'Unknown filesystem (3)',0>,\
|
||||
en,<'',0>,\
|
||||
en,<'Unable to open file (5)',0>,\
|
||||
en,<'Operation executed successfully (6)',0>,\
|
||||
en,<'Pointer lies outside of application memory (7)',0>,\
|
||||
en,<'Disk is full (8)',0>,\
|
||||
en,<'FAT table is destroyed (9)',0>,\
|
||||
en,<'Access denied (10)',0>,\
|
||||
en,<'Device error (11)',0>
|
||||
|
||||
sz symbols_ex,';?.%"',"'"
|
||||
sz symbols ,'#&*\:/<>|{}()[]=+-, '
|
||||
|
||||
ini_sec_window db 'Window',0
|
||||
ini_window_top db 'Top',0
|
||||
ini_window_left db 'Left',0
|
||||
ini_window_right db 'Right',0
|
||||
ini_window_bottom db 'Bottom',0
|
||||
|
||||
finfo_ini dd ?,?,?,AREA_TEMP,AREA_EDIT-AREA_TEMP
|
||||
db '/rd/1/tinypad.ini',0
|
||||
|
||||
TINYPAD_END: ; end of file
|
||||
|
||||
self_path rb PATHL
|
||||
@ -774,6 +897,8 @@ self_path rb PATHL
|
||||
section @UDATA ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
;-----------------------------------------------------------------------------
|
||||
|
||||
f_info70 rd 7
|
||||
|
||||
f_info.length dd ?
|
||||
f_info dd ?,?,?,?,?;?,0,?,AREA_TEMP,AREA_EDIT-AREA_TEMP
|
||||
|
||||
@ -798,7 +923,7 @@ vscrl_top dd ?
|
||||
vscrl_size dd ?
|
||||
hscrl_top dd ?
|
||||
hscrl_size dd ?
|
||||
skinh dd ? ; skin height
|
||||
;skinh dd ? ; skin height
|
||||
__rc dd ?,?,?,?
|
||||
;filelen dd ? ; file size (on save) ???
|
||||
filesize dd ? ; file size (on load) ???
|
||||
|
288
programs/develop/tinypad/trunk/tinypad.inc
Normal file
288
programs/develop/tinypad/trunk/tinypad.inc
Normal file
@ -0,0 +1,288 @@
|
||||
virtual at -20
|
||||
POPUP:
|
||||
.actions dd ?
|
||||
.data dd ?
|
||||
.acc_ofs dd ?
|
||||
.size:
|
||||
.height dw ?
|
||||
.width dw ?
|
||||
.pos:
|
||||
.y dw ?
|
||||
.x dw ?
|
||||
end virtual
|
||||
|
||||
macro popup_res _name,[_lang,_title,_accel,_action]
|
||||
{
|
||||
common
|
||||
local s1,s2,m1,m2,c1,c2
|
||||
m1 = 0
|
||||
m2 = 0
|
||||
c1 = 0
|
||||
c2 = 0
|
||||
if used _name
|
||||
dd _name#.actions
|
||||
dd _name#.data
|
||||
dd ?
|
||||
dw ? ; height
|
||||
dw ? ; width
|
||||
dw ? ; y
|
||||
dw ? ; x
|
||||
_name:
|
||||
forward
|
||||
if (lang eq _lang)
|
||||
db 1
|
||||
end if
|
||||
common
|
||||
.data:
|
||||
forward
|
||||
if lang eq _lang
|
||||
if _title eq '-'
|
||||
db 1,'-'
|
||||
c2 = c2+1
|
||||
else
|
||||
virtual at 0
|
||||
db _title
|
||||
s1 = $
|
||||
end virtual
|
||||
if m1 < s1
|
||||
m1 = s1
|
||||
end if
|
||||
virtual at 0
|
||||
db _accel
|
||||
s2 = $
|
||||
end virtual
|
||||
if m2 < s2
|
||||
m2 = s2
|
||||
end if
|
||||
db s1,_title,s2,_accel
|
||||
c1 = c1+1
|
||||
end if
|
||||
end if
|
||||
common
|
||||
db 0
|
||||
align 4
|
||||
.actions:
|
||||
forward
|
||||
if lang eq _lang
|
||||
dd _action
|
||||
end if
|
||||
common
|
||||
.size = $-_name+20
|
||||
.max_title = m1
|
||||
.max_accel = m2
|
||||
.cnt_item = c1
|
||||
.cnt_sep = c2
|
||||
if (m2 = 0)
|
||||
m2 = -2
|
||||
end if
|
||||
store word (m1*6+m2*6+6*8) at _name+POPUP.width
|
||||
store word (c1*POP_IHEIGHT+c2*4+4) at _name+POPUP.height
|
||||
store dword (((m1+2)*6-1)*65536) at _name+POPUP.acc_ofs
|
||||
end if
|
||||
}
|
||||
|
||||
macro menubar_res _name,[_lang,_title,_popup,_onshow]
|
||||
{
|
||||
common
|
||||
local s,m,c,x
|
||||
m = 0
|
||||
c = 0
|
||||
x = 2
|
||||
if used _name
|
||||
_name:
|
||||
forward
|
||||
if lang eq _lang
|
||||
virtual at 0
|
||||
db _title
|
||||
s = $
|
||||
end virtual
|
||||
if m < s
|
||||
m = s
|
||||
end if
|
||||
dw (s+2)*6,x,ATOPH-1,0
|
||||
db s,_title
|
||||
c = c+1
|
||||
x = x + (s+2)*6
|
||||
end if
|
||||
common
|
||||
db 0
|
||||
align 4
|
||||
.popups:
|
||||
forward
|
||||
if lang eq _lang
|
||||
dd _popup
|
||||
end if
|
||||
common
|
||||
align 4
|
||||
.onshow:
|
||||
forward
|
||||
if lang eq _lang
|
||||
dd _onshow
|
||||
end if
|
||||
common
|
||||
.size = $-_name
|
||||
.max_title = m
|
||||
.cnt_item = c
|
||||
.width = x-7
|
||||
end if
|
||||
}
|
||||
|
||||
;// OPTIONS
|
||||
|
||||
OPTS_SECURESEL = 00000001b
|
||||
OPTS_AUTOBRACES = 00000010b
|
||||
OPTS_AUTOINDENT = 00000100b
|
||||
OPTS_SMARTTAB = 00001000b
|
||||
OPTS_OPTIMSAVE = 00010000b
|
||||
OPTS_LINENUMS = 00100000b
|
||||
|
||||
;// KEY MODIFIERS
|
||||
|
||||
KM_SHIFT = 0x00010000
|
||||
KM_CTRL = 0x00020000
|
||||
KM_ALT = 0x00040000
|
||||
|
||||
KM_CTRLSHIFT = 0x00030000
|
||||
KM_ALTSHIFT = 0x00050000
|
||||
KM_CTRLALT = 0x00060000
|
||||
|
||||
KM_CTRLALTSHIFT = 0x00070000
|
||||
|
||||
;// KEY CODES
|
||||
|
||||
KEY_ESCAPE = 0x00000001
|
||||
KEY_SNAPSHOT = 0x00000137
|
||||
KEY_PAUSE = 0x0000021D
|
||||
|
||||
KEY_F1 = 0x0000003B
|
||||
KEY_F2 = 0x0000003C
|
||||
KEY_F3 = 0x0000003D
|
||||
KEY_F4 = 0x0000003E
|
||||
KEY_F5 = 0x0000003F
|
||||
KEY_F6 = 0x00000040
|
||||
KEY_F7 = 0x00000041
|
||||
KEY_F8 = 0x00000042
|
||||
KEY_F9 = 0x00000043
|
||||
KEY_F10 = 0x00000044
|
||||
KEY_F11 = 0x00000057
|
||||
KEY_F12 = 0x00000058
|
||||
|
||||
KEY_TILDE = 0x00000029
|
||||
KEY_MINUS = 0x0000000C
|
||||
KEY_EQUAL = 0x0000000D
|
||||
KEY_BACKSPACE = 0x0000000E
|
||||
KEY_TAB = 0x0000000F
|
||||
KEY_SQBRACE1 = 0x0000001A
|
||||
KEY_SQBRACE2 = 0x0000001B
|
||||
KEY_SLASH1 = 0x00000035
|
||||
KEY_SLASH2 = 0x0000002B
|
||||
KEY_SEMICOLON = 0x00000027
|
||||
KEY_QUOTE = 0x00000028
|
||||
KEY_COMMA = 0x00000033
|
||||
KEY_DOT = 0x00000034
|
||||
KEY_SPACE = 0x00000039
|
||||
|
||||
KEY_1 = 0x00000002
|
||||
KEY_2 = 0x00000003
|
||||
KEY_3 = 0x00000004
|
||||
KEY_4 = 0x00000005
|
||||
KEY_5 = 0x00000006
|
||||
KEY_6 = 0x00000007
|
||||
KEY_7 = 0x00000008
|
||||
KEY_8 = 0x00000009
|
||||
KEY_9 = 0x0000000A
|
||||
KEY_0 = 0x0000000B
|
||||
|
||||
KEY_A = 0x0000001E
|
||||
KEY_B = 0x00000030
|
||||
KEY_C = 0x0000002E
|
||||
KEY_D = 0x00000020
|
||||
KEY_E = 0x00000012
|
||||
KEY_F = 0x00000021
|
||||
KEY_G = 0x00000022
|
||||
KEY_H = 0x00000023
|
||||
KEY_I = 0x00000017
|
||||
KEY_J = 0x00000024
|
||||
KEY_K = 0x00000025
|
||||
KEY_L = 0x00000026
|
||||
KEY_M = 0x00000032
|
||||
KEY_N = 0x00000031
|
||||
KEY_O = 0x00000018
|
||||
KEY_P = 0x00000019
|
||||
KEY_Q = 0x00000010
|
||||
KEY_R = 0x00000013
|
||||
KEY_S = 0x0000001F
|
||||
KEY_T = 0x00000014
|
||||
KEY_U = 0x00000016
|
||||
KEY_V = 0x0000002F
|
||||
KEY_W = 0x00000011
|
||||
KEY_X = 0x0000002D
|
||||
KEY_Y = 0x00000015
|
||||
KEY_Z = 0x0000002C
|
||||
|
||||
KEY_CAPSLK = 0x0000003A
|
||||
KEY_SCRLK = 0x00000046
|
||||
KEY_NUMLK = 0x00000069
|
||||
|
||||
KEY_RETURN = 0x0000001C
|
||||
KEY_NUMRETURN = 0x0000011C
|
||||
|
||||
KEY_LCONTROL = 0x0000001D
|
||||
KEY_RCONTROL = 0x0000011D
|
||||
KEY_LSHIFT = 0x0000002A
|
||||
KEY_RSHIFT = 0x00000036
|
||||
KEY_LALT = 0x00000038
|
||||
KEY_RALT = 0x00000138
|
||||
|
||||
KEY_LWIN = 0x0000015B
|
||||
KEY_RWIN = 0x0000015C
|
||||
KEY_APPS = 0x0000015D
|
||||
|
||||
KEY_INSERT = 0x00000152
|
||||
KEY_DELETE = 0x00000153
|
||||
KEY_HOME = 0x00000147
|
||||
KEY_END = 0x0000014F
|
||||
KEY_PAGEUP = 0x00000149
|
||||
KEY_PAGEDOWN = 0x00000151
|
||||
KEY_UP = 0x00000148
|
||||
KEY_LEFT = 0x0000014B
|
||||
KEY_RIGHT = 0x0000014D
|
||||
KEY_DOWN = 0x00000150
|
||||
|
||||
KEY_DIVIDE = 0x00000135
|
||||
KEY_MULTIPLY = 0x00000037
|
||||
KEY_SUBTRACT = 0x0000004A
|
||||
KEY_ADD = 0x0000004E
|
||||
KEY_SEPARATOR = 0x00000053
|
||||
|
||||
KEY_NUM1 = 0x0000004F
|
||||
KEY_NUM2 = 0x00000050
|
||||
KEY_NUM3 = 0x00000051
|
||||
KEY_NUM4 = 0x0000004B
|
||||
KEY_NUM5 = 0x0000004C
|
||||
KEY_NUM6 = 0x0000004D
|
||||
KEY_NUM7 = 0x00000047
|
||||
KEY_NUM8 = 0x00000048
|
||||
KEY_NUM9 = 0x00000049
|
||||
KEY_NUM0 = 0x00000052
|
||||
|
||||
;// EXTENDED KEY CODES (MULTIMEDIA KEYBOARDS)
|
||||
|
||||
KEY_MYDOCUMENTS = 0x0000014C
|
||||
KEY_MYPICTURES = 0x00000164
|
||||
KEY_MYMUSIC = 0x0000013C
|
||||
KEY_MUTE = 0x00000120
|
||||
KEY_PLAYPAUSE = 0x00000122
|
||||
KEY_STOP = 0x00000124
|
||||
KEY_VOLUMEUP = 0x00000130
|
||||
KEY_VOLUMEDOWN = 0x0000013E
|
||||
KEY_PREVSONG = 0x00000110
|
||||
KEY_NEXTSONG = 0x00000119
|
||||
KEY_MEDIA = 0x0000016D
|
||||
KEY_MAIL = 0x0000016C
|
||||
KEY_WEBHOME = 0x00000132
|
||||
KEY_MESSENGER = 0x00000105
|
||||
|
||||
KEY_CALCULATOR = 0x00000121
|
||||
KEY_LOGOFF = 0x00000116
|
||||
KEY_SLEEP = 0x0000015F
|
346
programs/develop/tinypad/trunk/tp-butto.asm
Normal file
346
programs/develop/tinypad/trunk/tp-butto.asm
Normal file
@ -0,0 +1,346 @@
|
||||
button:
|
||||
mcall 17
|
||||
cmp al,0
|
||||
jne still
|
||||
shr eax,8
|
||||
|
||||
cmp [bot_mode],0
|
||||
je @f
|
||||
mov ebx,eax
|
||||
mov al,3
|
||||
call [bot_dlg_handler]
|
||||
jmp still
|
||||
|
||||
@@: mov esi,accel_table2
|
||||
.acc: cmp eax,[esi]
|
||||
jne @f
|
||||
call dword[esi+4]
|
||||
jmp still.skip_write
|
||||
@@: add esi,8
|
||||
cmp byte[esi],0
|
||||
jne .acc
|
||||
|
||||
jmp still.skip_write
|
||||
|
||||
; cmp eax,BUTTON_SCRLUP
|
||||
; jne not_up
|
||||
btn.scroll_up:
|
||||
dec [top_line]
|
||||
jns @f
|
||||
inc [top_line]
|
||||
ret;jmp still.skip_write
|
||||
@@: call check_inv_all.skip_check
|
||||
ret
|
||||
; not_up:
|
||||
|
||||
; cmp eax,BUTTON_SCRLDN
|
||||
; jne not_down
|
||||
btn.scroll_down:
|
||||
inc [top_line]
|
||||
mov eax,[lines]
|
||||
sub eax,[lines.scr]
|
||||
cmp eax,[top_line]
|
||||
jge @f
|
||||
dec [top_line]
|
||||
;dec eax
|
||||
;mov [top_line],eax
|
||||
ret;jmp still.skip_write
|
||||
@@: call check_inv_all.skip_check
|
||||
ret
|
||||
; not_down:
|
||||
|
||||
; cmp eax,BUTTON_SCRLLT
|
||||
; jne not_left
|
||||
btn.scroll_left:
|
||||
dec [left_col]
|
||||
jns @f
|
||||
inc [left_col]
|
||||
ret;jmp still.skip_write
|
||||
@@: call check_inv_all.skip_check
|
||||
ret
|
||||
; not_left:
|
||||
|
||||
; cmp eax,BUTTON_SCRLRT
|
||||
; jne not_right
|
||||
btn.scroll_right:
|
||||
inc [left_col]
|
||||
mov eax,[columns]
|
||||
sub eax,[columns.scr]
|
||||
cmp eax,[left_col]
|
||||
jge @f
|
||||
dec [left_col]
|
||||
;dec eax
|
||||
;mov [left_col],eax
|
||||
ret;jmp still.skip_write
|
||||
@@: call check_inv_all.skip_check
|
||||
ret
|
||||
; not_right:
|
||||
|
||||
; SEARCH {
|
||||
; search:
|
||||
; cmp al,BUTTON_SEARCH
|
||||
; jne no_search
|
||||
btn.search:
|
||||
key.f3:
|
||||
call search
|
||||
jc @f
|
||||
call check_inv_all
|
||||
@@: ret
|
||||
|
||||
|
||||
func search
|
||||
cld
|
||||
mov ecx,[pos.y]
|
||||
mov edx,ecx
|
||||
call get_line_offset
|
||||
cmp word[esi],0
|
||||
je .exit
|
||||
call get_real_length
|
||||
add esi,4
|
||||
or eax,eax
|
||||
jz .end_line.2
|
||||
mov ecx,eax
|
||||
sub ecx,[pos.x]
|
||||
push esi
|
||||
add esi,[pos.x]
|
||||
;dec ecx
|
||||
;inc esi
|
||||
jmp @f
|
||||
|
||||
.next_line:
|
||||
push esi
|
||||
@@: sub ecx,[s_search.size]
|
||||
inc ecx
|
||||
|
||||
.next_char:
|
||||
dec ecx
|
||||
js .end_line
|
||||
xor edi,edi
|
||||
|
||||
.next_ok:
|
||||
movzx eax,byte[edi+esi]
|
||||
movzx ebx,byte[edi+s_search]
|
||||
|
||||
cmp al,$61
|
||||
jb @f
|
||||
add al,[eax+add_table-$61]
|
||||
@@: cmp bl,$61
|
||||
jb @f
|
||||
add bl,[ebx+add_table-$61]
|
||||
@@:
|
||||
cmp al,bl
|
||||
je @f
|
||||
|
||||
inc esi
|
||||
jmp .next_char
|
||||
@@:
|
||||
inc edi
|
||||
cmp edi,[s_search.size]
|
||||
jne .next_ok
|
||||
|
||||
.found:
|
||||
add esp,4
|
||||
mov [pos.y],edx
|
||||
mov [sel.y],edx
|
||||
mov ecx,edx
|
||||
lea eax,[esi-4]
|
||||
call get_line_offset
|
||||
sub eax,esi
|
||||
mov [sel.x],eax
|
||||
add eax,[s_search.size]
|
||||
mov [pos.x],eax
|
||||
mov [s_status],0
|
||||
clc
|
||||
ret
|
||||
|
||||
.end_line:
|
||||
pop esi
|
||||
.end_line.2:
|
||||
movzx eax,word[esi-4]
|
||||
add esi,eax;[esi-4]
|
||||
inc edx
|
||||
call get_real_length
|
||||
mov ecx,eax
|
||||
lodsd
|
||||
or eax,eax
|
||||
jnz .next_line
|
||||
.exit:
|
||||
mov [s_status],s_text_not_found
|
||||
stc
|
||||
ret
|
||||
endf
|
||||
|
||||
; SEARCH }
|
||||
|
||||
; no_search:
|
||||
|
||||
; TOOLBAR {
|
||||
; cmp eax,10000
|
||||
; jb no_toolbar
|
||||
|
||||
; add eax,-10000
|
||||
; jnz @f
|
||||
btn.compile:
|
||||
key.ctrl_f9:
|
||||
mov bl,0;[run_outfile],0
|
||||
call start_fasm
|
||||
ret;jmp still
|
||||
; @@: dec eax
|
||||
; jnz @f
|
||||
btn.compile_run:
|
||||
key.f9:
|
||||
mov bl,1;[run_outfile],1
|
||||
call start_fasm
|
||||
ret;jmp still
|
||||
; @@: dec eax
|
||||
; jnz @f
|
||||
btn.debug_board:
|
||||
call open_debug_board
|
||||
ret;jmp still
|
||||
; @@: dec eax
|
||||
; jnz still
|
||||
btn.sysfuncs_txt:
|
||||
call open_sysfuncs_txt
|
||||
ret;jmp still
|
||||
; TOOLBAR }
|
||||
|
||||
; no_toolbar:
|
||||
|
||||
; cmp al,4
|
||||
; jne noid4
|
||||
|
||||
; LOAD_FILE {
|
||||
; do_load_file:
|
||||
btn.load_file:
|
||||
key.ctrl_l:
|
||||
; cmp [s_fname],'/'
|
||||
; jne @f
|
||||
; call load_hd_file
|
||||
; jmp .restorecursor
|
||||
; @@: call load_file
|
||||
call load_file
|
||||
jnc @f
|
||||
ret
|
||||
; .restorecursor:
|
||||
@@:
|
||||
xor eax,eax
|
||||
mov [top_line],eax
|
||||
mov [left_col],eax
|
||||
mov [pos.x],eax
|
||||
mov [pos.y],eax
|
||||
mov [sel.x],eax
|
||||
mov [sel.y],eax
|
||||
|
||||
mov [modified],al
|
||||
|
||||
; enable color syntax for ASM and INC files:
|
||||
mov [asm_mode],al
|
||||
|
||||
mov eax,[f_info.length] ; [s_fname.size]
|
||||
add eax,f_info.path ; s_fname
|
||||
mov byte[eax],0
|
||||
mov ecx, dword [eax-3]
|
||||
or ecx, 0x202020
|
||||
cmp ecx, 'asm'
|
||||
jne @f
|
||||
inc [asm_mode]
|
||||
jmp .nocol
|
||||
@@: cmp ecx, 'inc'
|
||||
jne .nocol
|
||||
inc [asm_mode]
|
||||
.nocol:
|
||||
|
||||
update_caption:
|
||||
macro unused {
|
||||
movzx ecx,[f_info.length] ; [s_fname.size]
|
||||
add ecx,10 ; strlen(" - TINYPAD");
|
||||
cmp ecx,[s_title.size]
|
||||
jne @f
|
||||
add ecx,-10
|
||||
mov esi,f_info.path ; s_fname ; strcmp(s_fname,header);
|
||||
mov edi,s_title
|
||||
repe cmpsb
|
||||
jne @f
|
||||
; call draw_file
|
||||
clc
|
||||
ret;jmp still
|
||||
@@:
|
||||
}
|
||||
; set window title:
|
||||
mov esi,f_info.path ; s_fname
|
||||
mov edi,s_title
|
||||
|
||||
cld
|
||||
mov ecx,[f_info.length] ; [s_fname.size]
|
||||
jecxz @f
|
||||
;lea eax,[ecx+10]
|
||||
;mov [s_title.size],eax
|
||||
;cld
|
||||
rep movsb
|
||||
|
||||
mov dword[edi],' - '
|
||||
add edi,3
|
||||
@@: mov esi,htext
|
||||
mov ecx,htext.size
|
||||
rep movsb
|
||||
|
||||
mov al,0
|
||||
stosb
|
||||
|
||||
; call drawwindow
|
||||
clc
|
||||
ret;jmp still
|
||||
; LOAD_FILE }
|
||||
|
||||
; noid4:
|
||||
|
||||
; cmp al, 2
|
||||
; jz yessave
|
||||
|
||||
; dec al ; close if butid == 1
|
||||
; jnz nosave
|
||||
; EXIT:
|
||||
btn.close_main_window:
|
||||
key.alt_x:
|
||||
mov esi,self_path
|
||||
mov byte[esi+PATHL-1],0
|
||||
mov edi,f_info.path
|
||||
cld
|
||||
@@: lodsb
|
||||
stosb
|
||||
or al,al
|
||||
jnz @b
|
||||
mov ebx,f_info
|
||||
mov dword[ebx+0],1
|
||||
mov dword[ebx+8],self_path
|
||||
mov dword[ebx+12],0
|
||||
mcall 58
|
||||
|
||||
; test eax,eax
|
||||
; je .close
|
||||
; cmp eax,6
|
||||
; je .close
|
||||
; ret
|
||||
|
||||
.close:
|
||||
mov [main_closed],1
|
||||
mcall -1
|
||||
|
||||
; SAVE_FILE {
|
||||
; yessave:
|
||||
; btn.save_file:
|
||||
; key.ctrl_s:
|
||||
; mov [bot_mode],1
|
||||
; mov [bot_save_mode],1
|
||||
; mov [bot_dlg_height],16*2+4*2-1
|
||||
; mov [bot_dlg_handler],osdlg_handler
|
||||
; call drawwindow
|
||||
; call save_file
|
||||
; ret;jmp still
|
||||
; SAVE_FILE }
|
||||
|
||||
; nosave:
|
||||
; btn.save_enter_name:
|
||||
; inc al
|
||||
; call read_string
|
||||
; ret;jmp still
|
590
programs/develop/tinypad/trunk/tp-commo.asm
Normal file
590
programs/develop/tinypad/trunk/tp-commo.asm
Normal file
@ -0,0 +1,590 @@
|
||||
;-----------------------------------------------------------------------------
|
||||
func check_cur_vis_inv ;//////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
push eax ebx
|
||||
xor bl,bl
|
||||
.chk_y:
|
||||
mov eax,[pos.y]
|
||||
or eax,eax
|
||||
jge @f
|
||||
mov [pos.y],0
|
||||
jmp .chk_dy
|
||||
@@: cmp eax,[lines]
|
||||
jl .chk_dy
|
||||
mov eax,[lines]
|
||||
dec eax
|
||||
mov [pos.y],eax
|
||||
.chk_dy:
|
||||
mov eax,[top_line]
|
||||
cmp eax,[pos.y]
|
||||
jle @f
|
||||
push [pos.y]
|
||||
pop [top_line]
|
||||
inc bl
|
||||
@@: add eax,[lines.scr]
|
||||
cmp eax,[pos.y]
|
||||
jg .chk_x
|
||||
mov eax,[pos.y]
|
||||
sub eax,[lines.scr]
|
||||
inc eax
|
||||
mov [top_line],eax
|
||||
inc bl
|
||||
.chk_x:
|
||||
mov eax,[pos.x]
|
||||
or eax,eax
|
||||
jge @f
|
||||
mov [pos.x],0
|
||||
jmp .chk_dx
|
||||
@@: cmp eax,[columns]
|
||||
jl .chk_dx
|
||||
mov eax,[columns]
|
||||
mov [pos.x],eax
|
||||
.chk_dx:
|
||||
mov eax,[left_col]
|
||||
cmp eax,[pos.x]
|
||||
jle @f
|
||||
push [pos.x]
|
||||
pop [left_col]
|
||||
inc bl
|
||||
@@: add eax,[columns.scr]
|
||||
cmp eax,[pos.x]
|
||||
jg @f
|
||||
mov eax,[pos.x]
|
||||
sub eax,[columns.scr]
|
||||
inc eax
|
||||
mov [left_col],eax
|
||||
inc bl
|
||||
@@: cmp [mev],MEV_LDOWN
|
||||
jne .exit
|
||||
push [pos.x] [pos.y]
|
||||
pop [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,[sel.y]
|
||||
mov ebx,[pos.y]
|
||||
cmp eax,ebx
|
||||
jle @f
|
||||
xchg eax,ebx
|
||||
@@: push [pos.x] [pos.y]
|
||||
pop [sel.y] [sel.x]
|
||||
call draw_file.ex
|
||||
pop ebx eax
|
||||
ret
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func pt_in_rect ;/////////////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
cmp eax,[ecx+0x0]
|
||||
jl @f
|
||||
cmp ebx,[ecx+0x4]
|
||||
jl @f
|
||||
cmp eax,[ecx+0x8]
|
||||
jg @f
|
||||
cmp ebx,[ecx+0xC]
|
||||
jg @f
|
||||
stc
|
||||
ret
|
||||
@@: clc
|
||||
ret
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func check_bottom_right ;/////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
push eax
|
||||
mov eax,[top_line]
|
||||
add eax,[lines.scr]
|
||||
cmp eax,[lines]
|
||||
jbe .lp1
|
||||
mov eax,[lines]
|
||||
sub eax,[lines.scr]
|
||||
jns @f
|
||||
xor eax,eax
|
||||
@@: mov [top_line],eax
|
||||
.lp1: mov eax,[left_col]
|
||||
add eax,[columns.scr]
|
||||
cmp eax,[columns]
|
||||
jbe .exit
|
||||
mov eax,[columns]
|
||||
sub eax,[columns.scr]
|
||||
jns @f
|
||||
xor eax,eax
|
||||
@@: mov [left_col],eax
|
||||
.exit:
|
||||
pop eax
|
||||
ret
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func check_inv_str ;//////////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
@^
|
||||
mov eax,[pos.y]
|
||||
mov ecx,[top_line]
|
||||
.skip_init:
|
||||
call check_cur_vis
|
||||
mov [pos.y],eax
|
||||
mov [top_line],ecx
|
||||
.skip_check:
|
||||
; call invalidate_string
|
||||
call drawfile
|
||||
ret
|
||||
^@
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func check_inv_all ;//////////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
mov eax,[pos.y]
|
||||
mov ecx,[top_line]
|
||||
.skip_init:
|
||||
call check_cur_vis
|
||||
mov [pos.y],eax
|
||||
mov [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,[lines]
|
||||
jbe @f
|
||||
mov 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,[lines]
|
||||
jbe @f
|
||||
mov ecx,[lines]
|
||||
sub ecx,[lines.scr]
|
||||
jns @f
|
||||
xor ecx,ecx
|
||||
@@:;mov [top_line],ecx
|
||||
|
||||
pushad
|
||||
mov eax,[pos.x]
|
||||
mov ebx,[left_col]
|
||||
mov 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 [left_col],ebx
|
||||
|
||||
.exit:
|
||||
mov [pos.x],eax
|
||||
popad
|
||||
|
||||
ret
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func get_real_length ;////////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
movzx eax,word[esi]
|
||||
@@: cmp byte[esi+eax+4-1],' '
|
||||
jne @f
|
||||
dec eax
|
||||
jnz @b
|
||||
@@: ret
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func get_line_offset ;////////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
; Input:
|
||||
; ECX = line number
|
||||
; Output:
|
||||
; ESI = line data offset
|
||||
;-----------------------------------------------------------------------------
|
||||
push eax ecx
|
||||
mov esi,AREA_EDIT
|
||||
jecxz .exit
|
||||
@@: movzx eax,word[esi]
|
||||
dec ecx
|
||||
lea esi,[esi+eax+4]
|
||||
jnz @b
|
||||
.exit:
|
||||
pop ecx eax
|
||||
ret
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func init_sel_vars ;//////////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
pushad
|
||||
mov [sel.selected],1
|
||||
mov eax,[sel.x]
|
||||
mov ebx,[sel.y]
|
||||
mov ecx,[pos.x]
|
||||
mov edx,[pos.y]
|
||||
cmp ebx,edx
|
||||
jl .lp2
|
||||
jne @f
|
||||
cmp eax,ecx
|
||||
jl .lp2
|
||||
jne .lp1
|
||||
dec [sel.selected]
|
||||
jmp .lp2
|
||||
@@: xchg ebx,edx
|
||||
.lp1: xchg eax,ecx
|
||||
.lp2: mov [sel.begin.x],eax
|
||||
mov [sel.begin.y],ebx
|
||||
mov [sel.end.x],ecx
|
||||
mov [sel.end.y],edx
|
||||
popad
|
||||
ret
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func get_scroll_vars ;////////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
; Input:
|
||||
; EAX = maximum data size (units)
|
||||
; EBX = visible data size (units)
|
||||
; ECX = current data position (units)
|
||||
; EDX = scrolling area size (pixels)
|
||||
; Output:
|
||||
; EAX = srcoller offset (pixels)
|
||||
; EBX = scroller size (pixels)
|
||||
;-----------------------------------------------------------------------------
|
||||
push eax ebx edx
|
||||
; sub eax,ebx
|
||||
mov esi,eax
|
||||
mov eax,edx
|
||||
imul ebx
|
||||
idiv esi
|
||||
cmp eax,[esp]
|
||||
jge .null
|
||||
cmp eax,AMINS
|
||||
jge @f
|
||||
neg eax
|
||||
add eax,AMINS
|
||||
sub [esp],eax
|
||||
mov eax,AMINS
|
||||
@@: mov [esp+4],eax ; scroller size
|
||||
mov eax,[esp]
|
||||
imul ecx
|
||||
idiv esi
|
||||
or eax,eax
|
||||
jns @f
|
||||
xor eax,eax
|
||||
@@: mov [esp+8],eax ; scroller offset
|
||||
add eax,[esp+4]
|
||||
cmp eax,[esp]
|
||||
jle @f
|
||||
; mov eax,[esp]
|
||||
; sub eax,[esp+4]
|
||||
; js @f
|
||||
; mov [esp+8],eax
|
||||
@@:
|
||||
pop edx ebx eax
|
||||
ret
|
||||
.null:
|
||||
mov dword[esp+4],0
|
||||
mov dword[esp+8],0
|
||||
jmp @b
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func uint2strz ;//////////////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
dec ebx
|
||||
jz @f
|
||||
xor edx,edx
|
||||
div ecx
|
||||
push edx
|
||||
call uint2strz
|
||||
pop eax
|
||||
@@: cmp al,10
|
||||
sbb al,$69
|
||||
das
|
||||
stosb
|
||||
ret
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func uint2str ;///////////////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
cmp eax,ecx
|
||||
jb @f
|
||||
xor edx,edx
|
||||
div ecx
|
||||
push edx
|
||||
call uint2str
|
||||
pop eax
|
||||
@@: cmp al,10
|
||||
sbb al,$69
|
||||
das
|
||||
stosb
|
||||
ret
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func rgb_to_gray ;////////////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
push 0 eax
|
||||
and dword[esp],0x000000FF
|
||||
fild dword[esp]
|
||||
fmul [float_gray_b]
|
||||
shr eax,8
|
||||
mov [esp],eax
|
||||
and dword[esp],0x000000FF
|
||||
fild dword[esp]
|
||||
fmul [float_gray_g]
|
||||
faddp
|
||||
shr eax,8
|
||||
and eax,0x000000FF
|
||||
mov [esp],eax
|
||||
fild dword[esp]
|
||||
fmul [float_gray_r]
|
||||
faddp
|
||||
frndint
|
||||
fist dword[esp]
|
||||
fist dword[esp+1]
|
||||
fistp dword[esp+2]
|
||||
pop eax
|
||||
add esp,4
|
||||
ret
|
||||
endf
|
||||
|
||||
;float_gray_r dd 0.30f
|
||||
;float_gray_g dd 0.59f
|
||||
;float_gray_b dd 0.11f
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func get_active_menu_item ;///////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
pushad
|
||||
mov [mi_cur],0
|
||||
mcall 37,1
|
||||
movsx ebx,ax
|
||||
sar eax,16
|
||||
mov ecx,__rc
|
||||
pushd 2 0 (main_menu.width+7) (ATOPH-2)
|
||||
popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
|
||||
; add [__rc+0xC],ATOPH-2
|
||||
call pt_in_rect
|
||||
jnc .outside_menu
|
||||
m2m dword[ecx+0x8],dword[ecx+0x0]
|
||||
mov edx,main_menu
|
||||
@@: inc [mi_cur]
|
||||
movzx esi,word[edx+0]
|
||||
add [ecx+0x8],esi
|
||||
call pt_in_rect
|
||||
jc .exit
|
||||
m2m dword[ecx+0x0],dword[ecx+0x8]
|
||||
add edx,8+1
|
||||
movzx esi,byte[edx-1]
|
||||
add edx,esi
|
||||
cmp byte[edx+8],0
|
||||
jne @b
|
||||
mov [mi_cur],0
|
||||
.exit:
|
||||
popad
|
||||
ret
|
||||
.outside_menu:
|
||||
or [mi_cur],-1
|
||||
@@: popad
|
||||
ret
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func get_active_popup_item ;//////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
pushad
|
||||
mov [pi_cur],0
|
||||
mcall 37,1
|
||||
movsx ebx,ax
|
||||
sar eax,16
|
||||
mov ecx,__rc
|
||||
mov dword[ecx+0x0],0
|
||||
mov dword[ecx+0x4],0
|
||||
movzx edx,[ebp+POPUP.width]
|
||||
mov dword[ecx+0x8],edx;POP_WIDTH
|
||||
movzx edx,[ebp+POPUP.height]
|
||||
mov dword[ecx+0xC],edx;POP_HEIGHT
|
||||
call pt_in_rect
|
||||
jnc .outside_window
|
||||
inc dword[ecx+0x0]
|
||||
mov dword[ecx+0x4],3
|
||||
dec dword[ecx+0x8]
|
||||
mov dword[ecx+0xC],3+POP_IHEIGHT-1
|
||||
mov edx,[ebp+POPUP.data];popup_text.data
|
||||
@@: inc [pi_cur]
|
||||
inc edx
|
||||
movzx esi,byte[edx-1]
|
||||
cmp byte[edx],'-'
|
||||
jne .lp1
|
||||
pushd [ecx+0xC]
|
||||
sub dword[ecx+0xC],POP_IHEIGHT-4
|
||||
call pt_in_rect
|
||||
popd [ecx+0xC]
|
||||
jc .separator
|
||||
add dword[ecx+0x4],4
|
||||
add dword[ecx+0xC],4
|
||||
jmp .lp3
|
||||
.lp1: call pt_in_rect
|
||||
jnc .lp2
|
||||
mov eax,[pi_cur]
|
||||
test byte[ebp+eax-1],1;byte[popup_text+eax-1],1
|
||||
jnz .exit
|
||||
jmp .separator
|
||||
.lp2: add dword[ecx+0x4],POP_IHEIGHT
|
||||
add dword[ecx+0xC],POP_IHEIGHT
|
||||
add edx,esi
|
||||
inc edx
|
||||
movzx esi,byte[edx-1]
|
||||
.lp3: add edx,esi
|
||||
cmp byte[edx],0
|
||||
jne @b
|
||||
.separator:
|
||||
mov [pi_cur],0
|
||||
.exit:
|
||||
popad
|
||||
ret
|
||||
.outside_window:
|
||||
or [pi_cur],-1
|
||||
jmp .exit
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func line_add_spaces ;////////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
; esi = line offset
|
||||
; ecx = needed line length
|
||||
;-----------------------------------------------------------------------------
|
||||
pushad
|
||||
movzx edx,word[esi]
|
||||
cmp ecx,edx
|
||||
jbe .exit
|
||||
sub ecx,edx
|
||||
push ecx
|
||||
mov edi,AREA_TEMP2
|
||||
mov eax,esi
|
||||
mov esi,edi
|
||||
sub esi,ecx
|
||||
lea ecx,[eax+4]
|
||||
add ecx,edx;[eax]
|
||||
push ecx
|
||||
neg ecx
|
||||
lea ecx,[esi+ecx+1]
|
||||
std
|
||||
rep movsb
|
||||
pop edi ecx
|
||||
add [eax],cx
|
||||
mov al,' '
|
||||
cld
|
||||
rep stosb
|
||||
.exit:
|
||||
popad
|
||||
ret
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func delete_selection ;///////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
cmp [sel.selected],0
|
||||
je .exit.2
|
||||
|
||||
pushad
|
||||
mov ecx,[sel.begin.y]
|
||||
cmp ecx,[sel.end.y]
|
||||
je .single_line
|
||||
call get_line_offset
|
||||
and dword[esi],not 0x00020000
|
||||
or dword[esi],0x00010000
|
||||
mov ecx,[sel.begin.x]
|
||||
call line_add_spaces
|
||||
lea edi,[esi+4]
|
||||
mov ecx,[sel.end.y]
|
||||
call get_line_offset
|
||||
call get_real_length
|
||||
cmp eax,[sel.end.x]
|
||||
jbe @f
|
||||
mov eax,[sel.end.x]
|
||||
@@: movzx ecx,word[esi]
|
||||
sub ecx,eax
|
||||
mov ebx,[sel.begin.x]
|
||||
add ebx,ecx
|
||||
mov [edi-4],bx
|
||||
add edi,[sel.begin.x]
|
||||
lea esi,[esi+eax+4]
|
||||
mov ecx,AREA_TEMP2
|
||||
sub ecx,esi
|
||||
cld
|
||||
rep movsb
|
||||
mov eax,[sel.end.y]
|
||||
sub eax,[sel.begin.y]
|
||||
sub [lines],eax
|
||||
jmp .exit
|
||||
|
||||
.single_line:
|
||||
call get_line_offset
|
||||
and dword[esi],not 0x00020000
|
||||
or dword[esi],0x00010000
|
||||
call get_real_length
|
||||
cmp eax,[sel.begin.x]
|
||||
jbe .exit
|
||||
mov ecx,[sel.end.x]
|
||||
cmp ecx,eax
|
||||
jbe @f
|
||||
mov ecx,eax
|
||||
@@: sub ecx,[sel.begin.x]
|
||||
sub [esi],cx
|
||||
lea edi,[esi+4]
|
||||
add edi,[sel.begin.x]
|
||||
lea esi,[edi+ecx]
|
||||
mov ecx,AREA_TEMP2
|
||||
sub ecx,esi
|
||||
cld
|
||||
rep movsb
|
||||
|
||||
.exit:
|
||||
mov eax,[sel.begin.x]
|
||||
mov [pos.x],eax
|
||||
mov [sel.x],eax
|
||||
mov eax,[sel.begin.y]
|
||||
mov [pos.y],eax
|
||||
mov [sel.y],eax
|
||||
popad
|
||||
mov [modified],1
|
||||
clc
|
||||
ret
|
||||
|
||||
.exit.2:
|
||||
stc
|
||||
ret
|
||||
endf
|
330
programs/develop/tinypad/trunk/tp-dialo.asm
Normal file
330
programs/develop/tinypad/trunk/tp-dialo.asm
Normal file
@ -0,0 +1,330 @@
|
||||
;-----------------------------------------------------------------------------
|
||||
func define_3d_button ;///////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
; ebx = <x,width>
|
||||
; ecx = <y,height>
|
||||
; esp+4*3 = id
|
||||
; esp+4*2 = text
|
||||
; esp+4*1 = text length
|
||||
;-----------------------------------------------------------------------------
|
||||
pushad
|
||||
mov edx,[esp+4*8+4+4*2]
|
||||
or edx,0x40000000
|
||||
mcall 8
|
||||
mov eax,[esp+4*8+4*1]
|
||||
add eax,2
|
||||
imul eax,6
|
||||
pushad
|
||||
shr ebx,16
|
||||
shr ecx,16
|
||||
push ebx ecx eax 15
|
||||
call draw_3d_panel
|
||||
popad
|
||||
shr ecx,16
|
||||
mov bx,cx
|
||||
add ebx,7*65536+4
|
||||
mcall 4,,[sc.work_text],[esp+4*8+4*2],[esp+4*8+4*1]
|
||||
popad
|
||||
ret 4*3
|
||||
endf
|
||||
|
||||
finddlg_handler:
|
||||
cmp al,1
|
||||
je .draw
|
||||
cmp al,2
|
||||
je .key
|
||||
cmp al,3
|
||||
je botdlg.button
|
||||
ret
|
||||
|
||||
.draw:
|
||||
mov ebx,[bot_ofs]
|
||||
add ebx,(1+3)*65536+6
|
||||
mcall 4,,[sc.work_text],s_2find,s_2find.size+1
|
||||
mov ecx,[bot_ofs]
|
||||
shl ecx,16
|
||||
add ecx,(3+17)*65536+15
|
||||
|
||||
push ecx
|
||||
cmp [bot_dlg_mode2],0
|
||||
je @f
|
||||
add ebx,18
|
||||
mcall 4,,[sc.work_text],s_2replace,s_2replace.size+1
|
||||
mov ecx,[esp]
|
||||
add ecx,18*65536
|
||||
@@:
|
||||
|
||||
mov ebx,[p_info.client_box.width]
|
||||
shl ebx,16
|
||||
|
||||
push 20003
|
||||
cmp [bot_dlg_mode2],0
|
||||
jne .draw.lp1
|
||||
add ebx,-(2+6*(s_2find.size+2))*65536+6*(s_2find.size+2)
|
||||
push s_2find s_2find.size
|
||||
jmp @f
|
||||
|
||||
.draw.lp1:
|
||||
add ebx,-(2+6*(s_2replace.size+2))*65536+6*(s_2replace.size+2)
|
||||
push s_2replace s_2replace.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
|
||||
|
||||
mov ecx,[esp]
|
||||
|
||||
mov ebp,tb_find
|
||||
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
|
||||
add ecx,-18*65536+1
|
||||
mov dword[tbox.y],ecx
|
||||
call textbox.draw
|
||||
|
||||
pop ecx
|
||||
|
||||
cmp [bot_dlg_mode2],0
|
||||
je @f
|
||||
mov ebp,tb_replace
|
||||
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
|
||||
inc ecx
|
||||
mov dword[tbox.y],ecx
|
||||
call textbox.draw
|
||||
@@:
|
||||
|
||||
ret
|
||||
|
||||
.key:
|
||||
cmp ebx,KEY_ESCAPE
|
||||
je btn.bot.cancel
|
||||
cmp ebx,KEY_RETURN
|
||||
je btn.bot.find
|
||||
cmp ebx,KEY_NUMRETURN
|
||||
je btn.bot.find
|
||||
cmp ebx,KEY_TAB
|
||||
je ..tab
|
||||
call textbox.key
|
||||
ret
|
||||
|
||||
..tab:
|
||||
cmp [bot_dlg_mode2],0
|
||||
je @f
|
||||
mov eax,tb_replace
|
||||
cmp eax,[focused_tb]
|
||||
jne .key.lp1
|
||||
mov eax,tb_find
|
||||
.key.lp1:
|
||||
mov [focused_tb],eax
|
||||
call .draw
|
||||
@@: ret
|
||||
|
||||
osdlg_handler:
|
||||
cmp al,1
|
||||
je .draw
|
||||
cmp al,2
|
||||
je .key
|
||||
cmp al,3
|
||||
je botdlg.button
|
||||
ret
|
||||
|
||||
.draw:
|
||||
mov ebx,[bot_ofs]
|
||||
add ebx,(1+3)*65536+6
|
||||
mcall 4,,[sc.work_text],s_2filename,s_2filename.size
|
||||
mov ebx,[p_info.client_box.width]
|
||||
shl ebx,16
|
||||
mov ecx,[bot_ofs]
|
||||
shl ecx,16
|
||||
add ecx,(2+18)*65536+15
|
||||
|
||||
push 20002
|
||||
cmp [bot_dlg_mode2],0
|
||||
jne .draw.lp1
|
||||
add ebx,-(2+6*(s_2open.size+2))*65536+6*(s_2open.size+2)
|
||||
push s_2open s_2open.size
|
||||
jmp @f
|
||||
.draw.lp1:
|
||||
add ebx,-(2+6*(s_2save.size+2))*65536+6*(s_2save.size+2)
|
||||
push 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
|
||||
|
||||
mov ebp,tb_opensave
|
||||
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
|
||||
add ecx,-18*65536+1
|
||||
mov dword[tbox.y],ecx
|
||||
call textbox.draw
|
||||
|
||||
ret
|
||||
|
||||
.key:
|
||||
cmp ebx,KEY_ESCAPE
|
||||
je btn.bot.cancel
|
||||
cmp ebx,KEY_RETURN
|
||||
je btn.bot.opensave
|
||||
cmp ebx,KEY_NUMRETURN
|
||||
je btn.bot.opensave
|
||||
call textbox.key
|
||||
ret
|
||||
|
||||
gotodlg_handler:
|
||||
cmp al,1
|
||||
je .draw
|
||||
cmp al,2
|
||||
je .key
|
||||
cmp al,3
|
||||
je botdlg.button
|
||||
ret
|
||||
|
||||
.draw:
|
||||
mov ebx,[bot_ofs]
|
||||
add ebx,(1+3)*65536+6
|
||||
mcall 4,,[sc.work_text],s_2filename,s_2filename.size
|
||||
mov ebx,[p_info.box.width]
|
||||
shl ebx,16
|
||||
mov ecx,[bot_ofs]
|
||||
shl ecx,16
|
||||
add ecx,(2+18)*65536+15
|
||||
|
||||
push 20002
|
||||
cmp [bot_dlg_mode2],0
|
||||
jne .draw.lp1
|
||||
add ebx,-(2+6*(s_2open.size+2))*65536+6*(s_2open.size+2)
|
||||
push s_2open s_2open.size
|
||||
jmp @f
|
||||
.draw.lp1:
|
||||
add ebx,-(2+6*(s_2save.size+2))*65536+6*(s_2save.size+2)
|
||||
push 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
|
||||
|
||||
mov ebp,tb_opensave
|
||||
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
|
||||
add ecx,-18*65536+1
|
||||
mov dword[tbox.y],ecx
|
||||
call textbox.draw
|
||||
|
||||
ret
|
||||
|
||||
.key:
|
||||
cmp ebx,KEY_ESCAPE
|
||||
je btn.bot.cancel
|
||||
cmp ebx,KEY_RETURN
|
||||
je btn.bot.opensave
|
||||
cmp ebx,KEY_NUMRETURN
|
||||
je btn.bot.opensave
|
||||
call textbox.key
|
||||
ret
|
||||
|
||||
botdlg.button:
|
||||
mov esi,accel_table2_botdlg
|
||||
.acc: cmp ebx,[esi]
|
||||
jne @f
|
||||
call dword[esi+4]
|
||||
ret
|
||||
@@: add esi,8
|
||||
cmp byte[esi],0
|
||||
jne .acc
|
||||
ret
|
||||
|
||||
btn.bot.cancel:
|
||||
xor eax,eax
|
||||
mov [bot_mode],al
|
||||
mov [bot_dlg_height],eax
|
||||
call drawwindow
|
||||
ret
|
||||
|
||||
btn.bot.opensave:
|
||||
cmp [bot_dlg_mode2],0
|
||||
je .lp1
|
||||
call save_file
|
||||
jnc @f
|
||||
jmp .lp2
|
||||
.lp1: call btn.load_file
|
||||
jnc @f
|
||||
.lp2:
|
||||
ret
|
||||
@@: call update_caption
|
||||
xor eax,eax
|
||||
mov [bot_mode],al
|
||||
mov [bot_dlg_height],eax
|
||||
call drawwindow
|
||||
ret
|
||||
|
||||
btn.bot.find:
|
||||
movzx ecx,[tb_find.length]
|
||||
mov [s_search.size],ecx
|
||||
mov esi,tb_find.text
|
||||
mov edi,s_search
|
||||
cld
|
||||
rep movsb
|
||||
|
||||
cmp [bot_dlg_mode2],0
|
||||
je @f
|
||||
call search
|
||||
jnc .found
|
||||
call check_inv_all
|
||||
ret
|
||||
|
||||
.found:
|
||||
;---------------------------------------
|
||||
push [copy_size] [copy_count]
|
||||
|
||||
mov esi,AREA_CBUF
|
||||
mov edi,AREA_CBUF-304
|
||||
mov ecx,300/4
|
||||
rep movsd
|
||||
|
||||
movzx eax,[tb_replace.length]
|
||||
mov esi,tb_replace.text
|
||||
mov edi,AREA_CBUF
|
||||
stosd
|
||||
mov ecx,eax
|
||||
jecxz .lp1
|
||||
rep movsb
|
||||
.lp1: add eax,4
|
||||
mov [copy_size],eax
|
||||
mov [copy_count],1
|
||||
|
||||
push [sel.x]
|
||||
call init_sel_vars
|
||||
call key.ctrl_v
|
||||
pop [sel.x]
|
||||
|
||||
mov esi,AREA_CBUF-304
|
||||
mov edi,AREA_CBUF
|
||||
mov ecx,300/4
|
||||
rep movsd
|
||||
|
||||
pop [copy_count] [copy_size]
|
||||
;---------------------------------------
|
||||
|
||||
call check_inv_all
|
||||
ret
|
||||
@@: xor eax,eax
|
||||
mov [bot_mode],al
|
||||
mov [bot_dlg_height],eax
|
||||
call btn.search
|
||||
call drawwindow
|
||||
ret
|
1251
programs/develop/tinypad/trunk/tp-draw.asm
Normal file
1251
programs/develop/tinypad/trunk/tp-draw.asm
Normal file
File diff suppressed because it is too large
Load Diff
307
programs/develop/tinypad/trunk/tp-files.asm
Normal file
307
programs/develop/tinypad/trunk/tp-files.asm
Normal file
@ -0,0 +1,307 @@
|
||||
;-----------------------------------------------------------------------------
|
||||
func save_file ;//////////////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
|
||||
mov esi,tb_opensave.text
|
||||
mov edi,f_info.path
|
||||
movzx ecx,[tb_opensave.length]
|
||||
mov [f_info.length],ecx
|
||||
cld
|
||||
rep movsb
|
||||
mov byte[edi],0
|
||||
|
||||
mov esi,AREA_EDIT ; 0x70000 = 448 Kbytes (maximum)
|
||||
mov edi,AREA_TEMP
|
||||
|
||||
.new_string:
|
||||
call save_string
|
||||
cmp dword[esi],0
|
||||
jne .new_string
|
||||
sub edi,AREA_TEMP+2 ; minus last CRLF
|
||||
;! mov [filelen],edi
|
||||
cmp byte[f_info.path],'/'
|
||||
je .systree_save
|
||||
mcall 33,f_info.path,AREA_TEMP,edi,0;[filelen],0
|
||||
or eax,eax
|
||||
jz .exit
|
||||
; call file_not_found
|
||||
jmp .exit.2
|
||||
|
||||
.systree_save:
|
||||
;! mov eax,[filelen]
|
||||
; mov [f_info+8],edi ;! eax
|
||||
; mov [f_info+0],1
|
||||
; mov esi,s_fname
|
||||
; mov edi,f_info.path
|
||||
; mov ecx,PATHL
|
||||
; cld
|
||||
; rep movsb
|
||||
;mcall 58,f_info
|
||||
|
||||
mov [f_info70+0],2
|
||||
mov [f_info70+12],edi
|
||||
mov [f_info70+16],AREA_TEMP
|
||||
mov byte[f_info70+20],0
|
||||
mov [f_info70+21],f_info.path
|
||||
mcall 70,f_info70
|
||||
|
||||
call set_status_fs_error
|
||||
|
||||
or eax,eax
|
||||
jnz .exit.2
|
||||
|
||||
.exit:
|
||||
mov [modified],0
|
||||
clc
|
||||
ret
|
||||
|
||||
.exit.2:
|
||||
stc
|
||||
ret
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func save_string ;////////////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
movzx ecx,word[esi]
|
||||
test dword[esi],0x00010000
|
||||
jz @f
|
||||
or dword[esi],0x00020000
|
||||
@@: add esi,4
|
||||
; mov ecx,eax
|
||||
|
||||
@@: cmp byte[esi+ecx-1],' '
|
||||
jne @f
|
||||
loop @b
|
||||
@@: jecxz .endcopy
|
||||
xor edx,edx
|
||||
mov ebx,edx
|
||||
mov ah,dl
|
||||
|
||||
.next_char:
|
||||
mov al,[esi+ebx]
|
||||
inc ebx
|
||||
; cmp [asm_mode],0
|
||||
; je .put
|
||||
test [options],OPTS_OPTIMSAVE
|
||||
jz .put
|
||||
test ah,00000001b
|
||||
jnz .char
|
||||
cmp al,'"'
|
||||
jne @f
|
||||
xor ah,00000100b
|
||||
jmp .char
|
||||
@@: cmp al,"'"
|
||||
jne @f
|
||||
xor ah,00000010b
|
||||
jmp .char
|
||||
@@: test ah,00000110b
|
||||
jnz .char
|
||||
cmp al,';'
|
||||
jne @f
|
||||
test ah,00000001b
|
||||
jnz .char
|
||||
xor ah,00000001b
|
||||
jmp .char
|
||||
@@: cmp al,' '
|
||||
jne .char
|
||||
inc edx
|
||||
test ebx,ATABW-1
|
||||
jnz @f
|
||||
dec edx
|
||||
jle .put
|
||||
mov al,9
|
||||
xor edx,edx
|
||||
jmp .put
|
||||
.char:
|
||||
or edx,edx
|
||||
jz .put
|
||||
push ecx eax
|
||||
mov ecx,edx
|
||||
mov al,' '
|
||||
rep stosb
|
||||
pop eax ecx
|
||||
xor edx,edx
|
||||
.put:
|
||||
stosb
|
||||
@@: loop .next_char
|
||||
|
||||
.endcopy:
|
||||
mov eax,0x0A0D
|
||||
stosw
|
||||
movzx eax,word[esi-4]
|
||||
add esi,eax;[esi-4]
|
||||
ret
|
||||
endf
|
||||
|
||||
func set_status_fs_error
|
||||
push eax
|
||||
mov esi,s_fs_error
|
||||
@@: dec eax
|
||||
js @f
|
||||
movzx ecx,byte[esi]
|
||||
lea esi,[esi+ecx+1]
|
||||
jmp @b
|
||||
@@: inc esi
|
||||
mov [s_status],esi
|
||||
pop eax
|
||||
call writepos
|
||||
ret
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func load_hd_file ;///////////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
mov [f_info+0],0
|
||||
mov [f_info+8],300000/512
|
||||
; mov esi,s_fname
|
||||
; mov edi,f_info.path;pathfile_read
|
||||
; mov ecx,PATHL
|
||||
; cld
|
||||
; rep movsb
|
||||
;mcall 58,f_info ; fileinfo_read
|
||||
|
||||
mov [f_info70+0],0
|
||||
mov [f_info70+4],0
|
||||
mov [f_info70+8],0
|
||||
mov [f_info70+12],300000;/512
|
||||
mov [f_info70+16],AREA_TEMP
|
||||
mov byte[f_info70+20],0
|
||||
mov [f_info70+21],f_info.path
|
||||
mcall 70,f_info70
|
||||
|
||||
call set_status_fs_error
|
||||
|
||||
xchg eax,ebx
|
||||
inc eax
|
||||
test ebx,ebx
|
||||
je load_file.file_found
|
||||
cmp ebx,6 ;// ATV driver fix (6 instead of 5)
|
||||
je load_file.file_found
|
||||
; jmp file_not_found
|
||||
stc
|
||||
ret
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func load_file ;//////////////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
|
||||
mov esi,tb_opensave.text
|
||||
mov edi,f_info.path
|
||||
movzx ecx,[tb_opensave.length]
|
||||
mov [f_info.length],ecx
|
||||
cld
|
||||
rep movsb
|
||||
mov byte[edi],0
|
||||
|
||||
cmp byte[f_info.path],'/'
|
||||
je load_hd_file
|
||||
|
||||
mcall 6,f_info.path,0,16800,AREA_TEMP ; 6 = open file
|
||||
inc eax ; eax = -1 -> file not found
|
||||
jnz .file_found
|
||||
; jmp file_not_found
|
||||
stc
|
||||
ret
|
||||
|
||||
.file_found:
|
||||
dec eax
|
||||
mov [filesize],eax
|
||||
mov [lines],1
|
||||
mov [columns],0
|
||||
mov esi,AREA_TEMP
|
||||
mov edi,AREA_EDIT
|
||||
mov edx,eax
|
||||
|
||||
.next_line:
|
||||
mov ebx,edi
|
||||
add edi,4
|
||||
.next_char:
|
||||
or edx,edx
|
||||
jle .exit
|
||||
lodsb
|
||||
dec edx
|
||||
cmp al,13
|
||||
je .CR
|
||||
cmp al,10
|
||||
je .LF
|
||||
cmp al,9
|
||||
je .TB
|
||||
cmp al,0
|
||||
je .exit
|
||||
stosb
|
||||
jmp .next_char
|
||||
|
||||
.exit:
|
||||
mov ecx,10
|
||||
mov al,' '
|
||||
rep stosb
|
||||
lea eax,[edi-4]
|
||||
sub eax,ebx
|
||||
mov [ebx],eax
|
||||
mov dword[ebx+eax+4],0
|
||||
sub eax,10
|
||||
jnz @f
|
||||
inc eax
|
||||
@@: cmp eax,[columns]
|
||||
jbe @f
|
||||
mov [columns],eax
|
||||
@@: mov [modified],0
|
||||
clc
|
||||
ret
|
||||
|
||||
.CR: cmp byte[esi],10
|
||||
jne .LF
|
||||
lodsb
|
||||
dec edx
|
||||
.LF: mov ecx,10
|
||||
mov al,' '
|
||||
rep stosb
|
||||
lea eax,[edi-4]
|
||||
sub eax,ebx
|
||||
mov [ebx],eax
|
||||
inc [lines]
|
||||
add eax,-10
|
||||
cmp eax,[columns]
|
||||
jbe .next_line
|
||||
mov [columns],eax
|
||||
jmp .next_line
|
||||
|
||||
.TB: lea eax,[edi-4]
|
||||
sub eax,ebx
|
||||
mov ecx,eax
|
||||
add ecx,ATABW
|
||||
and ecx,not(ATABW-1)
|
||||
sub ecx,eax
|
||||
mov al,' '
|
||||
rep stosb
|
||||
jmp .next_char
|
||||
endf
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
func new_file ;///////////////////////////////////////////////////////////////
|
||||
;-----------------------------------------------------------------------------
|
||||
; mcall 55,eax,error_beep ; beep
|
||||
mov [lines],1 ; open empty document
|
||||
mov [columns],1
|
||||
xor eax,eax
|
||||
mov [top_line],eax
|
||||
mov [pos.x],eax
|
||||
mov [pos.y],eax
|
||||
mov edi,AREA_EDIT+4
|
||||
mov ecx,10
|
||||
mov [edi-4],ecx
|
||||
mov [edi+10],eax
|
||||
mov al,' '
|
||||
cld
|
||||
rep stosb
|
||||
|
||||
mov [f_info.length],0
|
||||
mov [modified],0
|
||||
mov [asm_mode],0
|
||||
call update_caption
|
||||
call drawwindow
|
||||
|
||||
ret
|
||||
endf
|
1404
programs/develop/tinypad/trunk/tp-key.asm
Normal file
1404
programs/develop/tinypad/trunk/tp-key.asm
Normal file
File diff suppressed because it is too large
Load Diff
422
programs/develop/tinypad/trunk/tp-mouse.asm
Normal file
422
programs/develop/tinypad/trunk/tp-mouse.asm
Normal file
@ -0,0 +1,422 @@
|
||||
func check_mouse_in_edit_area
|
||||
mcall 37,1
|
||||
mov ebx,eax
|
||||
and ebx,0x0000FFFF
|
||||
shr eax,16
|
||||
mov ecx,[top_ofs]
|
||||
inc ecx
|
||||
pushd [left_ofs] ATOPH [p_info.client_box.width] ATOPH
|
||||
popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
|
||||
sub [__rc+0x8],SCRLW+6
|
||||
imul ecx,[lines.scr],LINEH
|
||||
dec ecx
|
||||
add [__rc+0xC],ecx
|
||||
mov ecx,__rc
|
||||
call pt_in_rect
|
||||
ret
|
||||
endf
|
||||
|
||||
func get_mouse_event
|
||||
mcall 37,2
|
||||
and al,3
|
||||
mov bl,[ecx]
|
||||
cmp [ecx],al
|
||||
mov [ecx],al
|
||||
jne @f
|
||||
mov eax,MEV_MOVE
|
||||
ret
|
||||
@@: mov bh,al
|
||||
and ebx,0x0101
|
||||
cmp bl,bh
|
||||
je .rb
|
||||
test al,1
|
||||
jz @f
|
||||
mov eax,MEV_LDOWN
|
||||
ret
|
||||
@@: mov eax,MEV_LUP
|
||||
ret
|
||||
.rb: test al,2
|
||||
jz @f
|
||||
mov eax,MEV_RDOWN
|
||||
ret
|
||||
@@: mov eax,MEV_RUP
|
||||
ret
|
||||
endf
|
||||
|
||||
mouse_ev dd mouse.l_down,mouse.l_up,mouse.r_down,mouse.r_up,mouse.move
|
||||
|
||||
mouse:
|
||||
mov ecx,mst
|
||||
call get_mouse_event
|
||||
cmp [bot_mode],0
|
||||
je @f
|
||||
mov ah,al
|
||||
mov al,4
|
||||
call [bot_dlg_handler]
|
||||
jmp still
|
||||
@@: cmp al,MEV_MOVE
|
||||
jne .no_move
|
||||
cmp [popup_active],1
|
||||
je @f
|
||||
.no_move:
|
||||
mov [s_status],0
|
||||
|
||||
push eax
|
||||
mcall 9,p_info,-1
|
||||
cmp ax,[p_info.window_stack_position]
|
||||
pop eax
|
||||
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]
|
||||
|
||||
.move:
|
||||
mcall 37,1
|
||||
movsx ebx,ax
|
||||
sar eax,16
|
||||
cmp [body_capt],0
|
||||
jge .check_body.2
|
||||
cmp [vscrl_capt],0
|
||||
jge .check_vscroll.2
|
||||
cmp [hscrl_capt],0
|
||||
jge .check_hscroll.2
|
||||
|
||||
cmp [do_not_draw],0
|
||||
jne still.skip_write
|
||||
mov eax,[mi_cur]
|
||||
call get_active_menu_item
|
||||
cmp eax,[mi_cur]
|
||||
je still.skip_write
|
||||
push [mi_cur]
|
||||
cmp [popup_active],0
|
||||
je @f
|
||||
mov [mi_cur],eax
|
||||
@@: call draw_main_menu
|
||||
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
|
||||
mov eax,[main_menu.popups+ecx*4-4]
|
||||
mov edx,main_menu
|
||||
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
|
||||
|
||||
|
||||
.r_down:
|
||||
@@: cmp [popup_active],0
|
||||
je @f
|
||||
mcall 5,1
|
||||
jmp @b
|
||||
@@: cmp [mouse_captured],0
|
||||
jne still.skip_write
|
||||
call check_mouse_in_edit_area
|
||||
jnc still.skip_write
|
||||
mcall 37,0
|
||||
mov [popup_edit+POPUP.pos],eax
|
||||
@@: mcall 37,2
|
||||
cmp eax,ebx
|
||||
jnz @f
|
||||
mcall 5,1
|
||||
jmp @b
|
||||
@@: and [mst],0xFD
|
||||
call onshow.edit
|
||||
mov dword[POPUP_STACK],popup_edit
|
||||
mcall 51,1,popup_thread_start,POPUP_STACK
|
||||
mov [h_popup],eax
|
||||
jmp still.skip_write
|
||||
|
||||
.r_up:
|
||||
jmp still.skip_write
|
||||
|
||||
.l_down:
|
||||
call check_mouse_in_edit_area
|
||||
jnc .check_vscroll
|
||||
mov [mouse_captured],1
|
||||
mov [body_capt],1
|
||||
|
||||
call clear_selection
|
||||
|
||||
.check_body.2:
|
||||
sub eax,[left_ofs]
|
||||
sub ebx,[top_ofs]
|
||||
dec ebx
|
||||
; sub ebx,[__rc+0x4]
|
||||
push eax
|
||||
mov eax,ebx
|
||||
cdq;xor edx,edx
|
||||
mov ecx,LINEH
|
||||
idiv ecx
|
||||
@@: add eax,[top_line]
|
||||
mov ebx,eax
|
||||
pop eax
|
||||
cdq;xor edx,edx
|
||||
mov ecx,6
|
||||
idiv ecx
|
||||
@@: add eax,[left_col]
|
||||
|
||||
cmp eax,[columns]
|
||||
jl @f
|
||||
mov eax,[columns]
|
||||
@@: cmp ebx,[lines]
|
||||
jl @f
|
||||
mov ebx,[lines]
|
||||
dec ebx
|
||||
@@:
|
||||
cmp [pos.x],eax
|
||||
jne .change_cur_pos
|
||||
cmp [pos.y],ebx
|
||||
je still.skip_write
|
||||
|
||||
.change_cur_pos:
|
||||
mov [pos.x],eax
|
||||
mov eax,[pos.y]
|
||||
mov [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:
|
||||
jmp still
|
||||
|
||||
.check_vscroll:
|
||||
mov ecx,[p_info.client_box.width]
|
||||
sub ecx,SCRLW-2
|
||||
pushd ecx [top_ofs] ecx [bot_ofs]
|
||||
popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
|
||||
add [__rc+0x8],SCRLW-1;!!!!!!!!!!!!!!-2
|
||||
add [__rc+0x4],SCRLW;!!!!!!!!!!!!!!+1
|
||||
sub [__rc+0xC],SCRLW*2+3
|
||||
mov ecx,__rc
|
||||
call pt_in_rect
|
||||
jnc .check_hscroll
|
||||
|
||||
.check_vscroll.2:
|
||||
sub ebx,[top_ofs]
|
||||
sub ebx,SCRLW;!!!!!!!!!!!!!!+1
|
||||
; sub ebx,[__rc+0x4]
|
||||
cmp [vscrl_capt],0
|
||||
jge .vcaptured
|
||||
mov eax,[vscrl_top]
|
||||
cmp ebx,eax
|
||||
jb .center_vcapture
|
||||
add eax,[vscrl_size]
|
||||
cmp ebx,eax
|
||||
jae .center_vcapture
|
||||
mov eax,ebx
|
||||
sub eax,[vscrl_top]
|
||||
dec eax
|
||||
mov [vscrl_capt],eax
|
||||
dec ebx
|
||||
jmp .vcaptured
|
||||
.center_vcapture:
|
||||
mov eax,[vscrl_size]
|
||||
shr eax,1
|
||||
mov [vscrl_capt],eax
|
||||
.vcaptured:
|
||||
sub ebx,[vscrl_capt]
|
||||
jns @f
|
||||
xor ebx,ebx
|
||||
@@: mov [mouse_captured],1
|
||||
mov eax,[bot_ofs]
|
||||
sub eax,[top_ofs]
|
||||
sub eax,[vscrl_size]
|
||||
sub eax,SCRLW*3-2
|
||||
cmp eax,ebx
|
||||
jge @f
|
||||
mov ebx,eax
|
||||
@@:
|
||||
mov [vscrl_top],ebx
|
||||
mov eax,[lines]
|
||||
sub eax,[lines.scr]
|
||||
imul ebx
|
||||
mov ebx,[bot_ofs]
|
||||
sub ebx,[top_ofs]
|
||||
sub ebx,SCRLW*3-2 ;**
|
||||
sub ebx,[vscrl_size]
|
||||
idiv ebx
|
||||
cmp eax,[top_line]
|
||||
je still.skip_write
|
||||
mov [top_line],eax
|
||||
call check_bottom_right
|
||||
call draw_file
|
||||
jmp still.skip_write
|
||||
|
||||
.check_hscroll:
|
||||
pushd (5+SCRLW+1) [bot_ofs] [p_info.box.width] [bot_ofs]
|
||||
popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0]
|
||||
add [__rc+0x8],-SCRLW*2-10-1
|
||||
add [__rc+0x4],-SCRLW
|
||||
add [__rc+0xC],-2
|
||||
mov ecx,__rc
|
||||
call pt_in_rect
|
||||
jnc .check_main_menu
|
||||
|
||||
.check_hscroll.2:
|
||||
mov ebx,eax
|
||||
sub ebx,(5+SCRLW+1)
|
||||
; sub ebx,[__rc+0x0]
|
||||
cmp [hscrl_capt],0
|
||||
jge .hcaptured
|
||||
mov eax,[hscrl_top]
|
||||
cmp ebx,eax
|
||||
jl .center_hcapture
|
||||
add eax,[hscrl_size]
|
||||
cmp ebx,eax
|
||||
jge .center_hcapture
|
||||
mov eax,ebx
|
||||
sub eax,[hscrl_top]
|
||||
dec eax
|
||||
mov [hscrl_capt],eax
|
||||
dec ebx
|
||||
jmp .hcaptured
|
||||
.center_hcapture:
|
||||
mov eax,[hscrl_size]
|
||||
shr eax,1
|
||||
mov [hscrl_capt],eax
|
||||
.hcaptured:
|
||||
sub ebx,[hscrl_capt]
|
||||
jns @f
|
||||
xor ebx,ebx
|
||||
@@: mov [mouse_captured],1
|
||||
mov eax,[p_info.box.width]
|
||||
sub eax,[hscrl_size]
|
||||
sub eax,SCRLW*3+10+1
|
||||
cmp eax,ebx
|
||||
jge @f
|
||||
mov ebx,eax
|
||||
@@:
|
||||
mov [hscrl_top],ebx
|
||||
mov eax,[columns]
|
||||
sub eax,[columns.scr]
|
||||
imul ebx
|
||||
mov ebx,[p_info.box.width]
|
||||
sub ebx,SCRLW*3+10+1 ;**
|
||||
sub ebx,[hscrl_size]
|
||||
idiv ebx
|
||||
cmp eax,[left_col]
|
||||
je still.skip_write
|
||||
mov [left_col],eax
|
||||
call check_bottom_right
|
||||
call draw_file
|
||||
jmp still.skip_write
|
||||
|
||||
.check_main_menu:
|
||||
cmp [do_not_draw],0
|
||||
jne .capture_off
|
||||
|
||||
@@: mcall 37,2
|
||||
test eax,0x01
|
||||
jz @f
|
||||
mcall 5,1
|
||||
jmp @b
|
||||
@@: and [mst],0xFE
|
||||
|
||||
cmp [mi_cur],0
|
||||
jle .capture_off
|
||||
mov ecx,[mi_cur]
|
||||
mov eax,[main_menu.popups+ecx*4-4]
|
||||
mov edx,main_menu
|
||||
call dword[main_menu.onshow+ecx*4-4]
|
||||
call setup_main_menu_popup
|
||||
mcall 51,1,popup_thread_start,POPUP_STACK
|
||||
mov [h_popup],eax
|
||||
|
||||
.l_up:
|
||||
.capture_off:
|
||||
or eax,-1
|
||||
mov [vscrl_capt],eax
|
||||
mov [hscrl_capt],eax
|
||||
mov [body_capt],eax
|
||||
mov [mouse_captured],0
|
||||
mov [just_from_popup],0
|
||||
jmp still.skip_write
|
||||
|
||||
|
||||
func setup_main_menu_popup
|
||||
mov ebx,[p_info.box.left]
|
||||
add ebx,[p_info.client_box.left]
|
||||
@@: dec ecx
|
||||
jz @f
|
||||
add edx,8+1
|
||||
movzx esi,byte[edx-1]
|
||||
add edx,esi
|
||||
jmp @b
|
||||
@@: movzx ecx,word[edx+2]
|
||||
add ebx,ecx
|
||||
|
||||
mov [eax+POPUP.x],bx
|
||||
mov ebx,[p_info.box.top]
|
||||
add ebx,[p_info.client_box.top]
|
||||
add ebx,ATOPH-1
|
||||
mov [eax+POPUP.y],bx
|
||||
mov [POPUP_STACK],eax
|
||||
ret
|
||||
endf
|
||||
|
||||
onshow:
|
||||
|
||||
.file:
|
||||
or byte[popup_file+3],0x01
|
||||
cmp [f_info.length],0
|
||||
jne @f
|
||||
and byte[popup_file+3],0xFE
|
||||
@@: ret
|
||||
|
||||
.edit:
|
||||
or byte[popup_edit+2],0x01
|
||||
cmp [copy_size],0
|
||||
jne @f
|
||||
and byte[popup_edit+2],0xFE
|
||||
@@: or dword[popup_edit+0],0x01000101
|
||||
cmp [sel.selected],0
|
||||
jne @f
|
||||
and dword[popup_edit+0],0xFEFFFEFE
|
||||
@@: ret
|
||||
|
||||
.search:
|
||||
mov byte[popup_search+0],0
|
||||
;mov byte[popup_search+4],0
|
||||
ret
|
||||
.run:
|
||||
ret
|
||||
.options:
|
||||
mov word[popup_options+0],0
|
||||
mov byte[popup_options+5],0
|
||||
or byte[popup_options+2],0x02
|
||||
test [options],OPTS_SECURESEL
|
||||
jnz @f
|
||||
and byte[popup_options+2],0xFD
|
||||
@@: or byte[popup_options+3],0x02
|
||||
test [options],OPTS_AUTOBRACES
|
||||
jnz @f
|
||||
and byte[popup_options+3],0xFD
|
||||
@@: or byte[popup_options+4],0x02
|
||||
test [options],OPTS_AUTOINDENT
|
||||
jnz @f
|
||||
and byte[popup_options+4],0xFD
|
||||
@@: or byte[popup_options+6],0x02
|
||||
test [options],OPTS_OPTIMSAVE
|
||||
jnz @f
|
||||
and byte[popup_options+6],0xFD
|
||||
@@: or byte[popup_options+8],0x02
|
||||
test [options],OPTS_LINENUMS
|
||||
jnz @f
|
||||
and byte[popup_options+8],0xFD
|
||||
@@: ret
|
321
programs/develop/tinypad/trunk/tp-popup.asm
Normal file
321
programs/develop/tinypad/trunk/tp-popup.asm
Normal file
@ -0,0 +1,321 @@
|
||||
;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
|
||||
|
||||
func calc_middle
|
||||
shr eax,1
|
||||
shr ebx,1
|
||||
and eax,0x007F7F7F
|
||||
and ebx,0x007F7F7F
|
||||
add eax,ebx
|
||||
ret
|
||||
endf
|
||||
|
||||
func calc_3d_colors
|
||||
pushad
|
||||
m2m [cl_3d_normal],[sc.work]
|
||||
m2m [cl_3d_inset],[sc.work_graph]
|
||||
push [cl_3d_normal]
|
||||
add byte[esp],48
|
||||
jnc @f
|
||||
mov byte[esp],255
|
||||
@@: add byte[esp+1],48
|
||||
jnc @f
|
||||
mov byte[esp+1],255
|
||||
@@: add byte[esp+2],48
|
||||
jnc @f
|
||||
mov byte[esp+2],255
|
||||
@@: pop [cl_3d_outset]
|
||||
mov eax,[cl_3d_inset]
|
||||
mov ebx,[cl_3d_outset]
|
||||
call calc_middle
|
||||
mov [cl_3d_pushed],eax
|
||||
mov eax,[cl_3d_normal]
|
||||
mov ebx,[sc.work_text]
|
||||
call calc_middle
|
||||
mov [cl_3d_grayed],eax
|
||||
popad
|
||||
ret
|
||||
endf
|
||||
|
||||
func draw_3d_panel ; x,y,w,h
|
||||
cmp dword[esp+8],4
|
||||
jl .exit
|
||||
cmp dword[esp+4],4
|
||||
jl .exit
|
||||
mov ebx,[esp+16-2]
|
||||
mov bx,[esp+8]
|
||||
inc ebx
|
||||
mov ecx,[esp+12-2]
|
||||
mov cx,[esp+4]
|
||||
inc ecx
|
||||
mcall 13,,,[cl_3d_normal];0x00EEEEEE;[sc.work]
|
||||
dec ebx
|
||||
add bx,[esp+16]
|
||||
mov cx,[esp+12]
|
||||
mcall 38,,,[cl_3d_inset];0x006382BF;[sc.work_text]
|
||||
add ecx,[esp+4-2]
|
||||
add cx,[esp+4]
|
||||
mcall
|
||||
mov bx,[esp+16]
|
||||
mov ecx,[esp+12-2]
|
||||
mov cx,[esp+4]
|
||||
add cx,[esp+12]
|
||||
mcall
|
||||
add ebx,[esp+8-2]
|
||||
add bx,[esp+8]
|
||||
mcall
|
||||
mov ebx,[esp+16-2]
|
||||
mov bx,[esp+8]
|
||||
add bx,[esp+16]
|
||||
add ebx,1*65536-1
|
||||
mov ecx,[esp+12-2]
|
||||
mov cx,[esp+12]
|
||||
add ecx,0x00010001
|
||||
mcall ,,,[cl_3d_outset]
|
||||
mov bx,[esp+16]
|
||||
inc ebx
|
||||
mov ecx,[esp+12-2]
|
||||
mov cx,[esp+4]
|
||||
add cx,[esp+12]
|
||||
add ecx,2*65536-1
|
||||
mcall
|
||||
.exit:
|
||||
ret 4*4
|
||||
endf
|
||||
|
||||
popup_thread_start:
|
||||
mov [popup_active],1
|
||||
mov [pi_cur],0
|
||||
mov ebp,[esp]
|
||||
mcall 14
|
||||
movzx ebx,ax
|
||||
shr eax,16
|
||||
movzx ecx,[ebp+POPUP.x]
|
||||
add cx,[ebp+POPUP.width]
|
||||
cmp ecx,eax
|
||||
jle @f
|
||||
mov cx,[ebp+POPUP.width]
|
||||
sub [ebp+POPUP.x],cx
|
||||
@@: movzx ecx,[ebp+POPUP.y]
|
||||
add cx,[ebp+POPUP.height]
|
||||
cmp ecx,ebx
|
||||
jle @f
|
||||
mov cx,[ebp+POPUP.height]
|
||||
sub [ebp+POPUP.y],cx
|
||||
@@: mcall 40,01100111b ; ipc mouse button key redraw
|
||||
cmp [mi_cur],0
|
||||
jl .2
|
||||
sub esp,32-16
|
||||
push 0 0 8 0
|
||||
mcall 60,1,esp,32
|
||||
.2: call draw_popup_wnd
|
||||
|
||||
still_popup:
|
||||
cmp [main_closed],1
|
||||
je close_popup
|
||||
mcall 10
|
||||
cmp eax,1
|
||||
je popup_thread_start.2
|
||||
cmp eax,2
|
||||
je key_popup
|
||||
cmp eax,3
|
||||
je button_popup
|
||||
cmp eax,6
|
||||
je mouse_popup
|
||||
cmp eax,7
|
||||
jne still_popup
|
||||
|
||||
mov ebp,[POPUP_STACK];-32+12+4]
|
||||
mov dword[POPUP_STACK-32+4],8
|
||||
movzx ebx,[ebp+POPUP.x]
|
||||
movzx ecx,[ebp+POPUP.y]
|
||||
movzx edx,[ebp+POPUP.width]
|
||||
movzx esi,[ebp+POPUP.height]
|
||||
mcall 67
|
||||
; call draw_popup_wnd
|
||||
jmp still_popup
|
||||
|
||||
mouse_popup:
|
||||
mov ecx,mst2
|
||||
call get_mouse_event
|
||||
cmp al,MEV_LDOWN
|
||||
je check_popup_click
|
||||
cmp al,MEV_MOVE
|
||||
je check_popup_move
|
||||
|
||||
mcall 9,p_info2,-1
|
||||
cmp ax,[p_info2.window_stack_position]
|
||||
jne close_popup
|
||||
|
||||
jmp still_popup
|
||||
|
||||
check_popup_click:
|
||||
mov eax,[pi_cur]
|
||||
or al,al
|
||||
js close_popup
|
||||
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]
|
||||
inc [just_from_popup]
|
||||
jmp close_popup
|
||||
|
||||
check_popup_move:
|
||||
mov eax,[pi_cur]
|
||||
call get_active_popup_item
|
||||
cmp eax,[pi_cur]
|
||||
je still_popup
|
||||
call draw_popup_wnd
|
||||
jmp still_popup
|
||||
|
||||
key_popup:
|
||||
mcall ;2
|
||||
cmp ah,27
|
||||
jne still_popup
|
||||
|
||||
button_popup:
|
||||
mcall 17
|
||||
|
||||
close_popup:
|
||||
mcall 18,3,[p_info.PID]
|
||||
mov [popup_active],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]
|
||||
mov cx,[ebp+POPUP.height]
|
||||
mcall 0,,,0x01000000,0x01000000
|
||||
|
||||
movzx ebx,bx
|
||||
movzx ecx,cx
|
||||
pushd 0 0 ebx ecx ;POP_WIDTH POP_HEIGHT
|
||||
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
|
||||
@@: inc [pi_sel]
|
||||
inc edx
|
||||
movzx esi,byte[edx-1]
|
||||
cmp byte[edx],'-'
|
||||
jne .lp1
|
||||
pushad
|
||||
mov ecx,ebx
|
||||
shl ecx,16
|
||||
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]
|
||||
add ecx,0x00010001
|
||||
mcall ,,,[cl_3d_outset];0x00FFFFFF
|
||||
popad
|
||||
add ebx,4
|
||||
jmp .lp2
|
||||
.lp1: mov edi,[pi_sel]
|
||||
cmp edi,[pi_cur]
|
||||
jne .lp3
|
||||
test byte[ebp+edi-1],0x01 ; byte[popup_text+edi-1],0x01
|
||||
jz .lp3
|
||||
pushad
|
||||
movzx ecx,bx
|
||||
shl ecx,16
|
||||
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
|
||||
rol ecx,16
|
||||
mov ax,cx
|
||||
rol ecx,16
|
||||
mov cx,ax
|
||||
mcall 38,,,[cl_3d_inset];0x006382BF
|
||||
add ecx,(POP_IHEIGHT-1)*65536+POP_IHEIGHT-1
|
||||
mcall ,,,[cl_3d_outset];0x00FFFFFF
|
||||
popad
|
||||
.lp3: add ebx,(POP_IHEIGHT-7)/2
|
||||
|
||||
pushad
|
||||
test byte[ebp+edi-1],0x02
|
||||
jz .lp8
|
||||
movzx ecx,bx
|
||||
shl ecx,16
|
||||
mov cx,bx
|
||||
shr ebx,16
|
||||
push bx
|
||||
shl ebx,16
|
||||
pop bx
|
||||
add ecx,0x00040003
|
||||
sub ebx,0x000A000B
|
||||
mcall 38,,,[sc.work_text]
|
||||
add ecx,0x00010001
|
||||
mcall
|
||||
add ebx,4
|
||||
sub ecx,2
|
||||
mcall
|
||||
sub ecx,0x00010001
|
||||
mcall
|
||||
.lp8: popad
|
||||
|
||||
mov ecx,[sc.work_text];0x00000000
|
||||
test byte[ebp+edi-1],0x01 ; byte[popup_text+edi-1],0x01
|
||||
jnz .lp5
|
||||
add ebx,0x00010001
|
||||
mov ecx,[cl_3d_outset]
|
||||
mcall
|
||||
sub ebx,0x00010001
|
||||
mov ecx,[cl_3d_inset]
|
||||
;mov ecx,[sc.grab_text];0x007F7F7F
|
||||
.lp5: mcall
|
||||
push ebx
|
||||
add edx,esi
|
||||
inc edx
|
||||
movzx esi,byte[edx-1]
|
||||
add ebx,[ebp+POPUP.acc_ofs] ; ((popup_text.max_title+2)*6-1)*65536
|
||||
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
|
||||
jnz .lp6
|
||||
add ebx,0x00010001
|
||||
mov ecx,[cl_3d_outset]
|
||||
mcall
|
||||
sub ebx,0x00010001
|
||||
mov ecx,[cl_3d_inset]
|
||||
;mov ecx,[sc.grab_text];0x007F7F7F
|
||||
.lp6: mcall
|
||||
pop ebx
|
||||
add ebx,POP_IHEIGHT-(POP_IHEIGHT-7)/2
|
||||
.lp2: add edx,esi
|
||||
cmp byte[edx],0
|
||||
jne @b
|
||||
.exit:
|
||||
mcall 12,2
|
||||
ret
|
||||
endf
|
||||
|
||||
pi_sel dd ?
|
||||
pi_cur dd ?
|
||||
p_pos dd ?
|
||||
popup_active db 0
|
390
programs/develop/tinypad/trunk/tp-tbox.asm
Normal file
390
programs/develop/tinypad/trunk/tp-tbox.asm
Normal file
@ -0,0 +1,390 @@
|
||||
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
|
||||
|
||||
tb.pos.x db ?
|
||||
tb.sel.x db ?
|
||||
tb.sel.selected db ?
|
||||
|
||||
func textbox.get_width
|
||||
push ebx edx
|
||||
movzx eax,[tbox.width-2]
|
||||
add eax,-6
|
||||
xor edx,edx
|
||||
mov ebx,6
|
||||
div ebx
|
||||
movzx ebx,[tbox.length]
|
||||
cmp eax,ebx
|
||||
jle @f
|
||||
mov eax,ebx
|
||||
@@: pop edx ebx
|
||||
ret
|
||||
endf
|
||||
|
||||
func textbox.delete_selection
|
||||
cmp [tb.sel.selected],0
|
||||
je .exit.2
|
||||
pushad
|
||||
movzx ecx,[tbox.length]
|
||||
sub cl,[tb.sel.x]
|
||||
lea eax,[tbox.text]
|
||||
movzx esi,[tb.pos.x]
|
||||
movzx edi,[tb.sel.x]
|
||||
add esi,eax
|
||||
add edi,eax
|
||||
mov eax,esi
|
||||
sub eax,edi
|
||||
sub [tbox.length],al
|
||||
cld
|
||||
rep movsb
|
||||
|
||||
.exit:
|
||||
mov al,[tb.sel.x]
|
||||
mov [tbox.pos.x],al
|
||||
mov [tbox.sel.x],al
|
||||
popad
|
||||
clc
|
||||
ret
|
||||
|
||||
.exit.2:
|
||||
stc
|
||||
ret
|
||||
endf
|
||||
|
||||
func textbox.draw ; TBOX* ebp
|
||||
call textbox.get_width
|
||||
movzx ebx,[tbox.pos.x]
|
||||
sub bl,[tbox.ofs.x]
|
||||
sub ebx,eax
|
||||
jle @f
|
||||
mov bl,[tbox.pos.x]
|
||||
sub bl,al
|
||||
mov [tbox.ofs.x],bl
|
||||
@@:
|
||||
mov [tb.sel.selected],0
|
||||
mov al,[tbox.pos.x]
|
||||
mov ah,[tbox.sel.x]
|
||||
cmp al,ah
|
||||
je @f
|
||||
inc [tb.sel.selected]
|
||||
ja @f
|
||||
xchg al,ah
|
||||
@@: mov [tb.pos.x],al
|
||||
mov [tb.sel.x],ah
|
||||
|
||||
mcall 13,dword[tbox.x],dword[tbox.y],[color_tbl+4*5];[sc.work]
|
||||
call draw_framerect
|
||||
|
||||
call textbox.get_width
|
||||
mov esi,eax
|
||||
mov edi,eax
|
||||
|
||||
cmp ebp,[focused_tb]
|
||||
je @f
|
||||
mov ebx,dword[tbox.x]
|
||||
mov bx,[tbox.y+2]
|
||||
movzx eax,[tbox.height-2]
|
||||
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]
|
||||
ret
|
||||
|
||||
@@: movzx eax,[tb.pos.x]
|
||||
cmp al,[tb.sel.x]
|
||||
je @f
|
||||
sub al,[tbox.ofs.x]
|
||||
jz @f
|
||||
movzx ebx,[tb.sel.x]
|
||||
sub bl,[tbox.ofs.x]
|
||||
jge .lp1
|
||||
xor ebx,ebx
|
||||
.lp1: push eax ebx
|
||||
sub eax,ebx
|
||||
mov ecx,edi
|
||||
sub ecx,ebx
|
||||
cmp eax,ecx
|
||||
jbe .lp2
|
||||
mov eax,ecx
|
||||
.lp2: imul eax,6
|
||||
imul ebx,6
|
||||
movzx ecx,[tbox.x+2]
|
||||
add ecx,3
|
||||
; sub eax,ebx
|
||||
add ebx,ecx
|
||||
shl ebx,16
|
||||
add ebx,eax
|
||||
movzx ecx,[tbox.height-2]
|
||||
shr ecx,1
|
||||
add cx,[tbox.y+2]
|
||||
shl ecx,16
|
||||
add ecx,-5*65536+10
|
||||
mcall 13,,,[color_tbl+4*7];0x0000007F
|
||||
|
||||
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]
|
||||
shr eax,1
|
||||
add eax,4*65536-4
|
||||
add ebx,eax
|
||||
mov eax,4
|
||||
or esi,esi
|
||||
jz .lp3
|
||||
mcall ,,[color_tbl+4*0];[sc.work_text]
|
||||
.lp3: sub edi,esi
|
||||
jnz .lp4
|
||||
add esp,8
|
||||
jmp .exit
|
||||
.lp4:
|
||||
add edx,esi
|
||||
imul esi,6*65536
|
||||
add ebx,esi
|
||||
pop ecx esi
|
||||
sub esi,ecx
|
||||
cmp esi,edi
|
||||
jbe .lp5
|
||||
mov esi,edi
|
||||
.lp5:
|
||||
mcall ,,[color_tbl+4*6];0x00FFFFFF
|
||||
sub edi,esi
|
||||
jz .exit
|
||||
add edx,esi
|
||||
imul esi,6*65536
|
||||
add ebx,esi
|
||||
lea ecx,[tbox.text]
|
||||
; sub ecx,edx
|
||||
; add edi,ecx
|
||||
mcall ,,[color_tbl+4*0],,edi;[sc.work_text],,edi
|
||||
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]
|
||||
shr eax,1
|
||||
add eax,4*65536-4
|
||||
add ebx,eax
|
||||
movzx eax,[tbox.ofs.x]
|
||||
call textbox.get_width
|
||||
mov esi,eax
|
||||
mcall 4,,[color_tbl+4*0];[sc.work_text]
|
||||
|
||||
.exit:
|
||||
movzx ebx,[tbox.pos.x]
|
||||
movzx eax,[tbox.ofs.x]
|
||||
sub ebx,eax
|
||||
imul ebx,6
|
||||
movzx eax,[tbox.x+2]
|
||||
add eax,3
|
||||
add ebx,eax
|
||||
push bx
|
||||
shl ebx,16
|
||||
pop bx
|
||||
movzx ecx,[tbox.height-2]
|
||||
shr ecx,1
|
||||
add cx,[tbox.y+2]
|
||||
push cx
|
||||
shl ecx,16
|
||||
pop cx
|
||||
add ecx,-5*65536+4
|
||||
mcall 38,,,0x01000000
|
||||
add ebx,0x00010001
|
||||
mcall
|
||||
ret
|
||||
endf
|
||||
|
||||
func textbox.key
|
||||
mov ebp,[focused_tb]
|
||||
mov esi,accel_table_textbox
|
||||
.acc: cmp ebx,[esi]
|
||||
jne @f
|
||||
call dword[esi+4]
|
||||
jmp .exit.2
|
||||
@@: add esi,8
|
||||
cmp byte[esi],0
|
||||
jne .acc
|
||||
|
||||
test byte[shi+2],0x06
|
||||
jnz .exit
|
||||
cmp [tbox.length],255
|
||||
je .exit
|
||||
|
||||
movzx eax,[chr]
|
||||
movzx eax,[eax+key0]
|
||||
or al,al
|
||||
jz .exit
|
||||
mov al,[eax+key1]
|
||||
cmp [tb_casesen],0
|
||||
je @f
|
||||
cmp al,$60
|
||||
jle @f
|
||||
add al,[add_table-$60+eax]
|
||||
@@:
|
||||
call textbox.delete_selection
|
||||
|
||||
mov ecx,255
|
||||
sub cl,[tbox.pos.x]
|
||||
lea edi,[tbox.text]
|
||||
add edi,255
|
||||
lea esi,[edi-1]
|
||||
std
|
||||
rep movsb
|
||||
stosb
|
||||
cld
|
||||
inc [tbox.length]
|
||||
call key.tb.right
|
||||
|
||||
.exit.2:
|
||||
call textbox.draw
|
||||
.exit:
|
||||
ret
|
||||
endf
|
||||
|
||||
textbox.mouse:
|
||||
ret
|
||||
|
||||
func key.tb.bkspace
|
||||
call textbox.delete_selection
|
||||
jnc @f
|
||||
|
||||
cmp [tbox.pos.x],0
|
||||
je @f
|
||||
call key.tb.left
|
||||
jmp key.tb.del.direct
|
||||
|
||||
@@: ret
|
||||
endf
|
||||
|
||||
func key.tb.home
|
||||
xor al,al
|
||||
mov [tbox.pos.x],al
|
||||
mov [tbox.sel.x],al
|
||||
mov [tbox.ofs.x],al
|
||||
ret
|
||||
endf
|
||||
|
||||
func key.tb.left
|
||||
mov al,[tbox.pos.x]
|
||||
mov [tbox.sel.x],al
|
||||
dec al
|
||||
js @f
|
||||
mov [tbox.pos.x],al
|
||||
mov [tbox.sel.x],al
|
||||
cmp [tbox.ofs.x],al
|
||||
jl @f
|
||||
sub [tbox.ofs.x],8
|
||||
jge @f
|
||||
mov [tbox.ofs.x],0
|
||||
@@: ret
|
||||
endf
|
||||
|
||||
func key.tb.right
|
||||
call textbox.get_width
|
||||
mov bl,[tbox.pos.x]
|
||||
mov [tbox.sel.x],bl
|
||||
inc bl
|
||||
cmp bl,[tbox.length]
|
||||
ja @f
|
||||
mov [tbox.pos.x],bl
|
||||
mov [tbox.sel.x],bl
|
||||
sub bl,[tbox.ofs.x]
|
||||
cmp bl,al
|
||||
jbe @f
|
||||
inc [tbox.ofs.x]
|
||||
@@: ret
|
||||
endf
|
||||
|
||||
func key.tb.end
|
||||
call textbox.get_width
|
||||
movzx ebx,[tbox.length]
|
||||
mov [tbox.pos.x],bl
|
||||
mov [tbox.sel.x],bl
|
||||
sub ebx,eax
|
||||
jge @f
|
||||
xor bl,bl
|
||||
@@: mov [tbox.ofs.x],bl
|
||||
ret
|
||||
endf
|
||||
|
||||
func key.tb.del
|
||||
call textbox.delete_selection
|
||||
jnc @f
|
||||
.direct:
|
||||
movzx ecx,[tbox.length]
|
||||
sub cl,[tbox.pos.x]
|
||||
jz @f
|
||||
lea eax,[tbox.text]
|
||||
movzx edi,[tbox.pos.x]
|
||||
add edi,eax
|
||||
lea esi,[edi+1]
|
||||
dec [tbox.length]
|
||||
cld
|
||||
rep movsb
|
||||
|
||||
@@: ret
|
||||
endf
|
||||
|
||||
func key.tb.shift_home
|
||||
xor al,al
|
||||
mov [tbox.pos.x],al
|
||||
mov [tbox.ofs.x],al
|
||||
ret
|
||||
endf
|
||||
|
||||
func key.tb.shift_left
|
||||
mov al,[tbox.pos.x]
|
||||
dec al
|
||||
js @f
|
||||
mov [tbox.pos.x],al
|
||||
cmp [tbox.ofs.x],al
|
||||
jl @f
|
||||
sub [tbox.ofs.x],8
|
||||
jge @f
|
||||
mov [tbox.ofs.x],0
|
||||
@@: ret
|
||||
endf
|
||||
|
||||
func key.tb.shift_right
|
||||
call textbox.get_width
|
||||
mov bl,[tbox.pos.x]
|
||||
inc bl
|
||||
cmp bl,[tbox.length]
|
||||
ja @f
|
||||
mov [tbox.pos.x],bl
|
||||
sub bl,[tbox.ofs.x]
|
||||
cmp bl,al
|
||||
jbe @f
|
||||
inc [tbox.ofs.x]
|
||||
@@: ret
|
||||
endf
|
||||
|
||||
func key.tb.shift_end
|
||||
call textbox.get_width
|
||||
movzx ebx,[tbox.length]
|
||||
mov [tbox.pos.x],bl
|
||||
sub ebx,eax
|
||||
jge @f
|
||||
xor bl,bl
|
||||
@@: mov [tbox.ofs.x],bl
|
||||
ret
|
||||
endf
|
Loading…
Reference in New Issue
Block a user