1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
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,
TQ_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"
|