ScreenSaver: rework some of the fixes
* Use a BTextView for the "no preview" text again, as Skipp_OSX pointed this allows it to word wrap as needed with any font bigger than 10pt. * Show a black screen rather than the "no preview" text for Darkness and when a screensaver fails to load. This matches what screen_blanker will do.
This commit is contained in:
@@ -64,11 +64,18 @@ PreviewView::PreviewView(const char* name)
|
|||||||
|
|
||||||
BGroupLayout* layout = new BGroupLayout(B_VERTICAL);
|
BGroupLayout* layout = new BGroupLayout(B_VERTICAL);
|
||||||
// We draw the "monitor" around the preview, hence the strange insets.
|
// We draw the "monitor" around the preview, hence the strange insets.
|
||||||
layout->SetInsets(10, 8, 11, 16);
|
layout->SetInsets(7, 6, 8, 12);
|
||||||
SetLayout(layout);
|
SetLayout(layout);
|
||||||
|
|
||||||
fNoPreview = new BStringView("no preview",
|
// A BStringView would be enough, if only it handled word wrapping.
|
||||||
B_TRANSLATE("No preview available"));
|
fNoPreview = new BTextView("no preview");
|
||||||
|
fNoPreview->SetText(B_TRANSLATE("No preview available"));
|
||||||
|
fNoPreview->SetFontAndColor(be_plain_font, B_FONT_ALL, &kWhite);
|
||||||
|
fNoPreview->MakeEditable(false);
|
||||||
|
fNoPreview->MakeResizable(false);
|
||||||
|
fNoPreview->MakeSelectable(false);
|
||||||
|
fNoPreview->SetViewColor(0, 0, 0);
|
||||||
|
fNoPreview->SetLowColor(0, 0, 0);
|
||||||
|
|
||||||
fNoPreview->Hide();
|
fNoPreview->Hide();
|
||||||
|
|
||||||
@@ -138,6 +145,7 @@ PreviewView::AddPreview()
|
|||||||
|
|
||||||
fNoPreview->SetExplicitSize(BSize(previewWidth, previewHeight));
|
fNoPreview->SetExplicitSize(BSize(previewWidth, previewHeight));
|
||||||
fNoPreview->ResizeTo(previewWidth, previewHeight);
|
fNoPreview->ResizeTo(previewWidth, previewHeight);
|
||||||
|
fNoPreview->SetInsets(0, previewHeight / 3, 0 , 0);
|
||||||
|
|
||||||
return fSaverView;
|
return fSaverView;
|
||||||
}
|
}
|
||||||
@@ -146,6 +154,8 @@ PreviewView::AddPreview()
|
|||||||
BView*
|
BView*
|
||||||
PreviewView::RemovePreview()
|
PreviewView::RemovePreview()
|
||||||
{
|
{
|
||||||
|
ShowNoPreview();
|
||||||
|
|
||||||
if (fSaverView != NULL)
|
if (fSaverView != NULL)
|
||||||
ChildAt(0)->RemoveChild(fSaverView);
|
ChildAt(0)->RemoveChild(fSaverView);
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
|
|
||||||
class BStringView;
|
class BTextView;
|
||||||
|
|
||||||
class PreviewView : public BView {
|
class PreviewView : public BView {
|
||||||
public:
|
public:
|
||||||
@@ -31,7 +31,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
BView* fSaverView;
|
BView* fSaverView;
|
||||||
BStringView* fNoPreview;
|
BTextView* fNoPreview;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -833,8 +833,12 @@ ModulesView::_OpenSaver()
|
|||||||
fSaverRunner->Run();
|
fSaverRunner->Run();
|
||||||
} else
|
} else
|
||||||
fPreviewView->ShowNoPreview();
|
fPreviewView->ShowNoPreview();
|
||||||
} else
|
} else {
|
||||||
fPreviewView->ShowNoPreview();
|
// Failed to load OR this is the "Darkness" screensaver. Show a black
|
||||||
|
// preview (this is what will happen in both cases when screen_blanker
|
||||||
|
// runs).
|
||||||
|
fPreviewView->HideNoPreview();
|
||||||
|
}
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user