From 38bda6536f13f9aff0d31e6d922bf9bcbebd8b03 Mon Sep 17 00:00:00 2001 From: Fredrik Holmqvist Date: Sun, 30 Jan 2011 19:54:18 +0000 Subject: [PATCH] Patch by John Scipione: "Show Application Expander" and "Expand New Applications" in the Deskbar preferences only work in Expando mode, however, this is not communicated to the user. This ticket contains a patch which disables these options in the preference window when not in expando mode and re-enables them in expando mode. This fixes ticket #7177. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40326 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/deskbar/BarApp.cpp | 4 ++++ src/apps/deskbar/BarView.cpp | 12 ++++++++++-- src/apps/deskbar/PreferencesWindow.cpp | 15 ++++++++++++--- src/apps/deskbar/PreferencesWindow.h | 1 + 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/apps/deskbar/BarApp.cpp b/src/apps/deskbar/BarApp.cpp index 532e1bc998..264706873d 100644 --- a/src/apps/deskbar/BarApp.cpp +++ b/src/apps/deskbar/BarApp.cpp @@ -334,6 +334,10 @@ TBarApp::MessageReceived(BMessage* message) ShowPreferencesWindow(); break; + case kStateChanged: + fPreferencesWindow->PostMessage(kStateChanged); + break; + case kShowBeMenu: if (fBarWindow->Lock()) { fBarWindow->ShowBeMenu(); diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp index f113e6a566..70971c5b73 100644 --- a/src/apps/deskbar/BarView.cpp +++ b/src/apps/deskbar/BarView.cpp @@ -130,10 +130,10 @@ void TBarView::Draw(BRect) { BRect bounds(Bounds()); - + rgb_color hilite = tint_color(ViewColor(), B_DARKEN_1_TINT); rgb_color light = tint_color(ViewColor(), B_LIGHTEN_2_TINT); - + SetHighColor(hilite); if (AcrossTop()) StrokeLine(bounds.LeftBottom(), bounds.RightBottom()); @@ -433,12 +433,20 @@ TBarView::ChangeState(int32 state, bool vertical, bool left, bool top) { bool vertSwap = (fVertical != vertical); bool leftSwap = (fLeft != left); + bool stateChanged = (fState != state); fState = state; fVertical = vertical; fLeft = left; fTop = top; + // Send a message to the preferences window to let it know to enable + // or disabled preference items + if (stateChanged || vertSwap) { + BMessage message(kStateChanged); + be_app->PostMessage(&message); + } + BRect screenFrame = (BScreen(Window())).Frame(); PlaceBeMenu(); diff --git a/src/apps/deskbar/PreferencesWindow.cpp b/src/apps/deskbar/PreferencesWindow.cpp index e8fdf07753..aecbba7b33 100644 --- a/src/apps/deskbar/PreferencesWindow.cpp +++ b/src/apps/deskbar/PreferencesWindow.cpp @@ -242,6 +242,10 @@ PreferencesWindow::MessageReceived(BMessage* message) be_app->PostMessage(message); break; + case kStateChanged: + _EnableDisableDependentItems(); + break; + default: BWindow::MessageReceived(message); break; @@ -275,10 +279,15 @@ PreferencesWindow::_UpdateRecentCounts() void PreferencesWindow::_EnableDisableDependentItems() { - if (fAppsShowExpanders->Value()) - fAppsExpandNew->SetEnabled(true); - else + TBarApp* barApp = static_cast(be_app); + if (barApp->BarView()->Vertical() + && barApp->BarView()->Expando()) { + fAppsShowExpanders->SetEnabled(true); + fAppsExpandNew->SetEnabled(fAppsShowExpanders->Value()); + } else { + fAppsShowExpanders->SetEnabled(false); fAppsExpandNew->SetEnabled(false); + } if (fMenuRecentDocuments->Value()) fMenuRecentDocumentCount->SetEnabled(true); diff --git a/src/apps/deskbar/PreferencesWindow.h b/src/apps/deskbar/PreferencesWindow.h index 77f641b75f..9bacafdf68 100644 --- a/src/apps/deskbar/PreferencesWindow.h +++ b/src/apps/deskbar/PreferencesWindow.h @@ -19,6 +19,7 @@ const uint32 kConfigShow = 'show'; const uint32 kConfigClose = 'canc'; const uint32 kUpdateRecentCounts = 'upct'; const uint32 kEditMenuInTracker = 'mtrk'; +const uint32 kStateChanged = 'stch'; class PreferencesWindow : public BWindow