mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-06-30 13:26:02 -04:00
--User changes
-Give tabs a height of 4px in the qss files. Looks a little large on 4k screens, but just right on HD screens which are much more common. -Allow for styling of zero and non-zero variation tree nodes via qss. -Allow for toggling whether to interpolate between colors in the palette editor, or to do hard cuts between colors. -Allow for adjusting spinner values with the + = or up arrow keys to increase, and - _ or down arrow keys to decrease. -Allow for responding to global presses of + = and - _ to cycle up or down to specify which xform is set as the current one. -Allow for adding "layers" via xaos which will add a user-specified number of xforms, and set certain xaos values to 0 or 1. -Add a new menu item under the Edit menu to copy the OpenCL iteration kernel source to the clipboard. -Show text on the status bar which indicates that an OpenCL kernel compilation is taking place. -Show xform name on xform combo box when expanded. Adjust size to fit all names. -Draw post affine circles using dashed lines. -Prevent QSS dialog from styling its editor, which makes it easier to see text when creating styles which have custom colors for text boxes. --Bug fixes -Fix up some table layouts which seemed to have regressed/decayed over time for reasons unknown. -Using undo/redo would create a new flame in the library every time. -Solo was not being preserved when using undo/redo. --Code changes -Make the solo flag be a part of the flame data now. -Fix some tabification in the OpenCL code for EllipticVariation. -Fix tabification in the varState code for OpenCL. -Add an event called m_CompileBegun to RendererCL that is called right before an OpenCL compile is begun. --This required making RendererCLBase not a pure virtual base class. Member functions just return defaults. -Filter key presses on main window to only process the third one. This is due to Qt triggering three events for every key press. -The palette preview table was installing an event filter for seemingly no reason. Remove it. -Mark certain virtual functions as override in SpinBox and DoubleSpinBox.
This commit is contained in:
@ -15,25 +15,28 @@ void Fractorium::InitXformsUI()
|
||||
connect(ui.AddFinalXformButton, SIGNAL(clicked(bool)), this, SLOT(OnAddFinalXformButtonClicked(bool)), Qt::QueuedConnection);
|
||||
connect(ui.CurrentXformCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(OnCurrentXformComboChanged(int)), Qt::QueuedConnection);
|
||||
connect(ui.AnimateXformCheckBox, SIGNAL(stateChanged(int)), this, SLOT(OnXformAnimateCheckBoxStateChanged(int)), Qt::QueuedConnection);
|
||||
SetFixedTableHeader(ui.XformWeightNameTable->horizontalHeader(),QHeaderView::ResizeToContents);
|
||||
SetFixedTableHeader(ui.XformWeightNameTable->horizontalHeader(), QHeaderView::ResizeToContents);
|
||||
//Use SetupSpinner() just to create the spinner, but use col of -1 to prevent it from being added to the table.
|
||||
SetupSpinner<DoubleSpinBox, double>(ui.XformWeightNameTable, this, row, -1, m_XformWeightSpin, spinHeight, 0, 1000, 0.05, SIGNAL(valueChanged(double)), SLOT(OnXformWeightChanged(double)), false, 0, 1, 0);
|
||||
m_XformWeightSpin->setDecimals(3);
|
||||
m_XformWeightSpin->SmallStep(0.001);
|
||||
m_XformWeightSpin->setMinimumWidth(40);
|
||||
m_XformWeightSpin->setMinimumWidth(40);
|
||||
m_XformWeightSpinnerButtonWidget = new SpinnerLabelButtonWidget(m_XformWeightSpin, "=", 20, 19, ui.XformWeightNameTable);
|
||||
m_XformWeightSpinnerButtonWidget->m_SpinBox->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
m_XformWeightSpinnerButtonWidget->m_Label->setStyleSheet("border: 0px;");
|
||||
m_XformWeightSpinnerButtonWidget->m_Label->setAlignment(Qt::AlignRight| Qt::AlignVCenter);
|
||||
m_XformWeightSpinnerButtonWidget->m_Label->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
|
||||
m_XformWeightSpinnerButtonWidget->m_Button->setToolTip("Equalize weights");
|
||||
m_XformWeightSpinnerButtonWidget->m_SpinBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
m_XformWeightSpinnerButtonWidget->m_Label->setStyleSheet("border: 0px;");
|
||||
m_XformWeightSpinnerButtonWidget->m_Label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
m_XformWeightSpinnerButtonWidget->m_Label->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
m_XformWeightSpinnerButtonWidget->m_Button->setToolTip("Equalize weights");
|
||||
m_XformWeightSpinnerButtonWidget->m_Button->setStyleSheet("text-align: center center");
|
||||
m_XformWeightSpinnerButtonWidget->setMaximumWidth(130);
|
||||
m_XformWeightSpinnerButtonWidget->setMaximumWidth(130);
|
||||
connect(m_XformWeightSpinnerButtonWidget->m_Button, SIGNAL(clicked(bool)), this, SLOT(OnEqualWeightButtonClicked(bool)), Qt::QueuedConnection);
|
||||
ui.XformWeightNameTable->setCellWidget(0, 0, m_XformWeightSpinnerButtonWidget);
|
||||
ui.XformWeightNameTable->setItem(0, 1, new QTableWidgetItem());
|
||||
connect(ui.XformWeightNameTable, SIGNAL(cellChanged(int, int)), this, SLOT(OnXformNameChanged(int, int)), Qt::QueuedConnection);
|
||||
ui.CurrentXformCombo->setProperty("soloxform", -1);
|
||||
ui.CurrentXformCombo->view()->setMinimumWidth(100);
|
||||
ui.CurrentXformCombo->view()->setMaximumWidth(500);
|
||||
//ui.CurrentXformCombo->view()->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
ui.CurrentXformCombo->view()->setSizeAdjustPolicy(QAbstractScrollArea::SizeAdjustPolicy::AdjustToContentsOnFirstShow);
|
||||
#ifndef _WIN32
|
||||
//For some reason linux makes these 24x24, even though the designer explicitly says 16x16.
|
||||
ui.AddXformButton->setIconSize(QSize(16, 16));
|
||||
@ -63,7 +66,7 @@ Xform<T>* FractoriumEmberController<T>::CurrentXform()
|
||||
void Fractorium::CurrentXform(uint i)
|
||||
{
|
||||
if (i < uint(ui.CurrentXformCombo->count()))
|
||||
ui.CurrentXformCombo->setCurrentIndex(i);
|
||||
ui.CurrentXformCombo->setCurrentIndex(i);
|
||||
}
|
||||
/// <summary>
|
||||
/// Set the current xform and populate all GUI widgets.
|
||||
@ -79,7 +82,7 @@ void FractoriumEmberController<T>::CurrentXformComboChanged(int index)
|
||||
{
|
||||
FillWithXform(xform);
|
||||
m_GLController->SetSelectedXform(xform);
|
||||
int solo = m_Fractorium->ui.CurrentXformCombo->property("soloxform").toInt();
|
||||
int solo = m_Ember.m_Solo;
|
||||
m_Fractorium->ui.SoloXformCheckBox->blockSignals(true);
|
||||
m_Fractorium->ui.SoloXformCheckBox->setChecked(solo == index);
|
||||
m_Fractorium->ui.SoloXformCheckBox->blockSignals(false);
|
||||
@ -244,7 +247,7 @@ void FractoriumEmberController<T>::ClearXform()
|
||||
{
|
||||
xform->ClearAndDeleteVariations();//Note xaos is left alone.
|
||||
}, eXformUpdate::UPDATE_SELECTED);
|
||||
FillVariationTreeWithXform(CurrentXform());
|
||||
FillVariationTreeWithCurrentXform();
|
||||
}
|
||||
|
||||
void Fractorium::OnClearXformButtonClicked(bool checked) { m_Controller->ClearXform(); }
|
||||
@ -393,11 +396,13 @@ void FractoriumEmberController<T>::XformNameChanged(int row, int col)
|
||||
}, eXformUpdate::UPDATE_CURRENT, false);
|
||||
FillSummary();//Manually update because this does not trigger a render, which is where this would normally be called.
|
||||
}
|
||||
|
||||
void Fractorium::OnXformNameChanged(int row, int col)
|
||||
{
|
||||
m_Controller->XformNameChanged(row, col);
|
||||
m_Controller->UpdateXformName(ui.CurrentXformCombo->currentIndex());
|
||||
m_Controller->XformNameChanged(row, col);
|
||||
m_Controller->UpdateXformName(ui.CurrentXformCombo->currentIndex());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the animate field of the selected xforms, this allows excluding current if it's not checked, but applies only to it if none are checked.
|
||||
/// This has no effect on interactive rendering, it only sets a value
|
||||
@ -480,9 +485,8 @@ void FractoriumEmberController<T>::SetNormalizedWeightText(Xform<T>* xform)
|
||||
m_Ember.CalcNormalizedWeights(m_NormalizedWeights);
|
||||
|
||||
if (index != -1 && index < m_NormalizedWeights.size())
|
||||
//m_Fractorium->m_XformWeightSpin->setSuffix(QString(" (") + QLocale::system().toString(double(m_NormalizedWeights[index]), 'g', 3) + ")");
|
||||
m_Fractorium->m_XformWeightSpinnerButtonWidget->m_Label->setText(QString(" (") + QLocale::system().toString(double(m_NormalizedWeights[index]), 'g', 3) + ")");
|
||||
}
|
||||
m_Fractorium->m_XformWeightSpinnerButtonWidget->m_Label->setText(QString(" (") + QLocale::system().toString(double(m_NormalizedWeights[index]), 'g', 3) + ")");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Determine whether the specified xform is the final xform in the ember.
|
||||
@ -517,7 +521,7 @@ void FractoriumEmberController<T>::FillXforms(int index)
|
||||
{
|
||||
combo->addItem(ToString(i + 1));
|
||||
combo->setItemIcon(i, m_Fractorium->m_XformComboIcons[i % XFORM_COLOR_COUNT]);
|
||||
UpdateXformName(i);
|
||||
UpdateXformName(i);
|
||||
}
|
||||
|
||||
i = 0;
|
||||
@ -553,7 +557,7 @@ void FractoriumEmberController<T>::FillXforms(int index)
|
||||
m_Fractorium->m_XformsSelectionLayout->addRow(cb, new QWidget(m_Fractorium));
|
||||
combo->addItem("Final");
|
||||
combo->setItemIcon(i, m_Fractorium->m_FinalXformComboIcon);
|
||||
UpdateXformName(i);
|
||||
UpdateXformName(i);
|
||||
}
|
||||
|
||||
m_Fractorium->m_XformsSelectionLayout->blockSignals(false);
|
||||
@ -562,31 +566,50 @@ void FractoriumEmberController<T>::FillXforms(int index)
|
||||
if (index < combo->count())
|
||||
combo->setCurrentIndex(index);
|
||||
|
||||
m_Fractorium->ui.SoloXformCheckBox->blockSignals(true);
|
||||
|
||||
if (m_Ember.m_Solo == combo->currentIndex())
|
||||
m_Fractorium->ui.SoloXformCheckBox->setChecked(true);
|
||||
else
|
||||
m_Fractorium->ui.SoloXformCheckBox->setChecked(false);
|
||||
|
||||
SoloXformCheckBoxStateChanged(m_Ember.m_Solo > -1 ? Qt::Checked : Qt::Unchecked, m_Ember.m_Solo);
|
||||
m_Fractorium->ui.SoloXformCheckBox->blockSignals(false);
|
||||
m_Fractorium->FillXaosTable();
|
||||
m_Fractorium->OnSoloXformCheckBoxStateChanged(Qt::Unchecked);
|
||||
m_Fractorium->OnCurrentXformComboChanged(index);//Make sure the event gets called, because it won't if the zero index is already selected.
|
||||
m_Fractorium->OnCurrentXformComboChanged(index);//Make sure the event gets called, because it won't if the zero index is already selected.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update the text in xforms combo box to show the name of Xform.
|
||||
/// </summary>
|
||||
/// <param name="index">The index of the Xform to update.</param>
|
||||
///
|
||||
///
|
||||
template<typename T>
|
||||
void FractoriumEmberController<T>::UpdateXformName(int index)
|
||||
{
|
||||
bool forceFinal = m_Fractorium->HaveFinal();
|
||||
bool isFinal = m_Ember.FinalXform() == m_Ember.GetTotalXform(index, forceFinal);
|
||||
QString name = isFinal ? "Final" : QString::number(index + 1);
|
||||
|
||||
if (auto xform = m_Ember.GetTotalXform(index, forceFinal))
|
||||
{
|
||||
if (!xform->m_Name.empty())
|
||||
{
|
||||
name += " " + QString::fromStdString(xform->m_Name);
|
||||
}
|
||||
m_Fractorium->ui.CurrentXformCombo->setItemText(index,name);
|
||||
}
|
||||
bool forceFinal = m_Fractorium->HaveFinal();
|
||||
bool isFinal = m_Ember.FinalXform() == m_Ember.GetTotalXform(index, forceFinal);
|
||||
QString name = isFinal ? "Final" : QString::number(index + 1);
|
||||
|
||||
if (auto xform = m_Ember.GetTotalXform(index, forceFinal))
|
||||
{
|
||||
if (!xform->m_Name.empty())
|
||||
name += " " + QString::fromStdString(xform->m_Name);
|
||||
|
||||
m_Fractorium->ui.CurrentXformCombo->setItemText(index, name);
|
||||
auto view = m_Fractorium->ui.CurrentXformCombo->view();
|
||||
auto fontMetrics1 = view->fontMetrics();
|
||||
auto textWidth = m_Fractorium->ui.CurrentXformCombo->width();
|
||||
auto ww = fontMetrics1.width("WW");
|
||||
|
||||
for (int i = 0; i < m_Fractorium->ui.CurrentXformCombo->count(); ++i)
|
||||
textWidth = std::max(fontMetrics1.width(m_Fractorium->ui.CurrentXformCombo->itemText(i)) + ww, textWidth);
|
||||
|
||||
view->setMinimumWidth(textWidth);
|
||||
view->setMaximumWidth(textWidth);
|
||||
}
|
||||
}
|
||||
|
||||
template class FractoriumEmberController<float>;
|
||||
#ifdef DO_DOUBLE
|
||||
template class FractoriumEmberController<double>;
|
||||
|
Reference in New Issue
Block a user