Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 6611 → Rev 6612

/contrib/C_Layer/ASM/loadboxlib.asm
12,10 → 12,8
include '../../../programs/dll.inc'
 
public init_boxlib as '_kolibri_boxlib_init'
public editbox_key_thunk as '_editbox_key@4' ; renamed due to ambiguity
public press_key as '_press_key'
 
;;; Returns 0 on success. -1 on failure.
 
proc init_boxlib
pusha
mcall 68,11
26,18 → 24,22
 
;; Wrapper to handle edit_box_key function for editboxes.
;; Call this baby from C (refer kolibri_editbox.h for details)
editbox_key_thunk:
mov [oldebp], ebp ;Save ebp because GCC is crazy for it otherwise.
pop ebp ;Save return address in ebp. Stack top is param now.
mov eax, dword [press_key]
call [edit_box_key] ; The pointer we passed should be on the stack already.
push ebp ;push the return address back to stack
mov ebp, [oldebp]
ret
;public editbox_key_thunk as '_editbox_key@4' ; renamed due to ambiguity
;public press_key as '_press_key'
;; replaced by siemargl as inline ASM in C wrapper
;editbox_key_thunk:
; mov [oldebp], ebp ;Save ebp because GCC is crazy for it otherwise.
; pop ebp ;Save return address in ebp. Stack top is param now.
; mov eax, dword [press_key]
; call [edit_box_key] ; The pointer we passed should be on the stack already.
; push ebp ;push the return address back to stack
; mov ebp, [oldebp]
; ret
;oldebp dd ?
;press_key dd ?
 
oldebp dd ?
press_key dd ?
 
 
@IMPORT:
library lib_boxlib, 'box_lib.obj'
 
/contrib/C_Layer/EXAMPLE/libguic_kolibri/Makefile
35,7 → 35,8
kos32-objcopy $@ -O binary
 
boardmsg: boardmsg.o
$(LD) $(LIBPATH) --subsystem native -o $@ $^ $(OBJPATH)/loadboxlib.obj $(LDFLAGS)
$(LD) $(LIBPATH) --subsystem native -o $@ $^ $(OBJPATH)/loadboxlib.obj $(LDFLAGS) -Map=boardmsg.map
# strip $@
kos32-objcopy $@ -O binary
 
dbutton_files: dbutton_files.o
/contrib/C_Layer/EXAMPLE/libguic_kolibri/boardmsg.c
69,9 → 69,7
debug_board_write_str("\n");
break;
}
press_key = key.val;
 
