SVN commit 1170443 by adamc: o code cleanup o copyright added M +17 -0 kis_color_history.cpp M +17 -0 kis_color_history.h M +3 -3 kis_color_patches.h M +1 -1 kis_color_selector.cpp M +2 -2 kis_color_selector.h M +2 -4 kis_color_selector_base.cpp M +2 -2 kis_color_selector_base.h M +3 -3 kis_color_selector_combo_box.h M +0 -25 kis_color_selector_ng_dock.cpp M +3 -7 kis_color_selector_ng_dock.h M +3 -3 kis_color_selector_ng_docker_widget.h M +3 -3 kis_color_selector_settings.h M +3 -3 kis_color_selector_simple.h M +3 -3 kis_common_colors.h M +0 -4 kis_minimal_shade_selector.cpp M +3 -3 kis_minimal_shade_selector.h M +1 -1 kis_my_paint_shade_selector.cpp M +3 -3 kis_my_paint_shade_selector.h M +3 -9 kis_shade_selector_line.cpp M +0 -2 kis_shade_selector_line.h --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_color_history.cpp #1170442:1170443 @@ -1,3 +1,20 @@ +/* + * Copyright (c) 2010 Adam Celarek + * + * This program 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; version 2 of the License. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #include "kis_color_history.h" #include "kis_canvas2.h" #include "kis_view2.h" --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_color_history.h #1170442:1170443 @@ -1,3 +1,20 @@ +/* + * Copyright (c) 2010 Adam Celarek + * + * This program 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; version 2 of the License. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + #ifndef KIS_COLOR_HISTORY_H #define KIS_COLOR_HISTORY_H --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_color_patches.h #1170442:1170443 @@ -15,8 +15,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef KIS_COLSELNG_COLOR_PATCHES_H -#define KIS_COLSELNG_COLOR_PATCHES_H +#ifndef KIS_COLOR_PATCHES_H +#define KIS_COLOR_PATCHES_H #include "kis_color_selector_base.h" @@ -88,4 +88,4 @@ QPoint m_dragStartPos; }; -#endif // KIS_COLSELNG_COLOR_PATCHES_H +#endif --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_color_selector.cpp #1170442:1170443 @@ -253,7 +253,7 @@ role=Foreground; else role=Background; - commitColor(KoColor(m_currentColor, colorSpace()), m_currentColor, role); + commitColor(KoColor(m_currentColor, colorSpace()), role); } e->accept(); m_grabbingComponent=0; --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_color_selector.h #1170442:1170443 @@ -15,8 +15,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef KIS_COLSELNG_COLOR_SELECTOR_H -#define KIS_COLSELNG_COLOR_SELECTOR_H +#ifndef KIS_COLOR_SELECTOR_H +#define KIS_COLOR_SELECTOR_H #include "kis_color_selector_base.h" --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_color_selector_base.cpp #1170442:1170443 @@ -261,8 +261,6 @@ void KisColorSelectorBase::dropEvent(QDropEvent *e) { -// kDebug() << "drop event. mime format=" << e->mimeData()->formats() << " text=" << e->mimeData()->text() << " colour=" << e->mimeData()->colorData(); - QColor color; if(e->mimeData()->hasColor()) { color = qvariant_cast(e->mimeData()->colorData()); @@ -276,7 +274,7 @@ KoColor kocolor(color , KoColorSpaceRegistry::instance()->rgb8()); color = findGeneratingColor(kocolor); setColor(color); - commitColor(kocolor, color, Foreground); + commitColor(kocolor, Foreground); } void KisColorSelectorBase::setColor(const QColor& color) @@ -309,7 +307,7 @@ m_popup->hide(); } -void KisColorSelectorBase::commitColor(const KoColor& color, const QColor& rawColor, ColorRole role) +void KisColorSelectorBase::commitColor(const KoColor& color, ColorRole role) { Q_ASSERT(m_canvas); if (!m_canvas) --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_color_selector_base.h #1170442:1170443 @@ -47,7 +47,7 @@ virtual void setColor(const QColor& color); virtual void showPopup(); /// commits a color to the resource manager - void commitColor(const KoColor& koColor, const QColor& qColor, ColorRole role); + void commitColor(const KoColor& koColor, ColorRole role); public: void mousePressEvent(QMouseEvent *); @@ -83,4 +83,4 @@ bool m_isPopup; //this instance is a popup }; -#endif // KIS_COLOR_SELECTOR_BASE_H +#endif --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_color_selector_combo_box.h #1170442:1170443 @@ -15,8 +15,8 @@ * along with this program; if not, write to the Free Software */ -#ifndef KIS_COLOR_SELECTOR_TYPE_WIDGET_H -#define KIS_COLOR_SELECTOR_TYPE_WIDGET_H +#ifndef KIS_COLOR_SELECTOR_COMBO_BOX_H +#define KIS_COLOR_SELECTOR_COMBO_BOX_H #include #include "kis_color_selector.h" @@ -45,4 +45,4 @@ KisColorSelector m_currentSelector; }; -#endif // KIS_COLOR_SELECTOR_TYPE_WIDGET_H +#endif --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_color_selector_ng_dock.cpp #1170442:1170443 @@ -19,24 +19,18 @@ #include "kis_color_selector_ng_dock.h" #include -#include #include "kis_canvas2.h" #include "kis_color_selector_ng_docker_widget.h" -#include "kis_canvas_resource_provider.h" -#include KisColorSelectorNgDock::KisColorSelectorNgDock() : QDockWidget() - , m_canvas(0) { m_colorSelectorNgWidget = new KisColorSelectorNgDockerWidget(this); setWidget(m_colorSelectorNgWidget); m_colorSelectorNgWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); -// connect(m_colorSelectorNgWidget, SIGNAL(colorChanged(const QColor&)), -// this, SLOT(colorChangedProxy(const QColor&))); setWindowTitle(i18n("Advanced Color Selector")); } @@ -44,26 +38,7 @@ void KisColorSelectorNgDock::setCanvas(KoCanvasBase * canvas) { m_colorSelectorNgWidget->setCanvas(dynamic_cast(canvas)); -// m_canvas = canvas; -// connect(m_canvas->resourceManager(), SIGNAL(resourceChanged(int, const QVariant&)), -// this, SLOT(resourceChanged(int, const QVariant&))); -// m_colorSelectorNgWidget->setQColor(m_canvas->resourceManager()->foregroundColor().toQColor()); } -void KisColorSelectorNgDock::colorChangedProxy(const QColor& c) -{ - Q_UNUSED(c); -// if (m_canvas) -// m_canvas->resourceManager()->setForegroundColor(KoColor(c , KoColorSpaceRegistry::instance()->rgb8())); -} -void KisColorSelectorNgDock::resourceChanged(int key, const QVariant& v) -{ - Q_UNUSED(key); - Q_UNUSED(v); -// if (key == KoCanvasResource::ForegroundColor) { -// m_colorSelectorNgWidget->setQColor(v.value().toQColor()); -// } -} - #include "kis_color_selector_ng_dock.moc" --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_color_selector_ng_dock.h #1170442:1170443 @@ -16,14 +16,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef _SMALLCOLORSELECTOR_DOCK_H_ -#define _SMALLCOLORSELECTOR_DOCK_H_ +#ifndef KIS_COLOR_SELECTOR_NG_DOCKER_H +#define KIS_COLOR_SELECTOR_NG_DOCKER_H #include #include class KisColorSelectorNgDockerWidget; -class KoColor; class KisColorSelectorNgDock : public QDockWidget, public KoCanvasObserverBase { @@ -33,12 +32,9 @@ /// reimplemented from KoCanvasObserverBase virtual void setCanvas(KoCanvasBase *canvas); -public slots: - void colorChangedProxy(const QColor&); - void resourceChanged(int, const QVariant&); + private: KisColorSelectorNgDockerWidget* m_colorSelectorNgWidget; - KoCanvasBase* m_canvas; }; --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_color_selector_ng_docker_widget.h #1170442:1170443 @@ -16,8 +16,8 @@ */ -#ifndef COLORSELECTORNGWIDGET_H -#define COLORSELECTORNGWIDGET_H +#ifndef KIS_COLOR_SELECTOR_NG_DOCKER_WIDGET_H +#define KIS_COLOR_SELECTOR_NG_DOCKER_WIDGET_H #include @@ -63,4 +63,4 @@ }; -#endif // COLORSELECTORNGWIDGET_H +#endif --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_color_selector_settings.h #1170442:1170443 @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef KIS_COLSELNG_SETTINGS_H -#define KIS_COLSELNG_SETTINGS_H +#ifndef KIS_COLOR_SELECTOR_SETTINGS_H +#define KIS_COLOR_SELECTOR_SETTINGS_H #include @@ -65,4 +65,4 @@ }; -#endif // KIS_COLSELNG_SETTINGS_H +#endif // KIS_COLOR_SELECTOR_SETTINGS_H --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_color_selector_simple.h #1170442:1170443 @@ -15,8 +15,8 @@ * along with this program; if not, write to the Free Software */ -#ifndef KIS_COLOR_SELECTOR_SQUARE_H -#define KIS_COLOR_SELECTOR_SQUARE_H +#ifndef KIS_COLOR_SELECTOR_SIMPLE_H +#define KIS_COLOR_SELECTOR_SIMPLE_H typedef unsigned int QRgb; class KoColorSpace; @@ -46,4 +46,4 @@ QImage m_pixelCache; }; -#endif // KIS_COLOR_SELECTOR_SQUARE_H +#endif --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_common_colors.h #1170442:1170443 @@ -15,8 +15,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef KIS_COLSELNG_COMMON_COLORS_H -#define KIS_COLSELNG_COMMON_COLORS_H +#ifndef KIS_COMMON_COLORS_H +#define KIS_COMMON_COLORS_H #include "kis_color_patches.h" @@ -37,4 +37,4 @@ void recalculate(); }; -#endif // KIS_COLSELNG_COMMON_COLORS_H +#endif --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_minimal_shade_selector.cpp #1170442:1170443 @@ -47,8 +47,6 @@ { KisColorSelectorBase::setCanvas(canvas); m_canvas=canvas; - for(int i=0; isetCanvas(canvas); } void KisMinimalShadeSelector::setColor(const QColor& color) @@ -78,8 +76,6 @@ for(int i=0; ifromString(strili.at(i)); - if(m_canvas!=0) - m_shadingLines.at(i)->setCanvas(m_canvas); } int lineHeight = cfg.readEntry("minimalShadeSelectorLineHeight", 20); --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_minimal_shade_selector.h #1170442:1170443 @@ -15,8 +15,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef KIS_COLSELNG_SHADE_SELECTOR_H -#define KIS_COLSELNG_SHADE_SELECTOR_H +#ifndef KIS_MINIMAL_SHADE_SELECTOR_H +#define KIS_MINIMAL_SHADE_SELECTOR_H #include "kis_color_selector_base.h" @@ -46,4 +46,4 @@ KisCanvas2* m_canvas; }; -#endif // KIS_COLSELNG_SHADE_SELECTOR_H +#endif --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_my_paint_shade_selector.cpp #1170442:1170443 @@ -215,7 +215,7 @@ setColor(color); } - commitColor(KoColor(color, colorSpace()), color, role); + commitColor(KoColor(color, colorSpace()), role); } } --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_my_paint_shade_selector.h #1170442:1170443 @@ -19,8 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef KIS_COLSELNG_MY_PAINT_SHADE_SELECTOR_H -#define KIS_COLSELNG_MY_PAINT_SHADE_SELECTOR_H +#ifndef KIS_MY_PAINT_SHADE_SELECTOR_H +#define KIS_MY_PAINT_SHADE_SELECTOR_H #include "kis_color_selector_base.h" #include @@ -53,4 +53,4 @@ QTimer* m_updateTimer; }; -#endif // KIS_COLSELNG_MY_PAINT_SHADE_SELECTOR_H +#endif // KIS_MY_PAINT_SHADE_SELECTOR_H --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_shade_selector_line.cpp #1170442:1170443 @@ -38,14 +38,14 @@ #include KisShadeSelectorLine::KisShadeSelectorLine(QWidget *parent) : - KisShadeSelectorLineBase(parent), m_displayHelpText(false), m_canvas(0) + KisShadeSelectorLineBase(parent), m_displayHelpText(false) { setParam(0, 0, 0, 0, 0, 0); updateSettings(); } KisShadeSelectorLine::KisShadeSelectorLine(qreal hueDelta, qreal satDelta, qreal valDelta, QWidget *parent, qreal hueShift, qreal satShift, qreal valShift) : - KisShadeSelectorLineBase(parent), m_displayHelpText(false), m_canvas(0) + KisShadeSelectorLineBase(parent), m_displayHelpText(false) { setParam(hueDelta, satDelta, valDelta, hueShift, satShift, valShift); updateSettings(); @@ -81,11 +81,6 @@ setMinimumHeight(m_lineHeight); } -void KisShadeSelectorLine::setCanvas(KisCanvas2 *canvas) -{ - m_canvas=canvas; -} - QString KisShadeSelectorLine::toString() const { return QString("%1|%2|%3|%4|%5|%6|%7").arg(m_lineNumber).arg(m_hueDelta).arg(m_saturationDelta).arg(m_valueDelta).arg(m_hueShift).arg(m_saturationShift).arg(m_valueShift); @@ -171,7 +166,6 @@ void KisShadeSelectorLine::mousePressEvent(QMouseEvent* e) { - Q_ASSERT(m_canvas); if(e->button()!=Qt::LeftButton && e->button()!=Qt::RightButton) { e->setAccepted(false); return; @@ -187,7 +181,7 @@ if(e->button()==Qt::RightButton) role = KisColorSelectorBase::Background; - parent->commitColor(KoColor(color, KoColorSpaceRegistry::instance()->rgb8()), color, role); + parent->commitColor(KoColor(color, KoColorSpaceRegistry::instance()->rgb8()), role); KConfigGroup cfg = KGlobal::config()->group("advancedColorSelector"); --- trunk/koffice/krita/plugins/extensions/dockers/colorselectorng/kis_shade_selector_line.h #1170442:1170443 @@ -73,8 +73,6 @@ int m_lineHeight; bool m_displayHelpText; - KisCanvas2* m_canvas; - friend class KisShadeSelectorLineComboBox; };