Icon-O-Matic: Make GradientTransformable a BReferenceable
* Switch to using support/Referenceable.h instead of using an older copy of this code. * Make GradientTransformable a BReferenceable and fix #12033.
This commit is contained in:
@@ -198,7 +198,6 @@ Application Icon-O-Matic :
|
|||||||
Selection.cpp
|
Selection.cpp
|
||||||
|
|
||||||
# generic/support
|
# generic/support
|
||||||
Referenceable.cpp
|
|
||||||
RWLocker.cpp
|
RWLocker.cpp
|
||||||
support.cpp
|
support.cpp
|
||||||
support_ui.cpp
|
support_ui.cpp
|
||||||
|
|||||||
@@ -839,7 +839,7 @@ MainWindow::SetIcon(Icon* icon)
|
|||||||
fIcon = icon;
|
fIcon = icon;
|
||||||
|
|
||||||
if (fIcon != NULL)
|
if (fIcon != NULL)
|
||||||
fIcon->Acquire();
|
fIcon->AcquireReference();
|
||||||
else
|
else
|
||||||
MakeEmpty();
|
MakeEmpty();
|
||||||
|
|
||||||
@@ -865,7 +865,7 @@ MainWindow::SetIcon(Icon* icon)
|
|||||||
|
|
||||||
// keep this last
|
// keep this last
|
||||||
if (oldIcon != NULL)
|
if (oldIcon != NULL)
|
||||||
oldIcon->Release();
|
oldIcon->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ Document::~Document()
|
|||||||
{
|
{
|
||||||
delete fCommandStack;
|
delete fCommandStack;
|
||||||
delete fSelection;
|
delete fSelection;
|
||||||
fIcon->Release();
|
fIcon->ReleaseReference();
|
||||||
delete fNativeSaver;
|
delete fNativeSaver;
|
||||||
delete fExportSaver;
|
delete fExportSaver;
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ Document::SetIcon(_ICON_NAMESPACE Icon* icon)
|
|||||||
if (fIcon == icon)
|
if (fIcon == icon)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fIcon->Release();
|
fIcon->ReleaseReference();
|
||||||
|
|
||||||
fIcon = icon;
|
fIcon = icon;
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
// constructor
|
// constructor
|
||||||
IconObject::IconObject(const char* name)
|
IconObject::IconObject(const char* name)
|
||||||
: Observable(),
|
: Observable(),
|
||||||
Referenceable(),
|
BReferenceable(),
|
||||||
Selectable(),
|
Selectable(),
|
||||||
|
|
||||||
fName(name)
|
fName(name)
|
||||||
@@ -27,7 +27,7 @@ IconObject::IconObject(const char* name)
|
|||||||
// copy constructor
|
// copy constructor
|
||||||
IconObject::IconObject(const IconObject& other)
|
IconObject::IconObject(const IconObject& other)
|
||||||
: Observable(),
|
: Observable(),
|
||||||
Referenceable(),
|
BReferenceable(),
|
||||||
Selectable(),
|
Selectable(),
|
||||||
|
|
||||||
fName(other.fName)
|
fName(other.fName)
|
||||||
@@ -37,7 +37,7 @@ IconObject::IconObject(const IconObject& other)
|
|||||||
// archive constructor
|
// archive constructor
|
||||||
IconObject::IconObject(BMessage* archive)
|
IconObject::IconObject(BMessage* archive)
|
||||||
: Observable(),
|
: Observable(),
|
||||||
Referenceable(),
|
BReferenceable(),
|
||||||
Selectable(),
|
Selectable(),
|
||||||
|
|
||||||
fName()
|
fName()
|
||||||
|
|||||||
@@ -9,17 +9,17 @@
|
|||||||
#ifndef ICON_OBJECT_H
|
#ifndef ICON_OBJECT_H
|
||||||
#define ICON_OBJECT_H
|
#define ICON_OBJECT_H
|
||||||
|
|
||||||
|
#include <Referenceable.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
#include "Observable.h"
|
#include "Observable.h"
|
||||||
#include "Referenceable.h"
|
|
||||||
#include "Selectable.h"
|
#include "Selectable.h"
|
||||||
|
|
||||||
class BMessage;
|
class BMessage;
|
||||||
class PropertyObject;
|
class PropertyObject;
|
||||||
|
|
||||||
class IconObject : public Observable,
|
class IconObject : public Observable,
|
||||||
public Referenceable,
|
public BReferenceable,
|
||||||
public Selectable {
|
public Selectable {
|
||||||
public:
|
public:
|
||||||
IconObject(const char* name);
|
IconObject(const char* name);
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2001-2006, Haiku.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* DarkWyrm <[email protected]>
|
|
||||||
* Axel Dörfler, [email protected]
|
|
||||||
* Stephan Aßmus <[email protected]>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "Referenceable.h"
|
|
||||||
|
|
||||||
#define TRACE 0
|
|
||||||
|
|
||||||
#if TRACE
|
|
||||||
#define ICON 1
|
|
||||||
#include <debugger.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#if ICON
|
|
||||||
#include "IconObject.h"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// constructor
|
|
||||||
Referenceable::Referenceable()
|
|
||||||
: fReferenceCount(1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// destructor
|
|
||||||
Referenceable::~Referenceable()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// Acquire
|
|
||||||
void
|
|
||||||
Referenceable::Acquire()
|
|
||||||
{
|
|
||||||
atomic_add(&fReferenceCount, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Release
|
|
||||||
bool
|
|
||||||
Referenceable::Release()
|
|
||||||
{
|
|
||||||
#if TRACE
|
|
||||||
int32 old = atomic_add(&fReferenceCount, -1);
|
|
||||||
//#if ICON
|
|
||||||
// if (old > 1) {
|
|
||||||
//IconObject* object = dynamic_cast<IconObject*>(this);
|
|
||||||
//printf("Referenceable::Release() - %s: %ld\n",
|
|
||||||
// object ? object->Name() : "unkown", fReferenceCount);
|
|
||||||
// } else
|
|
||||||
//#endif
|
|
||||||
if (old == 1) {
|
|
||||||
#if ICON
|
|
||||||
IconObject* object = dynamic_cast<IconObject*>(this);
|
|
||||||
printf("Referenceable::Release() - deleting %s\n",
|
|
||||||
object ? object->Name() : "unkown");
|
|
||||||
#else
|
|
||||||
printf("Referenceable::Release() - deleting\n");
|
|
||||||
#endif
|
|
||||||
delete this;
|
|
||||||
return true;
|
|
||||||
} else if (old < 1)
|
|
||||||
debugger("Referenceable::Release() - already deleted");
|
|
||||||
#else
|
|
||||||
if (atomic_add(&fReferenceCount, -1) == 1) {
|
|
||||||
delete this;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2001-2006, Haiku.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
|
||||||
* Axel Dörfler, axeld@pinc-software.de
|
|
||||||
* Stephan Aßmus <superstippi@gmx.de>
|
|
||||||
*/
|
|
||||||
#ifndef REFERENCABLE_H
|
|
||||||
#define REFERENCABLE_H
|
|
||||||
|
|
||||||
#include <SupportDefs.h>
|
|
||||||
|
|
||||||
class Referenceable {
|
|
||||||
public:
|
|
||||||
Referenceable();
|
|
||||||
virtual ~Referenceable();
|
|
||||||
|
|
||||||
void Acquire();
|
|
||||||
bool Release();
|
|
||||||
|
|
||||||
private:
|
|
||||||
int32 fReferenceCount;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // REFERENCABLE_H
|
|
||||||
@@ -204,14 +204,14 @@ IconObjectListView::_SetObject(IconObject* object)
|
|||||||
|
|
||||||
if (fObject) {
|
if (fObject) {
|
||||||
fObject->RemoveObserver(this);
|
fObject->RemoveObserver(this);
|
||||||
fObject->Release();
|
fObject->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
fObject = object;
|
fObject = object;
|
||||||
PropertyObject* propertyObject = NULL;
|
PropertyObject* propertyObject = NULL;
|
||||||
|
|
||||||
if (fObject) {
|
if (fObject) {
|
||||||
fObject->Acquire();
|
fObject->AcquireReference();
|
||||||
fObject->AddObserver(this);
|
fObject->AddObserver(this);
|
||||||
propertyObject = fObject->MakePropertyObject();
|
propertyObject = fObject->MakePropertyObject();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,13 +129,13 @@ public:
|
|||||||
|
|
||||||
if (path) {
|
if (path) {
|
||||||
path->RemoveObserver(this);
|
path->RemoveObserver(this);
|
||||||
path->Release();
|
path->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
path = p;
|
path = p;
|
||||||
|
|
||||||
if (path) {
|
if (path) {
|
||||||
path->Acquire();
|
path->AcquireReference();
|
||||||
path->AddObserver(this);
|
path->AddObserver(this);
|
||||||
UpdateText();
|
UpdateText();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,13 +76,13 @@ public:
|
|||||||
|
|
||||||
if (shape) {
|
if (shape) {
|
||||||
shape->RemoveObserver(this);
|
shape->RemoveObserver(this);
|
||||||
shape->Release();
|
shape->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
shape = s;
|
shape = s;
|
||||||
|
|
||||||
if (shape) {
|
if (shape) {
|
||||||
shape->Acquire();
|
shape->AcquireReference();
|
||||||
shape->AddObserver(this);
|
shape->AddObserver(this);
|
||||||
UpdateText();
|
UpdateText();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,13 +130,13 @@ public:
|
|||||||
|
|
||||||
if (style) {
|
if (style) {
|
||||||
style->RemoveObserver(this);
|
style->RemoveObserver(this);
|
||||||
style->Release();
|
style->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
style = s;
|
style = s;
|
||||||
|
|
||||||
if (style) {
|
if (style) {
|
||||||
style->Acquire();
|
style->AcquireReference();
|
||||||
style->AddObserver(this);
|
style->AddObserver(this);
|
||||||
UpdateText();
|
UpdateText();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -253,14 +253,14 @@ StyleView::SetStyle(Style* style)
|
|||||||
|
|
||||||
if (fStyle) {
|
if (fStyle) {
|
||||||
fStyle->RemoveObserver(this);
|
fStyle->RemoveObserver(this);
|
||||||
fStyle->Release();
|
fStyle->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
fStyle = style;
|
fStyle = style;
|
||||||
|
|
||||||
Gradient* gradient = NULL;
|
Gradient* gradient = NULL;
|
||||||
if (fStyle) {
|
if (fStyle) {
|
||||||
fStyle->Acquire();
|
fStyle->AcquireReference();
|
||||||
fStyle->AddObserver(this);
|
fStyle->AddObserver(this);
|
||||||
gradient = fStyle->Gradient();
|
gradient = fStyle->Gradient();
|
||||||
|
|
||||||
@@ -308,13 +308,16 @@ StyleView::_SetGradient(Gradient* gradient, bool forceControlUpdate,
|
|||||||
if (!forceControlUpdate && fGradient == gradient)
|
if (!forceControlUpdate && fGradient == gradient)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (fGradient)
|
Gradient* oldGradient = fGradient;
|
||||||
fGradient->RemoveObserver(this);
|
if (oldGradient != NULL)
|
||||||
|
oldGradient->RemoveObserver(this);
|
||||||
|
|
||||||
fGradient = gradient;
|
fGradient = gradient;
|
||||||
|
|
||||||
if (fGradient)
|
if (fGradient) {
|
||||||
|
fGradient->AcquireReference();
|
||||||
fGradient->AddObserver(this);
|
fGradient->AddObserver(this);
|
||||||
|
}
|
||||||
|
|
||||||
if (fGradient) {
|
if (fGradient) {
|
||||||
fGradientControl->SetEnabled(true);
|
fGradientControl->SetEnabled(true);
|
||||||
@@ -329,6 +332,9 @@ StyleView::_SetGradient(Gradient* gradient, bool forceControlUpdate,
|
|||||||
_MarkType(fGradientType->Menu(), -1);
|
_MarkType(fGradientType->Menu(), -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (oldGradient != NULL)
|
||||||
|
oldGradient->ReleaseReference();
|
||||||
|
|
||||||
if (sendMessage) {
|
if (sendMessage) {
|
||||||
BMessage message(MSG_STYLE_TYPE_CHANGED);
|
BMessage message(MSG_STYLE_TYPE_CHANGED);
|
||||||
message.AddPointer("style", fStyle);
|
message.AddPointer("style", fStyle);
|
||||||
|
|||||||
@@ -68,13 +68,13 @@ class TransformerItem : public SimpleItem,
|
|||||||
|
|
||||||
if (transformer) {
|
if (transformer) {
|
||||||
transformer->RemoveObserver(this);
|
transformer->RemoveObserver(this);
|
||||||
transformer->Release();
|
transformer->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
transformer = t;
|
transformer = t;
|
||||||
|
|
||||||
if (transformer) {
|
if (transformer) {
|
||||||
transformer->Acquire();
|
transformer->AcquireReference();
|
||||||
transformer->AddObserver(this);
|
transformer->AddObserver(this);
|
||||||
UpdateText();
|
UpdateText();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -534,7 +534,7 @@ printf("scale: %f\n", scale);
|
|||||||
if (*style == *earlierStyle) {
|
if (*style == *earlierStyle) {
|
||||||
shape->SetStyle(earlierStyle);
|
shape->SetStyle(earlierStyle);
|
||||||
icon->Styles()->RemoveStyle(style);
|
icon->Styles()->RemoveStyle(style);
|
||||||
style->Release();
|
style->ReleaseReference();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -649,7 +649,7 @@ AddPathsFromVertexSource(Icon* icon, Shape* shape,
|
|||||||
//printf(" path with no points!\n");
|
//printf(" path with no points!\n");
|
||||||
icon->Paths()->RemovePath(path);
|
icon->Paths()->RemovePath(path);
|
||||||
shape->Paths()->RemovePath(path);
|
shape->Paths()->RemovePath(path);
|
||||||
path->Release();
|
path->ReleaseReference();
|
||||||
}
|
}
|
||||||
path = new (nothrow) VectorPath();
|
path = new (nothrow) VectorPath();
|
||||||
if (!path || !icon->Paths()->AddPath(path)) {
|
if (!path || !icon->Paths()->AddPath(path)) {
|
||||||
@@ -745,7 +745,7 @@ AddPathsFromVertexSource(Icon* icon, Shape* shape,
|
|||||||
//printf("path with no points!\n");
|
//printf("path with no points!\n");
|
||||||
icon->Paths()->RemovePath(path);
|
icon->Paths()->RemovePath(path);
|
||||||
shape->Paths()->RemovePath(path);
|
shape->Paths()->RemovePath(path);
|
||||||
path->Release();
|
path->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ PathManipulator::PathManipulator(VectorPath* path)
|
|||||||
fLastNudgeTime(system_time()),
|
fLastNudgeTime(system_time()),
|
||||||
fNudgeCommand(NULL)
|
fNudgeCommand(NULL)
|
||||||
{
|
{
|
||||||
fPath->Acquire();
|
fPath->AcquireReference();
|
||||||
fPath->AddListener(this);
|
fPath->AddListener(this);
|
||||||
fPath->AddObserver(this);
|
fPath->AddObserver(this);
|
||||||
}
|
}
|
||||||
@@ -255,7 +255,7 @@ PathManipulator::~PathManipulator()
|
|||||||
|
|
||||||
fPath->RemoveObserver(this);
|
fPath->RemoveObserver(this);
|
||||||
fPath->RemoveListener(this);
|
fPath->RemoveListener(this);
|
||||||
fPath->Release();
|
fPath->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ AddPathsCommand::AddPathsCommand(PathContainer* container,
|
|||||||
// Add references to paths
|
// Add references to paths
|
||||||
for (int32 i = 0; i < fCount; i++) {
|
for (int32 i = 0; i < fCount; i++) {
|
||||||
if (fPaths[i] != NULL)
|
if (fPaths[i] != NULL)
|
||||||
fPaths[i]->Acquire();
|
fPaths[i]->AcquireReference();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ AddPathsCommand::~AddPathsCommand()
|
|||||||
if (!fPathsAdded && fPaths) {
|
if (!fPathsAdded && fPaths) {
|
||||||
for (int32 i = 0; i < fCount; i++) {
|
for (int32 i = 0; i < fCount; i++) {
|
||||||
if (fPaths[i] != NULL)
|
if (fPaths[i] != NULL)
|
||||||
fPaths[i]->Release();
|
fPaths[i]->ReleaseReference();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete[] fPaths;
|
delete[] fPaths;
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ AddShapesCommand::~AddShapesCommand()
|
|||||||
{
|
{
|
||||||
if (!fShapesAdded && fShapes) {
|
if (!fShapesAdded && fShapes) {
|
||||||
for (int32 i = 0; i < fCount; i++)
|
for (int32 i = 0; i < fCount; i++)
|
||||||
fShapes[i]->Release();
|
fShapes[i]->ReleaseReference();
|
||||||
}
|
}
|
||||||
delete[] fShapes;
|
delete[] fShapes;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ RemovePathsCommand::~RemovePathsCommand()
|
|||||||
if (fPathsRemoved && fInfos) {
|
if (fPathsRemoved && fInfos) {
|
||||||
for (int32 i = 0; i < fCount; i++) {
|
for (int32 i = 0; i < fCount; i++) {
|
||||||
if (fInfos[i].path)
|
if (fInfos[i].path)
|
||||||
fInfos[i].path->Release();
|
fInfos[i].path->ReleaseReference();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete[] fInfos;
|
delete[] fInfos;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ RemoveShapesCommand::~RemoveShapesCommand()
|
|||||||
{
|
{
|
||||||
if (fShapesRemoved && fShapes) {
|
if (fShapesRemoved && fShapes) {
|
||||||
for (int32 i = 0; i < fCount; i++)
|
for (int32 i = 0; i < fCount; i++)
|
||||||
fShapes[i]->Release();
|
fShapes[i]->ReleaseReference();
|
||||||
}
|
}
|
||||||
delete[] fShapes;
|
delete[] fShapes;
|
||||||
delete[] fIndices;
|
delete[] fIndices;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ UnassignPathCommand::UnassignPathCommand(Shape* shape,
|
|||||||
UnassignPathCommand::~UnassignPathCommand()
|
UnassignPathCommand::~UnassignPathCommand()
|
||||||
{
|
{
|
||||||
if (fPathRemoved && fPath)
|
if (fPathRemoved && fPath)
|
||||||
fPath->Release();
|
fPath->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitCheck
|
// InitCheck
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ AddStylesCommand::~AddStylesCommand()
|
|||||||
{
|
{
|
||||||
if (!fStylesAdded && fStyles) {
|
if (!fStylesAdded && fStyles) {
|
||||||
for (int32 i = 0; i < fCount; i++)
|
for (int32 i = 0; i < fCount; i++)
|
||||||
fStyles[i]->Release();
|
fStyles[i]->ReleaseReference();
|
||||||
}
|
}
|
||||||
delete[] fStyles;
|
delete[] fStyles;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,18 +28,18 @@ AssignStyleCommand::AssignStyleCommand(Shape* shape,
|
|||||||
fNewStyle(style)
|
fNewStyle(style)
|
||||||
{
|
{
|
||||||
if (fOldStyle)
|
if (fOldStyle)
|
||||||
fOldStyle->Acquire();
|
fOldStyle->AcquireReference();
|
||||||
if (fNewStyle)
|
if (fNewStyle)
|
||||||
fNewStyle->Acquire();
|
fNewStyle->AcquireReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
AssignStyleCommand::~AssignStyleCommand()
|
AssignStyleCommand::~AssignStyleCommand()
|
||||||
{
|
{
|
||||||
if (fOldStyle)
|
if (fOldStyle)
|
||||||
fOldStyle->Release();
|
fOldStyle->ReleaseReference();
|
||||||
if (fNewStyle)
|
if (fNewStyle)
|
||||||
fNewStyle->Release();
|
fNewStyle->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitCheck
|
// InitCheck
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ RemoveStylesCommand::~RemoveStylesCommand()
|
|||||||
if (fStylesRemoved && fInfos) {
|
if (fStylesRemoved && fInfos) {
|
||||||
for (int32 i = 0; i < fCount; i++) {
|
for (int32 i = 0; i < fCount; i++) {
|
||||||
if (fInfos[i].style)
|
if (fInfos[i].style)
|
||||||
fInfos[i].style->Release();
|
fInfos[i].style->ReleaseReference();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete[] fInfos;
|
delete[] fInfos;
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ SetGradientCommand::SetGradientCommand(Style* style,
|
|||||||
// destructor
|
// destructor
|
||||||
SetGradientCommand::~SetGradientCommand()
|
SetGradientCommand::~SetGradientCommand()
|
||||||
{
|
{
|
||||||
delete fGradient;
|
if (fGradient != NULL)
|
||||||
|
fGradient->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitCheck
|
// InitCheck
|
||||||
@@ -77,9 +78,9 @@ SetGradientCommand::Perform()
|
|||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if (fGradient != NULL) {
|
||||||
// the style didn't have a gradient set
|
// the style didn't have a gradient set
|
||||||
delete fGradient;
|
fGradient->ReleaseReference();
|
||||||
fGradient = NULL;
|
fGradient = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ TransformGradientBox::TransformGradientBox(CanvasView* view, Gradient* gradient,
|
|||||||
fGradient(gradient)
|
fGradient(gradient)
|
||||||
{
|
{
|
||||||
if (fShape) {
|
if (fShape) {
|
||||||
fShape->Acquire();
|
fShape->AcquireReference();
|
||||||
fShape->AddObserver(this);
|
fShape->AddObserver(this);
|
||||||
}
|
}
|
||||||
if (fGradient) {
|
if (fGradient) {
|
||||||
@@ -50,7 +50,7 @@ TransformGradientBox::~TransformGradientBox()
|
|||||||
{
|
{
|
||||||
if (fShape) {
|
if (fShape) {
|
||||||
fShape->RemoveObserver(this);
|
fShape->RemoveObserver(this);
|
||||||
fShape->Release();
|
fShape->ReleaseReference();
|
||||||
}
|
}
|
||||||
if (fGradient)
|
if (fGradient)
|
||||||
fGradient->RemoveObserver(this);
|
fGradient->RemoveObserver(this);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ TransformGradientCommand::TransformGradientCommand(TransformBox* box,
|
|||||||
if (fGradient == NULL)
|
if (fGradient == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// fGradient->Acquire();
|
fGradient->AcquireReference();
|
||||||
|
|
||||||
if (fTransformBox != NULL)
|
if (fTransformBox != NULL)
|
||||||
fTransformBox->AddListener(this);
|
fTransformBox->AddListener(this);
|
||||||
@@ -36,8 +36,8 @@ TransformGradientCommand::TransformGradientCommand(TransformBox* box,
|
|||||||
|
|
||||||
TransformGradientCommand::~TransformGradientCommand()
|
TransformGradientCommand::~TransformGradientCommand()
|
||||||
{
|
{
|
||||||
// if (fGradient != NULL)
|
if (fGradient != NULL)
|
||||||
// fGradient->Release();
|
fGradient->ReleaseReference();
|
||||||
|
|
||||||
if (fTransformBox != NULL)
|
if (fTransformBox != NULL)
|
||||||
fTransformBox->RemoveListener(this);
|
fTransformBox->RemoveListener(this);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ TransformPointsBox::TransformPointsBox(CanvasView* view,
|
|||||||
fCount(count),
|
fCount(count),
|
||||||
fPoints(count > 0 ? new (nothrow) control_point[count] : NULL)
|
fPoints(count > 0 ? new (nothrow) control_point[count] : NULL)
|
||||||
{
|
{
|
||||||
fPath->Acquire();
|
fPath->AcquireReference();
|
||||||
|
|
||||||
BRect bounds(0, 0, -1, -1);
|
BRect bounds(0, 0, -1, -1);
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ TransformPointsBox::~TransformPointsBox()
|
|||||||
{
|
{
|
||||||
delete[] fIndices;
|
delete[] fIndices;
|
||||||
delete[] fPoints;
|
delete[] fPoints;
|
||||||
fPath->Release();
|
fPath->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ TransformShapesBox::TransformShapesBox(CanvasView* view,
|
|||||||
|
|
||||||
for (int32 i = 0; i < fCount; i++) {
|
for (int32 i = 0; i < fCount; i++) {
|
||||||
if (fShapes[i]) {
|
if (fShapes[i]) {
|
||||||
fShapes[i]->Acquire();
|
fShapes[i]->AcquireReference();
|
||||||
fShapes[i]->AddObserver(this);
|
fShapes[i]->AddObserver(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ TransformShapesBox::~TransformShapesBox()
|
|||||||
for (int32 i = 0; i < fCount; i++) {
|
for (int32 i = 0; i < fCount; i++) {
|
||||||
if (fShapes[i]) {
|
if (fShapes[i]) {
|
||||||
fShapes[i]->RemoveObserver(this);
|
fShapes[i]->RemoveObserver(this);
|
||||||
fShapes[i]->Release();
|
fShapes[i]->ReleaseReference();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete[] fShapes;
|
delete[] fShapes;
|
||||||
|
|||||||
@@ -14,9 +14,9 @@
|
|||||||
|
|
||||||
#ifdef ICON_O_MATIC
|
#ifdef ICON_O_MATIC
|
||||||
# include <List.h>
|
# include <List.h>
|
||||||
|
# include <Referenceable.h>
|
||||||
|
|
||||||
# include "Observer.h"
|
# include "Observer.h"
|
||||||
# include "Referenceable.h"
|
|
||||||
#else
|
#else
|
||||||
# include <SupportDefs.h>
|
# include <SupportDefs.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -43,7 +43,7 @@ class IconListener {
|
|||||||
#ifdef ICON_O_MATIC
|
#ifdef ICON_O_MATIC
|
||||||
class Icon : public ShapeContainerListener,
|
class Icon : public ShapeContainerListener,
|
||||||
public Observer,
|
public Observer,
|
||||||
public Referenceable {
|
public BReferenceable {
|
||||||
#else
|
#else
|
||||||
class Icon {
|
class Icon {
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ PathContainer::_MakeEmpty()
|
|||||||
#ifdef ICON_O_MATIC
|
#ifdef ICON_O_MATIC
|
||||||
_NotifyPathRemoved(path);
|
_NotifyPathRemoved(path);
|
||||||
if (fOwnsPaths)
|
if (fOwnsPaths)
|
||||||
path->Release();
|
path->ReleaseReference();
|
||||||
#else
|
#else
|
||||||
if (fOwnsPaths)
|
if (fOwnsPaths)
|
||||||
delete path;
|
delete path;
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ Shape::ObjectChanged(const Observable* object)
|
|||||||
void
|
void
|
||||||
Shape::PathAdded(VectorPath* path, int32 index)
|
Shape::PathAdded(VectorPath* path, int32 index)
|
||||||
{
|
{
|
||||||
path->Acquire();
|
path->AcquireReference();
|
||||||
path->AddListener(this);
|
path->AddListener(this);
|
||||||
_NotifyRerender();
|
_NotifyRerender();
|
||||||
}
|
}
|
||||||
@@ -346,7 +346,7 @@ Shape::PathRemoved(VectorPath* path)
|
|||||||
{
|
{
|
||||||
path->RemoveListener(this);
|
path->RemoveListener(this);
|
||||||
_NotifyRerender();
|
_NotifyRerender();
|
||||||
path->Release();
|
path->ReleaseReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
@@ -417,7 +417,7 @@ Shape::SetStyle(::Style* style)
|
|||||||
#ifdef ICON_O_MATIC
|
#ifdef ICON_O_MATIC
|
||||||
if (fStyle) {
|
if (fStyle) {
|
||||||
fStyle->RemoveObserver(this);
|
fStyle->RemoveObserver(this);
|
||||||
fStyle->Release();
|
fStyle->ReleaseReference();
|
||||||
}
|
}
|
||||||
::Style* oldStyle = fStyle;
|
::Style* oldStyle = fStyle;
|
||||||
#endif
|
#endif
|
||||||
@@ -426,7 +426,7 @@ Shape::SetStyle(::Style* style)
|
|||||||
|
|
||||||
#ifdef ICON_O_MATIC
|
#ifdef ICON_O_MATIC
|
||||||
if (fStyle) {
|
if (fStyle) {
|
||||||
fStyle->Acquire();
|
fStyle->AcquireReference();
|
||||||
fStyle->AddObserver(this);
|
fStyle->AddObserver(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ ShapeContainer::_MakeEmpty()
|
|||||||
Shape* shape = ShapeAtFast(i);
|
Shape* shape = ShapeAtFast(i);
|
||||||
#ifdef ICON_O_MATIC
|
#ifdef ICON_O_MATIC
|
||||||
_NotifyShapeRemoved(shape);
|
_NotifyShapeRemoved(shape);
|
||||||
shape->Release();
|
shape->ReleaseReference();
|
||||||
#else
|
#else
|
||||||
delete shape;
|
delete shape;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ Gradient::Gradient(bool empty)
|
|||||||
#ifdef ICON_O_MATIC
|
#ifdef ICON_O_MATIC
|
||||||
: BArchivable(),
|
: BArchivable(),
|
||||||
Observable(),
|
Observable(),
|
||||||
|
BReferenceable(),
|
||||||
Transformable(),
|
Transformable(),
|
||||||
#else
|
#else
|
||||||
: Transformable(),
|
: Transformable(),
|
||||||
@@ -43,6 +44,7 @@ Gradient::Gradient(BMessage* archive)
|
|||||||
#ifdef ICON_O_MATIC
|
#ifdef ICON_O_MATIC
|
||||||
: BArchivable(archive),
|
: BArchivable(archive),
|
||||||
Observable(),
|
Observable(),
|
||||||
|
BReferenceable(),
|
||||||
Transformable(),
|
Transformable(),
|
||||||
#else
|
#else
|
||||||
: Transformable(),
|
: Transformable(),
|
||||||
@@ -89,6 +91,7 @@ Gradient::Gradient(const Gradient& other)
|
|||||||
#ifdef ICON_O_MATIC
|
#ifdef ICON_O_MATIC
|
||||||
: BArchivable(other),
|
: BArchivable(other),
|
||||||
Observable(),
|
Observable(),
|
||||||
|
BReferenceable(),
|
||||||
Transformable(other),
|
Transformable(other),
|
||||||
#else
|
#else
|
||||||
: Transformable(other),
|
: Transformable(other),
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#ifdef ICON_O_MATIC
|
#ifdef ICON_O_MATIC
|
||||||
# include <Archivable.h>
|
# include <Archivable.h>
|
||||||
|
# include <Referenceable.h>
|
||||||
|
|
||||||
# include "Observable.h"
|
# include "Observable.h"
|
||||||
#endif // ICON_O_MATIC
|
#endif // ICON_O_MATIC
|
||||||
@@ -45,6 +46,7 @@ _BEGIN_ICON_NAMESPACE
|
|||||||
#ifdef ICON_O_MATIC
|
#ifdef ICON_O_MATIC
|
||||||
class Gradient : public BArchivable,
|
class Gradient : public BArchivable,
|
||||||
public Observable,
|
public Observable,
|
||||||
|
public BReferenceable,
|
||||||
public Transformable {
|
public Transformable {
|
||||||
#else
|
#else
|
||||||
class Gradient : public Transformable {
|
class Gradient : public Transformable {
|
||||||
|
|||||||
@@ -223,7 +223,12 @@ Style::SetGradient(const ::Gradient* gradient)
|
|||||||
#endif
|
#endif
|
||||||
delete[] fColors;
|
delete[] fColors;
|
||||||
delete[] fGammaCorrectedColors;
|
delete[] fGammaCorrectedColors;
|
||||||
|
#ifdef ICON_O_MATIC
|
||||||
|
if (fGradient != NULL)
|
||||||
|
fGradient->ReleaseReference();
|
||||||
|
#else
|
||||||
delete fGradient;
|
delete fGradient;
|
||||||
|
#endif
|
||||||
fColors = NULL;
|
fColors = NULL;
|
||||||
fGammaCorrectedColors = NULL;
|
fGammaCorrectedColors = NULL;
|
||||||
fGradient = NULL;
|
fGradient = NULL;
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ StyleContainer::_MakeEmpty()
|
|||||||
Style* style = StyleAtFast(i);
|
Style* style = StyleAtFast(i);
|
||||||
#ifdef ICON_O_MATIC
|
#ifdef ICON_O_MATIC
|
||||||
_NotifyStyleRemoved(style);
|
_NotifyStyleRemoved(style);
|
||||||
style->Release();
|
style->ReleaseReference();
|
||||||
#else
|
#else
|
||||||
delete style;
|
delete style;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user