From 713007dadd5d4c30a854206af2d87415820571c9 Mon Sep 17 00:00:00 2001 From: mfeemster Date: Fri, 12 Dec 2014 00:54:03 -0800 Subject: [PATCH] Windows. --- Builds/MSVC/VS2013/Fractorium.vcxproj | 1 + Builds/MSVC/VS2013/Fractorium.vcxproj.filters | 3 + Source/Fractorium/AboutDialog.ui | 2 +- Source/Fractorium/DoubleSpinBox.h | 2 +- Source/Fractorium/Fractorium.cpp | 29 +++- Source/Fractorium/Fractorium.h | 12 +- Source/Fractorium/Fractorium.ui | 139 +++++++++++++----- Source/Fractorium/FractoriumInfo.cpp | 14 +- Source/Fractorium/GLWidget.cpp | 8 +- Source/Fractorium/GLWidget.h | 6 +- Source/Fractorium/Main.cpp | 34 +++-- Source/Fractorium/OptionsDialog.ui | 12 ++ Source/Fractorium/TwoButtonWidget.cpp | 2 - 13 files changed, 179 insertions(+), 85 deletions(-) delete mode 100644 Source/Fractorium/TwoButtonWidget.cpp diff --git a/Builds/MSVC/VS2013/Fractorium.vcxproj b/Builds/MSVC/VS2013/Fractorium.vcxproj index 0bc1f0f..95d8b18 100644 --- a/Builds/MSVC/VS2013/Fractorium.vcxproj +++ b/Builds/MSVC/VS2013/Fractorium.vcxproj @@ -731,6 +731,7 @@ xcopy /F /Y /R /D "$(SolutionDir)..\..\..\Data\flam3-palettes.xml" "$(OutDir)" + diff --git a/Builds/MSVC/VS2013/Fractorium.vcxproj.filters b/Builds/MSVC/VS2013/Fractorium.vcxproj.filters index bfb6e5e..ac10fe2 100644 --- a/Builds/MSVC/VS2013/Fractorium.vcxproj.filters +++ b/Builds/MSVC/VS2013/Fractorium.vcxproj.filters @@ -270,6 +270,9 @@ Header Files + + Header Files + diff --git a/Source/Fractorium/AboutDialog.ui b/Source/Fractorium/AboutDialog.ui index a770002..8601547 100644 --- a/Source/Fractorium/AboutDialog.ui +++ b/Source/Fractorium/AboutDialog.ui @@ -19,7 +19,7 @@ 488 - 615 + 617 diff --git a/Source/Fractorium/DoubleSpinBox.h b/Source/Fractorium/DoubleSpinBox.h index f4b8c4f..c5e79fd 100644 --- a/Source/Fractorium/DoubleSpinBox.h +++ b/Source/Fractorium/DoubleSpinBox.h @@ -30,7 +30,7 @@ public slots: void onSpinBoxValueChanged(double d); protected: - bool eventFilter(QObject* o, QEvent* e); + virtual bool eventFilter(QObject* o, QEvent* e) override; virtual void focusInEvent(QFocusEvent* e); virtual void focusOutEvent(QFocusEvent* e); virtual void enterEvent(QEvent* e); diff --git a/Source/Fractorium/Fractorium.cpp b/Source/Fractorium/Fractorium.cpp index 6e4d8c2..e7ae392 100644 --- a/Source/Fractorium/Fractorium.cpp +++ b/Source/Fractorium/Fractorium.cpp @@ -38,7 +38,7 @@ Fractorium::Fractorium(QWidget* p) m_OptionsDialog->layout()->setSizeConstraint(QLayout::SetFixedSize); m_OptionsDialog->setSizeGripEnabled(false); connect(m_ColorDialog, SIGNAL(colorSelected(const QColor&)), this, SLOT(OnColorSelected(const QColor&)), Qt::QueuedConnection); - + m_XformComboColors[i++] = QColor(0XFF, 0X00, 0X00); m_XformComboColors[i++] = QColor(0XCC, 0XCC, 0X00); m_XformComboColors[i++] = QColor(0X00, 0XCC, 0X00); @@ -143,8 +143,8 @@ Fractorium::Fractorium(QWidget* p) ui.PaletteAdjustTable->setStyleSheet("QTableWidget::item { padding: 1px; }");//Need this to avoid covering the top border pixel with the spinners. ui.statusBar->setStyleSheet("QStatusBar QLabel { padding-left: 2px; padding-right: 2px; }"); - //setStyleSheet("QGroupBox { border: 2px solid gray; border-radius: 3px; } "); - + //setStyleSheet("QGroupBox { border: 2px solid gray; border-radius: 3px; } "); + m_PreviousPaletteRow = -1;//Force click handler the first time through. //Setup pointer in the GL window to point back to here. @@ -152,6 +152,7 @@ Fractorium::Fractorium(QWidget* p) SetCoordinateStatus(0, 0, 0, 0); SetTabOrders(); + ui.GLParentScrollArea->installEventFilter(this); //At this point, everything has been setup except the renderer. Shortly after //this constructor exits, GLWidget::initializeGL() will create the initial flock and start the rendering timer @@ -249,8 +250,28 @@ void Fractorium::dockLocationChanged(Qt::DockWidgetArea area) /// /// -/// Resize event, change width and height double click values to match the window size. +/// Event filter for taking special action on dock widget resize events, +/// which in turn trigger GLParentScrollArea events. /// +/// The object +/// The eevent +/// false +bool Fractorium::eventFilter(QObject* o, QEvent* e) +{ + if (o == ui.GLParentScrollArea && e->type() == QEvent::Resize) + { + m_WidthSpin->DoubleClickNonZero(ui.GLParentScrollArea->width()); + m_HeightSpin->DoubleClickNonZero(ui.GLParentScrollArea->height()); + } + + return QMainWindow::eventFilter(o, e); +} + +/// +/// Respond to a resize event which will set the double click default value +/// in the width and height spinners. +/// Note, this does not change the size of the ember being rendered or +/// the OpenGL texture it's being drawn on. /// The event void Fractorium::resizeEvent(QResizeEvent* e) { diff --git a/Source/Fractorium/Fractorium.h b/Source/Fractorium/Fractorium.h index ecf0c39..d03a6d6 100644 --- a/Source/Fractorium/Fractorium.h +++ b/Source/Fractorium/Fractorium.h @@ -73,11 +73,11 @@ class Fractorium : public QMainWindow friend FinalRenderEmberController; #ifdef DO_DOUBLE - friend GLEmberController; - friend FractoriumEmberController; - friend FinalRenderEmberController; + friend GLEmberController; + friend FractoriumEmberController; + friend FinalRenderEmberController; #endif - + public: Fractorium(QWidget* p = 0); ~Fractorium(); @@ -262,6 +262,7 @@ public: static int FlipDet(Affine2D& affine); protected: + virtual bool eventFilter(QObject* o, QEvent* e) override; virtual void resizeEvent(QResizeEvent* e) override; virtual void closeEvent(QCloseEvent* e) override; virtual void dragEnterEvent(QDragEnterEvent* e) override; @@ -406,8 +407,7 @@ private: char m_URString[32]; char m_LRString[32]; char m_LLString[32]; - char m_WString[16]; - char m_HString[16]; + char m_WHString[64]; char m_DEString[16]; char m_CoordinateString[128]; QColor m_XformComboColors[XFORM_COLOR_COUNT], m_FinalXformComboColor; diff --git a/Source/Fractorium/Fractorium.ui b/Source/Fractorium/Fractorium.ui index 8d40726..41063f4 100644 --- a/Source/Fractorium/Fractorium.ui +++ b/Source/Fractorium/Fractorium.ui @@ -37,7 +37,7 @@ - + 0 0 @@ -59,12 +59,12 @@ 0 0 - 897 - 941 + 923 + 942 - + 0 0 @@ -79,7 +79,7 @@ - + 0 0 @@ -178,7 +178,7 @@ 0 0 1214 - 20 + 21 @@ -256,9 +256,15 @@ + + + 0 + 0 + + - 280 + 287 561 @@ -358,7 +364,7 @@ - + 0 0 @@ -391,6 +397,9 @@ true + + true + Library @@ -426,8 +435,8 @@ 0 0 - 290 - 845 + 259 + 852 @@ -495,6 +504,9 @@ 0 + + true + Flame @@ -530,8 +542,8 @@ 0 0 - 290 - 845 + 259 + 852 @@ -1901,6 +1913,9 @@ 0 + + true + @@ -2238,7 +2253,7 @@ - + 0 0 @@ -2284,11 +2299,11 @@ SpinBox QTabWidget::Triangular - 1 + 2 - + 0 0 @@ -2778,7 +2793,7 @@ SpinBox - + 0 0 @@ -2824,8 +2839,8 @@ SpinBox 0 0 - 276 - 728 + 245 + 747 @@ -4610,6 +4625,9 @@ SpinBox + + true + Palette @@ -4957,8 +4975,14 @@ SpinBox + + + 0 + 0 + + - false + true Info @@ -4971,7 +4995,7 @@ SpinBox 5 - 5 + 4 5 @@ -4981,6 +5005,12 @@ SpinBox + + + 0 + 0 + + false @@ -5001,10 +5031,16 @@ SpinBox 0 0 - 290 - 845 + 259 + 853 + + + 0 + 0 + + true @@ -5029,6 +5065,12 @@ SpinBox + + + 0 + 0 + + 0 @@ -5038,7 +5080,7 @@ SpinBox 16777215 - 257 + 250 @@ -5119,6 +5161,12 @@ SpinBox + + QFrame::Box + + + QFrame::Plain + UL: @@ -5127,8 +5175,11 @@ SpinBox - + + + QFrame::Box + LR: @@ -5137,8 +5188,11 @@ SpinBox - + + + QFrame::Box + UR: @@ -5147,15 +5201,24 @@ SpinBox - - + + + + QFrame::Box + - H: + W x H: + + + Qt::AlignCenter + + QFrame::Box + LL: @@ -5164,16 +5227,6 @@ SpinBox - - - - W: - - - Qt::AlignHCenter|Qt::AlignTop - - - @@ -5351,7 +5404,7 @@ SpinBox - + 0 0 @@ -5406,11 +5459,17 @@ SpinBox - + 0 0 + + + 0 + 0 + + Qt::StrongFocus diff --git a/Source/Fractorium/FractoriumInfo.cpp b/Source/Fractorium/FractoriumInfo.cpp index c03badf..085c3f2 100644 --- a/Source/Fractorium/FractoriumInfo.cpp +++ b/Source/Fractorium/FractoriumInfo.cpp @@ -10,19 +10,17 @@ void Fractorium::UpdateHistogramBounds() { if (RendererBase* r = m_Controller->Renderer()) { - sprintf_s(m_ULString, 32, "UL: %3.3f, %3.3f", r->LowerLeftX(), r->UpperRightY());//These bounds include gutter padding. - sprintf_s(m_URString, 32, "UR: %3.3f, %3.3f", -r->LowerLeftX(), r->UpperRightY()); - sprintf_s(m_LRString, 32, "LR: %3.3f, %3.3f", -r->LowerLeftX(), r->LowerLeftY()); - sprintf_s(m_LLString, 32, "LL: %3.3f, %3.3f", r->LowerLeftX(), r->LowerLeftY()); - sprintf_s(m_WString, 16, "W: %4lu" , r->SuperRasW()); - sprintf_s(m_HString, 16, "H: %4lu" , r->SuperRasH()); + sprintf_s(m_ULString, 32, "UL: %3.3f, %3.3f", r->LowerLeftX(), r->UpperRightY());//These bounds include gutter padding. + sprintf_s(m_URString, 32, "UR: %3.3f, %3.3f", -r->LowerLeftX(), r->UpperRightY()); + sprintf_s(m_LRString, 32, "LR: %3.3f, %3.3f", -r->LowerLeftX(), r->LowerLeftY()); + sprintf_s(m_LLString, 32, "LL: %3.3f, %3.3f", r->LowerLeftX(), r->LowerLeftY()); + sprintf_s(m_WHString, 32, "W x H: %4lu x %4lu", r->SuperRasW(), r->SuperRasH()); ui.InfoBoundsLabelUL->setText(QString(m_ULString)); ui.InfoBoundsLabelUR->setText(QString(m_URString)); ui.InfoBoundsLabelLR->setText(QString(m_LRString)); ui.InfoBoundsLabelLL->setText(QString(m_LLString)); - ui.InfoBoundsLabelW->setText(QString(m_WString)); - ui.InfoBoundsLabelH->setText(QString(m_HString)); + ui.InfoBoundsLabelWH->setText(QString(m_WHString)); ui.InfoBoundsTable->item(0, 1)->setText(ToString(r->GutterWidth())); diff --git a/Source/Fractorium/GLWidget.cpp b/Source/Fractorium/GLWidget.cpp index 7fbecdc..928ef89 100644 --- a/Source/Fractorium/GLWidget.cpp +++ b/Source/Fractorium/GLWidget.cpp @@ -717,10 +717,10 @@ void GLWidget::wheelEvent(QWheelEvent* e) } /// -/// Respond to a resize event which will set the read only -/// main window width and height spinners. -/// The main window will take care of stopping and restarting the -/// render timer. +/// Respond to a resize event which will set the double click default value +/// in the width and height spinners. +/// Note, this does not change the size of the ember being rendered or +/// the OpenGL texture it's being drawn on. /// /// The event void GLWidget::resizeEvent(QResizeEvent* e) diff --git a/Source/Fractorium/GLWidget.h b/Source/Fractorium/GLWidget.h index bab7195..72342d1 100644 --- a/Source/Fractorium/GLWidget.h +++ b/Source/Fractorium/GLWidget.h @@ -36,12 +36,12 @@ class GLWidget : public QGLWidget, protected QOpenGLFunctions_2_0//QOpenGLFuncti friend FractoriumEmberController; friend GLEmberControllerBase; friend GLEmberController; - + #ifdef DO_DOUBLE friend GLEmberController; - friend FractoriumEmberController; + friend FractoriumEmberController; #endif - + public: GLWidget(QWidget* p); ~GLWidget(); diff --git a/Source/Fractorium/Main.cpp b/Source/Fractorium/Main.cpp index 0fa95ea..d27c20f 100644 --- a/Source/Fractorium/Main.cpp +++ b/Source/Fractorium/Main.cpp @@ -29,22 +29,24 @@ int main(int argc, char *argv[]) #else putenv(const_cast("GPU_MAX_ALLOC_PERCENT=100")); #endif - - //a.setStyle("motif"); - //a.setStyleSheet("QGroupBox { border: 1px solid gray; border-radius: 3px; margin-top: 1em; } "); - - a.setStyleSheet("QGroupBox { border: 1px solid gray; border-radius: 3px; margin-top: 1.1em; background-color: transparent; } \n" - "QTabBar::tab { height: 2.8ex; } \n" - "QGroupBox::title " - "{" - " background-color: transparent;" - " subcontrol-origin: margin; " - //" left: 3px; " - " subcontrol-position: top left;" - " padding: 0 3px 0 3px;" - //" padding: 2px;" - "}" ); - + +#ifndef WIN32 + //a.setStyle("motif"); + //a.setStyleSheet("QGroupBox { border: 1px solid gray; border-radius: 3px; margin-top: 1em; } "); + + a.setStyleSheet("QGroupBox { border: 1px solid gray; border-radius: 3px; margin-top: 1.1em; background-color: transparent; } \n" + "QTabBar::tab { height: 2.8ex; } \n" + "QGroupBox::title " + "{" + " background-color: transparent;" + " subcontrol-origin: margin; " + //" left: 3px; " + " subcontrol-position: top left;" + " padding: 0 3px 0 3px;" + //" padding: 2px;" + "}" ); +#endif + Fractorium w; w.show(); return a.exec(); diff --git a/Source/Fractorium/OptionsDialog.ui b/Source/Fractorium/OptionsDialog.ui index cec1cc8..3f88c84 100644 --- a/Source/Fractorium/OptionsDialog.ui +++ b/Source/Fractorium/OptionsDialog.ui @@ -55,6 +55,9 @@ Qt::NoFocus + + true + QTabWidget::Triangular @@ -62,6 +65,9 @@ 0 + + true + Interactive Rendering @@ -297,6 +303,9 @@ in interactive mode for each mouse movement + + true + Xml Saving @@ -480,6 +489,9 @@ in interactive mode for each mouse movement + + true + Identity diff --git a/Source/Fractorium/TwoButtonWidget.cpp b/Source/Fractorium/TwoButtonWidget.cpp deleted file mode 100644 index f5a4681..0000000 --- a/Source/Fractorium/TwoButtonWidget.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "FractoriumPch.h" -#include "TwoButtonComboWidget.h"