Compare commits
1 Commits
37eb932a69
...
c3a31e39e4
Author | SHA1 | Date | |
---|---|---|---|
c3a31e39e4 |
@@ -506,7 +506,7 @@ tup.append_table(img_files, {
|
||||
{"GAMES/TETRIS", VAR_PROGS .. "/games/tetris/tetris"},
|
||||
{"GAMES/C4", VAR_PROGS .. "/games/c4/c4"},
|
||||
{"LIB/ARCHIVER.OBJ", VAR_PROGS .. "/fs/kfar/trunk/kfar_arc/kfar_arc.obj"},
|
||||
{"LIB/BOX_LIB.OBJ", VAR_PROGS .. "/develop/libraries/box_lib/trunk/box_lib.obj"},
|
||||
{"LIB/BOX_LIB.OBJ", VAR_PROGS .. "/develop/libraries/box_lib/box_lib.obj"},
|
||||
{"LIB/BUF2D.OBJ", VAR_PROGS .. "/develop/libraries/buf2d/trunk/buf2d.obj"},
|
||||
{"LIB/CONSOLE.OBJ", VAR_PROGS .. "/develop/libraries/console_coff/console.obj"},
|
||||
{"LIB/CNV_PNG.OBJ", VAR_PROGS .. "/media/zsea/plugins/png/cnv_png.obj"},
|
||||
|
@@ -101,7 +101,7 @@ fasm develop\cObj\cObj.asm %BIN%\develop\cObj
|
||||
echo *
|
||||
echo Building systems libraries
|
||||
echo *
|
||||
fasm develop\libraries\box_lib\trunk\box_lib.asm %BIN%\lib\box_lib.obj
|
||||
fasm develop\libraries\box_lib\box_lib.asm %BIN%\lib\box_lib.obj
|
||||
fasm develop\libraries\console\console.asm %BIN%\lib\console.obj
|
||||
fasm develop\libraries\libs-dev\libgfx\libgfx.asm %BIN%\lib\libgfx.obj
|
||||
fasm develop\libraries\libs-dev\libimg\libimg.asm %BIN%\lib\libimg.obj
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,9 @@
|
||||
; SPDX-License-Identifier: NOASSERTION
|
||||
;
|
||||
|
||||
; Text encoded with Code Page 866 - Cyrillic
|
||||
|
||||
|
||||
;unz - <20><>ᯠ<EFBFBD><E1AFA0><EFBFBD>騪, <20>ᯮ<EFBFBD><E1AFAE><EFBFBD><EFBFBD><EFBFBD>騩 archiver.obj. <20><><EFBFBD><EFBFBD><EFBFBD>ন<EFBFBD><E0A6A8><EFBFBD><EFBFBD> zip <20> 7z.
|
||||
|
||||
;unz [-o output path] [-f file for unpack] [-f ...] [-h] file.zip
|
||||
@@ -42,7 +48,7 @@ include 'lang.inc' ; Language support for locales: ru_RU (CP866), es_ES, en_US.
|
||||
include '../../macros.inc'
|
||||
include '../../proc32.inc'
|
||||
include "../../string.inc"
|
||||
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
|
||||
include '../../develop/libraries/box_lib/box_lib.mac'
|
||||
include '../../dll.inc'
|
||||
;include '../../debug.inc'
|
||||
include 'debug.inc'
|
||||
@@ -917,5 +923,3 @@ stackDlg:
|
||||
stack_top:
|
||||
|
||||
end_mem:
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,429 +1,435 @@
|
||||
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>୮<EFBFBD><E0ADAE><EFBFBD> <20>ᥬ, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD><EFBFBD><EFBFBD>/ᮢ<>⮬/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ...
|
||||
|
||||
use32
|
||||
org 0
|
||||
db 'MENUET01' ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20>ᯮ<EFBFBD><E1AFAE>塞<EFBFBD><EFA5AC><EFBFBD> 䠩<><E4A0A9> <20>ᥣ<EFBFBD><E1A5A3> 8 <20><><EFBFBD><EFBFBD>
|
||||
dd 1, start, i_end, mem, stacktop, file_name, sys_path
|
||||
|
||||
MAX_COLOR_WORD_LEN equ 40
|
||||
maxChars equ 100002 ;(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⢮ ᨬ<><E1A8AC><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>㬥<EFBFBD><E3ACA5><EFBFBD> + 2)
|
||||
BUF_SIZE equ 4096 ;buffer for copy|paste
|
||||
maxSyntaxFileSize equ 410000
|
||||
TOOLBAR_ICONS_SIZE equ 1200*21
|
||||
|
||||
include '../../proc32.inc'
|
||||
include '../../macros.inc'
|
||||
include '../../KOSfuncs.inc'
|
||||
include '../../load_img.inc'
|
||||
include '../../load_lib.mac'
|
||||
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
|
||||
include '../../system/skincfg/trunk/kglobals.inc'
|
||||
include '../../system/skincfg/trunk/unpacker.inc'
|
||||
include 'lang.inc'
|
||||
|
||||
include 't_data.inc'
|
||||
include 't_button.inc'
|
||||
include 't_menu.inc'
|
||||
include 'strlen.inc'
|
||||
include 't_draw.inc' ;draw main window functions
|
||||
include 'wnd_k_words.inc'
|
||||
|
||||
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
|
||||
|
||||
align 4
|
||||
icon_tl_sys dd 0 ;㪠<><E3AAA0>⥫<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20>࠭<EFBFBD><E0A0AD><EFBFBD><EFBFBD> <20><><EFBFBD>⥬<EFBFBD><E2A5AC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
run_file_70 FileInfoBlock
|
||||
|
||||
align 4
|
||||
start:
|
||||
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
|
||||
|
||||
mcall SF_SYS_MISC,SSF_HEAP_INIT
|
||||
or eax,eax
|
||||
jnz @f
|
||||
call ted_Exit
|
||||
@@:
|
||||
|
||||
mcall SF_KEYBOARD,SSF_SET_INPUT_MODE,1 ;scan code
|
||||
mcall SF_SET_EVENTS_MASK,0xC0000027
|
||||
|
||||
mov esi,file_name
|
||||
stdcall str_len,esi
|
||||
mov ecx,eax
|
||||
mov edi,openfile_path
|
||||
cld
|
||||
rep movsb ;<3B><><EFBFBD><EFBFBD><EFBFBD>㥬 <20><><EFBFBD> 䠩<><E4A0A9> <20> <20><><EFBFBD><EFBFBD><EFBFBD> openfile_path
|
||||
|
||||
load_libraries l_libs_start,load_lib_end
|
||||
|
||||
;<3B><EFBFBD>ઠ <20><> <>쪮 㤠筮 <20><><EFBFBD>㧨<EFBFBD><E3A7A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⥪<EFBFBD>
|
||||
mov ebp,lib0
|
||||
.test_lib_open:
|
||||
cmp dword [ebp+ll_struc_size-4],0
|
||||
jz @f
|
||||
mcall SF_TERMINATE_PROCESS ;exit not correct
|
||||
@@:
|
||||
add ebp,ll_struc_size
|
||||
cmp ebp,load_lib_end
|
||||
jl .test_lib_open
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
stdcall [ted_init], tedit0
|
||||
stdcall [tl_data_init], tree1
|
||||
option_boxes_set_sys_color sc,opt_grlist1
|
||||
init_checkboxes2 check_boxes,check_boxes_end
|
||||
check_boxes_set_sys_color2 check_boxes,check_boxes_end,sc
|
||||
|
||||
; OpenDialog initialisation
|
||||
stdcall [OpenDialog_Init],OpenDialog_data
|
||||
|
||||
; kmenu initialisation
|
||||
call tedit_menu_init
|
||||
|
||||
; init toolbar file
|
||||
include_image_file 'te_icon.png', bmp_icon,,,6 ;6 <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov eax,[bmp_icon]
|
||||
add eax,TOOLBAR_ICONS_SIZE
|
||||
stdcall img_to_gray, [bmp_icon],eax,(TOOLBAR_ICONS_SIZE)/3
|
||||
;---------------------------------------------------------------------
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>塞 䠩<> <20> <20><><EFBFBD><EFBFBD><EFBFBD>ࠬ<EFBFBD> <20> <20><><EFBFBD><EFBFBD>ﬨ
|
||||
include_image_file '..\..\media\log_el\trunk\tl_sys_16.png', icon_tl_sys
|
||||
mov eax,dword[icon_tl_sys]
|
||||
mov dword[tree1.data_img_sys],eax
|
||||
; <20><><EFBFBD><EFBFBD><EFBFBD>塞 䠩<> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 㧫<><E3A7AB>
|
||||
include_image_file 'tl_nod_16.png', icon_tl_sys
|
||||
mov eax,dword[icon_tl_sys]
|
||||
mov dword[tree1.data_img],eax
|
||||
;------------------------------------------------------------------------------
|
||||
copy_path fn_syntax_dir,sys_path,file_name,0 ;<3B><>६ <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20> 䠩<><E4A0A9><EFBFBD><EFBFBD> ᨭ⠪<E1A8AD><E2A0AA><EFBFBD><EFBFBD>
|
||||
xor eax,eax
|
||||
mov ecx,4096
|
||||
mov edi,file_name
|
||||
repnz scasb
|
||||
mov byte[edi-2],al ;㡨ࠥ<E3A1A8> '/' <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (<28>㦭<EFBFBD> <20><><EFBFBD> <20>⥭<EFBFBD><E2A5AD> <20> CD)
|
||||
mcall SF_FILE,tree_file_struct
|
||||
|
||||
or ebx,ebx
|
||||
jz .end_dir_init
|
||||
mov eax,dir_mem+32+40
|
||||
mov ecx,ebx
|
||||
@@:
|
||||
cmp byte[eax],'.' ;䨫<><E4A8AB><EFBFBD>㥬 䠩<><E4A0A9> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '.' <20> '..'
|
||||
je .filter
|
||||
;0x10000 ;1*2^16 - <20><><EFBFBD> 1 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
stdcall [tl_node_add], tree1,0x10000,eax
|
||||
stdcall [tl_cur_next], tree1
|
||||
.filter:
|
||||
add eax,304
|
||||
loop @b
|
||||
stdcall [tl_cur_beg],tree1 ;<3B>⠢<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD> <20><>砫<EFBFBD> ᯨ᪠
|
||||
or dword[tree1.style], tl_cursor_pos_limited ;<3B><>࠭<EFBFBD>稢<EFBFBD><E7A8A2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20>।<EFBFBD><E0A5A4><EFBFBD><EFBFBD> ᯨ᪠
|
||||
.end_dir_init:
|
||||
|
||||
;--- load ini file ---
|
||||
copy_path ini_name,sys_path,file_name,0
|
||||
;window startup pozition
|
||||
stdcall [ini_get_int],file_name,ini_sec_window,key_window_l,ini_def_window_l
|
||||
mov word[wnd_s_pos+2],ax
|
||||
stdcall [ini_get_int],file_name,ini_sec_window,key_window_w,ini_def_window_w
|
||||
mov word[wnd_s_pos],ax
|
||||
stdcall [ini_get_int],file_name,ini_sec_window,key_window_t,ini_def_window_t
|
||||
mov word[wnd_s_pos+6],ax
|
||||
stdcall [ini_get_int],file_name,ini_sec_window,key_window_h,ini_def_window_h
|
||||
mov word[wnd_s_pos+4],ax
|
||||
;scrool type
|
||||
stdcall [ini_get_int],file_name,ini_sec_window,key_scroll_type,ini_def_scroll_type
|
||||
mov [wScr.type],eax
|
||||
mov [hScr.type],eax
|
||||
mov [ws_dir_lbox.type],eax
|
||||
mov [w_scr_t3.type],eax
|
||||
;symbol size
|
||||
stdcall [ini_get_int],file_name,ini_sec_window,key_symbol_w,ini_def_symbol_w
|
||||
mov dword[tedit0.rec.width],eax
|
||||
stdcall [ini_get_int],file_name,ini_sec_window,key_symbol_h,ini_def_symbol_h
|
||||
mov dword[tedit0.rec.height],eax
|
||||
;lea eax,[eax+eax*2]
|
||||
;mov dword[tedit0.rec.top],eax
|
||||
;font size
|
||||
stdcall [ini_get_int],file_name,ini_sec_window,key_font_s,ini_def_font_s
|
||||
shl eax,24
|
||||
mov dword[tedit0.font_size],eax
|
||||
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ini_panel key_but_new, ID_BUT_NEW
|
||||
ini_panel key_but_open, ID_BUT_OPEN
|
||||
ini_panel key_but_save, ID_BUT_SAVE
|
||||
ini_panel key_but_save_as,ID_BUT_SAVE_AS
|
||||
ini_panel key_but_select, ID_BUT_SELECT
|
||||
ini_panel key_but_cut, ID_BUT_CUT
|
||||
ini_panel key_but_copy, ID_BUT_COPY
|
||||
ini_panel key_but_paste, ID_BUT_PASTE
|
||||
ini_panel key_but_find, ID_BUT_FIND
|
||||
ini_panel key_but_replace,ID_BUT_REPLACE
|
||||
ini_panel key_but_key_words,ID_BUT_KEY_WORDS
|
||||
ini_panel key_but_upper, ID_BUT_UPPER
|
||||
ini_panel key_but_lower, ID_BUT_LOWER
|
||||
ini_panel key_but_reverse,ID_BUT_REVERSE
|
||||
ini_panel key_but_undo, ID_BUT_UNDO
|
||||
ini_panel key_but_redo, ID_BUT_REDO
|
||||
ini_panel key_but_invisible,ID_BUT_INVISIBLE
|
||||
ini_panel key_but_syntax_list,ID_BUT_SYNTAX_LIST
|
||||
ini_panel key_but_syntax_mode,ID_BUT_SYNTAX_MODE
|
||||
ini_panel key_but_convert_1251_866,ID_BUT_CONVERT_1251_866
|
||||
ini_panel key_but_convert_866_1251,ID_BUT_CONVERT_866_1251
|
||||
;䠩<><E4A0A9><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>७<EFBFBD><E0A5AD>
|
||||
xor edx,edx
|
||||
mov ebx,synt_auto_open
|
||||
@@:
|
||||
;<3B><>६ <20><><EFBFBD> 䠩<><E4A0A9>
|
||||
stdcall [ini_get_str],file_name,ini_sec_options,key_synt_file,ebx,32,ini_def_synt_f
|
||||
cmp byte[ebx],0
|
||||
je @f
|
||||
inc byte[key_synt_file.numb]
|
||||
add ebx,32
|
||||
;<3B><>६ <20><><EFBFBD><EFBFBD><EFBFBD>७<EFBFBD><EFBFBD>
|
||||
stdcall [ini_get_str],file_name,ini_sec_options,key_synt_ext,ebx,32,ini_def_synt_f
|
||||
inc byte[key_synt_ext.numb]
|
||||
add ebx,32
|
||||
inc edx
|
||||
cmp edx,max_synt_auto_open
|
||||
jl @b
|
||||
@@:
|
||||
|
||||
;--- load color option file ---
|
||||
stdcall open_unpac_synt_file,[fn_col_option]
|
||||
|
||||
;--- get cmd line ---
|
||||
cmp byte[openfile_path+3],0 ;openfile_path
|
||||
je @f ;if file names exist
|
||||
mov esi,openfile_path
|
||||
stdcall auto_open_syntax,esi
|
||||
call but_no_msg_OpenFile
|
||||
@@:
|
||||
|
||||
|
||||
|
||||
align 16
|
||||
red_win:
|
||||
call draw_window
|
||||
|
||||
align 16
|
||||
still:
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp dword[exit_code],1
|
||||
jne @f
|
||||
call ted_Exit
|
||||
jmp still
|
||||
@@:
|
||||
|
||||
cmp al,1 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
jz red_win
|
||||
cmp al,2
|
||||
jz key
|
||||
cmp al,3
|
||||
jz button
|
||||
cmp al,6 ;<3B><><EFBFBD><EFBFBD>
|
||||
jne @f
|
||||
call mouse
|
||||
@@:
|
||||
jmp still
|
||||
|
||||
align 16
|
||||
mouse:
|
||||
stdcall [kmainmenu_dispatch_cursorevent], [main_menu]
|
||||
|
||||
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
|
||||
cmp word[tedit0.wnd.top],ax
|
||||
jg .no_edit
|
||||
shr eax,16
|
||||
cmp word[tedit0.wnd.left],ax
|
||||
jg .no_edit
|
||||
mcall SF_MOUSE_GET,SSF_BUTTON_EXT
|
||||
bt eax,24 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 饫<><E9A5AB><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
jnc @f
|
||||
stdcall [ted_but_select_word], tedit0
|
||||
ret
|
||||
@@:
|
||||
stdcall [ted_mouse], tedit0
|
||||
.no_edit:
|
||||
|
||||
;<3B><EFBFBD>ઠ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
cmp byte[tedit0.panel_id],TED_PANEL_FIND
|
||||
jne @f
|
||||
stdcall [edit_box_mouse], edit_find
|
||||
stdcall [option_box_mouse], opt_grlist1
|
||||
stdcall [check_box_mouse], ch1
|
||||
@@:
|
||||
cmp byte[tedit0.panel_id],TED_PANEL_REPLACE
|
||||
jne @f
|
||||
stdcall [edit_box_mouse], edit_find
|
||||
stdcall [edit_box_mouse], edit_replace
|
||||
stdcall [option_box_mouse], opt_grlist1
|
||||
@@:
|
||||
cmp byte[tedit0.panel_id],TED_PANEL_SYNTAX
|
||||
jne @f
|
||||
stdcall [tl_mouse], tree1
|
||||
@@:
|
||||
cmp byte[tedit0.panel_id],TED_PANEL_GOTO
|
||||
jne @f
|
||||
stdcall [edit_box_mouse], edit_goto
|
||||
@@:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
;output:
|
||||
; ah = symbol
|
||||
align 16
|
||||
proc KeyConvertToASCII uses ebx, table:dword
|
||||
mov ebx,dword[table] ;convert scan to ascii
|
||||
shr ax,8
|
||||
add bx,ax
|
||||
mov ah,byte[ebx]
|
||||
ret
|
||||
endp
|
||||
|
||||
align 16
|
||||
key:
|
||||
mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS ;66.3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ﭨ<EFBFBD> <20><>ࠢ<EFBFBD><E0A0A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
xor esi,esi
|
||||
mov ecx,1
|
||||
test al,3 ;[Shift]
|
||||
jz @f
|
||||
mov cl,2
|
||||
or esi,KM_SHIFT
|
||||
@@:
|
||||
test al,0x0c ;[Ctrl]
|
||||
jz @f
|
||||
or esi,KM_CTRL
|
||||
@@:
|
||||
test al,0x30 ;[Alt]
|
||||
jz @f
|
||||
mov cl,3
|
||||
or esi,KM_ALT
|
||||
@@:
|
||||
test al,0x80 ;[NumLock]
|
||||
jz @f
|
||||
or esi,KM_NUMLOCK
|
||||
@@:
|
||||
|
||||
mcall SF_SYSTEM_GET,SSF_KEYBOARD_LAYOUT,,conv_tabl ;26.2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>᪫<EFBFBD><E1AAAB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mcall SF_GET_KEY
|
||||
stdcall [tl_key], tree1
|
||||
|
||||
test word[edit_replace.flags],ed_focus ;<3B> <20><> <20> 䮪<><E4AEAA><EFBFBD>, <20><>室<EFBFBD><E5AEA4>
|
||||
je @f
|
||||
cmp ah,0x80 ;if key up
|
||||
ja still
|
||||
cmp ah,42 ;[Shift] (left)
|
||||
je still
|
||||
cmp ah,54 ;[Shift] (right)
|
||||
je still
|
||||
cmp ah,56 ;[Alt]
|
||||
je still
|
||||
cmp ah,29 ;[Ctrl]
|
||||
je still
|
||||
cmp ah,69 ;[Pause Break]
|
||||
je still
|
||||
|
||||
stdcall KeyConvertToASCII, conv_tabl
|
||||
stdcall [edit_box_key], edit_replace
|
||||
jmp still
|
||||
@@:
|
||||
test word[edit_find.flags],ed_focus ;<3B> <20><> <20> 䮪<><E4AEAA><EFBFBD>, <20><>室<EFBFBD><E5AEA4>
|
||||
je @f
|
||||
cmp ah,0x80 ;if key up
|
||||
ja still
|
||||
cmp ah,42 ;[Shift] (left)
|
||||
je still
|
||||
cmp ah,54 ;[Shift] (right)
|
||||
je still
|
||||
cmp ah,56 ;[Alt]
|
||||
je still
|
||||
cmp ah,29 ;[Ctrl]
|
||||
je still
|
||||
cmp ah,69 ;[Pause Break]
|
||||
je still
|
||||
|
||||
stdcall KeyConvertToASCII, conv_tabl
|
||||
stdcall [edit_box_key], edit_find
|
||||
jmp still
|
||||
@@:
|
||||
test word[edit_goto.flags],ed_focus ;<3B> <20><> <20> 䮪<><E4AEAA><EFBFBD>, <20><>室<EFBFBD><E5AEA4>
|
||||
je @f
|
||||
cmp ah,0x80 ;if key up
|
||||
ja still
|
||||
cmp ah,42 ;[Shift] (left)
|
||||
je still
|
||||
cmp ah,54 ;[Shift] (right)
|
||||
je still
|
||||
cmp ah,56 ;[Alt]
|
||||
je still
|
||||
cmp ah,29 ;[Ctrl]
|
||||
je still
|
||||
cmp ah,69 ;[Pause Break]
|
||||
je still
|
||||
|
||||
stdcall KeyConvertToASCII, conv_tabl
|
||||
stdcall [edit_box_key], edit_goto
|
||||
jmp still
|
||||
@@:
|
||||
|
||||
stdcall [ted_key], tedit0, conv_tabl,esi
|
||||
jmp still
|
||||
|
||||
align 4
|
||||
edit_replace edit_box TED_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_replace, mouse_dd, 0
|
||||
edit_find edit_box TED_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_find, mouse_dd, 0
|
||||
edit_goto edit_box TED_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 10, buf_goto, mouse_dd, 0
|
||||
|
||||
unpac_mem dd 0
|
||||
|
||||
;library structures
|
||||
l_libs_start:
|
||||
lib0 l_libs lib_name_0, file_name, system_dir_0, import_box_lib
|
||||
lib1 l_libs lib_name_1, file_name, system_dir_1, import_msgbox_lib
|
||||
lib2 l_libs lib_name_2, file_name, system_dir_2, import_proclib
|
||||
lib3 l_libs lib_name_3, file_name, system_dir_3, import_libimg
|
||||
lib4 l_libs lib_name_4, file_name, system_dir_4, import_libini
|
||||
lib5 l_libs lib_name_5, file_name, system_dir_5, import_libkmenu
|
||||
load_lib_end:
|
||||
|
||||
IncludeIGlobals
|
||||
hed db 'TextEdit '
|
||||
i_end:
|
||||
openfile_path: ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> 䠩<><E4A0A9> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ࠡ<><E0A0A1><EFBFBD>
|
||||
rb 4096
|
||||
dir_mem rb 32+304*count_of_dir_list_files
|
||||
wnd_s_pos: ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>⮢<EFBFBD><E2AEA2> <20><><EFBFBD><EFBFBD>樨 <20><><EFBFBD><EFBFBD>
|
||||
rq 1
|
||||
last_open_synt_file rb 32 ;<3B><><EFBFBD> <20><><EFBFBD><E1ABA5><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>祭<EFBFBD><E7A5AD><EFBFBD><EFBFBD> 䠩<><E4A0A9> ᨭ⠪<E1A8AD><E2A0AA><EFBFBD><EFBFBD>
|
||||
buf rb BUF_SIZE ;<3B><><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><>⠢<EFBFBD><EFBFBD>
|
||||
buf_find rb 302 ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD>᪠ ⥪<><E2A5AA><EFBFBD>
|
||||
buf_replace rb 302 ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ⥪<><E2A5AA><EFBFBD>
|
||||
buf_goto rb 12 ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD>室<EFBFBD> <20><> <20><>ப<EFBFBD>
|
||||
sc system_colors
|
||||
IncludeUGlobals
|
||||
align 16
|
||||
procinfo process_information
|
||||
rb 1024
|
||||
thread:
|
||||
rb 4096
|
||||
align 16
|
||||
thread_coords:
|
||||
rb 4096
|
||||
align 16
|
||||
stacktop:
|
||||
sys_path: ;<3B><><EFBFBD><EFBFBD> <20><><EFBFBD>㤠 <20><><EFBFBD><EFBFBD><EFBFBD>⨫<EFBFBD><E2A8AB> <20>ᯮ<EFBFBD><E1AFAE>塞<EFBFBD><EFA5AC> 䠩<>
|
||||
rb 4096
|
||||
file_name: ;<3B><>ࠬ<EFBFBD><E0A0AC><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>᪠
|
||||
rb 4096
|
||||
syntax_path: ;<3B><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>砥<EFBFBD><E7A0A5><EFBFBD><EFBFBD> 䠩<><E4A0A9> ᨭ⠪<E1A8AD><E2A0AA><EFBFBD><EFBFBD>
|
||||
rb 4096
|
||||
plugin_path:
|
||||
rb 4096
|
||||
text_work_area: ;<3B><><EFBFBD><EFBFBD> <20> 䠩<><E4A0A9>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>뢠<EFBFBD><EBA2A0><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>
|
||||
rb 4096
|
||||
filename_area: ;<3B><><EFBFBD> 䠩<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
rb 256
|
||||
file_info:
|
||||
rb 40
|
||||
mem:
|
||||
; SPDX-License-Identifier: NOASSERTION
|
||||
;
|
||||
|
||||
; Text encoded with Code Page 866 - Cyrillic
|
||||
|
||||
|
||||
;<3B><><EFBFBD><E0AEAC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>୮<EFBFBD><E0ADAE><EFBFBD> <20>ᥬ, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD><EFBFBD><EFBFBD>/ᮢ<>⮬/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ...
|
||||
|
||||
use32
|
||||
org 0
|
||||
db 'MENUET01' ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20>ᯮ<EFBFBD><E1AFAE>塞<EFBFBD><EFA5AC><EFBFBD> 䠩<><E4A0A9> <20>ᥣ<EFBFBD><E1A5A3> 8 <20><><EFBFBD><EFBFBD>
|
||||
dd 1, start, i_end, mem, stacktop, file_name, sys_path
|
||||
|
||||
MAX_COLOR_WORD_LEN equ 40
|
||||
maxChars equ 100002 ;(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⢮ ᨬ<><E1A8AC><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>㬥<EFBFBD><E3ACA5><EFBFBD> + 2)
|
||||
BUF_SIZE equ 4096 ;buffer for copy|paste
|
||||
maxSyntaxFileSize equ 410000
|
||||
TOOLBAR_ICONS_SIZE equ 1200*21
|
||||
|
||||
include '../../proc32.inc'
|
||||
include '../../macros.inc'
|
||||
include '../../KOSfuncs.inc'
|
||||
include '../../load_img.inc'
|
||||
include '../../load_lib.mac'
|
||||
include '../../develop/libraries/box_lib/box_lib.mac'
|
||||
include '../../system/skincfg/trunk/kglobals.inc'
|
||||
include '../../system/skincfg/trunk/unpacker.inc'
|
||||
include 'lang.inc'
|
||||
|
||||
include 't_data.inc'
|
||||
include 't_button.inc'
|
||||
include 't_menu.inc'
|
||||
include 'strlen.inc'
|
||||
include 't_draw.inc' ;draw main window functions
|
||||
include 'wnd_k_words.inc'
|
||||
|
||||
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
|
||||
|
||||
align 4
|
||||
icon_tl_sys dd 0 ;㪠<><E3AAA0>⥫<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20>࠭<EFBFBD><E0A0AD><EFBFBD><EFBFBD> <20><><EFBFBD>⥬<EFBFBD><E2A5AC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
run_file_70 FileInfoBlock
|
||||
|
||||
align 4
|
||||
start:
|
||||
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
|
||||
|
||||
mcall SF_SYS_MISC,SSF_HEAP_INIT
|
||||
or eax,eax
|
||||
jnz @f
|
||||
call ted_Exit
|
||||
@@:
|
||||
|
||||
mcall SF_KEYBOARD,SSF_SET_INPUT_MODE,1 ;scan code
|
||||
mcall SF_SET_EVENTS_MASK,0xC0000027
|
||||
|
||||
mov esi,file_name
|
||||
stdcall str_len,esi
|
||||
mov ecx,eax
|
||||
mov edi,openfile_path
|
||||
cld
|
||||
rep movsb ;<3B><><EFBFBD><EFBFBD><EFBFBD>㥬 <20><><EFBFBD> 䠩<><E4A0A9> <20> <20><><EFBFBD><EFBFBD><EFBFBD> openfile_path
|
||||
|
||||
load_libraries l_libs_start,load_lib_end
|
||||
|
||||
;<3B><EFBFBD>ઠ <20><> <>쪮 㤠筮 <20><><EFBFBD>㧨<EFBFBD><E3A7A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⥪<EFBFBD>
|
||||
mov ebp,lib0
|
||||
.test_lib_open:
|
||||
cmp dword [ebp+ll_struc_size-4],0
|
||||
jz @f
|
||||
mcall SF_TERMINATE_PROCESS ;exit not correct
|
||||
@@:
|
||||
add ebp,ll_struc_size
|
||||
cmp ebp,load_lib_end
|
||||
jl .test_lib_open
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
stdcall [ted_init], tedit0
|
||||
stdcall [tl_data_init], tree1
|
||||
option_boxes_set_sys_color sc,opt_grlist1
|
||||
init_checkboxes2 check_boxes,check_boxes_end
|
||||
check_boxes_set_sys_color2 check_boxes,check_boxes_end,sc
|
||||
|
||||
; OpenDialog initialisation
|
||||
stdcall [OpenDialog_Init],OpenDialog_data
|
||||
|
||||
; kmenu initialisation
|
||||
call tedit_menu_init
|
||||
|
||||
; init toolbar file
|
||||
include_image_file 'te_icon.png', bmp_icon,,,6 ;6 <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov eax,[bmp_icon]
|
||||
add eax,TOOLBAR_ICONS_SIZE
|
||||
stdcall img_to_gray, [bmp_icon],eax,(TOOLBAR_ICONS_SIZE)/3
|
||||
;---------------------------------------------------------------------
|
||||
; <20><><EFBFBD><EFBFBD><EFBFBD>塞 䠩<> <20> <20><><EFBFBD><EFBFBD><EFBFBD>ࠬ<EFBFBD> <20> <20><><EFBFBD><EFBFBD>ﬨ
|
||||
include_image_file '..\..\media\log_el\trunk\tl_sys_16.png', icon_tl_sys
|
||||
mov eax,dword[icon_tl_sys]
|
||||
mov dword[tree1.data_img_sys],eax
|
||||
; <20><><EFBFBD><EFBFBD><EFBFBD>塞 䠩<> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 㧫<><E3A7AB>
|
||||
include_image_file 'tl_nod_16.png', icon_tl_sys
|
||||
mov eax,dword[icon_tl_sys]
|
||||
mov dword[tree1.data_img],eax
|
||||
;------------------------------------------------------------------------------
|
||||
copy_path fn_syntax_dir,sys_path,file_name,0 ;<3B><>६ <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20> 䠩<><E4A0A9><EFBFBD><EFBFBD> ᨭ⠪<E1A8AD><E2A0AA><EFBFBD><EFBFBD>
|
||||
xor eax,eax
|
||||
mov ecx,4096
|
||||
mov edi,file_name
|
||||
repnz scasb
|
||||
mov byte[edi-2],al ;㡨ࠥ<E3A1A8> '/' <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (<28>㦭<EFBFBD> <20><><EFBFBD> <20>⥭<EFBFBD><E2A5AD> <20> CD)
|
||||
mcall SF_FILE,tree_file_struct
|
||||
|
||||
or ebx,ebx
|
||||
jz .end_dir_init
|
||||
mov eax,dir_mem+32+40
|
||||
mov ecx,ebx
|
||||
@@:
|
||||
cmp byte[eax],'.' ;䨫<><E4A8AB><EFBFBD>㥬 䠩<><E4A0A9> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '.' <20> '..'
|
||||
je .filter
|
||||
;0x10000 ;1*2^16 - <20><><EFBFBD> 1 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
stdcall [tl_node_add], tree1,0x10000,eax
|
||||
stdcall [tl_cur_next], tree1
|
||||
.filter:
|
||||
add eax,304
|
||||
loop @b
|
||||
stdcall [tl_cur_beg],tree1 ;<3B>⠢<EFBFBD><E2A0A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><>砫<EFBFBD> ᯨ᪠
|
||||
or dword[tree1.style], tl_cursor_pos_limited ;<3B><>࠭<EFBFBD>稢<EFBFBD><E7A8A2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20>।<EFBFBD><E0A5A4><EFBFBD><EFBFBD> ᯨ᪠
|
||||
.end_dir_init:
|
||||
|
||||
;--- load ini file ---
|
||||
copy_path ini_name,sys_path,file_name,0
|
||||
;window startup pozition
|
||||
stdcall [ini_get_int],file_name,ini_sec_window,key_window_l,ini_def_window_l
|
||||
mov word[wnd_s_pos+2],ax
|
||||
stdcall [ini_get_int],file_name,ini_sec_window,key_window_w,ini_def_window_w
|
||||
mov word[wnd_s_pos],ax
|
||||
stdcall [ini_get_int],file_name,ini_sec_window,key_window_t,ini_def_window_t
|
||||
mov word[wnd_s_pos+6],ax
|
||||
stdcall [ini_get_int],file_name,ini_sec_window,key_window_h,ini_def_window_h
|
||||
mov word[wnd_s_pos+4],ax
|
||||
;scrool type
|
||||
stdcall [ini_get_int],file_name,ini_sec_window,key_scroll_type,ini_def_scroll_type
|
||||
mov [wScr.type],eax
|
||||
mov [hScr.type],eax
|
||||
mov [ws_dir_lbox.type],eax
|
||||
mov [w_scr_t3.type],eax
|
||||
;symbol size
|
||||
stdcall [ini_get_int],file_name,ini_sec_window,key_symbol_w,ini_def_symbol_w
|
||||
mov dword[tedit0.rec.width],eax
|
||||
stdcall [ini_get_int],file_name,ini_sec_window,key_symbol_h,ini_def_symbol_h
|
||||
mov dword[tedit0.rec.height],eax
|
||||
;lea eax,[eax+eax*2]
|
||||
;mov dword[tedit0.rec.top],eax
|
||||
;font size
|
||||
stdcall [ini_get_int],file_name,ini_sec_window,key_font_s,ini_def_font_s
|
||||
shl eax,24
|
||||
mov dword[tedit0.font_size],eax
|
||||
;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ini_panel key_but_new, ID_BUT_NEW
|
||||
ini_panel key_but_open, ID_BUT_OPEN
|
||||
ini_panel key_but_save, ID_BUT_SAVE
|
||||
ini_panel key_but_save_as,ID_BUT_SAVE_AS
|
||||
ini_panel key_but_select, ID_BUT_SELECT
|
||||
ini_panel key_but_cut, ID_BUT_CUT
|
||||
ini_panel key_but_copy, ID_BUT_COPY
|
||||
ini_panel key_but_paste, ID_BUT_PASTE
|
||||
ini_panel key_but_find, ID_BUT_FIND
|
||||
ini_panel key_but_replace,ID_BUT_REPLACE
|
||||
ini_panel key_but_key_words,ID_BUT_KEY_WORDS
|
||||
ini_panel key_but_upper, ID_BUT_UPPER
|
||||
ini_panel key_but_lower, ID_BUT_LOWER
|
||||
ini_panel key_but_reverse,ID_BUT_REVERSE
|
||||
ini_panel key_but_undo, ID_BUT_UNDO
|
||||
ini_panel key_but_redo, ID_BUT_REDO
|
||||
ini_panel key_but_invisible,ID_BUT_INVISIBLE
|
||||
ini_panel key_but_syntax_list,ID_BUT_SYNTAX_LIST
|
||||
ini_panel key_but_syntax_mode,ID_BUT_SYNTAX_MODE
|
||||
ini_panel key_but_convert_1251_866,ID_BUT_CONVERT_1251_866
|
||||
ini_panel key_but_convert_866_1251,ID_BUT_CONVERT_866_1251
|
||||
;䠩<><E4A0A9><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>७<EFBFBD><E0A5AD>
|
||||
xor edx,edx
|
||||
mov ebx,synt_auto_open
|
||||
@@:
|
||||
;<3B><>६ <20><><EFBFBD> 䠩<EFBFBD><EFBFBD>
|
||||
stdcall [ini_get_str],file_name,ini_sec_options,key_synt_file,ebx,32,ini_def_synt_f
|
||||
cmp byte[ebx],0
|
||||
je @f
|
||||
inc byte[key_synt_file.numb]
|
||||
add ebx,32
|
||||
;<3B><>६ <20><><EFBFBD><EFBFBD><EFBFBD>७<EFBFBD><E0A5AD>
|
||||
stdcall [ini_get_str],file_name,ini_sec_options,key_synt_ext,ebx,32,ini_def_synt_f
|
||||
inc byte[key_synt_ext.numb]
|
||||
add ebx,32
|
||||
inc edx
|
||||
cmp edx,max_synt_auto_open
|
||||
jl @b
|
||||
@@:
|
||||
|
||||
;--- load color option file ---
|
||||
stdcall open_unpac_synt_file,[fn_col_option]
|
||||
|
||||
;--- get cmd line ---
|
||||
cmp byte[openfile_path+3],0 ;openfile_path
|
||||
je @f ;if file names exist
|
||||
mov esi,openfile_path
|
||||
stdcall auto_open_syntax,esi
|
||||
call but_no_msg_OpenFile
|
||||
@@:
|
||||
|
||||
|
||||
|
||||
align 16
|
||||
red_win:
|
||||
call draw_window
|
||||
|
||||
align 16
|
||||
still:
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp dword[exit_code],1
|
||||
jne @f
|
||||
call ted_Exit
|
||||
jmp still
|
||||
@@:
|
||||
|
||||
cmp al,1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
jz red_win
|
||||
cmp al,2
|
||||
jz key
|
||||
cmp al,3
|
||||
jz button
|
||||
cmp al,6 ;<3B><><EFBFBD><EFBFBD>
|
||||
jne @f
|
||||
call mouse
|
||||
@@:
|
||||
jmp still
|
||||
|
||||
align 16
|
||||
mouse:
|
||||
stdcall [kmainmenu_dispatch_cursorevent], [main_menu]
|
||||
|
||||
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
|
||||
cmp word[tedit0.wnd.top],ax
|
||||
jg .no_edit
|
||||
shr eax,16
|
||||
cmp word[tedit0.wnd.left],ax
|
||||
jg .no_edit
|
||||
mcall SF_MOUSE_GET,SSF_BUTTON_EXT
|
||||
bt eax,24 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 饫<><E9A5AB><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
jnc @f
|
||||
stdcall [ted_but_select_word], tedit0
|
||||
ret
|
||||
@@:
|
||||
stdcall [ted_mouse], tedit0
|
||||
.no_edit:
|
||||
|
||||
;<3B><EFBFBD>ઠ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
cmp byte[tedit0.panel_id],TED_PANEL_FIND
|
||||
jne @f
|
||||
stdcall [edit_box_mouse], edit_find
|
||||
stdcall [option_box_mouse], opt_grlist1
|
||||
stdcall [check_box_mouse], ch1
|
||||
@@:
|
||||
cmp byte[tedit0.panel_id],TED_PANEL_REPLACE
|
||||
jne @f
|
||||
stdcall [edit_box_mouse], edit_find
|
||||
stdcall [edit_box_mouse], edit_replace
|
||||
stdcall [option_box_mouse], opt_grlist1
|
||||
@@:
|
||||
cmp byte[tedit0.panel_id],TED_PANEL_SYNTAX
|
||||
jne @f
|
||||
stdcall [tl_mouse], tree1
|
||||
@@:
|
||||
cmp byte[tedit0.panel_id],TED_PANEL_GOTO
|
||||
jne @f
|
||||
stdcall [edit_box_mouse], edit_goto
|
||||
@@:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
;output:
|
||||
; ah = symbol
|
||||
align 16
|
||||
proc KeyConvertToASCII uses ebx, table:dword
|
||||
mov ebx,dword[table] ;convert scan to ascii
|
||||
shr ax,8
|
||||
add bx,ax
|
||||
mov ah,byte[ebx]
|
||||
ret
|
||||
endp
|
||||
|
||||
align 16
|
||||
key:
|
||||
mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS ;66.3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ﭨ<EFBFBD> <20><>ࠢ<EFBFBD><E0A0A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
xor esi,esi
|
||||
mov ecx,1
|
||||
test al,3 ;[Shift]
|
||||
jz @f
|
||||
mov cl,2
|
||||
or esi,KM_SHIFT
|
||||
@@:
|
||||
test al,0x0c ;[Ctrl]
|
||||
jz @f
|
||||
or esi,KM_CTRL
|
||||
@@:
|
||||
test al,0x30 ;[Alt]
|
||||
jz @f
|
||||
mov cl,3
|
||||
or esi,KM_ALT
|
||||
@@:
|
||||
test al,0x80 ;[NumLock]
|
||||
jz @f
|
||||
or esi,KM_NUMLOCK
|
||||
@@:
|
||||
|
||||
mcall SF_SYSTEM_GET,SSF_KEYBOARD_LAYOUT,,conv_tabl ;26.2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>᪫<EFBFBD><E1AAAB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mcall SF_GET_KEY
|
||||
stdcall [tl_key], tree1
|
||||
|
||||
test word[edit_replace.flags],ed_focus ;<3B> <20><> <20> 䮪<><E4AEAA><EFBFBD>, <20><>室<EFBFBD><E5AEA4>
|
||||
je @f
|
||||
cmp ah,0x80 ;if key up
|
||||
ja still
|
||||
cmp ah,42 ;[Shift] (left)
|
||||
je still
|
||||
cmp ah,54 ;[Shift] (right)
|
||||
je still
|
||||
cmp ah,56 ;[Alt]
|
||||
je still
|
||||
cmp ah,29 ;[Ctrl]
|
||||
je still
|
||||
cmp ah,69 ;[Pause Break]
|
||||
je still
|
||||
|
||||
stdcall KeyConvertToASCII, conv_tabl
|
||||
stdcall [edit_box_key], edit_replace
|
||||
jmp still
|
||||
@@:
|
||||
test word[edit_find.flags],ed_focus ;<3B> <20><> <20> 䮪<><E4AEAA><EFBFBD>, <20><>室<EFBFBD><E5AEA4>
|
||||
je @f
|
||||
cmp ah,0x80 ;if key up
|
||||
ja still
|
||||
cmp ah,42 ;[Shift] (left)
|
||||
je still
|
||||
cmp ah,54 ;[Shift] (right)
|
||||
je still
|
||||
cmp ah,56 ;[Alt]
|
||||
je still
|
||||
cmp ah,29 ;[Ctrl]
|
||||
je still
|
||||
cmp ah,69 ;[Pause Break]
|
||||
je still
|
||||
|
||||
stdcall KeyConvertToASCII, conv_tabl
|
||||
stdcall [edit_box_key], edit_find
|
||||
jmp still
|
||||
@@:
|
||||
test word[edit_goto.flags],ed_focus ;<3B> <20><> <20> 䮪<><E4AEAA><EFBFBD>, <20><>室<EFBFBD><E5AEA4>
|
||||
je @f
|
||||
cmp ah,0x80 ;if key up
|
||||
ja still
|
||||
cmp ah,42 ;[Shift] (left)
|
||||
je still
|
||||
cmp ah,54 ;[Shift] (right)
|
||||
je still
|
||||
cmp ah,56 ;[Alt]
|
||||
je still
|
||||
cmp ah,29 ;[Ctrl]
|
||||
je still
|
||||
cmp ah,69 ;[Pause Break]
|
||||
je still
|
||||
|
||||
stdcall KeyConvertToASCII, conv_tabl
|
||||
stdcall [edit_box_key], edit_goto
|
||||
jmp still
|
||||
@@:
|
||||
|
||||
stdcall [ted_key], tedit0, conv_tabl,esi
|
||||
jmp still
|
||||
|
||||
align 4
|
||||
edit_replace edit_box TED_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_replace, mouse_dd, 0
|
||||
edit_find edit_box TED_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 300, buf_find, mouse_dd, 0
|
||||
edit_goto edit_box TED_PANEL_WIDTH-1, 0, 20, 0xffffff, 0xff80, 0xff0000, 0xff, 0x4080, 10, buf_goto, mouse_dd, 0
|
||||
|
||||
unpac_mem dd 0
|
||||
|
||||
;library structures
|
||||
l_libs_start:
|
||||
lib0 l_libs lib_name_0, file_name, system_dir_0, import_box_lib
|
||||
lib1 l_libs lib_name_1, file_name, system_dir_1, import_msgbox_lib
|
||||
lib2 l_libs lib_name_2, file_name, system_dir_2, import_proclib
|
||||
lib3 l_libs lib_name_3, file_name, system_dir_3, import_libimg
|
||||
lib4 l_libs lib_name_4, file_name, system_dir_4, import_libini
|
||||
lib5 l_libs lib_name_5, file_name, system_dir_5, import_libkmenu
|
||||
load_lib_end:
|
||||
|
||||
IncludeIGlobals
|
||||
hed db 'TextEdit '
|
||||
i_end:
|
||||
openfile_path: ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EFBFBD><EFBFBD> <20> 䠩<><E4A0A9> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ࠡ<><EFBFBD><EFBFBD>
|
||||
rb 4096
|
||||
dir_mem rb 32+304*count_of_dir_list_files
|
||||
wnd_s_pos: ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>⮢<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>樨 <20><><EFBFBD><EFBFBD>
|
||||
rq 1
|
||||
last_open_synt_file rb 32 ;<3B><><EFBFBD> <20><><EFBFBD><E1ABA5><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>祭<EFBFBD><E7A5AD><EFBFBD><EFBFBD> 䠩<><E4A0A9> ᨭ⠪<E1A8AD><E2A0AA><EFBFBD><EFBFBD>
|
||||
buf rb BUF_SIZE ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD> <20> <20><>⠢<EFBFBD><E2A0A2>
|
||||
buf_find rb 302 ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD>᪠ ⥪<><E2A5AA><EFBFBD>
|
||||
buf_replace rb 302 ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ⥪<><E2A5AA><EFBFBD>
|
||||
buf_goto rb 12 ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD>室<EFBFBD> <20><> <20><>ப<EFBFBD>
|
||||
sc system_colors
|
||||
IncludeUGlobals
|
||||
align 16
|
||||
procinfo process_information
|
||||
rb 1024
|
||||
thread:
|
||||
rb 4096
|
||||
align 16
|
||||
thread_coords:
|
||||
rb 4096
|
||||
align 16
|
||||
stacktop:
|
||||
sys_path: ;<3B><><EFBFBD><EFBFBD> <20><><EFBFBD>㤠 <20><><EFBFBD><EFBFBD><EFBFBD>⨫<EFBFBD><E2A8AB> <20>ᯮ<EFBFBD><E1AFAE>塞<EFBFBD><EFA5AC> 䠩<>
|
||||
rb 4096
|
||||
file_name: ;<3B><>ࠬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>᪠
|
||||
rb 4096
|
||||
syntax_path: ;<3B><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>砥<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䠩<EFBFBD><EFBFBD> ᨭ⠪<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
rb 4096
|
||||
plugin_path:
|
||||
rb 4096
|
||||
text_work_area: ;<3B><><EFBFBD><EFBFBD> <20> 䠩<><E4A0A9>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>뢠<EFBFBD><EBA2A0><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>
|
||||
rb 4096
|
||||
filename_area: ;<3B><><EFBFBD> 䠩<><E4A0A9> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
rb 256
|
||||
file_info:
|
||||
rb 40
|
||||
mem:
|
||||
|
@@ -1,389 +1,395 @@
|
||||
use32
|
||||
org 0
|
||||
db 'MENUET01' ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20>ᯮ<EFBFBD><E1AFAE>塞<EFBFBD><EFA5AC><EFBFBD> 䠩<><E4A0A9> <20>ᥣ<EFBFBD><E1A5A3> 8 <20><><EFBFBD><EFBFBD>
|
||||
dd 1, start, i_end, mem, stacktop, file_name, sys_path
|
||||
|
||||
MAX_COLOR_WORD_LEN equ 40
|
||||
BUF_SIZE equ 4096 ;buffer for copy|paste
|
||||
CAPT_PATH_WIDTH equ 50 ;<3B><>ਭ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>। ⥪<>⮢<EFBFBD><E2AEA2> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
include '../../macros.inc'
|
||||
include '../../proc32.inc'
|
||||
include '../../KOSfuncs.inc'
|
||||
include '../../load_img.inc'
|
||||
include '../../load_lib.mac'
|
||||
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
|
||||
include '../../system/skincfg/trunk/kglobals.inc'
|
||||
include '../../system/skincfg/trunk/unpacker.inc'
|
||||
include 'te_data.inc'
|
||||
include 'te_work.inc' ;text work functions
|
||||
|
||||
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
|
||||
|
||||
icon_tl_sys dd 0 ;㪠<><E3AAA0>⥫<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20>࠭<EFBFBD><E0A0AD><EFBFBD><EFBFBD> <20><><EFBFBD>⥬<EFBFBD><E2A5AC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
align 4
|
||||
start:
|
||||
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
|
||||
|
||||
mcall SF_SYS_MISC,SSF_HEAP_INIT
|
||||
or eax,eax
|
||||
jz button.exit
|
||||
|
||||
mcall SF_KEYBOARD,SSF_SET_INPUT_MODE,1 ;scan code
|
||||
mcall SF_SET_EVENTS_MASK,0xC0000027
|
||||
|
||||
load_libraries l_libs_start,load_lib_end
|
||||
|
||||
;<3B><EFBFBD>ઠ <20><> <>쪮 㤠筮 <20><><EFBFBD>㧨<EFBFBD><E3A7A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⥪<EFBFBD>
|
||||
cmp dword[lib0+ll_struc_size-4],0
|
||||
jz @f
|
||||
mcall -1 ;exit not correct
|
||||
@@:
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
stdcall [tl_data_init], tree1
|
||||
|
||||
; <20><>⠥<EFBFBD> 䠩<> <20> <20><><EFBFBD><EFBFBD><EFBFBD>ࠬ<EFBFBD> <20> <20><><EFBFBD><EFBFBD>ﬨ
|
||||
include_image_file '..\..\media\log_el\trunk\tl_sys_16.png', icon_tl_sys
|
||||
mov eax,[icon_tl_sys]
|
||||
mov [tree1.data_img_sys],eax
|
||||
;---------------------------------------------------------------------
|
||||
; <20><>⠥<EFBFBD> bmp 䠩<> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 㧫<><E3A7AB>
|
||||
include_image_file '..\t_edit\tl_nod_16.png', icon_tl_sys
|
||||
mov eax,[icon_tl_sys]
|
||||
mov [tree1.data_img],eax
|
||||
;------------------------------------------------------------------------------
|
||||
copy_path fn_syntax_dir,sys_path,file_name,0 ;<3B><>६ <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20> 䠩<><E4A0A9><EFBFBD><EFBFBD> ᨭ⠪<E1A8AD><E2A0AA><EFBFBD><EFBFBD>
|
||||
mcall SF_FILE,tree_file_struct
|
||||
|
||||
cmp ebx,2
|
||||
jg @f
|
||||
notify_window_run file_name ;ᮮ<>饭<EFBFBD><E9A5AD> <20> <20><> 㤠<><E3A4A0><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9>
|
||||
jmp .end_dir_init
|
||||
@@:
|
||||
;cmp ebx,0
|
||||
;jle .end_dir_init
|
||||
mov eax,dir_mem+32+40
|
||||
mov ecx,ebx
|
||||
@@:
|
||||
cmp byte[eax],'.' ;䨫<><E4A8AB><EFBFBD>㥬 䠩<><E4A0A9> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '.' <20> '..'
|
||||
je .filter
|
||||
stdcall [tl_node_add],tree1,0x10000,eax ;1*2^16 - <20><><EFBFBD> 1 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
stdcall [tl_cur_next],tree1
|
||||
.filter:
|
||||
add eax,304
|
||||
loop @b
|
||||
stdcall [tl_cur_beg],tree1 ;<3B>⠢<EFBFBD><E2A0A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><>砫<EFBFBD> ᯨ᪠
|
||||
or dword[tree1.style], tl_cursor_pos_limited ;<3B><>࠭<EFBFBD>稢<EFBFBD><E7A8A2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20>।<EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᯨ᪠
|
||||
.end_dir_init:
|
||||
|
||||
xor eax,eax
|
||||
inc eax
|
||||
mov [scrol_w1.type],eax
|
||||
mov [scrol_h1.type],eax
|
||||
mov [ws_dir_lbox.type],eax
|
||||
|
||||
;--- load color option file ---
|
||||
stdcall [ted_init], tedit0
|
||||
mov byte[file_name],0
|
||||
|
||||
align 4
|
||||
red_win:
|
||||
call draw_window
|
||||
|
||||
align 4
|
||||
still:
|
||||
mcall SF_WAIT_EVENT
|
||||
|
||||
cmp al,1 ;<3B><><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
jz red_win
|
||||
cmp al,2
|
||||
jz key
|
||||
cmp al,3
|
||||
jz button
|
||||
cmp al,6
|
||||
jz mouse
|
||||
|
||||
jmp still
|
||||
|
||||
|
||||
align 4
|
||||
draw_window:
|
||||
pushad
|
||||
mcall SF_REDRAW,SSF_BEGIN_DRAW
|
||||
|
||||
mov edx,[sc.work]
|
||||
or edx,0x33000000
|
||||
mov edi,hed
|
||||
mcall SF_CREATE_WINDOW,<10,555>,<10,333>
|
||||
|
||||
mcall SF_THREAD_INFO,procinfo,-1
|
||||
mov edi,tedit0 ;<3B><><EFBFBD>祭<EFBFBD><E7A5AD> edi <20>㦭<EFBFBD> <20><><EFBFBD> EvSize <20> ted_wnd_t
|
||||
call EvSize
|
||||
|
||||
mov esi,[sc.work_button];0xd0
|
||||
mcall SF_DEFINE_BUTTON,5*65536+90,195*65536+20,200
|
||||
|
||||
mov ebx,100*65536+85
|
||||
mov ecx,195*65536+20
|
||||
mov edx,201
|
||||
mov esi,0xd00000
|
||||
mcall
|
||||
|
||||
mov ecx,[sc.work_button_text]
|
||||
or ecx,0x80000000
|
||||
mcall SF_DRAW_TEXT,10*65536+200,,txt_load_f
|
||||
|
||||
mov ecx,0xffff00
|
||||
or ecx,0x80000000
|
||||
mcall ,105*65536+200,,txt_save_f
|
||||
|
||||
mov ecx,[sc.work_text]
|
||||
or ecx,0x80000000
|
||||
mcall ,195*65536+10,,txt_inp_file
|
||||
|
||||
add ebx,20
|
||||
mov edx,txt_out_file
|
||||
int 0x40
|
||||
|
||||
stdcall [PathShow_draw], PathShow_data_1
|
||||
|
||||
stdcall [edit_box_draw], edit1
|
||||
stdcall [tl_draw], tree1
|
||||
|
||||
;scroll 1
|
||||
mov [ws_dir_lbox.all_redraw],1
|
||||
stdcall [scrollbar_ver_draw],ws_dir_lbox
|
||||
stdcall [ted_draw], tedit0
|
||||
|
||||
mcall SF_REDRAW,SSF_END_DRAW
|
||||
popad
|
||||
ret
|
||||
|
||||
MIN_M_WND_H equ 100 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쭠<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
;input:
|
||||
; edi = pointer to tedit struct
|
||||
align 4
|
||||
EvSize:
|
||||
pushad
|
||||
mov ebx,ted_scr_h
|
||||
mov esi,ted_scr_w
|
||||
|
||||
m2m ted_wnd_w,[procinfo.client_box.width] ;<3B>⠢<EFBFBD><E2A0A2> <20><>ਭ<EFBFBD> <20><><EFBFBD><EFBFBD> ।<><E0A5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ࠢ<><E0A0A2><EFBFBD> <20><>ਭ<EFBFBD> <20>ᥣ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
mov eax,ted_wnd_l
|
||||
sub ted_wnd_w,eax ;<3B>⭨<EFBFBD><E2ADA8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <><E1ABA5>
|
||||
movzx eax,word[esi+sb_offs_size_x]
|
||||
sub ted_wnd_w,eax ;<3B>⭨<EFBFBD><E2ADA8><EFBFBD><EFBFBD> <20><>ਭ<EFBFBD> <20><><EFBFBD><EFBFBD>. <20><><EFBFBD><E0AEAB><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
m2m ted_wnd_h,[procinfo.client_box.height] ;<3B>⠢<EFBFBD><E2A0A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ।<><E0A5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ࠢ<><E0A0A2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ᥣ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
cmp ted_wnd_h,MIN_M_WND_H
|
||||
jg @f
|
||||
mov ted_wnd_h,MIN_M_WND_H
|
||||
@@:
|
||||
|
||||
movzx eax,word[ebx+sb_offs_size_y]
|
||||
sub ted_wnd_h,eax ;<3B>⭨<EFBFBD><E2ADA8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ਧ. <20><><EFBFBD><E0AEAB><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov eax,ted_wnd_t
|
||||
sub ted_wnd_h,eax ;<3B>⭨<EFBFBD><E2ADA8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᢥ<><E1A2A5><EFBFBD>
|
||||
|
||||
stdcall [ted_init_scroll_bars], tedit0,2
|
||||
popad
|
||||
ret
|
||||
|
||||
align 4
|
||||
mouse:
|
||||
stdcall [tl_mouse],tree1
|
||||
stdcall [edit_box_mouse],edit1
|
||||
stdcall [ted_mouse], tedit0
|
||||
jmp still
|
||||
|
||||
;output:
|
||||
; ah = symbol
|
||||
align 4
|
||||
proc KeyConvertToASCII, table:dword
|
||||
push ebx
|
||||
mov ebx,dword[table] ;convert scan to ascii
|
||||
shr ax,8
|
||||
add bx,ax
|
||||
mov ah,byte[ebx]
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
key:
|
||||
mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS ;66.3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ﭨ<EFBFBD> <20><>ࠢ<EFBFBD><E0A0A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
xor esi,esi
|
||||
mov ecx,1
|
||||
test al,3 ;[Shift]
|
||||
jz @f
|
||||
mov cl,2
|
||||
or esi,KM_SHIFT
|
||||
@@:
|
||||
test al,0x0c ;[Ctrl]
|
||||
jz @f
|
||||
or esi,KM_CTRL
|
||||
@@:
|
||||
test al,0x30 ;[Alt]
|
||||
jz @f
|
||||
mov cl,3
|
||||
or esi,KM_ALT
|
||||
@@:
|
||||
test al,0x80 ;[NumLock]
|
||||
jz @f
|
||||
or esi,KM_NUMLOCK
|
||||
@@:
|
||||
|
||||
mcall SF_SYSTEM_GET,SSF_KEYBOARD_LAYOUT,,conv_tabl ;26.2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>᪫<EFBFBD><E1AAAB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mcall SF_GET_KEY
|
||||
stdcall [tl_key],tree1
|
||||
|
||||
test word [edit1.flags],10b;ed_focus ; <20> <20><> <20> 䮪<><E4AEAA><EFBFBD>, <20><>室<EFBFBD><E5AEA4>
|
||||
je @f
|
||||
cmp ah,0x80 ;if key up
|
||||
ja still
|
||||
cmp ah,42 ;[Shift] (left)
|
||||
je still
|
||||
cmp ah,54 ;[Shift] (right)
|
||||
je still
|
||||
cmp ah,56 ;[Alt]
|
||||
je still
|
||||
cmp ah,29 ;[Ctrl]
|
||||
je still
|
||||
cmp ah,69 ;[Pause Break]
|
||||
je still
|
||||
|
||||
stdcall KeyConvertToASCII, conv_tabl
|
||||
stdcall [edit_box_key],edit1
|
||||
jmp still
|
||||
@@:
|
||||
|
||||
stdcall [ted_key], tedit0, conv_tabl,esi
|
||||
jmp still
|
||||
|
||||
align 4
|
||||
button:
|
||||
mcall SF_GET_BUTTON
|
||||
|
||||
cmp ah,200
|
||||
jne @f
|
||||
call but_OpenSyntax
|
||||
@@:
|
||||
cmp ah,201
|
||||
jne @f
|
||||
call but_SaveSyntax
|
||||
@@:
|
||||
|
||||
cmp ah,1
|
||||
jne still
|
||||
.exit:
|
||||
stdcall mem.Free,[options_file]
|
||||
stdcall mem.Free,[unpac_mem]
|
||||
|
||||
stdcall [tl_data_clear], tree1
|
||||
stdcall [ted_delete], tedit0
|
||||
mcall SF_TERMINATE_PROCESS ;<3B><>室 <20><> <20>ணࠬ<E0AEA3><E0A0AC>
|
||||
|
||||
align 4
|
||||
but_OpenSyntax:
|
||||
push eax
|
||||
stdcall [tl_node_get_data],tree1
|
||||
mov [fn_col_option],eax
|
||||
call InitColText
|
||||
pop eax
|
||||
ret
|
||||
|
||||
align 4
|
||||
but_SaveSyntax:
|
||||
stdcall [ted_save_file], tedit0,run_file_70,[edit1.text]
|
||||
ret
|
||||
|
||||
;description:
|
||||
; <20>㭪<EFBFBD><E3ADAA><EFBFBD> <20><><EFBFBD>뢠<EFBFBD><EBA2A0><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>⨨ Ctrl+N,O,F,S,H,G
|
||||
align 4
|
||||
proc ted_but_ctrl_all uses eax, opt_key:dword
|
||||
mov eax,[opt_key]
|
||||
cmp al,'N' ;Ctrl+N
|
||||
jne @f
|
||||
call but_ctrl_n
|
||||
jmp .end0
|
||||
@@:
|
||||
cmp al,'O' ;Ctrl+O
|
||||
jne @f
|
||||
call but_ctrl_o
|
||||
@@:
|
||||
;cmp al,'S' ;Ctrl+S
|
||||
;cmp al,'F' ;Ctrl+F
|
||||
;cmp al,'G' ;Ctrl+G
|
||||
;cmp al,'H' ;Ctrl+H
|
||||
.end0:
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
but_ctrl_o:
|
||||
push eax
|
||||
call get_wnd_in_focus
|
||||
or eax,eax
|
||||
jz @f
|
||||
stdcall [ted_open_file], eax,str_file_70,[edit1.text]
|
||||
@@:
|
||||
pop eax
|
||||
ret
|
||||
|
||||
;ᮧ<><E1AEA7><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9>
|
||||
align 4
|
||||
but_ctrl_n:
|
||||
push eax
|
||||
call get_wnd_in_focus
|
||||
or eax,eax
|
||||
jz @f
|
||||
stdcall [ted_clear], eax,1
|
||||
stdcall [ted_draw], eax
|
||||
@@:
|
||||
pop eax
|
||||
ret
|
||||
|
||||
;<3B><>।<EFBFBD><E0A5A4>塞 <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> ।<><E0A5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> 䮪<><E4AEAA><EFBFBD>
|
||||
align 4
|
||||
get_wnd_in_focus:
|
||||
xor eax,eax
|
||||
cmp dword[el_focus],tedit0
|
||||
jne @f
|
||||
mov eax,tedit0
|
||||
@@:
|
||||
;cmp dword[el_focus],tedit1
|
||||
;jne @f
|
||||
; mov eax,tedit1
|
||||
;@@:
|
||||
ret
|
||||
|
||||
hed db 'TextEditor syntax file converter 18.12.20',0 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
conv_tabl rb 128 ; ⠡<><E2A0A1><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD> scan-<2D><><EFBFBD><EFBFBD> <20> ascii-<2D><><EFBFBD>
|
||||
|
||||
txt_load_f db '<27><><EFBFBD><EFBFBD>. 䠩<>',0
|
||||
txt_save_f db '<27><><EFBFBD><EFBFBD>. 䠩<>',0
|
||||
txt_inp_file db '<27><><EFBFBD>. 䠩<>:',0
|
||||
txt_out_file db '<27><><EFBFBD>. 䠩<>:',0
|
||||
|
||||
;library structures
|
||||
l_libs_start:
|
||||
lib0 l_libs lib_name_0, file_name, system_dir_0, import_box_lib
|
||||
lib1 l_libs lib_name_1, file_name, system_dir_1, import_libimg
|
||||
load_lib_end:
|
||||
|
||||
IncludeIGlobals
|
||||
|
||||
align 16
|
||||
i_end:
|
||||
IncludeUGlobals
|
||||
procinfo process_information
|
||||
rb 1024
|
||||
thread:
|
||||
rb 1024
|
||||
stacktop:
|
||||
sys_path rb 4096
|
||||
file_name rb 4096
|
||||
file_name_rez rb 4096
|
||||
mem:
|
||||
; SPDX-License-Identifier: NOASSERTION
|
||||
;
|
||||
|
||||
; Text encoded with Code Page 866 - Cyrillic
|
||||
|
||||
|
||||
use32
|
||||
org 0
|
||||
db 'MENUET01' ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20>ᯮ<EFBFBD><E1AFAE>塞<EFBFBD><EFA5AC><EFBFBD> 䠩<><E4A0A9> <20>ᥣ<EFBFBD><E1A5A3> 8 <20><><EFBFBD><EFBFBD>
|
||||
dd 1, start, i_end, mem, stacktop, file_name, sys_path
|
||||
|
||||
MAX_COLOR_WORD_LEN equ 40
|
||||
BUF_SIZE equ 4096 ;buffer for copy|paste
|
||||
CAPT_PATH_WIDTH equ 50 ;<3B><>ਭ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>। ⥪<>⮢<EFBFBD><E2AEA2> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
include '../../macros.inc'
|
||||
include '../../proc32.inc'
|
||||
include '../../KOSfuncs.inc'
|
||||
include '../../load_img.inc'
|
||||
include '../../load_lib.mac'
|
||||
include '../../develop/libraries/box_lib/box_lib.mac'
|
||||
include '../../system/skincfg/trunk/kglobals.inc'
|
||||
include '../../system/skincfg/trunk/unpacker.inc'
|
||||
include 'te_data.inc'
|
||||
include 'te_work.inc' ;text work functions
|
||||
|
||||
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
|
||||
|
||||
icon_tl_sys dd 0 ;㪠<><E3AAA0>⥫<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20>࠭<EFBFBD><E0A0AD><EFBFBD><EFBFBD> <20><><EFBFBD>⥬<EFBFBD><E2A5AC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
align 4
|
||||
start:
|
||||
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
|
||||
|
||||
mcall SF_SYS_MISC,SSF_HEAP_INIT
|
||||
or eax,eax
|
||||
jz button.exit
|
||||
|
||||
mcall SF_KEYBOARD,SSF_SET_INPUT_MODE,1 ;scan code
|
||||
mcall SF_SET_EVENTS_MASK,0xC0000027
|
||||
|
||||
load_libraries l_libs_start,load_lib_end
|
||||
|
||||
;<EFBFBD><EFBFBD>ઠ <20><> <>쪮 㤠筮 <20><><EFBFBD>㧨<EFBFBD><E3A7A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⥪<EFBFBD>
|
||||
cmp dword[lib0+ll_struc_size-4],0
|
||||
jz @f
|
||||
mcall -1 ;exit not correct
|
||||
@@:
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
stdcall [tl_data_init], tree1
|
||||
|
||||
; <20><>⠥<EFBFBD> 䠩<> <20> <20><><EFBFBD><EFBFBD><EFBFBD>ࠬ<EFBFBD> <20> <20><><EFBFBD><EFBFBD>ﬨ
|
||||
include_image_file '..\..\media\log_el\trunk\tl_sys_16.png', icon_tl_sys
|
||||
mov eax,[icon_tl_sys]
|
||||
mov [tree1.data_img_sys],eax
|
||||
;---------------------------------------------------------------------
|
||||
; <20><>⠥<EFBFBD> bmp 䠩<> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 㧫<><E3A7AB>
|
||||
include_image_file '..\t_edit\tl_nod_16.png', icon_tl_sys
|
||||
mov eax,[icon_tl_sys]
|
||||
mov [tree1.data_img],eax
|
||||
;------------------------------------------------------------------------------
|
||||
copy_path fn_syntax_dir,sys_path,file_name,0 ;<3B><>६ <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20> 䠩<><E4A0A9><EFBFBD><EFBFBD> ᨭ⠪<E1A8AD><E2A0AA><EFBFBD><EFBFBD>
|
||||
mcall SF_FILE,tree_file_struct
|
||||
|
||||
cmp ebx,2
|
||||
jg @f
|
||||
notify_window_run file_name ;ᮮ<>饭<EFBFBD><E9A5AD> <20> <20><> 㤠<><E3A4A0><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9>
|
||||
jmp .end_dir_init
|
||||
@@:
|
||||
;cmp ebx,0
|
||||
;jle .end_dir_init
|
||||
mov eax,dir_mem+32+40
|
||||
mov ecx,ebx
|
||||
@@:
|
||||
cmp byte[eax],'.' ;䨫<><E4A8AB><EFBFBD>㥬 䠩<><E4A0A9> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '.' <20> '..'
|
||||
je .filter
|
||||
stdcall [tl_node_add],tree1,0x10000,eax ;1*2^16 - <20><><EFBFBD> 1 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
stdcall [tl_cur_next],tree1
|
||||
.filter:
|
||||
add eax,304
|
||||
loop @b
|
||||
stdcall [tl_cur_beg],tree1 ;<3B>⠢<EFBFBD><E2A0A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><>砫<EFBFBD> ᯨ᪠
|
||||
or dword[tree1.style], tl_cursor_pos_limited ;<3B><>࠭<EFBFBD>稢<EFBFBD><E7A8A2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20>।<EFBFBD><E0A5A4><EFBFBD><EFBFBD> ᯨ᪠
|
||||
.end_dir_init:
|
||||
|
||||
xor eax,eax
|
||||
inc eax
|
||||
mov [scrol_w1.type],eax
|
||||
mov [scrol_h1.type],eax
|
||||
mov [ws_dir_lbox.type],eax
|
||||
|
||||
;--- load color option file ---
|
||||
stdcall [ted_init], tedit0
|
||||
mov byte[file_name],0
|
||||
|
||||
align 4
|
||||
red_win:
|
||||
call draw_window
|
||||
|
||||
align 4
|
||||
still:
|
||||
mcall SF_WAIT_EVENT
|
||||
|
||||
cmp al,1 ;<3B><><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
jz red_win
|
||||
cmp al,2
|
||||
jz key
|
||||
cmp al,3
|
||||
jz button
|
||||
cmp al,6
|
||||
jz mouse
|
||||
|
||||
jmp still
|
||||
|
||||
|
||||
align 4
|
||||
draw_window:
|
||||
pushad
|
||||
mcall SF_REDRAW,SSF_BEGIN_DRAW
|
||||
|
||||
mov edx,[sc.work]
|
||||
or edx,0x33000000
|
||||
mov edi,hed
|
||||
mcall SF_CREATE_WINDOW,<10,555>,<10,333>
|
||||
|
||||
mcall SF_THREAD_INFO,procinfo,-1
|
||||
mov edi,tedit0 ;<3B><><EFBFBD>祭<EFBFBD><E7A5AD> edi <20>㦭<EFBFBD> <20><><EFBFBD> EvSize <20> ted_wnd_t
|
||||
call EvSize
|
||||
|
||||
mov esi,[sc.work_button];0xd0
|
||||
mcall SF_DEFINE_BUTTON,5*65536+90,195*65536+20,200
|
||||
|
||||
mov ebx,100*65536+85
|
||||
mov ecx,195*65536+20
|
||||
mov edx,201
|
||||
mov esi,0xd00000
|
||||
mcall
|
||||
|
||||
mov ecx,[sc.work_button_text]
|
||||
or ecx,0x80000000
|
||||
mcall SF_DRAW_TEXT,10*65536+200,,txt_load_f
|
||||
|
||||
mov ecx,0xffff00
|
||||
or ecx,0x80000000
|
||||
mcall ,105*65536+200,,txt_save_f
|
||||
|
||||
mov ecx,[sc.work_text]
|
||||
or ecx,0x80000000
|
||||
mcall ,195*65536+10,,txt_inp_file
|
||||
|
||||
add ebx,20
|
||||
mov edx,txt_out_file
|
||||
int 0x40
|
||||
|
||||
stdcall [PathShow_draw], PathShow_data_1
|
||||
|
||||
stdcall [edit_box_draw], edit1
|
||||
stdcall [tl_draw], tree1
|
||||
|
||||
;scroll 1
|
||||
mov [ws_dir_lbox.all_redraw],1
|
||||
stdcall [scrollbar_ver_draw],ws_dir_lbox
|
||||
stdcall [ted_draw], tedit0
|
||||
|
||||
mcall SF_REDRAW,SSF_END_DRAW
|
||||
popad
|
||||
ret
|
||||
|
||||
MIN_M_WND_H equ 100 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쭠<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
;input:
|
||||
; edi = pointer to tedit struct
|
||||
align 4
|
||||
EvSize:
|
||||
pushad
|
||||
mov ebx,ted_scr_h
|
||||
mov esi,ted_scr_w
|
||||
|
||||
m2m ted_wnd_w,[procinfo.client_box.width] ;<3B>⠢<EFBFBD><E2A0A2> <20><>ਭ<EFBFBD> <20><><EFBFBD><EFBFBD> ।<><E0A5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ࠢ<><E0A0A2><EFBFBD> <20><>ਭ<EFBFBD> <20>ᥣ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
mov eax,ted_wnd_l
|
||||
sub ted_wnd_w,eax ;<3B>⭨<EFBFBD><E2ADA8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <><E1ABA5>
|
||||
movzx eax,word[esi+sb_offs_size_x]
|
||||
sub ted_wnd_w,eax ;<3B>⭨<EFBFBD><E2ADA8><EFBFBD><EFBFBD> <20><>ਭ<EFBFBD> <20><><EFBFBD><EFBFBD>. <20><><EFBFBD><E0AEAB><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
m2m ted_wnd_h,[procinfo.client_box.height] ;<3B>⠢<EFBFBD><E2A0A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ।<><E0A5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ࠢ<><E0A0A2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ᥣ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
cmp ted_wnd_h,MIN_M_WND_H
|
||||
jg @f
|
||||
mov ted_wnd_h,MIN_M_WND_H
|
||||
@@:
|
||||
|
||||
movzx eax,word[ebx+sb_offs_size_y]
|
||||
sub ted_wnd_h,eax ;<3B>⭨<EFBFBD><E2ADA8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ਧ. <20><><EFBFBD><E0AEAB><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov eax,ted_wnd_t
|
||||
sub ted_wnd_h,eax ;<3B>⭨<EFBFBD><E2ADA8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᢥ<><E1A2A5><EFBFBD>
|
||||
|
||||
stdcall [ted_init_scroll_bars], tedit0,2
|
||||
popad
|
||||
ret
|
||||
|
||||
align 4
|
||||
mouse:
|
||||
stdcall [tl_mouse],tree1
|
||||
stdcall [edit_box_mouse],edit1
|
||||
stdcall [ted_mouse], tedit0
|
||||
jmp still
|
||||
|
||||
;output:
|
||||
; ah = symbol
|
||||
align 4
|
||||
proc KeyConvertToASCII, table:dword
|
||||
push ebx
|
||||
mov ebx,dword[table] ;convert scan to ascii
|
||||
shr ax,8
|
||||
add bx,ax
|
||||
mov ah,byte[ebx]
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
key:
|
||||
mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS ;66.3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ﭨ<EFBFBD> <20><>ࠢ<EFBFBD><E0A0A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
xor esi,esi
|
||||
mov ecx,1
|
||||
test al,3 ;[Shift]
|
||||
jz @f
|
||||
mov cl,2
|
||||
or esi,KM_SHIFT
|
||||
@@:
|
||||
test al,0x0c ;[Ctrl]
|
||||
jz @f
|
||||
or esi,KM_CTRL
|
||||
@@:
|
||||
test al,0x30 ;[Alt]
|
||||
jz @f
|
||||
mov cl,3
|
||||
or esi,KM_ALT
|
||||
@@:
|
||||
test al,0x80 ;[NumLock]
|
||||
jz @f
|
||||
or esi,KM_NUMLOCK
|
||||
@@:
|
||||
|
||||
mcall SF_SYSTEM_GET,SSF_KEYBOARD_LAYOUT,,conv_tabl ;26.2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>᪫<EFBFBD><E1AAAB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mcall SF_GET_KEY
|
||||
stdcall [tl_key],tree1
|
||||
|
||||
test word [edit1.flags],10b;ed_focus ; <20> <20><> <20> 䮪<><E4AEAA><EFBFBD>, <20><>室<EFBFBD><E5AEA4>
|
||||
je @f
|
||||
cmp ah,0x80 ;if key up
|
||||
ja still
|
||||
cmp ah,42 ;[Shift] (left)
|
||||
je still
|
||||
cmp ah,54 ;[Shift] (right)
|
||||
je still
|
||||
cmp ah,56 ;[Alt]
|
||||
je still
|
||||
cmp ah,29 ;[Ctrl]
|
||||
je still
|
||||
cmp ah,69 ;[Pause Break]
|
||||
je still
|
||||
|
||||
stdcall KeyConvertToASCII, conv_tabl
|
||||
stdcall [edit_box_key],edit1
|
||||
jmp still
|
||||
@@:
|
||||
|
||||
stdcall [ted_key], tedit0, conv_tabl,esi
|
||||
jmp still
|
||||
|
||||
align 4
|
||||
button:
|
||||
mcall SF_GET_BUTTON
|
||||
|
||||
cmp ah,200
|
||||
jne @f
|
||||
call but_OpenSyntax
|
||||
@@:
|
||||
cmp ah,201
|
||||
jne @f
|
||||
call but_SaveSyntax
|
||||
@@:
|
||||
|
||||
cmp ah,1
|
||||
jne still
|
||||
.exit:
|
||||
stdcall mem.Free,[options_file]
|
||||
stdcall mem.Free,[unpac_mem]
|
||||
|
||||
stdcall [tl_data_clear], tree1
|
||||
stdcall [ted_delete], tedit0
|
||||
mcall SF_TERMINATE_PROCESS ;<3B><>室 <20><> <20>ணࠬ<E0AEA3><E0A0AC>
|
||||
|
||||
align 4
|
||||
but_OpenSyntax:
|
||||
push eax
|
||||
stdcall [tl_node_get_data],tree1
|
||||
mov [fn_col_option],eax
|
||||
call InitColText
|
||||
pop eax
|
||||
ret
|
||||
|
||||
align 4
|
||||
but_SaveSyntax:
|
||||
stdcall [ted_save_file], tedit0,run_file_70,[edit1.text]
|
||||
ret
|
||||
|
||||
;description:
|
||||
; <20>㭪<EFBFBD><E3ADAA><EFBFBD> <20><><EFBFBD>뢠<EFBFBD><EBA2A0><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>⨨ Ctrl+N,O,F,S,H,G
|
||||
align 4
|
||||
proc ted_but_ctrl_all uses eax, opt_key:dword
|
||||
mov eax,[opt_key]
|
||||
cmp al,'N' ;Ctrl+N
|
||||
jne @f
|
||||
call but_ctrl_n
|
||||
jmp .end0
|
||||
@@:
|
||||
cmp al,'O' ;Ctrl+O
|
||||
jne @f
|
||||
call but_ctrl_o
|
||||
@@:
|
||||
;cmp al,'S' ;Ctrl+S
|
||||
;cmp al,'F' ;Ctrl+F
|
||||
;cmp al,'G' ;Ctrl+G
|
||||
;cmp al,'H' ;Ctrl+H
|
||||
.end0:
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
but_ctrl_o:
|
||||
push eax
|
||||
call get_wnd_in_focus
|
||||
or eax,eax
|
||||
jz @f
|
||||
stdcall [ted_open_file], eax,str_file_70,[edit1.text]
|
||||
@@:
|
||||
pop eax
|
||||
ret
|
||||
|
||||
;ᮧ<><E1AEA7><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9>
|
||||
align 4
|
||||
but_ctrl_n:
|
||||
push eax
|
||||
call get_wnd_in_focus
|
||||
or eax,eax
|
||||
jz @f
|
||||
stdcall [ted_clear], eax,1
|
||||
stdcall [ted_draw], eax
|
||||
@@:
|
||||
pop eax
|
||||
ret
|
||||
|
||||
;<3B><>।<EFBFBD><E0A5A4>塞 <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> ।<><E0A5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> 䮪<><E4AEAA><EFBFBD>
|
||||
align 4
|
||||
get_wnd_in_focus:
|
||||
xor eax,eax
|
||||
cmp dword[el_focus],tedit0
|
||||
jne @f
|
||||
mov eax,tedit0
|
||||
@@:
|
||||
;cmp dword[el_focus],tedit1
|
||||
;jne @f
|
||||
; mov eax,tedit1
|
||||
;@@:
|
||||
ret
|
||||
|
||||
hed db 'TextEditor syntax file converter 18.12.20',0 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
conv_tabl rb 128 ; ⠡<><E2A0A1><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD> scan-<2D><><EFBFBD><EFBFBD> <20> ascii-<2D><><EFBFBD>
|
||||
|
||||
txt_load_f db '<27><><EFBFBD><EFBFBD>. 䠩<>',0
|
||||
txt_save_f db '<27><><EFBFBD><EFBFBD>. 䠩<>',0
|
||||
txt_inp_file db '<27><><EFBFBD>. 䠩<>:',0
|
||||
txt_out_file db '<27><><EFBFBD>. 䠩<>:',0
|
||||
|
||||
;library structures
|
||||
l_libs_start:
|
||||
lib0 l_libs lib_name_0, file_name, system_dir_0, import_box_lib
|
||||
lib1 l_libs lib_name_1, file_name, system_dir_1, import_libimg
|
||||
load_lib_end:
|
||||
|
||||
IncludeIGlobals
|
||||
|
||||
align 16
|
||||
i_end:
|
||||
IncludeUGlobals
|
||||
procinfo process_information
|
||||
rb 1024
|
||||
thread:
|
||||
rb 1024
|
||||
stacktop:
|
||||
sys_path rb 4096
|
||||
file_name rb 4096
|
||||
file_name_rez rb 4096
|
||||
mem:
|
||||
|
@@ -1,497 +1,497 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2014. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;; terminal for KolibriOS ;;
|
||||
;; ;;
|
||||
;; Written by hidnplayr@kolibrios.org ;;
|
||||
;; ;;
|
||||
;; GNU GENERAL PUBLIC LICENSE ;;
|
||||
;; Version 2, June 1991 ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
format binary as ""
|
||||
|
||||
use32
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01'
|
||||
dd 0x1
|
||||
dd START
|
||||
dd I_END
|
||||
dd IM_END+0x1000
|
||||
dd IM_END+0x1000
|
||||
dd 0, 0
|
||||
|
||||
include '../../proc32.inc'
|
||||
include '../../macros.inc'
|
||||
include '../../dll.inc'
|
||||
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
|
||||
|
||||
|
||||
START:
|
||||
|
||||
mcall 68, 11
|
||||
|
||||
stdcall dll.Load, @IMPORT
|
||||
or eax, eax
|
||||
jnz exit
|
||||
|
||||
mcall 40, EVM_MOUSE + EVM_MOUSE_FILTER + EVM_REDRAW + EVM_BUTTON + EVM_KEY
|
||||
|
||||
invoke init_checkbox, ch1
|
||||
|
||||
red_win:
|
||||
call draw_window
|
||||
|
||||
mainloop:
|
||||
mcall 10
|
||||
|
||||
dec eax
|
||||
jz red_win
|
||||
|
||||
dec eax
|
||||
jz key
|
||||
|
||||
dec eax
|
||||
jz button
|
||||
|
||||
invoke edit_box_mouse, edit1
|
||||
invoke edit_box_mouse, edit2
|
||||
invoke edit_box_mouse, edit3
|
||||
invoke edit_box_mouse, edit4
|
||||
|
||||
invoke option_box_mouse, Option_boxs1
|
||||
invoke option_box_mouse, Option_boxs2
|
||||
|
||||
invoke check_box_mouse, ch1
|
||||
|
||||
jmp mainloop
|
||||
|
||||
button:
|
||||
mcall 17
|
||||
|
||||
cmp ah, 0x10 ; connect button
|
||||
je open_connection
|
||||
|
||||
test ah , ah
|
||||
jz mainloop
|
||||
exit:
|
||||
mcall -1
|
||||
|
||||
key:
|
||||
mcall 2
|
||||
|
||||
cmp ah, 13 ; enter key
|
||||
je open_connection
|
||||
|
||||
invoke edit_box_key, edit1
|
||||
invoke edit_box_key, edit2
|
||||
invoke edit_box_key, edit3
|
||||
invoke edit_box_key, edit4
|
||||
|
||||
jmp mainloop
|
||||
|
||||
|
||||
|
||||
draw_window:
|
||||
; get system colors
|
||||
mcall 48, 3, sc, 40
|
||||
|
||||
mcall 12,1
|
||||
mov edx, [sc.work]
|
||||
or edx, 0x34000000
|
||||
xor esi, esi
|
||||
mov edi, str_title
|
||||
mcall 0, 50 shl 16 + 415, 30 shl 16 + 195
|
||||
|
||||
mov ebx, 5 shl 16 + 12
|
||||
mov ecx, 0x90000000
|
||||
or ecx, [sc.work_text]
|
||||
mov edx, str_port
|
||||
mcall 4
|
||||
add ebx, 25
|
||||
mov edx, str_speed
|
||||
mcall
|
||||
add ebx, 25
|
||||
mov edx, str_data
|
||||
mcall
|
||||
add ebx, 25
|
||||
mov edx, str_stop
|
||||
mcall
|
||||
|
||||
mov ebx, 195 shl 16 + 12
|
||||
mov edx, str_parity
|
||||
mcall
|
||||
mov ebx, 280 shl 16 + 12
|
||||
mov edx, str_flow
|
||||
mcall
|
||||
|
||||
edit_boxes_set_sys_color edit1,editboxes_end,sc
|
||||
invoke edit_box_draw, edit1
|
||||
invoke edit_box_draw, edit2
|
||||
invoke edit_box_draw, edit3
|
||||
invoke edit_box_draw, edit4
|
||||
|
||||
option_boxes_set_sys_color sc, Option_boxs1
|
||||
option_boxes_set_sys_color sc, Option_boxs2
|
||||
invoke option_box_draw, Option_boxs1
|
||||
invoke option_box_draw, Option_boxs2
|
||||
|
||||
check_boxes_set_sys_color2 ch1,ch1_end,sc ;set color
|
||||
invoke check_box_draw, ch1
|
||||
|
||||
mov esi, [sc.work_button]
|
||||
mcall 8, 280 shl 16 + 100, 115 shl 16 + 22, 0x10
|
||||
|
||||
mov ecx, 0x90000000
|
||||
or ecx, [sc.work_button_text]
|
||||
mcall 4, 315 shl 16 + 119, , str_open
|
||||
|
||||
|
||||
mov edx, [sc.work_graph]
|
||||
mcall 38, 0 shl 16 + 405, 145 shl 16 + 145
|
||||
|
||||
mov ecx, 0x90000000
|
||||
or ecx, [sc.work_text]
|
||||
mcall 4, 5 shl 16 + 150, , [errormsg]
|
||||
|
||||
mcall 12, 2
|
||||
ret
|
||||
|
||||
|
||||
open_connection:
|
||||
|
||||
mov [errormsg], err_none ; clear previous error message
|
||||
|
||||
; Read the serial port name, and convert it to a port number
|
||||
cmp byte[ed_port+4], 0
|
||||
jne .port_error
|
||||
mov eax, dword[ed_port]
|
||||
or eax, 0x20202020 ; convert to lowercase
|
||||
cmp eax, 'com1'
|
||||
je .com1
|
||||
cmp eax, 'com2'
|
||||
je .com2
|
||||
cmp eax, 'com3'
|
||||
je .com3
|
||||
cmp eax, 'com4'
|
||||
je .com4
|
||||
.port_error:
|
||||
mov [errormsg], err_port
|
||||
jmp red_win
|
||||
|
||||
.com1:
|
||||
mov [port], 0x3f8
|
||||
jmp .port_ok
|
||||
.com2:
|
||||
mov [port], 0x2f8
|
||||
jmp .port_ok
|
||||
.com3:
|
||||
mov [port], 0x3e8
|
||||
jmp .port_ok
|
||||
.com4:
|
||||
mov [port], 0x2e8
|
||||
.port_ok:
|
||||
|
||||
; reserve the com port so we can work with it
|
||||
xor ebx, ebx
|
||||
movzx ecx, [port]
|
||||
mov edx, ecx
|
||||
add edx, 7
|
||||
mcall 46
|
||||
test eax, eax
|
||||
jz .port_reserved
|
||||
mov [errormsg], err_reserve
|
||||
jmp red_win
|
||||
.port_reserved:
|
||||
|
||||
; disable com interrupts
|
||||
; (We cannot receive them on the application level :( )
|
||||
mov dx, [port]
|
||||
inc dx
|
||||
mov al, 0
|
||||
out dx, al
|
||||
|
||||
; Set speed:
|
||||
; Convert the ascii decimal number that user entered
|
||||
; So we can do some math with it
|
||||
mov esi, ed_speed
|
||||
xor eax, eax
|
||||
xor ebx, ebx
|
||||
.convert_loop:
|
||||
lodsb
|
||||
test al, al
|
||||
jz .convert_done
|
||||
sub al, '0'
|
||||
jb .invalid_speed
|
||||
cmp al, 9
|
||||
ja .invalid_speed
|
||||
lea ebx, [ebx + 4*ebx]
|
||||
shl ebx, 1
|
||||
add ebx, eax
|
||||
jmp .convert_loop
|
||||
.invalid_speed:
|
||||
call free_port
|
||||
mov [errormsg], err_speed
|
||||
jmp red_win
|
||||
.convert_done:
|
||||
test ebx, ebx
|
||||
jz .invalid_speed
|
||||
|
||||
; We now have the speed setting in ebx
|
||||
; calculate the divisor latch value as 115200/ebx
|
||||
xor edx, edx
|
||||
mov eax, 115200
|
||||
div ebx
|
||||
test edx, edx
|
||||
jnz .invalid_speed
|
||||
cmp eax, 0xffff
|
||||
ja .invalid_speed
|
||||
mov bx, ax
|
||||
|
||||
; enable Divisor latch
|
||||
mov dx, [port]
|
||||
add dx, 3
|
||||
mov al, 1 shl 7 ; dlab bit
|
||||
out dx, al
|
||||
|
||||
; Set divisor latch value
|
||||
mov dx, [port]
|
||||
mov al, bl
|
||||
out dx, al
|
||||
inc dx
|
||||
mov al, bh
|
||||
out dx, al
|
||||
|
||||
; Check the parity type
|
||||
xor bl, bl
|
||||
cmp [option_group1], op1 ; none
|
||||
je .parity_ok
|
||||
|
||||
mov bl, 001b shl 3
|
||||
cmp [option_group1], op2 ; odd
|
||||
je .parity_ok
|
||||
|
||||
mov bl, 011b shl 3
|
||||
cmp [option_group1], op3 ; even
|
||||
je .parity_ok
|
||||
|
||||
mov bl, 101b shl 3
|
||||
cmp [option_group1], op4 ; mark
|
||||
je .parity_ok
|
||||
|
||||
mov bl, 111b shl 3
|
||||
cmp [option_group1], op5 ; space
|
||||
je .parity_ok
|
||||
jmp exit2 ; something went terribly wrong
|
||||
.parity_ok:
|
||||
|
||||
; Check number of stop bits
|
||||
cmp [ed_stop], '1'
|
||||
je .stop_ok
|
||||
cmp [ed_stop], '2'
|
||||
jne .invalid_stop
|
||||
or bl, 1 shl 2 ; number of stop bits
|
||||
jmp .stop_ok
|
||||
.invalid_stop:
|
||||
call free_port
|
||||
mov [errormsg], err_stopbits
|
||||
jmp red_win
|
||||
.stop_ok:
|
||||
|
||||
; Check number of data bits
|
||||
mov al, [ed_data]
|
||||
cmp al, '8'
|
||||
ja .invalid_data
|
||||
sub al, '5'
|
||||
jae .data_ok
|
||||
.invalid_data:
|
||||
call free_port
|
||||
mov [errormsg], err_databits
|
||||
jmp red_win
|
||||
.data_ok:
|
||||
or al, bl
|
||||
; Program data bits, stop bits and parity in the UART
|
||||
mov dx, [port]
|
||||
add dx, 3 ; Line Control Register
|
||||
out dx, al
|
||||
|
||||
; clear + enable fifo (64 bytes), 1 byte trigger level
|
||||
mov dx, [port]
|
||||
inc dx
|
||||
inc dx
|
||||
mov al, 0x7 + 1 shl 5
|
||||
out dx, al
|
||||
|
||||
; flow control
|
||||
mov dx, [port]
|
||||
add dx, 4
|
||||
mov al, 0xb
|
||||
out dx, al
|
||||
|
||||
; Hide our GUI window and open the console
|
||||
mcall 40, 0 ; disable all events
|
||||
mcall 67, 0, 0, 0, 0 ; hide window
|
||||
mcall 12, 1
|
||||
mcall 12, 2
|
||||
|
||||
invoke con_start, 1
|
||||
invoke con_init, 80, 25, 80, 25, str_title
|
||||
|
||||
console_loop:
|
||||
mcall 5, 1 ; wait 10 ms
|
||||
|
||||
invoke con_get_flags
|
||||
test eax, 0x200 ; con window closed?
|
||||
jnz exit2
|
||||
|
||||
.tx_loop:
|
||||
invoke con_kbhit
|
||||
test eax, eax ; did user press a key?
|
||||
jz .rx_loop
|
||||
|
||||
invoke con_getch2 ; get the pressed key from buffer
|
||||
mov dx, [port]
|
||||
out dx, al
|
||||
|
||||
test [ch1.flags], ch_flag_en ; does user want us to echo locally?
|
||||
je .tx_loop
|
||||
|
||||
and eax, 0xff
|
||||
push eax
|
||||
invoke con_write_asciiz, esp ; print the character
|
||||
pop eax
|
||||
jmp .tx_loop
|
||||
|
||||
.rx_loop:
|
||||
mov dx, [port]
|
||||
add dx, 5 ; Line status register
|
||||
in al, dx
|
||||
test al, 1 ; Data ready?
|
||||
jz console_loop
|
||||
|
||||
mov dx, [port] ; Read character from buffer
|
||||
in al, dx
|
||||
|
||||
and eax, 0xff
|
||||
push eax
|
||||
invoke con_write_asciiz, esp ; print the character
|
||||
pop eax
|
||||
|
||||
jmp .rx_loop
|
||||
|
||||
|
||||
exit2:
|
||||
|
||||
call free_port
|
||||
mcall -1 ; exit
|
||||
|
||||
free_port:
|
||||
|
||||
xor ebx, ebx
|
||||
inc ebx
|
||||
movzx ecx, [port]
|
||||
mov edx, ecx
|
||||
add edx, 7
|
||||
mcall 46
|
||||
|
||||
ret
|
||||
|
||||
;-------------------------
|
||||
; DATA
|
||||
|
||||
align 16
|
||||
@IMPORT:
|
||||
|
||||
library box_lib, 'box_lib.obj',\
|
||||
console, 'console.obj'
|
||||
|
||||
import box_lib,\
|
||||
edit_box_draw, 'edit_box_draw',\
|
||||
edit_box_key, 'edit_box_key',\
|
||||
edit_box_mouse, 'edit_box_mouse',\
|
||||
init_checkbox, 'init_checkbox2',\
|
||||
check_box_draw, 'check_box_draw2',\
|
||||
check_box_mouse, 'check_box_mouse2',\
|
||||
option_box_draw, 'option_box_draw',\
|
||||
option_box_mouse, 'option_box_mouse'
|
||||
|
||||
import console,\
|
||||
con_start, 'START',\
|
||||
con_init, 'con_init',\
|
||||
con_exit, 'con_exit',\
|
||||
con_getch2, 'con_getch2',\
|
||||
con_write_asciiz, 'con_write_asciiz',\
|
||||
con_get_flags, 'con_get_flags',\
|
||||
con_kbhit, 'con_kbhit'
|
||||
|
||||
edit1 edit_box 60, 112, 10, 0xffffff, 0x6f9480, 0, 0, 0x10000000, 8, ed_port, mouse_dd, ed_focus, 4, 4
|
||||
edit2 edit_box 60, 112, 35, 0xffffff, 0x6a9480, 0, 0, 0x10000000, 7, ed_speed, mouse_dd, ed_figure_only, 4, 4
|
||||
edit3 edit_box 60, 112, 60, 0xffffff, 0x6a9480, 0, 0, 0x10000000, 1, ed_data, mouse_dd, ed_figure_only, 1, 1
|
||||
edit4 edit_box 60, 112, 85, 0xffffff, 0x6a9480, 0, 0, 0x10000000, 1, ed_stop, mouse_dd, ed_figure_only, 1, 1
|
||||
editboxes_end:
|
||||
|
||||
ed_port db "COM1",0,0,0,0,0,0
|
||||
ed_speed db "9600",0,0,0
|
||||
ed_data db "8",0
|
||||
ed_stop db "1",0
|
||||
|
||||
option_group1 dd op1
|
||||
op1 option_box option_group1, 195, 30, 6, 12, 0xffffff, 0, 0, str_none, 4
|
||||
op2 option_box option_group1, 195, 47, 6, 12, 0xffffff, 0, 0, str_odd, 3
|
||||
op3 option_box option_group1, 195, 64, 6, 12, 0xffffff, 0, 0, str_even, 4
|
||||
op4 option_box option_group1, 195, 81, 6, 12, 0xffffff, 0, 0, str_mark, 4
|
||||
op5 option_box option_group1, 195, 98, 6, 12, 0xffffff, 0, 0, str_space, 5
|
||||
|
||||
option_group2 dd op6
|
||||
op6 option_box option_group2, 280, 30, 6, 12, 0xffffff, 0, 0, str_none, 4
|
||||
;op7 option_box option_group2, 270, 44, 6, 12, 0xffffff, 0, 0, str_xon, 8, 10b
|
||||
;op8 option_box option_group2, 270, 61, 6, 12, 0xffffff, 0, 0, str_rts, 7, 1b
|
||||
;op9 option_box option_group2, 270, 78, 6, 12, 0xffffff, 0, 0, str_dsr, 7
|
||||
|
||||
ch1 check_box2 5 shl 16 + 12, 119 shl 16 + 12, 5, 0xffffff, 0x000000, 0, str_echo, ch_flag_middle
|
||||
ch1_end:
|
||||
|
||||
Option_boxs1 dd op1, op2, op3, op4, op5, 0
|
||||
Option_boxs2 dd op6, 0 ;op7, op8, op9, 0
|
||||
|
||||
str_title db 'Terminal', 0
|
||||
str_port db 'Serial port:', 0
|
||||
str_speed db 'Speed (baud):', 0
|
||||
str_data db 'Data bits:', 0
|
||||
str_parity db 'Parity:', 0
|
||||
str_flow db 'Flow control:', 0
|
||||
str_stop db 'Stop bits:', 0
|
||||
|
||||
str_open db 'Open', 0
|
||||
|
||||
str_none db 'None'
|
||||
str_odd db 'Odd'
|
||||
str_even db 'Even'
|
||||
str_mark db 'Mark'
|
||||
str_space db 'Space'
|
||||
;str_xon db 'XON/XOFF'
|
||||
;str_rts db 'RTS/CTS'
|
||||
;str_dsr db 'DSR/DTR'
|
||||
|
||||
str_echo db 'Local echo', 0
|
||||
|
||||
errormsg dd err_none
|
||||
err_none db 0
|
||||
err_port db 'Invalid serial port.', 0
|
||||
err_reserve db 'The port is already in use.', 0
|
||||
err_speed db 'Incorrect speed setting.', 0
|
||||
err_stopbits db 'Invalid number of stop bits. Must be 1 or 2.', 0
|
||||
err_databits db 'Invalid number of data bits. Must be between 5 and 8.', 0
|
||||
|
||||
I_END:
|
||||
|
||||
mouse_dd dd ?
|
||||
echo db ?
|
||||
port dw ?
|
||||
sc system_colors
|
||||
|
||||
IM_END:
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2014. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;; terminal for KolibriOS ;;
|
||||
;; ;;
|
||||
;; Written by hidnplayr@kolibrios.org ;;
|
||||
;; ;;
|
||||
;; GNU GENERAL PUBLIC LICENSE ;;
|
||||
;; Version 2, June 1991 ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
format binary as ""
|
||||
|
||||
use32
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01'
|
||||
dd 0x1
|
||||
dd START
|
||||
dd I_END
|
||||
dd IM_END+0x1000
|
||||
dd IM_END+0x1000
|
||||
dd 0, 0
|
||||
|
||||
include '../../proc32.inc'
|
||||
include '../../macros.inc'
|
||||
include '../../dll.inc'
|
||||
include '../../develop/libraries/box_lib/box_lib.mac'
|
||||
|
||||
|
||||
START:
|
||||
|
||||
mcall 68, 11
|
||||
|
||||
stdcall dll.Load, @IMPORT
|
||||
or eax, eax
|
||||
jnz exit
|
||||
|
||||
mcall 40, EVM_MOUSE + EVM_MOUSE_FILTER + EVM_REDRAW + EVM_BUTTON + EVM_KEY
|
||||
|
||||
invoke init_checkbox, ch1
|
||||
|
||||
red_win:
|
||||
call draw_window
|
||||
|
||||
mainloop:
|
||||
mcall 10
|
||||
|
||||
dec eax
|
||||
jz red_win
|
||||
|
||||
dec eax
|
||||
jz key
|
||||
|
||||
dec eax
|
||||
jz button
|
||||
|
||||
invoke edit_box_mouse, edit1
|
||||
invoke edit_box_mouse, edit2
|
||||
invoke edit_box_mouse, edit3
|
||||
invoke edit_box_mouse, edit4
|
||||
|
||||
invoke option_box_mouse, Option_boxs1
|
||||
invoke option_box_mouse, Option_boxs2
|
||||
|
||||
invoke check_box_mouse, ch1
|
||||
|
||||
jmp mainloop
|
||||
|
||||
button:
|
||||
mcall 17
|
||||
|
||||
cmp ah, 0x10 ; connect button
|
||||
je open_connection
|
||||
|
||||
test ah , ah
|
||||
jz mainloop
|
||||
exit:
|
||||
mcall -1
|
||||
|
||||
key:
|
||||
mcall 2
|
||||
|
||||
cmp ah, 13 ; enter key
|
||||
je open_connection
|
||||
|
||||
invoke edit_box_key, edit1
|
||||
invoke edit_box_key, edit2
|
||||
invoke edit_box_key, edit3
|
||||
invoke edit_box_key, edit4
|
||||
|
||||
jmp mainloop
|
||||
|
||||
|
||||
|
||||
draw_window:
|
||||
; get system colors
|
||||
mcall 48, 3, sc, 40
|
||||
|
||||
mcall 12,1
|
||||
mov edx, [sc.work]
|
||||
or edx, 0x34000000
|
||||
xor esi, esi
|
||||
mov edi, str_title
|
||||
mcall 0, 50 shl 16 + 415, 30 shl 16 + 195
|
||||
|
||||
mov ebx, 5 shl 16 + 12
|
||||
mov ecx, 0x90000000
|
||||
or ecx, [sc.work_text]
|
||||
mov edx, str_port
|
||||
mcall 4
|
||||
add ebx, 25
|
||||
mov edx, str_speed
|
||||
mcall
|
||||
add ebx, 25
|
||||
mov edx, str_data
|
||||
mcall
|
||||
add ebx, 25
|
||||
mov edx, str_stop
|
||||
mcall
|
||||
|
||||
mov ebx, 195 shl 16 + 12
|
||||
mov edx, str_parity
|
||||
mcall
|
||||
mov ebx, 280 shl 16 + 12
|
||||
mov edx, str_flow
|
||||
mcall
|
||||
|
||||
edit_boxes_set_sys_color edit1,editboxes_end,sc
|
||||
invoke edit_box_draw, edit1
|
||||
invoke edit_box_draw, edit2
|
||||
invoke edit_box_draw, edit3
|
||||
invoke edit_box_draw, edit4
|
||||
|
||||
option_boxes_set_sys_color sc, Option_boxs1
|
||||
option_boxes_set_sys_color sc, Option_boxs2
|
||||
invoke option_box_draw, Option_boxs1
|
||||
invoke option_box_draw, Option_boxs2
|
||||
|
||||
check_boxes_set_sys_color2 ch1,ch1_end,sc ;set color
|
||||
invoke check_box_draw, ch1
|
||||
|
||||
mov esi, [sc.work_button]
|
||||
mcall 8, 280 shl 16 + 100, 115 shl 16 + 22, 0x10
|
||||
|
||||
mov ecx, 0x90000000
|
||||
or ecx, [sc.work_button_text]
|
||||
mcall 4, 315 shl 16 + 119, , str_open
|
||||
|
||||
|
||||
mov edx, [sc.work_graph]
|
||||
mcall 38, 0 shl 16 + 405, 145 shl 16 + 145
|
||||
|
||||
mov ecx, 0x90000000
|
||||
or ecx, [sc.work_text]
|
||||
mcall 4, 5 shl 16 + 150, , [errormsg]
|
||||
|
||||
mcall 12, 2
|
||||
ret
|
||||
|
||||
|
||||
open_connection:
|
||||
|
||||
mov [errormsg], err_none ; clear previous error message
|
||||
|
||||
; Read the serial port name, and convert it to a port number
|
||||
cmp byte[ed_port+4], 0
|
||||
jne .port_error
|
||||
mov eax, dword[ed_port]
|
||||
or eax, 0x20202020 ; convert to lowercase
|
||||
cmp eax, 'com1'
|
||||
je .com1
|
||||
cmp eax, 'com2'
|
||||
je .com2
|
||||
cmp eax, 'com3'
|
||||
je .com3
|
||||
cmp eax, 'com4'
|
||||
je .com4
|
||||
.port_error:
|
||||
mov [errormsg], err_port
|
||||
jmp red_win
|
||||
|
||||
.com1:
|
||||
mov [port], 0x3f8
|
||||
jmp .port_ok
|
||||
.com2:
|
||||
mov [port], 0x2f8
|
||||
jmp .port_ok
|
||||
.com3:
|
||||
mov [port], 0x3e8
|
||||
jmp .port_ok
|
||||
.com4:
|
||||
mov [port], 0x2e8
|
||||
.port_ok:
|
||||
|
||||
; reserve the com port so we can work with it
|
||||
xor ebx, ebx
|
||||
movzx ecx, [port]
|
||||
mov edx, ecx
|
||||
add edx, 7
|
||||
mcall 46
|
||||
test eax, eax
|
||||
jz .port_reserved
|
||||
mov [errormsg], err_reserve
|
||||
jmp red_win
|
||||
.port_reserved:
|
||||
|
||||
; disable com interrupts
|
||||
; (We cannot receive them on the application level :( )
|
||||
mov dx, [port]
|
||||
inc dx
|
||||
mov al, 0
|
||||
out dx, al
|
||||
|
||||
; Set speed:
|
||||
; Convert the ascii decimal number that user entered
|
||||
; So we can do some math with it
|
||||
mov esi, ed_speed
|
||||
xor eax, eax
|
||||
xor ebx, ebx
|
||||
.convert_loop:
|
||||
lodsb
|
||||
test al, al
|
||||
jz .convert_done
|
||||
sub al, '0'
|
||||
jb .invalid_speed
|
||||
cmp al, 9
|
||||
ja .invalid_speed
|
||||
lea ebx, [ebx + 4*ebx]
|
||||
shl ebx, 1
|
||||
add ebx, eax
|
||||
jmp .convert_loop
|
||||
.invalid_speed:
|
||||
call free_port
|
||||
mov [errormsg], err_speed
|
||||
jmp red_win
|
||||
.convert_done:
|
||||
test ebx, ebx
|
||||
jz .invalid_speed
|
||||
|
||||
; We now have the speed setting in ebx
|
||||
; calculate the divisor latch value as 115200/ebx
|
||||
xor edx, edx
|
||||
mov eax, 115200
|
||||
div ebx
|
||||
test edx, edx
|
||||
jnz .invalid_speed
|
||||
cmp eax, 0xffff
|
||||
ja .invalid_speed
|
||||
mov bx, ax
|
||||
|
||||
; enable Divisor latch
|
||||
mov dx, [port]
|
||||
add dx, 3
|
||||
mov al, 1 shl 7 ; dlab bit
|
||||
out dx, al
|
||||
|
||||
; Set divisor latch value
|
||||
mov dx, [port]
|
||||
mov al, bl
|
||||
out dx, al
|
||||
inc dx
|
||||
mov al, bh
|
||||
out dx, al
|
||||
|
||||
; Check the parity type
|
||||
xor bl, bl
|
||||
cmp [option_group1], op1 ; none
|
||||
je .parity_ok
|
||||
|
||||
mov bl, 001b shl 3
|
||||
cmp [option_group1], op2 ; odd
|
||||
je .parity_ok
|
||||
|
||||
mov bl, 011b shl 3
|
||||
cmp [option_group1], op3 ; even
|
||||
je .parity_ok
|
||||
|
||||
mov bl, 101b shl 3
|
||||
cmp [option_group1], op4 ; mark
|
||||
je .parity_ok
|
||||
|
||||
mov bl, 111b shl 3
|
||||
cmp [option_group1], op5 ; space
|
||||
je .parity_ok
|
||||
jmp exit2 ; something went terribly wrong
|
||||
.parity_ok:
|
||||
|
||||
; Check number of stop bits
|
||||
cmp [ed_stop], '1'
|
||||
je .stop_ok
|
||||
cmp [ed_stop], '2'
|
||||
jne .invalid_stop
|
||||
or bl, 1 shl 2 ; number of stop bits
|
||||
jmp .stop_ok
|
||||
.invalid_stop:
|
||||
call free_port
|
||||
mov [errormsg], err_stopbits
|
||||
jmp red_win
|
||||
.stop_ok:
|
||||
|
||||
; Check number of data bits
|
||||
mov al, [ed_data]
|
||||
cmp al, '8'
|
||||
ja .invalid_data
|
||||
sub al, '5'
|
||||
jae .data_ok
|
||||
.invalid_data:
|
||||
call free_port
|
||||
mov [errormsg], err_databits
|
||||
jmp red_win
|
||||
.data_ok:
|
||||
or al, bl
|
||||
; Program data bits, stop bits and parity in the UART
|
||||
mov dx, [port]
|
||||
add dx, 3 ; Line Control Register
|
||||
out dx, al
|
||||
|
||||
; clear + enable fifo (64 bytes), 1 byte trigger level
|
||||
mov dx, [port]
|
||||
inc dx
|
||||
inc dx
|
||||
mov al, 0x7 + 1 shl 5
|
||||
out dx, al
|
||||
|
||||
; flow control
|
||||
mov dx, [port]
|
||||
add dx, 4
|
||||
mov al, 0xb
|
||||
out dx, al
|
||||
|
||||
; Hide our GUI window and open the console
|
||||
mcall 40, 0 ; disable all events
|
||||
mcall 67, 0, 0, 0, 0 ; hide window
|
||||
mcall 12, 1
|
||||
mcall 12, 2
|
||||
|
||||
invoke con_start, 1
|
||||
invoke con_init, 80, 25, 80, 25, str_title
|
||||
|
||||
console_loop:
|
||||
mcall 5, 1 ; wait 10 ms
|
||||
|
||||
invoke con_get_flags
|
||||
test eax, 0x200 ; con window closed?
|
||||
jnz exit2
|
||||
|
||||
.tx_loop:
|
||||
invoke con_kbhit
|
||||
test eax, eax ; did user press a key?
|
||||
jz .rx_loop
|
||||
|
||||
invoke con_getch2 ; get the pressed key from buffer
|
||||
mov dx, [port]
|
||||
out dx, al
|
||||
|
||||
test [ch1.flags], ch_flag_en ; does user want us to echo locally?
|
||||
je .tx_loop
|
||||
|
||||
and eax, 0xff
|
||||
push eax
|
||||
invoke con_write_asciiz, esp ; print the character
|
||||
pop eax
|
||||
jmp .tx_loop
|
||||
|
||||
.rx_loop:
|
||||
mov dx, [port]
|
||||
add dx, 5 ; Line status register
|
||||
in al, dx
|
||||
test al, 1 ; Data ready?
|
||||
jz console_loop
|
||||
|
||||
mov dx, [port] ; Read character from buffer
|
||||
in al, dx
|
||||
|
||||
and eax, 0xff
|
||||
push eax
|
||||
invoke con_write_asciiz, esp ; print the character
|
||||
pop eax
|
||||
|
||||
jmp .rx_loop
|
||||
|
||||
|
||||
exit2:
|
||||
|
||||
call free_port
|
||||
mcall -1 ; exit
|
||||
|
||||
free_port:
|
||||
|
||||
xor ebx, ebx
|
||||
inc ebx
|
||||
movzx ecx, [port]
|
||||
mov edx, ecx
|
||||
add edx, 7
|
||||
mcall 46
|
||||
|
||||
ret
|
||||
|
||||
;-------------------------
|
||||
; DATA
|
||||
|
||||
align 16
|
||||
@IMPORT:
|
||||
|
||||
library box_lib, 'box_lib.obj',\
|
||||
console, 'console.obj'
|
||||
|
||||
import box_lib,\
|
||||
edit_box_draw, 'edit_box_draw',\
|
||||
edit_box_key, 'edit_box_key',\
|
||||
edit_box_mouse, 'edit_box_mouse',\
|
||||
init_checkbox, 'init_checkbox2',\
|
||||
check_box_draw, 'check_box_draw2',\
|
||||
check_box_mouse, 'check_box_mouse2',\
|
||||
option_box_draw, 'option_box_draw',\
|
||||
option_box_mouse, 'option_box_mouse'
|
||||
|
||||
import console,\
|
||||
con_start, 'START',\
|
||||
con_init, 'con_init',\
|
||||
con_exit, 'con_exit',\
|
||||
con_getch2, 'con_getch2',\
|
||||
con_write_asciiz, 'con_write_asciiz',\
|
||||
con_get_flags, 'con_get_flags',\
|
||||
con_kbhit, 'con_kbhit'
|
||||
|
||||
edit1 edit_box 60, 112, 10, 0xffffff, 0x6f9480, 0, 0, 0x10000000, 8, ed_port, mouse_dd, ed_focus, 4, 4
|
||||
edit2 edit_box 60, 112, 35, 0xffffff, 0x6a9480, 0, 0, 0x10000000, 7, ed_speed, mouse_dd, ed_figure_only, 4, 4
|
||||
edit3 edit_box 60, 112, 60, 0xffffff, 0x6a9480, 0, 0, 0x10000000, 1, ed_data, mouse_dd, ed_figure_only, 1, 1
|
||||
edit4 edit_box 60, 112, 85, 0xffffff, 0x6a9480, 0, 0, 0x10000000, 1, ed_stop, mouse_dd, ed_figure_only, 1, 1
|
||||
editboxes_end:
|
||||
|
||||
ed_port db "COM1",0,0,0,0,0,0
|
||||
ed_speed db "9600",0,0,0
|
||||
ed_data db "8",0
|
||||
ed_stop db "1",0
|
||||
|
||||
option_group1 dd op1
|
||||
op1 option_box option_group1, 195, 30, 6, 12, 0xffffff, 0, 0, str_none, 4
|
||||
op2 option_box option_group1, 195, 47, 6, 12, 0xffffff, 0, 0, str_odd, 3
|
||||
op3 option_box option_group1, 195, 64, 6, 12, 0xffffff, 0, 0, str_even, 4
|
||||
op4 option_box option_group1, 195, 81, 6, 12, 0xffffff, 0, 0, str_mark, 4
|
||||
op5 option_box option_group1, 195, 98, 6, 12, 0xffffff, 0, 0, str_space, 5
|
||||
|
||||
option_group2 dd op6
|
||||
op6 option_box option_group2, 280, 30, 6, 12, 0xffffff, 0, 0, str_none, 4
|
||||
;op7 option_box option_group2, 270, 44, 6, 12, 0xffffff, 0, 0, str_xon, 8, 10b
|
||||
;op8 option_box option_group2, 270, 61, 6, 12, 0xffffff, 0, 0, str_rts, 7, 1b
|
||||
;op9 option_box option_group2, 270, 78, 6, 12, 0xffffff, 0, 0, str_dsr, 7
|
||||
|
||||
ch1 check_box2 5 shl 16 + 12, 119 shl 16 + 12, 5, 0xffffff, 0x000000, 0, str_echo, ch_flag_middle
|
||||
ch1_end:
|
||||
|
||||
Option_boxs1 dd op1, op2, op3, op4, op5, 0
|
||||
Option_boxs2 dd op6, 0 ;op7, op8, op9, 0
|
||||
|
||||
str_title db 'Terminal', 0
|
||||
str_port db 'Serial port:', 0
|
||||
str_speed db 'Speed (baud):', 0
|
||||
str_data db 'Data bits:', 0
|
||||
str_parity db 'Parity:', 0
|
||||
str_flow db 'Flow control:', 0
|
||||
str_stop db 'Stop bits:', 0
|
||||
|
||||
str_open db 'Open', 0
|
||||
|
||||
str_none db 'None'
|
||||
str_odd db 'Odd'
|
||||
str_even db 'Even'
|
||||
str_mark db 'Mark'
|
||||
str_space db 'Space'
|
||||
;str_xon db 'XON/XOFF'
|
||||
;str_rts db 'RTS/CTS'
|
||||
;str_dsr db 'DSR/DTR'
|
||||
|
||||
str_echo db 'Local echo', 0
|
||||
|
||||
errormsg dd err_none
|
||||
err_none db 0
|
||||
err_port db 'Invalid serial port.', 0
|
||||
err_reserve db 'The port is already in use.', 0
|
||||
err_speed db 'Incorrect speed setting.', 0
|
||||
err_stopbits db 'Invalid number of stop bits. Must be 1 or 2.', 0
|
||||
err_databits db 'Invalid number of data bits. Must be between 5 and 8.', 0
|
||||
|
||||
I_END:
|
||||
|
||||
mouse_dd dd ?
|
||||
echo db ?
|
||||
port dw ?
|
||||
sc system_colors
|
||||
|
||||
IM_END:
|
||||
|
Reference in New Issue
Block a user