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:
parent
da2ec759d7
commit
4ddea1f862
@ -64,11 +64,18 @@ PreviewView::PreviewView(const char* name)
|
||||
|
||||
BGroupLayout* layout = new BGroupLayout(B_VERTICAL);
|
||||
// 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);
|
||||
|
||||
fNoPreview = new BStringView("no preview",
|
||||
B_TRANSLATE("No preview available"));
|
||||
// A BStringView would be enough, if only it handled word wrapping.
|
||||
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();
|
||||
|
||||
@ -138,6 +145,7 @@ PreviewView::AddPreview()
|
||||
|
||||
fNoPreview->SetExplicitSize(BSize(previewWidth, previewHeight));
|
||||
fNoPreview->ResizeTo(previewWidth, previewHeight);
|
||||
fNoPreview->SetInsets(0, previewHeight / 3, 0 , 0);
|
||||
|
||||
return fSaverView;
|
||||
}
|
||||
@ -146,6 +154,8 @@ PreviewView::AddPreview()
|
||||
BView*
|
||||
PreviewView::RemovePreview()
|
||||
{
|
||||
ShowNoPreview();
|
||||
|
||||
if (fSaverView != NULL)
|
||||
ChildAt(0)->RemoveChild(fSaverView);
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <View.h>
|
||||
|
||||
|
||||
class BStringView;
|
||||
class BTextView;
|
||||
|
||||
class PreviewView : public BView {
|
||||
public:
|
||||
@ -31,7 +31,7 @@ public:
|
||||
|
||||
private:
|
||||
BView* fSaverView;
|
||||
BStringView* fNoPreview;
|
||||
BTextView* fNoPreview;
|
||||
};
|
||||
|
||||
|
||||
|
@ -833,8 +833,12 @@ ModulesView::_OpenSaver()
|
||||
fSaverRunner->Run();
|
||||
} else
|
||||
fPreviewView->ShowNoPreview();
|
||||
} else
|
||||
fPreviewView->ShowNoPreview();
|
||||
} else {
|
||||
// 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) {
|
||||
// There are no settings at all, we add the module name here to
|
||||
|
Loading…
Reference in New Issue
Block a user