Rev 6589 | Rev 6612 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6589 | Rev 6601 | ||
---|---|---|---|
Line 118... | Line 118... | ||
118 | }; |
118 | }; |
Line 119... | Line 119... | ||
119 | 119 | ||
120 | 120 | ||
121 | static struct editor_syntax_file default_syntax = { |
121 | static struct editor_syntax_file default_syntax = { |
122 | 10, //count_colors_text |
122 | 10, //count_colors_text |
123 | 0, // count_key_words dd (f1-text)/48 |
123 | 1, // count_key_words dd (f1-text)/48, minimum 1 |
124 | 0xf1fcd0, //color_cursor dd 0xf1fcd0 |
124 | 0xf1fcd0, //color_cursor dd 0xf1fcd0 |
125 | 0x080808, //color_wnd_capt dd 0x080808 |
125 | 0x080808, //color_wnd_capt dd 0x080808 |
126 | 0x1C1C1C, //color_wnd_work dd 0x1C1C1C |
126 | 0x1C1C1C, //color_wnd_work dd 0x1C1C1C |
Line 163... | Line 163... | ||
163 | 163 | ||
164 | extern void (*ted_but_sumb_upper_asm)(editor *) __attribute__((__stdcall__)); |
164 | extern void (*ted_but_sumb_upper_asm)(editor *) __attribute__((__stdcall__)); |
165 | static inline void editor_selected_toupper(editor *ed) |
165 | static inline void editor_selected_toupper(editor *ed) |
166 | { |
166 | { |
167 | __asm__ __volatile__ ( |
167 | __asm__ __volatile__ ( |
168 | "push edi \n\t" |
168 | "push %%edi \n\t" |
Line 169... | Line 169... | ||
169 | "push esi \n\t":::); |
169 | "push %%esi \n\t":::); |
Line 170... | Line 170... | ||
170 | 170 | ||
171 | (*ted_but_sumb_upper_asm)(ed); |
171 | (*ted_but_sumb_upper_asm)(ed); |
172 | 172 | ||
173 | __asm__ __volatile__ ( |
173 | __asm__ __volatile__ ( |
Line 174... | Line 174... | ||
174 | "pop esi \n\t" |
174 | "pop %%esi \n\t" |
175 | "pop edi \n\t":::); |
175 | "pop %%edi \n\t":::); |
176 | } |
176 | } |
177 | 177 | ||
178 | extern void (*ted_but_sumb_lover_asm)(editor *) __attribute__((__stdcall__)); |
178 | extern void (*ted_but_sumb_lover_asm)(editor *) __attribute__((__stdcall__)); |
179 | static inline void editor_selected_tolower(editor *ed) |
179 | static inline void editor_selected_tolower(editor *ed) |
Line 180... | Line 180... | ||
180 | { |
180 | { |
Line 181... | Line 181... | ||
181 | __asm__ __volatile__ ( |
181 | __asm__ __volatile__ ( |
182 | "push edi \n\t" |
182 | "push %%edi \n\t" |
183 | "push esi \n\t":::); |
183 | "push %%esi \n\t":::); |
184 | 184 | ||
Line 185... | Line 185... | ||
185 | (*ted_but_sumb_lover_asm)(ed); |
185 | (*ted_but_sumb_lover_asm)(ed); |
186 | 186 | ||
187 | __asm__ __volatile__ ( |
187 | __asm__ __volatile__ ( |
188 | "pop esi \n\t" |
188 | "pop %%esi \n\t" |
189 | "pop edi \n\t":::); |
189 | "pop %%edi \n\t":::); |
190 | } |
190 | } |
Line 191... | Line 191... | ||
191 | 191 | ||
Line 192... | Line 192... | ||
192 | 192 | ||
193 | extern void (*ted_but_convert_by_table_asm)(editor *, char* table) __attribute__((__stdcall__)); |
193 | extern void (*ted_but_convert_by_table_asm)(editor *, char* table) __attribute__((__stdcall__)); |
194 | static inline void editor_convert_by_table(editor *ed, char* table) |
194 | static inline void editor_convert_by_table(editor *ed, char* table) |
195 | { |
195 | { |
Line 196... | Line 196... | ||
196 | __asm__ __volatile__ ( |
196 | __asm__ __volatile__ ( |
197 | "push edi \n\t" |
197 | "push %%edi \n\t" |
198 | "push esi \n\t":::); |
198 | "push %%esi \n\t":::); |
199 | 199 | ||
200 | (*ted_but_convert_by_table_asm)(ed, table); |
200 | (*ted_but_convert_by_table_asm)(ed, table); |
201 | 201 | ||
202 | __asm__ __volatile__ ( |
202 | __asm__ __volatile__ ( |
Line 203... | Line 203... | ||
203 | "pop esi \n\t" |
203 | "pop %%esi \n\t" |
Line 204... | Line 204... | ||
204 | "pop edi \n\t":::); |
204 | "pop %%edi \n\t":::); |
205 | } |
205 | } |
206 | 206 | ||
207 | extern int (*ted_can_save_asm)(editor *) __attribute__((__stdcall__)); |
207 | extern int (*ted_can_save_asm)(editor *) __attribute__((__stdcall__)); |
Line 208... | Line 208... | ||
208 | static inline int editor_can_save(editor *ed) |
208 | static inline int editor_can_save(editor *ed) |
209 | /// return 1 if can be saved |
209 | /// return 1 if need to be saved (has changes), 0 otherwise |
210 | { |
210 | { |
211 | int ret; |
211 | int ret; |
212 | __asm__ __volatile__ ( |
212 | __asm__ __volatile__ ( |
213 | "push edi \n\t":::); |
213 | "push %%edi \n\t":::); |
Line 214... | Line 214... | ||
214 | 214 | ||
Line 215... | Line 215... | ||
215 | (*ted_can_save_asm)(ed); |
215 | (*ted_can_save_asm)(ed); |
216 | 216 | ||
217 | __asm__ __volatile__ ( |
217 | __asm__ __volatile__ ( |
Line 218... | Line 218... | ||
218 | "pop edi \n\t":"=a"(ret)::); |
218 | "pop %%edi \n\t":"=a"(ret)::); |
219 | return ret; |
219 | return ret; |
220 | } |
220 | } |
221 | 221 | ||
222 | extern void (*ted_clear_asm)(editor *, int) __attribute__((__stdcall__)); |
222 | extern void (*ted_clear_asm)(editor *, int) __attribute__((__stdcall__)); |
223 | static inline void editor_clear(editor *ed, int all) |
223 | static inline void editor_clear(editor *ed, int all) |
Line 224... | Line 224... | ||
224 | /// all==1 - clear all memory |
224 | /// all==1 - clear all memory |
Line 225... | Line 225... | ||
225 | { |
225 | { |
226 | __asm__ __volatile__ ( |
226 | __asm__ __volatile__ ( |
227 | "push edi \n\t":::); |
227 | "push %%edi \n\t":::); |
228 | 228 | ||
229 | (*ted_clear_asm)(ed, all); |
229 | (*ted_clear_asm)(ed, all); |
230 | 230 | ||
231 | __asm__ __volatile__ ( |
231 | __asm__ __volatile__ ( |
Line 252... | Line 252... | ||
252 | extern void (*ted_init_asm)(editor *) __attribute__((__stdcall__)); |
252 | extern void (*ted_init_asm)(editor *) __attribute__((__stdcall__)); |
253 | static inline void editor_init(editor *ed) |
253 | static inline void editor_init(editor *ed) |
254 | /// allocate memory |
254 | /// allocate memory |
255 | { |
255 | { |
256 | __asm__ __volatile__ ( |
256 | __asm__ __volatile__ ( |
257 | "push edi \n\t":::); |
257 | "push %%edi \n\t":::); |
Line 258... | Line 258... | ||
258 | 258 | ||
Line 259... | Line 259... | ||
259 | (*ted_init_asm)(ed); |
259 | (*ted_init_asm)(ed); |
260 | 260 | ||
261 | __asm__ __volatile__ ( |
261 | __asm__ __volatile__ ( |
Line 262... | Line 262... | ||
262 | "pop edi \n\t":::); |
262 | "pop %%edi \n\t":::); |
263 | } |
263 | } |
264 | 264 | ||
265 | extern int (*ted_is_select)(editor *) __attribute__((__stdcall__)); |
265 | extern int (*ted_is_select)(editor *) __attribute__((__stdcall__)); |
266 | static inline int editor_is_select(editor *ed) |
266 | static inline int editor_is_select(editor *ed) |
267 | /// return 1 if have selection |
267 | /// return 1 if have selection |
268 | { |
268 | { |
Line 269... | Line 269... | ||
269 | int ret; |
269 | int ret; |
Line 270... | Line 270... | ||
270 | __asm__ __volatile__ ( |
270 | __asm__ __volatile__ ( |
271 | "push ebx \n\t":::); |
271 | "push %%ebx \n\t":::); |
272 | 272 | ||
273 | (*ted_is_select)(ed); |
273 | (*ted_is_select)(ed); |
Line 274... | Line 274... | ||
274 | 274 | ||
275 | __asm__ __volatile__ ( |
275 | __asm__ __volatile__ ( |
Line 301... | Line 301... | ||
301 | /// returns errcode as SysFn70 |
301 | /// returns errcode as SysFn70 |
302 | { |
302 | { |
303 | int ret; |
303 | int ret; |
304 | struct fs_dirinfo di; |
304 | struct fs_dirinfo di; |
305 | __asm__ __volatile__ ( |
305 | __asm__ __volatile__ ( |
306 | "push edi \n\t":::); |
306 | "push %%edi \n\t":::); |
Line 307... | Line 307... | ||
307 | 307 | ||
Line 308... | Line 308... | ||
308 | (*ted_open_file_asm)(ed, &di, fname); |
308 | (*ted_open_file_asm)(ed, &di, fname); |
309 | 309 | ||
310 | __asm__ __volatile__ ( |
310 | __asm__ __volatile__ ( |
311 | "pop edi \n\t":"=b"(*readbytes), "=a"(ret)::); |
311 | "pop %%edi \n\t":"=b"(*readbytes), "=a"(ret)::); |
Line 312... | Line 312... | ||
312 | return ret; |
312 | return ret; |
313 | } |
313 | } |
Line 325... | Line 325... | ||
325 | 325 | ||
326 | extern void (*ted_but_cut)(editor *) __attribute__((__stdcall__)); |
326 | extern void (*ted_but_cut)(editor *) __attribute__((__stdcall__)); |
327 | static inline void editor_cut(editor *ed) |
327 | static inline void editor_cut(editor *ed) |
328 | { |
328 | { |
329 | __asm__ __volatile__ ( |
329 | __asm__ __volatile__ ( |
Line 330... | Line 330... | ||
330 | "push edi \n\t":::); |
330 | "push %%edi \n\t":::); |
Line 331... | Line 331... | ||
331 | 331 | ||
332 | (*ted_but_cut)(ed); |
332 | (*ted_but_cut)(ed); |
333 | 333 | ||
Line 334... | Line 334... | ||
334 | __asm__ __volatile__ ( |
334 | __asm__ __volatile__ ( |
335 | "pop edi \n\t":::); |
335 | "pop %%edi \n\t":::); |
336 | } |
336 | } |
337 | 337 | ||
338 | extern void (*ted_but_undo)(editor *) __attribute__((__stdcall__)); |
338 | extern void (*ted_but_undo)(editor *) __attribute__((__stdcall__)); |
Line 339... | Line 339... | ||
339 | static inline void editor_undo(editor *ed) |
339 | static inline void editor_undo(editor *ed) |
Line 340... | Line 340... | ||
340 | { |
340 | { |
341 | __asm__ __volatile__ ( |
341 | __asm__ __volatile__ ( |
342 | "push edi \n\t":::); |
342 | "push %%edi \n\t":::); |
Line 343... | Line 343... | ||
343 | 343 | ||
344 | (*ted_but_undo)(ed); |
344 | (*ted_but_undo)(ed); |
345 | 345 | ||
346 | __asm__ __volatile__ ( |
346 | __asm__ __volatile__ ( |
347 | "pop edi \n\t":::); |
347 | "pop %%edi \n\t":::); |
Line 348... | Line 348... | ||
348 | } |
348 | } |
Line 349... | Line 349... | ||
349 | 349 | ||
350 | extern void (*ted_but_redo)(editor *) __attribute__((__stdcall__)); |
350 | extern void (*ted_but_redo)(editor *) __attribute__((__stdcall__)); |
351 | static inline void editor_redo(editor *ed) |
351 | static inline void editor_redo(editor *ed) |
Line 352... | Line 352... | ||
352 | { |
352 | { |
353 | __asm__ __volatile__ ( |
353 | __asm__ __volatile__ ( |
354 | "push edi \n\t":::); |
354 | "push %%edi \n\t":::); |
355 | 355 | ||
356 | (*ted_but_redo)(ed); |
356 | (*ted_but_redo)(ed); |
357 | 357 | ||
Line 358... | Line 358... | ||
358 | __asm__ __volatile__ ( |
358 | __asm__ __volatile__ ( |
Line 359... | Line 359... | ||
359 | "pop edi \n\t":::); |
359 | "pop %%edi \n\t":::); |
360 | } |
360 | } |
361 | 361 | ||
362 | extern void (*ted_but_reverse)(editor *) __attribute__((__stdcall__)); |
362 | extern void (*ted_but_reverse)(editor *) __attribute__((__stdcall__)); |
Line 363... | Line 363... | ||
363 | static inline void editor_reverse(editor *ed) |
363 | static inline void editor_reverse(editor *ed) |
364 | { |
364 | { |
365 | __asm__ __volatile__ ( |
365 | __asm__ __volatile__ ( |
Line 426... | Line 426... | ||
426 | get_keyboard_layout(ly_opt, conv_table); |
426 | get_keyboard_layout(ly_opt, conv_table); |
Line 427... | Line 427... | ||
427 | 427 | ||
428 | editor_keyboard(ed, conv_table, ed_ctrl, get_key().val); |
428 | editor_keyboard(ed, conv_table, ed_ctrl, get_key().val); |
Line 429... | Line 429... | ||
429 | } |
429 | } |
430 | 430 | ||
431 | inline void gui_add_editor(kolibri_window *wnd, editor* e) |
431 | static inline void gui_add_editor(kolibri_window *wnd, editor* e) |
432 | { |
432 | { |
Line 433... | Line 433... | ||
433 | kolibri_window_add_element(wnd, KOLIBRI_EDITOR, e); |
433 | kolibri_window_add_element(wnd, KOLIBRI_EDITOR, e); |
Line 470... | Line 470... | ||
470 | ed->color_cur_text = 0xff0000; |
470 | ed->color_cur_text = 0xff0000; |
471 | ed->color_wnd_text = 0xffff00; |
471 | ed->color_wnd_text = 0xffff00; |
472 | */ |
472 | */ |
473 | ed->symbol_new_line = 20; // ascii(20) |
473 | ed->symbol_new_line = 20; // ascii(20) |
Line 474... | Line 474... | ||
474 | 474 | ||
475 | ed->scr_w = kolibri_new_scrollbar_def(0, 0, 100, 30, 0); |
475 | ed->scr_w = kolibri_new_scrollbar_def(X_Y(50, 16), X_Y(50, 300), 100, 30, 0); |
Line 476... | Line 476... | ||
476 | ed->scr_h = kolibri_new_scrollbar_def(0, 0, 100, 30, 0); |
476 | ed->scr_h = kolibri_new_scrollbar_def(X_Y(0, 150), X_Y(50, 16), 100, 30, 0); |
477 | 477 | ||
478 | ed->buffer_size = TE_BUF_SIZE; |
478 | ed->buffer_size = TE_BUF_SIZE; |