C_Layer: fixed some headers and code so that examples can build also with >= c99

git-svn-id: svn://kolibrios.org@8581 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Rustem Gimadutdinov (rgimad) 2021-02-05 23:27:15 +00:00
parent d5cfdf6d55
commit 10b3ae76ba
17 changed files with 348 additions and 339 deletions

View File

@ -8,7 +8,7 @@ CLAYER = $(abspath ../../)
LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds \ LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds \
--image-base 0 --image-base 0
CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__ CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__ -std=c99
INCLUDES = -I. -I$(SDK_DIR)/sources/newlib/libc/include INCLUDES = -I. -I$(SDK_DIR)/sources/newlib/libc/include
LIBPATH = -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib LIBPATH = -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib
@ -29,4 +29,4 @@ $(NAME): $(OBJECTS) Makefile
$(CC) -c $(INCLUDES) $(CFLAGS) -o $@ $< $(CC) -c $(INCLUDES) $(CFLAGS) -o $@ $<
clean: clean:
-rm -f *.o *.map -rm -f *.o *.map $(NAME)

View File

@ -8,7 +8,7 @@ CLAYER:= $(abspath ../../)
LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds \ LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds \
--image-base 0 --image-base 0
CFLAGS = -c -fno-ident -O2 -fomit-frame-pointer -fno-ident -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 CFLAGS = -c -fno-ident -O2 -fomit-frame-pointer -fno-ident -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -std=c99
INCLUDES= -I. -I$(SDK_DIR)/sources/newlib/libc/include -I$(CLAYER)/INCLUDE INCLUDES= -I. -I$(SDK_DIR)/sources/newlib/libc/include -I$(CLAYER)/INCLUDE
LIBPATH:= -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib LIBPATH:= -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib
@ -17,9 +17,9 @@ OBJPATH = $(CLAYER)/OBJ
all: all:
$(CC) $(CFLAGS) $(INCLUDES) $(SOURCES) main.c $(CC) $(CFLAGS) $(INCLUDES) $(SOURCES) main.c
$(LD) $(LIBPATH) $(LDFLAGS) --subsystem native main.o $(OBJPATH)/loadlibimg.obj -o $(NAME) -lgcc -lc.dll $(LD) $(LIBPATH) $(LDFLAGS) --subsystem native main.o $(OBJPATH)/loadlibimg.obj $(OBJPATH)/loadboxlib.obj -o $(NAME) -lgcc -lc.dll
strip -S $(NAME) strip -S $(NAME)
objcopy $(NAME) -O binary objcopy $(NAME) -O binary
clean: clean:
-rm -f *.o -rm -f *.o $(NAME)

View File

@ -3,8 +3,9 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stddef.h> #include <stddef.h>
#include <kolibri_libimg.h>
#include <kos32sys.h> #include <kos32sys.h>
#include <kolibri_gui.h>
#include <kolibri_libimg.h>
#define NEW_IMG_H 128 #define NEW_IMG_H 128
#define NEW_IMG_W 128 #define NEW_IMG_W 128

View File

@ -8,7 +8,7 @@ CLAYER:= $(abspath ../../)
LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds \ LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds \
--image-base 0 -lgcc -ldll -lc.dll --image-base 0 -lgcc -ldll -lc.dll
CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__ -std=gnu90 CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__ -std=c99
INCLUDES= -I. -I$(SDK_DIR)/sources/newlib/libc/include -I$(CLAYER)/INCLUDE INCLUDES= -I. -I$(SDK_DIR)/sources/newlib/libc/include -I$(CLAYER)/INCLUDE
LIBPATH:= -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib LIBPATH:= -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib
@ -29,4 +29,4 @@ $(NAME): $(OBJECTS) Makefile
$(CC) -c $(INCLUDES) $(CFLAGS) -o $@ $< $(CC) -c $(INCLUDES) $(CFLAGS) -o $@ $<
clean: clean:
-rm -f *.o *.map -rm -f *.o *.map $(NAME)

View File

@ -8,7 +8,7 @@ CLAYER:= $(abspath ../../)
LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app-dynamic.lds \ LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app-dynamic.lds \
--image-base 0 -lgcc -ldll -lc.dll --image-base 0 -lgcc -ldll -lc.dll
CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__ -std=gnu90 -mno-ms-bitfields CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__ -std=c99 -mno-ms-bitfields
INCLUDES= -I. -I$(SDK_DIR)/sources/newlib/libc/include -I$(CLAYER)/INCLUDE INCLUDES= -I. -I$(SDK_DIR)/sources/newlib/libc/include -I$(CLAYER)/INCLUDE
LIBPATH:= -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib LIBPATH:= -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib
@ -47,4 +47,4 @@ dbutton_files: dbutton_files.o
$(CC) -c $(INCLUDES) $(CFLAGS) -o $@ $< $(CC) -c $(INCLUDES) $(CFLAGS) -o $@ $<
clean: clean:
-rm -f *.o -rm -f *.o boardmsg boardmsg.map dbutton_files editor_tree_msgbox editor_tree_msgbox.map option_menu scroll_progress

