Developer Documentation

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
ColorPlugin.hh
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openflipper.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenFlipper. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41
42 /*===========================================================================*\
43 * *
44 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49
50 #ifndef COLORPLUGIN_HH
51 #define COLORPLUGIN_HH
52
53 #include <OpenFlipper/common/Types.hh>
54 #include <OpenFlipper/BasePlugin/BaseInterface.hh>
55 #include <OpenFlipper/BasePlugin/MenuInterface.hh>
56 #include <OpenFlipper/BasePlugin/ScriptInterface.hh>
57 #include <OpenFlipper/BasePlugin/ToolbarInterface.hh>
58 #include "OpenFlipper/BasePlugin/StatusbarInterface.hh"
59 #include "OpenFlipper/BasePlugin/OptionsInterface.hh"
60 #include "OpenFlipper/BasePlugin/INIInterface.hh"
61
62 #include <QObject>
63 #include <QMenuBar>
64 #include "ColorPlugin.hh"
65
66 #include "ColorOptions.hh"
67
68 #include "OpenFlipper/INIFile/INIFile.hh"
69
70 class ColorPlugin : public QObject, BaseInterface, MenuInterface, ScriptInterface, ToolbarInterface, StatusbarInterface, OptionsInterface, INIInterface
71 {
72
73 Q_OBJECT
74
75 Q_INTERFACES(BaseInterface)
76 Q_INTERFACES(MenuInterface)
77 Q_INTERFACES(ScriptInterface)
78 Q_INTERFACES(ToolbarInterface)
79 Q_INTERFACES(StatusbarInterface)
80 Q_INTERFACES(OptionsInterface)
81 Q_INTERFACES(INIInterface)
82
83 #if QT_VERSION >= 0x050000
84 Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-Color")
85 #endif
86
87 signals:
88 // BaseInterface
89 void updateView();
90
91 // ScriptInterface
92 void scriptInfo( QString _functionName );
93
94 // MenuInterface
95 void addMenubarAction(QAction* _action, QString _type );
96
97 // ToolbarInterface
98 void addToolbar(QToolBar* _toolbar);
99 void removeToolbar(QToolBar* _toolbar);
100
101 // StatusbarInterface
102 void showStatusMessage(QString _message, int _timeout = 0);
103
104 private slots:
105
106 // BaseInterface
107 void pluginsInitialized();
108
109 // OptionsInterface
110 void applyOptions();
111
112 // INIInterface
113 void loadIniFileOptions(INIFile& _ini);
114 void saveIniFileOptions(INIFile& _ini);
115
116 public :
117
118 // OptionsInterface
119 bool initializeOptionsWidget(QWidget*& _widget);
120
121 // BaseInterface
122 QString name() { return (QString("Color Plugin")); };
123 QString description( ) { return (tr("Sets the Default colors e.g. for slides, paper,... snapshots")); };
124
126 ColorPlugin();
127
128
129 //===========================================================================
132 //===========================================================================
133
134 private:
136 ColorOptions* optionsWidget_;
137
139 QIcon generateIcon(QRgb _color);
140
142 QIcon generateIcon(OpenMesh::Vec4f _color);
143
145 QRgb getIconColor(QIcon _icon);
146
148 void setNewColor(QIcon _icon, OpenMesh::Vec4f& _color);
149
151 void convertColor(uint _color, OpenMesh::Vec4f& _vector);
152
154 uint convertColor(OpenMesh::Vec4f& _vector);
155
156 //internal storage of colors
157 OpenMesh::Vec4f backgroundColorDefault_, backgroundColorPaper_, backgroundColorPresentation_;
158 OpenMesh::Vec4f baseColorDefault_, baseColorPaper_, baseColorPresentation_;
159 OpenMesh::Vec4f materialColorDefault_, materialColorPaper_, materialColorPresentation_;
160
161 double lineWidthDefault_, lineWidthPaper_, lineWidthPresentation_;
162
163 private slots:
165 void getColorDialog();
166
169 //===========================================================================
172 //===========================================================================
173
174 public slots:
178 void setDefaultColor();
179
183 void setPresentationColor();
184
188 void setPaperColor();
189
193 void setBackgroundColor( Vector _color );
194
198 void setObjectEmissiveColor(int _objectId , Vector4 _color);
199
203 void setObjectAmbientColor(int _objectId , Vector4 _color);
204
208 void setObjectDiffuseColor(int _objectId , Vector4 _color);
209
213 void setObjectSpecularColor(int _objectId , Vector4 _color);
214
217 //===========================================================================
220 //===========================================================================
221
222 public slots:
223
227 QString version() { return QString("1.0"); };
228
230 };
231
232 #endif //COLORPLUGIN_HH
BaseInterface
Interface class from which all plugins have to be created.
Definition: BaseInterface.hh:76
ColorPlugin::optionsWidget_
ColorOptions * optionsWidget_
the options widget to set colors
Definition: ColorPlugin.hh:136
ColorPlugin::description
QString description()
Return a description of what the plugin is doing.
Definition: ColorPlugin.hh:123
ColorOptions
Definition: ColorOptions.hh:59
ColorPlugin::lineWidthDefault_
double lineWidthDefault_
the options widget to set colors
Definition: ColorPlugin.hh:161
INIInterface
Interface class for Plugins which have to store information in ini files.
Definition: INIInterface.hh:81
ColorPlugin::setNewColor
void setNewColor(QIcon _icon, OpenMesh::Vec4f &_color)
set the color of a color vector to the one in the given icon
Definition: ColorPlugin.cc:428
OptionsInterface.hh
ColorPlugin::setPresentationColor
void setPresentationColor()
Set the presentation color preset.
Definition: ColorPlugin.cc:193
ToolbarInterface.hh
ColorPlugin::saveIniFileOptions
void saveIniFileOptions(INIFile &_ini)
Store current color preset to an ini file.
Definition: ColorPlugin.cc:622
ColorPlugin::ColorPlugin
ColorPlugin()
ConstructorOptionsInterface.
Definition: ColorPlugin.cc:66
ColorPlugin::baseColorPresentation_
OpenMesh::Vec4f baseColorPresentation_
the options widget to set colors
Definition: ColorPlugin.hh:158
ColorPlugin::initializeOptionsWidget
bool initializeOptionsWidget(QWidget *&_widget)
generate an optionsWidget to change color presets
Definition: ColorPlugin.cc:467
ColorPlugin::backgroundColorDefault_
OpenMesh::Vec4f backgroundColorDefault_
the options widget to set colors
Definition: ColorPlugin.hh:157
OptionsInterface
Options Dialog interface.
Definition: OptionsInterface.hh:74
ColorPlugin::convertColor
void convertColor(uint _color, OpenMesh::Vec4f &_vector)
convert betweeen uint and Vec4f
Definition: ColorPlugin.cc:542
ColorPlugin::setBackgroundColor
void setBackgroundColor(Vector _color)
Set the backgroundColor.
Definition: ColorPlugin.cc:286
INIFile
Class for the handling of simple configuration files.
Definition: INIFile.hh:105
ColorPlugin::materialColorDefault_
OpenMesh::Vec4f materialColorDefault_
the options widget to set colors
Definition: ColorPlugin.hh:159
ColorPlugin::name
QString name()
Return a name for the plugin.
Definition: ColorPlugin.hh:122
ColorPlugin::version
QString version()
Definition: ColorPlugin.hh:227
ColorPlugin::setObjectDiffuseColor
void setObjectDiffuseColor(int _objectId, Vector4 _color)
Definition: ColorPlugin.cc:342
ColorPlugin::applyOptions
void applyOptions()
Store the changed color presets when the apply Button was hit.
Definition: ColorPlugin.cc:515
ColorPlugin::setDefaultColor
void setDefaultColor()
set the defaultColor preset
Definition: ColorPlugin.cc:147
OpenMesh::VectorT< float, 4 >
ToolbarInterface
Add a toolbox to OpenFlipper.
Definition: ToolbarInterface.hh:79
ScriptInterface
Interface for all Plugins which provide scriptable Functions.
Definition: ScriptInterface.hh:67
ColorPlugin::getColorDialog
void getColorDialog()
display a color dialog
Definition: ColorPlugin.cc:443
ColorPlugin::baseColorPaper_
OpenMesh::Vec4f baseColorPaper_
the options widget to set colors
Definition: ColorPlugin.hh:158
ColorPlugin::backgroundColorPaper_
OpenMesh::Vec4f backgroundColorPaper_
the options widget to set colors
Definition: ColorPlugin.hh:157
ColorPlugin::pluginsInitialized
void pluginsInitialized()
initialize the toolbar and menubar
Definition: ColorPlugin.cc:93
ColorPlugin::lineWidthPaper_
double lineWidthPaper_
the options widget to set colors
Definition: ColorPlugin.hh:161
ColorPlugin::getIconColor
QRgb getIconColor(QIcon _icon)
get the color from a given icon
Definition: ColorPlugin.cc:413
ColorPlugin::materialColorPresentation_
OpenMesh::Vec4f materialColorPresentation_
the options widget to set colors
Definition: ColorPlugin.hh:159
ColorPlugin::generateIcon
QIcon generateIcon(QRgb _color)
generate an icon from a given color
Definition: ColorPlugin.cc:395
ColorPlugin::lineWidthPresentation_
double lineWidthPresentation_
the options widget to set colors
Definition: ColorPlugin.hh:161
StatusbarInterface
Control OpenFlippers status bar.
Definition: StatusbarInterface.hh:96
ColorPlugin::loadIniFileOptions
void loadIniFileOptions(INIFile &_ini)
read color preset from ini file
Definition: ColorPlugin.cc:576
ScriptInterface.hh
BaseInterface.hh
ColorPlugin::backgroundColorPresentation_
OpenMesh::Vec4f backgroundColorPresentation_
the options widget to set colors
Definition: ColorPlugin.hh:157
ColorPlugin::materialColorPaper_
OpenMesh::Vec4f materialColorPaper_
the options widget to set colors
Definition: ColorPlugin.hh:159
ColorPlugin::setObjectSpecularColor
void setObjectSpecularColor(int _objectId, Vector4 _color)
Definition: ColorPlugin.cc:359
ColorPlugin::baseColorDefault_
OpenMesh::Vec4f baseColorDefault_
the options widget to set colors
Definition: ColorPlugin.hh:158
Types.hh
StatusbarInterface.hh
ColorPlugin
Definition: ColorPlugin.hh:70
ColorPlugin::setObjectAmbientColor
void setObjectAmbientColor(int _objectId, Vector4 _color)
Definition: ColorPlugin.cc:325
ColorPlugin::setPaperColor
void setPaperColor()
set the paperColor Preset
Definition: ColorPlugin.cc:239
MenuInterface.hh
MenuInterface
Interface for all plugins which provide entries to the main menubar.
Definition: MenuInterface.hh:91
ColorPlugin::setObjectEmissiveColor
void setObjectEmissiveColor(int _objectId, Vector4 _color)
Definition: ColorPlugin.cc:306