iRoCS Toolbox  1.1.0
ColorMapEditorWidget.hh
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * This file belongs to the iRoCS Toolbox.
4  *
5  * Copyright (C) 2015 Thorsten Falk
6  *
7  * Image Analysis Lab, University of Freiburg, Germany
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  **************************************************************************/
24 
25 #ifndef COLORMAPEDITORWIDGET_HH
26 #define COLORMAPEDITORWIDGET_HH
27 
28 #ifdef HAVE_CONFIG_H
29 #include <config.hh>
30 #endif
31 
32 #include <QtGui/QWidget>
33 
34 #include "IColorMapEditor.hh"
35 
36 class QLabel;
37 class QTreeWidget;
38 class QPushButton;
39 class QToolButton;
40 
42 class IntControlElement;
44 class BoolControlElement;
46 
47 class ColorMapEditorWidget : public QWidget, public IColorMapEditor
48 {
49 
50 Q_OBJECT
51 
52 public:
53 
54  ColorMapEditorWidget(ColorMap *colorMap = NULL, QWidget *parent = NULL);
56 
57  void updateIndexRange(bool updatePreview = true);
58  void updateIntermediateColors(bool updatePreview = true);
59  void updateOverrideColors(bool updatePreview = true);
60  void updateMonochromeColor(bool updatePreview = true);
61  void updateRangeIndicator(bool updatePreview = true);
62  void updateGamma(bool updatePreview = true);
63 
64  void updateControls();
65 
66 signals:
67 
68  void colorMapChanged();
69 
70 private slots:
71 
72  void processPresetColorMapSelection();
73  void processColorMapLoadAction();
74  void processColorMapSaveAction();
75  void processPresetRangeSelection();
76  void processColorMapStartIndexChange();
77  void processColorMapEndIndexChange();
78  void processGammaChange();
79  void processRangeIndicatorChange();
80  void processStartColorChange();
81  void processEndColorChange();
82  void processMonochromeColorChange();
83  void processIntermediateColorAddition();
84  void processIntermediateColorDeletion();
85  void processIntermediateColorPercentageChange();
86  void processIntermediateColorChange();
87  void processIntermediateColorSelectionChange();
88  void processOverrideColorAddition();
89  void processOverrideColorDeletion();
90  void processOverrideColorIndexChange();
91  void processOverrideColorChange();
92  void processOverrideColorSelectionChange();
93  void toggleAdvanced(bool toggle);
94  void updateColorMapPreview();
95 
96  void resizeEvent(QResizeEvent *e);
97 
98 private:
99 
100  void setConnectionsEnabled(bool enable);
101 
102  QLabel *p_preview;
104  QAction *p_load, *p_save;
105  StringSelectionControlElement *p_dataType;
106  IntControlElement *p_startIndex, *p_endIndex;
107  DoubleControlElement *p_gamma;
108  BoolControlElement *p_rangeIndicator;
109  ColorControlElement *p_monochromeColor;
110  QTreeWidget *p_intermediateColors;
111  QPushButton *p_addIntermediateColor, *p_removeIntermediateColor;
112  QTreeWidget *p_overrideColors;
113  QPushButton *p_addOverrideColor, *p_removeOverrideColor;
114  QToolButton *p_toggleAdvancedButton;
115  QWidget *p_advancedWidget;
116  bool _connectionsEnabled;
117 
118 };
119 
120 #endif
void updateIndexRange(bool updatePreview=true)
ColorMap * colorMap() const
ColorMapEditorWidget(ColorMap *colorMap=NULL, QWidget *parent=NULL)
void updateRangeIndicator(bool updatePreview=true)
void updateGamma(bool updatePreview=true)
void updateOverrideColors(bool updatePreview=true)
void updateMonochromeColor(bool updatePreview=true)
void updateIntermediateColors(bool updatePreview=true)