mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-01-22 05:30:06 -05:00
5cdfe0b6b9
--User changes -Add many tooltips to help clarify functionality. -Select multiple flames in library for del/move. Still only one allowed to be set as the current. -Show checkbox for current flame. Remember this is not necessarily what's selected. -User can now drag a square to select xforms, which keeps in sync with checkboxes. -Remove --nframes from command line. Replace with new params: --loopframes, --interpframes, --interploops. -Add two new options to EmberGenome: --cwloops --cwinterploops to specify whether rotation should go clockwise instead of the default counter clockwise. -Add these to Fractorium as checkboxes. -Apply All now also works for toggling animate flag on xforms. -Options dialog now allows user to set whether double click toggles spinners, or right click does. --Bug fixes -Selecting final and non-final xforms, and then dragging the non-final did not drag the final with it. -Selecting all xforms when a final was present, then deleting crashed the program. -Remove support for ppm files in the command line programs, it's an outdated format. -Switching between SP and DP kept reapplying the palette adjustments. --Code changes -Move build system to Visual Studio 2015 and Qt 5.6. -SSE used during addition of points to the histogram. -Remove last remnants of old flam3 C code and replace with C++. -Remove unused code involving tbb::task_group. -Make settings object a global shared_ptr singleton, so it doesn't have to be passed around.
133 lines
4.2 KiB
C++
133 lines
4.2 KiB
C++
#include "FractoriumPch.h"
|
|
#include "Fractorium.h"
|
|
|
|
/// <summary>
|
|
/// Initialize the xforms selection UI.
|
|
/// </summary>
|
|
void Fractorium::InitXformsSelectUI()
|
|
{
|
|
m_XformsSelectionLayout = (QFormLayout*)ui.XformsSelectGroupBoxScrollAreaWidget->layout();
|
|
connect(ui.XformsSelectAllButton, SIGNAL(clicked(bool)), this, SLOT(OnXformsSelectAllButtonClicked(bool)), Qt::QueuedConnection);
|
|
connect(ui.XformsSelectNoneButton, SIGNAL(clicked(bool)), this, SLOT(OnXformsSelectNoneButtonClicked(bool)), Qt::QueuedConnection);
|
|
ClearXformsSelections();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Check all of the xform selection checkboxes.
|
|
/// </summary>
|
|
/// <param name="checked">Ignored</param>
|
|
void Fractorium::OnXformsSelectAllButtonClicked(bool checked) { ForEachXformCheckbox([&](int i, QCheckBox * w) { w->setChecked(true); }); }
|
|
|
|
/// <summary>
|
|
/// Uncheck all of the xform selection checkboxes.
|
|
/// </summary>
|
|
/// <param name="checked">Ignored</param>
|
|
void Fractorium::OnXformsSelectNoneButtonClicked(bool checked) { ForEachXformCheckbox([&](int i, QCheckBox * w) { w->setChecked(false); }); }
|
|
|
|
/// <summary>
|
|
/// Return whether the checkbox at the specified index is checked.
|
|
/// </summary>
|
|
/// <param name="i">The index of the xform to check for selection</param>
|
|
/// <param name="checked">True if checked, else false.</param>
|
|
bool Fractorium::IsXformSelected(size_t i)
|
|
{
|
|
if (i < m_XformSelections.size())
|
|
if (auto w = m_XformSelections[i])
|
|
return w->isChecked();
|
|
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Clear all of the dynamically created xform checkboxes.
|
|
/// </summary>
|
|
void Fractorium::ClearXformsSelections()
|
|
{
|
|
QLayoutItem* child = nullptr;
|
|
m_XformSelections.clear();
|
|
m_XformsSelectionLayout->blockSignals(true);
|
|
|
|
while (m_XformsSelectionLayout->count() && (child = m_XformsSelectionLayout->takeAt(0)))
|
|
{
|
|
auto w = child->widget();
|
|
delete child;
|
|
delete w;
|
|
}
|
|
|
|
m_XformsSelectionLayout->blockSignals(false);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Make a caption from an xform.
|
|
/// The caption will be the xform count + 1, optionally followed by the xform's name.
|
|
/// For final xforms, the string "Final" will be used in place of the count.
|
|
/// </summary>
|
|
/// <param name="i">The index of the xform to make a caption for</param>
|
|
/// <returns>The caption string</returns>
|
|
template <typename T>
|
|
QString FractoriumEmberController<T>::MakeXformCaption(size_t i)
|
|
{
|
|
bool isFinal = m_Ember.FinalXform() == m_Ember.GetTotalXform(i);
|
|
QString caption = isFinal ? "Final" : QString::number(i + 1);
|
|
|
|
if (auto xform = m_Ember.GetTotalXform(i))
|
|
{
|
|
if (!xform->m_Name.empty())
|
|
caption += " (" + QString::fromStdString(xform->m_Name) + ")";
|
|
}
|
|
|
|
return caption;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Function to perform the specified operation on every dynamically created xform selection checkbox.
|
|
/// </summary>
|
|
/// <param name="func">The operation to perform</param>
|
|
void Fractorium::ForEachXformCheckbox(std::function<void(int, QCheckBox*)> func)
|
|
{
|
|
int i = 0;
|
|
|
|
for (auto& cb : m_XformSelections)
|
|
func(i++, cb);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Function to perform the specified operation on one dynamically created xform selection checkbox.
|
|
/// </summary>
|
|
/// <param name="i">The index of the checkbox</param>
|
|
/// <param name="func">The operation to perform</param>
|
|
/// <returns>True if the checkbox was found, else false.</returns>
|
|
template <typename T>
|
|
bool FractoriumEmberController<T>::XformCheckboxAt(int i, std::function<void(QCheckBox*)> func)
|
|
{
|
|
if (i < m_Fractorium->m_XformSelections.size())
|
|
{
|
|
if (auto w = m_Fractorium->m_XformSelections[i])
|
|
{
|
|
func(w);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Function to perform the specified operation on one dynamically created xform selection checkbox.
|
|
/// The checkbox is specified by the xform it corresponds to, rather than its index.
|
|
/// </summary>
|
|
/// <param name="xform">The xform that corresponds to the checkbox</param>
|
|
/// <param name="func">The operation to perform</param>
|
|
/// <returns>True if the checkbox was found, else false.</returns>
|
|
template <typename T>
|
|
bool FractoriumEmberController<T>::XformCheckboxAt(Xform<T>* xform, std::function<void(QCheckBox*)> func)
|
|
{
|
|
return XformCheckboxAt(m_Ember.GetTotalXformIndex(xform), func);
|
|
}
|
|
|
|
template class FractoriumEmberController<float>;
|
|
|
|
#ifdef DO_DOUBLE
|
|
template class FractoriumEmberController<double>;
|
|
#endif
|