Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Ignore whitespace Rev 6455 → Rev 6456

/contrib/C_Layer/libguic_kolibri/README
File deleted
/contrib/C_Layer/libguic_kolibri/loadboxlib.asm
File deleted
/contrib/C_Layer/libguic_kolibri/kolibri_editbox.h
File deleted
/contrib/C_Layer/libguic_kolibri/kolibri_colors.h
File deleted
/contrib/C_Layer/libguic_kolibri/make_boardmsg.sh
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:executable
-*
\ No newline at end of property
/contrib/C_Layer/libguic_kolibri/kolibri_button.h
File deleted
/contrib/C_Layer/libguic_kolibri/quirks
File deleted
/contrib/C_Layer/libguic_kolibri/boardmsg.c
File deleted
/contrib/C_Layer/libguic_kolibri/kolibri_boxlib.h
File deleted
/contrib/C_Layer/libguic_kolibri/kolibri_gui_elements.h
File deleted
/contrib/C_Layer/libguic_kolibri/kolwin.c
File deleted
/contrib/C_Layer/libguic_kolibri/kolibri_gui.h
File deleted
/contrib/C_Layer/libguic_kolibri/kolibri_debug.h
File deleted
/contrib/C_Layer/libguic_kolibri/kolibri_checkbox.h
File deleted
/contrib/C_Layer/libguic_kolibri/kolibri_progressbar.h
File deleted
/contrib/C_Layer/libguic_kolibri/kolibri_frame.h
File deleted
/contrib/C_Layer/libguic_kolibri/make_boardmsg
File deleted
/contrib/C_Layer/libimg/loadlibimg.asm
File deleted
/contrib/C_Layer/libimg/kolibri_libimg.h
File deleted
/contrib/C_Layer/kmenu/loadkmenu.asm
File deleted
/contrib/C_Layer/kmenu/kolibri_kmenu.h
File deleted
/contrib/C_Layer/libini/kolibri_libini.h
File deleted
/contrib/C_Layer/libini/loadlibini.asm
File deleted
/contrib/C_Layer/http_lib/loadhttp.asm
File deleted
/contrib/C_Layer/buf2d/kolibri_buf2d.h
File deleted
/contrib/C_Layer/buf2d/loadbuf2d.asm
File deleted
/contrib/C_Layer/proc_lib/kolibri_opendialog.h
File deleted
/contrib/C_Layer/proc_lib/loadproclib.asm
File deleted
/contrib/C_Layer/proc_lib/kolibri_proclib.h
File deleted
/contrib/C_Layer/proc_lib/kolibri_colordialog.h
File deleted
/contrib/C_Layer/ASM/Makefile
0,0 → 1,7
 
FASM = fasm
 
all: $(patsubst %.asm,%.obj,$(wildcard *.asm))
mv $^ ../OBJ/
%.obj: %.asm
$(FASM) $< $%
/contrib/C_Layer/ASM/loadboxlib.asm
0,0 → 1,141
format coff
use32 ; Tell compiler to use 32 bit instructions
 
section '.init' code ; Keep this line before includes or GCC messes up call addresses
 
include '../../../programs/proc32.inc'
include '../../../programs/macros.inc'
purge section,mov,add,sub
include '../../../programs/develop/libraries/box_lib/trunk/box_lib.mac'
include '../../../programs/system/run/trunk/txtbut.inc'
include '../../../programs/dll.inc'
public init_boxlib as '_init_boxlib_asm'
public editbox_key as '_editbox_key@4'
public press_key as '_press_key'
;;; Returns 0 on success. -1 on failure.
 
proc init_boxlib
mcall 68,11
stdcall dll.Load, @IMPORT
test eax, eax
jnz error
mov eax, 0
ret
error:
mov eax, -1
ret
endp
;; Wrapper to handle edit_box_key function for editboxes.
;; Call this baby from C (refer kolibri_editbox.h for details)
editbox_key:
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 ?
 
@IMPORT:
library lib_boxlib, 'box_lib.obj'
 
import lib_boxlib, \
edit_box_draw, 'edit_box' , \
edit_box_key, 'edit_box_key' , \
edit_box_mouse, 'edit_box_mouse', \
edit_box_set_text, 'edit_box_set_text' , \
init_checkbox2, 'init_checkbox2' , \
check_box_draw2, 'check_box_draw2' , \
check_box_mouse2, 'check_box_mouse2' , \
option_box_draw, 'option_box_draw' , \
option_box_mouse, 'option_box_mouse' , \
scroll_bar_vertical_draw, 'scrollbar_ver_draw' , \
scroll_bar_vertical_mouse, 'scrollbar_ver_mouse' , \
scroll_bar_horizontal_draw, 'scrollbar_hor_draw' , \
scroll_bar_horizontal_mouse, 'scrollbar_hor_mouse' , \
dinamic_button_draw, 'dbutton_draw' , \
dinamic_button_mouse, 'dbutton_mouse' , \
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' , \
tl_data_init, 'tl_data_init' , \
tl_data_clear, 'tl_data_clear' , \
tl_info_clear, 'tl_info_clear' , \
tl_key, 'tl_key' , \
tl_mouse, 'tl_mouse' , \
tl_draw, 'tl_draw' , \
tl_info_undo, 'tl_info_undo' , \
tl_info_redo, 'tl_info_redo' , \
tl_node_add, 'tl_node_add' , \
tl_node_set_data, 'tl_node_set_data' , \
tl_node_get_data, 'tl_node_get_data' , \
tl_node_delete, 'tl_node_delete' , \
tl_cur_beg, 'tl_cur_beg' , \
tl_cur_next, 'tl_cur_next' , \
tl_cur_perv, 'tl_cur_perv' , \
tl_node_close_open, 'tl_node_close_open' , \
tl_node_lev_inc, 'tl_node_lev_inc' , \
tl_node_lev_dec, 'tl_node_lev_dec' , \
tl_node_move_up, 'tl_node_move_up' , \
tl_node_move_down, 'tl_node_move_down' , \
tl_node_poi_get_info, 'tl_node_poi_get_info' , \
tl_node_poi_get_next_info, 'tl_node_poi_get_next_info' , \
tl_node_poi_get_data, 'tl_node_poi_get_data' , \
tl_save_mem, 'tl_save_mem' , \
tl_load_mem, 'tl_load_mem' , \
tl_get_mem_size, 'tl_get_mem_size' , \
path_show_prepare, 'pathshow_prepare' , \
path_show_draw, 'pathshow_draw' , \
ted_but_sumb_upper, 'ted_but_sumb_upper' , \
ted_but_sumb_lover, 'ted_but_sumb_lover' , \
ted_but_convert_by_table, 'ted_but_convert_by_table' , \
ted_can_save, 'ted_can_save' , \
ted_clear, 'ted_clear' , \
ted_delete, 'ted_delete' , \
ted_draw, 'ted_draw' , \
ted_init, 'ted_init' , \
ted_init_scroll_bars, 'ted_init_scroll_bars' , \
ted_init_syntax_file, 'ted_init_syntax_file' , \
ted_is_select, 'ted_is_select' , \
ted_key, 'ted_key' , \
ted_mouse, 'ted_mouse' , \
ted_open_file, 'ted_open_file' , \
ted_save_file, 'ted_save_file' , \
ted_text_add, 'ted_text_add' , \
ted_but_select_word, 'ted_but_select_word' , \
ted_but_cut, 'ted_but_cut' , \
ted_but_copy, 'ted_but_copy' , \
ted_but_paste, 'ted_but_paste' , \
ted_but_undo, 'ted_but_undo' , \
ted_but_redo, 'ted_but_redo' , \
ted_but_reverse, 'ted_but_reverse' , \
ted_but_find_next, 'ted_but_find_next' , \
ted_text_colored, 'ted_text_colored' , \
frame_draw, 'frame_draw' , \
progressbar_draw,'progressbar_draw' , \
progressbar_progress, 'progressbar_progress'
public edit_box_draw as '_edit_box_draw'
public edit_box_key as '_edit_box_key'
public edit_box_mouse as '_edit_box_mouse'
 
public check_box_draw2 as '_check_box_draw2'
public check_box_mouse2 as '_check_box_mouse2'
 
public progressbar_draw as '_progressbar_draw'
public progressbar_progress as '_progressbar_progress'
 
public frame_draw as '_frame_draw'
/contrib/C_Layer/ASM/loadbuf2d.asm
0,0 → 1,94
 
format coff
use32 ; Tell compiler to use 32 bit instructions
 