kolibri_handle_event_key(main_window);
kolibri_handle_event_key(main_window, key);
}
else if(gui_event == KOLIBRI_EVENT_BUTTON)
{
/contrib/C_Layer/EXAMPLE/libguic_kolibri/dbutton_files.c
109,7 → 109,6
brows.folder_data = read_folderdata("/rd/1");
brows.select_panel_counter = 1; // if want to show selection
 
int extended_key = 0, act = 0;
do /* Start of main activity loop */
{
switch(gui_event)
124,44 → 123,7
break;
case KOLIBRI_EVENT_KEY:
keypress = get_key();
if(keypress.state) break;
if (keypress.code == 0xE0){ extended_key = 1; break; }
 
act = 0;
switch(keypress.ctrl_key) // ascii scancode
{
case 80: // arrow down
act = 1; break;
case 72: // arrow up
act = 2; break;
case 81: // PageDown
act = 3; break;
case 73: // PageUp
act = 4; break;
case 71: // Home
act = 5; break;
case 79: // End
act = 6; break;
case 28: // Enter
act = 7; break;
case 82: // Insert
act = 8; break;
case 78: // NumPad+ select all
act = 9; break;
case 74: // NumPad- deselct
act = 10; break;
case 55: // NumPad* invert selection
act = 11; break;
default:
act = 12; // search by letter
}
brows.key_action = act;
brows.key_action_num = keypress.ctrl_key;
 
debug_board_printf("key pressed [%X] %d, action %d, ext_flag = %d\n", keypress.val, brows.key_action_num, act, extended_key);
 
if (extended_key) extended_key = 0;
(*filebrowse_key)(&brows);
filebrowser_key(&brows, keypress);
//kolibri_handle_event_key(main_window);
break;
case KOLIBRI_EVENT_BUTTON:
/contrib/C_Layer/EXAMPLE/libguic_kolibri/editor_tree_msgbox.c
28,6 → 28,15
char* load_file_inmem(char* fname, int32_t* read_sz); // see below
char* load_image_file(char* fname); // see below
 
void set_os_keyb_mode(int mode)
// 0 - ASCII, 1 - SCAN
{
__asm__ __volatile__(
"int $0x40"
::"a"(66), "b"(1), "c"(mode));
};
 
 
int main(int argc, char **argv)
{
/* Load all libraries, initialize global tables like system color table and
36,6 → 45,7
elements can be used after a successful call to this function
*/
kolibri_gui_init();
set_os_keyb_mode(1); // scan code mode needed for editor
// kolibri_proclib_init(); // opensave && color dialogs
kolibri_libimg_init(); // png handling
 
43,7 → 53,7
uint32_t pressed_button = 0;
// uint32_t mouse_button;
// pos_t mouse_pos;
oskey_t keypress;
// oskey_t keypress;
 
// make full path + argv
strcpy(run_path, argv[0]);
55,12 → 65,22
kolibri_window *main_window = kolibri_new_window(50, 40, 490, 500, "Editor, TreeView and MsgBox demo");
 
editor *ed;
editor *ed_lock;
void *ed_lock;
 
gui_add_editor(main_window, ed = kolibri_new_editor(X_Y(0, 440), X_Y(20, 150), 0x1001, 2048, &ed_lock));
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
ed_lock = ed;
/*
// load sample file
int res, len;
res = editor_openfile(ed, "/rd/1/boardlog.txt", &len);
debug_board_printf("loaded sample file err=%d, len=%d\n", res, len);
*/
//adding sample text @cursor
char *sampletext = "==========ADDED SAMPLE TEXT==========\n";
(*ted_text_add)(ed, sampletext, strlen(sampletext), 0);
 
treelist *tl = kolibri_new_treelist(X_Y(0, 440), 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);
// treelist as tree
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);
treelist_data_init(tl);
 
// ÷èòàåì ôàéë ñ êóðñîðàìè è ëèíèÿìè
75,9 → 95,17
 
treelist_node_add(tl, "node1", 1, 0, 0); // ãäå 1 íîìåð èêîíêè ñ êíèãîé
treelist_cursor_next(tl);
treelist_node_add(tl, "node1.1", 1, 0, 1);
treelist_cursor_next(tl);
treelist_node_add(tl, "node1.1.1", 0, 0, 2);
treelist_cursor_next(tl);
treelist_node_add(tl, "node1.2", 1, 0, 1);
treelist_cursor_next(tl);
 
treelist_node_add(tl, "node2", 1, 0, 0);
treelist_node_add(tl, "node2", 1, 1, 0); // closed node
treelist_cursor_next(tl);
treelist_node_add(tl, "node2.1", 1, 0, 1);
treelist_cursor_next(tl);
 
treelist_node_add(tl, "node3", 1, 0, 0);
treelist_cursor_next(tl);
85,8 → 113,28
treelist_cursor_begin(tl); //;ñòàâèì êóðñîð íà íà÷àëî ñïèñêà
gui_add_treelist(main_window, tl);
 
// treelist as listbox
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);
treelist_data_init(tl2);
 
tl2->data_img_sys = tl->data_img_sys;
tl2->data_img = tl->data_img;
 
treelist_node_add(tl2, "list1", 0, 0, 0); // ãäå 1 íîìåð èêîíêè ñ êíèãîé
treelist_cursor_next(tl2);
 
treelist_node_add(tl2, "list2", 0, 0, 0);
treelist_cursor_next(tl2);
 
treelist_node_add(tl2, "list3", 0, 0, 0);
treelist_cursor_next(tl2);
 
treelist_cursor_begin(tl2); //;ñòàâèì êóðñîð íà íà÷àëî ñïèñêà
gui_add_treelist(main_window, tl2);
 
msgbox* box = kolibri_new_msgbox("Exit", "Are\rYOU\rSure?", 3, "YES", "Absolute", "Not Yet", NULL); // default NOT
 
oskey_t key;
do /* Start of main activity loop */
{
switch(gui_event)
99,10 → 147,20
case KOLIBRI_EVENT_NONE:
break;
case KOLIBRI_EVENT_KEY:
key = get_key();
trap(0x55); // for stop in debug
if (ed_lock == ed)
editor_key(ed);
editor_key(ed, key);
else if(ed_lock == tl)
{
treelist_key(tl, key);
}
else if(ed_lock == tl2)
{
treelist_key(tl2, key);
}
else
kolibri_handle_event_key(main_window);
kolibri_handle_event_key(main_window, key);
break;
case KOLIBRI_EVENT_BUTTON:
pressed_button = get_os_button();
/contrib/C_Layer/EXAMPLE/libguic_kolibri/option_menu.c
134,7 → 134,7
case KOLIBRI_EVENT_KEY:
keypress = get_key();
debug_board_printf("Key pressed state(%d) code(%d) ctrl_key(%d) modifiers(%#x)\n", keypress.state, keypress.code, keypress.ctrl_key, get_os_keyb_modifiers());
kolibri_handle_event_key(main_window); // ???????
kolibri_handle_event_key(main_window, keypress);
 
if(keypress.code == SCAN_CODE_ALTM && get_os_keyb_modifiers() & (KEY_LALT | KEY_RALT))
(*menu_bar_activate)(menu1); // wont work, immediately redraw command closes menu ( . but Alt+F1 worked in opendial.asm:463
/contrib/C_Layer/EXAMPLE/libguic_kolibri/scroll_progress.c
147,7 → 147,7
}
break;
}
kolibri_handle_event_key(main_window); // ???????
kolibri_handle_event_key(main_window, keypress);
break;
case KOLIBRI_EVENT_BUTTON:
pressed_button = get_os_button();
/contrib/C_Layer/INCLUDE/kolibri_button.h
21,7 → 21,8
return new_button;
}
 
