Rev 7575 | Rev 7579 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1476 | IgorA | 1 | use32 |
7575 | IgorA | 2 | org 0 |
1476 | IgorA | 3 | db 'MENUET01' ;идентиф. исполняемого файла всегда 8 байт |
7575 | IgorA | 4 | dd 1, start, i_end, mem, stacktop, file_name, sys_path |
1476 | IgorA | 5 | |
6 | MAX_COLOR_WORD_LEN equ 40 |
||
2819 | IgorA | 7 | BUF_SIZE equ 4096 ;buffer for copy|paste |
2086 | IgorA | 8 | CAPT_PATH_WIDTH equ 50 ;ширина подписи перед текстовым полем |
1476 | IgorA | 9 | |
10 | include '../../macros.inc' |
||
11 | include '../../proc32.inc' |
||
7575 | IgorA | 12 | include '../../KOSfuncs.inc' |
13 | include '../../load_img.inc' |
||
1476 | IgorA | 14 | include '../../develop/libraries/box_lib/trunk/box_lib.mac' |
7575 | IgorA | 15 | include '../../system/skincfg/trunk/kglobals.inc' |
16 | include '../../system/skincfg/trunk/unpacker.inc' |
||
1476 | IgorA | 17 | include 'te_data.inc' |
18 | include 'te_work.inc' ;text work functions |
||
19 | |||
4990 | IgorA | 20 | @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load |
1476 | IgorA | 21 | |
4990 | IgorA | 22 | icon_tl_sys dd 0 ;указатель на память для хранения системных иконок |
23 | |||
1476 | IgorA | 24 | align 4 |
25 | start: |
||
7575 | IgorA | 26 | mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors |
1476 | IgorA | 27 | |
7575 | IgorA | 28 | mcall SF_SYS_MISC,SSF_HEAP_INIT |
2819 | IgorA | 29 | or eax,eax |
30 | jz button.exit |
||
1476 | IgorA | 31 | |
7575 | IgorA | 32 | mcall SF_KEYBOARD,SSF_SET_INPUT_MODE,1 ;scan code |
33 | mcall SF_SET_EVENTS_MASK,0xC0000027 |
||
1476 | IgorA | 34 | |
7575 | IgorA | 35 | load_libraries l_libs_start,load_lib_end |
1476 | IgorA | 36 | |
7575 | IgorA | 37 | ;проверка на сколько удачно загузилась библиотека |
38 | cmp dword[lib0+ll_struc_size-4],0 |
||
5911 | IgorA | 39 | jz @f |
40 | mcall -1 ;exit not correct |
||
41 | @@: |
||
1476 | IgorA | 42 | |
43 | ;--------------------------------------------------------------------- |
||
7575 | IgorA | 44 | stdcall [tl_data_init], tree1 |
1476 | IgorA | 45 | |
4990 | IgorA | 46 | ; читаем файл с курсорами и линиями |
7575 | IgorA | 47 | include_image_file '..\..\media\log_el\trunk\tl_sys_16.png', icon_tl_sys |
48 | mov eax,[icon_tl_sys] |
||
49 | mov [tree1.data_img_sys],eax |
||
1476 | IgorA | 50 | ;--------------------------------------------------------------------- |
51 | ; читаем bmp файл с иконками узлов |
||
7575 | IgorA | 52 | include_image_file '..\t_edit\tl_nod_16.png', icon_tl_sys |
53 | mov eax,[icon_tl_sys] |
||
54 | mov [tree1.data_img],eax |
||
1476 | IgorA | 55 | ;------------------------------------------------------------------------------ |
7575 | IgorA | 56 | copy_path fn_syntax_dir,sys_path,file_name,0 ;берем путь к папке с файлами синтаксиса |
57 | mcall SF_FILE,tree_file_struct |
||
1476 | IgorA | 58 | |
7577 | IgorA | 59 | cmp ebx,0 |
60 | jle .end_dir_init |
||
61 | mov eax,dir_mem+32+40 |
||
7575 | IgorA | 62 | mov ecx,ebx |
63 | @@: |
||
64 | cmp byte[eax],'.' ;фильтруем файлы с именами '.' и '..' |
||
65 | je .filter |
||
66 | stdcall [tl_node_add],tree1,0x10000,eax ;1*2^16 - где 1 номер иконки с книгой |
||
67 | stdcall [tl_cur_next],tree1 |
||
68 | .filter: |
||
69 | add eax,304 |
||
70 | loop @b |
||
71 | stdcall [tl_cur_beg],tree1 ;ставим курсор на начало списка |
||
72 | or dword[tree1.style], tl_cursor_pos_limited ;ограничиваем движение курсора в пределах списка |
||
73 | .end_dir_init: |
||
1476 | IgorA | 74 | |
7577 | IgorA | 75 | xor eax,eax |
76 | inc eax |
||
77 | mov [scrol_w1.type],eax |
||
78 | mov [scrol_h1.type],eax |
||
79 | mov [ws_dir_lbox.type],eax |
||
80 | |||
1476 | IgorA | 81 | ;--- load color option file --- |
82 | stdcall [ted_init], tedit0 |
||
2086 | IgorA | 83 | mov byte[file_name],0 |
1476 | IgorA | 84 | |
85 | align 4 |
||
86 | red_win: |
||
2086 | IgorA | 87 | call draw_window |
1476 | IgorA | 88 | |
89 | align 4 |
||
90 | still: |
||
7575 | IgorA | 91 | mcall SF_WAIT_EVENT |
1476 | IgorA | 92 | |
93 | cmp al,1 ;изм. положение окна |
||
94 | jz red_win |
||
95 | cmp al,2 |
||
96 | jz key |
||
97 | cmp al,3 |
||
98 | jz button |
||
99 | cmp al,6 |
||
100 | jz mouse |
||
101 | |||
102 | jmp still |
||
103 | |||
104 | |||
105 | align 4 |
||
2086 | IgorA | 106 | draw_window: |
107 | pushad |
||
7575 | IgorA | 108 | mcall SF_REDRAW,SSF_BEGIN_DRAW |
2086 | IgorA | 109 | |
110 | mov edx,[sc.work] |
||
111 | or edx,0x33000000 |
||
112 | mov edi,hed |
||
7575 | IgorA | 113 | mcall SF_CREATE_WINDOW,<10,555>,<10,333> |
2086 | IgorA | 114 | |
7575 | IgorA | 115 | mcall SF_THREAD_INFO,procinfo,-1 |
116 | mov edi,tedit0 ;значение edi нужно для EvSize и ted_wnd_t |
||
117 | call EvSize |
||
2086 | IgorA | 118 | |
119 | mov esi,[sc.work_button];0xd0 |
||
7575 | IgorA | 120 | mcall SF_DEFINE_BUTTON,5*65536+90,195*65536+20,200 |
2086 | IgorA | 121 | |
122 | mov ebx,100*65536+85 |
||
123 | mov ecx,195*65536+20 |
||
124 | mov edx,201 |
||
125 | mov esi,0xd00000 |
||
126 | mcall |
||
127 | |||
128 | mov ecx,[sc.work_button_text] |
||
129 | or ecx,0x80000000 |
||
7575 | IgorA | 130 | mcall SF_DRAW_TEXT,10*65536+200,,txt_load_f |
2086 | IgorA | 131 | |
132 | mov ecx,0xffff00 |
||
133 | or ecx,0x80000000 |
||
7575 | IgorA | 134 | mcall ,105*65536+200,,txt_save_f |
2086 | IgorA | 135 | |
136 | mov ecx,[sc.work_text] |
||
137 | or ecx,0x80000000 |
||
7575 | IgorA | 138 | mcall ,195*65536+10,,txt_inp_file |
2086 | IgorA | 139 | |
140 | add ebx,20 |
||
141 | mov edx,txt_out_file |
||
142 | int 0x40 |
||
143 | |||
7577 | IgorA | 144 | stdcall [PathShow_draw], PathShow_data_1 |
2125 | IgorA | 145 | |
7577 | IgorA | 146 | stdcall [edit_box_draw], edit1 |
147 | stdcall [tl_draw], tree1 |
||
2086 | IgorA | 148 | |
149 | ;scroll 1 |
||
150 | mov [ws_dir_lbox.all_redraw],1 |
||
7577 | IgorA | 151 | stdcall [scrollbar_ver_draw],ws_dir_lbox |
2086 | IgorA | 152 | stdcall [ted_draw], tedit0 |
153 | |||
7575 | IgorA | 154 | mcall SF_REDRAW,SSF_END_DRAW |
2086 | IgorA | 155 | popad |
156 | ret |
||
157 | |||
7575 | IgorA | 158 | MIN_M_WND_H equ 100 ;минимальная высота главного окна |
159 | ;input: |
||
160 | ; edi = pointer to tedit struct |
||
2086 | IgorA | 161 | align 4 |
7575 | IgorA | 162 | EvSize: |
163 | pushad |
||
164 | mov ebx,ted_scr_h |
||
165 | mov esi,ted_scr_w |
||
166 | |||
167 | m2m ted_wnd_w,[procinfo.client_box.width] ;ставим ширину окна редактора равной ширине всего окна |
||
168 | mov eax,ted_wnd_l |
||
169 | sub ted_wnd_w,eax ;отнимаем отступ слева |
||
170 | movzx eax,word[esi+sb_offs_size_x] |
||
171 | sub ted_wnd_w,eax ;отнимаем ширину верт. скроллинга |
||
172 | |||
173 | m2m ted_wnd_h,[procinfo.client_box.height] ;ставим высоту окна редактора равной высоте всего окна |
||
174 | cmp ted_wnd_h,MIN_M_WND_H |
||
175 | jg @f |
||
176 | mov ted_wnd_h,MIN_M_WND_H |
||
177 | @@: |
||
178 | |||
179 | movzx eax,word[ebx+sb_offs_size_y] |
||
180 | sub ted_wnd_h,eax ;отнимаем высоту гориз. скроллинга |
||
181 | mov eax,ted_wnd_t |
||
182 | sub ted_wnd_h,eax ;отнимаем отступ сверху |
||
183 | |||
184 | stdcall [ted_init_scroll_bars], tedit0,2 |
||
185 | popad |
||
186 | ret |
||
187 | |||
188 | align 4 |
||
1476 | IgorA | 189 | mouse: |
190 | stdcall [tl_mouse],tree1 |
||
191 | stdcall [edit_box_mouse],edit1 |
||
192 | stdcall [ted_mouse], tedit0 |
||
193 | jmp still |
||
194 | |||
2819 | IgorA | 195 | ;output: |
196 | ; ah = symbol |
||
197 | align 4 |
||
198 | proc KeyConvertToASCII, table:dword |
||
199 | push ebx |
||
200 | mov ebx,dword[table] ;convert scan to ascii |
||
201 | ror ax,8 |
||
202 | xor ah,ah |
||
203 | add bx,ax |
||
204 | mov ah,byte[ebx] |
||
205 | pop ebx |
||
206 | ret |
||
207 | endp |
||
1476 | IgorA | 208 | |
209 | align 4 |
||
210 | key: |
||
7575 | IgorA | 211 | mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS ;66.3 получить состояние управляющих клавиш |
2819 | IgorA | 212 | xor esi,esi |
213 | mov ecx,1 |
||
7575 | IgorA | 214 | test al,3 ;[Shift] |
2819 | IgorA | 215 | jz @f |
216 | mov cl,2 |
||
217 | or esi,KM_SHIFT |
||
218 | @@: |
||
219 | test al,0x0c ;[Ctrl] |
||
220 | jz @f |
||
221 | or esi,KM_CTRL |
||
222 | @@: |
||
223 | test al,0x30 ;[Alt] |
||
224 | jz @f |
||
225 | mov cl,3 |
||
226 | or esi,KM_ALT |
||
227 | @@: |
||
228 | test al,0x80 ;[NumLock] |
||
229 | jz @f |
||
230 | or esi,KM_NUMLOCK |
||
231 | @@: |
||
232 | |||
7575 | IgorA | 233 | mcall SF_SYSTEM_GET,SSF_KEYBOARD_LAYOUT,,conv_tabl ;26.2 получить раскладку клавиатуры |
234 | mcall SF_GET_KEY |
||
1476 | IgorA | 235 | stdcall [tl_key],tree1 |
2819 | IgorA | 236 | |
237 | test word [edit1.flags],10b;ed_focus ; если не в фокусе, выходим |
||
238 | je @f |
||
239 | cmp ah,0x80 ;if key up |
||
240 | ja still |
||
241 | cmp ah,42 ;[Shift] (left) |
||
242 | je still |
||
243 | cmp ah,54 ;[Shift] (right) |
||
244 | je still |
||
245 | cmp ah,56 ;[Alt] |
||
246 | je still |
||
247 | cmp ah,29 ;[Ctrl] |
||
248 | je still |
||
249 | cmp ah,69 ;[Pause Break] |
||
250 | je still |
||
251 | |||
7575 | IgorA | 252 | stdcall KeyConvertToASCII, conv_tabl |
2819 | IgorA | 253 | stdcall [edit_box_key],edit1 |
254 | jmp still |
||
255 | @@: |
||
256 | |||
257 | stdcall [ted_key], tedit0, conv_tabl,esi |
||
1476 | IgorA | 258 | jmp still |
259 | |||
260 | align 4 |
||
261 | button: |
||
7575 | IgorA | 262 | mcall SF_GET_BUTTON |
1476 | IgorA | 263 | |
7575 | IgorA | 264 | cmp ah,200 |
265 | jne @f |
||
266 | call but_OpenSyntax |
||
267 | @@: |
||
268 | cmp ah,201 |
||
269 | jne @f |
||
270 | call but_SaveSyntax |
||
271 | @@: |
||
1476 | IgorA | 272 | |
7575 | IgorA | 273 | cmp ah,1 |
274 | jne still |
||
1476 | IgorA | 275 | .exit: |
7575 | IgorA | 276 | stdcall mem.Free,[options_file] |
277 | stdcall mem.Free,[unpac_mem] |
||
1476 | IgorA | 278 | |
7575 | IgorA | 279 | stdcall [tl_data_clear], tree1 |
280 | stdcall [ted_delete], tedit0 |
||
281 | mcall SF_TERMINATE_PROCESS ;выход из программы |
||
1476 | IgorA | 282 | |
283 | align 4 |
||
284 | but_OpenSyntax: |
||
5911 | IgorA | 285 | push eax |
286 | stdcall [tl_node_get_data],tree1 |
||
287 | mov [fn_col_option],eax |
||
288 | call InitColText |
||
289 | pop eax |
||
290 | ret |
||
1476 | IgorA | 291 | |
292 | align 4 |
||
293 | but_SaveSyntax: |
||
4990 | IgorA | 294 | stdcall [ted_save_file], tedit0,run_file_70,[edit1.text] |
1476 | IgorA | 295 | ret |
296 | |||
297 | align 4 |
||
298 | but_ctrl_o: |
||
299 | push eax |
||
300 | call get_wnd_in_focus |
||
301 | cmp eax,0 |
||
302 | je @f |
||
303 | stdcall [ted_open_file], eax,str_file_70,[edit1.text] |
||
304 | @@: |
||
305 | pop eax |
||
306 | ret |
||
307 | |||
308 | ;создание нового файла |
||
309 | align 4 |
||
310 | but_ctrl_n: |
||
311 | push eax |
||
312 | call get_wnd_in_focus |
||
313 | cmp eax,0 |
||
314 | je @f |
||
315 | stdcall [ted_clear], eax,1 |
||
316 | stdcall [ted_draw], eax |
||
317 | @@: |
||
318 | pop eax |
||
319 | ret |
||
320 | |||
321 | ;определяем какое из окон редактора в фокусе |
||
322 | align 4 |
||
323 | get_wnd_in_focus: |
||
324 | xor eax,eax |
||
325 | cmp dword[el_focus],tedit0 |
||
326 | jne @f |
||
327 | mov eax,tedit0 |
||
328 | @@: |
||
329 | ;cmp dword[el_focus],tedit1 |
||
330 | ;jne @f |
||
331 | ; mov eax,tedit1 |
||
332 | ;@@: |
||
333 | ret |
||
334 | |||
7577 | IgorA | 335 | hed db 'TextEditor syntax file converter 23.01.19',0 ;подпись окна |
2819 | IgorA | 336 | conv_tabl rb 128 ; таблица для конвертирования scan-кода в ascii-код |
1476 | IgorA | 337 | |
7575 | IgorA | 338 | txt_load_f db 'Загр. файл',0 |
339 | txt_save_f db 'Сохр. файл',0 |
||
2086 | IgorA | 340 | txt_inp_file db 'Исх. файл:',0 |
1476 | IgorA | 341 | txt_out_file db 'Вых. файл:',0 |
342 | |||
4990 | IgorA | 343 | head_f_i: |
7577 | IgorA | 344 | head_f_l db '"System error',0 |
345 | err_message_found_lib_0 db 'Sorry I cannot found library ',39,'box_lib.obj',39,'" -tE',0 |
||
346 | err_message_import_0 db 'Error on load import library ',39,'box_lib.obj',39,'" -tW',0 |
||
347 | err_message_found_lib_1 db 'Sorry I cannot found library ',39,'libimg.obj',39,'" -tE',0 |
||
348 | err_message_import_1 db 'Error on load import library ',39,'libimg.obj',39,'" -tW',0 |
||
4990 | IgorA | 349 | |
1476 | IgorA | 350 | ;library structures |
351 | l_libs_start: |
||
4990 | IgorA | 352 | lib0 l_libs lib_name_0, sys_path, file_name, system_dir_0, err_message_found_lib_0, head_f_l, import_box_lib,err_message_import_0, head_f_i |
353 | lib1 l_libs lib_name_1, sys_path, file_name, system_dir_1, err_message_found_lib_1, head_f_l, import_libimg,err_message_import_1, head_f_i |
||
1476 | IgorA | 354 | load_lib_end: |
355 | |||
7575 | IgorA | 356 | IncludeIGlobals |
1476 | IgorA | 357 | |
5911 | IgorA | 358 | align 16 |
1476 | IgorA | 359 | i_end: |
7575 | IgorA | 360 | IncludeUGlobals |
1476 | IgorA | 361 | procinfo process_information |
5911 | IgorA | 362 | rb 1024 |
1476 | IgorA | 363 | thread: |
364 | rb 1024 |
||
365 | stacktop: |
||
366 | sys_path: |
||
367 | rb 4096 |
||
368 | file_name: |
||
369 | rb 4096 |
||
370 | file_name_rez: |
||
371 | rb 4096 |
||
372 | mem:10,333>10,555> |