Added manual scaling to axonometric view
This commit is contained in:
parent
7d159360c4
commit
7348d0d497
|
@ -463,6 +463,8 @@ TaskOrthoViews::TaskOrthoViews(QWidget *parent)
|
||||||
connect(ui->axoTop, SIGNAL(activated(int)), this, SLOT(axoTopChanged(int)));
|
connect(ui->axoTop, SIGNAL(activated(int)), this, SLOT(axoTopChanged(int)));
|
||||||
connect(ui->axoLeft, SIGNAL(activated(int)), this, SLOT(axoChanged(int)));
|
connect(ui->axoLeft, SIGNAL(activated(int)), this, SLOT(axoChanged(int)));
|
||||||
connect(ui->flip, SIGNAL(clicked()), this, SLOT(axo_flip()));
|
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
|
//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
|
//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()
|
void TaskOrthoViews::compute()
|
||||||
{
|
{
|
||||||
|
float temp_scale = scale;
|
||||||
if (autoscale)
|
if (autoscale)
|
||||||
autodims();
|
autodims();
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
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);
|
views[i]->setPos(x_pos + view_status[i][2] * horiz, y_pos + view_status[i][3] * vert);
|
||||||
}
|
}
|
||||||
|
|
||||||
Command::updateActive();
|
Command::updateActive();
|
||||||
Command::commitCommand();
|
Command::commitCommand();
|
||||||
}
|
}
|
||||||
|
@ -845,6 +857,7 @@ void TaskOrthoViews::cb_toggled(bool toggle)
|
||||||
{
|
{
|
||||||
axo = i;
|
axo = i;
|
||||||
ui->tabWidget->setTabEnabled(1,true);
|
ui->tabWidget->setTabEnabled(1,true);
|
||||||
|
ui->axoScale->setText(QString::number(scale));
|
||||||
set_axo();
|
set_axo();
|
||||||
}
|
}
|
||||||
else
|
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()
|
void TaskOrthoViews::set_axo()
|
||||||
{
|
{
|
||||||
float v[3];
|
float v[3];
|
||||||
|
@ -1132,7 +1161,7 @@ void TaskOrthoViews::toggle_auto(int i)
|
||||||
|
|
||||||
void TaskOrthoViews::data_entered()
|
void TaskOrthoViews::data_entered()
|
||||||
{
|
{
|
||||||
Command::doCommand(Command::Doc,"#1");
|
//Command::doCommand(Command::Doc,"#1");
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
QString name = sender()->objectName().right(1);
|
QString name = sender()->objectName().right(1);
|
||||||
|
@ -1149,7 +1178,6 @@ void TaskOrthoViews::data_entered()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
compute();
|
compute();
|
||||||
Command::doCommand(Command::Doc,"#2");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1168,6 +1196,11 @@ bool TaskOrthoViews::user_input()
|
||||||
break; //stop checking
|
break; //stop checking
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (ui->axoScale->isModified())
|
||||||
|
{
|
||||||
|
ui->axoScale->setModified(false);
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
return modified;
|
return modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,7 @@ protected Q_SLOTS:
|
||||||
void axoChanged(int);
|
void axoChanged(int);
|
||||||
void axoTopChanged(int);
|
void axoTopChanged(int);
|
||||||
void axo_flip();
|
void axo_flip();
|
||||||
|
void axoScale();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent(QEvent *);
|
void changeEvent(QEvent *);
|
||||||
|
|
|
@ -636,7 +636,7 @@
|
||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QLineEdit" name="axoScale">
|
<widget class="QLineEdit" name="axoScale">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user