void draw_button(kolibri_button *some_button)
__attribute__((__stdcall__))
static inline void draw_button(kolibri_button *some_button)
{
define_button(some_button -> x65536sizex, some_button -> y65536sizey, some_button -> identifier, some_button -> color);
}
/contrib/C_Layer/INCLUDE/kolibri_debug.h
9,7 → 9,7
/* Write a printf() like function (variable argument list) for
writing to debug board */
 
inline void debug_board_write_byte(const char ch){
static inline void debug_board_write_byte(const char ch){
__asm__ __volatile__(
"int $0x40"
:
22,7 → 22,7
debug_board_write_byte(*str++);
}
 
void debug_board_printf(const char *format,...)
static inline void debug_board_printf(const char *format,...)
{
va_list ap;
char log_board[300];
33,4 → 33,13
debug_board_write_str(log_board);
}
 
__attribute__ ((noinline)) void trap(int n)
{
// nothing todo, just see n in debugger. use "bp trap" command
__asm__ __volatile__(
"nop"
:
:"a"(n));
}
 
#endif /* KOLIBRI_DEBUG_H */
/contrib/C_Layer/INCLUDE/kolibri_editbox.h
5,8 → 5,8
 
/* flags meaning
ed_figure_only= 1000000000000000b ;îäíè ñèìâîëû
ed_always_focus= 100000000000000b
ed_focus= 10b ;ôîêóñ ââîäà ïðèëîæåíèÿ
ed_always_focus= 100000000000000b // âñåãäà ñ êóðñîðîì (ôîêóñîì)
ed_focus= 10b ;ôîêóñ ââîäà ïðèëîæåíèÿ, ìûøèòñÿ ñàìîñòîÿòåëüíî
ed_pass= 1b ;ïîëå ñ ïàðîëåì
ed_shift_on= 1000b ;åñëè íå óñòàíîâëåí -çíà÷èò âïåðâûå íàæàò shift,åñëè áûë óñòàíîâëåí, çíà÷èò ìû óæå ÷òî - òî äåëàëè óäåðæèâàÿ shift
ed_shift_on_off=1111111111110111b
44,7 → 44,7
unsigned int text_color;
unsigned int max;
char *text;
struct edit_box_t** mouse_variable; // must be pointer edit_box** to save focused editbox
void *mouse_variable; // must be pointer edit_box** to save focused editbox
unsigned int flags;
 
unsigned int size; // used symbols in buffer without trailing zero
72,7 → 72,7
max_chars = Limit of number of characters user can enter into edit box.
*/
 
edit_box* kolibri_new_edit_box(unsigned int tlx, unsigned int tly, unsigned int max_chars, edit_box **editbox_interlock)
edit_box* kolibri_new_edit_box(unsigned int tlx, unsigned int tly, unsigned int max_chars, void *editbox_interlock)
{
unsigned int PIXELS_PER_CHAR = 7;
edit_box *new_textbox = (edit_box *)calloc(1, sizeof(edit_box));
99,12 → 99,24
 
extern void (*edit_box_draw)(edit_box *) __attribute__((__stdcall__));
 
extern void (*edit_box_key)(edit_box *) __attribute__((__stdcall__));
/* editbox_key is a wrapper written in assembly to handle key press events for editboxes */
/* because inline assembly in GCC is a PITA and interferes with the EAX (AH) register */
/* which edit_box_key requires */
extern void editbox_key(edit_box *) __attribute__((__stdcall__));
__attribute__((__stdcall__)) void editbox_key(edit_box *e, oskey_t ch)
/// åñëè flags íå ñîäåðæèò ed_focus, èãíîðèðóåò ââîä
/// åñëè flags ñîäåðæèò ed_mouse_on èëè ed_disabled, èãíîðèðóåò ââîä
/// íà ââîäå îæèäàåò ch - êîä êëàâèøè, òîëüêî â ðåæèìå ASCII
{
__asm__ __volatile__ (
"push %2\n\t"
"call *%1 \n\t"::"a"(ch.val), "m"(edit_box_key), "m"(e):);
}
 
extern void (*edit_box_mouse)(edit_box *) __attribute__((__stdcall__));
/// ïðè ùåë÷êå íå ëåâîé êíîïêîé, îáíóëÿåò *mouse_variable! è ñáðàñûâàåò ôëàã ed_mouse_on
 
 
extern void (*edit_box_set_text)(edit_box *, char *) __attribute__((__stdcall__));
extern volatile unsigned press_key;
#endif /* KOLIBRI_EDITBOX_H */
/contrib/C_Layer/INCLUDE/kolibri_editor.h
24,8 → 24,8
uint32_t y_pos; //50
uint32_t width; //440
uint32_t hight; //150
uint32_t w_pane; //30 øèðèíà ïàíåëè â îêíå
uint32_t h_pane; //25 âûñîòà ïàíåëè â îêíå
uint32_t w_pane; //30 øèðèíà ïàíåëè â îêíå, width of left pane with line numbers
uint32_t h_pane; //25 âûñîòà ïàíåëè â îêíå, hight of top pane with Rows, Cols Undo info
uint32_t width_sym; //9 øèðèíà ñèìâîëà (çíàêîìåñòà) â îêíå
uint32_t hight_sym; //16 âûñîòà ñèìâîëà (çíàêîìåñòà) â îêíå
uint8_t drag_m; // âûäåëåíèå îò ìûøè
285,15 → 285,21
};
 
extern void (*ted_key_asm)(editor *, char* table, int control) __attribute__((__stdcall__));
static inline void editor_keyboard(editor *ed, char* table, enum control_keys control, int ch)
static inline __attribute__((__stdcall__)) void editor_keyboard(editor *ed, char* table, enum control_keys control, int ch)
/// control is KM_SHIFT, KM_ALT, KM_CTRL, KM_NUMLOCK,
/// ch = GET_KEY
/// table = SF_SYSTEM_GET,SSF_KEYBOARD_LAYOUT
{
__asm__ __volatile__ (
"push %4\n\t"
"push %3\n\t"
"push %2\n\t"
"call *%1 \n\t"::"a"(ch), "m"(ted_key_asm), "m"(ed), "m"(table), "m"(control):);
/*
__asm__ __volatile__ (
"nop \n\t"::"a"(ch):);
 
(*ted_key_asm)(ed, table, control);
*/
}
 
extern void (*ted_open_file_asm)(editor *, struct fs_dirinfo*, char *fname) __attribute__((__stdcall__));
410,10 → 416,12
return lang;
};
 
 
static void editor_key(editor* ed)
__attribute__((__stdcall__))
static void editor_key(editor* ed, oskey_t key)
// callback for gui
{
//if(ed->el_focus != ed) return; // need to check not to lose keyb buffer
 
uint32_t control = get_control_keys();
enum control_keys ed_ctrl = 0;
int ly_opt = 1;
425,7 → 433,7
char conv_table[128];
get_keyboard_layout(ly_opt, conv_table);
 
editor_keyboard(ed, conv_table, ed_ctrl, get_key().val);
editor_keyboard(ed, conv_table, ed_ctrl, key.val);
}
 
static inline void gui_add_editor(kolibri_window *wnd, editor* e)
433,7 → 441,7
kolibri_window_add_element(wnd, KOLIBRI_EDITOR, e);
}
 
