From cdcf5839899276b041b56b70798055f0d438bbdb Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Wed, 9 May 2018 23:28:04 +1000 Subject: Text_Editor key bindings hopefully fixed, yet more polishing --- doc/fl_graphics_driver.html | 197 +++++++ doc/fl_preferences.html | 449 ++++++++++++++++ doc/fl_surface_device.html | 106 ++++ doc/fl_text_editor.html | 573 +++++++++++++++++++++ progress.txt | 12 +- src/c_fl_graphics_driver.cpp | 18 +- src/c_fl_graphics_driver.h | 18 +- src/c_fl_preferences.h | 40 +- src/c_fl_surface.cpp | 3 +- src/c_fl_surface.h | 8 +- src/c_fl_text_editor.h | 114 ++-- src/fltk-devices-graphics.adb | 9 + src/fltk-devices-graphics.ads | 19 + src/fltk-devices-surfaces.adb | 4 + src/fltk-devices-surfaces.ads | 11 + src/fltk-environment.adb | 21 + src/fltk-environment.ads | 23 + ...k-widgets-groups-text_displays-text_editors.adb | 212 +++++--- ...k-widgets-groups-text_displays-text_editors.ads | 114 +++- 19 files changed, 1762 insertions(+), 189 deletions(-) create mode 100644 doc/fl_graphics_driver.html create mode 100644 doc/fl_preferences.html create mode 100644 doc/fl_surface_device.html create mode 100644 doc/fl_text_editor.html diff --git a/doc/fl_graphics_driver.html b/doc/fl_graphics_driver.html new file mode 100644 index 0000000..9f613ef --- /dev/null +++ b/doc/fl_graphics_driver.html @@ -0,0 +1,197 @@ + + + + + + + Fl_Graphics_Driver Binding Map + + + + + + +

Fl_Graphics_Driver Binding Map

+ + + + + + + + + + +
Package name
Fl_Graphics_DriverFLTK.Devices.Graphics
+ + + + + + + + + + + + + + + + + + + + + +
Types
Fl_Graphics_DriverGraphics_Driver
 Graphics_Driver_Reference
matrix 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Functions and Procedures
+Fl_Graphics_Driver();
+
TBA
+virtual const char * class_name();
+
Use runtime tag checks instead
+Fl_Color color();
+
+function Get_Color
+       (This : in Graphics_Driver)
+    return Color;
+
+virtual int descent();
+
+function Get_Text_Descent
+       (This : in Graphics_Driver)
+    return Integer;
+
+virtual int draw_scaled(Fl_Image *img, int X, int Y, int W, int H);
+
+procedure Draw_Scaled_Image
+       (This       : in Graphics_Driver;
+        Img        : in FLTK.Images.Image'Class;
+        X, Y, W, H : in Integer);
+
+virtual void font(Fl_Font face, Fl_Fontsize fsize);
+
+procedure Set_Font
+       (This : in Graphics_Driver;
+        Face : in Font_Kind;
+        Size : in Font_Size);
+
+Fl_Font font();
+
+function Get_Font_Kind
+       (This : in Graphics_Driver)
+    return Font_Kind;
+
+Fl_Font_Descriptor * font_descriptor();
+
TBA
+void font_descriptor(Fl_Font_Descriptor *d);
+
TBA
+virtual int height();
+
+function Get_Line_Height
+       (This : in Graphics_Driver)
+    return Integer;
+
+Fl_Fontsize size();
+
+function Get_Font_Size
+       (This : in Graphics_Driver)
+    return Font_Size;
+
+virtual void text_extents(const char *, int n, int &dx, int &dy, int &w, int &h);
+
TBA
+virtual double width(const char *str, int n);
+
+function Get_Width
+       (This : in Graphics_Driver;
+        Str  : in String)
+    return Long_Float;
+
+virtual double width(unsigned int c);
+
+function Get_Width
+       (This : in Graphics_Driver;
+        Char : in Character)
+    return Long_Float;
+
+ + + + + diff --git a/doc/fl_preferences.html b/doc/fl_preferences.html new file mode 100644 index 0000000..b3d5ec0 --- /dev/null +++ b/doc/fl_preferences.html @@ -0,0 +1,449 @@ + + + + + + + Fl_Preferences Binding Map + + + + + + +

Fl_Preferences Binding Map

+ + + + + + + + + + +
Package name
Fl_PreferencesFLTK.Environment
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Types
Fl_PreferencesPreferences
 Preferences_Reference
