Rev 6601 | Rev 6615 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6601 | Rev 6612 | ||
---|---|---|---|
Line 22... | Line 22... | ||
22 | typedef struct __attribute__ ((__packed__)) { |
22 | typedef struct __attribute__ ((__packed__)) { |
23 | uint32_t x_pos; //0 |
23 | uint32_t x_pos; //0 |
24 | uint32_t y_pos; //50 |
24 | uint32_t y_pos; //50 |
25 | uint32_t width; //440 |
25 | uint32_t width; //440 |
26 | uint32_t hight; //150 |
26 | uint32_t hight; //150 |
27 | uint32_t w_pane; //30 øèðèíà ïàíåëè â îêíå |
27 | uint32_t w_pane; //30 øèðèíà ïàíåëè â îêíå, width of left pane with line numbers |
28 | uint32_t h_pane; //25 âûñîòà ïàíåëè â îêíå |
28 | uint32_t h_pane; //25 âûñîòà ïàíåëè â îêíå, hight of top pane with Rows, Cols Undo info |
29 | uint32_t width_sym; //9 øèðèíà ñèìâîëà (çíàêîìåñòà) â îêíå |
29 | uint32_t width_sym; //9 øèðèíà ñèìâîëà (çíàêîìåñòà) â îêíå |
30 | uint32_t hight_sym; //16 âûñîòà ñèìâîëà (çíàêîìåñòà) â îêíå |
30 | uint32_t hight_sym; //16 âûñîòà ñèìâîëà (çíàêîìåñòà) â îêíå |
31 | uint8_t drag_m; // âûäåëåíèå îò ìûøè |
31 | uint8_t drag_m; // âûäåëåíèå îò ìûøè |
32 | uint8_t drag_k; // âûäåëåíèå îò êëàâèàòóðû |
32 | uint8_t drag_k; // âûäåëåíèå îò êëàâèàòóðû |
33 | uint32_t sel_x0; // ñòðóêòóðà âûäåëåíèÿ |
33 | uint32_t sel_x0; // ñòðóêòóðà âûäåëåíèÿ |
Line 283... | Line 283... | ||
283 | KM_ALT = 0x00040000, |
283 | KM_ALT = 0x00040000, |
284 | KM_NUMLOCK = 0x00080000 |
284 | KM_NUMLOCK = 0x00080000 |
285 | }; |
285 | }; |
Line 286... | Line 286... | ||
286 | 286 | ||
287 | extern void (*ted_key_asm)(editor *, char* table, int control) __attribute__((__stdcall__)); |
287 | extern void (*ted_key_asm)(editor *, char* table, int control) __attribute__((__stdcall__)); |
288 | static inline void editor_keyboard(editor *ed, char* table, enum control_keys control, int ch) |
288 | static inline __attribute__((__stdcall__)) void editor_keyboard(editor *ed, char* table, enum control_keys control, int ch) |
289 | /// control is KM_SHIFT, KM_ALT, KM_CTRL, KM_NUMLOCK, |
289 | /// control is KM_SHIFT, KM_ALT, KM_CTRL, KM_NUMLOCK, |
290 | /// ch = GET_KEY |
290 | /// ch = GET_KEY |
291 | /// table = SF_SYSTEM_GET,SSF_KEYBOARD_LAYOUT |
291 | /// table = SF_SYSTEM_GET,SSF_KEYBOARD_LAYOUT |
292 | { |
292 | { |
- | 293 | __asm__ __volatile__ ( |
|
- | 294 | "push %4\n\t" |
|
- | 295 | "push %3\n\t" |
|
- | 296 | "push %2\n\t" |
|
- | 297 | "call *%1 \n\t"::"a"(ch), "m"(ted_key_asm), "m"(ed), "m"(table), "m"(control):); |
|
- | 298 | /* |
|
293 | __asm__ __volatile__ ( |
299 | __asm__ __volatile__ ( |
294 | "nop \n\t"::"a"(ch):); |
- | |
295 | 300 | "nop \n\t"::"a"(ch):); |
|
- | 301 | (*ted_key_asm)(ed, table, control); |
|
296 | (*ted_key_asm)(ed, table, control); |
302 | */ |
Line 297... | Line 303... | ||
297 | } |
303 | } |
298 | 304 | ||
299 | extern void (*ted_open_file_asm)(editor *, struct fs_dirinfo*, char *fname) __attribute__((__stdcall__)); |
305 | extern void (*ted_open_file_asm)(editor *, struct fs_dirinfo*, char *fname) __attribute__((__stdcall__)); |
Line 408... | Line 414... | ||
408 | :"a"(26),"b"(2), "c"(opt), "d"(buf)); |
414 | :"a"(26),"b"(2), "c"(opt), "d"(buf)); |
Line 409... | Line 415... | ||
409 | 415 | ||
410 | return lang; |
416 | return lang; |
Line 411... | Line -... | ||
411 | }; |
- | |
- | 417 | }; |
|
412 | 418 | ||
413 | 419 | __attribute__((__stdcall__)) |
|
414 | static void editor_key(editor* ed) |
420 | static void editor_key(editor* ed, oskey_t key) |
- | 421 | // callback for gui |
|
- | 422 | { |
|
415 | // callback for gui |
423 | //if(ed->el_focus != ed) return; // need to check not to lose keyb buffer |
416 | { |
424 | |
417 | uint32_t control = get_control_keys(); |
425 | uint32_t control = get_control_keys(); |
418 | enum control_keys ed_ctrl = 0; |
426 | enum control_keys ed_ctrl = 0; |
419 | int ly_opt = 1; |
427 | int ly_opt = 1; |
Line 423... | Line 431... | ||
423 | if (control & 0x80) ed_ctrl |= KM_NUMLOCK; |
431 | if (control & 0x80) ed_ctrl |= KM_NUMLOCK; |
Line 424... | Line 432... | ||
424 | 432 | ||
425 | char conv_table[128]; |
433 | char conv_table[128]; |
Line 426... | Line 434... | ||
426 | get_keyboard_layout(ly_opt, conv_table); |
434 | get_keyboard_layout(ly_opt, conv_table); |
427 | 435 | ||
Line 428... | Line 436... | ||
428 | editor_keyboard(ed, conv_table, ed_ctrl, get_key().val); |
436 | editor_keyboard(ed, conv_table, ed_ctrl, key.val); |
429 | } |
437 | } |
430 | 438 | ||
431 | static inline void gui_add_editor(kolibri_window *wnd, editor* e) |
439 | static inline void gui_add_editor(kolibri_window *wnd, editor* e) |
Line 432... | Line 440... | ||
432 | { |
440 | { |
433 | kolibri_window_add_element(wnd, KOLIBRI_EDITOR, e); |
441 | kolibri_window_add_element(wnd, KOLIBRI_EDITOR, e); |
Line 434... | Line 442... | ||
434 | } |
442 | } |
435 | 443 | ||
436 | static inline editor* kolibri_new_editor(uint32_t x_w, uint32_t y_h, uint32_t font, uint32_t max_chars, editor **editor_interlock) |
444 | static inline editor* kolibri_new_editor(uint32_t x_w, uint32_t y_h, uint32_t font, uint32_t max_chars, void *editor_interlock) |
437 | /// font - 0b10SSS 8x16 size multiply (SSS+1), 0xSSS - 6x9 multiply (SSS+1) |
445 | /// font - 0b10SSS 8x16 size multiply (SSS+1), 0xSSS - 6x9 multiply (SSS+1) |
438 | 446 | ||
439 | { |
447 | { |
Line -... | Line 448... | ||
- | 448 | editor *ed = (editor *)calloc(1, sizeof(editor)); |
|
440 | editor *ed = (editor *)calloc(1, sizeof(editor)); |
449 | ed->x_pos = x_w >> 16; |
441 | ed->x_pos = x_w >> 16; |
450 | ed->width = x_w & 0xFFFF; |
442 | ed->width = x_w & 0xFFFF; |
451 | ed->y_pos = y_h >> 16; |
443 | ed->y_pos = y_h >> 16; |
452 | ed->hight = y_h & 0xFFFF; |
444 | ed->hight = y_h & 0xFFFF; |
453 | |
445 | 454 | ed->w_pane = 30; |
|
Line 470... | Line 479... | ||
470 | ed->color_cur_text = 0xff0000; |
479 | ed->color_cur_text = 0xff0000; |
471 | ed->color_wnd_text = 0xffff00; |
480 | ed->color_wnd_text = 0xffff00; |
472 | */ |
481 | */ |
473 | ed->symbol_new_line = 20; // ascii(20) |
482 | ed->symbol_new_line = 20; // ascii(20) |
Line 474... | Line 483... | ||
474 | 483 | ||
475 | ed->scr_w = kolibri_new_scrollbar_def(X_Y(50, 16), X_Y(50, 300), 100, 30, 0); |
484 | ed->scr_w = kolibri_new_scrollbar_def(X_Y(0, 16), X_Y(0, 0), 100, 30, 0); // cur_area will be inited ltr, max & pos undef |
Line 476... | Line 485... | ||
476 | ed->scr_h = kolibri_new_scrollbar_def(X_Y(0, 150), X_Y(50, 16), 100, 30, 0); |
485 | ed->scr_h = kolibri_new_scrollbar_def(X_Y(0, 0), X_Y(0, 16), 100, 30, 0); // cur_area will be inited ltr, max & pos undef |
477 | 486 | ||
478 | ed->buffer_size = TE_BUF_SIZE; |
487 | ed->buffer_size = TE_BUF_SIZE; |
Line 479... | Line 488... | ||
479 | ed->buffer = malloc(TE_BUF_SIZE); |
488 | ed->buffer = malloc(TE_BUF_SIZE); |
480 | ed->buffer_find = malloc(TE_BUF_SIZE / 8); //where to store text to search |
489 | ed->buffer_find = malloc(TE_BUF_SIZE / 8); //where to store text to search |
481 | 490 | ||
Line -... | Line 491... | ||
- | 491 | ed->cur_ins = 1; // insert mode default |
|
- | 492 | ed->mode_color = 1; // can select text |
|
482 | ed->cur_ins = 1; // insert mode default |
493 | ed->mode_invis = 1; // show nonprinted symbols |
483 | ed->mode_color = 1; // can select text |
494 | |
484 | ed->mode_invis = 1; // show nonprinted symbols |
495 | ed->el_focus = editor_interlock; |
485 | 496 | ||
486 | // ??? saveregs ax,cx,di |
497 | // ??? saveregs ax,cx,di |