diff --git a/src/apps/deskbar/BarApp.cpp b/src/apps/deskbar/BarApp.cpp
index 532e1bc..1e3113a 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 | |
| 76 | const BRect kIconRect(0.0f, 0.0f, 15.0f, 15.0f); |
77 | 77 | static const color_space kIconFormat = B_RGBA32; |
78 | 78 | |
79 | 79 | |
… |
… |
TBarApp::TBarApp()
|
119 | 119 | fBarWindow = new TBarWindow(); |
120 | 120 | fBarWindow->Show(); |
121 | 121 | |
| 122 | fBarView = static_cast<TBarApp*>(be_app)->BarView(); |
| 123 | |
122 | 124 | // this messenger now targets the barview instead of the |
123 | 125 | // statusview so that all additions to the tray |
124 | 126 | // follow the same path |
… |
… |
TBarApp::SaveSettings()
|
208 | 210 | fSettings.superExpando); |
209 | 211 | storedSettings.AddBool("expandNewTeams", |
210 | 212 | fSettings.expandNewTeams); |
| 213 | storedSettings.AddInt32("iconSize", |
| 214 | fSettings.iconSize); |
211 | 215 | storedSettings.AddBool("autoRaise", |
212 | 216 | fSettings.autoRaise); |
213 | 217 | storedSettings.AddBool("recentAppsEnabled", |
… |
… |
TBarApp::InitSettings()
|
244 | 248 | settings.sortRunningApps = false; |
245 | 249 | settings.superExpando = false; |
246 | 250 | settings.expandNewTeams = false; |
| 251 | settings.iconSize = 1; |
247 | 252 | settings.autoRaise = false; |
248 | 253 | settings.recentAppsEnabled = true; |
249 | 254 | settings.recentDocsEnabled = true; |
… |
… |
TBarApp::InitSettings()
|
295 | 300 | &settings.superExpando); |
296 | 301 | storedSettings.FindBool("expandNewTeams", |
297 | 302 | &settings.expandNewTeams); |
| 303 | storedSettings.FindInt32("iconSize", |
| 304 | (int32*)&settings.iconSize); |
298 | 305 | storedSettings.FindBool("autoRaise", |
299 | 306 | &settings.autoRaise); |
300 | 307 | storedSettings.FindBool("recentAppsEnabled", |
… |
… |
TBarApp::MessageReceived(BMessage* message)
|
478 | 485 | break; |
479 | 486 | } |
480 | 487 | |
| 488 | case kResizeTeamIcons: |
| 489 | { |
| 490 | int32 iconSize; |
| 491 | |
| 492 | if (message->FindInt32("be:value", &iconSize) == B_OK) |
| 493 | fSettings.iconSize = iconSize; |
| 494 | |
| 495 | if (fSettings.iconSize < 1) |
| 496 | fSettings.iconSize = 1; |
| 497 | else if (fSettings.iconSize > 4) |
| 498 | fSettings.iconSize = 4; |
| 499 | |
| 500 | ResizeTeamIcons(); |
| 501 | |
| 502 | fBarWindow->Lock(); |
| 503 | fBarView->UpdatePlacement(); |
| 504 | fBarWindow->Unlock(); |
| 505 | break; |
| 506 | } |
| 507 | |
481 | 508 | case 'TASK': |
482 | 509 | fSwitcherMessenger.SendMessage(message); |
483 | 510 | break; |
… |
… |
TBarApp::AddTeam(team_id team, uint32 flags, const char* sig, entry_ref* ref)
|
628 | 655 | return; |
629 | 656 | } |
630 | 657 | |
631 | | BFile file(ref, B_READ_ONLY); |
632 | | BAppFileInfo appMime(&file); |
633 | | |
634 | 658 | BarTeamInfo* barInfo = new BarTeamInfo(new BList(), flags, strdup(sig), |
635 | | new BBitmap(kIconSize, kIconFormat), strdup(ref->name)); |
| 659 | new BBitmap(kIconRect, kIconFormat), strdup(ref->name)); |
636 | 660 | |
637 | 661 | 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 | 662 | |
641 | 663 | sBarTeamInfoList.AddItem(barInfo); |
| 664 | BMessage message(kResizeTeamIcons); |
| 665 | be_app->PostMessage(&message); |
642 | 666 | |
643 | 667 | int32 subsCount = sSubscribers.CountItems(); |
644 | 668 | if (subsCount > 0) { |
… |
… |
TBarApp::RemoveTeam(team_id team)
|
698 | 722 | |
699 | 723 | |
700 | 724 | void |
| 725 | TBarApp::ResizeTeamIcons() |
| 726 | { |
| 727 | BRect iconRect; |
| 728 | |
| 729 | if (fBarView->Vertical()) |
| 730 | iconRect = BRect(0, 0, ((fSettings.iconSize * 16) - 1), |
| 731 | ((fSettings.iconSize * 16) - 1)); |
| 732 | else |
| 733 | iconRect = kIconRect; |
| 734 | |
| 735 | for (int32 i = 0; i < sBarTeamInfoList.CountItems(); i++) { |
| 736 | BarTeamInfo* barInfo = (BarTeamInfo*)sBarTeamInfoList.ItemAt(i); |
| 737 | if ((barInfo->flags & B_BACKGROUND_APP) == 0 |
| 738 | && strcasecmp(barInfo->sig, kDeskbarSignature) != 0) { |
| 739 | barInfo->icon = new BBitmap(iconRect, kIconFormat); |
| 740 | FetchAppIcon(barInfo->sig, barInfo->icon); |
| 741 | } |
| 742 | } |
| 743 | } |
| 744 | |
| 745 | |
| 746 | void |
701 | 747 | TBarApp::ShowPreferencesWindow() |
702 | 748 | { |
703 | 749 | if (fPreferencesWindow) |
… |
… |
TBarApp::ShowPreferencesWindow()
|
709 | 755 | } |
710 | 756 | |
711 | 757 | |
| 758 | void |
| 759 | TBarApp::FetchAppIcon(const char* signature, BBitmap* icon) |
| 760 | { |
| 761 | app_info appInfo; |
| 762 | |
| 763 | if (be_roster->GetAppInfo(signature, &appInfo) == B_OK) { |
| 764 | BFile file(&appInfo.ref, B_READ_ONLY); |
| 765 | BAppFileInfo appMime(&file); |
| 766 | if (fBarView->Vertical() && icon->Bounds().IntegerHeight() > 15) { |
| 767 | if (appMime.GetIcon(icon, B_LARGE_ICON) != B_OK) |
| 768 | appMime.GetTrackerIcon(icon, B_LARGE_ICON); |
| 769 | } else { |
| 770 | if (appMime.GetIcon(icon, B_MINI_ICON) != B_OK) |
| 771 | appMime.GetTrackerIcon(icon, B_MINI_ICON); |
| 772 | } |
| 773 | } |
| 774 | } |
| 775 | |
| 776 | |
712 | 777 | // #pragma mark - |
713 | 778 | |
714 | 779 | |
diff --git a/src/apps/deskbar/BarApp.h b/src/apps/deskbar/BarApp.h
index 6f15838..3e9aefe 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 | |
… |
… |
struct desk_settings {
|
109 | 110 | bool sortRunningApps; |
110 | 111 | bool superExpando; |
111 | 112 | bool expandNewTeams; |
| 113 | int32 iconSize; |
112 | 114 | bool autoRaise; |
113 | 115 | bool recentAppsEnabled; |
114 | 116 | bool recentDocsEnabled; |
… |
… |
class TBarApp : public BApplication {
|
139 | 141 | |
140 | 142 | static void Subscribe(const BMessenger &subscriber, BList*); |
141 | 143 | static void Unsubscribe(const BMessenger &subscriber); |
| 144 | void ResizeTeamIcons(); |
142 | 145 | |
143 | 146 | private: |
144 | 147 | void AddTeam(team_id team, uint32 flags, const char *sig, entry_ref *); |
… |
… |
class TBarApp : public BApplication {
|
148 | 151 | void SaveSettings(); |
149 | 152 | |
150 | 153 | void ShowPreferencesWindow(); |
| 154 | void FetchAppIcon(const char* signature, BBitmap* icon); |
151 | 155 | |
152 | 156 | TBarWindow* fBarWindow; |
| 157 | TBarView* fBarView; |
153 | 158 | BMessenger fSwitcherMessenger; |
154 | 159 | BMessenger fStatusViewMessenger; |
155 | 160 | BFile* fSettingsFile; |
diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp
index f113e6a..92c9c0a 100644
a
|
b
|
TBarView::ChangeState(int32 state, bool vertical, bool left, bool top)
|
439 | 439 | fLeft = left; |
440 | 440 | fTop = top; |
441 | 441 | |
| 442 | // If switching vertical orientation resize the icons |
| 443 | if (vertSwap) |
| 444 | static_cast<TBarApp*>(be_app)->ResizeTeamIcons(); |
| 445 | |
442 | 446 | BRect screenFrame = (BScreen(Window())).Frame(); |
443 | 447 | |
444 | 448 | PlaceBeMenu(); |
diff --git a/src/apps/deskbar/PreferencesWindow.cpp b/src/apps/deskbar/PreferencesWindow.cpp
index e8fdf07..54ce455 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 | new BMessage(kResizeTeamIcons), 1, 4, B_HORIZONTAL); |
| 63 | fAppsIconSizeSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); |
| 64 | fAppsIconSizeSlider->SetHashMarkCount(4); |
| 65 | fAppsIconSizeSlider->SetLimitLabels(B_TRANSLATE("Small"), |
| 66 | B_TRANSLATE("Large")); |
60 | 67 | |
61 | 68 | fClockSeconds = new BCheckBox(B_TRANSLATE("Show seconds"), |
62 | 69 | new BMessage(kShowSeconds)); |
… |
… |
PreferencesWindow::PreferencesWindow(BRect frame)
|
89 | 96 | fAppsSortTrackerFirst->SetValue(appSettings->trackerAlwaysFirst); |
90 | 97 | fAppsShowExpanders->SetValue(appSettings->superExpando); |
91 | 98 | fAppsExpandNew->SetValue(appSettings->expandNewTeams); |
| 99 | fAppsIconSizeSlider->SetValue(appSettings->iconSize); |
92 | 100 | |
93 | 101 | int32 docCount = appSettings->recentDocsCount; |
94 | 102 | int32 appCount = appSettings->recentAppsCount; |
… |
… |
PreferencesWindow::PreferencesWindow(BRect frame)
|
131 | 139 | fAppsSort->SetTarget(be_app); |
132 | 140 | fAppsSortTrackerFirst->SetTarget(be_app); |
133 | 141 | fAppsExpandNew->SetTarget(be_app); |
| 142 | fAppsIconSizeSlider->SetTarget(be_app); |
134 | 143 | |
135 | 144 | fClockSeconds->SetTarget(replicantTray); |
136 | 145 | |
… |
… |
PreferencesWindow::PreferencesWindow(BRect frame)
|
179 | 188 | .SetInsets(20, 0, 0, 0) |
180 | 189 | .Add(fAppsExpandNew) |
181 | 190 | .End() |
| 191 | .Add(fAppsIconSizeSlider) |
182 | 192 | .AddGlue() |
183 | 193 | .SetInsets(10, 10, 10, 10) |
184 | 194 | .End() |
diff --git a/src/apps/deskbar/PreferencesWindow.h b/src/apps/deskbar/PreferencesWindow.h
index 77f641b..415e813 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> |
… |
… |
private:
|
51 | 52 | BCheckBox* fAppsSortTrackerFirst; |
52 | 53 | BCheckBox* fAppsShowExpanders; |
53 | 54 | BCheckBox* fAppsExpandNew; |
| 55 | BSlider* fAppsIconSizeSlider; |
54 | 56 | |
55 | 57 | BCheckBox* fClockSeconds; |
56 | 58 | |