View File

@ -22,6 +22,14 @@
#include "kolibri_libimg.h" #include "kolibri_libimg.h"
#include "kolibri_msgbox.h" #include "kolibri_msgbox.h"
/*extern inline scrollbar* kolibri_scrollbar(scrollbar* sb, uint32_t x_w, uint32_t y_h, uint32_t btn_height, uint32_t max_area,
uint32_t cur_area, uint32_t position, uint32_t back_color, uint32_t front_color, uint32_t line_color);
extern inline scrollbar* kolibri_new_scrollbar(uint32_t x_w, uint32_t y_h, uint32_t btn_height, uint32_t max_area,
uint32_t cur_area, uint32_t position, uint32_t back_color, uint32_t front_color, uint32_t line_color);
extern inline scrollbar* kolibri_new_scrollbar_def(uint32_t x_w, uint32_t y_h, uint32_t max_area, uint32_t cur_area, uint32_t position);
*/
char run_path[4096]; char run_path[4096];
char fname[4096]; char fname[4096];
@ -83,17 +91,17 @@ int main(int argc, char **argv)
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 *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);
(*tl_data_init)(tl); (*tl_data_init)(tl);
// читаем файл с курсорами и линиями // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
strcpy(fname, run_path); strcpy(fname, run_path);
strcat(fname, "tl_sys_16.png"); strcat(fname, "tl_sys_16.png");
tl->data_img_sys = load_image_file(fname); tl->data_img_sys = load_image_file(fname);
// читаем файл с иконками узлов // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
strcpy(fname, run_path); strcpy(fname, run_path);
strcat(fname, "tl_nod_16.png"); strcat(fname, "tl_nod_16.png");
tl->data_img = load_image_file(fname); tl->data_img = load_image_file(fname);
treelist_node_add(tl, "node1", 1, 0, 0); // где 1 номер иконки с книгой treelist_node_add(tl, "node1", 1, 0, 0); // <EFBFBD><EFBFBD><EFBFBD> 1 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
(*tl_cur_next)(tl); (*tl_cur_next)(tl);
treelist_node_add(tl, "node1.1", 1, 0, 1); treelist_node_add(tl, "node1.1", 1, 0, 1);
(*tl_cur_next)(tl); (*tl_cur_next)(tl);
@ -110,7 +118,7 @@ int main(int argc, char **argv)
treelist_node_add(tl, "node3", 1, 0, 0); treelist_node_add(tl, "node3", 1, 0, 0);
(*tl_cur_next)(tl); (*tl_cur_next)(tl);
(*tl_cur_beg)(tl); //;ставим курсор на начало списка (*tl_cur_beg)(tl); //;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gui_add_treelist(main_window, tl); gui_add_treelist(main_window, tl);
// treelist as listbox, no caption, no icons // treelist as listbox, no caption, no icons
@ -121,7 +129,7 @@ int main(int argc, char **argv)
tl2->data_img_sys = tl->data_img_sys; tl2->data_img_sys = tl->data_img_sys;
//tl2->data_img = tl->data_img; - no icons will be drawed //tl2->data_img = tl->data_img; - no icons will be drawed
treelist_node_add(tl2, "list1", 0, 0, 0); // где 1 номер иконки с книгой treelist_node_add(tl2, "list1", 0, 0, 0); // <EFBFBD><EFBFBD><EFBFBD> 1 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
(*tl_cur_next)(tl2); (*tl_cur_next)(tl2);
treelist_node_add(tl2, "list2", 0, 0, 0); treelist_node_add(tl2, "list2", 0, 0, 0);
@ -130,7 +138,7 @@ int main(int argc, char **argv)
treelist_node_add(tl2, "list3", 0, 0, 0); treelist_node_add(tl2, "list3", 0, 0, 0);
(*tl_cur_next)(tl2); (*tl_cur_next)(tl2);
(*tl_cur_beg)(tl2); //;ставим курсор на начало списка (*tl_cur_beg)(tl2); //;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
gui_add_treelist(main_window, tl2); gui_add_treelist(main_window, tl2);
msgbox* box = kolibri_new_msgbox("Exit", "Are\rYOU\rSure?", 3, "YES", "Absolute", "Not Yet", NULL); // default NOT msgbox* box = kolibri_new_msgbox("Exit", "Are\rYOU\rSure?", 3, "YES", "Absolute", "Not Yet", NULL); // default NOT
@ -230,14 +238,14 @@ char* load_image_file(char* fname)
char *image_data = 0, *image_data_rgb = 0, *filedata = 0; char *image_data = 0, *image_data_rgb = 0, *filedata = 0;
filedata = load_file_inmem(fname, &read_bytes); filedata = load_file_inmem(fname, &read_bytes);
// определяем вид изображения и переводим его во временный буфер image_data // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> image_data
image_data = (*img_decode)(filedata, read_bytes, 0); image_data = (*img_decode)(filedata, read_bytes, 0);
w = *(int*)(image_data +4); w = *(int*)(image_data +4);
h = *(int*)(image_data +8); h = *(int*)(image_data +8);
image_data_rgb = malloc(w * h * 3); image_data_rgb = malloc(w * h * 3);
// преобразуем изображение к формату rgb // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> rgb
(*img_to_rgb2)(image_data, image_data_rgb); (*img_to_rgb2)(image_data, image_data_rgb);
// удаляем временный буфер image_data // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> image_data
(*img_destroy)(image_data); (*img_destroy)(image_data);
free(filedata); free(filedata);

