itom
Loading...
Searching...
No Matches
widgetPropPalettes.h
1/* ********************************************************************
2itom software
3URL: http://www.uni-stuttgart.de/ito
4Copyright (C) 2020, Institut für Technische Optik (ITO),
5Universität Stuttgart, Germany
6
7This file is part of itom.
8
9itom is free software; you can redistribute it and/or modify it
10under the terms of the GNU Library General Public Licence as published by
11the Free Software Foundation; either version 2 of the Licence, or (at
12your option) any later version.
13
14itom is distributed in the hope that it will be useful, but
15WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17General Public Licence for more details.
18
19You should have received a copy of the GNU Library General Public License
20along with itom. If not, see <http://www.gnu.org/licenses/>.
21*********************************************************************** */
22#ifndef WIDGETPROPPALETTES_H
23#define WIDGETPROPPALETTES_H
24
25#include "abstractPropertyPageWidget.h"
26#include <qwidget.h>
27#include <qgraphicsitem.h>
28
29#include "ui_widgetPropPalettes.h"
30#include "../organizer/paletteOrganizer.h"
31
32namespace ito
33{
34
35class WidgetPropPalettes;
36
37//----------------------------------------------------------------------------------------------------------------------------------
38class ColCurve : public QObject, public QGraphicsPathItem
39{
40 Q_OBJECT
41
42 public:
43 ColCurve(WidgetPropPalettes *parentWidget, int colChannel, QObject *parent = NULL)
44 : QObject(parent), QGraphicsPathItem(),
45 m_parentWidget(parentWidget), m_colChannel(colChannel),
46 m_editable(true)
47 {
48 }
49
50 int getColChannel() const { return m_colChannel; }
51
52 void setEditable(bool editable) { m_editable = editable; }
53 bool editable() const { return m_editable; }
54
55 void setActiveSceneSize(const QSizeF size) { m_activeSceneSize = size; }
56
57 private:
58 int m_colChannel;
59 WidgetPropPalettes *m_parentWidget;
60 QPointF m_insertPos;
61 bool m_editable;
62
63 QSizeF m_activeSceneSize;
64
65 protected:
66 void mousePressEvent(QGraphicsSceneMouseEvent*);
67 void mouseMoveEvent(QGraphicsSceneMouseEvent*);
68 void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
69
70 protected slots:
71 void removeDataPoint();
72 void addDataPoint();
73};
74
75//----------------------------------------------------------------------------------------------------------------------------------
77{
78 Q_OBJECT
79
80 public:
81 WidgetPropPalettes(QWidget *parent = NULL);
83
84 void readSettings();
85 void writeSettings();
86 const ItomPaletteBase* getCurPalette() const { return &m_currentPalette; }
87 void drawPalCurves(int selPt = -1);
88 void updateOptionPalette();
89
90 void removeColorStop(int index);
91 void addColorStop(int index_before, float percent_to_next = 0.5);
92 void changeSelectedColorStop(int new_index);
93 int getSelectedColorStop() const { return m_selectedColorStop; }
94
95
96 ito::RetVal saveCurrentPalette();
97
98 friend class ColCurve;
99
100 private:
101 Ui::WidgetPropPalettes ui;
102 QImage m_imgGVCurPalette;
103 int m_selectedColorStop;
104 int m_isUpdating;
105 int m_isDirty;
106
107 float m_gvSceneMarginLeftRight;
108 float m_gvPaletteSceneMarginTopBottom;
109 float m_gvCurveSceneMarginTopBottom;
110
111 void updatePaletteList();
112
113 void updateViewOnResize();
114
115 QList<ito::ItomPaletteBase> m_palettes; //all existing palettes
116 int m_curPaletteIndex; //index of current palette in m_palettes or -1 if new and not saved, yet
117 ito::ItomPaletteBase m_currentPalette;
118
119 QGraphicsScene *m_pSceneCurPalette;
120 QGraphicsScene *m_pScenePalCurves;
121
122 public slots:
123 void lwCurrentRowChanged(int row);
124 void colorComponentChanged(int value);
125 void colorComponentVisibilityChanged(bool);
126
127 void palSpecialColorChanged(QColor color);
128
129 private slots:
130 void on_sbIndex_valueChanged(double value);
131 void on_pbAdd_clicked();
132 void on_pbDuplicate_clicked();
133 void on_pbRemove_clicked();
134 void on_pbPalSave_clicked();
135 void on_pbEquidistantColorStop_clicked();
136 void on_pbRemoveColorStop_clicked();
137 void on_pbAddColorStop_clicked();
138 void on_lePalName_textChanged(const QString & text);
139 void on_pbImportPalette_clicked();
140 void on_pbExportPalette_clicked();
141 void on_btnColor_colorChanged(QColor color);
142
143 protected:
144 bool eventFilter(QObject *obj, QEvent *event);
145};
146
147}//end namespace
148#endif
Definition abstractPropertyPageWidget.h:33
Definition widgetPropPalettes.h:39
Definition paletteOrganizer.h:39
Class for managing status values (like errors or warning)
Definition retVal.h:54
Definition widgetPropPalettes.h:77
void readSettings()
Definition widgetPropPalettes.cpp:977
void writeSettings()
Definition widgetPropPalettes.cpp:997
Definition apiFunctionsGraph.cpp:40