diff options
Diffstat (limited to 'chalk/colorspaces/wet/wet_plugin.cpp')
-rw-r--r-- | chalk/colorspaces/wet/wet_plugin.cpp | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/chalk/colorspaces/wet/wet_plugin.cpp b/chalk/colorspaces/wet/wet_plugin.cpp new file mode 100644 index 000000000..259fe5d1c --- /dev/null +++ b/chalk/colorspaces/wet/wet_plugin.cpp @@ -0,0 +1,128 @@ +/* + * wet_plugin.cpp -- Part of Chalk + * + * Copyright (c) 2004 Boudewijn Rempt (boud@valdyas.org) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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 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 <stdlib.h> +#include <vector> + +#include <tqobject.h> +#include <tqapplication.h> +#include <tqclipboard.h> +#include <tqdockwindow.h> +#include <tqpoint.h> +#include <tqlabel.h> +#include <tqwidget.h> + +#include <tdeactionclasses.h> +#include <tdelocale.h> +#include <kiconloader.h> +#include <kinstance.h> +#include <tdemessagebox.h> +#include <kstandarddirs.h> +#include <tdetempfile.h> +#include <kdebug.h> +#include <kgenericfactory.h> + +#include <kopalettemanager.h> +#include <KoMainWindow.h> + +#include <kis_debug_areas.h> +#include "kis_meta_registry.h" +#include <kis_factory.h> +#include <kis_image.h> +#include <kis_debug_areas.h> +#include <kis_types.h> +#include <kis_view.h> +#include <kis_colorspace_factory_registry.h> +#include <kis_tool_registry.h> +#include <kis_paintop_registry.h> +#include <kis_canvas_subject.h> +#include <kis_basic_histogram_producers.h> + +#include "wet_plugin.h" +#include "kis_wet_palette_widget.h" +#include "kis_wet_colorspace.h" +#include "kis_wetop.h" +#include "kis_wetness_visualisation_filter.h" +#include "kis_texture_filter.h" +#include "wetphysicsfilter.h" + +typedef KGenericFactory<WetPlugin> WetPluginFactory; +K_EXPORT_COMPONENT_FACTORY( chalkwetplugin, WetPluginFactory( "chalkcore" ) ) + + +WetPlugin::WetPlugin(TQObject *parent, const char *name, const TQStringList &) + : KParts::Plugin(parent, name) +{ + setInstance(WetPluginFactory::instance()); + + // This is not a gui plugin; only load it when the doc is created. + if ( parent->inherits("KisColorSpaceFactoryRegistry") ) { + KisColorSpaceFactoryRegistry * f = dynamic_cast<KisColorSpaceFactoryRegistry*>(parent); + + KisColorSpace* colorSpaceWet = new KisWetColorSpace(f, 0); + + KisColorSpaceFactory * csf = new KisWetColorSpaceFactory(); + TQ_CHECK_PTR(colorSpaceWet); + + // colorspace + f->add(csf); + + // histogram producer + KisHistogramProducerFactoryRegistry::instance()->add( + new KisBasicHistogramProducerFactory<KisBasicU16HistogramProducer> + (KisID("WETHISTO", i18n("Wet")), colorSpaceWet) ); + + // wet brush op + KisPaintOpRegistry::instance()->add(new KisWetOpFactory); + + // Dry filter + KisFilterRegistry::instance()->add( new WetPhysicsFilter() ); + + // Texture Action: + f->addPaintDeviceAction(colorSpaceWet, new WetPaintDevAction); + } + else if (parent->inherits("KisView")) + { + setInstance(WetPluginFactory::instance()); + setXMLFile(locate("data","chalkplugins/wetplugin.rc"), true); + + m_view = dynamic_cast<KisView*>(parent); + // Wetness visualisation + WetnessVisualisationFilter * wf = new WetnessVisualisationFilter(m_view); + wf->setAction(new TDEToggleAction(i18n("Wetness Visualisation"), 0, 0, wf, + TQT_SLOT(slotActivated()), actionCollection(), "wetnessvisualisation")); + + // Create the wet palette + KisWetPaletteWidget * w = new KisWetPaletteWidget(m_view); + TQ_CHECK_PTR(w); + + w->setCaption(i18n("Watercolors")); + + m_view->canvasSubject()->paletteManager()->addWidget(w, "watercolor docker", chalk::COLORBOX, INT_MAX, PALETTE_DOCKER, false); + m_view->canvasSubject()->attach(w); + } + + +} + +WetPlugin::~WetPlugin() +{ +} + +#include "wet_plugin.moc" |