From d80343a28be8424f3b13546c52a2be4fb80b094e Mon Sep 17 00:00:00 2001 From: mfeemster Date: Sat, 20 Jun 2015 11:35:08 -0700 Subject: [PATCH] --User changes -Better default/min/max sizes for docks/tabs. -Add a reset workspace menu item. --Bug fixes -Order of affine scale up/down buttons was reversed from what's intuitive. -Projection was not properly being set when animating flames with 3D parameters. --- Source/Ember/Ember.h | 3 + Source/Ember/Renderer.cpp | 2 +- Source/Fractorium/Fractorium.cpp | 26 ++- Source/Fractorium/Fractorium.h | 3 + Source/Fractorium/Fractorium.ui | 227 +++++++++++++++----------- Source/Fractorium/FractoriumMenus.cpp | 30 ++++ 6 files changed, 192 insertions(+), 99 deletions(-) diff --git a/Source/Ember/Ember.h b/Source/Ember/Ember.h index c93bd77..6e3e3ee 100644 --- a/Source/Ember/Ember.h +++ b/Source/Ember/Ember.h @@ -803,6 +803,9 @@ public: InterpT<&Ember::m_SpatialFilterRadius>(embers, coefs, size); InterpX, &Ember::m_Curves>(embers, coefs, size); + //Normally done in assignment, must manually do here. + SetProjFunc(); + //An extra step needed here due to the OOD that was not needed in the original. //A small price to pay for the conveniences it affords us elsewhere. //First clear the xforms, and find out the max number of xforms in all of the embers in the list. diff --git a/Source/Ember/Renderer.cpp b/Source/Ember/Renderer.cpp index 4231533..8bc9fab 100644 --- a/Source/Ember/Renderer.cpp +++ b/Source/Ember/Renderer.cpp @@ -1218,7 +1218,7 @@ EmberStats Renderer::Iterate(size_t iterCount, size_t temporalSample #ifdef WIN32 SetThreadPriority(GetCurrentThread(), m_Priority); #else - pthread_setschedprio(pthread_self(), (int)m_Priority); + pthread_setschedprio(pthread_self(), (int)m_Priority); #endif //Timing t; IterParams params; diff --git a/Source/Fractorium/Fractorium.cpp b/Source/Fractorium/Fractorium.cpp index 2b0c371..c4eb5ad 100644 --- a/Source/Fractorium/Fractorium.cpp +++ b/Source/Fractorium/Fractorium.cpp @@ -32,6 +32,14 @@ Fractorium::Fractorium(QWidget* p) tabifyDockWidget(ui.XformsDockWidget, ui.XaosDockWidget); tabifyDockWidget(ui.XaosDockWidget, ui.PaletteDockWidget); tabifyDockWidget(ui.PaletteDockWidget, ui.InfoDockWidget); + + m_Docks.reserve(8); + m_Docks.push_back(ui.LibraryDockWidget); + m_Docks.push_back(ui.FlameDockWidget); + m_Docks.push_back(ui.XformsDockWidget); + m_Docks.push_back(ui.XaosDockWidget); + m_Docks.push_back(ui.PaletteDockWidget); + m_Docks.push_back(ui.InfoDockWidget); m_FontSize = 9; m_VarSortMode = 1;//Sort by weight by default. @@ -137,15 +145,19 @@ Fractorium::Fractorium(QWidget* p) //Setup pointer in the GL window to point back to here. ui.GLDisplay->SetMainWindow(this); - restoreState(m_Settings->value("windowState").toByteArray()); + bool restored = restoreState(m_Settings->value("windowState").toByteArray()); showMaximized();//This won't fully set things up and show them until after this constructor exits. connect(ui.LibraryDockWidget, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(dockLocationChanged(Qt::DockWidgetArea))); connect(ui.LibraryDockWidget, SIGNAL(topLevelChanged(bool)), this, SLOT(OnDockTopLevelChanged(bool))); //Always ensure the library tab is selected, which will show preview renders. - //ui.ParamsTabWidget->setCurrentIndex(0); - ui.XformsTabWidget->setCurrentIndex(2);//Make variations tab the currently selected one under the Xforms tab. + if (!restored) + { + ui.LibraryDockWidget->raise(); + ui.LibraryDockWidget->show(); + ui.XformsTabWidget->setCurrentIndex(2);//Make variations tab the currently selected one under the Xforms tab. + } //Setting certain values will completely throw off the GUI, doing everything //from setting strange margins, to arbitrarily changing the fonts used. @@ -686,9 +698,9 @@ void Fractorium::SetTabOrders() w = SetTabOrder(this, w, ui.PreMoveCombo); w = SetTabOrder(this, w, ui.PreMoveLeftButton); w = SetTabOrder(this, w, ui.PreMoveRightButton); - w = SetTabOrder(this, w, ui.PreScaleUpButton); - w = SetTabOrder(this, w, ui.PreScaleCombo); w = SetTabOrder(this, w, ui.PreScaleDownButton); + w = SetTabOrder(this, w, ui.PreScaleCombo); + w = SetTabOrder(this, w, ui.PreScaleUpButton); w = SetTabOrder(this, w, ui.ShowPreAffineCurrentRadio); w = SetTabOrder(this, w, ui.ShowPreAffineAllRadio); w = SetTabOrder(this, w, ui.PostAffineGroupBox); @@ -711,9 +723,9 @@ void Fractorium::SetTabOrders() w = SetTabOrder(this, w, ui.PostMoveCombo); w = SetTabOrder(this, w, ui.PostMoveLeftButton); w = SetTabOrder(this, w, ui.PostMoveRightButton); - w = SetTabOrder(this, w, ui.PostScaleUpButton); - w = SetTabOrder(this, w, ui.PostScaleCombo); w = SetTabOrder(this, w, ui.PostScaleDownButton); + w = SetTabOrder(this, w, ui.PostScaleCombo); + w = SetTabOrder(this, w, ui.PostScaleUpButton); w = SetTabOrder(this, w, ui.ShowPostAffineCurrentRadio); w = SetTabOrder(this, w, ui.ShowPostAffineAllRadio); w = SetTabOrder(this, w, ui.LocalPivotRadio); diff --git a/Source/Fractorium/Fractorium.h b/Source/Fractorium/Fractorium.h index 12dc284..6a4d469 100644 --- a/Source/Fractorium/Fractorium.h +++ b/Source/Fractorium/Fractorium.h @@ -125,6 +125,8 @@ public slots: void OnActionCopySelectedXforms(bool checked); void OnActionPasteSelectedXforms(bool checked); + void OnActionResetWorkspace(bool checked);//View + void OnActionAddReflectiveSymmetry(bool checked);//Tools. void OnActionAddRotationalSymmetry(bool checked); void OnActionAddBothSymmetry(bool checked); @@ -458,6 +460,7 @@ private: char m_CoordinateString[128]; QColor m_XformComboColors[XFORM_COLOR_COUNT], m_FinalXformComboColor; QIcon m_XformComboIcons[XFORM_COLOR_COUNT], m_FinalXformComboIcon; + vector m_Docks; int m_FontSize; int m_VarSortMode; diff --git a/Source/Fractorium/Fractorium.ui b/Source/Fractorium/Fractorium.ui index 76d6e49..8ded213 100644 --- a/Source/Fractorium/Fractorium.ui +++ b/Source/Fractorium/Fractorium.ui @@ -74,7 +74,7 @@ 0 0 - 1130 + 1217 885 @@ -99,12 +99,18 @@ - 0 + 40 0 - 211 + 240 881 + + + 150 + 200 + + true @@ -112,7 +118,7 @@ QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable - Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea + Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea Flame @@ -150,7 +156,7 @@ 0 0 - 201 + 230 850 @@ -1518,17 +1524,23 @@ - 485 + 550 0 - 181 - 871 + 240 + 881 + + + 240 + 200 + + QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable - Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea + Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea Xaos @@ -1694,17 +1706,23 @@ - 666 + 790 0 - 205 - 871 + 240 + 881 + + + 240 + 200 + + QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable - Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea + Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea Palette @@ -2128,15 +2146,24 @@ - 211 + 300 0 - 274 - 861 + 240 + 881 + + + 240 + 613 + + QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable + + Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea + Xforms @@ -3225,8 +3252,8 @@ SpinBox 0 0 - 233 - 618 + 216 + 745 @@ -3463,20 +3490,6 @@ SpinBox - - - - Scale xform x percent up - - - - - - - :/Fractorium/Icons/arrow_out.png:/Fractorium/Icons/arrow_out.png - - - @@ -3703,20 +3716,6 @@ SpinBox - - - - Scale xform x percent down - - - - - - - :/Fractorium/Icons/arrow_in.png:/Fractorium/Icons/arrow_in.png - - - @@ -3779,6 +3778,34 @@ SpinBox + + + + Scale xform x percent down + + + + + + + :/Fractorium/Icons/arrow_in.png:/Fractorium/Icons/arrow_in.png + + + + + + + Scale xform x percent up + + + + + + + :/Fractorium/Icons/arrow_out.png:/Fractorium/Icons/arrow_out.png + + + @@ -4064,23 +4091,6 @@ SpinBox - - - - true - - - Scale xform x percent up - - - - - - - :/Fractorium/Icons/arrow_out.png:/Fractorium/Icons/arrow_out.png - - - @@ -4334,23 +4344,6 @@ SpinBox - - - - true - - - Scale xform x percent down - - - - - - - :/Fractorium/Icons/arrow_in.png:/Fractorium/Icons/arrow_in.png - - - @@ -4410,6 +4403,40 @@ SpinBox + + + + true + + + Scale xform x percent up + + + + + + + :/Fractorium/Icons/arrow_out.png:/Fractorium/Icons/arrow_out.png + + + + + + + true + + + Scale xform x percent down + + + + + + + :/Fractorium/Icons/arrow_in.png:/Fractorium/Icons/arrow_in.png + + + @@ -4882,8 +4909,8 @@ SpinBox 0 0 - 250 - 520 + 216 + 680 @@ -4939,17 +4966,23 @@ SpinBox - 871 + 1030 0 - 241 + 200 881 + + + 80 + 200 + + QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable - Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea + Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea Info @@ -4990,7 +5023,7 @@ SpinBox 0 0 - 231 + 190 851 @@ -5543,8 +5576,15 @@ SpinBox + + + &View + + + + @@ -5562,13 +5602,13 @@ SpinBox - 287 - 636 + 150 + 200 - 330 + 524287 524287 @@ -5582,7 +5622,7 @@ SpinBox QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable - Qt::AllDockWidgetAreas + Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea Library @@ -5714,7 +5754,7 @@ SpinBox 0 0 - 275 + 188 824 @@ -6095,6 +6135,11 @@ SpinBox Ctrl+W + + + &Reset Workspace + + diff --git a/Source/Fractorium/FractoriumMenus.cpp b/Source/Fractorium/FractoriumMenus.cpp index 0e80710..852d678 100644 --- a/Source/Fractorium/FractoriumMenus.cpp +++ b/Source/Fractorium/FractoriumMenus.cpp @@ -29,6 +29,9 @@ void Fractorium::InitMenusUI() connect(ui.ActionPasteSelectedXforms, SIGNAL(triggered(bool)), this, SLOT(OnActionPasteSelectedXforms(bool)), Qt::QueuedConnection); ui.ActionPasteSelectedXforms->setEnabled(false); + //View menu. + connect(ui.ActionResetWorkspace, SIGNAL(triggered(bool)), this, SLOT(OnActionResetWorkspace(bool)), Qt::QueuedConnection); + //Tools menu. connect(ui.ActionAddReflectiveSymmetry, SIGNAL(triggered(bool)), this, SLOT(OnActionAddReflectiveSymmetry(bool)), Qt::QueuedConnection); connect(ui.ActionAddRotationalSymmetry, SIGNAL(triggered(bool)), this, SLOT(OnActionAddRotationalSymmetry(bool)), Qt::QueuedConnection); @@ -663,6 +666,33 @@ void Fractorium::OnActionPasteSelectedXforms(bool checked) m_Controller->PasteSelectedXforms(); } +/// +/// Reset dock widgets and tabs to their default position. +/// Note that there is a bug in Qt, where it will only move them all to the left side if at least +/// one is on the left side, or they are all floating. If one or more are docked right, and none are docked +/// left, then it will put them all on the right side. Hopefully this isn't too much of a problem. +/// +void Fractorium::OnActionResetWorkspace(bool checked) +{ + QDockWidget* firstDock = nullptr; + + for (auto dock : m_Docks) + { + dock->setFloating(true); + dock->setGeometry(QRect(100, 100, dock->width(), dock->height()));//Doesn't seem to have an effect. + dock->setFloating(false); + dock->show(); + + if (firstDock) + tabifyDockWidget(firstDock, dock); + + firstDock = dock; + } + + ui.LibraryDockWidget->raise(); + ui.LibraryDockWidget->show(); +} + /// /// Add reflective symmetry to the current ember. /// Resets the rendering process.