/* * kis_wetness_visualisation_filter.cc -- Part of Chalk * * Copyright (c) 2005 Bart Coppens * * 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 #include #include "kis_meta_registry.h" #include #include #include #include #include "kis_wet_colorspace.h" #include #include "kis_wetness_visualisation_filter.h" WetnessVisualisationFilter::WetnessVisualisationFilter(KisView* view) : m_view(view), m_action(0) { connect(&m_timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotTimeout())); } // XXX this needs to work on a per-layer basis! void WetnessVisualisationFilter::setAction(TDEToggleAction* action) { m_action = action; if (!m_action) return; KisWetColorSpace* cs = dynamic_cast( KisMetaRegistry::instance()->csRegistry()->getColorSpace(KisID("WET", ""),"") ); Q_ASSERT(cs); m_action->setChecked(cs->paintWetness()); } void WetnessVisualisationFilter::slotActivated() { kdDebug(DBG_AREA_CMS) << "activated" << endl; if (!m_action) { kdDebug(DBG_AREA_CMS) << "no action" << endl; return; } KisWetColorSpace* cs = dynamic_cast( KisMetaRegistry::instance()->csRegistry()->getColorSpace(KisID("WET", ""),"") ); Q_ASSERT(cs); if (!m_action->isChecked()) { m_timer.stop(); cs->setPaintWetness(false); } else { m_timer.start(500); cs->setPaintWetness(true); } } void WetnessVisualisationFilter::slotTimeout() { KisWetColorSpace* cs = dynamic_cast( KisMetaRegistry::instance()->csRegistry()->getColorSpace(KisID("WET", ""),"") ); Q_ASSERT(cs); if (!cs) return; cs->resetPhase(); } #include "kis_wetness_visualisation_filter.moc"