Patch by Obaro Ogbo (nastee) with small changes by myself:

* Added "Close All in Workspace" menu item in the Window menu. The shortcut
  is 'Q', which is usually the Quit shortcut. Since Tracker prevents quitting
  via this shortcut, overriding it like this is ok, this was also discussed
  in the ticket #2833. I've tested that the existing functionality is not
  disturbed (ie Quit in the Settings panel still works, as does quitting
  Tracker via "hey Tracker quit"). I did not add the "Close All" menu item,
  since that feature is already available via DeskBar and when pressing the
  shift key before opening the Window menu.
* I did change the additional short cut. As with "Clean Up" versus "Cleanup Up
  All", it's now consistently the shift key, which you have to press.

Note to Obaro: The only other change was that one can set the target of the
menu item to be "be_app", that way one avoids dispatching the message in the
window. Thanks a lot for your work, Obaro!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30205 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2009-04-16 19:32:11 +00:00
parent 78e7cdaede
commit 5e71c7b1e5
4 changed files with 37 additions and 7 deletions

View File

@ -50,6 +50,7 @@ const uint32 kOpenSelection = 'Tosl';
const uint32 kOpenSelectionWith = 'Tosu';
const uint32 kCloseAllWindows = 'Tall';
const uint32 kCloseWindowAndChildren = 'Tcwc';
const uint32 kCloseAllInWorkspace = 'Tciw';
// end external app messages

View File

@ -1784,9 +1784,9 @@ BContainerWindow::SetCloseItem(BMenu *menu)
&& (item = menu->FindItem(kCloseAllWindows)) == NULL)
return;
if (modifiers() & B_OPTION_KEY) {
if (modifiers() & B_SHIFT_KEY) {
item->SetLabel("Close All");
item->SetShortcut('W', B_COMMAND_KEY | B_OPTION_KEY);
item->SetShortcut('W', B_COMMAND_KEY | B_SHIFT_KEY);
item->SetTarget(be_app);
item->SetMessage(new BMessage(kCloseAllWindows));
} else {
@ -1970,8 +1970,8 @@ BContainerWindow::AddWindowMenu(BMenu *menu)
item->SetTarget(PoseView());
menu->AddItem(item);
item = new BMenuItem("Select"B_UTF8_ELLIPSIS, new BMessage(kShowSelectionWindow),
'A', B_SHIFT_KEY);
item = new BMenuItem("Select"B_UTF8_ELLIPSIS,
new BMessage(kShowSelectionWindow), 'A', B_SHIFT_KEY);
item->SetTarget(PoseView());
menu->AddItem(item);
@ -1979,7 +1979,8 @@ BContainerWindow::AddWindowMenu(BMenu *menu)
item->SetTarget(PoseView());
menu->AddItem(item);
item = new BMenuItem("Invert Selection", new BMessage(kInvertSelection), 'S');
item = new BMenuItem("Invert Selection", new BMessage(kInvertSelection),
'S');
item->SetTarget(PoseView());
menu->AddItem(item);
@ -1994,9 +1995,15 @@ BContainerWindow::AddWindowMenu(BMenu *menu)
item->SetTarget(this);
menu->AddItem(item);
item = new BMenuItem("Close All in Workspace",
new BMessage(kCloseAllInWorkspace), 'Q');
item->SetTarget(be_app);
menu->AddItem(item);
menu->AddSeparatorItem();
item = new BMenuItem("Preferences"B_UTF8_ELLIPSIS, new BMessage(kShowSettingsWindow));
item = new BMenuItem("Preferences"B_UTF8_ELLIPSIS,
new BMessage(kShowSettingsWindow));
item->SetTarget(be_app);
menu->AddItem(item);
}

View File

@ -402,6 +402,10 @@ TTracker::MessageReceived(BMessage *message)
CloseAllWindows();
break;
case kCloseAllInWorkspace:
CloseAllInWorkspace();
break;
case kFindButton:
(new FindWindow())->Show();
break;
@ -854,7 +858,6 @@ TTracker::ArgvReceived(int32 argc, char **argv)
}
}
void
TTracker::OpenContainerWindow(Model *model, BMessage *originalRefsList,
OpenSelector openSelector, uint32 openFlags, bool checkAlreadyOpen,
@ -1189,6 +1192,24 @@ TTracker::CloseWindowAndChildren(const node_ref *node)
}
void
TTracker::CloseAllInWorkspace()
{
AutoLock<WindowList> lock(&fWindowList);
int32 currentWorkspace = 1 << current_workspace();
// count from end to beginning so we can remove items safely
for (int32 index = fWindowList.CountItems() - 1; index >= 0; index--) {
BWindow *window = fWindowList.ItemAt(index);
if (window->Workspaces() & currentWorkspace)
// avoid the desktop
if (!dynamic_cast<BDeskWindow *>(window)
&& !dynamic_cast<BStatusWindow *>(window))
window->PostMessage(B_QUIT_REQUESTED);
}
}
void
TTracker::CloseAllWindows()
{

View File

@ -192,6 +192,7 @@ class TTracker : public BApplication {
void CloseAllWindows();
void CloseWindowAndChildren(const node_ref *);
void CloseAllInWorkspace();
void OpenInfoWindows(BMessage*);
void MoveRefsToTrash(const BMessage *);
void OpenContainerWindow(Model *, BMessage *refsList = NULL,