static inline editor* kolibri_new_editor(uint32_t x_w, uint32_t y_h, uint32_t font, uint32_t max_chars, editor **editor_interlock)
static inline editor* kolibri_new_editor(uint32_t x_w, uint32_t y_h, uint32_t font, uint32_t max_chars, void *editor_interlock)
/// font - 0b10SSS 8x16 size multiply (SSS+1), 0xSSS - 6x9 multiply (SSS+1)
 
{
443,7 → 451,8
ed->y_pos = y_h >> 16;
ed->hight = y_h & 0xFFFF;
 
// no panel, w_pane, h_pane == 0
ed->w_pane = 30;
ed->h_pane = 20;
// font
if (font == 0) font = 0x10; // default 16 = 8x16
int font_multipl = (font & 7) + 1;
472,8 → 481,8
*/
ed->symbol_new_line = 20; // ascii(20)
 
ed->scr_w = kolibri_new_scrollbar_def(X_Y(50, 16), X_Y(50, 300), 100, 30, 0);
ed->scr_h = kolibri_new_scrollbar_def(X_Y(0, 150), X_Y(50, 16), 100, 30, 0);
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
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
 
ed->buffer_size = TE_BUF_SIZE;
ed->buffer = malloc(TE_BUF_SIZE);
483,6 → 492,8
ed->mode_color = 1; // can select text
ed->mode_invis = 1; // show nonprinted symbols
 
ed->el_focus = editor_interlock;
 
// ??? saveregs ax,cx,di
editor_init(ed); // memory allocation, cleaning
ed->syntax_file = (char*)&default_syntax;
/contrib/C_Layer/INCLUDE/kolibri_filebrowse.h
226,4 → 226,52
extern void (*filebrowse_key)(filebrowser *) __attribute__((__stdcall__));
extern void (*filebrowse_mouse)(filebrowser *) __attribute__((__stdcall__));
 
__attribute__((__stdcall__)) static inline void filebrowser_key(filebrowser *fb, oskey_t keypress)
/// wrapper for key, translate keypress (ASCII mode) to action for browser
{
// if (!fb->select_flag) return; // same reaction as other controls
 
int extended_key = 0, act = 0;
 
if(keypress.state) return;
if (keypress.code == 0xE0){ extended_key = 1; return; }
 
act = 0;
switch(keypress.ctrl_key) // ascii scancode
{
case 80: // arrow down
act = 1; break;
case 72: // arrow up
act = 2; break;
case 81: // PageDown
act = 3; break;
case 73: // PageUp
act = 4; break;
case 71: // Home
act = 5; break;
case 79: // End
act = 6; break;
case 28: // Enter
act = 7; break;
case 82: // Insert
act = 8; break;
case 78: // NumPad+ select all
act = 9; break;
case 74: // NumPad- deselct
act = 10; break;
case 55: // NumPad* invert selection
act = 11; break;
default:
act = 12; // search by letter
}
fb->key_action = act;
fb->key_action_num = keypress.ctrl_key;
 
// debug_board_printf("key pressed [%X] %d, action %d, ext_flag = %d\n", keypress.val, brows.key_action_num, act, extended_key);
 
if (extended_key) extended_key = 0;
(*filebrowse_key)(fb);
}
 
 
#endif /* KOLIBRI_FILEBROWSE_H */
/contrib/C_Layer/INCLUDE/kolibri_gui.h
66,7 → 66,7
}
}
 
