From 6976fe6967620cade6b0e41dab89f062583bc9be Mon Sep 17 00:00:00 2001 From: "Marat Zakiyanov (Mario79)" Date: Sat, 25 Sep 2010 19:21:10 +0000 Subject: [PATCH] Tinypad 4.0.6 - select file path with OpenDialog for Load and Save. git-svn-id: svn://kolibrios.org@1624 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/tinypad/trunk/build_en.bat | 1 + programs/develop/tinypad/trunk/build_et.bat | 1 + programs/develop/tinypad/trunk/build_ru.bat | 1 + .../develop/tinypad/trunk/data/tp-idata.inc | 47 ++++++ .../develop/tinypad/trunk/data/tp-locale.inc | 2 +- programs/develop/tinypad/trunk/history.txt | 4 + programs/develop/tinypad/trunk/tinypad.asm | 117 ++++++++++++++- programs/develop/tinypad/trunk/tp-dialog.asm | 136 +++++++++--------- 8 files changed, 240 insertions(+), 69 deletions(-) diff --git a/programs/develop/tinypad/trunk/build_en.bat b/programs/develop/tinypad/trunk/build_en.bat index ff1bed18ca..48003cecf3 100644 --- a/programs/develop/tinypad/trunk/build_en.bat +++ b/programs/develop/tinypad/trunk/build_en.bat @@ -1,4 +1,5 @@ @echo lang fix en >lang.inc @fasm tinypad.asm tinypad +@kpack tinypad @erase lang.inc @pause \ No newline at end of file diff --git a/programs/develop/tinypad/trunk/build_et.bat b/programs/develop/tinypad/trunk/build_et.bat index a9f505e97b..0bbae13b95 100644 --- a/programs/develop/tinypad/trunk/build_et.bat +++ b/programs/develop/tinypad/trunk/build_et.bat @@ -1,4 +1,5 @@ @echo lang fix et >lang.inc @fasm tinypad.asm tinypad +@kpack tinypad @erase lang.inc @pause \ No newline at end of file diff --git a/programs/develop/tinypad/trunk/build_ru.bat b/programs/develop/tinypad/trunk/build_ru.bat index 9042ac4313..397c709d70 100644 --- a/programs/develop/tinypad/trunk/build_ru.bat +++ b/programs/develop/tinypad/trunk/build_ru.bat @@ -1,4 +1,5 @@ @echo lang fix ru >lang.inc @fasm tinypad.asm tinypad +@kpack tinypad @erase lang.inc @pause \ No newline at end of file diff --git a/programs/develop/tinypad/trunk/data/tp-idata.inc b/programs/develop/tinypad/trunk/data/tp-idata.inc index 47a99b6938..697041b59b 100644 --- a/programs/develop/tinypad/trunk/data/tp-idata.inc +++ b/programs/develop/tinypad/trunk/data/tp-idata.inc @@ -114,3 +114,50 @@ sz ini_options_auto_indent,'auto_indent',0 sz ini_options_smart_tab,'smart_tab',0 sz ini_options_optim_save,'optim_save',0 sz ini_options_line_nums,'line_nums',0 +;----------------------------------------------------------------------------- +OpenDialog_data: +.type dd 0 +.procinfo dd p_info ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_pach dd temp_dir_pach ;+16 +.dir_default_pach dd communication_area_default_pach ;+20 +.start_path dd open_dialog_path ;+24 +.draw_window dd draw_window_for_OD ;+28 +.status dd 0 ;+32 +.openfile_pach dd fname_Info ;+36 +.filename_area dd filename_area ;+40 +.filter_area dd Filter +.x: +.x_size dw 420 ;+48 ; Window X size +.x_start dw 10 ;+50 ; Window X position +.y: +.y_size dw 320 ;+52 ; Window y size +.y_start dw 10 ;+54 ; Window Y position + +communication_area_name: + db 'FFFFFFFF_open_dialog',0 +open_dialog_path: + db '/sys/File Managers/opendial',0 +communication_area_default_pach: + db '/sys',0 + +Filter: +dd Filter.end - Filter +.1: +db 'TXT',0 +db 'ASM',0 +db 'INC',0 +db 'INI',0 +db 'LOG',0 +db 'DAT',0 +db 'INF',0 +db 'BAT',0 +db 'SH',0 + +.end: +db 0 + +open_dialog db 0 +;----------------------------------------------------------------------------- + diff --git a/programs/develop/tinypad/trunk/data/tp-locale.inc b/programs/develop/tinypad/trunk/data/tp-locale.inc index 11cd78955d..904356a22b 100644 --- a/programs/develop/tinypad/trunk/data/tp-locale.inc +++ b/programs/develop/tinypad/trunk/data/tp-locale.inc @@ -305,5 +305,5 @@ lsz sysfuncs_filename,\ en,<'SYSFUNCS.TXT',0>,\ et,<'SYSFUNCET.TXT',0> -sz s_example,'EXAMPLE.ASM' +sz s_example,'/sys/example.asm' sz s_still ,'still' diff --git a/programs/develop/tinypad/trunk/history.txt b/programs/develop/tinypad/trunk/history.txt index 14d7cbf4dc..f8ce50f395 100644 --- a/programs/develop/tinypad/trunk/history.txt +++ b/programs/develop/tinypad/trunk/history.txt @@ -1,6 +1,10 @@ HISTORY: +4.0.6 (26/09/2010, Marat Zakiyanov aka Mario79, aka Mario) + new features: + - Select file path with OpenDialog for Load and Save. + 4.0.5 (Rus, mike.dld) bug-fixes: - new tab is created when opening a file from Tinypad's home folder diff --git a/programs/develop/tinypad/trunk/tinypad.asm b/programs/develop/tinypad/trunk/tinypad.asm index bed8a21cc9..d3b269cb43 100644 --- a/programs/develop/tinypad/trunk/tinypad.asm +++ b/programs/develop/tinypad/trunk/tinypad.asm @@ -34,7 +34,7 @@ include 'tinypad.inc' header '01',1,@CODE,TINYPAD_END,STATIC_MEM_END,MAIN_STACK,@PARAMS,ini_path -APP_VERSION equ 'SVN (4.0.5)' +APP_VERSION equ 'SVN (4.0.6)' TRUE = 1 FALSE = 0 @@ -182,6 +182,23 @@ section @CODE ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: mov al,[tabs_pos] mov [tab_bar.Style],al +;--------------------------------------------------------------------- + mov edi,filename_area + mov esi,s_example+5 + call copy_str_1 + + mov esi,tb_opensave.text + mov edi,fname_Info + call copy_str_1 + xor eax,eax + mov [edi],al +;--------------------------------------------------------------------- +;OpenDialog initialisation + push dword OpenDialog_data + call [OpenDialog_Init] +;--------------------------------------------------------------------- + + mcall 66,1,1 mcall 40,00100111b red: @@ -193,6 +210,8 @@ still: call draw_statusbar ; write current position & number of strings .skip_write: + cmp [open_dialog],1 + je .open_dialog mcall 10 ; wait here until event cmp [main_closed],0 jne key.alt_x @@ -206,7 +225,86 @@ still: jz mouse jmp still.skip_write +;--------------------------------------------------------------------- +.open_dialog: + pusha + call btn.bot.cancel + + mov esi,tb_opensave.text + mov edi,[OpenDialog_data.openfile_pach] + movzx ecx,[tb_opensave.length] + mov edx,[OpenDialog_data.filename_area] + mov ebx,[OpenDialog_data.opendir_pach] + call copy_str_2 + movzx eax,byte [bot_mode2] + mov [OpenDialog_data.type],eax + popa +; invoke OpenDialog + push dword OpenDialog_data + call [OpenDialog_Start] + + cmp [OpenDialog_data.status],1 + jne .3 + + pusha + mov edi,tb_opensave.text + mov esi,[OpenDialog_data.openfile_pach] + call copy_str_1 + sub edi,tb_opensave.text + dec edi + mov eax,edi + mov [tb_opensave.length],al + popa + + cmp [bot_mode2],0 + je .2 + call save_file + jmp .3 +.2: + call load_file +.3: + mov [open_dialog],0 + jmp red +;----------------------------------------------------------------------------- +draw_window_for_OD: + call drawwindow + call draw_statusbar + ret +;----------------------------------------------------------------------------- +copy_str_2: + cld + push esi ecx + rep movsb ; edi openfile_pach + xor eax,eax + mov [edi],al + pop ecx esi + mov edi,ebx + rep movsb ; edi opendir_pach + mov [edi],al + mov esi,edi + std +@@: + lodsb + cmp al,byte '/' + jne @b + inc esi + xor eax,eax + mov [esi],al + inc esi + mov edi,edx ; edi filename_area + call copy_str_1 + ret +;----------------------------------------------------------------------------- +copy_str_1: + xor eax,eax + cld +@@: + lodsb + stosb + test eax,eax + jnz @b + ret ;----------------------------------------------------------------------------- proc get_event ctx ;////////////////////////////////////////////////////////// ;----------------------------------------------------------------------------- @@ -525,7 +623,8 @@ section @IMPORT ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: library \ libini,'libini.obj',\ libio,'libio.obj',\ - libgfx,'libgfx.obj' + libgfx,'libgfx.obj',\ + proc_lib,'proc_lib.obj' import libini, \ ini.get_str ,'ini_get_str',\ @@ -567,6 +666,10 @@ import libgfx, \ gfx.rectangle ,'gfx_rectangle',\ gfx.rectangle.ex,'gfx_rectangle_ex' +import proc_lib, \ + OpenDialog_Init ,'OpenDialog_init',\ + OpenDialog_Start ,'OpenDialog_start' + TINYPAD_END: ; end of file ;----------------------------------------------------------------------------- @@ -587,6 +690,16 @@ sc system_colors ini_path rb PATHL +;--------------------------------------------------------------------- +temp_dir_pach: + rb 4096 +;--------------------------------------------------------------------- +fname_Info: + rb 4096 ; filename +;--------------------------------------------------------------------- +filename_area: + rb 256 +;--------------------------------------------------------------------- rb 1024*4 MAIN_STACK: rb 1024*4 diff --git a/programs/develop/tinypad/trunk/tp-dialog.asm b/programs/develop/tinypad/trunk/tp-dialog.asm index 761358d626..aa237223f3 100644 --- a/programs/develop/tinypad/trunk/tp-dialog.asm +++ b/programs/develop/tinypad/trunk/tp-dialog.asm @@ -29,7 +29,7 @@ proc define_3d_button ;/////////////////////////////////////////////////////// popad ret 4*3 endp - +;----------------------------------------------------------------------------- finddlg_handler: cmp al,1 je .draw @@ -126,71 +126,74 @@ finddlg_handler: 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 + mov [open_dialog],1 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 +; cmp al,1 +; je .draw +; cmp al,2 +; je .key +; cmp al,3 +; je botdlg.button +; ret - push 20002 - cmp [bot_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 +; .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_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 +; @@: 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 - cmp [bot_mode2], 2 ; exit-save dialog - jne @f +; cmp [bot_mode2], 2 ; exit-save dialog +; jne @f - sub ebx,(6*(s_2save_no.size+2)+3)*65536 - mov bx,6*(s_2save_no.size+2) - push 20007 s_2save_no s_2save_no.size - call define_3d_button +; sub ebx,(6*(s_2save_no.size+2)+3)*65536 +; mov bx,6*(s_2save_no.size+2) +; push 20007 s_2save_no s_2save_no.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.width],eax - add ecx,-18*65536+1 - mov dword[tbox.height],ecx - call textbox.draw +; @@: 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.width],eax +; add ecx,-18*65536+1 +; mov dword[tbox.height],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 +; 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 @@ -251,11 +254,11 @@ gotodlg_handler: je btn.bot.opensave call textbox.key ret - +;----------------------------------------------------------------------------- cur_part dd ? cur_color dd ? cur_colors rd 10 - +;----------------------------------------------------------------------------- optsdlg_handler: cmp al,1 je .draw @@ -579,7 +582,7 @@ TPOSW = 10 .mouse.exit: ret - +;----------------------------------------------------------------------------- botdlg.button: mov esi,accel_table2_botdlg .acc: cmp ebx,[esi] @@ -590,7 +593,7 @@ botdlg.button: cmp byte[esi],0 jne .acc ret - +;----------------------------------------------------------------------------- btn.bot.cancel: xor eax,eax mov [bot_mode],al @@ -599,7 +602,7 @@ botdlg.button: mov [s_status],eax call drawwindow ret - +;----------------------------------------------------------------------------- btn.bot.opensave: cmp [bot_mode2],0 je .lp1 @@ -616,7 +619,7 @@ botdlg.button: mov [bot_dlg_height],eax call drawwindow ret - +;----------------------------------------------------------------------------- btn.bot.no: xor eax,eax mov [bot_mode],al @@ -630,7 +633,7 @@ botdlg.button: ret @@: call key.ctrl_f4.close ret - +;----------------------------------------------------------------------------- btn.bot.find: movzx ecx,[tb_find.length] mov [s_search.size],ecx @@ -683,7 +686,7 @@ botdlg.button: call key.f3 call drawwindow ret - +;----------------------------------------------------------------------------- btn.bot.appearance: @@: xor eax,eax mov [bot_mode],al @@ -695,12 +698,13 @@ botdlg.button: stdcall save_settings call drawwindow ret - +;----------------------------------------------------------------------------- tabpos_round db 4,3,1,2 - +;----------------------------------------------------------------------------- btn.bot.tabpos: movzx eax,[tabs_pos] mov al,[tabpos_round+eax-1] mov [tabs_pos],al @@: call optsdlg_handler.draw_tabpos ret +;----------------------------------------------------------------------------- \ No newline at end of file