/programs/develop/tinypad/trunk/tp-button.asm |
---|
File deleted |
\ No newline at end of file |
/programs/develop/tinypad/trunk/tp-recode.asm |
---|
File deleted |
/programs/develop/tinypad/trunk/tp-dialog.asm |
---|
File deleted |
/programs/develop/tinypad/trunk/tp-common.asm |
---|
File deleted |
/programs/develop/tinypad/trunk/tinypad.asm |
---|
2,13 → 2,13 |
; project name: TINYPAD |
; compiler: flat assembler 1.67.1 |
; memory to compile: 2.0/7.0 MBytes (without/with size optimizations) |
; version: 4.0.4 pre |
; last update: 2006-12-30 (Dec 30, 2006) |
; 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: Mike Semenyako >> mike.dld@gmail.com |
; Ivan Poddubny >> ivan-yar@bk.ru |
; maintained by: Ivan Poddubny >> ivan-yar@bk.ru |
; Mike Semenyako >> mike.dld@gmail.com |
;----------------------------------------------------------------------------- |
; TODO: |
; - optimize drawing (reduce flickering) |
19,22 → 19,15 |
; - other bugfixes and speed/size optimizations |
; |
; HISTORY: |
; 4.0.4 pre (mike.dld) |
; bug-fixes: |
; - clear statusbar text if dialog operation cancelled |
; changes: |
; - modified/saved colors now match those in MSVS |
; new features: |
; - recode tables between CP866, CP1251 and KOI8-R (suggested by Victor) |
; 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 main menu item's area |
; 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 (fixed by diamond) |
; - 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) |
149,8 → 142,6 |
header '01',1,@CODE,TINYPAD_END,AREA_ENDMEM,MAIN_STACK,@PARAMS,self_path |
APP_VERSION equ '4.0.4 pre' |
;include 'debug.inc' |
ASEPC = '-' ; separator character (char) |
184,8 → 175,8 |
RGB(255,255,255) ; RGB(224,224,224) ; RGB(255,255,255) ; background |
RGB(255,255,255) ; RGB(255,255,255) ; RGB(255,255,255) ; selection text |
RGB( 10, 36,106) ; RGB( 0, 0,128) ; RGB( 0, 64,128) ; selection background |
RGB(255,255, 0) ; modified line marker |
RGB( 0,255, 0) ; saved line marker |
RGB( 0,255, 0) ; modified line marker |
RGB(255,255, 0) ; saved line marker |
ins_mode db 1 |
502,14 → 493,13 |
include 'tp-draw.asm' |
include 'tp-key.asm' |
include 'tp-button.asm' |
include 'tp-butto.asm' |
include 'tp-mouse.asm' |
include 'tp-files.asm' |
include 'tp-common.asm' |
include 'tp-dialog.asm' |
include 'tp-commo.asm' |
include 'tp-dialo.asm' |
include 'tp-popup.asm' |
include 'tp-tbox.asm' |
include 'tp-recode.asm' |
;include 'lib-ini.asm' |
687,7 → 677,7 |
ru,<'SYSFUNCR.TXT',0>,\ |
en,<'SYSFUNCS.TXT',0> |
sz htext,'TINYPAD ',APP_VERSION |
sz htext,'TINYPAD 4.0.3' |
lszc help_text,b,\ |
ru,':',\ |
730,7 → 720,6 |
ru,'à ¢ª ' ,popup_edit ,onshow.edit ,\ |
ru,'®¨áª' ,popup_search ,onshow.search ,\ |
ru,' ¯ãáª' ,popup_run ,onshow.run ,\ |
ru,'®¤¨à®¢ª ',popup_recode ,onshow.recode ,\ |
ru,'¯æ¨¨' ,popup_options,onshow.options,\ |
\ |
en,'File' ,popup_file ,onshow.file ,\ |
737,7 → 726,6 |
en,'Edit' ,popup_edit ,onshow.edit ,\ |
en,'Search' ,popup_search ,onshow.search ,\ |
en,'Run' ,popup_run ,onshow.run ,\ |
en,'Encoding',popup_recode ,onshow.recode ,\ |
en,'Options' ,popup_options,onshow.options |
popup_res popup_file,\ |
800,25 → 788,6 |
en,'Debug board' ,'' ,open_debug_board ,\ |
en,'System functions' ,'' ,open_sysfuncs_txt |
popup_res popup_recode,\ |
ru,'CP866 -> CP1251' ,'',recode.866.1251,\ |
ru,'CP1251 -> CP866' ,'',recode.1251.866,\ |
ru,'-' ,'',0,\ |
ru,'CP866 -> KOI8-R' ,'',recode.866.koi,\ |
ru,'KOI8-R -> CP866' ,'',recode.koi.866,\ |
ru,'-' ,'',0,\ |
ru,'CP1251 -> KOI8-R' ,'',recode.1251.koi,\ |
ru,'KOI8-R -> CP1251' ,'',recode.koi.1251,\ |
\ |
en,'CP866 -> CP1251' ,'',recode.866.1251,\ |
en,'CP1251 -> CP866' ,'',recode.1251.866,\ |
en,'-' ,'',0,\ |
en,'CP866 -> KOI8-R' ,'',recode.866.koi,\ |
en,'KOI8-R -> CP866' ,'',recode.koi.866,\ |
en,'-' ,'',0,\ |
en,'CP1251 -> KOI8-R' ,'',recode.1251.koi,\ |
en,'KOI8-R -> CP1251' ,'',recode.koi.1251 |
popup_res popup_options,\ |
ru,'¥è¨© ¢¨¤...' ,'',0,\ |
ru,'-' ,'',0,\ |
/programs/develop/tinypad/trunk/build_en.bat |
---|
1,5 → 1,5 |
@erase lang.inc |
@echo lang fix en >lang.inc |
@fasm tinypad.asm tinypad.bin |
@fasm tinypad.asm tinypad |
@erase lang.inc |
@pause |
/programs/develop/tinypad/trunk/build_ru.bat |
---|
1,5 → 1,5 |
@erase lang.inc |
@echo lang fix ru >lang.inc |
@fasm tinypad.asm tinypad.bin |
@fasm tinypad.asm tinypad |
@erase lang.inc |
@pause |
/programs/develop/tinypad/trunk/tp-butto.asm |
---|
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 |
/programs/develop/tinypad/trunk/tp-commo.asm |
---|
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 |
/programs/develop/tinypad/trunk/tp-dialo.asm |
---|
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 |
/programs/develop/tinypad/trunk/tp-mouse.asm |
---|
396,8 → 396,6 |
ret |
.run: |
ret |
.recode: |
ret |
.options: |
mov word[popup_options+0],0 |
mov byte[popup_options+5],0 |
/programs/develop/tinypad/trunk/helpwnd.asm |
---|
0,0 → 1,57 |
help_thread_start: |
call draw_help_wnd |
still_hw: |
cmp [main_closed],1 |
je exit_hw |
mcall 10 |
cmp eax,1 |
je help_thread_start |
cmp eax,2 |
je key_hw |
cmp eax,3 |
je button_hw |
jmp still_hw |
key_hw: |
mcall ;2 |
cmp ah, 27 |
jne still_hw |
button_hw: |
mcall 17 |
exit_hw: |
mcall -1 |
func draw_help_wnd |
mcall 12,1 |
mcall 48,3,sc,sizeof.system_colors |
mov ecx,[skinh] |
add ecx,200*65536+(5+10*2+16*10) |
mov edx,[sc.work] |
or edx,0x03000000 |
mcall 0,<200,10+10*2+help_text.maxl*6> |
mov ebx,[skinh] |
shr ebx,1 |
adc ebx,1+0x000A0000-4 |
mcall 4,,[sc.grab_text],help_title,help_title.size |
mov eax,4 |
mov ebx,[skinh] |
add ebx,0x000F000A |
xor ecx,ecx |
mov edx,help_text |
@@: inc edx |
movzx esi,byte[edx-1] |
mcall |
add ebx,10 |
add edx,esi |
cmp byte[edx],0 |
jne @b |
mcall 12,2 |
ret |
endf |
Property changes: |
Added: svn:eol-style |
+native |
\ No newline at end of property |