mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-01-22 13:40:06 -05:00
26c558a2f5
-Give tabs a height of 4px in the qss files. Looks a little large on 4k screens, but just right on HD screens which are much more common. -Allow for styling of zero and non-zero variation tree nodes via qss. -Allow for toggling whether to interpolate between colors in the palette editor, or to do hard cuts between colors. -Allow for adjusting spinner values with the + = or up arrow keys to increase, and - _ or down arrow keys to decrease. -Allow for responding to global presses of + = and - _ to cycle up or down to specify which xform is set as the current one. -Allow for adding "layers" via xaos which will add a user-specified number of xforms, and set certain xaos values to 0 or 1. -Add a new menu item under the Edit menu to copy the OpenCL iteration kernel source to the clipboard. -Show text on the status bar which indicates that an OpenCL kernel compilation is taking place. -Show xform name on xform combo box when expanded. Adjust size to fit all names. -Draw post affine circles using dashed lines. -Prevent QSS dialog from styling its editor, which makes it easier to see text when creating styles which have custom colors for text boxes. --Bug fixes -Fix up some table layouts which seemed to have regressed/decayed over time for reasons unknown. -Using undo/redo would create a new flame in the library every time. -Solo was not being preserved when using undo/redo. --Code changes -Make the solo flag be a part of the flame data now. -Fix some tabification in the OpenCL code for EllipticVariation. -Fix tabification in the varState code for OpenCL. -Add an event called m_CompileBegun to RendererCL that is called right before an OpenCL compile is begun. --This required making RendererCLBase not a pure virtual base class. Member functions just return defaults. -Filter key presses on main window to only process the third one. This is due to Qt triggering three events for every key press. -The palette preview table was installing an event filter for seemingly no reason. Remove it. -Mark certain virtual functions as override in SpinBox and DoubleSpinBox.
90 lines
3.0 KiB
C++
90 lines
3.0 KiB
C++
#pragma once
|
|
|
|
#include "FractoriumPch.h"
|
|
#include "ColorPickerWidget.h"
|
|
#include "GradientColorsView.h"
|
|
#include "EmberFile.h"
|
|
#include "ui_PaletteEditor.h"
|
|
|
|
namespace Ui
|
|
{
|
|
class PaletteEditor;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Dialog for editing user created palettes.
|
|
/// This will load with all available user created palettes populated in the combo
|
|
/// box. As the user changes the selected index, the palettes for that file
|
|
/// are shown in the list box. The user can click on those and then edit them and either
|
|
/// save it back to the same position in the file, or append it to the end.
|
|
/// They can also click in the name column to set/rename the palette name.
|
|
/// Any changes on this dialog can be "synced". That is, when the Sync checkbox is checked
|
|
/// any changes result in a signal being sent back to the main window.
|
|
/// </summary>
|
|
class PaletteEditor : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit PaletteEditor(QWidget* p = nullptr);
|
|
|
|
public:
|
|
bool Sync();
|
|
Palette<float>& GetPalette(int size);
|
|
void SetPalette(const Palette<float>& palette);
|
|
map<size_t, float> GetColorIndices() const;
|
|
void SetColorIndices(const map<size_t, float>& indices);
|
|
string GetPaletteFile() const;
|
|
void SetPaletteFile(const string& filename);
|
|
|
|
Q_SIGNALS:
|
|
void PaletteChanged();
|
|
void PaletteFileChanged();
|
|
void ColorIndexChanged(size_t index, float value);
|
|
|
|
private Q_SLOTS:
|
|
void OnAddColorButtonClicked();
|
|
void OnRemoveColorButtonClicked();
|
|
void OnInvertColorsButtonClicked();
|
|
void OnRandomColorsButtonClicked();
|
|
void OnDistributeColorsButtonClicked();
|
|
void OnResetToDefaultButtonClicked();
|
|
void OnCreatePaletteFromImageButtonClicked();
|
|
void OnCreatePaletteAgainFromImageButton();
|
|
void OnColorPickerColorChanged(const QColor& col);
|
|
void OnArrowDoubleClicked(const GradientArrow& arrow);
|
|
void OnSyncCheckBoxStateChanged(int state);
|
|
void OnBlendCheckBoxStateChanged(int state);
|
|
void OnArrowMoved(qreal lastPos, const GradientArrow& arrow);
|
|
void OnColorIndexMove(size_t index, float value);
|
|
void OnPaletteFilenameComboChanged(const QString& text);
|
|
void OnPaletteCellClicked(int row, int col);
|
|
void OnPaletteCellChanged(int row, int col);
|
|
void OnNewPaletteFileButtonClicked();
|
|
void OnCopyPaletteFileButtonClicked();
|
|
void OnAppendPaletteButtonClicked();
|
|
void OnOverwritePaletteButtonClicked();
|
|
void OnDeletePaletteButtonClicked();
|
|
|
|
private:
|
|
void EmitPaletteChanged();
|
|
void EmitColorIndexChanged(size_t index, float value);
|
|
QStringList SetupOpenImagesDialog();
|
|
void AddArrow(const QColor& color);
|
|
map<float, GradientArrow> GetRandomColorsFromImage(QString filename, int numPoints);
|
|
void EnablePaletteFileControls();
|
|
void EnablePaletteControls();
|
|
bool IsCurrentPaletteAndFileEditable();
|
|
bool m_PaletteFileChanged = false;
|
|
int m_PaletteIndex = 0;
|
|
QString m_Filename;
|
|
string m_CurrentPaletteFilePath;
|
|
ColorPickerWidget* m_ColorPicker = nullptr;
|
|
GradientColorsView* m_GradientColorView = nullptr;
|
|
#ifndef __APPLE__
|
|
QFileDialog* m_FileDialog = nullptr;
|
|
#endif
|
|
shared_ptr<PaletteList<float>> m_PaletteList;
|
|
std::unique_ptr<Ui::PaletteEditor> ui;
|
|
};
|