mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-19 19:53:53 +00:00
split virtual select button into two buttons (primary select and seconadry select)
This commit is contained in:
parent
133e04a38e
commit
ad4e0e3b97
6 changed files with 62 additions and 19 deletions
|
@ -399,9 +399,13 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
|
||||||
secondaryEditing->setDeclaredValues (values);
|
secondaryEditing->setDeclaredValues (values);
|
||||||
secondaryEditing->setDefaultValue (cRight);
|
secondaryEditing->setDefaultValue (cRight);
|
||||||
|
|
||||||
Setting *selection = createSetting (Type_ComboBox, "select", "Selection Button");
|
Setting *primarySelection = createSetting (Type_ComboBox, "p-select", "Selection Button");
|
||||||
selection->setDeclaredValues (values);
|
primarySelection->setDeclaredValues (values);
|
||||||
selection->setDefaultValue (middle);
|
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");
|
Setting *contextSensitive = createSetting (Type_CheckBox, "context-select", "Context Sensitive Selection");
|
||||||
contextSensitive->setDefaultValue ("false");
|
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::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)
|
bool CSVRender::EditMode::primaryEditStartDrag (osg::ref_ptr<TagBase> tag)
|
||||||
{
|
{
|
||||||
|
@ -50,7 +52,12 @@ bool CSVRender::EditMode::secondaryEditStartDrag (osg::ref_ptr<TagBase> tag)
|
||||||
return false;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,10 @@ namespace CSVRender
|
||||||
virtual void secondaryEditPressed (osg::ref_ptr<TagBase> tag);
|
virtual void secondaryEditPressed (osg::ref_ptr<TagBase> tag);
|
||||||
|
|
||||||
/// Default-implementation: Ignored.
|
/// 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
|
/// Default-implementation: ignore and return false
|
||||||
///
|
///
|
||||||
|
@ -58,7 +61,12 @@ namespace CSVRender
|
||||||
/// Default-implementation: ignore and return false
|
/// Default-implementation: ignore and return false
|
||||||
///
|
///
|
||||||
/// \return Drag accepted?
|
/// \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
|
/// Default-implementation: ignored
|
||||||
virtual void drag (int diffX, int diffY, double speedFactor);
|
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)
|
void CSVRender::InstanceMode::primaryEditPressed (osg::ref_ptr<TagBase> tag)
|
||||||
{
|
{
|
||||||
if (mContextSelect)
|
if (mContextSelect)
|
||||||
selectPressed (tag);
|
primarySelectPressed (tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVRender::InstanceMode::secondaryEditPressed (osg::ref_ptr<TagBase> tag)
|
void CSVRender::InstanceMode::secondaryEditPressed (osg::ref_ptr<TagBase> tag)
|
||||||
{
|
{
|
||||||
if (mContextSelect)
|
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)
|
if (tag)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,9 @@ namespace CSVRender
|
||||||
|
|
||||||
virtual void secondaryEditPressed (osg::ref_ptr<TagBase> tag);
|
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-navi", "s-navi",
|
||||||
"p-edit", "s-edit",
|
"p-edit", "s-edit",
|
||||||
"select",
|
"p-select", "s-select",
|
||||||
0
|
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);
|
osg::ref_ptr<TagBase> tag = mousePick (event);
|
||||||
|
|
||||||
|
@ -523,8 +523,10 @@ void CSVRender::WorldspaceWidget::mouseMoveEvent (QMouseEvent *event)
|
||||||
mDragging = editMode.primaryEditStartDrag (tag);
|
mDragging = editMode.primaryEditStartDrag (tag);
|
||||||
else if (mDragMode=="s-edit")
|
else if (mDragMode=="s-edit")
|
||||||
mDragging = editMode.secondaryEditStartDrag (tag);
|
mDragging = editMode.secondaryEditStartDrag (tag);
|
||||||
else if (mDragMode=="select")
|
else if (mDragMode=="p-select")
|
||||||
mDragging = editMode.selectStartDrag (tag);
|
mDragging = editMode.primarySelectStartDrag (tag);
|
||||||
|
else if (mDragMode=="s-select")
|
||||||
|
mDragging = editMode.secondarySelectStartDrag (tag);
|
||||||
|
|
||||||
if (mDragging)
|
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());
|
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);
|
osg::ref_ptr<TagBase> tag = mousePick (event);
|
||||||
|
|
||||||
|
@ -647,6 +651,8 @@ void CSVRender::WorldspaceWidget::handleMouseClick (osg::ref_ptr<TagBase> tag, c
|
||||||
editMode.primaryEditPressed (tag);
|
editMode.primaryEditPressed (tag);
|
||||||
else if (button=="s-edit")
|
else if (button=="s-edit")
|
||||||
editMode.secondaryEditPressed (tag);
|
editMode.secondaryEditPressed (tag);
|
||||||
else if (button=="select")
|
else if (button=="p-select")
|
||||||
editMode.selectPressed (tag);
|
editMode.primarySelectPressed (tag);
|
||||||
|
else if (button=="s-select")
|
||||||
|
editMode.secondarySelectPressed (tag);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue