From 468cdc37c83cd51eb1b0656bc7faeaf2099e0918 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Tue, 13 Mar 2018 17:46:33 +1100 Subject: Updated to work with non-inherited constructors in FLTK binding --- src/adapad.adb | 2 +- src/windows-about.adb | 65 ++++++++++++++++------------------------------- src/windows-about.ads | 11 -------- src/windows-editor.adb | 11 ++++---- src/windows-find.adb | 59 ++++++++++++++----------------------------- src/windows-find.ads | 11 -------- src/windows-jump.adb | 47 ++++++++++------------------------ src/windows-jump.ads | 11 -------- src/windows-replace.adb | 67 +++++++++++++++++-------------------------------- src/windows-replace.ads | 11 -------- src/windows.ads | 2 +- 11 files changed, 85 insertions(+), 212 deletions(-) diff --git a/src/adapad.adb b/src/adapad.adb index 1379a0c..abb63cb 100644 --- a/src/adapad.adb +++ b/src/adapad.adb @@ -38,7 +38,7 @@ package body Adapad is -- Global state of the text editor. Editor : Windows.Editor.Editor_Window := Windows.Editor.Create (800, 500); - Buffer : FLTK.Text_Buffers.Text_Buffer := FLTK.Text_Buffers.Create; + Buffer : FLTK.Text_Buffers.Text_Buffer := FLTK.Text_Buffers.Forge.Create; About : Windows.About.About_Window := Windows.About.Create; Find : Windows.Find.Find_Window := Windows.Find.Create; Replace : Windows.Replace.Replace_Window := Windows.Replace.Create; diff --git a/src/windows-about.adb b/src/windows-about.adb index a02a66a..13b8337 100644 --- a/src/windows-about.adb +++ b/src/windows-about.adb @@ -13,41 +13,41 @@ package body Windows.About is function Create return About_Window is - My_Width : Integer := 350; - My_Height : Integer := 250; + My_Width : constant Integer := 350; + My_Height : constant Integer := 250; - Logo_Line : Integer := 30; - Logo_Width : Integer := 50; - Logo_Height : Integer := 50; + Logo_Line : constant Integer := 30; + Logo_Width : constant Integer := 50; + Logo_Height : constant Integer := 50; - Button_Width : Integer := 140; - Button_Height : Integer := 40; + Button_Width : constant Integer := 140; + Button_Height : constant Integer := 40; - Heading_Line : Integer := 90; - Blurb_Line : Integer := 132; - Author_Line : Integer := 157; - Button_Line : Integer := 190; + Heading_Line : constant Integer := 90; + Blurb_Line : constant Integer := 132; + Author_Line : constant Integer := 157; + Button_Line : constant Integer := 190; - Heading_Size : Integer := 22; - Text_Size : Integer := 12; + Heading_Size : constant Integer := 22; + Text_Size : constant Integer := 12; - Heading_Text : String := "Adapad 0.8"; - Blurb_Text : String := "FLTK based simple text editor written in Ada"; - Author_Text : String := "Programmed by Jed Barber"; + Heading_Text : constant String := "Adapad 0.8"; + Blurb_Text : constant String := "FLTK based simple text editor written in Ada"; + Author_Text : constant String := "Programmed by Jed Barber"; begin return This : About_Window := - (WD.Double_Window'(WD.Create (0, 0, My_Width, My_Height, "About Adapad")) with + (WD.Double_Window'(WD.Forge.Create (0, 0, My_Width, My_Height, "About Adapad")) with - Picture => BX.Box'(BX.Create + Picture => BX.Box'(BX.Forge.Create ((My_Width - Logo_Width) / 2, Logo_Line, Logo_Width, Logo_Height, "")), - Heading => BX.Box'(BX.Create + Heading => BX.Box'(BX.Forge.Create (0, Heading_Line, My_Width, Heading_Size, Heading_Text)), - Blurb => BX.Box'(BX.Create + Blurb => BX.Box'(BX.Forge.Create (0, Blurb_Line, My_Width, Text_Size, Blurb_Text)), - Author => BX.Box'(BX.Create + Author => BX.Box'(BX.Forge.Create (0, Author_Line, My_Width, Text_Size, Author_Text)), - Dismiss => EN.Enter_Button'(EN.Create + Dismiss => EN.Enter_Button'(EN.Forge.Create ((My_Width - Button_Width) / 2, Button_Line, Button_Width, Button_Height, "Close"))) do @@ -68,26 +68,5 @@ package body Windows.About is end Create; - - - function Create - (X, Y, W, H : in Integer; - Label_Text : in String) - return About_Window is - begin - return Create; - end Create; - - - - - function Create - (W, H : in Integer) - return About_Window is - begin - return Create; - end Create; - - end Windows.About; diff --git a/src/windows-about.ads b/src/windows-about.ads index a05a8e2..27e655b 100644 --- a/src/windows-about.ads +++ b/src/windows-about.ads @@ -16,17 +16,6 @@ package Windows.About is return About_Window; - function Create - (X, Y, W, H : in Integer; - Label_Text : in String) - return About_Window; - - - function Create - (W, H : in Integer) - return About_Window; - - private diff --git a/src/windows-editor.adb b/src/windows-editor.adb index cfcf191..29b1c6e 100644 --- a/src/windows-editor.adb +++ b/src/windows-editor.adb @@ -21,7 +21,8 @@ package body Windows.Editor is Width : Integer := Min_Editor_Width; Height : Integer := Min_Editor_Height; - Menu_Height : Integer := 22; + + Menu_Height : constant Integer := 22; begin if Width < W then Width := W; @@ -32,13 +33,13 @@ package body Windows.Editor is end if; return This : Editor_Window := - (WD.Double_Window'(WD.Create (X, Y, Width, Height, Label_Text)) with + (WD.Double_Window'(WD.Forge.Create (X, Y, Width, Height, Label_Text)) with - Editor => TE.Text_Editor'(TE.Create + Editor => TE.Text_Editor'(TE.Forge.Create (0, Menu_Height, Width, Height - Menu_Height, "")), - Bar => MB.Menu_Bar'(MB.Create + Bar => MB.Menu_Bar'(MB.Forge.Create (0, 0, Width, Menu_Height, "")), - Popup => MU.Menu_Button'(MU.Create + Popup => MU.Menu_Button'(MU.Forge.Create (0, Menu_Height, Width, Height - Menu_Height, ""))) do This.Editor.Set_Text_Font (Courier); diff --git a/src/windows-find.adb b/src/windows-find.adb index 2096436..02698da 100644 --- a/src/windows-find.adb +++ b/src/windows-find.adb @@ -33,38 +33,38 @@ package body Windows.Find is function Create return Find_Window is - My_Width : Integer := 350; - My_Height : Integer := 130; + My_Width : constant Integer := 350; + My_Height : constant Integer := 130; - Button_Width : Integer := 140; - Button_Height : Integer := 40; + Button_Width : constant Integer := 140; + Button_Height : constant Integer := 40; - Input_Line : Integer := 10; - Case_Line : Integer := 50; - Button_Line : Integer := 80; + Input_Line : constant Integer := 10; + Case_Line : constant Integer := 50; + Button_Line : constant Integer := 80; - Input_Width : Integer := 240; - Input_Height : Integer := 25; - Input_Margin_Right : Integer := 10; + Input_Width : constant Integer := 240; + Input_Height : constant Integer := 25; + Input_Margin_Right : constant Integer := 10; - Check_Width : Integer := 100; - Check_Height : Integer := 20; - Case_Margin_Left : Integer := 50; + Check_Width : constant Integer := 100; + Check_Height : constant Integer := 20; + Case_Margin_Left : constant Integer := 50; - Text_Size : Integer := 12; + Text_Size : constant Integer := 12; begin return This : Find_Window := - (WD.Double_Window'(WD.Create (0, 0, My_Width, My_Height, "Find")) with + (WD.Double_Window'(WD.Forge.Create (0, 0, My_Width, My_Height, "Find")) with - Find_What => IP.Input'(IP.Create + Find_What => IP.Input'(IP.Forge.Create (My_Width - Input_Width - Input_Margin_Right, Input_Line, Input_Width, Input_Height, "Find what:")), - Match_Case => LC.Check_Button'(LC.Create + Match_Case => LC.Check_Button'(LC.Forge.Create (Case_Margin_Left, Case_Line, Check_Width, Check_Height, "Match case")), - Cancel => BU.Button'(BU.Create + Cancel => BU.Button'(BU.Forge.Create ((My_Width - 2 * Button_Width) / 3, Button_Line, Button_Width, Button_Height, "Cancel")), - Start => EN.Enter_Button'(EN.Create + Start => EN.Enter_Button'(EN.Forge.Create ((My_Width - 2 * Button_Width) * 2 / 3 + Button_Width, Button_Line, Button_Width, Button_Height, "Find")), @@ -87,27 +87,6 @@ package body Windows.Find is - function Create - (X, Y, W, H : in Integer; - Label_Text : in String) - return Find_Window is - begin - return Create; - end Create; - - - - - function Create - (W, H : in Integer) - return Find_Window is - begin - return Create; - end Create; - - - - procedure Set_Find_Callback (This : in out Find_Window; Func : in Find_Callback) is diff --git a/src/windows-find.ads b/src/windows-find.ads index 0bf191d..d920398 100644 --- a/src/windows-find.ads +++ b/src/windows-find.ads @@ -26,17 +26,6 @@ package Windows.Find is return Find_Window; - function Create - (X, Y, W, H : in Integer; - Label_Text : in String) - return Find_Window; - - - function Create - (W, H : in Integer) - return Find_Window; - - procedure Set_Find_Callback (This : in out Find_Window; Func : in Find_Callback); diff --git a/src/windows-jump.adb b/src/windows-jump.adb index 7503ec7..898ce04 100644 --- a/src/windows-jump.adb +++ b/src/windows-jump.adb @@ -30,29 +30,29 @@ package body Windows.Jump is function Create return Jump_Window is - My_Width : Integer := 350; - My_Height : Integer := 110; + My_Width : constant Integer := 350; + My_Height : constant Integer := 110; - Button_Width : Integer := 140; - Button_Height : Integer := 40; + Button_Width : constant Integer := 140; + Button_Height : constant Integer := 40; - Input_Line : Integer := 10; - Button_Line : Integer := 60; + Input_Line : constant Integer := 10; + Button_Line : constant Integer := 60; - Input_Width : Integer := 240; - Input_Height : Integer := 25; - Input_Margin_Right : Integer := 10; + Input_Width : constant Integer := 240; + Input_Height : constant Integer := 25; + Input_Margin_Right : constant Integer := 10; begin return This : Jump_Window := - (WD.Double_Window'(WD.Create (0, 0, My_Width, My_Height, "Jump")) with + (WD.Double_Window'(WD.Forge.Create (0, 0, My_Width, My_Height, "Jump")) with - To_Line => IT.Integer_Input'(IT.Create + To_Line => IT.Integer_Input'(IT.Forge.Create (My_Width - Input_Width - Input_Margin_Right, Input_Line, Input_Width, Input_Height, "Jump to:")), - Cancel => BU.Button'(BU.Create + Cancel => BU.Button'(BU.Forge.Create ((My_Width - 2 * Button_Width) / 3, Button_Line, Button_Width, Button_Height, "Cancel")), - Go_Jump => EN.Enter_Button'(EN.Create + Go_Jump => EN.Enter_Button'(EN.Forge.Create ((My_Width - 2 * Button_Width) * 2 / 3 + Button_Width, Button_Line, Button_Width, Button_Height, "Jump")), @@ -74,27 +74,6 @@ package body Windows.Jump is - function Create - (X, Y, W, H : in Integer; - Label_Text : in String) - return Jump_Window is - begin - return Create; - end Create; - - - - - function Create - (W, H : in Integer) - return Jump_Window is - begin - return Create; - end Create; - - - - procedure Set_Jump_Callback (This : in out Jump_Window; Func : in Jump_Callback) is diff --git a/src/windows-jump.ads b/src/windows-jump.ads index e79af6c..6c483d5 100644 --- a/src/windows-jump.ads +++ b/src/windows-jump.ads @@ -20,17 +20,6 @@ package Windows.Jump is return Jump_Window; - function Create - (X, Y, W, H : in Integer; - Label_Text : in String) - return Jump_Window; - - - function Create - (W, H : in Integer) - return Jump_Window; - - procedure Set_Jump_Callback (This : in out Jump_Window; Func : in Jump_Callback); diff --git a/src/windows-replace.adb b/src/windows-replace.adb index dd3703d..1393711 100644 --- a/src/windows-replace.adb +++ b/src/windows-replace.adb @@ -34,47 +34,47 @@ package body Windows.Replace is function Create return Replace_Window is - My_Width : Integer := 350; - My_Height : Integer := 180; + My_Width : constant Integer := 350; + My_Height : constant Integer := 180; - Button_Width : Integer := 140; - Button_Height : Integer := 40; + Button_Width : constant Integer := 140; + Button_Height : constant Integer := 40; - Find_Line : Integer := 10; - Replace_Line : Integer := 40; - Match_Line : Integer := 80; - Rep_All_Line : Integer := 100; - Button_Line : Integer := 130; + Find_Line : constant Integer := 10; + Replace_Line : constant Integer := 40; + Match_Line : constant Integer := 80; + Rep_All_Line : constant Integer := 100; + Button_Line : constant Integer := 130; - Input_Width : Integer := 220; - Input_Height : Integer := 25; - Input_Margin_Right : Integer := 10; + Input_Width : constant Integer := 220; + Input_Height : constant Integer := 25; + Input_Margin_Right : constant Integer := 10; - Check_Width : Integer := 100; - Check_Height : Integer := 20; - Check_Margin_Left : Integer := 50; + Check_Width : constant Integer := 100; + Check_Height : constant Integer := 20; + Check_Margin_Left : constant Integer := 50; - Text_Size : Integer := 12; + Text_Size : constant Integer := 12; begin return This : Replace_Window := - (WD.Double_Window'(WD.Create (0, 0, My_Width, My_Height, "Replace")) with + (WD.Double_Window'(WD.Forge.Create (0, 0, My_Width, My_Height, "Replace")) with - Find_What => IP.Input'(IP.Create + Find_What => IP.Input'(IP.Forge.Create (My_Width - Input_Width - Input_Margin_Right, Find_Line, Input_Width, Input_Height, "Find what:")), - Replace_With => IP.Input'(IP.Create + Replace_With => IP.Input'(IP.Forge.Create (My_Width - Input_Width - Input_Margin_Right, Replace_Line, Input_Width, Input_Height, "Replace with:")), - Match_Case => LC.Check_Button'(LC.Create + Match_Case => LC.Check_Button'(LC.Forge.Create (Check_Margin_Left, Match_Line, Check_Width, Check_Height, "Match case")), - Replace_All => LC.Check_Button'(LC.Create + Replace_All => LC.Check_Button'(LC.Forge.Create (Check_Margin_Left, Rep_All_Line, Check_Width, Check_Height, "Replace all")), - Cancel => BU.Button'(BU.Create + Cancel => BU.Button'(BU.Forge.Create ((My_Width - 2 * Button_Width) / 3, Button_Line, Button_Width, Button_Height, "Cancel")), - Start => EN.Enter_Button'(EN.Create + Start => EN.Enter_Button'(EN.Forge.Create ((My_Width - 2 * Button_Width) * 2 / 3 + Button_Width, Button_Line, Button_Width, Button_Height, "Replace")), @@ -99,27 +99,6 @@ package body Windows.Replace is - function Create - (X, Y, W, H : in Integer; - Label_Text : in String) - return Replace_Window is - begin - return Create; - end Create; - - - - - function Create - (W, H : in Integer) - return Replace_Window is - begin - return Create; - end Create; - - - - procedure Set_Replace_Callback (This : in out Replace_Window; Func : in Replace_Callback) is diff --git a/src/windows-replace.ads b/src/windows-replace.ads index a5852d2..5b02055 100644 --- a/src/windows-replace.ads +++ b/src/windows-replace.ads @@ -22,17 +22,6 @@ package Windows.Replace is return Replace_Window; - function Create - (X, Y, W, H : in Integer; - Label_Text : in String) - return Replace_Window; - - - function Create - (W, H : in Integer) - return Replace_Window; - - procedure Set_Replace_Callback (This : in out Replace_Window; Func : in Replace_Callback); diff --git a/src/windows.ads b/src/windows.ads index eac1dc0..8050467 100644 --- a/src/windows.ads +++ b/src/windows.ads @@ -31,7 +31,7 @@ private (Ada.Directories.Full_Name (Ada.Command_Line.Command_Name)); Logo : FLTK.Images.RGB.PNG.PNG_Image := - FLTK.Images.RGB.PNG.Create (Origin & "/../share/adapad/logo.png"); + FLTK.Images.RGB.PNG.Forge.Create (Origin & "/../share/adapad/logo.png"); end Windows; -- cgit