Commit ea7fdfd1 authored by Boudewijn Rempt's avatar Boudewijn Rempt

* Fixed deslect-reselect bug

* Separate the debug areas into its own header. Let's make kis-global 
  as small as possible :-)

svn path=/trunk/koffice/; revision=477235
parent 7829c8f8
......@@ -23,10 +23,10 @@
#include <kgenericfactory.h>
#include <kdebug.h>
#include <kis_global.h>
#include <kis_debug_areas.h>
#include <kis_colorspace_factory_registry.h>
#include <kis_basic_histogram_producers.h>
#include <kis_debug_areas.h>
#include "cmyk_u16_plugin.h"
#include "kis_cmyk_u16_colorspace.h"
......
......@@ -26,6 +26,7 @@
#include <kdebug.h>
#include <klocale.h>
#include <kis_debug_areas.h>
#include "kis_cmyk_u16_colorspace.h"
#include "kis_u16_base_colorspace.h"
#include "kis_color_conversions.h"
......
......@@ -27,7 +27,7 @@
#include <kdebug.h>
#include <kgenericfactory.h>
#include <kis_debug_areas.h>
#include <kis_colorspace_factory_registry.h>
#include <kis_basic_histogram_producers.h>
......
......@@ -23,7 +23,7 @@
#include <kgenericfactory.h>
#include <kdebug.h>
#include <kis_global.h>
#include <kis_debug_areas.h>
#include <kis_colorspace_factory_registry.h>
#include <kis_basic_histogram_producers.h>
......
......@@ -26,6 +26,7 @@
#include <kdebug.h>
#include <kgenericfactory.h>
#include <kis_debug_areas.h>
#include <kis_colorspace_factory_registry.h>
#include <kis_basic_histogram_producers.h>
......
......@@ -25,7 +25,7 @@
#include <kgenericfactory.h>
#include <kdebug.h>
#include <kis_global.h>
#include <kis_debug_areas.h>
#include <kis_colorspace_factory_registry.h>
#include <kis_basic_histogram_producers.h>
......
......@@ -24,7 +24,7 @@
#include <kgenericfactory.h>
#include <kdebug.h>
#include <kis_global.h>
#include <kis_debug_areas.h>
#include <kis_colorspace_factory_registry.h>
#include <kis_basic_histogram_producers.h>
......
......@@ -24,7 +24,7 @@
#include <kgenericfactory.h>
#include <kdebug.h>
#include <kis_global.h>
#include <kis_debug_areas.h>
#include <kis_colorspace_factory_registry.h>
#include <kis_basic_histogram_producers.h>
......
......@@ -23,7 +23,7 @@
#include <kgenericfactory.h>
#include <kdebug.h>
#include <kis_global.h>
#include <kis_debug_areas.h>
#include <kis_colorspace_factory_registry.h>
#include "rgb_u16_plugin.h"
......
......@@ -30,7 +30,9 @@
#include <ktempfile.h>
#include <kdebug.h>
#include <kgenericfactory.h>
#include <kis_debug_areas.h>
#include <kis_debug_areas.h>
#include <kis_colorspace_factory_registry.h>
#include <kis_basic_histogram_producers.h>
......
......@@ -32,6 +32,7 @@
#include <kdebug.h>
#include <kgenericfactory.h>
#include <kis_debug_areas.h>
#include <kis_colorspace_registry.h>
#include <kis_factory.h>
......
......@@ -21,7 +21,7 @@
#include <kdebug.h>
#include <kis_view.h>
#include <kis_image.h>
#include <kis_debug_areas.h>
#include "kis_texture_painter.h"
#include "kis_texture_filter.h"
......
......@@ -26,7 +26,7 @@
#include <klocale.h>
#include <kdebug.h>
#include <kis_debug_areas.h>
#include "kis_abstract_colorspace.h"
#include "kis_colorspace_factory_registry.h"
#include "kis_image.h"
......
......@@ -27,6 +27,7 @@
#include <kis_colorspace_factory_registry.h>
#include <kis_factory.h>
#include "kis_wet_colorspace.h"
#include <kis_debug_areas.h>
#include "kis_wetness_visualisation_filter.h"
WetnessVisualisationFilter::WetnessVisualisationFilter(KisView* view)
......
......@@ -21,7 +21,7 @@
#include <kdebug.h>
#include <kis_brush.h>
#include <kis_global.h>
#include <kis_debug_areas.h>
#include <kis_paint_device_impl.h>
#include <kis_painter.h>
#include <kis_types.h>
......
......@@ -41,10 +41,11 @@
#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_global.h>
#include <kis_debug_areas.h>
#include <kis_types.h>
#include <kis_view.h>
#include <kis_colorspace_factory_registry.h>
......
......@@ -24,10 +24,10 @@
#include <kis_iterators_pixel.h>
#include <kis_filter_registry.h>
#include <kis_global.h>
#include <kis_debug_areas.h>
#include <kis_types.h>
#include <kis_paint_device_impl.h>
#include <kis_debug_areas.h>
#include "wetphysicsfilter.h"
......@@ -44,7 +44,7 @@ void WetPhysicsFilter::process(KisPaintDeviceImplSP src, KisPaintDeviceImplSP ds
// XXX: Don't do the flow yet. It loops three times through the paint device and creates an enormous amount
// of temporary data -- size arrays of doubles width * height of the paint device, and besides, it's
// subject to the same problems as the Wet & Sticky model; the windscreen wiper effect.
// Because I don't want to put a timer here (yet), just do it 25 times
for (int i = 0; i < 25; i++) {
flow(src, dst, rect);
......@@ -105,7 +105,7 @@ void WetPhysicsFilter::flow(KisPaintDeviceImplSP src, KisPaintDeviceImplSP dst,
Q_INT32 dx, dy;
dx = r.x();
dy = r.y();
int ix = width + 1; // keeps track where we are in the one-dimensional arrays
for (Q_INT32 y2 = 1; y2 < height - 1; ++y2) {
......@@ -180,7 +180,7 @@ void WetPhysicsFilter::flow(KisPaintDeviceImplSP src, KisPaintDeviceImplSP dst,
ix += 2;
}
// Third iteration: Combine the paint from the flow areas.
// Third iteration: Combine the paint from the flow areas.
ix = width + 1;
for (Q_INT32 y2 = 1; y2 < height - 1; ++y2) {
KisHLineIteratorPixel srcIt = src->createHLineIterator(dx, dy + y2, width, false);
......@@ -272,46 +272,46 @@ void WetPhysicsFilter::adsorb(KisPaintDeviceImplSP src, KisPaintDeviceImplSP dst
KisHLineIteratorPixel dstIt = dst->createHLineIterator(r.x(), r.y() + y, r.width(), true);
double ads;
WetPixDbl wet_top;
WetPixDbl wet_bot;
WetPack pack;
Q_UINT16 w;
while (!srcIt.isDone()) {
// Two wet pixels in one KisWetColorSpace pixels.
pack = *(reinterpret_cast<WetPack*>(srcIt.rawData()));
WetPix* paint = &(pack.paint);
WetPix* adsorb = &(pack.adsorb);
/* do adsorption */
w = paint -> w;
if (w == 0) {
++srcIt;
++dstIt;
continue;
}
ads = 0.5 / QMAX(w, 1);
wetPixToDouble(&wet_top, paint);
wetPixToDouble(&wet_bot, adsorb);
mergePixel(&wet_bot, &wet_top, ads, &wet_bot);
wetPixFromDouble(adsorb, &wet_bot);
paint -> rd *= (1 - ads);
paint -> rw *= (1 - ads);
paint -> gd *= (1 - ads);
paint -> gw *= (1 - ads);
paint -> bd *= (1 - ads);
paint -> bw *= (1 - ads);
*(reinterpret_cast<WetPack*>(dstIt.rawData())) = pack;
++srcIt;
++dstIt;
}
......
......@@ -26,9 +26,8 @@
#include <kdebug.h>
#include <kgenericfactory.h>
#include <kis_factory.h>
#include <kis_paintop_registry.h>
#include <kis_debug_areas.h>
#include "kis_wsbrushop.h"
#include "wsbrushpaintop_plugin.h"
......@@ -40,7 +39,7 @@ K_EXPORT_COMPONENT_FACTORY( kritawsbrushpaintop, WSBrushPaintOpPluginFactory( "k
WSBrushPaintOpPlugin::WSBrushPaintOpPlugin(QObject *parent, const char *name, const QStringList &)
: KParts::Plugin(parent, name)
{
setInstance(WSBrushPaintOpPluginFactory::instance());
setInstance(WSBrushPaintOpPluginFactory::instance());
kdDebug(DBG_AREA_PLUGINS) << "WSBrushPaintOpPlugin. Class: "
<< className()
......
......@@ -34,11 +34,12 @@
#include <kgenericfactory.h>
#include <knuminput.h>
#include <kis_debug_areas.h>
#include <kis_image.h>
#include <kis_iterators_pixel.h>
#include <kis_layer.h>
#include <kis_filter_registry.h>
#include <kis_global.h>
#include <kis_debug_areas.h>
#include <kis_types.h>
#include <kis_paint_device_impl.h>
#include <kis_colorspace_registry.h>
......
......@@ -27,7 +27,7 @@
#include <kgenericfactory.h>
#include <kis_colorspace_registry.h>
#include <kis_debug_areas.h>
#include "wet_sticky_plugin.h"
#include "kis_wet_sticky_colorspace.h"
......
......@@ -41,7 +41,7 @@
#include <klocale.h>
#include "kis_brush.h"
#include "kis_global.h"
#include "kis_debug_areas.h"
#include "kis_image.h"
#include "kis_layer.h"
#include "kis_paint_device_impl.h"
......
......@@ -26,7 +26,8 @@
#include <kservice.h>
#include <ktrader.h>
#include <kparts/componentfactory.h>
#include "kis_debug_areas.h"
#include <math.h>
#include "kis_types.h"
#include "kis_filter_registry.h"
#include "kis_paint_device_impl.h"
......
......@@ -18,8 +18,9 @@
*/
#include <kdebug.h>
#include <klocale.h>
#include "kis_global.h"
#include "kis_debug_areas.h"
#include "kis_filter_strategy.h"
#include <math.h>
double KisHermiteFilterStrategy::valueAt(double t) const {
/* f(t) = 2|t|^3 - 3|t|^2 + 1, -1 <= t <= 1 */
......
......@@ -39,7 +39,7 @@
#include <klocale.h>
#include "kis_brush.h"
#include "kis_global.h"
#include "kis_debug_areas.h"
#include "kis_gradient.h"
#include "kis_image.h"
#include "kis_iterators_pixel.h"
......
......@@ -25,6 +25,7 @@
#include "kis_types.h"
#include "kis_iterators_pixel.h"
#include "kis_colorspace.h"
#include "kis_debug_areas.h"
KisHistogram::KisHistogram(KisLayerSP layer,
KisHistogramProducerSP producer,
......
......@@ -23,6 +23,9 @@
#include <qvaluevector.h>
#include <qmutex.h>
#include <config.h>
#include LCMS_HEADER
#include <ksharedptr.h>
#include <kurl.h>
......@@ -30,7 +33,6 @@
#include "kis_global.h"
#include "kis_types.h"
//#include "kis_guide.h"
#include "kis_annotation.h"
#include <koffice_export.h>
......
......@@ -18,7 +18,7 @@
#include <kdebug.h>
#include "kis_global.h"
#include "kis_debug_areas.h"
#include "kis_image.h"
#include "kis_layer.h"
#include "kis_selection.h"
......
......@@ -821,20 +821,18 @@ void KisPaintDeviceImpl::emitSelectionChanged(const QRect& r) {
KisSelectionSP KisPaintDeviceImpl::selection()
{
// If there either is no selection yet,
// or there is a selection but it has been deselected
// create a new selection
// otherwise, make do with the current selection
if (!m_selection || (m_selection && m_selectionDeselected)) {
if ( m_selectionDeselected && m_selection ) {
m_selection->setVisible( true );
m_selectionDeselected = false;
}
else if (!m_selection) {
m_selection = new KisSelection(this, "layer selection for: " + name());
Q_CHECK_PTR(m_selection);
m_selection -> setVisible(true);
m_selection -> setX(m_x);
m_selection -> setY(m_y);
}
m_hasSelection = true;
m_selectionDeselected = false;
return m_selection;
}
......
......@@ -45,7 +45,7 @@
#include <klocale.h>
#include "kis_brush.h"
#include "kis_global.h"
#include "kis_debug_areas.h"
#include "kis_image.h"
#include "kis_layer.h"
#include "kis_paint_device_impl.h"
......
......@@ -32,7 +32,7 @@
#include "kis_paintop_registry.h"
#include "kis_paintop.h"
#include "kis_id.h"
#include "kis_global.h"
#include "kis_debug_areas.h"
KisPaintOpRegistry * KisPaintOpRegistry::m_singleton = 0;
......
......@@ -37,7 +37,7 @@
#include <kdebug.h>
#include <klocale.h>
#include "kis_global.h"
#include "kis_debug_areas.h"
#include "kis_palette.h"
#include "kis_iterators_pixel.h"
......
......@@ -23,6 +23,7 @@
#include <kio/job.h>
#include "kis_debug_areas.h"
#include "kis_resource.h"
#include "kis_types.h"
......
......@@ -26,9 +26,10 @@ KisSelectedTransaction::KisSelectedTransaction(const QString& name, KisPaintDevi
m_hadSelection(device->hasSelection())
{
m_selTransaction = new KisTransaction(name, device->selection().data());
if(! m_hadSelection)
if(! m_hadSelection) {
m_device->deselect(); // let us not be the cause of select
}
}
KisSelectedTransaction::~KisSelectedTransaction()
......@@ -50,7 +51,7 @@ void KisSelectedTransaction::execute()
void KisSelectedTransaction::unexecute()
{
m_redoHasSelection = m_device->hasSelection();
super::unexecute();
m_selTransaction->unexecute();
if(m_hadSelection)
......
......@@ -24,7 +24,7 @@
#include "kis_layer.h"
#include "kis_selection.h"
#include "kis_global.h"
#include "kis_debug_areas.h"
#include "kis_types.h"
#include "kis_colorspace_factory_registry.h"
#include "kis_fill_painter.h"
......
......@@ -20,6 +20,7 @@
#include <kdebug.h>
#include <klocale.h>
#include "kis_debug_areas.h"
#include "kis_paint_device_impl.h"
#include "kis_selection.h"
#include "kis_transform_visitor.h"
......
......@@ -23,6 +23,7 @@
#include <koStore.h>
#include "kis_global.h"
#include "kis_debug_areas.h"
#include "kis_tileddatamanager.h"
#include "kis_tilediterator.h"
#include "kis_tile.h"
......
......@@ -18,7 +18,7 @@
#include <qcolor.h>
#include "kdebug.h"
#include "kis_debug_areas.h"
#include "kis_pixel.h"
#include "kis_color.h"
#include "kis_profile.h"
......
......@@ -24,7 +24,7 @@
#include <kparts/componentfactory.h>
#include <kmessagebox.h>
#include <klocale.h>
#include "kis_debug_areas.h"
#include "kis_colorspace.h"
#include "kis_profile.h"
#include "kis_colorspace_factory_registry.h"
......
......@@ -30,7 +30,7 @@
#include <kdebug.h>
#include <kgenericfactory.h>
#include <kis_global.h>
#include <kis_debug_areas.h>
#include <kis_types.h>
#include <kis_tool_registry.h>
#include <kis_paintop_registry.h>
......
......@@ -61,6 +61,11 @@ public:
* and paintop
*/
virtual void attach(KisCanvasObserver *observer) = 0;
/**
* From now on, the specified observer will no longer be informed
* of changes.
*/
virtual void detach(KisCanvasObserver *observer) = 0;
/**
......@@ -135,18 +140,30 @@ public:
*/
virtual double zoomFactor() const = 0;
/**
* retrieve the undo adapater -- there is one undo adapter
* per document, and it collects all transactions
*/
virtual KisUndoAdapter *undoAdapter() const = 0;
/**
* @return the interface to the canvas widget
*/
virtual KisCanvasController *canvasController() const = 0;
/// XXX: Remove this method
virtual KisToolControllerInterface *toolController() const = 0;
/// XXX: Remove this method
virtual KisDoc * document() const = 0;
/// XXX: Remove this method
virtual KisProgressDisplayInterface *progressDisplay() const = 0;
/// XXX: Remove this method
virtual KisSelectionManager * selectionManager() = 0;
/// XXX: Remove this method
virtual KoPaletteManager * paletteManager() = 0;
/**
......
/*
* Copyright (c) 2005 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.
*/
#ifndef KIS_DEBUG_AREAS_H_
#define KIS_DEBUG_AREAS_H_
#define DBG_AREA_CORE 41001
#define DBG_AREA_REGISTRY 40002
#define DBG_AREA_TOOLS 41003
#define DBG_AREA_CMS 41004
#define DBG_AREA_FILTERS 41005
#define DBG_AREA_PLUGINS 41006
#define DBG_AREA_UI 41007
#define DBG_AREA_FILE 41008
#define DBG_AREA_MATH 41009
#define DBG_AREA_RENDER 41010
#define DBG_AREA_SCRIPT 41011
#endif
......@@ -19,7 +19,11 @@
#define _KIS_FILTER_CONFIG_WIDGET_H_
#include <qwidget.h>
/**
* Empty base class. Filters can build their own configuration widgets that
* inherit this class. The configuration widget can emit sigPleaseUpdatePreview
* when it wants the preview in the filter dialog to be updated.
*/
class KisFilterConfigWidget : public QWidget {
Q_OBJECT
......@@ -29,6 +33,11 @@ public:
KisFilterConfigWidget(QWidget * parent, const char * name = 0, WFlags f = 0 );
virtual ~KisFilterConfigWidget();
signals:
/**
* Subclasses should emit this signal whenever the preview should be
* be recalculated.
*/
void sigPleaseUpdatePreview();
};
......
......@@ -26,6 +26,15 @@
#include <kis_id.h>
/**
* Base class for registry objects in Krita. Krita registries
* contain resources such as filters, tools or colorspaces.
*
* Items are mapped by KisID. A KisID is the combination of
* a non-localized string that can be used in files and a
* user-visible, translated string that can be used in the
* user interface.
*/
template<typename _T>
class KisGenericRegistry {
typedef std::map<KisID, _T> sto