summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2016-11-10 21:26:59 +1100
committerJed Barber <jjbarber@y7mail.com>2016-11-10 21:26:59 +1100
commit61342fd9e3c4cf2eb388fc7a6ba971859020b456 (patch)
tree1796d42446b7563ae5b3dd62330726566e42966d
parent8528bd05cbf65593c0592055431f6c85c21d6967 (diff)
Simplified find/replace window callbacks
-rw-r--r--src/adapad.adb14
-rw-r--r--src/adapad.ads16
-rw-r--r--src/windows-find.adb4
-rw-r--r--src/windows-find.ads12
-rw-r--r--src/windows-replace.adb4
-rw-r--r--src/windows-replace.ads12
6 files changed, 20 insertions, 42 deletions
diff --git a/src/adapad.adb b/src/adapad.adb
index 50fbe8d..1f2c03d 100644
--- a/src/adapad.adb
+++ b/src/adapad.adb
@@ -232,9 +232,8 @@ package body Adapad is
-- callbacks for the find/replace windows
- overriding procedure Call
- (This : in Do_Find_Callback;
- Item : in String;
+ procedure Do_Find_CB
+ (Item : in String;
Match_Case : in Boolean)
is
Current_Position, Found_At : Natural;
@@ -248,14 +247,13 @@ package body Adapad is
else
FLTK.Dialogs.Alert ("No occurrences of '" & Item & "' found!");
end if;
- end Call;
+ end Do_Find_CB;
- overriding procedure Call
- (This : in Do_Replace_Callback;
- Item, Replace_With : in String;
+ procedure Do_Replace_CB
+ (Item, Replace_With : in String;
Match_Case, Replace_All : in Boolean)
is
Current_Position, Found_At : Natural;
@@ -285,7 +283,7 @@ package body Adapad is
else
FLTK.Dialogs.Alert ("No occurrences of '" & Item & "' found!");
end if;
- end Call;
+ end Do_Replace_CB;
diff --git a/src/adapad.ads b/src/adapad.ads
index 9bb11b2..0a739de 100644
--- a/src/adapad.ads
+++ b/src/adapad.ads
@@ -138,21 +138,5 @@ private
Mod_CB : aliased Mod_Callback;
- type Do_Find_Callback is new Windows.Find.Find_Callback with null record;
- overriding procedure Call
- (This : in Do_Find_Callback;
- Item : in String;
- Match_Case : in Boolean);
- Do_Find_CB : aliased Do_Find_Callback;
-
-
- type Do_Replace_Callback is new Windows.Replace.Replace_Callback with null record;
- overriding procedure Call
- (This : in Do_Replace_Callback;
- Item, Replace_With : in String;
- Match_Case, Replace_All : in Boolean);
- Do_Replace_CB : aliased Do_Replace_Callback;
-
-
end Adapad;
diff --git a/src/windows-find.adb b/src/windows-find.adb
index 4adc2ac..5459e38 100644
--- a/src/windows-find.adb
+++ b/src/windows-find.adb
@@ -32,7 +32,7 @@ package body Windows.Find is
Dialog : access Find_Window := Find_Window_Access (Item.Parent);
begin
if Dialog.Callback /= null then
- Dialog.Callback.Call
+ Dialog.Callback.all
(Dialog.Find_What.Get_Value,
Dialog.Match_Case.Get_State = BU.On);
end if;
@@ -120,7 +120,7 @@ package body Windows.Find is
procedure Set_Find_Callback
(This : in out Find_Window;
- Func : not null access Find_Callback'Class) is
+ Func : in Find_Callback) is
begin
This.Callback := Func;
end Set_Find_Callback;
diff --git a/src/windows-find.ads b/src/windows-find.ads
index b22c8aa..31ea2f6 100644
--- a/src/windows-find.ads
+++ b/src/windows-find.ads
@@ -14,11 +14,9 @@ package Windows.Find is
type Find_Window is new FLTK.Widgets.Groups.Windows.Double.Double_Window with private;
- type Find_Callback is interface;
- procedure Call
- (This : in Find_Callback;
- Item : in String;
- Match_Case : in Boolean) is abstract;
+ type Find_Callback is access procedure
+ (Item : in String;
+ Match_Case : in Boolean);
function Create
@@ -38,7 +36,7 @@ package Windows.Find is
procedure Set_Find_Callback
(This : in out Find_Window;
- Func : not null access Find_Callback'Class);
+ Func : in Find_Callback);
private
@@ -56,7 +54,7 @@ private
Match_Case : FLTK.Widgets.Buttons.Light.Check.Check_Button;
Cancel : FLTK.Widgets.Buttons.Button;
Start : FLTK.Widgets.Buttons.Enter.Enter_Button;
- Callback : access Find_Callback'Class;
+ Callback : Find_Callback;
end record;
diff --git a/src/windows-replace.adb b/src/windows-replace.adb
index 5db325a..a0bdcff 100644
--- a/src/windows-replace.adb
+++ b/src/windows-replace.adb
@@ -32,7 +32,7 @@ package body Windows.Replace is
Dialog : access Replace_Window := Replace_Window_Access (Item.Parent);
begin
if Dialog.Callback /= null then
- Dialog.Callback.Call
+ Dialog.Callback.all
(Dialog.Find_What.Get_Value,
Dialog.Replace_With.Get_Value,
Dialog.Match_Case.Get_State = BU.On,
@@ -133,7 +133,7 @@ package body Windows.Replace is
procedure Set_Replace_Callback
(This : in out Replace_Window;
- Func : not null access Replace_Callback'Class) is
+ Func : in Replace_Callback) is
begin
This.Callback := Func;
end Set_Replace_Callback;
diff --git a/src/windows-replace.ads b/src/windows-replace.ads
index ef5106b..854a882 100644
--- a/src/windows-replace.ads
+++ b/src/windows-replace.ads
@@ -14,11 +14,9 @@ package Windows.Replace is
type Replace_Window is new FLTK.Widgets.Groups.Windows.Double.Double_Window with private;
- type Replace_Callback is interface;
- procedure Call
- (This : in Replace_Callback;
- Item, Replace_With : in String;
- Match_Case, Rep_All : in Boolean) is abstract;
+ type Replace_Callback is access procedure
+ (Item, Replace_With : in String;
+ Match_Case, Rep_All : in Boolean);
function Create
@@ -38,7 +36,7 @@ package Windows.Replace is
procedure Set_Replace_Callback
(This : in out Replace_Window;
- Func : not null access Replace_Callback'Class);
+ Func : in Replace_Callback);
private
@@ -56,7 +54,7 @@ private
Match_Case, Replace_All : FLTK.Widgets.Buttons.Light.Check.Check_Button;
Cancel : FLTK.Widgets.Buttons.Button;
Start : FLTK.Widgets.Buttons.Enter.Enter_Button;
- Callback : access Replace_Callback'Class;
+ Callback : Replace_Callback;
end record;