update 't_edit':

1) convert cp1251-866, cp866-1251
2) use PathShow
3) modify element t_edit in box_lib.obj

git-svn-id: svn://kolibrios.org@4308 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2013-11-28 10:35:07 +00:00
parent c4ddb68d5f
commit e07b6d7a9a
7 changed files with 196 additions and 134 deletions

View File

@ -311,9 +311,9 @@ dd sz_PathShow_prepare, path_show.prepare
dd sz_PathShow_draw, path_show.draw
dd szVersion_path_show, 0x00010001
dd sz_ted_but_save_file, ted_but_save_file
dd sz_ted_but_sumb_upper, ted_but_sumb_upper
dd sz_ted_but_sumb_lover, ted_but_sumb_lover
dd sz_ted_but_convert_by_table, ted_but_convert_by_table
dd sz_ted_can_save, ted_can_save
dd sz_ted_clear, ted_clear
dd sz_ted_delete, ted_delete
@ -325,6 +325,7 @@ dd sz_ted_is_select, ted_is_select
dd sz_ted_key, ted_key
dd sz_ted_mouse, ted_mouse
dd sz_ted_open_file, ted_open_file
dd sz_ted_save_file, ted_save_file
dd sz_ted_text_add, ted_text_add
dd sz_ted_but_select_word, ted_but_select_word
dd sz_ted_but_cut, ted_but_cut
@ -335,7 +336,7 @@ dd sz_ted_but_redo, ted_but_redo
dd sz_ted_but_reverse, ted_but_reverse
dd sz_ted_but_find_next, ted_but_find_next
dd sz_ted_text_colored, ted_text_colored
dd sz_ted_version, 0x00000003
dd sz_ted_version, 0x00000004
dd sz_Frame_draw, frame.draw
dd szVersion_frame, 0x00010001
@ -416,9 +417,9 @@ sz_PathShow_prepare db 'PathShow_prepare',0
sz_PathShow_draw db 'PathShow_draw',0
szVersion_path_show db 'version_PathShow',0
sz_ted_but_save_file db 'ted_but_save_file',0
sz_ted_but_sumb_upper db 'ted_but_sumb_upper',0
sz_ted_but_sumb_lover db 'ted_but_sumb_lover',0
sz_ted_but_convert_by_table db 'ted_but_convert_by_table',0
sz_ted_can_save db 'ted_can_save',0
sz_ted_clear db 'ted_clear',0
sz_ted_delete db 'ted_delete',0
@ -430,6 +431,7 @@ sz_ted_is_select db 'ted_is_select',0
sz_ted_key db 'ted_key',0
sz_ted_mouse db 'ted_mouse',0
sz_ted_open_file db 'ted_open_file',0
sz_ted_save_file db 'ted_save_file',0
sz_ted_text_add db 'ted_text_add',0
sz_ted_but_select_word db 'ted_but_select_word',0
sz_ted_but_cut db 'ted_but_cut',0

View File

@ -1,6 +1,6 @@
; ¬ ªà®á ¤«ï á¨á⥬­®© ¡¨¡«¨®â¥ª¨ box_lib.obj
; í«¥¬¥­â TextEditor ¤«ï Kolibri OS
; ä ©« ¯®á«¥¤­¨© à § ¨§¬¥­ï«áï 18.11.2013 IgorA
; ä ©« ¯®á«¥¤­¨© à § ¨§¬¥­ï«áï 27.11.2013 IgorA
; ­  ª®¤ ¯à¨¬¥­¥­  GPL2 «¨æ¥­§¨ï
;input:
@ -1264,6 +1264,38 @@ ted_char_add:
call ted_text_colored
ret
;description:
; äã­ªæ¨ï ¤«ï ᬥ­ë ª®¤¨à®¢®ª
;input:
; table - â ¡«¨æ  ¤«ï ¯¥à¥ª®¤¨à®¢ª¨
align 4
proc ted_but_convert_by_table uses eax edx edi esi, edit:dword, table:dword
mov edi,dword[edit]
mov esi,dword[table]
mov edx,ted_tex
.cycle:
;¯¥à¥å®¤¨¬ ­  á«¥¤ãî騩 ᨬ¢®«
mov edx,dword[edx+6]
cmp edx,1
jle .end_text
imul edx,sizeof.symbol
add edx,ted_tex
movzx eax,byte[edx]
add eax,esi
mov al,byte[eax]
cmp al,0
je @f
mov byte[edx],al ;¬¥­ï¥¬ ª®¤¨à®¢ªã ᨬ¢®« 
@@:
jmp .cycle
.end_text:
;cmp esi,0
;je @f
stdcall ted_draw,edi ;®¡­®¢«ï¥¬ ®ª­®
;@@:
ret
endp
;input:
; edi = pointer to tedit struct
@ -4038,7 +4070,7 @@ ted_wnd_main_mouse_scroll:
ret
align 4
proc ted_but_save_file, edit:dword, file:dword, f_name:dword
proc ted_save_file, edit:dword, file:dword, f_name:dword
pushad
mov edi,dword[edit]

