Commit 65b69b23 authored by Dirk Wilden's avatar Dirk Wilden

enhanced ColorPlugin and added docu

color presets can now be chosen in the options and are stored in ini files

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5186 383ad7c9-94d9-4d36-a494-682f7c89f535
parent a37d5ce9
//=============================================================================
//
// OpenFlipper
// Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
// www.openflipper.org
//
//-----------------------------------------------------------------------------
//
// License
//
// OpenFlipper is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenFlipper is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
// $Revision: 5151 $
// $Author: moebius $
// $Date: 2009-02-27 17:36:10 +0100 (Fr, 27. Feb 2009) $
//
//=============================================================================
#include "ColorOptions.hh"
ColorOptions::ColorOptions(QWidget *parent)
: QWidget(parent)
{
setupUi(this);
}
//=============================================================================
//
// OpenFlipper
// Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
// www.openflipper.org
//
//-----------------------------------------------------------------------------
//
// License
//
// OpenFlipper is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenFlipper is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
// $Revision: 5151 $
// $Author: moebius $
// $Date: 2009-02-27 17:36:10 +0100 (Fr, 27. Feb 2009) $
//
//=============================================================================
#include "ui_colorOptions.hh"
#include <QtGui>
class ColorOptions : public QWidget, public Ui::colorOptions
{
Q_OBJECT
public:
ColorOptions(QWidget *parent = 0);
};
This diff is collapsed.
......@@ -12,12 +12,12 @@
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
//
// OpenFlipper is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>.
//
......@@ -36,14 +36,20 @@
#include <QMenuBar>
#include "ColorPlugin.hh"
#include "ColorOptions.hh"
#include "OpenFlipper/INIFile/INIFile.hh"
#include <OpenFlipper/common/Types.hh>
#include <OpenFlipper/BasePlugin/BaseInterface.hh>
#include <OpenFlipper/BasePlugin/MenuInterface.hh>
#include <OpenFlipper/BasePlugin/ScriptInterface.hh>
#include <OpenFlipper/BasePlugin/ToolbarInterface.hh>
#include "OpenFlipper/BasePlugin/StatusbarInterface.hh"
#include "OpenFlipper/BasePlugin/OptionsInterface.hh"
#include "OpenFlipper/BasePlugin/INIInterface.hh"
class ColorPlugin : public QObject, BaseInterface, MenuInterface, ScriptInterface, ToolbarInterface, StatusbarInterface
class ColorPlugin : public QObject, BaseInterface, MenuInterface, ScriptInterface, ToolbarInterface, StatusbarInterface, OptionsInterface, INIInterface
{
Q_OBJECT
Q_INTERFACES(BaseInterface)
......@@ -51,30 +57,91 @@ Q_INTERFACES(MenuInterface)
Q_INTERFACES(ScriptInterface)
Q_INTERFACES(ToolbarInterface)
Q_INTERFACES(StatusbarInterface)
Q_INTERFACES(OptionsInterface)
Q_INTERFACES(INIInterface)
signals:
// BaseInterface
void updateView();
// ScriptInterface
void scriptInfo( QString _functionName );
// MenuInterface
void addMenu(QMenu* _menu, MenuType _type);
// ToolbarInterface
void addToolbar(QToolBar* _toolbar);
void removeToolbar(QToolBar* _toolbar);
// StatusbarInterface
void showStatusMessage(QString _message, int _timeout = 0);
private slots:
// BaseInterface
void pluginsInitialized();
// OptionsInterface
void applyOptions();
// INIInterface
void loadIniFileOptions(INIFile& _ini);
void saveIniFileOptions(INIFile& _ini);
public :
void init();
// OptionsInterface
bool initializeOptionsWidget(QWidget*& _widget);
// BaseInterface
QString name() { return (QString("Color Plugin")); };
QString description( ) { return (QString("Sets the Default colors e.g. for slides, paper,... snapshots")); };
/// Constructor
ColorPlugin();
//===========================================================================
/** @name Show Colors in Options and Store them in INI files
* @{ */
//===========================================================================
private:
/// the options widget to set colors
ColorOptions* optionsWidget_;
/// generate an icon from a given color
QIcon generateIcon(QRgb _color);
/// generate an icon from a given color
QIcon generateIcon(OpenMesh::Vec4f _color);
/// get the color from a given icon
QRgb getIconColor(QIcon _icon);
/// set the color of a color vector to the one in the given icon
void setNewColor(QIcon _icon, OpenMesh::Vec4f& _color);
/// convert betweeen uint and Vec4f
void convertColor(uint _color, OpenMesh::Vec4f& _vector);
/// convert betweeen uint and Vec4f
uint convertColor(OpenMesh::Vec4f& _vector);
//internal storage of colors
OpenMesh::Vec4f backgroundColorDefault_, backgroundColorPaper_, backgroundColorPresentation_;
OpenMesh::Vec4f baseColorDefault_, baseColorPaper_, baseColorPresentation_;
OpenMesh::Vec4f materialColorDefault_, materialColorPaper_, materialColorPresentation_;
double lineWidthDefault_, lineWidthPaper_, lineWidthPresentation_;
private slots:
/// display a color dialog
void getColorDialog();
/** @} */
//===========================================================================
/** @name Scriptable functions to set colors
* @{ */
......@@ -89,7 +156,7 @@ Q_INTERFACES(StatusbarInterface)
/**
* Applies colors for presentations to the scene
*/
void setPowerpointColor();
void setPresentationColor();
/**
* Applies colors for papers
......@@ -101,6 +168,8 @@ Q_INTERFACES(StatusbarInterface)
*/
void setBackgroundColor( Vector _color );
/** @} */
//===========================================================================
/** @name Other scriptable functions
* @{ */
......
<ui version="4.0" >
<class>colorOptions</class>
<widget class="QWidget" name="colorOptions" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>487</width>
<height>393</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<widget class="QTabWidget" name="tabWidget" >
<property name="currentIndex" >
<number>0</number>
</property>
<widget class="QWidget" name="defaultColors" >
<attribute name="title" >
<string>Default Colors</string>
</attribute>
<layout class="QFormLayout" name="formLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Background Color:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="backgroundDefault" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Base Color:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QPushButton" name="baseDefault" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Material Color:</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QPushButton" name="materialDefault" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Line Width:</string>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QDoubleSpinBox" name="lineDefault" />
</item>
</layout>
</widget>
<widget class="QWidget" name="paper" >
<attribute name="title" >
<string>Paper Colors</string>
</attribute>
<layout class="QFormLayout" name="formLayout_2" >
<item row="0" column="0" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Background Color:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="backgroundPaper" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_8" >
<property name="text" >
<string>Base Color:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QPushButton" name="basePaper" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_7" >
<property name="text" >
<string>Material Color:</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QPushButton" name="materialPaper" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_6" >
<property name="text" >
<string>Line Width:</string>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QDoubleSpinBox" name="linePaper" />
</item>
</layout>
</widget>
<widget class="QWidget" name="presentation" >
<attribute name="title" >
<string>Presentation Colors</string>
</attribute>
<layout class="QFormLayout" name="formLayout_3" >
<item row="0" column="0" >
<widget class="QLabel" name="label_9" >
<property name="text" >
<string>Background Color:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="backgroundPresentation" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_12" >
<property name="text" >
<string>Base Color:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QPushButton" name="basePresentation" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_11" >
<property name="text" >
<string>Material Color:</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QPushButton" name="materialPresentation" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_10" >
<property name="text" >
<string>Line Width:</string>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QDoubleSpinBox" name="linePresentation" />
</item>
</layout>
</widget>
</widget>
</item>
<item>
<spacer name="verticalSpacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment