summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2018-05-09 23:28:04 +1000
committerJed Barber <jjbarber@y7mail.com>2018-05-09 23:28:04 +1000
commitcdcf5839899276b041b56b70798055f0d438bbdb (patch)
tree8f6637b3dfdbd92ab7d8b520b85aa7132290983d /src
parentf18aa62c78dd25851d47b611f564a14fabb5a5e2 (diff)
Text_Editor key bindings hopefully fixed, yet more polishing
Diffstat (limited to 'src')
-rw-r--r--src/c_fl_graphics_driver.cpp18
-rw-r--r--src/c_fl_graphics_driver.h18
-rw-r--r--src/c_fl_preferences.h40
-rw-r--r--src/c_fl_surface.cpp3
-rw-r--r--src/c_fl_surface.h8
-rw-r--r--src/c_fl_text_editor.h114
-rw-r--r--src/fltk-devices-graphics.adb9
-rw-r--r--src/fltk-devices-graphics.ads19
-rw-r--r--src/fltk-devices-surfaces.adb4
-rw-r--r--src/fltk-devices-surfaces.ads11
-rw-r--r--src/fltk-environment.adb21
-rw-r--r--src/fltk-environment.ads23
-rw-r--r--src/fltk-widgets-groups-text_displays-text_editors.adb212
-rw-r--r--src/fltk-widgets-groups-text_displays-text_editors.ads114
14 files changed, 432 insertions, 182 deletions
diff --git a/src/c_fl_graphics_driver.cpp b/src/c_fl_graphics_driver.cpp
index 187ece9..73112b4 100644
--- a/src/c_fl_graphics_driver.cpp
+++ b/src/c_fl_graphics_driver.cpp
@@ -15,19 +15,23 @@ unsigned int fl_graphics_driver_color(GRAPHICS_DRIVER g) {
int fl_graphics_driver_descent(GRAPHICS_DRIVER g) {
- return reinterpret_cast<Fl_Graphics_Driver*>(g)->descent();
+ // virtual so disable dispatch
+ return reinterpret_cast<Fl_Graphics_Driver*>(g)->Fl_Graphics_Driver::descent();
}
int fl_graphics_driver_height(GRAPHICS_DRIVER g) {
- return reinterpret_cast<Fl_Graphics_Driver*>(g)->height();
+ // virtual so disable dispatch
+ return reinterpret_cast<Fl_Graphics_Driver*>(g)->Fl_Graphics_Driver::height();
}
double fl_graphics_driver_width(GRAPHICS_DRIVER g, unsigned int c) {
- return reinterpret_cast<Fl_Graphics_Driver*>(g)->width(c);
+ // virtual so disable dispatch
+ return reinterpret_cast<Fl_Graphics_Driver*>(g)->Fl_Graphics_Driver::width(c);
}
double fl_graphics_driver_width2(GRAPHICS_DRIVER g, const char * s, int l) {
- return reinterpret_cast<Fl_Graphics_Driver*>(g)->width(s,l);
+ // virtual so disable dispatch
+ return reinterpret_cast<Fl_Graphics_Driver*>(g)->Fl_Graphics_Driver::width(s,l);
}
int fl_graphics_driver_get_font(GRAPHICS_DRIVER g) {
@@ -39,14 +43,16 @@ int fl_graphics_driver_size(GRAPHICS_DRIVER g) {
}
void fl_graphics_driver_set_font(GRAPHICS_DRIVER g, int f, int s) {
- reinterpret_cast<Fl_Graphics_Driver*>(g)->font(f,s);
+ // virtual so disable dispatch
+ reinterpret_cast<Fl_Graphics_Driver*>(g)->Fl_Graphics_Driver::font(f,s);
}
void fl_graphics_driver_draw_scaled(GRAPHICS_DRIVER g, void * i, int x, int y, int w, int h) {
- reinterpret_cast<Fl_Graphics_Driver*>(g)->draw_scaled(reinterpret_cast<Fl_Image*>(i),x,y,w,h);
+ // virtual so disable dispatch
+ reinterpret_cast<Fl_Graphics_Driver*>(g)->Fl_Graphics_Driver::draw_scaled(reinterpret_cast<Fl_Image*>(i),x,y,w,h);
}
diff --git a/src/c_fl_graphics_driver.h b/src/c_fl_graphics_driver.h
index d255400..545a300 100644
--- a/src/c_fl_graphics_driver.h
+++ b/src/c_fl_graphics_driver.h
@@ -11,19 +11,19 @@ typedef void* GRAPHICS_DRIVER;
-extern "C" unsigned int fl_graphics_driver_color(GRAPHICS_DRIVER g);
+extern "C" inline unsigned int fl_graphics_driver_color(GRAPHICS_DRIVER g);
-extern "C" int fl_graphics_driver_descent(GRAPHICS_DRIVER g);
-extern "C" int fl_graphics_driver_height(GRAPHICS_DRIVER g);
-extern "C" double fl_graphics_driver_width(GRAPHICS_DRIVER g, unsigned int c);
-extern "C" double fl_graphics_driver_width2(GRAPHICS_DRIVER g, const char * s, int l);
-extern "C" int fl_graphics_driver_get_font(GRAPHICS_DRIVER g);
-extern "C" int fl_graphics_driver_size(GRAPHICS_DRIVER g);
-extern "C" void fl_graphics_driver_set_font(GRAPHICS_DRIVER g, int f, int s);
+extern "C" inline int fl_graphics_driver_descent(GRAPHICS_DRIVER g);
+extern "C" inline int fl_graphics_driver_height(GRAPHICS_DRIVER g);
+extern "C" inline double fl_graphics_driver_width(GRAPHICS_DRIVER g, unsigned int c);
+extern "C" inline double fl_graphics_driver_width2(GRAPHICS_DRIVER g, const char * s, int l);
+extern "C" inline int fl_graphics_driver_get_font(GRAPHICS_DRIVER g);
+extern "C" inline int fl_graphics_driver_size(GRAPHICS_DRIVER g);
+extern "C" inline void fl_graphics_driver_set_font(GRAPHICS_DRIVER g, int f, int s);
-extern "C" void fl_graphics_driver_draw_scaled(GRAPHICS_DRIVER g, void * i, int x, int y, int w, int h);
+extern "C" inline void fl_graphics_driver_draw_scaled(GRAPHICS_DRIVER g, void * i, int x, int y, int w, int h);
#endif
diff --git a/src/c_fl_preferences.h b/src/c_fl_preferences.h
index e8581c2..9bda444 100644
--- a/src/c_fl_preferences.h
+++ b/src/c_fl_preferences.h
@@ -11,38 +11,38 @@ typedef void* PREFS;
-extern "C" PREFS new_fl_preferences(char * p, char * v, char * a);
-extern "C" void free_fl_preferences(PREFS e);
+extern "C" inline PREFS new_fl_preferences(char * p, char * v, char * a);
+extern "C" inline void free_fl_preferences(PREFS e);
-extern "C" int fl_preferences_entries(PREFS e);
-extern "C" const char * fl_preferences_entry(PREFS e, int i);
-extern "C" int fl_preferences_entryexists(PREFS e, const char * k);
-extern "C" int fl_preferences_size(PREFS e, const char * k);
+extern "C" inline int fl_preferences_entries(PREFS e);
+extern "C" inline const char * fl_preferences_entry(PREFS e, int i);
+extern "C" inline int fl_preferences_entryexists(PREFS e, const char * k);
+extern "C" inline int fl_preferences_size(PREFS e, const char * k);
-extern "C" int fl_preferences_get_int(PREFS e, const char * k, int& v, int d);
-extern "C" int fl_preferences_get_float(PREFS e, const char * k, float& v, float d);
-extern "C" int fl_preferences_get_double(PREFS e, const char * k, double& v, double d);
-extern "C" int fl_preferences_get_str(PREFS e, const char * k, char *& v, const char * d);
+extern "C" inline int fl_preferences_get_int(PREFS e, const char * k, int& v, int d);
+extern "C" inline int fl_preferences_get_float(PREFS e, const char * k, float& v, float d);
+extern "C" inline int fl_preferences_get_double(PREFS e, const char * k, double& v, double d);
+extern "C" inline int fl_preferences_get_str(PREFS e, const char * k, char *& v, const char * d);
-extern "C" int fl_preferences_set_int(PREFS e, const char * k, int v);
-extern "C" int fl_preferences_set_float(PREFS e, const char * k, float v);
-extern "C" int fl_preferences_set_float_prec(PREFS e, const char * k, float v, int p);
-extern "C" int fl_preferences_set_double(PREFS e, const char * k, double v);
-extern "C" int fl_preferences_set_double_prec(PREFS e, const char * k, double v, int p);
-extern "C" int fl_preferences_set_str(PREFS e, const char * k, const char * v);
+extern "C" inline int fl_preferences_set_int(PREFS e, const char * k, int v);
+extern "C" inline int fl_preferences_set_float(PREFS e, const char * k, float v);
+extern "C" inline int fl_preferences_set_float_prec(PREFS e, const char * k, float v, int p);
+extern "C" inline int fl_preferences_set_double(PREFS e, const char * k, double v);
+extern "C" inline int fl_preferences_set_double_prec(PREFS e, const char * k, double v, int p);
+extern "C" inline int fl_preferences_set_str(PREFS e, const char * k, const char * v);
-extern "C" int fl_preferences_deleteentry(PREFS e, const char * k);
-extern "C" int fl_preferences_deleteallentries(PREFS e);
-extern "C" int fl_preferences_clear(PREFS e);
+extern "C" inline int fl_preferences_deleteentry(PREFS e, const char * k);
+extern "C" inline int fl_preferences_deleteallentries(PREFS e);
+extern "C" inline int fl_preferences_clear(PREFS e);
-extern "C" void fl_preferences_flush(PREFS e);
+extern "C" inline void fl_preferences_flush(PREFS e);
#endif
diff --git a/src/c_fl_surface.cpp b/src/c_fl_surface.cpp
index 89d661f..ea37c9e 100644
--- a/src/c_fl_surface.cpp
+++ b/src/c_fl_surface.cpp
@@ -28,7 +28,8 @@ void free_fl_surface(SURFACE s) {
void fl_surface_set_current(SURFACE s) {
- reinterpret_cast<Fl_Surface_Device*>(s)->set_current();
+ // virtual so disable dispatch
+ reinterpret_cast<Fl_Surface_Device*>(s)->Fl_Surface_Device::set_current();
}
SURFACE fl_surface_get_surface(void) {
diff --git a/src/c_fl_surface.h b/src/c_fl_surface.h
index dd8d8e9..c763709 100644
--- a/src/c_fl_surface.h
+++ b/src/c_fl_surface.h
@@ -11,14 +11,14 @@ typedef void* SURFACE;
-extern "C" SURFACE new_fl_surface(void * g);
-extern "C" void free_fl_surface(SURFACE s);
+extern "C" inline SURFACE new_fl_surface(void * g);
+extern "C" inline void free_fl_surface(SURFACE s);
-extern "C" void fl_surface_set_current(SURFACE s);
-extern "C" SURFACE fl_surface_get_surface(void);
+extern "C" inline void fl_surface_set_current(SURFACE s);
+extern "C" inline SURFACE fl_surface_get_surface(void);
#endif
diff --git a/src/c_fl_text_editor.h b/src/c_fl_text_editor.h
index 5f73cbc..0fabaff 100644
--- a/src/c_fl_text_editor.h
+++ b/src/c_fl_text_editor.h
@@ -11,89 +11,89 @@ typedef void* TEXTEDITOR;
-extern "C" void text_editor_set_draw_hook(TEXTEDITOR te, void * d);
-extern "C" void fl_text_editor_draw(TEXTEDITOR te);
-extern "C" void text_editor_set_handle_hook(TEXTEDITOR te, void * h);
-extern "C" int fl_text_editor_handle(TEXTEDITOR te, int e);
+extern "C" inline void text_editor_set_draw_hook(TEXTEDITOR te, void * d);
+extern "C" inline void fl_text_editor_draw(TEXTEDITOR te);
+extern "C" inline void text_editor_set_handle_hook(TEXTEDITOR te, void * h);
+extern "C" inline int fl_text_editor_handle(TEXTEDITOR te, int e);
-extern "C" TEXTEDITOR new_fl_text_editor(int x, int y, int w, int h, char* label);
-extern "C" void free_fl_text_editor(TEXTEDITOR te);
+extern "C" inline TEXTEDITOR new_fl_text_editor(int x, int y, int w, int h, char* label);
+extern "C" inline void free_fl_text_editor(TEXTEDITOR te);
-extern "C" void fl_text_editor_default(TEXTEDITOR te, int k);
+extern "C" inline void fl_text_editor_default(TEXTEDITOR te, int k);
-extern "C" void fl_text_editor_undo(TEXTEDITOR te);
-extern "C" void fl_text_editor_cut(TEXTEDITOR te);
-extern "C" void fl_text_editor_copy(TEXTEDITOR te);
-extern "C" void fl_text_editor_paste(TEXTEDITOR te);
-extern "C" void fl_text_editor_delete(TEXTEDITOR te);
-extern "C" void fl_text_editor_select_all(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_undo(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_cut(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_copy(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_paste(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_delete(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_select_all(TEXTEDITOR te);
-extern "C" void fl_text_editor_backspace(TEXTEDITOR te);
-extern "C" void fl_text_editor_insert(TEXTEDITOR te);
-extern "C" void fl_text_editor_enter(TEXTEDITOR te);
-extern "C" void fl_text_editor_ignore(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_backspace(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_insert(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_enter(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_ignore(TEXTEDITOR te);
-extern "C" void fl_text_editor_home(TEXTEDITOR te);
-extern "C" void fl_text_editor_end(TEXTEDITOR te);
-extern "C" void fl_text_editor_page_down(TEXTEDITOR te);
-extern "C" void fl_text_editor_page_up(TEXTEDITOR te);
-extern "C" void fl_text_editor_down(TEXTEDITOR te);
-extern "C" void fl_text_editor_left(TEXTEDITOR te);
-extern "C" void fl_text_editor_right(TEXTEDITOR te);
-extern "C" void fl_text_editor_up(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_home(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_end(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_page_down(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_page_up(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_down(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_left(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_right(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_up(TEXTEDITOR te);
-extern "C" void fl_text_editor_shift_home(TEXTEDITOR te);
-extern "C" void fl_text_editor_shift_end(TEXTEDITOR te);
-extern "C" void fl_text_editor_shift_page_down(TEXTEDITOR te);
-extern "C" void fl_text_editor_shift_page_up(TEXTEDITOR te);
-extern "C" void fl_text_editor_shift_down(TEXTEDITOR te);
-extern "C" void fl_text_editor_shift_left(TEXTEDITOR te);
-extern "C" void fl_text_editor_shift_right(TEXTEDITOR te);
-extern "C" void fl_text_editor_shift_up(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_shift_home(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_shift_end(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_shift_page_down(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_shift_page_up(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_shift_down(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_shift_left(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_shift_right(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_shift_up(TEXTEDITOR te);
-extern "C" void fl_text_editor_ctrl_home(TEXTEDITOR te);
-extern "C" void fl_text_editor_ctrl_end(TEXTEDITOR te);
-extern "C" void fl_text_editor_ctrl_page_down(TEXTEDITOR te);
-extern "C" void fl_text_editor_ctrl_page_up(TEXTEDITOR te);
-extern "C" void fl_text_editor_ctrl_down(TEXTEDITOR te);
-extern "C" void fl_text_editor_ctrl_left(TEXTEDITOR te);
-extern "C" void fl_text_editor_ctrl_right(TEXTEDITOR te);
-extern "C" void fl_text_editor_ctrl_up(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_ctrl_home(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_ctrl_end(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_ctrl_page_down(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_ctrl_page_up(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_ctrl_down(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_ctrl_left(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_ctrl_right(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_ctrl_up(TEXTEDITOR te);
-extern "C" void fl_text_editor_ctrl_shift_home(TEXTEDITOR te);
-extern "C" void fl_text_editor_ctrl_shift_end(TEXTEDITOR te);
-extern "C" void fl_text_editor_ctrl_shift_page_down(TEXTEDITOR te);
-extern "C" void fl_text_editor_ctrl_shift_page_up(TEXTEDITOR te);
-extern "C" void fl_text_editor_ctrl_shift_down(TEXTEDITOR te);
-extern "C" void fl_text_editor_ctrl_shift_left(TEXTEDITOR te);
-extern "C" void fl_text_editor_ctrl_shift_right(TEXTEDITOR te);
-extern "C" void fl_text_editor_ctrl_shift_up(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_ctrl_shift_home(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_ctrl_shift_end(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_ctrl_shift_page_down(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_ctrl_shift_page_up(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_ctrl_shift_down(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_ctrl_shift_left(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_ctrl_shift_right(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_ctrl_shift_up(TEXTEDITOR te);
-extern "C" void fl_text_editor_add_key_binding(TEXTEDITOR te, int k, int s, void * f);
-extern "C" void fl_text_editor_remove_key_binding(TEXTEDITOR te, int k, int s);
-extern "C" void fl_text_editor_remove_all_key_bindings(TEXTEDITOR te);
-extern "C" void fl_text_editor_set_default_key_function(TEXTEDITOR te, void * f);
+extern "C" inline void fl_text_editor_add_key_binding(TEXTEDITOR te, int k, int s, void * f);
+extern "C" inline void fl_text_editor_remove_key_binding(TEXTEDITOR te, int k, int s);
+extern "C" inline void fl_text_editor_remove_all_key_bindings(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_set_default_key_function(TEXTEDITOR te, void * f);
-extern "C" int fl_text_editor_get_insert_mode(TEXTEDITOR te);
-extern "C" void fl_text_editor_set_insert_mode(TEXTEDITOR te, int i);
+extern "C" inline int fl_text_editor_get_insert_mode(TEXTEDITOR te);
+extern "C" inline void fl_text_editor_set_insert_mode(TEXTEDITOR te, int i);
-//extern "C" int fl_text_editor_get_tab_nav(TEXTEDITOR te);
-//extern "C" void fl_text_editor_set_tab_nav(TEXTEDITOR te, int t);
+//extern "C" inline int fl_text_editor_get_tab_nav(TEXTEDITOR te);
+//extern "C" inline void fl_text_editor_set_tab_nav(TEXTEDITOR te, int t);
#endif
diff --git a/src/fltk-devices-graphics.adb b/src/fltk-devices-graphics.adb
index 1341d67..e267690 100644
--- a/src/fltk-devices-graphics.adb
+++ b/src/fltk-devices-graphics.adb
@@ -13,6 +13,7 @@ package body FLTK.Devices.Graphics is
(G : in System.Address)
return Interfaces.C.unsigned;
pragma Import (C, fl_graphics_driver_color, "fl_graphics_driver_color");
+ pragma Inline (fl_graphics_driver_color);
@@ -21,17 +22,20 @@ package body FLTK.Devices.Graphics is
(G : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_graphics_driver_descent, "fl_graphics_driver_descent");
+ pragma Inline (fl_graphics_driver_descent);
function fl_graphics_driver_height
(G : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_graphics_driver_height, "fl_graphics_driver_height");
+ pragma Inline (fl_graphics_driver_height);
function fl_graphics_driver_width
(G : in System.Address;
C : in Interfaces.C.unsigned)
return Interfaces.C.double;
pragma Import (C, fl_graphics_driver_width, "fl_graphics_driver_width");
+ pragma Inline (fl_graphics_driver_width);
function fl_graphics_driver_width2
(G : in System.Address;
@@ -39,21 +43,25 @@ package body FLTK.Devices.Graphics is
L : in Interfaces.C.int)
return Interfaces.C.double;
pragma Import (C, fl_graphics_driver_width2, "fl_graphics_driver_width2");
+ pragma Inline (fl_graphics_driver_width2);
function fl_graphics_driver_get_font
(G : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_graphics_driver_get_font, "fl_graphics_driver_get_font");
+ pragma Inline (fl_graphics_driver_get_font);
function fl_graphics_driver_size
(G : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_graphics_driver_size, "fl_graphics_driver_size");
+ pragma Inline (fl_graphics_driver_size);
procedure fl_graphics_driver_set_font
(G : in System.Address;
K, S : in Interfaces.C.int);
pragma Import (C, fl_graphics_driver_set_font, "fl_graphics_driver_set_font");
+ pragma Inline (fl_graphics_driver_set_font);
@@ -62,6 +70,7 @@ package body FLTK.Devices.Graphics is
(G, I : in System.Address;
X, Y, W, H : in Interfaces.C.int);
pragma Import (C, fl_graphics_driver_draw_scaled, "fl_graphics_driver_draw_scaled");
+ pragma Inline (fl_graphics_driver_draw_scaled);
diff --git a/src/fltk-devices-graphics.ads b/src/fltk-devices-graphics.ads
index b407da4..abb6c5f 100644
--- a/src/fltk-devices-graphics.ads
+++ b/src/fltk-devices-graphics.ads
@@ -10,6 +10,9 @@ package FLTK.Devices.Graphics is
type Graphics_Driver is new Device with private;
+ type Graphics_Driver_Reference (Data : not null access Graphics_Driver'Class) is
+ limited null record with Implicit_Dereference => Data;
+
@@ -66,5 +69,21 @@ private
type Graphics_Driver is new Device with null record;
+
+
+ pragma Inline (Get_Color);
+
+
+ pragma Inline (Get_Text_Descent);
+ pragma Inline (Get_Line_Height);
+ pragma Inline (Get_Width);
+ pragma Inline (Get_Font_Kind);
+ pragma Inline (Get_Font_Size);
+ pragma Inline (Set_Font);
+
+
+ pragma Inline (Draw_Scaled_Image);
+
+
end FLTK.Devices.Graphics;
diff --git a/src/fltk-devices-surfaces.adb b/src/fltk-devices-surfaces.adb
index 7b95bec..400bd87 100644
--- a/src/fltk-devices-surfaces.adb
+++ b/src/fltk-devices-surfaces.adb
@@ -16,10 +16,12 @@ package body FLTK.Devices.Surfaces is
(G : in System.Address)
return System.Address;
pragma Import (C, new_fl_surface, "new_fl_surface");
+ pragma Inline (new_fl_surface);
procedure free_fl_surface
(S : in System.Address);
pragma Import (C, free_fl_surface, "free_fl_surface");
+ pragma Inline (free_fl_surface);
@@ -27,10 +29,12 @@ package body FLTK.Devices.Surfaces is
procedure fl_surface_set_current
(S : in System.Address);
pragma Import (C, fl_surface_set_current, "fl_surface_set_current");
+ pragma Inline (fl_surface_set_current);
function fl_surface_get_surface
return System.Address;
pragma Import (C, fl_surface_get_surface, "fl_surface_get_surface");
+ pragma Inline (fl_surface_get_surface);
diff --git a/src/fltk-devices-surfaces.ads b/src/fltk-devices-surfaces.ads
index 418903e..24a2838 100644
--- a/src/fltk-devices-surfaces.ads
+++ b/src/fltk-devices-surfaces.ads
@@ -10,6 +10,9 @@ package FLTK.Devices.Surfaces is
type Surface_Device is new Device with private;
+ type Surface_Device_Reference (Data : not null access Surface_Device'Class) is
+ limited null record with Implicit_Dereference => Data;
+
@@ -40,9 +43,17 @@ private
(This : in out Surface_Device);
+
+
Original_Surface : aliased Surface_Device;
Current_Ptr : access Surface_Device'Class := Original_Surface'Access;
+
+
+ pragma Inline (Get_Current);
+ pragma Inline (Set_Current);
+
+
end FLTK.Devices.Surfaces;
diff --git a/src/fltk-environment.adb b/src/fltk-environment.adb
index 22a0bd9..1c4cf28 100644
--- a/src/fltk-environment.adb
+++ b/src/fltk-environment.adb
@@ -18,10 +18,12 @@ package body FLTK.Environment is
(P, V, A : in Interfaces.C.char_array)
return System.Address;
pragma Import (C, new_fl_preferences, "new_fl_preferences");
+ pragma Inline (new_fl_preferences);
procedure free_fl_preferences
(E : in System.Address);
pragma Import (C, free_fl_preferences, "free_fl_preferences");
+ pragma Inline (free_fl_preferences);
@@ -30,24 +32,28 @@ package body FLTK.Environment is
(E : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_preferences_entries, "fl_preferences_entries");
+ pragma Inline (fl_preferences_entries);
function fl_preferences_entry
(E : in System.Address;
I : in Interfaces.C.int)
return Interfaces.C.Strings.chars_ptr;
pragma Import (C, fl_preferences_entry, "fl_preferences_entry");
+ pragma Inline (fl_preferences_entry);
function fl_preferences_entryexists
(E : in System.Address;
K : in Interfaces.C.char_array)
return Interfaces.C.int;
pragma Import (C, fl_preferences_entryexists, "fl_preferences_entryexists");
+ pragma Inline (fl_preferences_entryexists);
function fl_preferences_size
(E : in System.Address;
K : in Interfaces.C.char_array)
return Interfaces.C.int;
pragma Import (C, fl_preferences_size, "fl_preferences_size");
+ pragma Inline (fl_preferences_size);
@@ -59,6 +65,7 @@ package body FLTK.Environment is
D : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_preferences_get_int, "fl_preferences_get_int");
+ pragma Inline (fl_preferences_get_int);
function fl_preferences_get_float
(E : in System.Address;
@@ -67,6 +74,7 @@ package body FLTK.Environment is
D : in Interfaces.C.C_float)
return Interfaces.C.int;
pragma Import (C, fl_preferences_get_float, "fl_preferences_get_float");
+ pragma Inline (fl_preferences_get_float);
function fl_preferences_get_double
(E : in System.Address;
@@ -75,6 +83,7 @@ package body FLTK.Environment is
D : in Interfaces.C.double)
return Interfaces.C.int;
pragma Import (C, fl_preferences_get_double, "fl_preferences_get_double");
+ pragma Inline (fl_preferences_get_double);
function fl_preferences_get_str
(E : in System.Address;
@@ -83,6 +92,7 @@ package body FLTK.Environment is
D : in Interfaces.C.char_array)
return Interfaces.C.int;
pragma Import (C, fl_preferences_get_str, "fl_preferences_get_str");
+ pragma Inline (fl_preferences_get_str);
@@ -93,6 +103,7 @@ package body FLTK.Environment is
V : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_preferences_set_int, "fl_preferences_set_int");
+ pragma Inline (fl_preferences_set_int);
function fl_preferences_set_float
(E : in System.Address;
@@ -100,6 +111,7 @@ package body FLTK.Environment is
V : in Interfaces.C.C_float)
return Interfaces.C.int;
pragma Import (C, fl_preferences_set_float, "fl_preferences_set_float");
+ pragma Inline (fl_preferences_set_float);
function fl_preferences_set_float_prec
(E : in System.Address;
@@ -108,6 +120,7 @@ package body FLTK.Environment is
P : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_preferences_set_float_prec, "fl_preferences_set_float_prec");
+ pragma Inline (fl_preferences_set_float_prec);
function fl_preferences_set_double
(E : in System.Address;
@@ -115,6 +128,7 @@ package body FLTK.Environment is
V : in Interfaces.C.double)
return Interfaces.C.int;
pragma Import (C, fl_preferences_set_double, "fl_preferences_set_double");
+ pragma Inline (fl_preferences_set_double);
function fl_preferences_set_double_prec
(E : in System.Address;
@@ -123,6 +137,7 @@ package body FLTK.Environment is
P : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_preferences_set_double_prec, "fl_preferences_set_double_prec");
+ pragma Inline (fl_preferences_set_double_prec);
function fl_preferences_set_str
(E : in System.Address;
@@ -130,6 +145,7 @@ package body FLTK.Environment is
V : in Interfaces.C.char_array)
return Interfaces.C.int;
pragma Import (C, fl_preferences_set_str, "fl_preferences_set_str");
+ pragma Inline (fl_preferences_set_str);
@@ -139,16 +155,19 @@ package body FLTK.Environment is
K : in Interfaces.C.char_array)
return Interfaces.C.int;
pragma Import (C, fl_preferences_deleteentry, "fl_preferences_deleteentry");
+ pragma Inline (fl_preferences_deleteentry);
function fl_preferences_deleteallentries
(E : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_preferences_deleteallentries, "fl_preferences_deleteallentries");
+ pragma Inline (fl_preferences_deleteallentries);
function fl_preferences_clear
(E : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_preferences_clear, "fl_preferences_clear");
+ pragma Inline (fl_preferences_clear);
@@ -156,6 +175,7 @@ package body FLTK.Environment is
procedure fl_preferences_flush
(E : in System.Address);
pragma Import (C, fl_preferences_flush, "fl_preferences_flush");
+ pragma Inline (fl_preferences_flush);
@@ -210,6 +230,7 @@ package body FLTK.Environment is
fl_preferences_entry (This.Void_Ptr, Interfaces.C.int (Index));
Str : String := Interfaces.C.Strings.Value (Key);
begin
+ -- no need for dealloc?
return Str;
end Get_Key;
diff --git a/src/fltk-environment.ads b/src/fltk-environment.ads
index a163d19..cfa63a8 100644
--- a/src/fltk-environment.ads
+++ b/src/fltk-environment.ads
@@ -5,6 +5,9 @@ package FLTK.Environment is
type Preferences is new Wrapper with private;
+ type Preferences_Reference (Data : not null access Preferences'Class) is
+ limited null record with Implicit_Dereference => Data;
+
type Scope is (Root, User);
@@ -159,5 +162,25 @@ private
(This : in out Preferences);
+
+
+ pragma Inline (Number_Of_Entries);
+ pragma Inline (Get_Key);
+ pragma Inline (Entry_Exists);
+ pragma Inline (Entry_Size);
+
+
+ pragma Inline (Get);
+ pragma Inline (Set);
+
+
+ pragma Inline (Delete_Entry);
+ pragma Inline (Delete_All_Entries);
+ pragma Inline (Clear);
+
+
+ pragma Inline (Flush);
+
+
end FLTK.Environment;
diff --git a/src/fltk-widgets-groups-text_displays-text_editors.adb b/src/fltk-widgets-groups-text_displays-text_editors.adb
index f467862..9d0f51b 100644
--- a/src/fltk-widgets-groups-text_displays-text_editors.adb
+++ b/src/fltk-widgets-groups-text_displays-text_editors.adb
@@ -2,11 +2,13 @@
with
+ FLTK.Event,
Interfaces.C,
System;
use type
+ Interfaces.C.unsigned_long,
System.Address;
@@ -16,10 +18,12 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
procedure text_editor_set_draw_hook
(W, D : in System.Address);
pragma Import (C, text_editor_set_draw_hook, "text_editor_set_draw_hook");
+ pragma Inline (text_editor_set_draw_hook);
procedure text_editor_set_handle_hook
(W, H : in System.Address);
pragma Import (C, text_editor_set_handle_hook, "text_editor_set_handle_hook");
+ pragma Inline (text_editor_set_handle_hook);
@@ -29,10 +33,12 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
Text : in Interfaces.C.char_array)
return System.Address;
pragma Import (C, new_fl_text_editor, "new_fl_text_editor");
+ pragma Inline (new_fl_text_editor);
procedure free_fl_text_editor
(TE : in System.Address);
pragma Import (C, free_fl_text_editor, "free_fl_text_editor");
+ pragma Inline (free_fl_text_editor);
@@ -41,6 +47,7 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
(TE : in System.Address;
K : in Interfaces.C.int);
pragma Import (C, fl_text_editor_default, "fl_text_editor_default");
+ pragma Inline (fl_text_editor_default);
@@ -48,26 +55,32 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
procedure fl_text_editor_undo
(TE : in System.Address);
pragma Import (C, fl_text_editor_undo, "fl_text_editor_undo");
+ pragma Inline (fl_text_editor_undo);
procedure fl_text_editor_cut
(TE : in System.Address);
pragma Import (C, fl_text_editor_cut, "fl_text_editor_cut");
+ pragma Inline (fl_text_editor_cut);
procedure fl_text_editor_copy
(TE : in System.Address);
pragma Import (C, fl_text_editor_copy, "fl_text_editor_copy");
+ pragma Inline (fl_text_editor_copy);
procedure fl_text_editor_paste
(TE : in System.Address);
pragma Import (C, fl_text_editor_paste, "fl_text_editor_paste");
+ pragma Inline (fl_text_editor_paste);
procedure fl_text_editor_delete
(TE : in System.Address);
pragma Import (C, fl_text_editor_delete, "fl_text_editor_delete");
+ pragma Inline (fl_text_editor_delete);
procedure fl_text_editor_select_all
(TE : in System.Address);
pragma Import (C, fl_text_editor_select_all, "fl_text_editor_select_all");
+ pragma Inline (fl_text_editor_select_all);
@@ -75,18 +88,22 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
procedure fl_text_editor_backspace
(TE : in System.Address);
pragma Import (C, fl_text_editor_backspace, "fl_text_editor_backspace");
+ pragma Inline (fl_text_editor_backspace);
procedure fl_text_editor_insert
(TE : in System.Address);
pragma Import (C, fl_text_editor_insert, "fl_text_editor_insert");
+ pragma Inline (fl_text_editor_insert);
procedure fl_text_editor_enter
(TE : in System.Address);
pragma Import (C, fl_text_editor_enter, "fl_text_editor_enter");
+ pragma Inline (fl_text_editor_enter);
procedure fl_text_editor_ignore
(TE : in System.Address);
pragma Import (C, fl_text_editor_ignore, "fl_text_editor_ignore");
+ pragma Inline (fl_text_editor_ignore);
@@ -94,34 +111,42 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
procedure fl_text_editor_home
(TE : in System.Address);
pragma Import (C, fl_text_editor_home, "fl_text_editor_home");
+ pragma Inline (fl_text_editor_home);
procedure fl_text_editor_end
(TE : in System.Address);
pragma Import (C, fl_text_editor_end, "fl_text_editor_end");
+ pragma Inline (fl_text_editor_end);
procedure fl_text_editor_page_down
(TE : in System.Address);
pragma Import (C, fl_text_editor_page_down, "fl_text_editor_page_down");
+ pragma Inline (fl_text_editor_page_down);
procedure fl_text_editor_page_up
(TE : in System.Address);
pragma Import (C, fl_text_editor_page_up, "fl_text_editor_page_up");
+ pragma Inline (fl_text_editor_page_up);
procedure fl_text_editor_down
(TE : in System.Address);
pragma Import (C, fl_text_editor_down, "fl_text_editor_down");
+ pragma Inline (fl_text_editor_down);
procedure fl_text_editor_left
(TE : in System.Address);
pragma Import (C, fl_text_editor_left, "fl_text_editor_left");
+ pragma Inline (fl_text_editor_left);
procedure fl_text_editor_right
(TE : in System.Address);
pragma Import (C, fl_text_editor_right, "fl_text_editor_right");
+ pragma Inline (fl_text_editor_right);
procedure fl_text_editor_up
(TE : in System.Address);
pragma Import (C, fl_text_editor_up, "fl_text_editor_up");
+ pragma Inline (fl_text_editor_up);
@@ -129,34 +154,42 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
procedure fl_text_editor_shift_home
(TE : in System.Address);
pragma Import (C, fl_text_editor_shift_home, "fl_text_editor_shift_home");
+ pragma Inline (fl_text_editor_shift_home);
procedure fl_text_editor_shift_end
(TE : in System.Address);
pragma Import (C, fl_text_editor_shift_end, "fl_text_editor_shift_end");
+ pragma Inline (fl_text_editor_shift_end);
procedure fl_text_editor_shift_page_down
(TE : in System.Address);
pragma Import (C, fl_text_editor_shift_page_down, "fl_text_editor_shift_page_down");
+ pragma Inline (fl_text_editor_shift_page_down);
procedure fl_text_editor_shift_page_up
(TE : in System.Address);
pragma Import (C, fl_text_editor_shift_page_up, "fl_text_editor_shift_page_up");
+ pragma Inline (fl_text_editor_shift_page_up);
procedure fl_text_editor_shift_down
(TE : in System.Address);
pragma Import (C, fl_text_editor_shift_down, "fl_text_editor_shift_down");
+ pragma Inline (fl_text_editor_shift_down);
procedure fl_text_editor_shift_left
(TE : in System.Address);
pragma Import (C, fl_text_editor_shift_left, "fl_text_editor_shift_left");
+ pragma Inline (fl_text_editor_shift_left);
procedure fl_text_editor_shift_right
(TE : in System.Address);
pragma Import (C, fl_text_editor_shift_right, "fl_text_editor_shift_right");
+ pragma Inline (fl_text_editor_shift_right);
procedure fl_text_editor_shift_up
(TE : in System.Address);
pragma Import (C, fl_text_editor_shift_up, "fl_text_editor_shift_up");
+ pragma Inline (fl_text_editor_shift_up);
@@ -164,34 +197,42 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
procedure fl_text_editor_ctrl_home
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_home, "fl_text_editor_ctrl_home");
+ pragma Inline (fl_text_editor_ctrl_home);
procedure fl_text_editor_ctrl_end
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_end, "fl_text_editor_ctrl_end");
+ pragma Inline (fl_text_editor_ctrl_end);
procedure fl_text_editor_ctrl_page_down
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_page_down, "fl_text_editor_ctrl_page_down");
+ pragma Inline (fl_text_editor_ctrl_page_down);
procedure fl_text_editor_ctrl_page_up
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_page_up, "fl_text_editor_ctrl_page_up");
+ pragma Inline (fl_text_editor_ctrl_page_up);
procedure fl_text_editor_ctrl_down
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_down, "fl_text_editor_ctrl_down");
+ pragma Inline (fl_text_editor_ctrl_down);
procedure fl_text_editor_ctrl_left
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_left, "fl_text_editor_ctrl_left");
+ pragma Inline (fl_text_editor_ctrl_left);
procedure fl_text_editor_ctrl_right
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_right, "fl_text_editor_ctrl_right");
+ pragma Inline (fl_text_editor_ctrl_right);
procedure fl_text_editor_ctrl_up
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_up, "fl_text_editor_ctrl_up");
+ pragma Inline (fl_text_editor_ctrl_up);
@@ -199,34 +240,42 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
procedure fl_text_editor_ctrl_shift_home
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_shift_home, "fl_text_editor_ctrl_shift_home");
+ pragma Inline (fl_text_editor_ctrl_shift_home);
procedure fl_text_editor_ctrl_shift_end
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_shift_end, "fl_text_editor_ctrl_shift_end");
+ pragma Inline (fl_text_editor_ctrl_shift_end);
procedure fl_text_editor_ctrl_shift_page_down
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_shift_page_down, "fl_text_editor_ctrl_shift_page_down");
+ pragma Inline (fl_text_editor_ctrl_shift_page_down);
procedure fl_text_editor_ctrl_shift_page_up
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_shift_page_up, "fl_text_editor_ctrl_shift_page_up");
+ pragma Inline (fl_text_editor_ctrl_shift_page_up);
procedure fl_text_editor_ctrl_shift_down
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_shift_down, "fl_text_editor_ctrl_shift_down");
+ pragma Inline (fl_text_editor_ctrl_shift_down);
procedure fl_text_editor_ctrl_shift_left
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_shift_left, "fl_text_editor_ctrl_shift_left");
+ pragma Inline (fl_text_editor_ctrl_shift_left);
procedure fl_text_editor_ctrl_shift_right
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_shift_right, "fl_text_editor_ctrl_shift_right");
+ pragma Inline (fl_text_editor_ctrl_shift_right);
procedure fl_text_editor_ctrl_shift_up
(TE : in System.Address);
pragma Import (C, fl_text_editor_ctrl_shift_up, "fl_text_editor_ctrl_shift_up");
+ pragma Inline (fl_text_editor_ctrl_shift_up);
@@ -236,22 +285,26 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
K, S : in Interfaces.C.int;
F : in System.Address);
pragma Import (C, fl_text_editor_add_key_binding, "fl_text_editor_add_key_binding");
+ pragma Inline (fl_text_editor_add_key_binding);
-- this particular procedure won't be necessary when FLTK keybindings fixed
procedure fl_text_editor_remove_key_binding
(TE : in System.Address;
K, S : in Interfaces.C.int);
pragma Import (C, fl_text_editor_remove_key_binding, "fl_text_editor_remove_key_binding");
+ pragma Inline (fl_text_editor_remove_key_binding);
procedure fl_text_editor_remove_all_key_bindings
(TE : in System.Address);
pragma Import (C, fl_text_editor_remove_all_key_bindings,
"fl_text_editor_remove_all_key_bindings");
+ pragma Inline (fl_text_editor_remove_all_key_bindings);
procedure fl_text_editor_set_default_key_function
(TE, F : in System.Address);
pragma Import (C, fl_text_editor_set_default_key_function,
"fl_text_editor_set_default_key_function");
+ pragma Inline (fl_text_editor_set_default_key_function);
@@ -260,11 +313,13 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
(TE : in System.Address)
return Interfaces.C.int;
pragma Import (C, fl_text_editor_get_insert_mode, "fl_text_editor_get_insert_mode");
+ pragma Inline (fl_text_editor_get_insert_mode);
procedure fl_text_editor_set_insert_mode
(TE : in System.Address;
I : in Interfaces.C.int);
pragma Import (C, fl_text_editor_set_insert_mode, "fl_text_editor_set_insert_mode");
+ pragma Inline (fl_text_editor_set_insert_mode);
@@ -273,11 +328,13 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
-- (TE : in System.Address)
-- return Interfaces.C.int;
-- pragma Import (C, fl_text_editor_get_tab_nav, "fl_text_editor_get_tab_nav");
+ -- pragma Inline (fl_text_editor_get_tab_nav);
-- procedure fl_text_editor_set_tab_nav
-- (TE : in System.Address;
-- T : in Interfaces.C.int);
-- pragma Import (C, fl_text_editor_set_tab_nav, "fl_text_editor_set_tab_nav");
+ -- pragma Inline (fl_text_editor_set_tab_nav);
@@ -285,12 +342,14 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
procedure fl_text_editor_draw
(W : in System.Address);
pragma Import (C, fl_text_editor_draw, "fl_text_editor_draw");
+ pragma Inline (fl_text_editor_draw);
function fl_text_editor_handle
(W : in System.Address;
E : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_text_editor_handle, "fl_text_editor_handle");
+ pragma Inline (fl_text_editor_handle);
@@ -302,8 +361,9 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
is
Ada_Editor : access Text_Editor'Class :=
Editor_Convert.To_Pointer (fl_widget_get_user_data (E));
+ Modi : Modifier := FLTK.Event.Last_Modifier;
Ada_Key : Key_Combo :=
- To_Ada (Interfaces.C.unsigned_long (K));
+ To_Ada (Interfaces.C.unsigned_long (K) + To_C (Modi));
Found_Binding : Boolean := False;
begin
@@ -339,33 +399,33 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
-- remove this type and array once FLTK keybindings fixed
- type To_Remove is record
- Press : Keypress;
- Modif : Interfaces.C.int;
- end record;
-
- To_Remove_List : array (Positive range <>) of To_Remove :=
- ((Home_Key, 0),
- (End_Key, 0),
- (Page_Down_Key, 0),
- (Page_Up_Key, 0),
- (Down_Key, 0),
- (Left_Key, 0),
- (Right_Key, 0),
- (Up_Key, 0),
- (Character'Pos ('/'), Interfaces.C.int (Mod_Ctrl)),
- (Delete_Key, Interfaces.C.int (Mod_Shift)),
- (Insert_Key, Interfaces.C.int (Mod_Ctrl)),
- (Insert_Key, Interfaces.C.int (Mod_Shift)));
-
- use type Interfaces.C.int;
- To_Remove_Weird : array (Positive range <>) of To_Remove :=
- ((Enter_Key, -1),
- (Keypad_Enter_Key, -1),
- (Backspace_Key, -1),
- (Insert_Key, -1),
- (Delete_Key, -1),
- (Escape_Key, -1));
+ -- type To_Remove is record
+ -- Press : Keypress;
+ -- Modif : Interfaces.C.int;
+ -- end record;
+
+ -- To_Remove_List : array (Positive range <>) of To_Remove :=
+ -- ((Home_Key, 0),
+ -- (End_Key, 0),
+ -- (Page_Down_Key, 0),
+ -- (Page_Up_Key, 0),
+ -- (Down_Key, 0),
+ -- (Left_Key, 0),
+ -- (Right_Key, 0),
+ -- (Up_Key, 0),
+ -- (Character'Pos ('/'), Interfaces.C.int (Mod_Ctrl)),
+ -- (Delete_Key, Interfaces.C.int (Mod_Shift)),
+ -- (Insert_Key, Interfaces.C.int (Mod_Ctrl)),
+ -- (Insert_Key, Interfaces.C.int (Mod_Shift)));
+
+ -- use type Interfaces.C.int;
+ -- To_Remove_Weird : array (Positive range <>) of To_Remove :=
+ -- ((Enter_Key, -1),
+ -- (Keypad_Enter_Key, -1),
+ -- (Backspace_Key, -1),
+ -- (Insert_Key, -1),
+ -- (Delete_Key, -1),
+ -- (Escape_Key, -1));
@@ -402,33 +462,33 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
-- remove these loops and uncomment subsequent "remove_all_key_bindings"
-- when FLTK keybindings fixed
- for B of To_Remove_List loop
- fl_text_editor_remove_key_binding
- (This.Void_Ptr,
- Interfaces.C.int (B.Press),
- B.Modif * 65536);
- end loop;
- for B of To_Remove_Weird loop
- fl_text_editor_remove_key_binding
- (This.Void_Ptr,
- Interfaces.C.int (B.Press),
- B.Modif);
- end loop;
- -- fl_text_editor_remove_all_key_bindings (This.Void_Ptr);
+ -- for B of To_Remove_List loop
+ -- fl_text_editor_remove_key_binding
+ -- (This.Void_Ptr,
+ -- Interfaces.C.int (B.Press),
+ -- B.Modif * 65536);
+ -- end loop;
+ -- for B of To_Remove_Weird loop
+ -- fl_text_editor_remove_key_binding
+ -- (This.Void_Ptr,
+ -- Interfaces.C.int (B.Press),
+ -- B.Modif);
+ -- end loop;
+ fl_text_editor_remove_all_key_bindings (This.Void_Ptr);
fl_text_editor_set_default_key_function (This.Void_Ptr, Key_Func_Hook'Address);
-- this is irritatingly required due to how FLTK handles certain keys
- for B of Default_Key_Bindings loop
- -- remove this conditional once FLTK keybindings fixed
- if B.Key.Modcode = Mod_None then
- fl_text_editor_add_key_binding
- (This.Void_Ptr,
- Interfaces.C.int (B.Key.Keycode),
- Interfaces.C.int (B.Key.Modcode) * 65536,
- Key_Func_Hook'Address);
- end if;
- end loop;
+ -- for B of Default_Key_Bindings loop
+ -- -- remove this conditional once FLTK keybindings fixed
+ -- if B.Key.Modcode = Mod_None then
+ -- fl_text_editor_add_key_binding
+ -- (This.Void_Ptr,
+ -- Interfaces.C.int (B.Key.Keycode),
+ -- Interfaces.C.int (B.Key.Modcode) * 65536,
+ -- Key_Func_Hook'Address);
+ -- end if;
+ -- end loop;
end return;
end Create;
@@ -772,6 +832,16 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
end Add_Key_Binding;
+ procedure Add_Key_Bindings
+ (This : in out Text_Editor;
+ List : in Key_Binding_List) is
+ begin
+ for I of List loop
+ This.Bindings.Append (I);
+ end loop;
+ end Add_Key_Bindings;
+
+
function Get_Bound_Key_Function
(This : in Text_Editor;
Key : in Key_Combo)
@@ -799,12 +869,12 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
end loop;
-- remove this once FLTK keybindings fixed
- if Key.Modcode /= Mod_None then
- fl_text_editor_remove_key_binding
- (This.Void_Ptr,
- Interfaces.C.int (Key.Keycode),
- Interfaces.C.int (Key.Modcode) * 65536);
- end if;
+ -- if Key.Modcode /= Mod_None then
+ -- fl_text_editor_remove_key_binding
+ -- (This.Void_Ptr,
+ -- Interfaces.C.int (Key.Keycode),
+ -- Interfaces.C.int (Key.Modcode) * 65536);
+ -- end if;
end Remove_Key_Binding;
@@ -812,7 +882,7 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
(This : in out Text_Editor;
Bind : in Key_Binding)
is
- use type Interfaces.C.int;
+ -- use type Interfaces.C.int;
begin
for I in reverse 1 .. Integer (This.Bindings.Length) loop
if This.Bindings.Reference (I).Key = Bind.Key then
@@ -821,23 +891,33 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
end loop;
-- remove this once FLTK keybindings fixed
- if Bind.Key.Modcode /= Mod_None then
- fl_text_editor_remove_key_binding
- (This.Void_Ptr,
- Interfaces.C.int (Bind.Key.Keycode),
- Interfaces.C.int (Bind.Key.Modcode) * 65536);
- end if;
+ -- if Bind.Key.Modcode /= Mod_None then
+ -- fl_text_editor_remove_key_binding
+ -- (This.Void_Ptr,
+ -- Interfaces.C.int (Bind.Key.Keycode),
+ -- Interfaces.C.int (Bind.Key.Modcode) * 65536);
+ -- end if;
end Remove_Key_Binding;
+ procedure Remove_Key_Bindings
+ (This : in out Text_Editor;
+ List : in Key_Binding_List) is
+ begin
+ for I of List loop
+ This.Remove_Key_Binding (I);
+ end loop;
+ end Remove_Key_Bindings;
+
+
procedure Remove_All_Key_Bindings
(This : in out Text_Editor) is
begin
This.Bindings := Binding_Vectors.Empty_Vector;
- This.Default_Func := null;
+ -- This.Default_Func := null;
-- remove this once FLTK keybindings fixed
- fl_text_editor_remove_all_key_bindings (This.Void_Ptr);
+ -- fl_text_editor_remove_all_key_bindings (This.Void_Ptr);
end Remove_All_Key_Bindings;
diff --git a/src/fltk-widgets-groups-text_displays-text_editors.ads b/src/fltk-widgets-groups-text_displays-text_editors.ads
index 29413e6..2430e0b 100644
--- a/src/fltk-widgets-groups-text_displays-text_editors.ads
+++ b/src/fltk-widgets-groups-text_displays-text_editors.ads
@@ -11,7 +11,11 @@ package FLTK.Widgets.Groups.Text_Displays.Text_Editors is
type Text_Editor is new Text_Display with private;
+ type Text_Editor_Reference (Data : not null access Text_Editor'Class) is
+ limited null record with Implicit_Dereference => Data;
+
type Insert_Mode is (Before, After);
+
-- type Tab_Navigation is (Insert_Char, Widget_Focus);
type Key_Func is access procedure
@@ -200,12 +204,12 @@ package FLTK.Widgets.Groups.Text_Displays.Text_Editors is
(Mod_None + Backspace_Key, KF_Backspace'Access),
(Mod_None + Insert_Key, KF_Insert'Access),
- (Mod_None + Delete_Key, Delete'Access),
- (Mod_Ctrl + 'c', Copy'Access),
- (Mod_Ctrl + 'v', Paste'Access),
- (Mod_Ctrl + 'x', Cut'Access),
- (Mod_Ctrl + 'z', Undo'Access),
- (Mod_Ctrl + 'a', Select_All'Access),
+ (Mod_None + Delete_Key, Delete'Access),
+ (Mod_Ctrl + 'c', Copy'Access),
+ (Mod_Ctrl + 'v', Paste'Access),
+ (Mod_Ctrl + 'x', Cut'Access),
+ (Mod_Ctrl + 'z', Undo'Access),
+ (Mod_Ctrl + 'a', Select_All'Access),
(Mod_None + Home_Key, KF_Home'Access),
(Mod_None + End_Key, KF_End'Access),
@@ -246,19 +250,6 @@ package FLTK.Widgets.Groups.Text_Displays.Text_Editors is
- -- NOTE NOTE NOTE NOTE NOTE
- --
- -- Changing the keybindings for Shortcut_Keys that include modifiers
- -- currently does not work due to some bugbear in the FLTK side of things.
- --
- -- Until that's fixed, the default keybindings for those key combinations
- -- that include modifiers have been left in place.
- --
- -- NOTE NOTE NOTE NOTE NOTE
-
-
-
-
procedure Add_Key_Binding
(This : in out Text_Editor;
Key : in Key_Combo;
@@ -268,6 +259,10 @@ package FLTK.Widgets.Groups.Text_Displays.Text_Editors is
(This : in out Text_Editor;
Bind : in Key_Binding);
+ procedure Add_Key_Bindings
+ (This : in out Text_Editor;
+ List : in Key_Binding_List);
+
function Get_Bound_Key_Function
(This : in Text_Editor;
Key : in Key_Combo)
@@ -281,6 +276,10 @@ package FLTK.Widgets.Groups.Text_Displays.Text_Editors is
(This : in out Text_Editor;
Bind : in Key_Binding);
+ procedure Remove_Key_Bindings
+ (This : in out Text_Editor;
+ List : in Key_Binding_List);
+
procedure Remove_All_Key_Bindings
(This : in out Text_Editor);
@@ -359,5 +358,82 @@ private
package Editor_Convert is new System.Address_To_Access_Conversions (Text_Editor'Class);
+
+
+ pragma Inline (Default);
+
+
+ pragma Inline (Undo);
+ pragma Inline (Cut);
+ pragma Inline (Copy);
+ pragma Inline (Paste);
+ pragma Inline (Delete);
+ pragma Inline (Select_All);
+
+
+ pragma Inline (KF_Backspace);
+ pragma Inline (KF_Insert);
+ pragma Inline (KF_Enter);
+ pragma Inline (KF_Ignore);
+
+
+ pragma Inline (KF_Home);
+ pragma Inline (KF_End);
+ pragma Inline (KF_Page_Down);
+ pragma Inline (KF_Page_Up);
+ pragma Inline (KF_Down);
+ pragma Inline (KF_Left);
+ pragma Inline (KF_Right);
+ pragma Inline (KF_Up);
+
+
+ pragma Inline (KF_Shift_Home);
+ pragma Inline (KF_Shift_End);
+ pragma Inline (KF_Shift_Page_Down);
+ pragma Inline (KF_Shift_Page_Up);
+ pragma Inline (KF_Shift_Down);
+ pragma Inline (KF_Shift_Left);
+ pragma Inline (KF_Shift_Right);
+ pragma Inline (KF_Shift_Up);
+
+
+ pragma Inline (KF_Ctrl_Home);
+ pragma Inline (KF_Ctrl_End);
+ pragma Inline (KF_Ctrl_Page_Down);
+ pragma Inline (KF_Ctrl_Page_Up);
+ pragma Inline (KF_Ctrl_Down);
+ pragma Inline (KF_Ctrl_Left);
+ pragma Inline (KF_Ctrl_Right);
+ pragma Inline (KF_Ctrl_Up);
+
+
+ pragma Inline (KF_Ctrl_Shift_Home);
+ pragma Inline (KF_Ctrl_Shift_End);
+ pragma Inline (KF_Ctrl_Shift_Page_Down);
+ pragma Inline (KF_Ctrl_Shift_Page_Up);
+ pragma Inline (KF_Ctrl_Shift_Down);
+ pragma Inline (KF_Ctrl_Shift_Left);
+ pragma Inline (KF_Ctrl_Shift_Right);
+ pragma Inline (KF_Ctrl_Shift_Up);
+
+
+ pragma Inline (Add_Key_Binding);
+ pragma Inline (Remove_All_Key_Bindings);
+ pragma Inline (Get_Default_Key_Function);
+ pragma Inline (Set_Default_Key_Function);
+
+
+ pragma Inline (Get_Insert_Mode);
+ pragma Inline (Set_Insert_Mode);
+
+
+ -- pragma Inline (Get_Tab_Nav_Mode);
+ -- pragma Inline (Set_Tab_Nav_Mode);
+
+
+ pragma Inline (Draw);
+ pragma Inline (Handle);
+
+
end FLTK.Widgets.Groups.Text_Displays.Text_Editors;