View File

@ -63,7 +63,7 @@ On_SaveAndNewFile:
push edi
mov edi, tedit0
stdcall [ted_but_save_file],edi,run_file_70,[edit1.text]
call ted_but_save_file
cmp ted_err_save,0
jne @f
call On_NewFile
@ -76,7 +76,7 @@ On_SaveAndNewFile:
align 4
but_no_msg_OpenFile:
push eax ebx
stdcall [ted_open_file], tedit0,run_file_70,[edit1.text]
stdcall [ted_open_file], tedit0,run_file_70,openfile_path
call ted_messages_after_open_file
pop ebx eax
ret
@ -115,20 +115,19 @@ ted_but_open_file:
@@:
cmp [OpenDialog_data.status],1
jne .ret_f
mov esi,[OpenDialog_data.openfile_path]
call strlen
mov [edit1.size],eax
mov [edit1.pos],eax
stdcall [edit_box_draw], edit1
stdcall [PathShow_prepare], PathShow_data_1
stdcall [PathShow_draw], PathShow_data_1
;¨é¥¬ ¥áâì «¨ ä ©« ¯®¤á¢¥âª¨ ¤«ï ®âªà뢠¥¬®£® ⥪á⮢®£® ä ©« 
mov edx,[edit1.text]
mov esi,[OpenDialog_data.openfile_path]
call strlen
mov edx,openfile_path
add edx,eax
.f_beg:
cmp byte[edx],'.'
je .found
dec edx
cmp edx,[edit1.text]
cmp edx,openfile_path
jg .f_beg
.found:
inc edx ;edx - 㪠§ â¥«ì ­  à áè¨à¥­¨¥ ®âªàë⮣® ä ©« 
@ -150,13 +149,29 @@ ted_but_open_file:
call open_unpac_synt_file
.end_0:
stdcall [ted_open_file], tedit0,run_file_70,[edit1.text]
stdcall [ted_open_file], tedit0,run_file_70,openfile_path
call ted_messages_after_open_file
.ret_f:
popad
ret
;description:
; äã­ªæ¨ï á®åà ­¥­¨ï ä ©«  á ¢ë§®¢®¬ ®ª­  ¤¨ «®£ 
align 4
proc ted_but_save_file
;*** ¢ë§®¢ ¤¨ «®£®¢®£® ®ª­  ¤«ï á®åà ­¥­¨ï ä ©« 
copy_path open_dialog_name,communication_area_default_path,file_name,0
mov [OpenDialog_data.type],1
stdcall [OpenDialog_Start],OpenDialog_data
cmp [OpenDialog_data.status],1 ;if status==1 then save
jne .end_save_file
stdcall [PathShow_prepare], PathShow_data_1
stdcall [ted_save_file],tedit0,run_file_70,openfile_path
.end_save_file:
ret
endp
;description:
; ª®¯¨à®¢ ­¨¥ ¯ ¬ïâ¨
align 4
@ -216,6 +231,7 @@ ted_messages_after_open_file:
jl .ret_f
stdcall [mb_create],msgbox_1,thread
.ret_f:
stdcall [PathShow_prepare], PathShow_data_1
pop edi ecx
ret
@ -265,8 +281,8 @@ push eax edi esi
cld
rep movsb
copy_path ebx,fn_syntax_dir,file_name_rez,0
copy_path file_name_rez,sys_path,file_name,0
copy_path ebx,fn_syntax_dir,syntax_path,0
copy_path syntax_path,sys_path,file_name,0
mov edi, tedit0
mov [run_file_70.Function], 0
mov [run_file_70.Position], 0
@ -308,8 +324,7 @@ pop esi edi eax
;description:
; ¢ë§®¢/áªàë⨥ ¯ ­¥«¨ ¯®¨áª 
align 4
proc ted_but_find
push edi
proc ted_but_find uses edi
mov edi,tedit0
cmp ted_panel_id,TED_PANEL_NULL
@ -323,10 +338,33 @@ proc ted_but_find
.e_if:
call EvSize
stdcall [ted_draw],edi
pop edi
ret
endp
align 4
tbl_1251_866:
rb 128
db 0, 0, 0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0 ;128
db 0, 0, 0, 0, 0, 0, 0, 0, 0,0,0,0,0,0,0,0 ;144
db 0, 0, 0, 0, 0, 0, 0, 0,240,0,0,0,0,0,0,0 ;160
db 0, 0, 0, 0, 0, 0, 0, 0,241,0,0,0,0,0,0,0 ;176
db 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143 ;192
db 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159 ;208
db 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175 ;224
db 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239 ;240
align 4
tbl_866_1251:
rb 128
db 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207 ;128
db 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223 ;144
db 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239 ;160
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;176
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;192
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;208
db 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 ;224
db 168,184,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;240
align 4
ted_on_find_err:
stdcall [mb_create],msgbox_7,thread ;message: Can not find text

