Author: anevilyak Date: 2010-10-20 11:40:56 +0200 (Wed, 20 Oct 2010) New Revision: 39019 Changeset: http://dev.haiku-os.org/changeset/39019 Modified: haiku/trunk/src/apps/deskbar/PreferencesWindow.cpp haiku/trunk/src/apps/deskbar/PreferencesWindow.h haiku/trunk/src/apps/deskbar/StatusView.cpp haiku/trunk/src/apps/deskbar/StatusView.h haiku/trunk/src/apps/deskbar/TimeView.cpp haiku/trunk/src/apps/deskbar/TimeView.h Log: Remove the "Full Date" setting and associated madness with respect to the deskbar's current orientation. Instead, we now always show the full date, but as a tooltip rather than switching the timeview's display based on a mouse click. Modified: haiku/trunk/src/apps/deskbar/PreferencesWindow.cpp =================================================================== --- haiku/trunk/src/apps/deskbar/PreferencesWindow.cpp 2010-10-20 09:23:06 UTC (rev 39018) +++ haiku/trunk/src/apps/deskbar/PreferencesWindow.cpp 2010-10-20 09:40:56 UTC (rev 39019) @@ -60,9 +60,6 @@ fClockSeconds = new BCheckBox(B_TRANSLATE("Show seconds"), new BMessage(kShowSeconds)); - fClockFullDate = new BCheckBox(B_TRANSLATE("Full date"), - new BMessage(kFullDate)); - fWindowAlwaysOnTop = new BCheckBox(B_TRANSLATE("Always on top"), new BMessage(kAlwaysTop)); fWindowAutoRaise = new BCheckBox(B_TRANSLATE("Auto-raise"), @@ -121,11 +118,9 @@ TReplicantTray* replicantTray = barApp->BarView()->fReplicantTray; fClockSeconds->SetValue(replicantTray->ShowingSeconds()); - fClockFullDate->SetValue(replicantTray->ShowingFullDate()); bool showingClock = barApp->BarView()->ShowingClock(); fClockSeconds->SetEnabled(showingClock); - fClockFullDate->SetEnabled(replicantTray->CanShowFullDate()); fWindowAlwaysOnTop->SetValue(appSettings->alwaysOnTop); fWindowAutoRaise->SetValue(appSettings->autoRaise); @@ -138,7 +133,6 @@ fAppsExpandNew->SetTarget(be_app); fClockSeconds->SetTarget(replicantTray); - fClockFullDate->SetTarget(replicantTray); fWindowAlwaysOnTop->SetTarget(be_app); fWindowAutoRaise->SetTarget(be_app); @@ -194,7 +188,6 @@ view = BLayoutBuilder::Group<>() .AddGroup(B_VERTICAL, 1) .Add(fClockSeconds) - .Add(fClockFullDate) .AddGlue() .SetInsets(10, 10, 10, 10) .End() Modified: haiku/trunk/src/apps/deskbar/PreferencesWindow.h =================================================================== --- haiku/trunk/src/apps/deskbar/PreferencesWindow.h 2010-10-20 09:23:06 UTC (rev 39018) +++ haiku/trunk/src/apps/deskbar/PreferencesWindow.h 2010-10-20 09:40:56 UTC (rev 39019) @@ -53,7 +53,6 @@ BCheckBox* fAppsExpandNew; BCheckBox* fClockSeconds; - BCheckBox* fClockFullDate; BCheckBox* fWindowAlwaysOnTop; BCheckBox* fWindowAutoRaise; Modified: haiku/trunk/src/apps/deskbar/StatusView.cpp =================================================================== --- haiku/trunk/src/apps/deskbar/StatusView.cpp 2010-10-20 09:23:06 UTC (rev 39018) +++ haiku/trunk/src/apps/deskbar/StatusView.cpp 2010-10-20 09:40:56 UTC (rev 39019) @@ -199,7 +199,6 @@ desk_settings* settings = ((TBarApp*)be_app)->Settings(); settings->timeShowSeconds = fClock->ShowingSeconds(); - settings->timeFullDate = fClock->ShowingFullDate(); } } @@ -213,24 +212,6 @@ } -bool -TReplicantTray::ShowingFullDate() -{ - if (fClock && CanShowFullDate()) - return fClock->ShowingFullDate(); - return false; -} - - -bool -TReplicantTray::CanShowFullDate() -{ - if (fClock) - return fClock->CanShowFullDate(); - return false; -} - - void TReplicantTray::DealWithClock(bool showClock) { @@ -241,12 +222,11 @@ desk_settings* settings = ((TBarApp*)be_app)->Settings(); fClock = new TTimeView(fMinimumTrayWidth, kMaxReplicantHeight - 1.0, - settings->timeShowSeconds, settings->timeFullDate, + settings->timeShowSeconds, false); AddChild(fClock); fClock->MoveTo(Bounds().right - fClock->Bounds().Width() - 1, 2); - fClock->AllowFullDate(!IsMultiRow()); } } else { if (fClock) { @@ -1387,11 +1367,6 @@ TReplicantTray::SetMultiRow(bool state) { fMultiRowMode = state; - - // in multi-row state, we only want the short date - - if (fClock != NULL) - fClock->AllowFullDate(!state); } Modified: haiku/trunk/src/apps/deskbar/StatusView.h =================================================================== --- haiku/trunk/src/apps/deskbar/StatusView.h 2010-10-20 09:23:06 UTC (rev 39018) +++ haiku/trunk/src/apps/deskbar/StatusView.h 2010-10-20 09:40:56 UTC (rev 39019) @@ -113,8 +113,6 @@ bool ShowingSeconds(void); bool ShowingMiltime(void); - bool ShowingFullDate(void); - bool CanShowFullDate(void); void RememberClockSettings(); void DealWithClock(bool); Modified: haiku/trunk/src/apps/deskbar/TimeView.cpp =================================================================== --- haiku/trunk/src/apps/deskbar/TimeView.cpp 2010-10-20 09:23:06 UTC (rev 39018) +++ haiku/trunk/src/apps/deskbar/TimeView.cpp 2010-10-20 09:40:56 UTC (rev 39019) @@ -68,7 +68,7 @@ #define B_TRANSLATE_CONTEXT "TimeView" TTimeView::TTimeView(float maxWidth, float height, bool showSeconds, - bool fullDate, bool) + bool) : BView(BRect(-100, -100, -90, -90), "_deskbar_tv_", B_FOLLOW_RIGHT | B_FOLLOW_TOP, @@ -76,14 +76,11 @@ fParent(NULL), fShowInterval(true), // ToDo: defaulting this to true until UI is in place fShowSeconds(showSeconds), - fFullDate(fullDate), - fCanShowFullDate(false), fMaxWidth(maxWidth), fHeight(height), fOrientation(true), fLongClickMessageRunner(NULL) { - fShowingDate = false; fTime = fLastTime = time(NULL); fSeconds = fMinute = fHour = 0; fLastTimeStr[0] = 0; @@ -100,9 +97,7 @@ { fTime = fLastTime = time(NULL); data->FindBool("seconds", &fShowSeconds); - data->FindBool("fulldate", &fFullDate); data->FindBool("interval", &fInterval); - fShowingDate = false; fLocale = *be_locale; } @@ -131,7 +126,6 @@ { BView::Archive(data, deep); data->AddBool("seconds", fShowSeconds); - data->AddBool("fulldate", fFullDate); data->AddBool("interval", fInterval); data->AddInt32("deskbar:private_align", B_ALIGN_RIGHT); @@ -163,20 +157,13 @@ *height = fHeight; GetCurrentTime(); - GetCurrentDate(); // TODO: SetOrientation never gets called, fix that // When in vertical mode, we want to limit the width so that it can't // overlap the bevels in the parent view. - if (ShowingDate()) - *width = fOrientation ? - min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fDateStr)) - : kHMargin + StringWidth(fDateStr); - else { - *width = fOrientation ? - min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fTimeStr)) - : kHMargin + StringWidth(fTimeStr); - } + *width = fOrientation ? + min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fTimeStr)) + : kHMargin + StringWidth(fTimeStr); } @@ -206,10 +193,6 @@ TTimeView::MessageReceived(BMessage* message) { switch (message->what) { - case kFullDate: - ShowFullDate(!ShowingFullDate()); - break; - case kShowSeconds: ShowSeconds(!ShowingSeconds()); break; @@ -314,7 +297,7 @@ { char tmp[64]; - fLocale.FormatDate(tmp, 64, fTime, fFullDate && CanShowFullDate()); + fLocale.FormatDate(tmp, 64, fTime, true); // remove leading 0 from date when month is less than 10 (MM/DD/YY) // or remove leading 0 from date when day is less than 10 (DD/MM/YY) @@ -336,10 +319,7 @@ FillRect(Bounds()); SetHighColor(0, 0, 0, 255); - if (fShowingDate) - DrawString(fDateStr, fDateLocation); - else - DrawString(fTimeStr, fTimeLocation); + DrawString(fTimeStr, fTimeLocation); PopState(); } @@ -358,11 +338,6 @@ StartLongClickNotifier(point); } - // flip to/from showing date or time - fShowingDate = !fShowingDate; - if (fShowingDate) - fLastTime = time(NULL); - // invalidate last time/date strings and call the pulse // method directly to change the display instantly fLastDateStr[0] = '\0'; @@ -390,14 +365,12 @@ GetCurrentTime(); GetCurrentDate(); - if ((!fShowingDate && strcmp(fTimeStr, fLastTimeStr) != 0) - || (fShowingDate && strcmp(fDateStr, fLastDateStr) != 0)) { + if (strcmp(fTimeStr, fLastTimeStr) != 0) { // Update bounds when the size of the strings has changed // For dates, Update() could be called two times in a row, // but that should only happen very rarely - if ((!fShowingDate && fLastTimeStr[1] != fTimeStr[1] + if ((fLastTimeStr[1] != fTimeStr[1] && (fLastTimeStr[1] == ':' || fTimeStr[1] == ':')) - || (fShowingDate && strlen(fDateStr) != strlen(fLastDateStr)) || !fLastTimeStr[0]) Update(); @@ -406,11 +379,6 @@ fNeedToUpdate = true; } - if (fShowingDate && (fLastTime + 5 <= time(NULL))) { - fShowingDate = false; - Update(); // Needs to happen since size can change here - } - if (fNeedToUpdate) { fSeconds = ct->tm_sec; fMinute = ct->tm_min; @@ -432,38 +400,14 @@ void -TTimeView::ShowDate(bool on) -{ - fShowingDate = on; - Update(); -} - - -void -TTimeView::ShowFullDate(bool on) -{ - fFullDate = on; - Update(); -} - - -void -TTimeView::AllowFullDate(bool allow) -{ - fCanShowFullDate = allow; - - if (allow != ShowingFullDate()) - Update(); -} - - -void TTimeView::Update() { fLocale = *be_locale; GetCurrentTime(); GetCurrentDate(); + SetToolTip(fDateStr); + ResizeToPreferred(); CalculateTextPlacement(); Modified: haiku/trunk/src/apps/deskbar/TimeView.h =================================================================== --- haiku/trunk/src/apps/deskbar/TimeView.h 2010-10-20 09:23:06 UTC (rev 39018) +++ haiku/trunk/src/apps/deskbar/TimeView.h 2010-10-20 09:40:56 UTC (rev 39019) @@ -55,7 +55,7 @@ class TTimeView : public BView { public: TTimeView(float maxWidth, float height, bool showSeconds = false, - bool fullDate = false, bool showInterval = false); + bool showInterval = false); TTimeView(BMessage* data); ~TTimeView(); @@ -76,12 +76,6 @@ bool ShowingSeconds() { return fShowSeconds; } void ShowSeconds(bool); - bool ShowingDate() { return fShowingDate; } - void ShowDate(bool); - bool ShowingFullDate() { return fFullDate; } - void ShowFullDate(bool); - bool CanShowFullDate() const { return fCanShowFullDate; } - void AllowFullDate(bool); void ShowCalendar(BPoint where); void StartLongClickNotifier(BPoint where); void StopLongClickNotifier(); @@ -116,9 +110,6 @@ bool fShowInterval; bool fShowSeconds; - bool fShowingDate; - bool fFullDate; - bool fCanShowFullDate; float fMaxWidth; float fHeight;