* the path list view shows check boxes now when a shape is selected,
the marked paths are used in the shape * a new path is auto-selected * deselecting a shape still sends the selection message * PathSource does not call agg::path_storage::start_new_path() for each subpath... a move_to() is sufficient and makes sure the subpaths are rendered even :-) * updated NOTES * moved IconView into gui subfolder git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18021 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -45,6 +45,7 @@ enum {
|
|||||||
|
|
||||||
MSG_NEW_PATH = 'nwvp',
|
MSG_NEW_PATH = 'nwvp',
|
||||||
MSG_PATH_SELECTED = 'vpsl',
|
MSG_PATH_SELECTED = 'vpsl',
|
||||||
|
MSG_SHAPE_SELECTED = 'spsl',
|
||||||
};
|
};
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
@@ -100,6 +101,13 @@ case MSG_PATH_SELECTED: {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case MSG_SHAPE_SELECTED: {
|
||||||
|
Shape* shape;
|
||||||
|
if (message->FindPointer("shape", (void**)&shape) < B_OK)
|
||||||
|
shape = NULL;
|
||||||
|
fPathListView->SetCurrentShape(shape);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BWindow::MessageReceived(message);
|
BWindow::MessageReceived(message);
|
||||||
@@ -291,7 +299,8 @@ MainWindow::_CreateGUI(BRect bounds)
|
|||||||
new BMessage(MSG_PATH_SELECTED), this);
|
new BMessage(MSG_PATH_SELECTED), this);
|
||||||
|
|
||||||
bounds.OffsetBy(bounds.Width() + 6 + B_V_SCROLL_BAR_WIDTH, 0);
|
bounds.OffsetBy(bounds.Width() + 6 + B_V_SCROLL_BAR_WIDTH, 0);
|
||||||
fShapeListView = new ShapeListView(bounds, "shape list view");
|
fShapeListView = new ShapeListView(bounds, "shape list view",
|
||||||
|
new BMessage(MSG_SHAPE_SELECTED), this);
|
||||||
|
|
||||||
bg->AddChild(fSwatchGroup);
|
bg->AddChild(fSwatchGroup);
|
||||||
|
|
||||||
|
|||||||
@@ -15,21 +15,33 @@
|
|||||||
different paths showing at the same time...
|
different paths showing at the same time...
|
||||||
|
|
||||||
* solve the problem of individual gradient transformation per shape
|
* solve the problem of individual gradient transformation per shape
|
||||||
|
-> introduce "StyleInstance", a Shape would not reference a Style
|
||||||
|
directly but via a StyleInstance... this object can have additional
|
||||||
|
information like the gradient transformation
|
||||||
|
|
||||||
* IconRenderer should construct a separate StyleManager and append
|
* IconRenderer should construct a separate StyleManager and append
|
||||||
the styles in the order of shapes, also adding styles multiple
|
the styles in the order of shapes, also adding styles multiple
|
||||||
times, if two or more shapes use the same style (the compound shape
|
times, if two or more shapes use the same style (the compound shape
|
||||||
rendering uses the style index for z ordering)
|
rendering uses the style index for z ordering) [done]
|
||||||
|
|
||||||
|
* add more functionality to Transformer/VertexSource interface:
|
||||||
|
- (inverse) Transformation
|
||||||
|
- Cloning
|
||||||
|
|
||||||
|
* add more powerful listener interface to Shape
|
||||||
|
(TransformerAdded()/Removed()...)
|
||||||
|
|
||||||
|
* implement commands for the newly added editing features
|
||||||
|
|
||||||
|
|
||||||
--------- user interface
|
--------- user interface
|
||||||
|
|
||||||
* list of global vector paths
|
* list of global vector paths [done]
|
||||||
|
|
||||||
* list of shapes
|
* list of shapes [done]
|
||||||
|
|
||||||
* list of paths used by shape, but it could also be done such that
|
* list of paths used by shape, but it could also be done such that
|
||||||
used paths are marked in the global list when a shape is selected
|
used paths are marked in the global list when a shape is selected [done]
|
||||||
|
|
||||||
* list of transformers attached to the selected shape
|
* list of transformers attached to the selected shape
|
||||||
|
|
||||||
@@ -40,12 +52,12 @@
|
|||||||
|
|
||||||
* 192 "built-in" (pre-defined) style definitions
|
* 192 "built-in" (pre-defined) style definitions
|
||||||
* up to 64 additional style definitions per document
|
* up to 64 additional style definitions per document
|
||||||
|
* referencing of fill style by uint8 id
|
||||||
* solid colors and different types of gradients
|
* solid colors and different types of gradients
|
||||||
* uint8 precision for coordinates on a 64x64 virtual pixel grid
|
* uint8 precision for coordinates on a 64x64 virtual pixel grid
|
||||||
(* removal (freezing) of transformations at export time
|
(* removal (freezing) of transformations at export time
|
||||||
not sure about this one, it would remove the possiblity
|
not sure about this one, it would remove the possiblity
|
||||||
to store vector path only once for referenced objects)
|
to store vector path only once for referenced objects)
|
||||||
* referencing of fill style by uint8 id
|
|
||||||
* IFF type chunk format
|
* IFF type chunk format
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,16 +18,25 @@
|
|||||||
|
|
||||||
#include "VectorPath.h"
|
#include "VectorPath.h"
|
||||||
#include "Observer.h"
|
#include "Observer.h"
|
||||||
|
#include "Shape.h"
|
||||||
|
#include "ShapeContainer.h"
|
||||||
#include "Selection.h"
|
#include "Selection.h"
|
||||||
|
|
||||||
|
static const float kMarkWidth = 14.0;
|
||||||
|
static const float kBorderOffset = 3.0;
|
||||||
|
static const float kTextOffset = 4.0;
|
||||||
|
|
||||||
class PathListItem : public SimpleItem,
|
class PathListItem : public SimpleItem,
|
||||||
public Observer {
|
public Observer {
|
||||||
public:
|
public:
|
||||||
PathListItem(VectorPath* p,
|
PathListItem(VectorPath* p,
|
||||||
PathListView* listView)
|
PathListView* listView,
|
||||||
|
bool markEnabled)
|
||||||
: SimpleItem(""),
|
: SimpleItem(""),
|
||||||
path(NULL),
|
path(NULL),
|
||||||
fListView(listView)
|
fListView(listView),
|
||||||
|
fMarkEnabled(markEnabled),
|
||||||
|
fMarked(false)
|
||||||
{
|
{
|
||||||
SetPath(p);
|
SetPath(p);
|
||||||
}
|
}
|
||||||
@@ -37,11 +46,63 @@ class PathListItem : public SimpleItem,
|
|||||||
SetPath(NULL);
|
SetPath(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SimpleItem interface
|
||||||
|
virtual void Draw(BView* owner, BRect itemFrame, uint32 flags)
|
||||||
|
{
|
||||||
|
SimpleItem::DrawBackground(owner, itemFrame, flags);
|
||||||
|
|
||||||
|
// text
|
||||||
|
owner->SetHighColor(0, 0, 0, 255);
|
||||||
|
font_height fh;
|
||||||
|
owner->GetFontHeight(&fh);
|
||||||
|
BString truncatedString(Text());
|
||||||
|
owner->TruncateString(&truncatedString, B_TRUNCATE_MIDDLE,
|
||||||
|
itemFrame.Width()
|
||||||
|
- kBorderOffset
|
||||||
|
- kMarkWidth
|
||||||
|
- kTextOffset
|
||||||
|
- kBorderOffset);
|
||||||
|
float height = itemFrame.Height();
|
||||||
|
float textHeight = fh.ascent + fh.descent;
|
||||||
|
BPoint pos;
|
||||||
|
pos.x = itemFrame.left
|
||||||
|
+ kBorderOffset + kMarkWidth + kTextOffset;
|
||||||
|
pos.y = itemFrame.top
|
||||||
|
+ ceilf((height - textHeight) / 2.0 + fh.ascent);
|
||||||
|
owner->DrawString(truncatedString.String(), pos);
|
||||||
|
|
||||||
|
if (!fMarkEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// mark
|
||||||
|
BRect markRect = itemFrame;
|
||||||
|
markRect.left += kBorderOffset;
|
||||||
|
markRect.right = markRect.left + kMarkWidth;
|
||||||
|
markRect.top = (markRect.top + markRect.bottom - kMarkWidth) / 2.0;
|
||||||
|
markRect.bottom = markRect.top + kMarkWidth;
|
||||||
|
owner->SetHighColor(tint_color(owner->LowColor(), B_DARKEN_1_TINT));
|
||||||
|
owner->StrokeRect(markRect);
|
||||||
|
markRect.InsetBy(1, 1);
|
||||||
|
owner->SetHighColor(tint_color(owner->LowColor(), 1.04));
|
||||||
|
owner->FillRect(markRect);
|
||||||
|
if (fMarked) {
|
||||||
|
markRect.InsetBy(2, 2);
|
||||||
|
owner->SetHighColor(tint_color(owner->LowColor(),
|
||||||
|
B_DARKEN_4_TINT));
|
||||||
|
owner->SetPenSize(2);
|
||||||
|
owner->StrokeLine(markRect.LeftTop(), markRect.RightBottom());
|
||||||
|
owner->StrokeLine(markRect.LeftBottom(), markRect.RightTop());
|
||||||
|
owner->SetPenSize(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Observer interface
|
||||||
virtual void ObjectChanged(const Observable* object)
|
virtual void ObjectChanged(const Observable* object)
|
||||||
{
|
{
|
||||||
UpdateText();
|
UpdateText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PathListItem
|
||||||
void SetPath(VectorPath* p)
|
void SetPath(VectorPath* p)
|
||||||
{
|
{
|
||||||
if (p == path)
|
if (p == path)
|
||||||
@@ -63,17 +124,92 @@ class PathListItem : public SimpleItem,
|
|||||||
void UpdateText()
|
void UpdateText()
|
||||||
{
|
{
|
||||||
SetText(path->Name());
|
SetText(path->Name());
|
||||||
// :-/
|
Invalidate();
|
||||||
if (fListView->LockLooper()) {
|
|
||||||
fListView->InvalidateItem(
|
|
||||||
fListView->IndexOf(this));
|
|
||||||
fListView->UnlockLooper();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetMarkEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
if (fMarkEnabled == enabled)
|
||||||
|
return;
|
||||||
|
fMarkEnabled = enabled;
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
void SetMarked(bool marked)
|
||||||
|
{
|
||||||
|
if (fMarked == marked)
|
||||||
|
return;
|
||||||
|
fMarked = marked;
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Invalidate()
|
||||||
|
{
|
||||||
|
// :-/
|
||||||
|
if (fListView->LockLooper()) {
|
||||||
|
fListView->InvalidateItem(
|
||||||
|
fListView->IndexOf(this));
|
||||||
|
fListView->UnlockLooper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VectorPath* path;
|
VectorPath* path;
|
||||||
private:
|
private:
|
||||||
PathListView* fListView;
|
PathListView* fListView;
|
||||||
|
bool fMarkEnabled;
|
||||||
|
bool fMarked;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class ShapePathListener : public PathContainerListener,
|
||||||
|
public ShapeContainerListener {
|
||||||
|
public:
|
||||||
|
ShapePathListener(PathListView* listView)
|
||||||
|
: fListView(listView),
|
||||||
|
fShape(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual ~ShapePathListener()
|
||||||
|
{
|
||||||
|
SetShape(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void PathAdded(VectorPath* path)
|
||||||
|
{
|
||||||
|
fListView->_SetPathMarked(path, true);
|
||||||
|
}
|
||||||
|
virtual void PathRemoved(VectorPath* path)
|
||||||
|
{
|
||||||
|
fListView->_SetPathMarked(path, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void ShapeAdded(Shape* shape, int32 index) {}
|
||||||
|
virtual void ShapeRemoved(Shape* shape)
|
||||||
|
{
|
||||||
|
fListView->SetCurrentShape(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetShape(Shape* shape)
|
||||||
|
{
|
||||||
|
if (fShape == shape)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (fShape)
|
||||||
|
fShape->Paths()->RemoveListener(this);
|
||||||
|
|
||||||
|
fShape = shape;
|
||||||
|
|
||||||
|
if (fShape)
|
||||||
|
fShape->Paths()->AddListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
Shape* CurrentShape() const
|
||||||
|
{
|
||||||
|
return fShape;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
PathListView* fListView;
|
||||||
|
Shape* fShape;
|
||||||
};
|
};
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
@@ -86,7 +222,12 @@ PathListView::PathListView(BRect frame,
|
|||||||
NULL, B_SINGLE_SELECTION_LIST),
|
NULL, B_SINGLE_SELECTION_LIST),
|
||||||
fMessage(message),
|
fMessage(message),
|
||||||
fPathContainer(NULL),
|
fPathContainer(NULL),
|
||||||
fSelection(NULL)
|
fShapeContainer(NULL),
|
||||||
|
fSelection(NULL),
|
||||||
|
fCommandStack(NULL),
|
||||||
|
|
||||||
|
fCurrentShape(NULL),
|
||||||
|
fShapePathListener(new ShapePathListener(this))
|
||||||
{
|
{
|
||||||
SetTarget(target);
|
SetTarget(target);
|
||||||
}
|
}
|
||||||
@@ -99,6 +240,11 @@ PathListView::~PathListView()
|
|||||||
|
|
||||||
if (fPathContainer)
|
if (fPathContainer)
|
||||||
fPathContainer->RemoveListener(this);
|
fPathContainer->RemoveListener(this);
|
||||||
|
|
||||||
|
if (fShapeContainer)
|
||||||
|
fShapeContainer->RemoveListener(fShapePathListener);
|
||||||
|
|
||||||
|
delete fShapePathListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SelectionChanged
|
// SelectionChanged
|
||||||
@@ -125,6 +271,49 @@ PathListView::SelectionChanged()
|
|||||||
// fSelection->DeselectAll();
|
// fSelection->DeselectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MouseDown
|
||||||
|
void
|
||||||
|
PathListView::MouseDown(BPoint where)
|
||||||
|
{
|
||||||
|
if (!fCurrentShape) {
|
||||||
|
SimpleListView::MouseDown(where);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool handled = false;
|
||||||
|
int32 index = IndexOf(where);
|
||||||
|
PathListItem* item = dynamic_cast<PathListItem*>(ItemAt(index));
|
||||||
|
if (item) {
|
||||||
|
BRect itemFrame(ItemFrame(index));
|
||||||
|
itemFrame.right = itemFrame.left
|
||||||
|
+ kBorderOffset + kMarkWidth
|
||||||
|
+ kTextOffset / 2.0;
|
||||||
|
VectorPath* path = item->path;
|
||||||
|
if (itemFrame.Contains(where)) {
|
||||||
|
// add or remove the path to the shape
|
||||||
|
// TODO: code these commands...
|
||||||
|
// Command* command;
|
||||||
|
// if (fCurrentShape->Paths()->HasPath(path)) {
|
||||||
|
// command = new RemovePathFromShapeCommand(
|
||||||
|
// fCurrentShape, path);
|
||||||
|
// } else {
|
||||||
|
// command = new AddPathToShapeCommand(
|
||||||
|
// fCurrentShape, path);
|
||||||
|
// }
|
||||||
|
// fCommandStack->Perform(command);
|
||||||
|
if (fCurrentShape->Paths()->HasPath(path)) {
|
||||||
|
fCurrentShape->Paths()->RemovePath(path);
|
||||||
|
} else {
|
||||||
|
fCurrentShape->Paths()->AddPath(path);
|
||||||
|
}
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!handled)
|
||||||
|
SimpleListView::MouseDown(where);
|
||||||
|
}
|
||||||
|
|
||||||
// MessageReceived
|
// MessageReceived
|
||||||
void
|
void
|
||||||
PathListView::MessageReceived(BMessage* message)
|
PathListView::MessageReceived(BMessage* message)
|
||||||
@@ -176,7 +365,8 @@ PathListView::CloneItem(int32 index) const
|
|||||||
{
|
{
|
||||||
if (PathListItem* item = dynamic_cast<PathListItem*>(ItemAt(index))) {
|
if (PathListItem* item = dynamic_cast<PathListItem*>(ItemAt(index))) {
|
||||||
return new PathListItem(item->path,
|
return new PathListItem(item->path,
|
||||||
const_cast<PathListView*>(this));
|
const_cast<PathListView*>(this),
|
||||||
|
fCurrentShape != NULL);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -196,7 +386,8 @@ PathListView::PathAdded(VectorPath* path)
|
|||||||
|
|
||||||
// NOTE: shapes are always added at the end
|
// NOTE: shapes are always added at the end
|
||||||
// of the list, so the sorting is synced...
|
// of the list, so the sorting is synced...
|
||||||
_AddPath(path);
|
if (_AddPath(path))
|
||||||
|
Select(CountItems() - 1);
|
||||||
|
|
||||||
UnlockLooper();
|
UnlockLooper();
|
||||||
}
|
}
|
||||||
@@ -251,6 +442,23 @@ PathListView::SetPathContainer(PathContainer* container)
|
|||||||
// fPathContainer->ReadUnlock();
|
// fPathContainer->ReadUnlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetShapeContainer
|
||||||
|
void
|
||||||
|
PathListView::SetShapeContainer(ShapeContainer* container)
|
||||||
|
{
|
||||||
|
if (fShapeContainer == container)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// detach from old container
|
||||||
|
if (fShapeContainer)
|
||||||
|
fShapeContainer->RemoveListener(fShapePathListener);
|
||||||
|
|
||||||
|
fShapeContainer = container;
|
||||||
|
|
||||||
|
if (fShapeContainer)
|
||||||
|
fShapeContainer->AddListener(fShapePathListener);
|
||||||
|
}
|
||||||
|
|
||||||
// SetSelection
|
// SetSelection
|
||||||
void
|
void
|
||||||
PathListView::SetSelection(Selection* selection)
|
PathListView::SetSelection(Selection* selection)
|
||||||
@@ -258,6 +466,19 @@ PathListView::SetSelection(Selection* selection)
|
|||||||
fSelection = selection;
|
fSelection = selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetCurrentShape
|
||||||
|
void
|
||||||
|
PathListView::SetCurrentShape(Shape* shape)
|
||||||
|
{
|
||||||
|
if (fCurrentShape == shape)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fCurrentShape = shape;
|
||||||
|
fShapePathListener->SetShape(shape);
|
||||||
|
|
||||||
|
_UpdateMarks();
|
||||||
|
}
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
// _AddPath
|
// _AddPath
|
||||||
@@ -265,7 +486,7 @@ bool
|
|||||||
PathListView::_AddPath(VectorPath* path)
|
PathListView::_AddPath(VectorPath* path)
|
||||||
{
|
{
|
||||||
if (path)
|
if (path)
|
||||||
return AddItem(new PathListItem(path, this));
|
return AddItem(new PathListItem(path, this, fCurrentShape != NULL));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,3 +527,41 @@ PathListView::_MakeEmpty()
|
|||||||
delete RemoveItem(i);
|
delete RemoveItem(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
// _UpdateMarks
|
||||||
|
void
|
||||||
|
PathListView::_UpdateMarks()
|
||||||
|
{
|
||||||
|
int32 count = CountItems();
|
||||||
|
if (fCurrentShape) {
|
||||||
|
// enable display of marks and mark items whoes
|
||||||
|
// path is contained in fCurrentShape
|
||||||
|
for (int32 i = 0; i < count; i++) {
|
||||||
|
PathListItem* item = dynamic_cast<PathListItem*>(ItemAt(i));
|
||||||
|
if (!item)
|
||||||
|
continue;
|
||||||
|
item->SetMarkEnabled(true);
|
||||||
|
item->SetMarked(fCurrentShape->Paths()->HasPath(item->path));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// disable display of marks
|
||||||
|
for (int32 i = 0; i < count; i++) {
|
||||||
|
PathListItem* item = dynamic_cast<PathListItem*>(ItemAt(i));
|
||||||
|
if (!item)
|
||||||
|
continue;
|
||||||
|
item->SetMarkEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
// _SetPathMarked
|
||||||
|
void
|
||||||
|
PathListView::_SetPathMarked(VectorPath* path, bool marked)
|
||||||
|
{
|
||||||
|
if (PathListItem* item = _ItemForPath(path)) {
|
||||||
|
item->SetMarked(marked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,9 +12,13 @@
|
|||||||
#include "ListViews.h"
|
#include "ListViews.h"
|
||||||
#include "PathContainer.h"
|
#include "PathContainer.h"
|
||||||
|
|
||||||
|
class CommandStack;
|
||||||
class VectorPath;
|
class VectorPath;
|
||||||
class PathListItem;
|
class PathListItem;
|
||||||
class Selection;
|
class Selection;
|
||||||
|
class Shape;
|
||||||
|
class ShapeContainer;
|
||||||
|
class ShapePathListener;
|
||||||
|
|
||||||
class PathListView : public SimpleListView,
|
class PathListView : public SimpleListView,
|
||||||
public PathContainerListener {
|
public PathContainerListener {
|
||||||
@@ -28,6 +32,7 @@ class PathListView : public SimpleListView,
|
|||||||
// SimpleListView interface
|
// SimpleListView interface
|
||||||
virtual void SelectionChanged();
|
virtual void SelectionChanged();
|
||||||
|
|
||||||
|
virtual void MouseDown(BPoint where);
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
|
|
||||||
virtual void MakeDragMessage(BMessage* message) const;
|
virtual void MakeDragMessage(BMessage* message) const;
|
||||||
@@ -48,8 +53,13 @@ class PathListView : public SimpleListView,
|
|||||||
|
|
||||||
// PathListView
|
// PathListView
|
||||||
void SetPathContainer(PathContainer* container);
|
void SetPathContainer(PathContainer* container);
|
||||||
|
void SetShapeContainer(ShapeContainer* container);
|
||||||
void SetSelection(Selection* selection);
|
void SetSelection(Selection* selection);
|
||||||
|
|
||||||
|
void SetCurrentShape(Shape* shape);
|
||||||
|
Shape* CurrentShape() const
|
||||||
|
{ return fCurrentShape; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _AddPath(VectorPath* path);
|
bool _AddPath(VectorPath* path);
|
||||||
bool _RemovePath(VectorPath* path);
|
bool _RemovePath(VectorPath* path);
|
||||||
@@ -57,10 +67,22 @@ class PathListView : public SimpleListView,
|
|||||||
PathListItem* _ItemForPath(VectorPath* path) const;
|
PathListItem* _ItemForPath(VectorPath* path) const;
|
||||||
void _MakeEmpty();
|
void _MakeEmpty();
|
||||||
|
|
||||||
|
friend class ShapePathListener;
|
||||||
|
void _UpdateMarks();
|
||||||
|
void _SetPathMarked(VectorPath* path, bool marked);
|
||||||
|
|
||||||
BMessage* fMessage;
|
BMessage* fMessage;
|
||||||
|
|
||||||
PathContainer* fPathContainer;
|
PathContainer* fPathContainer;
|
||||||
|
ShapeContainer* fShapeContainer;
|
||||||
Selection* fSelection;
|
Selection* fSelection;
|
||||||
|
CommandStack* fCommandStack;
|
||||||
|
|
||||||
|
Shape* fCurrentShape;
|
||||||
|
// those path items will be marked that
|
||||||
|
// are referenced by this shape
|
||||||
|
|
||||||
|
ShapePathListener* fShapePathListener;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PATH_LIST_VIEW_H
|
#endif // PATH_LIST_VIEW_H
|
||||||
|
|||||||
@@ -120,9 +120,9 @@ ShapeListView::SelectionChanged()
|
|||||||
// TODO: single selection versus multiple selection
|
// TODO: single selection versus multiple selection
|
||||||
|
|
||||||
ShapeListItem* item = dynamic_cast<ShapeListItem*>(ItemAt(CurrentSelection(0)));
|
ShapeListItem* item = dynamic_cast<ShapeListItem*>(ItemAt(CurrentSelection(0)));
|
||||||
if (item && fMessage) {
|
if (fMessage) {
|
||||||
BMessage message(*fMessage);
|
BMessage message(*fMessage);
|
||||||
message.AddPointer("shape", (void*)item->shape);
|
message.AddPointer("shape", item ? (void*)item->shape : NULL);
|
||||||
Invoke(&message);
|
Invoke(&message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,11 +44,9 @@ void
|
|||||||
PathSource::Update()
|
PathSource::Update()
|
||||||
{
|
{
|
||||||
fAGGPath.remove_all();
|
fAGGPath.remove_all();
|
||||||
|
|
||||||
int32 count = fPaths->CountPaths();
|
int32 count = fPaths->CountPaths();
|
||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++)
|
||||||
VectorPath* path = fPaths->PathAtFast(i);
|
fPaths->PathAtFast(i)->GetAGGPathStorage(fAGGPath);
|
||||||
fAGGPath.start_new_path();
|
|
||||||
path->GetAGGPathStorage(fAGGPath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user