diff options
author | Jed Barber <jjbarber@y7mail.com> | 2017-07-31 00:16:24 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2017-07-31 00:16:24 +1000 |
commit | f7bfc040a062b3f5a3549abd87463221c667f1d5 (patch) | |
tree | 8c5564a52f242bef674176a03b66e1812c8975a6 | |
parent | 3592854ef4ebeab8c099defb5745623eb849111b (diff) |
Made logo code more concise
-rw-r--r-- | src/adapad.adb | 13 | ||||
-rw-r--r-- | src/adapad.ads | 9 | ||||
-rw-r--r-- | src/main.adb | 15 | ||||
-rw-r--r-- | src/windows-about.adb | 21 | ||||
-rw-r--r-- | src/windows-about.ads | 9 | ||||
-rw-r--r-- | src/windows-editor.adb | 11 | ||||
-rw-r--r-- | src/windows-editor.ads | 1 | ||||
-rw-r--r-- | src/windows-find.adb | 10 | ||||
-rw-r--r-- | src/windows-find.ads | 4 | ||||
-rw-r--r-- | src/windows-jump.adb | 9 | ||||
-rw-r--r-- | src/windows-jump.ads | 4 | ||||
-rw-r--r-- | src/windows-replace.adb | 10 | ||||
-rw-r--r-- | src/windows-replace.ads | 4 | ||||
-rw-r--r-- | src/windows.adb | 15 | ||||
-rw-r--r-- | src/windows.ads | 17 |
15 files changed, 26 insertions, 126 deletions
diff --git a/src/adapad.adb b/src/adapad.adb index 84ada4e..1379a0c 100644 --- a/src/adapad.adb +++ b/src/adapad.adb @@ -53,19 +53,6 @@ package body Adapad is -- Main program interface. - procedure Set_Logo - (Pic : in out FLTK.Images.RGB.PNG.PNG_Image) is - begin - Editor.Set_Logo (Pic); - About.Set_Logo (Pic); - Find.Set_Logo (Pic); - Replace.Set_Logo (Pic); - Jump.Set_Logo (Pic); - end Set_Logo; - - - - procedure Show is begin Editor.Show; diff --git a/src/adapad.ads b/src/adapad.ads index a9e317f..0695315 100644 --- a/src/adapad.ads +++ b/src/adapad.ads @@ -1,17 +1,8 @@ -with - - FLTK.Images.RGB.PNG; - - package Adapad is - procedure Set_Logo - (Pic : in out FLTK.Images.RGB.PNG.PNG_Image); - - procedure Show; procedure Hide; diff --git a/src/main.adb b/src/main.adb index 266beb7..07e062a 100644 --- a/src/main.adb +++ b/src/main.adb @@ -2,22 +2,13 @@ with - FLTK.Images.RGB.PNG, - Adapad, - Ada.Command_Line, - Ada.Directories; + FLTK, + Adapad; function Main - return Integer -is - Origin : String := Ada.Directories.Containing_Directory - (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"); + return Integer is begin - Adapad.Set_Logo (Logo); Adapad.Show; return FLTK.Run; end Main; diff --git a/src/windows-about.adb b/src/windows-about.adb index 6a3dda6..9d3f761 100644 --- a/src/windows-about.adb +++ b/src/windows-about.adb @@ -1,12 +1,5 @@ -with - - FLTK.Widgets.Groups.Windows.Double, - FLTK.Widgets.Boxes, - FLTK.Widgets.Buttons.Enter; - - package body Windows.About is @@ -66,6 +59,9 @@ package body Windows.About is This.Add (This.Dismiss); This.Dismiss.Set_Callback (Hide_CB'Access); + This.Set_Icon (Logo); + This.Picture.Set_Image (Logo); + This.Set_Callback (Hide_CB'Access); This.Set_Modal; end return; @@ -93,16 +89,5 @@ package body Windows.About is end Create; - - - procedure Set_Logo - (This : in out About_Window; - Logo : in out FLTK.Images.RGB.PNG.PNG_Image) is - begin - Window (This).Set_Logo (Logo); - This.Picture.Set_Image (Logo); - end Set_Logo; - - end Windows.About; diff --git a/src/windows-about.ads b/src/windows-about.ads index e15c38c..a05a8e2 100644 --- a/src/windows-about.ads +++ b/src/windows-about.ads @@ -1,9 +1,5 @@ -with - - FLTK.Widgets.Groups.Windows.Double; - private with FLTK.Widgets.Boxes, @@ -31,11 +27,6 @@ package Windows.About is return About_Window; - procedure Set_Logo - (This : in out About_Window; - Logo : in out FLTK.Images.RGB.PNG.PNG_Image); - - private diff --git a/src/windows-editor.adb b/src/windows-editor.adb index 9696174..cfcf191 100644 --- a/src/windows-editor.adb +++ b/src/windows-editor.adb @@ -1,14 +1,5 @@ -with - - FLTK.Widgets.Groups.Windows.Double, - FLTK.Widgets.Groups.Text_Displays.Text_Editors, - FLTK.Widgets.Menus.Menu_Bars, - FLTK.Widgets.Menus.Menu_Buttons, - FLTK.Text_Buffers; - - package body Windows.Editor is @@ -63,6 +54,8 @@ package body Windows.Editor is This.Set_Resizable (This.Editor); This.Set_Size_Range (Min_Editor_Width, Min_Editor_Height); + This.Set_Icon (Logo); + This.Editor.Remove_Key_Binding (Mod_Ctrl + 'z'); end return; end Create; diff --git a/src/windows-editor.ads b/src/windows-editor.ads index 4b9afce..890242a 100644 --- a/src/windows-editor.ads +++ b/src/windows-editor.ads @@ -2,7 +2,6 @@ with - FLTK.Widgets.Groups.Windows.Double, FLTK.Widgets.Menus, FLTK.Text_Buffers, FLTK.Widgets.Groups.Text_Displays; diff --git a/src/windows-find.adb b/src/windows-find.adb index 8ae6685..2096436 100644 --- a/src/windows-find.adb +++ b/src/windows-find.adb @@ -1,13 +1,5 @@ -with - - FLTK.Widgets.Groups.Windows.Double, - FLTK.Widgets.Inputs, - FLTK.Widgets.Buttons.Enter, - FLTK.Widgets.Buttons.Light.Check; - - package body Windows.Find is @@ -85,6 +77,8 @@ package body Windows.Find is This.Add (This.Start); This.Start.Set_Callback (Find_M'Access); + This.Set_Icon (Logo); + This.Set_Callback (Hide_CB'Access); This.Set_Modal; end return; diff --git a/src/windows-find.ads b/src/windows-find.ads index 32d653e..0bf191d 100644 --- a/src/windows-find.ads +++ b/src/windows-find.ads @@ -1,9 +1,5 @@ -with - - FLTK.Widgets.Groups.Windows.Double; - private with FLTK.Widgets.Inputs, diff --git a/src/windows-jump.adb b/src/windows-jump.adb index 5d263ba..7503ec7 100644 --- a/src/windows-jump.adb +++ b/src/windows-jump.adb @@ -1,12 +1,5 @@ -with - - FLTK.Widgets.Groups.Windows.Double, - FLTK.Widgets.Buttons.Enter, - FLTK.Widgets.Inputs.Integer; - - package body Windows.Jump is @@ -71,6 +64,8 @@ package body Windows.Jump is This.Add (This.Go_Jump); This.Go_Jump.Set_Callback (Jump_M'Access); + This.Set_Icon (Logo); + This.Set_Callback (Hide_CB'Access); This.Set_Modal; end return; diff --git a/src/windows-jump.ads b/src/windows-jump.ads index e9c0be5..e79af6c 100644 --- a/src/windows-jump.ads +++ b/src/windows-jump.ads @@ -1,9 +1,5 @@ -with - - FLTK.Widgets.Groups.Windows.Double; - private with FLTK.Widgets.Buttons.Enter, diff --git a/src/windows-replace.adb b/src/windows-replace.adb index 758dfff..dd3703d 100644 --- a/src/windows-replace.adb +++ b/src/windows-replace.adb @@ -1,13 +1,5 @@ -with - - FLTK.Widgets.Groups.Windows.Double, - FLTK.Widgets.Inputs, - FLTK.Widgets.Buttons.Enter, - FLTK.Widgets.Buttons.Light.Check; - - package body Windows.Replace is @@ -97,6 +89,8 @@ package body Windows.Replace is This.Add (This.Start); This.Start.Set_Callback (Replace_M'Access); + This.Set_Icon (Logo); + This.Set_Callback (Hide_CB'Access); This.Set_Modal; end return; diff --git a/src/windows-replace.ads b/src/windows-replace.ads index 522ec18..a5852d2 100644 --- a/src/windows-replace.ads +++ b/src/windows-replace.ads @@ -1,9 +1,5 @@ -with - - FLTK.Widgets.Groups.Windows.Double; - private with FLTK.Widgets.Inputs, diff --git a/src/windows.adb b/src/windows.adb index d637905..d8d2f5b 100644 --- a/src/windows.adb +++ b/src/windows.adb @@ -1,10 +1,5 @@ -with - - FLTK.Widgets.Groups.Windows; - - package body Windows is @@ -13,16 +8,6 @@ package body Windows is - procedure Set_Logo - (This : in out Window; - Logo : in out FLTK.Images.RGB.PNG.PNG_Image) is - begin - This.Set_Icon (Logo); - end Set_Logo; - - - - -- Used to hide about/find/replace/etc windows instead -- of constantly creating and destroying them. diff --git a/src/windows.ads b/src/windows.ads index dbe9cda..eac1dc0 100644 --- a/src/windows.ads +++ b/src/windows.ads @@ -5,16 +5,16 @@ with FLTK.Widgets.Groups.Windows.Double, FLTK.Images.RGB.PNG; +private with -package Windows is + Ada.Command_Line, + Ada.Directories; - type Window is new FLTK.Widgets.Groups.Windows.Double.Double_Window with private; +package Windows is - procedure Set_Logo - (This : in out Window; - Logo : in out FLTK.Images.RGB.PNG.PNG_Image); + type Window is new FLTK.Widgets.Groups.Windows.Double.Double_Window with private; private @@ -27,5 +27,12 @@ private (Item : in out FLTK.Widgets.Widget'Class); + Origin : String := Ada.Directories.Containing_Directory + (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"); + + end Windows; |