From 0b019001293227083dba0c953e0142c4d0c66884 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Sat, 16 Jul 2016 15:59:18 +1000 Subject: Starting to construct main program, but now I have to redo all the FLTK Initializers. Great. --- src/adapad.adb | 36 ++++++++++++----------------------- src/editors.adb | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/editors.ads | 54 +++++++++++++++++++++++++++++++++++++---------------- 3 files changed, 108 insertions(+), 40 deletions(-) create mode 100644 src/editors.adb diff --git a/src/adapad.adb b/src/adapad.adb index e0bf2d7..cf5b02e 100644 --- a/src/adapad.adb +++ b/src/adapad.adb @@ -1,40 +1,28 @@ --- with Editor; +with FLTK; +with Editors; +use Editors; with FLTK.Widgets.Groups.Windows.Double; -with FLTK.Widgets.Groups.Windows.Single.Menu; -with FLTK.Widgets.Boxes; -with FLTK.Widgets.Buttons.Enter; -with FLTK.Widgets.Buttons.Light.Check; -with FLTK.Widgets.Buttons.Light.Radio; -with FLTK.Widgets.Buttons.Light.Round.Radio; -with FLTK.Widgets.Buttons.Radio; -with FLTK.Widgets.Buttons.Repeat; -with FLTK.Widgets.Buttons.Toggle; -with FLTK.Widgets.Inputs; -with FLTK.Widgets.Groups.Text_Displays.Text_Editors; -with FLTK.Enums; use FLTK.Enums; -with FLTK.Widgets.Groups; +use FLTK.Widgets.Groups.Windows.Double; +with Ada.Text_IO; use Ada.Text_IO; function AdaPad return Integer is - package Dbl renames FLTK.Widgets.Groups.Windows.Double; - package Bx renames FLTK.Widgets.Boxes; - W : Dbl.Double_Window := Dbl.Create (340, 180); - B : Bx.Box := Bx.Create (20, 40, 300, 100, "Test"); + --Pad : Double_Window := Create (0, 0, 640, 400, "AdaPad"); + Pad : Editor_Window := Create (0, 0, 640, 400, "AdaPad"); + begin - B.Set_Box (Engraved_Box); - B.Set_Label_Font (Times_Bold_Italic); - B.Set_Label_Size (36); - B.Set_Label_Type (Shadow_Label); - W.Add (B); - W.Show; + Put_Line ("About to show"); + Pad.Show; + Put_Line ("About to run"); return FLTK.Run; + end AdaPad; diff --git a/src/editors.adb b/src/editors.adb new file mode 100644 index 0000000..1ce7a92 --- /dev/null +++ b/src/editors.adb @@ -0,0 +1,58 @@ + + +with FLTK.Widgets.Groups.Windows.Double; + + +package body Editors is + + + function Create + (X, Y, W, H : in Integer; + Label_Text : in String) + return Editor_Window is + begin + return FLTK.Widgets.Groups.Windows.Double.Create (0, 0, 640, 400, "AdaPad"); + --return This : Editor_Window do + --This.Replace_Dialog := FLTK.Widgets.Groups.Windows.Create (300, 105, "Replace"); + --This.Replace_Find := Create (70, 10, 200, 25, "Find:"); + --This.Replace_With := Create (70, 40, 200, 25, "Replace:"); + --This.Replace_All := Create (10, 70, 90, 25, "Replace All"); + --This.Replace_Next := Create (105, 70, 120, 25, "Replace Next"); + --This.Replace_Cancel := Create (230, 70, 60, 25, "Cancel"); + --This.The_Editor := Create (0, 30, 640, 370, Label_Text); + --end return; + end Create; + + + + + function Create + (W, H : in Integer) + return Editor_Window is + begin + return Create (0, 0, W, H, "AdaPad"); + end Create; + + + + + function Get_Buffer + (This : in Editor_Window) + return Text_Buffer_Cursor is + begin + return This.The_Editor.Get_Buffer; + end Get_Buffer; + + + + + procedure Set_Buffer + (This : in out Editor_Window; + Buff : in out Text_Buffer) is + begin + This.The_Editor.Set_Buffer (Buff); + end Set_Buffer; + + +end Editors; + diff --git a/src/editors.ads b/src/editors.ads index 27d54d7..41e6b07 100644 --- a/src/editors.ads +++ b/src/editors.ads @@ -1,41 +1,63 @@ +with FLTK.Widgets.Groups.Windows; +use FLTK.Widgets.Groups.Windows; with FLTK.Widgets.Groups.Windows.Double; +use FLTK.Widgets.Groups.Windows.Double; with FLTK.Widgets.Inputs; +use FLTK.Widgets.Inputs; +with FLTK.Widgets.Buttons; +use FLTK.Widgets.Buttons; with FLTK.Widgets.Buttons.Enter; +use FLTK.Widgets.Buttons.Enter; +with FLTK.Widgets.Groups.Text_Displays.Text_Editors; +use FLTK.Widgets.Groups.Text_Displays.Text_Editors; +with FLTK.Text_Buffers; +use FLTK.Text_Buffers; package Editors is - package Windows renames FLTK.Widgets.Groups.Windows; - - type Editor is new Windows.Double.Double_Window with private; + type Editor_Window is new Double_Window with private; function Create (X, Y, W, H : in Integer; - Label : in String) - return Editor; + Label_Text : in String) + return Editor_Window; + + + function Create + (W, H : in Integer) + return Editor_Window; + + + function Get_Buffer + (This : in Editor_Window) + return Text_Buffer_Cursor; + + + procedure Set_Buffer + (This : in out Editor_Window; + Buff : in out Text_Buffer); private - type Editor is new Windows.Double.Double_Window with + type Editor_Window is new Double_Window with record - Replace_Dialog : Windows.Window; - Replace_Find : FLTK.Widgets.Inputs.Input; - Replace_With : FLTK.Widgets.Inputs.Input; - Replace_All : FLTK.Widgets.Buttons.Button; - Replace_Next : FLTK.Widgets.Buttons.Enter.Enter_Button; - Replace_Cancel : FLTK.Widgets.Buttons.Button; + --Replace_Dialog : Window; + --Replace_Find : Input; + --Replace_With : Input; + --Replace_All : Button; + --Replace_Next : Enter_Button; + --Replace_Cancel : Button; + + The_Editor : Text_Editor := FLTK.Widgets.Groups.Text_Displays.Text_Editors.Create (0, 30, 640, 370, "AdaPad"); end record; - overriding procedure Initialize (This : in out Editor); - overriding procedure Finalize (This : in out Editor); - - end Editors; -- cgit