void kolibri_handle_event_key(kolibri_window* some_window)
void kolibri_handle_event_key(kolibri_window* some_window, oskey_t key)
{
/* Enumerate and trigger key handling functions of window elements here */
if(some_window->elements)
75,9 → 75,9
 
do
{
/* Only execute if the function pointer isn't NULL */
/* Only execute if the function pointer isn't NULL, or -1 (fail to find in export table) */
if((int)kolibri_gui_op_table[current_element -> type].key_fn > 0)
kolibri_gui_op_table[current_element -> type].key_fn(current_element -> element);
kolibri_gui_op_table[current_element -> type].key_fn(current_element -> element, key);
 
current_element = current_element -> next;
} while(current_element != some_window->elements); /* Have we covered all elements? */
/contrib/C_Layer/INCLUDE/kolibri_gui_elements.h
44,12 → 44,13
}kolibri_window_element;
 
typedef void (*cb_elem_boxlib)(void *) __attribute__((__stdcall__));
typedef void (*cbkey_elem_boxlib)(void *, oskey_t) __attribute__((__stdcall__));
 
/* Generic structure for supporting functions on various elements of Kolibri's GUI */
typedef struct {
cb_elem_boxlib redraw_fn;
cb_elem_boxlib mouse_fn;
cb_elem_boxlib key_fn;
cbkey_elem_boxlib key_fn;
}kolibri_element_operations;
 
