ScreenSaver: Style fixes

Update Copyright year and fix authors adding myself.
Mostly spacing and indentation fixes.
This commit is contained in:
John Scipione
2013-09-02 13:18:36 -04:00
parent 15a557e69c
commit 23ca081a2f
10 changed files with 158 additions and 128 deletions
+6 -5
View File
@@ -5,10 +5,11 @@
#include <GraphicsDefs.h>
const rgb_color kBlack = {0,0,0,0};
const rgb_color kDarkGrey = {150,150,150,0};
const rgb_color kGrey = {200,200,200,0};
const rgb_color kLightBlue = {200,200,255,0};
const rgb_color kLightGreen = {255,200,200,0};
const rgb_color kBlack = { 0, 0, 0, 0};
const rgb_color kDarkGrey = { 150, 150, 150, 0};
const rgb_color kGrey = { 200, 200, 200, 0};
const rgb_color kLightBlue = { 200, 200, 255, 0};
const rgb_color kLightGreen = { 255, 200, 200, 0};
#endif // CONSTANTS_H
+28 -27
View File
@@ -1,15 +1,16 @@
/*
* Copyright 2003-2007, Haiku, Inc. All Rights Reserved.
* Copyright 2003-2013 Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Michael Phipps
* Jérôme Duval, [email protected]
* Julun <[email protected]>
* Julun, [email protected]
* Michael Phipps
* John Scipione, [email protected]
*/
#include "PasswordWindow.h"
#include "PasswordWindow.h"
#include <Alert.h>
#include <Box.h>
@@ -138,12 +139,12 @@ PasswordWindow::Update()
}
char *
PasswordWindow::_SanitizeSalt(const char *password)
char*
PasswordWindow::_SanitizeSalt(const char* password)
{
char *salt;
uint8 length = strlen(password);
char* salt;
uint8 length = strlen(password);
if (length < 2)
salt = new char[3];
@@ -174,45 +175,45 @@ PasswordWindow::_SanitizeSalt(const char *password)
void
PasswordWindow::MessageReceived(BMessage *message)
PasswordWindow::MessageReceived(BMessage* message)
{
switch (message->what) {
case kMsgDone:
fSettings.SetLockMethod(fUseCustom->Value() ? "custom" : "network");
if (fUseCustom->Value()) {
if (strcmp(fPasswordControl->Text(), fConfirmControl->Text())) {
BAlert *alert = new BAlert("noMatch",
if (strcmp(fPasswordControl->Text(), fConfirmControl->Text())
!= 0) {
BAlert* alert = new BAlert("noMatch",
B_TRANSLATE("Passwords don't match. Please try again."),
B_TRANSLATE("OK"));
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
break;
}
const char *salt = _SanitizeSalt(fPasswordControl->Text());
const char* salt = _SanitizeSalt(fPasswordControl->Text());
fSettings.SetPassword(crypt(fPasswordControl->Text(), salt));
delete[] salt;
} else {
} else
fSettings.SetPassword("");
}
fPasswordControl->SetText("");
fConfirmControl->SetText("");
fSettings.Save();
Hide();
break;
case B_CANCEL:
fPasswordControl->SetText("");
fConfirmControl->SetText("");
Hide();
break;
case B_CANCEL:
fPasswordControl->SetText("");
fConfirmControl->SetText("");
Hide();
break;
case kMsgPasswordTypeChanged:
fSettings.SetLockMethod(fUseCustom->Value() > 0 ? "custom" : "network");
Update();
break;
case kMsgPasswordTypeChanged:
fSettings.SetLockMethod(fUseCustom->Value() > 0 ? "custom" : "network");
Update();
break;
default:
BWindow::MessageReceived(message);
break;
default:
BWindow::MessageReceived(message);
}
}
+17 -17
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2007, Haiku, Inc. All Rights Reserved.
* Copyright 2003-2013 Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -10,34 +10,34 @@
#define PASSWORD_WINDOW_H
#include "ScreenSaverSettings.h"
#include <Window.h>
class BRadioButton;
class BTextControl;
class ScreenSaverSettings;
class PasswordWindow : public BWindow {
public:
PasswordWindow(ScreenSaverSettings &settings);
public:
PasswordWindow(ScreenSaverSettings& settings);
virtual void MessageReceived(BMessage *message);
virtual void MessageReceived(BMessage* message);
void Update();
void Update();
private:
void _Setup();
char * _SanitizeSalt(const char *password);
private:
void _Setup();
char* _SanitizeSalt(const char* password);
BRadioButton *fUseCustom;
BRadioButton *fUseNetwork;
BTextControl *fConfirmControl;
BTextControl *fPasswordControl;
ScreenSaverSettings &fSettings;
BRadioButton* fUseCustom;
BRadioButton* fUseNetwork;
BTextControl* fConfirmControl;
BTextControl* fPasswordControl;
ScreenSaverSettings& fSettings;
};
#endif // PASSWORD_WINDOW_H
+30 -21
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2006, Haiku.
* Copyright 2003-20013 Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -22,26 +22,29 @@
#include <iostream>
static float sampleX[]= {0,.05,.15,.7,.725,.8,.825,.85,.950,1.0};
static float sampleY[]= {0,.05,.90,.95,.966,.975,1.0};
static float sampleX[]
= { 0, 0.05, 0.15, 0.7, 0.725, 0.8, 0.825, 0.85, 0.950, 1.0 };
static float sampleY[] = { 0, 0.05, 0.90, 0.95, 0.966, 0.975, 1.0 };
inline BPoint
scale2(int x, int y,BRect area)
scale2(int x, int y, BRect area)
{
return scale_direct(sampleX[x],sampleY[y],area);
return scale_direct(sampleX[x], sampleY[y], area);
}
inline BRect
scale2(int x1, int x2, int y1, int y2,BRect area)
scale2(int x1, int x2, int y1, int y2, BRect area)
{
return scale_direct(sampleX[x1],sampleX[x2],sampleY[y1],sampleY[y2],area);
return scale_direct(sampleX[x1], sampleX[x2], sampleY[y1], sampleY[y2],
area);
}
PreviewView::PreviewView(BRect frame, const char *name)
: BView(frame, name, B_FOLLOW_NONE, B_WILL_DRAW),
PreviewView::PreviewView(const char* name)
:
BView(name, B_WILL_DRAW),
fSaverView(NULL)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
@@ -56,7 +59,7 @@ PreviewView::~PreviewView()
BView*
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, "preview", B_FOLLOW_NONE, B_WILL_DRAW);
fSaverView->SetViewColor(0, 0, 0);
@@ -82,22 +85,28 @@ 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
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
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()));
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
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()));
FillRect(scale2(3, 4, 4, 5, Bounds()));
SetHighColor(96, 96, 96);
FillRect(scale2(5, 6, 4, 5, Bounds()));
}
+10 -11
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2006, Haiku.
* Copyright 2003-20013 Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -14,21 +14,20 @@
#include <Box.h>
#include <ScreenSaverRunner.h>
class BScreenSaver;
class PreviewView : public BView {
public:
PreviewView(BRect frame, const char *name);
virtual ~PreviewView();
public:
PreviewView(const char* name);
virtual ~PreviewView();
virtual void Draw(BRect update);
virtual void Draw(BRect update);
BView* AddPreview();
BView* RemovePreview();
BView* AddPreview();
BView* RemovePreview();
private:
BView* fSaverView;
private:
BView* fSaverView;
};
#endif // PREVIEW_VIEW_H
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2009, Haiku.
* Copyright 2003-2013 Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -8,8 +8,8 @@
*/
#include "ScreenCornerSelector.h"
#include "Constants.h"
#include "Utility.h"
#include <stdio.h>
#include <Rect.h>
#include <Point.h>
@@ -17,7 +17,8 @@
#include <Screen.h>
#include <Window.h>
#include <stdio.h>
#include "Constants.h"
#include "Utility.h"
static const float kAspectRatio = 4.0f / 3.0f;
@@ -26,10 +27,11 @@ static const float kArrowSize = 11.0f;
static const float kStopSize = 15.0f;
ScreenCornerSelector::ScreenCornerSelector(BRect frame, const char *name,
BMessage* message, uint32 resizingMode)
: BControl(frame, name, NULL, message, resizingMode,
B_WILL_DRAW | B_NAVIGABLE),
ScreenCornerSelector::ScreenCornerSelector(BRect frame, const char* name,
BMessage* message, uint32 resizingMode)
:
BControl(frame, name, NULL, message, resizingMode,
B_WILL_DRAW | B_NAVIGABLE | B_FULL_UPDATE_ON_RESIZE),
fCurrentCorner(NO_CORNER),
fPreviousCorner(-1)
{
@@ -70,7 +72,7 @@ ScreenCornerSelector::_CenterFrame(BRect innerFrame) const
void
ScreenCornerSelector::Draw(BRect update)
ScreenCornerSelector::Draw(BRect updateRect)
{
rgb_color darkColor = {160, 160, 160, 255};
rgb_color blackColor = {0, 0, 0, 255};
@@ -82,7 +84,7 @@ ScreenCornerSelector::Draw(BRect update)
SetDrawingMode(B_OP_OVER);
if (!_InnerFrame(outerRect).Contains(update)) {
if (!_InnerFrame(outerRect).Contains(updateRect)) {
// frame & background
// if the focus is changing, we don't redraw the whole view, but only
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2006, Haiku.
* Copyright 2003-2013 Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -10,38 +10,43 @@
#define SCREEN_CORNER_SELECTOR_H
#include "ScreenSaverSettings.h"
#include <Control.h>
#include "ScreenSaverSettings.h"
class ScreenCornerSelector : public BControl {
public:
ScreenCornerSelector(BRect frame, const char *name, BMessage* message,
uint32 resizingMode);
public:
ScreenCornerSelector(BRect frame,
const char *name, BMessage* message,
uint32 resizingMode);
virtual void Draw(BRect update);
virtual void MouseDown(BPoint point);
virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage);
virtual void KeyDown(const char* bytes, int32 numBytes);
virtual void Draw(BRect updateRect);
virtual void MouseDown(BPoint point);
virtual void MouseUp(BPoint point);
virtual void MouseMoved(BPoint where, uint32 transit,
const BMessage* dragMessage);
virtual void KeyDown(const char* bytes, int32 numBytes);
virtual void SetValue(int32 value);
virtual int32 Value();
virtual void SetValue(int32 value);
virtual int32 Value();
void SetCorner(screen_corner corner);
screen_corner Corner() const;
void SetCorner(screen_corner corner);
screen_corner Corner() const;
private:
BRect _MonitorFrame() const;
BRect _InnerFrame(BRect monitorFrame) const;
BRect _CenterFrame(BRect innerFrame) const;
void _DrawStop(BRect innerFrame);
void _DrawArrow(BRect innerFrame);
screen_corner _ScreenCorner(BPoint point, screen_corner previous) const;
private:
BRect _MonitorFrame() const;
BRect _InnerFrame(BRect monitorFrame) const;
BRect _CenterFrame(BRect innerFrame) const;
void _DrawStop(BRect innerFrame);
void _DrawArrow(BRect innerFrame);
screen_corner _ScreenCorner(BPoint point,
screen_corner previous) const;
screen_corner fCurrentCorner;
int32 fPreviousCorner;
screen_corner fCurrentCorner;
int32 fPreviousCorner;
};
#endif // SCREEN_CORNER_SELECTOR_H
@@ -1,11 +1,12 @@
/*
* Copyright 2003-2010, Haiku.
* Copyright 2003-2013 Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Michael Phipps
* Jérôme Duval, jerome.duval@free.fr
* Axel Dörfler, axeld@pinc-software.de
* Jérôme Duval, jerome.duval@free.fr
* Michael Phipps
* John Scipione, jscipione@gmail.com
*/
@@ -40,9 +41,11 @@
#include "ScreenCornerSelector.h"
#include "ScreenSaverItem.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "ScreenSaver"
const uint32 kPreviewMonitorGap = 16;
const uint32 kMinSettingsWidth = 230;
const uint32 kMinSettingsHeight = 120;
@@ -135,6 +138,9 @@ private:
};
// #pragma mark - TimeSlider
static const int32 kTimeInUnits[] = {
30, 60, 90,
120, 150, 180,
@@ -146,6 +152,7 @@ static const int32 kTimeInUnits[] = {
7200, 9000, 10800,
14400, 18000
};
static const int32 kTimeUnitCount
= sizeof(kTimeInUnits) / sizeof(kTimeInUnits[0]);
@@ -217,7 +224,7 @@ TimeSlider::_TimeToString(bigtime_t useconds, BString& string)
}
// #pragma mark -
// #pragma mark - FadeView
FadeView::FadeView(BRect rect, const char* name, ScreenSaverSettings& settings)
@@ -382,8 +389,9 @@ ModulesView::MessageReceived(BMessage* message)
// database for example...
BPath path;
if (find_directory(B_SYSTEM_BIN_DIRECTORY, &path) != B_OK
|| path.Append("screen_blanker") != B_OK)
|| path.Append("screen_blanker") != B_OK) {
path.SetTo("/bin/screen_blanker");
}
BEntry entry(path.Path());
entry_ref ref;
@@ -393,6 +401,7 @@ ModulesView::MessageReceived(BMessage* message)
}
break;
}
case kMsgAddSaver:
fFilePanel->Show();
break;
@@ -513,6 +522,7 @@ ModulesView::_CloseSaver()
if (fSaverRunner != NULL)
fSaverRunner->Quit();
if (saver != NULL)
saver->StopConfig();
@@ -544,6 +554,7 @@ ModulesView::_OpenSaver()
rect.top += 14;
#endif
fSettingsView = new BView(rect, "SettingsView", B_FOLLOW_ALL, B_WILL_DRAW);
fSettingsView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fSettingsBox->AddChild(fSettingsView);
@@ -611,7 +622,7 @@ ModulesView::_OpenSaver()
}
// #pragma mark -
// #pragma mark - ScreenSaverWindow
ScreenSaverWindow::ScreenSaverWindow()
@@ -1004,4 +1015,3 @@ ScreenSaverWindow::QuitRequested()
be_app->PostMessage(B_QUIT_REQUESTED);
return true;
}
@@ -1,18 +1,18 @@
/*
* Copyright 2003-2010, Haiku.
* Copyright 2003-2013 Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Michael Phipps
* Jérôme Duval, jerome.duval@free.fr
* Axel Dörfler, axeld@pinc-software.de
* Jérôme Duval, jerome.duval@free.fr
* Michael Phipps
* John Scipione, jscipione@gmail.com
*/
#ifndef SCREEN_SAVER_WINDOW_H
#define SCREEN_SAVER_WINDOW_H
#include "PasswordWindow.h"
#include "ScreenSaverSettings.h"
#include <Box.h>
#include <CheckBox.h>
@@ -20,6 +20,8 @@
#include <Slider.h>
#include <ListView.h>
#include "ScreenSaverSettings.h"
class BButton;
class BTabView;
+3 -2
View File
@@ -19,8 +19,8 @@ scale_direct(float x1, float x2, float y1, float y2, BRect area)
area.Width()* x2 + area.left, area.Height() * y2 + area.top);
}
static const float kPositionalX[] = { 0, .1, .25, .3, .7, .75, .9, 1.0 };
static const float kPositionalY[] = { 0, .1, .7, .8, .9, 1.0 };
static const float kPositionalX[] = { 0, 0.1, 0.25, 0.3, 0.7, 0.75, 0.9, 1.0 };
static const float kPositionalY[] = { 0, 0.1, 0.7, 0.8, 0.9, 1.0 };
inline BPoint
scale(int x, int y,BRect area)
@@ -36,4 +36,5 @@ scale(int x1, int x2, int y1, int y2,BRect area)
kPositionalY[y1], kPositionalY[y2], area);
}
#endif // UTILITY_H