wxSTD ostream& DiagramDocument::SaveObject(wxSTD ostream& stream)
{
wxDocument::SaveObject(stream);
-
+
char buf[400];
(void) wxGetTempFileName("diag", buf);
wxTransferFileToStream(buf, stream);
wxRemoveFile(buf);
-
+
return stream;
}
{
switch (cmd)
{
- case OGLEDIT_CUT:
+ case wxID_CUT:
{
if (shape)
{
deleteShape = true;
-
+
shape->Select(false);
-
+
// Generate commands to explicitly remove each connected line.
RemoveLines(shape);
-
+
doc->GetDiagram()->RemoveShape(shape);
if (shape->IsKindOf(CLASSINFO(wxLineShape)))
{
toShape = lineShape->GetTo();
}
shape->Unlink();
-
+
doc->Modify(true);
doc->UpdateAllViews();
}
theShape->SetCentreResize(false);
theShape->SetPen(wxBLACK_PEN);
theShape->SetBrush(wxCYAN_BRUSH);
-
+
theShape->SetSize(60, 60);
}
doc->GetDiagram()->AddShape(theShape);
theShape->GetCanvas()->PrepareDC(dc);
theShape->Move(dc, x, y);
-
+
shape = theShape;
deleteShape = false;
lineShape->MakeLineControlPoints(2);
lineShape->AddArrow(ARROW_ARROW, ARROW_POSITION_END, 10.0, 0.0, _T("Normal arrowhead"));
}
-
+
doc->GetDiagram()->AddShape(theShape);
-
+
fromShape->AddLine((wxLineShape *)theShape, toShape);
-
+
theShape->Show(true);
wxClientDC dc(theShape->GetCanvas());
// connected images
fromShape->Move(dc, fromShape->GetX(), fromShape->GetY());
toShape->Move(dc, toShape->GetX(), toShape->GetY());
-
+
shape = theShape;
deleteShape = false;
shape->SetBrush(shapeBrush);
shapeBrush = oldBrush;
shape->Draw(dc);
-
+
doc->Modify(true);
doc->UpdateAllViews();
}
shape->FormatText(dc, /* (char*) (const char*) */ myHandler->label);
shape->Draw(dc);
-
+
doc->Modify(true);
doc->UpdateAllViews();
}
{
switch (cmd)
{
- case OGLEDIT_CUT:
+ case wxID_CUT:
{
if (shape)
{
shape->SetBrush(shapeBrush);
shapeBrush = oldBrush;
shape->Draw(dc);
-
+
doc->Modify(true);
doc->UpdateAllViews();
}
shape->FormatText(dc, /* (char*) (const char*) */ myHandler->label);
shape->Draw(dc);
-
+
doc->Modify(true);
doc->UpdateAllViews();
}
// Remove each individual line connected to a shape by sending a command.
void DiagramCommand::RemoveLines(wxShape *shape)
{
- wxNode *node = shape->GetLines().GetFirst();
+ wxObjectList::compatibility_iterator node = shape->GetLines().GetFirst();
while (node)
{
wxLineShape *line = (wxLineShape *)node->GetData();
- doc->GetCommandProcessor()->Submit(new DiagramCommand(_T("Cut"), OGLEDIT_CUT, doc, NULL, 0.0, 0.0, line->Selected(), line));
-
+ doc->GetCommandProcessor()->Submit(new DiagramCommand(_T("Cut"), wxID_CUT, doc, NULL, 0.0, 0.0, line->Selected(), line));
+
node = shape->GetLines().GetFirst();
}
}
/*
* MyEvtHandler: an event handler class for all shapes
*/
-
+
void MyEvtHandler::OnLeftClick(double WXUNUSED(x), double WXUNUSED(y), int keys, int WXUNUSED(attachment))
{
wxClientDC dc(GetShape()->GetCanvas());
{
// Ensure no other shape is selected, to simplify Undo/Redo code
bool redraw = false;
- wxNode *node = GetShape()->GetCanvas()->GetDiagram()->GetShapeList()->GetFirst();
+ wxObjectList::compatibility_iterator node = GetShape()->GetCanvas()->GetDiagram()->GetShapeList()->GetFirst();
while (node)
{
wxShape *eachShape = (wxShape *)node->GetData();
// Force attachment to be zero for now. Eventually we can deal with
// the actual attachment point, e.g. a rectangle side if attachment mode is on.
attachment = 0;
-
+
wxClientDC dc(GetShape()->GetCanvas());
GetShape()->GetCanvas()->PrepareDC(dc);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetLogicalFunction(OGLRBLF);
dc.SetPen(dottedPen);
double xp, yp;
wxClientDC dc(GetShape()->GetCanvas());
GetShape()->GetCanvas()->PrepareDC(dc);
- wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
+ wxPen dottedPen(*wxBLACK, 1, wxDOT);
dc.SetLogicalFunction(OGLRBLF);
dc.SetPen(dottedPen);
double xp, yp;
// Check if we're on an object
int new_attachment;
wxShape *otherShape = canvas->FindFirstSensitiveShape(x, y, &new_attachment, OP_DRAG_RIGHT);
-
+
if (otherShape && !otherShape->IsKindOf(CLASSINFO(wxLineShape)))
{
canvas->view->GetDocument()->GetCommandProcessor()->Submit(
*/
#if wxUSE_PROLOGIO
-
+
bool MyDiagram::OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
{
wxDiagram::OnShapeSave(db, shape, expr);
expr.AssignAttributeValue(_T("label"), &label);
MyEvtHandler *handler = new MyEvtHandler(&shape, &shape, wxString(label));
shape.SetEventHandler(handler);
-
+
if (label)
delete[] label;
return true;
w = 60.0;
if (h == 0.0)
h = 60.0;
-
+
wxList *thePoints = new wxList;
wxRealPoint *point = new wxRealPoint(0.0, (-h/2.0));
thePoints->Append((wxObject*) point);