Entry 
RootScope
ID 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Functions and Procedures
+Fl_Preferences(Root root, const char *vendor, const char *application);
+
TBA
+Fl_Preferences(const char *path, const char *vendor, const char *application);
+
+function From_Filesystem
+       (Path, Vendor, Application : in String)
+    return Preferences;
+
+Fl_Preferences(Fl_Preferences &parent, const char *group);
+Fl_Preferences(Fl_Preferences *parent, const char *group);
+
TBA
+Fl_Preferences(Fl_Preferences &parent, int groupIndex);
+Fl_Preferences(Fl_Preferences *parent, int groupIndex);
+
TBA
+Fl_Preferences(const Fl_Preferences &);
+
TBA
+char clear();
+
+procedure Clear
+       (This : in out Preferences);
+
+char deleteAllEntries();
+
+procedure Delete_All_Entries
+       (This : in out Preferences);
+
+char deleteAllGroups();
+
TBA
+char deleteEntry(const char *entry);
+
+procedure Delete_Entry
+       (This : in out Preferences;
+        Key  : in     String);
+
+char deleteGroup(const char *group);
+
TBA
+int entries();
+
+function Number_Of_Entries
+       (This : in Preferences)
+    return Natural;
+
+const char * entry(int index);
+
+function Get_Key
+       (This  : in Preferences;
+        Index : in Natural)
+    return String;
+
+char entryExists(const char *key);
+
+function Entry_Exists
+       (This : in Preferences;
+        Key  : in String)
+    return Boolean;
+
+void flush();
+
+procedure Flush
+       (This : in Preferences);
+
+char get(const char *entry, int &value, int defaultValue);
+
+function Get
+       (This : in Preferences;
+        Key  : in String)
+    return Integer;
+
+function Get
+       (This    : in Preferences;
+        Key     : in String;
+        Default : in Integer)
+    return Integer;
+
+char get(const char *entry, float &value, float defaultValue);
+
+function Get
+       (This : in Preferences;
+        Key  : in String)
+    return Float;
+
+function Get
+       (This    : in Preferences;
+        Key     : in String;
+        Default : in Float)
+    return Float;
+
+char get(const char *entry, double &value, double defaultValue);
+
+function Get
+       (This : in Preferences;
+        Key  : in String)
+    return Long_Float;
+
+function Get
+       (This    : in Preferences;
+        Key     : in String;
+        Default : in Long_Float)
+    return Long_Float;
+
+char get(const char *entry, char *&value, const char *defaultValue);
+
+function Get
+       (This : in Preferences;
+        Key  : in String)
+    return String;
+
+function Get
+       (This    : in Preferences;
+        Key     : in String;
+        Default : in String)
+    return String;
+
+char get(const char *entry, char *value, const char *defaultValue, int maxSize);
+
TBA
+char get(const char *entry, void *&value, const void *defaultValue, int defaultSize);
+
TBA
+char get(const char *entry, void *value, const void *defaultValue, int defaultSize, int maxSize);
+
TBA
+char getUserdataPath(char *path, int pathlen);
+
TBA
+const char * group(int num_group);
+
TBA
+char groupExists(const char *key);
+
TBA
+int groups();
+
TBA
+ID id();
+
TBA
+const char * name();
+
TBA
+const char * path();
+
TBA
+char set(const char *entry, int value);
+
+procedure Set
+       (This  : in out Preferences;
+        Key   : in     String;
+        Value : in     Integer);
+
+char set(const char *entry, float value);
+
+procedure Set
+       (This  : in out Preferences;
+        Key   : in     String;
+        Value : in     Float);
+
+char set(const char *entry, float value, int precision);
+
+procedure Set
+       (This      : in out Preferences;
+        Key       : in     String;
+        Value     : in     Float;
+        Precision : in     Natural);
+
+char set(const char *entry, double value);
+
+procedure Set
+       (This  : in out Preferences;
+        Key   : in     String;
+        Value : in     Long_Float);
+
+char set(const char *entry, double value, int precision);
+
+procedure Set
+       (This      : in out Preferences;
+        Key       : in     String;
+        Value     : in     Long_Float;
+        Precision : in     Natural);
+
+char set(const char *entry, const char *value);
+
+procedure Set
+       (This  : in out Preferences;
+        Key   : in     String;
+        Value : in     String);
+
+char set(const char *entry, const void *value, int size);
+
TBA
+int size(const char *entry);
+
+function Entry_Size
+       (This : in Preferences;
+        Key  : in String)
+    return Natural;
+
+static const char * newUUID();
+
TBA
+static char remove(ID id_);
+
TBA
+ + + + + diff --git a/doc/fl_surface_device.html b/doc/fl_surface_device.html new file mode 100644 index 0000000..6da46c9 --- /dev/null +++ b/doc/fl_surface_device.html @@ -0,0 +1,106 @@ + + + + + + + Fl_Surface_Device Binding Map + + + + + + +

