Rev 1476 | Rev 2086 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1476 | IgorA | 1 | use32 |
2 | org 0x0 |
||
3 | db 'MENUET01' ;идентиф. исполняемого файла всегда 8 байт |
||
4 | dd 0x01 |
||
5 | dd start |
||
6 | dd i_end ; размер приложения |
||
7 | dd mem |
||
8 | dd stacktop |
||
9 | dd file_name;buf_cmd_lin |
||
10 | dd sys_path |
||
11 | |||
12 | MAX_COLOR_WORD_LEN equ 40 |
||
13 | BUF_SIZE equ 1000 ;buffer for copy|paste |
||
14 | maxSyntaxFileSize equ 310000 |
||
15 | |||
16 | include '../../macros.inc' |
||
17 | include '../../proc32.inc' |
||
18 | include '../../develop/libraries/box_lib/load_lib.mac' |
||
19 | include '../../develop/libraries/box_lib/trunk/box_lib.mac' |
||
1489 | IgorA | 20 | include '../t_edit/mem.inc' |
1476 | IgorA | 21 | include 'te_data.inc' |
22 | include 'te_work.inc' ;text work functions |
||
23 | |||
1489 | IgorA | 24 | @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,0 |
1476 | IgorA | 25 | |
26 | align 4 |
||
27 | start: |
||
28 | mov eax,48 |
||
29 | mov ebx,3 |
||
30 | mov ecx,sc |
||
31 | mov edx,sizeof.system_colors |
||
32 | mcall |
||
33 | |||
34 | mcall 68,11 |
||
35 | or eax,eax |
||
36 | jz button.exit |
||
37 | |||
38 | mcall 40,0x27 |
||
39 | |||
40 | ;------------------------------------------------- |
||
41 | mov ecx,maxSyntaxFileSize |
||
1489 | IgorA | 42 | stdcall mem.Alloc,ecx |
1476 | IgorA | 43 | mov [options_file],eax |
44 | mov [options_file_end],eax |
||
45 | add [options_file_end],ecx |
||
46 | |||
47 | |||
48 | load_libraries l_libs_start,load_lib_end |
||
49 | |||
50 | ;проверка на сколько удачно загузилась наша либа |
||
51 | mov ebp,lib0 |
||
52 | cmp dword [ebp+ll_struc_size-4],0 |
||
53 | jz @f |
||
54 | mcall -1 ;exit not correct |
||
55 | @@: |
||
56 | |||
57 | ;--------------------------------------------------------------------- |
||
58 | stdcall dword[tl_data_init],dword tree1 |
||
59 | copy_path fn_icon_tl_sys,sys_path,file_name,0 |
||
60 | |||
61 | mov ecx,3*256*13 |
||
1489 | IgorA | 62 | stdcall mem.Alloc,ecx |
1476 | IgorA | 63 | mov dword[tree1.data_img_sys],eax |
64 | |||
65 | mov [run_file_70.Function], 0 |
||
66 | mov [run_file_70.Position], 54 |
||
67 | mov [run_file_70.Flags], 0 |
||
1489 | IgorA | 68 | mov [run_file_70.Count], ecx |
1476 | IgorA | 69 | mov [run_file_70.Buffer], eax |
70 | mov byte[run_file_70+20], 0 |
||
71 | mov [run_file_70.FileName], file_name |
||
72 | |||
73 | mov eax,70 ;load icon file |
||
74 | mov ebx,run_file_70 |
||
75 | int 0x40 |
||
76 | cmp ebx,0 |
||
77 | jg @f |
||
78 | mov dword[tree1.data_img_sys],0 |
||
79 | @@: |
||
80 | ;--------------------------------------------------------------------- |
||
81 | ; читаем bmp файл с иконками узлов |
||
82 | copy_path fn_icon_tl_nod,sys_path,file_name,0 |
||
83 | |||
84 | mov ecx,3*256*2 |
||
1489 | IgorA | 85 | stdcall mem.Alloc,ecx |
1476 | IgorA | 86 | mov dword[tree1.data_img],eax |
87 | |||
88 | ; mov [run_file_70.Function], 0 |
||
89 | ; mov [run_file_70.Position], 54 |
||
90 | ; mov [run_file_70.Flags], 0 |
||
1489 | IgorA | 91 | mov [run_file_70.Count], ecx |
1476 | IgorA | 92 | mov [run_file_70.Buffer], eax |
93 | ; mov byte[run_file_70+20], 0 |
||
94 | ; mov [run_file_70.FileName], file_name |
||
95 | |||
96 | mov eax,70 ;load icon file |
||
97 | mov ebx,run_file_70 |
||
98 | int 0x40 |
||
99 | cmp ebx,0 |
||
100 | jg @f |
||
101 | mov dword[tree1.data_img],0 |
||
102 | @@: |
||
103 | ;------------------------------------------------------------------------------ |
||
104 | copy_path fn_syntax_dir,sys_path,file_name,0 ;берем путь к папке с файлами синтаксиса |
||
105 | mov eax,70 |
||
106 | mov ebx,tree_file_struct |
||
107 | int 0x40 |
||
108 | |||
109 | cmp ebx,-1 |
||
110 | je .end_dir_init |
||
111 | |||
112 | mov eax,dir_mem |
||
113 | add eax,32+4+1+3+4*6+8 |
||
114 | mov ecx,ebx |
||
115 | @@: |
||
116 | cmp byte[eax],'.' ;фильтруем файлы с именами '.' и '..' |
||
117 | je .filter |
||
118 | push dword tree1 |
||
119 | push dword 0x10000 ;1*2^16 - где 1 номер иконки с книгой |
||
120 | push dword eax |
||
121 | call dword[tl_node_add] |
||
122 | |||
123 | stdcall dword[tl_cur_next],tree1 |
||
124 | .filter: |
||
125 | add eax,304 |
||
126 | loop @b |
||
127 | .end_dir_init: |
||
128 | |||
129 | ;--- load color option file --- |
||
130 | stdcall [ted_init], tedit0 |
||
131 | |||
132 | align 4 |
||
133 | red_win: |
||
134 | pushad |
||
135 | mcall 12,1 |
||
136 | |||
137 | xor eax,eax |
||
138 | mov ebx,10*65536+555 |
||
139 | mov ecx,10*65536+333 |
||
140 | mov edx,[sc.work] |
||
141 | or edx,0x33000000 |
||
142 | mov edi,hed |
||
143 | mcall |
||
144 | |||
145 | mcall 9,procinfo,-1 |
||
146 | |||
147 | mov eax,8 ;кнопка |
||
148 | mov ebx,5*65536+90 |
||
149 | mov ecx,195*65536+20 |
||
150 | mov edx,200 |
||
151 | mov esi,[sc.work_button];0xd0 |
||
152 | mcall |
||
153 | |||
154 | ; mov eax,8 |
||
155 | mov ebx,100*65536+85 |
||
156 | mov ecx,195*65536+20 |
||
157 | mov edx,201 |
||
158 | mov esi,0xd00000 |
||
159 | mcall |
||
160 | |||
161 | mov eax,4 ;рисование текста |
||
162 | mov ebx,10*65536+200 |
||
163 | mov ecx,[sc.work_button_text] |
||
164 | or ecx,0x80000000 |
||
165 | mov edx,txt122 |
||
166 | mcall |
||
167 | |||
168 | mov ebx,105*65536+200 |
||
169 | mov ecx,0xffff00 |
||
170 | or ecx,0x80000000 |
||
171 | mov edx,txt148 |
||
172 | mcall |
||
173 | |||
174 | mov ebx,195*65536+10 |
||
175 | mov ecx,[sc.work_text] |
||
176 | or ecx,0x80000000 |
||
177 | mov edx,txt_out_file |
||
178 | mcall |
||
179 | |||
180 | stdcall [edit_box_draw],dword edit1 |
||
181 | stdcall [tl_draw],dword tree1 |
||
182 | |||
183 | ;scroll 1 |
||
184 | mov [ws_dir_lbox.all_redraw],1 |
||
185 | stdcall [scrollbar_ver_draw],dword ws_dir_lbox |
||
186 | stdcall [ted_draw], tedit0 |
||
187 | |||
188 | mcall 12,2 |
||
189 | popad |
||
190 | |||
191 | align 4 |
||
192 | still: |
||
193 | mcall 10 |
||
194 | |||
195 | cmp al,1 ;изм. положение окна |
||
196 | jz red_win |
||
197 | cmp al,2 |
||
198 | jz key |
||
199 | cmp al,3 |
||
200 | jz button |
||
201 | cmp al,6 |
||
202 | jz mouse |
||
203 | |||
204 | jmp still |
||
205 | |||
206 | |||
207 | align 4 |
||
208 | mouse: |
||
209 | stdcall [tl_mouse],tree1 |
||
210 | stdcall [edit_box_mouse],edit1 |
||
211 | stdcall [ted_mouse], tedit0 |
||
212 | jmp still |
||
213 | |||
214 | |||
215 | align 4 |
||
216 | key: |
||
217 | mcall 2 |
||
218 | stdcall [tl_key],tree1 |
||
219 | stdcall [edit_box_key],edit1 |
||
220 | ;;;stdcall [ted_key], tedit0, conv_tabl,esi |
||
221 | jmp still |
||
222 | |||
223 | align 4 |
||
224 | button: |
||
225 | ; cmp [menu_active],1 ;если нажали меню, то сначала реакция на меню |
||
226 | ; jne @f ;mouse.menu_bar_1 |
||
227 | ; mov [menu_active],0 |
||
228 | ; jmp still |
||
229 | ; @@: |
||
230 | |||
231 | mcall 17 ;получить код нажатой кнопки |
||
232 | |||
233 | cmp ah,200 |
||
234 | jne @f |
||
235 | call but_OpenSyntax |
||
236 | @@: |
||
237 | cmp ah,201 |
||
238 | jne @f |
||
239 | call but_SaveSyntax |
||
240 | @@: |
||
241 | |||
242 | cmp ah,1 |
||
243 | jne still |
||
244 | .exit: |
||
245 | ;push eax |
||
246 | |||
1489 | IgorA | 247 | stdcall mem.Free,[options_file] |
1476 | IgorA | 248 | |
249 | stdcall [tl_data_clear], tree1 |
||
250 | stdcall [ted_delete], tedit0 |
||
251 | mcall -1 ;выход из программы |
||
252 | |||
253 | align 4 |
||
254 | but_OpenSyntax: |
||
255 | stdcall [tl_node_get_data],tree1 |
||
256 | pop dword [fn_col_option] |
||
257 | call InitColText |
||
258 | ret |
||
259 | |||
260 | align 4 |
||
261 | but_SaveSyntax: |
||
262 | stdcall [ted_but_save_file], tedit0,run_file_70,[edit1.text] |
||
263 | ret |
||
264 | |||
265 | align 4 |
||
266 | but_ctrl_o: |
||
267 | push eax |
||
268 | call get_wnd_in_focus |
||
269 | cmp eax,0 |
||
270 | je @f |
||
271 | stdcall [ted_open_file], eax,str_file_70,[edit1.text] |
||
272 | @@: |
||
273 | pop eax |
||
274 | ret |
||
275 | |||
276 | ;создание нового файла |
||
277 | align 4 |
||
278 | but_ctrl_n: |
||
279 | push eax |
||
280 | call get_wnd_in_focus |
||
281 | cmp eax,0 |
||
282 | je @f |
||
283 | stdcall [ted_clear], eax,1 |
||
284 | stdcall [ted_draw], eax |
||
285 | @@: |
||
286 | pop eax |
||
287 | ret |
||
288 | |||
289 | ;определяем какое из окон редактора в фокусе |
||
290 | align 4 |
||
291 | get_wnd_in_focus: |
||
292 | xor eax,eax |
||
293 | cmp dword[el_focus],tedit0 |
||
294 | jne @f |
||
295 | mov eax,tedit0 |
||
296 | @@: |
||
297 | ;cmp dword[el_focus],tedit1 |
||
298 | ;jne @f |
||
299 | ; mov eax,tedit1 |
||
300 | ;@@: |
||
301 | ret |
||
302 | |||
1489 | IgorA | 303 | hed db 'TextEditor syntax file converter 09.06.10',0 ;подпись окна |
1476 | IgorA | 304 | |
305 | txtErrOpen db 'Не найден файл, проверьте правильность имени',0 |
||
306 | txtErrIni0 db 'Не открылся файл с иконками',0 |
||
307 | err_ini0 db 0 |
||
308 | |||
309 | txt122 db 'Загр. файл',0 |
||
310 | txt148 db 'Сохр. файл',0 |
||
311 | txt_out_file db 'Вых. файл:',0 |
||
312 | |||
313 | CAPT_PATH_WIDTH equ 50 |
||
314 | edit1 edit_box 305+16-CAPT_PATH_WIDTH, 215+CAPT_PATH_WIDTH, 5, 0xffffff, 0xff, 0xff0000, 0, 0x80, MAX_COLOR_WORD_LEN, ed_buffer.127, mouse_dd, 0 |
||
315 | |||
316 | ed_buffer: ;текст для edit |
||
317 | .127: rb MAX_COLOR_WORD_LEN+2 |
||
318 | |||
319 | err_message_found_lib0 db 'Sorry I cannot found library box_lib.obj',0 |
||
320 | head_f_i0: |
||
321 | head_f_l0 db 'System error',0 |
||
322 | err_message_import0 db 'Error on load import library box_lib.obj',0 |
||
323 | err_message_found_lib1 db 'Sorry I cannot found library msgbox.obj',0 |
||
324 | |||
325 | ;library structures |
||
326 | l_libs_start: |
||
1489 | IgorA | 327 | lib0 l_libs boxlib_name, sys_path, file_name, system_dir0, err_message_found_lib0, head_f_l0, boxlib_import,err_message_import0, head_f_i0 |
1476 | IgorA | 328 | load_lib_end: |
329 | |||
330 | |||
331 | i_end: |
||
332 | rb 1024 |
||
333 | align 16 |
||
334 | procinfo process_information |
||
335 | thread: |
||
336 | rb 1024 |
||
337 | stacktop: |
||
338 | sys_path: |
||
339 | rb 4096 |
||
340 | file_name: |
||
341 | rb 4096 |
||
342 | file_name_rez: |
||
343 | rb 4096 |
||
344 | file_info: |
||
345 | rb 40 |
||
346 | mem: |