Commit a74e48f5 authored by Boudewijn Rempt's avatar Boudewijn Rempt

The layerbox is back, plus factor out the layer and zoom stuff in their own

managers, perl-port bits of the view plugins. (The layerbox doesn't show the
layers somehow, need to work on that a bit.)

svn path=/trunk/koffice/; revision=606572
parent 4b4717cb
......@@ -569,7 +569,7 @@ KisImage::KisImage(const KisImage& rhs) : QObject(), KisShared(rhs)
m_d->annotations = rhs.m_d->annotations; // XXX the annotations would probably need to be deep-copied
m_d->nserver = new KisNameServer(i18n("Layer %1"), rhs.m_d->nserver->currentSeed() + 1);
m_d->nserver = new KisNameServer( i18n("Layer ") + rhs.m_d->nserver->currentSeed() + 1);
Q_CHECK_PTR(m_d->nserver);
}
......
#add_subdirectory( performancetest )
add_subdirectory( colorrange )
add_subdirectory( colorspaceconversion )
#add_subdirectory( colorrange )
#add_subdirectory( colorspaceconversion )
add_subdirectory( dropshadow )
add_subdirectory( filtersgallery )
add_subdirectory( histogram )
add_subdirectory( histogram_docker )
add_subdirectory( imagesize )
add_subdirectory( modify_selection )
add_subdirectory( rotateimage )
add_subdirectory( separate_channels )
add_subdirectory( shearimage )
add_subdirectory( flakeshapes )
#add_subdirectory( filtersgallery )
#add_subdirectory( histogram )
#add_subdirectory( histogram_docker )
#add_subdirectory( imagesize )
#add_subdirectory( modify_selection )
#add_subdirectory( rotateimage )
#add_subdirectory( separate_channels )
#add_subdirectory( shearimage )
if(KOFFICE_ENABLE_SCRIPTING)
add_subdirectory(scripting)
# add_subdirectory(scripting)
endif(KOFFICE_ENABLE_SCRIPTING)
......@@ -40,7 +40,7 @@
#include "kis_paint_device.h"
#include "kis_global.h"
#include "kis_types.h"
#include "kis_view.h"
#include "kis_view2.h"
#include "kis_selection.h"
#include "kis_selection_manager.h"
#include "colorrange.h"
......@@ -52,12 +52,12 @@ K_EXPORT_COMPONENT_FACTORY( kritacolorrange, ColorRangeFactory( "krita" ) )
ColorRange::ColorRange(QObject *parent, const QStringList &)
: KParts::Plugin(parent)
{
if (parent->inherits("KisView")) {
if (parent->inherits("KisView2")) {
setInstance(ColorRangeFactory::instance());
setXMLFile(KStandardDirs::locate("data","kritaplugins/colorrange.rc"),
true);
m_view = dynamic_cast<KisView*>(parent);
m_view = dynamic_cast<KisView2*>(parent);
KAction *action = new KAction(i18n("&Color Range..."), actionCollection(), "colorrange");
connect(action, SIGNAL(triggered()), this, SLOT(slotActivated()));
m_view->canvasSubject()->selectionManager()->addSelectionAction(action);
......
......@@ -23,7 +23,7 @@
#include <kparts/plugin.h>
class KisView;
class KisView2;
class ColorRange : public KParts::Plugin
{
......@@ -36,7 +36,7 @@ class ColorRange : public KParts::Plugin
void slotActivated();
private:
KisView * m_view;
KisView2 * m_view;
KisPainter * m_painter;
};
......
......@@ -45,7 +45,7 @@
#include <kis_selection_manager.h>
#include <kis_types.h>
#include <kis_undo_adapter.h>
#include <kis_view.h>
#include <kis_view2.h>
#include <kis_selected_transaction.h>
#include <kis_cursor.h>
......@@ -174,7 +174,7 @@ quint32 matchColors(const QColor & c, enumAction action)
DlgColorRange::DlgColorRange( KisView * view, KisPaintDeviceSP dev, QWidget * parent, const char * name)
DlgColorRange::DlgColorRange( KisView2 * view, KisPaintDeviceSP dev, QWidget * parent, const char * name)
: super (parent)
{
setCaption( i18n("Color Range") );
......
......@@ -32,7 +32,7 @@
#include "ui_wdg_colorrange.h"
class KisView;
class KisView2;
class KisCanvasSubject;
class DlgColorRange;
class KisSelectedTransaction;
......@@ -67,7 +67,7 @@ class DlgColorRange: public KDialog {
public:
DlgColorRange(KisView * view, KisPaintDeviceSP layer, QWidget * parent = 0, const char* name = 0);
DlgColorRange(KisView2 * view, KisPaintDeviceSP layer, QWidget * parent = 0, const char* name = 0);
~DlgColorRange();
private slots:
......@@ -91,7 +91,7 @@ private:
WdgColorRange * m_page;
KisSelectionSP m_selection;
KisPaintDeviceSP m_dev;
KisView * m_view;
KisView2 * m_view;
KisCanvasSubject * m_subject;
enumSelectionMode m_mode;
QCursor m_oldCursor;
......
......@@ -42,7 +42,7 @@
#include "kis_global.h"
#include "kis_types.h"
#include "kis_meta_registry.h"
#include "kis_view.h"
#include "kis_view2.h"
#include "kis_paint_device.h"
#include "KoColorSpaceRegistry.h"
#include "kis_cmb_idlist.h"
......@@ -58,9 +58,9 @@ K_EXPORT_COMPONENT_FACTORY( kritacolorspaceconversion, ColorSpaceConversionFacto
ColorSpaceConversion::ColorSpaceConversion(QObject *parent, const QStringList &)
: KParts::Plugin(parent)
{
if ( parent->inherits("KisView") )
if ( parent->inherits("KisView2") )
{
m_view = (KisView*) parent;
m_view = (KisView2*) parent;
setInstance(ColorSpaceConversionFactory::instance());
......
......@@ -23,7 +23,7 @@
#include <kparts/plugin.h>
class KisView;
class KisView2;
/**
* Dialog for converting between color models.
......@@ -42,7 +42,7 @@ private slots:
private:
KisView * m_view;
KisView2 * m_view;
KisPainter * m_painter;
};
......
......@@ -51,7 +51,7 @@
#include <kis_progress_display_interface.h>
#include <KoColorSpace.h>
#include <KoColorSpaceRegistry.h>
#include <kis_view.h>
#include <kis_view2.h>
#include <kis_paint_device.h>
#include <KoChannelInfo.h>
#include <kis_convolution_painter.h>
......@@ -61,7 +61,7 @@
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
KisDropshadow::KisDropshadow(KisView * view)
KisDropshadow::KisDropshadow(KisView2 * view)
: m_view(view)
{
}
......
......@@ -32,7 +32,7 @@ typedef enum
class QColor;
class KisView;
class KisView2;
class KisProgressDisplayInterface;
class KisDropshadow : public KisProgressSubject {
......@@ -41,7 +41,7 @@ class KisDropshadow : public KisProgressSubject {
public:
KisDropshadow(KisView * view);
KisDropshadow(KisView2 * view);
virtual ~KisDropshadow() {}
void dropshadow(KisProgressDisplayInterface * progress, qint32 xoffset, qint32 yoffset, qint32 blurradius, QColor color, quint8 opacity, bool allowResize);
......@@ -63,7 +63,7 @@ private:
void separate_alpha (quint8 *buf, qint32 width, qint32 bytes);
private:
KisView * m_view;
KisView2 * m_view;
bool m_cancelRequested;
};
......
......@@ -26,7 +26,7 @@
#include <kdebug.h>
#include <kgenericfactory.h>
#include "kis_view.h"
#include "kis_view2.h"
#include "kis_types.h"
#include "kis_image.h"
#include "kis_paint_device.h"
......@@ -41,14 +41,14 @@ K_EXPORT_COMPONENT_FACTORY( kritadropshadow, KGenericFactory<KisDropshadowPlugin
KisDropshadowPlugin::KisDropshadowPlugin(QObject *parent, const QStringList &)
: KParts::Plugin(parent)
{
if ( parent->inherits("KisView") ) {
if ( parent->inherits("KisView2") ) {
setInstance(KGenericFactory<KisDropshadowPlugin>::instance());
setXMLFile(KStandardDirs::locate("data","kritaplugins/dropshadow.rc"),
true);
m_view = (KisView*) parent;
m_view = (KisView2*) parent;
KAction *action = new KAction(i18n("Add Drop Shadow..."), actionCollection(), "dropshadow");
connect(action, SIGNAL(triggered()), this, SLOT(slotDropshadow()));
}
......
......@@ -22,7 +22,7 @@
#include <kparts/plugin.h>
class KisView;
class KisView2;
......@@ -39,7 +39,7 @@ private slots:
private:
KisView * m_view;
KisView2 * m_view;
};
#endif
......@@ -36,7 +36,7 @@
#include "kis_meta_registry.h"
#include "kis_paint_device.h"
#include "kis_selection.h"
#include "kis_view.h"
#include "kis_view2.h"
#include "kis_transaction.h"
namespace Krita {
......@@ -49,14 +49,14 @@ K_EXPORT_COMPONENT_FACTORY( kritafiltersgallery, KritaFiltersGalleryFactory( "kr
KritaFiltersGallery::KritaFiltersGallery(QObject *parent, const QStringList &)
: KParts::Plugin(parent)
{
if ( parent->inherits("KisView") )
if ( parent->inherits("KisView2") )
{
setInstance(KritaFiltersGallery::instance());
setXMLFile(KStandardDirs::locate("data","kritaplugins/kritafiltersgallery.rc"),
true);
m_view = (KisView*) parent;
m_view = (KisView2*) parent;
KAction *action = new KAction(i18n("&Filters Gallery"), actionCollection(), "krita_filters_gallery");
connect(action, SIGNAL(triggered()), this, SLOT(showFiltersGalleryDialog()));
......
......@@ -24,7 +24,7 @@
#include <kparts/plugin.h>
class KisView;
class KisView2;
namespace Krita {
namespace Plugins {
......@@ -39,7 +39,7 @@ namespace FiltersGallery {
void showFiltersGalleryDialog();
private:
KisView * m_view;
KisView2 * m_view;
};
......
......@@ -30,7 +30,7 @@
#include <kis_previewwidget.h>
#include <kis_transaction.h>
#include <kis_types.h>
#include <kis_view.h>
#include <kis_view2.h>
#include "kis_dlg_filtersgallery.h"
......@@ -39,7 +39,7 @@ namespace Plugins {
namespace FiltersGallery {
KisDlgFiltersGallery::KisDlgFiltersGallery(KisView* view, QWidget* parent,const char *name)
KisDlgFiltersGallery::KisDlgFiltersGallery(KisView2* view, QWidget* parent,const char *name)
: KDialog(parent), m_view(view), m_currentConfigWidget(0), m_currentFilter(0)
{
setCaption( i18n("Filters Gallery") );
......
......@@ -28,7 +28,7 @@
class Q3IconViewItem;
class QLabel;
class KisView;
class KisView2;
class KisFilter;
class KisWdgFiltersGallery : public QWidget, public Ui::KisWdgFiltersGallery
......@@ -50,7 +50,7 @@ class KisDlgFiltersGallery : public KDialog
{
Q_OBJECT
public:
KisDlgFiltersGallery(KisView* view, QWidget* parent,const char *name = "");
KisDlgFiltersGallery(KisView2* view, QWidget* parent,const char *name = "");
~KisDlgFiltersGallery();
public:
inline KisFilter* currentFilter() { return m_currentFilter; }
......@@ -61,7 +61,7 @@ class KisDlgFiltersGallery : public KDialog
void selectionHasChanged ( Q3IconViewItem * item );
private:
KisWdgFiltersGallery* m_widget;
KisView* m_view;
KisView2* m_view;
QWidget* m_currentConfigWidget;
KisFilter* m_currentFilter;
QLabel* m_labelNoCW;
......
########### next target ###############
set(kritaflakeshapes_PART_SRCS kis_image_shape.cc kis_paint_device_shape.cc)
kde4_automoc(${kritaflakeshapes_PART_SRCS})
kde4_add_plugin(kritaflakeshapes ${kritaflakeshapes_PART_SRCS})
target_link_libraries(kritaflakeshapes kritaui flake)
install(TARGETS kritaflakeshapes DESTINATION ${PLUGIN_INSTALL_DIR})
########### install files ###############
install( FILES kritaflakeshapes.desktop DESTINATION ${SERVICES_INSTALL_DIR})
/*
* kis_image_flake.h -- Part of Krita
*
* Copyright (c) 2006 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 <QString>
// #include <QWidget>
// #include <QPixmap>
// #include <QList>
// #include <QPainter>
// #include <QSize>
#include <klocale.h>
#include <kgenericfactory.h>
// #include <KoViewConverter.h>
// #include <KoShape.h>
// #include <KoShapeFactory.h>
#include <KoShapeRegistry.h>
// #include "kis_fill_painter.h"
//#include "kis_colorspace.h"
// #include "kis_colorspace_factory_registry.h"
#include "kis_image_shape.h"
#include "kis_paint_device_shape.h"
KisImageShape::KisImageShape()
: KoShape()
{
/*
KisColorSpace * cs = KisColorspaceFactoryRegistry::instance()->getRGB8();
m_image = new KisImage(cs, "Krita Image Shape");
if ( m_image && m_image->rootLayer() && m_image->rootLayer()->activeDevice() ) {
KisFillPainter painter;
painter.begin(m_image->rootLayer()->activeDevice());
painter.fillRect(0, 0, 256, 256, KisColor(Qt::white, cs), OPACITY_OPAQUE);
painter.end();
resize( QSize( 256, 256 ) );
}
*/
}
void KisImageShape::paint(QPainter &painter, const KoViewConverter &converter)
{
applyConversion( painter, converter );
// XXX: We pass 0 for the display profile for now: this should be
// the real monitor profile.
// XXX: Here I _need_ to know the zoom level: we need to follow
// different optimization paths for different zoom levels
// XXX: Keep sizes in mind.
//m_image->renderToPainter( 0, 0, 256, 256, painter );
}
//K_EXPORT_COMPONENT_FACTORY(kritaflakeshapes,
// KGenericFactory<KisImageShapeFactory>( "KritaImageShape" ) )
KisImageShapeFactory::KisImageShapeFactory(QObject *parent, const QStringList & sl)
: KoShapeFactory(parent, "KisImageShape", i18n("Krita Paintimage"))
{
setToolTip( i18n( "A surface to paint on with pixels" ) );
// setIcon(); // XXX: use KIconLoader...
// XXX: Set default templates
KoShapeRegistry::instance()->add( new KisPaintDeviceShapeFactory(parent, sl) );
}
KoShape * KisImageShapeFactory::createDefaultShape()
{
return new KisImageShape();
}
KoShape * KisImageShapeFactory::createShape(const KoProperties * params) const
{
return new KisImageShape();
}
QWidget * KisImageShapeFactory::optionWidget()
{
return 0;
}
/*
* kis_image_flake.h -- Part of Krita
*
* Copyright (c) 2006 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_IMAGE_SHAKE_H_
#define _KIS_IMAGE_SHAKE_H_
#include <QWidget>
// #include <QPainter>
//
// #include <KoViewConverter.h>
#include <KoShape.h>
#include <KoShapeFactory.h>
//
// #include <kis_types.h>
#include "kis_image.h"
class QPainter;
/**
* The paint device flake is a wrapper around a Krita image
*/
class KisImageShape : public KoShape {
public:
KisImageShape();
virtual void paint(QPainter &painter, const KoViewConverter &converter);
private:
KisImageSP m_image;
};
/**
* Factory class for indirect creation of KisImageShapes
*/
class KisImageShapeFactory : public KoShapeFactory {
public:
KisImageShapeFactory(QObject *parent, const QStringList &);
virtual ~KisImageShapeFactory() {}
public:
virtual KoShape * createDefaultShape();
virtual KoShape * createShape(const KoProperties * params) const;
virtual QWidget * optionWidget();
};
#endif // _KIS_IMAGE_SHAKE_H_
/*
* kis_paintdevice_shape.h -- Part of Krita
*
* Copyright (c) 2006 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 <QString>
// #include <QWidget>
// #include <QPixmap>
// #include <QList>
// #include <QPainter>
// #include <QSize>
#include <klocale.h>
#include <kgenericfactory.h>
// #include <KoViewConverter.h>
// #include <KoShape.h>
// #include <KoShapeFactory.h>
#include "kis_paint_device.h"
#include "kis_fill_painter.h"
#include "KoColorSpace.h"
#include "KoColorSpaceRegistry.h"
#include "kis_paint_device_shape.h"
KisPaintDeviceShape::KisPaintDeviceShape()
: KoShape()
{
KoColorSpace * cs = KoColorSpaceRegistry::instance()->rgb8();
m_device = new KisPaintDevice(cs, "Krita PaintDevice Shape");
KisFillPainter painter;
painter.begin(m_device);
painter.fillRect(0, 0, 256, 256, KoColor(Qt::green, cs), OPACITY_OPAQUE);
painter.end();
resize( QSize( 256, 256 ) );
}
void KisPaintDeviceShape::paint(QPainter &painter, const KoViewConverter &converter)
{
// KoViewConvert: has zoom() method to get zoomlevel
applyConversion( painter, converter );
// XXX: We pass 0 for the display profile for now: this should be
// the real monitor profile.
painter.drawImage( QRect( QPoint( 0, 0 ), size().toSize() ),
m_device->convertToQImage( 0 ) );
}
K_EXPORT_COMPONENT_FACTORY(kritaflakeshapes,
KGenericFactory<KisPaintDeviceShapeFactory>( "KisPaintDeviceShape" ) )
KisPaintDeviceShapeFactory::KisPaintDeviceShapeFactory(QObject *parent, const QStringList &)
: KoShapeFactory(parent, "KisPaintDeviceShape", i18n( "Krita Paintdevice" ) )
{
setToolTip( i18n( "A surface to paint on with pixels" ) );
// setPixmap(); // XXX: load icon using KIconLoader
// XXX: Set default templates
KoShapeTemplate t;
t.name = "Krita image";
t.toolTip = "A nice Krita image";
addTemplate(t);
}
KoShape * KisPaintDeviceShapeFactory::createDefaultShape()
{
return new KisPaintDeviceShape();
}
KoShape * KisPaintDeviceShapeFactory::createShape(const KoProperties * params) const
{
return new KisPaintDeviceShape();
}
QWidget * KisPaintDeviceShapeFactory::optionWidget()
{
return 0;
}
/*
* kis_paintdevice_flake.h -- Part of Krita
*
* Copyright (c) 2006 Boudewijn Rempt (boud@valdyas.org)
*