1) sync with the new box_lib.obj
2) corrected bug that could occur when pressing Ctrl+F
3) change the code

git-svn-id: svn://kolibrios.org@1449 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2010-04-15 15:50:49 +00:00
parent 66d949f4b4
commit d5f5e7780a
7 changed files with 525 additions and 513 deletions

View File

@ -205,6 +205,35 @@ struc tree_list info_size,info_max_count,style, img_cx,img_cy,\
;Basic macros for use TreeList ; ;Basic macros for use TreeList ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
tl_info_size equ word[edi +4] ;à §¬¥à ¤ ­­ëå ¢ë¤¥«ï¥¬ëå ¤«ï ª ¦¤®£® 㧫  (¯®«ì§®¢ â¥«ìá쪨¥ ¤ ­­ë¥ + ⥪áâ ¤«ï ¯®¤¯¨á¨)
tl_info_max_count equ dword[edi+6] ;¬ ªá¨¬ «ì­®¥ ª®«¨ç¥á⢮ 㧫®¢, ª®â®àë¥ ¬®¦­® ¤®¡ ¢¨âì ¢ í«¥¬¥­â
tl_style equ dword[edi+10] ;á⨫¨ í«¥¬¥­â 
tl_data_nodes equ dword[edi+14] ;㪠§ â¥«ì ­  áâàãªâãàë 㧫®¢
tl_data_img equ dword[edi+18] ;㪠§ â¥«ì ­  ¨§®¡à ¦¥­¨ï á ¨ª®­ª ¬¨ 㧫®¢
tl_img_cx equ word[edi+22] ;è¨à¨­  ¨ª®­®ª
tl_img_cy equ word[edi+24] ;¢ëá®â  ¨ª®­®ª
tl_data_img_sys equ dword[edi+26] ;㪠§ â¥«ì ­  á¨á⥬­ë¥ ¨§®¡à ¦¥­¨ï (áâ५ª¨, ¯«îᨪ¨)
tl_ch_tim equ dword[edi+30] ;ª®«¨ç¥á⢮ ¨§¬¥­¥­¨© ¢ ä ©«¥
tl_tim_undo equ dword[edi+38] ;ª®«¨ç¥á⢮ ®â¬¥­¥­­ëå ¤¥©á⢨©
tl_cur_pos equ dword[edi+42] ;¯®§¨æ¨ï ªãàá®à 
tl_col_bkg equ dword[edi+46] ;梥â ä®­ 
tl_col_zag equ dword[edi+50] ;梥⠧ £®«®¢ª 
tl_col_txt equ dword[edi+54] ;梥â ⥪áâ 
tl_box_left equ dword[edi+58]
tl_box_top equ dword[edi+62]
tl_box_width equ dword[edi+66]
tl_box_height equ dword[edi+70]
tl_capt_cy equ word[edi+74] ;¢ëá®â  ¯®¤¯¨á¨
tl_info_capt_offs equ word[edi+76] ;ᤢ¨£ ¤«ï ­ ç «  ⥪áâ  (¯®¤¯¨á¨ 㧫 )
tl_info_capt_len equ word[edi+78] ;¤«¨­­  ⥪áâ  ¯®¤¯¨á¨ 㧫  (¥á«¨ = 0 â® ¤® ª®­æ  áâàãªâãàë)
tl_el_focus equ dword[edi+80] ;㪠§ â¥«ì ­  áâàãªâãàã í«¥¬¥­â  ¢ 䮪ãá¥
tl_p_scrol equ dword[edi+84] ;㪠§ â¥«ì ­  áâàãªâãàã áªà®««¨­£ 
tl_on_press equ dword[edi+96] ;㪠§ â¥«ì ­  äã­ªæ¨î, ª®â®à ï ¢ë§ë¢ ¥âáï ¯à¨ ­ ¦ â¨¨ Enter
;data_info dd ? ;+ 0 㪠§ â¥«ì ­  ®á­®¢­ë¥ ¤ ­ë¥
;ls_tim dd ? ;+34 ¢à¥¬ï ¯®á«¥¤­¥£® á®åà ­¥­¨ï
;on_activate dd ? ;+92 㪠§ â¥«ì ­  äã­ªæ¨î ¯à¨  ªâ¨¢¨à®¢ ­¨¨ 㧫 
;ª®­áâ ­âë á⨫ï ;ª®­áâ ­âë á⨫ï
tl_key_no_edit equ 1b ;í«¥¬¥­â ­¥«ì§ï । ªâ¨à®¢ âì ­  ª« ¢¨ âãॠ(¨§¬¥­ïâì ã஢­¨, 㤠«ïâì) tl_key_no_edit equ 1b ;í«¥¬¥­â ­¥«ì§ï । ªâ¨à®¢ âì ­  ª« ¢¨ âãॠ(¨§¬¥­ïâì ã஢­¨, 㤠«ïâì)
tl_draw_par_line equ 10b ;à¨á®¢ âì «¨­¨¨ ª த¨â¥«ì᪮¬ã 㧫ã tl_draw_par_line equ 10b ;à¨á®¢ âì «¨­¨¨ ª த¨â¥«ì᪮¬ã 㧫ã

View File