View File

@ -20,8 +20,8 @@
#define SCAN_CODE_ALTM 50 #define SCAN_CODE_ALTM 50
#define SCAN_CODE_ALTE 18 #define SCAN_CODE_ALTE 18
inline
uint32_t get_os_keyb_modifiers() static inline uint32_t get_os_keyb_modifiers()
{ {
register uint32_t val; register uint32_t val;
__asm__ __volatile__( __asm__ __volatile__(
@ -43,8 +43,7 @@ uint32_t get_os_keyb_modifiers()
#define KEY_LWIN 0x200 #define KEY_LWIN 0x200
#define KEY_RWIN 0x400 #define KEY_RWIN 0x400
inline static inline void set_os_keyb_mode(int mode)
void set_os_keyb_mode(int mode)
// 0 - ASCII, 1 - SCAN // 0 - ASCII, 1 - SCAN
{ {
__asm__ __volatile__( __asm__ __volatile__(

View File

@ -8,7 +8,7 @@ CLAYER:= $(abspath ../../)
LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds \ LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds \
--image-base 0 -lgcc -ldll -lc.dll --image-base 0 -lgcc -ldll -lc.dll
CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__ CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__ -std=c99
INCLUDES= -I. -I$(SDK_DIR)/sources/newlib/libc/include -I$(CLAYER)/INCLUDE INCLUDES= -I. -I$(SDK_DIR)/sources/newlib/libc/include -I$(CLAYER)/INCLUDE
LIBPATH:= -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib LIBPATH:= -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib
@ -29,4 +29,4 @@ $(NAME): $(OBJECTS) Makefile
$(CC) -c $(INCLUDES) $(CFLAGS) -o $@ $< $(CC) -c $(INCLUDES) $(CFLAGS) -o $@ $<
clean: clean:
-rm -f *.o -rm -f *.o $(NAME)

View File

@ -19,7 +19,7 @@ typedef struct {
} pict_button; } pict_button;
inline pict_button* kolibri_pict_button(pict_button* b, uint32_t x_w, uint32_t y_h, void* active_pict, void* passive_pict, void* pressed_pict, uint32_t bpp, void* palette, int32_t offset_line) static inline pict_button* kolibri_pict_button(pict_button* b, uint32_t x_w, uint32_t y_h, void* active_pict, void* passive_pict, void* pressed_pict, uint32_t bpp, void* palette, int32_t offset_line)
{ {
b->type = b->mouse_pos = b->mouse_keys = b->mouse_keys_old = b->select = b->click = 0; b->type = b->mouse_pos = b->mouse_keys = b->mouse_keys_old = b->select = b->click = 0;
b->x_w = x_w; b->x_w = x_w;
@ -34,13 +34,13 @@ inline pict_button* kolibri_pict_button(pict_button* b, uint32_t x_w, uint32_t y
return b; return b;
} }
inline pict_button* kolibri_new_pict_button(uint32_t x_w, uint32_t y_h, void* active_pict, void* passive_pict, void* pressed_pict, uint32_t bpp, void* palette, int32_t offset_line) static inline pict_button* kolibri_new_pict_button(uint32_t x_w, uint32_t y_h, void* active_pict, void* passive_pict, void* pressed_pict, uint32_t bpp, void* palette, int32_t offset_line)
{ {
pict_button *new_d_but = (pict_button *)malloc(sizeof(pict_button)); pict_button *new_d_but = (pict_button *)malloc(sizeof(pict_button));
return kolibri_pict_button(new_d_but, x_w, y_h, active_pict, passive_pict, pressed_pict, bpp, palette, offset_line); return kolibri_pict_button(new_d_but, x_w, y_h, active_pict, passive_pict, pressed_pict, bpp, palette, offset_line);
} }
inline void gui_add_pict_button(kolibri_window *wnd, pict_button* db) static inline void gui_add_pict_button(kolibri_window *wnd, pict_button* db)
{ {
kolibri_window_add_element(wnd, KOLIBRI_D_BUTTON, db); kolibri_window_add_element(wnd, KOLIBRI_D_BUTTON, db);
} }

View File

@ -98,7 +98,7 @@ typedef struct __attribute__ ((__packed__)) {
uint32_t y_h; // 45, 550 uint32_t y_h; // 45, 550
uint32_t icon_size_xy; // x_y (16, 16) uint32_t icon_size_xy; // x_y (16, 16)
uint16_t line_size_x; // not used uint16_t line_size_x; // not used
uint16_t line_size_y; // 18 or 17 - âûñîòà ëèíèè - ñòðîêè ñ ôàéëîì uint16_t line_size_y; // 18 or 17 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint16_t type_size_x; // not used uint16_t type_size_x; // not used
uint16_t size_size_x; // not used uint16_t size_size_x; // not used
uint16_t date_size_x; // not used uint16_t date_size_x; // not used
@ -116,9 +116,9 @@ typedef struct __attribute__ ((__packed__)) {
color_t text_color; // self explained color_t text_color; // self explained
color_t reduct_text_color; // 0xff0000 - spec color for cutted filenames color_t reduct_text_color; // 0xff0000 - spec color for cutted filenames
color_t marked_text_color; // not used color_t marked_text_color; // not used
uint32_t max_panel_line; // moved to scrollbar->cur_area, - ìàêñèìàëüíîå ÷èñëî ñòðîê â îêíå, àâòîðàñ÷èòûâàåòñÿ uint32_t max_panel_line; // moved to scrollbar->cur_area, - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint32_t select_panel_counter; // !=0 if want to draw multiselection ??? uint32_t select_panel_counter; // !=0 if want to draw multiselection ???
uint32_t folder_block; // auto formed, êîëè÷åñòâî áëîêîâ äàííûõ âõîäà êàòàëîãà (ÁÄÂÊ) ????? format BDVK == bdfe,, // moved to scrollbar->max_area uint32_t folder_block; // auto formed, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD>) ????? format BDVK == bdfe,, // moved to scrollbar->max_area
uint32_t start_draw_line; // internal - top showed file n. moved to scrollbar->position and back uint32_t start_draw_line; // internal - top showed file n. moved to scrollbar->position and back
uint16_t start_draw_cursor_line; //internal uint16_t start_draw_cursor_line; //internal
void* folder_data; // 32 byte - dir_header, +4 = number, +32 - bdvk[], size of rec(bdvk cp866) = 304byte void* folder_data; // 32 byte - dir_header, +4 = number, +32 - bdvk[], size of rec(bdvk cp866) = 304byte
@ -217,7 +217,7 @@ inline filebrowser* kolibri_filebrowser_def(filebrowser* fb, uint32_t x_w, uint3
} }
*/ */
inline void gui_add_filebrowser(kolibri_window *wnd, filebrowser* f) static inline void gui_add_filebrowser(kolibri_window *wnd, filebrowser* f)
{ {
kolibri_window_add_element(wnd, KOLIBRI_FILEBROWSE, f); kolibri_window_add_element(wnd, KOLIBRI_FILEBROWSE, f);
} }

View File

@ -37,7 +37,7 @@ typedef struct {
color_t font_bg_color; color_t font_bg_color;
}frame; }frame;
inline frame* kolibri_frame(frame* f, uint32_t x_w, uint32_t y_h, color_t ext_col, color_t int_col, char *text, enum fr_text_position_t text_position, static inline frame* kolibri_frame(frame* f, uint32_t x_w, uint32_t y_h, color_t ext_col, color_t int_col, char *text, enum fr_text_position_t text_position,
color_t font_color, color_t font_bgcolor, enum fr_flags_t flags) color_t font_color, color_t font_bgcolor, enum fr_flags_t flags)
{ {
f->type = 0; f->type = 0;
@ -58,24 +58,24 @@ inline frame* kolibri_frame(frame* f, uint32_t x_w, uint32_t y_h, color_t ext_co
return f; return f;
} }
inline frame* kolibri_new_frame(uint32_t x_w, uint32_t y_h, color_t ext_col, color_t int_col, char *text, enum fr_text_position_t text_position, static inline frame* kolibri_new_frame(uint32_t x_w, uint32_t y_h, color_t ext_col, color_t int_col, char *text, enum fr_text_position_t text_position,
color_t font_color, color_t font_bgcolor, enum fr_flags_t flags) color_t font_color, color_t font_bgcolor, enum fr_flags_t flags)
{ {
frame *new_frame = (frame *)malloc(sizeof(frame)); frame *new_frame = (frame *)malloc(sizeof(frame));
return kolibri_frame(new_frame, x_w, y_h, ext_col, int_col, text, text_position, font_color, font_bgcolor, flags); return kolibri_frame(new_frame, x_w, y_h, ext_col, int_col, text, text_position, font_color, font_bgcolor, flags);
} }
inline frame* kolibri_frame_def(frame* f, uint32_t x_w, uint32_t y_h, char *text) static inline frame* kolibri_frame_def(frame* f, uint32_t x_w, uint32_t y_h, char *text)
{ {
return kolibri_frame(f, x_w, y_h, 0x00FCFCFC, 0x00DCDCDC, text, FR_TOP, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, 0); return kolibri_frame(f, x_w, y_h, 0x00FCFCFC, 0x00DCDCDC, text, FR_TOP, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, 0);
} }
inline frame* kolibri_new_frame_def(uint32_t x_w, uint32_t y_h, char *text) static inline frame* kolibri_new_frame_def(uint32_t x_w, uint32_t y_h, char *text)
{ {
return kolibri_new_frame(x_w, y_h, 0x00FCFCFC, 0x00DCDCDC, text, FR_TOP, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, 0); return kolibri_new_frame(x_w, y_h, 0x00FCFCFC, 0x00DCDCDC, text, FR_TOP, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, 0);
} }
inline void gui_add_frame(kolibri_window *wnd, frame* f) static inline void gui_add_frame(kolibri_window *wnd, frame* f)
{ {
kolibri_window_add_element(wnd, KOLIBRI_FRAME, f); kolibri_window_add_element(wnd, KOLIBRI_FRAME, f);
} }

View File

@ -118,7 +118,8 @@ extern Image* (*img_resize_data)(Image *src, uint32_t width, uint32_t height)
extern Image* (*img_scale)(Image* src, uint32_t crop_x, uint32_t crop_y, uint32_t crop_width, uint32_t crop_height, Image* dst, uint32_t scale_type, uint32_t inter, uint32_t new_width, uint32_t new_height) _stdcall; extern Image* (*img_scale)(Image* src, uint32_t crop_x, uint32_t crop_y, uint32_t crop_width, uint32_t crop_height, Image* dst, uint32_t scale_type, uint32_t inter, uint32_t new_width, uint32_t new_height) _stdcall;
void img_fill_color(Image* img, uint32_t width, uint32_t height, uint32_t color) { void img_fill_color(Image* img, uint32_t width, uint32_t height, uint32_t color) {
for (uint32_t i = 0; i < width*height; i++) { uint32_t i;
for (i = 0; i < width*height; i++) {
img->Data[i] = color; img->Data[i] = color;
} }
} }

View File

@ -3,9 +3,9 @@
typedef struct typedef struct
{ {
uint32_t type; // 1 åñëè íåò ïîäìåíþ, ïðîñòî ïóíêò uint32_t type; // 1 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
uint32_t x_w; // âåðõíèé ïóíêò uint32_t x_w; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
uint32_t y_h; uint32_t y_h;
char* text_pointer; char* text_pointer;
@ -14,12 +14,12 @@ typedef struct
uint32_t mouse_pos; uint32_t mouse_pos;
uint32_t mouse_keys; uint32_t mouse_keys;
uint32_t x_w1; // ïîäìåíþ uint32_t x_w1; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint32_t y_h1; uint32_t y_h1;
color_t bckg_col; // ôîí âåðõíåãî ïóêòà color_t bckg_col; // <EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
color_t frnt_col; // ôîí âûáðàííîãî âåðõíåãî ïóíêòà color_t frnt_col; // <EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
color_t menu_col; // ôîí âûïàäàþùåé ÷àñòè (ïîäïóêòû) color_t menu_col; // <EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
uint32_t select; uint32_t select;
uint32_t out_select; uint32_t out_select;
char* buf_adress; char* buf_adress;
@ -30,9 +30,9 @@ typedef struct
uint32_t interval; uint32_t interval;
uint32_t cursor_max; uint32_t cursor_max;
uint32_t extended_key; uint32_t extended_key;
color_t menu_sel_col; // öâåò ôîíà âûáðàííîãî ïîäïóíêòà color_t menu_sel_col; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
color_t bckg_text_col; // öâåò øðèôòà íåâûáðàííîãî ïóíêòà color_t bckg_text_col; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
color_t frnt_text_col; // öâåò øðèôòà âûáðàííîãî ïóíêòà color_t frnt_text_col; // <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint32_t mouse_keys_old; uint32_t mouse_keys_old;
uint32_t font_height; uint32_t font_height;
uint32_t cursor_out; uint32_t cursor_out;
@ -79,28 +79,28 @@ static inline menubar* kolibri_menubar(menubar* bar, uint32_t x_w, uint32_t y_h,
return bar; return bar;
} }
inline menubar* kolibri_new_menubar(uint32_t x_w, uint32_t y_h, uint16_t sub_w, uint16_t sub_h, char **menutext, static inline menubar* kolibri_new_menubar(uint32_t x_w, uint32_t y_h, uint16_t sub_w, uint16_t sub_h, char **menutext,
color_t sel_font, color_t unsel_font, color_t top_bg, color_t top_select, color_t sub_bg, color_t sub_select) color_t sel_font, color_t unsel_font, color_t top_bg, color_t top_select, color_t sub_bg, color_t sub_select)
{ {
menubar *new_bar = (menubar*)malloc(sizeof(menubar)); menubar *new_bar = (menubar*)malloc(sizeof(menubar));
return kolibri_menubar(new_bar, x_w, y_h, sub_w, sub_h, menutext, sel_font, unsel_font, top_bg, top_select, sub_bg, sub_select); return kolibri_menubar(new_bar, x_w, y_h, sub_w, sub_h, menutext, sel_font, unsel_font, top_bg, top_select, sub_bg, sub_select);
} }
inline menubar* kolibri_menubar_def(menubar* bar, uint32_t x_w, uint32_t y_h, uint16_t sub_w, uint16_t sub_h, char **menutext) static inline menubar* kolibri_menubar_def(menubar* bar, uint32_t x_w, uint32_t y_h, uint16_t sub_w, uint16_t sub_h, char **menutext)
{ {
return kolibri_menubar(bar, x_w, y_h, sub_w, sub_h, menutext, return kolibri_menubar(bar, x_w, y_h, sub_w, sub_h, menutext,
kolibri_color_table.color_work_button_text, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, kolibri_color_table.color_work_button_text, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area,
kolibri_color_table.color_work_button, kolibri_color_table.color_grab_bar_button, kolibri_color_table.color_work_button); kolibri_color_table.color_work_button, kolibri_color_table.color_grab_bar_button, kolibri_color_table.color_work_button);
} }
inline menubar* kolibri_new_menubar_def(uint32_t x_w, uint32_t y_h, uint16_t sub_w, uint16_t sub_h, char **menutext) static inline menubar* kolibri_new_menubar_def(uint32_t x_w, uint32_t y_h, uint16_t sub_w, uint16_t sub_h, char **menutext)
{ {
return kolibri_new_menubar(x_w, y_h, sub_w, sub_h, menutext, return kolibri_new_menubar(x_w, y_h, sub_w, sub_h, menutext,
kolibri_color_table.color_work_button_text, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, kolibri_color_table.color_work_button_text, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area,
kolibri_color_table.color_work_button, kolibri_color_table.color_grab_bar_button, kolibri_color_table.color_work_button); kolibri_color_table.color_work_button, kolibri_color_table.color_grab_bar_button, kolibri_color_table.color_work_button);
} }
inline void gui_add_menubar(kolibri_window *wnd, menubar* bar) static inline void gui_add_menubar(kolibri_window *wnd, menubar* bar)
{ {
kolibri_window_add_element(wnd, KOLIBRI_MENU_BAR, bar); kolibri_window_add_element(wnd, KOLIBRI_MENU_BAR, bar);
} }

View File

@ -5,8 +5,8 @@ typedef struct __attribute__ ((__packed__)) option_box_t {
struct option_box_t **selected; struct option_box_t **selected;
uint16_t posx; uint16_t posx;
uint16_t posy; uint16_t posy;
uint32_t text_margin; // = 4 ðàññòîÿíèå îò ïðÿìîóãîëüíèêà ÷åê áîêñà äî íàäïèñè uint32_t text_margin; // = 4 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint32_t size; // 12 ðàçìåð êâàäðàòà ÷åê áîêñà uint32_t size; // 12 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
color_t color; color_t color;
color_t border_color; // individual border color_t border_color; // individual border
color_t text_color; color_t text_color;
@ -18,7 +18,7 @@ typedef struct __attribute__ ((__packed__)) option_box_t {
extern void (*option_box_draw)(option_box **) __attribute__((__stdcall__)); extern void (*option_box_draw)(option_box **) __attribute__((__stdcall__));
extern void (*option_box_mouse)(option_box **)__attribute__((__stdcall__)); extern void (*option_box_mouse)(option_box **)__attribute__((__stdcall__));
inline option_box* gui_optionbox(option_box* ob, uint32_t x_y, char* text, option_box**select) static inline option_box* gui_optionbox(option_box* ob, uint32_t x_y, char* text, option_box**select)
{ {
ob->selected = select; ob->selected = select;
ob->posx = x_y >> 16; ob->posx = x_y >> 16;
@ -35,7 +35,7 @@ inline option_box* gui_optionbox(option_box* ob, uint32_t x_y, char* text, optio
return ob; return ob;
} }
inline option_box* gui_new_optionbox(uint32_t x_y, char* text, option_box**select) static inline option_box* gui_new_optionbox(uint32_t x_y, char* text, option_box**select)
{ {
option_box* ob = malloc(sizeof(option_box)); option_box* ob = malloc(sizeof(option_box));
@ -46,7 +46,7 @@ inline option_box* gui_new_optionbox(uint32_t x_y, char* text, option_box**selec
#define gui_new_optionbox_def(a,b,c) gui_new_optionbox(a,b,c) #define gui_new_optionbox_def(a,b,c) gui_new_optionbox(a,b,c)
inline void gui_add_optiongroup(kolibri_window *wnd, option_box** option_group) static inline void gui_add_optiongroup(kolibri_window *wnd, option_box** option_group)
{ {
kolibri_window_add_element(wnd, KOLIBRI_OPTIONGROUP, option_group); kolibri_window_add_element(wnd, KOLIBRI_OPTIONGROUP, option_group);
} }

View File

@ -17,7 +17,7 @@ typedef struct __attribute__ ((__packed__)) {
inline pathview* kolibri_pathview(pathview* p, uint32_t x_y, uint32_t width, uint32_t font_number, uint32_t is_bkgr, char* text, char* temp_buf, color_t font, color_t bkgr) static inline pathview* kolibri_pathview(pathview* p, uint32_t x_y, uint32_t width, uint32_t font_number, uint32_t is_bkgr, char* text, char* temp_buf, color_t font, color_t bkgr)
{ {
p->type = p->temp_text_length = 0; p->type = p->temp_text_length = 0;
p->x_y = x_y; p->x_y = x_y;
@ -33,13 +33,13 @@ inline pathview* kolibri_pathview(pathview* p, uint32_t x_y, uint32_t width, uin
return p; return p;
} }
inline pathview* kolibri_new_pathview(pathview* p, uint32_t x_y, uint32_t width, uint32_t font_number, uint32_t is_bkgr, char* text, char* temp_buf, color_t font, color_t bkgr) static inline pathview* kolibri_new_pathview(pathview* p, uint32_t x_y, uint32_t width, uint32_t font_number, uint32_t is_bkgr, char* text, char* temp_buf, color_t font, color_t bkgr)
{ {
pathview *new_pv = (pathview *)malloc(sizeof(pathview)); pathview *new_pv = (pathview *)malloc(sizeof(pathview));
return kolibri_pathview(new_pv, x_y, width, font_number, is_bkgr, text, temp_buf, font, bkgr); return kolibri_pathview(new_pv, x_y, width, font_number, is_bkgr, text, temp_buf, font, bkgr);
} }
inline void gui_add_pathview(kolibri_window *wnd, pathview* pv) static inline void gui_add_pathview(kolibri_window *wnd, pathview* pv)
{ {
kolibri_window_add_element(wnd, KOLIBRI_PATHSHOW, pv); kolibri_window_add_element(wnd, KOLIBRI_PATHSHOW, pv);
} }

View File

@ -33,7 +33,7 @@ typedef struct __attribute__ ((__packed__)) {
uint32_t ar_offset; uint32_t ar_offset;
} scrollbar; } scrollbar;
inline scrollbar* kolibri_scrollbar(scrollbar* sb, uint32_t x_w, uint32_t y_h, uint32_t btn_height, uint32_t max_area, static inline scrollbar* kolibri_scrollbar(scrollbar* sb, uint32_t x_w, uint32_t y_h, uint32_t btn_height, uint32_t max_area,
uint32_t cur_area, uint32_t position, uint32_t back_color, uint32_t front_color, uint32_t line_color) uint32_t cur_area, uint32_t position, uint32_t back_color, uint32_t front_color, uint32_t line_color)
{ {
memset(sb, 0, sizeof(scrollbar)); memset(sb, 0, sizeof(scrollbar));
@ -53,7 +53,7 @@ inline scrollbar* kolibri_scrollbar(scrollbar* sb, uint32_t x_w, uint32_t y_h, u
return sb; return sb;
}; };
inline scrollbar* kolibri_new_scrollbar(uint32_t x_w, uint32_t y_h, uint32_t btn_height, uint32_t max_area, static inline scrollbar* kolibri_new_scrollbar(uint32_t x_w, uint32_t y_h, uint32_t btn_height, uint32_t max_area,
uint32_t cur_area, uint32_t position, uint32_t back_color, uint32_t front_color, uint32_t line_color) uint32_t cur_area, uint32_t position, uint32_t back_color, uint32_t front_color, uint32_t line_color)
{ {
scrollbar *sb = (scrollbar *)malloc(sizeof(scrollbar)); scrollbar *sb = (scrollbar *)malloc(sizeof(scrollbar));
@ -61,22 +61,22 @@ inline scrollbar* kolibri_new_scrollbar(uint32_t x_w, uint32_t y_h, uint32_t btn
return kolibri_scrollbar(sb, x_w, y_h, btn_height, max_area, cur_area, position, back_color, front_color, line_color); return kolibri_scrollbar(sb, x_w, y_h, btn_height, max_area, cur_area, position, back_color, front_color, line_color);
}; };
inline scrollbar* kolibri_scrollbar_def(scrollbar* sb, uint32_t x_w, uint32_t y_h, uint32_t max_area, uint32_t cur_area, uint32_t position) static inline scrollbar* kolibri_scrollbar_def(scrollbar* sb, uint32_t x_w, uint32_t y_h, uint32_t max_area, uint32_t cur_area, uint32_t position)
{ {
return kolibri_scrollbar(sb, x_w, y_h, 15, max_area, cur_area, position, kolibri_color_table.color_work_area, kolibri_color_table.color_work_button, kolibri_color_table.color_work_button_text); return kolibri_scrollbar(sb, x_w, y_h, 15, max_area, cur_area, position, kolibri_color_table.color_work_area, kolibri_color_table.color_work_button, kolibri_color_table.color_work_button_text);
}; };
inline scrollbar* kolibri_new_scrollbar_def(uint32_t x_w, uint32_t y_h, uint32_t max_area, uint32_t cur_area, uint32_t position) static inline scrollbar* kolibri_new_scrollbar_def(uint32_t x_w, uint32_t y_h, uint32_t max_area, uint32_t cur_area, uint32_t position)
{ {
return kolibri_new_scrollbar(x_w, y_h, 15, max_area, cur_area, position, kolibri_color_table.color_work_area, kolibri_color_table.color_work_button, kolibri_color_table.color_work_button_text); return kolibri_new_scrollbar(x_w, y_h, 15, max_area, cur_area, position, kolibri_color_table.color_work_area, kolibri_color_table.color_work_button, kolibri_color_table.color_work_button_text);
}; };
inline void gui_add_scrollbar_h(kolibri_window *wnd, scrollbar* sb) static inline void gui_add_scrollbar_h(kolibri_window *wnd, scrollbar* sb)
{ {
kolibri_window_add_element(wnd, KOLIBRI_SCROLL_BAR_H, sb); kolibri_window_add_element(wnd, KOLIBRI_SCROLL_BAR_H, sb);
} }
inline void gui_add_scrollbar_v(kolibri_window *wnd, scrollbar* sb) static inline void gui_add_scrollbar_v(kolibri_window *wnd, scrollbar* sb)
{ {
kolibri_window_add_element(wnd, KOLIBRI_SCROLL_BAR_V, sb); kolibri_window_add_element(wnd, KOLIBRI_SCROLL_BAR_V, sb);
} }

View File

@ -66,7 +66,7 @@ void statictext_draw(statictext *st)
:); :);
} }
inline void gui_add_statictext(kolibri_window *wnd, statictext* st) static inline void gui_add_statictext(kolibri_window *wnd, statictext* st)
{ {
kolibri_window_add_element(wnd, KOLIBRI_STATICTEXT, st); kolibri_window_add_element(wnd, KOLIBRI_STATICTEXT, st);
} }
@ -104,7 +104,7 @@ staticnum* kolibri_new_staticnum_def(uint32_t xy, int32_t width, int32_t number)
return kolibri_new_staticnum(xy, width, number, cp866, 0, kolibri_color_table.color_work_text, 0); return kolibri_new_staticnum(xy, width, number, cp866, 0, kolibri_color_table.color_work_text, 0);
} }
inline void gui_add_staticnum(kolibri_window *wnd, staticnum* sn) static inline void gui_add_staticnum(kolibri_window *wnd, staticnum* sn)
{ {
kolibri_window_add_element(wnd, KOLIBRI_STATICNUM, sn); kolibri_window_add_element(wnd, KOLIBRI_STATICNUM, sn);
} }