mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-01-21 13:10:04 -05:00
--User changes -Add pre/post in Toolbar
This commit is contained in:
parent
207ace6c67
commit
1fdebe6f05
@ -234,7 +234,7 @@ Fractorium::~Fractorium()
|
||||
{
|
||||
SyncSequenceSettings();
|
||||
m_VarDialog->SyncSettings();
|
||||
m_Settings->ShowXforms(ui.ActionDrawXforms->isChecked());
|
||||
m_Settings->ShowXforms(ui.ActionDrawPreAffines->isChecked() || ui.ActionDrawPostAffines->isChecked());
|
||||
m_Settings->ShowGrid(ui.ActionDrawGrid->isChecked());
|
||||
m_Settings->setValue("windowState", saveState());
|
||||
m_Settings->sync();
|
||||
|
@ -15,6 +15,11 @@
|
||||
#include "DoubleSpinBoxTableItemDelegate.h"
|
||||
#include "PaletteEditor/PaletteEditor.h"
|
||||
|
||||
/// <summary>
|
||||
/// An enum representing the type of edit being done.
|
||||
/// </summary>
|
||||
enum class eAffineState : int { PRE, ALL_PRE, POST, ALL_POST };
|
||||
|
||||
/// <summary>
|
||||
/// Fractorium class.
|
||||
/// </summary>
|
||||
@ -116,6 +121,8 @@ public:
|
||||
void CurrentXform(uint i);
|
||||
|
||||
//Xforms Affine.
|
||||
bool DrawPreAffines();
|
||||
bool DrawPostAffines();
|
||||
bool DrawSelectedPre();
|
||||
bool DrawAllPre();
|
||||
bool DrawSelectedPost();
|
||||
@ -174,7 +181,8 @@ public slots:
|
||||
void OnActionDP(bool checked);
|
||||
void OnActionStyle(bool checked);
|
||||
void OnActionStartStopRenderer(bool checked);
|
||||
void OnActionDrawXforms(bool checked);
|
||||
void OnActionDrawAffines(bool checked);
|
||||
void OnActionDrawAllAffines(bool checked);
|
||||
void OnActionDrawImage(bool checked);
|
||||
void OnActionDrawGrid(bool checked);
|
||||
|
||||
@ -412,6 +420,8 @@ private:
|
||||
bool HaveFinal();
|
||||
|
||||
//Toolbar.
|
||||
void SaveAffineState();
|
||||
void SyncAffineStateToToolbar();
|
||||
void SyncOptionsToToolbar();
|
||||
|
||||
//Library.
|
||||
@ -592,6 +602,7 @@ private:
|
||||
QColor m_VariationTreeBgColorNonZero, m_VariationTreeBgColorZero;
|
||||
vector<QDockWidget*> m_Docks;
|
||||
|
||||
bool m_PreviousAffineState[4];
|
||||
int m_FontSize;
|
||||
int m_VarSortMode;
|
||||
int m_PaletteSortMode;
|
||||
|
@ -50,5 +50,6 @@
|
||||
<file>Icons/Function-512.png</file>
|
||||
<file>Icons/pic.png</file>
|
||||
<file>Icons/grid.png</file>
|
||||
<file>Icons/reset_scale.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -766,17 +766,20 @@ void Fractorium::OnActionResetWorkspace(bool checked)
|
||||
/// <param name="checked">Ignored</param>
|
||||
void Fractorium::OnActionAlternateEditorImage(bool checked)
|
||||
{
|
||||
if (DrawImage())
|
||||
if (DrawPreAffines() || DrawPostAffines())
|
||||
{
|
||||
ui.ActionDrawImage->setChecked(false);
|
||||
ui.ActionDrawXforms->setChecked(true);
|
||||
ui.ActionDrawGrid->setChecked(true);
|
||||
ui.ActionDrawPreAffines->setChecked(false);
|
||||
ui.ActionDrawAllPreAffines->setChecked(false);
|
||||
ui.ActionDrawPostAffines->setChecked(false);
|
||||
ui.ActionDrawAllPostAffines->setChecked(false);
|
||||
ui.ActionDrawGrid->setChecked(false);
|
||||
ui.ActionDrawImage->setChecked(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.ActionDrawXforms->setChecked(false);
|
||||
ui.ActionDrawGrid->setChecked(false);
|
||||
ui.ActionDrawImage->setChecked(true);
|
||||
ui.ActionDrawImage->setChecked(false);
|
||||
ui.ActionDrawGrid->setChecked(true);
|
||||
SyncAffineStateToToolbar();
|
||||
}
|
||||
|
||||
ui.GLDisplay->update();
|
||||
|
@ -15,24 +15,37 @@ void Fractorium::InitToolbarUI()
|
||||
spGroup->addAction(ui.ActionDP);
|
||||
SyncOptionsToToolbar();
|
||||
ui.ActionDrawImage->setChecked(true);
|
||||
connect(ui.ActionCpu, SIGNAL(triggered(bool)), this, SLOT(OnActionCpu(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ActionCL, SIGNAL(triggered(bool)), this, SLOT(OnActionCL(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ActionSP, SIGNAL(triggered(bool)), this, SLOT(OnActionSP(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ActionDP, SIGNAL(triggered(bool)), this, SLOT(OnActionDP(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ActionStyle, SIGNAL(triggered(bool)), this, SLOT(OnActionStyle(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ActionStartStopRenderer, SIGNAL(triggered(bool)), this, SLOT(OnActionStartStopRenderer(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ActionDrawXforms, SIGNAL(triggered(bool)), this, SLOT(OnActionDrawXforms(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ActionDrawImage, SIGNAL(triggered(bool)), this, SLOT(OnActionDrawImage(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ActionDrawGrid, SIGNAL(triggered(bool)), this, SLOT(OnActionDrawGrid(bool)), Qt::QueuedConnection);
|
||||
m_PreviousAffineState[(int)eAffineState::PRE] = true;
|
||||
m_PreviousAffineState[(int)eAffineState::ALL_PRE] = true;
|
||||
m_PreviousAffineState[(int)eAffineState::POST] = false;
|
||||
m_PreviousAffineState[(int)eAffineState::ALL_POST] = false;
|
||||
connect(ui.ActionCpu, SIGNAL(triggered(bool)), this, SLOT(OnActionCpu(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ActionCL, SIGNAL(triggered(bool)), this, SLOT(OnActionCL(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ActionSP, SIGNAL(triggered(bool)), this, SLOT(OnActionSP(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ActionDP, SIGNAL(triggered(bool)), this, SLOT(OnActionDP(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ActionStyle, SIGNAL(triggered(bool)), this, SLOT(OnActionStyle(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ActionStartStopRenderer, SIGNAL(triggered(bool)), this, SLOT(OnActionStartStopRenderer(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ActionDrawImage, SIGNAL(triggered(bool)), this, SLOT(OnActionDrawImage(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ActionDrawPreAffines, SIGNAL(triggered(bool)), this, SLOT(OnActionDrawAffines(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ActionDrawPostAffines, SIGNAL(triggered(bool)), this, SLOT(OnActionDrawAffines(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ActionDrawAllPreAffines, SIGNAL(triggered(bool)), this, SLOT(OnActionDrawAllAffines(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ActionDrawAllPostAffines, SIGNAL(triggered(bool)), this, SLOT(OnActionDrawAllAffines(bool)), Qt::QueuedConnection);
|
||||
connect(ui.ActionDrawGrid, SIGNAL(triggered(bool)), this, SLOT(OnActionDrawGrid(bool)), Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GUI wrapper functions, getters only.
|
||||
/// </summary>
|
||||
|
||||
bool Fractorium::DrawXforms() { return ui.ActionDrawXforms->isChecked(); }
|
||||
bool Fractorium::DrawImage() { return ui.ActionDrawImage->isChecked(); }
|
||||
bool Fractorium::DrawGrid() { return ui.ActionDrawGrid->isChecked(); }
|
||||
bool Fractorium::DrawPreAffines() { return ui.ActionDrawPreAffines->isChecked(); }
|
||||
bool Fractorium::DrawPostAffines() { return ui.ActionDrawPostAffines->isChecked(); }
|
||||
bool Fractorium::DrawSelectedPre() { return !ui.ActionDrawAllPreAffines->isChecked(); }
|
||||
bool Fractorium::DrawAllPre() { return ui.ActionDrawAllPreAffines->isChecked(); }
|
||||
bool Fractorium::DrawSelectedPost() { return !ui.ActionDrawAllPostAffines->isChecked(); }
|
||||
bool Fractorium::DrawAllPost() { return ui.ActionDrawAllPostAffines->isChecked(); }
|
||||
bool Fractorium::DrawXforms() { return ui.ActionDrawPreAffines->isChecked() || ui.ActionDrawPostAffines->isChecked(); }
|
||||
bool Fractorium::DrawImage() { return ui.ActionDrawImage->isChecked(); }
|
||||
bool Fractorium::DrawGrid() { return ui.ActionDrawGrid->isChecked(); }
|
||||
|
||||
/// <summary>
|
||||
/// Called when the CPU render option on the toolbar is clicked.
|
||||
@ -122,18 +135,30 @@ void Fractorium::OnActionStartStopRenderer(bool checked)
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Toggle whether to show the affines.
|
||||
/// Called when the editor image button is clicked.
|
||||
/// Called when the pre affine button is clicked.
|
||||
/// </summary>
|
||||
/// <param name="checked">Check state, show editor if true, else hide.</param>
|
||||
void Fractorium::OnActionDrawXforms(bool checked)
|
||||
/// <param name="checked">Check state, show pre affines if true, else hide.</param>
|
||||
void Fractorium::OnActionDrawAffines(bool checked)
|
||||
{
|
||||
m_Settings->ShowXforms(checked);
|
||||
m_Settings->ShowXforms(checked);
|
||||
|
||||
if (!ui.ActionDrawImage->isChecked() && !ui.ActionDrawXforms->isChecked())
|
||||
ui.ActionDrawImage->setChecked(true);
|
||||
if (!ui.ActionDrawImage->isChecked() && !(ui.ActionDrawPreAffines->isChecked() || ui.ActionDrawPostAffines->isChecked()))
|
||||
ui.ActionDrawImage->setChecked(true);
|
||||
|
||||
ui.GLDisplay->update();
|
||||
SaveAffineState();
|
||||
|
||||
ui.GLDisplay->update();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Toggle whether to show selected/all post affines.
|
||||
/// Called when the show all post affine button is clicked.
|
||||
/// </summary>
|
||||
/// <param name="checked">Check state, show all pre affines if true, else show selected.</param>
|
||||
void Fractorium::OnActionDrawAllAffines(bool checked)
|
||||
{
|
||||
SaveAffineState();
|
||||
ui.GLDisplay->update();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -143,8 +168,8 @@ void Fractorium::OnActionDrawXforms(bool checked)
|
||||
/// <param name="checked">Check state, show image if true, else hide.</param>
|
||||
void Fractorium::OnActionDrawImage(bool checked)
|
||||
{
|
||||
if (!ui.ActionDrawImage->isChecked() && !ui.ActionDrawXforms->isChecked())
|
||||
ui.ActionDrawXforms->setChecked(true);
|
||||
if (!ui.ActionDrawImage->isChecked())
|
||||
SyncAffineStateToToolbar();
|
||||
|
||||
ui.GLDisplay->update();
|
||||
}
|
||||
@ -160,6 +185,32 @@ void Fractorium::OnActionDrawGrid(bool checked)
|
||||
ui.GLDisplay->update();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Keep previous state of the affines to switch between Editor and Image
|
||||
/// </summary>
|
||||
void Fractorium::SaveAffineState()
|
||||
{
|
||||
if(!ui.ActionDrawPreAffines->isChecked() && !ui.ActionDrawPostAffines->isChecked())
|
||||
return;
|
||||
|
||||
m_PreviousAffineState[(int)eAffineState::PRE] = ui.ActionDrawPreAffines->isChecked();
|
||||
m_PreviousAffineState[(int)eAffineState::ALL_PRE] = ui.ActionDrawAllPreAffines->isChecked();
|
||||
m_PreviousAffineState[(int)eAffineState::POST] = ui.ActionDrawPostAffines->isChecked();
|
||||
m_PreviousAffineState[(int)eAffineState::ALL_POST] = ui.ActionDrawAllPostAffines->isChecked();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sync affine state data to the check state of the toolbar buttons.
|
||||
/// This does not trigger a clicked() event.
|
||||
/// </summary>
|
||||
void Fractorium::SyncAffineStateToToolbar()
|
||||
{
|
||||
ui.ActionDrawPreAffines->setChecked(m_PreviousAffineState[(int)eAffineState::PRE]);
|
||||
ui.ActionDrawAllPreAffines->setChecked(m_PreviousAffineState[(int)eAffineState::ALL_PRE]);
|
||||
ui.ActionDrawPostAffines->setChecked(m_PreviousAffineState[(int)eAffineState::POST]);
|
||||
ui.ActionDrawAllPostAffines->setChecked(m_PreviousAffineState[(int)eAffineState::ALL_POST]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sync options data to the check state of the toolbar buttons.
|
||||
/// This does not trigger a clicked() event.
|
||||
@ -196,5 +247,8 @@ void Fractorium::SyncOptionsToToolbar()
|
||||
}
|
||||
|
||||
ui.ActionDrawGrid->setChecked(m_Settings->ShowGrid());
|
||||
ui.ActionDrawXforms->setChecked(m_Settings->ShowXforms());
|
||||
}
|
||||
ui.ActionDrawPreAffines->setChecked(m_Settings->ShowXforms());
|
||||
ui.ActionDrawAllPreAffines->setChecked(m_Settings->ShowXforms());
|
||||
|
||||
SaveAffineState();
|
||||
}
|
||||
|
@ -154,8 +154,10 @@ void Fractorium::InitXformsAffineUI()
|
||||
m_PostSpins[5] = m_PostO2Spin;
|
||||
ui.PreAffineGroupBox->setChecked(false);//Flip both once to force enabling/disabling the disabling of the group boxes and the corner buttons.
|
||||
ui.PreAffineGroupBox->setChecked(true);//Pre affine enabled.
|
||||
ui.PostAffineGroupBox->setChecked(true);
|
||||
ui.PostAffineGroupBox->setChecked(false);//Post affine disabled.
|
||||
ui.PostAffineGroupBox->setChecked(false);
|
||||
ui.PostAffineGroupBox->setChecked(true);//Post affine enabled.
|
||||
ui.PreAffineShowGroupBox->setVisible(false); // michel - to delete
|
||||
ui.PostAffineShowGroupBox->setVisible(false); // michel - to delete
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -791,13 +793,9 @@ void Fractorium::SetupAffineSpinner(QTableWidget* table, const QObject* receiver
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GUI wrapper functions, getters only.
|
||||
/// GUI wrapper function, getter only.
|
||||
/// </summary>
|
||||
|
||||
bool Fractorium::DrawSelectedPre() { return ui.ShowPreAffineSelectedRadio->isChecked(); }
|
||||
bool Fractorium::DrawAllPre() { return ui.ShowPreAffineAllRadio->isChecked(); }
|
||||
bool Fractorium::DrawSelectedPost() { return ui.ShowPostAffineSelectedRadio->isChecked(); }
|
||||
bool Fractorium::DrawAllPost() { return ui.ShowPostAffineAllRadio->isChecked(); }
|
||||
bool Fractorium::LocalPivot() { return ui.LocalPivotRadio->isChecked(); }
|
||||
|
||||
template class FractoriumEmberController<float>;
|
||||
|
@ -523,8 +523,8 @@ void GLWidget::paintGL()
|
||||
}
|
||||
|
||||
//Affine drawing.
|
||||
bool pre = m_Fractorium->ui.PreAffineGroupBox->isChecked();
|
||||
bool post = m_Fractorium->ui.PostAffineGroupBox->isChecked();
|
||||
bool pre = m_Fractorium->DrawPreAffines();
|
||||
bool post = m_Fractorium->DrawPostAffines();
|
||||
this->glEnable(GL_BLEND);
|
||||
this->glEnable(GL_LINE_SMOOTH);
|
||||
this->glEnable(GL_POINT_SMOOTH);
|
||||
@ -1757,8 +1757,8 @@ void GLWidget::DrawAffineHelper(int index, float circleWidth, float lineWidth, b
|
||||
template <typename T>
|
||||
int GLEmberController<T>::UpdateHover(v3T& glCoords)
|
||||
{
|
||||
bool pre = m_Fractorium->ui.PreAffineGroupBox->isChecked();
|
||||
bool post = m_Fractorium->ui.PostAffineGroupBox->isChecked();
|
||||
bool pre = m_Fractorium->DrawPreAffines();
|
||||
bool post = m_Fractorium->DrawPostAffines();
|
||||
int i = 0, bestIndex = -1;
|
||||
T bestDist = 10;
|
||||
auto ember = m_FractoriumEmberController->CurrentEmber();
|
||||
|
BIN
Source/Fractorium/Icons/grid.png
Normal file → Executable file
BIN
Source/Fractorium/Icons/grid.png
Normal file → Executable file
Binary file not shown.
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 2.3 KiB |
BIN
Source/Fractorium/Icons/pic.png
Normal file → Executable file
BIN
Source/Fractorium/Icons/pic.png
Normal file → Executable file
Binary file not shown.
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 1.9 KiB |
BIN
Source/Fractorium/Icons/reset_scale.png
Executable file
BIN
Source/Fractorium/Icons/reset_scale.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
Loading…
Reference in New Issue
Block a user