many improvements and bug fixes:

* added VertexSource::SetLast() used by PathSource
  to call agg::path_storage::close_polygon(). The
  StrokeTransformer avoids this of course. Affine
  and PerspectiveTransformer forward this to their source.
* TransformerItems watch their transformers for notifications
* made VectorPath an IconObject
* VectorPath no longer uses close_polygon() when converting
  to agg::path_storage to allow open strokes
* added IconObjectListView which inherits from
  PropertyListView and allows to edit the properties of the
  last selected object from one of the other list views
* fixed a couple bugs when adopting properties:
  - removed the Property* in the PropertyEditorView base
  class, and made GetProperty() virtual, as the base class
  pointer was not maintained and superfluous
  - delete the old PropertyObject in PropertyListView::SetTo
  when adopting the properties instead of the object whose
  properties were adopted...
* added SetPropertiesCommand to allow Undo/Redo on changes
  of properties
* Style is also an IconObject now (TODO: yet another list view
  for styles... :-)
* Style watches its Gradient for notifications and builds and
  caches the color array now
* removed generating the color array for each scanline in
  IconRenderer, so the performance is improved a lot
* Shape watches its Transformers for notifications in order
  to trigger rerendering
* StrokeTransformers adds a bunch of properties like stroke
  width, cap and join mode
* StateView keyboard filter no longer steals keydown events
  from BTextViews
* PropertyItemViews resize with the parent
* refined the interface for PropertyListView for easier
  tracking of the changed properties in derived classes
* added HasPendingNotifications() to Observable, so that
  IconObjects can track changes more easily when adopting
  a PropertyObject
