Suggestion from Rene:
- Make the BuildScreenSaverDefaultSettingsView function be built into libscreensaver.so and under the BPrivate namespace. This avoids the repetition of the compiled code in each screen saver that uses it. - Updated the ScreenSaver preferences to use this. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33403 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -9,25 +9,12 @@
|
|||||||
#define BUILD_SCREEN_SAVER_DEFAULT_SETTINGS_VIEW
|
#define BUILD_SCREEN_SAVER_DEFAULT_SETTINGS_VIEW
|
||||||
|
|
||||||
|
|
||||||
#include <StringView.h>
|
class BView;
|
||||||
#include <View.h>
|
|
||||||
|
|
||||||
|
namespace BPrivate {
|
||||||
|
|
||||||
// This is used to provide a consistent look for the settings view for screen
|
void BuildScreenSaverDefaultSettingsView(BView* view, const char* moduleName, const char* info);
|
||||||
// savers without any configuration.
|
|
||||||
void
|
|
||||||
BuildScreenSaverDefaultSettingsView(BView* view, const char* moduleName, const char* info)
|
|
||||||
{
|
|
||||||
BRect rect(15, 15, 20, 20);
|
|
||||||
BStringView* stringView = new BStringView(rect, "module", moduleName);
|
|
||||||
stringView->SetFont(be_bold_font);
|
|
||||||
stringView->ResizeToPreferred();
|
|
||||||
view->AddChild(stringView);
|
|
||||||
|
|
||||||
rect.OffsetBy(0, stringView->Bounds().Height() + 4);
|
|
||||||
stringView = new BStringView(rect, "info", info);
|
|
||||||
stringView->ResizeToPreferred();
|
|
||||||
view->AddChild(stringView);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009, Haiku.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Ryan Leavengood, [email protected]
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <BuildScreenSaverDefaultSettingsView.h>
|
||||||
|
|
||||||
|
#include <StringView.h>
|
||||||
|
#include <View.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace BPrivate {
|
||||||
|
|
||||||
|
// This is used to provide a consistent look for the settings view for screen
|
||||||
|
// savers without any configuration.
|
||||||
|
void
|
||||||
|
BuildScreenSaverDefaultSettingsView(BView* view, const char* moduleName, const char* info)
|
||||||
|
{
|
||||||
|
BRect rect(15, 15, 20, 20);
|
||||||
|
BStringView* stringView = new BStringView(rect, "module", moduleName);
|
||||||
|
stringView->SetFont(be_bold_font);
|
||||||
|
stringView->ResizeToPreferred();
|
||||||
|
view->AddChild(stringView);
|
||||||
|
|
||||||
|
rect.OffsetBy(0, stringView->Bounds().Height() + 4);
|
||||||
|
stringView = new BStringView(rect, "info", info);
|
||||||
|
stringView->ResizeToPreferred();
|
||||||
|
view->AddChild(stringView);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -8,6 +8,7 @@ UseHeaders [ FDirName $(HAIKU_TOP) headers os add-ons screen_saver ] ;
|
|||||||
UsePrivateHeaders screen_saver ;
|
UsePrivateHeaders screen_saver ;
|
||||||
|
|
||||||
SharedLibrary libscreensaver.so :
|
SharedLibrary libscreensaver.so :
|
||||||
|
BuildScreenSaverDefaultSettingsView.cpp
|
||||||
ScreenSaver.cpp
|
ScreenSaver.cpp
|
||||||
ScreenSaverSettings.cpp
|
ScreenSaverSettings.cpp
|
||||||
ScreenSaverRunner.cpp
|
ScreenSaverRunner.cpp
|
||||||
|
|||||||
@@ -532,7 +532,7 @@ ModulesView::_OpenSaver()
|
|||||||
if (fSettingsView->ChildAt(0) == NULL) {
|
if (fSettingsView->ChildAt(0) == NULL) {
|
||||||
// There are no settings at all, we add the module name here to
|
// There are no settings at all, we add the module name here to
|
||||||
// let it look a bit better at least.
|
// let it look a bit better at least.
|
||||||
BuildScreenSaverDefaultSettingsView(fSettingsView,
|
BPrivate::BuildScreenSaverDefaultSettingsView(fSettingsView,
|
||||||
fSettings.ModuleName()[0] ? fSettings.ModuleName() : "Blackness",
|
fSettings.ModuleName()[0] ? fSettings.ModuleName() : "Blackness",
|
||||||
saver || !fSettings.ModuleName()[0]
|
saver || !fSettings.ModuleName()[0]
|
||||||
? "No options available" : "Could not load screen saver");
|
? "No options available" : "Could not load screen saver");
|
||||||
|
|||||||
Reference in New Issue
Block a user