aboutsummaryrefslogtreecommitdiff
path: root/body/fltk-widgets-groups-text_displays-text_editors.adb
diff options
context:
space:
mode:
Diffstat (limited to 'body/fltk-widgets-groups-text_displays-text_editors.adb')
-rw-r--r--body/fltk-widgets-groups-text_displays-text_editors.adb89
1 files changed, 66 insertions, 23 deletions
diff --git a/body/fltk-widgets-groups-text_displays-text_editors.adb b/body/fltk-widgets-groups-text_displays-text_editors.adb
index 15066f9..c2722b6 100644
--- a/body/fltk-widgets-groups-text_displays-text_editors.adb
+++ b/body/fltk-widgets-groups-text_displays-text_editors.adb
@@ -8,8 +8,7 @@ with
Ada.Assertions,
Ada.Characters.Latin_1,
- FLTK.Event,
- Interfaces.C;
+ FLTK.Events;
package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
@@ -25,6 +24,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
-- Functions From C --
------------------------
+ -- Allocation --
+
function new_fl_text_editor
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
@@ -40,6 +41,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Default Key Function --
+
procedure fl_text_editor_default
(TE : in Storage.Integer_Address;
K : in Interfaces.C.int);
@@ -49,6 +52,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Operation Key Functions --
+
procedure fl_text_editor_undo
(TE : in Storage.Integer_Address);
pragma Import (C, fl_text_editor_undo, "fl_text_editor_undo");
@@ -82,6 +87,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Special Key Functions --
+
procedure fl_text_editor_backspace
(TE : in Storage.Integer_Address);
pragma Import (C, fl_text_editor_backspace, "fl_text_editor_backspace");
@@ -105,6 +112,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Movement Key Functions --
+
procedure fl_text_editor_home
(TE : in Storage.Integer_Address);
pragma Import (C, fl_text_editor_home, "fl_text_editor_home");
@@ -148,6 +157,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Shift Key Functions --
+
procedure fl_text_editor_shift_home
(TE : in Storage.Integer_Address);
pragma Import (C, fl_text_editor_shift_home, "fl_text_editor_shift_home");
@@ -191,6 +202,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Control Key Functions --
+
procedure fl_text_editor_ctrl_home
(TE : in Storage.Integer_Address);
pragma Import (C, fl_text_editor_ctrl_home, "fl_text_editor_ctrl_home");
@@ -234,6 +247,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Control Shift Key Functions --
+
procedure fl_text_editor_ctrl_shift_home
(TE : in Storage.Integer_Address);
pragma Import (C, fl_text_editor_ctrl_shift_home, "fl_text_editor_ctrl_shift_home");
@@ -277,6 +292,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Meta Key Functions --
+
procedure fl_text_editor_meta_home
(TE : in Storage.Integer_Address);
pragma Import (C, fl_text_editor_meta_home, "fl_text_editor_meta_home");
@@ -320,6 +337,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Meta Shift Key Functions --
+
procedure fl_text_editor_meta_shift_home
(TE : in Storage.Integer_Address);
pragma Import (C, fl_text_editor_meta_shift_home, "fl_text_editor_meta_shift_home");
@@ -363,12 +382,14 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
- procedure fl_text_editor_add_key_binding
- (TE : in Storage.Integer_Address;
- K, S : in Interfaces.C.int;
- F : in Storage.Integer_Address);
- pragma Import (C, fl_text_editor_add_key_binding, "fl_text_editor_add_key_binding");
- pragma Inline (fl_text_editor_add_key_binding);
+ -- Key Binding Modification --
+
+ -- procedure fl_text_editor_add_key_binding
+ -- (TE : in Storage.Integer_Address;
+ -- K, S : in Interfaces.C.int;
+ -- F : in Storage.Integer_Address);
+ -- pragma Import (C, fl_text_editor_add_key_binding, "fl_text_editor_add_key_binding");
+ -- pragma Inline (fl_text_editor_add_key_binding);
procedure fl_text_editor_remove_all_key_bindings
(TE : in Storage.Integer_Address);
@@ -385,6 +406,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Settings --
+
function fl_text_editor_get_insert_mode
(TE : in Storage.Integer_Address)
return Interfaces.C.int;
@@ -397,9 +420,6 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
pragma Import (C, fl_text_editor_set_insert_mode, "fl_text_editor_set_insert_mode");
pragma Inline (fl_text_editor_set_insert_mode);
-
-
-
function fl_text_editor_get_tab_nav
(TE : in Storage.Integer_Address)
return Interfaces.C.int;
@@ -415,6 +435,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Drawing, Events --
+
procedure fl_text_editor_draw
(W : in Storage.Integer_Address);
pragma Import (C, fl_text_editor_draw, "fl_text_editor_draw");
@@ -450,12 +472,13 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
E : in Storage.Integer_Address)
return Interfaces.C.int
is
- Editor_Ptr : Storage.Integer_Address := fl_widget_get_user_data (E);
+ Editor_Ptr : constant Storage.Integer_Address := fl_widget_get_user_data (E);
Ada_Editor : access Text_Editor'Class;
- Extra_Keys : Modifier := FLTK.Event.Last_Modifier;
- Actual_Key : Keypress := FLTK.Event.Last_Key; -- fuck you FLTK, give me the real code
- Ada_Key : Key_Combo := Extra_Keys + Actual_Key;
+ Extra_Keys : constant Modifier := FLTK.Events.Last_Modifier;
+ Actual_Key : constant Keypress := FLTK.Events.Last_Key;
+ -- fuck you FLTK, give me the real code
+ Ada_Key : constant Key_Combo := Extra_Keys + Actual_Key;
-- For whatever reason, if a regular key function is used then FLTK will
-- give you the key code, but if a default key function is used instead it
@@ -554,9 +577,7 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
function Create
(X, Y, W, H : in Integer;
Text : in String := "")
- return Text_Editor
- is
- use type Interfaces.C.int;
+ return Text_Editor is
begin
return This : Text_Editor do
This.Void_Ptr := new_fl_text_editor
@@ -590,6 +611,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
-- API Subprograms --
-----------------------
+ -- Default Key Function --
+
procedure KF_Default
(This : in out Text_Editor'Class;
Key : in Key_Combo) is
@@ -602,6 +625,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Operation Key Functions --
+
procedure KF_Undo
(This : in out Text_Editor'Class) is
begin
@@ -646,6 +671,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Special Key Functions --
+
procedure KF_Backspace
(This : in out Text_Editor'Class) is
begin
@@ -683,6 +710,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Movement Key Functions --
+
procedure KF_Home
(This : in out Text_Editor'Class) is
begin
@@ -741,6 +770,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Shift Key Functions --
+
procedure KF_Shift_Home
(This : in out Text_Editor'Class) is
begin
@@ -799,6 +830,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Control Key Functions --
+
procedure KF_Ctrl_Home
(This : in out Text_Editor'Class) is
begin
@@ -857,6 +890,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Control Shift Key Functions --
+
procedure KF_Ctrl_Shift_Home
(This : in out Text_Editor'Class) is
begin
@@ -915,6 +950,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Meta Key Functions --
+
procedure KF_Meta_Home
(This : in out Text_Editor'Class) is
begin
@@ -973,6 +1010,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Meta Shift Key Functions --
+
procedure KF_Meta_Shift_Home
(This : in out Text_Editor'Class) is
begin
@@ -1031,6 +1070,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Key Binding Modification --
+
procedure Add_Key_Binding
(This : in out Text_Editor;
Key : in Key_Combo;
@@ -1149,11 +1190,13 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Settings --
+
function Get_Insert_Mode
(This : in Text_Editor)
return Insert_Mode
is
- Result : Interfaces.C.int := fl_text_editor_get_insert_mode (This.Void_Ptr);
+ Result : constant Interfaces.C.int := fl_text_editor_get_insert_mode (This.Void_Ptr);
begin
return Insert_Mode'Val (Result);
exception
@@ -1171,13 +1214,11 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
end Set_Insert_Mode;
-
-
function Get_Tab_Mode
(This : in Text_Editor)
return Tab_Navigation
is
- Result : Interfaces.C.int := fl_text_editor_get_tab_nav (This.Void_Ptr);
+ Result : constant Interfaces.C.int := fl_text_editor_get_tab_nav (This.Void_Ptr);
begin
return Tab_Navigation'Val (Result);
exception
@@ -1197,6 +1238,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
+ -- Events --
+
function Handle
(This : in out Text_Editor;
Event : in Event_Kind)
@@ -1210,7 +1253,7 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is
(This : in out Text_Editor)
return Event_Outcome
is
- Result : Interfaces.C.int := fl_text_editor_handle_key (This.Void_Ptr);
+ Result : constant Interfaces.C.int := fl_text_editor_handle_key (This.Void_Ptr);
begin
return Event_Outcome'Val (Result);
exception