hrev45317 adds 2 changesets to branch 'master' old head: d45a713ca1a3ce2d34069e1000c66bea75bdcb8c new head: ca00f398da7f8cd19698205769fdf8cb6f2bde83 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=ca00f39+%5Ed45a713 ---------------------------------------------------------------------------- a2d1b65: Silly style fixes ca00f39: Fix Deskbar clock show/hide when Deskbar is hidden. Bug #9469 happens because I set the showClock checkbox or not based on whether or not the clock is currently hidden. This works most of the time, but if Deskbar is hidden the clock is also considered to be hidden and that isn't what I want in this case. The solution is to override BView's Show(), Hide(), and IsHidden() methods in TimeView to ignore whether or not the window is hidden when considering if the clock is hidden. The commit also deletes some no-longer-used private member variables of TimeView. Fixes #9469 [ John Scipione <jscipione@xxxxxxxxx> ] ---------------------------------------------------------------------------- 3 files changed, 36 insertions(+), 9 deletions(-) src/apps/deskbar/TimeView.cpp | 28 +++++++++++++++++++++++++++- src/apps/deskbar/TimeView.h | 11 ++++++----- src/preferences/time/ClockView.cpp | 6 +++--- ############################################################################ Commit: a2d1b65a85f33469f29aada03646b0aed4a61f92 URL: http://cgit.haiku-os.org/haiku/commit/?id=a2d1b65 Author: John Scipione <jscipione@xxxxxxxxx> Date: Sat Feb 23 19:40:26 2013 UTC Silly style fixes ---------------------------------------------------------------------------- diff --git a/src/preferences/time/ClockView.cpp b/src/preferences/time/ClockView.cpp index 8c51c67..82085c9 100644 --- a/src/preferences/time/ClockView.cpp +++ b/src/preferences/time/ClockView.cpp @@ -6,6 +6,7 @@ * John Scipione <jscipione@xxxxxxxxx> */ + #include "ClockView.h" #include <Alignment.h> @@ -24,9 +25,8 @@ #include "TimeMessages.h" -static const char* kDeskbarSignature = "application/x-vnd.Be-TSKB"; - -static const float kIndentSpacing +static const char* kDeskbarSignature = "application/x-vnd.Be-TSKB"; +static const float kIndentSpacing = be_control_look->DefaultItemSpacing() * 2.3; ############################################################################ Revision: hrev45317 Commit: ca00f398da7f8cd19698205769fdf8cb6f2bde83 URL: http://cgit.haiku-os.org/haiku/commit/?id=ca00f39 Author: John Scipione <jscipione@xxxxxxxxx> Date: Sat Feb 23 19:41:54 2013 UTC Ticket: https://dev.haiku-os.org/ticket/9469 Fix Deskbar clock show/hide when Deskbar is hidden. Bug #9469 happens because I set the showClock checkbox or not based on whether or not the clock is currently hidden. This works most of the time, but if Deskbar is hidden the clock is also considered to be hidden and that isn't what I want in this case. The solution is to override BView's Show(), Hide(), and IsHidden() methods in TimeView to ignore whether or not the window is hidden when considering if the clock is hidden. The commit also deletes some no-longer-used private member variables of TimeView. Fixes #9469 ---------------------------------------------------------------------------- diff --git a/src/apps/deskbar/TimeView.cpp b/src/apps/deskbar/TimeView.cpp index 0c6d0c8..02e7162 100644 --- a/src/apps/deskbar/TimeView.cpp +++ b/src/apps/deskbar/TimeView.cpp @@ -37,6 +37,8 @@ All rights reserved. #include "TimeView.h" #include <string.h> +#include <stdint.h> + // for INT16_MIN and INT16_MAX #include <Application.h> #include <Catalog.h> @@ -69,6 +71,7 @@ TTimeView::TTimeView(float maxWidth, float height) fMaxWidth(maxWidth), fHeight(height), fOrientation(true), + fShowLevel(0), fShowSeconds(false), fShowDayOfWeek(false), fShowTimeZone(false) @@ -116,10 +119,11 @@ status_t TTimeView::Archive(BMessage* data, bool deep) const { BView::Archive(data, deep); + data->AddBool("orientation", fOrientation); + data->AddInt16("showLevel", fShowLevel); data->AddBool("showSeconds", fShowSeconds); data->AddBool("showDayOfWeek", fShowDayOfWeek); data->AddBool("showTimeZone", fShowTimeZone); - data->AddBool("orientation", fOrientation); data->AddInt32("deskbar:private_align", B_ALIGN_RIGHT); return B_OK; @@ -184,6 +188,17 @@ TTimeView::GetPreferredSize(float* width, float* height) void +TTimeView::Hide() +{ + // Prevent overflow + if (fShowLevel < INT16_MAX) + ++fShowLevel; + + BView::Hide(); +} + + +void TTimeView::MessageReceived(BMessage* message) { switch (message->what) { @@ -292,6 +307,17 @@ TTimeView::ResizeToPreferred() } +void +TTimeView::Show() +{ + // Prevent underflow + if (fShowLevel > INT16_MIN) + --fShowLevel; + + BView::Show(); +} + + // # pragma mark - Public methods diff --git a/src/apps/deskbar/TimeView.h b/src/apps/deskbar/TimeView.h index 129b202..9f28a1c 100644 --- a/src/apps/deskbar/TimeView.h +++ b/src/apps/deskbar/TimeView.h @@ -88,10 +88,13 @@ public: void Draw(BRect update); void FrameMoved(BPoint); void GetPreferredSize(float* width, float* height); + void Hide(); + bool IsHidden() const { return fShowLevel > 0; }; void MessageReceived(BMessage*); void MouseDown(BPoint where); void Pulse(); void ResizeToPreferred(); + void Show(); bool Orientation() const; void SetOrientation(bool o); @@ -133,16 +136,14 @@ private: float fMaxWidth; float fHeight; - bool fOrientation; // vertical = true + bool fOrientation; + // vertical = true + int16 fShowLevel; - bool fOverrideLocale; - bool fUse24HourClock; bool fShowSeconds; bool fShowDayOfWeek; bool fShowTimeZone; - BString fTimeFormat; - BPoint fTimeLocation; BPoint fDateLocation;