forked from mirror/openmw-tes3mp
Make scene controls use configurable speed modifier.
This commit is contained in:
parent
bf2ab4ed45
commit
f73d60cc73
2 changed files with 16 additions and 3 deletions
|
@ -44,6 +44,7 @@ CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidg
|
||||||
, mDragging (false)
|
, mDragging (false)
|
||||||
, mDragX(0)
|
, mDragX(0)
|
||||||
, mDragY(0)
|
, mDragY(0)
|
||||||
|
, mSpeedMode(false)
|
||||||
, mDragFactor(0)
|
, mDragFactor(0)
|
||||||
, mDragWheelFactor(0)
|
, mDragWheelFactor(0)
|
||||||
, mDragShiftFactor(0)
|
, mDragShiftFactor(0)
|
||||||
|
@ -97,8 +98,10 @@ CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidg
|
||||||
CSMPrefs::get()["Tooltips"].update();
|
CSMPrefs::get()["Tooltips"].update();
|
||||||
|
|
||||||
// Shortcuts
|
// Shortcuts
|
||||||
CSMPrefs::Shortcut* primaryEditShortcut = new CSMPrefs::Shortcut("scene-edit-primary", this);
|
CSMPrefs::Shortcut* primaryEditShortcut = new CSMPrefs::Shortcut("scene-edit-primary", "scene-speed-modifier",
|
||||||
|
CSMPrefs::Shortcut::SM_Detach, this);
|
||||||
connect(primaryEditShortcut, SIGNAL(activated(bool)), this, SLOT(primaryEdit(bool)));
|
connect(primaryEditShortcut, SIGNAL(activated(bool)), this, SLOT(primaryEdit(bool)));
|
||||||
|
connect(primaryEditShortcut, SIGNAL(secondary(bool)), this, SLOT(speedMode(bool)));
|
||||||
|
|
||||||
CSMPrefs::Shortcut* secondaryEditShortcut = new CSMPrefs::Shortcut("scene-edit-secondary", this);
|
CSMPrefs::Shortcut* secondaryEditShortcut = new CSMPrefs::Shortcut("scene-edit-secondary", this);
|
||||||
connect(secondaryEditShortcut, SIGNAL(activated(bool)), this, SLOT(secondaryEdit(bool)));
|
connect(secondaryEditShortcut, SIGNAL(activated(bool)), this, SLOT(secondaryEdit(bool)));
|
||||||
|
@ -602,7 +605,7 @@ void CSVRender::WorldspaceWidget::mouseMoveEvent (QMouseEvent *event)
|
||||||
|
|
||||||
double factor = mDragFactor;
|
double factor = mDragFactor;
|
||||||
|
|
||||||
if (event->modifiers() & Qt::ShiftModifier)
|
if (mSpeedMode)
|
||||||
factor *= mDragShiftFactor;
|
factor *= mDragShiftFactor;
|
||||||
|
|
||||||
EditMode& editMode = dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent());
|
EditMode& editMode = dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent());
|
||||||
|
@ -656,7 +659,7 @@ void CSVRender::WorldspaceWidget::wheelEvent (QWheelEvent *event)
|
||||||
{
|
{
|
||||||
double factor = mDragWheelFactor;
|
double factor = mDragWheelFactor;
|
||||||
|
|
||||||
if (event->modifiers() & Qt::ShiftModifier)
|
if (mSpeedMode)
|
||||||
factor *= mDragShiftFactor;
|
factor *= mDragShiftFactor;
|
||||||
|
|
||||||
EditMode& editMode = dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent());
|
EditMode& editMode = dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent());
|
||||||
|
@ -706,6 +709,11 @@ void CSVRender::WorldspaceWidget::secondarySelect(bool activate)
|
||||||
handleInteraction(InteractionType_SecondarySelect, activate);
|
handleInteraction(InteractionType_SecondarySelect, activate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVRender::WorldspaceWidget::speedMode(bool activate)
|
||||||
|
{
|
||||||
|
mSpeedMode = activate;
|
||||||
|
}
|
||||||
|
|
||||||
void CSVRender::WorldspaceWidget::handleInteraction(InteractionType type, bool activate)
|
void CSVRender::WorldspaceWidget::handleInteraction(InteractionType type, bool activate)
|
||||||
{
|
{
|
||||||
if (activate)
|
if (activate)
|
||||||
|
|
|
@ -59,6 +59,7 @@ namespace CSVRender
|
||||||
bool mDragging;
|
bool mDragging;
|
||||||
int mDragX;
|
int mDragX;
|
||||||
int mDragY;
|
int mDragY;
|
||||||
|
bool mSpeedMode;
|
||||||
double mDragFactor;
|
double mDragFactor;
|
||||||
double mDragWheelFactor;
|
double mDragWheelFactor;
|
||||||
double mDragShiftFactor;
|
double mDragShiftFactor;
|
||||||
|
@ -208,6 +209,8 @@ namespace CSVRender
|
||||||
|
|
||||||
EditMode *getEditMode();
|
EditMode *getEditMode();
|
||||||
|
|
||||||
|
bool getSpeedMode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void dragEnterEvent(QDragEnterEvent *event);
|
void dragEnterEvent(QDragEnterEvent *event);
|
||||||
|
@ -269,6 +272,8 @@ namespace CSVRender
|
||||||
|
|
||||||
void secondarySelect(bool activate);
|
void secondarySelect(bool activate);
|
||||||
|
|
||||||
|
void speedMode(bool activate);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|
||||||
void elementSelectionChanged();
|
void elementSelectionChanged();
|
||||||
|
|
Loading…
Reference in a new issue