Commit dd75c9d5 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Beginning a dcop interface for kis_paint_device.

svn path=/trunk/koffice/; revision=444089
parent f9dd89b1
......@@ -33,25 +33,27 @@ libkritacore_la_LIBADD = tiles/libkistile.la \
$(LIB_KOPAINTER)
libkritacore_la_SOURCES = kis_color.cc kis_paint_device.cc kis_layer.cc \
kis_image.cc kis_doc.cc kis_view.cc kis_factory.cc kis_nameserver.cc \
kis_painter.cc kis_fill_painter.cc kis_gradient_painter.cc \
kis_convolution_painter.cc kis_cursor.cc kis_selection.cc kis_command.cc kis_background.cc \
kis_config.cc kis_canvas_observer.cc kis_transaction.cc \
kis_selected_transaction.cc kis_vec.cc kis_rect.cc kis_iterators_pixel.cc kis_view_iface.cc \
kis_view_iface.skel kis_doc_iface.cc kis_doc_iface.skel kis_image_iface.cc kis_image_iface.skel \
kis_selection_manager.cc kis_scale_visitor.cc kis_transform_visitor.cc kis_rotate_visitor.cc \
kis_clipboard.cc kis_filter.cc kis_filter_registry.cc kis_filter_strategy.cc \
kis_composite_op.cc kis_part_layer.cc kis_filter_manager.cc kis_tool_manager.cc
kis_image.cc kis_doc.cc kis_view.cc kis_factory.cc kis_nameserver.cc \
kis_painter.cc kis_fill_painter.cc kis_gradient_painter.cc \
kis_convolution_painter.cc kis_cursor.cc kis_selection.cc kis_command.cc kis_background.cc \
kis_config.cc kis_canvas_observer.cc kis_transaction.cc \
kis_selected_transaction.cc kis_vec.cc kis_rect.cc kis_iterators_pixel.cc kis_view_iface.cc \
kis_view_iface.skel kis_doc_iface.cc kis_doc_iface.skel kis_image_iface.cc kis_image_iface.skel \
kis_selection_manager.cc kis_scale_visitor.cc kis_transform_visitor.cc kis_rotate_visitor.cc \
kis_clipboard.cc kis_filter.cc kis_filter_registry.cc kis_filter_strategy.cc \
kis_composite_op.cc kis_part_layer.cc kis_filter_manager.cc kis_tool_manager.cc \
kis_paint_device_iface.cc kis_paint_device_iface.skel
noinst_HEADERS = kis_paint_device.h kis_layer.h kis_image.h kis_doc.h \
kis_view.h kis_factory.h kis_nameserver.h kis_cursor.h kis_selection.h \
kis_command.h kis_background.h kis_global.h kis_config.h kis_canvas_subject.h \
kis_canvas_controller.h kis_canvas_observer.h kis_transaction.h kis_vec.h kis_rect.h \
kis_iteratorpixeltrait.h kis_iterators_pixel.h kis_view_iface.h kis_doc_iface.h kis_image_iface.h \
kis_matrix.h kis_selection_manager.h kis_scale_visitor.h kis_rotate_visitor.h \
kis_filter.h kis_filter_registry.h kis_composite_op.h kis_part_layer.h \
kis_filter_manager.h kis_tool_manager.h
kis_view.h kis_factory.h kis_nameserver.h kis_cursor.h kis_selection.h \
kis_command.h kis_background.h kis_global.h kis_config.h kis_canvas_subject.h \
kis_canvas_controller.h kis_canvas_observer.h kis_transaction.h kis_vec.h kis_rect.h \
kis_iteratorpixeltrait.h kis_iterators_pixel.h kis_view_iface.h kis_doc_iface.h kis_image_iface.h \
kis_matrix.h kis_selection_manager.h kis_scale_visitor.h kis_rotate_visitor.h \
kis_filter.h kis_filter_registry.h kis_composite_op.h kis_part_layer.h \
kis_filter_manager.h kis_tool_manager.h
kis_paint_device_iface.h
libkritacore_la_METASOURCES = AUTO
......
......@@ -36,7 +36,8 @@ DCOPRef KisDocIface::currentImage()
return DCOPRef();
else
return DCOPRef( kapp->dcopClient()->appId(),
img->dcopObject()->objId() );
img->dcopObject()->objId(),
"KisImageIface");
}
......
......@@ -21,6 +21,7 @@
#include <KoViewIface.h>
#include <KoDocumentIface.h>
#include <dcopref.h>
#include <qstring.h>
......
......@@ -1031,26 +1031,6 @@ void KisImage::layerRemove(KisLayerSP layer)
}
}
#if 0
void KisImage::layerRaise(KisLayerSP layer)
{
if (layer) {
m_doc->setModified(true);
raise(layer);
emit layersUpdated(this);
}
}
void KisImage::layerLower(KisLayerSP layer)
{
if (layer) {
m_doc->setModified(true);
lower(layer);
emit layersUpdated(this);
}
}
#endif
void KisImage::layerNext(KisLayerSP l)
{
if (l) {
......
......@@ -138,10 +138,6 @@ public:
KisLayerSP layerAdd(KisLayerSP layer, Q_INT32 position);
void layerRemove(KisLayerSP layer);
#if 0
void layerRaise(KisLayerSP layer);
void layerLower(KisLayerSP layer);
#endif
void layerNext(KisLayerSP layer);
void layerPrev(KisLayerSP layer);
......
......@@ -17,11 +17,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <kapplication.h>
#include "kis_image_iface.h"
#include "kis_types.h"
#include "kis_image.h"
#include "kis_paint_device.h"
#include "kis_paint_device_iface.h"
#include <dcopclient.h>
KisImageIface::KisImageIface( KisImage *img_ )
......@@ -55,3 +57,15 @@ void KisImageIface::setName(const QString& name)
m_img->setName( name );
}
DCOPRef KisImageIface::activeDevice()
{
KisPaintDeviceSP dev = m_img->activeDevice();
if( !dev )
return DCOPRef();
else
return DCOPRef( kapp->dcopClient()->appId(),
dev->dcopObject()->objId(),
"KisPaintDeviceIface");
}
......@@ -20,11 +20,14 @@
#ifndef KIS_IMAGE_IFACE_H
#define KIS_IMAGE_IFACE_H
#include <KoViewIface.h>
#include <dcopref.h>
#include <dcopobject.h>
#include <qstring.h>
class KisImage;
class KisPaintDeviceIface;
class KisImageIface : virtual public DCOPObject
{
......@@ -39,6 +42,12 @@ k_dcop:
void setName(const QString& name);
/**
* Get the active painting device.
*/
DCOPRef activeDevice();
private:
KisImage *m_img;
......
......@@ -44,6 +44,8 @@
#include "kis_color.h"
#include "kis_integer_maths.h"
#include "kis_colorspace_registry.h"
#include "kis_paint_device_iface.h"
namespace {
class KisPaintDeviceCommand : public KNamedCommand {
......@@ -296,6 +298,7 @@ namespace {
KisPaintDevice::KisPaintDevice(KisStrategyColorSpace * colorStrategy, const QString& name) :
KShared()
{
m_dcop = 0;
Q_ASSERT(colorStrategy != 0);
Q_ASSERT(name.isEmpty() == false);
if (name.isEmpty()) kdDebug(DBG_AREA_CORE) << "Empty name \n";
......@@ -330,6 +333,7 @@ KisPaintDevice::KisPaintDevice(KisStrategyColorSpace * colorStrategy, const QStr
KisPaintDevice::KisPaintDevice(KisImage *img, KisStrategyColorSpace * colorStrategy, const QString& name) :
KShared()
{
m_dcop = 0;
Q_ASSERT(name.isEmpty() == false);
m_x = 0;
......@@ -372,7 +376,7 @@ KisPaintDevice::KisPaintDevice(const KisPaintDevice& rhs) : QObject(), KShared(r
{
if (this != &rhs) {
m_owner = 0;
m_dcop = rhs.m_dcop;
if (rhs.m_datamanager) {
m_datamanager = new KisDataManager(*rhs.m_datamanager);
Q_CHECK_PTR(m_datamanager);
......@@ -394,8 +398,19 @@ KisPaintDevice::KisPaintDevice(const KisPaintDevice& rhs) : QObject(), KShared(r
KisPaintDevice::~KisPaintDevice()
{
delete m_dcop;
}
DCOPObject *KisPaintDevice::dcopObject()
{
if (!m_dcop) {
m_dcop = new KisPaintDeviceIface(this);
Q_CHECK_PTR(m_dcop);
}
return m_dcop;
}
void KisPaintDevice::move(Q_INT32 x, Q_INT32 y)
{
m_x = x;
......
......@@ -34,9 +34,11 @@
#include "kis_pixel.h"
#include "kis_canvas_controller.h"
#include "kis_color.h"
#include "kis_paint_device_iface.h"
#include <koffice_export.h>
class DCOPObject;
class QImage;
class QSize;
class QPoint;
......@@ -68,6 +70,7 @@ public:
KisPaintDevice(const KisPaintDevice& rhs);
virtual ~KisPaintDevice();
virtual DCOPObject *dcopObject();
public:
// Implement KisRenderInterface
......@@ -403,6 +406,9 @@ private:
// Contains the actual selection. For now, there can be only
// one selection per layer. XXX: is this a limitation?
KisSelectionSP m_selection;
DCOPObject * m_dcop;
};
inline Q_INT32 KisPaintDevice::pixelSize() const
......
/*
* This file is part of the KDE project
*
* 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.
*/
#include <kapplication.h>
#include "kis_paint_device_iface.h"
#include "kis_paint_device.h"
#include <dcopclient.h>
KisPaintDeviceIface::KisPaintDeviceIface( KisPaintDevice * parent )
: DCOPObject()
{
m_parent = parent;
}
QString KisPaintDeviceIface::name() const
{
return m_parent->name();
}
void KisPaintDeviceIface::setName(const QString& name)
{
m_parent->setName(name);
}
\ No newline at end of file
/* This file is part of the KDE project
* 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_PAINT_DEVICE_IFACE_H
#define _KIS_PAINT_DEVICE_IFACE_H
#include <dcopref.h>
#include <dcopobject.h>
#include <qstring.h>
class KisPaintDevice;
class KisPaintDeviceIface : virtual public DCOPObject
{
K_DCOP
public:
KisPaintDeviceIface( KisPaintDevice * parent );
k_dcop:
virtual QString name() const;
virtual void setName(const QString& name);
private:
KisPaintDevice *m_parent;
};
#endif
......@@ -55,16 +55,15 @@ class KisBrush;
class KisPattern;
/**
KisPainter contains the graphics primitives necessary to draw on a
KisPaintDevice. This is the same kind of abstraction as used in Qt
itself, where you have QPainter and QPaintDevice.
However, KisPainter works on a tiled image and supports different
colour models, and that's a lot more complicated.
KisPainter supports transactions that can group various paint operations
in one undoable step.
* KisPainter contains the graphics primitives necessary to draw on a
* KisPaintDevice. This is the same kind of abstraction as used in Qt
* itself, where you have QPainter and QPaintDevice.
*
* However, KisPainter works on a tiled image and supports different
* colour models, and that's a lot more complicated.
*
* KisPainter supports transactions that can group various paint operations
* in one undoable step.
*/
class KRITACORE_EXPORT KisPainter : public KisProgressSubject {
typedef KisProgressSubject super;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment