#include <wx/wxexpr.h>
#endif
-#if USE_IOSTREAMH
+#if wxUSE_IOSTREAMH
#include <iostream.h>
#else
#include <iostream>
m_snapToGrid = snap;
}
-void wxDiagram::SetGridSpacing(float spacing)
+void wxDiagram::SetGridSpacing(double spacing)
{
m_gridSpacing = spacing;
}
-void wxDiagram::Snap(float *x, float *y)
+void wxDiagram::Snap(double *x, double *y)
{
if (m_snapToGrid)
{
}
}
-void wxDiagram::DrawOutline(wxDC& dc, float x1, float y1, float x2, float y2)
+void wxDiagram::DrawOutline(wxDC& dc, double x1, double y1, double x2, double y2)
{
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
dc.SetPen(dottedPen);
{
wxBeginBusyCursor();
- wxExprDatabase database(PrologInteger, "id");
+ wxExprDatabase database(wxExprInteger, "id");
if (!database.Read(filename))
{
wxEndBusyCursor();
shape->Show(TRUE);
OnShapeLoad(database, *shape, *clause);
+ shape->SetCanvas(GetCanvas());
long image_to = -1; long image_from = -1;
clause->GetAttributeValue("to", image_to);
bool wxDiagram::OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
{
- shape.WritePrologAttributes(&expr);
+ shape.WriteAttributes(&expr);
db.Append(&expr);
if (shape.IsKindOf(CLASSINFO(wxCompositeShape)))
bool wxDiagram::OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
{
- shape.ReadPrologAttributes(&expr);
+ shape.ReadAttributes(&expr);
return TRUE;
}
m_diagramCanvas = can;
}
+// Find a shape by its id
+wxShape* wxDiagram::FindShape(long id) const
+{
+ wxNode* node = GetShapeList()->First();
+ while (node)
+ {
+ wxShape* shape = (wxShape*) node->Data();
+ if (shape->GetId() == id)
+ return shape;
+ node = node->Next();
+ }
+ return NULL;
+}