diff --git a/src/apps/deskbar/BarApp.cpp b/src/apps/deskbar/BarApp.cpp
index 532e1bc..331abbc 100644
a
|
b
|
TBarApp::SaveSettings()
|
206 | 206 | fSettings.sortRunningApps); |
207 | 207 | storedSettings.AddBool("superExpando", |
208 | 208 | fSettings.superExpando); |
209 | | storedSettings.AddBool("expandNewTeams", |
210 | | fSettings.expandNewTeams); |
| 209 | storedSettings.AddBool("autoExpandTeams", |
| 210 | fSettings.autoExpandTeams); |
211 | 211 | storedSettings.AddBool("autoRaise", |
212 | 212 | fSettings.autoRaise); |
213 | 213 | storedSettings.AddBool("recentAppsEnabled", |
… |
… |
TBarApp::InitSettings()
|
243 | 243 | settings.trackerAlwaysFirst = false; |
244 | 244 | settings.sortRunningApps = false; |
245 | 245 | settings.superExpando = false; |
246 | | settings.expandNewTeams = false; |
| 246 | settings.autoExpandTeams = false; |
247 | 247 | settings.autoRaise = false; |
248 | 248 | settings.recentAppsEnabled = true; |
249 | 249 | settings.recentDocsEnabled = true; |
… |
… |
TBarApp::InitSettings()
|
293 | 293 | &settings.sortRunningApps); |
294 | 294 | storedSettings.FindBool("superExpando", |
295 | 295 | &settings.superExpando); |
296 | | storedSettings.FindBool("expandNewTeams", |
297 | | &settings.expandNewTeams); |
| 296 | storedSettings.FindBool("autoExpandTeams", |
| 297 | &settings.autoExpandTeams); |
298 | 298 | storedSettings.FindBool("autoRaise", |
299 | 299 | &settings.autoRaise); |
300 | 300 | storedSettings.FindBool("recentAppsEnabled", |
… |
… |
TBarApp::MessageReceived(BMessage* message)
|
384 | 384 | message->FindRef("be:ref", &ref); |
385 | 385 | |
386 | 386 | AddTeam(team, flags, sig, &ref); |
| 387 | |
| 388 | TBarView* barView = static_cast<TBarApp*>(be_app)->BarView(); |
| 389 | fBarWindow->Lock(); |
| 390 | barView->UpdatePlacement(); |
| 391 | fBarWindow->Unlock(); |
| 392 | |
387 | 393 | break; |
388 | 394 | } |
389 | 395 | |
… |
… |
TBarApp::MessageReceived(BMessage* message)
|
441 | 447 | { |
442 | 448 | fSettings.sortRunningApps = !fSettings.sortRunningApps; |
443 | 449 | |
444 | | TBarView* barView = static_cast<TBarApp*>(be_app)->BarView(); |
445 | | fBarWindow->Lock(); |
| 450 | TBarView* barView = static_cast<TBarApp*>(be_app)->BarView(); fBarWindow->Lock(); |
446 | 451 | barView->UpdatePlacement(); |
447 | 452 | fBarWindow->Unlock(); |
448 | 453 | break; |
… |
… |
TBarApp::MessageReceived(BMessage* message)
|
467 | 472 | break; |
468 | 473 | } |
469 | 474 | |
470 | | case kExpandNewTeams: |
| 475 | case kAutoExpandTeams: |
471 | 476 | { |
472 | | fSettings.expandNewTeams = !fSettings.expandNewTeams; |
| 477 | fSettings.autoExpandTeams = !fSettings.autoExpandTeams; |
473 | 478 | |
474 | 479 | TBarView* barView = static_cast<TBarApp*>(be_app)->BarView(); |
475 | 480 | fBarWindow->Lock(); |
476 | | barView->UpdatePlacement(); |
| 481 | barView->ToggleExpandedItems(); |
477 | 482 | fBarWindow->Unlock(); |
478 | 483 | break; |
479 | 484 | } |
diff --git a/src/apps/deskbar/BarApp.h b/src/apps/deskbar/BarApp.h
index 6f15838..8985133 100644
a
|
b
|
const uint32 kShutDown = 'ShDn';
|
79 | 79 | const uint32 kTrackerFirst = 'TkFt'; |
80 | 80 | const uint32 kSortRunningApps = 'SAps'; |
81 | 81 | const uint32 kSuperExpando = 'SprE'; |
82 | | const uint32 kExpandNewTeams = 'ExTm'; |
| 82 | const uint32 kAutoExpandTeams = 'ExTm'; |
83 | 83 | const uint32 kAutoRaise = 'AtRs'; |
84 | 84 | const uint32 kRestartTracker = 'Trak'; |
85 | 85 | |
… |
… |
struct desk_settings {
|
108 | 108 | bool trackerAlwaysFirst; |
109 | 109 | bool sortRunningApps; |
110 | 110 | bool superExpando; |
111 | | bool expandNewTeams; |
| 111 | bool autoExpandTeams; |
112 | 112 | bool autoRaise; |
113 | 113 | bool recentAppsEnabled; |
114 | 114 | bool recentDocsEnabled; |
diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp
index f113e6a..3777ae1 100644
a
|
b
|
TBarView::ChangeState(int32 state, bool vertical, bool left, bool top)
|
469 | 469 | Window()->UpdateIfNeeded(); |
470 | 470 | |
471 | 471 | // Re-expand those apps. |
472 | | if (expandedItems.CountItems() > 0) { |
| 472 | if (static_cast<TBarApp*>(be_app)->Settings()->superExpando |
| 473 | && static_cast<TBarApp*>(be_app)->Settings()->autoExpandTeams) |
| 474 | ToggleExpandedItems(); |
| 475 | else if (expandedItems.CountItems() > 0) { |
473 | 476 | for (int sigIndex = expandedItems.CountItems(); sigIndex-- > 0;) { |
474 | 477 | signature = static_cast<BString*>(expandedItems.ItemAt(sigIndex)); |
475 | 478 | if (signature == NULL) |
… |
… |
TBarView::ChangeState(int32 state, bool vertical, bool left, bool top)
|
499 | 502 | } |
500 | 503 | |
501 | 504 | |
| 505 | void |
| 506 | TBarView::ToggleExpandedItems() |
| 507 | { |
| 508 | if (fExpando && fVertical && Expando() |
| 509 | && static_cast<TBarApp*>(be_app)->Settings()->superExpando) { |
| 510 | for (int32 teamIndex = fExpando->CountItems(); teamIndex-- > 0;) { |
| 511 | TTeamMenuItem* teamItem |
| 512 | = dynamic_cast<TTeamMenuItem*>(fExpando->ItemAt(teamIndex)); |
| 513 | if (teamItem != NULL |
| 514 | && static_cast<TBarApp*>(be_app)->Settings()->autoExpandTeams != |
| 515 | teamItem->IsExpanded()) |
| 516 | teamItem->ToggleExpandState(false); |
| 517 | } |
| 518 | |
| 519 | fExpando->SizeWindow(); |
| 520 | } |
| 521 | } |
| 522 | |
| 523 | |
502 | 524 | // window placement functions |
503 | 525 | |
504 | 526 | bool |
diff --git a/src/apps/deskbar/BarView.h b/src/apps/deskbar/BarView.h
index a481445..3e96ec3 100644
a
|
b
|
class TBarView : public BView {
|
135 | 135 | TExpandoMenuBar* ExpandoMenuBar() const; |
136 | 136 | TBarMenuBar* BarMenuBar() const; |
137 | 137 | TDragRegion* DragRegion() const { return fDragRegion; } |
| 138 | void ToggleExpandedItems(); |
138 | 139 | |
139 | 140 | private: |
140 | 141 | friend class TBeMenu; |
diff --git a/src/apps/deskbar/ExpandoMenuBar.cpp b/src/apps/deskbar/ExpandoMenuBar.cpp
index 0fd4483..e13f6cd 100644
a
|
b
|
TExpandoMenuBar::TExpandoMenuBar(TBarView* bar, BRect frame, const char* name,
|
80 | 80 | fDrawLabel(drawLabel), |
81 | 81 | fIsScrolling(false), |
82 | 82 | fShowTeamExpander(static_cast<TBarApp*>(be_app)->Settings()->superExpando), |
83 | | fExpandNewTeams(static_cast<TBarApp*>(be_app)->Settings()->expandNewTeams), |
| 83 | fAutoExpandTeams(static_cast<TBarApp*>(be_app)->Settings()->autoExpandTeams), |
84 | 84 | fBeMenuWidth(kDefaultBeMenuWidth), |
85 | 85 | fBarView(bar), |
86 | 86 | fFirstApp(0), |
… |
… |
TExpandoMenuBar::AddTeam(BList* team, BBitmap* icon, char* name,
|
535 | 535 | AddItem(item); |
536 | 536 | |
537 | 537 | if (fVertical) { |
538 | | if (item && fShowTeamExpander && fExpandNewTeams) |
| 538 | if (item && fShowTeamExpander && fAutoExpandTeams) |
539 | 539 | item->ToggleExpandState(false); |
540 | 540 | |
541 | 541 | fBarView->SizeWindow(BScreen(Window()).Frame()); |
diff --git a/src/apps/deskbar/ExpandoMenuBar.h b/src/apps/deskbar/ExpandoMenuBar.h
index 928555c..86f8cd3 100644
a
|
b
|
class TExpandoMenuBar : public BMenuBar {
|
97 | 97 | bool fDrawLabel : 1; |
98 | 98 | bool fIsScrolling : 1; |
99 | 99 | bool fShowTeamExpander : 1; |
100 | | bool fExpandNewTeams : 1; |
| 100 | bool fAutoExpandTeams : 1; |
101 | 101 | |
102 | 102 | float fBeMenuWidth; |
103 | 103 | |
diff --git a/src/apps/deskbar/PreferencesWindow.cpp b/src/apps/deskbar/PreferencesWindow.cpp
index e8fdf07..eff7ab3 100644
a
|
b
|
PreferencesWindow::PreferencesWindow(BRect frame)
|
55 | 55 | fAppsShowExpanders = new BCheckBox( |
56 | 56 | B_TRANSLATE("Show application expander"), |
57 | 57 | new BMessage(kSuperExpando)); |
58 | | fAppsExpandNew = new BCheckBox(B_TRANSLATE("Expand new applications"), |
59 | | new BMessage(kExpandNewTeams)); |
| 58 | fAppsAutoExpand = new BCheckBox(B_TRANSLATE("Auto-expand applications"), |
| 59 | new BMessage(kAutoExpandTeams)); |
60 | 60 | |
61 | 61 | fClockSeconds = new BCheckBox(B_TRANSLATE("Show seconds"), |
62 | 62 | new BMessage(kShowSeconds)); |
… |
… |
PreferencesWindow::PreferencesWindow(BRect frame)
|
88 | 88 | fAppsSort->SetValue(appSettings->sortRunningApps); |
89 | 89 | fAppsSortTrackerFirst->SetValue(appSettings->trackerAlwaysFirst); |
90 | 90 | fAppsShowExpanders->SetValue(appSettings->superExpando); |
91 | | fAppsExpandNew->SetValue(appSettings->expandNewTeams); |
| 91 | fAppsAutoExpand->SetValue(appSettings->autoExpandTeams); |
92 | 92 | |
93 | 93 | int32 docCount = appSettings->recentDocsCount; |
94 | 94 | int32 appCount = appSettings->recentAppsCount; |
… |
… |
PreferencesWindow::PreferencesWindow(BRect frame)
|
130 | 130 | // Targets |
131 | 131 | fAppsSort->SetTarget(be_app); |
132 | 132 | fAppsSortTrackerFirst->SetTarget(be_app); |
133 | | fAppsExpandNew->SetTarget(be_app); |
| 133 | fAppsAutoExpand->SetTarget(be_app); |
134 | 134 | |
135 | 135 | fClockSeconds->SetTarget(replicantTray); |
136 | 136 | |
… |
… |
PreferencesWindow::PreferencesWindow(BRect frame)
|
177 | 177 | .Add(fAppsShowExpanders) |
178 | 178 | .AddGroup(B_HORIZONTAL, 0) |
179 | 179 | .SetInsets(20, 0, 0, 0) |
180 | | .Add(fAppsExpandNew) |
| 180 | .Add(fAppsAutoExpand) |
181 | 181 | .End() |
182 | 182 | .AddGlue() |
183 | 183 | .SetInsets(10, 10, 10, 10) |
… |
… |
void
|
276 | 276 | PreferencesWindow::_EnableDisableDependentItems() |
277 | 277 | { |
278 | 278 | if (fAppsShowExpanders->Value()) |
279 | | fAppsExpandNew->SetEnabled(true); |
| 279 | fAppsAutoExpand->SetEnabled(true); |
280 | 280 | else |
281 | | fAppsExpandNew->SetEnabled(false); |
| 281 | fAppsAutoExpand->SetEnabled(false); |
282 | 282 | |
283 | 283 | if (fMenuRecentDocuments->Value()) |
284 | 284 | fMenuRecentDocumentCount->SetEnabled(true); |
diff --git a/src/apps/deskbar/PreferencesWindow.h b/src/apps/deskbar/PreferencesWindow.h
index 77f641b..6b4b031 100644
a
|
b
|
private:
|
50 | 50 | BCheckBox* fAppsSort; |
51 | 51 | BCheckBox* fAppsSortTrackerFirst; |
52 | 52 | BCheckBox* fAppsShowExpanders; |
53 | | BCheckBox* fAppsExpandNew; |
| 53 | BCheckBox* fAppsAutoExpand; |
54 | 54 | |
55 | 55 | BCheckBox* fClockSeconds; |
56 | 56 | |
diff --git a/src/apps/deskbar/TeamMenuItem.cpp b/src/apps/deskbar/TeamMenuItem.cpp
index cbd669f..0e61613 100644
a
|
b
|
TTeamMenuItem::ToggleExpandState(bool resizeWindow)
|
497 | 497 | TWindowMenu* sub = (static_cast<TWindowMenu*>(Submenu())); |
498 | 498 | if (sub) { |
499 | 499 | // force the menu to update it's contents. |
500 | | bool locked = sub->LockLooper(); |
| 500 | if (sub->LockLooper()) { |
501 | 501 | // if locking the looper failed, the menu is just not visible |
502 | | sub->AttachedToWindow(); |
503 | | if (locked) |
| 502 | sub->AttachedToWindow(); |
504 | 503 | sub->UnlockLooper(); |
| 504 | } |
505 | 505 | |
506 | 506 | if (sub->CountItems() > 1){ |
507 | 507 | TExpandoMenuBar* parent = static_cast<TExpandoMenuBar*>(Menu()); |