Commit a27f91de authored by Boudewijn Rempt's avatar Boudewijn Rempt

Add the oasis stuff back to kisdoc2 -- and some more work that

seems to compile.

svn path=/trunk/koffice/; revision=602760
parent 27024afc
......@@ -4,7 +4,6 @@ set(kritaui_LIB_SRCS
kcurve.cc
kis_autobrush.cc
kis_autogradient.cc
#kis_birdeye_box.cc
kis_boundary_painter.cc
kis_brush_chooser.cc
kis_canvas2.cpp
......@@ -54,7 +53,6 @@ set(kritaui_LIB_SRCS
kis_oasis_save_data_visitor.cc
kis_oasis_save_visitor.cc
kis_opengl_canvas2.cpp
#kis_paintop_box.cc
kis_palette_view.cc
kis_palette_widget.cc
kis_part_layer.cc
......@@ -67,7 +65,6 @@ set(kritaui_LIB_SRCS
kis_resource_mediator.cc
kis_resource_provider.cc
kis_resourceserver.cc
#kis_selection_manager.cc
kis_selection_options.cc
kis_strategy_move.cc
kis_text_brush.cc
......@@ -75,10 +72,13 @@ set(kritaui_LIB_SRCS
kis_view_converter.cpp
kobirdeyepanel.cpp
squeezedcombobox.cpp
# kis_paintop_box.cc # Needs to know about the active input device a lot
# kis_tool_freehand.cc
# kis_tool_non_paint.cc
#kis_tool_non_paint.cc
#kis_tool_paint.cc
# kis_tool_shape.cc
# kis_birdeye_box.cc
# kis_selection_manager.cc
)
......
......@@ -237,13 +237,13 @@ void KisControlFrame::createBrushesChooser(KisView2 * view)
l->addWidget(m_brushesTab);
KisBrushChooser * m_brushChooser = new KisBrushChooser(0, "brush_chooser");
m_brushesTab->addTab( m_brushChooser, i18n("Predefined Brushes"));
KisAutobrush * m_autobrush = new KisAutobrush(0, "autobrush", i18n("Autobrush"));
m_brushesTab->addTab( m_autobrush, i18n("Autobrush"));
connect(m_autobrush, SIGNAL(activatedResource(KisResource*)), m_view, SLOT(brushActivated( KisResource* )));
KisBrushChooser * m_brushChooser = new KisBrushChooser(0, "brush_chooser");
m_brushesTab->addTab( m_brushChooser, i18n("Predefined Brushes"));
KisCustomBrush* customBrushes = new KisCustomBrush(0, "custombrush",
i18n("Custom Brush"), m_view);
m_brushesTab->addTab( customBrushes, i18n("Custom Brush"));
......
......@@ -79,11 +79,14 @@
#include "kis_config.h"
#include "kis_custom_image_widget.h"
#include "kis_load_visitor.h"
#include "kis_oasis_save_data_visitor.h"
#include "kis_oasis_save_visitor.h"
#include "kis_part_layer.h"
#include "kis_save_visitor.h"
#include "kis_savexml_visitor.h"
#include "kis_oasis_load_data_visitor.h"
#include "kis_oasis_load_visitor.h"
#include "kis_oasis_save_data_visitor.h"
#include "kis_oasis_save_visitor.h"
static const char *CURRENT_DTD_VERSION = "1.3";
......@@ -235,34 +238,50 @@ QDomDocument KisDoc2::saveXML()
return doc;
}
bool KisDoc2::loadOasis( const QDomDocument&, KoOasisStyles&, const QDomDocument&, KoStore* )
bool KisDoc2::loadOasis( const QDomDocument& doc, KoOasisStyles&, const QDomDocument&, KoStore* store)
{
//XXX: todo (and that includes defining an OASIS format for layered 2D raster data!)
kDebug() << "loading with OpenRaster" << endl;
return true;
kDebug(41008) << "loading with OpenRaster" << endl;
QDomNode root = doc.documentElement();
for (QDomNode node = root.firstChild(); !node.isNull(); node = node.nextSibling()) {
if (node.isElement() && node.nodeName() == "office:body") {
QDomElement elem = node.toElement();
KisOasisLoadVisitor olv(this);
olv.loadImage(elem);
if (!(m_currentImage = olv.image() ))
return false;
KoOasisStore* oasisStore = new KoOasisStore( store );
KisOasisLoadDataVisitor oldv(oasisStore, olv.layerFilenames());
m_currentImage->rootLayer()->accept(oldv);
return true;
}
}
return false;
}
bool KisDoc2::saveOasis( KoStore* store, KoXmlWriter* manifestWriter)
{
#if 0
//XXX: todo (and that includes defining an OASIS format for layered 2D raster data!)
kDebug() << "saving with OpenRaster" << endl;
kDebug(41008) << "saving with OpenRaster" << endl;
manifestWriter->addManifestEntry( "content.xml", "text/xml" );
KoOasisStore* oasisStore = new KoOasisStore( store );
KoXmlWriter* contentWriter = oasisStore->contentWriter();
if ( !contentWriter )
if ( !contentWriter ) {
delete oasisStore;
return false;
}
manifestWriter->addManifestEntry( "data/", "" );
KoXmlWriter* bodyWriter = oasisStore->bodyWriter();
// Save the structure
KisOasisSaveVisitor osv(oasisStore);
bodyWriter->startElement("office:body");
m_currentImage->rootLayer()->accept(osv);
bodyWriter->endElement();
oasisStore->closeContentWriter();
// Sqve the data
KisOasisSaveDataVisitor osdv(oasisStore, manifestWriter);
m_currentImage->rootLayer()->accept(osdv);
delete oasisStore;
#endif
return true;
}
......
......@@ -17,6 +17,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_paintop_box.h"
#include <QWidget>
#include <QString>
#include <QPixmap>
......@@ -35,17 +38,17 @@
#include <kinstance.h>
#include <kis_paintop_registry.h>
#include <kis_resource_provider.h>
#include <kis_view2.h>
#include <kis_painter.h>
#include <kis_paintop.h>
#include <kis_layer.h>
#include <kis_factory2.h>
#include "kis_paintop_box.h"
KisPaintopBox::KisPaintopBox (KisView2 * view, QWidget *parent, const char * name)
: super (parent),
m_canvasController(view->canvasController())
m_resourceProvider(view->resourceProvider())
{
setObjectName(name);
......@@ -65,7 +68,7 @@ KisPaintopBox::KisPaintopBox (KisView2 * view, QWidget *parent, const char * nam
m_layout->setSpacing(1);
m_layout->addWidget(m_cmbPaintops);
connect(this, SIGNAL(selected(const KoID &, const KisPaintOpSettings *)), view, SLOT(paintopActivated(const KoID &, const KisPaintOpSettings *)));
connect(this, SIGNAL(selected(const KoID &, const KisPaintOpSettings *)), m_resourceProvider, SLOT(slotPaintopActivated(const KoID &, const KisPaintOpSettings *)));
connect(m_cmbPaintops, SIGNAL(activated(int)), this, SLOT(slotItemSelected(int)));
// XXX: Let's see... Are all paintops loaded and ready?
......@@ -74,13 +77,14 @@ KisPaintopBox::KisPaintopBox (KisView2 * view, QWidget *parent, const char * nam
// add all paintops, and show/hide them afterwards
addItem(*it);
}
#if 0 // XXX: Port once the view (or resourceprovider) has regained these settings
connect(view, SIGNAL(currentColorSpaceChanged(KoColorSpace*)),
this, SLOT(colorSpaceChanged(KoColorSpace*)));
connect(view, SIGNAL(sigInputDeviceChanged(const KoInputDevice&)),
this, SLOT(slotInputDeviceChanged(const KoInputDevice&)));
setCurrentPaintop(defaultPaintop(view->currentInputDevice()));
#endif
}
KisPaintopBox::~KisPaintopBox()
......@@ -217,7 +221,6 @@ const KisPaintOpSettings *KisPaintopBox::paintopSettings(const KoID & paintop, c
{
QList<KisPaintOpSettings *> settingsArray;
InputDevicePaintopSettingsMap::iterator it = m_inputDevicePaintopSettings.find(inputDevice);
if (it == m_inputDevicePaintopSettings.end()) {
// Create settings for each paintop.
......
......@@ -34,7 +34,7 @@ class QString;
class QHBoxLayout;
class KisView2;
class KisCanvasController;
class KisResourceProvider;
class KoID;
class KoColorSpace;
......@@ -83,7 +83,7 @@ private:
const KisPaintOpSettings *paintopSettings(const KoID & paintop, const KoInputDevice & inputDevice);
private:
KisCanvasController *m_canvasController;
KisResourceProvider *m_resourceProvider;
QComboBox * m_cmbPaintops;
QHBoxLayout * m_layout;
QWidget * m_optionWidget;
......
......@@ -24,7 +24,7 @@
static const QString TOOL_TYPE_SHAPE = "Krita/Shape"; // Geometric shapes like ellipses and lines
static const QString TOOL_TYPE_FREEHAND = "Krita/Freehand"; // Freehand drawing tools
static const QString TOOL_TYPE_TRANSFORM = "Krita/Transform" // Tools that transform the layer;
static const QString TOOL_TYPE_TRANSFORM = "Krita/Transform"; // Tools that transform the layer;
static const QString TOOL_TYPE_FILL = "Krita/Fill"; // Tools that fill parts of the canvas
static const QString TOOL_TYPE_VIEW = "Krita/View"; // Tools that affect the canvas: pan, zoom, etc.
static const QString TOOL_TYPE_SELECTED = "Krita/Select"; // Tools that select pixels
......
......@@ -48,7 +48,7 @@
KisToolPaint::KisToolPaint(KoCanvasBase * canvas)
: KoTool(canvas)
{
m_subject = 0;
m_resourceProvider = 0;
m_optionWidget = 0;
m_optionWidgetLayout = 0;
......@@ -66,19 +66,15 @@ KisToolPaint::~KisToolPaint()
{
}
void KisToolPaint::paint(QPainter&)
void KisToolPaint::paint(QPainter&, KoViewConverter &)
{
}
void KisToolPaint::activate()
void KisToolPaint::activate(bool )
{
if (m_subject) {
updateCompositeOpComboBox();
KisConfig cfg;
m_paintOutline = (cfg.cursorStyle() == CURSOR_STYLE_OUTLINE);
}
updateCompositeOpComboBox();
KisConfig cfg;
m_paintOutline = (cfg.cursorStyle() == CURSOR_STYLE_OUTLINE);
}
......@@ -87,30 +83,6 @@ void KisToolPaint::deactivate()
{
}
void KisToolPaint::buttonPress(KoPointerEvent *)
{
}
void KisToolPaint::move(KoPointerEvent *)
{
}
void KisToolPaint::buttonRelease(KoPointerEvent *)
{
}
void KisToolPaint::doubleClick(KoPointerEvent *)
{
}
void KisToolPaint::keyPress(QKeyEvent *)
{
}
void KisToolPaint::keyRelease(QKeyEvent *)
{
}
QWidget* KisToolPaint::createOptionWidget(QWidget* parent)
{
m_optionWidget = new QWidget(parent);
......
......@@ -27,7 +27,7 @@
#include <QEvent>
#include <QPaintEvent>
#include <KoCanvasResourceProvider.h>
#include <KoTool.h>
#include <krita_export.h>
......@@ -101,7 +101,7 @@ protected:
// Add the tool-specific layout to the default option widget's layout.
void addOptionWidgetLayout(QLayout *layout);
virtual QWidget* createOptionWidget(QWidget* parent);
virtual void createOptionWidget(QWidget* parent);
private:
// XXX: Call this when the layer changes (this used to be called in KisCanvasObserver::update)
......@@ -123,6 +123,7 @@ private:
KisIntSpinbox *m_slOpacity;
QLabel *m_lbComposite;
KisCmbComposite *m_cmbComposite;
KoCanvasResourceProvider * m_resourceProvider;
};
#endif // KIS_TOOL_PAINT_H_
......
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