From 707681534a1001400dfc1c5062a0e9eb9fef5470 Mon Sep 17 00:00:00 2001 From: WandererFan Date: Thu, 24 Nov 2016 07:22:34 -0500 Subject: [PATCH] Improve ProjectionGroup dialog Text to icons in dialog Fix rotation directions --- src/Mod/TechDraw/Gui/Resources/TechDraw.qrc | 6 + .../Gui/Resources/icons/arrow-ccw.svg | 230 +++++++++++++++++ .../TechDraw/Gui/Resources/icons/arrow-cw.svg | 242 ++++++++++++++++++ .../Gui/Resources/icons/arrow-down.svg | 232 +++++++++++++++++ .../Gui/Resources/icons/arrow-left.svg | 185 +++++++++++++ .../Gui/Resources/icons/arrow-right.svg | 185 +++++++++++++ .../TechDraw/Gui/Resources/icons/arrow-up.svg | 232 +++++++++++++++++ src/Mod/TechDraw/Gui/TaskProjGroup.cpp | 34 ++- src/Mod/TechDraw/Gui/TaskProjGroup.h | 6 + src/Mod/TechDraw/Gui/TaskProjGroup.ui | 209 ++++++++++++--- 10 files changed, 1513 insertions(+), 48 deletions(-) create mode 100644 src/Mod/TechDraw/Gui/Resources/icons/arrow-ccw.svg create mode 100644 src/Mod/TechDraw/Gui/Resources/icons/arrow-cw.svg create mode 100644 src/Mod/TechDraw/Gui/Resources/icons/arrow-down.svg create mode 100644 src/Mod/TechDraw/Gui/Resources/icons/arrow-left.svg create mode 100644 src/Mod/TechDraw/Gui/Resources/icons/arrow-right.svg create mode 100644 src/Mod/TechDraw/Gui/Resources/icons/arrow-up.svg diff --git a/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc b/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc index 685d8b3e7..d5f2fe60f 100644 --- a/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc +++ b/src/Mod/TechDraw/Gui/Resources/TechDraw.qrc @@ -53,5 +53,11 @@ icons/actions/section-down.svg icons/actions/section-left.svg icons/actions/section-right.svg + icons/arrow-right.svg + icons/arrow-left.svg + icons/arrow-up.svg + icons/arrow-down.svg + icons/arrow-ccw.svg + icons/arrow-cw.svg diff --git a/src/Mod/TechDraw/Gui/Resources/icons/arrow-ccw.svg b/src/Mod/TechDraw/Gui/Resources/icons/arrow-ccw.svg new file mode 100644 index 000000000..71f10ca01 --- /dev/null +++ b/src/Mod/TechDraw/Gui/Resources/icons/arrow-ccw.svg @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/src/Mod/TechDraw/Gui/Resources/icons/arrow-cw.svg b/src/Mod/TechDraw/Gui/Resources/icons/arrow-cw.svg new file mode 100644 index 000000000..4cbb4fc6b --- /dev/null +++ b/src/Mod/TechDraw/Gui/Resources/icons/arrow-cw.svg @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/src/Mod/TechDraw/Gui/Resources/icons/arrow-down.svg b/src/Mod/TechDraw/Gui/Resources/icons/arrow-down.svg new file mode 100644 index 000000000..db50c3031 --- /dev/null +++ b/src/Mod/TechDraw/Gui/Resources/icons/arrow-down.svg @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/src/Mod/TechDraw/Gui/Resources/icons/arrow-left.svg b/src/Mod/TechDraw/Gui/Resources/icons/arrow-left.svg new file mode 100644 index 000000000..cf3c6e933 --- /dev/null +++ b/src/Mod/TechDraw/Gui/Resources/icons/arrow-left.svg @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/src/Mod/TechDraw/Gui/Resources/icons/arrow-right.svg b/src/Mod/TechDraw/Gui/Resources/icons/arrow-right.svg new file mode 100644 index 000000000..c5d0c6d74 --- /dev/null +++ b/src/Mod/TechDraw/Gui/Resources/icons/arrow-right.svg @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/src/Mod/TechDraw/Gui/Resources/icons/arrow-up.svg b/src/Mod/TechDraw/Gui/Resources/icons/arrow-up.svg new file mode 100644 index 000000000..4c975cc7a --- /dev/null +++ b/src/Mod/TechDraw/Gui/Resources/icons/arrow-up.svg @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/src/Mod/TechDraw/Gui/TaskProjGroup.cpp b/src/Mod/TechDraw/Gui/TaskProjGroup.cpp index 9fd34ebe5..4854aba82 100644 --- a/src/Mod/TechDraw/Gui/TaskProjGroup.cpp +++ b/src/Mod/TechDraw/Gui/TaskProjGroup.cpp @@ -102,6 +102,8 @@ TaskProjGroup::TaskProjGroup(TechDraw::DrawProjGroup* featView, bool mode) : Gui::ViewProvider* vp = activeGui->getViewProvider(m_page); ViewProviderPage* dvp = dynamic_cast(vp); m_mdi = dvp->getMDIViewPage(); + + setPrimaryDirection(); } TaskProjGroup::~TaskProjGroup() @@ -152,21 +154,22 @@ void TaskProjGroup::rotateButtonClicked(void) //TODO: Consider changing the vectors around depending on whether we're in First or Third angle mode - might be more intuitive? IR if ( clicked == ui->butTopRotate ) { + t.rotX(M_PI / 2); + } else if ( clicked == ui->butDownRotate) { t.rotX(M_PI / -2); + } else if ( clicked == ui->butRightRotate) { + t.rotZ(M_PI / -2); + } else if ( clicked == ui->butLeftRotate) { + t.rotZ(M_PI / 2); } else if ( clicked == ui->butCWRotate ) { t.rotY(M_PI / -2); - } else if ( clicked == ui->butRightRotate) { - t.rotZ(M_PI / 2); - } else if ( clicked == ui->butDownRotate) { - t.rotX(M_PI / 2); - } else if ( clicked == ui->butLeftRotate) { - t.rotZ(M_PI / -2); } else if ( clicked == ui->butCCWRotate) { t.rotY(M_PI / 2); } m *= t; multiView->setFrontViewOrientation(m); + setPrimaryDirection(); Gui::Command::updateActive(); } } @@ -375,6 +378,25 @@ void TaskProjGroup::setupViewCheckboxes(bool addConnections) } } +void TaskProjGroup::setPrimaryDirection() +{ + App::DocumentObject* docObj = multiView->getProjObj("Front"); + TechDraw::DrawViewPart* dvp = dynamic_cast(docObj); + if (dvp != nullptr) { + Base::Vector3d frontDir = dvp->Direction.getValue(); + ui->lePrimary->setText(formatVector(frontDir)); + } +} + +QString TaskProjGroup::formatVector(Base::Vector3d v) +{ + QString data = QString::fromLatin1("[%1 %2 %3]") + .arg(QLocale::system().toString(v.x, 'f', 2)) + .arg(QLocale::system().toString(v.y, 'f', 2)) + .arg(QLocale::system().toString(v.z, 'f', 2)); + return data; +} + bool TaskProjGroup::accept() { Gui::Command::commitCommand(); diff --git a/src/Mod/TechDraw/Gui/TaskProjGroup.h b/src/Mod/TechDraw/Gui/TaskProjGroup.h index b1a5cbd59..ff07ea086 100644 --- a/src/Mod/TechDraw/Gui/TaskProjGroup.h +++ b/src/Mod/TechDraw/Gui/TaskProjGroup.h @@ -24,7 +24,10 @@ #ifndef GUI_TASKVIEW_TASKVIEWGROUP_H #define GUI_TASKVIEW_TASKVIEWGROUP_H +#include + #include +#include #include #include @@ -86,6 +89,9 @@ protected: */ void setupViewCheckboxes(bool addConnections = false); + void setPrimaryDirection(void); + QString formatVector(Base::Vector3d v); + private: //class Private; Ui_TaskProjGroup * ui; diff --git a/src/Mod/TechDraw/Gui/TaskProjGroup.ui b/src/Mod/TechDraw/Gui/TaskProjGroup.ui index df5d062b6..ab54d9046 100644 --- a/src/Mod/TechDraw/Gui/TaskProjGroup.ui +++ b/src/Mod/TechDraw/Gui/TaskProjGroup.ui @@ -6,8 +6,8 @@ 0 0 - 342 - 431 + 371 + 491 @@ -174,59 +174,124 @@ + + + 0 + 0 + + - View From + Adjust Primary Direction + + + true - Qt::AlignBottom|Qt::AlignHCenter + Qt::AlignCenter + + + 0 - - - - - About 3D Y + + + + + true - - Spin CW + + + 12 + 50 + false + false + + + + Qt::NoFocus + + + Qt::AlignCenter + + + true - + - About 3D Z + Rotate right - > + + + + + :/icons/arrow-right.svg + + + + + 24 + 24 + - - - - About 3D Y - - - Spin CCW - - - - + + + + 0 + 0 + + - About 3D X + Rotate up - /\ + + + + + :/icons/arrow-up.svg + + + + + 24 + 24 + - + + + + Rotate left + + + + + + + :/icons/arrow-left.svg + + + + + 24 + 24 + + + + + false @@ -236,28 +301,36 @@ - - - - About 3D Y - - - < - - - - + - About 3D X + Rotate down - \/ + + + + + :/icons/arrow-down.svg + + + + + 24 + 24 + + + + + Qt::Horizontal + + + @@ -265,6 +338,43 @@ Secondary Projections + + Qt::AlignCenter + + + + + + + + + + + Spin CW + + + + + + + :/icons/arrow-cw.svg + + + + + + + + Spin CCW + + + + + + + :/icons/arrow-ccw.svg + + @@ -380,11 +490,26 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + + - + + +