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
+1
View File
@@ -11,4 +11,5 @@ 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
@@ -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>
@@ -180,7 +181,8 @@ PasswordWindow::MessageReceived(BMessage *message)
case kMsgDone:
fSettings.SetLockMethod(fUseCustom->Value() ? "custom" : "network");
if (fUseCustom->Value()) {
if (strcmp(fPasswordControl->Text(), fConfirmControl->Text())) {
if (strcmp(fPasswordControl->Text(), fConfirmControl->Text())
!= 0) {
BAlert* alert = new BAlert("noMatch",
B_TRANSLATE("Passwords don't match. Please try again."),
B_TRANSLATE("OK"));
@@ -191,9 +193,9 @@ PasswordWindow::MessageReceived(BMessage *message)
const char* salt = _SanitizeSalt(fPasswordControl->Text());
fSettings.SetPassword(crypt(fPasswordControl->Text(), salt));
delete[] salt;
} else {
} else
fSettings.SetPassword("");
}
fPasswordControl->SetText("");
fConfirmControl->SetText("");
fSettings.Save();
@@ -213,6 +215,5 @@ PasswordWindow::MessageReceived(BMessage *message)
default:
BWindow::MessageReceived(message);
break;
}
}
+4 -4
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,15 +10,14 @@
#define PASSWORD_WINDOW_H
#include "ScreenSaverSettings.h"
#include <Window.h>
class BRadioButton;
class BTextControl;
class ScreenSaverSettings;
class PasswordWindow : public BWindow {
public:
@@ -40,4 +39,5 @@ class PasswordWindow : public BWindow {
ScreenSaverSettings& fSettings;
};
#endif // PASSWORD_WINDOW_H
+20 -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:
@@ -22,8 +22,9 @@
#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
@@ -36,12 +37,14 @@ scale2(int x, int y,BRect area)
inline BRect
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));
@@ -82,19 +85,25 @@ 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()));
SetHighColor(184, 184, 184);
BRect outerShape = scale2(2, 7, 2, 6, Bounds());
outerShape.InsetBy(1, 1);
FillRoundRect(outerShape,4,4);// Outer shape
FillRoundRect(outerShape, 4, 4);
// Outer shape
SetHighColor(0, 255, 0);
FillRect(scale2(3, 4, 4, 5, Bounds()));
+3 -4
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,12 +14,10 @@
#include <Box.h>
#include <ScreenSaverRunner.h>
class BScreenSaver;
class PreviewView : public BView {
public:
PreviewView(BRect frame, const char *name);
PreviewView(const char* name);
virtual ~PreviewView();
virtual void Draw(BRect update);
@@ -31,4 +29,5 @@ class PreviewView : public BView {
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;
@@ -28,8 +29,9 @@ 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),
:
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,20 +10,23 @@
#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,
ScreenCornerSelector(BRect frame,
const char *name, BMessage* message,
uint32 resizingMode);
virtual void Draw(BRect update);
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 MouseMoved(BPoint where, uint32 transit,
const BMessage* dragMessage);
virtual void KeyDown(const char* bytes, int32 numBytes);
virtual void SetValue(int32 value);
@@ -38,10 +41,12 @@ class ScreenCornerSelector : public BControl {
BRect _CenterFrame(BRect innerFrame) const;
void _DrawStop(BRect innerFrame);
void _DrawArrow(BRect innerFrame);
screen_corner _ScreenCorner(BPoint point, screen_corner previous) const;
screen_corner _ScreenCorner(BPoint point,
screen_corner previous) const;
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, [email protected]
* Axel Dörfler, [email protected]
* Jérôme Duval, [email protected]
* Michael Phipps
* John Scipione, [email protected]
*/
@@ -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, [email protected]
* Axel Dörfler, [email protected]
* Jérôme Duval, [email protected]
* Michael Phipps
* John Scipione, [email protected]
*/
#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