@ -1,6 +1,6 @@
; макрос для системной библиотеки box_lib.obj ; макрос для системной библиотеки box_lib.obj
; элемент TreeList для Kolibri OS ; элемент TreeList для Kolibri OS
; файл последний раз изменялся 26.03.2010 IgorA ; файл последний раз изменялся 14.04.2010 IgorA
; на код применена GPL2 лицензия ; на код применена GPL2 лицензия
@ -15,47 +15,6 @@ sizeof.TreeList equ 20
; td dd ? ;+16 врем. удаления ; td dd ? ;+16 врем. удаления
;ends ;ends
tl_info_size equ word[edi +4] ;размер данных выделяемых для каждого узла (пользовательськие данные + текст для подписи)
tl_info_max_count equ dword[edi+6] ;максимальное количество узлов, которые можно добавить в элемент
tl_style equ dword[edi+10] ;стили элемента
tl_data_nodes equ dword[edi+14] ;указатель на структуры узлов
tl_data_img equ dword[edi+18] ;указатель на изображения с иконками узлов
tl_img_cx equ word[edi+22] ;ширина иконок
tl_img_cy equ word[edi+24] ;высота иконок
tl_data_img_sys equ dword[edi+26] ;указатель на системные изображения (стрелки, плюсики)
tl_ch_tim equ dword[edi+30] ;количество изменений в файле
tl_tim_undo equ dword[edi+38] ;количество отмененных действий
tl_cur_pos equ dword[edi+42] ;позиция курсора
tl_col_bkg equ dword[edi+46] ;цвет фона
tl_col_zag equ dword[edi+50] ;цвет заголовка
tl_col_txt equ dword[edi+54] ;цвет текста
tl_box_left equ dword[edi+58]
tl_box_top equ dword[edi+62]
tl_box_width equ dword[edi+66]
tl_box_height equ dword[edi+70]
tl_capt_cy equ word[edi+74] ;высота подписи
tl_info_capt_offs equ word[edi+76] ;сдвиг для начала текста (подписи узла)
tl_info_capt_len equ word[edi+78] ;длинна текста подписи узла (если = 0 то до конца структуры)
tl_el_focus equ dword[edi+80] ;указатель на структуру элемента в фокусе
tl_p_scrol equ dword[edi+84] ;указатель на структуру скроллинга
tl_on_press equ dword[edi+96] ;указатель на функцию, которая вызывается при нажатии Enter
;константы стиля
tl_key_no_edit equ 1b ;элемент нельзя редактировать на клавиатуре (изменять уровни, удалять)
tl_draw_par_line equ 10b ;рисовать линии к родительскому узлу
tl_list_box_mode equ 100b ;стиль не отображает уровни (как в ListBox все одного уровня)
;константы для функций
tl_err_save_memory_size equ 10b ;не хватает памяти для сохранения элемента
tl_err_load_caption equ 1b ;в памяти нет заголовка 'tree'
tl_err_load_info_size equ 100b ;не совпадает размер информационной структуры при открытии
tl_load_mode_add equ 0x20000 ;опция считывания в режиме добавления информации
tl_save_load_heder_size equ 26 ;размер заголовка для записи/чтения элементов
;data_info dd ? ;+ 0 указатель на основные даные
;ls_tim dd ? ;+34 время последнего сохранения
;on_activate dd ? ;+92 указатель на функцию при активировании узла
macro use_tree_list macro use_tree_list
{ {
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------

View File

@ -23,7 +23,7 @@ On_NewFile:
mov al,1 mov al,1
call Clear call Clear
call draw_but_toolbar call draw_but_toolbar
call draw_main_win stdcall draw_main_win, tedit0
pop eax pop eax
ret ret
@ -83,13 +83,12 @@ On_OpenFile:
call [mb_create] ;message: Can-t open text file! call [mb_create] ;message: Can-t open text file!
jmp .ret_f jmp .ret_f
@@: @@:
mov [err_opn],1
cmp ebx,-1 cmp ebx,-1
je .ret_f je .ret_f
;if open file ;if open file
call OpenFile call OpenFile
call draw_but_toolbar call draw_but_toolbar
call draw_main_win stdcall draw_main_win, tedit0
cmp ebx,maxChars-2 cmp ebx,maxChars-2
jl .ret_f jl .ret_f
push thread push thread
@ -194,7 +193,7 @@ but_FindText:
call GetTexCoords call GetTexCoords
mov [sel.x0],ebx mov [sel.x0],ebx
mov [sel.y0],eax mov [sel.y0],eax
call draw_main_win stdcall draw_main_win, tedit0
jmp .end_find jmp .end_find
@@: @@:
push thread push thread
@ -241,12 +240,11 @@ GetFindRezult:
but_OpenSyntax: but_OpenSyntax:
cmp byte[panel_id],TE_PANEL_SYNTAX cmp byte[panel_id],TE_PANEL_SYNTAX
jne @f jne @f
push dword tree1 stdcall dword[tl_node_get_data], dword tree1
call dword [tl_node_get_data]
pop dword[fn_col_option] pop dword[fn_col_option]
call InitColText call InitColText
call CmColored call CmColored
call draw_main_win stdcall draw_main_win, tedit0
@@: @@:
ret ret
@ -272,7 +270,7 @@ but_select_word:
@@: @@:
pop edx ecx ebx eax pop edx ecx ebx eax
call draw_but_toolbar call draw_but_toolbar
call draw_main_win stdcall draw_main_win, tedit0
jmp still jmp still
but_cut: but_cut:
@ -285,7 +283,7 @@ but_cut:
cmp al,1 cmp al,1
jne @f jne @f
call draw_but_toolbar call draw_but_toolbar
call draw_main_win stdcall draw_main_win, tedit0
@@: @@:
jmp still jmp still
@ -293,7 +291,7 @@ but_cut:
; al = 1 if copy text ; al = 1 if copy text
but_Copy: but_Copy:
push ax push ax
call IsSel stdcall IsSel, tedit0
cmp al,0 cmp al,0
jne @f jne @f
pop ax pop ax
@ -336,7 +334,7 @@ but_Copy:
cmp ecx,0 cmp ecx,0
je @f je @f
call draw_but_toolbar call draw_but_toolbar
call draw_bufer stdcall draw_bufer, tedit0
@@: @@:
pop esi edx ecx ebx ax pop esi edx ecx ebx ax
ret ret
@ -354,24 +352,29 @@ but_paste:
mov edi,buf mov edi,buf
call TextAdd call TextAdd
call draw_but_toolbar call draw_but_toolbar
call draw_main_win stdcall draw_main_win, tedit0
@@: @@:
pop edi esi bx eax pop edi esi bx eax
jmp still jmp still
but_find: proc but_find, edit:dword ;¢ë§®¢/áªàë⨥ ¯ ­¥«¨ ¯®¨áª 
push edi
mov edi,[edit]
cmp byte[panel_id],TE_PANEL_NULL cmp byte[panel_id],TE_PANEL_NULL
je @f je @f
mov byte[panel_id],TE_PANEL_NULL mov byte[panel_id],TE_PANEL_NULL
mov word[wndMain.left],0 mov ted_wnd_l,0
jmp .e_if jmp .e_if
@@: @@:
mov byte[panel_id],TE_PANEL_FIND mov byte[panel_id],TE_PANEL_FIND
mov word[wndMain.left],TE_PANEL_WIDTH mov ted_wnd_l,TE_PANEL_WIDTH
.e_if: .e_if:
call EvSize stdcall EvSize,edi
call draw_main_win stdcall draw_main_win,edi
jmp still pop edi
ret
endp
but_replace: but_replace:
jmp still jmp still
@ -385,7 +388,7 @@ but_sumb_upper:
call ConvertSelText call ConvertSelText
cmp edi,0 cmp edi,0
je @f je @f
call draw_main_win stdcall draw_main_win, tedit0
@@: @@:
pop edi pop edi
jmp still jmp still
@ -396,14 +399,14 @@ but_sumb_lover:
call ConvertSelText call ConvertSelText
cmp edi,0 cmp edi,0
je @f je @f
call draw_main_win stdcall draw_main_win, tedit0
@@: @@:
pop edi pop edi
jmp still jmp still
but_reverse: but_reverse:
push eax ebx push eax ebx
call IsSel stdcall IsSel, tedit0
cmp al,0 cmp al,0
je @f je @f
call SelNormalize call SelNormalize
@ -427,7 +430,7 @@ but_reverse:
call Revers call Revers
@@: @@:
pop ebx eax pop ebx eax
call draw_main_win stdcall draw_main_win, tedit0
jmp still jmp still
but_undo: but_undo:
@ -501,22 +504,27 @@ but_CtrlHome:
mov [hScr.position],0 mov [hScr.position],0
call draw_but_toolbar call draw_but_toolbar
call draw_main_win stdcall draw_main_win, tedit0
ret ret
but_synt_show: proc but_synt_show, edit:dword
push edi
mov edi,[edit]
cmp byte[panel_id],TE_PANEL_NULL cmp byte[panel_id],TE_PANEL_NULL
je @f je @f
mov byte[panel_id],TE_PANEL_NULL mov byte[panel_id],TE_PANEL_NULL
mov word[wndMain.left],0 mov ted_wnd_l,0
jmp .e_if jmp .e_if
@@: @@:
mov byte[panel_id],TE_PANEL_SYNTAX mov byte[panel_id],TE_PANEL_SYNTAX
mov word[wndMain.left],TE_PANEL_WIDTH mov ted_wnd_l,TE_PANEL_WIDTH
.e_if: .e_if:
call EvSize stdcall EvSize,edi
call draw_main_win stdcall draw_main_win,edi
jmp still pop edi
ret
endp
sel_KeyUp: sel_KeyUp:
cmp [dragk],1 cmp [dragk],1
@ -532,7 +540,7 @@ sel_KeyUp:
@@: @@:
pop dx pop dx
call SelMove call SelMove
call draw_main_win stdcall draw_main_win, tedit0
ret ret
sel_KeyDown: sel_KeyDown:
@ -549,7 +557,7 @@ sel_KeyDown:
@@: @@:
pop dx pop dx
call SelMove call SelMove
call draw_main_win stdcall draw_main_win, tedit0
ret ret
sel_KeyLeft: sel_KeyLeft:
@ -568,10 +576,10 @@ sel_KeyLeft:
cmp dl,8 cmp dl,8
jne @f jne @f
call OnInitialUpdate call OnInitialUpdate
call draw_main_win stdcall draw_main_win, tedit0
jmp .end_f jmp .end_f
@@: @@:
call draw_cur_line stdcall draw_cur_line, tedit0
.end_f: .end_f:
pop dx pop dx
ret ret
@ -592,10 +600,10 @@ sel_KeyRight:
cmp dl,8 cmp dl,8
jne @f jne @f
call OnInitialUpdate call OnInitialUpdate
call draw_main_win stdcall draw_main_win, tedit0
jmp .end_f jmp .end_f
@@: @@:
call draw_cur_line stdcall draw_cur_line, tedit0
.end_f: .end_f:
pop dx pop dx
ret ret

View File

@ -282,6 +282,35 @@ TE_PANEL_WIDTH equ 150 ;
count_of_dir_list_files equ 15 count_of_dir_list_files equ 15
;------------------------------------------------------------------------------
struct TexSelect
x0 dd ?
y0 dd ?
x1 dd ?
y1 dd ?
ends
;------------------------------------------------------------------------------
ted_wnd_l equ dword[edi+ 0] ;®ª­® । ªâ®à : ®âáâ㯠᫥¢ 
ted_wnd_t equ dword[edi+ 4] ;®ª­® । ªâ®à : ®âáâ㯠ᢥàåã
ted_wnd_w equ dword[edi+ 8] ;®ª­® । ªâ®à : è¨à¨­ 
ted_wnd_h equ dword[edi+12] ;®ª­® । ªâ®à : ¢ëá®â 
ted_rec_l equ dword[edi+16] ;è¨à¨­  ¯ ­¥«¨ ¢ ®ª­¥
ted_rec_t equ dword[edi+20] ;¢ëá®â  ¯ ­¥«¨ ¢ ®ª­¥
ted_rec_w equ dword[edi+24] ;è¨à¨­  ᨬ¢®«  (§­ ª®¬¥áâ ) ¢ ®ª­¥
ted_rec_h equ dword[edi+28] ;¢ëá®â  ᨬ¢®«  (§­ ª®¬¥áâ ) ¢ ®ª­¥
ted_drag_m equ byte[edi+32] ;¢ë¤¥«¥­¨¥ ®â ¬ëè¨
ted_drag_k equ byte[edi+33] ;¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
;------------------------------------------------------------------------------
align 4
tedit0: ;áâàãªâãà  â¥ªá⮢®£® । ªâ®à 
.wnd BOX 0,50,440,150 ;+ 0
.rec BOX 30,23,7,10 ;+16
.dragm db 0 ;+32 ¢ë¤¥«¥­¨¥ ®â ¬ëè¨
dragk db 0 ;+33 ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
sel TexSelect 0,0,0,0 ;+34 áâàãªâãà  ¢ë¤¥«¥­¨ï
seln TexSelect ;+50 ¤®¯®«­¨â¥«ì­ ï áâàãªâãà  ¢ë¤¥«¥­¨ï
;------------------------------------------------------------------------------
el_focus dd 0 el_focus dd 0
mouse_dd dd 0 mouse_dd dd 0
tree1 tree_list 264,count_of_dir_list_files+2, tl_key_no_edit+tl_draw_par_line+tl_list_box_mode,\ tree1 tree_list 264,count_of_dir_list_files+2, tl_key_no_edit+tl_draw_par_line+tl_list_box_mode,\

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +1,17 @@
;Îăđîěíŕ˙ áëŕăîäŕđíîńňü Maxxxx32, Diamond, Heavyiron ;Ž£à®¬­ ï ¡« £®¤ à­®áâì Maxxxx32, Diamond, Heavyiron
;č äđóăčě ďđîăđŕěěčńňŕě, ŕ ňŕęćĺ ;¨ ¤à㣨¬ ¯à®£à ¬¬¨áâ ¬,   â ª¦¥
;Ňĺďëîâó Ŕëĺęńĺţ (<Lrz> www.lrz.land.ru) ;’¥¯«®¢ã €«¥ªá¥î (<Lrz> www.lrz.land.ru)
use32 use32
org 0x0 org 0x0
db 'MENUET01' ;čäĺíňčô. čńďîëí˙ĺěîăî ôŕéëŕ âńĺăäŕ 8 áŕéň db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
dd 0x01 dd 0x01
dd start dd start
dd i_end ; đŕçěĺđ ďđčëîćĺíč˙ dd i_end ; à §¬¥à ¯à¨«®¦¥­¨ï
dd mem dd mem
dd stacktop dd stacktop
dd file_name;buf_cmd_lin dd file_name ; command line
dd sys_path dd sys_path
MAX_COLOR_WORD_LEN equ 40 MAX_COLOR_WORD_LEN equ 40
@ -19,11 +19,10 @@ maxChars equ 100002 ;(...+2)
BUF_SIZE equ 1000 ;bufer for copy|paste BUF_SIZE equ 1000 ;bufer for copy|paste
maxColWords equ 10000 maxColWords equ 10000
include '../../proc32.inc'
include '../../macros.inc' include '../../macros.inc'
include '../../develop/libraries/box_lib/load_lib.mac' include '../../develop/libraries/box_lib/load_lib.mac'
include '../../develop/libraries/box_lib/trunk/tree_list.mac' include '../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../develop/libraries/box_lib/trunk/editbox.mac'
include 'lang.inc' include 'lang.inc'
include 't_data.inc' include 't_data.inc'
@ -128,7 +127,7 @@ load_libraries l_libs_start,load_lib_end
push dword tree1 push dword tree1
call dword[tl_data_init] call dword[tl_data_init]
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
; ÷čňŕĺě bmp ôŕéë ń ęóđńîđŕěč č ëčíč˙ěč ; ç¨â ¥¬ bmp ä ©« á ªãàá®à ¬¨ ¨ «¨­¨ï¬¨
copy_path fn_icon_tl_sys,sys_path,file_name,0x0 copy_path fn_icon_tl_sys,sys_path,file_name,0x0
mov ecx,3*256*13 mov ecx,3*256*13
@ -151,7 +150,7 @@ load_libraries l_libs_start,load_lib_end
mov dword[tree1.data_img_sys],0 mov dword[tree1.data_img_sys],0
@@: @@:
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
; ÷čňŕĺě bmp ôŕéë ń čęîíęŕěč óçëîâ ; ç¨â ¥¬ bmp ä ©« á ¨ª®­ª ¬¨ 㧫®¢
copy_path fn_icon_tl_nod,sys_path,file_name,0x0 copy_path fn_icon_tl_nod,sys_path,file_name,0x0
mov ecx,3*256*2 mov ecx,3*256*2
@ -174,7 +173,7 @@ load_libraries l_libs_start,load_lib_end
mov dword[tree1.data_img],0 mov dword[tree1.data_img],0
@@: @@:
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
copy_path fn_syntax_dir,sys_path,file_name,0x0 ;áĺđĺě ďóňü ę ďŕďęĺ ń ôŕéëŕěč ńčíňŕęńčńŕ copy_path fn_syntax_dir,sys_path,file_name,0x0 ;¡¥à¥¬ ¯ãâì ª ¯ ¯ª¥ á ä ©« ¬¨ ᨭ⠪á¨á 
mov eax,70 mov eax,70
mov ebx,tree_file_struct mov ebx,tree_file_struct
int 0x40 int 0x40
@ -186,10 +185,10 @@ je .end_dir_init
add eax,32+4+1+3+4*6+8 add eax,32+4+1+3+4*6+8
mov ecx,ebx mov ecx,ebx
@@: @@:
cmp byte[eax],'.' ;ôčëüňđóĺě ôŕéëű ń čěĺíŕěč '.' č '..' cmp byte[eax],'.' ;䨫ìâà㥬 ä ©«ë á ¨¬¥­ ¬¨ '.' ¨ '..'
je .filter je .filter
push dword tree1 push dword tree1
push dword 0x10000 ;1*2^16 - ăäĺ 1 íîěĺđ čęîíęč ń ęíčăîé push dword 0x10000 ;1*2^16 - £¤¥ 1 ­®¬¥à ¨ª®­ª¨ á ª­¨£®©
push dword eax push dword eax
call dword[tl_node_add] call dword[tl_node_add]
@ -228,36 +227,33 @@ red_win:
mov edx,[sc.work] mov edx,[sc.work]
or edx,0x73000000 or edx,0x73000000
mov edi,hed mov edi,hed
mcall int 0x40
mov edi,tedit0
mcall 9,procinfo,-1 mcall 9,procinfo,-1
call EvSize stdcall EvSize,edi
mov eax,13 ;rect mov eax,13 ;âåðõíèé ïðÿìîóãîëüíèê, äëÿ î÷èñòêè âåðõíåé ïàíåëè
xor ebx,ebx xor ebx,ebx
xor ecx,ecx mov ecx,ted_wnd_t
mov bx,word [procinfo.client_box.width] mov bx,word [procinfo.client_box.width]
inc bx inc bx
mov cx,word [wndMain.top] int 0x40
mcall
push dword edit1 stdcall [edit_box_draw], dword edit1
call [edit_box_draw] stdcall [menu_bar_draw], dword menu_data_1
; draw for Menu 1
push dword menu_data_1
call [menu_bar_draw]
call draw_but_toolbar call draw_but_toolbar
cmp [err_ini0],1 cmp [err_ini0],1
jne @f jne @f
mov eax,4 mov eax,4
mov ebx,[wndMain.left] mov ebx,ted_wnd_l
add ebx,[recMain.left] add ebx,ted_rec_l
shl ebx,16 shl ebx,16
add ebx,[wndMain.top] add ebx,ted_wnd_t
add ebx,[recMain.top] add ebx,ted_rec_t
mov ecx,0x80ff0000 mov ecx,0x80ff0000
mov edx,txtErrIni0 mov edx,txtErrIni0
int 0x40 int 0x40
@ -270,16 +266,7 @@ red_win:
cmp [err_ini0],1 cmp [err_ini0],1
je @f je @f
call draw_main_win stdcall draw_main_win, tedit0
@@:
cmp [err_opn],1
jne @f
;mov eax,4
mov ebx,10*65536+35
mov ecx,0x80ff0000
mov edx,txtErrOpen
mcall
@@: @@:
mcall 12,2 mcall 12,2
@ -288,7 +275,7 @@ still:
mov eax,10 mov eax,10
mcall mcall
cmp al,1 ;čçě. ďîëîćĺíčĺ îęíŕ cmp al,1 ;¨§¬. ¯®«®¦¥­¨¥ ®ª­ 
jz red_win jz red_win
cmp al,2 cmp al,2
jz key jz key
@ -302,8 +289,7 @@ still:
mouse: mouse:
push dword edit1 stdcall [edit_box_mouse], dword edit1
call [edit_box_mouse]
test word [edit1.flags],10b;ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬ test word [edit1.flags],10b;ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
jne still jne still
@ -316,16 +302,14 @@ mouse:
cmp eax,[wScr.cur_area] cmp eax,[wScr.cur_area]
jbe .horizontal jbe .horizontal
; mouse event for Vertical ScrollBar ; mouse event for Vertical ScrollBar
push dword wScr stdcall [scrollbar_ver_mouse], dword wScr
call [scrollbar_ver_mouse]
mov eax,wScr.redraw mov eax,wScr.redraw
xor ebx,ebx xor ebx,ebx
cmp [eax],ebx cmp [eax],ebx
je @f je @f
mov [eax],ebx mov [eax],ebx
call draw_main_win stdcall draw_main_win, tedit0
;call mouse_wnd_main
jmp still jmp still
@@: @@:
cmp [wScr.delta2],0 cmp [wScr.delta2],0
@ -342,7 +326,7 @@ mouse:
cmp [eax],ebx cmp [eax],ebx
je .other je .other
mov [eax],ebx mov [eax],ebx
call draw_main_win stdcall draw_main_win, tedit0
jmp still jmp still
.other: .other:
cmp [wScr.delta2],0 cmp [wScr.delta2],0
@ -350,7 +334,7 @@ mouse:
cmp [hScr.delta2],0 cmp [hScr.delta2],0
jne still jne still
call mouse_wnd_main stdcall mouse_wnd_main, tedit0
cmp byte[panel_id],TE_PANEL_FIND ;if not panel cmp byte[panel_id],TE_PANEL_FIND ;if not panel
jne @f jne @f
@ -468,8 +452,7 @@ key:
; jne still ; jne still
call KeyConvertToASCII call KeyConvertToASCII
push dword edit2 stdcall [edit_box_key], dword edit2
call [edit_box_key]
jmp still jmp still
@@: @@:
@ -495,7 +478,7 @@ key:
jne @f jne @f
cmp byte[panel_id],TE_PANEL_FIND cmp byte[panel_id],TE_PANEL_FIND
je @f je @f
call but_find stdcall but_find, tedit0
@@: @@:
cmp ah,44 ;Ctrl+Z cmp ah,44 ;Ctrl+Z
je but_undo je but_undo
@ -534,105 +517,105 @@ key:
jne @f jne @f
call sel_KeyDown call sel_KeyDown
@@: @@:
;mov [dragk],1 ;íŕ÷číŕĺě âűäĺëĺíčĺ îň ęëŕâčŕňóđű ;mov [dragk],1 ;­ ç¨­ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
jmp .key_MoveCur jmp .key_MoveCur
.key_Shift: .key_Shift:
;------------------------------------------------- ;-------------------------------------------------
cmp ah,72 ;178 ;Up cmp ah,72 ;178 ;Up
jne @f jne @f
push dx push dx
call draw_cursor_sumb stdcall draw_cursor_sumb, tedit0
call CurMoveUp call CurMoveUp
cmp dl,8 cmp dl,8
jne .no_red_0 jne .no_red_0
call OnInitialUpdate call OnInitialUpdate
call draw_main_win stdcall draw_main_win, tedit0
pop dx pop dx
jmp @f jmp @f
.no_red_0: .no_red_0:
call draw_main_cursor stdcall draw_main_cursor, tedit0
pop dx pop dx
mov [dragk],0 ;çŕęŕí÷čâŕĺě âűäĺëĺíčĺ îň ęëŕâčŕňóđű mov [dragk],0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
@@: @@:
cmp ah,80 ;177 ;Down cmp ah,80 ;177 ;Down
jne @f jne @f
push dx push dx
call draw_cursor_sumb stdcall draw_cursor_sumb, tedit0
call CurMoveDown call CurMoveDown
cmp dl,8 cmp dl,8
jne .no_red_1 jne .no_red_1
call OnInitialUpdate call OnInitialUpdate
call draw_main_win stdcall draw_main_win, tedit0
pop dx pop dx
jmp @f jmp @f
.no_red_1: .no_red_1:
call draw_main_cursor stdcall draw_main_cursor, tedit0
pop dx pop dx
mov [dragk],0 ;çŕęŕí÷čâŕĺě âűäĺëĺíčĺ îň ęëŕâčŕňóđű mov [dragk],0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
@@: @@:
cmp ah,75 ;176 ;Left cmp ah,75 ;176 ;Left
jne @f jne @f
push dx push dx
call draw_cursor_sumb stdcall draw_cursor_sumb, tedit0
call CurMoveLeft call CurMoveLeft
cmp dl,8 cmp dl,8
jne .no_red_2 jne .no_red_2
call OnInitialUpdate call OnInitialUpdate
call draw_main_win stdcall draw_main_win, tedit0
pop dx pop dx
jmp @f jmp @f
.no_red_2: .no_red_2:
call draw_main_cursor stdcall draw_main_cursor, tedit0
pop dx pop dx
mov [dragk],0 ;çŕęŕí÷čâŕĺě âűäĺëĺíčĺ îň ęëŕâčŕňóđű mov [dragk],0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
@@: @@:
cmp ah,77 ;179 ;Right cmp ah,77 ;179 ;Right
jne @f jne @f
push dx push dx
call draw_cursor_sumb stdcall draw_cursor_sumb, tedit0
call CurMoveRight call CurMoveRight
cmp dl,8 cmp dl,8
jne .no_red_3 jne .no_red_3
call OnInitialUpdate call OnInitialUpdate
call draw_main_win stdcall draw_main_win, tedit0
pop dx pop dx
jmp @f jmp @f
.no_red_3: .no_red_3:
call draw_main_cursor stdcall draw_main_cursor, tedit0
pop dx pop dx
mov [dragk],0 ;çŕęŕí÷čâŕĺě âűäĺëĺíčĺ îň ęëŕâčŕňóđű mov [dragk],0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
@@: @@:
cmp ah,71 ;180 ;Home cmp ah,71 ;180 ;Home
jne @f jne @f
push dx push dx
call draw_cursor_sumb stdcall draw_cursor_sumb, tedit0
call CurMoveX_FirstChar call CurMoveX_FirstChar
cmp dl,8 cmp dl,8
jne .no_red_4 jne .no_red_4
call OnInitialUpdate call OnInitialUpdate
call draw_main_win stdcall draw_main_win, tedit0
pop dx pop dx
jmp @f jmp @f
.no_red_4: .no_red_4:
call draw_main_cursor stdcall draw_main_cursor, tedit0
pop dx pop dx
mov [dragk],0 ;çŕęŕí÷čâŕĺě âűäĺëĺíčĺ îň ęëŕâčŕňóđű mov [dragk],0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
@@: @@:
cmp ah,79 ;181 ;End cmp ah,79 ;181 ;End
jne @f jne @f
push dx push dx
call draw_cursor_sumb stdcall draw_cursor_sumb, tedit0
call CurMoveX_LastChar call CurMoveX_LastChar
cmp dl,8 cmp dl,8
jne .no_red_5 jne .no_red_5
call OnInitialUpdate call OnInitialUpdate
call draw_main_win stdcall draw_main_win, tedit0
pop dx pop dx
jmp @f jmp @f
.no_red_5: .no_red_5:
call draw_main_cursor stdcall draw_main_cursor, tedit0
pop dx pop dx
mov [dragk],0 ;çŕęŕí÷čâŕĺě âűäĺëĺíčĺ îň ęëŕâčŕňóđű mov [dragk],0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
@@: @@:
cmp ah,73 ;184 ;PageUp cmp ah,73 ;184 ;PageUp
jne @f jne @f
@ -642,7 +625,7 @@ key:
pop dx pop dx
je @f je @f
call OnInitialUpdate call OnInitialUpdate
call draw_main_win stdcall draw_main_win, tedit0
@@: @@:
cmp ah,81 ;183 ;PageDown cmp ah,81 ;183 ;PageDown
jne @f jne @f
@ -652,8 +635,8 @@ key:
pop dx pop dx
je @f je @f
call OnInitialUpdate call OnInitialUpdate
call draw_main_win stdcall draw_main_win, tedit0
mov [dragk],0 ;çŕęŕí÷čâŕĺě âűäĺëĺíčĺ îň ęëŕâčŕňóđű mov [dragk],0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
@@: @@:
;------------------------------------------------- ;-------------------------------------------------
cmp [keyUpr],0 cmp [keyUpr],0
@ -668,7 +651,7 @@ key:
ja still ja still
call KeyConvertToASCII call KeyConvertToASCII
;mov [dragk],0 ;çŕęŕí÷čâŕĺě âűäĺëĺíčĺ îň ęëŕâčŕňóđű ;mov [dragk],0 ;§ ª ­ç¨¢ ¥¬ ¢ë¤¥«¥­¨¥ ®â ª« ¢¨ âãàë
push ebx push ebx
xor ebx,ebx xor ebx,ebx
@ -692,10 +675,10 @@ key:
call draw_but_toolbar call draw_but_toolbar
cmp byte [key_new],13 cmp byte [key_new],13
jne .dr_m_win jne .dr_m_win
call draw_main_win stdcall draw_main_win, tedit0
jmp .dr_cur_l jmp .dr_cur_l
.dr_m_win: .dr_m_win:
call draw_cur_line stdcall draw_cur_line, tedit0
.dr_cur_l: .dr_cur_l:
pop edi esi pop edi esi
@@: @@:
@ -713,7 +696,7 @@ key:
call TextDel call TextDel
.del_one_b: .del_one_b:
call draw_but_toolbar call draw_but_toolbar
call draw_main_win stdcall draw_main_win, tedit0
pop bx ax pop bx ax
@@: @@:
@ -729,27 +712,27 @@ key:
call TextDel call TextDel
.del_one_d: .del_one_d:
call draw_but_toolbar call draw_but_toolbar
call draw_main_win stdcall draw_main_win, tedit0
pop bx ax pop bx ax
@@: @@:
cmp ah,185 ;Ins cmp ah,185 ;Ins
jne @f jne @f
call draw_cursor_sumb stdcall draw_cursor_sumb, tedit0
xor [curMod],1 xor [curMod],1
call draw_main_cursor stdcall draw_main_cursor, tedit0
@@: @@:
jmp still jmp still
button: button:
; cmp [menu_active],1 ;ĺńëč íŕćŕëč ěĺíţ, ňî ńíŕ÷ŕëŕ đĺŕęöč˙ íŕ ěĺíţ ; cmp [menu_active],1 ;¥á«¨ ­ ¦ «¨ ¬¥­î, â® á­ ç «  ॠªæ¨ï ­  ¬¥­î
; jne @f ;mouse.menu_bar_1 ; jne @f ;mouse.menu_bar_1
; mov [menu_active],0 ; mov [menu_active],0
; jmp still ; jmp still
; @@: ; @@:
mcall 17 ;ďîëó÷čňü ęîä íŕćŕňîé ęíîďęč mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨
cmp ah,3 cmp ah,3
jne @f jne @f
call but_NewFile call but_NewFile
@ -773,7 +756,9 @@ button:
cmp ah,9 cmp ah,9
jz but_paste jz but_paste
cmp ah,10 cmp ah,10
jz but_find jne @f
stdcall but_find, tedit0
@@:
cmp ah,11 cmp ah,11
jz but_replace jz but_replace
cmp ah,12 cmp ah,12
@ -793,7 +778,9 @@ button:
cmp ah,19 cmp ah,19
jz but_k_words_show jz but_k_words_show
cmp ah,20 cmp ah,20
jz but_synt_show jne @f
stdcall but_synt_show, tedit0
@@:
cmp ah,200 cmp ah,200
jne @f jne @f
@ -824,11 +811,10 @@ button:
call mem_Free call mem_Free
push dword tree1 push dword tree1
call dword[tl_data_clear] call dword[tl_data_clear]
mcall -1 ;âűőîä čç ďđîăđŕěěű mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
txtErrOpen db 'ŤĄ ­ ©¤Ą­ ä ©«, Żŕ®˘Ąŕě⥠Żŕ ˘¨«ě­®áâě ¨¬Ą­¨',0
txtErrIni0 db '<27>¥ ®âªàë«áï ä ©« á ¨ª®­ª ¬¨',0 txtErrIni0 db '<27>¥ ®âªàë«áï ä ©« á ¨ª®­ª ¬¨',0
err_ini0 db 0 err_ini0 db 0

View File

@ -8,13 +8,6 @@ struct f70
name dd ? name dd ?
ends ends
struct TexSelect
x0 dd ?
y0 dd ?
x1 dd ?
y1 dd ?
ends
struct TexColViv struct TexColViv
Text rb MAX_COLOR_WORD_LEN; // ñëîâî Text rb MAX_COLOR_WORD_LEN; // ñëîâî
f1 dd 0 f1 dd 0
@ -52,7 +45,7 @@ Col dd 0 ;
conv_tabl rb 128 ; òàáëèöà äëÿ êîíâåðòèðîâàíèÿ scan-êîäà â ascii-êîä conv_tabl rb 128 ; òàáëèöà äëÿ êîíâåðòèðîâàíèÿ scan-êîäà â ascii-êîä
keyUpr dd 0 keyUpr dd 0
err_opn db 0 ;ошибка открытия файла
err_sav db 0 ;îøèáêà ñîõðàíåíèÿ ôàéëà err_sav db 0 ;îøèáêà ñîõðàíåíèÿ ôàéëà
panel_id db 0 ;íîìåð îòêðûòîé ïàíåëè panel_id db 0 ;íîìåð îòêðûòîé ïàíåëè
@ -68,23 +61,16 @@ tex dd 0 ;text memory pointer
tex_1 dd 0 ;text first symbol pointer tex_1 dd 0 ;text first symbol pointer
tex_end dd 0 ;text end memory pointer tex_end dd 0 ;text end memory pointer
hed db 'TextEditor 05.02.10',0 ;подпись окна
sc system_colors
wndMain BOX 0,50,440,150
recMain BOX 30,23,7,10
curMod db 1 curMod db 1
cur_x dd 0 cur_x dd 0
cur_y dd 0 cur_y dd 0
invis db 0 ;ðåæèì ïîêàçà íåïå÷àòàåìûõ ñèìâîëîâ invis db 0 ;ðåæèì ïîêàçà íåïå÷àòàåìûõ ñèìâîëîâ
symbol_new_line db 20 ;ñèìâîë çàâåðøåíèÿ ñòðîêè symbol_new_line db 20 ;ñèìâîë çàâåðøåíèÿ ñòðîêè
dragm db 0 ;выделение от мыши
dragk db 0 ;выделение от клавиатуры
sel TexSelect 0,0,0,0 ;структура выделения
seln TexSelect ;дополнительная структура выделения
help_id dd -1 ;èäåíòèôèêàòîð äëÿ ñïðàâêè help_id dd -1 ;èäåíòèôèêàòîð äëÿ ñïðàâêè
hed db 'TextEditor 15.04.10',0 ;ïîäïèñü îêíà
sc system_colors
fn_icon db 'te_icon.bmp',0 fn_icon db 'te_icon.bmp',0
bmp_icon dd 0 bmp_icon dd 0
run_file_70 f70 run_file_70 f70
@ -117,10 +103,11 @@ CanSave:
;output: ;output:
; al = 1 - selected ; al = 1 - selected
IsSel: proc IsSel, edit:dword
push ebx push ebx edi
mov edi,dword[edit]
xor al,al xor al,al
cmp [dragm],1 cmp ted_drag_m,1
je @f je @f
mov al,1 mov al,1
mov ebx,[sel.x0] mov ebx,[sel.x0]
@ -131,8 +118,9 @@ IsSel:
jne @f jne @f
xor al,al xor al,al
@@: @@:
pop ebx pop edi ebx
ret ret
endp
SelNormalize: SelNormalize:
push ecx esi edi push ecx esi edi
@ -343,7 +331,6 @@ InitColText:
;input: ;input:
; ebx = file size ; ebx = file size
OpenFile: OpenFile:
mov [err_opn],0
push eax ;destination push eax ;destination
push ecx ;for cycle push ecx ;for cycle
push edx ;source push edx ;source
@ -729,7 +716,7 @@ CharAdd:
ConvertSelText: ConvertSelText:
xor edi,edi xor edi,edi
push eax ebx ecx edx esi push eax ebx ecx edx esi
call IsSel stdcall IsSel, tedit0
cmp al,0 cmp al,0
je .end_f je .end_f
call SetUndo call SetUndo
@ -1329,7 +1316,7 @@ GoToPos:
;output: ;output:
; al = 1 if delete ; al = 1 if delete
SelTextDel: SelTextDel:
call IsSel stdcall IsSel, tedit0
cmp al,0 cmp al,0
jne @f jne @f
ret ret
@ -1664,8 +1651,8 @@ ShowHelpF1:
call FindHelpId call FindHelpId
@@: @@:
pop edx eax pop edx eax
;call draw_main_cursor ;stdcall draw_main_cursor, tedit0
call draw_help_f1 stdcall draw_help_f1, tedit0
ret ret
;input: ;input: