From 8eb81c39682604c97f4506c39503b646ebb8e539 Mon Sep 17 00:00:00 2001 From: siemargl Date: Tue, 27 Sep 2016 09:47:30 +0000 Subject: [PATCH] fix pusha, use gcc5.4, filebrowser initial git-svn-id: svn://kolibrios.org@6535 a494cfbc-eb01-0410-851d-a64ba20cac60 --- contrib/C_Layer/ASM/loadboxlib.asm | 12 +- contrib/C_Layer/ASM/loadbuf2d.asm | 2 + contrib/C_Layer/ASM/loadhttp.asm | 2 + contrib/C_Layer/ASM/loadkmenu.asm | 2 + contrib/C_Layer/ASM/loadlibimg.asm | 2 + contrib/C_Layer/ASM/loadlibini.asm | 2 + contrib/C_Layer/ASM/loadproclib.asm | 2 + contrib/C_Layer/ASM/loadrasterworks.asm | 2 + .../C_Layer/EXAMPLE/libguic_kolibri/Makefile | 8 +- .../EXAMPLE/libguic_kolibri/Makefile482 | 46 +++++++ .../EXAMPLE/libguic_kolibri/dbutton_files.c | 4 +- contrib/C_Layer/INCLUDE/kolibri_debug.h | 2 +- contrib/C_Layer/INCLUDE/kolibri_filebrowse.h | 130 ++++++++++++++++++ contrib/C_Layer/INCLUDE/kolibri_menubar.h | 2 +- 14 files changed, 207 insertions(+), 11 deletions(-) create mode 100644 contrib/C_Layer/EXAMPLE/libguic_kolibri/Makefile482 create mode 100644 contrib/C_Layer/INCLUDE/kolibri_filebrowse.h diff --git a/contrib/C_Layer/ASM/loadboxlib.asm b/contrib/C_Layer/ASM/loadboxlib.asm index 875216e43f..099349ced8 100644 --- a/contrib/C_Layer/ASM/loadboxlib.asm +++ b/contrib/C_Layer/ASM/loadboxlib.asm @@ -17,8 +17,10 @@ public press_key as '_press_key' ;;; Returns 0 on success. -1 on failure. proc init_boxlib + pusha mcall 68,11 stdcall dll.Load, @IMPORT + popa ret endp @@ -58,9 +60,9 @@ import lib_boxlib, \ menu_bar_draw, 'menu_bar_draw' , \ menu_bar_mouse, 'menu_bar_mouse' , \ menu_bar_activate, 'menu_bar_activate' , \ - fb_draw_panel, 'filebrowser_draw' , \ - fb_mouse, 'filebrowser_mouse' , \ - fb_key, 'filebrowser_key' , \ + fb_draw_panel, 'FileBrowser_draw' , \ + fb_mouse, 'FileBrowser_mouse' , \ + fb_key, 'FileBrowser_key' , \ tl_data_init, 'tl_data_init' , \ tl_data_clear, 'tl_data_clear' , \ tl_info_clear, 'tl_info_clear' , \ @@ -150,3 +152,7 @@ public dynamic_button_mouse as '_dynamic_button_mouse' public path_show_prepare as '_path_show_prepare' public path_show_draw as '_path_show_draw' + +public fb_draw_panel as '_filebrowse_draw' +public fb_mouse as '_filebrowse_mouse' +public fb_key as '_filebrowse_key' diff --git a/contrib/C_Layer/ASM/loadbuf2d.asm b/contrib/C_Layer/ASM/loadbuf2d.asm index 54674a4181..eb4ee799f6 100644 --- a/contrib/C_Layer/ASM/loadbuf2d.asm +++ b/contrib/C_Layer/ASM/loadbuf2d.asm @@ -14,8 +14,10 @@ public init_buf2d as '_kolibri_buf2d_init' ;;; Returns 0 on success. -1 on failure. proc init_buf2d + pusha mcall 68,11 stdcall dll.Load, @IMPORT + popa ret endp diff --git a/contrib/C_Layer/ASM/loadhttp.asm b/contrib/C_Layer/ASM/loadhttp.asm index 762441db55..7c4b0c8205 100644 --- a/contrib/C_Layer/ASM/loadhttp.asm +++ b/contrib/C_Layer/ASM/loadhttp.asm @@ -21,8 +21,10 @@ public init_network as '_kolibri_http_init' ;;; Returns 0 on success. -1 on failure. proc init_network + pusha mcall 68,11 stdcall dll.Load, @IMPORT + popa ret endp diff --git a/contrib/C_Layer/ASM/loadkmenu.asm b/contrib/C_Layer/ASM/loadkmenu.asm index cbbd544729..bd021a7269 100644 --- a/contrib/C_Layer/ASM/loadkmenu.asm +++ b/contrib/C_Layer/ASM/loadkmenu.asm @@ -13,8 +13,10 @@ public init_kmenu as '_kolibri_kmenu_init' ;;; Returns 0 on success. -1 on failure. proc init_kmenu + pusha mcall 68,11 stdcall dll.Load, @IMPORT + popa ret endp diff --git a/contrib/C_Layer/ASM/loadlibimg.asm b/contrib/C_Layer/ASM/loadlibimg.asm index 9400d66641..8a707cf67b 100644 --- a/contrib/C_Layer/ASM/loadlibimg.asm +++ b/contrib/C_Layer/ASM/loadlibimg.asm @@ -14,8 +14,10 @@ public init_libimg as '_kolibri_libimg_init' ;;; Returns 0 on success. -1 on failure. proc init_libimg + pusha mcall 68,11 stdcall dll.Load, @IMPORT + popa ret endp diff --git a/contrib/C_Layer/ASM/loadlibini.asm b/contrib/C_Layer/ASM/loadlibini.asm index 14421efc22..c5939fe96b 100644 --- a/contrib/C_Layer/ASM/loadlibini.asm +++ b/contrib/C_Layer/ASM/loadlibini.asm @@ -15,8 +15,10 @@ public init_libini as '_kolibri_libini_init' ;;; Returns 0 on success. -1 on failure. proc init_libini + pusha mcall 68,11 stdcall dll.Load, @IMPORT + popa ret endp diff --git a/contrib/C_Layer/ASM/loadproclib.asm b/contrib/C_Layer/ASM/loadproclib.asm index cb1340055a..cbc6ad9826 100644 --- a/contrib/C_Layer/ASM/loadproclib.asm +++ b/contrib/C_Layer/ASM/loadproclib.asm @@ -14,8 +14,10 @@ public init_proclib as '_kolibri_proclib_init' ;;; Returns 0 on success. -1 on failure. proc init_proclib + pusha mcall 68,11 stdcall dll.Load, @IMPORT + popa ret endp diff --git a/contrib/C_Layer/ASM/loadrasterworks.asm b/contrib/C_Layer/ASM/loadrasterworks.asm index 18b0da9916..d7489673cd 100644 --- a/contrib/C_Layer/ASM/loadrasterworks.asm +++ b/contrib/C_Layer/ASM/loadrasterworks.asm @@ -15,8 +15,10 @@ public init_rasterworks as '_kolibri_rasterworks_init' ;;; Returns 0 on success. -1 on failure. proc init_rasterworks + pusha mcall 68,11 stdcall dll.Load, @IMPORT + popa ret endp diff --git a/contrib/C_Layer/EXAMPLE/libguic_kolibri/Makefile b/contrib/C_Layer/EXAMPLE/libguic_kolibri/Makefile index 015ffca4e5..58cbb60161 100644 --- a/contrib/C_Layer/EXAMPLE/libguic_kolibri/Makefile +++ b/contrib/C_Layer/EXAMPLE/libguic_kolibri/Makefile @@ -5,13 +5,13 @@ LD = kos32-ld SDK_DIR:= $(abspath ../../../sdk) CLAYER:= $(abspath ../../) -LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds \ - --image-base 0 -lgcc -ldll -lc.dll -lapp +LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/lib/app-dynamic.lds \ + --image-base 0 -lgcc -ldll -lc.dll -CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__ +CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__ -std=gnu90 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 OBJPATH = $(CLAYER)/OBJ diff --git a/contrib/C_Layer/EXAMPLE/libguic_kolibri/Makefile482 b/contrib/C_Layer/EXAMPLE/libguic_kolibri/Makefile482 new file mode 100644 index 0000000000..35df843f0a --- /dev/null +++ b/contrib/C_Layer/EXAMPLE/libguic_kolibri/Makefile482 @@ -0,0 +1,46 @@ +NAME=boardmsg +CC = kos32-gcc +LD = kos32-ld + +SDK_DIR:= $(abspath ../../../sdk) +CLAYER:= $(abspath ../../) + +LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds \ + --image-base 0 -lgcc -ldll -lc.dll + +CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__ + +INCLUDES= -I. -I$(SDK_DIR)/sources/newlib/libc/include -I$(CLAYER)/INCLUDE +LIBPATH:= -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib + +OBJPATH = $(CLAYER)/OBJ + +SOURCES = boardmsg.c option_menu.c + +OBJECTS = $(patsubst %.c, %.o, $(SOURCES)) + +all: boardmsg option_menu scroll_progress dbutton_files + +scroll_progress: scroll_progress.o +# $(LD) $(LIBPATH) --subsystem native -o $@ $^ $(OBJPATH)/loadboxlib.obj $(LDFLAGS) + $(LD) $(LIBPATH) --subsystem windows -o $@ $^ $(OBJPATH)/loadboxlib.obj $(LDFLAGS) + kos32-objcopy $@ -O binary + + +option_menu: option_menu.o + $(LD) $(LIBPATH) --subsystem native -o $@ $^ $(OBJPATH)/loadboxlib.obj $(LDFLAGS) + kos32-objcopy $@ -O binary + +boardmsg: boardmsg.o + $(LD) $(LIBPATH) --subsystem native -o $@ $^ $(OBJPATH)/loadboxlib.obj $(LDFLAGS) + kos32-objcopy $@ -O binary + +dbutton_files: dbutton_files.o + $(LD) $(LIBPATH) --subsystem native -o $@ $^ $(OBJPATH)/loadboxlib.obj $(OBJPATH)/loadproclib.obj $(OBJPATH)/loadlibimg.obj $(LDFLAGS) -Map=dbutton_files.map + kos32-objcopy $@ -O binary + +%.o : %.c Makefile + $(CC) -c $(INCLUDES) $(CFLAGS) -o $@ $< + +clean: + -rm -f *.o diff --git a/contrib/C_Layer/EXAMPLE/libguic_kolibri/dbutton_files.c b/contrib/C_Layer/EXAMPLE/libguic_kolibri/dbutton_files.c index 308e35b969..6d759dec95 100644 --- a/contrib/C_Layer/EXAMPLE/libguic_kolibri/dbutton_files.c +++ b/contrib/C_Layer/EXAMPLE/libguic_kolibri/dbutton_files.c @@ -22,7 +22,7 @@ #include "kolibri_libimg.h" char temp_path[4096]; -char** sys_path = (char**)0x20; // hack - get path from KOS header +char** sys_path = (char**)0x20; // hack - get path from KOS header. analog argv[0] int main(int argc, char **argv) { @@ -48,7 +48,7 @@ int main(int argc, char **argv) *image_data, *pc; // make full path + argv strcpy(temp_path, *sys_path); - pc = strrchr(temp_path, '/'); + pc = strrchr(temp_path, '/'); // this fails if has params with '/' within. use argv[0] instead if (pc) pc[1] = 0; strcat(temp_path, "reload_16x16_8b.png"); debug_board_write_str(temp_path); diff --git a/contrib/C_Layer/INCLUDE/kolibri_debug.h b/contrib/C_Layer/INCLUDE/kolibri_debug.h index 0e254fd826..1bee8c378b 100644 --- a/contrib/C_Layer/INCLUDE/kolibri_debug.h +++ b/contrib/C_Layer/INCLUDE/kolibri_debug.h @@ -26,7 +26,7 @@ void debug_board_printf(const char *format,...) { va_list ap; char log_board[300]; - + va_start (ap, format); vsprintf(log_board, format, ap); va_end(ap); diff --git a/contrib/C_Layer/INCLUDE/kolibri_filebrowse.h b/contrib/C_Layer/INCLUDE/kolibri_filebrowse.h new file mode 100644 index 0000000000..873134db9c --- /dev/null +++ b/contrib/C_Layer/INCLUDE/kolibri_filebrowse.h @@ -0,0 +1,130 @@ +#ifndef KOLIBRI_FILEBROWSE_H +#define KOLIBRI_FILEBROWSE_H + +typedef struct { + uint32_t type; + uint32_t x_w; // 10, 400 + uint32_t y_h; // 45, 550 + uint32_t icon_size_xy; // x_y (16, 16) + uint16_t line_size_x; + uint16_t line_size_y; // 18 or 17 - высота линии + uint16_t type_size_x; + uint16_t size_size_x; + uint16_t date_size_x; + uint16_t attributes_size_x; + uint32_t icon_assoc_area; + uint32_t icon_raw_area; // z_icons.png + uint32_t icon_resolution_raw; // ... + uint32_t palette_raw; // ... + uint32_t directory_path_area; + uint32_t file_name_area; + uint32_t select_flag; + color_t background_color; // 0xffffff + color_t select_color; // 0xbbddff + color_t select_text_color; + color_t text_color; + color_t reduct_text_color; // 0xff0000 + color_t marked_text_color; + uint32_t max_panel_line; // // moved to scrollbar->cur_area, - максимальное число строк в окне + uint32_t select_panel_counter; // 1 if focused + uint32_t folder_block; // количество блоков данных входа каталога (БДВК) ????? format BDVK == bdfe,, // moved to scrollbar->max_area + uint32_t start_draw_line; // moved to scrollbar->position and back + uint16_t start_draw_cursor_line; + void* folder_data; // ??? format 32 byte - header, +4 = number, +32 - bdvk[], size of rec(bdvk cp866) = 304byte + uint32_t temp_counter; + uint32_t file_name_length; + uint32_t marked_file; + uint32_t extension_size; + uint32_t extension_start; + void* type_table; //dd features_table ; +122 ? table format + char* ini_file_start; // icons.ini + char* ini_file_end; // start + filesize + uint32_t draw_scroll_bar; // 1 = need redraw sb after key() + uint32_t font_size_xy; // x_y (6, 9) + uint32_t mouse_keys; + uint32_t mouse_keys_old; + uint32_t mouse_pos; + uint32_t mouse_keys_delta; + uint32_t mouse_key_delay; // 50 + uint32_t mouse_keys_tick; + uint16_t start_draw_cursor_line_2; + uint32_t all_redraw; // 1 - force draw, 2 - ???? + uint32_t selected_BDVK_adress; + uint16_t key_action; // fill before key(), 1..12, wiki + uint16_t key_action_num; // fill before key() fn2 >> 8 + char* name_temp_area dd name_temp_area ;+180 + uint32_t max_name_temp_size; + uint32_t display_name_max_length; + uint32_t draw_panel_selection_flag; + uint32_t mouse_pos_old; + uint32_t marked_counter; + char* keymap_pointer dd keymap_area ;+204 + + +} file_browser; +/* +features_table: +.type_table: + db ' ' +;--------------------------------------------------------------------- +.size_table: + db '1023b ' +;--------------------------------------------------------------------- +.date_table: + db '00.00.00 00:00 ' +;--------------------------------------------------------------------- +.year_table: + db ' ' + +name_temp_area: + rb 256 + +keymap_area: + rb 128 + +inline frame* kolibri_filebrowser(frame* f, uint32_t x_w, uint32_t y_h, color_t ext_col, color_t int_col, char *text, uint32_t text_position, color_t font_color, color_t font_bgcolor) +{ + f->type = 0; + f->x_w = x_w; + f->y_h = y_h; + f->ext_col = ext_col; + f->int_col = int_col; + f->draw_text_flag = text != NULL; + f->text_pointer = text; + f->text_position = text_position; + f->font_number = 0; // 0 == font 6x9, 1==8x16 + f->font_size_y = 9; + f->font_color = font_color | 0x80000000; + f->font_bg_color = font_bgcolor; + + 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, uint32_t text_position, color_t font_color, color_t font_bgcolor) +{ + 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); +} + +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, TOP, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area); +} + +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, TOP, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area); +} + +inline void gui_add_frame(kolibri_window *wnd, frame* f) +{ + kolibri_window_add_element(wnd, KOLIBRI_FRAME, f); +} + +FileBrowser_draw - рисование элемента +FileBrowser_mouse - эта функция должна вызываться при вводе информации с мыши +FileBrowser_key + +extern void (*frame_draw)(frame *) __attribute__((__stdcall__)); +/* +#endif /* KOLIBRI_FILEBROWSE_H */ diff --git a/contrib/C_Layer/INCLUDE/kolibri_menubar.h b/contrib/C_Layer/INCLUDE/kolibri_menubar.h index 4923f0a125..616e01414d 100644 --- a/contrib/C_Layer/INCLUDE/kolibri_menubar.h +++ b/contrib/C_Layer/INCLUDE/kolibri_menubar.h @@ -40,7 +40,7 @@ typedef struct } menubar; -inline menubar* kolibri_menubar(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(menubar* bar, 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) { static char procinfo[1024];