X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0fc1a7137cccc829a34b3527c768db7d7ac83437..23e09f1115536813561fded9bd17ee197cf010c7:/utils/ogl/src/ogldiag.cpp diff --git a/utils/ogl/src/ogldiag.cpp b/utils/ogl/src/ogldiag.cpp index 198b3073d4..d6c3f3672e 100644 --- a/utils/ogl/src/ogldiag.cpp +++ b/utils/ogl/src/ogldiag.cpp @@ -28,7 +28,7 @@ #include #endif -#if USE_IOSTREAMH +#if wxUSE_IOSTREAMH #include #else #include @@ -71,12 +71,12 @@ void wxDiagram::SetSnapToGrid(bool snap) 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) { @@ -181,7 +181,7 @@ void wxDiagram::ShowAll(bool show) } } -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); @@ -300,7 +300,7 @@ bool wxDiagram::LoadFile(const wxString& filename) { wxBeginBusyCursor(); - wxExprDatabase database(PrologInteger, "id"); + wxExprDatabase database(wxExprInteger, "id"); if (!database.Read(filename)) { wxEndBusyCursor(); @@ -400,6 +400,7 @@ void wxDiagram::ReadLines(wxExprDatabase& database) shape->Show(TRUE); OnShapeLoad(database, *shape, *clause); + shape->SetCanvas(GetCanvas()); long image_to = -1; long image_from = -1; clause->GetAttributeValue("to", image_to); @@ -536,7 +537,7 @@ bool wxDiagram::OnDatabaseSave(wxExprDatabase& db) bool wxDiagram::OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr) { - shape.WritePrologAttributes(&expr); + shape.WriteAttributes(&expr); db.Append(&expr); if (shape.IsKindOf(CLASSINFO(wxCompositeShape))) @@ -556,7 +557,7 @@ bool wxDiagram::OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr) bool wxDiagram::OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr) { - shape.ReadPrologAttributes(&expr); + shape.ReadAttributes(&expr); return TRUE; } @@ -577,4 +578,17 @@ void wxDiagram::SetCanvas(wxShapeCanvas *can) 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; +}