From 71c1c5bb789f315239a64cb22002088ddcb353b1 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Mon, 30 Apr 2018 01:33:49 +1000 Subject: Text_Displays finished, more things polished --- src/c_fl_color_chooser.cpp | 31 +++-- src/c_fl_color_chooser.h | 36 ++--- src/c_fl_input_choice.cpp | 41 +++--- src/c_fl_input_choice.h | 46 ++++--- src/c_fl_printer.h | 36 ++--- src/c_fl_text_display.cpp | 26 ++++ src/c_fl_text_display.h | 124 +++++++++-------- src/fltk-devices-surfaces-paged-printers.adb | 54 +++++--- src/fltk-devices-surfaces-paged-printers.ads | 28 ++++ src/fltk-text_buffers.ads | 2 +- src/fltk-widgets-groups-color_choosers.adb | 61 +++++++++ src/fltk-widgets-groups-color_choosers.ads | 44 ++++++ src/fltk-widgets-groups-input_choices.adb | 64 ++++++++- src/fltk-widgets-groups-input_choices.ads | 38 ++++++ src/fltk-widgets-groups-text_displays.adb | 193 +++++++++++++++++++++++++-- src/fltk-widgets-groups-text_displays.ads | 158 +++++++++++++++++++++- 16 files changed, 805 insertions(+), 177 deletions(-) (limited to 'src') diff --git a/src/c_fl_color_chooser.cpp b/src/c_fl_color_chooser.cpp index fa34171..86e1014 100644 --- a/src/c_fl_color_chooser.cpp +++ b/src/c_fl_color_chooser.cpp @@ -71,49 +71,60 @@ void free_fl_color_chooser(COLOR_CHOOSER n) { double fl_color_chooser_r(COLOR_CHOOSER n) { - return reinterpret_cast(n)->r(); + return reinterpret_cast(n)->r(); } double fl_color_chooser_g(COLOR_CHOOSER n) { - return reinterpret_cast(n)->g(); + return reinterpret_cast(n)->g(); } double fl_color_chooser_b(COLOR_CHOOSER n) { - return reinterpret_cast(n)->b(); + return reinterpret_cast(n)->b(); } int fl_color_chooser_rgb(COLOR_CHOOSER n, int r, int g, int b) { - return reinterpret_cast(n)->rgb(r,g,b); + return reinterpret_cast(n)->rgb(r,g,b); } double fl_color_chooser_hue(COLOR_CHOOSER n) { - return reinterpret_cast(n)->hue(); + return reinterpret_cast(n)->hue(); } double fl_color_chooser_saturation(COLOR_CHOOSER n) { - return reinterpret_cast(n)->saturation(); + return reinterpret_cast(n)->saturation(); } double fl_color_chooser_value(COLOR_CHOOSER n) { - return reinterpret_cast(n)->value(); + return reinterpret_cast(n)->value(); } int fl_color_chooser_hsv(COLOR_CHOOSER n, int h, int s, int v) { - return reinterpret_cast(n)->hsv(h,s,v); + return reinterpret_cast(n)->hsv(h,s,v); +} + + + + +void fl_color_chooser_hsv2rgb(double h, double s, double v, double &r, double &g, double &b) { + Fl_Color_Chooser::hsv2rgb(h,s,v,r,g,b); +} + +void fl_color_chooser_rgb2hsv(double r, double g, double b, double &h, double &s, double &v) { + Fl_Color_Chooser::rgb2hsv(r,g,b,h,s,v); } int fl_color_chooser_get_mode(COLOR_CHOOSER n) { - return reinterpret_cast(n)->mode(); + return reinterpret_cast(n)->mode(); } void fl_color_chooser_set_mode(COLOR_CHOOSER n, int m) { - reinterpret_cast(n)->mode(m); + reinterpret_cast(n)->mode(m); } diff --git a/src/c_fl_color_chooser.h b/src/c_fl_color_chooser.h index 2948285..f545002 100644 --- a/src/c_fl_color_chooser.h +++ b/src/c_fl_color_chooser.h @@ -11,34 +11,38 @@ typedef void* COLOR_CHOOSER; -extern "C" void color_chooser_set_draw_hook(COLOR_CHOOSER n, void * d); -extern "C" void fl_color_chooser_draw(COLOR_CHOOSER n); -extern "C" void color_chooser_set_handle_hook(COLOR_CHOOSER n, void * h); -extern "C" int fl_color_chooser_handle(COLOR_CHOOSER n, int e); +extern "C" inline void color_chooser_set_draw_hook(COLOR_CHOOSER n, void * d); +extern "C" inline void fl_color_chooser_draw(COLOR_CHOOSER n); +extern "C" inline void color_chooser_set_handle_hook(COLOR_CHOOSER n, void * h); +extern "C" inline int fl_color_chooser_handle(COLOR_CHOOSER n, int e); -extern "C" COLOR_CHOOSER new_fl_color_chooser(int x, int y, int w, int h, char* label); -extern "C" void free_fl_color_chooser(COLOR_CHOOSER n); +extern "C" inline COLOR_CHOOSER new_fl_color_chooser(int x, int y, int w, int h, char* label); +extern "C" inline void free_fl_color_chooser(COLOR_CHOOSER n); -extern "C" double fl_color_chooser_r(COLOR_CHOOSER n); -extern "C" double fl_color_chooser_g(COLOR_CHOOSER n); -extern "C" double fl_color_chooser_b(COLOR_CHOOSER n); -extern "C" int fl_color_chooser_rgb(COLOR_CHOOSER n, int r, int g, int b); +extern "C" inline double fl_color_chooser_r(COLOR_CHOOSER n); +extern "C" inline double fl_color_chooser_g(COLOR_CHOOSER n); +extern "C" inline double fl_color_chooser_b(COLOR_CHOOSER n); +extern "C" inline int fl_color_chooser_rgb(COLOR_CHOOSER n, int r, int g, int b); -extern "C" double fl_color_chooser_hue(COLOR_CHOOSER n); -extern "C" double fl_color_chooser_saturation(COLOR_CHOOSER n); -extern "C" double fl_color_chooser_value(COLOR_CHOOSER n); -extern "C" int fl_color_chooser_hsv(COLOR_CHOOSER n, int h, int s, int v); +extern "C" inline double fl_color_chooser_hue(COLOR_CHOOSER n); +extern "C" inline double fl_color_chooser_saturation(COLOR_CHOOSER n); +extern "C" inline double fl_color_chooser_value(COLOR_CHOOSER n); +extern "C" inline int fl_color_chooser_hsv(COLOR_CHOOSER n, int h, int s, int v); -extern "C" int fl_color_chooser_get_mode(COLOR_CHOOSER n); -extern "C" void fl_color_chooser_set_mode(COLOR_CHOOSER n, int m); +extern "C" inline void fl_color_chooser_hsv2rgb(double h, double s, double v, double &r, double &g, double &b); +extern "C" inline void fl_color_chooser_rgb2hsv(double r, double g, double b, double &h, double &s, double &v); + + +extern "C" inline int fl_color_chooser_get_mode(COLOR_CHOOSER n); +extern "C" inline void fl_color_chooser_set_mode(COLOR_CHOOSER n, int m); #endif diff --git a/src/c_fl_input_choice.cpp b/src/c_fl_input_choice.cpp index a56d836..a48a4bc 100644 --- a/src/c_fl_input_choice.cpp +++ b/src/c_fl_input_choice.cpp @@ -71,66 +71,77 @@ void free_fl_input_choice(INPUT_CHOICE n) { void * fl_input_choice_input(INPUT_CHOICE n) { - return reinterpret_cast(n)->input(); + return reinterpret_cast(n)->input(); } void * fl_input_choice_menubutton(INPUT_CHOICE n) { - return reinterpret_cast(n)->menubutton(); + return reinterpret_cast(n)->menubutton(); +} + + + + +void fl_input_choice_clear(INPUT_CHOICE n) { + reinterpret_cast(n)->clear(); } int fl_input_choice_changed(INPUT_CHOICE n) { - return reinterpret_cast(n)->changed(); + return reinterpret_cast(n)->changed(); } void fl_input_choice_clear_changed(INPUT_CHOICE n) { - reinterpret_cast(n)->clear_changed(); + reinterpret_cast(n)->clear_changed(); +} + +void fl_input_choice_set_changed(INPUT_CHOICE n) { + reinterpret_cast(n)->set_changed(); } int fl_input_choice_get_down_box(INPUT_CHOICE n) { - return reinterpret_cast(n)->down_box(); + return reinterpret_cast(n)->down_box(); } void fl_input_choice_set_down_box(INPUT_CHOICE n, int t) { - reinterpret_cast(n)->down_box(static_cast(t)); + reinterpret_cast(n)->down_box(static_cast(t)); } unsigned int fl_input_choice_get_textcolor(INPUT_CHOICE n) { - return reinterpret_cast(n)->textcolor(); + return reinterpret_cast(n)->textcolor(); } void fl_input_choice_set_textcolor(INPUT_CHOICE n, unsigned int t) { - reinterpret_cast(n)->textcolor(t); + reinterpret_cast(n)->textcolor(t); } int fl_input_choice_get_textfont(INPUT_CHOICE n) { - return reinterpret_cast(n)->textfont(); + return reinterpret_cast(n)->textfont(); } void fl_input_choice_set_textfont(INPUT_CHOICE n, int t) { - reinterpret_cast(n)->textfont(t); + reinterpret_cast(n)->textfont(t); } int fl_input_choice_get_textsize(INPUT_CHOICE n) { - return reinterpret_cast(n)->textsize(); + return reinterpret_cast(n)->textsize(); } void fl_input_choice_set_textsize(INPUT_CHOICE n, int t) { - reinterpret_cast(n)->textsize(t); + reinterpret_cast(n)->textsize(t); } const char * fl_input_choice_get_value(INPUT_CHOICE n) { - return reinterpret_cast(n)->value(); + return reinterpret_cast(n)->value(); } void fl_input_choice_set_value(INPUT_CHOICE n, const char * t) { - reinterpret_cast(n)->value(t); + reinterpret_cast(n)->value(t); } void fl_input_choice_set_value2(INPUT_CHOICE n, int t) { - reinterpret_cast(n)->value(t); + reinterpret_cast(n)->value(t); } diff --git a/src/c_fl_input_choice.h b/src/c_fl_input_choice.h index 8ad700b..2535b93 100644 --- a/src/c_fl_input_choice.h +++ b/src/c_fl_input_choice.h @@ -11,37 +11,41 @@ typedef void* INPUT_CHOICE; -extern "C" void input_choice_set_draw_hook(INPUT_CHOICE n, void * d); -extern "C" void fl_input_choice_draw(INPUT_CHOICE n); -extern "C" void input_choice_set_handle_hook(INPUT_CHOICE n, void * h); -extern "C" int fl_input_choice_handle(INPUT_CHOICE n, int e); +extern "C" inline void input_choice_set_draw_hook(INPUT_CHOICE n, void * d); +extern "C" inline void fl_input_choice_draw(INPUT_CHOICE n); +extern "C" inline void input_choice_set_handle_hook(INPUT_CHOICE n, void * h); +extern "C" inline int fl_input_choice_handle(INPUT_CHOICE n, int e); -extern "C" INPUT_CHOICE new_fl_input_choice(int x, int y, int w, int h, char* label); -extern "C" void free_fl_input_choice(INPUT_CHOICE n); +extern "C" inline INPUT_CHOICE new_fl_input_choice(int x, int y, int w, int h, char* label); +extern "C" inline void free_fl_input_choice(INPUT_CHOICE n); -extern "C" void * fl_input_choice_input(INPUT_CHOICE n); -extern "C" void * fl_input_choice_menubutton(INPUT_CHOICE n); +extern "C" inline void * fl_input_choice_input(INPUT_CHOICE n); +extern "C" inline void * fl_input_choice_menubutton(INPUT_CHOICE n); -extern "C" int fl_input_choice_changed(INPUT_CHOICE n); -extern "C" void fl_input_choice_clear_changed(INPUT_CHOICE n); -extern "C" int fl_input_choice_get_down_box(INPUT_CHOICE n); -extern "C" void fl_input_choice_set_down_box(INPUT_CHOICE n, int t); -extern "C" unsigned int fl_input_choice_get_textcolor(INPUT_CHOICE n); -extern "C" void fl_input_choice_set_textcolor(INPUT_CHOICE n, unsigned int t); -extern "C" int fl_input_choice_get_textfont(INPUT_CHOICE n); -extern "C" void fl_input_choice_set_textfont(INPUT_CHOICE n, int t); -extern "C" int fl_input_choice_get_textsize(INPUT_CHOICE n); -extern "C" void fl_input_choice_set_textsize(INPUT_CHOICE n, int t); -extern "C" const char * fl_input_choice_get_value(INPUT_CHOICE n); -extern "C" void fl_input_choice_set_value(INPUT_CHOICE n, const char * t); -extern "C" void fl_input_choice_set_value2(INPUT_CHOICE n, int t); +extern "C" inline void fl_input_choice_clear(INPUT_CHOICE n); + + +extern "C" inline int fl_input_choice_changed(INPUT_CHOICE n); +extern "C" inline void fl_input_choice_clear_changed(INPUT_CHOICE n); +extern "C" inline void fl_input_choice_set_changed(INPUT_CHOICE n); +extern "C" inline int fl_input_choice_get_down_box(INPUT_CHOICE n); +extern "C" inline void fl_input_choice_set_down_box(INPUT_CHOICE n, int t); +extern "C" inline unsigned int fl_input_choice_get_textcolor(INPUT_CHOICE n); +extern "C" inline void fl_input_choice_set_textcolor(INPUT_CHOICE n, unsigned int t); +extern "C" inline int fl_input_choice_get_textfont(INPUT_CHOICE n); +extern "C" inline void fl_input_choice_set_textfont(INPUT_CHOICE n, int t); +extern "C" inline int fl_input_choice_get_textsize(INPUT_CHOICE n); +extern "C" inline void fl_input_choice_set_textsize(INPUT_CHOICE n, int t); +extern "C" inline const char * fl_input_choice_get_value(INPUT_CHOICE n); +extern "C" inline void fl_input_choice_set_value(INPUT_CHOICE n, const char * t); +extern "C" inline void fl_input_choice_set_value2(INPUT_CHOICE n, int t); #endif diff --git a/src/c_fl_printer.h b/src/c_fl_printer.h index 0ae2499..74abc84 100644 --- a/src/c_fl_printer.h +++ b/src/c_fl_printer.h @@ -11,34 +11,34 @@ typedef void* PRINTER; -extern "C" PRINTER new_fl_printer(void); -extern "C" void free_fl_printer(PRINTER p); +extern "C" inline PRINTER new_fl_printer(void); +extern "C" inline void free_fl_printer(PRINTER p); -extern "C" int fl_printer_start_job(PRINTER p, int c); -extern "C" int fl_printer_start_job2(PRINTER p, int c, int f, int t); -extern "C" void fl_printer_end_job(PRINTER p); -extern "C" int fl_printer_start_page(PRINTER p); -extern "C" int fl_printer_end_page(PRINTER p); +extern "C" inline int fl_printer_start_job(PRINTER p, int c); +extern "C" inline int fl_printer_start_job2(PRINTER p, int c, int f, int t); +extern "C" inline void fl_printer_end_job(PRINTER p); +extern "C" inline int fl_printer_start_page(PRINTER p); +extern "C" inline int fl_printer_end_page(PRINTER p); -extern "C" void fl_printer_margins(PRINTER p, int * l, int * t, int * r, int * b); -extern "C" int fl_printer_printable_rect(PRINTER p, int * w, int * h); -extern "C" void fl_printer_get_origin(PRINTER p, int * x, int * y); -extern "C" void fl_printer_set_origin(PRINTER p, int x, int y); -extern "C" void fl_printer_rotate(PRINTER p, float r); -extern "C" void fl_printer_scale(PRINTER p, float x, float y); -extern "C" void fl_printer_translate(PRINTER p, int x, int y); -extern "C" void fl_printer_untranslate(PRINTER p); +extern "C" inline void fl_printer_margins(PRINTER p, int * l, int * t, int * r, int * b); +extern "C" inline int fl_printer_printable_rect(PRINTER p, int * w, int * h); +extern "C" inline void fl_printer_get_origin(PRINTER p, int * x, int * y); +extern "C" inline void fl_printer_set_origin(PRINTER p, int x, int y); +extern "C" inline void fl_printer_rotate(PRINTER p, float r); +extern "C" inline void fl_printer_scale(PRINTER p, float x, float y); +extern "C" inline void fl_printer_translate(PRINTER p, int x, int y); +extern "C" inline void fl_printer_untranslate(PRINTER p); -extern "C" void fl_printer_print_widget(PRINTER p, void * i, int dx, int dy); -extern "C" void fl_printer_print_window_part(PRINTER p, void * i, int x, int y, int w, int h, int dx, int dy); +extern "C" inline void fl_printer_print_widget(PRINTER p, void * i, int dx, int dy); +extern "C" inline void fl_printer_print_window_part(PRINTER p, void * i, int x, int y, int w, int h, int dx, int dy); -extern "C" void fl_printer_set_current(PRINTER p); +extern "C" inline void fl_printer_set_current(PRINTER p); #endif diff --git a/src/c_fl_text_display.cpp b/src/c_fl_text_display.cpp index 9cc087e..b56f368 100644 --- a/src/c_fl_text_display.cpp +++ b/src/c_fl_text_display.cpp @@ -85,6 +85,20 @@ void fl_text_display_set_buffer(TEXTDISPLAY td, TEXTBUFFER tb) { +void fl_text_display_highlight_data(TEXTDISPLAY td, TEXTBUFFER tb, void * st, int len) { + reinterpret_cast(td)->highlight_data + (reinterpret_cast(tb), reinterpret_cast(st), len, 0, 0, 0); +} + +void fl_text_display_highlight_data2(TEXTDISPLAY td, TEXTBUFFER tb, void * st, int len, char us, void * cb, void * a) { + reinterpret_cast(td)->highlight_data + (reinterpret_cast(tb), reinterpret_cast(st), len, + us, reinterpret_cast(cb), a); +} + + + + double fl_text_display_col_to_x(TEXTDISPLAY td, double c) { return reinterpret_cast(td)->col_to_x(c); } @@ -158,6 +172,10 @@ void fl_text_display_insert(TEXTDISPLAY td, char * i) { reinterpret_cast(td)->insert(i); } +void fl_text_display_overstrike(TEXTDISPLAY td, char * t) { + reinterpret_cast(td)->overstrike(t); +} + int fl_text_display_get_insert_pos(TEXTDISPLAY td) { return reinterpret_cast(td)->insert_position(); } @@ -309,3 +327,11 @@ void fl_text_display_set_scrollbar_width(TEXTDISPLAY td, int w) { reinterpret_cast(td)->scrollbar_width(w); } + + + +void fl_text_display_redisplay_range(TEXTDISPLAY td, int s, int f) { + reinterpret_cast(td)->redisplay_range(s,f); +} + + diff --git a/src/c_fl_text_display.h b/src/c_fl_text_display.h index 3b7e7e3..5d4574b 100644 --- a/src/c_fl_text_display.h +++ b/src/c_fl_text_display.h @@ -13,90 +13,98 @@ typedef void* TEXTDISPLAY; -extern "C" void text_display_set_draw_hook(TEXTDISPLAY td, void * d); -extern "C" void fl_text_display_draw(TEXTDISPLAY td); -extern "C" void text_display_set_handle_hook(TEXTDISPLAY td, void * h); -extern "C" int fl_text_display_handle(TEXTDISPLAY td, int e); +extern "C" inline void text_display_set_draw_hook(TEXTDISPLAY td, void * d); +extern "C" inline void fl_text_display_draw(TEXTDISPLAY td); +extern "C" inline void text_display_set_handle_hook(TEXTDISPLAY td, void * h); +extern "C" inline int fl_text_display_handle(TEXTDISPLAY td, int e); -extern "C" TEXTDISPLAY new_fl_text_display(int x, int y, int w, int h, char* label); -extern "C" void free_fl_text_display(TEXTDISPLAY td); +extern "C" inline TEXTDISPLAY new_fl_text_display(int x, int y, int w, int h, char* label); +extern "C" inline void free_fl_text_display(TEXTDISPLAY td); -extern "C" TEXTBUFFER fl_text_display_get_buffer(TEXTDISPLAY td); -extern "C" void fl_text_display_set_buffer(TEXTDISPLAY td, TEXTBUFFER tb); +extern "C" inline TEXTBUFFER fl_text_display_get_buffer(TEXTDISPLAY td); +extern "C" inline void fl_text_display_set_buffer(TEXTDISPLAY td, TEXTBUFFER tb); -extern "C" double fl_text_display_col_to_x(TEXTDISPLAY td, double c); -extern "C" double fl_text_display_x_to_col(TEXTDISPLAY td, double x); -extern "C" int fl_text_display_in_selection(TEXTDISPLAY td, int x, int y); -extern "C" int fl_text_display_position_to_xy(TEXTDISPLAY td, int p, int * x, int * y); +extern "C" inline void fl_text_display_highlight_data(TEXTDISPLAY td, TEXTBUFFER tb, void * st, int len); +extern "C" inline void fl_text_display_highlight_data2(TEXTDISPLAY td, TEXTBUFFER tb, void * st, int len, char us, void * cb, void * a); -extern "C" unsigned int fl_text_display_get_cursor_color(TEXTDISPLAY td); -extern "C" void fl_text_display_set_cursor_color(TEXTDISPLAY td, unsigned int c); -extern "C" void fl_text_display_set_cursor_style(TEXTDISPLAY td, int s); -extern "C" void fl_text_display_hide_cursor(TEXTDISPLAY td); -extern "C" void fl_text_display_show_cursor(TEXTDISPLAY td); +extern "C" inline double fl_text_display_col_to_x(TEXTDISPLAY td, double c); +extern "C" inline double fl_text_display_x_to_col(TEXTDISPLAY td, double x); +extern "C" inline int fl_text_display_in_selection(TEXTDISPLAY td, int x, int y); +extern "C" inline int fl_text_display_position_to_xy(TEXTDISPLAY td, int p, int * x, int * y); -extern "C" unsigned int fl_text_display_get_text_color(TEXTDISPLAY td); -extern "C" void fl_text_display_set_text_color(TEXTDISPLAY td, unsigned int c); -extern "C" int fl_text_display_get_text_font(TEXTDISPLAY td); -extern "C" void fl_text_display_set_text_font(TEXTDISPLAY td, int f); -extern "C" int fl_text_display_get_text_size(TEXTDISPLAY td); -extern "C" void fl_text_display_set_text_size(TEXTDISPLAY td, int s); +extern "C" inline unsigned int fl_text_display_get_cursor_color(TEXTDISPLAY td); +extern "C" inline void fl_text_display_set_cursor_color(TEXTDISPLAY td, unsigned int c); +extern "C" inline void fl_text_display_set_cursor_style(TEXTDISPLAY td, int s); +extern "C" inline void fl_text_display_hide_cursor(TEXTDISPLAY td); +extern "C" inline void fl_text_display_show_cursor(TEXTDISPLAY td); -extern "C" void fl_text_display_insert(TEXTDISPLAY td, char * i); -extern "C" int fl_text_display_get_insert_pos(TEXTDISPLAY td); -extern "C" void fl_text_display_set_insert_pos(TEXTDISPLAY td, int p); -extern "C" void fl_text_display_show_insert_pos(TEXTDISPLAY td); +extern "C" inline unsigned int fl_text_display_get_text_color(TEXTDISPLAY td); +extern "C" inline void fl_text_display_set_text_color(TEXTDISPLAY td, unsigned int c); +extern "C" inline int fl_text_display_get_text_font(TEXTDISPLAY td); +extern "C" inline void fl_text_display_set_text_font(TEXTDISPLAY td, int f); +extern "C" inline int fl_text_display_get_text_size(TEXTDISPLAY td); +extern "C" inline void fl_text_display_set_text_size(TEXTDISPLAY td, int s); -extern "C" int fl_text_display_word_start(TEXTDISPLAY td, int p); -extern "C" int fl_text_display_word_end(TEXTDISPLAY td, int p); -extern "C" void fl_text_display_next_word(TEXTDISPLAY td); -extern "C" void fl_text_display_previous_word(TEXTDISPLAY td); -extern "C" void fl_text_display_wrap_mode(TEXTDISPLAY td, int w, int m); +extern "C" inline void fl_text_display_insert(TEXTDISPLAY td, char * i); +extern "C" inline void fl_text_display_overstrike(TEXTDISPLAY td, char * t); +extern "C" inline int fl_text_display_get_insert_pos(TEXTDISPLAY td); +extern "C" inline void fl_text_display_set_insert_pos(TEXTDISPLAY td, int p); +extern "C" inline void fl_text_display_show_insert_pos(TEXTDISPLAY td); -extern "C" int fl_text_display_line_start(TEXTDISPLAY td, int s); -extern "C" int fl_text_display_line_end(TEXTDISPLAY td, int s, int p); -extern "C" int fl_text_display_count_lines(TEXTDISPLAY td, int s, int f, int p); -extern "C" int fl_text_display_skip_lines(TEXTDISPLAY td, int s, int l, int p); -extern "C" int fl_text_display_rewind_lines(TEXTDISPLAY td, int s, int l); +extern "C" inline int fl_text_display_word_start(TEXTDISPLAY td, int p); +extern "C" inline int fl_text_display_word_end(TEXTDISPLAY td, int p); +extern "C" inline void fl_text_display_next_word(TEXTDISPLAY td); +extern "C" inline void fl_text_display_previous_word(TEXTDISPLAY td); +extern "C" inline void fl_text_display_wrap_mode(TEXTDISPLAY td, int w, int m); -extern "C" unsigned int fl_text_display_get_linenumber_align(TEXTDISPLAY td); -extern "C" void fl_text_display_set_linenumber_align(TEXTDISPLAY td, unsigned int a); -extern "C" unsigned int fl_text_display_get_linenumber_bgcolor(TEXTDISPLAY td); -extern "C" void fl_text_display_set_linenumber_bgcolor(TEXTDISPLAY td, unsigned int c); -extern "C" unsigned int fl_text_display_get_linenumber_fgcolor(TEXTDISPLAY td); -extern "C" void fl_text_display_set_linenumber_fgcolor(TEXTDISPLAY td, unsigned int c); -extern "C" int fl_text_display_get_linenumber_font(TEXTDISPLAY td); -extern "C" void fl_text_display_set_linenumber_font(TEXTDISPLAY td, int f); -extern "C" int fl_text_display_get_linenumber_size(TEXTDISPLAY td); -extern "C" void fl_text_display_set_linenumber_size(TEXTDISPLAY td, int s); -extern "C" int fl_text_display_get_linenumber_width(TEXTDISPLAY td); -extern "C" void fl_text_display_set_linenumber_width(TEXTDISPLAY td, int w); +extern "C" inline int fl_text_display_line_start(TEXTDISPLAY td, int s); +extern "C" inline int fl_text_display_line_end(TEXTDISPLAY td, int s, int p); +extern "C" inline int fl_text_display_count_lines(TEXTDISPLAY td, int s, int f, int p); +extern "C" inline int fl_text_display_skip_lines(TEXTDISPLAY td, int s, int l, int p); +extern "C" inline int fl_text_display_rewind_lines(TEXTDISPLAY td, int s, int l); -extern "C" int fl_text_display_move_down(TEXTDISPLAY td); -extern "C" int fl_text_display_move_left(TEXTDISPLAY td); -extern "C" int fl_text_display_move_right(TEXTDISPLAY td); -extern "C" int fl_text_display_move_up(TEXTDISPLAY td); +extern "C" inline unsigned int fl_text_display_get_linenumber_align(TEXTDISPLAY td); +extern "C" inline void fl_text_display_set_linenumber_align(TEXTDISPLAY td, unsigned int a); +extern "C" inline unsigned int fl_text_display_get_linenumber_bgcolor(TEXTDISPLAY td); +extern "C" inline void fl_text_display_set_linenumber_bgcolor(TEXTDISPLAY td, unsigned int c); +extern "C" inline unsigned int fl_text_display_get_linenumber_fgcolor(TEXTDISPLAY td); +extern "C" inline void fl_text_display_set_linenumber_fgcolor(TEXTDISPLAY td, unsigned int c); +extern "C" inline int fl_text_display_get_linenumber_font(TEXTDISPLAY td); +extern "C" inline void fl_text_display_set_linenumber_font(TEXTDISPLAY td, int f); +extern "C" inline int fl_text_display_get_linenumber_size(TEXTDISPLAY td); +extern "C" inline void fl_text_display_set_linenumber_size(TEXTDISPLAY td, int s); +extern "C" inline int fl_text_display_get_linenumber_width(TEXTDISPLAY td); +extern "C" inline void fl_text_display_set_linenumber_width(TEXTDISPLAY td, int w); -extern "C" void fl_text_display_scroll(TEXTDISPLAY td, int l); -extern "C" unsigned int fl_text_display_get_scrollbar_align(TEXTDISPLAY td); -extern "C" void fl_text_display_set_scrollbar_align(TEXTDISPLAY td, unsigned int a); -extern "C" int fl_text_display_get_scrollbar_width(TEXTDISPLAY td); -extern "C" void fl_text_display_set_scrollbar_width(TEXTDISPLAY td, int w); +extern "C" inline int fl_text_display_move_down(TEXTDISPLAY td); +extern "C" inline int fl_text_display_move_left(TEXTDISPLAY td); +extern "C" inline int fl_text_display_move_right(TEXTDISPLAY td); +extern "C" inline int fl_text_display_move_up(TEXTDISPLAY td); + + +extern "C" inline void fl_text_display_scroll(TEXTDISPLAY td, int l); +extern "C" inline unsigned int fl_text_display_get_scrollbar_align(TEXTDISPLAY td); +extern "C" inline void fl_text_display_set_scrollbar_align(TEXTDISPLAY td, unsigned int a); +extern "C" inline int fl_text_display_get_scrollbar_width(TEXTDISPLAY td); +extern "C" inline void fl_text_display_set_scrollbar_width(TEXTDISPLAY td, int w); + + +extern "C" inline void fl_text_display_redisplay_range(TEXTDISPLAY td, int s, int f); #endif diff --git a/src/fltk-devices-surfaces-paged-printers.adb b/src/fltk-devices-surfaces-paged-printers.adb index 6114cae..bdc34b0 100644 --- a/src/fltk-devices-surfaces-paged-printers.adb +++ b/src/fltk-devices-surfaces-paged-printers.adb @@ -17,10 +17,12 @@ package body FLTK.Devices.Surfaces.Paged.Printers is function new_fl_printer return System.Address; pragma Import (C, new_fl_printer, "new_fl_printer"); + pragma Inline (new_fl_printer); procedure free_fl_printer (D : in System.Address); pragma Import (C, free_fl_printer, "free_fl_printer"); + pragma Inline (free_fl_printer); @@ -30,26 +32,31 @@ package body FLTK.Devices.Surfaces.Paged.Printers is C : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_printer_start_job, "fl_printer_start_job"); + pragma Inline (fl_printer_start_job); function fl_printer_start_job2 (D : in System.Address; C, F, T : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_printer_start_job2, "fl_printer_start_job2"); + pragma Inline (fl_printer_start_job2); procedure fl_printer_end_job (D : in System.Address); pragma Import (C, fl_printer_end_job, "fl_printer_end_job"); + pragma Inline (fl_printer_end_job); function fl_printer_start_page (D : in System.Address) return Interfaces.C.int; pragma Import (C, fl_printer_start_page, "fl_printer_start_page"); + pragma Inline (fl_printer_start_page); function fl_printer_end_page (D : in System.Address) return Interfaces.C.int; pragma Import (C, fl_printer_end_page, "fl_printer_end_page"); + pragma Inline (fl_printer_end_page); @@ -58,41 +65,49 @@ package body FLTK.Devices.Surfaces.Paged.Printers is (D : in System.Address; L, T, R, B : out Interfaces.C.int); pragma Import (C, fl_printer_margins, "fl_printer_margins"); + pragma Inline (fl_printer_margins); function fl_printer_printable_rect (D : in System.Address; W, H : out Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_printer_printable_rect, "fl_printer_printable_rect"); + pragma Inline (fl_printer_printable_rect); procedure fl_printer_get_origin (D : in System.Address; X, Y : out Interfaces.C.int); pragma Import (C, fl_printer_get_origin, "fl_printer_get_origin"); + pragma Inline (fl_printer_get_origin); procedure fl_printer_set_origin (D : in System.Address; X, Y : in Interfaces.C.int); pragma Import (C, fl_printer_set_origin, "fl_printer_set_origin"); + pragma Inline (fl_printer_set_origin); procedure fl_printer_rotate (D : in System.Address; R : in Interfaces.C.C_float); pragma Import (C, fl_printer_rotate, "fl_printer_rotate"); + pragma Inline (fl_printer_rotate); procedure fl_printer_scale (D : in System.Address; X, Y : in Interfaces.C.C_float); pragma Import (C, fl_printer_scale, "fl_printer_scale"); + pragma Inline (fl_printer_scale); procedure fl_printer_translate (D : in System.Address; X, Y : in Interfaces.C.int); pragma Import (C, fl_printer_translate, "fl_printer_translate"); + pragma Inline (fl_printer_translate); procedure fl_printer_untranslate (D : in System.Address); pragma Import (C, fl_printer_untranslate, "fl_printer_untranslate"); + pragma Inline (fl_printer_untranslate); @@ -101,11 +116,13 @@ package body FLTK.Devices.Surfaces.Paged.Printers is (D, I : in System.Address; DX, DY : in Interfaces.C.int); pragma Import (C, fl_printer_print_widget, "fl_printer_print_widget"); + pragma Inline (fl_printer_print_widget); procedure fl_printer_print_window_part (D, I : in System.Address; X, Y, W, H, DX, DY : in Interfaces.C.int); pragma Import (C, fl_printer_print_window_part, "fl_printer_print_window_part"); + pragma Inline (fl_printer_print_window_part); @@ -113,6 +130,7 @@ package body FLTK.Devices.Surfaces.Paged.Printers is procedure fl_printer_set_current (D : in System.Address); pragma Import (C, fl_printer_set_current, "fl_printer_set_current"); + pragma Inline (fl_printer_set_current); @@ -142,6 +160,8 @@ package body FLTK.Devices.Surfaces.Paged.Printers is end return; end Create; + pragma Inline (Create); + end Forge; @@ -204,42 +224,34 @@ package body FLTK.Devices.Surfaces.Paged.Printers is procedure Get_Margins (This : in Printer; - Left, Top, Right, Bottom : out Integer) - is - L, T, R, B : Interfaces.C.int; + Left, Top, Right, Bottom : out Integer) is begin - fl_printer_margins (This.Void_Ptr, L, T, R, B); - Left := Integer (L); - Top := Integer (T); - Right := Integer (R); - Bottom := Integer (B); + fl_printer_margins + (This.Void_Ptr, + Interfaces.C.int (Left), + Interfaces.C.int (Top), + Interfaces.C.int (Right), + Interfaces.C.int (Bottom)); end Get_Margins; procedure Get_Printable_Rect (This : in Printer; - W, H : out Integer) - is - Wid, Hei : Interfaces.C.int; + W, H : out Integer) is begin - if fl_printer_printable_rect (This.Void_Ptr, Wid, Hei) /= 0 then + if fl_printer_printable_rect + (This.Void_Ptr, Interfaces.C.int (W), Interfaces.C.int (H)) /= 0 + then raise Page_Error; - else - W := Integer (Wid); - H := Integer (Hei); end if; end Get_Printable_Rect; procedure Get_Origin (This : in Printer; - X, Y : out Integer) - is - Eks, Why : Interfaces.C.int; + X, Y : out Integer) is begin - fl_printer_get_origin (This.Void_Ptr, Eks, Why); - X := Integer (Eks); - Y := Integer (Why); + fl_printer_get_origin (This.Void_Ptr, Interfaces.C.int (X), Interfaces.C.int (Y)); end Get_Origin; diff --git a/src/fltk-devices-surfaces-paged-printers.ads b/src/fltk-devices-surfaces-paged-printers.ads index 7eae340..b336373 100644 --- a/src/fltk-devices-surfaces-paged-printers.ads +++ b/src/fltk-devices-surfaces-paged-printers.ads @@ -10,6 +10,9 @@ package FLTK.Devices.Surfaces.Paged.Printers is type Printer is new Paged_Surface with private; + type Printer_Reference (Data : not null access Printer'Class) is limited null record + with Implicit_Dereference => Data; + @@ -109,5 +112,30 @@ private (This : in out Printer); + + + pragma Inline (Start_Job); + pragma Inline (End_Job); + pragma Inline (Start_Page); + pragma Inline (End_Page); + + + pragma Inline (Get_Margins); + pragma Inline (Get_Printable_Rect); + pragma Inline (Get_Origin); + pragma Inline (Set_Origin); + pragma Inline (Rotate); + pragma Inline (Scale); + pragma Inline (Translate); + pragma Inline (Untranslate); + + + pragma Inline (Print_Widget); + pragma Inline (Print_Window_Part); + + + pragma Inline (Set_Current); + + end FLTK.Devices.Surfaces.Paged.Printers; diff --git a/src/fltk-text_buffers.ads b/src/fltk-text_buffers.ads index ea66f6f..a2b5a6a 100644 --- a/src/fltk-text_buffers.ads +++ b/src/fltk-text_buffers.ads @@ -12,7 +12,7 @@ package FLTK.Text_Buffers is type Text_Buffer is new Wrapper with private; - type Text_Buffer_Cursor (Data : access Text_Buffer'Class) is limited null record + type Text_Buffer_Reference (Data : access Text_Buffer'Class) is limited null record with Implicit_Dereference => Data; type Position is new Natural; diff --git a/src/fltk-widgets-groups-color_choosers.adb b/src/fltk-widgets-groups-color_choosers.adb index dabcf00..9d8221b 100644 --- a/src/fltk-widgets-groups-color_choosers.adb +++ b/src/fltk-widgets-groups-color_choosers.adb @@ -17,10 +17,12 @@ package body FLTK.Widgets.Groups.Color_Choosers is procedure color_chooser_set_draw_hook (W, D : in System.Address); pragma Import (C, color_chooser_set_draw_hook, "color_chooser_set_draw_hook"); + pragma Inline (color_chooser_set_draw_hook); procedure color_chooser_set_handle_hook (W, H : in System.Address); pragma Import (C, color_chooser_set_handle_hook, "color_chooser_set_handle_hook"); + pragma Inline (color_chooser_set_handle_hook); @@ -30,10 +32,12 @@ package body FLTK.Widgets.Groups.Color_Choosers is Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_color_chooser, "new_fl_color_chooser"); + pragma Inline (new_fl_color_chooser); procedure free_fl_color_chooser (W : in System.Address); pragma Import (C, free_fl_color_chooser, "free_fl_color_chooser"); + pragma Inline (free_fl_color_chooser); @@ -42,22 +46,26 @@ package body FLTK.Widgets.Groups.Color_Choosers is (N : in System.Address) return Interfaces.C.double; pragma Import (C, fl_color_chooser_r, "fl_color_chooser_r"); + pragma Inline (fl_color_chooser_r); function fl_color_chooser_g (N : in System.Address) return Interfaces.C.double; pragma Import (C, fl_color_chooser_g, "fl_color_chooser_g"); + pragma Inline (fl_color_chooser_g); function fl_color_chooser_b (N : in System.Address) return Interfaces.C.double; pragma Import (C, fl_color_chooser_b, "fl_color_chooser_b"); + pragma Inline (fl_color_chooser_b); function fl_color_chooser_rgb (N : in System.Address; R, G, B : in Interfaces.C.double) return Interfaces.C.int; pragma Import (C, fl_color_chooser_rgb, "fl_color_chooser_rgb"); + pragma Inline (fl_color_chooser_rgb); @@ -66,22 +74,41 @@ package body FLTK.Widgets.Groups.Color_Choosers is (N : in System.Address) return Interfaces.C.double; pragma Import (C, fl_color_chooser_hue, "fl_color_chooser_hue"); + pragma Inline (fl_color_chooser_hue); function fl_color_chooser_saturation (N : in System.Address) return Interfaces.C.double; pragma Import (C, fl_color_chooser_saturation, "fl_color_chooser_saturation"); + pragma Inline (fl_color_chooser_saturation); function fl_color_chooser_value (N : in System.Address) return Interfaces.C.double; pragma Import (C, fl_color_chooser_value, "fl_color_chooser_value"); + pragma Inline (fl_color_chooser_value); function fl_color_chooser_hsv (N : in System.Address; H, S, V : in Interfaces.C.double) return Interfaces.C.int; pragma Import (C, fl_color_chooser_hsv, "fl_color_chooser_hsv"); + pragma Inline (fl_color_chooser_hsv); + + + + + procedure fl_color_chooser_hsv2rgb + (H, S, V : in Interfaces.C.double; + R, G, B : out Interfaces.C.double); + pragma Import (C, fl_color_chooser_hsv2rgb, "fl_color_chooser_hsv2rgb"); + pragma Inline (fl_color_chooser_hsv2rgb); + + procedure fl_color_chooser_rgb2hsv + (R, G, B : in Interfaces.C.double; + H, S, V : out Interfaces.C.double); + pragma Import (C, fl_color_chooser_rgb2hsv, "fl_color_chooser_rgb2hsv"); + pragma Inline (fl_color_chooser_rgb2hsv); @@ -90,11 +117,13 @@ package body FLTK.Widgets.Groups.Color_Choosers is (N : in System.Address) return Interfaces.C.int; pragma Import (C, fl_color_chooser_get_mode, "fl_color_chooser_get_mode"); + pragma Inline (fl_color_chooser_get_mode); procedure fl_color_chooser_set_mode (N : in System.Address; M : in Interfaces.C.int); pragma Import (C, fl_color_chooser_set_mode, "fl_color_chooser_set_mode"); + pragma Inline (fl_color_chooser_set_mode); @@ -102,12 +131,14 @@ package body FLTK.Widgets.Groups.Color_Choosers is procedure fl_color_chooser_draw (W : in System.Address); pragma Import (C, fl_color_chooser_draw, "fl_color_chooser_draw"); + pragma Inline (fl_color_chooser_draw); function fl_color_chooser_handle (W : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_color_chooser_handle, "fl_color_chooser_handle"); + pragma Inline (fl_color_chooser_handle); @@ -232,6 +263,36 @@ package body FLTK.Widgets.Groups.Color_Choosers is + procedure HSV_To_RGB + (H, S, V : in Long_Float; + R, G, B : out Long_Float) is + begin + fl_color_chooser_hsv2rgb + (Interfaces.C.double (H), + Interfaces.C.double (S), + Interfaces.C.double (V), + Interfaces.C.double (R), + Interfaces.C.double (G), + Interfaces.C.double (B)); + end HSV_To_RGB; + + + procedure RGB_To_HSV + (R, G, B : in Long_Float; + H, S, V : out Long_Float) is + begin + fl_color_chooser_rgb2hsv + (Interfaces.C.double (R), + Interfaces.C.double (G), + Interfaces.C.double (B), + Interfaces.C.double (H), + Interfaces.C.double (S), + Interfaces.C.double (V)); + end RGB_To_HSV; + + + + function Color_Was_Changed (This : in Color_Chooser) return Boolean is diff --git a/src/fltk-widgets-groups-color_choosers.ads b/src/fltk-widgets-groups-color_choosers.ads index 3af3fa4..fa26c2d 100644 --- a/src/fltk-widgets-groups-color_choosers.ads +++ b/src/fltk-widgets-groups-color_choosers.ads @@ -5,6 +5,9 @@ package FLTK.Widgets.Groups.Color_Choosers is type Color_Chooser is new Group with private; + type Color_Chooser_Reference (Data : not null access Color_Chooser'Class) is + limited null record with Implicit_Dereference => Data; + type Color_Mode is (RGB, Byte, Hex, HSV); @@ -60,6 +63,17 @@ package FLTK.Widgets.Groups.Color_Choosers is + procedure HSV_To_RGB + (H, S, V : in Long_Float; + R, G, B : out Long_Float); + + procedure RGB_To_HSV + (R, G, B : in Long_Float; + H, S, V : out Long_Float); + + + + function Color_Was_Changed (This : in Color_Chooser) return Boolean; @@ -101,5 +115,35 @@ private (This : in out Color_Chooser); + + + pragma Inline (Get_Red); + pragma Inline (Get_Green); + pragma Inline (Get_Blue); + pragma Inline (Set_RGB); + + + pragma Inline (Get_Hue); + pragma Inline (Get_Saturation); + pragma Inline (Get_Value); + pragma Inline (Set_HSV); + + + pragma Inline (HSV_To_RGB); + pragma Inline (RGB_To_HSV); + + + pragma Inline (Color_Was_Changed); + pragma Inline (Clear_Changed); + + + pragma Inline (Get_Mode); + pragma Inline (Set_Mode); + + + pragma Inline (Draw); + pragma Inline (Handle); + + end FLTK.Widgets.Groups.Color_Choosers; diff --git a/src/fltk-widgets-groups-input_choices.adb b/src/fltk-widgets-groups-input_choices.adb index afda09f..366eade 100644 --- a/src/fltk-widgets-groups-input_choices.adb +++ b/src/fltk-widgets-groups-input_choices.adb @@ -18,10 +18,12 @@ package body FLTK.Widgets.Groups.Input_Choices is procedure input_choice_set_draw_hook (W, D : in System.Address); pragma Import (C, input_choice_set_draw_hook, "input_choice_set_draw_hook"); + pragma Inline (input_choice_set_draw_hook); procedure input_choice_set_handle_hook (W, H : in System.Address); pragma Import (C, input_choice_set_handle_hook, "input_choice_set_handle_hook"); + pragma Inline (input_choice_set_handle_hook); @@ -31,10 +33,12 @@ package body FLTK.Widgets.Groups.Input_Choices is Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_input_choice, "new_fl_input_choice"); + pragma Inline (new_fl_input_choice); procedure free_fl_input_choice (W : in System.Address); pragma Import (C, free_fl_input_choice, "free_fl_input_choice"); + pragma Inline (free_fl_input_choice); @@ -43,11 +47,21 @@ package body FLTK.Widgets.Groups.Input_Choices is (N : in System.Address) return System.Address; pragma Import (C, fl_input_choice_input, "fl_input_choice_input"); + pragma Inline (fl_input_choice_input); function fl_input_choice_menubutton (N : in System.Address) return System.Address; pragma Import (C, fl_input_choice_menubutton, "fl_input_choice_menubutton"); + pragma Inline (fl_input_choice_menubutton); + + + + + procedure fl_input_choice_clear + (N : in System.Address); + pragma Import (C, fl_input_choice_clear, "fl_input_choice_clear"); + pragma Inline (fl_input_choice_clear); @@ -56,65 +70,83 @@ package body FLTK.Widgets.Groups.Input_Choices is (N : in System.Address) return Interfaces.C.int; pragma Import (C, fl_input_choice_changed, "fl_input_choice_changed"); + pragma Inline (fl_input_choice_changed); procedure fl_input_choice_clear_changed (N : in System.Address); pragma Import (C, fl_input_choice_clear_changed, "fl_input_choice_clear_changed"); + pragma Inline (fl_input_choice_clear_changed); + + procedure fl_input_choice_set_changed + (N : in System.Address); + pragma Import (C, fl_input_choice_set_changed, "fl_input_choice_set_changed"); + pragma Inline (fl_input_choice_set_changed); function fl_input_choice_get_down_box (N : in System.Address) return Interfaces.C.int; pragma Import (C, fl_input_choice_get_down_box, "fl_input_choice_get_down_box"); + pragma Inline (fl_input_choice_get_down_box); procedure fl_input_choice_set_down_box (N : in System.Address; T : in Interfaces.C.int); pragma Import (C, fl_input_choice_set_down_box, "fl_input_choice_set_down_box"); + pragma Inline (fl_input_choice_set_down_box); function fl_input_choice_get_textcolor (N : in System.Address) return Interfaces.C.unsigned; pragma Import (C, fl_input_choice_get_textcolor, "fl_input_choice_get_textcolor"); + pragma Inline (fl_input_choice_get_textcolor); procedure fl_input_choice_set_textcolor (N : in System.Address; T : in Interfaces.C.unsigned); pragma Import (C, fl_input_choice_set_textcolor, "fl_input_choice_set_textcolor"); + pragma Inline (fl_input_choice_set_textcolor); function fl_input_choice_get_textfont (N : in System.Address) return Interfaces.C.int; pragma Import (C, fl_input_choice_get_textfont, "fl_input_choice_get_textfont"); + pragma Inline (fl_input_choice_get_textfont); procedure fl_input_choice_set_textfont (N : in System.Address; T : in Interfaces.C.int); pragma Import (C, fl_input_choice_set_textfont, "fl_input_choice_set_textfont"); + pragma Inline (fl_input_choice_set_textfont); function fl_input_choice_get_textsize (N : in System.Address) return Interfaces.C.int; pragma Import (C, fl_input_choice_get_textsize, "fl_input_choice_get_textsize"); + pragma Inline (fl_input_choice_get_textsize); procedure fl_input_choice_set_textsize (N : in System.Address; T : in Interfaces.C.int); pragma Import (C, fl_input_choice_set_textsize, "fl_input_choice_set_textsize"); + pragma Inline (fl_input_choice_set_textsize); function fl_input_choice_get_value (N : in System.Address) return Interfaces.C.Strings.chars_ptr; pragma Import (C, fl_input_choice_get_value, "fl_input_choice_get_value"); + pragma Inline (fl_input_choice_get_value); procedure fl_input_choice_set_value (N : in System.Address; T : in Interfaces.C.char_array); pragma Import (C, fl_input_choice_set_value, "fl_input_choice_set_value"); + pragma Inline (fl_input_choice_set_value); procedure fl_input_choice_set_value2 (N : in System.Address; T : in Interfaces.C.int); pragma Import (C, fl_input_choice_set_value2, "fl_input_choice_set_value2"); + pragma Inline (fl_input_choice_set_value2); @@ -122,12 +154,14 @@ package body FLTK.Widgets.Groups.Input_Choices is procedure fl_input_choice_draw (W : in System.Address); pragma Import (C, fl_input_choice_draw, "fl_input_choice_draw"); + pragma Inline (fl_input_choice_draw); function fl_input_choice_handle (W : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_input_choice_handle, "fl_input_choice_handle"); + pragma Inline (fl_input_choice_handle); @@ -146,7 +180,7 @@ package body FLTK.Widgets.Groups.Input_Choices is if This.Void_Ptr /= System.Null_Address and then This in Input_Choice'Class then - This.Clear; + Group (This).Clear; free_fl_input_choice (This.Void_Ptr); Free (This.My_Input); Free (This.My_Menu_Button); @@ -214,6 +248,15 @@ package body FLTK.Widgets.Groups.Input_Choices is + procedure Clear + (This : in out Input_Choice) is + begin + fl_input_choice_clear (This.Void_Ptr); + end Clear; + + + + function Has_Changed (This : in Input_Choice) return Boolean is @@ -229,6 +272,16 @@ package body FLTK.Widgets.Groups.Input_Choices is end Clear_Changed; + procedure Set_Changed + (This : in out Input_Choice; + To : in Boolean) is + begin + if To then + fl_input_choice_set_changed (This.Void_Ptr); + end if; + end Set_Changed; + + function Get_Down_Box (This : in Input_Choice) return Box_Kind is @@ -295,13 +348,10 @@ package body FLTK.Widgets.Groups.Input_Choices is function Get_Input (This : in Input_Choice) - return String - is - C_Str : Interfaces.C.Strings.chars_ptr := fl_input_choice_get_value (This.Void_Ptr); - The_Text : String := Interfaces.C.Strings.Value (C_Str); + return String is begin - Interfaces.C.Strings.Free (C_Str); - return The_Text; + -- pointer to internal buffer so no free necessary + return Interfaces.C.Strings.Value (fl_input_choice_get_value (This.Void_Ptr)); end Get_Input; diff --git a/src/fltk-widgets-groups-input_choices.ads b/src/fltk-widgets-groups-input_choices.ads index 52fa2d0..b57585d 100644 --- a/src/fltk-widgets-groups-input_choices.ads +++ b/src/fltk-widgets-groups-input_choices.ads @@ -11,6 +11,9 @@ package FLTK.Widgets.Groups.Input_Choices is type Input_Choice is new Group with private; + type Input_Choice_Reference (Data : not null access Input_Choice'Class) is + limited null record with Implicit_Dereference => Data; + @@ -37,6 +40,12 @@ package FLTK.Widgets.Groups.Input_Choices is + procedure Clear + (This : in out Input_Choice); + + + + function Has_Changed (This : in Input_Choice) return Boolean; @@ -44,6 +53,10 @@ package FLTK.Widgets.Groups.Input_Choices is procedure Clear_Changed (This : in out Input_Choice); + procedure Set_Changed + (This : in out Input_Choice; + To : in Boolean); + function Get_Down_Box (This : in Input_Choice) return Box_Kind; @@ -120,5 +133,30 @@ private (This : in out Input_Choice); + + + pragma Inline (Input); + pragma Inline (Menu_Button); + + + pragma Inline (Has_Changed); + pragma Inline (Clear_Changed); + pragma Inline (Get_Down_Box); + pragma Inline (Set_Down_Box); + pragma Inline (Get_Text_Color); + pragma Inline (Set_Text_Color); + pragma Inline (Get_Text_Font); + pragma Inline (Set_Text_Font); + pragma Inline (Get_Text_Size); + pragma Inline (Set_Text_Size); + pragma Inline (Get_Input); + pragma Inline (Set_Input); + pragma Inline (Set_Item); + + + pragma Inline (Draw); + pragma Inline (Handle); + + end FLTK.Widgets.Groups.Input_Choices; diff --git a/src/fltk-widgets-groups-text_displays.adb b/src/fltk-widgets-groups-text_displays.adb index 4548708..a28cdbb 100644 --- a/src/fltk-widgets-groups-text_displays.adb +++ b/src/fltk-widgets-groups-text_displays.adb @@ -18,10 +18,12 @@ package body FLTK.Widgets.Groups.Text_Displays is procedure text_display_set_draw_hook (W, D : in System.Address); pragma Import (C, text_display_set_draw_hook, "text_display_set_draw_hook"); + pragma Inline (text_display_set_draw_hook); procedure text_display_set_handle_hook (W, H : in System.Address); pragma Import (C, text_display_set_handle_hook, "text_display_set_handle_hook"); + pragma Inline (text_display_set_handle_hook); @@ -31,10 +33,12 @@ package body FLTK.Widgets.Groups.Text_Displays is Label : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_text_display, "new_fl_text_display"); + pragma Inline (new_fl_text_display); procedure free_fl_text_display (TD : in System.Address); pragma Import (C, free_fl_text_display, "free_fl_text_display"); + pragma Inline (free_fl_text_display); @@ -43,10 +47,29 @@ package body FLTK.Widgets.Groups.Text_Displays is (TD : in System.Address) return System.Address; pragma Import (C, fl_text_display_get_buffer, "fl_text_display_get_buffer"); + pragma Inline (fl_text_display_get_buffer); procedure fl_text_display_set_buffer (TD, TB : in System.Address); pragma Import (C, fl_text_display_set_buffer, "fl_text_display_set_buffer"); + pragma Inline (fl_text_display_set_buffer); + + + + + procedure fl_text_display_highlight_data + (TD, TB, ST : in System.Address; + L : in Interfaces.C.int); + pragma Import (C, fl_text_display_highlight_data, "fl_text_display_highlight_data"); + pragma Inline (fl_text_display_highlight_data); + + procedure fl_text_display_highlight_data2 + (TD, TB, ST : in System.Address; + L : in Interfaces.C.int; + C : in Interfaces.C.unsigned; + B, A : in System.Address); + pragma Import (C, fl_text_display_highlight_data2, "fl_text_display_highlight_data2"); + pragma Inline (fl_text_display_highlight_data2); @@ -56,18 +79,21 @@ package body FLTK.Widgets.Groups.Text_Displays is C : in Interfaces.C.double) return Interfaces.C.double; pragma Import (C, fl_text_display_col_to_x, "fl_text_display_col_to_x"); + pragma Inline (fl_text_display_col_to_x); function fl_text_display_x_to_col (TD : in System.Address; X : in Interfaces.C.double) return Interfaces.C.double; pragma Import (C, fl_text_display_x_to_col, "fl_text_display_x_to_col"); + pragma Inline (fl_text_display_x_to_col); function fl_text_display_in_selection (TD : in System.Address; X, Y : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_text_display_in_selection, "fl_text_display_in_selection"); + pragma Inline (fl_text_display_in_selection); function fl_text_display_position_to_xy (TD : in System.Address; @@ -75,6 +101,7 @@ package body FLTK.Widgets.Groups.Text_Displays is X, Y : out Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_text_display_position_to_xy, "fl_text_display_position_to_xy"); + pragma Inline (fl_text_display_position_to_xy); @@ -83,24 +110,29 @@ package body FLTK.Widgets.Groups.Text_Displays is (TD : in System.Address) return Interfaces.C.unsigned; pragma Import (C, fl_text_display_get_cursor_color, "fl_text_display_get_cursor_color"); + pragma Inline (fl_text_display_get_cursor_color); procedure fl_text_display_set_cursor_color (TD : in System.Address; C : in Interfaces.C.unsigned); pragma Import (C, fl_text_display_set_cursor_color, "fl_text_display_set_cursor_color"); + pragma Inline (fl_text_display_set_cursor_color); procedure fl_text_display_set_cursor_style (TD : in System.Address; S : in Interfaces.C.int); pragma Import (C, fl_text_display_set_cursor_style, "fl_text_display_set_cursor_style"); + pragma Inline (fl_text_display_set_cursor_style); procedure fl_text_display_hide_cursor (TD : in System.Address); pragma Import (C, fl_text_display_hide_cursor, "fl_text_display_hide_cursor"); + pragma Inline (fl_text_display_hide_cursor); procedure fl_text_display_show_cursor (TD : in System.Address); pragma Import (C, fl_text_display_show_cursor, "fl_text_display_show_cursor"); + pragma Inline (fl_text_display_show_cursor); @@ -109,31 +141,37 @@ package body FLTK.Widgets.Groups.Text_Displays is (TD : in System.Address) return Interfaces.C.unsigned; pragma Import (C, fl_text_display_get_text_color, "fl_text_display_get_text_color"); + pragma Inline (fl_text_display_get_text_color); procedure fl_text_display_set_text_color (TD : in System.Address; C : in Interfaces.C.unsigned); pragma Import (C, fl_text_display_set_text_color, "fl_text_display_set_text_color"); + pragma Inline (fl_text_display_set_text_color); function fl_text_display_get_text_font (TD : in System.Address) return Interfaces.C.int; pragma Import (C, fl_text_display_get_text_font, "fl_text_display_get_text_font"); + pragma Inline (fl_text_display_get_text_font); procedure fl_text_display_set_text_font (TD : in System.Address; F : in Interfaces.C.int); pragma Import (C, fl_text_display_set_text_font, "fl_text_display_set_text_font"); + pragma Inline (fl_text_display_set_text_font); function fl_text_display_get_text_size (TD : in System.Address) return Interfaces.C.int; pragma Import (C, fl_text_display_get_text_size, "fl_text_display_get_text_size"); + pragma Inline (fl_text_display_get_text_size); procedure fl_text_display_set_text_size (TD : in System.Address; S : in Interfaces.C.int); pragma Import (C, fl_text_display_set_text_size, "fl_text_display_set_text_size"); + pragma Inline (fl_text_display_set_text_size); @@ -142,20 +180,30 @@ package body FLTK.Widgets.Groups.Text_Displays is (TD : in System.Address; I : in Interfaces.C.char_array); pragma Import (C, fl_text_display_insert, "fl_text_display_insert"); + pragma Inline (fl_text_display_insert); + + procedure fl_text_display_overstrike + (TD : in System.Address; + T : in Interfaces.C.char_array); + pragma Import (C, fl_text_display_overstrike, "fl_text_display_overstrike"); + pragma Inline (fl_text_display_overstrike); function fl_text_display_get_insert_pos (TD : in System.Address) return Interfaces.C.int; pragma Import (C, fl_text_display_get_insert_pos, "fl_text_display_get_insert_pos"); + pragma Inline (fl_text_display_get_insert_pos); procedure fl_text_display_set_insert_pos (TD : in System.Address; P : in Interfaces.C.int); pragma Import (C, fl_text_display_set_insert_pos, "fl_text_display_set_insert_pos"); + pragma Inline (fl_text_display_set_insert_pos); procedure fl_text_display_show_insert_pos (TD : in System.Address); pragma Import (C, fl_text_display_show_insert_pos, "fl_text_display_show_insert_pos"); + pragma Inline (fl_text_display_show_insert_pos); @@ -165,25 +213,30 @@ package body FLTK.Widgets.Groups.Text_Displays is P : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_text_display_word_start, "fl_text_display_word_start"); + pragma Inline (fl_text_display_word_start); function fl_text_display_word_end (TD : in System.Address; P : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_text_display_word_end, "fl_text_display_word_end"); + pragma Inline (fl_text_display_word_end); procedure fl_text_display_next_word (TD : in System.Address); pragma Import (C, fl_text_display_next_word, "fl_text_display_next_word"); + pragma Inline (fl_text_display_next_word); procedure fl_text_display_previous_word (TD : in System.Address); pragma Import (C, fl_text_display_previous_word, "fl_text_display_previous_word"); + pragma Inline (fl_text_display_previous_word); procedure fl_text_display_wrap_mode (TD : in System.Address; W, M : in Interfaces.C.int); pragma Import (C, fl_text_display_wrap_mode, "fl_text_display_wrap_mode"); + pragma Inline (fl_text_display_wrap_mode); @@ -193,30 +246,35 @@ package body FLTK.Widgets.Groups.Text_Displays is S : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_text_display_line_start, "fl_text_display_line_start"); + pragma Inline (fl_text_display_line_start); function fl_text_display_line_end (TD : in System.Address; S, P : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_text_display_line_end, "fl_text_display_line_end"); + pragma Inline (fl_text_display_line_end); function fl_text_display_count_lines (TD : in System.Address; S, F, P : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_text_display_count_lines, "fl_text_display_count_lines"); + pragma Inline (fl_text_display_count_lines); function fl_text_display_skip_lines (TD : in System.Address; S, L, P : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_text_display_skip_lines, "fl_text_display_skip_lines"); + pragma Inline (fl_text_display_skip_lines); function fl_text_display_rewind_lines (TD : in System.Address; S, L : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_text_display_rewind_lines, "fl_text_display_rewind_lines"); + pragma Inline (fl_text_display_rewind_lines); @@ -226,72 +284,84 @@ package body FLTK.Widgets.Groups.Text_Displays is return Interfaces.C.unsigned; pragma Import (C, fl_text_display_get_linenumber_align, "fl_text_display_get_linenumber_align"); + pragma Inline (fl_text_display_get_linenumber_align); procedure fl_text_display_set_linenumber_align (TD : in System.Address; A : in Interfaces.C.unsigned); pragma Import (C, fl_text_display_set_linenumber_align, "fl_text_display_set_linenumber_align"); + pragma Inline (fl_text_display_set_linenumber_align); function fl_text_display_get_linenumber_bgcolor (TD : in System.Address) return Interfaces.C.unsigned; pragma Import (C, fl_text_display_get_linenumber_bgcolor, "fl_text_display_get_linenumber_bgcolor"); + pragma Inline (fl_text_display_get_linenumber_bgcolor); procedure fl_text_display_set_linenumber_bgcolor (TD : in System.Address; C : in Interfaces.C.unsigned); pragma Import (C, fl_text_display_set_linenumber_bgcolor, "fl_text_display_set_linenumber_bgcolor"); + pragma Inline (fl_text_display_set_linenumber_bgcolor); function fl_text_display_get_linenumber_fgcolor (TD : in System.Address) return Interfaces.C.unsigned; pragma Import (C, fl_text_display_get_linenumber_fgcolor, "fl_text_display_get_linenumber_fgcolor"); + pragma Inline (fl_text_display_get_linenumber_fgcolor); procedure fl_text_display_set_linenumber_fgcolor (TD : in System.Address; C : in Interfaces.C.unsigned); pragma Import (C, fl_text_display_set_linenumber_fgcolor, "fl_text_display_set_linenumber_fgcolor"); + pragma Inline (fl_text_display_set_linenumber_fgcolor); function fl_text_display_get_linenumber_font (TD : in System.Address) return Interfaces.C.int; pragma Import (C, fl_text_display_get_linenumber_font, "fl_text_display_get_linenumber_font"); + pragma Inline (fl_text_display_get_linenumber_font); procedure fl_text_display_set_linenumber_font (TD : in System.Address; F : in Interfaces.C.int); pragma Import (C, fl_text_display_set_linenumber_font, "fl_text_display_set_linenumber_font"); + pragma Inline (fl_text_display_set_linenumber_font); function fl_text_display_get_linenumber_size (TD : in System.Address) return Interfaces.C.int; pragma Import (C, fl_text_display_get_linenumber_size, "fl_text_display_get_linenumber_size"); + pragma Inline (fl_text_display_get_linenumber_size); procedure fl_text_display_set_linenumber_size (TD : in System.Address; S : in Interfaces.C.int); pragma Import (C, fl_text_display_set_linenumber_size, "fl_text_display_set_linenumber_size"); + pragma Inline (fl_text_display_set_linenumber_size); function fl_text_display_get_linenumber_width (TD : in System.Address) return Interfaces.C.int; pragma Import (C, fl_text_display_get_linenumber_width, "fl_text_display_get_linenumber_width"); + pragma Inline (fl_text_display_get_linenumber_width); procedure fl_text_display_set_linenumber_width (TD : in System.Address; W : in Interfaces.C.int); pragma Import (C, fl_text_display_set_linenumber_width, "fl_text_display_set_linenumber_width"); + pragma Inline (fl_text_display_set_linenumber_width); @@ -300,21 +370,25 @@ package body FLTK.Widgets.Groups.Text_Displays is (TD : in System.Address) return Interfaces.C.int; pragma Import (C, fl_text_display_move_down, "fl_text_display_move_down"); + pragma Inline (fl_text_display_move_down); function fl_text_display_move_left (TD : in System.Address) return Interfaces.C.int; pragma Import (C, fl_text_display_move_left, "fl_text_display_move_left"); + pragma Inline (fl_text_display_move_left); function fl_text_display_move_right (TD : in System.Address) return Interfaces.C.int; pragma Import (C, fl_text_display_move_right, "fl_text_display_move_right"); + pragma Inline (fl_text_display_move_right); function fl_text_display_move_up (TD : in System.Address) return Interfaces.C.int; pragma Import (C, fl_text_display_move_up, "fl_text_display_move_up"); + pragma Inline (fl_text_display_move_up); @@ -323,39 +397,69 @@ package body FLTK.Widgets.Groups.Text_Displays is (TD : in System.Address; L : in Interfaces.C.int); pragma Import (C, fl_text_display_scroll, "fl_text_display_scroll"); + pragma Inline (fl_text_display_scroll); function fl_text_display_get_scrollbar_align (TD : in System.Address) return Interfaces.C.unsigned; pragma Import (C, fl_text_display_get_scrollbar_align, "fl_text_display_get_scrollbar_align"); + pragma Inline (fl_text_display_get_scrollbar_align); procedure fl_text_display_set_scrollbar_align (TD : in System.Address; A : in Interfaces.C.unsigned); pragma Import (C, fl_text_display_set_scrollbar_align, "fl_text_display_set_scrollbar_align"); + pragma Inline (fl_text_display_set_scrollbar_align); function fl_text_display_get_scrollbar_width (TD : in System.Address) return Interfaces.C.int; pragma Import (C, fl_text_display_get_scrollbar_width, "fl_text_display_get_scrollbar_width"); + pragma Inline (fl_text_display_get_scrollbar_width); procedure fl_text_display_set_scrollbar_width (TD : in System.Address; W : in Interfaces.C.int); pragma Import (C, fl_text_display_set_scrollbar_width, "fl_text_display_set_scrollbar_width"); + pragma Inline (fl_text_display_set_scrollbar_width); + + procedure fl_text_display_redisplay_range + (TD : in System.Address; + S, F : in Interfaces.C.int); + pragma Import (C, fl_text_display_redisplay_range, "fl_text_display_redisplay_range"); + pragma Inline (fl_text_display_redisplay_range); procedure fl_text_display_draw (W : in System.Address); pragma Import (C, fl_text_display_draw, "fl_text_display_draw"); + pragma Inline (fl_text_display_draw); function fl_text_display_handle (W : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_text_display_handle, "fl_text_display_handle"); + pragma Inline (fl_text_display_handle); + + + + + procedure Style_Hook + (C : in Interfaces.C.int; + D : in System.Address) + is + use Styles; -- for maximum stylin' + + Ada_Widget : access Text_Display'Class := + Text_Display_Convert.To_Pointer (D); + begin + if Ada_Widget.Style_Callback /= null then + Ada_Widget.Style_Callback (Character'Val (C), Text_Display (Ada_Widget.all)); + end if; + end Style_Hook; @@ -404,11 +508,34 @@ package body FLTK.Widgets.Groups.Text_Displays is + package body Styles is + + function Item + (Tint : in Color; + Font : in Font_Kind; + Size : in Font_Size) + return Style_Entry is + begin + return This : Style_Entry do + This.Attr := 0; + This.Col := Interfaces.C.unsigned (Tint); + This.Font := Font_Kind'Pos (Font); + This.Size := Interfaces.C.int (Size); + end return; + end Item; + + pragma Inline (Item); + + end Styles; + + + + function Get_Buffer (This : in Text_Display) - return FLTK.Text_Buffers.Text_Buffer_Cursor is + return FLTK.Text_Buffers.Text_Buffer_Reference is begin - return Ref : FLTK.Text_Buffers.Text_Buffer_Cursor (This.Buffer); + return Ref : FLTK.Text_Buffers.Text_Buffer_Reference (This.Buffer); end Get_Buffer; @@ -423,6 +550,40 @@ package body FLTK.Widgets.Groups.Text_Displays is + procedure Highlight_Data + (This : in out Text_Display; + Buff : in out FLTK.Text_Buffers.Text_Buffer; + Table : in Styles.Style_Array) is + begin + fl_text_display_highlight_data + (This.Void_Ptr, + Wrapper (Buff).Void_Ptr, + Table'Address, + Table'Length); + end Highlight_Data; + + + procedure Highlight_Data + (This : in out Text_Display; + Buff : in out FLTK.Text_Buffers.Text_Buffer; + Table : in Styles.Style_Array; + Unfinished : in Styles.Style_Index; + Callback : in Styles.Unfinished_Style_Callback) is + begin + This.Style_Callback := Callback; + fl_text_display_highlight_data2 + (This.Void_Ptr, + Wrapper (Buff).Void_Ptr, + Table'Address, + Table'Length, + Character'Pos (Character (Unfinished)), + Style_Hook'Address, + This'Address); + end Highlight_Data; + + + + function Col_To_X (This : in Text_Display; Col_Num : in Integer) @@ -457,16 +618,13 @@ package body FLTK.Widgets.Groups.Text_Displays is (This : in Text_Display; Pos : in Integer; X, Y : out Integer; - Vert_Out : out Boolean) - is - Raw_X, Raw_Y : Interfaces.C.int; + Vert_Out : out Boolean) is begin Vert_Out := fl_text_display_position_to_xy (This.Void_Ptr, Interfaces.C.int (Pos), - Raw_X, Raw_Y) /= 0; - X := Integer (Raw_X); - Y := Integer (Raw_Y); + Interfaces.C.int (X), + Interfaces.C.int (Y)) /= 0; end Position_To_XY; @@ -570,6 +728,14 @@ package body FLTK.Widgets.Groups.Text_Displays is end Insert_Text; + procedure Overstrike + (This : in out Text_Display; + Text : in String) is + begin + fl_text_display_overstrike (This.Void_Ptr, Interfaces.C.To_C (Text)); + end Overstrike; + + function Get_Insert_Position (This : in Text_Display) return Natural is @@ -905,6 +1071,17 @@ package body FLTK.Widgets.Groups.Text_Displays is + procedure Redisplay_Range + (This : in out Text_Display; + Start, Finish : in Natural) is + begin + fl_text_display_redisplay_range + (This.Void_Ptr, + Interfaces.C.int (Start), + Interfaces.C.int (Finish)); + end Redisplay_Range; + + procedure Draw (This : in out Text_Display) is begin diff --git a/src/fltk-widgets-groups-text_displays.ads b/src/fltk-widgets-groups-text_displays.ads index 6262125..332af44 100644 --- a/src/fltk-widgets-groups-text_displays.ads +++ b/src/fltk-widgets-groups-text_displays.ads @@ -4,13 +4,22 @@ with FLTK.Text_Buffers; +private with + + Interfaces.C, + System.Address_To_Access_Conversions; + package FLTK.Widgets.Groups.Text_Displays is type Text_Display is new Group with private; + type Text_Display_Reference (Data : not null access Text_Display'Class) is + limited null record with Implicit_Dereference => Data; + type Wrap_Mode is (None, Column, Pixel, Bounds); + type Cursor_Style is (Normal, Caret, Dim, Block, Heavy, Simple); Bounds_Error : exception; @@ -30,9 +39,42 @@ package FLTK.Widgets.Groups.Text_Displays is + package Styles is + + type Style_Entry is private; + type Style_Index is new Character range 'A' .. '~'; + type Style_Array is array (Style_Index range <>) of Style_Entry; + + type Unfinished_Style_Callback is access procedure + (Char : in Character; + Display : in out Text_Display); + + function Item + (Tint : in Color; + Font : in Font_Kind; + Size : in Font_Size) + return Style_Entry; + + private + + type Style_Entry is record + Attr : Interfaces.C.unsigned; + Col : Interfaces.C.unsigned; + Font : Interfaces.C.int; + Size : Interfaces.C.int; + end record; + + pragma Convention (C, Style_Entry); + pragma Convention (C, Style_Array); + + end Styles; + + + + function Get_Buffer (This : in Text_Display) - return FLTK.Text_Buffers.Text_Buffer_Cursor; + return FLTK.Text_Buffers.Text_Buffer_Reference; procedure Set_Buffer (This : in out Text_Display; @@ -41,6 +83,21 @@ package FLTK.Widgets.Groups.Text_Displays is + procedure Highlight_Data + (This : in out Text_Display; + Buff : in out FLTK.Text_Buffers.Text_Buffer; + Table : in Styles.Style_Array); + + procedure Highlight_Data + (This : in out Text_Display; + Buff : in out FLTK.Text_Buffers.Text_Buffer; + Table : in Styles.Style_Array; + Unfinished : in Styles.Style_Index; + Callback : in Styles.Unfinished_Style_Callback); + + + + function Col_To_X (This : in Text_Display; Col_Num : in Integer) @@ -117,6 +174,10 @@ package FLTK.Widgets.Groups.Text_Displays is (This : in out Text_Display; Item : in String); + procedure Overstrike + (This : in out Text_Display; + Text : in String); + function Get_Insert_Position (This : in Text_Display) return Natural; @@ -279,6 +340,10 @@ package FLTK.Widgets.Groups.Text_Displays is + procedure Redisplay_Range + (This : in out Text_Display; + Start, Finish : in Natural); + procedure Draw (This : in out Text_Display); @@ -293,12 +358,101 @@ private type Text_Display is new Group with record - Buffer : access FLTK.Text_Buffers.Text_Buffer; + Buffer : access FLTK.Text_Buffers.Text_Buffer; + Style_Callback : Styles.Unfinished_Style_Callback; end record; overriding procedure Finalize (This : in out Text_Display); + + + package Text_Display_Convert is new System.Address_To_Access_Conversions (Text_Display'Class); + + + + + pragma Inline (Get_Buffer); + pragma Inline (Set_Buffer); + + + pragma Inline (Highlight_Data); + + + pragma Inline (Col_To_X); + pragma Inline (X_To_Col); + pragma Inline (In_Selection); + pragma Inline (Position_To_XY); + + + pragma Inline (Get_Cursor_Color); + pragma Inline (Set_Cursor_Color); + pragma Inline (Set_Cursor_Style); + pragma Inline (Hide_Cursor); + pragma Inline (Show_Cursor); + + + pragma Inline (Get_Text_Color); + pragma Inline (Set_Text_Color); + pragma Inline (Get_Text_Font); + pragma Inline (Set_Text_Font); + pragma Inline (Get_Text_Size); + pragma Inline (Set_Text_Size); + + + pragma Inline (Insert_Text); + pragma Inline (Overstrike); + pragma Inline (Get_Insert_Position); + pragma Inline (Set_Insert_Position); + pragma Inline (Show_Insert_Position); + + + pragma Inline (Word_Start); + pragma Inline (Word_End); + pragma Inline (Next_Word); + pragma Inline (Previous_Word); + pragma Inline (Set_Wrap_Mode); + + + pragma Inline (Line_Start); + pragma Inline (Line_End); + pragma Inline (Count_Lines); + pragma Inline (Skip_Lines); + pragma Inline (Rewind_Lines); + + + pragma Inline (Get_Linenumber_Alignment); + pragma Inline (Set_Linenumber_Alignment); + pragma Inline (Get_Linenumber_Back_Color); + pragma Inline (Set_Linenumber_Back_Color); + pragma Inline (Get_Linenumber_Fore_Color); + pragma Inline (Set_Linenumber_Fore_Color); + pragma Inline (Get_Linenumber_Font); + pragma Inline (Set_Linenumber_Font); + pragma Inline (Get_Linenumber_Size); + pragma Inline (Set_Linenumber_Size); + pragma Inline (Get_Linenumber_Width); + pragma Inline (Set_Linenumber_Width); + + + pragma Inline (Move_Down); + pragma Inline (Move_Left); + pragma Inline (Move_Right); + pragma Inline (Move_Up); + + + pragma Inline (Scroll_To); + pragma Inline (Get_Scrollbar_Alignment); + pragma Inline (Set_Scrollbar_Alignment); + pragma Inline (Get_Scrollbar_Width); + pragma Inline (Set_Scrollbar_Width); + + + pragma Inline (Redisplay_Range); + pragma Inline (Draw); + pragma Inline (Handle); + + end FLTK.Widgets.Groups.Text_Displays; -- cgit