View File

@ -95,9 +95,9 @@ import_box_lib:
tl_node_lev_inc dd sz_tl_node_lev_inc
tl_node_lev_dec dd sz_tl_node_lev_dec
ted_but_save_file dd sz_ted_but_save_file
ted_but_sumb_upper dd sz_ted_but_sumb_upper
ted_but_sumb_lover dd sz_ted_but_sumb_lover
ted_but_convert_by_table dd sz_ted_but_convert_by_table
ted_can_save dd sz_ted_can_save
ted_clear dd sz_ted_clear
ted_delete dd sz_ted_delete
@ -109,6 +109,7 @@ import_box_lib:
ted_key dd sz_ted_key
ted_mouse dd sz_ted_mouse
ted_open_file dd sz_ted_open_file
ted_save_file dd sz_ted_save_file
ted_text_add dd sz_ted_text_add
ted_but_select_word dd sz_ted_but_select_word
ted_but_cut dd sz_ted_but_cut
@ -121,6 +122,9 @@ import_box_lib:
ted_text_colored dd sz_ted_text_colored
version_text_edit dd sz_ted_version
PathShow_prepare dd sz_PathShow_prepare
PathShow_draw dd sz_PathShow_draw
dd 0,0
alib_init0 db 'lib_init',0
@ -163,9 +167,9 @@ dd 0,0
sz_tl_node_lev_inc db 'tl_node_lev_inc',0
sz_tl_node_lev_dec db 'tl_node_lev_dec',0
sz_ted_but_save_file db 'ted_but_save_file',0
sz_ted_but_sumb_upper db 'ted_but_sumb_upper',0
sz_ted_but_sumb_lover db 'ted_but_sumb_lover',0
sz_ted_but_convert_by_table db 'ted_but_convert_by_table',0
sz_ted_can_save db 'ted_can_save',0
sz_ted_clear db 'ted_clear',0
sz_ted_delete db 'ted_delete',0
@ -177,6 +181,7 @@ dd 0,0
sz_ted_key db 'ted_key',0
sz_ted_mouse db 'ted_mouse',0
sz_ted_open_file db 'ted_open_file',0
sz_ted_save_file db 'ted_save_file',0
sz_ted_text_add db 'ted_text_add',0
sz_ted_but_select_word db 'ted_but_select_word',0
sz_ted_but_cut db 'ted_but_cut',0
@ -189,6 +194,9 @@ dd 0,0
sz_ted_text_colored db 'ted_text_colored',0
sz_ted_version db 'version_text_edit',0
sz_PathShow_prepare db 'PathShow_prepare',0
sz_PathShow_draw db 'PathShow_draw',0
align 4
import_proclib:
OpenDialog_Init dd aOpenDialog_Init
@ -486,7 +494,7 @@ tree_file_struct:
if lang eq ru
hed db '’¥ªáâ®¢ë© à¥¤ ªâ®à 14.11.13',0 ;¯®¤¯¨áì ®ª­ 
hed db '’¥ªáâ®¢ë© à¥¤ ªâ®à 28.11.13',0 ;¯®¤¯¨áì ®ª­ 
menu_text_area:
db '” ©«',0
@ -580,14 +588,6 @@ msgbox_9:
db 0
db '‡ ªàëâì',0
db 0
msgbox_10:
db 1,0
db '‚­¨¬ ­¨¥',0
db '‚ë ¨á¯®«ì§ã¥â¥ áâ àãî ¢¥àá¨î ¡¨¡«¨®â¥ª¨ ',39,'box_lib.obj',39,'.',13,\
'<27>®¯à®¡ã©â¥ ­ ©â¨ ¡¨¡«¨®â¥ªã ¢ ª®â®à®©',13,\
'í«¥¬¥­â ',39,'t_edit',39,' ¨¬¥¥â ¢¥àá¨î 3.',0
db '‡ ªàëâì',0
db 0
txtFile db '” ©«:',0
txtFindCapt db '<27>®¨áª',0
@ -597,7 +597,7 @@ txtFormatApply db '
else
hed db 'Text editor 14.11.13',0
hed db 'Text editor 28.11.13',0
menu_text_area:
db 'File',0
@ -691,14 +691,6 @@ msgbox_9:
db 0
db 'Close',0
db 0
msgbox_10:
db 1,0
db 'Warning',0
db 'You are using an older version of the library ',39,'box_lib.obj',39,'.',13,\
'Try to find a library in which the element',13,\
39,'t_edit',39,' has a version 3.',13,0
db 'Close',0
db 0
txtFile db 'File:',0
txtFindCapt db 'Search',0

