Pulse: automatic whitespace cleanup.

This commit is contained in:
Augustin Cavalier
2015-02-14 18:49:22 -05:00
parent 99515c66b8
commit 9c353c978c
16 changed files with 72 additions and 72 deletions
+1 -1
View File
@@ -313,7 +313,7 @@ CPUButton::AttachedToWindow()
SetTarget(this); SetTarget(this);
SetFont(be_plain_font); SetFont(be_plain_font);
SetFontSize(10); SetFontSize(10);
fReplicantInDeskbar = false; fReplicantInDeskbar = false;
if (fReplicant) { if (fReplicant) {
+2 -2
View File
@@ -28,11 +28,11 @@ class CPUButton : public BControl {
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void DetachedFromWindow(); virtual void DetachedFromWindow();
status_t Invoke(BMessage *message = NULL); status_t Invoke(BMessage *message = NULL);
static CPUButton *Instantiate(BMessage *data); static CPUButton *Instantiate(BMessage *data);
status_t Archive(BMessage *data, bool deep = true) const; status_t Archive(BMessage *data, bool deep = true) const;
void UpdateColors(int32 color); void UpdateColors(int32 color);
private: private:
+13 -13
View File
@@ -82,7 +82,7 @@ ConfigView::ConfigView(BRect rect, const char *name, uint32 mode, BMessenger& ta
if (mode == PRV_NORMAL_CHANGE_COLOR) { if (mode == PRV_NORMAL_CHANGE_COLOR) {
// normal mode // normal mode
fFadeCheckBox = new BCheckBox(rect, "FadeColors", fFadeCheckBox = new BCheckBox(rect, "FadeColors",
B_TRANSLATE("Fade colors"), new BMessage(PRV_NORMAL_FADE_COLORS)); B_TRANSLATE("Fade colors"), new BMessage(PRV_NORMAL_FADE_COLORS));
fFadeCheckBox->ResizeToPreferred(); fFadeCheckBox->ResizeToPreferred();
AddChild(fFadeCheckBox); AddChild(fFadeCheckBox);
@@ -92,20 +92,20 @@ ConfigView::ConfigView(BRect rect, const char *name, uint32 mode, BMessenger& ta
} else if (mode == PRV_MINI_CHANGE_COLOR) { } else if (mode == PRV_MINI_CHANGE_COLOR) {
// mini mode // mini mode
fActiveButton = new BRadioButton(rect, "ActiveColor", fActiveButton = new BRadioButton(rect, "ActiveColor",
B_TRANSLATE("Active color"), new BMessage(PRV_MINI_ACTIVE)); B_TRANSLATE("Active color"), new BMessage(PRV_MINI_ACTIVE));
fActiveButton->ResizeToPreferred(); fActiveButton->ResizeToPreferred();
fActiveButton->SetValue(B_CONTROL_ON); fActiveButton->SetValue(B_CONTROL_ON);
AddChild(fActiveButton); AddChild(fActiveButton);
rect.left = fActiveButton->Frame().right + 5.0f; rect.left = fActiveButton->Frame().right + 5.0f;
fIdleButton = new BRadioButton(rect, "IdleColor", fIdleButton = new BRadioButton(rect, "IdleColor",
B_TRANSLATE("Idle color"), new BMessage(PRV_MINI_IDLE)); B_TRANSLATE("Idle color"), new BMessage(PRV_MINI_IDLE));
fIdleButton->ResizeToPreferred(); fIdleButton->ResizeToPreferred();
AddChild(fIdleButton); AddChild(fIdleButton);
rect.left = fIdleButton->Frame().right + 5.0f; rect.left = fIdleButton->Frame().right + 5.0f;
fFrameButton = new BRadioButton(rect, "FrameColor", fFrameButton = new BRadioButton(rect, "FrameColor",
B_TRANSLATE("Frame color"), new BMessage(PRV_MINI_FRAME)); B_TRANSLATE("Frame color"), new BMessage(PRV_MINI_FRAME));
fFrameButton->ResizeToPreferred(); fFrameButton->ResizeToPreferred();
AddChild(fFrameButton); AddChild(fFrameButton);
@@ -113,20 +113,20 @@ ConfigView::ConfigView(BRect rect, const char *name, uint32 mode, BMessenger& ta
fColorControl->SetValue(fPrefs->mini_active_color); fColorControl->SetValue(fPrefs->mini_active_color);
} else { } else {
// deskbar mode // deskbar mode
fActiveButton = new BRadioButton(rect, "ActiveColor", fActiveButton = new BRadioButton(rect, "ActiveColor",
B_TRANSLATE("Active color"), new BMessage(PRV_DESKBAR_ACTIVE)); B_TRANSLATE("Active color"), new BMessage(PRV_DESKBAR_ACTIVE));
fActiveButton->ResizeToPreferred(); fActiveButton->ResizeToPreferred();
fActiveButton->SetValue(B_CONTROL_ON); fActiveButton->SetValue(B_CONTROL_ON);
AddChild(fActiveButton); AddChild(fActiveButton);
rect.left = fActiveButton->Frame().right + 5.0f; rect.left = fActiveButton->Frame().right + 5.0f;
fIdleButton = new BRadioButton(rect, "IdleColor", fIdleButton = new BRadioButton(rect, "IdleColor",
B_TRANSLATE("Idle color"), new BMessage(PRV_DESKBAR_IDLE)); B_TRANSLATE("Idle color"), new BMessage(PRV_DESKBAR_IDLE));
fIdleButton->ResizeToPreferred(); fIdleButton->ResizeToPreferred();
AddChild(fIdleButton); AddChild(fIdleButton);
rect.left = fIdleButton->Frame().right + 5.0f; rect.left = fIdleButton->Frame().right + 5.0f;
fFrameButton = new BRadioButton(rect, "FrameColor", fFrameButton = new BRadioButton(rect, "FrameColor",
B_TRANSLATE("Frame color"), new BMessage(PRV_DESKBAR_FRAME)); B_TRANSLATE("Frame color"), new BMessage(PRV_DESKBAR_FRAME));
fFrameButton->ResizeToPreferred(); fFrameButton->ResizeToPreferred();
AddChild(fFrameButton); AddChild(fFrameButton);
@@ -136,8 +136,8 @@ ConfigView::ConfigView(BRect rect, const char *name, uint32 mode, BMessenger& ta
char temp[10]; char temp[10];
snprintf(temp, sizeof(temp), "%d", fPrefs->deskbar_icon_width); snprintf(temp, sizeof(temp), "%d", fPrefs->deskbar_icon_width);
fIconWidthControl = new BTextControl(rect, "Width", fIconWidthControl = new BTextControl(rect, "Width",
B_TRANSLATE("Width of icon:"), temp, B_TRANSLATE("Width of icon:"), temp,
new BMessage(PRV_DESKBAR_ICON_WIDTH)); new BMessage(PRV_DESKBAR_ICON_WIDTH));
AddChild(fIconWidthControl); AddChild(fIconWidthControl);
fIconWidthControl->SetDivider(be_plain_font->StringWidth( fIconWidthControl->SetDivider(be_plain_font->StringWidth(
@@ -148,7 +148,7 @@ ConfigView::ConfigView(BRect rect, const char *name, uint32 mode, BMessenger& ta
fIconWidthControl->TextView()->DisallowChar(c); fIconWidthControl->TextView()->DisallowChar(c);
} }
fIconWidthControl->TextView()->SetMaxBytes(2); fIconWidthControl->TextView()->SetMaxBytes(2);
float width, height; float width, height;
fIconWidthControl->GetPreferredSize(&width, &height); fIconWidthControl->GetPreferredSize(&width, &height);
fIconWidthControl->ResizeTo(fIconWidthControl->Divider() + 32.0f fIconWidthControl->ResizeTo(fIconWidthControl->Divider() + 32.0f
@@ -194,7 +194,7 @@ void
ConfigView::AttachedToWindow() ConfigView::AttachedToWindow()
{ {
BView::AttachedToWindow(); BView::AttachedToWindow();
// AttachedToWindow() gets called every time this tab is brought // AttachedToWindow() gets called every time this tab is brought
// to the front, but we only want this initialization to happen once // to the front, but we only want this initialization to happen once
if (fFirstTimeAttached) { if (fFirstTimeAttached) {
@@ -211,7 +211,7 @@ ConfigView::AttachedToWindow()
fActiveButton->SetTarget(messenger); fActiveButton->SetTarget(messenger);
if (fIdleButton != NULL) if (fIdleButton != NULL)
fIdleButton->SetTarget(messenger); fIdleButton->SetTarget(messenger);
if (fFrameButton != NULL) if (fFrameButton != NULL)
fFrameButton->SetTarget(messenger); fFrameButton->SetTarget(messenger);
if (fIconWidthControl != NULL) if (fIconWidthControl != NULL)
fIconWidthControl->SetTarget(messenger); fIconWidthControl->SetTarget(messenger);
@@ -350,7 +350,7 @@ ConfigView::_ResetDefaults()
message->AddInt32("idle_color", DEFAULT_MINI_IDLE_COLOR); message->AddInt32("idle_color", DEFAULT_MINI_IDLE_COLOR);
message->AddInt32("frame_color", DEFAULT_MINI_FRAME_COLOR); message->AddInt32("frame_color", DEFAULT_MINI_FRAME_COLOR);
fTarget.SendMessage(message); fTarget.SendMessage(message);
} else { } else {
fPrefs->deskbar_active_color = DEFAULT_DESKBAR_ACTIVE_COLOR; fPrefs->deskbar_active_color = DEFAULT_DESKBAR_ACTIVE_COLOR;
fPrefs->deskbar_idle_color = DEFAULT_DESKBAR_IDLE_COLOR; fPrefs->deskbar_idle_color = DEFAULT_DESKBAR_IDLE_COLOR;
fPrefs->deskbar_frame_color = DEFAULT_DESKBAR_FRAME_COLOR; fPrefs->deskbar_frame_color = DEFAULT_DESKBAR_FRAME_COLOR;
+3 -3
View File
@@ -23,15 +23,15 @@ class DeskbarPulseView : public MiniPulseView {
void MouseDown(BPoint point); void MouseDown(BPoint point);
void AttachedToWindow(); void AttachedToWindow();
void Pulse(); void Pulse();
void MessageReceived(BMessage *message); void MessageReceived(BMessage *message);
static DeskbarPulseView *Instantiate(BMessage *data); static DeskbarPulseView *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const; virtual status_t Archive(BMessage *data, bool deep = true) const;
private: private:
void Remove(); void Remove();
void SetMode(bool normal); void SetMode(bool normal);
PrefsWindow *prefswindow; PrefsWindow *prefswindow;
Prefs *prefs; Prefs *prefs;
BMessageRunner *messagerunner; BMessageRunner *messagerunner;
+1 -1
View File
@@ -28,4 +28,4 @@ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+14 -14
View File
@@ -17,7 +17,7 @@
#define B_TRANSLATION_CONTEXT "MiniPulseView" #define B_TRANSLATION_CONTEXT "MiniPulseView"
MiniPulseView::MiniPulseView(BRect rect, const char *name, Prefs *prefs) : MiniPulseView::MiniPulseView(BRect rect, const char *name, Prefs *prefs) :
PulseView(rect, name) { PulseView(rect, name) {
mode1->SetLabel(B_TRANSLATE("Normal mode")); mode1->SetLabel(B_TRANSLATE("Normal mode"));
@@ -27,19 +27,19 @@ MiniPulseView::MiniPulseView(BRect rect, const char *name, Prefs *prefs) :
quit = new BMenuItem(B_TRANSLATE("Quit"), new BMessage(PV_QUIT), 0, 0); quit = new BMenuItem(B_TRANSLATE("Quit"), new BMessage(PV_QUIT), 0, 0);
popupmenu->AddSeparatorItem(); popupmenu->AddSeparatorItem();
popupmenu->AddItem(quit); popupmenu->AddItem(quit);
// Our drawing covers every pixel in the view, so no reason to // Our drawing covers every pixel in the view, so no reason to
// take the time (and to flicker) by resetting the view color // take the time (and to flicker) by resetting the view color
SetViewColor(B_TRANSPARENT_COLOR); SetViewColor(B_TRANSPARENT_COLOR);
active_color.red = (prefs->mini_active_color & 0xff000000) >> 24; active_color.red = (prefs->mini_active_color & 0xff000000) >> 24;
active_color.green = (prefs->mini_active_color & 0x00ff0000) >> 16; active_color.green = (prefs->mini_active_color & 0x00ff0000) >> 16;
active_color.blue = (prefs->mini_active_color & 0x0000ff00) >> 8; active_color.blue = (prefs->mini_active_color & 0x0000ff00) >> 8;
idle_color.red = (prefs->mini_idle_color & 0xff000000) >> 24; idle_color.red = (prefs->mini_idle_color & 0xff000000) >> 24;
idle_color.green = (prefs->mini_idle_color & 0x00ff0000) >> 16; idle_color.green = (prefs->mini_idle_color & 0x00ff0000) >> 16;
idle_color.blue = (prefs->mini_idle_color & 0x0000ff00) >> 8; idle_color.blue = (prefs->mini_idle_color & 0x0000ff00) >> 8;
frame_color.red = (prefs->mini_frame_color & 0xff000000) >> 24; frame_color.red = (prefs->mini_frame_color & 0xff000000) >> 24;
frame_color.green = (prefs->mini_frame_color & 0x00ff0000) >> 16; frame_color.green = (prefs->mini_frame_color & 0x00ff0000) >> 16;
frame_color.blue = (prefs->mini_frame_color & 0x0000ff00) >> 8; frame_color.blue = (prefs->mini_frame_color & 0x0000ff00) >> 8;
@@ -53,7 +53,7 @@ MiniPulseView::MiniPulseView(BRect rect, const char *name)
} }
MiniPulseView::MiniPulseView(BMessage *message) MiniPulseView::MiniPulseView(BMessage *message)
: :
PulseView(message) PulseView(message)
{ {
@@ -66,7 +66,7 @@ void MiniPulseView::Draw(BRect rect) {
get_system_info(&sys_info); get_system_info(&sys_info);
if (sys_info.cpu_count <= 0) if (sys_info.cpu_count <= 0)
return; return;
BRect bounds(Bounds()); BRect bounds(Bounds());
SetDrawingMode(B_OP_COPY); SetDrawingMode(B_OP_COPY);
@@ -75,18 +75,18 @@ void MiniPulseView::Draw(BRect rect) {
float bottom = top + h; float bottom = top + h;
float bar_width = (bounds.Width()) / sys_info.cpu_count - 2; float bar_width = (bounds.Width()) / sys_info.cpu_count - 2;
float right = bar_width + left; float right = bar_width + left;
for (unsigned int x = 0; x < sys_info.cpu_count; x++) { for (unsigned int x = 0; x < sys_info.cpu_count; x++) {
int bar_height = (int)(cpu_times[x] * (h + 1)); int bar_height = (int)(cpu_times[x] * (h + 1));
if (bar_height > h) bar_height = h; if (bar_height > h) bar_height = h;
double rem = cpu_times[x] * (h + 1) - bar_height; double rem = cpu_times[x] * (h + 1) - bar_height;
rgb_color fraction_color; rgb_color fraction_color;
fraction_color.red = (uint8)(idle_color.red + rem fraction_color.red = (uint8)(idle_color.red + rem
* (active_color.red - idle_color.red)); * (active_color.red - idle_color.red));
fraction_color.green = (uint8)(idle_color.green + rem fraction_color.green = (uint8)(idle_color.green + rem
* (active_color.green - idle_color.green)); * (active_color.green - idle_color.green));
fraction_color.blue = (uint8)(idle_color.blue + rem fraction_color.blue = (uint8)(idle_color.blue + rem
* (active_color.blue - idle_color.blue)); * (active_color.blue - idle_color.blue));
fraction_color.alpha = 0xff; fraction_color.alpha = 0xff;
@@ -127,7 +127,7 @@ void MiniPulseView::AttachedToWindow() {
preferences->SetTarget(messenger); preferences->SetTarget(messenger);
about->SetTarget(messenger); about->SetTarget(messenger);
quit->SetTarget(messenger); quit->SetTarget(messenger);
system_info sys_info; system_info sys_info;
get_system_info(&sys_info); get_system_info(&sys_info);
if (sys_info.cpu_count >= 2) { if (sys_info.cpu_count >= 2) {
@@ -142,7 +142,7 @@ void MiniPulseView::UpdateColors(BMessage *message) {
int32 ac = message->FindInt32("active_color"); int32 ac = message->FindInt32("active_color");
int32 ic = message->FindInt32("idle_color"); int32 ic = message->FindInt32("idle_color");
int32 fc = message->FindInt32("frame_color"); int32 fc = message->FindInt32("frame_color");
active_color.red = (ac & 0xff000000) >> 24; active_color.red = (ac & 0xff000000) >> 24;
active_color.green = (ac & 0x00ff0000) >> 16; active_color.green = (ac & 0x00ff0000) >> 16;
active_color.blue = (ac & 0x0000ff00) >> 8; active_color.blue = (ac & 0x0000ff00) >> 8;
@@ -154,7 +154,7 @@ void MiniPulseView::UpdateColors(BMessage *message) {
frame_color.red = (fc & 0xff000000) >> 24; frame_color.red = (fc & 0xff000000) >> 24;
frame_color.green = (fc & 0x00ff0000) >> 16; frame_color.green = (fc & 0x00ff0000) >> 16;
frame_color.blue = (fc & 0x0000ff00) >> 8; frame_color.blue = (fc & 0x0000ff00) >> 8;
Draw(Bounds()); Draw(Bounds());
} }
+1 -1
View File
@@ -25,7 +25,7 @@ class MiniPulseView : public PulseView {
void Pulse(); void Pulse();
void FrameResized(float width, float height); void FrameResized(float width, float height);
void UpdateColors(BMessage *message); void UpdateColors(BMessage *message);
protected: protected:
BMenuItem *quit; BMenuItem *quit;
rgb_color frame_color, active_color, idle_color; rgb_color frame_color, active_color, idle_color;
+5 -5
View File
@@ -42,7 +42,7 @@ max_font_size(BFont font, const char* text, float maxSize, float maxWidth)
return 4; return 4;
} }
// #pragma mark - // #pragma mark -
@@ -58,7 +58,7 @@ NormalPulseView::NormalPulseView(BRect rect)
mode1->SetMessage(new BMessage(PV_MINI_MODE)); mode1->SetMessage(new BMessage(PV_MINI_MODE));
mode2->SetLabel(B_TRANSLATE("Deskbar mode")); mode2->SetLabel(B_TRANSLATE("Deskbar mode"));
mode2->SetMessage(new BMessage(PV_DESKBAR_MODE)); mode2->SetMessage(new BMessage(PV_DESKBAR_MODE));
DetermineVendorAndProcessor(); DetermineVendorAndProcessor();
// Allocate progress bars and button pointers // Allocate progress bars and button pointers
@@ -190,7 +190,7 @@ NormalPulseView::Draw(BRect rect)
StrokeLine(BPoint(1, frame.bottom + 1), BPoint(frame.right, frame.bottom + 1)); StrokeLine(BPoint(1, frame.bottom + 1), BPoint(frame.right, frame.bottom + 1));
SetHighColor(255, 255, 255); SetHighColor(255, 255, 255);
StrokeLine(BPoint(1, frame.bottom + 2), BPoint(frame.right, frame.bottom + 2)); StrokeLine(BPoint(1, frame.bottom + 2), BPoint(frame.right, frame.bottom + 2));
// Processor picture // Processor picture
DrawBitmap(fCpuLogo, BPoint(10, 10)); DrawBitmap(fCpuLogo, BPoint(10, 10));
@@ -210,7 +210,7 @@ NormalPulseView::Draw(BRect rect)
// Draw processor type and speed // Draw processor type and speed
SetDrawingMode(B_OP_OVER); SetDrawingMode(B_OP_OVER);
SetHighColor(240, 240, 240); SetHighColor(240, 240, 240);
SetFontSize(fProcessorFontSize); SetFontSize(fProcessorFontSize);
float width = StringWidth(fProcessor); float width = StringWidth(fProcessor);
MovePenTo(10 + (32 - width / 2), 48); MovePenTo(10 + (32 - width / 2), 48);
@@ -222,7 +222,7 @@ NormalPulseView::Draw(BRect rect)
snprintf(buffer, sizeof(buffer), B_TRANSLATE("%.2f GHz"), cpuSpeed / 1000.0f); snprintf(buffer, sizeof(buffer), B_TRANSLATE("%.2f GHz"), cpuSpeed / 1000.0f);
else else
snprintf(buffer, sizeof(buffer), B_TRANSLATE("%ld MHz"), cpuSpeed); snprintf(buffer, sizeof(buffer), B_TRANSLATE("%ld MHz"), cpuSpeed);
// We can't assume anymore that a CPU clock speed is always static. // We can't assume anymore that a CPU clock speed is always static.
// Let's compute the best font size for the CPU speed string each time... // Let's compute the best font size for the CPU speed string each time...
BFont font; BFont font;
+2 -2
View File
@@ -51,10 +51,10 @@ Prefs::Prefs()
return; return;
} }
// While normal window position is under user control, size is not. // While normal window position is under user control, size is not.
// Width is fixed and height must be dynamically computed each time, // Width is fixed and height must be dynamically computed each time,
// as number of CPUs could change since boot. // as number of CPUs could change since boot.
ComputeNormalWindowSize(); ComputeNormalWindowSize();
r = GetMiniWindowRect(); r = GetMiniWindowRect();
if (!GetRect("mini_window_rect", &mini_window_rect, &r)) { if (!GetRect("mini_window_rect", &mini_window_rect, &r)) {
fFatalError = true; fFatalError = true;
+2 -2
View File
@@ -19,7 +19,7 @@ class Prefs {
Prefs(); Prefs();
bool Save(); bool Save();
~Prefs(); ~Prefs();
int window_mode, deskbar_icon_width; int window_mode, deskbar_icon_width;
BRect normal_window_rect, mini_window_rect, prefs_window_rect; BRect normal_window_rect, mini_window_rect, prefs_window_rect;
int normal_bar_color, mini_active_color, mini_idle_color, mini_frame_color, int normal_bar_color, mini_active_color, mini_idle_color, mini_frame_color,
@@ -35,7 +35,7 @@ class Prefs {
bool PutInt(const char *name, int *value); bool PutInt(const char *name, int *value);
bool PutBool(const char *name, bool *value); bool PutBool(const char *name, bool *value);
bool PutRect(const char *name, BRect *value); bool PutRect(const char *name, BRect *value);
float GetNormalWindowHeight(); float GetNormalWindowHeight();
void ComputeNormalWindowSize(); void ComputeNormalWindowSize();
BRect GetNormalWindowRect(); BRect GetNormalWindowRect();
+7 -7
View File
@@ -26,7 +26,7 @@
#define B_TRANSLATION_CONTEXT "PrefsWindow" #define B_TRANSLATION_CONTEXT "PrefsWindow"
PrefsWindow::PrefsWindow(BRect frame, const char *name, PrefsWindow::PrefsWindow(BRect frame, const char *name,
BMessenger *messenger, Prefs *prefs) BMessenger *messenger, Prefs *prefs)
: BWindow(frame, name, B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE : BWindow(frame, name, B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
| B_NOT_MINIMIZABLE | B_ASYNCHRONOUS_CONTROLS), | B_NOT_MINIMIZABLE | B_ASYNCHRONOUS_CONTROLS),
@@ -52,7 +52,7 @@ PrefsWindow::PrefsWindow(BRect frame, const char *name,
PRV_NORMAL_CHANGE_COLOR, fTarget, prefs); PRV_NORMAL_CHANGE_COLOR, fTarget, prefs);
fTabView->AddTab(normalView); fTabView->AddTab(normalView);
ConfigView *miniView = new ConfigView(rect, B_TRANSLATE("Mini mode"), ConfigView *miniView = new ConfigView(rect, B_TRANSLATE("Mini mode"),
PRV_MINI_CHANGE_COLOR, fTarget, prefs); PRV_MINI_CHANGE_COLOR, fTarget, prefs);
fTabView->AddTab(miniView); fTabView->AddTab(miniView);
@@ -67,19 +67,19 @@ PrefsWindow::PrefsWindow(BRect frame, const char *name,
deskbarView->ResizeTo(width, height); deskbarView->ResizeTo(width, height);
fTabView->Select(0L); fTabView->Select(0L);
fTabView->ResizeTo(deskbarView->Bounds().Width() + 16.0f, fTabView->ResizeTo(deskbarView->Bounds().Width() + 16.0f,
deskbarView->Bounds().Height() + deskbarView->Bounds().Height() +
fTabView->ContainerView()->Frame().top + 16.0f); fTabView->ContainerView()->Frame().top + 16.0f);
BButton *okButton = new BButton(rect, "ok", B_TRANSLATE("OK"), BButton *okButton = new BButton(rect, "ok", B_TRANSLATE("OK"),
new BMessage(PRV_BOTTOM_OK), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); new BMessage(PRV_BOTTOM_OK), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
okButton->ResizeToPreferred(); okButton->ResizeToPreferred();
okButton->MoveTo(Bounds().Width() - 8.0f - okButton->Bounds().Width(), okButton->MoveTo(Bounds().Width() - 8.0f - okButton->Bounds().Width(),
Bounds().Height() - 8.0f - okButton->Bounds().Height()); Bounds().Height() - 8.0f - okButton->Bounds().Height());
topView->AddChild(okButton); topView->AddChild(okButton);
BButton *defaultsButton = new BButton(okButton->Frame(), "defaults", BButton *defaultsButton = new BButton(okButton->Frame(), "defaults",
B_TRANSLATE("Defaults"), new BMessage(PRV_BOTTOM_DEFAULTS), B_TRANSLATE("Defaults"), new BMessage(PRV_BOTTOM_DEFAULTS),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
defaultsButton->ResizeToPreferred(); defaultsButton->ResizeToPreferred();
defaultsButton->MoveBy(-defaultsButton->Bounds().Width() - 10.0f, 0.0f); defaultsButton->MoveBy(-defaultsButton->Bounds().Width() - 10.0f, 0.0f);
+12 -12
View File
@@ -13,9 +13,9 @@
#include "PulseApp.h" #include "PulseApp.h"
ProgressBar::ProgressBar(BRect r, char *name) : BView(r, name, B_FOLLOW_NONE, ProgressBar::ProgressBar(BRect r, char *name) : BView(r, name, B_FOLLOW_NONE,
B_WILL_DRAW) B_WILL_DRAW)
{ {
previous_value = current_value = 0; previous_value = current_value = 0;
// Create 20 segments // Create 20 segments
@@ -44,11 +44,11 @@ ProgressBar::UpdateColors(int32 color, bool fade)
unsigned char blue_base = blue / 3; unsigned char blue_base = blue / 3;
for (int x = 0; x < 20; x++) { for (int x = 0; x < 20; x++) {
segments[x].color.red = (uint8)(red_base + ((red - red_base) segments[x].color.red = (uint8)(red_base + ((red - red_base)
* ((float)x / 19.0))); * ((float)x / 19.0)));
segments[x].color.green = (uint8)(green_base segments[x].color.green = (uint8)(green_base
+ ((green - green_base) * ((float)x / 19.0))); + ((green - green_base) * ((float)x / 19.0)));
segments[x].color.blue = (uint8)(blue_base + ((blue - blue_base) segments[x].color.blue = (uint8)(blue_base + ((blue - blue_base)
* ((float)x / 19.0))); * ((float)x / 19.0)));
segments[x].color.alpha = 0xff; segments[x].color.alpha = 0xff;
} }
@@ -155,21 +155,21 @@ ProgressBar::Draw(BRect rect)
SetHighColor(dkgray, dkgray, dkgray); SetHighColor(dkgray, dkgray, dkgray);
BRect frame = Bounds(); BRect frame = Bounds();
StrokeLine(BPoint(frame.left, frame.top), BPoint(frame.right, frame.top)); StrokeLine(BPoint(frame.left, frame.top), BPoint(frame.right, frame.top));
StrokeLine(BPoint(frame.left, frame.top + 1), BPoint(frame.right, StrokeLine(BPoint(frame.left, frame.top + 1), BPoint(frame.right,
frame.top + 1)); frame.top + 1));
StrokeLine(BPoint(frame.left, frame.top), BPoint(frame.left, StrokeLine(BPoint(frame.left, frame.top), BPoint(frame.left,
frame.bottom)); frame.bottom));
StrokeLine(BPoint(frame.left + 1, frame.top), StrokeLine(BPoint(frame.left + 1, frame.top),
BPoint(frame.left + 1, frame.bottom)); BPoint(frame.left + 1, frame.bottom));
SetHighColor(ltgray, ltgray, ltgray); SetHighColor(ltgray, ltgray, ltgray);
StrokeLine(BPoint(frame.right-1, frame.top + 2), StrokeLine(BPoint(frame.right-1, frame.top + 2),
BPoint(frame.right - 1, frame.bottom)); BPoint(frame.right - 1, frame.bottom));
StrokeLine(BPoint(frame.right, frame.top + 1), StrokeLine(BPoint(frame.right, frame.top + 1),
BPoint(frame.right, frame.bottom)); BPoint(frame.right, frame.bottom));
StrokeLine(BPoint(frame.left+1, frame.bottom - 1), StrokeLine(BPoint(frame.left+1, frame.bottom - 1),
BPoint(frame.right - 1, frame.bottom - 1)); BPoint(frame.right - 1, frame.bottom - 1));
StrokeLine(BPoint(frame.left, frame.bottom), StrokeLine(BPoint(frame.left, frame.bottom),
BPoint(frame.right, frame.bottom)); BPoint(frame.right, frame.bottom));
Render(true); Render(true);
+1 -1
View File
@@ -37,7 +37,7 @@ class ProgressBar : public BView {
private: private:
void Render(bool all = false); void Render(bool all = false);
segment segments[20]; segment segments[20];
int32 current_value, previous_value; int32 current_value, previous_value;
}; };
+3 -3
View File
@@ -186,10 +186,10 @@ PulseApp::ShowAbout(bool asApplication)
BTextView* view = alert->TextView(); BTextView* view = alert->TextView();
BFont font; BFont font;
view->SetStylable(true); view->SetStylable(true);
view->GetFont(&font); view->GetFont(&font);
font.SetSize(18); font.SetSize(18);
font.SetFace(B_BOLD_FACE); font.SetFace(B_BOLD_FACE);
view->SetFontAndColor(0, name.Length(), &font); view->SetFontAndColor(0, name.Length(), &font);
+2 -2
View File
@@ -69,9 +69,9 @@ void PulseView::Init() {
popupmenu->SetFont(be_plain_font); popupmenu->SetFont(be_plain_font);
mode1 = new BMenuItem("", NULL, 0, 0); mode1 = new BMenuItem("", NULL, 0, 0);
mode2 = new BMenuItem("", NULL, 0, 0); mode2 = new BMenuItem("", NULL, 0, 0);
preferences = new BMenuItem(B_TRANSLATE("Settings" B_UTF8_ELLIPSIS), preferences = new BMenuItem(B_TRANSLATE("Settings" B_UTF8_ELLIPSIS),
new BMessage(PV_PREFERENCES), 0, 0); new BMessage(PV_PREFERENCES), 0, 0);
about = new BMenuItem(B_TRANSLATE("About Pulse" B_UTF8_ELLIPSIS), about = new BMenuItem(B_TRANSLATE("About Pulse" B_UTF8_ELLIPSIS),
new BMessage(PV_ABOUT), 0, 0); new BMessage(PV_ABOUT), 0, 0);
popupmenu->AddItem(mode1); popupmenu->AddItem(mode1);
+3 -3
View File
@@ -33,13 +33,13 @@ PulseWindow::PulseWindow(BRect rect)
B_NOT_RESIZABLE | B_NOT_ZOOMABLE) B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
{ {
SetPulseRate(200000); SetPulseRate(200000);
PulseApp *pulseapp = (PulseApp *)be_app; PulseApp *pulseapp = (PulseApp *)be_app;
BRect bounds = Bounds(); BRect bounds = Bounds();
fNormalPulseView = new NormalPulseView(bounds); fNormalPulseView = new NormalPulseView(bounds);
AddChild(fNormalPulseView); AddChild(fNormalPulseView);
fMiniPulseView = new MiniPulseView(bounds, "MiniPulseView", fMiniPulseView = new MiniPulseView(bounds, "MiniPulseView",
pulseapp->prefs); pulseapp->prefs);
AddChild(fMiniPulseView); AddChild(fMiniPulseView);
@@ -97,7 +97,7 @@ PulseWindow::MessageReceived(BMessage *message)
// Otherwise launch a new preferences window // Otherwise launch a new preferences window
PulseApp *pulseapp = (PulseApp *)be_app; PulseApp *pulseapp = (PulseApp *)be_app;
fPrefsWindow = new PrefsWindow(pulseapp->prefs->prefs_window_rect, fPrefsWindow = new PrefsWindow(pulseapp->prefs->prefs_window_rect,
B_TRANSLATE("Pulse settings"), new BMessenger(this), B_TRANSLATE("Pulse settings"), new BMessenger(this),
pulseapp->prefs); pulseapp->prefs);
fPrefsWindow->Show(); fPrefsWindow->Show();
break; break;