diff --git a/src/apps/workspaces/Workspaces.cpp b/src/apps/workspaces/Workspaces.cpp
index e3415d0..14fa340 100644
a
|
b
|
|
14 | 14 | #include <Alert.h> |
15 | 15 | #include <Application.h> |
16 | 16 | #include <Catalog.h> |
| 17 | #include <Deskbar.h> |
17 | 18 | #include <Dragger.h> |
18 | 19 | #include <Entry.h> |
19 | 20 | #include <File.h> |
… |
… |
|
40 | 41 | #define B_TRANSLATE_CONTEXT "Workspaces" |
41 | 42 | |
42 | 43 | |
| 44 | static const char* kDeskbarItemName = "workspaces"; |
43 | 45 | static const char* kSignature = "application/x-vnd.Be-WORK"; |
| 46 | static const char* kDeskbarSignature = "application/x-vnd.Be-TSKB"; |
44 | 47 | static const char* kScreenPrefletSignature = "application/x-vnd.Haiku-Screen"; |
45 | 48 | static const char* kOldSettingFile = "Workspace_data"; |
46 | 49 | static const char* kSettingsFile = "Workspaces_settings"; |
… |
… |
static const uint32 kMsgToggleTitle = 'tgTt';
|
50 | 53 | static const uint32 kMsgToggleBorder = 'tgBd'; |
51 | 54 | static const uint32 kMsgToggleAutoRaise = 'tgAR'; |
52 | 55 | static const uint32 kMsgToggleAlwaysOnTop = 'tgAT'; |
| 56 | static const uint32 kMsgToggleLiveInDeskbar = 'tgDb'; |
53 | 57 | |
54 | 58 | static const float kScreenBorderOffset = 10.0; |
55 | 59 | |
| 60 | extern "C" _EXPORT BView* instantiate_deskbar_item(); |
56 | 61 | |
57 | 62 | class WorkspacesSettings { |
58 | 63 | public: |
… |
… |
class WorkspacesSettings {
|
89 | 94 | |
90 | 95 | class WorkspacesView : public BView { |
91 | 96 | public: |
92 | | WorkspacesView(BRect frame); |
| 97 | WorkspacesView(BRect frame, bool showDragger); |
93 | 98 | WorkspacesView(BMessage* archive); |
94 | 99 | ~WorkspacesView(); |
95 | 100 | |
… |
… |
WorkspacesSettings::SetWindowFrame(BRect frame)
|
331 | 336 | // #pragma mark - |
332 | 337 | |
333 | 338 | |
334 | | WorkspacesView::WorkspacesView(BRect frame) |
| 339 | WorkspacesView::WorkspacesView(BRect frame, bool showDragger=true) |
335 | 340 | : |
336 | | BView(frame, "workspaces", B_FOLLOW_ALL, |
| 341 | BView(frame, kDeskbarItemName, B_FOLLOW_ALL, |
337 | 342 | kWorkspacesViewFlag | B_FRAME_EVENTS), |
338 | 343 | fParentWhichDrawsOnChildren(NULL), |
339 | 344 | fCurrentFrame(frame) |
340 | 345 | { |
341 | | frame.OffsetTo(B_ORIGIN); |
342 | | frame.top = frame.bottom - 7; |
343 | | frame.left = frame.right - 7; |
344 | | BDragger* dragger = new BDragger(frame, this, |
345 | | B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); |
346 | | AddChild(dragger); |
| 346 | if(showDragger) { |
| 347 | frame.OffsetTo(B_ORIGIN); |
| 348 | frame.top = frame.bottom - 7; |
| 349 | frame.left = frame.right - 7; |
| 350 | BDragger* dragger = new BDragger(frame, this, |
| 351 | B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); |
| 352 | AddChild(dragger); |
| 353 | } |
347 | 354 | } |
348 | 355 | |
349 | 356 | |
… |
… |
WorkspacesView::MouseDown(BPoint where)
|
576 | 583 | new BMessage(kMsgToggleAutoRaise))); |
577 | 584 | if (window->IsAutoRaising()) |
578 | 585 | item->SetMarked(true); |
| 586 | if (be_roster->IsRunning(kDeskbarSignature)) { |
| 587 | menu->AddItem(item = new BMenuItem(B_TRANSLATE("Live in the Deskbar"), |
| 588 | new BMessage(kMsgToggleLiveInDeskbar))); |
| 589 | BDeskbar deskbar; |
| 590 | item->SetMarked(deskbar.HasItem(kDeskbarItemName)); |
| 591 | } |
579 | 592 | |
580 | 593 | menu->AddSeparatorItem(); |
581 | 594 | menu->AddItem(new BMenuItem(B_TRANSLATE("About Workspaces" |
… |
… |
WorkspacesWindow::MessageReceived(BMessage *message)
|
772 | 785 | fSettings->SetAlwaysOnTop(enable); |
773 | 786 | break; |
774 | 787 | } |
| 788 | |
| 789 | case kMsgToggleLiveInDeskbar: |
| 790 | { |
| 791 | BDeskbar deskbar; |
| 792 | if (deskbar.HasItem (kDeskbarItemName)) |
| 793 | deskbar.RemoveItem (kDeskbarItemName); |
| 794 | else { |
| 795 | entry_ref ref; |
| 796 | be_roster->FindApp(kSignature, &ref); |
| 797 | deskbar.AddItem(&ref); |
| 798 | } |
| 799 | break; |
| 800 | } |
775 | 801 | |
776 | 802 | default: |
777 | 803 | BWindow::MessageReceived(message); |
… |
… |
WorkspacesApp::ArgvReceived(int32 argc, char **argv)
|
904 | 930 | } |
905 | 931 | |
906 | 932 | |
| 933 | BView* instantiate_deskbar_item() |
| 934 | { |
| 935 | return new WorkspacesView(BRect (0, 0, 75, 15), false); |
| 936 | } |
| 937 | |
| 938 | |
907 | 939 | void |
908 | 940 | WorkspacesApp::ReadyToRun() |
909 | 941 | { |