fractorium/Source/Fractorium/DoubleSpinBox.h
Person 8a4127d5d7 --User changes
-Add a palette editor.
 -Add support for reading .ugr/.gradient/.gradients palette files.
 -Allow toggling on spinners whose minimum value is not zero.
 -Allow toggling display of image, affines and grid.
 -Add new variations: cylinder2, circlesplit, tile_log, truchet_fill, waves2_radial.

--Bug fixes
 -cpow2 was wrong.
 -Palettes with rapid changes in color would produce slightly different outputs from Apo/Chaotica. This was due to a long standing bug from flam3.
 -Use exec() on Apple and show() on all other OSes for dialog boxes.
 -Trying to render a sequence with no frames would crash.
 -Selecting multiple xforms and rotating them would produce the wrong rotation.
 -Better handling when parsing flames using different encoding, such as unicode and UTF-8.
 -Switching between SP/DP didn't reselect the selected flame in the Library tab.

--Code changes
 -Make all types concerning palettes be floats, including PaletteTableWidgetItem.
 -PaletteTableWidgetItem is no longer templated because all palettes are float.
 -Include the source colors for user created gradients.
 -Change parallel_for() calls to work with very old versions of TBB which are lingering on some systems.
 -Split conditional out of accumulation loop on the CPU for better performance.
 -Vectorize summing when doing density filter for better performance.
 -Make all usage of palettes be of type float, double is pointless.
 -Allow palettes to reside in multiple folders, while ensuring only one of each name is added.
 -Refactor some palette path searching code.
 -Make ReadFile() throw and catch an exception if the file operation fails.
 -A little extra safety in foci and foci3D with a call to Zeps().
 -Cast to (real_t) in the OpenCL string for the w variation, which was having trouble compiling on Mac.
 -Fixing missing comma between paths in InitPaletteList().
 -Move Xml and PaletteList classes into cpp to shorten build times when working on them.
 -Remove default param values for IterOpenCLKernelCreator<T>::SharedDataIndexDefines in cpp file.
 -Change more NULL to nullptr.
2017-02-26 00:02:21 -08:00

104 lines
3.1 KiB
C++

#pragma once
#include "FractoriumPch.h"
#include "FractoriumSettings.h"
/// <summary>
/// DoubleSpinBox and VariationTreeDoubleSpinBox classes.
/// </summary>
enum class eSpinToggle : et { NONE = 0, SPIN_DOUBLE_CLICK = 1, SPIN_RIGHT_CLICK = 2 };
/// <summary>
/// A derivation to prevent the spin box from selecting its own text
/// when editing. Also to prevent multiple spin boxes from all having
/// selected text at once.
/// </summary>
class DoubleSpinBox : public QDoubleSpinBox
{
Q_OBJECT
public:
explicit DoubleSpinBox(QWidget* parent = nullptr, int height = 16, double step = 0.05);
virtual ~DoubleSpinBox() { }
void SetValueStealth(double d);
void DoubleClick(bool b);
void DoubleClickLowVal(double val);
void DoubleClickZero(double val);
void DoubleClickNonZero(double val);
double Step();
void Step(double step);
double SmallStep();
void SmallStep(double step);
QLineEdit* lineEdit();
public slots:
void OnSpinBoxValueChanged(double d);
void OnTimeout();
protected:
virtual bool eventFilter(QObject* o, QEvent* e) override;
virtual void focusInEvent(QFocusEvent* e);
virtual void focusOutEvent(QFocusEvent* e);
virtual void enterEvent(QEvent* e);
virtual void leaveEvent(QEvent* e);
private:
void StartTimer();
void StopTimer();
bool m_DoubleClick;
double m_DoubleClickLowVal;
double m_DoubleClickNonZero;
double m_DoubleClickZero;
double m_Step;
double m_SmallStep;
QPoint m_MouseDownPoint;
QPoint m_MouseMovePoint;
shared_ptr<FractoriumSettings> m_Settings;
static QTimer s_Timer;
};
/// <summary>
/// VariationTreeWidgetItem and VariationTreeDoubleSpinBox need each other, but each can't include the other.
/// So VariationTreeWidgetItem includes this file, and use a forward declaration here.
/// </summary>
class VariationTreeWidgetItem;
/// <summary>
/// Derivation for the double spin boxes that are in the
/// variations tree.
/// </summary>
class VariationTreeDoubleSpinBox : public DoubleSpinBox
{
public:
/// <summary>
/// Constructor that passes agruments to the base and assigns the m_Param and m_Variation members.
/// </summary>
/// <param name="p">The parent widget</param>
/// <param name="widgetItem">The widget item this spinner is contained in</param>
/// <param name="id">The variation this spinner is for</param>
/// <param name="param">The name of the parameter this is for</param>
/// <param name="h">The height of the spin box. Default: 16.</param>
/// <param name="step">The step used to increment/decrement the spin box when using the mouse wheel. Default: 0.05.</param>
explicit VariationTreeDoubleSpinBox(QWidget* p, VariationTreeWidgetItem* widgetItem, eVariationId id, const string& param, int h = 16, double step = 0.05)
: DoubleSpinBox(p, h, step)
{
m_WidgetItem = widgetItem;
m_Param = param;
m_Id = id;
setDecimals(3);
}
virtual ~VariationTreeDoubleSpinBox() { }
bool IsParam() { return !m_Param.empty(); }
string ParamName() { return m_Param; }
eVariationId GetVariationId() { return m_Id; }
VariationTreeWidgetItem* WidgetItem() { return m_WidgetItem; }
private:
string m_Param;
eVariationId m_Id;
VariationTreeWidgetItem* m_WidgetItem;
};