View File

@ -102,10 +102,18 @@ or ecx,0x40000000
mov edx,425*65536+25
call draw_but_icon
mov cx,17
mov cx,17 ;âûáîð ôàéëà ïîäñâåòêè
mov edx,450*65536+25
call draw_but_icon
mov cx,18 ;cp 1251 -> 866
mov edx,425*65536+2
call draw_but_icon
mov cx,19 ;cp 866 -> 1251
mov edx,450*65536+2
call draw_but_icon
popad
ret
@ -332,7 +340,7 @@ draw_but_icon:
cmp eax,7
jne @f ;êíîïêà íå âëåçëà â îêíî
mov ebx,[bmp_icon]
bt ecx,30 ;if (ecx or 0x40000000)
bt ecx,30 ;if (ecx & 0x40000000)
jc .gray
add ebx,TOOLBAR_ICONS_SIZE ;ïåðåìåùàåìñÿ íà ñåðûå êíîïêè
.gray:

View File

@ -1,7 +1,4 @@
;Ž£à®¬­ ï ¡« £®¤ à­®áâì Maxxxx32, Diamond, Heavyiron
;¨ ¤à㣨¬ ¯à®£à ¬¬¨áâ ¬,   â ª¦¥
;’¥¯«®¢ã €«¥ªá¥î (<Lrz> www.lrz.land.ru)
;Ž£à®¬­ ï ¡« £®¤ à­®áâì ¢á¥¬, ªâ® ¯®¬®£ «: ª®¤®¬/ᮢ¥â®¬/¤¨§ ©­®¬ ...
use32
org 0x0
@ -18,7 +15,7 @@ MAX_COLOR_WORD_LEN equ 40
maxChars equ 100002 ;(...+2)
BUF_SIZE equ 4096 ;buffer for copy|paste
maxSyntaxFileSize equ 410000
TOOLBAR_ICONS_SIZE equ 1200*18
TOOLBAR_ICONS_SIZE equ 1200*20
include '../../proc32.inc'
;include '../../config.inc'
@ -102,27 +99,20 @@ start:
mov ecx,eax
mov edi,openfile_path
cld
rep movsb ;ª®¯¨à㥬 ¨¬ï ä ©«  ¢ ¡ãä¥à edit1
rep movsb ;ª®¯¨à㥬 ¨¬ï ä ©«  ¢ ¡ãä¥à openfile_path
load_libraries l_libs_start,load_lib_end
;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨«¨áì ¡¨¡«¨®â¥ª¨
mov ebp,lib0
mov ebp,lib0
.test_lib_open:
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
@@:
mov ebp,lib1 ;
cmp dword [ebp+ll_struc_size-4],0
jz @f
mcall -1 ;exit not correct
@@:
cmp dword[version_text_edit],3
jge @f
stdcall [mb_create],msgbox_10,thread
mcall -1
@@:
add ebp,ll_struc_size
cmp ebp,load_lib_end
jl .test_lib_open
;---------------------------------------------------------------------
stdcall [ted_init], tedit0
@ -130,6 +120,10 @@ load_libraries l_libs_start,load_lib_end
; OpenDialog initialisation
stdcall [OpenDialog_Init],OpenDialog_data
mov eax,[sc.work_button_text]
mov [PathShow_data_1.font_color],eax
mov eax,[sc.work_button]
mov [PathShow_data_1.background_color],eax
; init toolbar file
load_image_file 'te_icon.png', bmp_icon,TOOLBAR_ICONS_SIZE*2 ;㬭®¦¥­¨¥ ­  2 ¤«ï á¥àëå ª­®¯®ª
@ -223,7 +217,6 @@ mov ecx,ebx
je @f ;if file names exist
mov esi,openfile_path
call strlen ;eax=strlen
mov [edit1.size],eax
call but_no_msg_OpenFile
@@:
@ -276,7 +269,7 @@ draw_window:
mov edx,txtFile
int 0x40
stdcall [edit_box_draw], dword edit1
stdcall [PathShow_draw], dword PathShow_data_1
stdcall [menu_bar_draw], dword menu_data_1
call draw_but_toolbar
@ -288,11 +281,6 @@ draw_window:
align 4
mouse:
stdcall [edit_box_mouse], dword edit1
test word [edit1.flags],10b ;ed_focus ;¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
jne still
stdcall [ted_mouse], tedit0
cmp byte[tedit0.panel_id],TED_PANEL_FIND ;if not panel
@ -313,7 +301,7 @@ mouse:
je button.exit
cmp dword[menu_data_1.cursor_out],3
jne @f
stdcall [ted_but_save_file], tedit0,run_file_70,[edit1.text]
call ted_but_save_file
@@:
cmp dword[menu_data_1.cursor_out],2
jne @f
@ -369,26 +357,6 @@ key:
mcall 2 ;¯®«ãç ¥¬ ª®¤ ­ ¦ â®© ª« ¢¨è¨
stdcall [tl_key], tree1
test word [edit1.flags],10b;ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
je @f
cmp ah,0x80 ;if key up
ja still
cmp ah,42 ;[Shift] (left)
je still
cmp ah,54 ;[Shift] (right)
je still
cmp ah,56 ;[Alt]
je still
cmp ah,29 ;[Ctrl]
je still
cmp ah,69 ;[Pause Break]
je still
stdcall KeyConvertToASCII, dword conv_tabl
stdcall [edit_box_key], dword edit1
jmp still
@@:
test word [edit2.flags],10b;ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
je @f
cmp ah,0x80 ;if key up
@ -431,7 +399,7 @@ button:
@@:
cmp ah,5
jne @f
stdcall [ted_but_save_file], tedit0,run_file_70,[edit1.text]
call ted_but_save_file
@@:
cmp ah,6
jne @f
@ -493,6 +461,14 @@ button:
jne @f
stdcall but_synt_show, tedit0
@@:
cmp ah,21
jne @f
stdcall [ted_but_convert_by_table],tedit0,tbl_1251_866
@@:
cmp ah,22
jne @f
stdcall [ted_but_convert_by_table],tedit0,tbl_866_1251
@@:
cmp ah,200
jne @f
@ -522,8 +498,20 @@ button:
stdcall dword[tl_data_clear], tree1
mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
PathShow_data_1:
.type dd 0 ;+0
.start_y dw 9 ;+4
.start_x dw 222 ;+6
.font_size_x dw 6 ;+8 ; 6 - for font 0, 8 - for font 1
.area_size_x dw 200 ;+10
.font_number dd 0 ;+12 ; 0 - monospace, 1 - variable
.background_flag dd 1 ;+16
.font_color dd 0x0 ;+20
.background_color dd 0xffffff ;+24
.text_pointer dd openfile_path ;+28
.work_area_pointer dd text_work_area ;+32
.temp_text_length dd 0 ;+36
edit1 edit_box 250, 220, 5, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 4090, openfile_path, mouse_dd, 0
edit2 edit_box TED_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_find, mouse_dd, 0
unpac_mem dd 0
@ -587,17 +575,19 @@ IncludeUGlobals
thread_coords:
rb 1024
stacktop:
sys_path:
sys_path: ;¯ãâì ®âªã¤  § ¯ãá⨫áï ¨á¯®«­ï¥¬ë© ä ©«
rb 4096
file_name:
file_name: ;¯ à ¬¥âàë § ¯ã᪠
rb 4096
file_name_rez:
syntax_path: ;¨¬ï ¯®¤ª«îç ¥¬®£® ä ©«  ᨭ⠪á¨á 
rb 4096
plugin_path:
rb 4096
openfile_path:
openfile_path: ;¯®«­ë© ¯ãâì ª ä ©«ã á ª®â®àë¬ ¨¤¥â à ¡®â 
rb 4096
filename_area:
text_work_area: ;¯ãâì ª ä ©«ã, ª®â®àë© ¯®ª §ë¢ ¥âáï ¢ ®ª­¥
rb 4096
filename_area: ;¨¬ï ä ©«  ¤«ï ¤¨ «®£  ®âªàëâ¨ï/§ ªàëâ¨ï
rb 256
file_info:
rb 40

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB