aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/images.adb44
-rw-r--r--src/images.ads17
-rw-r--r--src/windows.ads15
3 files changed, 65 insertions, 11 deletions
diff --git a/src/images.adb b/src/images.adb
new file mode 100644
index 0000000..07897d1
--- /dev/null
+++ b/src/images.adb
@@ -0,0 +1,44 @@
+
+
+with
+
+ Ada.Command_Line,
+ Ada.Directories,
+ FLTK.Images.RGB.PNG,
+ Here_I_Am;
+
+
+package body Images is
+
+
+ package ACom renames Ada.Command_Line;
+ package ADir renames Ada.Directories;
+
+
+ Dummy : constant FLTK.Color_Component_Array := (1 .. 0 => 0);
+
+
+
+
+ function Load_Logo
+ return FLTK.Images.RGB.RGB_Image'Class is
+ begin
+ declare
+ Base_Path : String := ADir.Containing_Directory (Here_I_Am.Executable);
+ Logo_Path : String :=
+ ADir.Compose
+ (ADir.Compose -- No matter how many times I write this, still looks weird...
+ (ADir.Compose
+ (ADir.Compose (Base_Path, ".."), "share"), "adapad"), "logo.png");
+ begin
+ return FLTK.Images.RGB.PNG.Forge.Create (Logo_Path);
+ end;
+ exception
+ when others =>
+ return FLTK.Images.RGB.Forge.Create (Dummy, 0, 0);
+ end Load_Logo;
+
+
+end Images;
+
+
diff --git a/src/images.ads b/src/images.ads
new file mode 100644
index 0000000..e6d44f5
--- /dev/null
+++ b/src/images.ads
@@ -0,0 +1,17 @@
+
+
+with
+
+ FLTK.Images.RGB;
+
+
+package Images is
+
+
+ function Load_Logo
+ return FLTK.Images.RGB.RGB_Image'Class;
+
+
+end Images;
+
+
diff --git a/src/windows.ads b/src/windows.ads
index 8050467..222efcf 100644
--- a/src/windows.ads
+++ b/src/windows.ads
@@ -3,12 +3,8 @@
with
FLTK.Widgets.Groups.Windows.Double,
- FLTK.Images.RGB.PNG;
-
-private with
-
- Ada.Command_Line,
- Ada.Directories;
+ FLTK.Images.RGB,
+ Images;
package Windows is
@@ -27,12 +23,9 @@ 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.Forge.Create (Origin & "/../share/adapad/logo.png");
+ Logo : FLTK.Images.RGB.RGB_Image'Class := Images.Load_Logo;
end Windows;
+