section '.init' code ; Keep this line before includes or GCC messes up call addresses
 
include '../../../programs/proc32.inc'
include '../../../programs/macros.inc'
purge section,mov,add,sub
include '../../../programs/dll.inc'
public init_buf2d as '_init_buf2d_asm'
;;; Returns 0 on success. -1 on failure.
 
proc init_buf2d
mcall 68,11
stdcall dll.Load, @IMPORT
test eax, eax
jnz error
mov eax, 0
ret
error:
mov eax, -1
ret
endp
 
@IMPORT:
library lib_buf2d, 'buf2d.obj'
 
import lib_buf2d, \
buf2d_create, 'buf2d_create' , \
buf2d_clear, 'buf2d_clear' , \
buf2d_draw, 'buf2d_draw' , \
buf2d_delete, 'buf2d_delete', \
buf2d_rotate, 'buf2d_rotate', \
buf2d_resize, 'buf2d_resize', \
buf2d_line, 'buf2d_line', \
buf2d_line_sm, 'buf2d_line_sm', \
buf2d_rect_by_size, 'buf2d_rect_by_size', \
buf2d_filled_rect_by_size, 'buf2d_filled_rect_by_size', \
buf2d_circle, 'buf2d_circle', \
buf2d_img_hdiv2, 'buf2d_img_hdiv2', \
buf2d_img_wdiv2, 'buf2d_img_wdiv2', \
buf2d_conv_24_to_8, 'buf2d_conv_24_to_8', \
buf2d_conv_24_to_32, 'buf2d_conv_24_to_32', \
buf2d_bit_blt, 'buf2d_bit_blt', \
buf2d_bit_blt_transp, 'buf2d_bit_blt_transp', \
buf2d_bit_blt_alpha, 'buf2d_bit_blt_alpha', \
buf2d_curve_bezier, 'buf2d_curve_bezier', \
buf2d_convert_text_matrix, 'buf2d_convert_text_matrix', \
buf2d_draw_text, 'buf2d_draw_text', \
buf2d_crop_color, 'buf2d_crop_color', \
buf2d_offset_h, 'buf2d_offset_h', \
buf2d_flood_fill, 'buf2d_flood_fill', \
buf2d_set_pixel, 'buf2d_set_pixel', \
buf2d_get_pixel, 'buf2d_get_pixel', \
buf2d_flip_h, 'buf2d_flip_h', \
buf2d_flip_v, 'buf2d_flip_v', \
buf2d_filter_dither, 'buf2d_filter_dither'
public buf2d_create as '_buf2d_create_asm'
public buf2d_clear as '_buf2d_clear'
public buf2d_draw as '_buf2d_draw'
public buf2d_delete as '_buf2d_delete'
public buf2d_rotate as '_buf2d_rotate'
public buf2d_resize as '_buf2d_resize'
public buf2d_line as '_buf2d_line'
public buf2d_line_sm as '_buf2d_line_sm'
public buf2d_rect_by_size as '_buf2d_rect_by_size'
public buf2d_filled_rect_by_size as '_buf2d_filled_rect_by_size'
public buf2d_circle as '_buf2d_circle'
public buf2d_img_hdiv2 as '_buf2d_img_hdiv2'
public buf2d_img_wdiv2 as '_buf2d_img_wdiv2'
public buf2d_conv_24_to_8 as '_buf2d_conv_24_to_8'
public buf2d_conv_24_to_32 as '_buf2d_conv_24_to_32'
public buf2d_bit_blt as '_buf2d_bit_blt'
public buf2d_bit_blt_transp as '_buf2d_bit_blt_transp'
public buf2d_bit_blt_alpha as '_buf2d_bit_blt_alpha'
public buf2d_curve_bezier as '_buf2d_curve_bezier_asm'
public buf2d_convert_text_matrix as '_buf2d_convert_text_matrix'
public buf2d_draw_text as '_buf2d_draw_text'
public buf2d_crop_color as '_buf2d_crop_color'
public buf2d_offset_h as '_buf2d_offset_h'
public buf2d_flood_fill as '_buf2d_flood_fill'
public buf2d_set_pixel as '_buf2d_set_pixel'
public buf2d_get_pixel as '_buf2d_get_pixel'
public buf2d_flip_h as '_buf2d_flip_h'
public buf2d_flip_v as '_buf2d_flip_v'
public buf2d_filter_dither as '_buf2d_filter_dither'
/contrib/C_Layer/ASM/loadhttp.asm
0,0 → 1,64
format coff
use32 ; Tell compiler to use 32 bit instructions
section '.flat' code ; Keep this line before includes or GCC messes up call addresses
 
include 'struct.inc'
include 'proc32.inc'
include 'macros.inc'
purge section,mov,add,sub
 
include 'network.inc'
include 'http.inc'
include 'dll.inc'
virtual at 0
http_msg http_msg
end virtual
 
public init_network as '_init_network_asm'
;;; Returns 0 on success. -1 on failure.
 
proc init_network
mcall 68,11
stdcall dll.Load, @IMPORT
test eax, eax
jnz error
mov eax, 0
ret
error:
mov eax, -1
ret
endp
@IMPORT:
 
library lib_http, 'http.obj'
 
import lib_http, \
HTTP_get , 'get' , \
HTTP_head , 'head' , \
HTTP_post , 'post' , \
HTTP_find_header_field , 'find_header_field' , \
HTTP_send , 'send' , \
HTTP_receive , 'receive' , \
HTTP_disconnect , 'disconnect' , \
HTTP_free , 'free' , \
HTTP_escape , 'escape' , \
HTTP_unescape , 'unescape'
public HTTP_get as '_http_get_asm'
public HTTP_head as '_http_head_asm'
public HTTP_post as '_http_post_asm'
public HTTP_find_header_field as '_http_find_header_field_asm'
public HTTP_send as '_http_send_asm'
public HTTP_receive as '_http_receive_asm'
public HTTP_disconnect as '_http_disconnect_asm'
public HTTP_free as '_http_free_asm'
public HTTP_escape as '_http_escape_asm'
public HTTP_unescape as '_http_unescape_asm'
/contrib/C_Layer/ASM/loadkmenu.asm
0,0 → 1,68
format coff
use32 ; Tell compiler to use 32 bit instructions
 
section '.init' code ; Keep this line before includes or GCC messes up call addresses
 
include '../../../programs/proc32.inc'
include '../../../programs/macros.inc'
purge section,mov,add,sub
include '../../../programs/dll.inc'
public init_kmenu as '_init_kmenu_asm'
;;; Returns 0 on success. -1 on failure.
 
proc init_kmenu
mcall 68,11
stdcall dll.Load, @IMPORT
test eax, eax
jnz error
mov eax, 0
ret
error:
mov eax, -1
ret
endp
@IMPORT:
library lib_kmenu, 'kmenu.obj'
 
import lib_kmenu, \
kmainmenu_draw, 'kmainmenu_draw' , \
kmainmenu_dispatch_cursorevent, 'kmainmenu_dispatch_cursorevent' , \
kmainmenu_get_height, 'kmainmenu_get_height', \
ksubmenu_new, 'ksubmenu_new' , \
ksubmenu_delete, 'ksubmenu_delete' , \
ksubmenu_draw, 'ksubmenu_draw' , \
ksubmenu_add, 'ksubmenu_add' , \
ksubmenu_set_items_margin, 'ksubmenu_set_items_margin' , \
ksubmenu_set_items_padding, 'ksubmenu_set_items_padding' , \
kmenuitem_new, 'kmenuitem_new' , \
kmenuitem_delete, 'kmenuitem_delete' , \
kmenuitem_draw, 'kmenuitem_draw' , \
kmenuitem_get_preffered_width, 'kmenuitem_get_preffered_width' , \
kmenuitem_get_preffered_height, 'kmenuitem_get_preffered_height' , \
kmenu_set_font, 'kmenu_set_font' , \
kmenu_init, 'kmenu_init'
public kmainmenu_draw as '_kmainmenu_draw'
public kmainmenu_dispatch_cursorevent as '_kmainmenu_dispatch_cursorevent'
public kmainmenu_get_height as '_kmainmenu_get_height'
public ksubmenu_new as '_ksubmenu_new'
public ksubmenu_delete as '_ksubmenu_delete'
public ksubmenu_draw as '_ksubmenu_draw'
public ksubmenu_add as '_ksubmenu_add'
public ksubmenu_set_items_margin as '_ksubmenu_set_items_margin'
public ksubmenu_set_items_padding as '_ksubmenu_set_items_padding'
public kmenuitem_new as '_kmenuitem_new'
public kmenuitem_new as '_kmenuitem__submenu_new'
public kmenuitem_delete as '_kmenuitem_delete'
public kmenuitem_draw as '_kmenuitem_draw'
public kmenuitem_get_preffered_width as '_kmenuitem_get_preffered_width'
public kmenuitem_get_preffered_height as '_kmenuitem_get_preffered_height'
public kmenu_set_font as '_kmenu_set_font'
public kmenu_init as '_kmenu_init'
/contrib/C_Layer/ASM/loadlibimg.asm
0,0 → 1,78
 
