Improved contex menu according to ticket #4081:
* When right-clicking a path point directly, and it isn't currently selected, switch the selection before showing the context menu. * Don't show the "Select All" menu item when directly clicking any path point. * Fix the shortcuts. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31808 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,9 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006-2007, Haiku.
|
* Copyright 2006-2009, Stephan Aßmus <[email protected]>.
|
||||||
* Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Stephan Aßmus <[email protected]>
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "PathManipulator.h"
|
#include "PathManipulator.h"
|
||||||
@@ -528,7 +525,7 @@ PathManipulator::MouseDown(BPoint where)
|
|||||||
_Select(fCurrentPathPoint, appendSelection);
|
_Select(fCurrentPathPoint, appendSelection);
|
||||||
}
|
}
|
||||||
fCanvasView->BeginRectTracking(BRect(where, where),
|
fCanvasView->BeginRectTracking(BRect(where, where),
|
||||||
B_TRACK_RECT_CORNER);
|
B_TRACK_RECT_CORNER);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -753,20 +750,32 @@ PathManipulator::DoubleClicked(BPoint where)
|
|||||||
bool
|
bool
|
||||||
PathManipulator::ShowContextMenu(BPoint where)
|
PathManipulator::ShowContextMenu(BPoint where)
|
||||||
{
|
{
|
||||||
|
// Change the selection to the current point if it isn't currently
|
||||||
|
// selected. This could will only be chosen if the user right-clicked
|
||||||
|
// a path point directly.
|
||||||
|
if (fCurrentPathPoint >= 0 && !fSelection->Contains(fCurrentPathPoint)) {
|
||||||
|
fSelection->MakeEmpty();
|
||||||
|
_UpdateSelection();
|
||||||
|
*fOldSelection = *fSelection;
|
||||||
|
_Select(fCurrentPathPoint, false);
|
||||||
|
}
|
||||||
|
|
||||||
BPopUpMenu* menu = new BPopUpMenu("context menu", false, false);
|
BPopUpMenu* menu = new BPopUpMenu("context menu", false, false);
|
||||||
BMessage* message;
|
BMessage* message;
|
||||||
BMenuItem* item;
|
BMenuItem* item;
|
||||||
|
|
||||||
bool hasSelection = fSelection->CountItems() > 0;
|
bool hasSelection = fSelection->CountItems() > 0;
|
||||||
|
|
||||||
message = new BMessage(B_SELECT_ALL);
|
if (fCurrentPathPoint < 0) {
|
||||||
item = new BMenuItem("Select All", message, 'A');
|
message = new BMessage(B_SELECT_ALL);
|
||||||
menu->AddItem(item);
|
item = new BMenuItem("Select All", message, 'A');
|
||||||
|
menu->AddItem(item);
|
||||||
|
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
|
}
|
||||||
|
|
||||||
message = new BMessage(MSG_TRANSFORM);
|
message = new BMessage(MSG_TRANSFORM);
|
||||||
item = new BMenuItem("Transform", message);
|
item = new BMenuItem("Transform", message, 'T');
|
||||||
item->SetEnabled(hasSelection);
|
item->SetEnabled(hasSelection);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
|
|
||||||
@@ -781,7 +790,7 @@ PathManipulator::ShowContextMenu(BPoint where)
|
|||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
|
|
||||||
message = new BMessage(MSG_REMOVE_POINTS);
|
message = new BMessage(MSG_REMOVE_POINTS);
|
||||||
item = new BMenuItem("Remove", message, 'A');
|
item = new BMenuItem("Remove", message);
|
||||||
item->SetEnabled(hasSelection);
|
item->SetEnabled(hasSelection);
|
||||||
menu->AddItem(item);
|
menu->AddItem(item);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user