Fl_Surface_Device Binding Map

+ + + + + + + + + + +
Package name
Fl_Surface_DeviceFLTK.Devices.Surfaces
+ + + + + + + + + + + + + + + + +
Types
Fl_Surface_DeviceSurface_Device
 Surface_Device_Reference
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Functions and Procedures
+Fl_Surface_Device(Fl_Graphics_Driver *graphics_driver);
+
+function Create
+       (Graphics : in out FLTK.Devices.Graphics.Graphics_Driver)
+    return Surface_Device;
+
+const char * class_name();
+
Use runtime tag checks instead
+void driver(Fl_Graphics_Driver *graphics_driver);
+
TBA
+Fl_Graphics_Driver * driver();
+
TBA
+virtual void set_current(void);
+
+procedure Set_Current
+       (This : in out Surface_Device);
+
+static Fl_Surface_Device * surface();
+
+function Get_Current
+    return access Surface_Device'Class;
+
+ + + + + diff --git a/doc/fl_text_editor.html b/doc/fl_text_editor.html new file mode 100644 index 0000000..88bf734 --- /dev/null +++ b/doc/fl_text_editor.html @@ -0,0 +1,573 @@ + + + + + + + Fl_Text_Editor Binding Map + + + + + + +

Fl_Text_Editor Binding Map

+ + + + + + + + + + +
Package name
Fl_Text_EditorFLTK.Widgets.Groups.Text_Displays.Text_Editors
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Types
Fl_Text_EditorText_Editor
 Text_Editor_Reference
 Insert_Mode
Key_FuncKey_Func
 Default_Key_Func
Key_BindingKey_Binding
 Key_Binding_List
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Functions and Procedures
+Fl_Text_Editor(int X, int Y, int W, int H, const char *L=0);
+
+function Create
+       (X, Y, W, H : in Integer;
+        Text       : in String)
+    return Text_Editor;
+
+void add_default_key_bindings(Key_Binding **list);
+
 
+void add_key_binding(int key, int state, Key_Func f, Key_Binding **list);
+
+procedure Add_Key_Binding
+       (This : in out Text_Editor;
+        Bind : in     Key_Binding);
+
+void add_key_binding(int key, int state, Key_Func f);
+
+procedure Add_Key_Binding
+       (This : in out Text_Editor;
+        Key  : in     Key_Combo;
+        Func : in     Key_Func);
+
 
+procedure Add_Key_Bindings
+       (This : in out Text_Editor;
+        List : in     Key_Binding_List);
+
+Key_Func bound_key_function(int key, int state, Key_Binding *list) const;
+
 
+Key_Func bound_key_function(int key, int state) const;
+
+function Get_Bound_Key_Function
+       (This : in Text_Editor;
+        Key  : in Key_Combo)
+    return Key_Func;
+
+void default_key_function(Key_Func f);
+
+procedure Set_Default_Key_Function
+       (This : in out Text_Editor;
+        Func : in     Default_Key_Func);
+
 
+function Get_Default_Key_Function
+       (This : in Text_Editor)
+    return Default_Key_Func;
+
 
