From 8b8d44bfccf4d07e51069e68eeef1c0b711cb0ef Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Mon, 18 May 2009 20:15:04 +0000 Subject: [PATCH] Enable just enough of the message based format used in Icon-O-Matic to allow BIconUtils to understand and render it. This makes it possible to use the HVIFTranslator to also read Icon-O-Matic files out of the box. Will cleanup now duplicated files next. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30794 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/libs/icon/IconUtils.cpp | 11 +- src/libs/icon/Jamfile | 5 + src/libs/icon/message/Defines.cpp | 11 + src/libs/icon/message/Defines.h | 17 ++ src/libs/icon/message/MessageImporter.cpp | 236 ++++++++++++++++++ src/libs/icon/message/MessageImporter.h | 56 +++++ src/libs/icon/shape/Shape.cpp | 10 +- src/libs/icon/shape/Shape.h | 2 +- src/libs/icon/shape/VectorPath.cpp | 8 +- src/libs/icon/shape/VectorPath.h | 3 +- src/libs/icon/style/GradientTransformable.cpp | 6 +- src/libs/icon/style/GradientTransformable.h | 2 - src/libs/icon/style/Style.cpp | 8 +- src/libs/icon/style/Style.h | 5 +- .../icon/transformer/AffineTransformer.cpp | 2 - src/libs/icon/transformer/AffineTransformer.h | 3 +- .../icon/transformer/ContourTransformer.cpp | 2 - .../icon/transformer/ContourTransformer.h | 3 +- .../transformer/PerspectiveTransformer.cpp | 2 - .../icon/transformer/PerspectiveTransformer.h | 3 +- .../icon/transformer/StrokeTransformer.cpp | 2 - src/libs/icon/transformer/StrokeTransformer.h | 3 +- src/libs/icon/transformer/Transformer.cpp | 6 +- src/libs/icon/transformer/Transformer.h | 4 +- .../icon/transformer/TransformerFactory.cpp | 3 +- .../icon/transformer/TransformerFactory.h | 2 +- 26 files changed, 374 insertions(+), 41 deletions(-) create mode 100644 src/libs/icon/message/Defines.cpp create mode 100644 src/libs/icon/message/Defines.h create mode 100644 src/libs/icon/message/MessageImporter.cpp create mode 100644 src/libs/icon/message/MessageImporter.h diff --git a/src/libs/icon/IconUtils.cpp b/src/libs/icon/IconUtils.cpp index 9ed0ba50a8..d7a0df5bdc 100644 --- a/src/libs/icon/IconUtils.cpp +++ b/src/libs/icon/IconUtils.cpp @@ -23,6 +23,7 @@ #include "Icon.h" #include "IconRenderer.h" #include "FlatIconImporter.h" +#include "MessageImporter.h" #ifndef HAIKU_TARGET_PLATFORM_HAIKU # define B_MINI_ICON_TYPE 'MICN' @@ -244,8 +245,14 @@ BIconUtils::GetVectorIcon(const uint8* buffer, size_t size, BBitmap* result) FlatIconImporter importer; ret = importer.Import(&icon, const_cast(buffer), size); - if (ret < B_OK) - return ret; + if (ret < B_OK) { + // try the message based format used by Icon-O-Matic + MessageImporter messageImporter; + BMemoryIO memoryIO(const_cast(buffer), size); + ret = messageImporter.Import(&icon, &memoryIO); + if (ret < B_OK) + return ret; + } IconRenderer renderer(temp); renderer.SetIcon(&icon); diff --git a/src/libs/icon/Jamfile b/src/libs/icon/Jamfile index 15c775568d..47d7ce0b6e 100644 --- a/src/libs/icon/Jamfile +++ b/src/libs/icon/Jamfile @@ -6,6 +6,7 @@ AddSubDirSupportedPlatforms libbe_test ; # source directories local sourceDirs = flat_icon + message shape style transformable @@ -29,6 +30,10 @@ StaticLibrary libicon.a : LittleEndianBuffer.cpp PathCommandQueue.cpp + # message + Defines.cpp + MessageImporter.cpp + # shape PathContainer.cpp Shape.cpp diff --git a/src/libs/icon/message/Defines.cpp b/src/libs/icon/message/Defines.cpp new file mode 100644 index 0000000000..8b0d4f2969 --- /dev/null +++ b/src/libs/icon/message/Defines.cpp @@ -0,0 +1,11 @@ +/* + * Copyright 2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan Aßmus + */ +#include "Defines.h" + +const uint32 kNativeIconMagicNumber = 'IMSG'; +const char* kNativeIconMimeType = "application/x-vnd.Haiku-icon"; diff --git a/src/libs/icon/message/Defines.h b/src/libs/icon/message/Defines.h new file mode 100644 index 0000000000..8d75a1cebf --- /dev/null +++ b/src/libs/icon/message/Defines.h @@ -0,0 +1,17 @@ +/* + * Copyright 2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan Aßmus + */ +#ifndef DEFINES_H +#define DEFINES_H + +#include + + +extern const uint32 kNativeIconMagicNumber; +extern const char* kNativeIconMimeType; + +#endif // DEFINES_H diff --git a/src/libs/icon/message/MessageImporter.cpp b/src/libs/icon/message/MessageImporter.cpp new file mode 100644 index 0000000000..018b733f0e --- /dev/null +++ b/src/libs/icon/message/MessageImporter.cpp @@ -0,0 +1,236 @@ +/* + * Copyright 2006-2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan Aßmus + */ +#include "MessageImporter.h" + +#include +#include + +#include +#include +#include +#include + +#include "Defines.h" +#include "Icon.h" +#include "PathContainer.h" +#include "Shape.h" +#include "Style.h" +#include "StyleContainer.h" +#include "VectorPath.h" + +using std::nothrow; + +// constructor +MessageImporter::MessageImporter() +#ifdef ICON_O_MATIC + : Importer() +#endif +{ +} + +// destructor +MessageImporter::~MessageImporter() +{ +} + +// Import +status_t +MessageImporter::Import(Icon* icon, BPositionIO* stream) +{ +#ifdef ICON_O_MATIC + status_t ret = Init(icon); + if (ret < B_OK) { + printf("MessageImporter::Import() - " + "Init() error: %s\n", strerror(ret)); + return ret; + } +#else + status_t ret; +#endif + + uint32 magic = 0; + ssize_t size = sizeof(magic); + off_t position = stream->Position(); + ssize_t read = stream->Read(&magic, size); + if (read != size) { + if (read < 0) + ret = (status_t)read; + else + ret = B_IO_ERROR; + return ret; + } + + if (B_BENDIAN_TO_HOST_INT32(magic) != kNativeIconMagicNumber) { + // this might be an old native icon file, where + // we didn't prepend the magic number yet, seek back + if (stream->Seek(position, SEEK_SET) != position) { + printf("MessageImporter::Import() - " + "failed to seek back to beginning of stream\n"); + return B_IO_ERROR; + } + } + + BMessage archive; + ret = archive.Unflatten(stream); + if (ret < B_OK) { + printf("MessageImporter::Import() - " + "error unflattening icon archive: %s\n", strerror(ret)); + return ret; + } + + // paths + PathContainer* paths = icon->Paths(); + ret = _ImportPaths(&archive, paths); + if (ret < B_OK) { + printf("MessageImporter::Import() - " + "error importing paths: %s\n", strerror(ret)); + return ret; + } + + // styles + StyleContainer* styles = icon->Styles(); + ret = _ImportStyles(&archive, styles); + if (ret < B_OK) { + printf("MessageImporter::Import() - " + "error importing styles: %s\n", strerror(ret)); + return ret; + } + + // shapes + ret = _ImportShapes(&archive, paths, styles, icon->Shapes()); + if (ret < B_OK) { + printf("MessageImporter::Import() - " + "error importing shapes: %s\n", strerror(ret)); + return ret; + } + + return B_OK; +} + +// #pragma mark - + +// _ImportPaths +status_t +MessageImporter::_ImportPaths(const BMessage* archive, + PathContainer* paths) const +{ + BMessage allPaths; + status_t ret = archive->FindMessage("paths", &allPaths); + if (ret < B_OK) + return ret; + + BMessage pathArchive; + for (int32 i = 0; + allPaths.FindMessage("path", i, &pathArchive) == B_OK; i++) { + VectorPath* path = new (nothrow) VectorPath(&pathArchive); + if (!path || !paths->AddPath(path)) { + delete path; + ret = B_NO_MEMORY; + } + if (ret < B_OK) + break; + } + + return ret; +} + +// _ImportStyles +status_t +MessageImporter::_ImportStyles(const BMessage* archive, + StyleContainer* styles) const +{ + BMessage allStyles; + status_t ret = archive->FindMessage("styles", &allStyles); + if (ret < B_OK) + return ret; + + BMessage styleArchive; + for (int32 i = 0; + allStyles.FindMessage("style", i, &styleArchive) == B_OK; i++) { + Style* style = new (nothrow) Style(&styleArchive); + if (!style || !styles->AddStyle(style)) { + delete style; + ret = B_NO_MEMORY; + } + if (ret < B_OK) + break; + } + + return ret; +} + +// _ImportShapes +status_t +MessageImporter::_ImportShapes(const BMessage* archive, + PathContainer* paths, + StyleContainer* styles, + ShapeContainer* shapes) const +{ + BMessage allShapes; + status_t ret = archive->FindMessage("shapes", &allShapes); + if (ret < B_OK) + return ret; + + BMessage shapeArchive; + for (int32 i = 0; + allShapes.FindMessage("shape", i, &shapeArchive) == B_OK; i++) { + // find the right style + int32 styleIndex; + if (shapeArchive.FindInt32("style ref", &styleIndex) < B_OK) { + printf("MessageImporter::_ImportShapes() - " + "Shape %ld doesn't reference a Style!", i); + continue; + } +#ifdef ICON_O_MATIC + Style* style = styles->StyleAt(StyleIndexFor(styleIndex)); +#else + Style* style = styles->StyleAt(styleIndex); +#endif + if (!style) { + printf("MessageImporter::_ImportShapes() - " + "Shape %ld wants Style %ld, which does not exist\n", + i, styleIndex); + continue; + } + + // create shape + Shape* shape = new (nothrow) Shape(style); + if (!shape || shape->InitCheck() < B_OK || !shapes->AddShape(shape)) { + delete shape; + ret = B_NO_MEMORY; + } + if (ret < B_OK) + break; + + // find the referenced paths + int32 pathIndex; + for (int32 j = 0; + shapeArchive.FindInt32("path ref", j, &pathIndex) == B_OK; + j++) { +#ifdef ICON_O_MATIC + VectorPath* path = paths->PathAt(PathIndexFor(pathIndex)); +#else + VectorPath* path = paths->PathAt(pathIndex); +#endif + if (!path) { + printf("MessageImporter::_ImportShapes() - " + "Shape %ld referenced path %ld, " + "which does not exist\n", i, pathIndex); + continue; + } + shape->Paths()->AddPath(path); + } + + // Shape properties + if (ret == B_OK) + shape->Unarchive(&shapeArchive); + } + + return ret; +} + diff --git a/src/libs/icon/message/MessageImporter.h b/src/libs/icon/message/MessageImporter.h new file mode 100644 index 0000000000..31b9058271 --- /dev/null +++ b/src/libs/icon/message/MessageImporter.h @@ -0,0 +1,56 @@ +/* + * Copyright 2006-2007, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stephan Aßmus + */ +#ifndef MESSAGE_IMPORTER_H +#define MESSAGE_IMPORTER_H + + +#ifdef ICON_O_MATIC +# include "Importer.h" +#else +# include +#endif + +class BMessage; +class BPositionIO; + +namespace BPrivate { +namespace Icon { + +class Icon; +class PathContainer; +class ShapeContainer; +class StyleContainer; + + +#ifdef ICON_O_MATIC +class MessageImporter : public Importer { +#else +class MessageImporter { +#endif + public: + MessageImporter(); + virtual ~MessageImporter(); + + status_t Import(Icon* icon, + BPositionIO* stream); + + private: + status_t _ImportPaths(const BMessage* archive, + PathContainer* paths) const; + status_t _ImportStyles(const BMessage* archive, + StyleContainer* styles) const; + status_t _ImportShapes(const BMessage* archive, + PathContainer* paths, + StyleContainer* styles, + ShapeContainer* shapes) const; +}; + +} // namespace Icon +} // namespace BPrivate + +#endif // MESSAGE_IMPORTER_H diff --git a/src/libs/icon/shape/Shape.cpp b/src/libs/icon/shape/Shape.cpp index 90e2a5ca83..5f9b9bf0d6 100644 --- a/src/libs/icon/shape/Shape.cpp +++ b/src/libs/icon/shape/Shape.cpp @@ -157,16 +157,18 @@ Shape::~Shape() // #pragma mark - -#ifdef ICON_O_MATIC - // Unarchive status_t Shape::Unarchive(const BMessage* archive) { +#ifdef ICON_O_MATIC // IconObject properties status_t ret = IconObject::Unarchive(archive); if (ret < B_OK) return ret; +#else + status_t ret; +#endif // recreate transformers BMessage transformerArchive; @@ -217,6 +219,8 @@ Shape::Unarchive(const BMessage* archive) return B_OK; } +#ifdef ICON_O_MATIC + // Archive status_t Shape::Archive(BMessage* into, bool deep) const @@ -407,10 +411,10 @@ Shape::InitCheck() const void Shape::SetStyle(::Style* style) { -#ifdef ICON_O_MATIC if (fStyle == style) return; +#ifdef ICON_O_MATIC if (fStyle) { fStyle->RemoveObserver(this); fStyle->Release(); diff --git a/src/libs/icon/shape/Shape.h b/src/libs/icon/shape/Shape.h index e0d6ec4dac..eaf735ef6c 100644 --- a/src/libs/icon/shape/Shape.h +++ b/src/libs/icon/shape/Shape.h @@ -59,9 +59,9 @@ class Shape : public BPrivate::Icon::Transformable { Shape(const Shape& other); virtual ~Shape(); -#ifdef ICON_O_MATIC // IconObject interface virtual status_t Unarchive(const BMessage* archive); +#ifdef ICON_O_MATIC virtual status_t Archive(BMessage* into, bool deep = true) const; diff --git a/src/libs/icon/shape/VectorPath.cpp b/src/libs/icon/shape/VectorPath.cpp index 6d991db937..a2108426ae 100644 --- a/src/libs/icon/shape/VectorPath.cpp +++ b/src/libs/icon/shape/VectorPath.cpp @@ -21,10 +21,12 @@ #ifdef ICON_O_MATIC #include #include +#endif // ICON_O_MATIC #include #include +#ifdef ICON_O_MATIC # include "support.h" # include "CommonPropertyIDs.h" @@ -119,12 +121,15 @@ VectorPath::VectorPath(const VectorPath& from) *this = from; } -#ifdef ICON_O_MATIC // constructor VectorPath::VectorPath(BMessage* archive) +#ifdef ICON_O_MATIC : BArchivable(), IconObject(archive), fListeners(20), +#else + : +#endif fPath(NULL), fClosed(false), fPointCount(0), @@ -161,7 +166,6 @@ VectorPath::VectorPath(BMessage* archive) fClosed = false; } -#endif // ICON_O_MATIC // destructor VectorPath::~VectorPath() diff --git a/src/libs/icon/shape/VectorPath.h b/src/libs/icon/shape/VectorPath.h index e56f7f5a0b..e69641353a 100644 --- a/src/libs/icon/shape/VectorPath.h +++ b/src/libs/icon/shape/VectorPath.h @@ -70,9 +70,8 @@ class VectorPath { VectorPath(); VectorPath(const VectorPath& from); -#ifdef ICON_O_MATIC VectorPath(BMessage* archive); -#endif + virtual ~VectorPath(); #ifdef ICON_O_MATIC diff --git a/src/libs/icon/style/GradientTransformable.cpp b/src/libs/icon/style/GradientTransformable.cpp index 072b9239b2..50c8525a65 100644 --- a/src/libs/icon/style/GradientTransformable.cpp +++ b/src/libs/icon/style/GradientTransformable.cpp @@ -38,12 +38,15 @@ Gradient::Gradient(bool empty) } } -#ifdef ICON_O_MATIC // constructor Gradient::Gradient(BMessage* archive) +#ifdef ICON_O_MATIC : BArchivable(archive), Observable(), Transformable(), +#else + : Transformable(), +#endif fColors(4), fType(GRADIENT_LINEAR), @@ -80,7 +83,6 @@ Gradient::Gradient(BMessage* archive) &fInheritTransformation) < B_OK) fInheritTransformation = true; } -#endif // ICON_O_MATIC // constructor Gradient::Gradient(const Gradient& other) diff --git a/src/libs/icon/style/GradientTransformable.h b/src/libs/icon/style/GradientTransformable.h index 9aeb3707b9..596cc93bcf 100644 --- a/src/libs/icon/style/GradientTransformable.h +++ b/src/libs/icon/style/GradientTransformable.h @@ -50,9 +50,7 @@ class Gradient : public Transformable { public: Gradient(bool empty = false); -#ifdef ICON_O_MATIC Gradient(BMessage* archive); -#endif Gradient(const Gradient& other); virtual ~Gradient(); diff --git a/src/libs/icon/style/Style.cpp b/src/libs/icon/style/Style.cpp index d8b3e79ee9..814620333b 100644 --- a/src/libs/icon/style/Style.cpp +++ b/src/libs/icon/style/Style.cpp @@ -10,9 +10,9 @@ #include -#ifdef ICON_O_MATIC # include +#ifdef ICON_O_MATIC # include "ui_defines.h" #else # define kWhite (rgb_color){ 255, 255, 255, 255 } @@ -77,11 +77,14 @@ Style::Style(const Style& other) SetGradient(other.fGradient); } -#ifdef ICON_O_MATIC // constructor Style::Style(BMessage* archive) +#ifdef ICON_O_MATIC : IconObject(archive), Observer(), +#else + : +#endif fColor(kWhite), fGradient(NULL), @@ -102,7 +105,6 @@ Style::Style(BMessage* archive) SetGradient(&gradient); } } -#endif // ICON_O_MATIC // destructor Style::~Style() diff --git a/src/libs/icon/style/Style.h b/src/libs/icon/style/Style.h index e7ee34230c..177024e98d 100644 --- a/src/libs/icon/style/Style.h +++ b/src/libs/icon/style/Style.h @@ -22,6 +22,8 @@ #include +class BMessage; + namespace BPrivate { namespace Icon { @@ -37,9 +39,8 @@ class Style { Style(); Style(const Style& other); Style(const rgb_color& color); -#ifdef ICON_O_MATIC Style(BMessage* archive); -#endif + virtual ~Style(); #ifdef ICON_O_MATIC diff --git a/src/libs/icon/transformer/AffineTransformer.cpp b/src/libs/icon/transformer/AffineTransformer.cpp index 6277239c25..e3d73e673f 100644 --- a/src/libs/icon/transformer/AffineTransformer.cpp +++ b/src/libs/icon/transformer/AffineTransformer.cpp @@ -31,7 +31,6 @@ AffineTransformer::AffineTransformer(VertexSource& source) { } -#ifdef ICON_O_MATIC // constructor AffineTransformer::AffineTransformer(VertexSource& source, BMessage* archive) @@ -50,7 +49,6 @@ AffineTransformer::AffineTransformer(VertexSource& source, load_from((const double*)matrix); } } -#endif // ICON_O_MATIC // destructor AffineTransformer::~AffineTransformer() diff --git a/src/libs/icon/transformer/AffineTransformer.h b/src/libs/icon/transformer/AffineTransformer.h index 3f0f352cca..452db3b728 100644 --- a/src/libs/icon/transformer/AffineTransformer.h +++ b/src/libs/icon/transformer/AffineTransformer.h @@ -31,11 +31,10 @@ class AffineTransformer : public Transformer, AffineTransformer( VertexSource& source); -#ifdef ICON_O_MATIC AffineTransformer( VertexSource& source, BMessage* archive); -#endif + virtual ~AffineTransformer(); virtual Transformer* Clone(VertexSource& source) const; diff --git a/src/libs/icon/transformer/ContourTransformer.cpp b/src/libs/icon/transformer/ContourTransformer.cpp index b88870cc3d..1ab7073887 100644 --- a/src/libs/icon/transformer/ContourTransformer.cpp +++ b/src/libs/icon/transformer/ContourTransformer.cpp @@ -33,7 +33,6 @@ ContourTransformer::ContourTransformer(VertexSource& source) auto_detect_orientation(true); } -#ifdef ICON_O_MATIC // constructor ContourTransformer::ContourTransformer(VertexSource& source, BMessage* archive) @@ -62,7 +61,6 @@ ContourTransformer::ContourTransformer(VertexSource& source, if (archive->FindDouble("inner miter limit", &value) == B_OK) inner_miter_limit(value); } -#endif // ICON_O_MATIC // destructor ContourTransformer::~ContourTransformer() diff --git a/src/libs/icon/transformer/ContourTransformer.h b/src/libs/icon/transformer/ContourTransformer.h index 76fd376096..1e756ec5fe 100644 --- a/src/libs/icon/transformer/ContourTransformer.h +++ b/src/libs/icon/transformer/ContourTransformer.h @@ -28,11 +28,10 @@ class ContourTransformer : public Transformer, ContourTransformer( VertexSource& source); -#ifdef ICON_O_MATIC ContourTransformer( VertexSource& source, BMessage* archive); -#endif + virtual ~ContourTransformer(); virtual Transformer* Clone(VertexSource& source) const; diff --git a/src/libs/icon/transformer/PerspectiveTransformer.cpp b/src/libs/icon/transformer/PerspectiveTransformer.cpp index 066598eb00..0f4525000a 100644 --- a/src/libs/icon/transformer/PerspectiveTransformer.cpp +++ b/src/libs/icon/transformer/PerspectiveTransformer.cpp @@ -26,7 +26,6 @@ PerspectiveTransformer::PerspectiveTransformer(VertexSource& source) { } -#ifdef ICON_O_MATIC // constructor PerspectiveTransformer::PerspectiveTransformer(VertexSource& source, BMessage* archive) @@ -35,7 +34,6 @@ PerspectiveTransformer::PerspectiveTransformer(VertexSource& source, { // TODO: upgrade AGG to be able to use load_from() etc } -#endif // destructor PerspectiveTransformer::~PerspectiveTransformer() diff --git a/src/libs/icon/transformer/PerspectiveTransformer.h b/src/libs/icon/transformer/PerspectiveTransformer.h index 12d1173c86..2bddc83ca4 100644 --- a/src/libs/icon/transformer/PerspectiveTransformer.h +++ b/src/libs/icon/transformer/PerspectiveTransformer.h @@ -31,11 +31,10 @@ class PerspectiveTransformer : public Transformer, PerspectiveTransformer( VertexSource& source); -#ifdef ICON_O_MATIC PerspectiveTransformer( VertexSource& source, BMessage* archive); -#endif + virtual ~PerspectiveTransformer(); // Transformer interface diff --git a/src/libs/icon/transformer/StrokeTransformer.cpp b/src/libs/icon/transformer/StrokeTransformer.cpp index 7ef5726efc..6cd818f5d5 100644 --- a/src/libs/icon/transformer/StrokeTransformer.cpp +++ b/src/libs/icon/transformer/StrokeTransformer.cpp @@ -31,7 +31,6 @@ StrokeTransformer::StrokeTransformer(VertexSource& source) { } -#ifdef ICON_O_MATIC // constructor StrokeTransformer::StrokeTransformer(VertexSource& source, BMessage* archive) @@ -64,7 +63,6 @@ StrokeTransformer::StrokeTransformer(VertexSource& source, if (archive->FindDouble("shorten", &value) == B_OK) shorten(value); } -#endif // ICON_O_MATIC // destructor StrokeTransformer::~StrokeTransformer() diff --git a/src/libs/icon/transformer/StrokeTransformer.h b/src/libs/icon/transformer/StrokeTransformer.h index 7bb1ce4296..b1b47dc4e5 100644 --- a/src/libs/icon/transformer/StrokeTransformer.h +++ b/src/libs/icon/transformer/StrokeTransformer.h @@ -28,11 +28,10 @@ class StrokeTransformer : public Transformer, StrokeTransformer( VertexSource& source); -#ifdef ICON_O_MATIC StrokeTransformer( VertexSource& source, BMessage* archive); -#endif + virtual ~StrokeTransformer(); // Transformer interface diff --git a/src/libs/icon/transformer/Transformer.cpp b/src/libs/icon/transformer/Transformer.cpp index 132b83db37..85230f23f3 100644 --- a/src/libs/icon/transformer/Transformer.cpp +++ b/src/libs/icon/transformer/Transformer.cpp @@ -36,15 +36,17 @@ Transformer::Transformer(VertexSource& source, const char* name) { } -#ifdef ICON_O_MATIC // constructor Transformer::Transformer(VertexSource& source, BMessage* archive) +#ifdef ICON_O_MATIC : IconObject(archive), +#else + : +#endif fSource(source) { } -#endif // ICON_O_MATIC // destructor Transformer::~Transformer() diff --git a/src/libs/icon/transformer/Transformer.h b/src/libs/icon/transformer/Transformer.h index b16cd9cbb6..ddc11ded40 100644 --- a/src/libs/icon/transformer/Transformer.h +++ b/src/libs/icon/transformer/Transformer.h @@ -12,6 +12,7 @@ #ifdef ICON_O_MATIC # include "IconObject.h" #else +# include # include #endif @@ -41,10 +42,9 @@ class Transformer : public VertexSource { public: Transformer(VertexSource& source, const char* name); -#ifdef ICON_O_MATIC Transformer(VertexSource& source, BMessage* archive); -#endif + virtual ~Transformer(); // Transformer diff --git a/src/libs/icon/transformer/TransformerFactory.cpp b/src/libs/icon/transformer/TransformerFactory.cpp index 2b1b98fe2c..f531c38eaf 100644 --- a/src/libs/icon/transformer/TransformerFactory.cpp +++ b/src/libs/icon/transformer/TransformerFactory.cpp @@ -38,7 +38,6 @@ TransformerFactory::TransformerFor(uint32 type, VertexSource& source) return NULL; } -#ifdef ICON_O_MATIC // TransformerFor Transformer* TransformerFactory::TransformerFor(BMessage* message, @@ -58,6 +57,8 @@ TransformerFactory::TransformerFor(BMessage* message, return NULL; } +#ifdef ICON_O_MATIC + // NextType bool TransformerFactory::NextType(int32* cookie, uint32* type, BString* name) diff --git a/src/libs/icon/transformer/TransformerFactory.h b/src/libs/icon/transformer/TransformerFactory.h index bec9a39978..f0ade510ba 100644 --- a/src/libs/icon/transformer/TransformerFactory.h +++ b/src/libs/icon/transformer/TransformerFactory.h @@ -26,10 +26,10 @@ class TransformerFactory { static Transformer* TransformerFor(uint32 type, VertexSource& source); -#ifdef ICON_O_MATIC static Transformer* TransformerFor(BMessage* archive, VertexSource& source); +#ifdef ICON_O_MATIC static bool NextType(int32* cookie, uint32* type, BString* name);