split virtual select button into two buttons (primary select and seconadry select)

pull/793/head
Marc Zinnschlag 9 years ago
parent 133e04a38e
commit ad4e0e3b97

@ -399,9 +399,13 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
secondaryEditing->setDeclaredValues (values);
secondaryEditing->setDefaultValue (cRight);
Setting *selection = createSetting (Type_ComboBox, "select", "Selection Button");
selection->setDeclaredValues (values);
selection->setDefaultValue (middle);
Setting *primarySelection = createSetting (Type_ComboBox, "p-select", "Selection Button");
primarySelection->setDeclaredValues (values);
primarySelection->setDefaultValue (middle);
Setting *secondarySelection = createSetting (Type_ComboBox, "s-select", "Selection Button");
secondarySelection->setDeclaredValues (values);
secondarySelection->setDefaultValue (cMiddle);
Setting *contextSensitive = createSetting (Type_CheckBox, "context-select", "Context Sensitive Selection");
contextSensitive->setDefaultValue ("false");

@ -38,7 +38,9 @@ void CSVRender::EditMode::primaryEditPressed (osg::ref_ptr<TagBase> tag) {}
void CSVRender::EditMode::secondaryEditPressed (osg::ref_ptr<TagBase> tag) {}
void CSVRender::EditMode::selectPressed (osg::ref_ptr<TagBase> tag) {}
void CSVRender::EditMode::primarySelectPressed (osg::ref_ptr<TagBase> tag) {}
void CSVRender::EditMode::secondarySelectPressed (osg::ref_ptr<TagBase> tag) {}
bool CSVRender::EditMode::primaryEditStartDrag (osg::ref_ptr<TagBase> tag)
{
@ -50,7 +52,12 @@ bool CSVRender::EditMode::secondaryEditStartDrag (osg::ref_ptr<TagBase> tag)
return false;
}
bool CSVRender::EditMode::selectStartDrag (osg::ref_ptr<TagBase> tag)
bool CSVRender::EditMode::primarySelectStartDrag (osg::ref_ptr<TagBase> tag)
{
return false;
}
bool CSVRender::EditMode::secondarySelectStartDrag (osg::ref_ptr<TagBase> tag)
{
return false;
}

@ -43,7 +43,10 @@ namespace CSVRender
virtual void secondaryEditPressed (osg::ref_ptr<TagBase> tag);
/// Default-implementation: Ignored.
virtual void selectPressed (osg::ref_ptr<TagBase> tag);
virtual void primarySelectPressed (osg::ref_ptr<TagBase> tag);
/// Default-implementation: Ignored.
virtual void secondarySelectPressed (osg::ref_ptr<TagBase> tag);
/// Default-implementation: ignore and return false
///
@ -58,7 +61,12 @@ namespace CSVRender
/// Default-implementation: ignore and return false
///
/// \return Drag accepted?
virtual bool selectStartDrag (osg::ref_ptr<TagBase> tag);
virtual bool primarySelectStartDrag (osg::ref_ptr<TagBase> tag);
/// Default-implementation: ignore and return false
///
/// \return Drag accepted?
virtual bool secondarySelectStartDrag (osg::ref_ptr<TagBase> tag);
/// Default-implementation: ignored
virtual void drag (int diffX, int diffY, double speedFactor);

@ -30,16 +30,32 @@ void CSVRender::InstanceMode::updateUserSetting (const QString& name, const QStr
void CSVRender::InstanceMode::primaryEditPressed (osg::ref_ptr<TagBase> tag)
{
if (mContextSelect)
selectPressed (tag);
primarySelectPressed (tag);
}
void CSVRender::InstanceMode::secondaryEditPressed (osg::ref_ptr<TagBase> tag)
{
if (mContextSelect)
selectPressed (tag);
secondarySelectPressed (tag);
}
void CSVRender::InstanceMode::selectPressed (osg::ref_ptr<TagBase> tag)
void CSVRender::InstanceMode::primarySelectPressed (osg::ref_ptr<TagBase> tag)
{
if (tag)
{
if (CSVRender::ObjectTag *objectTag = dynamic_cast<CSVRender::ObjectTag *> (tag.get()))
{
// hit an Object, toggle its selection state
CSVRender::Object* object = objectTag->mObject;
object->setSelected (!object->getSelected());
return;
}
}
getWorldspaceWidget().clearSelection (Element_Reference);
}
void CSVRender::InstanceMode::secondarySelectPressed (osg::ref_ptr<TagBase> tag)
{
if (tag)
{

@ -23,7 +23,9 @@ namespace CSVRender
virtual void secondaryEditPressed (osg::ref_ptr<TagBase> tag);
virtual void selectPressed (osg::ref_ptr<TagBase> tag);
virtual void primarySelectPressed (osg::ref_ptr<TagBase> tag);
virtual void secondarySelectPressed (osg::ref_ptr<TagBase> tag);
};
}

@ -36,7 +36,7 @@ namespace
{
"p-navi", "s-navi",
"p-edit", "s-edit",
"select",
"p-select", "s-select",
0
};
}
@ -513,7 +513,7 @@ void CSVRender::WorldspaceWidget::mouseMoveEvent (QMouseEvent *event)
{
}
else if (mDragMode=="p-edit" || mDragMode=="s-edit" || mDragMode=="select")
else if (mDragMode=="p-edit" || mDragMode=="s-edit" || mDragMode=="p-select" || mDragMode=="s-select")
{
osg::ref_ptr<TagBase> tag = mousePick (event);
@ -523,8 +523,10 @@ void CSVRender::WorldspaceWidget::mouseMoveEvent (QMouseEvent *event)
mDragging = editMode.primaryEditStartDrag (tag);
else if (mDragMode=="s-edit")
mDragging = editMode.secondaryEditStartDrag (tag);
else if (mDragMode=="select")
mDragging = editMode.selectStartDrag (tag);
else if (mDragMode=="p-select")
mDragging = editMode.primarySelectStartDrag (tag);
else if (mDragMode=="s-select")
mDragging = editMode.secondarySelectStartDrag (tag);
if (mDragging)
{
@ -575,7 +577,8 @@ void CSVRender::WorldspaceWidget::mouseReleaseEvent (QMouseEvent *event)
{
}
else if (mDragMode=="p-edit" || mDragMode=="s-edit" || mDragMode=="select")
else if (mDragMode=="p-edit" || mDragMode=="s-edit" ||
mDragMode=="p-select" || mDragMode=="s-select")
{
EditMode& editMode = dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent());
@ -589,7 +592,8 @@ void CSVRender::WorldspaceWidget::mouseReleaseEvent (QMouseEvent *event)
{
}
else if (button=="p-edit" || button=="s-edit" || button=="select")
else if (button=="p-edit" || button=="s-edit" ||
button=="p-select" || button=="s-select")
{
osg::ref_ptr<TagBase> tag = mousePick (event);
@ -647,6 +651,8 @@ void CSVRender::WorldspaceWidget::handleMouseClick (osg::ref_ptr<TagBase> tag, c
editMode.primaryEditPressed (tag);
else if (button=="s-edit")
editMode.secondaryEditPressed (tag);
else if (button=="select")
editMode.selectPressed (tag);
else if (button=="p-select")
editMode.primarySelectPressed (tag);
else if (button=="s-select")
editMode.secondarySelectPressed (tag);
}

Loading…
Cancel
Save