Skip to content

Commit

Permalink
Icon-O-Matic: Make GradientTransformable a BReferenceable
Browse files Browse the repository at this point in the history
 * Switch to using support/Referenceable.h instead of using an older copy
   of this code.
 * Make GradientTransformable a BReferenceable and fix #12033.
  • Loading branch information
stippi committed May 9, 2015
1 parent 8f18237 commit 0cbb6c1
Show file tree
Hide file tree
Showing 36 changed files with 79 additions and 167 deletions.
1 change: 0 additions & 1 deletion src/apps/icon-o-matic/Jamfile
Expand Up @@ -198,7 +198,6 @@ Application Icon-O-Matic :
Selection.cpp

# generic/support
Referenceable.cpp
RWLocker.cpp
support.cpp
support_ui.cpp
Expand Down
4 changes: 2 additions & 2 deletions src/apps/icon-o-matic/MainWindow.cpp
Expand Up @@ -839,7 +839,7 @@ MainWindow::SetIcon(Icon* icon)
fIcon = icon;

if (fIcon != NULL)
fIcon->Acquire();
fIcon->AcquireReference();
else
MakeEmpty();

Expand All @@ -865,7 +865,7 @@ MainWindow::SetIcon(Icon* icon)

// keep this last
if (oldIcon != NULL)
oldIcon->Release();
oldIcon->ReleaseReference();
}


Expand Down
4 changes: 2 additions & 2 deletions src/apps/icon-o-matic/document/Document.cpp
Expand Up @@ -46,7 +46,7 @@ Document::~Document()
{
delete fCommandStack;
delete fSelection;
fIcon->Release();
fIcon->ReleaseReference();
delete fNativeSaver;
delete fExportSaver;
}
Expand Down Expand Up @@ -92,7 +92,7 @@ Document::SetIcon(_ICON_NAMESPACE Icon* icon)
if (fIcon == icon)
return;

fIcon->Release();
fIcon->ReleaseReference();

fIcon = icon;

Expand Down
6 changes: 3 additions & 3 deletions src/apps/icon-o-matic/document/IconObject.cpp
Expand Up @@ -17,7 +17,7 @@
// constructor
IconObject::IconObject(const char* name)
: Observable(),
Referenceable(),
BReferenceable(),
Selectable(),

fName(name)
Expand All @@ -27,7 +27,7 @@ IconObject::IconObject(const char* name)
// copy constructor
IconObject::IconObject(const IconObject& other)
: Observable(),
Referenceable(),
BReferenceable(),
Selectable(),

fName(other.fName)
Expand All @@ -37,7 +37,7 @@ IconObject::IconObject(const IconObject& other)
// archive constructor
IconObject::IconObject(BMessage* archive)
: Observable(),
Referenceable(),
BReferenceable(),
Selectable(),

fName()
Expand Down
4 changes: 2 additions & 2 deletions src/apps/icon-o-matic/document/IconObject.h
Expand Up @@ -9,17 +9,17 @@
#ifndef ICON_OBJECT_H
#define ICON_OBJECT_H

#include <Referenceable.h>
#include <String.h>

#include "Observable.h"
#include "Referenceable.h"
#include "Selectable.h"

class BMessage;
class PropertyObject;

