From 7348d0d4979c3548e085fa63192767af03422436 Mon Sep 17 00:00:00 2001 From: j-dowsett Date: Mon, 2 Dec 2013 19:31:28 +0000 Subject: [PATCH] Added manual scaling to axonometric view --- src/Mod/Drawing/Gui/TaskOrthoViews.cpp | 41 +++++++++++++++++++++++--- src/Mod/Drawing/Gui/TaskOrthoViews.h | 1 + src/Mod/Drawing/Gui/TaskOrthoViews.ui | 2 +- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/Mod/Drawing/Gui/TaskOrthoViews.cpp b/src/Mod/Drawing/Gui/TaskOrthoViews.cpp index a77944a92..f876b86ec 100644 --- a/src/Mod/Drawing/Gui/TaskOrthoViews.cpp +++ b/src/Mod/Drawing/Gui/TaskOrthoViews.cpp @@ -463,6 +463,8 @@ TaskOrthoViews::TaskOrthoViews(QWidget *parent) connect(ui->axoTop, SIGNAL(activated(int)), this, SLOT(axoTopChanged(int))); connect(ui->axoLeft, SIGNAL(activated(int)), this, SLOT(axoChanged(int))); connect(ui->flip, SIGNAL(clicked()), this, SLOT(axo_flip())); + connect(ui->axoScale, SIGNAL(editingFinished()), this, SLOT(axoScale())); + //these matrices contain information relating relative position on page to which view appears there, and in which orientation //first matrix is for front, right, back, left. Only needs to contain positions above and below primary since in positions horizontally @@ -762,15 +764,25 @@ void TaskOrthoViews::autodims() void TaskOrthoViews::compute() { + float temp_scale = scale; if (autoscale) autodims(); for (int i = 0; i < 4; i++) { - views[i]->setScale(scale); + if (i == axo && i > 0) + { + if (temp_scale == ui->axoScale->text().toFloat()) + { + views[i]->setScale(scale); // only update the axonometric scale if it wasn't manually changed + ui->axoScale->setText(QString::number(scale)); + } + } + else + views[i]->setScale(scale); + views[i]->setPos(x_pos + view_status[i][2] * horiz, y_pos + view_status[i][3] * vert); } - Command::updateActive(); Command::commitCommand(); } @@ -845,6 +857,7 @@ void TaskOrthoViews::cb_toggled(bool toggle) { axo = i; ui->tabWidget->setTabEnabled(1,true); + ui->axoScale->setText(QString::number(scale)); set_axo(); } else @@ -1055,6 +1068,22 @@ void TaskOrthoViews::axoChanged(int i) } +void TaskOrthoViews::axoScale() +{ + bool ok; + QString temp = ui->axoScale->text(); + + float value = temp.toFloat(&ok); + if (ok) + { + views[axo]->setScale(value); + compute(); + } + else + ui->axoScale->setText(temp); +} + + void TaskOrthoViews::set_axo() { float v[3]; @@ -1132,7 +1161,7 @@ void TaskOrthoViews::toggle_auto(int i) void TaskOrthoViews::data_entered() { - Command::doCommand(Command::Doc,"#1"); + //Command::doCommand(Command::Doc,"#1"); bool ok; QString name = sender()->objectName().right(1); @@ -1149,7 +1178,6 @@ void TaskOrthoViews::data_entered() return; } compute(); - Command::doCommand(Command::Doc,"#2"); } @@ -1168,6 +1196,11 @@ bool TaskOrthoViews::user_input() break; //stop checking } } + if (ui->axoScale->isModified()) + { + ui->axoScale->setModified(false); + modified = true; + } return modified; } diff --git a/src/Mod/Drawing/Gui/TaskOrthoViews.h b/src/Mod/Drawing/Gui/TaskOrthoViews.h index acfc99b40..9c88bfa0e 100644 --- a/src/Mod/Drawing/Gui/TaskOrthoViews.h +++ b/src/Mod/Drawing/Gui/TaskOrthoViews.h @@ -99,6 +99,7 @@ protected Q_SLOTS: void axoChanged(int); void axoTopChanged(int); void axo_flip(); + void axoScale(); protected: void changeEvent(QEvent *); diff --git a/src/Mod/Drawing/Gui/TaskOrthoViews.ui b/src/Mod/Drawing/Gui/TaskOrthoViews.ui index c469783f4..33d9e4b92 100644 --- a/src/Mod/Drawing/Gui/TaskOrthoViews.ui +++ b/src/Mod/Drawing/Gui/TaskOrthoViews.ui @@ -636,7 +636,7 @@ - false + true