format coff
use32 ; Tell compiler to use 32 bit instructions
 
section '.init' code ; Keep this line before includes or GCC messes up call addresses
 
include '../../../programs/proc32.inc'
include '../../../programs/macros.inc'
purge section,mov,add,sub
include '../../../programs/dll.inc'
public init_libimg as '_init_libimg_asm'
;;; Returns 0 on success. -1 on failure.
 
proc init_libimg
mcall 68,11
stdcall dll.Load, @IMPORT
test eax, eax
jnz error
mov eax, 0
ret
error:
mov eax, -1
ret
endp
 
@IMPORT:
library lib_libimg, 'libimg.obj'
 
import lib_libimg, \
libimg_init, 'lib_init' , \
img_is_img, 'img_is_img' , \
img_info, 'img_info' , \
img_from_file, 'img_from_file', \
img_to_file, 'img_to_file', \
img_from_rgb, 'img_from_rgb', \
img_to_rgb, 'img_to_rgb', \
img_to_rgb2, 'img_to_rgb2', \
img_decode, 'img_decode', \
img_encode, 'img_encode', \
img_create, 'img_create', \
img_destroy, 'img_destroy', \
img_destroy_layer, 'img_destroy_layer', \
img_count, 'img_count', \
img_lock_bits, 'img_lock_bits', \
img_unlock_bits, 'img_unlock_bits', \
img_flip, 'img_flip', \
img_flip_layer, 'img_flip_layer', \
img_rotate, 'img_rotate', \
img_rotate_layer, 'img_rotate_layer', \
img_draw, 'img_draw'
public libimg_init as '_libimg_init'
; public img_is_img as '_img_is_img'
;public img_info as '_img_info'
;public img_from_file as '_img_from_file'
;public img_to_file as '_img_to_file'
;public img_from_rgb as '_img_from_rgb'
public img_to_rgb as '_img_to_rgb'
public img_to_rgb2 as '_img_to_rgb2'
public img_decode as '_img_decode'
public img_encode as '_img_encode'
public img_create as '_img_create'
public img_destroy as '_img_destroy'
public img_destroy_layer as '_img_destroy_layer'
public img_count as '_img_count'
;public img_lock_bits as '_img_lock_bits'
;public img_unlock_bits as '_img_unlock_bits'
public img_flip as '_img_flip'
public img_flip_layer as '_img_flip_layer'
public img_rotate as '_img_rotate'
public img_rotate_layer as '_img_rotate_layer'
public img_draw as '_img_draw'
/contrib/C_Layer/ASM/loadlibini.asm
0,0 → 1,54
format coff
use32 ; Tell compiler to use 32 bit instructions
section '.flat' code ; Keep this line before includes or GCC messes up call addresses
 
;include 'struct.inc'
include '../../../programs/proc32.inc'
include '../../../programs/macros.inc'
purge section,mov,add,sub
 
include '../../../programs/dll.inc'
public init_libini as '_init_libini_asm'
;;; Returns 0 on success. -1 on failure.
 
proc init_libini
mcall 68,11
stdcall dll.Load, @IMPORT
test eax, eax
jnz error
mov eax, 0
ret
error:
mov eax, -1
ret
endp
@IMPORT:
 
library lib_libini, 'libini.obj'
 
import lib_libini, \
LIBINI_enum_sections , 'ini_enum_sections' , \
LIBINI_enum_keys , 'ini_enum_keys' , \
LIBINI_get_str , 'ini_get_str' , \
LIBINI_get_int , 'ini_get_int' , \
LIBINI_get_color , 'int_get_color' , \
LIBINI_get_shortcut , 'int_get_shortcut' , \
LIBINI_set_str , 'ini_set_str' , \
LIBINI_set_int , 'ini_set_int' , \
LIBINI_set_color , 'ini_set_color'
public LIBINI_enum_sections as '_LIBINI_enum_sections'
public LIBINI_enum_keys as '_LIBINI_enum_keys'
public LIBINI_get_str as '_LIBINI_get_str'
public LIBINI_get_int as '_LIBINI_get_int'
public LIBINI_get_color as '_LIBINI_get_color'
public LIBINI_set_str as '_LIBINI_set_str'
public LIBINI_set_int as '_LIBINI_set_int'
/contrib/C_Layer/ASM/loadproclib.asm
0,0 → 1,45
 
format coff
use32 ; Tell compiler to use 32 bit instructions
 
section '.init' code ; Keep this line before includes or GCC messes up call addresses
 
include 'proc32.inc'
include 'macros.inc'
purge section,mov,add,sub
include 'dll.inc'
public init_proclib as '_init_proclib_asm'
;;; Returns 0 on success. -1 on failure.
 
proc init_proclib
mcall 68,11
stdcall dll.Load, @IMPORT
test eax, eax
jnz error
mov eax, 0
ret
error:
mov eax, -1
ret
endp
 
@IMPORT:
library lib_boxlib, 'proc_lib.obj'
 
import lib_boxlib, \
OpenDialog_init, 'OpenDialog_init' , \
OpenDialog_start, 'OpenDialog_start' , \
ColorDialog_init, 'ColorDialog_init' , \
ColorDialog_start, 'ColorDialog_start'
public OpenDialog_init as '_OpenDialog_init'
public OpenDialog_start as '_OpenDialog_start'
 
public ColorDialog_init as '_ColorDialog_init'
public ColorDialog_start as '_ColorDialog_start'
/contrib/C_Layer/EXAMPLE/libguic_kolibri/make_boardmsg
0,0 → 1,37
NAME=boardmsg
CC = kos32-gcc
LD = kos32-ld
FASM=fasm
 
SDK_DIR:= $(abspath ../../sdk)
 
LDFLAGS = -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds \
--image-base 0 -lgcc /home/autobuild/tools/win32/lib/libdll.a\
/home/autobuild/tools/win32/lib/libc.dll.a\
/home/autobuild/tools/win32/lib/libapp.a
 
CFLAGS = -g -U_Win32 -U_WIN32 -U__MINGW32__
 
INCLUDES= -I $(SDK_DIR)/sources/newlib/libc/include
LIBPATH:= -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib
 
 
SOURCES = loadboxlib.asm boardmsg.c
 
OBJECTS = $(patsubst %.asm, %.obj, $(patsubst %.c, %.o, $(SOURCES)))
 
all:$(NAME)
 
$(NAME): $(OBJECTS) Makefile
$(LD) $(LIBPATH) -o $@ $(OBJECTS) $(LDFLAGS)
# -ldll -lapp -lc.dll -lgcc -Map $(NAME).map
kos32-objcopy $@ -O binary
 
%.o : %.c Makefile
$(CC) -c $(INCLUDES) $(CFLAGS) -o $@ $<
 
%.obj : %.asm Makefile
$(FASM) $< $@
 
clean:
-rm -f *.o *.obj
/contrib/C_Layer/EXAMPLE/libguic_kolibri/make_boardmsg.sh
0,0 → 1,11
#Please set up kolibrios sources here : /home/<username>/kolibrios
 
kos32-gcc -c -I${HOME}/kolibrios/contrib/sdk/sources/newlib/libc/include -g -U_Win32 -U_WIN32 -U__MINGW32__ boardmsg.c -o boardmsg.o
 
fasm loadboxlib.asm loadboxlib.obj
 
kos32-ld *.o *.obj -T${HOME}/kolibrios/contrib/sdk/sources/newlib/libc/app.lds -nostdlib -static --image-base 0 -lgcc -L/home/autobuild/tools/win32/mingw32/lib /home/autobuild/tools/win32/lib/libdll.a /home/autobuild/tools/win32/lib/libapp.a /home/autobuild/tools/win32/lib/libc.dll.a -static -o boardxmsg -Map=boardxmsg.map
 
objcopy -O binary boardxmsg
 
echo "If everything went well, boardxmsg should be your binary!"
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/contrib/C_Layer/EXAMPLE/libguic_kolibri/boardmsg.c
0,0 → 1,74
#include "kolibri_gui.h"
 
int main()
{
/* Load all libraries, initialize global tables like system color table and
operations table. kolibri_gui_init() will EXIT with mcall -1 if it fails
to do it's job. This is all you need to call and all libraries and GUI
elements can be used after a successful call to this function
*/
kolibri_gui_init();
/* Set gui_event to REDRAW so that window is drawn in first iteration */
unsigned int gui_event = KOLIBRI_EVENT_REDRAW;
oskey_t key;
 
struct kolibri_window *main_window = kolibri_new_window(50, 50, 400, 100, "BoardMsg: OpenDialog 0.12");
struct check_box *checkbox = kolibri_new_check_box(20, 40, 12, 12, "Append BOARDMSG to entered message.");
struct edit_box *textbox = kolibri_new_edit_box(20, 55, 40);
struct kolibri_button *button = kolibri_new_button(310, 55, 24, 14, 0x21, kolibri_color_table.color_work_button);
 
kolibri_window_add_element(main_window, KOLIBRI_EDIT_BOX, textbox);
kolibri_window_add_element(main_window, KOLIBRI_CHECK_BOX, checkbox);
kolibri_window_add_element(main_window, KOLIBRI_BUTTON, button);
 
extern volatile unsigned press_key;
 
do /* Start of main activity loop */
{
if(gui_event == KOLIBRI_EVENT_REDRAW)
{
kolibri_handle_event_redraw(main_window);
}
else if(gui_event == KOLIBRI_EVENT_KEY)
{
key = get_key();
switch (key.code)
{
case 13:
if(checkbox -> flags & CHECKBOX_IS_SET) /* Append BoardMsg checkbox is set */
debug_board_write_str("BOARDMSG: ");
 
debug_board_write_str(textbox->text);
debug_board_write_str("\n");
break;
}
press_key = key.val;
 
kolibri_handle_event_key(main_window);
}
else if(gui_event == KOLIBRI_EVENT_BUTTON)
{
unsigned int pressed_button = kolibri_button_get_identifier();
switch (pressed_button)
{
case 0x21:
if(checkbox -> flags & CHECKBOX_IS_SET) /* Append BoardMsg checkbox is set */
debug_board_write_str("BOARDMSG: ");
debug_board_write_str(textbox->text);
debug_board_write_str("\n");
break;
case 0x00000001:
kolibri_exit();
}
}
else if(gui_event == KOLIBRI_EVENT_MOUSE)
{
kolibri_handle_event_mouse(main_window);
}
 
} while(gui_event = get_os_event()); /* End of main activity loop */
 
/* kolibri_quit(); */
 
return 0;
}
/contrib/C_Layer/EXAMPLE/libguic_kolibri/README
0,0 → 1,57
Welcome to the README for GUI LIBRARY FOR KOLIBRIOS IN C.
 
This library tries to use the wealth of code already written for KolibriOS in assembly.
 
The files currently available are :
 
0) loadboxlib.asm :
This is a wrapper created so that C can call assembly functions.
Assemble this to loadboxlib.obj and use with cross compiler linker the .obj file
to create correct executables which use this GUI library.
 
1) kolibri_boxlib.h :
This file contains functions for initializing boxlib from C. This is used by the
function kolibri_gui_init() in kolibri_gui.h
 
2)kolibri_button.h:
This file contains functions to create and use kolibriOS buttons.
3)kolibri_checkbox.h:
This file contains functions to create and use Check boxes from BOXLIB.
 
4)kolibri_editbox.h:
This file contains functions for creating text boxes (edit boxes from Boxlib)
 
5)kolibri_colors.h:
This file has functions to initialize global kolibri color table
so that the GUI can use colors from the System theme.
 
6)kolibri_gui_elements.h:
This defines generic containers for GUI elements so that ANY element
(buttons, editboxes, checkboxes, etc) can have their redraw/mouse/key event
functions. This helps create a list of all the elements and draw them together.
 
ALL FILES ABOVE ARE INCLUDED IN KOLIBRI_GUI.H SO THEY DO NOT NEED TO BE INCLUDED IN THE CODE YOU WRITE.
 
7)kolibri_gui.h:
This is the master file we use. This baby contains everything you need (all GUI elements are included).
This also contains event handlers that can be simply called from the main application loop.
This will make your life easy on KolibriOS ;) USE IT!
The function kolibri_gui_init() needs to be called from all applications using this library.
 
8)boardmsg.c:
Sample application written to show off the library.
This application sends messages to Debug Board on KolibriOS.
Enter a msg and press the button with the mouse to send messages!
This is the first of many applications to come with this library.
 
---
NOTES
 
Refer to boardmsg.c to see how the library is used.
Use instructions from here to build files in C : http://board.kolibrios.org/viewtopic.php?f=24&t=3117
 
---
Suggestions, Feedback and Ideas are welcome and appreciated!
Please contact : ashmew2 (on board.kolibrios.org) or ashmew2 at gmail dot com for discussing,
Or post on : http://board.kolibrios.org/viewtopic.php?f=24&t=3117#p62536 so that everyone can participate!
/contrib/C_Layer/EXAMPLE/libguic_kolibri/quirks
0,0 → 1,6
USE .section '.init' code for writing loader asm C mixed code (in FASM)
Got to know this by checking out the linker script on KGCC. -Xlinker -verbose .
Inside the .text section that is being assembled, the .init is placed at the very beginning.
Let the macros expand, GCC simply places .init on the top and therefore it works.
 
Inexplicable errors if .init is not used and .text or .flat is used... Took 4 hours to figure out.
/contrib/C_Layer/INCLUDE/kolibri_boxlib.h
0,0 → 1,18
#ifndef KOLIBRI_BOXLIB_H
#define KOLIBRI_BOXLIB_H
 
extern int init_boxlib_asm(void);
 
int kolibri_boxlib_init(void)
{
int asm_init_status = init_boxlib_asm();
/* just return asm_init_status? or return init_boxlib_asm() ?*/
 
if(asm_init_status == 0)
return 0;
else
return 1;
}
 
#endif /* KOLIBRI_BOXLIB_H */
/contrib/C_Layer/INCLUDE/kolibri_buf2d.h
0,0 → 1,96
#ifndef KOLIBRI_BUF2D_H
#define KOLIBRI_BUF2D_H
 
/*ToDo
* buf_curve_bezier
* voxel function
*/
 
extern int init_buf2d_asm(void);
 
int kolibri_buf2d_init(void)
{
int asm_init_status = init_buf2d_asm();
/* just return asm_init_status? or return init_boxlib_asm() ?*/
 
if(asm_init_status == 0)
return 0;
else
return 1;
}
 
 
struct buf2d_struct {
unsigned int *buf_pointer;
uint16_t left;
uint16_t top;
unsigned int width;
unsigned int height;
unsigned int bgcolor;
uint8_t color_bit;
};
 
enum BUF2D_ALGORITM_FILTR {
SIERRA_LITE,
FLOYD_STEINBERG,
BURKERS,
HEAVYIRON_MOD,
ATKINSON
};
 
enum BUF2D_OPT_CROP {
BUF2D_OPT_CROP_TOP = 1,
BUF2D_OPT_CROP_LEFT = 2,
BUF2D_OPT_CROP_BOTTOM = 4,
BUF2D_OPT_CROP_RIGHT = 8
};
 
extern void (*buf2d_create_asm)(struct buf2d_struct *) __attribute__((__stdcall__));
extern void (*buf2d_curve_bezier_asm)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
 
struct buf2d_struct* buf2d_create(uint16_t tlx, uint16_t tly, unsigned int sizex, unsigned int sizey, unsigned int font_bgcolor, uint8_t color_bit)
{
struct buf2d_struct *new_buf2d_struct = (struct buf2d_struct *)malloc(sizeof(struct buf2d_struct));
new_buf2d_struct -> left = tlx;
new_buf2d_struct -> top = tly;
new_buf2d_struct -> width = sizex;
new_buf2d_struct -> height = sizey;
new_buf2d_struct -> bgcolor = font_bgcolor;
new_buf2d_struct -> color_bit = color_bit;
buf2d_create_asm(new_buf2d_struct);
return new_buf2d_struct;
}
 
void buf2d_curve_bezier(struct buf2d_struct *buf, unsigned int p0_x, unsigned int p0_y, unsigned int p1_x, unsigned int p1_y, unsigned int p2_x, unsigned int p2_y, unsigned int color)
{
buf2d_curve_bezier_asm(buf, (p0_x<<16)+p0_y, (p1_x<<16)+p1_y, (p2_x<<16)+p2_y, color);
}
 
