From 7a84d0f3d0d181196b24795592a260e05b63fa74 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Tue, 4 Oct 2016 00:32:30 +1100 Subject: Find/Replace marshalling back to Adapad Main done, some Group/Widget_Cursor stuff removed --- src/adapad.adb | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'src/adapad.adb') diff --git a/src/adapad.adb b/src/adapad.adb index 7ba743e..7440ce9 100644 --- a/src/adapad.adb +++ b/src/adapad.adb @@ -16,6 +16,8 @@ use FLTK.Widgets.Groups.Windows; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; +with Ada.Text_IO; + function Adapad return Integer is @@ -271,6 +273,45 @@ function Adapad return Integer is + -- callbacks for the find/replace windows + + type Do_Find_Callback is new Editor_Windows.Find_Callback with null record; + Do_Find_CB : aliased Do_Find_Callback; + + overriding procedure Call + (This : in Do_Find_Callback; + Item : in String; + Match_Case : in Boolean) is + begin + Ada.Text_IO.Put_Line ("Finding " & Item); + if Match_Case then + Ada.Text_IO.Put_Line ("Matching case"); + end if; + end Call; + + + + + type Do_Replace_Callback is new Editor_Windows.Replace_Callback with null record; + Do_Replace_CB : aliased Do_Replace_Callback; + + overriding procedure Call + (This : in Do_Replace_Callback; + Item, Replace_With : in String; + Match_Case, Replace_All : in Boolean) is + begin + Ada.Text_IO.Put_Line ("Replacing " & Item & " with " & Replace_With); + if Match_Case then + Ada.Text_IO.Put_Line ("Matching case"); + end if; + if Replace_All then + Ada.Text_IO.Put_Line ("Replacing all"); + end if; + end Call; + + + + -- helper functions procedure Set_Title is @@ -404,6 +445,8 @@ begin end; + Find.Set_Find_Callback (Do_Find_CB'Access); + Replace.Set_Replace_Callback (Do_Replace_CB'Access); Buffer.Add_Modify_Callback (Mod_CB'Access); Editor.Set_Callback (Quit_CB'Access); Editor.Set_Buffer (Buffer); -- cgit