Rev 6612 | Rev 8581 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6612 | Rev 6615 | ||
---|---|---|---|
Line 67... | Line 67... | ||
67 | void *ed_lock; |
67 | void *ed_lock; |
68 | 68 | ||
Line 69... | Line 69... | ||
69 | gui_add_editor(main_window, ed = kolibri_new_editor(X_Y(0, 440), X_Y(20, 150), 0x11, 2048, &ed_lock)); // 0x11 font 8x16 sized x2 |
69 | gui_add_editor(main_window, ed = kolibri_new_editor(X_Y(0, 440), X_Y(20, 150), 0x11, 2048, &ed_lock)); // 0x11 font 8x16 sized x2 |
70 | ed_lock = ed; |
70 | ed_lock = ed; |
71 | /* |
71 | |
72 | // load sample file |
72 | // load sample file |
73 | int res, len; |
73 | //int res, len; |
74 | res = editor_openfile(ed, "/rd/1/boardlog.txt", &len); |
74 | //res = editor_openfile(ed, "/rd/1/boardlog.txt", &len); |
75 | debug_board_printf("loaded sample file err=%d, len=%d\n", res, len); |
75 | //debug_board_printf("loaded sample file err=%d, len=%d\n", res, len); |
76 | */ |
76 | |
77 | //adding sample text @cursor |
77 | //adding sample text @cursor |
78 | char *sampletext = "==========ADDED SAMPLE TEXT==========\n"; |
78 | char *sampletext = "*123*=========ADDED SAMPLE TEXT=========*789*\n"; |
79 | (*ted_text_add)(ed, sampletext, strlen(sampletext), 0); |
79 | (*ted_text_add)(ed, sampletext, strlen(sampletext), 0); |
Line 80... | Line 80... | ||
80 | 80 | ||
81 | // treelist as tree |
81 | // treelist as tree |
82 | treelist *tl = kolibri_new_treelist(X_Y(0, 200), X_Y(200, 200), 16, X_Y(16, 16), 100, 50, 0, 0, TL_KEY_NO_EDIT | TL_DRAW_PAR_LINE, &ed_lock, 0x8080ff, 0x0000ff, 0xffffff); |
82 | treelist *tl = kolibri_new_treelist(X_Y(0, 200), X_Y(200, 200), 16, X_Y(16, 16), 100, 50, 0, 0, TL_KEY_NO_EDIT | TL_DRAW_PAR_LINE, &ed_lock, 0x8080ff, 0x0000ff, 0xffffff); |
Line 83... | Line 83... | ||
83 | treelist_data_init(tl); |
83 | (*tl_data_init)(tl); |
84 | 84 | ||
85 | // ÷èòàåì ôàéë ñ êóðñîðàìè è ëèíèÿìè |
85 | // ÷èòàåì ôàéë ñ êóðñîðàìè è ëèíèÿìè |
86 | strcpy(fname, run_path); |
86 | strcpy(fname, run_path); |
Line 92... | Line 92... | ||
92 | strcat(fname, "tl_nod_16.png"); |
92 | strcat(fname, "tl_nod_16.png"); |
93 | tl->data_img = load_image_file(fname); |
93 | tl->data_img = load_image_file(fname); |
94 | 94 | ||
Line 95... | Line 95... | ||
95 | treelist_node_add(tl, "node1", 1, 0, 0); // ãäå 1 íîìåð èêîíêè ñ êíèãîé |
95 | treelist_node_add(tl, "node1", 1, 0, 0); // ãäå 1 íîìåð èêîíêè ñ êíèãîé |
96 | treelist_cursor_next(tl); |
96 | (*tl_cur_next)(tl); |
97 | treelist_node_add(tl, "node1.1", 1, 0, 1); |
97 | treelist_node_add(tl, "node1.1", 1, 0, 1); |
98 | treelist_cursor_next(tl); |
98 | (*tl_cur_next)(tl); |
99 | treelist_node_add(tl, "node1.1.1", 0, 0, 2); |
99 | treelist_node_add(tl, "node1.1.1", 0, 0, 2); |
100 | treelist_cursor_next(tl); |
100 | (*tl_cur_next)(tl); |
101 | treelist_node_add(tl, "node1.2", 1, 0, 1); |
101 | treelist_node_add(tl, "node1.2", 1, 0, 1); |
102 | treelist_cursor_next(tl); |
102 | (*tl_cur_next)(tl); |
Line 103... | Line 103... | ||
103 | 103 | ||
104 | treelist_node_add(tl, "node2", 1, 1, 0); // closed node |
104 | treelist_node_add(tl, "node2", 1, 1, 0); // closed node |
105 | treelist_cursor_next(tl); |
105 | (*tl_cur_next)(tl); |
106 | treelist_node_add(tl, "node2.1", 1, 0, 1); |
106 | treelist_node_add(tl, "node2.1", 1, 0, 1); |
Line 107... | Line 107... | ||
107 | treelist_cursor_next(tl); |
107 | (*tl_cur_next)(tl); |
108 | 108 | ||
Line 109... | Line 109... | ||
109 | treelist_node_add(tl, "node3", 1, 0, 0); |
109 | treelist_node_add(tl, "node3", 1, 0, 0); |
110 | treelist_cursor_next(tl); |
110 | (*tl_cur_next)(tl); |
Line 111... | Line 111... | ||
111 | 111 | ||
112 | treelist_cursor_begin(tl); //;ñòàâèì êóðñîð íà íà÷àëî ñïèñêà |
112 | (*tl_cur_beg)(tl); //;ñòàâèì êóðñîð íà íà÷àëî ñïèñêà |
113 | gui_add_treelist(main_window, tl); |
113 | gui_add_treelist(main_window, tl); |
Line 114... | Line 114... | ||
114 | 114 | ||
115 | // treelist as listbox |
115 | // treelist as listbox |
Line 116... | Line 116... | ||
116 | treelist *tl2 = kolibri_new_treelist(X_Y(220, 200), X_Y(200, 200), 16, X_Y(16, 16), 100, 50, 0, 0, TL_LISTBOX_MODE, &ed_lock, 0x8080ff, 0x0000ff, 0xffffff); |
116 | treelist *tl2 = kolibri_new_treelist(X_Y(220, 200), X_Y(200, 200), 16, X_Y(16, 16), 100, 50, 0, 0, TL_LISTBOX_MODE, &ed_lock, 0x8080ff, 0x0000ff, 0xffffff); |
117 | treelist_data_init(tl2); |
117 | (*tl_data_init)(tl2); |
Line 118... | Line 118... | ||
118 | 118 | ||
119 | tl2->data_img_sys = tl->data_img_sys; |
119 | tl2->data_img_sys = tl->data_img_sys; |
Line 120... | Line 120... | ||
120 | tl2->data_img = tl->data_img; |
120 | tl2->data_img = tl->data_img; |
121 | 121 | ||
Line 122... | Line 122... | ||
122 | treelist_node_add(tl2, "list1", 0, 0, 0); // ãäå 1 íîìåð èêîíêè ñ êíèãîé |
122 | treelist_node_add(tl2, "list1", 0, 0, 0); // ãäå 1 íîìåð èêîíêè ñ êíèãîé |
123 | treelist_cursor_next(tl2); |
123 | (*tl_cur_next)(tl2); |
Line 124... | Line 124... | ||
124 | 124 | ||
Line 125... | Line 125... | ||
125 | treelist_node_add(tl2, "list2", 0, 0, 0); |
125 | treelist_node_add(tl2, "list2", 0, 0, 0); |
Line 146... | Line 146... | ||
146 | case KOLIBRI_EVENT_NONE: |
146 | case KOLIBRI_EVENT_NONE: |
147 | break; |
147 | break; |
148 | case KOLIBRI_EVENT_KEY: |
148 | case KOLIBRI_EVENT_KEY: |
149 | key = get_key(); |
149 | key = get_key(); |
150 | trap(0x55); // for stop in debug |
150 | if (ed_lock == ed) |
151 | if (ed_lock == ed) |
- | |
152 | editor_key(ed, key); |
151 | editor_key(ed, key); |
153 | else if(ed_lock == tl) |
152 | else if(ed_lock == tl) |
154 | { |
153 | { |
155 | treelist_key(tl, key); |
154 | treelist_key(tl, key); |
156 | } |
155 | } |
Line 179... | Line 178... | ||
179 | gui_event = get_os_event(); |
178 | gui_event = get_os_event(); |
180 | } while(1) ; /* End of main activity loop */ |
179 | } while(1) ; /* End of main activity loop */ |
Line 181... | Line 180... | ||
181 | 180 | ||
- | 181 | clearing: |
|
- | 182 | trap(0x55); // for stop in debug |
|
- | 183 | //res = editor_savefile(ed, "/tmp0/1/editorlog.txt"); |
|
- | 184 | pc = editor_get_text(ed); |
|
- | 185 | debug_board_printf("saved text \"%s\"\n", pc); |
|
- | 186 | free(pc); |
|
- | 187 | ||
- | 188 | ||
182 | clearing: |
189 | |
183 | editor_delete(ed); |
190 | editor_delete(ed); |
Line 184... | Line 191... | ||
184 | treelist_data_clear(tl); |
191 | treelist_data_clear(tl); |
185 | 192 |