diff --git a/programs/develop/libraries/box_lib/trunk/bl_sys.mac b/programs/develop/libraries/box_lib/trunk/bl_sys.mac index b5b7ed57a8..fead243904 100644 --- a/programs/develop/libraries/box_lib/trunk/bl_sys.mac +++ b/programs/develop/libraries/box_lib/trunk/bl_sys.mac @@ -6,4 +6,5 @@ include 'd_button.mac' ;macro implements dinamic_button include 'menubar.mac' ;macro implements menubar include 'filebrowser.mac' ;macro implements filebrowser include 'tree_list.mac' ;macro implements tree_list, image_list, list_box -include 'pathshow.mac' ;macro implements pathshow \ No newline at end of file +include 'pathshow.mac' ;macro implements pathshow +include 't_edit.mac' ;macro implements text_editor \ No newline at end of file diff --git a/programs/develop/libraries/box_lib/trunk/box_lib.asm b/programs/develop/libraries/box_lib/trunk/box_lib.asm index f0838b990c..666efe9fb4 100644 --- a/programs/develop/libraries/box_lib/trunk/box_lib.asm +++ b/programs/develop/libraries/box_lib/trunk/box_lib.asm @@ -16,6 +16,7 @@ public EXPORTS section '.flat' code readable align 16 include '../../../../macros.inc' +include '../../../../proc32.inc' include 'bl_sys.mac' include 'box_lib.mac' ;macro which should make life easier :) @@ -88,6 +89,12 @@ use_tree_list align 16 use_path_show +;-------------------------------------------------- +;text editor +;-------------------------------------------------- +align 16 +use_text_edit + align 16 init: ret @@ -141,13 +148,13 @@ dd sz_tl_mouse, tl_mouse dd sz_tl_draw, tl_draw dd sz_tl_info_undo, tl_info_undo dd sz_tl_info_redo, tl_info_redo -dd sz_tl_node_add, tl_node_add +dd sz_tl_node_add, tl_node_add dd sz_tl_node_set_data, tl_node_set_data dd sz_tl_node_get_data, tl_node_get_data dd sz_tl_node_delete, tl_node_delete dd sz_tl_cur_beg, tl_cur_beg -dd sz_tl_cur_next, tl_cur_next -dd sz_tl_cur_perv, tl_cur_perv +dd sz_tl_cur_next, tl_cur_next +dd sz_tl_cur_perv, tl_cur_perv dd sz_tl_node_close_open, tl_node_close_open dd sz_tl_node_lev_inc, tl_node_lev_inc dd sz_tl_node_lev_dec, tl_node_lev_dec @@ -156,23 +163,48 @@ dd sz_tl_node_move_down, tl_node_move_down dd sz_tl_node_poi_get_info, tl_node_poi_get_info dd sz_tl_node_poi_get_next_info, tl_node_poi_get_next_info dd sz_tl_node_poi_get_data, tl_node_poi_get_data -dd sz_tl_save_mem, tl_save_mem -dd sz_tl_load_mem, tl_load_mem +dd sz_tl_save_mem, tl_save_mem +dd sz_tl_load_mem, tl_load_mem dd sz_tl_get_mem_size, tl_get_mem_size dd sz_tl_version_tree_list, 0x00000001 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_can_save, ted_can_save +dd sz_ted_clear, ted_clear +dd sz_ted_delete, ted_delete +dd sz_ted_draw, ted_draw +dd sz_ted_init, ted_init +dd sz_ted_init_syntax_file, ted_init_syntax_file +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_text_add, ted_text_add +dd sz_ted_but_select_word, ted_but_select_word +dd sz_ted_but_cut, ted_but_cut +dd sz_ted_but_copy, ted_but_copy +dd sz_ted_but_paste, ted_but_paste +dd sz_ted_but_undo, ted_but_undo +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, 0x00000001 + dd 0,0 -sz_init db 'lib_init',0 +sz_init db 'lib_init',0 sz_version db 'version',0 sz_edit_box db 'edit_box',0 -sz_edit_box_key db 'edit_box_key',0 +sz_edit_box_key db 'edit_box_key',0 sz_edit_box_mouse db 'edit_box_mouse',0 szVersion_ed db 'version_ed',0 @@ -196,7 +228,7 @@ szVersion_dbutton db 'version_dbutton',0 sz_Menu_bar_draw db 'menu_bar_draw',0 sz_Menu_bar_mouse db 'menu_bar_mouse',0 -sz_Menu_bar_activate db 'menu_bar_activate',0 +sz_Menu_bar_activate db 'menu_bar_activate',0 szVersion_menu_bar db 'version_menu_bar',0 sz_FileBrowser_draw db 'FileBrowser_draw',0 @@ -204,14 +236,14 @@ sz_FileBrowser_mouse db 'FileBrowser_mouse',0 sz_FileBrowser_key db 'FileBrowser_key',0 szVersion_FileBrowser db 'version_FileBrowser',0 -sz_tl_data_init db 'tl_data_init',0 +sz_tl_data_init db 'tl_data_init',0 sz_tl_data_clear db 'tl_data_clear',0 sz_tl_info_clear db 'tl_info_clear',0 sz_tl_key db 'tl_key',0 sz_tl_mouse db 'tl_mouse',0 sz_tl_draw db 'tl_draw',0 -sz_tl_info_undo db 'tl_info_undo',0 -sz_tl_info_redo db 'tl_info_redo',0 +sz_tl_info_undo db 'tl_info_undo',0 +sz_tl_info_redo db 'tl_info_redo',0 sz_tl_node_add db 'tl_node_add',0 sz_tl_node_set_data db 'tl_node_set_data',0 sz_tl_node_get_data db 'tl_node_get_data',0 @@ -224,14 +256,39 @@ sz_tl_node_lev_inc db 'tl_node_lev_inc',0 sz_tl_node_lev_dec db 'tl_node_lev_dec',0 sz_tl_node_move_up db 'tl_node_move_up',0 sz_tl_node_move_down db 'tl_node_move_down',0 -sz_tl_node_poi_get_info db 'tl_node_poi_get_info',0 +sz_tl_node_poi_get_info db 'tl_node_poi_get_info',0 sz_tl_node_poi_get_next_info db 'tl_node_poi_get_next_info',0 -sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0 +sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0 sz_tl_save_mem db 'tl_save_mem',0 sz_tl_load_mem db 'tl_load_mem',0 sz_tl_get_mem_size db 'tl_get_mem_size',0 -sz_tl_version_tree_list db 'version_tree_list',0 +sz_tl_version_tree_list db 'version_tree_list',0 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_can_save db 'ted_can_save',0 +sz_ted_clear db 'ted_clear',0 +sz_ted_delete db 'ted_delete',0 +sz_ted_draw db 'ted_draw',0 +sz_ted_init db 'ted_init',0 +sz_ted_init_syntax_file db 'ted_init_syntax_file',0 +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_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 +sz_ted_but_copy db 'ted_but_copy',0 +sz_ted_but_paste db 'ted_but_paste',0 +sz_ted_but_undo db 'ted_but_undo',0 +sz_ted_but_redo db 'ted_but_redo',0 +sz_ted_but_reverse db 'ted_but_reverse',0 +sz_ted_but_find_next db 'ted_but_find_next',0 +sz_ted_text_colored db 'ted_text_colored',0 +sz_ted_version db 'version_text_edit',0 \ No newline at end of file diff --git a/programs/develop/libraries/box_lib/trunk/box_lib.mac b/programs/develop/libraries/box_lib/trunk/box_lib.mac index 502f0223eb..c4425d1356 100644 --- a/programs/develop/libraries/box_lib/trunk/box_lib.mac +++ b/programs/develop/libraries/box_lib/trunk/box_lib.mac @@ -168,6 +168,10 @@ op_flag_en=10b .flags: dd flags+0 ; 䫠 } +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;Basic macros for use TreeList ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + struc tree_list info_size,info_max_count,style, img_cx,img_cy,\ col_bkg,col_zag,col_txt, box_l,box_t,box_w,box_h, capt_cy,info_capt_offs,\ info_capt_len,el_focus, p_scrol,on_press { @@ -201,10 +205,6 @@ struc tree_list info_size,info_max_count,style, img_cx,img_cy,\ .on_press dd on_press } -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;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] ;⨫ @@ -245,3 +245,102 @@ tl_err_load_caption equ 1b ; tl_err_load_info_size equ 100b ; ᮢ ࠧ ଠ樮 ⨨ tl_load_mode_add equ 0x20000 ; 뢠 ० ଠ樨 tl_save_load_heder_size equ 26 ;ࠧ /⥭ ⮢ + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;Basic macros for use TextEditor ; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +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] ;뤥 +ted_sel_x0 equ dword[edi+34] ;न 뤥 x0 +ted_sel_y0 equ dword[edi+38] ;न 뤥 y0 +ted_sel_x1 equ dword[edi+42] ;न 뤥 x1 +ted_sel_y1 equ dword[edi+46] ;न 뤥 y1 +; न 뤥 +ted_seln_x0 equ dword[edi+50] +ted_seln_y0 equ dword[edi+54] +ted_seln_x1 equ dword[edi+58] +ted_seln_y1 equ dword[edi+62] + +ted_tex equ dword[edi+66] ;㪠⥫ ࠭ ⥪ +ted_tex_1 equ dword[edi+70] ;㪠⥫ 1- ᨬ +ted_tex_end equ dword[edi+74] ;㪠⥫ ᫥ ᨬ +ted_cur_x equ dword[edi+78] ;न x +ted_cur_y equ dword[edi+82] ;न y +ted_max_chars equ dword[edi+86] ;ᨬ쭮 ᫮ ᨬ 㬥 +ted_colors_text_count equ dword[edi+90] ;⢮ 梥⮢ ⥪ +ted_key_words_count equ dword[edi+94] ;⢮ 祢 ᫮ +ted_color_cursor equ dword[edi+98] ;梥 +ted_color_wnd_capt equ dword[edi+102] ;梥 +ted_color_wnd_work equ dword[edi+106] ;梥 䮭 +ted_color_wnd_bord equ dword[edi+110] ;梥 ⥪ +ted_color_select equ dword[edi+114] ;梥 뤥 +ted_color_cur_text equ dword[edi+118] ;梥 ᨬ ஬ +ted_color_wnd_text equ dword[edi+122] ;梥 ⥪ +ted_syntax_file equ dword[edi+126] ;㪠⥫ 砫 䠩 ᨭ⠪ +ted_syntax_file_size equ dword[edi+130] ;ᨬ ࠧ 䠩 ᨭ⠪ +ted_text_colors equ dword[edi+134] ;㪠⥫ ᨢ 梥⮢ ⥪ +ted_help_text_f1 equ dword[edi+138] ;㪠⥫ ⥪ ࠢ ( ⨨ F1) +ted_help_id equ dword[edi+142] ;䨪 ࠢ +ted_key_words_data equ dword[edi+146] ;㪠⥫ 祢 ᫮ TexColViv +ted_tim_ch equ dword[edi+150] ;⢮ 䠩 +ted_tim_undo equ dword[edi+154] ;⢮ ⬥ ⢨ +ted_tim_ls equ dword[edi+158] ;६ ᫥ ࠭ +ted_tim_co equ dword[edi+162] ;६ ᫥ 梥⮢ ࠧ⪨ +ted_el_focus equ dword[edi+166] ;㪠⥫ ६ 䮪 +ted_err_save equ byte[edi+170] ;訡 ࠭ 䠩 +ted_panel_id equ byte[edi+171] ; ⮩ +ted_key_new equ byte[edi+172] ;ᨬ, 㤥 +ted_symbol_new_line equ byte[edi+173] ;ᨬ 襭 ப +ted_scr_w equ dword[edi+174] ;⨪ ஫ +ted_scr_h equ dword[edi+178] ;ਧ⠫ ஫ +ted_arr_key_pos equ dword[edi+182] ;㪠⥫ ᨢ 権 祢 ᫮ +ted_buffer equ dword[edi+186] ;㪠⥫ ஢/⠢ +ted_buffer_find equ dword[edi+190] ;㪠⥫ ᪠ +ted_cur_ins equ byte[edi+194] ;० ࠡ ( ) +ted_mode_color equ byte[edi+195] ;० 뤥 ᫮ 梥⮬ (0-몫. 1-.) +ted_mode_invis equ byte[edi+196] ;० ⠥ ᨬ +ted_gp_opt equ byte[edi+197] ;樨 頥 㭪樥 ted_get_pos_by_cursor +ted_fun_on_key_ctrl_o equ dword[edi+198] ;㪠⥫ 㭪 뢠 ⨨ Ctrl+O (⨥ 䠩) +ted_fun_on_key_ctrl_f equ dword[edi+202] ;... Ctrl+F (맮/ ᪠) +ted_fun_on_key_ctrl_n equ dword[edi+206] ;... Ctrl+N (ᮧ 㬥) +ted_fun_on_key_ctrl_s equ dword[edi+210] ;... Ctrl+S +ted_buffer_size equ dword[edi+214] ;ࠧ ஢/⠢ +ted_fun_find_err equ dword[edi+218] ;㪠⥫ 㭪 뢠 ᫨ 稫 㤠筮 +ted_fun_init_synt_err equ dword[edi+222] ;㪠⥫ 㭪 뢠 訡筮 ⨨ 䠩 ᨭ⠪ +ted_fun_draw_panel_buttons equ dword[edi+226] ;㪠⥫ 㭪 ᮢ +ted_fun_draw_panel_find equ dword[edi+230] ;㪠⥫ 㭪 ᮢ ᪠ +ted_fun_draw_panel_syntax equ dword[edi+234] ;㪠⥫ 㭪 ᮢ ᨭ⠪ +ted_fun_save_err equ dword[edi+238] ;㪠⥫ 㭪 뢠 ᫨ ࠭ 䠩 稫 㤠筮 +;------------------------------------------------------------------------------ +ted_opt_ed_move_cursor equ 1 ; ᫥ ⥪ +ted_opt_ed_change_time equ 2 ; ।஢ ⥪ +ted_offs_sel equ 34 ;ᬥ饭 sel +ted_offs_seln equ 50 ;ᬥ饭 seln +ted_offs_count_colors equ 90 ;ᬥ饭 ६ ⢠ 梥⮢ +ted_offs_key_new equ 172 +ted_offs_symbol_new_line equ 173 ;ᬥ饭 ᨬ ப +;------------------------------------------------------------------------------ + + + +; *** scroll bar constant *** +sb_offs_size_x equ 0 +sb_offs_start_x equ 2 +sb_offs_size_y equ 4 +sb_offs_start_y equ 6 +sb_offs_max_area equ 16 +sb_offs_cur_area equ 20 +sb_offs_position equ 24 +sb_offs_redraw equ 40 +sb_offs_delta2 equ 46 +sb_offs_all_redraw equ 80 +;------------------------------------------------------------------------------ \ No newline at end of file diff --git a/programs/develop/libraries/box_lib/trunk/doc/box_lib.htm b/programs/develop/libraries/box_lib/trunk/doc/box_lib.htm index 2b79e93ee1..9140a70c1a 100644 --- a/programs/develop/libraries/box_lib/trunk/doc/box_lib.htm +++ b/programs/develop/libraries/box_lib/trunk/doc/box_lib.htm @@ -24,7 +24,9 @@
  • d_button
  • menubar
  • filebrowser
  • -
  • tree_list
  • +
  • filepath
  • +
  • tree_list
  • +
  • text_editor
  • @@ -36,6 +38,6 @@

    aka IgorA


    -

    05.02.10.

    +

    29.04.10.

    \ No newline at end of file diff --git a/programs/develop/libraries/box_lib/trunk/doc/style.css b/programs/develop/libraries/box_lib/trunk/doc/style.css index 83ea644faf..c0e81eda41 100644 --- a/programs/develop/libraries/box_lib/trunk/doc/style.css +++ b/programs/develop/libraries/box_lib/trunk/doc/style.css @@ -36,16 +36,6 @@ pre{ color: #004000; background: #ffd0ff; } -pre font.f0 { color: #ffff00; } -pre font.f1 { color: #ffffff; } -pre font.f2 { color: #00ff00; } -pre font.f3 { color: #00ffff; } -pre font.f4 { color: #808080; } -pre font.f5 { color: #ff40ff; } -pre font.f6 { color: #4080ff; } -pre font.f7 { color: #ff0000; } -pre font.f8 { color: #ffcc00; } -pre font.f9 { color: #00ccff; } caption { @@ -57,15 +47,12 @@ caption } table { - font-size: 10px; border-collapse: collapse; border: #000000 1px solid; - background-color: #c0e7fb; } table td { border: none; - text-align: center; } table th { diff --git a/programs/develop/libraries/box_lib/trunk/doc/t_edit/t_edit.htm b/programs/develop/libraries/box_lib/trunk/doc/t_edit/t_edit.htm new file mode 100644 index 0000000000..c71adc0b62 --- /dev/null +++ b/programs/develop/libraries/box_lib/trunk/doc/t_edit/t_edit.htm @@ -0,0 +1,138 @@ + + + Text Editor + + + + + +

    +

    + +

    +

    + + +

    +

    text_editor , .

    +

    +

    , text_editor.

    + +

    + + +

    + + +

    +

    ( ), + , .

    + +

    :

    +
    struct symbol
    +  c db ?	;  +0 
    +  col db ?	;  +1 
    +  perv dd ? ;  +2
    +  next dd ? ;  +6 
    +  tc dd ?	; +10 . 
    +  td dd ?	; +14 . 
    +ends
    +

    'c'. + 'perv' 'next' . + ( ).

    +

    'tc' - , "" + , ( "" ).

    +

    'td' - , , + , .

    +

    'col' - .

    + +

    +

    :

    + +

    ted_but_copy

    + +

    Ctrl+C.

    +

    :

    +
    stdcall [ted_but_copy], tedit0
    + +

    ted_but_cut

    +

    ted_but_find_next

    +

    ted_but_paste

    +

    ted_but_redo

    +

    ted_but_reverse

    +

    ted_but_save_file

    +

    ted_but_select_word

    +

    ted_but_sumb_lover

    +

    ted_but_sumb_upper

    +

    ted_but_undo

    +

    ted_can_save

    +

    ted_clear

    +

    ted_delete

    +

    ted_draw

    +

    ted_init

    +

    ted_init_syntax_file

    +

    ted_is_select

    +

    ted_key

    +

    ted_mouse

    +

    ted_open_file

    +

    ted_text_add

    +

    ted_text_colored

    + +

    :

    +

    ted_get_text_perv_pos - ( 'perv')

    +

    ted_get_text_next_pos - ( 'next')

    +

    ted_symbol_not_vis - ( + 'tc' 'td')

    +

    ted_iterat_next - . + ted_get_text_next_pos ted_symbol_not_vis.

    +

    ted_iterat_perv - .

    + +

    ted_iterat_next_pos_char - (edx-. + , bl-> )

    +

    ted_get_pos_by_coords - (esi->. x, ; + ecx->. y, )

    +

    ted_go_to_pos - , + , (ecx->. x, ; edx->. y, )

    + + +

    *.syn

    + + + + + + + + + + + + + + + + +
    ()
    4
    4
    4*6
    4*(. . )
    sizeof(TexColViv)*(. )
    , ( 0)
    1 
    ( 0- )
    (   + 1)
    +

    .

    + + +
    +

    29.04.10.

    + + + \ No newline at end of file diff --git a/programs/develop/libraries/box_lib/trunk/t_edit.mac b/programs/develop/libraries/box_lib/trunk/t_edit.mac new file mode 100644 index 0000000000..c1f82f77bb --- /dev/null +++ b/programs/develop/libraries/box_lib/trunk/t_edit.mac @@ -0,0 +1,3867 @@ +; ⥬ ⥪ box_lib.obj +; TextEditor Kolibri OS +; 䠩 ᫥ ࠧ 29.04.2010 IgorA +; ਬ GPL2 業 + +;input: +; edi = pointer to tedit struct +; reg = index +;output: +; reg = pointer to 'tex' struct +macro ConvertIndexToPointer reg { + imul reg,sizeof.symbol + add reg,ted_tex +} + +;--- out_reg = ted_key_words_data[ind_reg].Text[0] --- +macro ColToIndexOffset ind_reg,out_reg { + mov out_reg,ind_reg + imul out_reg,sizeof.TexColViv + add out_reg,ted_key_words_data +} + +macro use_text_edit +{ +TED_PANEL_NULL equ 0 ; ⮩ +TED_PANEL_FIND equ 1 ; ᪠ +TED_PANEL_SYNTAX equ 2 ; 롮 䠩 ᢥ⪨ +TED_PANEL_WIDTH equ 150 ;ਭ + +MAX_COLOR_WORD_LEN equ 40 +;------------------------------------------------------------------------------ +struct TexSelect + x0 dd ? + y0 dd ? + x1 dd ? + y1 dd ? +ends + +struct TexColViv + Text rb MAX_COLOR_WORD_LEN ; ᫮ ᢥ⪨ + f1 dd 0 ; ࠢ ᫮ + wwo db ? ; whole words only + endc db ? ; ᨬ 뤥 (wwo&4) + color db ? ; 梥 +ends + +struct symbol + c db ? ; +0 ᨬ + col db ? ; +1 梥 + perv dd ? ; +2 + next dd ? ; +6 㪠⥫ + tc dd ? ; +10 ६. ᮧ + td dd ? ; +14 ६. 㤠 +ends +;------------------------------------------------------------------------------ + +if lang eq ru + +txtFindCapt db '',0 +txtFindNext db ' ',0 +txtFormatCapt db 'ଠ',0 +txtFormatApply db 'ਬ',0 +txtRow db 'ப',0 +txtCol db '',0 +txtOtm db '⬥',0 +txtBuf db ':',0 + +else + +txtFindCapt db 'Search',0 +txtFindNext db 'Find next',0 +txtFormatCapt db 'Format',0 +txtFormatApply db 'Apply',0 +txtRow db 'Rows',0 +txtCol db 'Cols',0 +txtOtm db 'Undo',0 +txtBuf db 'Buffer:',0 + +end if + +;------ +align 4 +EvChar db 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + +EvUpper db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79 + db 80,81,82,83,84,85,86,87,88,89,90,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +EvLover db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111 + db 112,113,114,115,116,117,118,119,120,121,122,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +conv_table dd 0 + + +KM_SHIFT equ 0x00010000 +KM_CTRL equ 0x00020000 +KM_ALT equ 0x00040000 +KM_NUMLOCK equ 0x00080000 + +; KEY CODES +KEY_F1 equ 0x0000003B +KEY_F2 equ 0x0000003C +KEY_F3 equ 0x0000003D + + + +align 4 +proc ted_init, edit:dword + push eax ecx edi + mov edi,dword[edit] + + mov ecx,sizeof.symbol + imul ecx,ted_max_chars + call mem_Alloc ;뤥塞 + mov ted_tex,eax + mov ted_tex_1,eax + add ted_tex_1,sizeof.symbol + add eax,ecx + mov ted_tex_end,eax + + stdcall ted_clear, edi,1 + +;------------------------------------------------- + mov ecx,1024 ;1024 - ᨢ ted_arr_key_pos + add ecx,ted_syntax_file_size + call mem_Alloc + mov ted_arr_key_pos,eax + add eax,1024 + mov ted_syntax_file,eax + + pop edi ecx eax + ret +endp + +align 4 +proc ted_delete, edit:dword + push ecx edi + mov edi,dword[edit] + + mov ecx,ted_tex + call mem_Free + mov ecx,ted_arr_key_pos ;ted_syntax_file + call mem_Free + + pop edi ecx + ret +endp + + +;input: +; eax = key kodes +align 4 +proc ted_key, edit:dword, table:dword, control:dword + pushad + mov edi,dword[edit] + mov esi,dword[control] + + cmp ah,KEY_F1 ;[F1] + jne @f + stdcall ted_show_help_f1,edi + jmp .end_key_fun + @@: + cmp ah,KEY_F3 ;[F3] + jne @f + stdcall ted_but_find_next,edi + jmp .end_key_fun + @@: + + test esi,KM_CTRL ;Ctrl+... + jz .key_Ctrl + cmp ah,24 ;Ctrl+O + jne @f + cmp ted_fun_on_key_ctrl_o,0 + je @f + call ted_fun_on_key_ctrl_o + @@: + cmp ah,33 ;Ctrl+F + jne @f + cmp ted_panel_id,TED_PANEL_FIND + je @f + cmp ted_fun_on_key_ctrl_f,0 + je @f + call ted_fun_on_key_ctrl_f + @@: + cmp ah,44 ;Ctrl+Z + jne @f + stdcall ted_but_undo,edi + @@: + cmp ah,46 ;Ctrl+C + jne @f + stdcall ted_but_copy,edi + @@: + cmp ah,47 ;Ctrl+V + jne @f + stdcall ted_but_paste,edi + @@: + cmp ah,49 ;Ctrl+N + jne @f + cmp ted_fun_on_key_ctrl_n,0 + je @f + call ted_fun_on_key_ctrl_n + @@: + cmp ah,199 ;Ctrl+Home + jne @f + call ted_key_ctrl_home + @@: + jmp .end_key_fun + .key_Ctrl: + + test esi,KM_SHIFT ;Shift+... + jz .key_Shift + cmp ah,72 ;Shift+Up + jne @f + call ted_sel_key_up + @@: + cmp ah,75 ;Shift+Left + jne @f + call ted_sel_key_left + @@: + cmp ah,77 ;Shift+Right + jne @f + call ted_sel_key_right + @@: + cmp ah,80 ;Shift+Down + jne @f + call ted_sel_key_down + @@: + ;mov ted_drag_k,1 ;稭 뤥 + jmp .key_MoveCur + .key_Shift: +;------------------------------------------------- + cmp ah,72 ;178 ;Up + jne @f + call ted_draw_cursor_sumb + call ted_cur_move_up + cmp dl,8 + jne .no_red_0 + call ted_scroll_set_redraw + stdcall ted_draw,edi + jmp @f + .no_red_0: + call ted_draw_main_cursor + mov ted_drag_k,0 ;稢 뤥 + @@: + cmp ah,80 ;177 ;Down + jne @f + call ted_draw_cursor_sumb + call ted_cur_move_down + cmp dl,8 + jne .no_red_1 + call ted_scroll_set_redraw + stdcall ted_draw,edi + jmp @f + .no_red_1: + call ted_draw_main_cursor + mov ted_drag_k,0 ;稢 뤥 + @@: + cmp ah,75 ;176 ;Left + jne @f + call ted_draw_cursor_sumb + call ted_cur_move_left + cmp dl,8 + jne .no_red_2 + call ted_scroll_set_redraw + stdcall ted_draw,edi + jmp @f + .no_red_2: + call ted_draw_main_cursor + mov ted_drag_k,0 ;稢 뤥 + @@: + cmp ah,77 ;179 ;Right + jne @f + call ted_draw_cursor_sumb + call ted_cur_move_right + cmp dl,8 + jne .no_red_3 + call ted_scroll_set_redraw + stdcall ted_draw,edi + jmp @f + .no_red_3: + call ted_draw_main_cursor + mov ted_drag_k,0 ;稢 뤥 + @@: + cmp ah,71 ;180 ;Home + jne @f + call ted_draw_cursor_sumb + call ted_cur_move_x_first_char + cmp dl,8 + jne .no_red_4 + call ted_scroll_set_redraw + stdcall ted_draw,edi + jmp @f + .no_red_4: + call ted_draw_main_cursor + mov ted_drag_k,0 ;稢 뤥 + @@: + cmp ah,79 ;181 ;End + jne @f + call ted_draw_cursor_sumb + call ted_cur_move_x_last_char + cmp dl,8 + jne .no_red_5 + call ted_scroll_set_redraw + stdcall ted_draw,edi + jmp @f + .no_red_5: + call ted_draw_main_cursor + mov ted_drag_k,0 ;稢 뤥 + @@: + cmp ah,73 ;184 ;PageUp + jne @f + call ted_cur_move_page_up + cmp dl,0 + je @f + call ted_scroll_set_redraw + stdcall ted_draw,edi + @@: + cmp ah,81 ;183 ;PageDown + jne @f + call ted_cur_move_page_down + cmp dl,0 + je @f + call ted_scroll_set_redraw + stdcall ted_draw,edi + mov ted_drag_k,0 ;稢 뤥 + @@: +;------------------------------------------------- +; cmp esi,0 +; jne .end_key_fun + .key_MoveCur: + + cmp ah,69 ;[Pause Break] + je .end_key_fun + cmp ah,120 ;[Fn] + je .end_key_fun + cmp ah,0x80 ;if key up + ja .end_key_fun + + cmp dword[table],0 + je @f + stdcall KeyConvertToASCII, dword[table] + @@: + + ;mov ted_drag_k,0 ;稢 뤥 + + lea edx,[EvChar] ;६ ⠡ ⨬묨 ᨬ + add dl,ah + jae @f + add edx,0x100 ;᫨ 뫮 ९ ᨬ + @@: + cmp byte [edx],1 + jne @f + mov ted_key_new,ah + call ted_set_undo + mov edx,ted_opt_ed_change_time+ted_opt_ed_move_cursor + stdcall ted_sel_text_del,edx + cmp al,1 + jne .del + mov edx,ted_opt_ed_move_cursor + .del: + cmp ted_cur_ins,1 + je .no_ins_mod + stdcall ted_text_del,edi,ted_opt_ed_change_time + mov edx,ted_opt_ed_move_cursor + .no_ins_mod: + mov ecx,edi + add ecx,ted_offs_key_new + stdcall ted_text_add,edi,ecx,1,edx ;塞 ᨬ + cmp ted_key_new,13 + jne .dr_m_win + stdcall ted_draw,edi + jmp .dr_cur_l + .dr_m_win: + stdcall ted_draw_cur_line,edi + .dr_cur_l: + cmp ted_fun_draw_panel_buttons,0 + je @f + call ted_fun_draw_panel_buttons + @@: + + cmp ah,8 ;[<-] + jne @f + call ted_set_undo + stdcall ted_sel_text_del,ted_opt_ed_change_time + cmp al,1 + je .del_one_b + stdcall ted_text_del,edi,ted_opt_ed_change_time+ted_opt_ed_move_cursor + .del_one_b: + stdcall ted_draw,edi + cmp ted_fun_draw_panel_buttons,0 + je .end_key_fun + call ted_fun_draw_panel_buttons + jmp .end_key_fun + @@: + + cmp ah,182 ;Delete + jne @f + call ted_set_undo + stdcall ted_sel_text_del,ted_opt_ed_change_time + cmp al,1 + je .del_one_d + stdcall ted_text_del,edi,ted_opt_ed_change_time + .del_one_d: + stdcall ted_draw,edi + cmp ted_fun_draw_panel_buttons,0 + je .end_key_fun + call ted_fun_draw_panel_buttons + jmp .end_key_fun + @@: + + cmp ah,185 ;Ins + jne @f + call ted_draw_cursor_sumb + xor ted_cur_ins,1 + call ted_draw_main_cursor + @@: + + .end_key_fun: + popad + ret +endp + +;output: +; al = 1 - can save +align 4 +proc ted_can_save, edit:dword + push ecx edi + mov edi,dword[edit] + + mov ecx,ted_tim_ch + sub ecx,ted_tim_undo + mov al,1 + cmp ted_tim_ls,ecx + jne @f + dec al + @@: + pop edi ecx + ret +endp + +;input: +; edi = pointer to tedit struct +;output: +; al = 1 - selected +align 4 +proc ted_is_select + push ebx + xor al,al + cmp ted_drag_m,1 + je @f + mov al,1 + mov ebx,ted_sel_x0 + cmp ebx,ted_sel_x1 + jne @f + mov ebx,ted_sel_y0 + cmp ebx,ted_sel_y1 + jne @f + xor al,al + @@: + pop ebx + ret +endp + +;input: +; edi = pointer to tedit struct +align 4 +proc ted_sel_normalize + push ecx esi + push edi + mov esi,edi + add esi,ted_offs_sel + add edi,ted_offs_seln + mov ecx,sizeof.TexSelect + rep movsb + pop edi + + jmp @f + .swp_f: + mov ecx,ted_seln_x0 + m2m ted_seln_x0,ted_seln_x1 + mov ted_seln_x1,ecx + + mov ecx,ted_seln_y0 + cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1) + jle .end_f + m2m ted_seln_y0,ted_seln_y1 + mov ted_seln_y1,ecx + + jmp .end_f + @@: + + mov ecx,ted_seln_y0 + cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1) + jg .swp_f + + cmp ecx,ted_seln_y1 ;(sel_y0==sel_y1) + jne .end_f + mov ecx,ted_seln_x0 + cmp ecx,ted_seln_x1 ;(sel_x0>sel_x1) + jg .swp_f + + .end_f: + pop esi ecx + ret +endp + +;input: +; edi = pointer to tedit struct +;description: +; 㭪 뢠 砫 뤥 +align 4 +proc ted_sel_start + push eax ecx + mov eax,ted_scr_h + mov ecx,ted_cur_x + add ecx,dword[eax+sb_offs_position] + mov ted_sel_x0,ecx + mov ted_sel_x1,ecx + + mov eax,ted_scr_w + mov ecx,ted_cur_y + add ecx,dword[eax+sb_offs_position] + mov ted_sel_y0,ecx + mov ted_sel_y1,ecx + pop ecx eax + ret +endp + +;input: +; edi = pointer to tedit struct +;description: +; 㭪 뢠 ६饭 뤥 +align 4 +proc ted_sel_move + push eax ecx + mov ecx,ted_cur_x + mov eax,ted_scr_h + add ecx,dword[eax+sb_offs_position] + mov ted_sel_x1,ecx + + mov eax,ted_scr_w + mov ecx,ted_cur_y + add ecx,dword[eax+sb_offs_position] + mov ted_sel_y1,ecx + pop ecx eax + cmp ted_fun_draw_panel_buttons,0 ;redraw toolbar (need to button Copy) + je @f + call ted_fun_draw_panel_buttons + @@: + ret +endp + +;input: +; cl_al_mem = 1 - clear all memory +align 4 +proc ted_clear, edit:dword, cl_al_mem:dword + push ecx edi + mov edi,dword[edit] + + mov ted_cur_x,0 + mov ted_cur_y,0 + mov ted_tim_ch,0 + mov ted_tim_ls,0 + mov ted_tim_co,0 + mov ted_tim_undo,0 + mov ted_help_id,-1 + + mov ecx,ted_scr_w + mov dword[ecx+sb_offs_position],0 + mov dword[ecx+sb_offs_max_area],100 + mov dword[ecx+sb_offs_redraw],1 + mov ecx,ted_scr_h + mov dword[ecx+sb_offs_position],0 + mov dword[ecx+sb_offs_max_area],100 + + mov ted_sel_x0,0 + mov ted_sel_y0,0 + mov ted_sel_x1,0 + mov ted_sel_y1,0 + + cmp dword[cl_al_mem],0 + je .exit + + push edx + mov ecx,sizeof.symbol + imul ecx,ted_max_chars + mov edx,ted_tex + @@: + mov byte [edx],0 + inc edx + loop @b + mov edx,ted_tex + mov dword [edx+6],1 + pop edx + + .exit: + pop edi ecx + ret +endp + + +align 4 +proc ted_init_syntax_file, edit:dword, file:dword, f_name:dword + pushad + mov edi,dword[edit] + + mov eax,70 + mov ebx,dword[file] + mov dword[ebx], 0 + mov dword[ebx+4], 0 + mov dword[ebx+8], 0 + mov ecx,ted_syntax_file_size + mov dword[ebx+12], ecx + m2m dword[ebx+16], ted_syntax_file + mov byte[ebx+20], 0 + m2m dword[ebx+21], dword[f_name] + int 0x40 + + mov ecx,0x100 + mov edx,ted_arr_key_pos + @@: + mov dword[edx],-1 + add edx,4 + loop @b + + ;init: ted_colors_text_count, ted_key_words_count, ... + mov ted_colors_text_count,1 + mov ted_key_words_count,0 + mov ted_help_text_f1,0 + mov ted_help_id,-1 ;䨪 ᫮ ࠢ + + cmp eax,6 + je @f + cmp eax,0 + je @f + cmp ax,10 + jl .zifra_0_9 + mov al,'?' + sub ax,48 + .zifra_0_9: + add ax,48 + cmp ted_fun_init_synt_err,0 + je .no_colors + call ted_fun_init_synt_err + jmp .no_colors + @@: + + mov eax,edi ;࠭塞 祭 edi + mov esi,ted_syntax_file + add edi,ted_offs_count_colors + mov ecx,9*4 + rep movsb + mov edi,eax ;⠭ 祭 edi + + mov eax,ted_syntax_file + add eax,32 + mov ted_text_colors,eax + + mov eax,ted_colors_text_count ;init: count_colors_text (offset to key words) + add eax,8 + shl eax,2 + add eax,ted_syntax_file + mov ted_key_words_data,eax + + mov ecx,ted_key_words_count ;init: ted_arr_key_pos (first key positions) + xor eax,eax + @@: + ColToIndexOffset eax,edx + xor ebx,ebx + mov bl,byte[edx] + shl bx,2 + mov esi,ted_arr_key_pos + add esi,ebx + cmp dword[esi],-1 + jne .no_ch_key + mov dword[esi],eax + .no_ch_key: + inc eax + loop @b + + ;init: ted_help_text_f1 + mov ecx,ted_key_words_count + imul ecx,sizeof.TexColViv + add ecx,ted_key_words_data + mov ted_help_text_f1,ecx + + .no_colors: + popad + ret +endp + +;input: +; ebx = file size +; edi = pointer to tedit struct +;description: +; 㭪 뢠 ⨨ 䠩 +align 4 +proc ted_on_open_file + push eax ;destination + push ecx ;for cycle + push edx ;source + push esi + + stdcall ted_clear,edi,0 ;⨬ , ⮬ 㤥 묨 묨 + mov eax,ebx + mov ecx,ebx + add eax,2 + ConvertIndexToPointer eax + mov edx,ted_tex + add edx,ebx + push ebx + @@: + mov ebx,[edx] + mov byte [eax],bl + mov dword [eax+2],ecx + inc dword [eax+2] + mov dword [eax+6],ecx + add dword [eax+6],3 + ;mov byte[eax+1],0 ;col=0 + mov dword [eax+10],-1 ;tc=-1 + mov dword [eax+14],0 ;td=0 + + cmp ecx,0 + je @f + dec ecx + dec edx + sub eax,sizeof.symbol + jmp @b + @@: + pop ebx + add eax,2 + mov dword [eax],0 ; first sumbol 'perv=0' + + mov edx,ted_tex + ; begining sumbol 'perv=0' 'next=2' + mov dword [edx+2],0 + mov dword [edx+6],2 + + add edx,sizeof.symbol + mov dword [edx+6],0 ; last sumbol 'next=0' + mov dword [edx+2],ebx ; last sumbol 'perv=last' + inc dword [edx+2] + + mov edx,ebx + inc edx ;2 = rezerv sumbols + imul edx,sizeof.symbol + add edx,ted_tex + mov dword [edx+6],1 ; last sumbol 'next=1' + + @@: ;clear memory, need if before was open big file + add edx,sizeof.symbol + cmp edx,ted_tex_end + jge @f + mov dword[edx+10],0 + mov dword[edx+14],0 + jmp @b + @@: + + call ted_get_num_lines + cmp eax,100 + jge @f + mov eax,100 + @@: + mov esi,ted_scr_w + mov dword[esi+sb_offs_max_area],eax + pop esi edx ecx eax + + call ted_text_colored + stdcall ted_draw,edi + cmp ted_fun_draw_panel_buttons,0 + je @f + call ted_fun_draw_panel_buttons + @@: + ret +endp + +;input: +; edx = pointer to symbol struct +; edi = pointer to tedit struct +;output: +; edx = pointer to 'perv' visible symbol struct +align 4 +ted_iterat_perv: + cmp ted_tim_undo,0 + je .else + push ebx + @@: + call ted_get_text_perv_pos + cmp edx,ted_tex + je @f + call ted_symbol_not_vis + cmp bl,1 + je @b + cmp byte[edx],10 ;ய ᨬ 10 + je @b + @@: + pop ebx + ret + .else: + call ted_get_text_perv_pos + cmp edx,ted_tex + je .endif + cmp dword [edx+14],0 + jne .else + cmp byte[edx],10 ;ய ᨬ 10 + je .else + .endif: + ret + + +;input: +; edx = pointer to symbol struct +; edi = pointer to tedit struct +;output: +; edx = pointer to 'next' visible symbol struct +align 4 +ted_iterat_next: + cmp ted_tim_undo,0 + je .else + push ebx + @@: + call ted_get_text_next_pos + cmp edx,ted_tex_1 + jle @f + call ted_symbol_not_vis + cmp bl,1 + je @b + cmp byte[edx],10 ;ய ᨬ 10 + je @b + @@: + pop ebx + ret + .else: + call ted_get_text_next_pos + cmp edx,ted_tex_1 + jle .endif + cmp dword [edx+14],0 + jne .else + cmp byte[edx],10 ;ய ᨬ 10 + je .else + .endif: + ret + +;input: +; bl = symbol end of select +; edx = pointer to symbol struct +; edi = pointer to tedit struct +;description: +; ᫥ 㪠 ᨬ +align 4 +ted_iterat_next_pos_char: + @@: + cmp bl,byte[edx] + je @f + cmp edx,ted_tex_1 + jle @f + call ted_iterat_next + jmp @b + @@: + call ted_iterat_next + ret + +;input: +; edx = pointer to symbol struct +; edi = pointer to tedit struct +align 4 +ted_iterat_perv_color_tag: + @@: + cmp byte[edx+1],0 + jne @f + call ted_iterat_perv + cmp edx,ted_tex_1 + jle @f + jmp @b + @@: + ret + +;input: +; edx = pointer to symbol struct +; edi = pointer to tedit struct +align 4 +ted_iterat_next_color_tag: + @@: + call ted_iterat_next + cmp byte[edx+1],0 + jne @f + cmp edx,ted_tex_1 + jle @f + jmp @b + @@: + ;call ted_iterat_next + ret + +;input: +; edx = pointer to symbol struct +; edi = pointer to tedit struct +;output: +; bl = 1 if sumbol not visible +; (tex[i].td+ted_tim_undo<=ted_tim_ch && tex[i].td) || (tex[i].tc>ted_tim_ch-ted_tim_undo) +align 4 +ted_symbol_not_vis: + push eax + + xor bl,bl + + cmp dword [edx+14],0 + je @f + mov eax,[edx+14] ;eax=tex[i].td + add eax,ted_tim_undo + cmp eax,ted_tim_ch + jg @f + mov bl,1 + pop eax + ret + @@: + + mov eax,ted_tim_ch + sub eax,ted_tim_undo + cmp [edx+10],eax + jle @f + or bl,1 + @@: + + pop eax + ret + +;input: +; text:dword - pointer to text string +; add_opt:dword - options +align 4 +proc ted_text_add, edit:dword, text:dword, t_len:dword, add_opt:dword + locals + new_spc dd ? ;count new spaces + new_lin dd ? ;count new lines + endl +;ᯮ짮 ॣ஢ 㭪樨: +;eax - ⠢ ⥪ +;ebx - ६ 㦤, ⠢塞 ⥪ +;ecx - ६ 㦤 +;edx - 㪠⥫ ᨬ + pushad + mov edi,dword[edit] + mov esi,dword[text] + + call ted_get_pos_by_cursor + call ted_get_text_perv_pos + call ted_get_text_arr_index ;eax=po_t + + mov dword[new_spc],0 + cmp ted_gp_opt,2 + je @f + push eax ;c_sp=cur[cn].x+Scroller->XPos-StrLen(cur[cn].y+Scroller->YPos); + mov eax,ted_scr_h + mov eax,dword[eax+sb_offs_position] + add eax,ted_cur_x ;eax - ᨬ + mov dword[new_spc],eax + + mov eax,ted_scr_w + mov eax,dword[eax+sb_offs_position] + add eax,ted_cur_y ;eax - ப + call ted_strlen ;ebx = line len + sub dword[new_spc],ebx ; 樨 ⭨ ப, 㧭 ⢮ 塞 ஡ + pop eax + @@: + + mov ebx,dword[t_len] + + mov dword[new_lin],0 + cmp ted_gp_opt,0 + jne @f + push eax + mov eax,ted_scr_w + mov eax,dword[eax+sb_offs_position] + add eax,ted_cur_y + inc eax + mov dword[new_lin],eax + + call ted_get_num_lines + sub dword[new_lin],eax + pop eax + @@: + + mov edx,sizeof.symbol + shl edx,1 + add edx,ted_tex + @@: ;for(i=2;i ted_cur_x + mov ted_gp_opt,1 + cmp eax,ecx + jge @f ; Row >= ted_cur_y + .u1_0: + mov ted_gp_opt,0 + inc ebx + cmp byte [edx],13 + jne @b + cmp eax,ecx + jge @f ; Row >= ted_cur_y + inc eax + xor ebx,ebx + jmp @b + @@: + cmp eax,ecx + jne @f ; Row = ted_cur_y + inc ted_gp_opt + @@: + cmp ted_gp_opt,0 + jne @f + mov edx,ted_tex_1 + ;call ted_get_text_perv_pos + @@: + pop ebx eax + ret + + +;input: +; eax = Row +; edi = pointer to tedit struct +;output: +; ebx = str len +align 4 +ted_strlen: + push edx ecx + ;ecx = Row, from cycle + + xor ebx,ebx + xor ecx,ecx + mov edx,ted_tex + @@: + call ted_iterat_next + cmp edx,ted_tex_1 + jle @f + inc ebx + cmp byte [edx],13 + jne @b + dec ebx ;lenght minus 1 sumbol to paragraph + cmp eax,ecx + je @f + xor ebx,ebx + inc ecx + jmp @b + @@: + + cmp eax,ecx + je @f + xor ebx,ebx + @@: + + pop ecx edx + ret + + +;input: +; edx = symbol position +; edi = pointer to tedit struct +;output: +; eax = number of line +; ebx = symbol position in line +align 4 +ted_get_text_coords: + push edx + xor eax,eax + xor ebx,ebx + @@: + call ted_iterat_perv + + cmp eax,0 + jne .no_col_mov + inc ebx + .no_col_mov: + + cmp edx,ted_tex_1 + jle @f + cmp byte [edx],13 + jne @b + inc eax + jmp @b + @@: + dec ebx + pop edx + ret + +;input: +; edi = pointer to tedit struct +;output: +; eax = num lines +align 4 +ted_get_num_lines: + push edx + mov eax,1 + mov edx,ted_tex + @@: + call ted_iterat_next + cmp edx,ted_tex_1 + jle @f + cmp byte [edx],13 + jne @b + inc eax + jmp @b + @@: +;... +;dec eax + pop edx + ret + + +;input: +; edi = pointer to tedit struct +;description: +; ⬥ ⬥ ⢨, । 㬥 +align 4 +proc ted_set_undo + mov ted_drag_k,0 ;稢 뤥 + cmp ted_tim_undo,1 + jl .no_work + + push eax ebx edx + mov edx,ted_tex + call ted_get_text_next_pos ;long i=tex[0].next; + mov eax,ted_tim_undo + sub ted_tim_ch,eax ;ted_tim_ch-=ted_tim_undo; + mov eax,ted_tim_ch + cmp ted_tim_ls,eax ;if(ted_tim_ls>ted_tim_ch) + jle @f + mov ted_tim_ls,0 + @@: + cmp edx,ted_tex + je @f + + ;if(tex[i].tc>ted_tim_ch){ // ᫨ ᮧ ᨬ 뫮 ⬥ + cmp [edx+10],eax + jle .no_u1 + mov dword [edx+10],0 + mov dword [edx+14],0 + + mov ebx,[edx+2] + imul ebx,sizeof.symbol + add ebx,ted_tex;.next + m2m dword [ebx+6],dword [edx+6] ;tex[tex[i].perv].next=tex[i].next; + + mov ebx,[edx+6] + imul ebx,sizeof.symbol + add ebx,ted_tex;.perv + m2m dword [ebx+2],dword [edx+2] ;tex[tex[i].next].perv=tex[i].perv; + + .no_u1: + + ;else if(tex[i].td>ted_tim_ch) tex[i].td=0; // ᫨ 㤠 ᨬ 뫮 ⬥ + cmp [edx+14],eax + jle .no_u2 + mov dword [edx+14],0 + .no_u2: + + call ted_get_text_next_pos + jmp @b + @@: + mov ted_tim_undo,0 + mov eax,ted_tim_co + cmp ted_tim_ch,eax + jge @f + mov ted_tim_co,0 + @@: + pop edx ebx eax + .no_work: + ret +endp + +;input: +; ecx = Col +; edx = Row +; edi = pointer to tedit struct +align 4 +ted_go_to_pos: + push eax + mov eax,ted_scr_w + mov ted_cur_x,ecx + sub edx,dword[eax+sb_offs_position] + + cmp edx,dword[eax+sb_offs_cur_area] ;ted_cur_y > [.cur_area] + jl @f + push ebx + mov ebx,edx + sub ebx,dword[eax+sb_offs_cur_area] + inc ebx + add dword[eax+sb_offs_position],ebx + sub edx,ebx + pop ebx + ; ??? redrav + @@: + mov ted_cur_y,edx + pop eax + ret + +;input: +; edi = pointer to tedit struct +align 4 +ted_text_colored: + push eax edx + mov eax,ted_tim_ch + sub eax,ted_tim_undo + mov ted_tim_co,eax + mov edx,ted_tex + @@: + call ted_iterat_next + cmp edx,ted_tex_1 + jle @f + mov byte[edx+1],0 + jmp @b + @@: + + cmp ted_key_words_count,1 + jl .no_colors + mov edx,ted_tex + @@: + call ted_text_find_sel_color + cmp edx,ted_tex_1 + jle .no_colors + jmp @b + .no_colors: + pop edx eax + ret + + +;input: +; edx = pointer to start symbol +; edi = pointer to tedit struct +;output: +; edx = pointer to next symbol +;description: +; 㭪 ᪠ 뤥 ᢥ祭 ᫮ +align 4 +proc ted_text_find_sel_color +locals + begPos dd ? ;砫쭠 + endPos dd ? ;筠 + find db ? ; / + f_color db ? ; 梥 ᫮ +endl + push eax ebx ecx esi +;eax = word_n ⥪騩 () ஢塞 ᫮ ᯨ᪥ +;ebx = ࠧ 楫 +;ecx = l_pos ᫥ () 室饣 ᫮ ᯨ᪥ +;esi = ࠧ 楫, ஢塞 ᨬ ᫮ + mov dword[begPos],1 + mov dword[endPos],1 + mov byte[find],0 + mov byte[f_color],1 + @@: + call ted_iterat_next + cmp edx,ted_tex_1 + jle @f + + xor eax,eax + mov al,byte[edx] + shl ax,2 ;eax*=4 + add eax,ted_arr_key_pos + mov eax,dword[eax] + cmp eax,0 + jl @b ;if( (word_n=ted_arr_key_pos[(unsigned char)tex[i].c])>-1 ){ + + mov ecx,eax + ;while(l_posword_n && Col[l_pos-1].Text[pos]!=tex[i].c) + .wh_3b: + cmp ecx,eax + jle .wh_3e + dec ecx + ColToIndexOffset ecx,ebx + inc ecx + ;cmp byte[ebx+esi],byte[edx] + mov bl,byte[ebx+esi] + cmp bl,byte[edx] + je .wh_3e + dec ecx + jmp .wh_3b + .wh_3e: + + ColToIndexOffset eax,ebx + cmp byte[ebx+esi],0 + jne .if_0 ;if(Col[word_n].Text[pos]==0){ + mov dword[endPos],edx ;eP=i; + ColToIndexOffset eax,ebx + mov bl,byte[ebx+MAX_COLOR_WORD_LEN+6] + mov byte[f_color],bl ;f_color=Col[word_n].color; + +mov byte[find],1 + ColToIndexOffset eax,ebx ;... ebx = Col[word_n] + mov bl,byte[ebx+MAX_COLOR_WORD_LEN+4] + cmp bl,0 ;if(Col[word_n].wwo) + je .if_2n + push edx + mov edx,dword[begPos] + call ted_iterat_perv + + btr bx,0 ;1-1 + jae .if_3e ;if(Col[word_n].wwo&1) + ;u1= !(isalnum(cont_s)||cont_s=='_') + call isalnum + jae .if_3e + mov byte[find],0 + .if_3e: + + btr bx,3 ;4-1 + jae .if_4e ;if(Col[word_n].wwo&8) + ;u1= !isalpha(cont_s); + call isalpha + jae .if_4e + mov byte[find],0 + .if_4e: + + mov edx,dword[endPos] +; call ted_iterat_next + + btr bx,1 ;2-1 + jae .if_5e ;if(Col[word_n].wwo&2) + ;u1= !(isalnum(cont_s)||cont_s=='_') + call isalnum + jae .if_5e + mov byte[find],0 + .if_5e: + + btr bx,4 ;5-1 + jae .if_6e ;if(Col[word_n].wwo&16) + ;u1= !isalpha(cont_s); + call isalpha + jae .if_6e + mov byte[find],0 + .if_6e: + + btr bx,2 ;3-1 + jae .if_7e ;if(Col[word_n].wwo&4) + ColToIndexOffset eax,ebx + mov bl,byte[ebx+MAX_COLOR_WORD_LEN+5] + call ted_iterat_next_pos_char + cmp edx,ted_tex_1 + jle .if_7e + mov dword[endPos],edx + .if_7e: + + pop edx + .if_2n: +; if(i!=1){ // 㬥 +; cont_s=tex[eP].c; +; if(Col[word_n].wwo&2) u2= !(isalnum(cont_s)||cont_s=='_'); // 㪢.-. ᨬ +; if(u2 && Col[word_n].wwo&16) u2= !isalpha(cont_s); // . ᨬ +; if(Col[word_n].wwo&4) eP=ted_iterat_next_pos_char(eP,Col[word_n].endc); + + cmp eax,ecx + je .wh_2e ;if(word_n==l_pos) break; // do double - ᫨ ᫮ 筮 ᫥ + .if_0: + + cmp edx,ted_tex_1 + jle .wh_2e ;if(i==1) break; + + ;while(l_pos>word_n && Col[word_n].Text[pos]!=tex[i].c) + .wh_4b: + cmp ecx,eax + jle .wh_4e + ColToIndexOffset eax,ebx + ;cmp byte[ebx+esi],byte[edx] + mov bl,byte[ebx+esi] + cmp bl,byte[edx] + je .wh_4e + inc eax + jmp .wh_4b + .wh_4e: + + cmp eax,ecx + je .wh_2e;if(word_n==l_pos) break; + inc esi ;pos++; + jmp .wh_2b + .wh_2e: + + cmp byte[find],1 ;if(fnd)break; + je @f + mov edx,dword[begPos];i=bP; + jmp @b + @@: + + cmp byte[find],1 + jne .if_1e ;if(fnd){ // 뤥 ⥪ +; if(!mode_sf1 || (mode_sf1 && strlen(Col[word_n].f1->c_str())>0)){ + mov eax,dword[begPos] + mov bl,byte[f_color] + mov byte[eax+1],bl ;tex[bP].col=f_color; + mov eax,dword[endPos] + mov byte[eax+1],0xff ;tex[eP].col=255; +; return ItPoPerv(eP); // 頥 宦 + mov edx,dword[endPos] + call ted_get_text_perv_pos + jmp @f + .if_1e: + mov edx,ted_tex + @@: + + pop esi ecx ebx eax + ret +endp + +;input: +; edx = pointer to char (byte) +;output: +; cf=1 if symbol is... +align 4 +tab_all_num db 0,0,0,0,0,0,11111111b,11b,11111110b,0xff,0xff,111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0;,0,0,0,0,0,0,0,0 - tab_alpha_0,0,0,0,0,0,0,0 +tab_alpha db 0,0,0,0,0,0,0,0,11111110b,0xff,0xff,111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + +align 4 +isalnum: + push eax ebx + mov al,byte[edx] ;al=offset + shr al,3 + and eax,11111b + lea ebx,[tab_all_num] + add ebx,eax + mov ah,byte[ebx] + mov al,byte[edx] ;al=bit + and ax,111b + mov bx,word[ebx] + btr bx,ax + pop ebx eax + ret +align 4 +isalpha: + push eax ebx + mov al,byte[edx] ;al=offset + shr al,3 + and eax,11111b + lea ebx,[tab_alpha] + add ebx,eax + mov ah,byte[ebx] + mov al,byte[edx] ;al=bit + and ax,111b + mov bx,word[ebx] + btr bx,ax + pop ebx eax + ret + +align 4 +proc ted_show_help_f1, edit:dword + push eax edx edi + mov edi,dword[edit] + + call ted_get_pos_by_cursor + push edx + call ted_iterat_next_color_tag + mov eax,edx + pop edx + call ted_iterat_perv_color_tag + + cmp eax,ted_tex + jle @f + cmp edx,ted_tex_1 + jle @f + stdcall ted_find_help_id,eax + @@: + ;call ted_draw_main_cursor + call ted_draw_help_f1 + pop edi edx eax + ret +endp + +;input: +; edx = position begin 'symbol' struct +; edi = pointer to tedit struct +; end_pos = position end 'symbol' struct +align 4 +proc ted_find_help_id, end_pos:dword +; ecx = word_n +; ebx = l_pos + mov ted_help_id,-1 + + push ebx ecx + xor ebx,ebx + mov bl,byte[edx] + shl bx,2 ;ebx*=4 + add ebx,ted_arr_key_pos + mov ecx,dword[ebx] + cmp ecx,0 + jl .if_0e ;if( (word_n=ted_arr_key_pos[(unsigned char)tf[0]])>-1 ){ + push esi eax + mov ebx,ecx ;l_pos=word_n; + ColToIndexOffset ecx,esi + push cx + mov cl,byte[esi] + @@: + cmp ebx,ted_key_words_count ;while(l_posword_n + jle .wh_0e + dec ebx + ColToIndexOffset ebx,eax + inc ebx + cmp byte[eax+esi],dl ;&& Col[l_pos-1].Text[pos]!=tf[i]) + je .wh_0e + dec ebx ;l_pos--; + jmp .wh_0b + .wh_0e: + + .wh_1b: + cmp ebx,ecx ;while(l_pos>word_n + jle .wh_1e + ColToIndexOffset ecx,eax + cmp byte[eax+esi],dl + je .wh_1e + inc ecx ;word_n++; + jmp .wh_1b + .wh_1e: + pop dx + + cmp ecx,ebx ;if(word_n==l_pos) break; + je @f + call ted_iterat_next ;pos++; + cmp edx,dword[end_pos] ;for(...;i y0,y1 + add ecx,ted_rec_t + mov edx,ted_cur_y + imul edx,ted_rec_h + add ecx,edx + shl ecx,16 + add ecx,ted_rec_h + + mov edx,ted_color_wnd_work + push ecx + call ted_sel_normalize + + mov esi,ted_scr_w + mov ecx,dword[esi+sb_offs_position] + sub ted_seln_y0,ecx + sub ted_seln_y1,ecx + + mov ecx,ted_cur_y + cmp ecx,ted_seln_y0 + jl .no_cur_sel + cmp ecx,ted_seln_y1 + jg .no_cur_sel + mov edx,ted_color_select ;塞 梥 䮭 梥 뤥 + + mov esi,ted_scr_h + cmp ecx,ted_seln_y0 + jne @f + mov ecx,ted_cur_x + add ecx,dword[esi+sb_offs_position] + cmp ecx,ted_seln_x0 + jge @f + mov edx,ted_color_wnd_work + @@: + + mov ecx,ted_cur_y + cmp ecx,ted_seln_y1 + jne .no_cur_sel + mov ecx,ted_cur_x + add ecx,dword[esi+sb_offs_position] + cmp ecx,ted_seln_x1 + jl .no_cur_sel + mov edx,ted_color_wnd_work + + .no_cur_sel: + pop ecx + int 0x40 ;ᮢ אַ㣮쭨 + + call ted_get_pos_by_cursor ;६ ᨬ + cmp ted_gp_opt,2 + jne @f + mov eax,4 + mov esi,1 + ror ecx,16 + mov bx,cx + add ebx,0x10001 + call ted_get_symb_color + call ted_convert_invis_symb + int 0x40 ;ᮢ ᨬ + @@: + + popad + ret +endp + +;input: +; edx -> pointer to text +; edi -> 㪠⥫ tedit +;output: +; ecx = color +; if ted_mode_color=0 then ecx=ted_color_wnd_text +align 4 +ted_get_symb_color: + mov ecx,ted_color_wnd_text ; 梥 ⥪ 㬮砭 + + push eax edx + cmp ted_mode_color,0 + je .exit + jmp .on_first + @@: + call ted_iterat_perv + cmp edx,ted_tex_1 + jle .exit + .on_first: + xor eax,eax + mov al,byte[edx+1] + cmp al,0 ;᫨ al=0 梥 + je @b + + cmp eax,ted_colors_text_count + jge .exit + + shl ax,2 ;㬭 梥 4 + mov ecx,ted_text_colors ;ਡ塞 ᬥ饭 1- 梥 + add ecx,eax + mov ecx,dword[ecx] ;⠭ ⥪騩 梥 ⥪ ᬥ饭 + .exit: + pop edx eax + ret + +;input: +; edx = pointer to text +; edi = pointer to tedit struct +;description: +; 㭪 ८ࠧ ᨬ ⠥ ࠭ +align 4 +ted_convert_invis_symb: + cmp ted_mode_invis,1 + jne @f + cmp byte[edx],13 + jne @f + mov edx,edi + add edx,ted_offs_symbol_new_line + @@: + ret + +;input: +; edi = pointer to tedit struct +align 4 +ted_scroll_set_redraw: + push eax + mov eax,ted_scr_w + mov dword[eax+sb_offs_redraw],1 + mov eax,ted_scr_h + mov dword[eax+sb_offs_redraw],1 + pop eax + ret + +align 4 +proc ted_draw, edit:dword + locals + line_num dd ? + endl + pushad + mov edi,dword[edit] + + mov eax,4 ;draw text + mov ecx,ted_text_colors + mov ecx,dword[ecx] + + mov ebx,ted_wnd_l + add ebx,ted_rec_l + shl ebx,16 + add ebx,ted_wnd_t + add ebx,ted_rec_t + add ebx,0x10001 ;塞 ࠢ 㪢 業 + + call ted_sel_normalize ;need before draw select + mov esi,ted_scr_w + mov esi,dword[esi+sb_offs_position] + mov dword[line_num],esi + + stdcall ted_clear_line_before_draw, edi,ebx,1,esi + call ted_get_first_visible_pos + cmp edx,0 + je .no_draw_text + mov esi,1 ; 뢮 ⥪ 1- ᨬ + @@: + call ted_iterat_next + cmp edx,ted_tex_1 + jle .no_draw_text + + ; *** 梥⮢ ࠧ⪠ + cmp ted_mode_color,0 + je .no_col_change + cmp byte[edx+1],0 + je .no_col_change + call ted_get_symb_color + .no_col_change: + + cmp byte [edx],13 + jne .no_13 + cmp ted_mode_invis,1 + jne .no_invis + push edx + mov edx,edi + add edx,ted_offs_symbol_new_line + int 0x40 + pop edx + .no_invis: + add ebx,ted_rec_h + ;optimized output \/ + mov eax,ted_wnd_h + add eax,ted_wnd_t + cmp bx,ax + jg .no_draw_text + mov eax,4 + ;optimized output /\ + and ebx,0xffff + ror ebx,16 + add ebx,ted_wnd_l + add ebx,ted_rec_l + inc ebx + ror ebx,16 + inc dword[line_num] ;increment line number + stdcall ted_clear_line_before_draw,edi,ebx,1,dword[line_num] + call ted_opt_draw_line_left + jmp @b + .no_13: + + int 0x40 + ror ebx,16 + add ebx,ted_rec_w + mov esi,ted_wnd_l + add esi,ted_wnd_w + cmp bx,si + jl .no_opt + call ted_opt_draw_line_right + .no_opt: + mov si,1 + ror ebx,16 + jmp @b + .no_draw_text: + + stdcall ted_clear_line_before_draw,edi,ebx,0,dword[line_num] + call ted_draw_line_numbers + call ted_draw_main_cursor + +;--------------------------------------------- +; set all_redraw flag for draw all ScrollBar +; In some cases it is necessity to draw only the area +; of moving of a "runner", for acceleration of output - +; in this case the flag needs to be reset to 0 (zero). + mov eax,ted_scr_h + mov esi,ted_scr_w + mov dword[eax+sb_offs_all_redraw],1 + mov dword[esi+sb_offs_all_redraw],1 + +; ᮢ ப⪨ + stdcall scroll_bar_horizontal.draw,eax ;[scrollbar_hor_draw] + stdcall scroll_bar_vertical.draw,esi ;[scrollbar_ver_draw] +; reset all_redraw flag + mov dword[eax+sb_offs_all_redraw],0 + mov dword[esi+sb_offs_all_redraw],0 +;--------------------------------------------- + + ;left-bottom square + mov ebx,ted_wnd_l + shl ebx,16 + add ebx,ted_rec_l + mov ecx,ted_wnd_t + add ecx,ted_wnd_h + shl ecx,16 + mov cx,word[eax+sb_offs_size_y] + inc cx + mov edx,ted_color_wnd_capt ;[sc.work] + mov eax,13 + int 0x40 + + ;right-bottom square + mov ebx,ted_wnd_l + add ebx,ted_wnd_w + shl ebx,16 + mov bx,word[esi+sb_offs_size_x] + inc bx + int 0x40 + + cmp ted_fun_draw_panel_find,0 + je @f + call ted_fun_draw_panel_find + @@: + cmp ted_fun_draw_panel_syntax,0 + je @f + call ted_fun_draw_panel_syntax + @@: + popad + ret +endp + +;input: +; edi = pointer to tedit struct +align 4 +proc ted_draw_main_cursor + pushad + + mov eax,13 ;draw cursor + mov ecx,ted_wnd_t ;calc rect -> y0,y1 + add ecx,ted_rec_t + mov edx,ted_cur_y + imul edx,ted_rec_h + add ecx,edx + + cmp ted_cur_ins,1 ;஢ઠ ० ࠡ ( ⠢) + jne @f + mov edx,ted_rec_h + inc edx ;1->1, 3->2, 5->3, ... + shr edx,1 ;edx = ப 2 ( ) + add ecx,edx + @@: + shl ecx,16 + add ecx,ted_rec_h + cmp ted_cur_ins,1 + jne @f + shr cx,1 ; 2 + @@: + + mov ebx,ted_wnd_l ;calc rect -> x0,x1 + add ebx,ted_rec_l + mov edx,ted_cur_x + imul edx,ted_rec_w + add ebx,edx + shl ebx,16 + add ebx,ted_rec_w + + mov edx,ted_color_cursor + int 0x40 ;뢮 + + call ted_get_pos_by_cursor + cmp ted_gp_opt,2 + jne @f + mov eax,4 ;draw text + mov esi,1 + ror ecx,16 + mov bx,cx + add ebx,0x10001 + cmp ted_cur_ins,1 + jne .no_up_tetx + mov ecx,ted_rec_h + inc cx ; 1->1, 3->2, 5->3, ... + shr cx,1 + sub bx,cx + .no_up_tetx: + mov ecx,ted_color_cur_text + call ted_convert_invis_symb + int 0x40 + @@: + + mov eax,4 + mov ebx,ted_wnd_l + add ebx,ted_rec_l + shl ebx,16 + add ebx,ted_wnd_t + add ebx,3 + mov ecx,ted_color_wnd_bord + or ecx,0x80000000 + lea edx,[txtRow] + int 0x40 ;뢮 'ப' + + add ebx,0x500000 + lea edx,[txtCol] + int 0x40 ;뢮 '' + + cmp ted_tim_undo,0 + je @f + add ebx,0x500000 + lea edx,[txtOtm] + int 0x40 + sub ebx,0x500000 + @@: + + call ted_draw_buffer + call ted_draw_help_f1 + + mov eax,47 ;draw cursor coords + mov esi,ted_color_wnd_bord + or esi,0x40000000 + + mov edx,ebx + ror edx,16 + sub edx,35 + ror edx,16 + ;add edx,3 + mov ebx,0x40000 ;Row=... + mov ecx,ted_scr_w + mov ecx,dword[ecx+sb_offs_position] + add ecx,ted_cur_y + inc ecx + +push edi + mov edi,ted_color_wnd_work + int 0x40 ;뢮 ᫠ ⥪饩 ப +pop edi + + ;mov ebx,0x40000 ;Col=... + mov ecx,ted_scr_h + mov ecx,dword[ecx+sb_offs_position] + add ecx,ted_cur_x + inc ecx + add edx,0x500000 +push edi + mov edi,ted_color_wnd_work + int 0x40 ;뢮 ᫠ +pop edi + + cmp ted_tim_undo,0 + je @f + mov ecx,ted_tim_undo + add edx,0x500000 + int 0x40 + @@: + + popad + ret +endp + +;input: +; edi = pointer to tedit struct +proc ted_draw_buffer + pushad + + mov eax,ted_buffer + cmp byte[eax],0 ;ᬮਬ 1- ᨬ + je @f + mov ebx,ted_wnd_l + add ebx,ted_rec_l + add bx,300 + shl ebx,16 + add ebx,ted_wnd_t + add ebx,3 + mov ecx,ted_color_wnd_bord + or ecx,0x40000000 + + mov edx,ted_buffer + mov esi,edx + mov edi,ted_color_wnd_work ;edi - destroy not pointer to tedit + call tl_strlen + ;cmp eax,0 ; + ;je @f + cmp eax,20 + jle .crop_buf + mov eax,20 ;१ 20 ᨬ + .crop_buf: + mov esi,eax + mov eax,4 + int 0x40 ;뢮 ᮤন + + sub ebx,50 shl 16 + lea edx,[txtBuf] + mov esi,edx + call tl_strlen + mov esi,eax + mov eax,4 + xor ecx,0x40000000 ;㡨ࠥ 梥 䮭 + int 0x40 ;뢮 + @@: + popad + ret +endp + +;input: +; edi = pointer to tedit struct +align 4 +proc ted_draw_help_f1 + pushad + + mov eax,13 ;clear place before draw help + mov ebx,ted_wnd_l + add ebx,ted_rec_l + shl ebx,16 + add ebx,ted_wnd_w + sub ebx,ted_rec_l + mov ecx,ted_wnd_t + add ecx,13 + shl ecx,16 + add ecx,ted_rec_h + mov edx,ted_color_wnd_capt + int 0x40 + + cmp ted_help_id,-1 + je @f + mov eax,ted_help_id + ColToIndexOffset eax,edx + + ;SetCoordinates + mov ebx,ted_wnd_l + add ebx,ted_rec_l + shl ebx,16 + add ebx,ted_wnd_t + add ebx,13 ;=3+10 + + ;SetTextColor + xor eax,eax + mov al,byte[edx+MAX_COLOR_WORD_LEN+6] + shl ax,2 + mov ecx,ted_text_colors + add ecx,eax + mov ecx,dword[ecx] + or ecx,0xc0000000 ;SetTextStyles + mov esi,edi + mov edi,ted_color_wnd_work + mov eax,4 + int 0x40 + mov edi,esi + + ;*** draw help string *** + mov ecx,ted_color_wnd_bord + or ecx,0x80000000 + mov edx,dword[edx+MAX_COLOR_WORD_LEN] + cmp edx,0 + je @f + add edx,ted_help_text_f1 + add ebx,0x500000 + int 0x40 + @@: + popad + ret +endp + +;input: +; edi = pointer to tedit struct +align 4 +proc ted_draw_line_numbers + pushad + + ;top panel with caption + mov ebx,ted_wnd_l +; add ebx,ted_rec_l + shl ebx,16 + add ebx,ted_wnd_w +; sub ebx,ted_rec_l + mov edx,ted_color_wnd_work + mov ecx,ted_wnd_t + shl ecx,16 + add ecx,ted_rec_t + mov eax,13 + mov edx,ted_color_wnd_capt + int 0x40 + + ;line numbers + mov ebx,0x40000 ;format + mov ecx,ted_scr_w + mov ecx,dword[ecx+sb_offs_position] + inc ecx + mov edx,3 + add edx,ted_wnd_l + rol edx,16 + add edx,ted_wnd_t + add edx,ted_rec_t + @@: + +push ebx ecx edx + ;left panel with numbers + mov ebx,ted_wnd_l + shl ebx,16 + add ebx,ted_rec_l + mov ecx,ted_rec_h + rol ecx,16 + mov cx,dx + rol ecx,16 + mov eax,13 + mov edx,ted_color_wnd_capt + int 0x40 ;㥬 אַ㣮쭨 ஬ ப +pop edx ecx ebx + + mov eax,47 + mov esi,ted_color_wnd_bord + int 0x40 ;㥬 ப + inc ecx + add edx,ted_rec_h + sub edx,ted_wnd_t + mov esi,edx + and esi,0xffff + cmp esi,ted_wnd_h + jge @f + add edx,ted_wnd_t + jmp @b + @@: + + popad + ret +endp + +;output: +; ah = symbol +align 4 +proc KeyConvertToASCII, table:dword + push ebx + mov ebx,dword[table] ;convert scan to ascii + ror ax,8 + xor ah,ah + add bx,ax + mov ah,byte[ebx] + pop ebx + ret +endp + +align 4 +proc ted_draw_cur_line, edit:dword + pushad + mov edi,dword[edit] + + mov ebx,ted_wnd_l + add ebx,ted_rec_l + shl ebx,16 + mov eax,ted_cur_y + imul eax,ted_rec_h + mov bx,ax + add ebx,ted_wnd_t + add ebx,ted_rec_t ;ebx - न אַ㣮쭨 ⪨ + add ebx,0x10001 ;塞 ࠢ 㪢 業 + + call ted_sel_normalize ;need before draw select + mov ecx,ted_cur_y + mov eax,ted_scr_w + add ecx,dword[eax+sb_offs_position] + stdcall ted_clear_line_before_draw,edi,ebx,1,ecx + + mov eax,ted_scr_h + mov esi,dword[eax+sb_offs_position] + call ted_get_pos_by_coords + + cmp ted_gp_opt,2 + jne .no_draw_text +; mov eax,4 ;draw text + call ted_get_symb_color + mov esi,1 ;draw 1 symbol + @@: + ;call ted_iterat_next + cmp edx,ted_tex_1 + jle .no_draw_text + + ; *** 梥⮢ ࠧ⪠ + cmp ted_mode_color,0 + je .no_col_change + cmp byte[edx+1],0 + je .no_col_change + call ted_get_symb_color + .no_col_change: + + mov eax,4 ;draw text + cmp byte [edx],13 + jne .no_13 + cmp ted_mode_invis,1 + jne .no_draw_text + push edx + mov edx,edi + add edx,ted_offs_symbol_new_line + int 0x40 + pop edx + jmp .no_draw_text + .no_13: + + int 0x40 + ror ebx,16 + add ebx,ted_rec_w + mov eax,ted_wnd_w + add eax,ted_wnd_l ;ax = x + cmp bx,ax + jge .no_draw_text ;Opt + ror ebx,16 + call ted_iterat_next + jmp @b + .no_draw_text: + + call ted_draw_main_cursor + popad + ret +endp + +;input: +; eax - text need find +; bl - first symbol to find +; edx - first symbol pointer +; edi - pointer to tedit struct +;output: +; bh - rezult +; edx - last text position (if find sucess) +; esi - first symbol pointer +;description: +; 㭪 ஢ ᮢ ⥪ eax +; ⥪⮬ । 㪠⥫ edx. +; ⠭ 㭪樨 (. strcmp) , ⮬ +; । ⥪ ᮤন ascii ப. +align 4 +ted_get_find_rezult: + push eax + mov bh,1 + mov esi,edx ;copy edx + @@: + cmp byte[edx],bl + jne .no_text + + inc eax ;*** get next symbol (in find text) *** + mov bl,byte[eax] + cmp bl,0 + je @f ;end of find text + + call ted_iterat_next ;*** get next symbol (in editor text) *** + cmp edx,ted_tex_1 + jle @f ;end of editor text + + jmp @b + .no_text: + xor bh,bh + mov edx,esi ;restore edx + @@: + pop eax + mov bl,byte[eax] ;restore bl + ret + +;input: +; clear_o - ᫨ =1 ப, =0 ப +align 4 +proc ted_clear_line_before_draw, edit:dword, coords:dword, clear_o:dword, numb_lin:dword + pushad + mov edi,dword[edit] + mov ebx,dword[coords] ;ebx = x*2^16+y coords to left up point clear line + mov esi,dword[numb_lin] ;esi - number text line + + sub ebx,0x10001 ;⭨ ࠢ 㪢 業 + cmp dword[clear_o],0 + jne @f + add ebx,ted_rec_h + inc esi + ror ebx,16 + xor bx,bx + add ebx,ted_wnd_l + add ebx,ted_rec_l ;bx = ted_wnd_l+ted_rec_l + ror ebx,16 + @@: + + mov eax,ted_wnd_h + add eax,ted_wnd_t + cmp ax,bx + jl .no_clear + sub ax,bx + + mov cx,bx + shl ecx,16 + + xor bx,bx + add ebx,ted_wnd_w + sub ebx,ted_rec_l + xor cx,cx + add ecx,ted_rec_h + mov edx,ted_color_wnd_work + + cmp dword[clear_o],0 + je .pusto + cmp ax,cx + jge @f + .pusto: + mov cx,ax + @@: + + call ted_is_select + cmp al,0 + je @f + cmp ted_seln_y0,esi + jg @f + cmp ted_seln_y1,esi + jl @f + mov edx,ted_color_select ;draw selected line + @@: + + mov eax,13 ;rect + int 0x40 + + call ted_is_select + cmp al,0 + je .no_clear + + mov al,13 ;rect + xor cx,cx + add ecx,ted_rec_h + cmp ted_seln_y0,esi + jne @f + push bx esi + mov edx,ted_seln_x0 ; (ࠥ ᫥) + mov esi,ted_scr_h + cmp edx,dword[esi+sb_offs_position] + jle .in_wnd + sub edx,dword[esi+sb_offs_position] + imul edx,ted_rec_w + mov bx,dx + jmp .no_wnd + .in_wnd: + mov bx,0 + .no_wnd: + mov edx,ted_color_wnd_work + int 0x40 + pop esi bx + @@: + cmp ted_seln_y1,esi + jne @f + push esi + mov edx,ted_seln_x1 ; (ࠥ ࠢ) + mov esi,ted_scr_h + cmp edx,dword[esi+sb_offs_position] + jle .in_wnd2 + sub edx,dword[esi+sb_offs_position] + imul edx,ted_rec_w + sub bx,dx + shl edx,16 + add ebx,edx + .in_wnd2: + + mov edx,ted_color_wnd_work + int 0x40 + pop esi + @@: + + .no_clear: + popad + ret +endp + +;input: +; edi = pointer to tedit struct +;output: +; ecx = 梥 ᨬ +; edx = pointer to symbol +; edx = 0 if text not in screen +align 4 +ted_get_first_visible_pos: + push eax ecx + mov eax,ted_scr_w + mov edx,ted_tex + xor ecx,ecx + @@: + cmp ecx,dword[eax+sb_offs_position] + je @f + call ted_iterat_next + cmp edx,ted_tex_1 + jle @f + cmp byte [edx],13 + jne @b + inc ecx + jmp @b + @@: + + cmp ecx,dword[eax+sb_offs_position] + je @f + xor edx,edx + @@: + cmp ecx,dword[eax+sb_offs_max_area] + jle @f + mov dword[eax+sb_offs_max_area],ecx + @@: + pop ecx eax + call ted_opt_draw_line_left + ret + +;input: +; edx = pointer to symbol +; edi = pointer to tedit struct +;output: +; ecx = 梥 ᨬ +; edx = 㪠⥫ ᨬ +;description: +; 㭪 㦭 ⨬樨 뢮 ⥪ +align 4 +proc ted_opt_draw_line_left + push ebx + + mov ebx,ted_scr_h + mov ebx,dword[ebx+sb_offs_position] + cmp ebx,0 + je .ret_f + push eax + mov eax,edx + + cmp edx,ted_tex + jne @f + call ted_iterat_next + jmp .beg_cycle + @@: + + cmp ebx,0 + je @f + + cmp byte[edx],13 + jne @f + call ted_iterat_next + .beg_cycle: + @@: + cmp edx,ted_tex_1 + jle @f + cmp byte[edx],13 + je @f + cmp ebx,0 + je @f +;-------------------------------------- +xor eax,eax ;eax 㤥 +mov al,byte[edx+1] +cmp al,0 +je .no_color +cmp eax,ted_colors_text_count +jge .no_color + xor ecx,ecx + mov cl,byte[edx+1] + shl cx,2 + add ecx,ted_text_colors + mov ecx,dword[ecx] +.no_color: +;-------------------------------------- + mov eax,edx + call ted_iterat_next + dec ebx + jmp @b + @@: + mov edx,eax + pop eax + .ret_f: + call ted_get_symb_color + pop ebx + ret +endp + +;input: +; edx = pointer to symbol +; edi = pointer to tedit struct +;output: +; ecx = symbol color +; edx = pointer to 13 symbol +;description: +; 㭪 㦭 ⨬樨 뢮 ⥪ +align 4 +proc ted_opt_draw_line_right + push eax + mov eax,edx + @@: + cmp edx,ted_tex_1 + jle @f + cmp byte[edx],13 + je @f + mov eax,edx + call ted_iterat_next + jmp @b + @@: + mov edx,eax ;perv sumbol + call ted_get_symb_color + + pop eax + ret +endp + +align 4 +proc ted_mouse, edit:dword + pushad + mov edi,dword[edit] + + ;ࠡ뢠 ஫ + mov edx,ted_scr_h + mov ecx,ted_scr_w + + cmp word[edx+sb_offs_delta2],0 + jne .horizontal + + mov eax,dword[ecx+sb_offs_max_area] + cmp eax,dword[ecx+sb_offs_cur_area] + jbe .horizontal + ; mouse event for Vertical ScrollBar + stdcall scroll_bar_vertical.mouse,ecx ;[scrollbar_ver_mouse] + cmp dword[ecx+sb_offs_redraw],0 + je @f + mov dword[ecx+sb_offs_redraw],0 + stdcall ted_draw,edi + jmp .no_in_wnd + @@: + cmp word[ecx+sb_offs_delta2],0 + jne .no_in_wnd + .horizontal: + mov eax,dword[edx+sb_offs_max_area] + cmp eax,dword[edx+sb_offs_cur_area] + jbe .other + ; mouse event for Horizontal ScrollBar + stdcall scroll_bar_horizontal.mouse,edx ;[scrollbar_hor_mouse] + cmp dword[edx+sb_offs_redraw],0 + je .other + mov dword[edx+sb_offs_redraw],0 + stdcall ted_draw,edi + jmp .no_in_wnd + .other: + cmp word[ecx+sb_offs_delta2],0 + jne .no_in_wnd + cmp word[edx+sb_offs_delta2],0 + jne .no_in_wnd + + ;ࠡ뢠 । + mcall 37,2 ;get mouse buttons + cmp al,1 + jne @f + mcall 37,1 ;get mouse coords + mov ebx,ted_wnd_t + add ebx,ted_rec_t + cmp ax,bx + jl @f ;y_mousey_wnd + + mov ebx,ted_wnd_l + add ebx,ted_rec_l + mov ecx,eax + shr ecx,16 + cmp cx,bx + jl @f ;x_mousex_wnd + + call ted_draw_cursor_sumb + call ted_wnd_main_click + jmp .no_in_wnd + @@: + call ted_wnd_main_mouse_scroll + cmp ted_drag_m,0 + je .no_in_wnd + mov ted_drag_m,0 + stdcall ted_draw,edi + cmp ted_fun_draw_panel_buttons,0 + je .no_in_wnd + call ted_fun_draw_panel_buttons + .no_in_wnd: + popad + ret +endp + +;input: +; eax -> (x,y) +; edi -> 㪠⥫ tedit +;description: +; 㭪 뢥 ⨨ ஬ । +align 4 +ted_wnd_main_click: + push ebx ecx edx + + push eax + shr eax,16 + and eax,0xffff + sub eax,ted_wnd_l + sub eax,ted_rec_l + + xor edx,edx + mov ecx,ted_rec_w + div cx + ;inc eax + mov ebx,ted_scr_h + cmp eax,dword[ebx+sb_offs_cur_area] + jle @f + mov eax,dword[ebx+sb_offs_cur_area] + @@: + ;dec eax + mov ted_cur_x,eax + pop eax + + push eax + and eax,0xffff + sub eax,ted_wnd_t + sub eax,ted_rec_t + + xor edx,edx + mov ecx,ted_rec_h + div cx + inc eax + mov ebx,ted_scr_w + cmp eax,dword[ebx+sb_offs_cur_area] + jle @f + mov eax,dword[ebx+sb_offs_cur_area] + @@: + dec eax + mov ted_cur_y,eax + pop eax + + cmp ted_drag_m,0 + je @f + call ted_sel_move + jmp .sel_move + @@: + mov ted_drag_m,1 + call ted_sel_start + .sel_move: + pop edx ecx ebx + ret + +;input: +; edi = pointer to tedit struct +align 4 +ted_wnd_main_mouse_scroll: + push eax ebx ecx + mcall 37,7 + cmp ax,0 + je .no_scroll + mov ecx,ted_scr_w + mov ebx,dword[ecx+sb_offs_position] ;copy old scroll position + and eax,0xffff + btr ax,15 + jae @f + or eax,0xffff8000 + @@: + add dword[ecx+sb_offs_position],eax + + mov eax,[ecx+sb_offs_position] + cmp eax,[ecx+sb_offs_max_area] + jb @f + mov dword[ecx+sb_offs_position],ebx ;if scroll position out of range + jmp .no_scroll + @@: + stdcall ted_draw,edi + .no_scroll: + pop ecx ebx eax + ret + +align 4 +proc ted_but_save_file, edit:dword, file:dword, f_name:dword + pushad + mov edi,dword[edit] + + stdcall ted_can_save,edi + cmp al,0 + je .no_save + + mov ecx,ted_max_chars + call mem_Alloc + push eax ; 㪠⥫ 뤥 + + mov edx,ted_tex + xor ecx,ecx + @@: + call ted_iterat_next + cmp edx,ted_tex_1 + jle @f ;edx = ted_tex or edx = ted_tex+sizeof.symbol + mov bl,[edx] + mov byte[eax],bl + inc eax + inc ecx + jmp @b + @@: + + cmp ecx,0 + je @f + mov ebx,dword[file] + pop eax ;뢠 㪠⥫ 뤥 + mov dword[ebx+16],eax + push eax ;⭮ 㪠⥫ 뤥 + mov eax,70 + mov dword[ebx], 2 + mov dword[ebx+4], 0 + mov dword[ebx+8], 0 + mov dword[ebx+12], ecx + mov byte[ebx+20], 0 + push dword[f_name] + pop dword[ebx+21] + int 0x40 + + mov ted_err_save,al + + cmp eax,0 + je .no_msg +; cmp eax,6 +; je @f + cmp ax,10 + jl .zifra_0_9 + mov al,'?' + sub ax,48 + .zifra_0_9: + add ax,48 +cmp ted_fun_save_err,0 +je @f +call ted_fun_save_err + jmp @f + .no_msg: + m2m ted_tim_ls,ted_tim_ch + @@: + + pop ecx ;뢠 㪠⥫ 뤥 + call mem_Free + .no_save: + popad + ret +endp +} \ No newline at end of file diff --git a/programs/develop/libraries/box_lib/trunk/tree_list.mac b/programs/develop/libraries/box_lib/trunk/tree_list.mac index 4f24e29094..15358b694e 100644 --- a/programs/develop/libraries/box_lib/trunk/tree_list.mac +++ b/programs/develop/libraries/box_lib/trunk/tree_list.mac @@ -1,6 +1,6 @@ ; box_lib.obj ; TreeList Kolibri OS -; 14.04.2010 IgorA +; 29.04.2010 IgorA ; GPL2 @@ -1303,7 +1303,7 @@ tl_strlen: cmp byte[eax],0 je @f inc eax - loop @b + jmp @b @@: sub eax,esi ret diff --git a/programs/other/t_edit/build_en.bat b/programs/other/t_edit/build_en.bat index 01b7620bf3..35234bbbed 100644 --- a/programs/other/t_edit/build_en.bat +++ b/programs/other/t_edit/build_en.bat @@ -6,7 +6,7 @@ if not exist bin\te_icon.bmp @copy te_icon.bmp bin\te_icon.bmp if not exist bin\info mkdir bin\info copy info\* bin\info\* -@fasm.exe -m 16384 ..\..\develop\libraries\box_lib\trunk\box_lib.asm bin\box_lib.obj +if not exist bin\box_lib.obj @fasm.exe -m 16384 ..\..\develop\libraries\box_lib\trunk\box_lib.asm bin\box_lib.obj @kpack bin\box_lib.obj @erase lang.inc diff --git a/programs/other/t_edit/build_ru.bat b/programs/other/t_edit/build_ru.bat index 5a37a404c3..6c3a1539e1 100644 --- a/programs/other/t_edit/build_ru.bat +++ b/programs/other/t_edit/build_ru.bat @@ -6,7 +6,7 @@ if not exist bin\te_icon.bmp @copy te_icon.bmp bin\te_icon.bmp if not exist bin\info mkdir bin\info copy info\* bin\info\* -@fasm.exe -m 16384 ..\..\develop\libraries\box_lib\trunk\box_lib.asm bin\box_lib.obj +if not exist bin\box_lib.obj @fasm.exe -m 16384 ..\..\develop\libraries\box_lib\trunk\box_lib.asm bin\box_lib.obj @kpack bin\box_lib.obj @erase lang.inc diff --git a/programs/other/t_edit/readme.htm b/programs/other/t_edit/readme.htm index e83b64cc6c..05aa5decf6 100644 --- a/programs/other/t_edit/readme.htm +++ b/programs/other/t_edit/readme.htm @@ -48,7 +48,7 @@ table -

    TextEditor 22.04.2010

    +

    TextEditor 29.04.2010

    . .

    @@ -73,11 +73,11 @@ table KOI8M, OEM - , . ( , F1). + , . ( , F1). / - + - +

    @@ -112,21 +112,8 @@ ends , .

    'col' - .

    -

    :

    -

    GetTexPervPos - ( 'perv')

    -

    GetTexNextPos - ( 'next')

    -

    SymbNotVis - ( - 'tc' 'td')

    -

    IteratNext - . - GetTexNextPos SymbNotVis.

    -

    IteratPerv - .

    - -

    ItPoNextUc - (edx-. - , bl-> )

    -

    GetPosByParam - (esi->. x, ; - ecx->. y, )

    -

    GoToPos - , - , (ecx->. x, ; edx->. y, )

    +

    +

    t_edit box_lib.obj.

    *.syn

    diff --git a/programs/other/t_edit/t_button.inc b/programs/other/t_edit/t_button.inc index 23c77d613a..5cfd28d91c 100644 --- a/programs/other/t_edit/t_button.inc +++ b/programs/other/t_edit/t_button.inc @@ -1,7 +1,83 @@ +struct f70 + func_n dd ? + param1 dd ? + param2 dd ? + param3 dd ? + param4 dd ? + rezerv db ? + name dd ? +ends + +struct TexColViv + Text rb MAX_COLOR_WORD_LEN ; ᫮ ᢥ⪨ + f1 dd 0 ; ࠢ ᫮ + wwo db ? ; whole words only + endc db ? ; ᨬ 뤥 (wwo&4) + color db ? ; 梥 +ends + +struct symbol + c db ? ; +0 ᨬ + col db ? ; +1 梥 + perv dd ? ; +2 + next dd ? ; +6 㪠⥫ + tc dd ? ; +10 ६. ᮧ + td dd ? ; +14 ६. 㤠 +ends + + +hed db 'TextEditor 29.04.10',0 ; +sc system_colors + +fn_icon db 'te_icon.bmp',0 +bmp_icon dd 0 +run_file_70 f70 + + +;input: +; al = 訡 align 4 -but_NewFile: +ted_on_init_synt_err: + mov byte[msgbox_3.err],al + stdcall [mb_create],msgbox_3,thread ;message: Can-t open color options file! + ret + + +;----------------------------------------------------------------------------- +;㭪 뤥 +;input: +; ecx = size data +;otput: +; eax = pointer to memory +align 4 +mem_Alloc: + push ebx + mov eax,68 + mov ebx,12 + int 0x40 + pop ebx + ret +;----------------------------------------------------------------------------- +;㭪 ᢮ +;input: +; ecx = pointer to memory +align 4 +mem_Free: push eax ebx - stdcall ted_can_save, tedit0 + cmp ecx,0 + jz @f + mov eax,68 + mov ebx,13 + int 0x40 + @@: + pop ebx eax + ret + + +align 4 +ted_but_new_file: + push eax ebx + stdcall [ted_can_save], tedit0 cmp al,1 jne @f stdcall [mb_create],msgbox_2,thread ;message: save changes in file? @@ -18,9 +94,9 @@ but_NewFile: align 4 On_NewFile: - stdcall ted_clear, tedit0,1 + stdcall [ted_clear], tedit0,1 call draw_but_toolbar - stdcall draw_main_win, tedit0 + stdcall [ted_draw], tedit0 ret align 4 @@ -28,7 +104,7 @@ On_SaveAndNewFile: push edi mov edi, tedit0 - stdcall but_SaveFile,edi + stdcall [ted_but_save_file],edi,run_file_70,[edit1.text] cmp ted_err_save,0 jne @f call On_NewFile @@ -36,387 +112,119 @@ On_SaveAndNewFile: pop edi ret +;description: +; 㭪 䠩 ᮮ饭 align 4 -but_no_msg_OpenFile: ;㭪 䠩 १ ᮮ饭 - stdcall ted_on_open_file, tedit0 - ret +but_no_msg_OpenFile: + push eax ebx + stdcall [ted_open_file], tedit0,run_file_70,[edit1.text] + call ted_messages_after_open_file + pop ebx eax + ret - -;㭪 䠩 ᮮ饭 ( ⬥ ⨥) +;description: +; 㭪 䠩 ᮮ饭 ( ⬥ ⨥) align 4 -but_OpenFile: - push eax - stdcall ted_can_save, tedit0 - cmp al,1 - jne @f - stdcall [mb_create],msgbox_5,thread ;message: save changes in file? - stdcall [mb_setfunctions],msgbox_5_funct - jmp .ret_f - @@: - stdcall ted_on_open_file, tedit0 - .ret_f: - pop eax - ret - -align 4 -proc ted_on_open_file, edit:dword ;㭪 䠩 - push eax ebx edi - mov edi,dword[edit] - - mov eax,70 - mov [run_file_70.func_n], 0 - mov [run_file_70.param1], 0 - mov [run_file_70.param2], 0 - mov [run_file_70.param3], maxChars-2 ;sizeof.symbol - m2m [run_file_70.param4], ted_tex - mov [run_file_70.rezerv], 0 - push dword[edit1.text] - pop dword[run_file_70.name] - mov ebx,run_file_70 - int 0x40 - - cmp eax,0 - je @f - cmp eax,6 - je @f - cmp ax,10 - jl .zifra_0_9 - mov al,'?' - sub ax,48 - .zifra_0_9: - add ax,48 - - mov byte[msgbox_4.err],al - stdcall [mb_create],msgbox_4,thread ;message: Can-t open text file! - jmp .ret_f - @@: - cmp ebx,-1 - je .ret_f - ;if open file - call OpenFile - cmp ebx,maxChars-2 - jl .ret_f - stdcall [mb_create],msgbox_1,thread - .ret_f: - pop edi ebx eax - ret -endp - - -align 4 -proc but_SaveFile, edit:dword - pushad - - stdcall ted_can_save,edi - cmp al,0 - je .no_save - - mov edi,dword[edit] - - mov ecx,maxChars - call mem_Alloc - push eax - - mov edx,ted_tex - xor ecx,ecx - @@: - call IteratNext - cmp edx,ted_tex_1 - jle @f ;edx = ted_tex or edx = ted_tex+sizeof.symbol - mov bl,[edx] - mov byte[eax],bl - inc eax - inc ecx - jmp @b - @@: - - cmp ecx,0 - je @f - pop eax - mov [run_file_70.param4],eax - push eax - mov eax,70 - mov [run_file_70.func_n], 2 - mov [run_file_70.param1], 0 - mov [run_file_70.param2], 0 - mov [run_file_70.param3], ecx - mov [run_file_70.rezerv], 0 - push [edit1.text] - pop [run_file_70.name] - mov ebx,run_file_70 - int 0x40 - - mov ted_err_save,ax - - cmp eax,0 - je .no_msg -; cmp eax,6 -; je @f - cmp ax,10 - jl .zifra_0_9 - mov al,'?' - sub ax,48 - .zifra_0_9: - add ax,48 - - mov byte[msgbox_6.err],al - stdcall [mb_create],msgbox_6,thread ;message: Can-t save text file! - jmp @f - .no_msg: - m2m ted_tim_ls,ted_tim_ch - @@: - - pop ecx - call mem_Free - .no_save: - popad - ret -endp - - -align 4 -proc but_FindText, edit:dword - pushad - mov edi,dword[edit] - - call GetPos - mov eax,[edit2.text] - mov bl,byte[eax] - @@: - call GetFindRezult - cmp bh,1 - je @f ; find - - call IteratNext - cmp edx,ted_tex_1 - jle @f - jmp @b - @@: - cmp bh,0 - je @f - call GetTexCoords - inc ebx ;move cursor right - mov ted_sel_x1,ebx - mov ted_sel_y1,eax - mov edx,eax - mov ecx,ebx - call GoToPos - mov edx,esi ;esi 뫮 ⠭ GetFindRezult - call GetTexCoords - mov ted_sel_x0,ebx - mov ted_sel_y0,eax - stdcall draw_main_win,edi - jmp .end_find - @@: - stdcall [mb_create],msgbox_7,thread ;message: Can not find text - .end_find: - popad - ret -endp +ted_but_open_file: + push eax ebx + stdcall [ted_can_save], tedit0 + cmp al,1 + jne @f + stdcall [mb_create],msgbox_5,thread ;message: save changes in file? + stdcall [mb_setfunctions],msgbox_5_funct + jmp .ret_f + @@: + stdcall [ted_open_file], tedit0,run_file_70,[edit1.text] + call ted_messages_after_open_file + .ret_f: + pop ebx eax + ret ;input: -; eax - text need find -; bl - first symbol to find -; edx - first symbol pointer -; edi - pointer to tedit struct -;output: -; bh - rezult -; edx - last text position (if find sucess) -; esi - first symbol pointer -;description: -; 㭪 ஢ ᮢ ⥪ eax -; ⥪⮬ । 㪠⥫ edx. -; ⠭ 㭪樨 (. strcmp) , ⮬ -; । ⥪ ᮤন ascii ப. +; eax = 訡 +; ebx = ⢮ ⠭ +; edi = pointer to tedit struct align 4 -GetFindRezult: - push eax - mov bh,1 - mov esi,edx ;copy edx - @@: - cmp byte[edx],bl - jne .no_text +ted_messages_after_open_file: + push ecx + cmp eax,0 + je @f + cmp eax,6 + je @f + cmp ax,10 + jl .zifra_0_9 + mov al,'?' + sub ax,48 + .zifra_0_9: + add ax,48 - inc eax ;*** get next symbol (in find text) *** - mov bl,byte[eax] - cmp bl,0 - je @f ;end of find text + mov byte[msgbox_4.err],al + stdcall [mb_create],msgbox_4,thread ;message: Can-t open text file! + jmp .ret_f + @@: + cmp ebx,-1 + je .ret_f + ;if open file + mov ecx,ted_max_chars + sub ecx,2 ;ecx = ᨬ쭮 ᫮ , 뫠 뤥 + cmp ebx,ecx + jl .ret_f + stdcall [mb_create],msgbox_1,thread + .ret_f: + pop ecx + ret - call IteratNext ;*** get next symbol (in editor text) *** - cmp edx,ted_tex_1 - jle @f ;end of editor text - - jmp @b - .no_text: - xor bh,bh - mov edx,esi ;restore edx - @@: - pop eax - mov bl,byte[eax] ;restore bl - ret +align 4 +ted_save_err_msg: + mov byte[msgbox_6.err],al + stdcall [mb_create],msgbox_6,thread ;message: Can-t save text file! + ret align 4 proc ted_but_open_syntax, edit:dword - push edi + push ebx edi mov edi,dword[edit] - cmp ted_panel_id,TE_PANEL_SYNTAX + cmp ted_panel_id,TED_PANEL_SYNTAX jne @f stdcall dword[tl_node_get_data], tree1 pop dword[fn_col_option] - stdcall InitColText,edi - call CmColored - stdcall draw_main_win,edi + mov ebx,dword[fn_col_option] + copy_path ebx,fn_syntax_dir,file_name_rez,0x0 + copy_path file_name_rez,sys_path,file_name,0x0 + stdcall [ted_init_syntax_file],edi,run_file_70,file_name + call [ted_text_colored] + stdcall [ted_draw],edi @@: - pop edi + pop edi ebx ret endp align 4 -proc ted_but_select_word, edit:dword - pushad - mov edi,dword[edit] - - call GetPos - push edx - call ItPervColorTag - cmp edx,ted_tex_1 - jle @f - call GetTexCoords - mov ted_sel_x0,ebx - mov ted_sel_y0,eax - @@: - pop edx - call ItNextColorTag - cmp edx,ted_tex_1 - jle @f - call GetTexCoords - mov ted_sel_x1,ebx - mov ted_sel_y1,eax - @@: - - call draw_but_toolbar - stdcall draw_main_win,edi - popad - ret -endp - -align 4 -proc ted_but_cut, edit:dword +proc ted_but_find ;맮/⨥ ᪠ push edi - mov edi,dword[edit] + mov edi,tedit0 - stdcall ted_but_copy,edi - stdcall ted_set_undo,edi - stdcall SelTextDel,ted_opt_ed_change_time - - cmp al,1 - jne @f - call draw_but_toolbar - stdcall draw_main_win,edi - @@: - pop edi - ret -endp - -;output: -; al = 1 if copy text -align 4 -proc ted_but_copy, edit:dword - pushad - mov edi,dword[edit] - - stdcall IsSel,edi - cmp al,0 - je .end_f ;if not selected text - stdcall SelNormalize,edi - - mov esi,ted_seln_x1 - mov ecx,ted_seln_y1 - call GetPosByParam - mov ebx,edx - mov esi,ted_seln_x0 - mov ecx,ted_seln_y0 - call GetPosByParam - mov esi,ebx - - xor ecx,ecx - mov ebx,buf - ;mov edx,ted_tex - @@: - cmp edx,ted_tex_1 ;end of file - jle @f - cmp edx,esi ;end of select - je @f - inc ecx - cmp ecx,BUF_SIZE ;owerflow bufer - je @f - - mov al,byte[edx] - mov byte[ebx],al - inc ebx - - call IteratNext - jmp @b - @@: - add ecx,buf - mov byte[ebx],0 - - cmp ecx,0 - je .end_f - call draw_but_toolbar - stdcall draw_bufer,edi - .end_f: - popad - ret -endp - - -align 4 -proc ted_but_paste, edit:dword - push eax ebx esi edi - mov edi,dword[edit] - - mov esi,buf - call strlen - cmp eax,1 - jl @f - stdcall ted_set_undo,edi - mov esi,eax - mov ebx,ted_opt_ed_change_time+ted_opt_ed_move_cursor - stdcall SelTextDel,ebx - cmp al,1 - jne .del - mov ebx,ted_opt_ed_move_cursor - .del: - stdcall ted_text_add,edi,buf,esi,ebx - call draw_but_toolbar - stdcall draw_main_win,edi - @@: - pop edi esi ebx eax - ret -endp - -align 4 -proc but_find, edit:dword ;맮/⨥ ᪠ - push edi - mov edi,dword[edit] - - cmp ted_panel_id,TE_PANEL_NULL + cmp ted_panel_id,TED_PANEL_NULL je @f - mov ted_panel_id,TE_PANEL_NULL + mov ted_panel_id,TED_PANEL_NULL mov ted_wnd_l,0 jmp .e_if @@: - mov ted_panel_id,TE_PANEL_FIND - mov ted_wnd_l,TE_PANEL_WIDTH + mov ted_panel_id,TED_PANEL_FIND + mov ted_wnd_l,TED_PANEL_WIDTH .e_if: stdcall EvSize,edi - stdcall draw_main_win,edi + stdcall [ted_draw],edi pop edi ret endp +align 4 +ted_on_find_err: + stdcall [mb_create],msgbox_7,thread ;message: Can not find text + ret + align 4 but_replace: ret @@ -425,102 +233,6 @@ align 4 but_find_key_w: ret -align 4 -proc but_sumb_upper, edit:dword - push edi esi - mov edi,dword[edit] - - mov [conv_table],EvUpper - call ConvertSelText - cmp esi,0 - je @f - stdcall draw_main_win,edi - @@: - pop esi edi - ret -endp - -align 4 -proc but_sumb_lover, edit:dword - push edi esi - mov edi,dword[edit] - - mov [conv_table],EvLover - call ConvertSelText - cmp esi,0 - je @f - stdcall draw_main_win,edi - @@: - pop esi edi - ret -endp - -align 4 -proc but_reverse, edit:dword - push eax ebx edi - mov edi,dword[edit] - - stdcall IsSel,edi - cmp al,0 - je @f - stdcall SelNormalize,edi - push esi ecx edx - mov esi,ted_seln_x0 - mov ecx,ted_seln_y0 - call GetPosByParam - mov eax,edx - mov esi,ted_seln_x1 - cmp esi,0 - je .beg_str - dec esi - .beg_str: - mov ecx,ted_seln_y1 - call GetPosByParam - ;call GetTexPervPos - mov ebx,edx - pop edx ecx esi - ;cmp eax,... - ;je @f - call Revers - @@: - stdcall draw_main_win,edi - pop edi ebx eax - ret -endp - -align 4 -proc ted_but_undo, edit:dword - push eax edi - mov edi,dword[edit] - - mov eax,ted_tim_undo - cmp ted_tim_ch,eax - jbe @f - inc ted_tim_undo - ;call CmColored - stdcall draw_main_win,edi - call draw_but_toolbar - @@: - pop edi eax - ret -endp - -align 4 -proc ted_but_redo, edit:dword - push edi - mov edi,dword[edit] - - cmp ted_tim_undo,1 - jb @f - dec ted_tim_undo - ;call CmColored - stdcall draw_main_win,edi - call draw_but_toolbar - @@: - pop edi - ret -endp - align 4 proc but_sumb_invis, edit:dword push edi @@ -528,7 +240,7 @@ proc but_sumb_invis, edit:dword xor ted_mode_invis,1 call draw_but_toolbar - stdcall draw_main_win,edi + stdcall [ted_draw],edi pop edi ret endp @@ -541,153 +253,30 @@ proc but_k_words_show, edit:dword xor ted_mode_color,1 cmp ted_mode_color,0 je @f - call CmColored + call [ted_text_colored] @@: call draw_but_toolbar - stdcall draw_main_win,edi + stdcall [ted_draw],edi pop edi ret endp - -;input: -; edi = pointer to tedit struct -align 4 -but_CtrlHome: - mov ted_cur_x,0 - mov ted_cur_y,0 - push eax - mov eax,ted_scr_w - mov dword[eax+sb_offs_position],0 - mov eax,ted_scr_h - mov dword[eax+sb_offs_position],0 - pop eax - call draw_but_toolbar - stdcall draw_main_win,edi - ret - align 4 proc but_synt_show, edit:dword push edi mov edi,[edit] - cmp ted_panel_id,TE_PANEL_NULL + cmp ted_panel_id,TED_PANEL_NULL je @f - mov ted_panel_id,TE_PANEL_NULL + mov ted_panel_id,TED_PANEL_NULL mov ted_wnd_l,0 jmp .e_if @@: - mov ted_panel_id,TE_PANEL_SYNTAX - mov ted_wnd_l,TE_PANEL_WIDTH + mov ted_panel_id,TED_PANEL_SYNTAX + mov ted_wnd_l,TED_PANEL_WIDTH .e_if: stdcall EvSize,edi - stdcall draw_main_win,edi - pop edi - ret -endp - -align 4 -proc ted_sel_key_up, edit:dword - push edi - mov edi,dword[edit] - - cmp ted_drag_k,1 - je @f - stdcall SelStart,edi - mov ted_drag_k,1 - @@: - push dx - call CurMoveUp - cmp dl,8 - jne @f - call OnInitialUpdate - @@: - pop dx - stdcall SelMove,edi - stdcall draw_main_win,edi - pop edi - ret -endp - -align 4 -proc ted_sel_key_down, edit:dword - push edi - mov edi,dword[edit] - - cmp ted_drag_k,1 - je @f - stdcall SelStart,edi - mov ted_drag_k,1 - @@: - push dx - call CurMoveDown - cmp dl,8 - jne @f - call OnInitialUpdate - @@: - pop dx - stdcall SelMove,edi - stdcall draw_main_win,edi - pop edi - ret -endp - -align 4 -proc ted_sel_key_left, edit:dword - push edi - mov edi,dword[edit] - - cmp ted_drag_k,1 - je @f - stdcall SelStart,edi - @@: - push dx - call CurMoveLeft - stdcall SelMove,edi - cmp ted_drag_k,1 - je @f - mov ted_drag_k,1 - mov dl,8 - @@: - cmp dl,8 - jne @f - call OnInitialUpdate - stdcall draw_main_win,edi - jmp .end_f - @@: - stdcall draw_cur_line,edi - .end_f: - pop dx - pop edi - ret -endp - -align 4 -proc ted_sel_key_right, edit:dword - push edi - mov edi,dword[edit] - - cmp ted_drag_k,1 - je @f - stdcall SelStart,edi - @@: - push dx - call CurMoveRight - stdcall SelMove,edi - cmp ted_drag_k,1 - je @f - mov ted_drag_k,1 - mov dl,8 - @@: - cmp dl,8 - jne @f - call OnInitialUpdate - stdcall draw_main_win,edi - jmp .end_f - @@: - stdcall draw_cur_line,edi - .end_f: - pop dx + stdcall [ted_draw],edi pop edi ret endp diff --git a/programs/other/t_edit/t_data.inc b/programs/other/t_edit/t_data.inc index 169ade0d91..9ba44abf93 100644 --- a/programs/other/t_edit/t_data.inc +++ b/programs/other/t_edit/t_data.inc @@ -72,6 +72,32 @@ menu_bar_mouse dd aMenu_bar_mouse tl_node_close_open dd sz_tl_node_close_open 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_can_save dd sz_ted_can_save +ted_clear dd sz_ted_clear +ted_delete dd sz_ted_delete +ted_draw dd sz_ted_draw +ted_init dd sz_ted_init +ted_init_syntax_file dd sz_ted_init_syntax_file +ted_is_select dd sz_ted_is_select +ted_key dd sz_ted_key +ted_mouse dd sz_ted_mouse +ted_open_file dd sz_ted_open_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 +ted_but_copy dd sz_ted_but_copy +ted_but_paste dd sz_ted_but_paste +ted_but_undo dd sz_ted_but_undo +ted_but_redo dd sz_ted_but_redo +ted_but_reverse dd sz_ted_but_reverse +ted_but_find_next dd sz_ted_but_find_next +ted_text_colored dd sz_ted_text_colored +;;;version_text_edit dd sz_ted_version + dd 0,0 aEdit_box_draw db 'edit_box',0 @@ -119,6 +145,31 @@ aMenu_bar_mouse db 'menu_bar_mouse',0 sz_tl_node_close_open db 'tl_node_close_open',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_can_save db 'ted_can_save',0 +sz_ted_clear db 'ted_clear',0 +sz_ted_delete db 'ted_delete',0 +sz_ted_draw db 'ted_draw',0 +sz_ted_init db 'ted_init',0 +sz_ted_init_syntax_file db 'ted_init_syntax_file',0 +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_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 +sz_ted_but_copy db 'ted_but_copy',0 +sz_ted_but_paste db 'ted_but_paste',0 +sz_ted_but_undo db 'ted_but_undo',0 +sz_ted_but_redo db 'ted_but_redo',0 +sz_ted_but_reverse db 'ted_but_reverse',0 +sz_ted_but_find_next db 'ted_but_find_next',0 +sz_ted_text_colored db 'ted_text_colored',0 +;;;sz_ted_version db 'version_text_edit',0 ;-------------------------------------------------- align 4 msgbox_lib_import: @@ -275,10 +326,10 @@ menu_data_1: .get_mouse_flag dd 0 ;+116 ;------------------------- -TE_PANEL_NULL equ 0 -TE_PANEL_FIND equ 1 -TE_PANEL_SYNTAX equ 2 -TE_PANEL_WIDTH equ 150 ; +TED_PANEL_NULL equ 0 ; ⮩ +TED_PANEL_FIND equ 1 ; ᪠ +TED_PANEL_SYNTAX equ 2 ; 롮 䠩 ᢥ⪨ +TED_PANEL_WIDTH equ 150 ;ਭ count_of_dir_list_files equ 15 @@ -290,75 +341,6 @@ struct TexSelect 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] ;뤥 -ted_sel_x0 equ dword[edi+34] ;न 뤥 x0 -ted_sel_y0 equ dword[edi+38] ;न 뤥 y0 -ted_sel_x1 equ dword[edi+42] ;न 뤥 x1 -ted_sel_y1 equ dword[edi+46] ;न 뤥 y1 -; न 뤥 -ted_seln_x0 equ dword[edi+50] -ted_seln_y0 equ dword[edi+54] -ted_seln_x1 equ dword[edi+58] -ted_seln_y1 equ dword[edi+62] - -ted_tex equ dword[edi+66] ;㪠⥫ ࠭ ⥪ -ted_tex_1 equ dword[edi+70] ;㪠⥫ 1- ᨬ -ted_tex_end equ dword[edi+74] ;㪠⥫ ᫥ ᨬ -ted_cur_x equ dword[edi+78] ;न x -ted_cur_y equ dword[edi+82] ;न y -ted_cur_ins equ byte[edi+86] ;० ࠡ ( ) -ted_mode_color equ byte[edi+87] ;० 뤥 ᫮ 梥⮬ (0-몫. 1-.) -ted_mode_invis equ byte[edi+88] ;० ⠥ ᨬ -ted_gp_opt equ byte[edi+89] ;樨 頥 㭪樥 GetPos -ted_colors_text_count equ dword[edi+90] ;⢮ 梥⮢ ⥪ -ted_key_words_count equ dword[edi+94] ;⢮ 祢 ᫮ -ted_color_cursor equ dword[edi+98] ;梥 -ted_color_wnd_capt equ dword[edi+102] ;梥 -ted_color_wnd_work equ dword[edi+106] ;梥 䮭 -ted_color_wnd_bord equ dword[edi+110] ;梥 ⥪ -ted_color_select equ dword[edi+114] ;梥 뤥 -ted_color_cur_text equ dword[edi+118] ;梥 ᨬ ஬ -ted_color_wnd_text equ dword[edi+122] ;梥 ⥪ -ted_syntax_file equ dword[edi+126] ;㪠⥫ 砫 䠩 ᨭ⠪ -ted_syntax_file_end equ dword[edi+130] ;㪠⥫ 䠩 ᨭ⠪ -ted_text_colors equ dword[edi+134] ;㪠⥫ ᨢ 梥⮢ ⥪ -ted_help_text_f1 equ dword[edi+138] ;㪠⥫ ⥪ ࠢ ( ⨨ F1) -ted_help_id equ dword[edi+142] ;䨪 ࠢ -ted_key_words_data equ dword[edi+146] ;㪠⥫ 祢 ᫮ TexColViv -ted_tim_ch equ dword[edi+150] ;⢮ 䠩 -ted_tim_undo equ dword[edi+154] ;⢮ ⬥ ⢨ -ted_tim_ls equ dword[edi+158] ;६ ᫥ ࠭ -ted_tim_co equ dword[edi+162] ;६ ᫥ 梥⮢ ࠧ⪨ -ted_el_focus equ dword[edi+166] ;㪠⥫ ६ 䮪 -ted_err_save equ word[edi+170] ;訡 ࠭ 䠩 -ted_key_new equ byte[edi+172] ;ᨬ, 㤥 -ted_symbol_new_line equ byte[edi+173] ;ᨬ 襭 ப -ted_scr_w equ dword[edi+174] ;⨪ ஫ -ted_scr_h equ dword[edi+178] ;ਧ⠫ ஫ -ted_panel_id equ byte[edi+182] ; ⮩ -;------------------------------------------------------------------------------ -sb_offs_max_area equ 16 -sb_offs_cur_area equ 20 -sb_offs_position equ 24 -sb_offs_redraw equ 40 -;------------------------------------------------------------------------------ -ted_opt_ed_move_cursor equ 1 ; ᫥ ⥪ -ted_opt_ed_change_time equ 2 ; ।஢ ⥪ -ted_offs_sel equ 34 ;ᬥ饭 sel -ted_offs_seln equ 50 ;ᬥ饭 seln -ted_offs_count_colors equ 90 ;ᬥ饭 ६ ⢠ 梥⮢ -ted_offs_key_new equ 172 -ted_offs_symbol_new_line equ 173 ;ᬥ饭 ᨬ ப -;------------------------------------------------------------------------------ align 4 tedit0: ; ⥪⮢ । .wnd BOX 0,50,440,150 ;+ 0 @@ -367,53 +349,67 @@ tedit0: ; .drag_k db 0 ;+33 뤥 .sel TexSelect 0,0,0,0 ;+34 뤥 .seln TexSelect ;+50 ⥫쭠 뤥 - .tex dd 0 ;+66 text memory pointer - .tex_1 dd 0 ;+70 text first symbol pointer - .tex_end dd 0 ;+74 text end memory pointer - .cur_x dd 0 ;+78 - .cur_y dd 0 ;+82 - .cur_ins db 1 ;+86 - .mode_color db 1 ;+87 ० 뤥 ᫮ 梥⮬ (0-몫. 1-.) - .mode_invis db 0 ;+88 ० ⠥ ᨬ - .gp_opt db 0 ;+89 樨 頥 㭪樥 GetPos + .tex dd 0 ;+66 text memory pointer + .tex_1 dd 0 ;+70 text first symbol pointer + .tex_end dd 0 ;+74 text end memory pointer + .cur_x dd 0 ;+78 न x + .cur_y dd 0 ;+82 न y + .max_chars dd maxChars ;+86 ᨬ쭮 ᫮ ᨬ 㬥 ; \/ ࠧ뢠 ᫥騥 ६: .count_colors_text dd 1 ;+90 ⢮ 梥⮢ ⥪ .count_key_words dd 0 ;+94 ⢮ 祢 ᫮ - .color_cursor dd 0x808080 ;+98 梥 - .color_wnd_capt dd 0x80 ;+102 梥 - .color_wnd_work dd 0x0 ;+106 梥 䮭 - .color_wnd_bord dd 0xd0d0d0 ;+110 梥 ⥪ - .color_select dd 0x208080 ;+114 梥 뤥 - .color_cur_text dd 0xff0000 ;+118 梥 ᨬ ஬ - .color_wnd_text dd 0xffff00 ;+122 梥 ⥪ + .color_cursor dd 0x808080 ;+98 梥 + .color_wnd_capt dd 0x80 ;+102 梥 + .color_wnd_work dd 0x0 ;+106 梥 䮭 + .color_wnd_bord dd 0xd0d0d0 ;+110 梥 ⥪ + .color_select dd 0x208080 ;+114 梥 뤥 + .color_cur_text dd 0xff0000 ;+118 梥 ᨬ ஬ + .color_wnd_text dd 0xffff00 ;+122 梥 ⥪ ; /\ 㣨, 騥 ࠧ뢠. - .syntax_file dd 0 ;+126 㪠⥫ 砫 䠩 ᨭ⠪ - .syntax_file_end dd 0 ;+130 㪠⥫ 䠩 ᨭ⠪ - .text_colors dd 0 ;+134 㪠⥫ ᨢ 梥⮢ ⥪ - .help_text_f1 dd 0 ;+138 㪠⥫ ⥪ ࠢ ( ⨨ F1) - .help_id dd -1 ;+142 䨪 ࠢ - .key_words_data dd 0 ;+146 㪠⥫ 祢 ᫮ TexColViv - .tim_ch dd ? ;+150 ⢮ 䠩 - .tim_undo dd ? ;+154 ⢮ ⬥ ⢨ - .tim_ls dd ? ;+158 ६ ᫥ ࠭ - .tim_co dd ? ;+162 ६ ᫥ 梥⮢ ࠧ⪨ - .el_focus dd el_focus ;+166 㪠⥫ ६ 䮪 - .err_save dw 0 ;+170 訡 ࠭ 䠩 + .syntax_file dd 0 ;+126 㪠⥫ 砫 䠩 ᨭ⠪ + .syntax_file_size dd maxSyntaxFileSize ;+130 ᨬ ࠧ 䠩 ᨭ⠪ + .text_colors dd 0 ;+134 㪠⥫ ᨢ 梥⮢ ⥪ + .help_text_f1 dd 0 ;+138 㪠⥫ ⥪ ࠢ ( ⨨ F1) + .help_id dd -1 ;+142 䨪 ࠢ + .key_words_data dd 0 ;+146 㪠⥫ 祢 ᫮ TexColViv + .tim_ch dd ? ;+150 ⢮ 䠩 + .tim_undo dd ? ;+154 ⢮ ⬥ ⢨ + .tim_ls dd ? ;+158 ६ ᫥ ࠭ + .tim_co dd ? ;+162 ६ ᫥ 梥⮢ ࠧ⪨ + .el_focus dd el_focus ;+166 㪠⥫ ६ 䮪 + .err_save db 0 ;+170 訡 ࠭ 䠩 + .panel_id db 0 ;+171 ⮩ .key_new db 0 ;+172 ᨬ, 㤥 .symbol_new_line db 20 ;+173 ᨬ 襭 ப - .scr_w dd wScr ;+174 ⨪ ஫ - .scr_h dd hScr ;+178 ਧ⠫ ஫ - .panel_id db 0 ;+182 ⮩ + .scr_w dd wScr ;+174 ⨪ ஫ + .scr_h dd hScr ;+178 ਧ⠫ ஫ + .arr_key_pos dd 0 ;+182 㪠⥫ ᨢ 権 祢 ᫮ + .buffer dd buf ;+186 㪠⥫ ஢/⠢ + .buffer_find dd buf_find ;+190 㪠⥫ ᪠ + .cur_ins db 1 ;+194 ० ࠡ ( ) + .mode_color db 1 ;+195 ० 뤥 ᫮ 梥⮬ (0-몫. 1-.) + .mode_invis db 0 ;+196 ० ⠥ ᨬ + .gp_opt db 0 ;+197 樨 頥 㭪樥 ted_get_pos_by_cursor + .fun_on_key_ctrl_o dd ted_but_open_file ;+198 㪠⥫ 㭪 뢠 ⨨ Ctrl+O (⨥ 䠩) + .fun_on_key_ctrl_f dd ted_but_find ;+202 ... Ctrl+F (맮/ ᪠) + .fun_on_key_ctrl_n dd ted_but_new_file ;+206 ... Ctrl+N (ᮧ 㬥) + .fun_on_key_ctrl_s dd 0 ;+210 ... Ctrl+S + .buffer_size dd BUF_SIZE ;+214 ࠧ ஢/⠢ + .fun_find_err dd ted_on_find_err ;+218 㪠⥫ 㭪 뢠 ᫨ 稫 㤠筮 + .fun_init_synt_err dd ted_on_init_synt_err ;+222 㪠⥫ 㭪 뢠 訡筮 ⨨ 䠩 ᨭ⠪ + .fun_draw_panel_buttons dd draw_but_toolbar ;+226 㪠⥫ 㭪 ᮢ + .fun_draw_panel_find dd draw_panel_find ;+230 㪠⥫ 㭪 ᮢ ᪠ + .fun_draw_panel_syntax dd draw_panel_syntax ;+234 㪠⥫ 㭪 ᮢ ᨭ⠪ + .fun_save_err dd ted_save_err_msg ;+238 㪠⥫ 㭪 뢠 ᫨ ࠭ 䠩 稫 㤠筮 ;------------------------------------------------------------------------------ -FkPos: rd 256 conv_tabl rb 128 ; ⠡ ஢ scan- ascii- - +buf db BUF_SIZE dup(0) el_focus 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,\ - 16,16, 0x8080ff,0x0000ff,0xffffff, 0,70,TE_PANEL_WIDTH-17,120, 0,0,0, el_focus,\ + 16,16, 0x8080ff,0x0000ff,0xffffff, 0,70,TED_PANEL_WIDTH-17,120, 0,0,0, el_focus,\ ws_dir_lbox,0 ;dir_list memory @@ -426,7 +422,6 @@ tree_file_struct: dir_mem rb 32+304*count_of_dir_list_files - if lang eq ru menu_text_area: @@ -525,11 +520,6 @@ txtFindCapt db ' txtFindNext db ' ',0 txtFormatCapt db 'ଠ',0 txtFormatApply db 'ਬ',0 -txtRow db 'ப',0 -txtCol db '',0 -txtOtm db '⬥',0 -txtBuf db ': ' -buf db BUF_SIZE dup(0) ;buf txtBuf else @@ -629,66 +619,9 @@ txtFindCapt db 'Search',0 txtFindNext db 'Find next',0 txtFormatCapt db 'Format',0 txtFormatApply db 'Apply',0 -txtRow db 'Rows',0 -txtCol db 'Cols',0 -txtOtm db 'Undo',0 -txtBuf db 'Buffer: ' -buf db BUF_SIZE dup(0) ;buf always after txtBuf end if ;------ -align 4 -EvChar db 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - -EvUpper db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79 - db 80,81,82,83,84,85,86,87,88,89,90,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -EvLover db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111 - db 112,113,114,115,116,117,118,119,120,121,122,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -conv_table dd 0 - KM_SHIFT equ 0x00010000 KM_CTRL equ 0x00020000 diff --git a/programs/other/t_edit/t_draw.inc b/programs/other/t_edit/t_draw.inc index 7cef38da29..1236fced52 100644 --- a/programs/other/t_edit/t_draw.inc +++ b/programs/other/t_edit/t_draw.inc @@ -1,133 +1,6 @@ align 4 -proc mouse_wnd_main, edit:dword - push eax ebx ecx edi - mcall 37,2 ;get mouse buttons - - mov edi,dword[edit] - - cmp al,1 - jne @f - mcall 37,1 ;get mouse coords - mov ebx,ted_wnd_t - add ebx,ted_rec_t - cmp ax,bx - jl @f ;y_mousey_wnd - - mov ebx,ted_wnd_l - add ebx,ted_rec_l - mov ecx,eax - shr ecx,16 - cmp cx,bx - jl @f ;x_mousex_wnd - - stdcall draw_cursor_sumb, tedit0 - call wnd_main_click - jmp .no_in_wnd - @@: - call wnd_main_mouse_scroll - cmp ted_drag_m,0 - je .no_in_wnd - mov ted_drag_m,0 - call draw_but_toolbar - stdcall draw_main_win, tedit0 - .no_in_wnd: - pop edi ecx ebx eax - ret -endp - -;input: -; eax -> (x,y) -; edi -> tedit -;description: -; -align 4 -wnd_main_click: - push ecx edx - - push eax - shr eax,16 - and eax,0xffff - sub eax,ted_wnd_l - sub eax,ted_rec_l - - xor edx,edx - mov ecx,ted_rec_w - div cx - ;inc eax - cmp eax,[hScr.cur_area] - jle @f - mov eax,[hScr.cur_area] - @@: - ;dec eax - mov ted_cur_x,eax - pop eax - - push eax - and eax,0xffff - sub eax,ted_wnd_t - sub eax,ted_rec_t - - xor edx,edx - mov ecx,ted_rec_h - div cx - inc eax - cmp eax,[wScr.cur_area] - jle @f - mov eax,[wScr.cur_area] - @@: - dec eax - mov ted_cur_y,eax - pop eax - - cmp ted_drag_m,0 - je @f - stdcall SelMove,edi - jmp .sel_move - @@: - mov ted_drag_m,1 - stdcall SelStart,edi - .sel_move: - pop edx ecx - ret - -align 4 -wnd_main_mouse_scroll: - push eax ebx - mcall 37,7 - cmp ax,0 - je .no_scroll - mov ebx,dword[wScr.position] ;copy old scroll position - and eax,0xffff - btr ax,15 - jae @f - or eax,0xffff8000 - @@: - add dword[wScr.position],eax - - mov eax,[wScr.position] - cmp eax,[wScr.max_area] - jb @f - mov dword[wScr.position],ebx ;if scroll position out of range - jmp .no_scroll - @@: - stdcall draw_main_win, tedit0 - .no_scroll: - pop ebx eax - ret - -align 4 -draw_but_toolbar: ; - push ebx ecx edx edi +draw_but_toolbar: ; + pushad mov edi,tedit0 mov ecx,0x40000000 @@ -140,7 +13,7 @@ draw_but_toolbar: ; mov edx,110*65536+2 call draw_but_icon -stdcall ted_can_save,edi +stdcall [ted_can_save],edi cmp al,1 je @f and ecx,0xffff @@ -155,7 +28,7 @@ or ecx,0x40000000 mov edx,85*65536+25 call draw_but_icon -stdcall IsSel,edi +call [ted_is_select] cmp al,0 jne @f and ecx,0xffff @@ -176,7 +49,7 @@ and ecx,0xffff mov edx,290*65536+25 call draw_but_icon - inc cx ; Reverse + inc cx ; reverse mov edx,315*65536+25 call draw_but_icon or ecx,0x40000000 @@ -233,262 +106,26 @@ or ecx,0x40000000 mov edx,450*65536+25 call draw_but_icon - pop edi edx ecx ebx - ret - -;input: -; clear_o - =1 , =0 -align 4 -proc clear_line_before_draw, edit:dword, coords:dword, clear_o:dword, numb_lin:dword - pushad - mov edi,dword[edit] - mov ebx,dword[coords] ;ebx = x*2^16+y coords to left up point clear line - mov esi,dword[numb_lin] ;esi - number text line - - sub ebx,0x10001 ; - cmp dword[clear_o],0 - jne @f - add ebx,ted_rec_h - inc esi - ror ebx,16 - xor bx,bx - add ebx,ted_wnd_l - add ebx,ted_rec_l ;bx = ted_wnd_l+ted_rec_l - ror ebx,16 - @@: - - mov eax,ted_wnd_h - add eax,ted_wnd_t - cmp ax,bx - jl .no_clear - sub ax,bx - - mov cx,bx - shl ecx,16 - - xor bx,bx - add ebx,ted_wnd_w - sub ebx,ted_rec_l - xor cx,cx - add ecx,ted_rec_h - mov edx,ted_color_wnd_work - - cmp dword[clear_o],0 - je .pusto - cmp ax,cx - jge @f - .pusto: - mov cx,ax - @@: - - stdcall IsSel,edi - cmp al,0 - je @f - cmp ted_seln_y0,esi - jg @f - cmp ted_seln_y1,esi - jl @f - mov edx,ted_color_select ;draw selected line - @@: - - mov eax,13 ;rect - int 0x40 - - stdcall IsSel,edi - cmp al,0 - je .no_clear - - mov al,13 ;rect - xor cx,cx - add ecx,ted_rec_h - cmp ted_seln_y0,esi - jne @f - push bx - mov edx,ted_seln_x0 ; ( ) - cmp edx,[hScr.position] - jle .in_wnd - sub edx,[hScr.position] - imul edx,ted_rec_w - mov bx,dx - jmp .no_wnd - .in_wnd: - mov bx,0 - .no_wnd: - mov edx,ted_color_wnd_work - int 0x40 - pop bx - @@: - cmp ted_seln_y1,esi - jne @f - mov edx,ted_seln_x1 ; ( ) - cmp edx,[hScr.position] - jle .in_wnd2 - sub edx,[hScr.position] - imul edx,ted_rec_w - sub bx,dx - shl edx,16 - add ebx,edx - .in_wnd2: - - mov edx,ted_color_wnd_work - int 0x40 - @@: - - .no_clear: popad ret -endp - -align 4 -proc draw_main_win, edit:dword - locals - line_num dd ? - endl - pushad - mov edi,dword[edit] - - mov eax,4 ;draw text - mov ecx,ted_text_colors - mov ecx,dword[ecx] - - mov ebx,ted_wnd_l - add ebx,ted_rec_l - shl ebx,16 - add ebx,ted_wnd_t - add ebx,ted_rec_t - add ebx,0x10001 ; - - stdcall SelNormalize,edi ;need before draw select - mov esi,[wScr.position] - mov dword[line_num],esi - - stdcall clear_line_before_draw, edi,ebx,1,esi - call GetFirstVisiblePos - cmp edx,0 - je .no_draw_text - mov esi,1 ; 1- - @@: - call IteratNext - cmp edx,ted_tex_1 - jle .no_draw_text - - ; *** - cmp ted_mode_color,0 - je .no_col_change - cmp byte[edx+1],0 - je .no_col_change - call GetSymbColor - .no_col_change: - - cmp byte [edx],13 - jne .no_13 - cmp ted_mode_invis,1 - jne .no_invis - push edx - mov edx,edi - add edx,ted_offs_symbol_new_line - int 0x40 - pop edx - .no_invis: - add ebx,ted_rec_h - ;optimized output \/ - mov eax,ted_wnd_h - add eax,ted_wnd_t - cmp bx,ax - jg .no_draw_text - mov eax,4 - ;optimized output /\ - and ebx,0xffff - ror ebx,16 - add ebx,ted_wnd_l - add ebx,ted_rec_l - inc ebx - ror ebx,16 - inc dword[line_num] ;increment line number - stdcall clear_line_before_draw,edi,ebx,1,dword[line_num] - call OptDrawLineLeft - jmp @b - .no_13: - - int 0x40 - ror ebx,16 - add ebx,ted_rec_w - mov esi,ted_wnd_l - add esi,ted_wnd_w - cmp bx,si - jl .no_opt - call OptDrawLineRight - .no_opt: - mov si,1 - ror ebx,16 - jmp @b - .no_draw_text: - - stdcall clear_line_before_draw,edi,ebx,0,dword[line_num] - stdcall draw_line_numbers,edi - stdcall draw_main_cursor,edi - -;--------------------------------------------- -; set all_redraw flag for draw all ScrollBar -; In some cases it is necessity to draw only the area -; of moving of a "runner", for acceleration of output - -; in this case the flag needs to be reset to 0 (zero). - xor eax,eax - inc eax - mov [wScr.all_redraw],eax - mov [hScr.all_redraw],eax - -; draw for Vertical ScrollBar - stdcall [scrollbar_ver_draw], dword wScr - stdcall [scrollbar_hor_draw], dword hScr -; reset all_redraw flag - xor eax,eax - mov [wScr.all_redraw],eax - mov [hScr.all_redraw],eax -;--------------------------------------------- - - mov eax,13 - ;left-bottom square - mov ebx,ted_wnd_l - shl ebx,16 - add ebx,ted_rec_l - mov ecx,ted_wnd_t - add ecx,ted_wnd_h - shl ecx,16 - mov cx,word[hScr.size_y] - inc cx - mov edx,[sc.work] - int 0x40 - - ;right-bottom square - mov ebx,ted_wnd_l - add ebx,ted_wnd_w - shl ebx,16 - mov bx,word[wScr.size_x] - inc bx - int 0x40 - - stdcall draw_panel_find, edi - stdcall draw_panel_syntax, edi - popad - ret -endp ;txtBUp db 24 ;txtBDn db 25 ;txtBRi db 26 ;txtBLe db 27 -align 4 -proc draw_panel_find, edit:dword - push edi - mov edi,dword[edit] - cmp ted_panel_id,TE_PANEL_FIND ;if not panel +;input: +; edi = pointer to tedit struct +align 4 +proc draw_panel_find +;push edi +;mov edi,dword[edit] + cmp ted_panel_id,TED_PANEL_FIND ;if not panel jne @f push eax ebx ecx edx mov eax,13 ; - mov ebx,TE_PANEL_WIDTH + mov ebx,TED_PANEL_WIDTH mov ecx,ted_wnd_t shl ecx,16 mov cx,20 @@ -506,12 +143,13 @@ proc draw_panel_find, edit:dword stdcall [edit_box_draw], dword edit2 mov eax,13 ; - mov ebx,TE_PANEL_WIDTH + mov ebx,TED_PANEL_WIDTH mov ecx,ted_wnd_t add cx,20+15 ; 15 - height text box shl ecx,16 add ecx,ted_wnd_h - add cx,word[hScr.size_y] + mov edx,ted_scr_h + add cx,word[edx+sb_offs_size_y] sub cx,20+15-1 ; 15 - height text box mov edx,[sc.work] int 0x40 @@ -544,22 +182,22 @@ proc draw_panel_find, edit:dword int 0x40 pop edx eax .end_f: - pop edi +;pop edi ret endp - +;input: +; edi = pointer to tedit struct align 4 -proc draw_panel_syntax, edit:dword - push edi - mov edi,dword[edit] - - cmp ted_panel_id,TE_PANEL_SYNTAX ;if not panel +proc draw_panel_syntax +;push edi +;mov edi,dword[edit] + cmp ted_panel_id,TED_PANEL_SYNTAX ;if not panel jne @f - push eax ebx ecx edx + pushad mov eax,13 ; - mov ebx,TE_PANEL_WIDTH + mov ebx,TED_PANEL_WIDTH mov ecx,ted_wnd_t shl ecx,16 mov cx,20 @@ -576,7 +214,8 @@ proc draw_panel_syntax, edit:dword and ecx,0xffff ror ecx,16 add ecx,ted_wnd_h - add cx,word[hScr.size_y] + mov esi,ted_scr_h + add cx,word[esi+sb_offs_size_y] sub cx,20 sub ecx,dword[tree1.box_height] inc cx @@ -607,7 +246,7 @@ proc draw_panel_syntax, edit:dword mov edx,txtFormatApply int 0x40 - pop edx ecx ebx eax + popad jmp .end_f @@: push eax edx @@ -617,79 +256,7 @@ proc draw_panel_syntax, edit:dword int 0x40 ; pop edx eax .end_f: - pop edi - ret -endp - - -align 4 -proc draw_cur_line, edit:dword - pushad - mov edi,dword[edit] - - mov ebx,ted_wnd_l - add ebx,ted_rec_l - shl ebx,16 - mov eax,ted_cur_y - imul eax,ted_rec_h - mov bx,ax - add ebx,ted_wnd_t - add ebx,ted_rec_t ;ebx - - add ebx,0x10001 ; - - stdcall SelNormalize,edi ;need before draw select - mov ecx,ted_cur_y - add ecx,[wScr.position] - stdcall clear_line_before_draw, tedit0, ebx,1,ecx - - mov esi,[hScr.position] - call GetPosByParam - - cmp ted_gp_opt,2 - jne .no_draw_text -; mov eax,4 ;draw text - call GetSymbColor - mov esi,1 ;draw 1 symbol - @@: - ;call IteratNext - cmp edx,ted_tex_1 - jle .no_draw_text - - ; *** - cmp ted_mode_color,0 - je .no_col_change - cmp byte[edx+1],0 - je .no_col_change - call GetSymbColor - .no_col_change: - - mov eax,4 ;draw text - cmp byte [edx],13 - jne .no_13 - cmp ted_mode_invis,1 - jne .no_draw_text - push edx - mov edx,edi - add edx,ted_offs_symbol_new_line - int 0x40 - pop edx - jmp .no_draw_text - .no_13: - - int 0x40 - ror ebx,16 - add ebx,ted_rec_w - mov eax,ted_wnd_w - add eax,ted_wnd_l ;ax = x - cmp bx,ax - jge .no_draw_text ;Opt - ror ebx,16 - call IteratNext - jmp @b - .no_draw_text: - - stdcall draw_main_cursor,edi - popad +;pop edi ret endp @@ -698,13 +265,15 @@ MIN_W_SCRL_ARE equ 3 MIN_H_SCRL_ARE equ 3 align 4 proc EvSize, edit:dword - push eax ecx edx edi + pushad mov edi,dword[edit] + mov ebx,ted_scr_h + mov esi,ted_scr_w m2m ted_wnd_w,[procinfo.client_box.width] ; mov eax,ted_wnd_l sub ted_wnd_w,eax ; - mov eax,[wScr] ;+0 size_x + mov eax,dword[esi+sb_offs_size_x] and eax,0xffff sub ted_wnd_w,eax ; . @@ -714,26 +283,26 @@ proc EvSize, edit:dword mov ted_wnd_h,MIN_M_WND_H @@: - mov ax,word[hScr.size_y] + mov ax,word[ebx+sb_offs_size_y] and eax,0xffff sub ted_wnd_h,eax ; . - mov eax,ted_wnd_h ;eax = - . - mov word[hScr.start_y],ax ; . + mov eax,ted_wnd_h ;eax = - . + mov word[ebx+sb_offs_start_y],ax ; . mov eax,ted_wnd_t sub ted_wnd_h,eax ; mov eax,ted_wnd_w mov ecx,ted_wnd_l add eax,ecx - mov word[wScr.start_x],ax ; . + mov word[esi+sb_offs_start_x],ax ; . mov eax,ted_wnd_h - mov word[wScr.size_y],ax ; . + mov word[esi+sb_offs_size_y],ax ; . add ecx,ted_rec_l ;ecx=ted_wnd_l+ted_rec_l - mov [hScr.start_x],cx ; . + mov word[ebx+sb_offs_start_x],cx ; . mov eax,ted_wnd_w sub eax,ted_rec_l - mov word[hScr.size_x],ax ; . + mov word[ebx+sb_offs_size_x],ax ; . mov eax,ted_wnd_h ;calculate lines in page sub eax,ted_rec_t @@ -744,7 +313,7 @@ proc EvSize, edit:dword jg @f mov eax,MIN_W_SCRL_ARE @@: - mov [wScr.cur_area],eax + mov dword[esi+sb_offs_cur_area],eax mov eax,ted_wnd_w ;calculate cols in page sub eax,ted_rec_l @@ -756,7 +325,7 @@ proc EvSize, edit:dword mov eax,MIN_H_SCRL_ARE @@: dec eax ; ??? - mov [hScr.cur_area],eax + mov dword[ebx+sb_offs_cur_area],eax mov eax,ted_wnd_t mov edi,dword tree1 @@ -766,596 +335,55 @@ proc EvSize, edit:dword mov dword[edit2.top],eax ;=ted_wnd_t add dword[edit2.top],20 - pop edi edx ecx eax - call OnInitialUpdate - ret -endp - -align 4 -OnInitialUpdate: - mov [wScr.redraw],1 - mov [hScr.redraw],1 - ret - -;input: -; edi = pointer to tedit struct -;output: -; ecx = -; edx = pointer to symbol -; edx = 0 if text not in screen -align 4 -GetFirstVisiblePos: - push ecx - mov edx,ted_tex - xor ecx,ecx - @@: - cmp ecx,[wScr.position] - je @f - call IteratNext - cmp edx,ted_tex_1 - jle @f - cmp byte [edx],13 - jne @b - inc ecx - jmp @b - @@: - - cmp ecx,[wScr.position] - je @f - xor edx,edx - @@: - cmp ecx,[wScr.max_area] - jle @f - mov [wScr.max_area],ecx - @@: - pop ecx - call OptDrawLineLeft - ret - - - -;input: -; edx = pointer to symbol -; edi = pointer to tedit struct -;output: -; ecx = -; edx = -align 4 -proc OptDrawLineLeft - push ebx - - mov ebx,[hScr.position] - cmp ebx,0 - je .ret_f - push eax - mov eax,edx - - cmp edx,ted_tex - jne @f - call IteratNext - jmp .beg_cycle - @@: - - cmp ebx,0 - je @f - - cmp byte[edx],13 - jne @f - call IteratNext - .beg_cycle: - @@: - cmp edx,ted_tex_1 - jle @f - cmp byte[edx],13 - je @f - cmp ebx,0 - je @f -;-------------------------------------- -xor eax,eax ;eax -mov al,byte[edx+1] -cmp al,0 -je .no_color -cmp eax,ted_colors_text_count -jge .no_color - xor ecx,ecx - mov cl,byte[edx+1] - shl cx,2 - add ecx,ted_text_colors - mov ecx,dword[ecx] -.no_color: -;-------------------------------------- - mov eax,edx - call IteratNext - dec ebx - jmp @b - @@: - mov edx,eax - pop eax - .ret_f: - call GetSymbColor - pop ebx - ret -endp - -;input: -; edx = pointer to symbol -; edi = pointer to tedit struct -;output: -; edx = pointer to 13 symbol -align 4 -proc OptDrawLineRight - push eax - mov eax,edx - @@: - cmp edx,ted_tex_1 - jle @f - cmp byte[edx],13 - je @f - mov eax,edx - call IteratNext - jmp @b - @@: - mov edx,eax ;perv sumbol - call GetSymbColor - - pop eax - ret -endp - -align 4 -proc draw_main_cursor, edit:dword - pushad - mov edi,dword[edit] - - mov eax,13 ;draw cursor - mov ecx,ted_wnd_t ;calc rect -> y0,y1 - add ecx,ted_rec_t - mov edx,ted_cur_y - imul edx,ted_rec_h - add ecx,edx - - cmp ted_cur_ins,1 ; ( ) - jne @f - mov edx,ted_rec_h - inc edx ;1->1, 3->2, 5->3, ... - shr edx,1 ;edx = 2 ( ) - add ecx,edx - @@: - shl ecx,16 - add ecx,ted_rec_h - cmp ted_cur_ins,1 - jne @f - shr cx,1 ; 2 - @@: - - mov ebx,ted_wnd_l ;calc rect -> x0,x1 - add ebx,ted_rec_l - mov edx,ted_cur_x - imul edx,ted_rec_w - add ebx,edx - shl ebx,16 - add ebx,ted_rec_w - - mov edx,ted_color_cursor - int 0x40 ; - - call GetPos - cmp ted_gp_opt,2 - jne @f - mov eax,4 ;draw text - mov esi,1 - ror ecx,16 - mov bx,cx - add ebx,0x10001 - cmp ted_cur_ins,1 - jne .no_up_tetx - mov ecx,ted_rec_h - inc cx ; 1->1, 3->2, 5->3, ... - shr cx,1 - sub bx,cx - .no_up_tetx: - mov ecx,ted_color_cur_text - call ConvertInvisSymb - int 0x40 - @@: - - mov eax,4 - mov ebx,ted_wnd_l - add ebx,ted_rec_l - shl ebx,16 - add ebx,ted_wnd_t - add ebx,3 - mov ecx,ted_color_wnd_bord - or ecx,0x80000000 - mov edx,txtRow - int 0x40 ; '' - - add ebx,0x500000 - mov edx,txtCol - int 0x40 ; '' - - cmp ted_tim_undo,0 - je @f - add ebx,0x500000 - mov edx,txtOtm - int 0x40 - sub ebx,0x500000 - @@: - - stdcall draw_bufer,edi - stdcall draw_help_f1 - - mov eax,47 ;draw cursor coords - mov esi,ted_color_wnd_bord - or esi,0x40000000 - - mov edx,ebx - ror edx,16 - sub edx,35 - ror edx,16 - ;add edx,3 - mov ebx,0x40000 ;Row=... - mov ecx,ted_cur_y - inc ecx - add ecx,[wScr.position] - -push edi - mov edi,ted_color_wnd_work - int 0x40 ; -pop edi - - ;mov ebx,0x40000 ;Col=... - mov ecx,ted_cur_x - inc ecx - add ecx,[hScr.position] - add edx,0x500000 -push edi - mov edi,ted_color_wnd_work - int 0x40 ; -pop edi - - cmp ted_tim_undo,0 - je @f - mov ecx,ted_tim_undo - add edx,0x500000 - int 0x40 - @@: - popad ret endp -align 4 -proc draw_bufer, edit:dword - pushad - mov edi,dword[edit] - - cmp byte[buf],0 - je @f - mov ebx,ted_wnd_l - add ebx,ted_rec_l - add bx,250 - shl ebx,16 - add ebx,ted_wnd_t - add ebx,3 - mov ecx,ted_color_wnd_bord - or ecx,0x40000000 - mov edi,ted_color_wnd_work - - mov edx,txtBuf - mov esi,buf - call strlen -if lang eq ru - cmp eax,15 - jle .crop_buf - mov eax,15 - .crop_buf: - mov esi,7 ;7=len(txtBuf) -else - cmp eax,14 - jle .crop_buf - mov eax,14 - .crop_buf: - mov esi,8 ;8=len(txtBuf) -end if - add esi,eax - - mov eax,4 - int 0x40 - @@: - popad - ret -endp - -;input: -; edi = pointer to tedit struct -align 4 -proc draw_help_f1 - pushad - - mov eax,13 ;clear place before draw help - mov ebx,ted_wnd_l - add ebx,ted_rec_l - shl ebx,16 - add ebx,ted_wnd_w - sub ebx,ted_rec_l - mov ecx,ted_wnd_t - add ecx,13 - shl ecx,16 - add ecx,ted_rec_h - mov edx,ted_color_wnd_capt - int 0x40 - - cmp ted_help_id,-1 - je @f - mov eax,ted_help_id - ColToIndexOffset eax,edx - - ;SetCoordinates - mov ebx,ted_wnd_l - add ebx,ted_rec_l - shl ebx,16 - add ebx,ted_wnd_t - add ebx,13 ;=3+10 - - ;SetTextColor - xor eax,eax - mov al,byte[edx+MAX_COLOR_WORD_LEN+6] - shl ax,2 - mov ecx,ted_text_colors - add ecx,eax - mov ecx,dword[ecx] - or ecx,0xc0000000 ;SetTextStyles - mov esi,edi - mov edi,ted_color_wnd_work - mov eax,4 - int 0x40 - mov edi,esi - - ;*** draw help string *** - mov ecx,ted_color_wnd_bord - or ecx,0x80000000 - mov edx,dword[edx+MAX_COLOR_WORD_LEN] - cmp edx,0 - je @f - add edx,ted_help_text_f1 - add ebx,0x500000 - int 0x40 - @@: - popad - ret -endp - -align 4 -proc draw_line_numbers, edit:dword - pushad - mov edi,dword[edit] - - ;top panel with caption - mov ebx,ted_wnd_l -; add ebx,ted_rec_l - shl ebx,16 - add ebx,ted_wnd_w -; sub ebx,ted_rec_l - mov edx,ted_color_wnd_work - mov ecx,ted_wnd_t - shl ecx,16 - add ecx,ted_rec_t - mov eax,13 - mov edx,ted_color_wnd_capt - int 0x40 - - ;line numbers - mov ebx,0x40000 ;format - mov ecx,[wScr.position] - inc ecx - mov edx,3 - add edx,ted_wnd_l - rol edx,16 - add edx,ted_wnd_t - add edx,ted_rec_t - @@: - -push ebx ecx edx - ;left panel with numbers - mov ebx,ted_wnd_l - shl ebx,16 - add ebx,ted_rec_l - mov ecx,ted_rec_h - rol ecx,16 - mov cx,dx - rol ecx,16 - mov eax,13 - mov edx,ted_color_wnd_capt - int 0x40 ; -pop edx ecx ebx - - mov eax,47 - mov esi,ted_color_wnd_bord - int 0x40 ; - inc ecx - add edx,ted_rec_h - sub edx,ted_wnd_t - mov esi,edx - and esi,0xffff - cmp esi,ted_wnd_h - jge @f - add edx,ted_wnd_t - jmp @b - @@: - - popad - ret -endp - -;this function need to optimize output -align 4 -proc draw_cursor_sumb, edit:dword - push eax ecx edx edi - mov edi,dword[edit] - - mov eax,13 ;rect - mov ebx,ted_wnd_l - add ebx,ted_rec_l - mov edx,ted_cur_x - imul edx,ted_rec_w - add ebx,edx - shl ebx,16 - add ebx,ted_rec_w - - mov ecx,ted_wnd_t ;calc rect -> y0,y1 - add ecx,ted_rec_t - mov edx,ted_cur_y - imul edx,ted_rec_h - add ecx,edx - shl ecx,16 - add ecx,ted_rec_h - - mov edx,ted_color_wnd_work - push ecx - stdcall SelNormalize,edi - - mov ecx,[wScr.position] - sub ted_seln_y0,ecx - sub ted_seln_y1,ecx - - mov ecx,ted_cur_y - cmp ecx,ted_seln_y0 - jl .no_cur_sel - cmp ecx,ted_seln_y1 - jg .no_cur_sel - mov edx,ted_color_select - - cmp ecx,ted_seln_y0 - jne @f - mov ecx,ted_cur_x - add ecx,[hScr.position] - cmp ecx,ted_seln_x0 - jge @f - mov edx,ted_color_wnd_work - @@: - - mov ecx,ted_cur_y - cmp ecx,ted_seln_y1 - jne .no_cur_sel - mov ecx,ted_cur_x - add ecx,[hScr.position] - cmp ecx,ted_seln_x1 - jl .no_cur_sel - mov edx,ted_color_wnd_work - - .no_cur_sel: - pop ecx - int 0x40 - - call GetPos - cmp ted_gp_opt,2 - jne @f - push esi - mov eax,4 ;draw text - mov esi,1 - ror ecx,16 - mov bx,cx - add ebx,0x10001 - call GetSymbColor - call ConvertInvisSymb - int 0x40 - pop esi - @@: - - pop edi edx ecx eax - ret -endp - - -;input: -; edx -> pointer to text -; edi -> tedit -;output: -; ecx = color -; if ted_mode_color=0 then ecx=ted_color_wnd_text -align 4 -GetSymbColor: - mov ecx,ted_color_wnd_text ; - - push eax edx - cmp ted_mode_color,0 - je .exit - jmp .on_first - @@: - call IteratPerv - cmp edx,ted_tex_1 - jle .exit - .on_first: - xor eax,eax - mov al,byte[edx+1] - cmp al,0 ; al=0 - je @b - - cmp eax,ted_colors_text_count - jge .exit - - shl ax,2 ; 4 - mov ecx,ted_text_colors ; 1- - add ecx,eax - mov ecx,dword[ecx] ; - .exit: - pop edx eax - ret - -;input: -; edx = pointer to text -; edi = pointer to tedit struct -align 4 -ConvertInvisSymb: - cmp ted_mode_invis,1 - jne @f - cmp byte [edx],13 - jne @f - mov edx,edi - add edx,ted_offs_symbol_new_line - @@: - ret - ;input: ; ecx = 0x4000____ ; cx = icon index ; edx = x*2^16+y align 4 draw_but_icon: - push eax ebx + push eax ebx - mov eax,8 ; - push ecx edx esi - mov ebx,edx - mov edx,ecx - add edx,3 - mov cx,bx - shl ecx,16 - mov cx,19 ;=20-1 - mov bx,19 ;=20-1 - mov esi,[sc.work_button] - int 0x40 - pop esi edx ecx + mov eax,8 ; + push ecx edx esi + mov ebx,edx + mov edx,ecx + add edx,3 + mov cx,bx + shl ecx,16 + mov cx,19 ;=20-1 + mov bx,19 ;=20-1 + mov esi,ebx + shr esi,16 + add esi,20 + cmp esi,[procinfo.client_box.width] + jge @f ; + mov esi,[sc.work_button] + int 0x40 ; + mov eax,7 ;bmp + @@: + pop esi edx ecx - mov ebx,ecx - ror ebx,16 - cmp bx,0x4000 - jne @f - - mov eax,7 ;bmp - mov ebx,[bmp_icon] - push ecx - and ecx,0xffff - imul ecx,1200 - add ebx,ecx - mov ecx,20 - shl ecx,16 - add ecx,20 - int 0x40 - pop ecx - - @@: - pop ebx eax - ret + cmp eax,7 + jne @f ; + mov ebx,ecx + ror ebx,16 + cmp bx,0x4000 + jne @f + mov ebx,[bmp_icon] + push ecx + and ecx,0xffff + imul ecx,1200 + add ebx,ecx + mov ecx,20 + shl ecx,16 + add ecx,20 + int 0x40 ; + pop ecx + @@: + pop ebx eax + ret diff --git a/programs/other/t_edit/t_edit.asm b/programs/other/t_edit/t_edit.asm index 8530e2346a..9271d5b963 100644 --- a/programs/other/t_edit/t_edit.asm +++ b/programs/other/t_edit/t_edit.asm @@ -16,8 +16,8 @@ use32 MAX_COLOR_WORD_LEN equ 40 maxChars equ 100002 ;(...+2) -BUF_SIZE equ 1000 ;bufer for copy|paste -maxColWords equ 10000 +BUF_SIZE equ 1000 ;buffer for copy|paste +maxSyntaxFileSize equ 410000 include '../../proc32.inc' include '../../macros.inc' @@ -27,9 +27,8 @@ include '../../develop/libraries/box_lib/trunk/box_lib.mac' include 'lang.inc' include 't_data.inc' include 'strlen.inc' -include 't_work.inc' ;text work functions include 't_draw.inc' ;draw main window functions -include 't_button.inc' +include 't_button.inc' ;text work functions @use_library @@ -37,14 +36,15 @@ align 4 start: mcall 48,3,sc,sizeof.system_colors - m2m [wScr.bckg_col],[sc.work] - m2m [wScr.frnt_col],[sc.work_button] - m2m [wScr.line_col],[sc.work_button_text] - - m2m [hScr.bckg_col],[sc.work] - m2m [hScr.frnt_col],[sc.work_button] - m2m [hScr.line_col],[sc.work_button_text] - + mov eax,[sc.work] + mov [wScr.bckg_col],eax + mov [hScr.bckg_col],eax + mov eax,[sc.work_button] + mov [wScr.frnt_col],eax + mov [hScr.frnt_col],eax + mov eax,[sc.work_button_text] + mov [wScr.line_col],eax + mov [hScr.line_col],eax mcall 68,11 or eax,eax @@ -75,7 +75,7 @@ load_libraries l_libs_start,load_lib_end @@: ;--------------------------------------------------------------------- - stdcall ted_init, tedit0 + stdcall [ted_init], tedit0 stdcall dword[tl_data_init], tree1 ;--------------------------------------------------------------------- @@ -174,7 +174,10 @@ mov ecx,ebx .end_dir_init: ;--- load color option file --- - stdcall InitColText, tedit0 + mov ebx,dword[fn_col_option] + copy_path ebx,fn_syntax_dir,file_name_rez,0x0 + copy_path file_name_rez,sys_path,file_name,0x0 + stdcall [ted_init_syntax_file], tedit0,run_file_70,file_name ;--- get cmd line --- cmp byte[buf_cmd_lin+3],0 ;buf_cmd_lin @@ -202,7 +205,7 @@ red_win: mcall 9,procinfo,-1 stdcall EvSize,edi - mov eax,13 ; , + mov eax,13 ;孨 אַ㣮쭨, ⪨ 孥 xor ebx,ebx mov ecx,ted_wnd_t mov bx,word [procinfo.client_box.width] @@ -234,7 +237,7 @@ red_win: cmp [err_ini0],1 je @f - stdcall draw_main_win, tedit0 + stdcall [ted_draw], tedit0 @@: mcall 12,2 @@ -263,53 +266,13 @@ mouse: test word [edit1.flags],10b;ed_focus ; ᫨ 䮪, 室 jne still -;----------------------------------------------- - cmp [hScr.delta2],0 - jne .horizontal -.vertical: - mov eax,[wScr.max_area] - cmp eax,[wScr.cur_area] - jbe .horizontal -; mouse event for Vertical ScrollBar - stdcall [scrollbar_ver_mouse], dword wScr - mov eax,wScr.redraw - xor ebx,ebx - cmp [eax],ebx - je @f - mov [eax],ebx + stdcall [ted_mouse], tedit0 - stdcall draw_main_win, tedit0 - jmp still -@@: - cmp [wScr.delta2],0 - jne still -.horizontal: - mov eax,[hScr.max_area] - cmp eax,[hScr.cur_area] - jbe .other -; mouse event for Horizontal ScrollBar - push dword hScr - call [scrollbar_hor_mouse] - mov eax,hScr.redraw - xor ebx,ebx - cmp [eax],ebx - je .other - mov [eax],ebx - stdcall draw_main_win, tedit0 - jmp still -.other: - cmp [wScr.delta2],0 - jne still - cmp [hScr.delta2],0 - jne still - - stdcall mouse_wnd_main, tedit0 - - cmp byte[tedit0.panel_id],TE_PANEL_FIND ;if not panel + cmp byte[tedit0.panel_id],TED_PANEL_FIND ;if not panel jne @f stdcall [edit_box_mouse], dword edit2 @@: - cmp byte[tedit0.panel_id],TE_PANEL_SYNTAX ;if not panel + cmp byte[tedit0.panel_id],TED_PANEL_SYNTAX ;if not panel jne .menu_bar_1 ;@f stdcall [tl_mouse], tree1 ;----------------------------------------------- @@ -324,15 +287,15 @@ mouse: je button.exit cmp [menu_data_1.cursor_out],dword 3 jne @f - stdcall but_SaveFile, tedit0 + stdcall [ted_but_save_file], tedit0,run_file_70,[edit1.text] @@: cmp [menu_data_1.cursor_out],dword 2 jne @f - call but_OpenFile + call ted_but_open_file @@: cmp [menu_data_1.cursor_out],dword 1 jne @f - call but_NewFile + call ted_but_new_file @@: ;cmp [menu_data_1.cursor_out],dword 0 ;jne @f @@ -357,29 +320,30 @@ endp align 4 key: mcall 66,3 ;66.3 ﭨ ࠢ - xor ebx,ebx + xor esi,esi mov ecx,1 test al,0x03 ;[Shift] jz @f mov cl,2 - or ebx,KM_SHIFT + or esi,KM_SHIFT @@: test al,0x0c ;[Ctrl] jz @f - or ebx,KM_CTRL + or esi,KM_CTRL @@: test al,0x30 ;[Alt] jz @f mov cl,3 - or ebx,KM_ALT + or esi,KM_ALT @@: test al,0x80 ;[NumLock] jz @f - or ebx,KM_NUMLOCK + or esi,KM_NUMLOCK @@: + mcall 26,2,,conv_tabl ;26.2 ᪫ mcall 2 ;砥 ⮩ - ;stdcall [tl_key], tree1 ;??? + ;stdcall [tl_key], tree1 test word [edit1.flags],10b;ed_focus ; ᫨ 䮪, 室 je @f @@ -421,9 +385,10 @@ key: jmp still @@: - stdcall ted_key, tedit0, conv_tabl + stdcall [ted_key], tedit0, conv_tabl,esi jmp still +align 4 button: ; cmp [menu_active],1 ;᫨ , ᭠砫 ॠ ; jne @f ;mouse.menu_bar_1 @@ -434,35 +399,35 @@ button: mcall 17 ; ⮩ cmp ah,3 jne @f - call but_NewFile + call ted_but_new_file @@: cmp ah,4 jne @f - call but_OpenFile + call ted_but_open_file @@: cmp ah,5 jne @f - stdcall but_SaveFile, tedit0 + stdcall [ted_but_save_file], tedit0,run_file_70,[edit1.text] @@: cmp ah,6 jne @f - stdcall ted_but_select_word, tedit0 + stdcall [ted_but_select_word], tedit0 @@: cmp ah,7 jne @f - stdcall ted_but_cut, tedit0 + stdcall [ted_but_cut], tedit0 @@: cmp ah,8 jne @f - stdcall ted_but_copy, tedit0 + stdcall [ted_but_copy], tedit0 @@: cmp ah,9 jne @f - stdcall ted_but_paste, tedit0 + stdcall [ted_but_paste], tedit0 @@: cmp ah,10 jne @f - stdcall but_find, tedit0 + call ted_but_find @@: cmp ah,11 jne @f @@ -474,23 +439,23 @@ button: @@: cmp ah,13 jne @f - stdcall but_sumb_upper, tedit0 + stdcall [ted_but_sumb_upper], tedit0 @@: cmp ah,14 jne @f - stdcall but_sumb_lover, tedit0 + stdcall [ted_but_sumb_lover], tedit0 @@: cmp ah,15 jne @f - stdcall but_reverse, tedit0 + stdcall [ted_but_reverse], tedit0 @@: cmp ah,16 jne @f - stdcall ted_but_undo, tedit0 + stdcall [ted_but_undo], tedit0 @@: cmp ah,17 jne @f - stdcall ted_but_redo, tedit0 + stdcall [ted_but_redo], tedit0 @@: cmp ah,18 jne @f @@ -511,13 +476,13 @@ button: @@: cmp ah,201 jne @f - stdcall but_FindText, tedit0 + stdcall [ted_but_find_next], tedit0 @@: cmp ah,1 jne still .exit: - stdcall ted_can_save, tedit0 + stdcall [ted_can_save], tedit0 cmp al,1 jne @f stdcall [mb_create],msgbox_8,thread ;message: save changes in file? @@ -526,7 +491,7 @@ button: mov ecx,[bmp_icon] call mem_Free - stdcall ted_delete, tedit0 + stdcall [ted_delete], tedit0 stdcall dword[tl_data_clear], tree1 mcall -1 ;室 ணࠬ @@ -536,7 +501,7 @@ txtErrIni0 db ' err_ini0 db 0 edit1 edit_box 250, 220, 5, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_cmd_lin, mouse_dd, 0 -edit2 edit_box TE_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_find, mouse_dd, 0 +edit2 edit_box TED_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_find, mouse_dd, 0 buf_cmd_lin db 302 dup(0) buf_find db 302 dup(0) diff --git a/programs/other/t_edit/t_work.inc b/programs/other/t_edit/t_work.inc deleted file mode 100644 index 078489a9d3..0000000000 --- a/programs/other/t_edit/t_work.inc +++ /dev/null @@ -1,2139 +0,0 @@ -struct f70 - func_n dd ? - param1 dd ? - param2 dd ? - param3 dd ? - param4 dd ? - rezerv db ? - name dd ? -ends - -struct TexColViv - Text rb MAX_COLOR_WORD_LEN; // - f1 dd 0 - wwo db ? ; whole words only - endc db ? ; (wwo&4) - color db ? ; -ends - -struct symbol - c db ? ; +0 - col db ? ; +1 - perv dd ? ; +2 - next dd ? ; +6 - tc dd ? ; +10 . - td dd ? ; +14 . -ends - - -hed db 'TextEditor 22.04.10',0 ; -sc system_colors - -fn_icon db 'te_icon.bmp',0 -bmp_icon dd 0 -run_file_70 f70 - - -;input: -; edi = pointer to tedit struct -; reg = index -;output: -; reg = pointer to 'tex' struct -macro ConvertIndexToPointer reg { - imul reg,sizeof.symbol - add reg,ted_tex -} - -align 4 -proc ted_init, edit:dword - push eax ecx edi - mov edi,dword[edit] - - mov ecx,sizeof.symbol*maxChars - call mem_Alloc ; - mov ted_tex,eax - mov ted_tex_1,eax - add ted_tex_1,sizeof.symbol - mov ted_tex_end,eax - add ted_tex_end,sizeof.symbol*maxChars - - stdcall ted_clear, edi,1 - -;------------------------------------------------- - mov ecx,maxColWords*sizeof.TexColViv+40 - ;add ecx,40 - call mem_Alloc - mov ted_syntax_file,eax - mov ted_syntax_file_end,eax - add ted_syntax_file_end,ecx - - pop edi ecx eax - ret -endp - -align 4 -proc ted_delete, edit:dword - push ecx edi - mov edi,dword[edit] - - mov ecx,ted_tex - call mem_Free - mov ecx,ted_syntax_file - call mem_Free - - pop edi ecx - ret -endp - - -;input: -; eax = key kodes -; ebx = key control -align 4 -proc ted_key, edit:dword, table:dword - pushad - mov edi,dword[edit] - - cmp ah,KEY_F1 ;[F1] - jne @f - stdcall ted_show_help_f1,edi - jmp .end_key_fun - @@: - cmp ah,KEY_F3 ;[F3] - jne @f - stdcall but_FindText,edi - jmp .end_key_fun - @@: - - test ebx,KM_CTRL ;Ctrl+... - jz .key_Ctrl - - cmp ah,24 ;Ctrl+O - jne @f - call but_OpenFile - @@: - cmp ah,33 ;Ctrl+F - jne @f - cmp ted_panel_id,TE_PANEL_FIND - je @f - stdcall but_find,edi - @@: - cmp ah,44 ;Ctrl+Z - jne @f - stdcall ted_but_undo,edi - @@: - cmp ah,46 ;Ctrl+C - jne @f - stdcall ted_but_copy,edi - @@: - cmp ah,47 ;Ctrl+V - jne @f - stdcall ted_but_paste,edi - @@: - cmp ah,49 ;Ctrl+N - jne @f - call but_NewFile - @@: - cmp ah,199 ;Ctrl+Home - jne @f - call but_CtrlHome - @@: - ;jmp .end_key_fun - .key_Ctrl: - - test ebx,KM_SHIFT ;Shift+... - jz .key_Shift - cmp ah,72 ;Shift+Up - jne @f - stdcall ted_sel_key_up,edi - @@: - cmp ah,75 ;Shift+Left - jne @f - stdcall ted_sel_key_left,edi - @@: - cmp ah,77 ;Shift+Right - jne @f - stdcall ted_sel_key_right,edi - @@: - cmp ah,80 ;Shift+Down - jne @f - stdcall ted_sel_key_down,edi - @@: - ;mov ted_drag_k,1 ; - jmp .key_MoveCur - .key_Shift: -;------------------------------------------------- - cmp ah,72 ;178 ;Up - jne @f - stdcall draw_cursor_sumb,edi - call CurMoveUp - cmp dl,8 - jne .no_red_0 - call OnInitialUpdate - stdcall draw_main_win,edi - jmp @f - .no_red_0: - stdcall draw_main_cursor,edi - mov ted_drag_k,0 ; - @@: - cmp ah,80 ;177 ;Down - jne @f - stdcall draw_cursor_sumb,edi - call CurMoveDown - cmp dl,8 - jne .no_red_1 - call OnInitialUpdate - stdcall draw_main_win,edi - jmp @f - .no_red_1: - stdcall draw_main_cursor,edi - mov ted_drag_k,0 ; - @@: - cmp ah,75 ;176 ;Left - jne @f - stdcall draw_cursor_sumb,edi - call CurMoveLeft - cmp dl,8 - jne .no_red_2 - call OnInitialUpdate - stdcall draw_main_win,edi - jmp @f - .no_red_2: - stdcall draw_main_cursor,edi - mov ted_drag_k,0 ; - @@: - cmp ah,77 ;179 ;Right - jne @f - stdcall draw_cursor_sumb,edi - call CurMoveRight - cmp dl,8 - jne .no_red_3 - call OnInitialUpdate - stdcall draw_main_win,edi - jmp @f - .no_red_3: - stdcall draw_main_cursor,edi - mov ted_drag_k,0 ; - @@: - cmp ah,71 ;180 ;Home - jne @f - stdcall draw_cursor_sumb,edi - call CurMoveX_FirstChar - cmp dl,8 - jne .no_red_4 - call OnInitialUpdate - stdcall draw_main_win,edi - jmp @f - .no_red_4: - stdcall draw_main_cursor,edi - mov ted_drag_k,0 ; - @@: - cmp ah,79 ;181 ;End - jne @f - stdcall draw_cursor_sumb,edi - call CurMoveX_LastChar - cmp dl,8 - jne .no_red_5 - call OnInitialUpdate - stdcall draw_main_win,edi - jmp @f - .no_red_5: - stdcall draw_main_cursor,edi - mov ted_drag_k,0 ; - @@: - cmp ah,73 ;184 ;PageUp - jne @f - call CurMovePageUp - cmp dl,0 - je @f - call OnInitialUpdate - stdcall draw_main_win,edi - @@: - cmp ah,81 ;183 ;PageDown - jne @f - call CurMovePageDown - cmp dl,0 - je @f - call OnInitialUpdate - stdcall draw_main_win,edi - mov ted_drag_k,0 ; - @@: -;------------------------------------------------- -; cmp ebx,0 -; jne .end_key_fun - .key_MoveCur: - - cmp ah,69 ;[Pause Break] - je .end_key_fun - cmp ah,120 ;[Fn] - je .end_key_fun - cmp ah,0x80 ;if key up - ja .end_key_fun - - cmp dword[table],0 - je @f - stdcall KeyConvertToASCII, dword[table] - @@: - - ;mov ted_drag_k,0 ; - - xor edx,edx - mov dl,ah - add edx,EvChar ;add char to text - cmp byte [edx],1 - jne @f - mov ted_key_new,ah - stdcall ted_set_undo,edi - mov edx,ted_opt_ed_change_time+ted_opt_ed_move_cursor - stdcall SelTextDel,edx - cmp al,1 - jne .del - mov edx,ted_opt_ed_move_cursor - .del: - cmp ted_cur_ins,1 - je .no_ins_mod - stdcall TextDel,edi,ted_opt_ed_change_time - mov edx,ted_opt_ed_move_cursor - .no_ins_mod: - mov ecx,edi - add ecx,ted_offs_key_new - stdcall ted_text_add,edi,ecx,1,edx ; - call draw_but_toolbar - cmp ted_key_new,13 - jne .dr_m_win - stdcall draw_main_win,edi - jmp .dr_cur_l - .dr_m_win: - stdcall draw_cur_line,edi - .dr_cur_l: - @@: - - cmp ah,8 ;[<-] - jne @f - stdcall ted_set_undo,edi - stdcall SelTextDel,ted_opt_ed_change_time - cmp al,1 - je .del_one_b - stdcall TextDel,edi,ted_opt_ed_change_time+ted_opt_ed_move_cursor - .del_one_b: - call draw_but_toolbar - stdcall draw_main_win,edi - jmp .end_key_fun - @@: - - cmp ah,182 ;Delete - jne @f - stdcall ted_set_undo,edi - stdcall SelTextDel,ted_opt_ed_change_time - cmp al,1 - je .del_one_d - stdcall TextDel,edi,ted_opt_ed_change_time - .del_one_d: - call draw_but_toolbar - stdcall draw_main_win,edi - jmp .end_key_fun - @@: - - cmp ah,185 ;Ins - jne @f - stdcall draw_cursor_sumb,edi - xor ted_cur_ins,1 - stdcall draw_main_cursor,edi - @@: - - .end_key_fun: - popad - ret -endp - -;output: -; al = 1 - can save -align 4 -proc ted_can_save, edit:dword - push ecx edi - mov edi,dword[edit] - - mov ecx,ted_tim_ch - sub ecx,ted_tim_undo - mov al,1 - cmp ted_tim_ls,ecx - jne @f - dec al - @@: - pop edi ecx - ret -endp - -;output: -; al = 1 - selected -align 4 -proc IsSel, edit:dword - push ebx edi - mov edi,dword[edit] - xor al,al - cmp ted_drag_m,1 - je @f - mov al,1 - mov ebx,ted_sel_x0 - cmp ebx,ted_sel_x1 - jne @f - mov ebx,ted_sel_y0 - cmp ebx,ted_sel_y1 - jne @f - xor al,al - @@: - pop edi ebx - ret -endp - -align 4 -proc SelNormalize, edit:dword - push ecx esi edi - mov edi,dword[edit] - mov esi,edi - add esi,ted_offs_sel - add edi,ted_offs_seln - mov ecx,sizeof.TexSelect - rep movsb - - mov edi,dword[edit] - - jmp @f - .swp_f: - mov ecx,ted_seln_x0 - m2m ted_seln_x0,ted_seln_x1 - mov ted_seln_x1,ecx - - mov ecx,ted_seln_y0 - cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1) - jle .end_f - m2m ted_seln_y0,ted_seln_y1 - mov ted_seln_y1,ecx - - jmp .end_f - @@: - - mov ecx,ted_seln_y0 - cmp ecx,ted_seln_y1 ;(sel_y0>sel_y1) - jg .swp_f - - cmp ecx,ted_seln_y1 ;(sel_y0==sel_y1) - jne .end_f - mov ecx,ted_seln_x0 - cmp ecx,ted_seln_x1 ;(sel_x0>sel_x1) - jg .swp_f - - .end_f: - pop edi esi ecx - ret -endp - -align 4 -proc SelStart, edit:dword - push ecx edi - mov edi,dword[edit] - - mov ecx,ted_cur_x - add ecx,[hScr.position] - mov ted_sel_x0,ecx - mov ted_sel_x1,ecx - - mov ecx,ted_cur_y - add ecx,[wScr.position] - mov ted_sel_y0,ecx - mov ted_sel_y1,ecx - pop edi ecx - ret -endp - -align 4 -proc SelMove, edit:dword - push ecx edi - mov edi,dword[edit] - - mov ecx,ted_cur_x - add ecx,[hScr.position] - mov ted_sel_x1,ecx - - mov ecx,ted_cur_y - add ecx,[wScr.position] - mov ted_sel_y1,ecx - pop edi ecx - call draw_but_toolbar ;redraw toolbar (need to button Copy) - ret -endp - -;input: -; cl_al_mem = 1 - clear all memory -align 4 -proc ted_clear, edit:dword, cl_al_mem:dword - push edi - mov edi,dword[edit] - - mov ted_cur_x,0 - mov ted_cur_y,0 - mov ted_tim_ch,0 - mov ted_tim_ls,0 - mov ted_tim_co,0 - mov ted_tim_undo,0 - mov ted_help_id,-1 - - mov [wScr.position],0 - mov [wScr.max_area],100 - mov [wScr.redraw],1 - mov [hScr.position],0 - mov [hScr.max_area],100 - - mov ted_sel_x0,0 - mov ted_sel_y0,0 - mov ted_sel_x1,0 - mov ted_sel_y1,0 - - cmp dword[cl_al_mem],0 - je .exit - - push ecx edx - mov ecx,sizeof.symbol*maxChars - mov edx,ted_tex - @@: - mov byte [edx],0 - inc edx - loop @b - mov edx,ted_tex - mov dword [edx+6],1 - pop edx ecx - - .exit: - pop edi - ret -endp - -;--- out_reg = Col[ind_reg].Text[0] --- -macro ColToIndexOffset ind_reg,out_reg { - mov out_reg,ind_reg - imul out_reg,sizeof.TexColViv - add out_reg,ted_key_words_data -} - - -align 4 -proc InitColText, edit:dword - pushad - mov edi,dword[edit] - - mov ebx,dword[fn_col_option] - copy_path ebx,fn_syntax_dir,file_name_rez,0x0 - copy_path file_name_rez,sys_path,file_name,0x0 - - mov eax,70 - mov [run_file_70.func_n], 0 - mov [run_file_70.param1], 0 - mov [run_file_70.param2], 0 - mov ebx,ted_syntax_file_end - sub ebx,ted_syntax_file - mov [run_file_70.param3], ebx - m2m [run_file_70.param4], ted_syntax_file - mov [run_file_70.rezerv], 0 - mov [run_file_70.name], file_name - mov ebx,run_file_70 - int 0x40 - - mov ecx,0x100 - mov edx,FkPos - @@: - mov dword[edx],-1 - add edx,4 - loop @b - - ;init: ted_colors_text_count, ted_key_words_count, ... - mov ted_colors_text_count,1 - mov ted_key_words_count,0 - mov ted_help_text_f1,0 - mov ted_help_id,-1 ; - - cmp eax,6 - je @f - cmp eax,0 - je @f - cmp ax,10 - jl .zifra_0_9 - mov al,'?' - sub ax,48 - .zifra_0_9: - add ax,48 - - mov byte[msgbox_3.err],al - stdcall [mb_create],msgbox_3,thread ;message: Can-t open color options file! - jmp .no_colors - @@: - - mov eax,edi ; edi - mov esi,ted_syntax_file - add edi,ted_offs_count_colors - mov ecx,9*4 - rep movsb - mov edi,eax ; edi - - mov eax,ted_syntax_file - add eax,32 - mov ted_text_colors,eax - - mov eax,ted_colors_text_count ;init: count_colors_text (offset to key words) - add eax,8 - shl eax,2 - add eax,ted_syntax_file - mov ted_key_words_data,eax - - mov ecx,ted_key_words_count ;init: FkPos (first key positions) - xor eax,eax - @@: - ColToIndexOffset eax,edx - xor ebx,ebx - mov bl,byte[edx] - shl bx,2 - mov esi,FkPos - add esi,ebx - cmp dword[esi],-1 - jne .no_ch_key - mov dword[esi],eax - .no_ch_key: - inc eax - loop @b - - ;init: ted_help_text_f1 - mov ecx,ted_key_words_count - imul ecx,sizeof.TexColViv - add ecx,ted_key_words_data - mov ted_help_text_f1,ecx - - .no_colors: - popad - ret -endp - -;input: -; ebx = file size -; edi = pointer to tedit struct -align 4 -proc OpenFile - push eax ;destination - push ecx ;for cycle - push edx ;source - - stdcall ted_clear,edi,0 ; , - mov eax,ebx - mov ecx,ebx - add eax,2 - ConvertIndexToPointer eax - mov edx,ted_tex - add edx,ebx - push ebx - @@: - mov ebx,[edx] - mov byte [eax],bl - mov dword [eax+2],ecx - inc dword [eax+2] - mov dword [eax+6],ecx - add dword [eax+6],3 - ;mov byte[eax+1],0 ;col=0 - mov dword [eax+10],-1 ;tc=-1 - mov dword [eax+14],0 ;td=0 - - cmp ecx,0 - je @f - dec ecx - dec edx - sub eax,sizeof.symbol - jmp @b - @@: - pop ebx - add eax,2 - mov dword [eax],0 ; first sumbol 'perv=0' - - mov edx,ted_tex - ; begining sumbol 'perv=0' 'next=2' - mov dword [edx+2],0 - mov dword [edx+6],2 - - add edx,sizeof.symbol - mov dword [edx+6],0 ; last sumbol 'next=0' - mov dword [edx+2],ebx ; last sumbol 'perv=last' - inc dword [edx+2] - - mov edx,ebx - inc edx ;2 = rezerv sumbols - imul edx,sizeof.symbol - add edx,ted_tex - mov dword [edx+6],1 ; last sumbol 'next=1' - - @@: ;clear memory, need if before was open big file - add edx,sizeof.symbol - cmp edx,ted_tex_end - jge @f - mov dword[edx+10],0 - mov dword[edx+14],0 - jmp @b - @@: - - call GetNumLines - cmp eax,100 - jge @f - mov eax,100 - @@: - mov [wScr.max_area],eax -; mov [wScr.redraw],1 - pop edx ecx eax - - call CmColored - call draw_but_toolbar - stdcall draw_main_win,edi - ret -endp - -;input: -; edx = pointer to symbol struct -; edi = pointer to tedit struct -;output: -; edx = pointer to 'perv' visible symbol struct -align 4 -IteratPerv: - cmp ted_tim_undo,0 - je .else - push ebx - @@: - call GetTexPervPos - cmp edx,ted_tex - je @f - call SymbNotVis - cmp bl,1 - je @b - cmp byte[edx],10 ; 10 - je @b - @@: - pop ebx - ret - .else: - call GetTexPervPos - cmp edx,ted_tex - je .endif - cmp dword [edx+14],0 - jne .else - cmp byte[edx],10 ; 10 - je .else - .endif: - ret - - -;input: -; edx = pointer to symbol struct -; edi = pointer to tedit struct -;output: -; edx = pointer to 'next' visible symbol struct -align 4 -IteratNext: - cmp ted_tim_undo,0 - je .else - push ebx - @@: - call GetTexNextPos - cmp edx,ted_tex_1 - jle @f - call SymbNotVis - cmp bl,1 - je @b - cmp byte[edx],10 ; 10 - je @b - @@: - pop ebx - ret - .else: - call GetTexNextPos - cmp edx,ted_tex_1 - jle .endif - cmp dword [edx+14],0 - jne .else - cmp byte[edx],10 ; 10 - je .else - .endif: - ret - -;input: -; bl = symbol end of select -; edx = pointer to symbol struct -; edi = pointer to tedit struct -align 4 -ItPoNextUc: - @@: - cmp bl,byte[edx] - je @f - cmp edx,ted_tex_1 - jle @f - call IteratNext - jmp @b - @@: - call IteratNext - ret - -;input: -; edx = pointer to symbol struct -; edi = pointer to tedit struct -align 4 -ItPervColorTag: - @@: - cmp byte[edx+1],0 - jne @f - call IteratPerv - cmp edx,ted_tex_1 - jle @f - jmp @b - @@: - ret - -;input: -; edx = pointer to symbol struct -; edi = pointer to tedit struct -align 4 -ItNextColorTag: - @@: - call IteratNext - cmp byte[edx+1],0 - jne @f - cmp edx,ted_tex_1 - jle @f - jmp @b - @@: - ;call IteratNext - ret - -;input: -; edx = pointer to symbol struct -; edi = pointer to tedit struct -;output: -; bl = 1 if sumbol not visible -; (tex[i].td+ted_tim_undo<=ted_tim_ch && tex[i].td) || (tex[i].tc>ted_tim_ch-ted_tim_undo) -align 4 -SymbNotVis: - push eax - - xor bl,bl - - cmp dword [edx+14],0 - je @f - mov eax,[edx+14] ;eax=tex[i].td - add eax,ted_tim_undo - cmp eax,ted_tim_ch - jg @f - mov bl,1 - pop eax - ret - @@: - - mov eax,ted_tim_ch - sub eax,ted_tim_undo - cmp [edx+10],eax - jle @f - or bl,1 - @@: - - pop eax - ret - - -;input: -; text:dword - pointer to text string -; add_opt:dword - options -align 4 -proc ted_text_add, edit:dword, text:dword, t_len:dword, add_opt:dword - locals - new_spc dd ? ;count new spaces - new_lin dd ? ;count new lines - endl -; : -;eax - -;ebx - , -;ecx - -;edx - - pushad - mov edi,dword[edit] - mov esi,dword[text] - - call GetPos - call GetTexPervPos - call GetTexArrIndex ;eax=po_t - - mov dword[new_spc],0 - cmp ted_gp_opt,2 - je @f - push eax ;c_sp=cur[cn].x+Scroller->XPos-StrLen(cur[cn].y+Scroller->YPos); - mov eax,ted_cur_x - add eax,[hScr.position] - mov dword[new_spc],eax - - mov eax,ted_cur_y - add eax,[wScr.position] - call ted_strlen ;ebx = line len - sub dword[new_spc],ebx - pop eax - @@: - - mov ebx,dword[t_len] - - mov dword[new_lin],0 - cmp ted_gp_opt,0 - jne @f - push eax - mov eax,ted_cur_y - add eax,[wScr.position] - inc eax - mov dword[new_lin],eax - - call GetNumLines - sub dword[new_lin],eax - pop eax - @@: - - mov edx,sizeof.symbol - shl edx,1 - add edx,ted_tex - @@: ;for(i=2;i ted_cur_x - mov ted_gp_opt,1 - cmp eax,ecx - jge @f ; Row >= ted_cur_y - .u1_0: - mov ted_gp_opt,0 - inc ebx - cmp byte [edx],13 - jne @b - cmp eax,ecx - jge @f ; Row >= ted_cur_y - inc eax - xor ebx,ebx - jmp @b - @@: - cmp eax,ecx - jne @f ; Row = ted_cur_y - inc ted_gp_opt - @@: - cmp ted_gp_opt,0 - jne @f - mov edx,ted_tex_1 - ;call GetTexPervPos - @@: - pop ebx eax - ret - - -;input: -; eax = Row -; edi = pointer to tedit struct -;output: -; ebx = str len -align 4 -ted_strlen: - push edx ecx - ;ecx = Row, from cycle - - xor ebx,ebx - xor ecx,ecx - mov edx,ted_tex - @@: - call IteratNext - cmp edx,ted_tex_1 - jle @f - inc ebx - cmp byte [edx],13 - jne @b - dec ebx ;lenght minus 1 sumbol to paragraph - cmp eax,ecx - je @f - xor ebx,ebx - inc ecx - jmp @b - @@: - - cmp eax,ecx - je @f - xor ebx,ebx - @@: - - pop ecx edx - ret - - -;input: -; edx = symbol position -; edi = pointer to tedit struct -;output: -; eax = number of line -; ebx = symbol position in line -align 4 -GetTexCoords: - push edx - xor eax,eax - xor ebx,ebx - @@: - call IteratPerv - - cmp eax,0 - jne .no_col_mov - inc ebx - .no_col_mov: - - cmp edx,ted_tex_1 - jle @f - cmp byte [edx],13 - jne @b - inc eax - jmp @b - @@: - dec ebx - pop edx - ret - -;input: -; edi = pointer to tedit struct -;output: -; eax = num lines -align 4 -GetNumLines: - push edx - mov eax,1 - mov edx,ted_tex - @@: - call IteratNext - cmp edx,ted_tex_1 - jle @f - cmp byte [edx],13 - jne @b - inc eax - jmp @b - @@: -;... -;dec eax - pop edx - ret - - -align 4 -proc ted_set_undo, edit:dword - push edi - mov edi,dword[edit] - - mov ted_drag_k,0 ; - cmp ted_tim_undo,1 - jl .no_work - - push eax ebx edx - mov edx,ted_tex - call GetTexNextPos ;long i=tex[0].next; - mov eax,ted_tim_undo - sub ted_tim_ch,eax ;ted_tim_ch-=ted_tim_undo; - mov eax,ted_tim_ch - cmp ted_tim_ls,eax ;if(ted_tim_ls>ted_tim_ch) - jle @f - mov ted_tim_ls,0 - @@: - cmp edx,ted_tex - je @f - - ;if(tex[i].tc>ted_tim_ch){ // - cmp [edx+10],eax - jle .no_u1 - mov dword [edx+10],0 - mov dword [edx+14],0 - - mov ebx,[edx+2] - imul ebx,sizeof.symbol - add ebx,ted_tex;.next - m2m dword [ebx+6],dword [edx+6] ;tex[tex[i].perv].next=tex[i].next; - - mov ebx,[edx+6] - imul ebx,sizeof.symbol - add ebx,ted_tex;.perv - m2m dword [ebx+2],dword [edx+2] ;tex[tex[i].next].perv=tex[i].perv; - - .no_u1: - - ;else if(tex[i].td>ted_tim_ch) tex[i].td=0; // - cmp [edx+14],eax - jle .no_u2 - mov dword [edx+14],0 - .no_u2: - - call GetTexNextPos - jmp @b - @@: - mov ted_tim_undo,0 - mov eax,ted_tim_co - cmp ted_tim_ch,eax - jge @f - mov ted_tim_co,0 - @@: - pop edx ebx eax - .no_work: - pop edi - ret -endp - -;input: -; ecx = Col -; edx = Row -; edi = pointer to tedit struct -align 4 -GoToPos: - mov ted_cur_x,ecx - sub edx,[wScr.position] - - cmp edx,[wScr.cur_area] ;ted_cur_y > [.cur_area] - jl @f - push ebx - mov ebx,edx - sub ebx,[wScr.cur_area] - inc ebx - add [wScr.position],ebx - sub edx,ebx - pop ebx - ; ??? redrav - @@: - mov ted_cur_y,edx - ret - -;input: -; edi = pointer to tedit struct -align 4 -CmColored: - push eax edx - mov eax,ted_tim_ch - sub eax,ted_tim_undo - mov ted_tim_co,eax - mov edx,ted_tex - @@: - call IteratNext - cmp edx,ted_tex_1 - jle @f - mov byte[edx+1],0 - jmp @b - @@: - - cmp ted_key_words_count,1 - jl .no_colors - mov edx,ted_tex - @@: - call TextFSColor - cmp edx,ted_tex_1 - jle .no_colors - jmp @b - .no_colors: - pop edx eax - ret - - -;input: -; edx = pointer to start symbol -; edi = pointer to tedit struct -;output: -; edx = pointer to next symbol -;description: -; -align 4 -proc TextFSColor -locals - begPos dd ? ; - endPos dd ? ; - find db ? ; / - f_color db ? ; -endl - push eax ebx ecx esi -;eax = word_n () -;ebx = -;ecx = l_pos () -;esi = , - mov dword[begPos],1 - mov dword[endPos],1 - mov byte[find],0 - mov byte[f_color],1 - @@: - call IteratNext - cmp edx,ted_tex_1 - jle @f - - xor eax,eax - mov al,byte[edx] - shl ax,2 ;eax*=4 - add eax,FkPos - mov eax,dword[eax] - cmp eax,0 - jl @b ;if( (word_n=FkPos[(unsigned char)tex[i].c])>-1 ){ - - mov ecx,eax - ;while(l_posword_n && Col[l_pos-1].Text[pos]!=tex[i].c) - .wh_3b: - cmp ecx,eax - jle .wh_3e - dec ecx - ColToIndexOffset ecx,ebx - inc ecx - ;cmp byte[ebx+esi],byte[edx] - mov bl,byte[ebx+esi] - cmp bl,byte[edx] - je .wh_3e - dec ecx - jmp .wh_3b - .wh_3e: - - ColToIndexOffset eax,ebx - cmp byte[ebx+esi],0 - jne .if_0 ;if(Col[word_n].Text[pos]==0){ - mov dword[endPos],edx ;eP=i; - ColToIndexOffset eax,ebx - mov bl,byte[ebx+MAX_COLOR_WORD_LEN+6] - mov byte[f_color],bl ;f_color=Col[word_n].color; - -mov byte[find],1 - ColToIndexOffset eax,ebx ;... ebx = Col[word_n] - mov bl,byte[ebx+MAX_COLOR_WORD_LEN+4] - cmp bl,0 ;if(Col[word_n].wwo) - je .if_2n - push edx - mov edx,dword[begPos] - call IteratPerv - - btr bx,0 ;1-1 - jae .if_3e ;if(Col[word_n].wwo&1) - ;u1= !(isalnum(cont_s)||cont_s=='_') - call isalnum - jae .if_3e - mov byte[find],0 - .if_3e: - - btr bx,3 ;4-1 - jae .if_4e ;if(Col[word_n].wwo&8) - ;u1= !isalpha(cont_s); - call isalpha - jae .if_4e - mov byte[find],0 - .if_4e: - - mov edx,dword[endPos] -; call IteratNext - - btr bx,1 ;2-1 - jae .if_5e ;if(Col[word_n].wwo&2) - ;u1= !(isalnum(cont_s)||cont_s=='_') - call isalnum - jae .if_5e - mov byte[find],0 - .if_5e: - - btr bx,4 ;5-1 - jae .if_6e ;if(Col[word_n].wwo&16) - ;u1= !isalpha(cont_s); - call isalpha - jae .if_6e - mov byte[find],0 - .if_6e: - - btr bx,2 ;3-1 - jae .if_7e ;if(Col[word_n].wwo&4) - ColToIndexOffset eax,ebx - mov bl,byte[ebx+MAX_COLOR_WORD_LEN+5] - call ItPoNextUc - cmp edx,ted_tex_1 - jle .if_7e - mov dword[endPos],edx - .if_7e: - - pop edx - .if_2n: -; if(i!=1){ // -; cont_s=tex[eP].c; -; if(Col[word_n].wwo&2) u2= !(isalnum(cont_s)||cont_s=='_'); // .-. -; if(u2 && Col[word_n].wwo&16) u2= !isalpha(cont_s); // . -; if(Col[word_n].wwo&4) eP=ItPoNextUc(eP,Col[word_n].endc); - - cmp eax,ecx - je .wh_2e ;if(word_n==l_pos) break; // do double - - .if_0: - - cmp edx,ted_tex_1 - jle .wh_2e ;if(i==1) break; - - ;while(l_pos>word_n && Col[word_n].Text[pos]!=tex[i].c) - .wh_4b: - cmp ecx,eax - jle .wh_4e - ColToIndexOffset eax,ebx - ;cmp byte[ebx+esi],byte[edx] - mov bl,byte[ebx+esi] - cmp bl,byte[edx] - je .wh_4e - inc eax - jmp .wh_4b - .wh_4e: - - cmp eax,ecx - je .wh_2e;if(word_n==l_pos) break; - inc esi ;pos++; - jmp .wh_2b - .wh_2e: - - cmp byte[find],1 ;if(fnd)break; - je @f - mov edx,dword[begPos];i=bP; - jmp @b - @@: - - cmp byte[find],1 - jne .if_1e ;if(fnd){ // -; if(!mode_sf1 || (mode_sf1 && strlen(Col[word_n].f1->c_str())>0)){ - mov eax,dword[begPos] - mov bl,byte[f_color] - mov byte[eax+1],bl ;tex[bP].col=f_color; - mov eax,dword[endPos] - mov byte[eax+1],0xff ;tex[eP].col=255; -; return ItPoPerv(eP); // - mov edx,dword[endPos] - call GetTexPervPos - jmp @f - .if_1e: - mov edx,ted_tex - @@: - - pop esi ecx ebx eax - ret -endp - -;input: -; edx = pointer to char (byte) -;output: -; cf=1 if symbol is... -align 4 -tab_all_num db 0,0,0,0,0,0,11111111b,11b,11111110b,0xff,0xff,111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0;,0,0,0,0,0,0,0,0 - tab_alpha_0,0,0,0,0,0,0,0 -tab_alpha db 0,0,0,0,0,0,0,0,11111110b,0xff,0xff,111b,11111110b,0xff,0xff,111b,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - -align 4 -isalnum: - push eax ebx - mov al,byte[edx] ;al=offset - shr al,3 - and eax,11111b - mov ebx,tab_all_num - add ebx,eax - mov ah,byte[ebx] - mov al,byte[edx] ;al=bit - and ax,111b - mov bx,word[ebx] - btr bx,ax - pop ebx eax - ret -align 4 -isalpha: - push eax ebx - mov al,byte[edx] ;al=offset - shr al,3 - and eax,11111b - mov ebx,tab_alpha - add ebx,eax - mov ah,byte[ebx] - mov al,byte[edx] ;al=bit - and ax,111b - mov bx,word[ebx] - btr bx,ax - pop ebx eax - ret - -align 4 -proc ted_show_help_f1, edit:dword - push eax edx edi - mov edi,dword[edit] - - call GetPos - push edx - call ItNextColorTag - mov eax,edx - pop edx - call ItPervColorTag - - cmp eax,ted_tex - jle @f - cmp edx,ted_tex_1 - jle @f - stdcall FindHelpId,eax - @@: - ;stdcall draw_main_cursor,edi - stdcall draw_help_f1 - pop edi edx eax - ret -endp - -;input: -; edx = position begin 'symbol' struct -; edi = pointer to tedit struct -; end_pos = position end 'symbol' struct -align 4 -proc FindHelpId, end_pos:dword -; ecx = word_n -; ebx = l_pos - mov ted_help_id,-1 - - push ebx ecx - xor ebx,ebx - mov bl,byte[edx] - shl bx,2 ;ebx*=4 - add ebx,FkPos - mov ecx,dword[ebx] - cmp ecx,0 - jl .if_0e ;if( (word_n=FkPos[(unsigned char)tf[0]])>-1 ){ - push esi eax - mov ebx,ecx ;l_pos=word_n; - ColToIndexOffset ecx,esi - push cx - mov cl,byte[esi] - @@: - cmp ebx,ted_key_words_count ;while(l_posword_n - jle .wh_0e - dec ebx - ColToIndexOffset ebx,eax - inc ebx - cmp byte[eax+esi],dl ;&& Col[l_pos-1].Text[pos]!=tf[i]) - je .wh_0e - dec ebx ;l_pos--; - jmp .wh_0b - .wh_0e: - - .wh_1b: - cmp ebx,ecx ;while(l_pos>word_n - jle .wh_1e - ColToIndexOffset ecx,eax - cmp byte[eax+esi],dl - je .wh_1e - inc ecx ;word_n++; - jmp .wh_1b - .wh_1e: - pop dx - - cmp ecx,ebx ;if(word_n==l_pos) break; - je @f - call IteratNext ;pos++; - cmp edx,dword[end_pos] ;for(...;i