extern void (*buf2d_draw)(struct buf2d_struct *) __attribute__((__stdcall__));
extern void (*buf2d_clear)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__));
extern void (*buf2d_delete)(struct buf2d_struct *) __attribute__((__stdcall__));
extern void (*buf2d_rotate)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__));
extern void (*buf2d_resize)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
extern void (*buf2d_line)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
extern void (*buf2d_line_sm)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
extern void (*buf2d_rect_by_size)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
extern void (*buf2d_filled_rect_by_size)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
extern void (*buf2d_circle)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
extern void (*buf2d_img_hdiv2)(struct buf2d_struct *) __attribute__((__stdcall__));
extern void (*buf2d_img_wdiv2)(struct buf2d_struct *) __attribute__((__stdcall__));
extern void (*buf2d_conv_24_to_8)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__));
extern void (*buf2d_conv_24_to_32)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__));
extern void (*buf2d_bit_blt_transp)(struct buf2d_struct *, unsigned int, unsigned int, struct buf2d_struct *) __attribute__((__stdcall__));
extern void (*buf2d_bit_blt_alpha)(struct buf2d_struct *, unsigned int, unsigned int, struct buf2d_struct *) __attribute__((__stdcall__));
extern void (*buf2d_convert_text_matrix)(struct buf2d_struct *) __attribute__((__stdcall__));
extern void (*buf2d_draw_text)(struct buf2d_struct *, struct buf2d_struct *, const char *, unsigned int, unsigned int) __attribute__((__stdcall__));
extern void (*buf2d_crop_color)(struct buf2d_struct *, unsigned int, unsigned int) __attribute__((__stdcall__));
extern void (*buf2d_offset_h)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
extern void (*buf2d_flood_fill)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
extern void (*buf2d_set_pixel)(struct buf2d_struct *, unsigned int, unsigned int, unsigned int) __attribute__((__stdcall__));
extern unsigned int (*buf2d_get_pixel)(struct buf2d_struct *, unsigned int, unsigned int) __attribute__((__stdcall__));
extern void (*buf2d_flip_h)(struct buf2d_struct *) __attribute__((__stdcall__));
extern void (*buf2d_flip_v)(struct buf2d_struct *) __attribute__((__stdcall__));
extern void (*buf2d_filter_dither)(struct buf2d_struct *, unsigned int) __attribute__((__stdcall__));
#endif /* KOLIBRI_BUF2D_H */
/contrib/C_Layer/INCLUDE/kolibri_button.h
0,0 → 1,47
#ifndef KOLIBRI_BUTTON_H
#define KOLIBRI_BUTTON_H
 
struct kolibri_button {
unsigned int x65536sizex;
unsigned int y65536sizey;
unsigned int color;
unsigned int identifier;
unsigned int XY;
};
 
struct kolibri_button *kolibri_new_button(unsigned int tlx, unsigned int tly, unsigned int sizex, unsigned int sizey,
unsigned int identifier, unsigned int color)
{
struct kolibri_button* new_button = (struct kolibri_button *)malloc(sizeof(struct kolibri_button));
new_button -> x65536sizex = (tlx << 16) + sizex;
new_button -> y65536sizey = (tly << 16) + sizey;
new_button -> color = color;
new_button -> identifier = identifier;
new_button -> XY = 0;
return new_button;
}
 
void draw_button(struct kolibri_button *some_button)
{
define_button(some_button -> x65536sizex, some_button -> y65536sizey, some_button -> identifier, some_button -> color);
}
 
unsigned int kolibri_button_get_identifier(void)
{
unsigned int identifier;
 
__asm__ __volatile__(
"int $0x40"
:"=a"(identifier)
:"a"(17)
);
/* If no button pressed, returns 1 */
/* Otherwise, returns identifier of button */
 
if(identifier != 1) /* Button was detected indeed */
return identifier>>8;
else
return identifier; /* No button detected */
}
 
#endif /* KOLIBRI_BUTTON_H */
/contrib/C_Layer/INCLUDE/kolibri_checkbox.h
0,0 → 1,43
#ifndef KOLIBRI_CHECKBOX_H
#define KOLIBRI_CHECKBOX_H
 
#include "kolibri_colors.h"
 
enum CHECKBOX_FLAGS {
CHECKBOX_IS_SET = 0x00000002
/* Add more flags later */
};
 
struct check_box {
unsigned int left_s;
unsigned int top_s;
unsigned int ch_text_margin;
unsigned int color;
unsigned int border_color;
unsigned int text_color;
char *text;
unsigned int flags;
 
/* Users can use members above this */
unsigned int size_of_str;
};
 
struct check_box* kolibri_new_check_box(unsigned int tlx, unsigned int tly, unsigned int sizex, unsigned int sizey, char *label_text)
{
struct check_box* new_checkbox = (struct check_box *)malloc(sizeof(struct check_box));
new_checkbox -> left_s = (tlx << 16) + sizex;
new_checkbox -> top_s = (tly << 16) + sizey;
new_checkbox -> ch_text_margin = 10;
new_checkbox -> color = 0xFFFFFFFF;
new_checkbox -> border_color = kolibri_color_table.color_work_graph;
new_checkbox -> text_color = kolibri_color_table.color_work_text;
new_checkbox -> text = label_text;
new_checkbox -> flags = 0x00000008;
 
return new_checkbox;
}
 
extern void (*check_box_draw2)(struct check_box *) __attribute__((__stdcall__));
extern void (*check_box_mouse2)(struct check_box *)__attribute__((__stdcall__));
 
#endif /* KOLIBRI_CHECKBOX_H */
/contrib/C_Layer/INCLUDE/kolibri_colordialog.h
0,0 → 1,48
#ifndef KOLIBRI_COLORIALOG_H
#define KOLIBRI_COLORIALOG_H
 
char cd_com_area_name[] = "FFFFFFFF_color_dialog";
char cd_start_path[] = "/rd/1/colrdial";
 
struct color_dialog {
unsigned int type;
unsigned int procinfo;
unsigned int com_area_name;
unsigned int com_area;
unsigned int start_path;
unsigned int draw_window;
unsigned int status;
unsigned short x_size;
unsigned short x_start;
unsigned short y_size;
unsigned short y_start;
unsigned int color_type;
unsigned int color;
};
 
void cd_fake_on_redraw(void) {}
 
struct open_dialog* kolibri_new_color_dialog(unsigned int type, unsigned short tlx, unsigned short tly, unsigned short x_size, unsigned short y_size)
{
struct color_dialog *new_colordialog = (struct color_dialog *)malloc(sizeof(struct color_dialog));
char *proc_info = (char *)calloc(1024, sizeof(char));
new_colordialog -> type = type;
new_colordialog -> procinfo = proc_info;
new_colordialog -> com_area_name = &cd_com_area_name;
new_colordialog -> com_area = 0;
new_colordialog -> start_path = &cd_start_path;
new_colordialog -> draw_window = &cd_fake_on_redraw;
new_colordialog -> status = 0;
new_colordialog -> x_size = x_size;
new_colordialog -> x_start = tlx;
new_colordialog -> y_size = y_size;
new_colordialog -> y_start = tly;
new_colordialog -> color_type = 0;
new_colordialog -> color = 0;
return new_colordialog;
}
 
extern void (*ColorDialog_init)(struct open_dialog *) __attribute__((__stdcall__));
extern void (*ColorDialog_start)(struct open_dialog *) __attribute__((__stdcall__));
#endif /* KOLIBRI_COLORDIALOG_H */
/contrib/C_Layer/INCLUDE/kolibri_colors.h
0,0 → 1,28
#ifndef KOLIBRI_COLORS_H
#define KOLIBRI_COLORS_H
struct kolibri_system_colors {
unsigned int color_frame_area;
unsigned int color_grab_bar;
unsigned int color_grab_bar_button;
unsigned int color_grab_button_text;
unsigned int color_grab_text;
unsigned int color_work_area;
unsigned int color_work_button;
unsigned int color_work_button_text;
unsigned int color_work_text;
unsigned int color_work_graph;
};
 
struct kolibri_system_colors kolibri_color_table;
 
void kolibri_get_system_colors(struct kolibri_system_colors *color_table)
{
__asm__ volatile ("int $0x40"
:
:"a"(48),"b"(3),"c"(color_table),"d"(40)
);
 
/* color_table should point to the system color table */
}
 
