1
1
/*
2
+ * Copyright 2018 Humdinger
3
+ * Copyright 2017-2018 Owen
2
4
* Copyright 2009-2017 Scott McCreary
3
5
* Copyright 2014-2016 Puck Meerburg
4
6
* Copyright 2013 Luke (noryb009)
18
20
#include < Bitmap.h>
19
21
#include < TranslationUtils.h>
20
22
#include < Roster.h>
23
+ #include < StringList.h>
21
24
#include < Path.h>
25
+ #include < PathFinder.h>
22
26
#include < Entry.h>
23
27
#include < Directory.h>
24
28
#include < Box.h>
@@ -70,15 +74,18 @@ MainWindow::MainWindow(void)
70
74
fGrid(NULL ),
71
75
fWorkGrid(NULL )
72
76
{
73
- app_info ai;
74
- be_app->GetAppInfo (&ai);
75
- BPath path (&ai.ref );
76
- path.GetParent (&path);
77
- path.Append (" backgrounds" );
78
- fBackPath = path.Path ();
77
+ BPath path;
78
+ BPathFinder pathFinder;
79
+ BStringList paths;
80
+
81
+ status_t error = pathFinder.FindPaths (B_FIND_PATH_DATA_DIRECTORY,
82
+ " hexvexed/backgrounds" , paths);
83
+
84
+ if (error == B_OK && path.SetTo (paths.StringAt (0 )) == B_OK)
85
+ fBackPath = path.Path ();
86
+
79
87
fBackPath << " /" ;
80
88
81
- static const rgb_color beos_blue = {51 ,102 ,152 ,255 };
82
89
Preferences::Init ();
83
90
Preferences::LockPreferences ();
84
91
Preferences::Load ();
@@ -99,10 +106,8 @@ MainWindow::MainWindow(void)
99
106
Preferences::Message ().AddInt8 (" numberbase" , fNumberBase );
100
107
}
101
108
102
- fBack = new BackView (Bounds ()," background" ,B_FOLLOW_ALL,B_WILL_DRAW | B_DRAW_ON_CHILDREN);
109
+ fBack = new BView (Bounds ()," background" ,B_FOLLOW_ALL,B_WILL_DRAW | B_DRAW_ON_CHILDREN);
103
110
AddChild (fBack );
104
- rgb_color randa = {rand () % 255 , rand () % 255 , rand () % 255 , 255 };
105
- fBack ->SetViewColor (B_TRANSPARENT_COLOR);
106
111
107
112
fMenuBar = new BMenuBar (BRect (0 ,0 ,Bounds ().Width (),20 )," menubar" );
108
113
fBack ->AddChild (fMenuBar );
@@ -229,6 +234,8 @@ MainWindow::MainWindow(void)
229
234
230
235
if (Preferences::Message ().FindString (" background" ,&fBackName ) == B_OK)
231
236
SetBackground (fBackName .String ());
237
+ else
238
+ SetBackground (" Grass.png" ); // default
232
239
233
240
Preferences::UnlockPreferences ();
234
241
}
@@ -511,8 +518,6 @@ void MainWindow::ScanBackgrounds(void)
511
518
512
519
BMessage *msg = new BMessage (M_SET_BACKGROUND);
513
520
msg->AddString (" name" ," " );
514
- fBackMenu ->AddItem (new BMenuItem (" None" ,msg));
515
- fBackMenu ->AddSeparatorItem ();
516
521
517
522
BDirectory dir (fBackPath .String ());
518
523
dir.Rewind ();
0 commit comments