/* Structure for a GUI Window on Kolibri. It also contains all the elements drawn in window */
95,7 → 96,7
/* Setting up functions for edit box GUI elements*/
kolibri_gui_op_table[KOLIBRI_EDIT_BOX].redraw_fn = (cb_elem_boxlib)edit_box_draw;
kolibri_gui_op_table[KOLIBRI_EDIT_BOX].mouse_fn = (cb_elem_boxlib)edit_box_mouse;
kolibri_gui_op_table[KOLIBRI_EDIT_BOX].key_fn = (cb_elem_boxlib)editbox_key;
kolibri_gui_op_table[KOLIBRI_EDIT_BOX].key_fn = (cbkey_elem_boxlib)editbox_key;
 
/* Setting up functions for check box GUI elements*/
kolibri_gui_op_table[KOLIBRI_CHECK_BOX].redraw_fn = (cb_elem_boxlib)check_box_draw2;
152,17 → 153,16
 
kolibri_gui_op_table[KOLIBRI_FILEBROWSE].redraw_fn = (cb_elem_boxlib)filebrowse_draw;
kolibri_gui_op_table[KOLIBRI_FILEBROWSE].mouse_fn = (cb_elem_boxlib)filebrowse_mouse;
kolibri_gui_op_table[KOLIBRI_FILEBROWSE].key_fn = (cb_elem_boxlib)filebrowse_key;
kolibri_gui_op_table[KOLIBRI_FILEBROWSE].key_fn = (cbkey_elem_boxlib)filebrowser_key;
 
kolibri_gui_op_table[KOLIBRI_EDITOR].redraw_fn = (cb_elem_boxlib)ted_draw;
kolibri_gui_op_table[KOLIBRI_EDITOR].mouse_fn = (cb_elem_boxlib)ted_mouse;
kolibri_gui_op_table[KOLIBRI_EDITOR].key_fn = (cb_elem_boxlib)editor_key;
debug_board_printf("KOLIBRI_EDITOR (%x,%x,%x)\n", ted_draw, ted_mouse, editor_key);
kolibri_gui_op_table[KOLIBRI_EDITOR].key_fn = (cbkey_elem_boxlib)editor_key;
 