#endif /* KOLIBRI_COLORS_H */
/contrib/C_Layer/INCLUDE/kolibri_debug.h
0,0 → 1,36
#ifndef KOLIBRI_DEBUG_H
#define KOLIBRI_DEBUG_H
 
#include <_ansi.h>
#include <reent.h>
#include <stdio.h>
#include <stdarg.h>
 
/* Write a printf() like function (variable argument list) for
writing to debug board */
 
inline void debug_board_write_byte(const char ch){
__asm__ __volatile__(
"int $0x40"
:
:"a"(63), "b"(1), "c"(ch));
}
 
//added noninline because incofortabre stepping in in debugger
void __attribute__ ((noinline)) debug_board_write_str(const char* str){
while(*str)
debug_board_write_byte(*str++);
}
 
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);
debug_board_write_str(log_board);
}
 
#endif /* KOLIBRI_DEBUG_H */
/contrib/C_Layer/INCLUDE/kolibri_editbox.h
0,0 → 1,89
#ifndef KOLIBRI_EDITBOX_H
#define KOLIBRI_EDITBOX_H
 
#include "kolibri_colors.h"
 
struct edit_box {
unsigned int width;
unsigned int left;
unsigned int top;
unsigned int color;
unsigned int shift_color;
unsigned int focus_border_color;
unsigned int blur_border_color;
unsigned int text_color;
unsigned int max;
char *text;
unsigned int mouse_variable;
unsigned int flags;
 
/* The following struct members are not used by the users of API */
unsigned int size;
unsigned int pos;
unsigned int offset;
unsigned int cl_curs_x;
unsigned int cl_curs_y;
unsigned int shift;
unsigned int shift_old;
};
 
/* Initializes an Editbox with sane settings, sufficient for most use.
This will let you create a box and position it somewhere on the screen.
The text_buffer is a pointer to a character array and needs to be as long as
AT LEAST MAX_CHARS + 1.If the text_buffer is smaller, it will crash if user
types more characters than what will fit into the text buffer.
 
Allocating buffer space automatically so that programmer can be carefree now.
This also automatically adjusts the size of edit box so that it can hold enough characters.
 
All you need is :
 
tlx,tly = Coordinates of the beginning of the edit box.
max_chars = Limit of number of characters user can enter into edit box.
*/
 
struct edit_box* kolibri_new_edit_box(unsigned int tlx, unsigned int tly, unsigned int max_chars)
{
unsigned int PIXELS_PER_CHAR = 7;
struct edit_box *new_textbox = (struct edit_box *)malloc(sizeof(struct edit_box));
char *text_buffer = (char *)calloc(max_chars + 1, sizeof(char));
 
/* Update blur_border_color and shift_color from box_lib.mac macro */
/* edit_boxes_set_sys_color */
 
new_textbox -> width = max_chars * PIXELS_PER_CHAR;
new_textbox -> left = tlx;
new_textbox -> top = tly;
new_textbox -> color = 0xFFFFFF; /* Always make white edit boxes */
new_textbox -> shift_color = 0x6a9480;
new_textbox -> focus_border_color = kolibri_color_table.color_work_graph;
new_textbox -> blur_border_color = 0x6a9480;
new_textbox -> text_color = kolibri_color_table.color_work_text; /* Always black text when typing */
new_textbox -> max = max_chars;
new_textbox -> text = text_buffer;
new_textbox -> mouse_variable = 1; /* let the mouse take control? */
new_textbox -> flags = 0x00000000;
/* If these lines are uncommented, the executable will crash for no reason at start */
/* Even though these lines are not ever read it ALWAYS causes a crash, even crashes MTDBG. What gives? */
 
new_textbox -> size = 0;
new_textbox -> pos = 0;
new_textbox -> offset = 0;
new_textbox -> cl_curs_x = 0;
new_textbox -> cl_curs_y = 0;
new_textbox -> shift = 0;
new_textbox -> shift_old = 0;
 
return new_textbox;
}
 