* the name is now part of any IconObject


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18045 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2006-07-05 23:51:34 +00:00
parent b92418a82c
commit e2a31283dd
55 changed files with 787 additions and 229 deletions
+2
View File
@@ -43,6 +43,7 @@ Application Icon-O-Matic :
Icon.cpp
IconObject.cpp
IconRenderer.cpp
SetPropertiesCommand.cpp
# generic/command
Command.cpp
CommandStack.cpp
@@ -107,6 +108,7 @@ Application Icon-O-Matic :
support.cpp
support_ui.cpp
# gui
IconObjectListView.cpp
PathListView.cpp
ShapeListView.cpp
SwatchGroup.cpp
+22 -3
View File
@@ -19,9 +19,11 @@
#include "Document.h"
#include "CanvasView.h"
#include "CommandStack.h"
#include "IconObjectListView.h"
#include "IconEditorApp.h"
#include "IconView.h"
#include "PathListView.h"
#include "ScrollView.h"
#include "ShapeListView.h"
#include "SwatchGroup.h"
#include "TransformerFactory.h"
@@ -54,7 +56,7 @@ enum {
// constructor
MainWindow::MainWindow(IconEditorApp* app, Document* document)
: BWindow(BRect(50, 50, 781, 781), "Icon-O-Matic",
: BWindow(BRect(50, 50, 891, 781), "Icon-O-Matic",
B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS),
fApp(app),
@@ -205,6 +207,11 @@ MainWindow::_Init()
fShapeListView->SetCommandStack(fDocument->CommandStack());
fShapeListView->SetSelection(fDocument->Selection());
fTransformerListView->SetSelection(fDocument->Selection());
fPropertyListView->SetCommandStack(fDocument->CommandStack());
fPropertyListView->SetSelection(fDocument->Selection());
fIconPreview16->SetIcon(fDocument->Icon());
fIconPreview32->SetIcon(fDocument->Icon());
// fIconPreview48->SetIcon(fDocument->Icon());
@@ -332,6 +339,9 @@ MainWindow::_CreateGUI(BRect bounds)
fTransformerListView = new TransformerListView(bounds,
"transformer list view");
// property list view
fPropertyListView = new IconObjectListView();
bg->AddChild(fSwatchGroup);
bg->AddChild(fIconPreview16);
@@ -346,15 +356,24 @@ MainWindow::_CreateGUI(BRect bounds)
B_NO_BORDER));
bg->AddChild(new BScrollView("shape list scroll view",
fShapeListView,
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
B_FOLLOW_LEFT | B_FOLLOW_TOP,
0, false, true,
B_NO_BORDER));
bg->AddChild(new BScrollView("transformer list scroll view",
fTransformerListView,
B_FOLLOW_RIGHT | B_FOLLOW_TOP,
B_FOLLOW_LEFT | B_FOLLOW_TOP,
0, false, true,
B_NO_BORDER));
// scroll view around property list view
bounds.OffsetBy(bounds.Width() + 6 + B_V_SCROLL_BAR_WIDTH, 0);
bg->AddChild(new ScrollView(fPropertyListView,
SCROLL_VERTICAL | SCROLL_NO_FRAME,
bounds, "property scroll view",
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
B_WILL_DRAW | B_FRAME_EVENTS));
bg->AddChild(fCanvasView);
return bg;
+2
View File
@@ -17,6 +17,7 @@ class BMenuBar;
class BMenuItem;
class CanvasView;
class Document;
class IconObjectListView;
class IconEditorApp;
class IconView;
class PathListView;
@@ -62,6 +63,7 @@ class MainWindow : public BWindow,
PathListView* fPathListView;
ShapeListView* fShapeListView;
TransformerListView* fTransformerListView;
IconObjectListView* fPropertyListView;
// TODO: for testing only...
MultipleManipulatorState* fState;
+41 -5
View File
@@ -8,11 +8,27 @@
#include "IconObject.h"
#include "CommonPropertyIDs.h"
#include "Property.h"
#include "PropertyObject.h"
// constructor
IconObject::IconObject()
IconObject::IconObject(const char* name)
: Observable(),
Referenceable(),
Selectable()
Selectable(),
fName(name)
{
}
// copy constructor
IconObject::IconObject(const IconObject& other)
: Observable(),
Referenceable(),
Selectable(),
fName(other.fName)
{
}
@@ -26,7 +42,7 @@ void
IconObject::SelectedChanged()
{
// simply pass on the event for now
Notify();
// Notify();
}
// #pragma mark -
@@ -35,13 +51,33 @@ IconObject::SelectedChanged()
PropertyObject*
IconObject::MakePropertyObject() const
{
return NULL;
PropertyObject* object = new PropertyObject();
object->AddProperty(new StringProperty(PROPERTY_NAME, fName.String()));
return object;
}
// SetToPropertyObject
bool
IconObject::SetToPropertyObject(const PropertyObject* object)
{
return false;
AutoNotificationSuspender _(this);
BString name;
if (object->GetValue(PROPERTY_NAME, name))
SetName(name.String());
return HasPendingNotifications();
}
// SetName
void
IconObject::SetName(const char* name)
{
if (fName == name)
return;
fName = name;
Notify();
}
+9 -1
View File
@@ -9,6 +9,8 @@
#ifndef ICON_OBJECT_H
#define ICON_OBJECT_H
#include <String.h>
#include "Observable.h"
#include "Referenceable.h"
#include "Selectable.h"
@@ -19,7 +21,8 @@ class IconObject : public Observable,
public Referenceable,
public Selectable {
public:
IconObject();
IconObject(const char* name);
IconObject(const IconObject& other);
virtual ~IconObject();
// Selectable interface
@@ -30,7 +33,12 @@ class IconObject : public Observable,
virtual bool SetToPropertyObject(
const PropertyObject* object);
void SetName(const char* name);
const char* Name() const
{ return fName.String(); }
private:
BString fName;
};
#endif // ICON_OBJECT_H
@@ -0,0 +1,89 @@
/*
* Copyright 2006, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* Stephan Aßmus <[email protected]>
*/
#include "SetPropertiesCommand.h"
#include <stdio.h>
#include "CommonPropertyIDs.h"
#include "IconObject.h"
#include "Property.h"
#include "PropertyObject.h"
// constructor
SetPropertiesCommand::SetPropertiesCommand(IconObject** objects,
int32 objectCount,
PropertyObject* previous,
PropertyObject* current)
: Command(),
fObjects(objects),
fObjectCount(objectCount),
fOldProperties(previous),
fNewProperties(current)
{
}
// destructor
SetPropertiesCommand::~SetPropertiesCommand()
{
delete[] fObjects;
delete fOldProperties;
delete fNewProperties;
}
// InitCheck
status_t
SetPropertiesCommand::InitCheck()
{
return fObjects && fOldProperties && fNewProperties
&& fObjectCount > 0 && fOldProperties->CountProperties() > 0
&& fOldProperties->ContainsSameProperties(*fNewProperties) ?
B_OK : B_NO_INIT;
}
// Perform
status_t
SetPropertiesCommand::Perform()
{
for (int32 i = 0; i < fObjectCount; i++) {
if (fObjects[i])
fObjects[i]->SetToPropertyObject(fNewProperties);
}
return B_OK;
}
// Undo
status_t
SetPropertiesCommand::Undo()
{
for (int32 i = 0; i < fObjectCount; i++) {
if (fObjects[i])
fObjects[i]->SetToPropertyObject(fOldProperties);
}
return B_OK;
}
// GetName
void
SetPropertiesCommand::GetName(BString& name)
{
if (fOldProperties->CountProperties() > 1) {
if (fObjectCount > 1)
name << "Multi Paste Properties";
else
name << "Paste Properties";
} else {
BString property = name_for_id(
fOldProperties->PropertyAt(0)->Identifier());
if (fObjectCount > 1)
name << "Multi Set " << property;
else
name << "Set " << property;
}
}
@@ -0,0 +1,40 @@
/*
* Copyright 2006, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* Stephan Aßmus <[email protected]>
*/
#ifndef SET_PROPERTIES_COMMAND_H
#define SET_PROPERTIES_COMMAND_H
#include "Command.h"
class IconObject;
class PropertyObject;
class SetPropertiesCommand : public Command {
public:
SetPropertiesCommand(IconObject** objects,
int32 objectCount,
PropertyObject* previous,
PropertyObject* current);
virtual ~SetPropertiesCommand();
virtual status_t InitCheck();
virtual status_t Perform();
virtual status_t Undo();
virtual void GetName(BString& name);
private:
IconObject** fObjects;
int32 fObjectCount;
PropertyObject* fOldProperties;
PropertyObject* fNewProperties;
};
#endif // SET_PROPERTIES_COMMAND_H
@@ -10,6 +10,7 @@
#include <Message.h>
#include <MessageFilter.h>
#include <TextView.h>
#include <Window.h>
#include "Command.h"
@@ -32,6 +33,8 @@ class EventFilter : public BMessageFilter {
filter_result result = B_DISPATCH_MESSAGE;
switch (message->what) {
case B_KEY_DOWN: {
if (dynamic_cast<BTextView*>(*target))
break;
uint32 key;
uint32 modifiers;
if (message->FindInt32("raw_char", (int32*)&key) >= B_OK
@@ -41,6 +44,8 @@ class EventFilter : public BMessageFilter {
break;
}
case B_KEY_UP: {
if (dynamic_cast<BTextView*>(*target))
break;
uint32 key;
uint32 modifiers;
if (message->FindInt32("raw_char", (int32*)&key) >= B_OK
@@ -25,6 +25,8 @@ class Observable {
void SuspendNotifications(bool suspend);
bool HasPendingNotifications() const
{ return fPendingNotifications; }
private:
BList fObservers;
@@ -8,6 +8,10 @@
#include "CommonPropertyIDs.h"
#include <stdio.h>
#include <debugger.h>
// name_for_id
const char*
name_for_id(int32 id)
@@ -42,6 +46,10 @@ name_for_id(int32 id)
name = "Miter Limit";
break;
case PROPERTY_CLOSED:
name = "Closed";
break;
default:
name = "<unkown property>";
break;
@@ -23,6 +23,8 @@ enum {
PROPERTY_CAP_MODE = 'cpmd',
PROPERTY_JOIN_MODE = 'jnmd',
PROPERTY_MITER_LIMIT = 'mtlm',
PROPERTY_CLOSED = 'clsd',
};
@@ -14,12 +14,11 @@
#include "PropertyItemView.h"
// constructor
PropertyEditorView::PropertyEditorView(Property* property)
PropertyEditorView::PropertyEditorView()
: BView(BRect(0.0, 0.0, 10.0, 10.0), "property item",
B_FOLLOW_LEFT | B_FOLLOW_TOP,
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE),
fParent(NULL),
fProperty(property),
fSelected(false)
{
}
@@ -107,4 +106,3 @@ PropertyEditorView::ValueChanged()
fParent->UpdateObject();
}
@@ -16,7 +16,7 @@ class PropertyItemView;
class PropertyEditorView : public BView {
public:
PropertyEditorView(Property* property);
PropertyEditorView();
virtual ~PropertyEditorView();
// BView
@@ -30,9 +30,6 @@ class PropertyEditorView : public BView {
// PropertyEditorView
virtual float PreferredHeight() const;
Property* GetProperty() const
{ return fProperty; }
void SetSelected(bool selected);
bool IsSelected() const
{ return fSelected; }
@@ -47,12 +44,12 @@ class PropertyEditorView : public BView {
virtual void ValueChanged();
virtual bool AdoptProperty(Property* property) = 0;
virtual Property* GetProperty() const = 0;
protected:
PropertyItemView* fParent;
private:
Property* fProperty;
bool fSelected;
};
@@ -25,7 +25,7 @@
// constructor
PropertyItemView::PropertyItemView(Property* property)
: BView(BRect(0.0, 0.0, 10.0, 10.0), "property item",
B_FOLLOW_LEFT | B_FOLLOW_TOP,
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
B_NAVIGABLE | B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE),
fParent(NULL),
fEditorView(/*factory->*/EditorFor(property)),
@@ -85,6 +85,7 @@ PropertyListView::PropertyListView()
fPropertyM(NULL),
fPropertyObject(NULL),
fSavedProperties(new PropertyObject()),
fLastClickedItem(NULL),
fSuspendUpdates(false),
@@ -103,6 +104,7 @@ PropertyListView::~PropertyListView()
delete fClipboard;
delete fPropertyObject;
delete fSavedProperties;
delete fMouseWheelFilter;
delete fTabFilter;
@@ -346,6 +348,7 @@ PropertyListView::SetTo(PropertyObject* object)
if (fPropertyObject && object &&
fPropertyObject->ContainsSameProperties(*object)) {
// iterate over view items and update their value views
bool error = false;
for (int32 i = 0; PropertyItemView* item = _ItemAt(i); i++) {
Property* property = object->PropertyAt(i);
if (!item->AdoptProperty(property)) {
@@ -354,13 +357,24 @@ PropertyListView::SetTo(PropertyObject* object)
// there is no editor view at this item
fprintf(stderr, "PropertyListView::_SetTo() - "
"property mismatch at %ld\n", i);
error = true;
break;
}
if (property)
item->SetEnabled(property->IsEditable());
}
// we didn't take on ownership, but kept our old object
delete object;
// we didn't need to make empty, but transfer ownership
// of the object
if (!error) {
// if the "adopt" process went only halfway,
// some properties of the original object
// are still referenced, so we can only
// delete the original object if the process
// was successful and leak Properties otherwise,
// but this case is only theoretical anyways...
delete fPropertyObject;
}
fPropertyObject = object;
} else {
// remember scroll pos, selection and focused item
BPoint scrollOffset = ScrollOffset();
@@ -406,14 +420,17 @@ PropertyListView::SetTo(PropertyObject* object)
SetDataRect(_ItemsRect());
}
_UpdateSavedProperties();
_CheckMenuStatus();
}
// UpdateObject
// PropertyChanged
void
PropertyListView::UpdateObject(uint32 propertyID)
PropertyListView::PropertyChanged(const Property* previous,
const Property* current)
{
printf("PropertyListView::UpdateObject(%s)\n", name_for_id(propertyID));
printf("PropertyListView::PropertyChanged(%s)\n",
name_for_id(current->Identifier()));
}
// PasteProperties
@@ -442,6 +459,20 @@ PropertyListView::IsEditingMultipleObjects()
// #pragma mark -
// UpdateObject
void
PropertyListView::UpdateObject(uint32 propertyID)
{
Property* previous = fSavedProperties->FindProperty(propertyID);
Property* current = fPropertyObject->FindProperty(propertyID);
if (previous && current) {
// call hook function
PropertyChanged(previous, current);
// update saved property
previous->SetValue(current);
}
}
// ScrollOffsetChanged
void
PropertyListView::ScrollOffsetChanged(BPoint oldOffset, BPoint newOffset)
@@ -508,13 +539,28 @@ PropertyListView::DoubleClicked(PropertyItemView* item)
{
if (fLastClickedItem == item) {
printf("implement PropertyListView::DoubleClicked()\n");
// ...->EditObject(item->GetProperty());
}
fLastClickedItem = NULL;
}
// #pragma mark -
// _UpdateSavedProperties
void
PropertyListView::_UpdateSavedProperties()
{
fSavedProperties->DeleteProperties();
if (!fPropertyObject)
return;
int32 count = fPropertyObject->CountProperties();
for (int32 i = 0; i < count; i++) {
const Property* p = fPropertyObject->PropertyAtFast(i);
fSavedProperties->AddProperty(p->Clone());
}
}
// _AddItem
bool
PropertyListView::_AddItem(PropertyItemView* item)
@@ -52,7 +52,8 @@ class PropertyListView : public BView,
// PropertyListView
void SetTo(PropertyObject* object);
// takes ownership of the object
virtual void UpdateObject(uint32 propertyID);
virtual void PropertyChanged(const Property* previous,
const Property* current);
// implement to know when a property changed
virtual void PasteProperties(const PropertyObject* object);
// implement to know when a property changed
@@ -63,6 +64,8 @@ class PropertyListView : public BView,
void UpdateStrings();
// interface for Property framework
void UpdateObject(uint32 propertyID);
bool TabFocus(bool shift);
void Select(PropertyItemView* item);
@@ -72,6 +75,8 @@ class PropertyListView : public BView,
void DoubleClicked(PropertyItemView* item);
private:
void _UpdateSavedProperties();
bool _AddItem(PropertyItemView* item);
PropertyItemView* _RemoveItem(int32 index);
PropertyItemView* _ItemAt(int32 index) const;
@@ -96,6 +101,7 @@ class PropertyListView : public BView,
BMenuItem* fPasteMI;
PropertyObject* fPropertyObject;
PropertyObject* fSavedProperties;
PropertyItemView* fLastClickedItem;
@@ -10,13 +10,11 @@
#include <stdio.h>
#include "Property.h"
#include "ui_defines.h"
// constructor
BoolValueView::BoolValueView(BoolProperty* property)
: PropertyEditorView(property),
: PropertyEditorView(),
fProperty(property),
fCheckBoxRect(0.0, 0.0, -1.0, -1.0),
fEnabled(true)
@@ -9,10 +9,9 @@
#ifndef BOOL_VALUE_VIEW_H
#define BOOL_VALUE_VIEW_H
#include "Property.h"
#include "PropertyEditorView.h"
class BoolProperty;
class BoolValueView : public PropertyEditorView {
public:
BoolValueView(BoolProperty* property);
@@ -31,6 +30,8 @@ class BoolValueView : public PropertyEditorView {
virtual void SetEnabled(bool enabled);
virtual bool AdoptProperty(Property* property);
virtual Property* GetProperty() const
{ return fProperty; }
private:
void _ToggleValue();
@@ -16,7 +16,6 @@
#include "support_ui.h"
#include "ColorProperty.h"
#include "PropertyItemView.h"
#include "SwatchValueView.h"
@@ -26,7 +25,7 @@ enum {
// constructor
ColorValueView::ColorValueView(ColorProperty* property)
: PropertyEditorView(property),
: PropertyEditorView(),
fProperty(property)
{
fSwatchView = new SwatchValueView("swatch property view",
@@ -9,9 +9,9 @@
#ifndef COLOR_VALUE_VIEW_H
#define COLOR_VALUE_VIEW_H
#include "ColorProperty.h"
#include "PropertyEditorView.h"
class ColorProperty;
class SwatchValueView;
class ColorValueView : public PropertyEditorView {
@@ -32,6 +32,8 @@ class ColorValueView : public PropertyEditorView {
virtual bool IsFocused() const;
virtual bool AdoptProperty(Property* property);
virtual Property* GetProperty() const
{ return fProperty; }
protected:
ColorProperty* fProperty;
@@ -10,12 +10,11 @@
#include <stdio.h>
#include "Property.h"
#include "NummericalTextView.h"
// constructor
FloatValueView::FloatValueView(FloatProperty* property)
: TextInputValueView(property),
: TextInputValueView(),
fProperty(property)
{
BRect b = Bounds();
@@ -9,9 +9,9 @@
#ifndef FLOAT_VALUE_VIEW_H
#define FLOAT_VALUE_VIEW_H
#include "Property.h"
#include "TextInputValueView.h"
class FloatProperty;
class NummericalTextView;
class FloatValueView : public TextInputValueView {
@@ -26,6 +26,8 @@ class FloatValueView : public TextInputValueView {
virtual void ValueChanged();
virtual bool AdoptProperty(Property* property);
virtual Property* GetProperty() const
{ return fProperty; }
private:
FloatProperty* fProperty;
@@ -6,20 +6,19 @@
* Stephan Aßmus <superstippi@gmx.de>
*/
#include "IconValueView.h"
#include <stdio.h>
#include <string.h>
#include <Bitmap.h>
#include <Region.h>
#include "IconProperty.h"
#include "PropertyItemView.h"
#include "IconValueView.h"
// constructor
IconValueView::IconValueView(IconProperty* property)
: PropertyEditorView(property),
: PropertyEditorView(),
fProperty(property),
fIcon(NULL)
{
@@ -9,9 +9,9 @@
#ifndef ICON_VALUE_VIEW_H
#define ICON_VALUE_VIEW_H
#include "IconProperty.h"
#include "PropertyEditorView.h"
class IconProperty;
class NummericalTextView;
class IconValueView : public PropertyEditorView {
@@ -26,6 +26,8 @@ class IconValueView : public PropertyEditorView {
virtual void SetEnabled(bool enabled);
virtual bool AdoptProperty(Property* property);
virtual Property* GetProperty() const
{ return fProperty; }
// IconValueView
status_t SetIcon(const unsigned char* bitsFromQuickRes,
@@ -10,12 +10,11 @@
#include <stdio.h>
#include "Int64Property.h"
#include "NummericalTextView.h"
// constructor
Int64ValueView::Int64ValueView(Int64Property* property)
: TextInputValueView(property),
: TextInputValueView(),
fProperty(property)
{
BRect b = Bounds();
@@ -9,9 +9,9 @@
#ifndef INT64_VALUE_VIEW_H
#define INT64_VALUE_VIEW_H
#include "Int64Property.h"
#include "TextInputValueView.h"
class Int64Property;
class NummericalTextView;
class Int64ValueView : public TextInputValueView {
@@ -26,6 +26,8 @@ class Int64ValueView : public TextInputValueView {
virtual void ValueChanged();
virtual bool AdoptProperty(Property* property);
virtual Property* GetProperty() const
{ return fProperty; }
private:
Int64Property* fProperty;
@@ -10,12 +10,11 @@
#include <stdio.h>
#include "Property.h"
#include "NummericalTextView.h"
// constructor
IntValueView::IntValueView(IntProperty* property)
: TextInputValueView(property),
: TextInputValueView(),
fProperty(property)
{
BRect b = Bounds();
@@ -9,9 +9,9 @@
#ifndef INT_VALUE_VIEW_H
#define INT_VALUE_VIEW_H
#include "Property.h"
#include "TextInputValueView.h"
class IntProperty;
class NummericalTextView;
class IntValueView : public TextInputValueView {
@@ -26,6 +26,8 @@ class IntValueView : public TextInputValueView {
virtual void ValueChanged();
virtual bool AdoptProperty(Property* property);
virtual Property* GetProperty() const
{ return fProperty; }
private:
IntProperty* fProperty;
@@ -6,6 +6,8 @@
* Stephan Aßmus <superstippi@gmx.de>
*/
#include "OptionValueView.h"
#include <stdio.h>
#include <Font.h>
@@ -14,17 +16,13 @@
#include <PopUpMenu.h>
#include <Region.h>
#include "OptionProperty.h"
#include "OptionValueView.h"
enum {
MSG_OPTION_CHANGED = 'opch',
};
// constructor
OptionValueView::OptionValueView(OptionProperty* property)
: PropertyEditorView(property),
: PropertyEditorView(),
fProperty(property),
fCurrentOption(""),
fEnabled(true)
@@ -11,10 +11,9 @@
#include <String.h>
#include "OptionProperty.h"
#include "PropertyEditorView.h"
class OptionProperty;
class OptionValueView : public PropertyEditorView {
public:
OptionValueView(OptionProperty* property);
@@ -35,6 +34,8 @@ class OptionValueView : public PropertyEditorView {
virtual void ValueChanged();
virtual bool AdoptProperty(Property* property);
virtual Property* GetProperty() const
{ return fProperty; }
private:
OptionProperty* fProperty;
@@ -11,12 +11,11 @@
#include <stdio.h>
#include <string.h>
#include "Property.h"
#include "StringTextView.h"
// constructor
StringValueView::StringValueView(StringProperty* property)
: TextInputValueView(property),
: TextInputValueView(),
fProperty(property)
{
BRect b = Bounds();
@@ -9,9 +9,10 @@
#ifndef STRING_VALUE_VIEW_H
#define STRING_VALUE_VIEW_H
#include "OptionProperty.h"
#include "Property.h"
#include "TextInputValueView.h"
class StringProperty;
class StringTextView;
class StringValueView : public TextInputValueView {
@@ -26,6 +27,8 @@ class StringValueView : public TextInputValueView {
virtual void ValueChanged();
virtual bool AdoptProperty(Property* property);
virtual Property* GetProperty() const
{ return fProperty; }
private:
StringProperty* fProperty;
@@ -21,8 +21,8 @@ enum {
};
// constructor
TextInputValueView::TextInputValueView(Property* property)
: PropertyEditorView(property)
TextInputValueView::TextInputValueView()
: PropertyEditorView()
{
}
@@ -21,7 +21,7 @@ class InputTextView;
class TextInputValueView : public PropertyEditorView {
public:
TextInputValueView(Property* property);
TextInputValueView();
virtual ~TextInputValueView();
// BView interface
@@ -0,0 +1,153 @@
/*
* Copyright 2006, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* Stephan Aßmus <superstippi@gmx.de>
*/
#include "IconObjectListView.h"
#include <new>
#include <stdio.h>
#include <string.h>
#include "CommandStack.h"
#include "IconObject.h"
#include "Property.h"
#include "PropertyObject.h"
#include "Selection.h"
#include "SetPropertiesCommand.h"
using std::nothrow;
// constructor
IconObjectListView::IconObjectListView()
: PropertyListView(),
fSelection(NULL),
fCommandStack(NULL),
fObject(NULL),
fIgnoreObjectChange(false)
{
}
// destructor
IconObjectListView::~IconObjectListView()
{
SetSelection(NULL);
_SetObject(NULL);
}
// PropertyChanged
void
IconObjectListView::PropertyChanged(const Property* previous,
const Property* current)
{
if (!fCommandStack || !fObject)
return;
PropertyObject* oldObject = new (nothrow) PropertyObject();
if (oldObject)
oldObject->AddProperty(previous->Clone());
PropertyObject* newObject = new (nothrow) PropertyObject();
if (newObject)
newObject->AddProperty(current->Clone());
IconObject** objects = new (nothrow) IconObject*[1];
if (objects)
objects[0] = fObject;
Command* command = new (nothrow) SetPropertiesCommand(objects, 1,
oldObject,
newObject);
fIgnoreObjectChange = true;
fCommandStack->Perform(command);
fIgnoreObjectChange = false;
}
// PasteProperties
void
IconObjectListView::PasteProperties(const PropertyObject* object)
{
printf("IconObjectListView::PasteProperties()\n");
PropertyListView::PasteProperties(object);
}
// IsEditingMultipleObjects
bool
IconObjectListView::IsEditingMultipleObjects()
{
return false;
}
// #pragma mark -
// ObjectChanged
void
IconObjectListView::ObjectChanged(const Observable* object)
{
if (object == fSelection) {
Selectable* selected = fSelection->SelectableAt(0);
_SetObject(dynamic_cast<IconObject*>(selected));
}
if (object == fObject && !fIgnoreObjectChange) {
printf("IconObjectListView::ObjectChanged(fObject)\n");
SetTo(fObject->MakePropertyObject());
}
}
// #pragma mark -
// SetSelection
void
IconObjectListView::SetSelection(Selection* selection)
{
if (fSelection == selection)
return;
if (fSelection)
fSelection->RemoveObserver(this);
fSelection = selection;
if (fSelection)
fSelection->AddObserver(this);
}
// SetCommandStack
void
IconObjectListView::SetCommandStack(CommandStack* stack)
{
fCommandStack = stack;
}
// #pragma mark -
// _SetObject
void
IconObjectListView::_SetObject(IconObject* object)
{
if (fObject == object)
return;
if (fObject) {
fObject->RemoveObserver(this);
fObject->Release();
}
fObject = object;
PropertyObject* propertyObject = NULL;
if (fObject) {
fObject->Acquire();
fObject->AddObserver(this);
propertyObject = fObject->MakePropertyObject();
}
SetTo(propertyObject);
}
@@ -0,0 +1,48 @@
/*
* Copyright 2006, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* Stephan Aßmus <superstippi@gmx.de>
*/
#ifndef ICON_OBJECT_LIST_VIEW_H
#define ICON_OBJECT_LIST_VIEW_H
#include "Observer.h"
#include "PropertyListView.h"
class CommandStack;
class IconObject;
class Selection;
class IconObjectListView : public PropertyListView,
public Observer {
public:
IconObjectListView();
virtual ~IconObjectListView();
// PropertyListView interface
virtual void PropertyChanged(const Property* previous,
const Property* current);
virtual void PasteProperties(const PropertyObject* object);
virtual bool IsEditingMultipleObjects();
// Observer interface
virtual void ObjectChanged(const Observable* object);
// IconObjectListView
void SetSelection(Selection* selection);
void SetCommandStack(CommandStack* stack);
private:
void _SetObject(IconObject* object);
Selection* fSelection;
CommandStack* fCommandStack;
IconObject* fObject;
bool fIgnoreObjectChange;
};
#endif // ICON_OBJECT_LIST_VIEW_H
+24 -24
View File
@@ -128,29 +128,29 @@ class PathListItem : public SimpleItem,
}
void SetMarkEnabled(bool enabled)
{
if (fMarkEnabled == enabled)
return;
fMarkEnabled = enabled;
Invalidate();
}
{
if (fMarkEnabled == enabled)
return;
fMarkEnabled = enabled;
Invalidate();
}
void SetMarked(bool marked)
{
if (fMarked == marked)
return;
fMarked = marked;
Invalidate();
}
{
if (fMarked == marked)
return;
fMarked = marked;
Invalidate();
}
void Invalidate()
{
// :-/
if (fListView->LockLooper()) {
fListView->InvalidateItem(
fListView->IndexOf(this));
fListView->UnlockLooper();
}
}
{
// :-/
if (fListView->LockLooper()) {
fListView->InvalidateItem(
fListView->IndexOf(this));
fListView->UnlockLooper();
}
}
VectorPath* path;
private:
@@ -265,10 +265,10 @@ PathListView::SelectionChanged()
if (!fSelection)
return;
// if (item)
// fSelection->Select(item->path);
// else
// fSelection->DeselectAll();
if (item)
fSelection->Select(item->path);
else
fSelection->DeselectAll();
}
// MouseDown
@@ -26,19 +26,62 @@
using std::nothrow;
class TransformerItem : public SimpleItem {
class TransformerItem : public SimpleItem,
public Observer {
public:
TransformerItem(Transformer* t)
TransformerItem(Transformer* t,
TransformerListView* listView)
: SimpleItem(t->Name()),
transformer(t)
transformer(NULL),
fListView(listView)
{
SetTransformer(t);
}
virtual ~TransformerItem()
{
SetTransformer(NULL);
}
// Observer interface
virtual void ObjectChanged(const Observable* object)
{
UpdateText();
}
// TransformerItem
void SetTransformer(Transformer* t)
{
if (t == transformer)
return;
if (transformer) {
transformer->RemoveObserver(this);
transformer->Release();
}
transformer = t;
if (transformer) {
transformer->Acquire();
transformer->AddObserver(this);
UpdateText();
}
}
void UpdateText()
{
SetText(transformer->Name());
// :-/
if (fListView->LockLooper()) {
fListView->InvalidateItem(
fListView->IndexOf(this));
fListView->UnlockLooper();
}
}
Transformer* transformer;
private:
TransformerListView* fListView;
};
// #pragma mark -
@@ -171,7 +214,8 @@ BListItem*
TransformerListView::CloneItem(int32 index) const
{
if (TransformerItem* item = dynamic_cast<TransformerItem*>(ItemAt(index))) {
return new TransformerItem(item->transformer);
return new TransformerItem(item->transformer,
const_cast<TransformerListView*>(this));
}
return NULL;
}
@@ -258,7 +302,7 @@ bool
TransformerListView::_AddTransformer(Transformer* transformer, int32 index)
{
if (transformer)
return AddItem(new TransformerItem(transformer), index);
return AddItem(new TransformerItem(transformer, this), index);
return false;
}
+16 -31
View File
@@ -25,7 +25,7 @@ ShapeListener::~ShapeListener()
// constructor
Shape::Shape(::Style* style)
: IconObject(),
: IconObject("<shape>"),
Observer(),
PathContainerListener(),
@@ -35,9 +35,7 @@ Shape::Shape(::Style* style)
fPathSource(fPaths),
fTransformers(4),
fLastBounds(0, 0, -1, -1),
fName("<shape>")
fLastBounds(0, 0, -1, -1)
{
if (fPaths)
fPaths->AddListener(this);
@@ -47,7 +45,7 @@ Shape::Shape(::Style* style)
// constructor
Shape::Shape(const Shape& other)
: IconObject(),
: IconObject(other),
Observer(),
PathContainerListener(),
@@ -57,9 +55,7 @@ Shape::Shape(const Shape& other)
fPathSource(fPaths),
fTransformers(4),
fLastBounds(0, 0, -1, -1),
fName(other.fName)
fLastBounds(0, 0, -1, -1)
{
if (fPaths) {
fPaths->AddListener(this);
@@ -82,8 +78,11 @@ Shape::Shape(const Shape& other)
Shape::~Shape()
{
int32 count = fTransformers.CountItems();
for (int32 i = 0; i < count; i++)
delete (Transformer*)fTransformers.ItemAtFast(i);
for (int32 i = 0; i < count; i++) {
Transformer* t = (Transformer*)fTransformers.ItemAtFast(i);
t->RemoveObserver(this);
delete t;
}
fPaths->MakeEmpty();
fPaths->RemoveListener(this);
@@ -99,7 +98,7 @@ void
Shape::ObjectChanged(const Observable* object)
{
// simply pass on the event for now
// (a path or the style changed,
// (a path, transformer or the style changed,
// the shape needs to be re-rendered)
Notify();
}
@@ -157,26 +156,6 @@ Shape::SetStyle(::Style* style)
// #pragma mark -
// SetName
void
Shape::SetName(const char* name)
{
if (fName == name)
return;
fName = name;
Notify();
}
// Name
const char*
Shape::Name() const
{
return fName.String();
}
// #pragma mark -
// Bounds
BRect
Shape::Bounds(bool updateLast) const
@@ -217,6 +196,8 @@ Shape::VertexSource()
source = t;
}
source->SetLast();
return *source;
}
@@ -237,6 +218,8 @@ Shape::AddTransformer(Transformer* transformer, int32 index)
if (!fTransformers.AddItem((void*)transformer, index))
return false;
transformer->AddObserver(this);
_NotifyTransformerAdded(transformer, index);
return true;
}
@@ -246,6 +229,8 @@ bool
Shape::RemoveTransformer(Transformer* transformer)
{
if (fTransformers.RemoveItem((void*)transformer)) {
transformer->RemoveObserver(this);
_NotifyTransformerRemoved(transformer);
return true;
}
-6
View File
@@ -3,7 +3,6 @@
#include <List.h>
#include <Rect.h>
#include <String.h>
#include "IconObject.h"
#include "Observer.h"
@@ -48,9 +47,6 @@ class Shape : public IconObject,
inline ::Style* Style() const
{ return fStyle; }
void SetName(const char* name);
const char* Name() const;
inline BRect LastBounds() const
{ return fLastBounds; }
BRect Bounds(bool updateLast = false) const;
@@ -87,8 +83,6 @@ class Shape : public IconObject,
BList fListeners;
mutable BRect fLastBounds;
BString fName;
};
#endif // SHAPE_H
+45 -46
View File
@@ -24,6 +24,10 @@
#include "support.h"
#include "CommonPropertyIDs.h"
#include "Property.h"
#include "PropertyObject.h"
#define obj_new(type, n) ((type *)malloc ((n) * sizeof(type)))
#define obj_renew(p, type, n) ((type *)realloc (p, (n) * sizeof(type)))
#define obj_free free
@@ -56,11 +60,6 @@ get_path_storage(agg::path_storage& path,
points[0].point.x,
points[0].point.y);
path.close_polygon();
} else {
// straight line from last to first control point
path.line_to(points[0].point.x,
points[0].point.y);
path.close_polygon();
}
return true;
@@ -72,27 +71,23 @@ get_path_storage(agg::path_storage& path,
// constructor
VectorPath::VectorPath()
: BArchivable(),
Observable(),
Referenceable(),
IconObject("<path>"),
fPath(NULL),
fClosed(false),
fPointCount(0),
fAllocCount(0),
fCachedBounds(0.0, 0.0, -1.0, -1.0),
fName("<path>")
fCachedBounds(0.0, 0.0, -1.0, -1.0)
{
}
// constructor
VectorPath::VectorPath(const VectorPath& from)
: BArchivable(),
Observable(),
Referenceable(),
IconObject(from),
fPath(NULL),
fPointCount(0),
fAllocCount(0),
fCachedBounds(0.0, 0.0, -1.0, -1.0),
fName()
fCachedBounds(0.0, 0.0, -1.0, -1.0)
{
*this = from;
}
@@ -100,14 +95,12 @@ VectorPath::VectorPath(const VectorPath& from)
// constructor
VectorPath::VectorPath(const BMessage* archive)
: BArchivable(),
Observable(),
Referenceable(),
IconObject("<path>"/*archive*/),
fPath(NULL),
fClosed(false),
fPointCount(0),
fAllocCount(0),
fCachedBounds(0.0, 0.0, -1.0, -1.0),
fName()
fCachedBounds(0.0, 0.0, -1.0, -1.0)
{
if (archive) {
type_code typeFound;
@@ -133,9 +126,6 @@ VectorPath::VectorPath(const BMessage* archive)
if (archive->FindBool("path closed", &fClosed) < B_OK) {
fClosed = false;
}
if (archive->FindString("name", &fName) < B_OK) {
fName = "<path>";
}
}
}
@@ -146,6 +136,35 @@ VectorPath::~VectorPath()
obj_free(fPath);
}
// #pragma mark -
// MakePropertyObject
PropertyObject*
VectorPath::MakePropertyObject() const
{
PropertyObject* object = IconObject::MakePropertyObject();
if (!object)
return NULL;
object->AddProperty(new BoolProperty(PROPERTY_CLOSED, fClosed));
return object;
}
// SetToPropertyObject
bool
VectorPath::SetToPropertyObject(const PropertyObject* object)
{
AutoNotificationSuspender _(this);
IconObject::SetToPropertyObject(object);
SetClosed(object->Value(PROPERTY_CLOSED, fClosed));
return HasPendingNotifications();
}
// #pragma mark -
// operator=
VectorPath&
VectorPath::operator=(const VectorPath& from)
@@ -161,7 +180,6 @@ VectorPath::operator=(const VectorPath& from)
fPointCount = 0;
fCachedBounds.Set(0.0, 0.0, -1.0, -1.0);
}
fName = from.fName;
return *this;
}
@@ -213,13 +231,8 @@ VectorPath::Archive(BMessage* into, bool deep) const
fprintf(stderr, "failed adding points!\n");
}
if (ret >= B_OK) {
ret = into->AddString("name", fName.String());
} else {
fprintf(stderr, "failed adding close!\n");
}
if (ret < B_OK) {
fprintf(stderr, "failed adding name!\n");
}
// finish off
if (ret < B_OK) {
ret = into->AddString("class", "VectorPath");
@@ -228,6 +241,8 @@ VectorPath::Archive(BMessage* into, bool deep) const
return ret;
}
// #pragma mark -
// AddPoint
bool
VectorPath::AddPoint(BPoint point)
@@ -414,6 +429,8 @@ VectorPath::SetInOutConnected(int32 index, bool connected)
return false;
}
// #pragma mark -
// GetPointAt
bool
VectorPath::GetPointAt(int32 index, BPoint& point) const
@@ -478,6 +495,8 @@ VectorPath::CountPoints() const
return fPointCount;
}
// #pragma mark -
// distance_to_curve
static float
distance_to_curve(const BPoint& p, const BPoint& a, const BPoint& aOut, const BPoint& bIn, const BPoint& b)
@@ -845,26 +864,6 @@ VectorPath::_SetPoint(int32 index, BPoint point)
// #pragma mark -
// SetName
void
VectorPath::SetName(const char* name)
{
if (fName == name)
return;
fName = name;
Notify();
}
// Name
const char*
VectorPath::Name() const
{
return fName.String();
}
// #pragma mark -
// _SetPointCount
bool
VectorPath::_SetPointCount(int32 count)
+8 -10
View File
@@ -15,8 +15,7 @@
#include <agg_path_storage.h>
#include "Observable.h"
#include "Referenceable.h"
#include "IconObject.h"
class BBitmap;
class BMessage;
@@ -30,8 +29,7 @@ struct control_point {
};
class VectorPath : public BArchivable,
public Observable,
public Referenceable {
public IconObject {
public:
class Iterator {
@@ -48,6 +46,12 @@ class VectorPath : public BArchivable,
VectorPath(const BMessage* archive);
virtual ~VectorPath();
// IconObject
virtual PropertyObject* MakePropertyObject() const;
virtual bool SetToPropertyObject(
const PropertyObject* object);
// VectorPath
VectorPath& operator=(const VectorPath& from);
// bool operator==(const VectorPath& frrom) const;
@@ -122,9 +126,6 @@ class VectorPath : public BArchivable,
bool GetAGGPathStorage(agg::path_storage& path) const;
void SetName(const char* name);
const char* Name() const;
private:
BRect _Bounds() const;
void _SetPoint(int32 index, BPoint point);
@@ -138,9 +139,6 @@ class VectorPath : public BArchivable,
int32 fAllocCount;
mutable BRect fCachedBounds;
// TODO: should this really be part of VectorPath?
BString fName;
};
#endif // VECTOR_PATH_H
+1 -1
View File
@@ -12,7 +12,7 @@
// constructor
Style::Style()
: IconObject(),
: IconObject("<style>"),
Observer(),
fColor(),
@@ -10,7 +10,7 @@
// constructor
AffineTransformer::AffineTransformer(VertexSource& source)
: Transformer(source),
: Transformer(source, "Transformation"),
Affine(source, *this)
{
}
@@ -42,11 +42,10 @@ AffineTransformer::SetSource(VertexSource& source)
Affine::attach(source);
}
// Name
const char*
AffineTransformer::Name() const
// SetLast
void
AffineTransformer::SetLast()
{
return "Transformation";
fSource.SetLast();
}
@@ -29,8 +29,7 @@ class AffineTransformer : public Transformer,
virtual unsigned vertex(double* x, double* y);
virtual void SetSource(VertexSource& source);
virtual const char* Name() const;
virtual void SetLast();
};
#endif // AFFINE_TRANSFORMER_H
@@ -10,7 +10,7 @@
// constructor
ContourTransformer::ContourTransformer(VertexSource& source)
: Transformer(source),
: Transformer(source, "Contour"),
Contour(source)
{
}
@@ -42,10 +42,10 @@ ContourTransformer::SetSource(VertexSource& source)
Contour::attach(source);
}
// Name
const char*
ContourTransformer::Name() const
// SetLast
void
ContourTransformer::SetLast()
{
return "Contour";
fSource.SetLast();
}
@@ -26,8 +26,7 @@ class ContourTransformer : public Transformer,
virtual unsigned vertex(double* x, double* y);
virtual void SetSource(VertexSource& source);
virtual const char* Name() const;
virtual void SetLast();
};
#endif // CONTOUR_TRANSFORMER_H
@@ -39,6 +39,13 @@ PathSource::vertex(double* x, double* y)
return fAGGCurvedPath.vertex(x, y);
}
// SetLast
void
PathSource::SetLast()
{
fAGGPath.close_polygon();
}
// Update
void
PathSource::Update()
@@ -28,6 +28,8 @@ class PathSource : public VertexSource {
virtual void rewind(unsigned path_id);
virtual unsigned vertex(double* x, double* y);
virtual void SetLast();
void Update();
private:
@@ -10,7 +10,7 @@
// constructor
PerspectiveTransformer::PerspectiveTransformer(VertexSource& source)
: Transformer(source),
: Transformer(source, "Perspective"),
Perspective(source, *this)
{
}
@@ -42,11 +42,12 @@ PerspectiveTransformer::SetSource(VertexSource& source)
Perspective::attach(source);
}
// Name
const char*
PerspectiveTransformer::Name() const
// SetLast
void
PerspectiveTransformer::SetLast()
{
return "Perspective";
fSource.SetLast();
}
@@ -29,8 +29,7 @@ class PerspectiveTransformer : public Transformer,
virtual unsigned vertex(double* x, double* y);
virtual void SetSource(VertexSource& source);
virtual const char* Name() const;
virtual void SetLast();
};
#endif // PERSPECTIVE_TRANSFORMER_H
@@ -8,9 +8,14 @@
#include "StrokeTransformer.h"
#include "CommonPropertyIDs.h"
#include "OptionProperty.h"
#include "Property.h"
#include "PropertyObject.h"
// constructor
StrokeTransformer::StrokeTransformer(VertexSource& source)
: Transformer(source),
: Transformer(source, "Stroke"),
Stroke(source)
{
}
@@ -42,11 +47,71 @@ StrokeTransformer::SetSource(VertexSource& source)
Stroke::attach(source);
}
// Name
const char*
StrokeTransformer::Name() const
// #pragma mark -
// MakePropertyObject
PropertyObject*
StrokeTransformer::MakePropertyObject() const
{
return "Stroke";
PropertyObject* object = Transformer::MakePropertyObject();
if (!object)
return NULL;
// width
object->AddProperty(new FloatProperty(PROPERTY_WIDTH, width()));
// cap mode
OptionProperty* property = new OptionProperty(PROPERTY_CAP_MODE);
property->AddOption(agg::butt_cap, "Butt");
property->AddOption(agg::square_cap, "Square");
property->AddOption(agg::round_cap, "Round");
property->SetCurrentOptionID(line_cap());
object->AddProperty(property);
// join mode
property = new OptionProperty(PROPERTY_JOIN_MODE);
property->AddOption(agg::miter_join, "Miter");
property->AddOption(agg::round_join, "Round");
property->AddOption(agg::bevel_join, "Bevel");
property->SetCurrentOptionID(line_join());
object->AddProperty(property);
return object;
}
// SetToPropertyObject
bool
StrokeTransformer::SetToPropertyObject(const PropertyObject* object)
{
AutoNotificationSuspender _(this);
Transformer::SetToPropertyObject(object);
// width
float w = object->Value(PROPERTY_WIDTH, (float)width());
if (w != width()) {
width(w);
Notify();
}
// cap mode
OptionProperty* property = dynamic_cast<OptionProperty*>(
object->FindProperty(PROPERTY_CAP_MODE));
if (property && line_cap() != property->CurrentOptionID()) {
line_cap((agg::line_cap_e)property->CurrentOptionID());
Notify();
}
// join mode
property = dynamic_cast<OptionProperty*>(
object->FindProperty(PROPERTY_JOIN_MODE));
if (property && line_join() != property->CurrentOptionID()) {
line_join((agg::line_join_e)property->CurrentOptionID());
Notify();
}
return HasPendingNotifications();
}
@@ -27,7 +27,10 @@ class StrokeTransformer : public Transformer,
virtual void SetSource(VertexSource& source);
virtual const char* Name() const;
// IconObject interface
virtual PropertyObject* MakePropertyObject() const;
virtual bool SetToPropertyObject(
const PropertyObject* object);
};
#endif // STROKE_TRANSFORMER_H
@@ -18,11 +18,18 @@ VertexSource::~VertexSource()
{
}
// Finish
void
VertexSource::SetLast()
{
}
// #pragma mark -
// constructor
Transformer::Transformer(VertexSource& source)
: fSource(source)
Transformer::Transformer(VertexSource& source, const char* name)
: IconObject(name),
fSource(source)
{
}
@@ -52,11 +59,4 @@ Transformer::SetSource(VertexSource& source)
fSource = source;
}
// #pragma mark -
// SelectedChanged
void
Transformer::SelectedChanged()
{
}
@@ -9,7 +9,7 @@
#ifndef TRANSFORMER_H
#define TRANSFORMER_H
#include "Selectable.h"
#include "IconObject.h"
class VertexSource {
public:
@@ -18,13 +18,16 @@ class VertexSource {
virtual void rewind(unsigned path_id) = 0;
virtual unsigned vertex(double* x, double* y) = 0;
virtual void SetLast();
};
class Transformer : public VertexSource,
public Selectable {
public IconObject {
public:
Transformer(VertexSource& source);
Transformer(VertexSource& source,
const char* name);
virtual ~Transformer();
virtual void rewind(unsigned path_id);
@@ -32,12 +35,7 @@ class Transformer : public VertexSource,
virtual void SetSource(VertexSource& source);
virtual const char* Name() const = 0;
// Selectable interface
virtual void SelectedChanged();
private:
protected:
VertexSource& fSource;
};