kolibri_gui_op_table[KOLIBRI_TREELIST].redraw_fn = (cb_elem_boxlib)tl_draw;
kolibri_gui_op_table[KOLIBRI_TREELIST].redraw_fn = (cb_elem_boxlib)treelist_draw;
kolibri_gui_op_table[KOLIBRI_TREELIST].mouse_fn = (cb_elem_boxlib)tl_mouse;
kolibri_gui_op_table[KOLIBRI_TREELIST].key_fn = (cb_elem_boxlib)treelist_key;
debug_board_printf("KOLIBRI_TREELIST (%x,%x,%x)\n", tl_draw, tl_mouse, treelist_key);
kolibri_gui_op_table[KOLIBRI_TREELIST].key_fn = (cbkey_elem_boxlib)treelist_key;
debug_board_printf("KOLIBRI_TREELIST (%x,%x,%x)\n", treelist_draw, tl_mouse, treelist_key);
}
 
/* Create a new main GUI window for KolibriOS */
/contrib/C_Layer/INCLUDE/kolibri_msgbox.h
5,7 → 5,7
typedef struct __attribute__ ((__packed__)) {
uint8_t retval; // 0 - win closed, 1 to n - button num, also default button on start
uint8_t reserv;
char texts[2048]; // mus be enough ;-)
char texts[2048]; // must be enough ;-)
char msgbox_stack[1024];
uint32_t top_stack;
} msgbox;
49,7 → 49,7
return box;
}
 
void kolibri_start_msgbox(msgbox* box, msgbox_callback cb[])
static inline void kolibri_start_msgbox(msgbox* box, msgbox_callback cb[])
{
if (!msgbox_inited)
{
/contrib/C_Layer/INCLUDE/kolibri_scrollbar.h
29,7 → 29,7
uint32_t run_size;
uint32_t position2;
uint32_t work_size;
uint32_t all_redraw;
uint32_t all_redraw; // need to be set =1 before each redraw
uint32_t ar_offset;
} scrollbar;
 
/contrib/C_Layer/INCLUDE/kolibri_treelist.h
74,7 → 74,7
tl->info_capt_len = info_capt_len;
tl->info_capt_offs = info_capt_offs;
tl->el_focus = el_focus;
tl->p_scroll = kolibri_new_scrollbar_def(X_Y(0, 16), X_Y(70, 30), 100, 30, 0);
tl->p_scroll = kolibri_new_scrollbar_def(X_Y(0, 16), X_Y(0, 0), 100, 30, 0);
return tl;
}
 
89,7 → 89,13
 
///âûâîä ñïèñêà íà ýêðàí
extern void (*tl_draw)(treelist *) __attribute__((__stdcall__));
__attribute__((__stdcall__)) static inline void treelist_draw(treelist *tl)
{
tl->p_scroll->all_redraw = 1;
(*tl_draw)(tl);
}
 
 
///ïåðåìåùàåì óçåë ââåðõ
extern void (*tl_node_move_up)(treelist *) __attribute__((__stdcall__));
 
120,6 → 126,7
 
__asm__ __volatile__ (
"pop %%edi \n\t":::);
free(tl->p_scroll);
}
 
extern void (*tl_info_clear_asm)(treelist *) __attribute__((__stdcall__));
137,17 → 144,13
 
extern void (*tl_key_asm)(treelist *) __attribute__((__stdcall__));
///ðåàêöèÿ íà êëàâèàòóðó
static inline void treelist_key(treelist *tl)
__attribute__((__stdcall__)) static inline void treelist_key(treelist *tl, oskey_t code)
{
__asm__ __volatile__ (
"push %%ebx \n\t"
"push %%edi \n\t":::);
"push %2\n\t"
"call *%1 \n\t"::"a"(code.val), "m"(tl_key_asm), "m"(tl):); // indirect call with asterisk *
 
(*tl_key_asm)(tl);
 
__asm__ __volatile__ (
"pop %%edi \n\t"
"pop %%ebx \n\t":::);
// (*tl_key_asm)(tl);
}
 
extern void (*tl_info_undo_asm)(treelist *) __attribute__((__stdcall__));