ScreenSaver PreviewView code cleanup.
Eliminate Constants.h, set View color and low color black initially Move AddPreview and Remove Preview to bottom
This commit is contained in:
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "PreviewView.h"
|
#include "PreviewView.h"
|
||||||
#include "Constants.h"
|
|
||||||
#include "Utility.h"
|
#include "Utility.h"
|
||||||
|
|
||||||
#include <Point.h>
|
#include <Point.h>
|
||||||
@@ -63,13 +62,45 @@ PreviewView::~PreviewView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PreviewView::Draw(BRect update)
|
||||||
|
{
|
||||||
|
SetHighColor(184, 184, 184);
|
||||||
|
FillRoundRect(scale2(0, 9, 0, 3, Bounds()), 4, 4);
|
||||||
|
// Outer shape
|
||||||
|
FillRoundRect(scale2(2, 7, 3, 6, Bounds()), 2, 2);
|
||||||
|
// control console outline
|
||||||
|
|
||||||
|
SetHighColor(96, 96, 96);
|
||||||
|
StrokeRoundRect(scale2(2, 7, 3, 6, Bounds()), 2, 2);
|
||||||
|
// control console outline
|
||||||
|
StrokeRoundRect(scale2(0, 9, 0, 3, Bounds()), 4, 4);
|
||||||
|
// Outline outer shape
|
||||||
|
|
||||||
|
SetHighColor(0, 0, 0);
|
||||||
|
FillRect(scale2(1, 8, 1, 2, Bounds()));
|
||||||
|
|
||||||
|
SetHighColor(184, 184, 184);
|
||||||
|
BRect outerShape = scale2(2, 7, 2, 6, Bounds());
|
||||||
|
outerShape.InsetBy(1, 1);
|
||||||
|
FillRoundRect(outerShape, 4, 4);
|
||||||
|
// Outer shape
|
||||||
|
|
||||||
|
SetHighColor(0, 255, 0);
|
||||||
|
FillRect(scale2(3, 4, 4, 5, Bounds()));
|
||||||
|
SetHighColor(96, 96, 96);
|
||||||
|
FillRect(scale2(5, 6, 4, 5, Bounds()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BView*
|
BView*
|
||||||
PreviewView::AddPreview()
|
PreviewView::AddPreview()
|
||||||
{
|
{
|
||||||
BRect rect = scale2(1, 8, 1, 2, Bounds());
|
BRect rect = scale2(1, 8, 1, 2, Bounds());
|
||||||
rect.InsetBy(1, 1);
|
fSaverView = new BView(rect.InsetBySelf(1, 1), "preview", B_FOLLOW_NONE,
|
||||||
fSaverView = new BView(rect, "preview", B_FOLLOW_NONE, B_WILL_DRAW);
|
B_WILL_DRAW);
|
||||||
fSaverView->SetViewColor(0, 0, 0);
|
fSaverView->SetViewColor(0, 0, 0);
|
||||||
|
fSaverView->SetLowColor(0, 0, 0);
|
||||||
AddChild(fSaverView);
|
AddChild(fSaverView);
|
||||||
|
|
||||||
return fSaverView;
|
return fSaverView;
|
||||||
@@ -86,34 +117,3 @@ PreviewView::RemovePreview()
|
|||||||
fSaverView = NULL;
|
fSaverView = NULL;
|
||||||
return saverView;
|
return saverView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
PreviewView::Draw(BRect update)
|
|
||||||
{
|
|
||||||
SetHighColor(184, 184, 184);
|
|
||||||
FillRoundRect(scale2(0, 9, 0, 3, Bounds()), 4, 4);
|
|
||||||
// Outer shape
|
|
||||||
FillRoundRect(scale2(2, 7, 3, 6, Bounds()), 2, 2);
|
|
||||||
// control console outline
|
|
||||||
|
|
||||||
SetHighColor(96, 96, 96);
|
|
||||||
StrokeRoundRect(scale2(2, 7, 3, 6, Bounds()), 2, 2);
|
|
||||||
// control console outline
|
|
||||||
StrokeRoundRect(scale2(0, 9, 0, 3, Bounds()), 4, 4);
|
|
||||||
// Outline outer shape
|
|
||||||
|
|
||||||
SetHighColor(kBlack);
|
|
||||||
FillRect(scale2(1, 8, 1, 2, Bounds()));
|
|
||||||
|
|
||||||
SetHighColor(184, 184, 184);
|
|
||||||
BRect outerShape = scale2(2, 7, 2, 6, Bounds());
|
|
||||||
outerShape.InsetBy(1, 1);
|
|
||||||
FillRoundRect(outerShape, 4, 4);
|
|
||||||
// Outer shape
|
|
||||||
|
|
||||||
SetHighColor(0, 255, 0);
|
|
||||||
FillRect(scale2(3, 4, 4, 5, Bounds()));
|
|
||||||
SetHighColor(96, 96, 96);
|
|
||||||
FillRect(scale2(5, 6, 4, 5, Bounds()));
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user