diff --git a/src/apps/deskbar/BarApp.cpp b/src/apps/deskbar/BarApp.cpp
index 532e1bc..f008ff8 100644
a
|
b
|
BList TBarApp::sSubscribers;
|
72 | 72 | const uint32 kShowBeMenu = 'BeMn'; |
73 | 73 | const uint32 kShowTeamMenu = 'TmMn'; |
74 | 74 | |
75 | | const BRect kIconSize(0.0f, 0.0f, 15.0f, 15.0f); |
76 | 75 | |
77 | 76 | static const color_space kIconFormat = B_RGBA32; |
78 | 77 | |
… |
… |
TBarApp::TBarApp()
|
95 | 94 | InitSettings(); |
96 | 95 | InitIconPreloader(); |
97 | 96 | |
| 97 | fBarWindow = new TBarWindow(); |
| 98 | fBarView = static_cast<TBarApp*>(be_app)->BarView(); |
| 99 | |
98 | 100 | be_roster->StartWatching(this); |
99 | 101 | |
100 | 102 | sBarTeamInfoList.MakeEmpty(); |
… |
… |
TBarApp::TBarApp()
|
116 | 118 | |
117 | 119 | fSwitcherMessenger = BMessenger(new TSwitchManager(fSettings.switcherLoc)); |
118 | 120 | |
119 | | fBarWindow = new TBarWindow(); |
120 | 121 | fBarWindow->Show(); |
121 | 122 | |
122 | 123 | // this messenger now targets the barview instead of the |
… |
… |
TBarApp::SaveSettings()
|
190 | 191 | storedSettings.AddFloat("width", fSettings.width); |
191 | 192 | storedSettings.AddBool("showTime", fSettings.showTime); |
192 | 193 | storedSettings.AddPoint("switcherLoc", fSettings.switcherLoc); |
193 | | storedSettings.AddInt32("recentAppsCount", |
194 | | fSettings.recentAppsCount); |
195 | | storedSettings.AddInt32("recentDocsCount", |
196 | | fSettings.recentDocsCount); |
197 | | storedSettings.AddBool("timeShowSeconds", |
198 | | fSettings.timeShowSeconds); |
| 194 | storedSettings.AddInt32("recentAppsCount", fSettings.recentAppsCount); |
| 195 | storedSettings.AddInt32("recentDocsCount", fSettings.recentDocsCount); |
| 196 | storedSettings.AddBool("timeShowSeconds", fSettings.timeShowSeconds); |
199 | 197 | storedSettings.AddInt32("recentFoldersCount", |
200 | 198 | fSettings.recentFoldersCount); |
201 | 199 | storedSettings.AddBool("alwaysOnTop", fSettings.alwaysOnTop); |
202 | 200 | storedSettings.AddBool("timeFullDate", fSettings.timeFullDate); |
203 | 201 | storedSettings.AddBool("trackerAlwaysFirst", |
204 | 202 | fSettings.trackerAlwaysFirst); |
205 | | storedSettings.AddBool("sortRunningApps", |
206 | | fSettings.sortRunningApps); |
207 | | storedSettings.AddBool("superExpando", |
208 | | fSettings.superExpando); |
209 | | storedSettings.AddBool("expandNewTeams", |
210 | | fSettings.expandNewTeams); |
211 | | storedSettings.AddBool("autoRaise", |
212 | | fSettings.autoRaise); |
| 203 | storedSettings.AddBool("sortRunningApps", fSettings.sortRunningApps); |
| 204 | storedSettings.AddBool("superExpando", fSettings.superExpando); |
| 205 | storedSettings.AddBool("expandNewTeams", fSettings.expandNewTeams); |
| 206 | storedSettings.AddInt32("iconSize", fSettings.iconSize); |
| 207 | storedSettings.AddBool("autoRaise", fSettings.autoRaise); |
213 | 208 | storedSettings.AddBool("recentAppsEnabled", |
214 | 209 | fSettings.recentAppsEnabled); |
215 | 210 | storedSettings.AddBool("recentDocsEnabled", |
… |
… |
TBarApp::InitSettings()
|
244 | 239 | settings.sortRunningApps = false; |
245 | 240 | settings.superExpando = false; |
246 | 241 | settings.expandNewTeams = false; |
| 242 | settings.iconSize = kMinimumIconSize; |
247 | 243 | settings.autoRaise = false; |
248 | 244 | settings.recentAppsEnabled = true; |
249 | 245 | settings.recentDocsEnabled = true; |
… |
… |
TBarApp::InitSettings()
|
291 | 287 | &settings.trackerAlwaysFirst); |
292 | 288 | storedSettings.FindBool("sortRunningApps", |
293 | 289 | &settings.sortRunningApps); |
294 | | storedSettings.FindBool("superExpando", |
295 | | &settings.superExpando); |
296 | | storedSettings.FindBool("expandNewTeams", |
297 | | &settings.expandNewTeams); |
298 | | storedSettings.FindBool("autoRaise", |
299 | | &settings.autoRaise); |
| 290 | storedSettings.FindBool("superExpando", &settings.superExpando); |
| 291 | storedSettings.FindBool("expandNewTeams", &settings.expandNewTeams); |
| 292 | storedSettings.FindInt32("iconSize", (int32*)&settings.iconSize); |
| 293 | storedSettings.FindBool("autoRaise", &settings.autoRaise); |
300 | 294 | storedSettings.FindBool("recentAppsEnabled", |
301 | 295 | &settings.recentAppsEnabled); |
302 | 296 | storedSettings.FindBool("recentDocsEnabled", |
… |
… |
TBarApp::MessageReceived(BMessage* message)
|
369 | 363 | fPreferencesWindow = NULL; |
370 | 364 | break; |
371 | 365 | |
| 366 | case kStateChanged: |
| 367 | fPreferencesWindow->PostMessage(kStateChanged); |
| 368 | break; |
| 369 | |
372 | 370 | case B_SOME_APP_LAUNCHED: |
373 | 371 | { |
374 | 372 | team_id team = -1; |
… |
… |
TBarApp::MessageReceived(BMessage* message)
|
478 | 476 | break; |
479 | 477 | } |
480 | 478 | |
| 479 | case kResizeTeamIcons: |
| 480 | { |
| 481 | int32 iconSize; |
| 482 | |
| 483 | if (message->FindInt32("be:value", &iconSize) == B_OK) |
| 484 | fSettings.iconSize = iconSize * 8; |
| 485 | |
| 486 | if (fSettings.iconSize < kMinimumIconSize) |
| 487 | fSettings.iconSize = kMinimumIconSize; |
| 488 | else if (fSettings.iconSize > kMaximumIconSize) |
| 489 | fSettings.iconSize = kMaximumIconSize; |
| 490 | |
| 491 | ResizeTeamIcons(); |
| 492 | |
| 493 | fBarWindow->Lock(); |
| 494 | fBarView->UpdatePlacement(); |
| 495 | fBarWindow->Unlock(); |
| 496 | break; |
| 497 | } |
| 498 | |
481 | 499 | case 'TASK': |
482 | 500 | fSwitcherMessenger.SendMessage(message); |
483 | 501 | break; |
… |
… |
TBarApp::AddTeam(team_id team, uint32 flags, const char* sig, entry_ref* ref)
|
628 | 646 | return; |
629 | 647 | } |
630 | 648 | |
631 | | BFile file(ref, B_READ_ONLY); |
632 | | BAppFileInfo appMime(&file); |
633 | | |
634 | 649 | BarTeamInfo* barInfo = new BarTeamInfo(new BList(), flags, strdup(sig), |
635 | | new BBitmap(kIconSize, kIconFormat), strdup(ref->name)); |
| 650 | new BBitmap(IconRect(), kIconFormat), strdup(ref->name)); |
| 651 | |
| 652 | if ((barInfo->flags & B_BACKGROUND_APP) == 0 |
| 653 | && strcasecmp(barInfo->sig, kDeskbarSignature) != 0) |
| 654 | FetchAppIcon(barInfo->sig, barInfo->icon); |
636 | 655 | |
637 | 656 | barInfo->teams->AddItem((void*)team); |
638 | | if (appMime.GetIcon(barInfo->icon, B_MINI_ICON) != B_OK) |
639 | | appMime.GetTrackerIcon(barInfo->icon, B_MINI_ICON); |
640 | 657 | |
641 | 658 | sBarTeamInfoList.AddItem(barInfo); |
| 659 | BMessage message(kResizeTeamIcons); |
| 660 | be_app->PostMessage(&message); |
642 | 661 | |
643 | 662 | int32 subsCount = sSubscribers.CountItems(); |
644 | 663 | if (subsCount > 0) { |
… |
… |
TBarApp::RemoveTeam(team_id team)
|
698 | 717 | |
699 | 718 | |
700 | 719 | void |
| 720 | TBarApp::ResizeTeamIcons() |
| 721 | { |
| 722 | for (int32 i = 0; i < sBarTeamInfoList.CountItems(); i++) { |
| 723 | BarTeamInfo* barInfo = (BarTeamInfo*)sBarTeamInfoList.ItemAt(i); |
| 724 | if ((barInfo->flags & B_BACKGROUND_APP) == 0 |
| 725 | && strcasecmp(barInfo->sig, kDeskbarSignature) != 0) { |
| 726 | barInfo->icon = new BBitmap(IconRect(), kIconFormat); |
| 727 | FetchAppIcon(barInfo->sig, barInfo->icon); |
| 728 | } |
| 729 | } |
| 730 | } |
| 731 | |
| 732 | |
| 733 | void |
701 | 734 | TBarApp::ShowPreferencesWindow() |
702 | 735 | { |
703 | 736 | if (fPreferencesWindow) |
… |
… |
TBarApp::ShowPreferencesWindow()
|
709 | 742 | } |
710 | 743 | |
711 | 744 | |
| 745 | void |
| 746 | TBarApp::FetchAppIcon(const char* signature, BBitmap* icon) |
| 747 | { |
| 748 | app_info appInfo; |
| 749 | |
| 750 | if (be_roster->GetAppInfo(signature, &appInfo) == B_OK) { |
| 751 | BFile file(&appInfo.ref, B_READ_ONLY); |
| 752 | BAppFileInfo appMime(&file); |
| 753 | icon_size size = icon->Bounds().IntegerHeight() >= 31 |
| 754 | ? B_LARGE_ICON : B_MINI_ICON; |
| 755 | |
| 756 | if (appMime.GetIcon(icon, size) != B_OK) |
| 757 | appMime.GetTrackerIcon(icon, size); |
| 758 | } |
| 759 | } |
| 760 | |
| 761 | |
| 762 | const BRect |
| 763 | TBarApp::IconRect() |
| 764 | { |
| 765 | return BRect(0, 0, fSettings.iconSize - 1, fSettings.iconSize - 1); |
| 766 | } |
| 767 | |
| 768 | |
712 | 769 | // #pragma mark - |
713 | 770 | |
714 | 771 | |
diff --git a/src/apps/deskbar/BarApp.h b/src/apps/deskbar/BarApp.h
index 6f15838..f474417 100644
a
|
b
|
const uint32 kTrackerFirst = 'TkFt';
|
80 | 80 | const uint32 kSortRunningApps = 'SAps'; |
81 | 81 | const uint32 kSuperExpando = 'SprE'; |
82 | 82 | const uint32 kExpandNewTeams = 'ExTm'; |
| 83 | const uint32 kResizeTeamIcons = 'RTIs'; |
83 | 84 | const uint32 kAutoRaise = 'AtRs'; |
84 | 85 | const uint32 kRestartTracker = 'Trak'; |
85 | 86 | |
… |
… |
const uint32 kShutdownSystem = 301;
|
88 | 89 | const uint32 kRebootSystem = 302; |
89 | 90 | const uint32 kSuspendSystem = 304; |
90 | 91 | |
| 92 | // icon size constants |
| 93 | const int32 kMinimumIconSize = 16; |
| 94 | const int32 kMaximumIconSize = 64; |
| 95 | const int32 kIconSizeInterval = 8; |
| 96 | |
91 | 97 | /* --------------------------------------------- */ |
92 | 98 | |
93 | 99 | struct desk_settings { |
… |
… |
struct desk_settings {
|
109 | 115 | bool sortRunningApps; |
110 | 116 | bool superExpando; |
111 | 117 | bool expandNewTeams; |
| 118 | int32 iconSize; |
112 | 119 | bool autoRaise; |
113 | 120 | bool recentAppsEnabled; |
114 | 121 | bool recentDocsEnabled; |
… |
… |
class TBarApp : public BApplication {
|
139 | 146 | |
140 | 147 | static void Subscribe(const BMessenger &subscriber, BList*); |
141 | 148 | static void Unsubscribe(const BMessenger &subscriber); |
| 149 | void ResizeTeamIcons(); |
142 | 150 | |
143 | 151 | private: |
144 | 152 | void AddTeam(team_id team, uint32 flags, const char *sig, entry_ref *); |
… |
… |
class TBarApp : public BApplication {
|
148 | 156 | void SaveSettings(); |
149 | 157 | |
150 | 158 | void ShowPreferencesWindow(); |
| 159 | void FetchAppIcon(const char* signature, BBitmap* icon); |
| 160 | const BRect IconRect(); |
151 | 161 | |
152 | 162 | TBarWindow* fBarWindow; |
| 163 | TBarView* fBarView; |
153 | 164 | BMessenger fSwitcherMessenger; |
154 | 165 | BMessenger fStatusViewMessenger; |
155 | 166 | BFile* fSettingsFile; |
diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp
index f113e6a..f028fb2 100644
a
|
b
|
void
|
130 | 130 | TBarView::Draw(BRect) |
131 | 131 | { |
132 | 132 | BRect bounds(Bounds()); |
133 | | |
| 133 | |
134 | 134 | rgb_color hilite = tint_color(ViewColor(), B_DARKEN_1_TINT); |
135 | 135 | rgb_color light = tint_color(ViewColor(), B_LIGHTEN_2_TINT); |
136 | | |
| 136 | |
137 | 137 | SetHighColor(hilite); |
138 | 138 | if (AcrossTop()) |
139 | 139 | StrokeLine(bounds.LeftBottom(), bounds.RightBottom()); |
… |
… |
TBarView::PlaceBeMenu()
|
232 | 232 | } else if (fState == kExpandoState) { |
233 | 233 | // shows apps below tray |
234 | 234 | fBarMenuBar->RemoveTeamMenu(); |
235 | | if (fVertical) |
| 235 | if (fVertical) { |
236 | 236 | width += 1; |
237 | | else |
| 237 | desk_settings* settings = ((TBarApp*)be_app)->Settings(); |
| 238 | width += settings->iconSize - kMinimumIconSize; |
| 239 | } else |
238 | 240 | width = floorf(width) / 2; |
239 | 241 | loc = Bounds().LeftTop(); |
240 | 242 | } else |
… |
… |
TBarView::PlaceApplicationBar(BRect screenFrame)
|
298 | 300 | if (fState == kMiniState) |
299 | 301 | return; |
300 | 302 | |
| 303 | desk_settings* settings = ((TBarApp*)be_app)->Settings(); |
301 | 304 | BRect expandoFrame(0, 0, 0, 0); |
302 | 305 | if (fVertical) { |
303 | 306 | // top left/right |
… |
… |
TBarView::PlaceApplicationBar(BRect screenFrame)
|
309 | 312 | expandoFrame.bottom = expandoFrame.top + 1; |
310 | 313 | if (fState == kFullState) |
311 | 314 | expandoFrame.right = fBarMenuBar->Frame().Width(); |
312 | | else |
313 | | expandoFrame.right = sMinimumWindowWidth; |
| 315 | else { |
| 316 | expandoFrame.right = sMinimumWindowWidth + settings->iconSize |
| 317 | - kMinimumIconSize; |
| 318 | } |
314 | 319 | } else { |
315 | 320 | // top or bottom |
316 | 321 | expandoFrame.top = 0; |
317 | | expandoFrame.bottom = kHModeHeight; |
| 322 | expandoFrame.bottom = settings->iconSize + 4; |
318 | 323 | if (fTrayLocation != 0) |
319 | 324 | expandoFrame.right = fDragRegion->Frame().left - 1; |
320 | 325 | else |
… |
… |
TBarView::GetPreferredWindowSize(BRect screenFrame, float* width, float* height)
|
336 | 341 | windowHeight = screenFrame.bottom; |
337 | 342 | windowWidth = fBarMenuBar->Frame().Width(); |
338 | 343 | } else if (fState == kExpandoState) { |
| 344 | desk_settings* settings = ((TBarApp*)be_app)->Settings(); |
339 | 345 | if (fVertical) { |
340 | 346 | // top left or right |
341 | 347 | windowHeight = fExpando->Frame().bottom; |
| 348 | windowWidth += settings->iconSize - kMinimumIconSize; |
342 | 349 | } else { |
343 | 350 | // top or bottom, full |
344 | 351 | fExpando->CheckItemSizes(0); |
345 | | windowHeight = kHModeHeight; |
| 352 | windowHeight = settings->iconSize + 4; |
346 | 353 | windowWidth = screenFrame.Width(); |
347 | 354 | } |
348 | 355 | } else { |
… |
… |
TBarView::ChangeState(int32 state, bool vertical, bool left, bool top)
|
433 | 440 | { |
434 | 441 | bool vertSwap = (fVertical != vertical); |
435 | 442 | bool leftSwap = (fLeft != left); |
| 443 | bool stateChanged = (fState != state); |
436 | 444 | |
437 | 445 | fState = state; |
438 | 446 | fVertical = vertical; |
439 | 447 | fLeft = left; |
440 | 448 | fTop = top; |
441 | 449 | |
| 450 | // Send a message to the preferences window to let it know to enable |
| 451 | // or disabled preference items |
| 452 | if (stateChanged) { |
| 453 | BMessage message(kStateChanged); |
| 454 | be_app->PostMessage(&message); |
| 455 | } |
| 456 | |
442 | 457 | BRect screenFrame = (BScreen(Window())).Frame(); |
443 | 458 | |
444 | 459 | PlaceBeMenu(); |
… |
… |
BRect
|
934 | 949 | TBarView::OffsetIconFrame(BRect rect) const |
935 | 950 | { |
936 | 951 | BRect frame(Frame()); |
| 952 | desk_settings* settings = ((TBarApp*)be_app)->Settings(); |
| 953 | |
937 | 954 | frame.left += fDragRegion->Frame().left + fReplicantTray->Frame().left |
938 | | + rect.left; |
| 955 | + rect.left + settings->iconSize - kMinimumIconSize; |
939 | 956 | frame.top += fDragRegion->Frame().top + fReplicantTray->Frame().top |
940 | 957 | + rect.top; |
941 | 958 | |
diff --git a/src/apps/deskbar/ExpandoMenuBar.cpp b/src/apps/deskbar/ExpandoMenuBar.cpp
index 0fd4483..28ecb99 100644
a
|
b
|
TExpandoMenuBar::TExpandoMenuBar(TBarView* bar, BRect frame, const char* name,
|
89 | 89 | { |
90 | 90 | SetItemMargins(0.0f, 0.0f, 0.0f, 0.0f); |
91 | 91 | SetFont(be_plain_font); |
92 | | SetMaxContentWidth(sMinimumWindowWidth); |
| 92 | float maxContentWidth = sMinimumWindowWidth |
| 93 | + ((TBarApp*)be_app)->Settings()->iconSize - kMinimumIconSize; |
| 94 | SetMaxContentWidth(maxContentWidth); |
93 | 95 | } |
94 | 96 | |
95 | 97 | |
… |
… |
TExpandoMenuBar::AttachedToWindow()
|
133 | 135 | |
134 | 136 | desk_settings* settings = ((TBarApp*)be_app)->Settings(); |
135 | 137 | |
| 138 | if (!fVertical || fBarView->Expando()) |
| 139 | width += settings->iconSize - kMinimumIconSize; |
| 140 | |
136 | 141 | if (settings->sortRunningApps) |
137 | 142 | teamList.SortItems(CompareByName); |
138 | 143 | |
… |
… |
TExpandoMenuBar::CheckItemSizes(int32 delta)
|
628 | 633 | } else if (delta < 0 && fOverflow) { |
629 | 634 | reset = true; |
630 | 635 | if (fullWidth > width) |
631 | | newWidth = floorf(width/count); |
| 636 | newWidth = floorf(width / count); |
632 | 637 | else |
633 | 638 | newWidth = sMinimumWindowWidth; |
634 | 639 | } |
| 640 | |
635 | 641 | if (newWidth > sMinimumWindowWidth) |
636 | 642 | newWidth = sMinimumWindowWidth; |
637 | 643 | |
diff --git a/src/apps/deskbar/PreferencesWindow.cpp b/src/apps/deskbar/PreferencesWindow.cpp
index e8fdf07..6bd2405 100644
a
|
b
|
|
17 | 17 | #include <OpenWithTracker.h> |
18 | 18 | #include <RadioButton.h> |
19 | 19 | #include <SeparatorView.h> |
| 20 | #include <Slider.h> |
20 | 21 | |
21 | 22 | #include <ctype.h> |
22 | 23 | |
… |
… |
PreferencesWindow::PreferencesWindow(BRect frame)
|
57 | 58 | new BMessage(kSuperExpando)); |
58 | 59 | fAppsExpandNew = new BCheckBox(B_TRANSLATE("Expand new applications"), |
59 | 60 | new BMessage(kExpandNewTeams)); |
| 61 | fAppsIconSizeSlider = new BSlider("icon_size", B_TRANSLATE("Icon size"), |
| 62 | NULL, kMinimumIconSize / kIconSizeInterval, |
| 63 | kMaximumIconSize / kIconSizeInterval, B_HORIZONTAL); |
| 64 | fAppsIconSizeSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); |
| 65 | fAppsIconSizeSlider->SetHashMarkCount(((kMaximumIconSize - kMinimumIconSize) |
| 66 | / kIconSizeInterval) + 1); |
| 67 | fAppsIconSizeSlider->SetLimitLabels(B_TRANSLATE("Small"), |
| 68 | B_TRANSLATE("Large")); |
| 69 | fAppsIconSizeSlider->SetModificationMessage(new BMessage(kResizeTeamIcons)); |
60 | 70 | |
61 | 71 | fClockSeconds = new BCheckBox(B_TRANSLATE("Show seconds"), |
62 | 72 | new BMessage(kShowSeconds)); |
… |
… |
PreferencesWindow::PreferencesWindow(BRect frame)
|
83 | 93 | |
84 | 94 | // Values |
85 | 95 | TBarApp* barApp = static_cast<TBarApp*>(be_app); |
86 | | desk_settings* appSettings = barApp->Settings();; |
| 96 | desk_settings* appSettings = barApp->Settings(); |
87 | 97 | |
88 | 98 | fAppsSort->SetValue(appSettings->sortRunningApps); |
89 | 99 | fAppsSortTrackerFirst->SetValue(appSettings->trackerAlwaysFirst); |
90 | 100 | fAppsShowExpanders->SetValue(appSettings->superExpando); |
91 | 101 | fAppsExpandNew->SetValue(appSettings->expandNewTeams); |
| 102 | fAppsIconSizeSlider->SetValue(appSettings->iconSize / 8); |
92 | 103 | |
93 | 104 | int32 docCount = appSettings->recentDocsCount; |
94 | 105 | int32 appCount = appSettings->recentAppsCount; |
… |
… |
PreferencesWindow::PreferencesWindow(BRect frame)
|
131 | 142 | fAppsSort->SetTarget(be_app); |
132 | 143 | fAppsSortTrackerFirst->SetTarget(be_app); |
133 | 144 | fAppsExpandNew->SetTarget(be_app); |
| 145 | fAppsIconSizeSlider->SetTarget(be_app); |
134 | 146 | |
135 | 147 | fClockSeconds->SetTarget(replicantTray); |
136 | 148 | |
… |
… |
PreferencesWindow::PreferencesWindow(BRect frame)
|
179 | 191 | .SetInsets(20, 0, 0, 0) |
180 | 192 | .Add(fAppsExpandNew) |
181 | 193 | .End() |
| 194 | .Add(fAppsIconSizeSlider) |
182 | 195 | .AddGlue() |
183 | 196 | .SetInsets(10, 10, 10, 10) |
184 | 197 | .End() |
… |
… |
PreferencesWindow::MessageReceived(BMessage* message)
|
242 | 255 | be_app->PostMessage(message); |
243 | 256 | break; |
244 | 257 | |
| 258 | case kStateChanged: |
| 259 | _EnableDisableDependentItems(); |
| 260 | break; |
| 261 | |
245 | 262 | default: |
246 | 263 | BWindow::MessageReceived(message); |
247 | 264 | break; |
… |
… |
PreferencesWindow::_UpdateRecentCounts()
|
275 | 292 | void |
276 | 293 | PreferencesWindow::_EnableDisableDependentItems() |
277 | 294 | { |
278 | | if (fAppsShowExpanders->Value()) |
279 | | fAppsExpandNew->SetEnabled(true); |
280 | | else |
| 295 | TBarApp* barApp = static_cast<TBarApp*>(be_app); |
| 296 | if (barApp->BarView()->Vertical()) { |
| 297 | if (barApp->BarView()->Expando()) { |
| 298 | fAppsShowExpanders->SetEnabled(true); |
| 299 | if (fAppsShowExpanders->Value()) |
| 300 | fAppsExpandNew->SetEnabled(true); |
| 301 | else |
| 302 | fAppsExpandNew->SetEnabled(false); |
| 303 | } else { |
| 304 | fAppsShowExpanders->SetEnabled(false); |
| 305 | fAppsExpandNew->SetEnabled(false); |
| 306 | } |
| 307 | } else { |
| 308 | fAppsShowExpanders->SetEnabled(false); |
281 | 309 | fAppsExpandNew->SetEnabled(false); |
| 310 | } |
282 | 311 | |
283 | 312 | if (fMenuRecentDocuments->Value()) |
284 | 313 | fMenuRecentDocumentCount->SetEnabled(true); |
diff --git a/src/apps/deskbar/PreferencesWindow.h b/src/apps/deskbar/PreferencesWindow.h
index 77f641b..4aabde4 100644
a
|
b
|
|
10 | 10 | #include <Button.h> |
11 | 11 | #include <CheckBox.h> |
12 | 12 | #include <RadioButton.h> |
| 13 | #include <Slider.h> |
13 | 14 | #include <StringView.h> |
14 | 15 | #include <TextControl.h> |
15 | 16 | #include <Window.h> |
… |
… |
const uint32 kConfigShow = 'show';
|
19 | 20 | const uint32 kConfigClose = 'canc'; |
20 | 21 | const uint32 kUpdateRecentCounts = 'upct'; |
21 | 22 | const uint32 kEditMenuInTracker = 'mtrk'; |
| 23 | const uint32 kStateChanged = 'stch'; |
22 | 24 | |
23 | 25 | |
24 | 26 | class PreferencesWindow : public BWindow |
… |
… |
private:
|
51 | 53 | BCheckBox* fAppsSortTrackerFirst; |
52 | 54 | BCheckBox* fAppsShowExpanders; |
53 | 55 | BCheckBox* fAppsExpandNew; |
| 56 | BSlider* fAppsIconSizeSlider; |
54 | 57 | |
55 | 58 | BCheckBox* fClockSeconds; |
56 | 59 | |
diff --git a/src/apps/deskbar/StatusView.cpp b/src/apps/deskbar/StatusView.cpp
index a504101..4f29518 100644
a
|
b
|
TReplicantTray::TReplicantTray(TBarView* parent, bool vertical)
|
136 | 136 | fAlignmentSupport(false) |
137 | 137 | { |
138 | 138 | // init the minimum window width according to the logo. |
| 139 | desk_settings* settings = ((TBarApp*)be_app)->Settings(); |
139 | 140 | const BBitmap* logoBitmap = AppResSet()->FindBitmap(B_MESSAGE_TYPE, |
140 | 141 | R_BeLogoIcon); |
| 142 | |
141 | 143 | if (logoBitmap != NULL) { |
142 | 144 | sMinimumWindowWidth = max_c(sMinimumWindowWidth, |
143 | | 2 * (logoBitmap->Bounds().Width() + 8)); |
| 145 | 2 * (logoBitmap->Bounds().Width() + 8) + settings->iconSize |
| 146 | - kMinimumIconSize); |
144 | 147 | fMinimumTrayWidth = sMinimumWindowWidth - kGutter - kDragRegionWidth; |
145 | 148 | } |
146 | 149 | } |
… |
… |
void
|
250 | 253 | TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight) |
251 | 254 | { |
252 | 255 | float width = 0, height = kMinimumTrayHeight; |
| 256 | desk_settings* settings = ((TBarApp*)be_app)->Settings(); |
253 | 257 | |
254 | 258 | if (fMultiRowMode) { |
255 | 259 | if (fShelf->CountReplicants() > 0) |
… |
… |
TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight)
|
262 | 266 | height = kGutter + (rowCount * kMaxReplicantHeight) |
263 | 267 | + ((rowCount - 1) * kIconGap) + kGutter; |
264 | 268 | height = max(kMinimumTrayHeight, height); |
265 | | width = fMinimumTrayWidth; |
| 269 | |
| 270 | if (fBarView->Expando()) |
| 271 | width = fMinimumTrayWidth + settings->iconSize - kMinimumIconSize; |
| 272 | else |
| 273 | width = fMinimumTrayWidth; |
266 | 274 | } else { |
267 | | // if last replicant overruns clock then |
268 | | // resize to accomodate |
| 275 | // if last replicant overruns the clock then resize to accomodate |
269 | 276 | if (fShelf->CountReplicants() > 0) { |
270 | | if (fBarView->ShowingClock() |
271 | | && fRightBottomReplicant.right + 6 >= fClock->Frame().left) { |
| 277 | if (fBarView->ShowingClock() && fRightBottomReplicant.right + 6 |
| 278 | >= fClock->Frame().left) { |
272 | 279 | width = fRightBottomReplicant.right + 6 |
273 | 280 | + fClock->Frame().Width(); |
274 | 281 | } else |
… |
… |
TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight)
|
276 | 283 | } |
277 | 284 | // this view has a fixed minimum width |
278 | 285 | width = max(fMinimumTrayWidth, width); |
| 286 | height = kGutter + settings->iconSize + kGutter; |
279 | 287 | } |
280 | 288 | |
281 | 289 | *preferredWidth = width; |
… |
… |
TReplicantTray::AcceptAddon(BRect replicantFrame, BMessage* message)
|
1237 | 1245 | BPoint |
1238 | 1246 | TReplicantTray::LocationForReplicant(int32 index, float width) |
1239 | 1247 | { |
| 1248 | desk_settings* settings = ((TBarApp*)be_app)->Settings(); |
1240 | 1249 | BPoint loc(kIconGap + 1, kGutter + 1); |
1241 | 1250 | |
1242 | 1251 | if (fMultiRowMode) { |
1243 | 1252 | // try to find free space in every row |
1244 | 1253 | for (int32 row = 0; ; loc.y += kMaxReplicantHeight + kIconGap, row++) { |
1245 | 1254 | // determine free space in this row |
1246 | | BRect rect(loc.x, loc.y, loc.x + fMinimumTrayWidth - kIconGap - 2.0, |
| 1255 | BRect rect(loc.x, loc.y, loc.x + fMinimumTrayWidth |
| 1256 | + settings->iconSize - kMinimumIconSize - kIconGap - 2.0, |
1247 | 1257 | loc.y + kMaxReplicantHeight); |
1248 | 1258 | if (row == 0 && fBarView->ShowingClock()) |
1249 | 1259 | rect.right -= fClock->Frame().Width() + kIconGap; |
diff --git a/src/apps/deskbar/TeamMenuItem.cpp b/src/apps/deskbar/TeamMenuItem.cpp
index cbd669f..5e7f1cd 100644
a
|
b
|
TTeamMenuItem::GetContentSize(float* width, float* height)
|
203 | 203 | if (fIcon) |
204 | 204 | iconBounds = fIcon->Bounds(); |
205 | 205 | else |
206 | | iconBounds = BRect(0, 0, 15, 15); |
| 206 | iconBounds = BRect(0, 0, kMinimumIconSize - 1, kMinimumIconSize - 1); |
207 | 207 | |
208 | 208 | BMenuItem::GetContentSize(width, height); |
209 | 209 | |
210 | 210 | if (fOverrideWidth != -1.0f) |
211 | 211 | *width = fOverrideWidth; |
212 | 212 | else |
213 | | *width = kHPad + iconBounds.Width() + kLabelOffset + fLabelWidth + kHPad |
214 | | + 20; |
| 213 | *width = kHPad + iconBounds.Width() + kLabelOffset + fLabelWidth + kHPad + 20; |
215 | 214 | |
216 | 215 | if (fOverrideHeight != -1.0f) |
217 | 216 | *height = fOverrideHeight; |