-
diff --git a/src/apps/deskbar/BarApp.cpp b/src/apps/deskbar/BarApp.cpp
index 2647068..ffc1398 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
All rights reserved.
|
60 | 61 | #include "PublicCommands.h" |
61 | 62 | #include "ResourceSet.h" |
62 | 63 | #include "Switcher.h" |
63 | | #include "TeamMenu.h" |
64 | | #include "WindowMenuItem.h" |
65 | 64 | |
66 | 65 | |
67 | 66 | BLocker TBarApp::sSubscriberLock; |
… |
… |
BList TBarApp::sSubscribers;
|
72 | 71 | const uint32 kShowBeMenu = 'BeMn'; |
73 | 72 | const uint32 kShowTeamMenu = 'TmMn'; |
74 | 73 | |
75 | | const BRect kIconSize(0.0f, 0.0f, 15.0f, 15.0f); |
76 | 74 | |
| 75 | const BRect kIconRect(0.0f, 0.0f, 15.0f, 15.0f); |
77 | 76 | static const color_space kIconFormat = B_RGBA32; |
78 | 77 | |
79 | 78 | |
… |
… |
TBarApp::SaveSettings()
|
190 | 189 | storedSettings.AddFloat("width", fSettings.width); |
191 | 190 | storedSettings.AddBool("showTime", fSettings.showTime); |
192 | 191 | 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); |
| 192 | storedSettings.AddInt32("recentAppsCount", fSettings.recentAppsCount); |
| 193 | storedSettings.AddInt32("recentDocsCount", fSettings.recentDocsCount); |
| 194 | storedSettings.AddBool("timeShowSeconds", fSettings.timeShowSeconds); |
199 | 195 | storedSettings.AddInt32("recentFoldersCount", |
200 | 196 | fSettings.recentFoldersCount); |
201 | 197 | storedSettings.AddBool("alwaysOnTop", fSettings.alwaysOnTop); |
202 | 198 | storedSettings.AddBool("timeFullDate", fSettings.timeFullDate); |
203 | 199 | storedSettings.AddBool("trackerAlwaysFirst", |
204 | 200 | 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); |
| 201 | storedSettings.AddBool("sortRunningApps", fSettings.sortRunningApps); |
| 202 | storedSettings.AddBool("superExpando", fSettings.superExpando); |
| 203 | storedSettings.AddBool("expandNewTeams", fSettings.expandNewTeams); |
| 204 | storedSettings.AddBool("autoRaise", fSettings.autoRaise); |
213 | 205 | storedSettings.AddBool("recentAppsEnabled", |
214 | 206 | fSettings.recentAppsEnabled); |
215 | 207 | storedSettings.AddBool("recentDocsEnabled", |
… |
… |
TBarApp::InitSettings()
|
291 | 283 | &settings.trackerAlwaysFirst); |
292 | 284 | storedSettings.FindBool("sortRunningApps", |
293 | 285 | &settings.sortRunningApps); |
294 | | storedSettings.FindBool("superExpando", |
295 | | &settings.superExpando); |
296 | | storedSettings.FindBool("expandNewTeams", |
297 | | &settings.expandNewTeams); |
298 | | storedSettings.FindBool("autoRaise", |
299 | | &settings.autoRaise); |
| 286 | storedSettings.FindBool("superExpando", &settings.superExpando); |
| 287 | storedSettings.FindBool("expandNewTeams", &settings.expandNewTeams); |
| 288 | storedSettings.FindBool("autoRaise", &settings.autoRaise); |
300 | 289 | storedSettings.FindBool("recentAppsEnabled", |
301 | 290 | &settings.recentAppsEnabled); |
302 | 291 | storedSettings.FindBool("recentDocsEnabled", |
… |
… |
TBarApp::InitSettings()
|
313 | 302 | void |
314 | 303 | TBarApp::MessageReceived(BMessage* message) |
315 | 304 | { |
316 | | int32 count; |
317 | | bool enabled; |
318 | 305 | switch (message->what) { |
319 | 306 | case 'gloc': |
320 | 307 | case 'sloc': |
… |
… |
TBarApp::MessageReceived(BMessage* message)
|
353 | 340 | break; |
354 | 341 | |
355 | 342 | case kUpdateRecentCounts: |
| 343 | int32 count; |
| 344 | bool enabled; |
| 345 | |
356 | 346 | if (message->FindInt32("applications", &count) == B_OK) |
357 | 347 | fSettings.recentAppsCount = count; |
358 | 348 | if (message->FindBool("applicationsEnabled", &enabled) == B_OK) |
… |
… |
TBarApp::MessageReceived(BMessage* message)
|
413 | 403 | break; |
414 | 404 | |
415 | 405 | case kAlwaysTop: |
416 | | fSettings.alwaysOnTop = !fSettings.alwaysOnTop; |
| 406 | fSettings.alwaysOnTop = !fSettings.alwaysOnTop; |
417 | 407 | |
418 | | fBarWindow->SetFeel(fSettings.alwaysOnTop ? |
419 | | B_FLOATING_ALL_WINDOW_FEEL : B_NORMAL_WINDOW_FEEL); |
420 | | break; |
| 408 | fBarWindow->SetFeel(fSettings.alwaysOnTop ? |
| 409 | B_FLOATING_ALL_WINDOW_FEEL : B_NORMAL_WINDOW_FEEL); |
| 410 | break; |
421 | 411 | |
422 | 412 | case kAutoRaise: |
423 | | { |
424 | 413 | fSettings.autoRaise = !fSettings.autoRaise; |
425 | 414 | |
426 | | TBarView* barView = static_cast<TBarApp*>(be_app)->BarView(); |
427 | 415 | fBarWindow->Lock(); |
428 | | barView->UpdateAutoRaise(); |
| 416 | BarView()->UpdateAutoRaise(); |
429 | 417 | fBarWindow->Unlock(); |
430 | 418 | break; |
431 | | } |
432 | 419 | |
433 | 420 | case kTrackerFirst: |
434 | | { |
435 | 421 | fSettings.trackerAlwaysFirst = !fSettings.trackerAlwaysFirst; |
436 | 422 | |
437 | | TBarView* barView = static_cast<TBarApp*>(be_app)->BarView(); |
438 | 423 | fBarWindow->Lock(); |
439 | | barView->UpdatePlacement(); |
| 424 | BarView()->UpdatePlacement(); |
440 | 425 | fBarWindow->Unlock(); |
441 | 426 | break; |
442 | | } |
443 | 427 | |
444 | 428 | case kSortRunningApps: |
445 | | { |
446 | 429 | fSettings.sortRunningApps = !fSettings.sortRunningApps; |
447 | 430 | |
448 | | TBarView* barView = static_cast<TBarApp*>(be_app)->BarView(); |
449 | 431 | fBarWindow->Lock(); |
450 | | barView->UpdatePlacement(); |
| 432 | BarView()->UpdatePlacement(); |
451 | 433 | fBarWindow->Unlock(); |
452 | 434 | break; |
453 | | } |
454 | 435 | |
455 | 436 | case kUnsubscribe: |
456 | 437 | { |
… |
… |
TBarApp::MessageReceived(BMessage* message)
|
461 | 442 | } |
462 | 443 | |
463 | 444 | case kSuperExpando: |
464 | | { |
465 | 445 | fSettings.superExpando = !fSettings.superExpando; |
466 | 446 | |
467 | | TBarView* barView = static_cast<TBarApp*>(be_app)->BarView(); |
468 | 447 | fBarWindow->Lock(); |
469 | | barView->UpdatePlacement(); |
| 448 | BarView()->UpdatePlacement(); |
470 | 449 | fBarWindow->Unlock(); |
471 | 450 | break; |
472 | | } |
473 | 451 | |
474 | 452 | case kExpandNewTeams: |
475 | | { |
476 | 453 | fSettings.expandNewTeams = !fSettings.expandNewTeams; |
477 | 454 | |
478 | | TBarView* barView = static_cast<TBarApp*>(be_app)->BarView(); |
479 | 455 | fBarWindow->Lock(); |
480 | | barView->UpdatePlacement(); |
| 456 | BarView()->UpdatePlacement(); |
481 | 457 | fBarWindow->Unlock(); |
482 | 458 | break; |
483 | | } |
484 | 459 | |
485 | 460 | case 'TASK': |
486 | 461 | fSwitcherMessenger.SendMessage(message); |
… |
… |
TBarApp::AddTeam(team_id team, uint32 flags, const char* sig, entry_ref* ref)
|
636 | 611 | BAppFileInfo appMime(&file); |
637 | 612 | |
638 | 613 | BarTeamInfo* barInfo = new BarTeamInfo(new BList(), flags, strdup(sig), |
639 | | new BBitmap(kIconSize, kIconFormat), strdup(ref->name)); |
| 614 | new BBitmap(kIconRect, kIconFormat), strdup(ref->name)); |
640 | 615 | |
641 | 616 | barInfo->teams->AddItem((void*)team); |
642 | 617 | if (appMime.GetIcon(barInfo->icon, B_MINI_ICON) != B_OK) |
… |
… |
TBarApp::RemoveTeam(team_id team)
|
682 | 657 | int32 subsCount = sSubscribers.CountItems(); |
683 | 658 | if (subsCount > 0) { |
684 | 659 | BMessage message((barInfo->teams->CountItems() == 1) ? |
685 | | B_SOME_APP_QUIT : kRemoveTeam); |
| 660 | B_SOME_APP_QUIT : kRemoveTeam); |
686 | 661 | |
687 | 662 | message.AddInt32("team", team); |
688 | 663 | for (int32 i = 0; i < subsCount; i++) { |
… |
… |
TBarApp::ShowPreferencesWindow()
|
706 | 681 | { |
707 | 682 | if (fPreferencesWindow) |
708 | 683 | fPreferencesWindow->Activate(); |
709 | | else { |
| 684 | else { |
710 | 685 | fPreferencesWindow = new PreferencesWindow(BRect(0, 0, 320, 240)); |
711 | 686 | fPreferencesWindow->Show(); |
712 | 687 | } |
-
diff --git a/src/apps/deskbar/BarApp.h b/src/apps/deskbar/BarApp.h
index 6f15838..c3fd47b 100644
a
|
b
|
class TBarApp : public BApplication {
|
141 | 141 | static void Unsubscribe(const BMessenger &subscriber); |
142 | 142 | |
143 | 143 | private: |
144 | | void AddTeam(team_id team, uint32 flags, const char *sig, entry_ref *); |
| 144 | void AddTeam(team_id team, uint32 flags, const char *sig, entry_ref*); |
145 | 145 | void RemoveTeam(team_id); |
146 | 146 | |
147 | 147 | void InitSettings(); |
-
diff --git a/src/apps/deskbar/BarMenuBar.cpp b/src/apps/deskbar/BarMenuBar.cpp
index b246eb3..333e06a 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
TBarMenuBar::SmartResize(float width, float height)
|
78 | 79 | BRect frame = Frame(); |
79 | 80 | width = frame.Width(); |
80 | 81 | height = frame.Height(); |
81 | | } else |
| 82 | } else |
82 | 83 | ResizeTo(width, height); |
83 | 84 | |
84 | 85 | width -= 1; |
… |
… |
TBarMenuBar::SmartResize(float width, float height)
|
96 | 97 | void |
97 | 98 | TBarMenuBar::AddTeamMenu() |
98 | 99 | { |
99 | | if (CountItems() > 1) |
| 100 | if (CountItems() > 1) |
100 | 101 | return; |
101 | 102 | |
102 | 103 | BRect frame(Frame()); |
… |
… |
TBarMenuBar::AddTeamMenu()
|
112 | 113 | void |
113 | 114 | TBarMenuBar::RemoveTeamMenu() |
114 | 115 | { |
115 | | if (CountItems() < 2) |
| 116 | if (CountItems() < 2) |
116 | 117 | return; |
117 | 118 | |
118 | 119 | if (fAppListMenuItem) { |
… |
… |
TBarMenuBar::RemoveTeamMenu()
|
121 | 122 | fAppListMenuItem = NULL; |
122 | 123 | } |
123 | 124 | |
124 | | BRect frame = Frame(); |
| 125 | BRect frame = Frame(); |
125 | 126 | SmartResize(frame.Width(), frame.Height()); |
126 | 127 | } |
127 | 128 | |
… |
… |
init_tracking_hook(BMenuItem* item, bool (*hookFunction)(BMenu*, void*),
|
179 | 180 | return; |
180 | 181 | |
181 | 182 | BMenu* windowMenu = item->Submenu(); |
182 | | if (windowMenu) |
183 | | // have a menu, set the tracking hook |
184 | | windowMenu->SetTrackingHook(hookFunction, state); |
| 183 | if (windowMenu) { |
| 184 | // have a menu, set the tracking hook |
| 185 | windowMenu->SetTrackingHook(hookFunction, state); |
| 186 | } |
185 | 187 | } |
186 | 188 | |
187 | 189 | |
… |
… |
TBarMenuBar::InitTrackingHook(bool (*hookFunction)(BMenu*, void*),
|
192 | 194 | BPoint loc; |
193 | 195 | uint32 buttons; |
194 | 196 | GetMouse(&loc, &buttons); |
195 | | // set the hook functions for the two menus |
196 | | // will always have the be menu |
197 | | // may have the app menu as well (mini mode) |
198 | | if (fBeMenuItem->Frame().Contains(loc) || both) |
| 197 | // set the hook functions for the two menus |
| 198 | // will always have the be menu |
| 199 | // may have the app menu as well (mini mode) |
| 200 | if (fBeMenuItem->Frame().Contains(loc) || both) |
199 | 201 | init_tracking_hook(fBeMenuItem, hookFunction, state); |
200 | 202 | |
201 | | if (fAppListMenuItem && (fAppListMenuItem->Frame().Contains(loc) || both)) |
| 203 | if (fAppListMenuItem && (fAppListMenuItem->Frame().Contains(loc) || both)) |
202 | 204 | init_tracking_hook(fAppListMenuItem, hookFunction, state); |
203 | 205 | } |
204 | 206 | |
-
diff --git a/src/apps/deskbar/BarMenuBar.h b/src/apps/deskbar/BarMenuBar.h
index ef21df1..f748882 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
35 | | // Be Menu, used in vertical mode, expanded and mini |
36 | | // in mini mode will have team menu next to Be menu |
37 | | // Be menu in horizontal mode is embedded in ExpandoMenuBar |
| 36 | // Be Menu, used in vertical mode, expanded and mini |
| 37 | // - in mini mode will have team menu next to Be menu |
| 38 | // - Be menu in horizontal mode is embedded in ExpandoMenuBar |
38 | 39 | |
39 | 40 | #ifndef BARMENUBAR_H |
40 | 41 | #define BARMENUBAR_H |
… |
… |
class TBarMenuBar : public BMenuBar {
|
63 | 64 | |
64 | 65 | void InitTrackingHook(bool (* hookfunction)(BMenu*, void*), void* state, |
65 | 66 | bool both = false); |
66 | | |
| 67 | |
67 | 68 | private: |
68 | 69 | TBarView* fBarView; |
69 | 70 | TBarMenuTitle* fBeMenuItem; |
-
diff --git a/src/apps/deskbar/BarMenuTitle.cpp b/src/apps/deskbar/BarMenuTitle.cpp
index df8b0d2..84c2d91 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
TBarMenuTitle::DrawContent()
|
116 | 117 | |
117 | 118 | if (be_control_look != NULL) { |
118 | 119 | menu->SetDrawingMode(B_OP_ALPHA); |
119 | | |
| 120 | |
120 | 121 | if (fIcon != NULL) { |
121 | 122 | BRect dstRect(fIcon->Bounds()); |
122 | 123 | dstRect.OffsetTo(frame.LeftTop()); |
123 | 124 | dstRect.OffsetBy(rintf(((frame.Width() - dstRect.Width()) / 2) |
124 | 125 | - 1.0f), rintf(((frame.Height() - dstRect.Height()) / 2) |
125 | 126 | - 0.0f)); |
126 | | |
| 127 | |
127 | 128 | menu->DrawBitmapAsync(fIcon, dstRect); |
128 | 129 | } |
129 | 130 | return; |
… |
… |
TBarMenuTitle::Invoke(BMessage* message)
|
200 | 201 | BLooper* looper = barview->Looper(); |
201 | 202 | if (looper->Lock()) { |
202 | 203 | // tell barview to add the refs to the be menu |
203 | | barview->HandleBeMenu(NULL); |
| 204 | barview->HandleBeMenu(NULL); |
204 | 205 | looper->Unlock(); |
205 | 206 | } |
206 | 207 | } |
207 | | |
| 208 | |
208 | 209 | return BMenuItem::Invoke(message); |
209 | 210 | } |
210 | 211 | |
-
diff --git a/src/apps/deskbar/BarMenuTitle.h b/src/apps/deskbar/BarMenuTitle.h
index be7aa99..543cc51 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
class BMenu;
|
46 | 47 | |
47 | 48 | class TBarMenuTitle : public BMenuItem { |
48 | 49 | public: |
49 | | TBarMenuTitle(float width,float height, const BBitmap* icon, |
50 | | BMenu* menu, bool inexpando = false); |
| 50 | TBarMenuTitle(float width, float height, const BBitmap* icon, |
| 51 | BMenu* menu, bool inexpando = false); |
51 | 52 | virtual ~TBarMenuTitle(); |
52 | 53 | |
53 | 54 | void SetWidthHeight(float width, float height); |
54 | 55 | void Draw(); |
55 | 56 | |
56 | 57 | status_t Invoke(BMessage* message); |
57 | | |
| 58 | |
58 | 59 | protected: |
59 | 60 | void DrawContent(); |
60 | 61 | void GetContentSize(float* width, float* height); |
… |
… |
private:
|
63 | 64 | float fWidth; |
64 | 65 | float fHeight; |
65 | 66 | bool fInExpando; |
66 | | const BBitmap* fIcon; |
| 67 | const BBitmap* fIcon; |
67 | 68 | }; |
68 | 69 | |
69 | 70 | #endif /* BARMENUTITLE_H */ |
-
diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp
index 53dfeec..cac3472 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
TBarView::Draw(BRect)
|
135 | 136 | rgb_color light = tint_color(ViewColor(), B_LIGHTEN_2_TINT); |
136 | 137 | |
137 | 138 | SetHighColor(hilite); |
138 | | if (AcrossTop()) |
| 139 | if (AcrossTop()) |
139 | 140 | StrokeLine(bounds.LeftBottom(), bounds.RightBottom()); |
140 | | else if (AcrossBottom()) |
| 141 | else if (AcrossBottom()) |
141 | 142 | StrokeLine(bounds.LeftTop(), bounds.RightTop()); |
142 | 143 | |
143 | 144 | if (Vertical() && Expando()) { |
… |
… |
TBarView::MessageReceived(BMessage* message)
|
166 | 167 | // so that I can follow the common pathway |
167 | 168 | // for adding icons to the tray |
168 | 169 | int32 id; |
169 | | AddItem(new BMessage(*message), B_DESKBAR_TRAY, &id); |
| 170 | AddItem(new BMessage(*message), B_DESKBAR_TRAY, &id); |
170 | 171 | break; |
171 | 172 | } |
172 | 173 | |
… |
… |
TBarView::PlaceBeMenu()
|
206 | 207 | fBarMenuBar = NULL; |
207 | 208 | } |
208 | 209 | |
209 | | // top or bottom expando mode has Be menu built in for tracking |
210 | | // only for vertical mini or expanded |
211 | | // mini mode will have team menu added as part of BarMenuBar |
| 210 | // top or bottom expando mode has Be menu built in for tracking |
| 211 | // only for vertical mini or expanded |
| 212 | // mini mode will have team menu added as part of BarMenuBar |
212 | 213 | if (fVertical && !fBarMenuBar) { |
213 | 214 | // create the Be menu |
214 | 215 | BRect mbarFrame(Bounds()); |
… |
… |
TBarView::PlaceBeMenu()
|
217 | 218 | AddChild(fBarMenuBar); |
218 | 219 | } |
219 | 220 | |
220 | | // if there isn't a bemenu at this point, |
221 | | // DB should be in top/bottom mode, else error |
| 221 | // if there isn't a bemenu at this point, |
| 222 | // DB should be in top/bottom mode, else error |
222 | 223 | if (!fBarMenuBar) |
223 | 224 | return; |
224 | | |
| 225 | |
225 | 226 | float width = sMinimumWindowWidth; |
226 | 227 | BPoint loc(B_ORIGIN); |
227 | 228 | BRect menuFrame(fBarMenuBar->Frame()); |
… |
… |
TBarView::PlaceBeMenu()
|
237 | 238 | else |
238 | 239 | width = floorf(width) / 2; |
239 | 240 | loc = Bounds().LeftTop(); |
240 | | } else |
| 241 | } else { |
241 | 242 | // mini mode, BeMenu next to team menu |
242 | 243 | fBarMenuBar->AddTeamMenu(); |
| 244 | } |
243 | 245 | |
244 | 246 | fBarMenuBar->SmartResize(width, menuFrame.Height()); |
245 | 247 | fBarMenuBar->MoveTo(loc); |
… |
… |
TBarView::PlaceTray(bool, bool, BRect screenFrame)
|
257 | 259 | fDragRegion->MoveTo(statusLoc); |
258 | 260 | |
259 | 261 | if (!fReplicantTray->IsHidden()) |
260 | | fReplicantTray->Hide(); |
| 262 | fReplicantTray->Hide(); |
261 | 263 | |
262 | 264 | return; |
263 | 265 | } |
264 | 266 | |
265 | 267 | if (fReplicantTray->IsHidden()) |
266 | | fReplicantTray->Show(); |
| 268 | fReplicantTray->Show(); |
267 | 269 | |
268 | 270 | if (fTrayLocation != 0) { |
269 | 271 | fReplicantTray->SetMultiRow(fVertical); |
… |
… |
TBarView::GetPreferredWindowSize(BRect screenFrame, float* width, float* height)
|
347 | 349 | } |
348 | 350 | } else { |
349 | 351 | // four corners |
350 | | if (fTrayLocation != 0) |
| 352 | if (fTrayLocation != 0) |
351 | 353 | windowHeight = fDragRegion->Frame().bottom; |
352 | 354 | else |
353 | 355 | windowHeight = fBarMenuBar->Frame().bottom; |
… |
… |
TBarView::SaveSettings()
|
404 | 406 | settings->state = (uint32)State(); |
405 | 407 | settings->width = 0; |
406 | 408 | settings->showTime = ShowingClock(); |
407 | | |
| 409 | |
408 | 410 | fReplicantTray->RememberClockSettings(); |
409 | | settings->alwaysOnTop = (Window()->Feel() & B_FLOATING_ALL_WINDOW_FEEL) |
410 | | != 0; |
| 411 | settings->alwaysOnTop |
| 412 | = (Window()->Feel() & B_FLOATING_ALL_WINDOW_FEEL) != 0; |
411 | 413 | } |
412 | 414 | |
413 | 415 | |
… |
… |
TBarView::UpdateAutoRaise()
|
424 | 426 | void |
425 | 427 | TBarView::UpdatePlacement() |
426 | 428 | { |
427 | | ChangeState(fState, fVertical, fLeft, fTop); |
| 429 | ChangeState(fState, fVertical, fLeft, fTop); |
428 | 430 | } |
429 | 431 | |
430 | 432 | |
… |
… |
TBarView::ChangeState(int32 state, bool vertical, bool left, bool top)
|
455 | 457 | BString* signature = NULL; |
456 | 458 | if (fVertical && Expando() |
457 | 459 | && static_cast<TBarApp*>(be_app)->Settings()->superExpando) { |
458 | | // Get a list of the signatures of expanded apps. Can't use |
| 460 | // Get a list of the signatures of expanded apps. Can't use |
459 | 461 | // team_id because there can be more than one team per application |
460 | 462 | if (fVertical && Expando() && vertical && fExpando) { |
461 | 463 | for (int index = 0; index < fExpando->CountItems(); index++) { |
… |
… |
TBarView::ChangeState(int32 state, bool vertical, bool left, bool top)
|
469 | 471 | } |
470 | 472 | } |
471 | 473 | |
472 | | PlaceApplicationBar(screenFrame); |
473 | | SizeWindow(screenFrame); |
474 | | PositionWindow(screenFrame); |
475 | | Window()->UpdateIfNeeded(); |
| 474 | PlaceApplicationBar(screenFrame); |
| 475 | SizeWindow(screenFrame); |
| 476 | PositionWindow(screenFrame); |
| 477 | Window()->UpdateIfNeeded(); |
476 | 478 | |
477 | 479 | // Re-expand those apps. |
478 | 480 | if (expandedItems.CountItems() > 0) { |
… |
… |
TBarView::ChangeState(int32 state, bool vertical, bool left, bool top)
|
505 | 507 | } |
506 | 508 | |
507 | 509 | |
508 | | // window placement functions |
| 510 | // window placement functions |
509 | 511 | |
510 | 512 | bool |
511 | 513 | TBarView::Vertical() const |
… |
… |
TBarView::State() const
|
558 | 560 | |
559 | 561 | // optional functionality functions |
560 | 562 | |
561 | | bool |
| 563 | bool |
562 | 564 | TBarView::MilTime() const |
563 | 565 | { |
564 | 566 | return fShowInterval; |
… |
… |
void
|
586 | 588 | TBarView::CacheDragData(const BMessage* incoming) |
587 | 589 | { |
588 | 590 | if (!incoming) |
589 | | return; |
| 591 | return; |
590 | 592 | |
591 | 593 | if (Dragging() && SpringLoadedFolderCompareMessages(incoming, fDragMessage)) |
592 | 594 | return; |
… |
… |
init_tracking_hook(BMenuItem* item,
|
614 | 616 | |
615 | 617 | status_t |
616 | 618 | TBarView::DragStart() |
617 | | { |
| 619 | { |
618 | 620 | if (!Dragging()) |
619 | 621 | return B_OK; |
620 | 622 | |
… |
… |
TBarView::DragStart()
|
624 | 626 | |
625 | 627 | if (fExpando && fExpando->Frame().Contains(loc)) { |
626 | 628 | ConvertToScreen(&loc); |
627 | | BPoint expandoLocation = fExpando->ConvertFromScreen(loc); |
| 629 | BPoint expandoLocation = fExpando->ConvertFromScreen(loc); |
628 | 630 | TTeamMenuItem* item = fExpando->TeamItemAtPoint(expandoLocation); |
629 | 631 | |
630 | 632 | if (fLastDragItem) |
… |
… |
TBarView::DragStart()
|
634 | 636 | if (item == fLastDragItem) |
635 | 637 | return B_OK; |
636 | 638 | |
637 | | fLastDragItem = item; |
638 | | } |
| 639 | fLastDragItem = item; |
| 640 | } |
639 | 641 | } |
640 | 642 | |
641 | 643 | return B_OK; |
… |
… |
TBarView::MenuTrackingHook(BMenu* menu, void* castToThis)
|
676 | 678 | |
677 | 679 | if (bemenu && bemenu->LockLooper()) { |
678 | 680 | bemenu->ConvertFromScreen(&location); |
679 | | if (bemenu->Frame().Contains(location)) |
| 681 | if (bemenu->Frame().Contains(location)) |
680 | 682 | endMenu = false; |
681 | 683 | |
682 | 684 | bemenu->UnlockLooper(); |
… |
… |
TBarView::MenuTrackingHook(BMenu* menu, void* castToThis)
|
685 | 687 | if (endMenu && expando) { |
686 | 688 | expando->ConvertFromScreen(&location); |
687 | 689 | BMenuItem* item = expando->TeamItemAtPoint(location); |
688 | | if (item) |
| 690 | if (item) |
689 | 691 | endMenu = false; |
690 | 692 | } |
691 | 693 | barview->UnlockLooper(); |
… |
… |
TBarView::AppCanHandleTypes(const char* signature)
|
757 | 759 | if (appmime.GetAppHint(&hintref) != B_OK) |
758 | 760 | return false; |
759 | 761 | |
760 | | // an app was found, now see if it supports any of |
| 762 | // an app was found, now see if it supports any of |
761 | 763 | // the refs in the message |
762 | 764 | BFile file(&hintref, O_RDONLY); |
763 | 765 | BAppFileInfo fileinfo(&file); |
… |
… |
TBarView::AppCanHandleTypes(const char* signature)
|
768 | 770 | |
769 | 771 | int32 count = fCachedTypesList->CountItems(); |
770 | 772 | for (int32 i = 0 ; i < count ; i++) { |
771 | | if (fileinfo.IsSupportedType(fCachedTypesList->ItemAt(i)->String())) |
| 773 | if (fileinfo.IsSupportedType(fCachedTypesList->ItemAt(i)->String())) |
772 | 774 | return true; |
773 | 775 | } |
774 | 776 | |
… |
… |
TBarView::ItemExists(const char* name, DeskbarShelf)
|
910 | 912 | |
911 | 913 | int32 |
912 | 914 | TBarView::CountItems(DeskbarShelf) |
913 | | { |
914 | | return fReplicantTray->IconCount(); |
915 | | } |
| 915 | { |
| 916 | return fReplicantTray->IconCount(); |
| 917 | } |
916 | 918 | |
917 | 919 | |
918 | 920 | status_t |
-
diff --git a/src/apps/deskbar/BarView.h b/src/apps/deskbar/BarView.h
index a481445..8f4e5b8 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
class TBarView : public BView {
|
98 | 99 | void CacheDragData(const BMessage* incoming); |
99 | 100 | status_t DragStart(); |
100 | 101 | static bool MenuTrackingHook(BMenu* menu, void* castToThis); |
101 | | void DragStop(bool full=false); |
| 102 | void DragStop(bool full = false); |
102 | 103 | TrackingHookData* GetTrackingHookData(); |
103 | 104 | bool Dragging() const; |
104 | 105 | const BMessage* DragMessage() const; |
-
diff --git a/src/apps/deskbar/BarWindow.cpp b/src/apps/deskbar/BarWindow.cpp
index 26b02b7..7702e84 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
All rights reserved.
|
58 | 59 | #include <MessagePrivate.h> |
59 | 60 | |
60 | 61 | |
61 | | // This is a very ugly hack to be able to call the private BMenuBar::StartMenuBar() |
62 | | // method from the TBarWindow::ShowBeMenu() method. |
| 62 | // This is a very ugly hack to be able to call the private |
| 63 | // BMenuBar::StartMenuBar() method from the TBarWindow::ShowBeMenu() method. |
63 | 64 | // Don't do this at home -- but why the hell is this method private? |
64 | 65 | #if __MWERKS__ |
65 | 66 | #define BMenuBar_StartMenuBar_Hack StartMenuBar__8BMenuBarFlbbP5BRect |
… |
… |
All rights reserved.
|
70 | 71 | #else |
71 | 72 | # error "You may want to port this ugly hack to your compiler ABI" |
72 | 73 | #endif |
73 | | extern "C" void BMenuBar_StartMenuBar_Hack(BMenuBar*,int32,bool,bool,BRect*); |
| 74 | extern "C" void |
| 75 | BMenuBar_StartMenuBar_Hack(BMenuBar*, int32, bool, bool, BRect*); |
74 | 76 | |
75 | 77 | |
76 | 78 | TBeMenu* TBarWindow::sBeMenu = NULL; |
… |
… |
TBarWindow::ShowBeMenu()
|
312 | 314 | if (menuBar == NULL) |
313 | 315 | return; |
314 | 316 | |
315 | | BMenuBar_StartMenuBar_Hack(menuBar,0,true,true,NULL); |
| 317 | BMenuBar_StartMenuBar_Hack(menuBar, 0, true, true, NULL); |
316 | 318 | } |
317 | 319 | |
318 | 320 | |
… |
… |
TBarWindow::ShowTeamMenu()
|
326 | 328 | if (KeyMenuBar() == NULL) |
327 | 329 | return; |
328 | 330 | |
329 | | BMenuBar_StartMenuBar_Hack(KeyMenuBar(),index,true,true,NULL); |
| 331 | BMenuBar_StartMenuBar_Hack(KeyMenuBar(), index, true, true, NULL); |
330 | 332 | } |
331 | 333 | |
332 | 334 | |
333 | | /** determines the actual location of the window */ |
| 335 | // determines the actual location of the window |
334 | 336 | |
335 | 337 | deskbar_location |
336 | 338 | TBarWindow::DeskbarLocation() const |
… |
… |
TBarWindow::AddItem(BMessage* message)
|
552 | 554 | if (err < B_OK) |
553 | 555 | delete archive; |
554 | 556 | } else if (message->FindRef("addon", &ref) == B_OK) { |
555 | | // |
556 | 557 | // exposing the name of the view here is not so great |
557 | 558 | TReplicantTray* tray |
558 | 559 | = dynamic_cast<TReplicantTray*>(FindView("Status")); |
… |
… |
TBarWindow::RemoveItem(BMessage* message)
|
579 | 580 | int32 id; |
580 | 581 | const char* name; |
581 | 582 | |
582 | | // ids ought to be unique across all shelves, assuming, of course, |
583 | | // that sometime in the future there may be more than one |
| 583 | // ids ought to be unique across all shelves, assuming, of course, |
| 584 | // that sometime in the future there may be more than one |
584 | 585 | #if SHELF_AWARE |
585 | 586 | if (message->FindInt32("shelf", (int32*)&shelf) == B_OK) { |
586 | 587 | if (message->FindString("name", &name) == B_OK) |
… |
… |
TBarWindow::RemoveItem(BMessage* message)
|
589 | 590 | #endif |
590 | 591 | if (message->FindInt32("id", &id) == B_OK) { |
591 | 592 | fBarView->RemoveItem(id); |
592 | | // remove the following two lines if and when the |
593 | | // shelf option returns |
| 593 | // remove the following two lines if and when the |
| 594 | // shelf option returns |
594 | 595 | } else if (message->FindString("name", &name) == B_OK) |
595 | 596 | fBarView->RemoveItem(name, B_DESKBAR_TRAY); |
596 | 597 | |
… |
… |
TBarWindow::_IsFocusMessage(BMessage* message)
|
632 | 633 | |
633 | 634 | return true; |
634 | 635 | } |
| 636 | |
-
diff --git a/src/apps/deskbar/BarWindow.h b/src/apps/deskbar/BarWindow.h
index ac27410..73568f1 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | #ifndef BAR_WINDOW_H |
-
diff --git a/src/apps/deskbar/BeMenu.cpp b/src/apps/deskbar/BeMenu.cpp
index 7f22518..005fb07 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
TRecentsMenu::~TRecentsMenu()
|
476 | 477 | void |
477 | 478 | TRecentsMenu::DetachedFromWindow() |
478 | 479 | { |
479 | | // |
480 | | // BNavMenu::DetachedFromWindow sets the TypesList to NULL |
481 | | // |
| 480 | // BNavMenu::DetachedFromWindow sets the TypesList to NULL |
482 | 481 | BMenu::DetachedFromWindow(); |
483 | 482 | } |
484 | 483 | |
-
diff --git a/src/apps/deskbar/BeMenu.h b/src/apps/deskbar/BeMenu.h
index 276275d..9612a04 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
All rights reserved.
|
42 | 43 | class TBarView; |
43 | 44 | |
44 | 45 | enum recent_type { |
45 | | kRecentDocuments = 0, |
| 46 | kRecentDocuments = 0, |
46 | 47 | kRecentApplications, |
47 | 48 | kRecentFolders, |
48 | 49 | kRecentAppDocuments |
… |
… |
class TRecentsMenu : public BNavMenu {
|
76 | 77 | |
77 | 78 | int32 fItemIndex; |
78 | 79 | BMessage fRecentList; |
79 | | |
| 80 | |
80 | 81 | TBarView *fBarView; |
81 | 82 | }; |
82 | 83 | |
… |
… |
class TBeMenu : public BNavMenu {
|
102 | 103 | void AttachedToWindow(); |
103 | 104 | void DetachedFromWindow(); |
104 | 105 | |
105 | | void ResetTargets(); |
| 106 | void ResetTargets(); |
106 | 107 | |
107 | 108 | static BMessenger DefaultTarget(); |
108 | 109 | |
… |
… |
class TBeMenu : public BNavMenu {
|
118 | 119 | |
119 | 120 | bool AddStandardBeMenuItems(); |
120 | 121 | |
121 | | private: |
122 | | virtual bool StartBuildingItemList(); |
| 122 | private: |
| 123 | virtual bool StartBuildingItemList(); |
123 | 124 | virtual void DoneBuildingItemList(); |
124 | | virtual bool AddNextItem(); |
125 | | virtual void ClearMenuBuildingState(); |
| 125 | virtual bool AddNextItem(); |
| 126 | virtual void ClearMenuBuildingState(); |
126 | 127 | |
127 | | // to keep track of the menu building state |
128 | | State fAddState; |
129 | | TBarView *fBarView; |
| 128 | // to keep track of the menu building state |
| 129 | State fAddState; |
| 130 | TBarView* fBarView; |
130 | 131 | }; |
131 | 132 | |
132 | 133 | #endif /* _BE_MENU_H_ */ |
-
diff --git a/src/apps/deskbar/CalendarMenuWindow.cpp b/src/apps/deskbar/CalendarMenuWindow.cpp
index 7cdbb61..c7af6d1 100644
a
|
b
|
using BPrivate::B_WEEK_START_SUNDAY;
|
24 | 24 | using BPrivate::B_WEEK_START_MONDAY; |
25 | 25 | |
26 | 26 | |
27 | | // #pragma mark -- FlatButton |
| 27 | // #pragma mark -- FlatButton |
28 | 28 | |
29 | 29 | |
30 | 30 | class FlatButton : public BButton { |
… |
… |
FlatButton::Draw(BRect updateRect)
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | | // #pragma mark -- CalendarMenuWindow |
| 69 | // #pragma mark -- CalendarMenuWindow |
70 | 70 | |
71 | 71 | |
72 | 72 | enum { |
-
diff --git a/src/apps/deskbar/CalendarMenuWindow.h b/src/apps/deskbar/CalendarMenuWindow.h
index 57b627e..1ac0a78 100644
a
|
b
|
class BStringView;
|
17 | 17 | namespace BPrivate { |
18 | 18 | class BCalendarView; |
19 | 19 | } |
20 | | using BPrivate::BCalendarView; |
| 20 | |
| 21 | using BPrivate::BCalendarView; |
21 | 22 | |
22 | 23 | |
23 | 24 | class CalendarMenuWindow : public BWindow { |
… |
… |
public:
|
25 | 26 | CalendarMenuWindow(BPoint where); |
26 | 27 | virtual ~CalendarMenuWindow(); |
27 | 28 | |
28 | | virtual void Show(); |
29 | | virtual void WindowActivated(bool active); |
30 | | virtual void MessageReceived(BMessage* message); |
| 29 | virtual void Show(); |
| 30 | virtual void WindowActivated(bool active); |
| 31 | virtual void MessageReceived(BMessage* message); |
31 | 32 | |
32 | 33 | private: |
33 | 34 | void _UpdateUI(const BDate& date); |
-
diff --git a/src/apps/deskbar/DeskBarUtils.cpp b/src/apps/deskbar/DeskBarUtils.cpp
index 151fd60..791a809 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
AddRefsToBeMenu(const BMessage* m, entry_ref* subdirectory)
|
60 | 61 | int32 count = 0; |
61 | 62 | uint32 type = 0; |
62 | 63 | entry_ref ref; |
63 | | |
| 64 | |
64 | 65 | m->GetInfo("refs", &type, &count); |
65 | 66 | if (count <= 0) |
66 | 67 | return; |
67 | | |
| 68 | |
68 | 69 | BPath path; |
69 | 70 | BSymLink link; |
70 | 71 | BDirectory dir; |
… |
… |
AddRefsToBeMenu(const BMessage* m, entry_ref* subdirectory)
|
72 | 73 | ref = *subdirectory; |
73 | 74 | BEntry entry(&ref); |
74 | 75 | if (entry.Exists()) { |
75 | | // if the ref is a file |
76 | | // get the parent and convert it to a ref |
| 76 | // if the ref is a file get the parent and convert it to a ref |
77 | 77 | if (entry.IsFile()) { |
78 | 78 | BEntry parent; |
79 | 79 | entry.GetParent(&parent); |
… |
… |
AddRefsToBeMenu(const BMessage* m, entry_ref* subdirectory)
|
81 | 81 | } |
82 | 82 | } else |
83 | 83 | return; |
84 | | |
| 84 | |
85 | 85 | dir.SetTo(&ref); |
86 | 86 | } else { |
87 | 87 | if (find_directory(B_USER_DESKBAR_DIRECTORY, &path) == B_OK) |
… |
… |
AddRefsToBeMenu(const BMessage* m, entry_ref* subdirectory)
|
89 | 89 | else |
90 | 90 | return; |
91 | 91 | } |
92 | | |
| 92 | |
93 | 93 | for (long i = 0; i < count; i++) { |
94 | 94 | if (m->FindRef("refs", i, &ref) == B_NO_ERROR) { |
95 | | |
96 | 95 | BEntry entry(&ref); |
97 | 96 | entry.GetPath(&path); |
98 | | |
| 97 | |
99 | 98 | dir.CreateSymLink(ref.name, path.Path(), &link); |
100 | 99 | } |
101 | 100 | } |
-
diff --git a/src/apps/deskbar/DeskBarUtils.h b/src/apps/deskbar/DeskBarUtils.h
index 1f05c83..b35ad56 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
-
diff --git a/src/apps/deskbar/ExpandoMenuBar.cpp b/src/apps/deskbar/ExpandoMenuBar.cpp
index 0fd4483..1622b67 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
TExpandoMenuBar::AttachedToWindow()
|
118 | 119 | R_BeLogoIcon); |
119 | 120 | if (logoBitmap != NULL) |
120 | 121 | fBeMenuWidth = logoBitmap->Bounds().Width() + 16; |
121 | | fBeMenuItem = new TBarMenuTitle(fBeMenuWidth, Frame().Height(), |
122 | | logoBitmap, beMenu, true); |
| 122 | fBeMenuItem = new TBarMenuTitle(fBeMenuWidth, Frame().Height(), |
| 123 | logoBitmap, beMenu, true); |
123 | 124 | AddItem(fBeMenuItem); |
124 | 125 | |
125 | 126 | fSeparatorItem = new TTeamMenuItem(kSepItemWidth, height, fVertical); |
… |
… |
TExpandoMenuBar::RemoveTeam(team_id team, bool partial)
|
584 | 585 | RemoveItem(i); |
585 | 586 | |
586 | 587 | if (fVertical) { |
587 | | // instead of resizing the window here and there in the |
588 | | // code the resize method will be centered in one place |
589 | | // thus, the same behavior (good or bad) will be used |
590 | | // whereever window sizing is done |
| 588 | // instead of resizing the window here and there in the |
| 589 | // code the resize method will be centered in one place |
| 590 | // thus, the same behavior (good or bad) will be used |
| 591 | // whereever window sizing is done |
591 | 592 | fBarView->SizeWindow(BScreen(Window()).Frame()); |
592 | 593 | } else |
593 | 594 | CheckItemSizes(-1); |
… |
… |
TExpandoMenuBar::CheckItemSizes(int32 delta)
|
613 | 614 | |
614 | 615 | if (!fBarView->Vertical()) { |
615 | 616 | // in this case there are 2 extra items: |
616 | | // The Be Menu |
617 | | // The little separator item |
| 617 | // - The Be Menu |
| 618 | // - The little separator item |
618 | 619 | fullWidth = fullWidth - (sMinimumWindowWidth * 2) |
619 | 620 | + (fBeMenuWidth + kSepItemWidth); |
620 | 621 | width -= (fBeMenuWidth + kSepItemWidth); |
… |
… |
TExpandoMenuBar::CheckItemSizes(int32 delta)
|
624 | 625 | if (delta >= 0 && fullWidth > width) { |
625 | 626 | fOverflow = true; |
626 | 627 | reset = true; |
627 | | newWidth = floorf(width/count); |
| 628 | newWidth = floorf(width / count); |
628 | 629 | } else if (delta < 0 && fOverflow) { |
629 | 630 | reset = true; |
630 | 631 | if (fullWidth > width) |
631 | | newWidth = floorf(width/count); |
| 632 | newWidth = floorf(width / count); |
632 | 633 | else |
633 | 634 | newWidth = sMinimumWindowWidth; |
634 | 635 | } |
… |
… |
void
|
713 | 714 | TExpandoMenuBar::CheckForSizeOverrun() |
714 | 715 | { |
715 | 716 | BRect screenFrame = (BScreen(Window())).Frame(); |
716 | | if (fVertical) |
717 | | fIsScrolling = Window()->Frame().bottom > screenFrame.bottom; |
718 | | else |
719 | | fIsScrolling = false; |
| 717 | |
| 718 | fIsScrolling = fVertical ? Window()->Frame().bottom > screenFrame.bottom |
| 719 | : false; |
720 | 720 | } |
721 | 721 | |
722 | 722 | |
… |
… |
TExpandoMenuBar::monitor_team_windows(void* arg)
|
744 | 744 | // Set all WindowMenuItems to require an update. |
745 | 745 | TWindowMenuItem* item = NULL; |
746 | 746 | for (int32 i = 0; i < totalItems; i++) { |
747 | | if (!teamMenu->SubmenuAt(i)){ |
| 747 | if (!teamMenu->SubmenuAt(i)) { |
748 | 748 | item = static_cast<TWindowMenuItem*>(teamMenu->ItemAt(i)); |
749 | 749 | item->SetRequireUpdate(); |
750 | 750 | } |
… |
… |
TExpandoMenuBar::monitor_team_windows(void* arg)
|
814 | 814 | |
815 | 815 | // Remove any remaining items which require an update. |
816 | 816 | for (int32 i = 0; i < totalItems; i++) { |
817 | | if (!teamMenu->SubmenuAt(i)){ |
| 817 | if (!teamMenu->SubmenuAt(i)) { |
818 | 818 | item = static_cast<TWindowMenuItem*>(teamMenu->ItemAt(i)); |
819 | 819 | if (item && item->RequiresUpdate()) { |
820 | 820 | item = static_cast<TWindowMenuItem*> |
-
diff --git a/src/apps/deskbar/ExpandoMenuBar.h b/src/apps/deskbar/ExpandoMenuBar.h
index 928555c..6a96559 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | #ifndef EXPANDO_MENU_BAR_H |
35 | 36 | #define EXPANDO_MENU_BAR_H |
36 | 37 | |
37 | | // application list |
38 | | // top level at window |
39 | | // in expanded mode horizontal and vertical |
| 38 | // application list |
| 39 | // top level at window |
| 40 | // in expanded mode horizontal and vertical |
40 | 41 | |
41 | 42 | |
42 | 43 | #include <MenuBar.h> |
-
diff --git a/src/apps/deskbar/LICENSE b/src/apps/deskbar/LICENSE
index 6992c78..dc84944 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
25 | 25 | used in advertising or otherwise to promote the sale, use or other dealings in |
26 | 26 | this Software without prior written authorization from Be Incorporated. |
27 | 27 | |
28 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
29 | | of Be Incorporated in the United States and other countries. Other brand product |
30 | | names are registered trademarks or trademarks of their respective holders. |
| 28 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 29 | trademarks of Be Incorporated in the United States and other countries. Other |
| 30 | brand product names are registered trademarks or trademarks of their respective |
| 31 | holders. |
31 | 32 | All rights reserved. |
-
diff --git a/src/apps/deskbar/PreferencesWindow.cpp b/src/apps/deskbar/PreferencesWindow.cpp
index aecbba7..bb378f1 100644
a
|
b
|
PreferencesWindow::PreferencesWindow(BRect frame)
|
35 | 35 | // Controls |
36 | 36 | fMenuRecentDocuments = new BCheckBox(B_TRANSLATE("Recent documents:"), |
37 | 37 | new BMessage(kUpdateRecentCounts)); |
38 | | fMenuRecentApplications = new BCheckBox( |
39 | | B_TRANSLATE("Recent applications:"), |
| 38 | fMenuRecentApplications = new BCheckBox(B_TRANSLATE("Recent applications:"), |
40 | 39 | new BMessage(kUpdateRecentCounts)); |
41 | 40 | fMenuRecentFolders = new BCheckBox(B_TRANSLATE("Recent folders:"), |
42 | 41 | new BMessage(kUpdateRecentCounts)); |
… |
… |
PreferencesWindow::PreferencesWindow(BRect frame)
|
52 | 51 | new BMessage(kSortRunningApps)); |
53 | 52 | fAppsSortTrackerFirst = new BCheckBox(B_TRANSLATE("Tracker always first"), |
54 | 53 | new BMessage(kTrackerFirst)); |
55 | | fAppsShowExpanders = new BCheckBox( |
56 | | B_TRANSLATE("Show application expander"), |
| 54 | fAppsShowExpanders = new BCheckBox(B_TRANSLATE("Show application expander"), |
57 | 55 | new BMessage(kSuperExpando)); |
58 | 56 | fAppsExpandNew = new BCheckBox(B_TRANSLATE("Expand new applications"), |
59 | 57 | new BMessage(kExpandNewTeams)); |
… |
… |
PreferencesWindow::PreferencesWindow(BRect frame)
|
83 | 81 | |
84 | 82 | // Values |
85 | 83 | TBarApp* barApp = static_cast<TBarApp*>(be_app); |
86 | | desk_settings* appSettings = barApp->Settings();; |
| 84 | desk_settings* appSettings = barApp->Settings(); |
87 | 85 | |
88 | 86 | fAppsSort->SetValue(appSettings->sortRunningApps); |
89 | 87 | fAppsSortTrackerFirst->SetValue(appSettings->trackerAlwaysFirst); |
-
diff --git a/src/apps/deskbar/PreferencesWindow.h b/src/apps/deskbar/PreferencesWindow.h
index 9bacafd..a45005c 100644
a
|
b
|
public:
|
28 | 28 | PreferencesWindow(BRect frame); |
29 | 29 | ~PreferencesWindow(); |
30 | 30 | |
31 | | virtual void MessageReceived(BMessage* message); |
32 | | virtual void WindowActivated(bool active); |
| 31 | virtual void MessageReceived(BMessage* message); |
| 32 | virtual void WindowActivated(bool active); |
33 | 33 | |
34 | 34 | private: |
35 | 35 | void _UpdateRecentCounts(); |
-
diff --git a/src/apps/deskbar/ResourceSet.cpp b/src/apps/deskbar/ResourceSet.cpp
index 6bbb33b..fc9369c 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
namespace TResourcePrivate {
|
70 | 71 | : fDeleteOK(false) |
71 | 72 | { |
72 | 73 | } |
73 | | |
| 74 | |
74 | 75 | virtual ~TypeObject() |
75 | 76 | { |
76 | 77 | if (!fDeleteOK) |
77 | 78 | debugger("deleting object owned by BResourceSet"); |
78 | 79 | } |
79 | | |
| 80 | |
80 | 81 | void Delete() |
81 | 82 | { |
82 | 83 | fDeleteOK = true; |
83 | 84 | } |
84 | | |
| 85 | |
85 | 86 | private: |
86 | 87 | TypeObject(const TypeObject &); |
87 | 88 | TypeObject &operator=(const TypeObject &); |
88 | 89 | bool operator==(const TypeObject &); |
89 | 90 | bool operator!=(const TypeObject &); |
90 | | |
| 91 | |
91 | 92 | bool fDeleteOK; |
92 | 93 | }; |
93 | | |
| 94 | |
94 | 95 | class BitmapTypeItem : public BBitmap, public TypeObject { |
95 | 96 | public: |
96 | 97 | BitmapTypeItem(BRect bounds, uint32 flags, color_space depth, |
97 | | int32 bytesPerRow=B_ANY_BYTES_PER_ROW, screen_id screenID |
| 98 | int32 bytesPerRow = B_ANY_BYTES_PER_ROW, screen_id screenID |
98 | 99 | = B_MAIN_SCREEN_ID) |
99 | 100 | : BBitmap(bounds, flags, depth, bytesPerRow, screenID) |
100 | 101 | { |
101 | 102 | } |
102 | | |
| 103 | |
103 | 104 | BitmapTypeItem(const BBitmap* source, bool accepts_views = false, |
104 | 105 | bool need_contiguous = false) |
105 | 106 | : BBitmap(source, accepts_views, need_contiguous) |
106 | 107 | { |
107 | 108 | } |
108 | | |
| 109 | |
109 | 110 | BitmapTypeItem(BMessage* data) |
110 | 111 | : BBitmap(data) |
111 | 112 | { |
112 | 113 | } |
113 | | |
| 114 | |
114 | 115 | virtual ~BitmapTypeItem() |
115 | 116 | { |
116 | 117 | } |
117 | 118 | }; |
118 | | |
| 119 | |
119 | 120 | class StringBlockTypeItem : public TStringBlock, public TypeObject { |
120 | 121 | public: |
121 | 122 | StringBlockTypeItem(BDataIO* data) |
122 | 123 | : TStringBlock(data) |
123 | 124 | { |
124 | 125 | } |
125 | | |
| 126 | |
126 | 127 | StringBlockTypeItem(const void* block, size_t size) |
127 | 128 | : TStringBlock(block, size) |
128 | 129 | { |
129 | 130 | } |
130 | | |
| 131 | |
131 | 132 | virtual ~StringBlockTypeItem() |
132 | 133 | { |
133 | 134 | } |
134 | 135 | }; |
135 | | |
| 136 | |
136 | 137 | class TypeItem { |
137 | 138 | public: |
138 | 139 | TypeItem(int32 id, const char* name, const void* data, size_t size) |
139 | | : fID(id), fName(name), |
140 | | fData(const_cast<void*>(data)), fSize(size), fObject(0), |
141 | | fOwnData(false), fSourceIsFile(false) |
| 140 | : fID(id), fName(name), |
| 141 | fData(const_cast<void*>(data)), fSize(size), fObject(0), |
| 142 | fOwnData(false), fSourceIsFile(false) |
142 | 143 | { |
143 | 144 | } |
144 | | |
| 145 | |
145 | 146 | TypeItem(int32 id, const char* name, BFile* file) |
146 | 147 | : fID(id), |
147 | 148 | fName(name), |
… |
… |
namespace TResourcePrivate {
|
162 | 163 | } |
163 | 164 | } |
164 | 165 | } |
165 | | |
| 166 | |
166 | 167 | virtual ~TypeItem() |
167 | 168 | { |
168 | 169 | if (fOwnData) { |
… |
… |
namespace TResourcePrivate {
|
172 | 173 | } |
173 | 174 | SetObject(NULL); |
174 | 175 | } |
175 | | |
| 176 | |
176 | 177 | int32 ID() const |
177 | | { return fID; } |
| 178 | { |
| 179 | return fID; |
| 180 | } |
178 | 181 | |
179 | 182 | const char* Name() const |
180 | | { return fName.String(); } |
| 183 | { |
| 184 | return fName.String(); |
| 185 | } |
181 | 186 | |
182 | 187 | const void* Data() const |
183 | | { return fData; } |
| 188 | { |
| 189 | return fData; |
| 190 | } |
184 | 191 | |
185 | 192 | size_t Size() const |
186 | | { return fSize; } |
187 | | |
| 193 | { |
| 194 | return fSize; |
| 195 | } |
| 196 | |
188 | 197 | void SetObject(TypeObject* object) |
189 | 198 | { |
190 | 199 | if (object == fObject) |
… |
… |
namespace TResourcePrivate {
|
195 | 204 | } |
196 | 205 | |
197 | 206 | TypeObject* Object() const |
198 | | { return fObject; } |
199 | | |
| 207 | { |
| 208 | return fObject; |
| 209 | } |
| 210 | |
200 | 211 | void SetSourceIsFile(bool state) |
201 | | { fSourceIsFile = state; } |
| 212 | { |
| 213 | fSourceIsFile = state; |
| 214 | } |
202 | 215 | |
203 | 216 | bool SourceIsFile() const |
204 | | { return fSourceIsFile; } |
205 | | |
| 217 | { |
| 218 | return fSourceIsFile; |
| 219 | } |
| 220 | |
206 | 221 | private: |
207 | 222 | int32 fID; |
208 | 223 | BString fName; |
… |
… |
namespace TResourcePrivate {
|
212 | 227 | bool fOwnData; |
213 | 228 | bool fSourceIsFile; |
214 | 229 | }; |
215 | | |
| 230 | |
216 | 231 | static bool FreeTypeItemFunc(void* item) |
217 | 232 | { |
218 | 233 | delete reinterpret_cast<TypeItem*>(item); |
… |
… |
namespace TResourcePrivate {
|
225 | 240 | : fType(type) |
226 | 241 | { |
227 | 242 | } |
228 | | |
| 243 | |
229 | 244 | virtual ~TypeList() |
230 | 245 | { |
231 | 246 | fItems.DoForEach(FreeTypeItemFunc); |
232 | 247 | fItems.MakeEmpty(); |
233 | 248 | } |
234 | | |
| 249 | |
235 | 250 | type_code Type() const |
236 | | { return fType; } |
237 | | |
| 251 | { |
| 252 | return fType; |
| 253 | } |
| 254 | |
238 | 255 | TypeItem* FindItemByID(int32 id) |
239 | 256 | { |
240 | 257 | for (int32 i = 0; i < fItems.CountItems(); i++ ) { |
… |
… |
namespace TResourcePrivate {
|
254 | 271 | } |
255 | 272 | return NULL; |
256 | 273 | } |
257 | | |
| 274 | |
258 | 275 | void AddItem(TypeItem* item) |
259 | 276 | { |
260 | 277 | fItems.AddItem(item); |
261 | 278 | } |
262 | | |
| 279 | |
263 | 280 | private: |
264 | 281 | type_code fType; |
265 | 282 | BList fItems; |
266 | 283 | }; |
267 | | |
268 | 284 | } |
269 | 285 | |
270 | | using namespace TResourcePrivate; |
| 286 | using namespace TResourcePrivate; |
271 | 287 | |
272 | 288 | // #pragma mark - |
273 | 289 | // ----------------------------- TStringBlock ----------------------------- |
… |
… |
TStringBlock::TStringBlock(BDataIO* data)
|
282 | 298 | fStrings = (char*)malloc(1024); |
283 | 299 | size_t pos = 0; |
284 | 300 | ssize_t amount; |
285 | | while ((amount=data->Read(fStrings + pos, 1024)) == 1024) { |
| 301 | while ((amount = data->Read(fStrings + pos, 1024)) == 1024) { |
286 | 302 | pos += amount; |
287 | 303 | fStrings = (char*)realloc(fStrings, pos + 1024); |
288 | 304 | } |
289 | 305 | if (amount > 0) |
290 | 306 | pos += amount; |
291 | | |
| 307 | |
292 | 308 | fNumEntries = PreIndex(fStrings, amount); |
293 | 309 | fIndex = (size_t*)malloc(sizeof(size_t) * fNumEntries); |
294 | 310 | MakeIndex(fStrings, amount, fNumEntries, fIndex); |
… |
… |
TStringBlock::TStringBlock(const void* block, size_t size)
|
304 | 320 | { |
305 | 321 | fIndex = (size_t*)const_cast<void*>(block); |
306 | 322 | fStrings = (char*)const_cast<void*>(block); |
307 | | |
| 323 | |
308 | 324 | // Figure out how many entries there are. |
309 | 325 | size_t last_off = 0; |
310 | 326 | while (fIndex[fNumEntries] > last_off && fIndex[fNumEntries] < size ) { |
… |
… |
size_t
|
339 | 355 | TStringBlock::PreIndex(char* strings, ssize_t len) |
340 | 356 | { |
341 | 357 | size_t count = 0; |
342 | | |
343 | 358 | char* orig = strings; |
344 | 359 | char* end = strings + len; |
345 | 360 | bool in_cr = false; |
346 | 361 | bool first = true; |
347 | 362 | bool skipping = false; |
| 363 | |
348 | 364 | while (orig < end) { |
349 | 365 | if (*orig == '\n' || *orig == '\r' || *orig == 0) { |
350 | 366 | if (!in_cr && *orig == '\r') |
… |
… |
TStringBlock::PreIndex(char* strings, ssize_t len)
|
371 | 387 | case '\\': |
372 | 388 | *strings = '\\'; |
373 | 389 | break; |
374 | | |
| 390 | |
375 | 391 | case '\n': |
376 | 392 | *strings = '\n'; |
377 | 393 | break; |
378 | | |
| 394 | |
379 | 395 | case '\r': |
380 | 396 | *strings = '\r'; |
381 | 397 | break; |
382 | | |
| 398 | |
383 | 399 | case '\t': |
384 | 400 | *strings = '\t'; |
385 | 401 | break; |
386 | | |
| 402 | |
387 | 403 | default: |
388 | 404 | *strings = *orig; |
389 | 405 | break; |
390 | 406 | } |
391 | | } else |
| 407 | } else |
392 | 408 | *strings = *orig; |
393 | 409 | |
394 | 410 | orig++; |
395 | 411 | strings++; |
396 | 412 | } |
397 | | |
398 | 413 | return count; |
399 | 414 | } |
400 | 415 | |
… |
… |
TStringBlock::MakeIndex(const char* strings, ssize_t len,
|
405 | 420 | { |
406 | 421 | *resultingIndex++ = 0; |
407 | 422 | indexLength--; |
408 | | |
| 423 | |
409 | 424 | ssize_t pos = 0; |
410 | 425 | while (pos < len && indexLength > 0) { |
411 | 426 | if (strings[pos] == 0 ) { |
… |
… |
TResourceSet::AddResources(BResources* RESOURCES_ONLY(resources))
|
475 | 490 | #if USE_RESOURCES |
476 | 491 | if (!resources) |
477 | 492 | return B_BAD_VALUE; |
478 | | |
| 493 | |
479 | 494 | BAutolock lock(&fLock); |
480 | 495 | status_t err = fResources.AddItem(resources) ? B_OK : B_ERROR; |
481 | 496 | if (err != B_OK) |
… |
… |
TResourceSet::AddDirectory(const char* fullPath)
|
499 | 514 | delete path; |
500 | 515 | return err; |
501 | 516 | } |
502 | | |
| 517 | |
503 | 518 | BAutolock lock(&fLock); |
504 | 519 | err = fDirectories.AddItem(path) ? B_OK : B_ERROR; |
505 | 520 | if (err != B_OK) |
… |
… |
TResourceSet::AddEnvDirectory(const char* in, const char* defaultValue)
|
514 | 529 | { |
515 | 530 | BString buf; |
516 | 531 | status_t err = ExpandString(&buf, in); |
517 | | |
| 532 | |
518 | 533 | if (err != B_OK) { |
519 | 534 | if (defaultValue) |
520 | 535 | return AddDirectory(defaultValue); |
521 | 536 | return err; |
522 | 537 | } |
523 | | |
| 538 | |
524 | 539 | return AddDirectory(buf.String()); |
525 | 540 | } |
526 | 541 | |
… |
… |
status_t
|
529 | 544 | TResourceSet::ExpandString(BString* out, const char* in) |
530 | 545 | { |
531 | 546 | const char* start = in; |
| 547 | |
532 | 548 | while (*in) { |
533 | 549 | if (*in == '$') { |
534 | 550 | if (start < in) |
535 | | out->Append(start, (int32)(in - start)); |
536 | | |
| 551 | out->Append(start, (int32)(in - start)); |
| 552 | |
537 | 553 | in++; |
538 | 554 | char variableName[1024]; |
539 | 555 | size_t i = 0; |
… |
… |
TResourceSet::ExpandString(BString* out, const char* in)
|
545 | 561 | if (*in) |
546 | 562 | in++; |
547 | 563 | |
548 | | } else |
549 | | while ((isalnum(*in) || *in == '_') && i |
550 | | < sizeof(variableName) - 1) |
| 564 | } else { |
| 565 | while ((isalnum(*in) || *in == '_') |
| 566 | && i < sizeof(variableName) - 1) |
551 | 567 | variableName[i++] = *in++; |
552 | | |
| 568 | } |
| 569 | |
553 | 570 | start = in; |
554 | | |
555 | 571 | variableName[i] = '\0'; |
556 | | |
| 572 | |
557 | 573 | const char* val = getenv(variableName); |
558 | 574 | if (!val) { |
559 | 575 | PRINT(("Error: env var %s not found.\n", &variableName[0])); |
560 | 576 | return B_NAME_NOT_FOUND; |
561 | 577 | } |
562 | | |
| 578 | |
563 | 579 | status_t err = ExpandString(out, val); |
564 | 580 | if (err != B_OK) |
565 | 581 | return err; |
566 | | |
| 582 | |
567 | 583 | } else if (*in == '\\') { |
568 | 584 | if (start < in) |
569 | 585 | out->Append(start, (int32)(in - start)); |
… |
… |
TResourceSet::ExpandString(BString* out, const char* in)
|
576 | 592 | |
577 | 593 | if (start < in) |
578 | 594 | out->Append(start, (int32)(in - start)); |
579 | | |
| 595 | |
580 | 596 | return B_OK; |
581 | 597 | } |
582 | 598 | |
… |
… |
const void*
|
585 | 601 | TResourceSet::FindResource(type_code type, int32 id, size_t* outSize) |
586 | 602 | { |
587 | 603 | TypeItem* item = FindItemID(type, id); |
588 | | |
| 604 | |
589 | 605 | if (outSize) |
590 | 606 | *outSize = item ? item->Size() : 0; |
591 | 607 | |
… |
… |
const void*
|
597 | 613 | TResourceSet::FindResource(type_code type, const char* name, size_t* outSize) |
598 | 614 | { |
599 | 615 | TypeItem* item = FindItemName(type, name); |
600 | | |
| 616 | |
601 | 617 | if (outSize) |
602 | 618 | *outSize = item ? item->Size() : 0; |
603 | 619 | |
… |
… |
TResourceSet::FindStringBlock(type_code type, const char* name)
|
632 | 648 | return ReturnStringBlockItem(FindItemName(type, name)); |
633 | 649 | } |
634 | 650 | |
635 | | |
| 651 | |
636 | 652 | const char* |
637 | 653 | TResourceSet::FindString(type_code type, int32 id, uint32 index) |
638 | 654 | { |
639 | 655 | const TStringBlock* stringBlock = FindStringBlock(type, id); |
| 656 | |
640 | 657 | if (!stringBlock) |
641 | 658 | return NULL; |
642 | 659 | |
… |
… |
const char*
|
648 | 665 | TResourceSet::FindString(type_code type, const char* name, uint32 index) |
649 | 666 | { |
650 | 667 | const TStringBlock* stringBlock = FindStringBlock(type, name); |
| 668 | |
651 | 669 | if (!stringBlock) |
652 | 670 | return NULL; |
653 | 671 | |
654 | 672 | return stringBlock->String(index); |
655 | 673 | } |
656 | 674 | |
657 | | |
| 675 | |
658 | 676 | TypeList* |
659 | 677 | TResourceSet::FindTypeList(type_code type) |
660 | 678 | { |
661 | 679 | BAutolock lock(&fLock); |
662 | | |
| 680 | |
663 | 681 | int32 count = fTypes.CountItems(); |
664 | 682 | for (int32 i = 0; i < count; i++ ) { |
665 | 683 | TypeList* list = (TypeList*)fTypes.ItemAt(i); |
666 | 684 | if (list && list->Type() == type) |
667 | 685 | return list; |
668 | 686 | } |
669 | | |
| 687 | |
670 | 688 | return NULL; |
671 | 689 | } |
672 | 690 | |
… |
… |
TResourceSet::FindItemID(type_code type, int32 id)
|
676 | 694 | { |
677 | 695 | TypeList* list = FindTypeList(type); |
678 | 696 | TypeItem* item = NULL; |
679 | | |
680 | | if (list) item = list->FindItemByID(id); |
681 | | |
| 697 | |
| 698 | if (list) |
| 699 | item = list->FindItemByID(id); |
| 700 | |
682 | 701 | if (!item) |
683 | 702 | item = LoadResource(type, id, 0, &list); |
684 | | |
| 703 | |
685 | 704 | return item; |
686 | 705 | } |
687 | 706 | |
… |
… |
TResourceSet::FindItemName(type_code type, const char* name)
|
691 | 710 | { |
692 | 711 | TypeList* list = FindTypeList(type); |
693 | 712 | TypeItem* item = NULL; |
694 | | |
| 713 | |
695 | 714 | if (list) |
696 | 715 | item = list->FindItemByName(name); |
697 | | |
| 716 | |
698 | 717 | if (!item) |
699 | 718 | item = LoadResource(type, -1, name, &list); |
700 | | |
| 719 | |
701 | 720 | return item; |
702 | 721 | } |
703 | 722 | |
… |
… |
TResourceSet::LoadResource(type_code type, int32 id, const char* name,
|
707 | 726 | TypeList** inOutList) |
708 | 727 | { |
709 | 728 | TypeItem* item = NULL; |
710 | | |
| 729 | |
711 | 730 | if (name) { |
712 | 731 | BEntry entry; |
713 | | |
| 732 | |
714 | 733 | // If a named resource, first look in directories. |
715 | 734 | fLock.Lock(); |
716 | 735 | int32 count = fDirectories.CountItems(); |
… |
… |
TResourceSet::LoadResource(type_code type, int32 id, const char* name,
|
731 | 750 | } |
732 | 751 | fLock.Unlock(); |
733 | 752 | } |
734 | | |
| 753 | |
735 | 754 | #if USE_RESOURCES |
736 | 755 | if (!item) { |
737 | 756 | // Look through resource objects for data. |
… |
… |
TResourceSet::LoadResource(type_code type, int32 id, const char* name,
|
746 | 765 | data = resource->LoadResource(type, id, &size); |
747 | 766 | else if (name != NULL) |
748 | 767 | data = resource->LoadResource(type, name, &size); |
749 | | |
| 768 | |
750 | 769 | if (data && size) { |
751 | 770 | item = new TypeItem(id, name, data, size); |
752 | 771 | item->SetSourceIsFile(false); |
… |
… |
TResourceSet::ReturnBitmapItem(type_code, TypeItem* from)
|
787 | 806 | { |
788 | 807 | if (!from) |
789 | 808 | return NULL; |
790 | | |
| 809 | |
791 | 810 | TypeObject* obj = from->Object(); |
792 | 811 | BitmapTypeItem* bitmap = dynamic_cast<BitmapTypeItem*>(obj); |
793 | 812 | if (bitmap) |
… |
… |
TResourceSet::ReturnBitmapItem(type_code, TypeItem* from)
|
803 | 822 | // Try to read as an archived bitmap. |
804 | 823 | stream.Seek(0, SEEK_SET); |
805 | 824 | BMessage archive; |
806 | | if (archive.Unflatten(&stream) == B_OK ) { |
| 825 | if (archive.Unflatten(&stream) == B_OK) { |
807 | 826 | bitmap = new BitmapTypeItem(&archive); |
808 | 827 | if (bitmap && bitmap->InitCheck() != B_OK) { |
809 | | bitmap->Delete(); // allows us to delete this bitmap... |
| 828 | bitmap->Delete(); |
| 829 | // allows us to delete this bitmap... |
810 | 830 | delete bitmap; |
811 | 831 | bitmap = NULL; |
812 | 832 | } |
… |
… |
TResourceSet::ReturnBitmapItem(type_code, TypeItem* from)
|
815 | 835 | if (bitmap) { |
816 | 836 | BAutolock lock(&fLock); |
817 | 837 | if (from->Object() != NULL) { |
818 | | // Whoops! Someone snuck in under us. |
| 838 | // Whoops! Someone snuck in under us. |
819 | 839 | bitmap->Delete(); |
820 | 840 | delete bitmap; |
821 | 841 | bitmap = dynamic_cast<BitmapTypeItem*>(from->Object()); |
822 | | } else |
| 842 | } else |
823 | 843 | from->SetObject(bitmap); |
824 | 844 | } |
825 | 845 | |
… |
… |
TResourceSet::ReturnStringBlockItem(TypeItem* from)
|
832 | 852 | { |
833 | 853 | if (!from) |
834 | 854 | return NULL; |
835 | | |
| 855 | |
836 | 856 | TypeObject* obj = from->Object(); |
837 | 857 | StringBlockTypeItem* stringBlock = dynamic_cast<StringBlockTypeItem*>(obj); |
838 | 858 | if (stringBlock) |
839 | 859 | return stringBlock; |
840 | | |
| 860 | |
841 | 861 | // Can't change an existing object. |
842 | 862 | if (obj) |
843 | 863 | return NULL; |
844 | | |
| 864 | |
845 | 865 | // Don't have a string block in the item -- we'll create one. |
846 | 866 | if (from->SourceIsFile() ) { |
847 | 867 | BMemoryIO stream(from->Data(), from->Size()); |
848 | 868 | stringBlock = new StringBlockTypeItem(&stream); |
849 | 869 | } else |
850 | 870 | stringBlock = new StringBlockTypeItem(from->Data(), from->Size()); |
851 | | |
| 871 | |
852 | 872 | if (stringBlock) { |
853 | 873 | BAutolock lock(&fLock); |
854 | 874 | if (from->Object() != NULL) { |
855 | | // Whoops! Someone snuck in under us. |
| 875 | // Whoops! Someone snuck in under us. |
856 | 876 | delete stringBlock; |
857 | 877 | stringBlock = dynamic_cast<StringBlockTypeItem*>(from->Object()); |
858 | 878 | } else |
859 | 879 | from->SetObject(stringBlock); |
860 | 880 | } |
861 | | |
| 881 | |
862 | 882 | return stringBlock; |
863 | 883 | } |
864 | 884 | |
… |
… |
TResourceSet::ReturnStringBlockItem(TypeItem* from)
|
867 | 887 | |
868 | 888 | |
869 | 889 | namespace TResourcePrivate { |
870 | | |
871 | 890 | TResourceSet* gResources = NULL; |
872 | 891 | BLocker gResourceLocker; |
873 | | |
874 | 892 | } |
875 | 893 | |
876 | 894 | |
… |
… |
AppResSet()
|
880 | 898 | // If already have it, return immediately. |
881 | 899 | if (gResources) |
882 | 900 | return gResources; |
883 | | |
| 901 | |
884 | 902 | // Don't have 'em, lock access to make 'em. |
885 | 903 | if (!gResourceLocker.Lock()) |
886 | 904 | return NULL; |
… |
… |
AppResSet()
|
889 | 907 | gResourceLocker.Unlock(); |
890 | 908 | return gResources; |
891 | 909 | } |
892 | | |
| 910 | |
893 | 911 | // Make 'em. |
894 | 912 | gResources = new TResourceSet; |
895 | 913 | gResources->AddResources(BApplication::AppResources()); |
-
diff --git a/src/apps/deskbar/ResourceSet.h b/src/apps/deskbar/ResourceSet.h
index 5975304..7012c1d 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | #ifndef _T_RESOURCE_SET_H |
… |
… |
namespace TResourcePrivate {
|
48 | 49 | class TypeList; |
49 | 50 | } |
50 | 51 | |
51 | | using namespace TResourcePrivate; |
| 52 | using namespace TResourcePrivate; |
52 | 53 | |
53 | 54 | const uint32 B_STRING_BLOCK_TYPE = 'SBLK'; |
54 | 55 | |
… |
… |
public:
|
57 | 58 | TStringBlock(BDataIO* data); |
58 | 59 | TStringBlock(const void* block, size_t size); |
59 | 60 | virtual ~TStringBlock(); |
60 | | |
| 61 | |
61 | 62 | const char* String(size_t index) const; |
62 | 63 | |
63 | 64 | private: |
64 | 65 | size_t PreIndex(char* strings, ssize_t len); |
65 | | void MakeIndex(const char* strings, ssize_t len, |
66 | | size_t indexLen, size_t* outIndex); |
67 | | |
| 66 | void MakeIndex(const char* strings, ssize_t len, size_t indexLen, |
| 67 | size_t* outIndex); |
| 68 | |
68 | 69 | size_t fNumEntries; |
69 | 70 | size_t* fIndex; |
70 | 71 | char* fStrings; |
… |
… |
public:
|
80 | 81 | status_t AddDirectory(const char* fullPath); |
81 | 82 | status_t AddEnvDirectory(const char* envPath, |
82 | 83 | const char* defaultValue = NULL); |
83 | | |
84 | | const void* FindResource(type_code type, int32 id, |
85 | | size_t* outSize); |
86 | | const void* FindResource(type_code type, const char* name, |
87 | | size_t* outSize); |
88 | | |
| 84 | |
| 85 | const void* FindResource(type_code type, int32 id, size_t* outSize); |
| 86 | const void* FindResource(type_code type, const char* name, size_t* outSize); |
| 87 | |
89 | 88 | const BBitmap* FindBitmap(type_code type, int32 id); |
90 | 89 | const BBitmap* FindBitmap(type_code type, const char* name); |
91 | | |
| 90 | |
92 | 91 | const TStringBlock* FindStringBlock(type_code type, int32 id); |
93 | 92 | const TStringBlock* FindStringBlock(type_code type, const char* name); |
94 | | |
| 93 | |
95 | 94 | const char* FindString(type_code type, int32 id, uint32 index); |
96 | 95 | const char* FindString(type_code type, const char* name, uint32 index); |
97 | | |
| 96 | |
98 | 97 | private: |
99 | 98 | status_t ExpandString(BString* out, const char* in); |
100 | 99 | TypeList* FindTypeList(type_code type); |
101 | | |
| 100 | |
102 | 101 | TypeItem* FindItemID(type_code type, int32 id); |
103 | 102 | TypeItem* FindItemName(type_code type, const char* name); |
104 | | |
| 103 | |
105 | 104 | TypeItem* LoadResource(type_code type, int32 id, const char* name, |
106 | 105 | TypeList** inoutList = NULL); |
107 | | |
| 106 | |
108 | 107 | BBitmap* ReturnBitmapItem(type_code type, TypeItem* from); |
109 | 108 | TStringBlock* ReturnStringBlockItem(TypeItem* from); |
110 | | |
| 109 | |
111 | 110 | BLocker fLock; // access control. |
112 | 111 | BList fResources; // containing BResources objects. |
113 | 112 | BList fDirectories; // containing BPath objects. |
-
diff --git a/src/apps/deskbar/ShowHideMenuItem.cpp b/src/apps/deskbar/ShowHideMenuItem.cpp
index a614fc8..b793426 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
-
diff --git a/src/apps/deskbar/ShowHideMenuItem.h b/src/apps/deskbar/ShowHideMenuItem.h
index cd52f09..159dde1 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
All rights reserved.
|
43 | 44 | |
44 | 45 | class TShowHideMenuItem : public BMenuItem { |
45 | 46 | public: |
46 | | TShowHideMenuItem(const char* title, |
| 47 | TShowHideMenuItem(const char* title, |
47 | 48 | const BList* teams, |
48 | 49 | uint32 action); |
49 | 50 | |
50 | | static status_t TeamShowHideCommon(int32 action, |
51 | | const BList* teamList, |
52 | | BRect zoomRect = BRect(0, 0, 0, 0), |
| 51 | static status_t TeamShowHideCommon(int32 action, |
| 52 | const BList* teamList, |
| 53 | BRect zoomRect = BRect(0, 0, 0, 0), |
53 | 54 | bool doZoom = false); |
54 | 55 | protected: |
55 | 56 | virtual void GetContentSize(float* width, float* height); |
56 | 57 | virtual void DrawContent(); |
57 | 58 | virtual status_t Invoke(BMessage* message = NULL); |
58 | 59 | |
59 | | private: |
| 60 | private: |
60 | 61 | const BList* fTeams; |
61 | 62 | uint32 fAction; |
62 | 63 | float fTitleWidth; |
-
diff --git a/src/apps/deskbar/StatusView.cpp b/src/apps/deskbar/StatusView.cpp
index a504101..14627f2 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
All rights reserved.
|
74 | 75 | using std::max; |
75 | 76 | |
76 | 77 | #ifdef DB_ADDONS |
77 | | // Add-on support |
| 78 | // Add-on support |
78 | 79 | // |
79 | | // Item - internal item list (node, eref, etc) |
80 | | // Icon - physical replicant handed to the DeskbarClass class |
81 | | // AddOn - attribute based add-on |
| 80 | // Item - internal item list (node, eref, etc) |
| 81 | // Icon - physical replicant handed to the DeskbarClass class |
| 82 | // AddOn - attribute based add-on |
82 | 83 | |
83 | 84 | const char* const kInstantiateItemCFunctionName = "instantiate_deskbar_item"; |
84 | 85 | const char* const kInstantiateEntryCFunctionName = "instantiate_deskbar_entry"; |
85 | 86 | const char* const kDeskbarSecurityCodeFile = "Deskbar_security_code"; |
86 | 87 | const char* const kDeskbarSecurityCodeAttr = "be:deskbar_security_code"; |
87 | 88 | const char* const kStatusPredicate = "be:deskbar_item_status"; |
88 | | const char* const kEnabledPredicate = "be:deskbar_item_status=enabled"; |
89 | | const char* const kDisabledPredicate = "be:deskbar_item_status=disabled"; |
| 89 | const char* const kEnabledPredicate = "be:deskbar_item_status = enabled"; |
| 90 | const char* const kDisabledPredicate = "be:deskbar_item_status = disabled"; |
90 | 91 | |
91 | 92 | float sMinimumWindowWidth = kGutter + kMinimumTrayWidth + kDragRegionWidth; |
92 | 93 | |
… |
… |
TReplicantTray::DealWithClock(bool showClock)
|
240 | 241 | } |
241 | 242 | |
242 | 243 | |
243 | | /*! |
244 | | Width is set to a minimum of kMinimumReplicantCount by kMaxReplicantWidth |
| 244 | /*! Width is set to a minimum of kMinimumReplicantCount by kMaxReplicantWidth |
245 | 245 | if not in multirowmode and greater than kMinimumReplicantCount |
246 | 246 | the width should be calculated based on the actual |
247 | 247 | replicant widths |
… |
… |
TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight)
|
255 | 255 | if (fShelf->CountReplicants() > 0) |
256 | 256 | height = fRightBottomReplicant.bottom; |
257 | 257 | |
258 | | // the height will be uniform for the number of rows |
259 | | // necessary to show all the reps + any gutters |
260 | | // necessary for spacing |
| 258 | // the height will be uniform for the number of rows necessary to show |
| 259 | // all the reps + any gutters necessary for spacing |
261 | 260 | int32 rowCount = (int32)(height / kMaxReplicantHeight); |
262 | 261 | height = kGutter + (rowCount * kMaxReplicantHeight) |
263 | 262 | + ((rowCount - 1) * kIconGap) + kGutter; |
264 | 263 | height = max(kMinimumTrayHeight, height); |
265 | 264 | width = fMinimumTrayWidth; |
266 | 265 | } else { |
267 | | // if last replicant overruns clock then |
268 | | // resize to accomodate |
| 266 | // if last replicant overruns clock then resize to accomodate |
269 | 267 | if (fShelf->CountReplicants() > 0) { |
270 | 268 | if (fBarView->ShowingClock() |
271 | 269 | && fRightBottomReplicant.right + 6 >= fClock->Frame().left) { |
… |
… |
TReplicantTray::GetPreferredSize(float* preferredWidth, float* preferredHeight)
|
274 | 272 | } else |
275 | 273 | width = fRightBottomReplicant.right + 3; |
276 | 274 | } |
| 275 | |
277 | 276 | // this view has a fixed minimum width |
278 | 277 | width = max(fMinimumTrayWidth, width); |
279 | 278 | } |
280 | 279 | |
281 | 280 | *preferredWidth = width; |
282 | | // add 2 for the border |
| 281 | // add 1 for the border |
283 | 282 | *preferredHeight = height + 1; |
284 | 283 | } |
285 | 284 | |
… |
… |
TReplicantTray::ShowReplicantMenu(BPoint point)
|
350 | 349 | BPopUpMenu* menu = new BPopUpMenu("", false, false); |
351 | 350 | menu->SetFont(be_plain_font); |
352 | 351 | |
353 | | // If the clock is visible, show the extended menu |
354 | | // otheriwse, show "Show Time". |
| 352 | // If clock is visible show the extended menu, otherwise show "Show Time" |
355 | 353 | |
356 | 354 | if (fBarView->ShowingClock()) |
357 | 355 | fClock->ShowClockOptions(ConvertToScreen(point)); |
… |
… |
TReplicantTray::MouseDown(BPoint where)
|
375 | 373 | DumpList(fItemList); |
376 | 374 | #endif |
377 | 375 | |
378 | | uint32 buttons; |
| 376 | uint32 buttons; |
379 | 377 | |
380 | 378 | Window()->CurrentMessage()->FindInt32("buttons", (int32*)&buttons); |
381 | 379 | if (buttons == B_SECONDARY_MOUSE_BUTTON) { |
… |
… |
TReplicantTray::InitAddOnSupport()
|
412 | 410 | { |
413 | 411 | // list to maintain refs to each rep added/deleted |
414 | 412 | fItemList = new BList(); |
415 | | |
416 | 413 | bool haveKey = false; |
417 | | BPath path; |
| 414 | BPath path; |
| 415 | |
418 | 416 | if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, true) == B_OK) { |
419 | 417 | path.Append(kDeskbarSecurityCodeFile); |
420 | 418 | |
421 | | BFile file(path.Path(),B_READ_ONLY); |
| 419 | BFile file(path.Path(), B_READ_ONLY); |
422 | 420 | if (file.InitCheck() == B_OK |
423 | | && file.Read(&fDeskbarSecurityCode, sizeof(fDeskbarSecurityCode)) |
| 421 | && file.Read(&fDeskbarSecurityCode, sizeof(fDeskbarSecurityCode)) |
424 | 422 | == sizeof(fDeskbarSecurityCode)) |
425 | 423 | haveKey = true; |
426 | 424 | } |
… |
… |
TReplicantTray::InitAddOnSupport()
|
443 | 441 | } |
444 | 442 | } |
445 | 443 | |
446 | | // for each volume currently mounted |
447 | | // index the volume with our indices |
| 444 | // for each volume currently mounted index the volume with our indices |
448 | 445 | BVolumeRoster roster; |
449 | 446 | BVolume volume; |
450 | 447 | while (roster.GetNextVolume(&volume) == B_OK) { |
… |
… |
TReplicantTray::RunAddOnQuery(BVolume* volume, const char* predicate)
|
488 | 485 | || fs_stat_index(volume->Device(), kStatusPredicate, &info) != 0) |
489 | 486 | return; |
490 | 487 | |
491 | | // run a new query on a specific volume |
492 | | // make it live |
| 488 | // run a new query on a specific volume and make it live |
493 | 489 | BQuery query; |
494 | 490 | query.SetVolume(volume); |
495 | 491 | query.SetPredicate(predicate); |
… |
… |
TReplicantTray::NodeExists(node_ref& nodeRef)
|
557 | 553 | } |
558 | 554 | |
559 | 555 | |
560 | | /*! This handles B_NODE_MONITOR & B_QUERY_UPDATE messages received |
| 556 | /*! This handles B_NODE_MONITOR & B_QUERY_UPDATE messages received |
561 | 557 | for the registered add-ons. |
562 | 558 | */ |
563 | 559 | void |
… |
… |
TReplicantTray::HandleEntryUpdate(BMessage* message)
|
697 | 693 | } |
698 | 694 | |
699 | 695 | |
700 | | /*! |
701 | | The add-ons must support the exported C function API |
| 696 | /*! The add-ons must support the exported C function API |
702 | 697 | if they do, they will be loaded and added to deskbar |
703 | 698 | primary function is the Instantiate function |
704 | 699 | */ |
… |
… |
TReplicantTray::MoveItem(entry_ref* ref, ino_t toDirectory)
|
883 | 878 | } |
884 | 879 | } |
885 | 880 | |
886 | | #endif // add-on support |
| 881 | #endif // add-on support |
887 | 882 | |
888 | 883 | // external add-on API routines |
889 | 884 | // called using the new BDeskbar class |
… |
… |
TReplicantTray::IconCount() const
|
989 | 984 | } |
990 | 985 | |
991 | 986 | |
992 | | /*! Message must contain an archivable view for later rehydration. |
| 987 | /*! Message must contain an archivable view for later rehydration. |
993 | 988 | This function takes over ownership of the provided message on success |
994 | 989 | only. |
995 | 990 | Returns the current replicant ID. |
… |
… |
TReplicantTray::AddIcon(BMessage* archive, int32* id, const entry_ref* addOn)
|
1004 | 999 | |
1005 | 1000 | entry_ref ref; |
1006 | 1001 | if (addOn) { |
1007 | | // Use it if we got it |
1008 | 1002 | ref = *addOn; |
| 1003 | // Use it if we got it |
1009 | 1004 | } else { |
1010 | 1005 | const char* signature; |
| 1006 | |
1011 | 1007 | status_t status = archive->FindString("add_on", &signature); |
1012 | 1008 | if (status == B_OK) { |
1013 | 1009 | BRoster roster; |
… |
… |
TReplicantTray::AddIcon(BMessage* archive, int32* id, const entry_ref* addOn)
|
1028 | 1024 | return status; |
1029 | 1025 | |
1030 | 1026 | BEntry entry(&ref, true); |
1031 | | // ToDo: this resolves an eventual link for the item |
1032 | | // being added - this is okay for now, but in multi-user |
1033 | | // environments, one might want to have links that |
1034 | | // carry the be:deskbar_item_status attribute |
| 1027 | // TODO: this resolves an eventual link for the item being added - this |
| 1028 | // is okay for now, but in multi-user environments, one might want to |
| 1029 | // have links that carry the be:deskbar_item_status attribute |
1035 | 1030 | status = entry.InitCheck(); |
1036 | 1031 | if (status != B_OK) |
1037 | 1032 | return status; |
… |
… |
TReplicantTray::AddIcon(BMessage* archive, int32* id, const entry_ref* addOn)
|
1041 | 1036 | archive->what = 0; |
1042 | 1037 | |
1043 | 1038 | BRect originalBounds = archive->FindRect("_frame"); |
1044 | | // this is a work-around for buggy replicants that change their |
1045 | | // size in AttachedToWindow() (such as "SVM") |
| 1039 | // this is a work-around for buggy replicants that change their size in |
| 1040 | // AttachedToWindow() (such as "SVM") |
1046 | 1041 | |
1047 | | // !! check for name collisions? |
| 1042 | // TODO: check for name collisions? |
1048 | 1043 | status = fShelf->AddReplicant(archive, BPoint(1, 1)); |
1049 | 1044 | if (status != B_OK) |
1050 | 1045 | return status; |
… |
… |
TReplicantTray::AddIcon(BMessage* archive, int32* id, const entry_ref* addOn)
|
1070 | 1065 | // add the item to the add-on list |
1071 | 1066 | |
1072 | 1067 | AddItem(*id, nodeRef, entry, addOn != NULL); |
1073 | | return B_OK; |
| 1068 | return B_OK; |
1074 | 1069 | } |
1075 | 1070 | |
1076 | 1071 | |
… |
… |
TReplicantTray::RealReplicantAdjustment(int32 startIndex)
|
1129 | 1124 | float width, height; |
1130 | 1125 | GetPreferredSize(&width, &height); |
1131 | 1126 | if (oldWidth != width || oldHeight != height) { |
1132 | | // resize view to accomodate the replicants |
1133 | | // redraw as necessary |
| 1127 | // resize view to accomodate the replicants, redraw as necessary |
1134 | 1128 | AdjustPlacement(); |
1135 | 1129 | } |
1136 | 1130 | } |
… |
… |
TReplicantTray::ViewAt(int32* index, int32* id, int32 target, bool byIndex)
|
1154 | 1148 | } |
1155 | 1149 | } |
1156 | 1150 | } else { |
1157 | | int32 count = fShelf->CountReplicants()-1; |
| 1151 | int32 count = fShelf->CountReplicants() - 1; |
1158 | 1152 | int32 localid; |
1159 | 1153 | for (int32 repIndex = count ; repIndex >= 0 ; repIndex--) { |
1160 | 1154 | fShelf->ReplicantAt(repIndex, &view, (uint32*)&localid); |
… |
… |
TReplicantTray::ViewAt(int32* index, int32* id, int32 target, bool byIndex)
|
1165 | 1159 | } |
1166 | 1160 | } |
1167 | 1161 | } |
1168 | | |
1169 | 1162 | return NULL; |
1170 | 1163 | } |
1171 | 1164 | |
… |
… |
TReplicantTray::ViewAt(int32* index, int32* id, const char* name)
|
1189 | 1182 | return view; |
1190 | 1183 | } |
1191 | 1184 | } |
1192 | | |
1193 | 1185 | return NULL; |
1194 | 1186 | } |
1195 | 1187 | |
… |
… |
TReplicantTray::SetMultiRow(bool state)
|
1353 | 1345 | // #pragma mark - |
1354 | 1346 | |
1355 | 1347 | |
1356 | | /*! Draggable region that is asynchronous so that dragging does not block |
| 1348 | /*! Draggable region that is asynchronous so that dragging does not block |
1357 | 1349 | other activities. |
1358 | 1350 | */ |
1359 | 1351 | TDragRegion::TDragRegion(TBarView* parent, BView* child) |
… |
… |
bool
|
1583 | 1575 | TDragRegion::SwitchModeForRect(BPoint mouse, BRect rect, |
1584 | 1576 | bool newVertical, bool newLeft, bool newTop, int32 newState) |
1585 | 1577 | { |
1586 | | if (!rect.Contains(mouse)) |
| 1578 | if (!rect.Contains(mouse)) { |
1587 | 1579 | // not our rect |
1588 | 1580 | return false; |
| 1581 | } |
1589 | 1582 | |
1590 | | if (newVertical == fBarView->Vertical() |
1591 | | && newLeft == fBarView->Left() |
1592 | | && newTop == fBarView->Top() |
1593 | | && newState == fBarView->State()) |
| 1583 | if (newVertical == fBarView->Vertical() && newLeft == fBarView->Left() |
| 1584 | && newTop == fBarView->Top() && newState == fBarView->State()) { |
1594 | 1585 | // already in the correct mode |
1595 | 1586 | return true; |
| 1587 | } |
1596 | 1588 | |
1597 | 1589 | fBarView->ChangeState(newState, newVertical, newLeft, newTop); |
1598 | 1590 | return true; |
-
diff --git a/src/apps/deskbar/StatusView.h b/src/apps/deskbar/StatusView.h
index aeef04b..31fb82f 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
const int32 kIconGap = 2;
|
51 | 52 | const int32 kGutter = 1; |
52 | 53 | const int32 kDragRegionWidth = 6; |
53 | 54 | |
54 | | // 1 pixel left gutter |
55 | | // space for replicant tray (6 items) |
56 | | // 6 pixel drag region |
57 | | const float kMinimumTrayWidth = kIconGap |
58 | | + (kMinimumReplicantCount * kIconGap) |
59 | | + (kMinimumReplicantCount * kMaxReplicantWidth) + kGutter; |
| 55 | // 1 pixel left gutter |
| 56 | // space for replicant tray (6 items) |
| 57 | // 6 pixel drag region |
| 58 | const float kMinimumTrayWidth = kIconGap + (kMinimumReplicantCount * kIconGap) |
| 59 | + (kMinimumReplicantCount * kMaxReplicantWidth) + kGutter; |
60 | 60 | const float kMinimumTrayHeight = kGutter + kMaxReplicantHeight + kGutter; |
61 | 61 | |
62 | 62 | extern float sMinimumWindowWidth; |
… |
… |
public:
|
104 | 104 | void RemoveIcon(int32 target, bool byIndex = false); |
105 | 105 | void RemoveIcon(const char* name); |
106 | 106 | |
107 | | BRect IconFrame(int32 target, bool byIndex=false); |
| 107 | BRect IconFrame(int32 target, bool byIndex = false); |
108 | 108 | BRect IconFrame(const char* name); |
109 | 109 | |
110 | 110 | bool AcceptAddon(BRect frame, BMessage* message); |
-
diff --git a/src/apps/deskbar/StatusViewShelf.cpp b/src/apps/deskbar/StatusViewShelf.cpp
index c879036..38cd445 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
TReplicantShelf::MessageReceived(BMessage* message)
|
68 | 69 | // since we can't use ReplicantDeleted |
69 | 70 | // catch the message and find the id or name specifier |
70 | 71 | // then delete the rep vi the api, |
71 | | // |
| 72 | |
72 | 73 | // this will fix the problem of realigning the reps |
73 | 74 | // after a remove when done through scripting |
74 | | // |
| 75 | |
75 | 76 | // note: if specified by index its the index not the id! |
76 | 77 | |
77 | 78 | while (message->FindMessage("specifiers", index++, &repspec) |
78 | 79 | == B_OK) { |
79 | 80 | const char* str; |
| 81 | |
80 | 82 | if (repspec.FindString("property", &str) == B_OK) { |
81 | 83 | if (strcmp(str, "Replicant") == 0) { |
82 | 84 | int32 index; |
… |
… |
TReplicantShelf::MessageReceived(BMessage* message)
|
103 | 105 | } |
104 | 106 | |
105 | 107 | |
106 | | bool |
| 108 | bool |
107 | 109 | TReplicantShelf::CanAcceptReplicantView(BRect frame, BView* view, |
108 | 110 | BMessage* message) const |
109 | 111 | { |
-
diff --git a/src/apps/deskbar/StatusViewShelf.h b/src/apps/deskbar/StatusViewShelf.h
index 4db46fb..181b4a8 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
35 | | // overrides BShelf; rejects draggers that won't fit into the shelf |
36 | | // alligns received draggers into a grid |
| 36 | // overrides BShelf; rejects draggers that won't fit into the shelf |
| 37 | // alligns received draggers into a grid |
37 | 38 | |
38 | 39 | #ifndef __STATUS_VIEW_SHELF__ |
39 | 40 | #define __STATUS_VIEW_SHELF__ |
… |
… |
class TReplicantShelf : public BShelf {
|
45 | 46 | public: |
46 | 47 | TReplicantShelf(TReplicantTray* view); |
47 | 48 | ~TReplicantShelf(); |
48 | | |
| 49 | |
49 | 50 | void MessageReceived(BMessage*); |
50 | | |
| 51 | |
51 | 52 | protected: |
52 | 53 | bool CanAcceptReplicantView(BRect, BView*, BMessage*) const; |
53 | | BPoint AdjustReplicantBy(BRect, BMessage*) const; |
| 54 | BPoint AdjustReplicantBy(BRect, BMessage*) const; |
54 | 55 | void ReplicantDeleted(int32, const BMessage*, const BView*); |
55 | 56 | |
56 | 57 | private: |
-
diff --git a/src/apps/deskbar/Switcher.cpp b/src/apps/deskbar/Switcher.cpp
index 86df52d..ed686a2 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
public:
|
99 | 100 | TSwitchManager* manager); |
100 | 101 | virtual ~TSwitcherWindow(); |
101 | 102 | |
102 | | virtual bool QuitRequested(); |
103 | | virtual void MessageReceived(BMessage* message); |
104 | | virtual void Show(); |
105 | | virtual void Hide(); |
106 | | virtual void WindowActivated(bool state); |
| 103 | virtual bool QuitRequested(); |
| 104 | virtual void MessageReceived(BMessage* message); |
| 105 | virtual void Show(); |
| 106 | virtual void Hide(); |
| 107 | virtual void WindowActivated(bool state); |
107 | 108 | |
108 | 109 | void DoKey(uint32 key, uint32 modifiers); |
109 | 110 | TIconView* IconView(); |
… |
… |
public:
|
133 | 134 | void UpdateGroup(int32 groupIndex, int32 windowIndex); |
134 | 135 | |
135 | 136 | virtual void AttachedToWindow(); |
136 | | virtual void Draw(BRect update); |
137 | | virtual void Pulse(); |
138 | | virtual void GetPreferredSize(float* w, float* h); |
| 137 | virtual void Draw(BRect update); |
| 138 | virtual void Pulse(); |
| 139 | virtual void GetPreferredSize(float* w, float* h); |
139 | 140 | void ScrollTo(float x, float y) |
140 | | { ScrollTo(BPoint(x,y)); } |
141 | | virtual void ScrollTo(BPoint where); |
| 141 | { |
| 142 | ScrollTo(BPoint(x, y)); |
| 143 | } |
| 144 | virtual void ScrollTo(BPoint where); |
142 | 145 | |
143 | 146 | void ShowIndex(int32 windex); |
144 | 147 | BRect FrameOf(int32 index) const; |
… |
… |
public:
|
161 | 164 | void Hiding(); |
162 | 165 | |
163 | 166 | virtual void KeyDown(const char* bytes, int32 numBytes); |
164 | | virtual void Pulse(); |
165 | | virtual void MouseDown(BPoint point); |
166 | | virtual void Draw(BRect updateRect); |
| 167 | virtual void Pulse(); |
| 168 | virtual void MouseDown(BPoint point); |
| 169 | virtual void Draw(BRect updateRect); |
167 | 170 | |
168 | 171 | void ScrollTo(float x, float y) |
169 | | { ScrollTo(BPoint(x,y)); } |
170 | | virtual void ScrollTo(BPoint where); |
| 172 | { |
| 173 | ScrollTo(BPoint(x, y)); |
| 174 | } |
| 175 | virtual void ScrollTo(BPoint where); |
171 | 176 | void Update(int32 previous, int32 current, |
172 | 177 | int32 previousSlot, int32 currentSlot, |
173 | 178 | bool forward); |
… |
… |
public:
|
199 | 204 | |
200 | 205 | virtual void Draw(BRect update); |
201 | 206 | virtual void AllAttached(); |
202 | | virtual void DrawIconScrollers(bool force); |
203 | | virtual void DrawWindowScrollers(bool force); |
204 | | virtual void MouseDown(BPoint where); |
| 207 | virtual void DrawIconScrollers(bool force); |
| 208 | virtual void DrawWindowScrollers(bool force); |
| 209 | virtual void MouseDown(BPoint where); |
205 | 210 | |
206 | 211 | private: |
207 | 212 | TSwitchManager* fManager; |
… |
… |
LowBitIndex(uint32 value)
|
252 | 257 | inline bool |
253 | 258 | IsVisibleInCurrentWorkspace(const window_info* windowInfo) |
254 | 259 | { |
255 | | /* |
256 | | The window list is always ordered from the top |
257 | | front visible window (the first on the list), going down through all |
258 | | the other visible windows, then all the hidden or non workspace |
259 | | visible window at the end. |
260 | | |
261 | | layer > 2 : normal visible window. |
262 | | layer == 2 : reserved for the desktop window (visible also). |
263 | | layer < 2 : hidden (0) and non workspace visible window (1) |
264 | | */ |
| 260 | // The window list is always ordered from the top front visible window |
| 261 | // (the first on the list), going down through all the other visible |
| 262 | // windows, then all hidden or non-workspace visible windows at the end. |
| 263 | // layer > 2 : normal visible window |
| 264 | // layer == 2 : reserved for the desktop window (visible also) |
| 265 | // layer < 2 : hidden (0) and non workspace visible window (1) |
265 | 266 | return windowInfo->layer > 2; |
266 | 267 | } |
267 | 268 | |
… |
… |
bool
|
280 | 281 | IsWindowOK(const window_info* windowInfo) |
281 | 282 | { |
282 | 283 | // is_mini (true means that the window is minimized). |
283 | | // if not, then |
284 | | // show_hide >= 1 means that the window is hidden. |
285 | | // |
| 284 | // if not, then show_hide >= 1 means that the window is hidden. |
286 | 285 | // If the window is both minimized and hidden, then you get : |
287 | | // TWindow->is_mini = false; |
288 | | // TWindow->was_mini = true; |
289 | | // TWindow->show_hide >= 1; |
| 286 | // TWindow->is_mini = false; |
| 287 | // TWindow->was_mini = true; |
| 288 | // TWindow->show_hide >= 1; |
290 | 289 | |
291 | 290 | if (windowInfo->feel != _STD_W_TYPE_) |
292 | 291 | return false; |
… |
… |
SmartStrcmp(const char* s1, const char* s2)
|
332 | 331 | s2++; |
333 | 332 | continue; |
334 | 333 | } |
335 | | if (*s1 != *s2) |
336 | | return 1; // they differ |
| 334 | if (*s1 != *s2) { |
| 335 | // they differ |
| 336 | return 1; |
| 337 | } |
337 | 338 | s1++; |
338 | 339 | s2++; |
339 | 340 | } |
340 | 341 | |
341 | 342 | // if one of the strings ended before the other |
342 | | // ??? could process trailing spaces & underscores! |
| 343 | // TODO: could process trailing spaces and underscores |
343 | 344 | if (*s1) |
344 | 345 | return 1; |
345 | 346 | if (*s2) |
… |
… |
TSwitchManager::TSwitchManager(BPoint point)
|
448 | 449 | TBarApp::Subscribe(BMessenger(this), &tmpList); |
449 | 450 | |
450 | 451 | for (int32 i = 0; ; i++) { |
451 | | BarTeamInfo *barTeamInfo = (BarTeamInfo *)tmpList.ItemAt(i); |
| 452 | BarTeamInfo* barTeamInfo = (BarTeamInfo*)tmpList.ItemAt(i); |
452 | 453 | if (!barTeamInfo) |
453 | 454 | break; |
454 | 455 | |
… |
… |
TSwitchManager::MessageReceived(BMessage* message)
|
485 | 486 | int i = 0; |
486 | 487 | TTeamGroup* tinfo; |
487 | 488 | message->FindInt32("team", &teamID); |
| 489 | |
488 | 490 | while ((tinfo = (TTeamGroup*)fGroupList.ItemAt(i)) != NULL) { |
489 | 491 | if (tinfo->TeamList()->HasItem((void*)teamID)) { |
490 | 492 | fGroupList.RemoveItem(i); |
… |
… |
TSwitchManager::MessageReceived(BMessage* message)
|
519 | 521 | delete teams; |
520 | 522 | break; |
521 | 523 | } |
| 524 | |
522 | 525 | delete smallIcon; |
| 526 | |
523 | 527 | if (message->FindString("sig", &signature) != B_OK) { |
524 | 528 | delete teams; |
525 | 529 | break; |
526 | 530 | } |
| 531 | |
527 | 532 | if (message->FindInt32("flags", (int32*)&flags) != B_OK) { |
528 | 533 | delete teams; |
529 | 534 | break; |
530 | 535 | } |
| 536 | |
531 | 537 | if (message->FindString("name", &name) != B_OK) { |
532 | 538 | delete teams; |
533 | 539 | break; |
… |
… |
TSwitchManager::MessageReceived(BMessage* message)
|
548 | 554 | const char* signature = message->FindString("sig"); |
549 | 555 | team_id team = message->FindInt32("team"); |
550 | 556 | |
551 | | int32 numItems = fGroupList.CountItems(); |
552 | | for (int32 i = 0; i < numItems; i++) { |
| 557 | for (int32 i = 0; i < fGroupList.CountItems(); i++) { |
553 | 558 | TTeamGroup* tinfo = (TTeamGroup*)fGroupList.ItemAt(i); |
554 | 559 | if (strcasecmp(tinfo->Signature(), signature) == 0) { |
555 | 560 | if (!(tinfo->TeamList()->HasItem((void*)team))) |
… |
… |
TSwitchManager::MessageReceived(BMessage* message)
|
564 | 569 | { |
565 | 570 | team_id team = message->FindInt32("team"); |
566 | 571 | |
567 | | int32 numItems = fGroupList.CountItems(); |
568 | | for (int32 i = 0; i < numItems; i++) { |
| 572 | for (int32 i = 0; i < fGroupList.CountItems(); i++) { |
569 | 573 | TTeamGroup* tinfo = (TTeamGroup*)fGroupList.ItemAt(i); |
570 | 574 | if (tinfo->TeamList()->HasItem((void*)team)) { |
571 | 575 | tinfo->TeamList()->RemoveItem((void*)team); |
… |
… |
TSwitchManager::MessageReceived(BMessage* message)
|
586 | 590 | // starts differentiating initial key_downs from KeyDowns generated |
587 | 591 | // by auto-repeat. Until then the fSkipUntil stuff helps, but it |
588 | 592 | // isn't perfect. |
589 | | |
590 | 593 | if (time < fSkipUntil) |
591 | 594 | break; |
592 | 595 | |
… |
… |
TSwitchManager::_SortApps()
|
622 | 625 | team_id* teams; |
623 | 626 | int32 count; |
624 | 627 | if (BPrivate::get_application_order(current_workspace(), &teams, &count) |
625 | | != B_OK) |
| 628 | != B_OK) |
626 | 629 | return; |
627 | 630 | |
628 | 631 | BList groups; |
… |
… |
TSwitchManager::MainEntry(BMessage* message)
|
658 | 661 | { |
659 | 662 | bigtime_t now = system_time(); |
660 | 663 | bigtime_t timeout = now + 180000; |
661 | | // The delay above was arrived at by trial and error and |
662 | | // has a good "feel" |
| 664 | // The above delay has a good "feel" found by trial and error |
663 | 665 | |
664 | 666 | app_info appInfo; |
665 | 667 | be_roster->GetActiveAppInfo(&appInfo); |
… |
… |
TSwitchManager::_FindNextValidApp(bool forward)
|
887 | 889 | if (fCurrentIndex < 0) |
888 | 890 | fCurrentIndex = max - 1; |
889 | 891 | } |
| 892 | |
890 | 893 | if (fCurrentIndex == startIndex) { |
891 | 894 | // we've gone completely through the list without finding |
892 | 895 | // a good app. Oh well. |
… |
… |
TSwitchManager::_FindNextValidApp(bool forward)
|
900 | 903 | return false; |
901 | 904 | } |
902 | 905 | |
| 906 | |
903 | 907 | void |
904 | 908 | TSwitchManager::SwitchToApp(int32 previousIndex, int32 newIndex, bool forward) |
905 | 909 | { |
… |
… |
TSwitchManager::ActivateApp(bool forceShow, bool allowWorkspaceSwitch)
|
932 | 936 | |
933 | 937 | int32 currentWorkspace = current_workspace(); |
934 | 938 | TTeamGroup* teamGroup = (TTeamGroup*)fGroupList.ItemAt(fCurrentIndex); |
| 939 | |
935 | 940 | // Let's handle the easy case first: There's only 1 team in the group |
936 | 941 | if (teamGroup->TeamList()->CountItems() == 1) { |
937 | 942 | bool result; |
… |
… |
TSwitchManager::ActivateApp(bool forceShow, bool allowWorkspaceSwitch)
|
990 | 995 | if (tokens == NULL) { |
991 | 996 | ASSERT(windowInfo); |
992 | 997 | free(windowInfo); |
993 | | return true; // weird error, so don't try to recover |
| 998 | return true; |
| 999 | // weird error, so don't try to recover |
994 | 1000 | } |
995 | 1001 | |
996 | 1002 | BList windowsToActivate; |
… |
… |
TSwitchManager::QuitApp()
|
1042 | 1048 | |
1043 | 1049 | TTeamGroup* teamGroup; |
1044 | 1050 | int32 count = 0; |
| 1051 | |
1045 | 1052 | for (int32 i = fCurrentIndex + 1; i < fGroupList.CountItems(); i++) { |
1046 | 1053 | teamGroup = (TTeamGroup*)fGroupList.ItemAt(i); |
1047 | 1054 | |
… |
… |
TBox::MouseDown(BPoint where)
|
1296 | 1303 | if (fLeftScroller) { |
1297 | 1304 | BRect lhit(0, frame.top, frame.left, frame.bottom); |
1298 | 1305 | if (lhit.Contains(where)) { |
1299 | | // Want to scroll by NUMSLOTS-1 slots |
| 1306 | // Want to scroll by NUMSLOTS - 1 slots |
1300 | 1307 | int32 previousIndex = fManager->CurrentIndex(); |
1301 | 1308 | int32 previousSlot = fManager->CurrentSlot(); |
1302 | 1309 | int32 newSlot = previousSlot - (kNumSlots - 1); |
… |
… |
TBox::MouseDown(BPoint where)
|
1311 | 1318 | if (fRightScroller) { |
1312 | 1319 | BRect rhit(frame.right, frame.top, bounds.right, frame.bottom); |
1313 | 1320 | if (rhit.Contains(where)) { |
1314 | | // Want to scroll by NUMSLOTS-1 slots |
| 1321 | // Want to scroll by NUMSLOTS - 1 slots |
1315 | 1322 | int32 previousIndex = fManager->CurrentIndex(); |
1316 | 1323 | int32 previousSlot = fManager->CurrentSlot(); |
1317 | | int32 newSlot = previousSlot + (kNumSlots-1); |
| 1324 | int32 newSlot = previousSlot + (kNumSlots - 1); |
1318 | 1325 | int32 newIndex = fIconView->IndexAt(newSlot); |
1319 | 1326 | |
1320 | 1327 | if (newIndex < 0) { |
1321 | 1328 | // don't have a page full to scroll |
1322 | 1329 | int32 valid = fManager->CountVisibleGroups(); |
1323 | | newIndex = fIconView->IndexAt(valid-1); |
| 1330 | newIndex = fIconView->IndexAt(valid - 1); |
1324 | 1331 | } |
1325 | 1332 | fManager->SwitchToApp(previousIndex, newIndex, true); |
1326 | 1333 | } |
… |
… |
TBox::MouseDown(BPoint where)
|
1329 | 1336 | frame = fWindow->WindowView()->Frame(); |
1330 | 1337 | if (fUpScroller) { |
1331 | 1338 | BRect hit1(frame.left - 10, frame.top, frame.left, |
1332 | | (frame.top+frame.bottom)/2); |
| 1339 | (frame.top + frame.bottom) / 2); |
1333 | 1340 | BRect hit2(frame.right, frame.top, frame.right + 10, |
1334 | | (frame.top+frame.bottom)/2); |
| 1341 | (frame.top + frame.bottom) / 2); |
1335 | 1342 | if (hit1.Contains(where) || hit2.Contains(where)) { |
1336 | 1343 | // Want to scroll up 1 window |
1337 | 1344 | fManager->CycleWindow(false, false); |
… |
… |
TBox::MouseDown(BPoint where)
|
1339 | 1346 | } |
1340 | 1347 | |
1341 | 1348 | if (fDownScroller) { |
1342 | | BRect hit1(frame.left - 10, (frame.top+frame.bottom) / 2, frame.left, |
1343 | | frame.bottom); |
1344 | | BRect hit2(frame.right, (frame.top+frame.bottom) / 2, frame.right + 10, |
1345 | | frame.bottom); |
| 1349 | BRect hit1(frame.left - 10, (frame.top + frame.bottom) / 2, |
| 1350 | frame.left, frame.bottom); |
| 1351 | BRect hit2(frame.right, (frame.top + frame.bottom) / 2, |
| 1352 | frame.right + 10, frame.bottom); |
1346 | 1353 | if (hit1.Contains(where) || hit2.Contains(where)) { |
1347 | 1354 | // Want to scroll down 1 window |
1348 | 1355 | fManager->CycleWindow(true, false); |
… |
… |
TBox::Draw(BRect update)
|
1374 | 1381 | |
1375 | 1382 | // Fill the area with dark gray |
1376 | 1383 | SetHighColor(darkGray); |
1377 | | box.InsetBy(1,1); |
| 1384 | box.InsetBy(1, 1); |
1378 | 1385 | FillRect(box); |
1379 | 1386 | |
1380 | | box.InsetBy(-1,-1); |
| 1387 | box.InsetBy(-1, -1); |
1381 | 1388 | |
1382 | 1389 | BeginLineArray(50); |
1383 | 1390 | |
1384 | 1391 | // The main frame around the icon view |
1385 | | AddLine(box.LeftTop(), BPoint(center-kWedge, box.top), veryDarkGray); |
1386 | | AddLine(BPoint(center+kWedge, box.top), box.RightTop(), veryDarkGray); |
| 1392 | AddLine(box.LeftTop(), BPoint(center - kWedge, box.top), veryDarkGray); |
| 1393 | AddLine(BPoint(center + kWedge, box.top), box.RightTop(), veryDarkGray); |
1387 | 1394 | |
1388 | | AddLine(box.LeftBottom(), BPoint(center-kWedge, box.bottom), veryDarkGray); |
1389 | | AddLine(BPoint(center+kWedge, box.bottom), box.RightBottom(), veryDarkGray); |
| 1395 | AddLine(box.LeftBottom(), BPoint(center - kWedge, box.bottom), |
| 1396 | veryDarkGray); |
| 1397 | AddLine(BPoint(center + kWedge, box.bottom), box.RightBottom(), |
| 1398 | veryDarkGray); |
1390 | 1399 | AddLine(box.LeftBottom() + BPoint(1, 1), |
1391 | | BPoint(center-kWedge, box.bottom + 1), white); |
1392 | | AddLine(BPoint(center+kWedge, box.bottom) + BPoint(0, 1), |
| 1400 | BPoint(center - kWedge, box.bottom + 1), white); |
| 1401 | AddLine(BPoint(center + kWedge, box.bottom) + BPoint(0, 1), |
1393 | 1402 | box.RightBottom() + BPoint(1, 1), white); |
1394 | 1403 | |
1395 | 1404 | AddLine(box.LeftTop(), box.LeftBottom(), veryDarkGray); |
1396 | 1405 | AddLine(box.RightTop(), box.RightBottom(), veryDarkGray); |
1397 | | AddLine(box.RightTop() + BPoint(1, 1), |
1398 | | box.RightBottom() + BPoint(1, 1), white); |
| 1406 | AddLine(box.RightTop() + BPoint(1, 1), box.RightBottom() + BPoint(1, 1), |
| 1407 | white); |
1399 | 1408 | |
1400 | 1409 | // downward pointing area at top of frame |
1401 | 1410 | BPoint point(center - kWedge, box.top); |
1402 | 1411 | AddLine(point, point + BPoint(kWedge, kWedge), veryDarkGray); |
1403 | | AddLine(point + BPoint(kWedge, kWedge), |
1404 | | BPoint(center+kWedge, point.y), veryDarkGray); |
| 1412 | AddLine(point + BPoint(kWedge, kWedge), BPoint(center + kWedge, point.y), |
| 1413 | veryDarkGray); |
1405 | 1414 | |
1406 | | AddLine(point + BPoint(1, 0), |
1407 | | point + BPoint(1, 0) + BPoint(kWedge - 1, kWedge - 1), white); |
| 1415 | AddLine(point + BPoint(1, 0), point + BPoint(1, 0) |
| 1416 | + BPoint(kWedge - 1, kWedge - 1), white); |
1408 | 1417 | |
1409 | 1418 | AddLine(point + BPoint(2, -1) + BPoint(kWedge - 1, kWedge - 1), |
1410 | | BPoint(center+kWedge-1, point.y), darkGray); |
| 1419 | BPoint(center + kWedge - 1, point.y), darkGray); |
1411 | 1420 | |
1412 | 1421 | BPoint topPoint = point; |
1413 | 1422 | |
… |
… |
TBox::Draw(BRect update)
|
1416 | 1425 | point.x = center - kWedge; |
1417 | 1426 | AddLine(point, point + BPoint(kWedge, -kWedge), veryDarkGray); |
1418 | 1427 | AddLine(point + BPoint(kWedge, -kWedge), |
1419 | | BPoint(center+kWedge, point.y), veryDarkGray); |
| 1428 | BPoint(center + kWedge, point.y), veryDarkGray); |
1420 | 1429 | |
1421 | 1430 | AddLine(point + BPoint(1, 0), |
1422 | 1431 | point + BPoint(1, 0) + BPoint(kWedge - 1, -(kWedge - 1)), white); |
… |
… |
TBox::Draw(BRect update)
|
1436 | 1445 | |
1437 | 1446 | // fill the upward pointing arrow area |
1438 | 1447 | SetHighColor(standardGray); |
1439 | | FillTriangle(bottomPoint + BPoint(2,0), |
| 1448 | FillTriangle(bottomPoint + BPoint(2, 0), |
1440 | 1449 | bottomPoint + BPoint(2, 0) + BPoint(kWedge - 2, -(kWedge - 2)), |
1441 | 1450 | BPoint(center + kWedge - 2, bottomPoint.y)); |
1442 | 1451 | |
… |
… |
TBox::DrawIconScrollers(bool force)
|
1467 | 1476 | } |
1468 | 1477 | |
1469 | 1478 | int32 maxIndex = fManager->GroupList()->CountItems() - 1; |
1470 | | // last_frame is in fIconView coordinate space |
| 1479 | // last_frame is in fIconView coordinate space |
1471 | 1480 | BRect lastFrame = fIconView->FrameOf(maxIndex); |
1472 | 1481 | |
1473 | 1482 | if (lastFrame.right > rect.right) { |
… |
… |
TIconView::CacheIcons(TTeamGroup* teamGroup)
|
1893 | 1902 | void |
1894 | 1903 | TIconView::AnimateIcon(BBitmap* startIcon, BBitmap* endIcon) |
1895 | 1904 | { |
1896 | | BRect centerRect(kCenterSlot*kSlotSize, 0, |
| 1905 | BRect centerRect(kCenterSlot * kSlotSize, 0, |
1897 | 1906 | (kCenterSlot + 1) * kSlotSize - 1, kSlotSize - 1); |
1898 | 1907 | BRect startIconBounds = startIcon->Bounds(); |
1899 | 1908 | BRect bounds = Bounds(); |
… |
… |
TIconView::AnimateIcon(BBitmap* startIcon, BBitmap* endIcon)
|
1917 | 1926 | fOffBitmap->Lock(); |
1918 | 1927 | |
1919 | 1928 | for (int i = 0; i < 2; i++) { |
1920 | | startIconBounds.InsetBy(amount,amount); |
| 1929 | startIconBounds.InsetBy(amount, amount); |
1921 | 1930 | snooze(20000); |
1922 | 1931 | fOffView->SetDrawingMode(B_OP_COPY); |
1923 | 1932 | fOffView->FillRect(fOffView->Bounds()); |
… |
… |
TIconView::AnimateIcon(BBitmap* startIcon, BBitmap* endIcon)
|
1927 | 1936 | DrawBitmap(fOffBitmap, destRect); |
1928 | 1937 | } |
1929 | 1938 | for (int i = 0; i < 2; i++) { |
1930 | | startIconBounds.InsetBy(amount,amount); |
| 1939 | startIconBounds.InsetBy(amount, amount); |
1931 | 1940 | snooze(20000); |
1932 | 1941 | fOffView->SetDrawingMode(B_OP_COPY); |
1933 | 1942 | fOffView->FillRect(fOffView->Bounds()); |
… |
… |
int32
|
2054 | 2063 | TIconView::SlotOf(int32 index) const |
2055 | 2064 | { |
2056 | 2065 | BRect rect = FrameOf(index); |
| 2066 | |
2057 | 2067 | return (int32)(rect.left / kSlotSize) - kCenterSlot; |
2058 | 2068 | } |
2059 | 2069 | |
… |
… |
TIconView::FrameOf(int32 index) const
|
2063 | 2073 | { |
2064 | 2074 | BList* list = fManager->GroupList(); |
2065 | 2075 | int32 visible = kCenterSlot - 1; |
2066 | | // first few slots in view are empty |
| 2076 | // first few slots in view are empty |
2067 | 2077 | |
2068 | 2078 | TTeamGroup* teamGroup; |
2069 | 2079 | for (int32 i = 0; i <= index; i++) { |
… |
… |
TIconView::DrawTeams(BRect update)
|
2107 | 2117 | |
2108 | 2118 | SetDrawingMode(B_OP_COPY); |
2109 | 2119 | } |
2110 | | rect.OffsetBy(kSlotSize,0); |
| 2120 | rect.OffsetBy(kSlotSize, 0); |
2111 | 2121 | } |
2112 | 2122 | } |
2113 | 2123 | |
… |
… |
TWindowView::ScrollTo(BPoint where)
|
2200 | 2210 | } |
2201 | 2211 | |
2202 | 2212 | |
2203 | | |
2204 | 2213 | BRect |
2205 | 2214 | TWindowView::FrameOf(int32 index) const |
2206 | 2215 | { |
… |
… |
TWindowView::Draw(BRect update)
|
2274 | 2283 | int32 groupIndex = fManager->CurrentIndex(); |
2275 | 2284 | TTeamGroup* teamGroup |
2276 | 2285 | = (TTeamGroup*)fManager->GroupList()->ItemAt(groupIndex); |
| 2286 | |
2277 | 2287 | if (teamGroup == NULL) |
2278 | 2288 | return; |
2279 | 2289 | |
-
diff --git a/src/apps/deskbar/Switcher.h b/src/apps/deskbar/Switcher.h
index 9f319ea..b727c99 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | #ifndef SWITCHER_H |
… |
… |
public:
|
53 | 54 | TSwitchManager(BPoint where); |
54 | 55 | virtual ~TSwitchManager(); |
55 | 56 | |
56 | | virtual void MessageReceived(BMessage* message); |
| 57 | virtual void MessageReceived(BMessage* message); |
57 | 58 | |
58 | 59 | void Stop(bool doAction, uint32 modifiers); |
59 | 60 | void Unblock(); |
… |
… |
private:
|
85 | 86 | bool allowWorkspaceSwitch); |
86 | 87 | void ActivateWindow(int32 windowID = -1); |
87 | 88 | void _SortApps(); |
88 | | |
| 89 | |
89 | 90 | bool _FindNextValidApp(bool forward); |
90 | 91 | |
91 | 92 | TSwitcherWindow* fWindow; |
-
diff --git a/src/apps/deskbar/TeamMenu.cpp b/src/apps/deskbar/TeamMenu.cpp
index 7814b40..3053969 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
TTeamMenu::AttachedToWindow()
|
121 | 122 | if (dragging && barview->LockLooper()) { |
122 | 123 | SetTrackingHook(barview->MenuTrackingHook, |
123 | 124 | barview->GetTrackingHookData()); |
124 | | barview->DragStart(); |
| 125 | barview->DragStart(); |
125 | 126 | barview->UnlockLooper(); |
126 | 127 | } |
127 | 128 | |
-
diff --git a/src/apps/deskbar/TeamMenu.h b/src/apps/deskbar/TeamMenu.h
index b3b0487..a012a5e 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
35 | | // listing of running applications |
36 | | // menu of BarMenuTitle |
37 | | // in mini mode only |
| 36 | // listing of running applications |
| 37 | // menu of BarMenuTitle |
| 38 | // in mini mode only |
38 | 39 | |
39 | 40 | #ifndef TEAMMENU_H |
40 | 41 | #define TEAMMENU_H |
… |
… |
All rights reserved.
|
44 | 45 | #include "TeamMenuItem.h" |
45 | 46 | |
46 | 47 | class TTeamMenu : public BMenu { |
47 | | public: |
| 48 | public: |
48 | 49 | TTeamMenu(); |
49 | 50 | |
50 | 51 | void AttachedToWindow(); |
-
diff --git a/src/apps/deskbar/TeamMenuItem.cpp b/src/apps/deskbar/TeamMenuItem.cpp
index cbd669f..5cdecdd 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
TTeamMenuItem::TTeamMenuItem(BList* team, BBitmap* icon, char* name, char* sig,
|
71 | 72 | } |
72 | 73 | |
73 | 74 | |
74 | | TTeamMenuItem::TTeamMenuItem(float width,float height,bool vertical) |
| 75 | TTeamMenuItem::TTeamMenuItem(float width, float height, bool vertical) |
75 | 76 | : BMenuItem("", NULL) |
76 | 77 | { |
77 | | InitData(NULL, NULL, strdup(""), strdup(""), width, height, false, vertical); |
| 78 | InitData(NULL, NULL, strdup(""), strdup(""), width, height, false, |
| 79 | vertical); |
78 | 80 | } |
79 | 81 | |
80 | 82 | |
… |
… |
TTeamMenuItem::Invoke(BMessage* message)
|
136 | 138 | barview->DragStop(); |
137 | 139 | |
138 | 140 | // bring to front or minimize shortcuts |
139 | | uint32 mods = modifiers(); |
140 | | if (mods & B_CONTROL_KEY) |
| 141 | uint32 mods = modifiers(); |
| 142 | if (mods & B_CONTROL_KEY) { |
141 | 143 | TShowHideMenuItem::TeamShowHideCommon((mods & B_SHIFT_KEY) |
142 | 144 | ? B_MINIMIZE_WINDOW : B_BRING_TO_FRONT, Teams()); |
| 145 | } |
143 | 146 | |
144 | 147 | return BMenuItem::Invoke(message); |
145 | 148 | } |
… |
… |
TTeamMenuItem::GetContentSize(float* width, float* height)
|
213 | 216 | *width = kHPad + iconBounds.Width() + kLabelOffset + fLabelWidth + kHPad |
214 | 217 | + 20; |
215 | 218 | |
216 | | if (fOverrideHeight != -1.0f) |
| 219 | if (fOverrideHeight != -1.0f) |
217 | 220 | *height = fOverrideHeight; |
218 | 221 | else { |
219 | 222 | *height = iconBounds.Height(); |
… |
… |
TTeamMenuItem::Draw()
|
233 | 236 | BMenu* menu = Menu(); |
234 | 237 | menu->PushState(); |
235 | 238 | rgb_color menuColor = menu->LowColor(); |
236 | | |
237 | 239 | TBarView* barview = (static_cast<TBarApp*>(be_app))->BarView(); |
| 240 | |
238 | 241 | bool canHandle = !barview->Dragging() |
239 | 242 | || barview->AppCanHandleTypes(Signature()); |
240 | 243 | |
… |
… |
TTeamMenuItem::Draw()
|
314 | 317 | |
315 | 318 | // these continue the dark grey border on the left or top edge |
316 | 319 | menu->SetHighColor(tint_color(menuColor, B_DARKEN_4_TINT)); |
317 | | if (fVertical) |
| 320 | if (fVertical) { |
318 | 321 | // dark line at top |
319 | 322 | menu->StrokeLine(frame.LeftTop(), frame.RightTop()); |
320 | | else |
| 323 | } else { |
321 | 324 | // dark line on the left |
322 | 325 | menu->StrokeLine(frame.LeftTop(), frame.LeftBottom()); |
323 | | } else |
| 326 | } |
| 327 | } else |
324 | 328 | menu->SetLowColor(menuColor); |
325 | 329 | |
326 | 330 | menu->MovePenTo(ContentLocation()); |
… |
… |
TTeamMenuItem::DrawContent()
|
337 | 341 | if (fIcon->ColorSpace() == B_RGBA32) { |
338 | 342 | menu->SetDrawingMode(B_OP_ALPHA); |
339 | 343 | menu->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY); |
340 | | } else { |
| 344 | } else |
341 | 345 | menu->SetDrawingMode(B_OP_OVER); |
342 | | } |
343 | | BRect frame(Frame()); |
344 | 346 | |
| 347 | BRect frame(Frame()); |
345 | 348 | BRect iconBounds(fIcon->Bounds()); |
346 | 349 | BRect dstRect(iconBounds); |
347 | 350 | float extra = fVertical ? 0.0f : 1.0f; |
348 | 351 | BPoint contLoc = ContentLocation(); |
| 352 | |
349 | 353 | dstRect.OffsetTo(BPoint(contLoc.x + kHPad, contLoc.y + |
350 | 354 | ((frame.Height() - iconBounds.Height()) / 2) + extra)); |
351 | 355 | menu->DrawBitmapAsync(fIcon, dstRect); |
… |
… |
TTeamMenuItem::DrawContent()
|
357 | 361 | menu->MovePenTo(drawLoc); |
358 | 362 | } |
359 | 363 | |
360 | | // set the pen to black so that either method will draw in the same color |
361 | | // low color is set in inherited::DrawContent, override makes sure its |
362 | | // what we want |
| 364 | // set the pen to black so that either method will draw in the same color |
| 365 | // low color is set in inherited::DrawContent, override makes sure its |
| 366 | // what we want |
363 | 367 | if (fDrawLabel) { |
364 | 368 | menu->SetDrawingMode(B_OP_OVER); |
365 | 369 | menu->SetHighColor(0, 0, 0); |
366 | 370 | |
367 | | // override the drawing of the content when the item is disabled |
368 | | // the wrong lowcolor is used when the item is disabled since the |
369 | | // text color does not change |
370 | | DrawContentLabel(); |
| 371 | // override the drawing of the content when the item is disabled |
| 372 | // the wrong lowcolor is used when the item is disabled since the |
| 373 | // text color does not change |
| 374 | DrawContentLabel(); |
371 | 375 | } |
372 | 376 | |
373 | 377 | // Draw the expandable icon. |
… |
… |
TTeamMenuItem::DrawContent()
|
387 | 391 | } else { |
388 | 392 | rgb_color outlineColor = {80, 80, 80, 255}; |
389 | 393 | rgb_color middleColor = {200, 200, 200, 255}; |
390 | | |
| 394 | |
391 | 395 | menu->SetDrawingMode(B_OP_OVER); |
392 | | |
| 396 | |
393 | 397 | if (!fExpanded) { |
394 | 398 | menu->BeginLineArray(6); |
395 | | |
396 | | menu->AddLine(BPoint(rect.left + 3, rect.top + 1), |
| 399 | |
| 400 | menu->AddLine(BPoint(rect.left + 3, rect.top + 1), |
397 | 401 | BPoint(rect.left + 3, rect.bottom - 1), outlineColor); |
398 | | menu->AddLine(BPoint(rect.left + 3, rect.top + 1), |
| 402 | menu->AddLine(BPoint(rect.left + 3, rect.top + 1), |
399 | 403 | BPoint(rect.left + 7, rect.top + 5), outlineColor); |
400 | | menu->AddLine(BPoint(rect.left + 7, rect.top + 5), |
| 404 | menu->AddLine(BPoint(rect.left + 7, rect.top + 5), |
401 | 405 | BPoint(rect.left + 3, rect.bottom - 1), outlineColor); |
402 | | |
403 | | menu->AddLine(BPoint(rect.left + 4, rect.top + 3), |
| 406 | |
| 407 | menu->AddLine(BPoint(rect.left + 4, rect.top + 3), |
404 | 408 | BPoint(rect.left + 4, rect.bottom - 3), middleColor); |
405 | | menu->AddLine(BPoint(rect.left + 5, rect.top + 4), |
| 409 | menu->AddLine(BPoint(rect.left + 5, rect.top + 4), |
406 | 410 | BPoint(rect.left + 5, rect.bottom - 4), middleColor); |
407 | | menu->AddLine(BPoint(rect.left + 5, rect.top + 5), |
| 411 | menu->AddLine(BPoint(rect.left + 5, rect.top + 5), |
408 | 412 | BPoint(rect.left + 6, rect.top + 5), middleColor); |
409 | 413 | menu->EndLineArray(); |
410 | 414 | } else { |
411 | 415 | // expanded state |
412 | | |
| 416 | |
413 | 417 | menu->BeginLineArray(6); |
414 | | menu->AddLine(BPoint(rect.left + 1, rect.top + 3), |
| 418 | menu->AddLine(BPoint(rect.left + 1, rect.top + 3), |
415 | 419 | BPoint(rect.right - 3, rect.top + 3), outlineColor); |
416 | | menu->AddLine(BPoint(rect.left + 1, rect.top + 3), |
| 420 | menu->AddLine(BPoint(rect.left + 1, rect.top + 3), |
417 | 421 | BPoint(rect.left + 5, rect.top + 7), outlineColor); |
418 | | menu->AddLine(BPoint(rect.left + 5, rect.top + 7), |
| 422 | menu->AddLine(BPoint(rect.left + 5, rect.top + 7), |
419 | 423 | BPoint(rect.right - 3, rect.top + 3), outlineColor); |
420 | | |
421 | | menu->AddLine(BPoint(rect.left + 3, rect.top + 4), |
| 424 | |
| 425 | menu->AddLine(BPoint(rect.left + 3, rect.top + 4), |
422 | 426 | BPoint(rect.right - 5, rect.top + 4), middleColor); |
423 | | menu->AddLine(BPoint(rect.left + 4, rect.top + 5), |
| 427 | menu->AddLine(BPoint(rect.left + 4, rect.top + 5), |
424 | 428 | BPoint(rect.right - 6, rect.top + 5), middleColor); |
425 | | menu->AddLine(BPoint(rect.left + 5, rect.top + 5), |
| 429 | menu->AddLine(BPoint(rect.left + 5, rect.top + 5), |
426 | 430 | BPoint(rect.left + 5, rect.top + 6), middleColor); |
427 | 431 | menu->EndLineArray(); |
428 | 432 | } |
… |
… |
TTeamMenuItem::DrawContentLabel()
|
437 | 441 | BMenu* menu = Menu(); |
438 | 442 | menu->MovePenBy(0, fLabelAscent); |
439 | 443 | |
440 | | float cachedWidth = menu->StringWidth(Label()); |
| 444 | float cachedWidth = menu->StringWidth(Label()); |
441 | 445 | if (Submenu() && fVertical) |
442 | 446 | cachedWidth += 18; |
443 | 447 | |
444 | 448 | const char* label = Label(); |
445 | 449 | char* truncLabel = NULL; |
446 | 450 | float max = 0; |
| 451 | |
447 | 452 | if (static_cast<TBarApp*>(be_app)->Settings()->superExpando && fVertical) |
448 | 453 | max = menu->MaxContentWidth() - kSwitchWidth; |
449 | 454 | else |
450 | 455 | max = menu->MaxContentWidth(); |
451 | 456 | |
452 | 457 | if (max > 0) { |
453 | | BPoint penloc = menu->PenLocation(); |
| 458 | BPoint penloc = menu->PenLocation(); |
454 | 459 | BRect frame = Frame(); |
455 | 460 | float offset = penloc.x - frame.left; |
456 | | if (cachedWidth + offset > max) { |
| 461 | if (cachedWidth + offset > max) { |
457 | 462 | truncLabel = (char*)malloc(strlen(label) + 4); |
458 | 463 | if (!truncLabel) |
459 | 464 | return; |
… |
… |
void
|
491 | 496 | TTeamMenuItem::ToggleExpandState(bool resizeWindow) |
492 | 497 | { |
493 | 498 | fExpanded = !fExpanded; |
494 | | |
| 499 | |
495 | 500 | if (fExpanded) { |
496 | 501 | // Populate Menu() with the stuff from SubMenu(). |
497 | 502 | TWindowMenu* sub = (static_cast<TWindowMenu*>(Submenu())); |
… |
… |
TTeamMenuItem::ToggleExpandState(bool resizeWindow)
|
503 | 508 | if (locked) |
504 | 509 | sub->UnlockLooper(); |
505 | 510 | |
506 | | if (sub->CountItems() > 1){ |
| 511 | if (sub->CountItems() > 1) { |
507 | 512 | TExpandoMenuBar* parent = static_cast<TExpandoMenuBar*>(Menu()); |
508 | 513 | int myindex = parent->IndexOf(this) + 1; |
509 | 514 | |
… |
… |
TTeamMenuItem::ToggleExpandState(bool resizeWindow)
|
553 | 558 | TWindowMenuItem* |
554 | 559 | TTeamMenuItem::ExpandedWindowItem(int32 id) |
555 | 560 | { |
556 | | if (!fExpanded) // Paranoia |
| 561 | if (!fExpanded) { |
| 562 | // Paranoia |
557 | 563 | return NULL; |
| 564 | } |
558 | 565 | |
559 | 566 | TExpandoMenuBar* parent = static_cast<TExpandoMenuBar*>(Menu()); |
560 | 567 | int childIndex = parent->IndexOf(this) + 1; |
-
diff --git a/src/apps/deskbar/TeamMenuItem.h b/src/apps/deskbar/TeamMenuItem.h
index efcd7d0..9bfd28b 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | #ifndef TEAMMENUITEM_H |
… |
… |
class TTeamMenuItem : public BMenuItem {
|
53 | 54 | float width = -1.0f, float height = -1.0f, |
54 | 55 | bool drawLabel = true, bool vertical = true); |
55 | 56 | TTeamMenuItem(float width = -1.0f, float height = -1.0f, |
56 | | bool vertical=true); |
| 57 | bool vertical = true); |
57 | 58 | virtual ~TTeamMenuItem(); |
58 | 59 | |
59 | 60 | status_t Invoke(BMessage* msg = NULL); |
… |
… |
class TTeamMenuItem : public BMenuItem {
|
82 | 83 | friend class TExpandoMenuBar; |
83 | 84 | void InitData(BList* team, BBitmap* icon, char* name, char* sig, |
84 | 85 | float width = -1.0f, float height = -1.0f, |
85 | | bool drawLabel = true,bool vertical=true); |
| 86 | bool drawLabel = true, bool vertical = true); |
86 | 87 | |
87 | 88 | bool _IsSelected() const; |
88 | 89 | |
-
diff --git a/src/apps/deskbar/TimeView.cpp b/src/apps/deskbar/TimeView.cpp
index 16c4982..1c141b4 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
TTimeView::GetPreferredSize(float* width, float* height)
|
154 | 155 | |
155 | 156 | GetCurrentTime(); |
156 | 157 | |
157 | | // TODO: SetOrientation never gets called, fix that |
158 | | // When in vertical mode, we want to limit the width so that it can't |
159 | | // overlap the bevels in the parent view. |
| 158 | // TODO: SetOrientation never gets called, fix that when in vertical mode, |
| 159 | // we want to limit the width so that it can't overlap the bevels in the |
| 160 | // parent view. |
160 | 161 | *width = fOrientation ? |
161 | 162 | min_c(fMaxWidth - kHMargin, kHMargin + StringWidth(fTimeStr)) |
162 | 163 | : kHMargin + StringWidth(fTimeStr); |
… |
… |
TTimeView::MessageReceived(BMessage* message)
|
217 | 218 | |
218 | 219 | default: |
219 | 220 | BView::MessageReceived(message); |
| 221 | break; |
220 | 222 | } |
221 | 223 | } |
222 | 224 | |
… |
… |
TTimeView::GetCurrentDate()
|
262 | 264 | |
263 | 265 | fLocale.FormatDate(tmp, 64, fTime, B_FULL_DATE_FORMAT); |
264 | 266 | |
265 | | // remove leading 0 from date when month is less than 10 (MM/DD/YY) |
266 | | // or remove leading 0 from date when day is less than 10 (DD/MM/YY) |
| 267 | // remove leading 0 from date when month is less than 10 (MM/DD/YY) |
| 268 | // or remove leading 0 from date when day is less than 10 (DD/MM/YY) |
267 | 269 | const char* str = tmp; |
268 | 270 | if (str[0] == '0') |
269 | 271 | str++; |
… |
… |
TTimeView::Pulse()
|
325 | 327 | // For dates, Update() could be called two times in a row, |
326 | 328 | // but that should only happen very rarely |
327 | 329 | if ((fLastTimeStr[1] != fTimeStr[1] |
328 | | && (fLastTimeStr[1] == ':' || fTimeStr[1] == ':')) |
| 330 | && (fLastTimeStr[1] == ':' || fTimeStr[1] == ':')) |
329 | 331 | || !fLastTimeStr[0]) |
330 | 332 | Update(); |
331 | 333 | |
… |
… |
TTimeView::Update()
|
361 | 363 | GetCurrentTime(); |
362 | 364 | GetCurrentDate(); |
363 | 365 | |
364 | | |
365 | 366 | SetToolTip(fDateStr); |
366 | 367 | |
367 | 368 | ResizeToPreferred(); |
-
diff --git a/src/apps/deskbar/TimeView.h b/src/apps/deskbar/TimeView.h
index 6034fb0..f71c052 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | #ifndef TIME_VIEW_H |
… |
… |
class TTimeView : public BView {
|
73 | 74 | void MouseDown(BPoint where); |
74 | 75 | void Pulse(); |
75 | 76 | |
76 | | bool ShowingSeconds() { return fShowSeconds; } |
| 77 | bool ShowingSeconds() { return fShowSeconds; } |
77 | 78 | void ShowSeconds(bool); |
78 | 79 | void ShowCalendar(BPoint where); |
79 | 80 | |
… |
… |
class TTimeView : public BView {
|
110 | 111 | |
111 | 112 | float fMaxWidth; |
112 | 113 | float fHeight; |
113 | | bool fOrientation; // vertical = true |
| 114 | bool fOrientation; // vertical = true |
114 | 115 | BPoint fTimeLocation; |
115 | 116 | BPoint fDateLocation; |
116 | 117 | |
-
diff --git a/src/apps/deskbar/WindowMenu.cpp b/src/apps/deskbar/WindowMenu.cpp
index 895b890..59e31fc 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
void
|
88 | 89 | TWindowMenu::AttachedToWindow() |
89 | 90 | { |
90 | 91 | SetFont(be_plain_font); |
91 | | |
92 | 92 | RemoveItems(0, CountItems(), true); |
93 | | |
94 | 93 | int32 miniCount = 0; |
95 | 94 | |
96 | 95 | bool dragging = false; |
97 | 96 | TBarView* barview =(static_cast<TBarApp*>(be_app))->BarView(); |
98 | 97 | if (barview && barview->LockLooper()) { |
99 | | // 'dragging' mode set in BarView::CacheDragData |
100 | | // invoke in MouseEnter in ExpandoMenuBar |
| 98 | // 'dragging' mode set in BarView::CacheDragData |
| 99 | // invoke in MouseEnter in ExpandoMenuBar |
101 | 100 | dragging = barview->Dragging(); |
102 | 101 | if (dragging) { |
103 | 102 | // We don't want to show the menu when dragging, but it's not |
… |
… |
TWindowMenu::AttachedToWindow()
|
105 | 104 | // Don't call BMenu::Hide(), it causes the menu to pop up every now |
106 | 105 | // and then. |
107 | 106 | Window()->Hide(); |
108 | | // if in expando (horizontal or vertical) |
| 107 | // if in expando (horizontal or vertical) |
109 | 108 | if (barview->Expando()) { |
110 | 109 | SetTrackingHook(barview->MenuTrackingHook, |
111 | 110 | barview->GetTrackingHookData()); |
… |
… |
TWindowMenu::AttachedToWindow()
|
177 | 176 | |
178 | 177 | int32 itemCount = CountItems() + parentMenuItems; |
179 | 178 | if (itemCount < 1) { |
180 | | TWindowMenuItem* noWindowsItem = |
181 | | new TWindowMenuItem(B_TRANSLATE("No windows"), -1, false, false); |
| 179 | TWindowMenuItem* noWindowsItem |
| 180 | = new TWindowMenuItem(B_TRANSLATE("No windows"), -1, false, false); |
182 | 181 | |
183 | 182 | noWindowsItem->SetEnabled(false); |
184 | 183 | |
… |
… |
TWindowMenu::AttachedToWindow()
|
186 | 185 | |
187 | 186 | // if an application has no windows, this feature makes it easy to quit |
188 | 187 | // it. (but we only add this option if the application is not Tracker.) |
189 | | if (fApplicationSignature.ICompare(kTrackerSignature) != 0) { |
| 188 | if (fApplicationSignature.ICompare(kTrackerSignature) != 0) { |
190 | 189 | AddSeparatorItem(); |
191 | 190 | AddItem(new TShowHideMenuItem(B_TRANSLATE("Quit application"), |
192 | 191 | fTeam, B_QUIT_REQUESTED)); |
193 | | } |
| 192 | } |
194 | 193 | } else { |
195 | | // if we are in drag mode, then don't add the window controls |
196 | | // to the menu |
| 194 | // if we are in drag mode, then don't add the window controls |
| 195 | // to the menu |
197 | 196 | if (!dragging) { |
198 | | TShowHideMenuItem* hide = |
199 | | new TShowHideMenuItem(B_TRANSLATE("Hide all"), fTeam, |
| 197 | TShowHideMenuItem* hide |
| 198 | = new TShowHideMenuItem(B_TRANSLATE("Hide all"), fTeam, |
200 | 199 | B_MINIMIZE_WINDOW); |
201 | | TShowHideMenuItem* show = |
202 | | new TShowHideMenuItem(B_TRANSLATE("Show all"), fTeam, |
| 200 | TShowHideMenuItem* show |
| 201 | = new TShowHideMenuItem(B_TRANSLATE("Show all"), fTeam, |
203 | 202 | B_BRING_TO_FRONT); |
204 | | TShowHideMenuItem* close = |
205 | | new TShowHideMenuItem(B_TRANSLATE("Close all"), fTeam, |
| 203 | TShowHideMenuItem* close |
| 204 | = new TShowHideMenuItem(B_TRANSLATE("Close all"), fTeam, |
206 | 205 | B_QUIT_REQUESTED); |
207 | 206 | |
208 | 207 | if (miniCount == itemCount) |
… |
… |
TWindowMenu::AttachedToWindow()
|
212 | 211 | |
213 | 212 | if (!parentMenuItems) |
214 | 213 | AddSeparatorItem(); |
| 214 | |
215 | 215 | AddItem(hide); |
216 | 216 | AddItem(show); |
217 | 217 | AddItem(close); |
… |
… |
TWindowMenu::AttachedToWindow()
|
225 | 225 | void |
226 | 226 | TWindowMenu::DetachedFromWindow() |
227 | 227 | { |
228 | | // in expando mode the teammenu will not call DragStop, |
229 | | // thus, it needs to be called from here |
| 228 | // in expando mode the teammenu will not call DragStop, thus, it needs to |
| 229 | // be called from here |
230 | 230 | TBarView* barview = (dynamic_cast<TBarApp*>(be_app))->BarView(); |
231 | 231 | if (barview && barview->Expando() && barview->Dragging() |
232 | 232 | && barview->LockLooper()) { |
233 | | // We changed the show level in AttachedToWindow(). Undo it. |
| 233 | // We changed the show level in AttachedToWindow(). Undo it. |
234 | 234 | Window()->Show(); |
235 | 235 | barview->DragStop(); |
236 | 236 | barview->UnlockLooper(); |
-
diff --git a/src/apps/deskbar/WindowMenu.h b/src/apps/deskbar/WindowMenu.h
index 108f688..4204c07 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
35 | | // list of windows for a specific application |
36 | | // always submenu for a TeamMenuItem |
37 | | // all DB positions |
| 36 | // list of windows for a specific application |
| 37 | // always submenu for a TeamMenuItem |
| 38 | // all DB positions |
38 | 39 | |
39 | 40 | #ifndef WINDOWMENU_H |
40 | 41 | #define WINDOWMENU_H |
-
diff --git a/src/apps/deskbar/WindowMenuItem.cpp b/src/apps/deskbar/WindowMenuItem.cpp
index ddf94f4..3e23585 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | |
… |
… |
All rights reserved.
|
48 | 49 | #include "WindowMenu.h" |
49 | 50 | |
50 | 51 | |
51 | | const float kHPad = 10.0f; |
52 | | const float kVPad = 2.0f; |
53 | | const float kLabelOffset = 8.0f; |
54 | | const BRect kIconRect(1.0f, 1.0f, 13.0f, 14.0f); |
| 52 | const float kHPad = 10.0f; |
| 53 | const float kVPad = 2.0f; |
| 54 | const float kLabelOffset = 8.0f; |
| 55 | const BRect kIconRect(1.0f, 1.0f, 13.0f, 14.0f); |
55 | 56 | |
56 | 57 | |
57 | 58 | TWindowMenuItem::TWindowMenuItem(const char* title, int32 id, bool mini, |
… |
… |
void
|
75 | 76 | TWindowMenuItem::Initialize(const char* title) |
76 | 77 | { |
77 | 78 | if (fMini) { |
78 | | fBitmap = fCurrentWorkSpace |
| 79 | fBitmap = fCurrentWorkSpace |
79 | 80 | ? AppResSet()->FindBitmap(B_MESSAGE_TYPE, R_WindowHiddenIcon) |
80 | 81 | : AppResSet()->FindBitmap(B_MESSAGE_TYPE, R_WindowHiddenSwitchIcon); |
81 | 82 | } else { |
82 | | fBitmap = fCurrentWorkSpace |
| 83 | fBitmap = fCurrentWorkSpace |
83 | 84 | ? AppResSet()->FindBitmap(B_MESSAGE_TYPE, R_WindowShownIcon) |
84 | 85 | : AppResSet()->FindBitmap(B_MESSAGE_TYPE, R_WindowShownSwitchIcon); |
85 | 86 | } |
… |
… |
TWindowMenuItem::Draw()
|
204 | 205 | |
205 | 206 | menu->PushState(); |
206 | 207 | |
207 | | // if not selected or being tracked on, fill with gray |
| 208 | // if not selected or being tracked on, fill with gray |
208 | 209 | TBarView* barview = (static_cast<TBarApp*>(be_app))->BarView(); |
209 | 210 | if ((!IsSelected() && !menu->IsRedrawAfterSticky()) |
210 | 211 | || barview->Dragging() || !IsEnabled()) { |
… |
… |
TWindowMenuItem::DrawContent()
|
241 | 242 | |
242 | 243 | BRect frame(Frame()); |
243 | 244 | BPoint contLoc = ContentLocation() + BPoint(kHPad, kVPad); |
244 | | // if (fExpanded) |
245 | | // contLoc.x += kHPad; |
| 245 | //if (fExpanded) |
| 246 | // contLoc.x += kHPad; |
246 | 247 | |
247 | 248 | if (fID >= 0) { |
248 | 249 | menu->SetDrawingMode(B_OP_OVER); |
-
diff --git a/src/apps/deskbar/WindowMenuItem.h b/src/apps/deskbar/WindowMenuItem.h
index bfe14da..d777b73 100644
a
|
b
|
Except as contained in this notice, the name of Be Incorporated shall not be
|
26 | 26 | used in advertising or otherwise to promote the sale, use or other dealings in |
27 | 27 | this Software without prior written authorization from Be Incorporated. |
28 | 28 | |
29 | | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks |
30 | | of Be Incorporated in the United States and other countries. Other brand product |
31 | | names are registered trademarks or trademarks of their respective holders. |
| 29 | Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered |
| 30 | trademarks of Be Incorporated in the United States and other countries. Other |
| 31 | brand product names are registered trademarks or trademarks of their respective |
| 32 | holders. |
32 | 33 | All rights reserved. |
33 | 34 | */ |
34 | 35 | #ifndef WINDOWMENUITEM_H |
… |
… |
public:
|
69 | 70 | |
70 | 71 | protected: |
71 | 72 | void Initialize(const char* title); |
72 | | virtual void GetContentSize(float* width, float* height); |
| 73 | virtual void GetContentSize(float* width, float* height); |
73 | 74 | virtual void DrawContent(); |
74 | 75 | virtual status_t Invoke(BMessage* message = NULL); |
75 | 76 | virtual void Draw(); |
… |
… |
private:
|
91 | 92 | |
92 | 93 | |
93 | 94 | #endif /* WINDOWMENUITEM_H */ |
| 95 | |