From ede7482f170d498d0a2129da6e81ff4764e366e2 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Fri, 28 Jul 2017 00:03:19 +1000 Subject: Logo file now better integrated --- logo.png | Bin 5925 -> 0 bytes share/adapad/logo.png | Bin 0 -> 5925 bytes src/adapad.adb | 13 +++++++++++++ src/adapad.ads | 7 +++++++ src/main.adb | 13 +++++++++++-- src/windows-about.adb | 13 +++++++++++-- src/windows-about.ads | 9 +++++++-- src/windows-editor.adb | 1 - src/windows-editor.ads | 4 ++-- src/windows-find.adb | 1 - src/windows-find.ads | 4 ++-- src/windows-jump.adb | 1 - src/windows-jump.ads | 4 ++-- src/windows-replace.adb | 1 - src/windows-replace.ads | 4 ++-- src/windows.adb | 10 ++++++++++ src/windows.ads | 12 ++++++++++-- 17 files changed, 77 insertions(+), 20 deletions(-) delete mode 100644 logo.png create mode 100644 share/adapad/logo.png diff --git a/logo.png b/logo.png deleted file mode 100644 index db5ab11..0000000 Binary files a/logo.png and /dev/null differ diff --git a/share/adapad/logo.png b/share/adapad/logo.png new file mode 100644 index 0000000..db5ab11 Binary files /dev/null and b/share/adapad/logo.png differ diff --git a/src/adapad.adb b/src/adapad.adb index c9ff4e3..6a725c3 100644 --- a/src/adapad.adb +++ b/src/adapad.adb @@ -47,6 +47,19 @@ 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 0695315..850b760 100644 --- a/src/adapad.ads +++ b/src/adapad.ads @@ -1,8 +1,15 @@ +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 7f31554..f917081 100644 --- a/src/main.adb +++ b/src/main.adb @@ -1,11 +1,20 @@ -with FLTK; +with FLTK.Images.RGB.PNG; with Adapad; +with Ada.Command_Line; +with Ada.Directories; -function Main return Integer is +function Main return Integer +is + Containing_Dir : 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 (Containing_Dir & "/../share/adapad/logo.png"); 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 a09a41b..12f9c17 100644 --- a/src/windows-about.adb +++ b/src/windows-about.adb @@ -57,7 +57,6 @@ package body Windows.About is Button_Line, Button_Width, Button_Height, "Close"))) do This.Add (This.Picture); - This.Picture.Set_Image (Logo); This.Add (This.Heading); This.Heading.Set_Label_Size (FLTK.Widgets.Font_Size (Heading_Size)); This.Add (This.Blurb); @@ -66,7 +65,6 @@ package body Windows.About is This.Dismiss.Set_Callback (Hide_CB'Access); This.Set_Callback (Hide_CB'Access); - This.Set_Icon (Logo); This.Set_Modal; end return; end Create; @@ -93,5 +91,16 @@ 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 0d605f9..f27ad26 100644 --- a/src/windows-about.ads +++ b/src/windows-about.ads @@ -8,7 +8,7 @@ private with FLTK.Widgets.Buttons.Enter; package Windows.About is - type About_Window is new FLTK.Widgets.Groups.Windows.Double.Double_Window with private; + type About_Window is new Window with private; function Create @@ -26,10 +26,15 @@ 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 - type About_Window is new FLTK.Widgets.Groups.Windows.Double.Double_Window with + type About_Window is new Window with record Picture : FLTK.Widgets.Boxes.Box; Heading : FLTK.Widgets.Boxes.Box; diff --git a/src/windows-editor.adb b/src/windows-editor.adb index 81e5633..f8f15eb 100644 --- a/src/windows-editor.adb +++ b/src/windows-editor.adb @@ -60,7 +60,6 @@ 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; diff --git a/src/windows-editor.ads b/src/windows-editor.ads index e3d36e0..079638c 100644 --- a/src/windows-editor.ads +++ b/src/windows-editor.ads @@ -12,7 +12,7 @@ private with FLTK.Widgets.Menus.Menu_Buttons; package Windows.Editor is - type Editor_Window is new FLTK.Widgets.Groups.Windows.Double.Double_Window with private; + type Editor_Window is new Window with private; type Wrap_Mode is new FLTK.Widgets.Groups.Text_Displays.Wrap_Mode; @@ -109,7 +109,7 @@ package Windows.Editor is private - type Editor_Window is new FLTK.Widgets.Groups.Windows.Double.Double_Window with + type Editor_Window is new Window with record Bar : aliased FLTK.Widgets.Menus.Menu_Bars.Menu_Bar; Popup : aliased FLTK.Widgets.Menus.Menu_Buttons.Menu_Button; diff --git a/src/windows-find.adb b/src/windows-find.adb index 394ce2d..87acd04 100644 --- a/src/windows-find.adb +++ b/src/windows-find.adb @@ -84,7 +84,6 @@ package body Windows.Find is This.Start.Set_Callback (Find_M'Access); This.Set_Callback (Hide_CB'Access); - This.Set_Icon (Logo); This.Set_Modal; end return; end Create; diff --git a/src/windows-find.ads b/src/windows-find.ads index 82895e7..adcb9c8 100644 --- a/src/windows-find.ads +++ b/src/windows-find.ads @@ -9,7 +9,7 @@ private with FLTK.Widgets.Buttons.Light.Check; package Windows.Find is - type Find_Window is new FLTK.Widgets.Groups.Windows.Double.Double_Window with private; + type Find_Window is new Window with private; type Direction is (Forward, Backward); @@ -49,7 +49,7 @@ package Windows.Find is private - type Find_Window is new FLTK.Widgets.Groups.Windows.Double.Double_Window with + type Find_Window is new Window with record Find_What : FLTK.Widgets.Inputs.Input; Match_Case : FLTK.Widgets.Buttons.Light.Check.Check_Button; diff --git a/src/windows-jump.adb b/src/windows-jump.adb index 13f9cd0..bed3669 100644 --- a/src/windows-jump.adb +++ b/src/windows-jump.adb @@ -70,7 +70,6 @@ package body Windows.Jump is This.Go_Jump.Set_Callback (Jump_M'Access); This.Set_Callback (Hide_CB'Access); - This.Set_Icon (Logo); This.Set_Modal; end return; end Create; diff --git a/src/windows-jump.ads b/src/windows-jump.ads index f47db24..d458a8d 100644 --- a/src/windows-jump.ads +++ b/src/windows-jump.ads @@ -8,7 +8,7 @@ private with FLTK.Widgets.Inputs.Integer; package Windows.Jump is - type Jump_Window is new FLTK.Widgets.Groups.Windows.Double.Double_Window with private; + type Jump_Window is new Window with private; type Jump_Callback is access procedure @@ -38,7 +38,7 @@ package Windows.Jump is private - type Jump_Window is new FLTK.Widgets.Groups.Windows.Double.Double_Window with + type Jump_Window is new Window with record To_Line : FLTK.Widgets.Inputs.Integer.Integer_Input; Cancel : FLTK.Widgets.Buttons.Button; diff --git a/src/windows-replace.adb b/src/windows-replace.adb index 83e328d..8a48e0e 100644 --- a/src/windows-replace.adb +++ b/src/windows-replace.adb @@ -96,7 +96,6 @@ package body Windows.Replace is This.Start.Set_Callback (Replace_M'Access); This.Set_Callback (Hide_CB'Access); - This.Set_Icon (Logo); This.Set_Modal; end return; end Create; diff --git a/src/windows-replace.ads b/src/windows-replace.ads index 64ff562..48c3a73 100644 --- a/src/windows-replace.ads +++ b/src/windows-replace.ads @@ -9,7 +9,7 @@ private with FLTK.Widgets.Buttons.Light.Check; package Windows.Replace is - type Replace_Window is new FLTK.Widgets.Groups.Windows.Double.Double_Window with private; + type Replace_Window is new Window with private; type Replace_Callback is access procedure @@ -40,7 +40,7 @@ package Windows.Replace is private - type Replace_Window is new FLTK.Widgets.Groups.Windows.Double.Double_Window with + type Replace_Window is new Window with record Find_What, Replace_With : FLTK.Widgets.Inputs.Input; Match_Case, Replace_All : FLTK.Widgets.Buttons.Light.Check.Check_Button; diff --git a/src/windows.adb b/src/windows.adb index 3c2020d..eff387d 100644 --- a/src/windows.adb +++ b/src/windows.adb @@ -12,6 +12,16 @@ 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 b187b7b..64a8823 100644 --- a/src/windows.ads +++ b/src/windows.ads @@ -1,18 +1,26 @@ +with FLTK.Widgets.Groups.Windows.Double; with FLTK.Images.RGB.PNG; -private with FLTK.Widgets; package Windows is - Logo : FLTK.Images.RGB.PNG.PNG_Image := FLTK.Images.RGB.PNG.Create ("logo.png"); + type Window is new FLTK.Widgets.Groups.Windows.Double.Double_Window with private; + + + procedure Set_Logo + (This : in out Window; + Logo : in out FLTK.Images.RGB.PNG.PNG_Image); private + type Window is new FLTK.Widgets.Groups.Windows.Double.Double_Window with null record; + + procedure Hide_CB (Item : in out FLTK.Widgets.Widget'Class); -- cgit