class IconObject : public Observable,
public Referenceable,
public BReferenceable,
public Selectable {
public:
IconObject(const char* name);
Expand Down
77 changes: 0 additions & 77 deletions src/apps/icon-o-matic/generic/support/Referenceable.cpp

This file was deleted.

27 changes: 0 additions & 27 deletions src/apps/icon-o-matic/generic/support/Referenceable.h

This file was deleted.

4 changes: 2 additions & 2 deletions src/apps/icon-o-matic/gui/IconObjectListView.cpp
Expand Up @@ -204,14 +204,14 @@ IconObjectListView::_SetObject(IconObject* object)

if (fObject) {
fObject->RemoveObserver(this);
fObject->Release();
fObject->ReleaseReference();
}

fObject = object;
PropertyObject* propertyObject = NULL;

if (fObject) {
fObject->Acquire();
fObject->AcquireReference();
fObject->AddObserver(this);
propertyObject = fObject->MakePropertyObject();
}
Expand Down
4 changes: 2 additions & 2 deletions src/apps/icon-o-matic/gui/PathListView.cpp
Expand Up @@ -129,13 +129,13 @@ class PathListItem : public SimpleItem, public Observer {

if (path) {
path->RemoveObserver(this);
path->Release();
path->ReleaseReference();
}

path = p;

if (path) {
path->Acquire();
path->AcquireReference();
path->AddObserver(this);
UpdateText();
}
Expand Down
4 changes: 2 additions & 2 deletions src/apps/icon-o-matic/gui/ShapeListView.cpp
Expand Up @@ -76,13 +76,13 @@ class ShapeListItem : public SimpleItem, public Observer {

if (shape) {
shape->RemoveObserver(this);
shape->Release();
shape->ReleaseReference();
}

shape = s;

if (shape) {
shape->Acquire();
shape->AcquireReference();
shape->AddObserver(this);
UpdateText();
}
Expand Down
4 changes: 2 additions & 2 deletions src/apps/icon-o-matic/gui/StyleListView.cpp
Expand Up @@ -130,13 +130,13 @@ class StyleListItem : public SimpleItem,

if (style) {
style->RemoveObserver(this);
style->Release();
style->ReleaseReference();
}

style = s;

if (style) {
style->Acquire();
style->AcquireReference();
style->AddObserver(this);
UpdateText();
}
Expand Down
16 changes: 11 additions & 5 deletions src/apps/icon-o-matic/gui/StyleView.cpp
Expand Up @@ -253,14 +253,14 @@ StyleView::SetStyle(Style* style)

if (fStyle) {
fStyle->RemoveObserver(this);
fStyle->Release();
fStyle->ReleaseReference();
}

fStyle = style;

Gradient* gradient = NULL;
if (fStyle) {
fStyle->Acquire();
fStyle->AcquireReference();
fStyle->AddObserver(this);
gradient = fStyle->Gradient();

Expand Down Expand Up @@ -308,13 +308,16 @@ StyleView::_SetGradient(Gradient* gradient, bool forceControlUpdate,
if (!forceControlUpdate && fGradient == gradient)
return;

if (fGradient)
fGradient->RemoveObserver(this);
Gradient* oldGradient = fGradient;
if (oldGradient != NULL)
oldGradient->RemoveObserver(this);

fGradient = gradient;

if (fGradient)
if (fGradient) {
fGradient->AcquireReference();
fGradient->AddObserver(this);
}

if (fGradient) {
fGradientControl->SetEnabled(true);
Expand All @@ -329,6 +332,9 @@ StyleView::_SetGradient(Gradient* gradient, bool forceControlUpdate,
_MarkType(fGradientType->Menu(), -1);
}

if (oldGradient != NULL)
oldGradient->ReleaseReference();

if (sendMessage) {
BMessage message(MSG_STYLE_TYPE_CHANGED);
message.AddPointer("style", fStyle);
Expand Down
4 changes: 2 additions & 2 deletions src/apps/icon-o-matic/gui/TransformerListView.cpp
Expand Up @@ -68,13 +68,13 @@ class TransformerItem : public SimpleItem,

if (transformer) {
transformer->RemoveObserver(this);
transformer->Release();
transformer->ReleaseReference();
}

transformer = t;

if (transformer) {
transformer->Acquire();
transformer->AcquireReference();
transformer->AddObserver(this);
UpdateText();
}
Expand Down
6 changes: 3 additions & 3 deletions src/apps/icon-o-matic/import_export/svg/DocumentBuilder.cpp
Expand Up @@ -534,7 +534,7 @@ printf("scale: %f\n", scale);
if (*style == *earlierStyle) {
shape->SetStyle(earlierStyle);
icon->Styles()->RemoveStyle(style);
style->Release();
style->ReleaseReference();
break;
}
}
Expand Down Expand Up @@ -649,7 +649,7 @@ AddPathsFromVertexSource(Icon* icon, Shape* shape,
//printf(" path with no points!\n");
icon->Paths()->RemovePath(path);
shape->Paths()->RemovePath(path);
path->Release();
path->ReleaseReference();
}
path = new (nothrow) VectorPath();
if (!path || !icon->Paths()->AddPath(path)) {
Expand Down Expand Up @@ -745,7 +745,7 @@ AddPathsFromVertexSource(Icon* icon, Shape* shape,
//printf("path with no points!\n");
icon->Paths()->RemovePath(path);
shape->Paths()->RemovePath(path);
path->Release();
path->ReleaseReference();
}

return B_OK;
Expand Down
4 changes: 2 additions & 2 deletions src/apps/icon-o-matic/shape/PathManipulator.cpp
Expand Up @@ -235,7 +235,7 @@ PathManipulator::PathManipulator(VectorPath* path)
fLastNudgeTime(system_time()),
fNudgeCommand(NULL)
{
fPath->Acquire();
fPath->AcquireReference();
fPath->AddListener(this);
fPath->AddObserver(this);
}
Expand All @@ -255,7 +255,7 @@ PathManipulator::~PathManipulator()

fPath->RemoveObserver(this);
fPath->RemoveListener(this);
fPath->Release();
fPath->ReleaseReference();
}


Expand Down
4 changes: 2 additions & 2 deletions src/apps/icon-o-matic/shape/commands/AddPathsCommand.cpp
Expand Up @@ -48,7 +48,7 @@ AddPathsCommand::AddPathsCommand(PathContainer* container,
// Add references to paths
for (int32 i = 0; i < fCount; i++) {
if (fPaths[i] != NULL)
fPaths[i]->Acquire();
fPaths[i]->AcquireReference();
}
}
}
Expand All @@ -59,7 +59,7 @@ AddPathsCommand::~AddPathsCommand()
if (!fPathsAdded && fPaths) {
for (int32 i = 0; i < fCount; i++) {
if (fPaths[i] != NULL)
fPaths[i]->Release();
fPaths[i]->ReleaseReference();
}
}
delete[] fPaths;
Expand Down
2 changes: 1 addition & 1 deletion src/apps/icon-o-matic/shape/commands/AddShapesCommand.cpp
Expand Up @@ -52,7 +52,7 @@ AddShapesCommand::~AddShapesCommand()
{
if (!fShapesAdded && fShapes) {
for (int32 i = 0; i < fCount; i++)
fShapes[i]->Release();
fShapes[i]->ReleaseReference();
}
delete[] fShapes;
}
Expand Down

0 comments on commit 0cbb6c1

Please sign in to comment.