Add context menu item to delete a point-coincident constraint,
which can't be selected with the mouse and would otherwise have to get deleted by selecting it in the text window. [git-p4: depot-paths = "//depot/solvespace/": change = 2065]
This commit is contained in:
parent
b9ab62ab3f
commit
2ae9983f9e
38
mouse.cpp
38
mouse.cpp
|
@ -460,6 +460,24 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
|
||||||
CMNU_OTHER_ANGLE);
|
CMNU_OTHER_ANGLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(hover.entity.v) {
|
||||||
|
Entity *p = SK.GetEntity(hover.entity);
|
||||||
|
if(p->IsPoint()) {
|
||||||
|
Constraint *c;
|
||||||
|
IdList<Constraint,hConstraint> *lc = &(SK.constraint);
|
||||||
|
for(c = lc->First(); c; c = lc->NextAfter(c)) {
|
||||||
|
if(c->type != Constraint::POINTS_COINCIDENT) continue;
|
||||||
|
if(c->ptA.v == p->h.v || c->ptB.v == p->h.v) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(c) {
|
||||||
|
AddContextMenuItem(
|
||||||
|
"Hovered: Delete Point-Coincident Constraint",
|
||||||
|
CMNU_DEL_COINCIDENT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if(hover.HasEndpoints()) {
|
if(hover.HasEndpoints()) {
|
||||||
AddContextMenuItem("Hovered: Select Edge Chain", CMNU_SELECT_CHAIN);
|
AddContextMenuItem("Hovered: Select Edge Chain", CMNU_SELECT_CHAIN);
|
||||||
}
|
}
|
||||||
|
@ -495,7 +513,7 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = ShowContextMenu();
|
int ret = ShowContextMenu();
|
||||||
if(ret != 0 && selEmpty) {
|
if(ret != 0 && ret != CMNU_DEL_COINCIDENT && selEmpty) {
|
||||||
ToggleSelectionStateOf(&hover);
|
ToggleSelectionStateOf(&hover);
|
||||||
}
|
}
|
||||||
switch(ret) {
|
switch(ret) {
|
||||||
|
@ -519,6 +537,24 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
|
||||||
Constraint::MenuConstrain(MNU_OTHER_ANGLE);
|
Constraint::MenuConstrain(MNU_OTHER_ANGLE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CMNU_DEL_COINCIDENT: {
|
||||||
|
SS.UndoRemember();
|
||||||
|
if(!hover.entity.v) break;
|
||||||
|
Entity *p = SK.GetEntity(hover.entity);
|
||||||
|
if(!p->IsPoint()) break;
|
||||||
|
|
||||||
|
SK.constraint.ClearTags();
|
||||||
|
Constraint *c;
|
||||||
|
for(c = SK.constraint.First(); c; c = SK.constraint.NextAfter(c)) {
|
||||||
|
if(c->type != Constraint::POINTS_COINCIDENT) continue;
|
||||||
|
if(c->ptA.v == p->h.v || c->ptB.v == p->h.v) {
|
||||||
|
c->tag = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SK.constraint.RemoveTagged();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case CMNU_SNAP_TO_GRID:
|
case CMNU_SNAP_TO_GRID:
|
||||||
MenuEdit(MNU_SNAP_TO_GRID);
|
MenuEdit(MNU_SNAP_TO_GRID);
|
||||||
break;
|
break;
|
||||||
|
|
15
ui.h
15
ui.h
|
@ -454,13 +454,14 @@ public:
|
||||||
void ToggleSelectionStateOf(Selection *s);
|
void ToggleSelectionStateOf(Selection *s);
|
||||||
void ClearSuper(void);
|
void ClearSuper(void);
|
||||||
|
|
||||||
static const int CMNU_UNSELECT_ALL = 0x101;
|
static const int CMNU_UNSELECT_ALL = 0x100;
|
||||||
static const int CMNU_DELETE_SEL = 0x102;
|
static const int CMNU_DELETE_SEL = 0x101;
|
||||||
static const int CMNU_NEW_CUSTOM_STYLE = 0x103;
|
static const int CMNU_NEW_CUSTOM_STYLE = 0x102;
|
||||||
static const int CMNU_NO_STYLE = 0x104;
|
static const int CMNU_NO_STYLE = 0x103;
|
||||||
static const int CMNU_GROUP_INFO = 0x105;
|
static const int CMNU_GROUP_INFO = 0x104;
|
||||||
static const int CMNU_REFERENCE_DIM = 0x106;
|
static const int CMNU_REFERENCE_DIM = 0x105;
|
||||||
static const int CMNU_OTHER_ANGLE = 0x107;
|
static const int CMNU_OTHER_ANGLE = 0x106;
|
||||||
|
static const int CMNU_DEL_COINCIDENT = 0x107;
|
||||||
static const int CMNU_STYLE_INFO = 0x108;
|
static const int CMNU_STYLE_INFO = 0x108;
|
||||||
static const int CMNU_SNAP_TO_GRID = 0x109;
|
static const int CMNU_SNAP_TO_GRID = 0x109;
|
||||||
static const int CMNU_SELECT_CHAIN = 0x10a;
|
static const int CMNU_SELECT_CHAIN = 0x10a;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user