extern void (*edit_box_draw)(struct 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(struct edit_box *) __attribute__((__stdcall__));
 
extern void (*edit_box_mouse)(struct edit_box *) __attribute__((__stdcall__));
extern volatile unsigned press_key;
#endif /* KOLIBRI_EDITBOX_H */
/contrib/C_Layer/INCLUDE/kolibri_frame.h
0,0 → 1,48
#ifndef KOLIBRI_FRAME_H
#define KOLIBRI_FRAME_H
 
enum {
TOP,
BOTTON
};
 
struct frame {
unsigned int type;
uint16_t size_x;
uint16_t start_x;
uint16_t size_y;
uint16_t start_y;
unsigned int ext_col;
unsigned int int_col;
unsigned int draw_text_flag;
char *text_pointer;
unsigned int text_position;
unsigned int font_number;
unsigned int font_size_y;
unsigned int font_color;
unsigned int font_backgr_color;
};
 
struct frame* kolibri_new_frame(uint16_t tlx, uint16_t tly, uint16_t sizex, uint16_t sizey, unsigned int ext_col, unsigned int int_col, unsigned int draw_text_flag, char *text_pointer, unsigned int text_position, unsigned int font_color, unsigned int font_bgcolor)
{
struct frame *new_frame = (struct frame *)malloc(sizeof(struct frame));
new_frame -> type = 0;
new_frame -> size_x = sizex;
new_frame -> start_x = tlx;
new_frame -> size_y = sizey;
new_frame -> start_y = tly;
new_frame -> ext_col = ext_col;
new_frame -> int_col = int_col;
new_frame -> draw_text_flag = draw_text_flag;
new_frame -> text_pointer = text_pointer;
new_frame -> text_position = text_position;
new_frame -> font_number = 1;
new_frame -> font_size_y = 12;
new_frame -> font_color = font_color;
new_frame -> font_backgr_color = font_bgcolor;
return new_frame;
}
 
extern void (*frame_draw)(struct frame *) __attribute__((__stdcall__));
 
#endif /* KOLIBRI_FRAME_H */
/contrib/C_Layer/INCLUDE/kolibri_gui.h
0,0 → 1,134
#ifndef KOLIBRI_GUI_H
#define KOLIBRI_GUI_H
 
#include <stdlib.h> /* for malloc() */
#include <kos32sys.h>
 
#include "kolibri_debug.h" /* work with debug board */
 
/* boxlib loader */
#include "kolibri_boxlib.h"
 
/* All supported GUI elements included */
#include "kolibri_gui_elements.h"
 
enum KOLIBRI_GUI_EVENTS {
KOLIBRI_EVENT_REDRAW = 1, /* Window and window elements should be redrawn */
KOLIBRI_EVENT_KEY = 2, /* A key on the keyboard was pressed */
KOLIBRI_EVENT_BUTTON = 3, /* A button was clicked with the mouse */
KOLIBRI_EVENT_MOUSE = 6 /* Mouse activity (movement, button press) was detected */
};
 
void kolibri_handle_event_redraw(struct kolibri_window* some_window)
{
/* Draw windows with system color table. */
 
BeginDraw();
 
DrawWindow(some_window->topleftx, some_window->toplefty,
some_window->sizex, some_window->sizey,
some_window->window_title,
kolibri_color_table.color_work_area, some_window->XY);
 
/* Enumerate and draw all window elements here */
if(some_window->elements) /* Draw all elements added to window */
{
struct kolibri_window_element* current_element = some_window -> elements;
 
do
{
/* The redraw_fn serves as draw_fn on initial draw */
if(kolibri_gui_op_table[current_element -> type].redraw_fn)
kolibri_gui_op_table[current_element -> type].redraw_fn(current_element -> element);
 
//sie after fixing calling conventions no more needed
/*
switch(current_element -> type)
{
case KOLIBRI_EDIT_BOX:
case KOLIBRI_CHECK_BOX:
__asm__ volatile("push $0x13371337"::); / * Random value pushed to balance stack * /
/ * otherwise edit_box_draw leaves stack unbalanced * /
/ * and GCC jumps like a crazy motha' fucka' * /
 
break;
}
*/
current_element = current_element -> next;
 
} while(current_element != some_window->elements); /* Have we covered all elements? */
}
}
 
void kolibri_handle_event_key(struct kolibri_window* some_window)
{
/* Enumerate and trigger key handling functions of window elements here */
if(some_window->elements)
{
struct kolibri_window_element *current_element = some_window -> elements;
 
do
{
/* Only execute if the function pointer isn't NULL */
if(kolibri_gui_op_table[current_element -> type].key_fn)
kolibri_gui_op_table[current_element -> type].key_fn(current_element -> element);
 
current_element = current_element -> next;
} while(current_element != some_window->elements); /* Have we covered all elements? */
}
}
 
void kolibri_handle_event_mouse(struct kolibri_window* some_window)
{
/* Enumerate and trigger mouse handling functions of window elements here */
if(some_window->elements)
{
struct kolibri_window_element *current_element = some_window -> elements;
 
do
{
if(kolibri_gui_op_table[current_element -> type].mouse_fn)
kolibri_gui_op_table[current_element -> type].mouse_fn(current_element -> element);
 
current_element = current_element -> next;
 
} while(current_element != some_window->elements); /* Have we covered all elements? */
}
}
 
void kolibri_exit(void)
{
__asm__ volatile ("int $0x40"::"a"(-1));
}
 
int kolibri_gui_init(void)
{
int boxlib_init_status = kolibri_boxlib_init();
 
if(boxlib_init_status == 0)
debug_board_write_str("ashmew2 is happy: Kolibri GUI Successfully Initialized.\n");
else
{
debug_board_write_str("ashmew2 is sad: Kolibri GUI Failed to initialize.\n");
kolibri_exit();
}
 
/* Initialize the global operation table which handles event functions of */
/* each individual element type */
kolibri_init_gui_op_table();
 
/* Get the current color table for Kolibri and store in global table*/
kolibri_get_system_colors(&kolibri_color_table);
 
/* Set up system events for buttons, mouse and keyboard and redraw */
/* Also set filters so that window receives mouse events only when active
and mouse inside window */
__asm__ volatile("int $0x40"::"a"(40), "b"(0xC0000027));
 
return boxlib_init_status;
}
 
/* Note: The current implementation tries to automatically colors
GUI elements with system theme */
 
#endif /* KOLIBRI_GUI_H */
/contrib/C_Layer/INCLUDE/kolibri_gui_elements.h
0,0 → 1,142
#ifndef KOLIBRI_GUI_ELEMENTS_H
#define KOLIBRI_GUI_ELEMENTS_H
 
/* GUI Elements being used */
#include "kolibri_editbox.h"
#include "kolibri_checkbox.h"
#include "kolibri_button.h"
#include "kolibri_progressbar.h"
#include "kolibri_frame.h"
 
/* enum KOLIBRI_GUI_ELEMENT_TYPE contains all available GUI items from box_lib */
/* More elements can be added from other libraries as required */
enum KOLIBRI_GUI_ELEMENT_TYPE {
KOLIBRI_EDIT_BOX,
KOLIBRI_CHECK_BOX,
KOLIBRI_RADIO_BUTTON,
KOLIBRI_SCROLL_BAR,
KOLIBRI_DYNAMIC_BUTTON,
KOLIBRI_MENU_BAR,
KOLIBRI_FILE_BROWSER,
KOLIBRI_TREE_LIST,
KOLIBRI_PATH_SHOW,
KOLIBRI_TEXT_EDITOR,
KOLIBRI_FRAME,
KOLIBRI_PROGRESS_BAR,
 
KOLIBRI_BUTTON,
 
/* Add elements above this element in order to let KOLIBRI_NUM_GUI_ELEMENTS */
/* stay at correct value */
 
KOLIBRI_NUM_GUI_ELEMENTS
};
 
/* Linked list which connects together all the elements drawn inside a GUI window */
struct kolibri_window_element {
enum KOLIBRI_GUI_ELEMENT_TYPE type;
void *element;
struct kolibri_window_element *next, *prev;
};
 
 
typedef void (*cb_elem_boxlib)(void *) __attribute__((__stdcall__));
 
/* Generic structure for supporting functions on various elements of Kolibri's GUI */
struct kolibri_element_operations {
cb_elem_boxlib redraw_fn;
cb_elem_boxlib mouse_fn;
cb_elem_boxlib key_fn;
};
 
/* Structure for a GUI Window on Kolibri. It also contains all the elements drawn in window */
struct kolibri_window {
unsigned int topleftx, toplefty;
unsigned int sizex, sizey;
char *window_title;
 
/* Refer to sysfuncs, value to be stored in EDX (Function 0) */
unsigned int XY;
 
struct kolibri_window_element *elements;
};
 
/*---------------------End of Structure and enum definitions---------------*/
/*---------------------Define various functions for initializing GUI-------*/
 
/* Master table containing operations for various GUI elements in one place */
struct kolibri_element_operations kolibri_gui_op_table[KOLIBRI_NUM_GUI_ELEMENTS];
 
void kolibri_init_gui_op_table(void)
{
/* 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;
 
/* Setting up functions for check box GUI elements*/
kolibri_gui_op_table[KOLIBRI_CHECK_BOX].redraw_fn = (cb_elem_boxlib)check_box_draw2;
kolibri_gui_op_table[KOLIBRI_CHECK_BOX].mouse_fn = (cb_elem_boxlib)check_box_mouse2;
kolibri_gui_op_table[KOLIBRI_CHECK_BOX].key_fn = NULL;
 
/* Setting up functions for Kolibri Buttons ( SysFunc 8 )*/
kolibri_gui_op_table[KOLIBRI_BUTTON].redraw_fn = (cb_elem_boxlib)draw_button;
kolibri_gui_op_table[KOLIBRI_BUTTON].mouse_fn = NULL;
kolibri_gui_op_table[KOLIBRI_BUTTON].key_fn = NULL;
 
/* Setting up functions for progress bar GUI elements*/
kolibri_gui_op_table[KOLIBRI_PROGRESS_BAR].redraw_fn = (cb_elem_boxlib)progressbar_draw;
kolibri_gui_op_table[KOLIBRI_PROGRESS_BAR].mouse_fn = NULL;
kolibri_gui_op_table[KOLIBRI_PROGRESS_BAR].key_fn = NULL;
 
/* Setting up functions for frame GUI elements*/
kolibri_gui_op_table[KOLIBRI_FRAME].redraw_fn = (cb_elem_boxlib)frame_draw;
kolibri_gui_op_table[KOLIBRI_FRAME].mouse_fn = NULL;
kolibri_gui_op_table[KOLIBRI_FRAME].key_fn = NULL;
 
}
 
/* Create a new main GUI window for KolibriOS */
/* tl stands for TOP LEFT. x and y are coordinates. */
 
struct kolibri_window * kolibri_new_window(int tlx, int tly, int sizex, int sizey, char *title)
{
struct kolibri_window *new_win = (struct kolibri_window *)malloc(sizeof(struct kolibri_window));
 
new_win->topleftx = tlx;
new_win->toplefty = tly;
new_win->sizex = sizex;
new_win->sizey = sizey;
new_win->window_title = title;
new_win->XY = 0x00000013; /* All windows are skinned windows with caption for now */
new_win->elements = NULL;
 
return new_win;
}
 
/* Add an element to an existing window */
void kolibri_window_add_element(struct kolibri_window *some_window, enum KOLIBRI_GUI_ELEMENT_TYPE element_type, void *some_gui_element)
{
struct kolibri_window_element *new_element = (struct kolibri_window_element *)malloc(sizeof(struct kolibri_window_element));
 
new_element -> type = element_type;
new_element -> element = some_gui_element;
 
if(!(some_window->elements)) /* No elements in window yet */
{
some_window->elements = new_element;
some_window->elements -> prev = some_window->elements;
some_window->elements -> next = some_window->elements;
}
else
{
struct kolibri_window_element *last_element = some_window -> elements -> prev;
 
last_element -> next = new_element;
new_element -> next = some_window -> elements; /* start of linked list */
some_window -> elements -> prev = new_element;
new_element -> prev = last_element;
}
}
 
#endif /* KOLIBRI_GUI_ELEMENTS_H */
/contrib/C_Layer/INCLUDE/kolibri_kmenu.h
0,0 → 1,28
#ifndef KOLIBRI_KMENU_H
#define KOLIBRI_KMENU_H
 
extern int init_kmenu_asm(void);
 
int kolibri_kmenu_init(void)
{
int asm_init_status = init_kmenu_asm();
/* just return asm_init_status? or return init_boxlib_asm() ?*/
 
if(asm_init_status == 0)
return 0;
else
return 1;
}
 
 
 
extern void (*kmainmenu_draw)(void *) __attribute__((__stdcall__));
extern void (*kmainmenu_dispatch_cursorevent)(void *) __attribute__((__stdcall__));
extern void (*kmenu_init)(void *) __attribute__((__stdcall__));
extern void* (*ksubmenu_new)() __attribute__((__stdcall__));
extern void (*ksubmenu_add)(void *, void *) __attribute__((__stdcall__));
extern void* (*kmenuitem_new)(uint32_t, const char *, uint32_t) __attribute__((__stdcall__));
extern void* (*kmenuitem__submenu_new)(uint32_t, const char *, void *) __attribute__((__stdcall__));
 
#endif /* KOLIBRI_KMENU_H */
/contrib/C_Layer/INCLUDE/kolibri_libimg.h
0,0 → 1,30
#ifndef KOLIBRI_LIBIMG_H
#define KOLIBRI_LIBIMG_H
 
int kolibri_libimg_init(void)
{
int asm_init_status = init_libimg_asm();
/* just return asm_init_status? or return init_libimg_asm() ?*/
 
if(asm_init_status == 0)
return 0;
else
return 1;
}
 
extern void* (*img_decode)(void *, uint32_t, uint32_t) __attribute__((__stdcall__));
extern void* (*img_encode)(void *, uint32_t, uint32_t) __attribute__((__stdcall__));
extern void* (*img_create)(uint32_t, uint32_t, uint32_t) __attribute__((__stdcall__));
extern void (*img_to_rgb2)(void *, void *) __attribute__((__stdcall__));
extern void* (*img_to_rgb)(void *) __attribute__((__stdcall__));
extern uint32_t (*img_flip)(void *, uint32_t) __attribute__((__stdcall__));
extern uint32_t (*img_flip_layer)(void *, uint32_t) __attribute__((__stdcall__));
extern uint32_t (*img_rotate)(void *, uint32_t) __attribute__((__stdcall__));
extern uint32_t (*img_rotate_layer)(void *, uint32_t) __attribute__((__stdcall__));
extern void (*img_draw)(void *, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t ) __attribute__((__stdcall__));
extern uint32_t (*img_count)(void *) __attribute__((__stdcall__));
extern uint32_t (*img_destroy)(void *) __attribute__((__stdcall__));
extern uint32_t (*img_destroy_layer)(void *) __attribute__((__stdcall__));
 
#endif /* KOLIBRI_LIBIMG_H */
/contrib/C_Layer/INCLUDE/kolibri_libini.h
0,0 → 1,29
#ifndef KOLIBRI_LIBINI_H
#define KOLIBRI_LIBINI_H
 
extern int init_libini_asm(void);
 
int kolibri_libini_init(void)
{
int asm_init_status = init_libini_asm();
/* just return asm_init_status? or return init_boxlib_asm() ?*/
 
if(asm_init_status == 0)
return 0;
else
return 1;
}
 
extern uint32_t (*LIBINI_enum_sections)(const char*, void*) __attribute__((__stdcall__));
extern uint32_t (*LIBINI_enum_keys)(const char*, const char*, void*) __attribute__((__stdcall__));
 
extern uint32_t (*LIBINI_get_str)(const char*, const char*, const char*, char*, uint32_t) __attribute__((__stdcall__));
extern uint32_t (*LIBINI_set_str)(const char*, const char*, const char*, const char*, uint32_t) __attribute__((__stdcall__));
extern uint32_t (*LIBINI_get_int)(const char*, const char*, const char*, uint32_t) __attribute__((__stdcall__));
extern uint32_t (*LIBINI_set_int)(const char*, const char*, const char*, uint32_t) __attribute__((__stdcall__));
extern uint32_t (*LIBINI_get_color)(const char*, const char*, const char*, uint32_t) __attribute__((__stdcall__));
extern uint32_t (*LIBINI_set_color)(const char*, const char*, const char*, uint32_t) __attribute__((__stdcall__));
extern uint32_t (*LIBINI_get_shortcut)(const char*, const char*, const char*, uint32_t, const char*, uint32_t) __attribute__((__stdcall__));
 
#endif /* KOLIBRI_LIBINI_H */
/contrib/C_Layer/INCLUDE/kolibri_opendialog.h
0,0 → 1,67
#ifndef KOLIBRI_OPENDIALOG_H
#define KOLIBRI_OPENDIALOG_H
 
char sz_com_area_name[] = "FFFFFFFF_open_dialog";
char sz_dir_default_path[] = "/rd/1";
char sz_start_path[] = "/rd/1/File managers/opendial";
 
struct open_dialog {
unsigned int mode;
unsigned int procinfo;
unsigned int com_area_name;
unsigned int com_area;
unsigned int opendir_path;
unsigned int dir_default_path;
unsigned int start_path;
unsigned int draw_window;
unsigned int status;
unsigned int openfile_path;
unsigned int filename_area;
unsigned int filter_area;
unsigned short x_size;
unsigned short x_start;
unsigned short y_size;
unsigned short y_start;
};
 
struct od_filter {
unsigned int size;
unsigned char end;
};
 
void fake_on_redraw(void) {}
 
struct open_dialog* kolibri_new_open_dialog(unsigned int mode, unsigned short tlx, unsigned short tly, unsigned short x_size, unsigned short y_size)
{
struct open_dialog *new_opendialog = (struct open_dialog *)malloc(sizeof(struct open_dialog));
struct od_filter *new_od_filter = (struct od_filter *)malloc(sizeof(struct od_filter));
char *plugin_path = (char *)calloc(4096, sizeof(char));
char *openfile_path = (char *)calloc(4096, sizeof(char));
char *proc_info = (char *)calloc(1024, sizeof(char));
char *filename_area = (char *)calloc(256, sizeof(char));
new_od_filter -> size = 0;
new_od_filter -> end = 0;
new_opendialog -> mode = mode;
new_opendialog -> procinfo = proc_info;
new_opendialog -> com_area_name = &sz_com_area_name;
new_opendialog -> com_area = 0;
new_opendialog -> opendir_path = plugin_path;
new_opendialog -> dir_default_path = &sz_dir_default_path;
new_opendialog -> start_path = &sz_start_path;
new_opendialog -> draw_window = &fake_on_redraw;
new_opendialog -> status = 0;
new_opendialog -> openfile_path = openfile_path;
new_opendialog -> filename_area = filename_area;
new_opendialog -> filter_area = new_od_filter;
new_opendialog -> x_size = x_size;
new_opendialog -> x_start = tlx;
new_opendialog -> y_size = y_size;
new_opendialog -> y_start = tly;
return new_opendialog;
}
 
extern void (*OpenDialog_init)(struct open_dialog *) __attribute__((__stdcall__));
extern void (*OpenDialog_start)(struct open_dialog *) __attribute__((__stdcall__));
#endif /* KOLIBRI_OPENDIALOG_H */
/contrib/C_Layer/INCLUDE/kolibri_proclib.h
0,0 → 1,22
#ifndef KOLIBRI_PROCLIB_H
#define KOLIBRI_PROCLIB_H
 
int kolibri_proclib_init(void)
{
int asm_init_status = init_proclib_asm();
/* just return asm_init_status? or return init_proclib_asm() ?*/
 
if(asm_init_status == 0)
return 0;
else
return 1;
}
 
enum Mode {
OD_OPEN,
OD_SAVE,
OD_DIR
};
 
#endif /* KOLIBRI_PROCLIB_H */
/contrib/C_Layer/INCLUDE/kolibri_progressbar.h
0,0 → 1,39
#ifndef KOLIBRI_PROGRESSBAR_H
#define KOLIBRI_PROGRESSBAR_H
 
struct progress_bar {
unsigned int value;
unsigned int left;
unsigned int top;
unsigned int width;
unsigned int height;
unsigned int style;
unsigned int min;
unsigned int max;
unsigned int back_color;
unsigned int progress_color;
unsigned int frame_color;
};
 
struct progress_bar* kolibri_new_progress_bar(unsigned int min_value, unsigned int max_value, unsigned int cur_value, unsigned int tlx, unsigned int tly, unsigned int sizex, unsigned int sizey)
{
struct progress_bar *new_progressbar = (struct progress_bar *)malloc(sizeof(struct progress_bar));
new_progressbar -> value = cur_value;
new_progressbar -> left = tlx;
new_progressbar -> top = tly;
new_progressbar -> width = sizex;
new_progressbar -> height = sizey;
new_progressbar -> style = 1;
new_progressbar -> min = min_value;
new_progressbar -> max = max_value;
new_progressbar -> back_color = 0xffffff;
new_progressbar -> progress_color = 0x00ff00;
new_progressbar -> frame_color = 0x000000;
return new_progressbar;
}
 
extern void (*progressbar_draw)(struct progress_bar *) __attribute__((__stdcall__));
extern void (*progressbar_progress)(struct progress_bar *) __attribute__((__stdcall__));
 
#endif /* KOLIBRI_PROGRESSBAR_H */