+procedure Draw
+       (This : in out Text_Editor);
+
+virtual int handle(int e);
+
+function Handle
+       (This  : in out Text_Editor;
+        Event : in     Event_Kind)
+    return Event_Outcome;
+
+void insert_mode(int b);
+
+procedure Set_Insert_Mode
+       (This : in out Text_Editor;
+        To   : in     Insert_Mode);
+
+int insert_mode();
+
+function Get_Insert_Mode
+       (This : in Text_Editor)
+    return Insert_Mode;
+
+void remove_all_key_bindings(Key_Binding **list);
+
+procedure Remove_Key_Bindings
+       (This : in out Text_Editor;
+        List : in     Key_Binding_List);
+
+void remove_all_key_bindings();
+
+procedure Remove_All_Key_Bindings
+       (This : in out Text_Editor);
+
+void remove_key_binding(int key, int state, Key_Binding **list);
+
+procedure Remove_Key_Binding
+       (This : in out Text_Editor;
+        Bind : in     Key_Binding);
+
+void remove_key_binding(int key, int state);
+
+procedure Remove_Key_Binding
+       (This : in out Text_Editor;
+        Key  : in     Key_Combo);
+
+void tab_nav(int val);
+
TBA
+int tab_nav() const;
+
TBA
+static int kf_backspace(int c, Fl_Text_Editor *e);
+
+procedure KF_Backspace
+       (This : in out Text_Editor'Class);
+
+static int kf_c_s_move(int c, Fl_Text_Editor *e);
+
+procedure KF_Ctrl_Shift_Home
+       (This : in out Text_Editor'Class);
+
+procedure KF_Ctrl_Shift_End
+       (This : in out Text_Editor'Class);
+
+procedure KF_Ctrl_Shift_Page_Down
+       (This : in out Text_Editor'Class);
+
+procedure KF_Ctrl_Shift_Page_Up
+       (This : in out Text_Editor'Class);
+
+procedure KF_Ctrl_Shift_Down
+       (This : in out Text_Editor'Class);
+
+procedure KF_Ctrl_Shift_Left
+       (This : in out Text_Editor'Class);
+
+procedure KF_Ctrl_Shift_Right
+       (This : in out Text_Editor'Class);
+
+procedure KF_Ctrl_Shift_Up
+       (This : in out Text_Editor'Class);
+
+static int kf_copy(int c, Fl_Text_Editor *e);
+
+procedure Copy
+       (This : in out Text_Editor'Class);
+
+static int kf_ctrl_move(int c, Fl_Text_Editor *e);
+
+procedure KF_Ctrl_Home
+       (This : in out Text_Editor'Class);
+
+procedure KF_Ctrl_End
+       (This : in out Text_Editor'Class);
+
+procedure KF_Ctrl_Page_Down
+       (This : in out Text_Editor'Class);
+
+procedure KF_Ctrl_Page_Up
+       (This : in out Text_Editor'Class);
+
+procedure KF_Ctrl_Down
+       (This : in out Text_Editor'Class);
+
+procedure KF_Ctrl_Left
+       (This : in out Text_Editor'Class);
+
+procedure KF_Ctrl_Right
+       (This : in out Text_Editor'Class);
+
+procedure KF_Ctrl_Up
+       (This : in out Text_Editor'Class);
+
+static int kf_cut(int c, Fl_Text_Editor *e);
+
+procedure Cut
+       (This : in out Text_Editor'Class);
+
+static int kf_default(int c, Fl_Text_Editor *e);
+
+procedure Default
+       (This : in out Text_Editor'Class;
+        Key  : in     Key_Combo);
+
+static int kf_delete(int c, Fl_Text_Editor *e);
+
+procedure Delete
+       (This : in out Text_Editor'Class);
+
+static int kf_down(int c, Fl_Text_Editor *e);
+
+procedure KF_Down
+       (This : in out Text_Editor'Class);
+
+static int kf_end(int c, Fl_Text_Editor *e);
+
+procedure KF_End
+       (This : in out Text_Editor'Class);
+
+static int kf_enter(int c, Fl_Text_Editor *e);
+
+procedure KF_Enter
+       (This : in out Text_Editor'Class);
+
+static int kf_home(int, Fl_Text_Editor *e);
+
+procedure KF_Home
+       (This : in out Text_Editor'Class);
+
+static int kf_ignore(int c, Fl_Text_Editor *e);
+
+procedure KF_Ignore
+       (This : in out Text_Editor'Class);
+
+static int kf_insert(int c, Fl_Text_Editor *e);
+
+procedure KF_Insert
+       (This : in out Text_Editor'Class);
+
+static int kf_left(int c, Fl_Text_Editor *e);
+
+procedure KF_Left
+       (This : in out Text_Editor'Class);
+
+static int kf_m_s_move(int c, Fl_Text_Editor *e);
+
 
+static int kf_meta_move(int c, Fl_Text_Editor *e);
+
 
+static int kf_move(int c, Fl_Text_Editor *e);
+
 
+static int kf_page_down(int c, Fl_Text_Editor *e);
+
+procedure KF_Page_Down
+       (This : in out Text_Editor'Class);
+
+static int kf_page_up(int c, Fl_Text_Editor *e);
+
+procedure KF_Page_Up
+       (This : in out Text_Editor'Class);
+
+static int kf_paste(int c, Fl_Text_Editor *e);
+
+procedure Paste
+       (This : in out Text_Editor'Class);
+
+static int kf_right(int c, Fl_Text_Editor *e);
+
+procedure KF_Right
+       (This : in out Text_Editor'Class);
+
+static int kf_select_all(int c, Fl_Text_Editor *e);
+
+procedure Select_All
+       (This : in out Text_Editor'Class);
+
+static int kf_shift_move(int c, Fl_Text_Editor *e);
+
+procedure KF_Shift_Home
+       (This : in out Text_Editor'Class);
+
+procedure KF_Shift_End
+       (This : in out Text_Editor'Class);
+
+procedure KF_Shift_Page_Down
+       (This : in out Text_Editor'Class);
+
+procedure KF_Shift_Page_Up
+       (This : in out Text_Editor'Class);
+
+procedure KF_Shift_Down
+       (This : in out Text_Editor'Class);
+
+procedure KF_Shift_Left
+       (This : in out Text_Editor'Class);
+
+procedure KF_Shift_Right
+       (This : in out Text_Editor'Class);
+
+procedure KF_Shift_Up
+       (This : in out Text_Editor'Class);
+
+static int kf_undo(int c, Fl_Text_Editor *e);
+
+procedure Undo
+       (This : in out Text_Editor'Class);
+
+static int kf_up(int c, Fl_Text_Editor *e);
+
+procedure KF_Up
+       (This : in out Text_Editor'Class);
+
+ + + + + diff --git a/progress.txt b/progress.txt index bcfa1ec..9dcba9f 100644 --- a/progress.txt +++ b/progress.txt @@ -56,6 +56,7 @@ FLTK.Widgets.Groups.Scrolls FLTK.Widgets.Groups.Spinners FLTK.Widgets.Groups.Tabbed FLTK.Widgets.Groups.Text_Displays +FLTK.Widgets.Groups.Text_Displays.Text_Editors FLTK.Widgets.Groups.Tiled FLTK.Widgets.Groups.Windows FLTK.Widgets.Groups.Windows.Double @@ -96,16 +97,14 @@ FLTK.Widgets.Valuators.Sliders.Horizontal Done: -FLTK.Widgets.Groups.Text_Displays.Text_Editors - Partially Done: -FLTK.Devices.Graphics -FLTK.Devices.Surfaces -FLTK.Environment +FLTK.Devices.Graphics (incomplete API, otherwise polished) +FLTK.Devices.Surfaces (incomplete API, otherwise polished) +FLTK.Environment (incomplete API, otherwise polished) FLTK.Widgets FLTK.Widgets.Groups FLTK.Widgets.Menus @@ -142,9 +141,7 @@ FL_Cairo_Window - mark all methods as inline - make sure all C++ reinterpret_cast for methods is to the Fl object, not the My object, because inheriting -- consistent unicode utf-8 support (is this even fully supported by FLTK? if not, nevermind...) - check FLTK library internals to see which char* return values need dealloc -- remove custom exception types in favour of Program_Error? or at least a generic FLTK_Error? - qualify all C++ virtual method calls with the class name to prevent dynamic dispatch on C++ side - provide documentation for how C++ methods map to Ada functions and procedures @@ -160,6 +157,7 @@ Bugs to fix: Fl_Help_View ABI_VERSION checks Fl_Tooltip ABI_VERSION checks +Fl_Text_Editor tab_nav ABI_VERSION checks Fl_Wizard draw() method private/protected GNAT bug with type_invariant combined with derived type and a begin section in a package, eg dialogs.adb 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(g)->descent(); + // virtual so disable dispatch + return reinterpret_cast(g)->Fl_Graphics_Driver::descent(); } int fl_graphics_driver_height(GRAPHICS_DRIVER g) { - return reinterpret_cast(g)->height(); + // virtual so disable dispatch + return reinterpret_cast(g)->Fl_Graphics_Driver::height(); } double fl_graphics_driver_width(GRAPHICS_DRIVER g, unsigned int c) { - return reinterpret_cast(g)->width(c); + // virtual so disable dispatch + return reinterpret_cast(g)->Fl_Graphics_Driver::width(c); } double fl_graphics_driver_width2(GRAPHICS_DRIVER g, const char * s, int l) { - return reinterpret_cast(g)->width(s,l); + // virtual so disable dispatch + return reinterpret_cast(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(g)->font(f,s); + // virtual so disable dispatch + reinterpret_cast(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(g)->draw_scaled(reinterpret_cast(i),x,y,w,h); + // virtual so disable dispatch + reinterpret_cast(g)->Fl_Graphics_Driver::draw_scaled(reinterpret_cast(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(s)->set_current(); + // virtual so disable dispatch + reinterpret_cast(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; -- cgit