#include <wx/wx.h>
#endif
-#ifdef PROLOGIO
#include <wx/wxexpr.h>
-#endif
#if wxUSE_IOSTREAMH
#include <iostream.h>
if (m_shapeList)
{
if (GetCanvas())
- GetCanvas()->SetCursor(wxHOURGLASS_CURSOR);
+ GetCanvas()->SetCursor(* wxHOURGLASS_CURSOR);
wxNode *current = m_shapeList->First();
while (current)
current = current->Next();
}
if (GetCanvas())
- GetCanvas()->SetCursor(wxSTANDARD_CURSOR);
+ GetCanvas()->SetCursor(* wxSTANDARD_CURSOR);
}
}
wxPoint points[5];
- points[0].x = x1;
- points[0].y = y1;
+ points[0].x = (int) x1;
+ points[0].y = (int) y1;
- points[1].x = x2;
- points[1].y = y1;
+ points[1].x = (int) x2;
+ points[1].y = (int) y1;
- points[2].x = x2;
- points[2].y = y2;
+ points[2].x = (int) x2;
+ points[2].y = (int) y2;
- points[3].x = x1;
- points[3].y = y2;
+ points[3].x = (int) x1;
+ points[3].y = (int) y2;
- points[4].x = x1;
- points[4].y = y1;
+ points[4].x = (int) x1;
+ points[4].y = (int) y1;
dc.DrawLines(5, points);
}
bool wxDiagram::SaveFile(const wxString& filename)
{
wxBeginBusyCursor();
-
+
wxExprDatabase *database = new wxExprDatabase;
// First write the diagram type
wxExpr *header = new wxExpr("diagram");
OnHeaderSave(*database, *header);
-
+
database->Append(header);
-
+
wxNode *node = m_shapeList->First();
while (node)
{
wxShape *shape = (wxShape *)node->Data();
-
+
if (!shape->IsKindOf(CLASSINFO(wxControlPoint)))
{
wxExpr *expr = NULL;
node = node->Next();
}
OnDatabaseSave(*database);
-
+
char tempFile[400];
wxGetTempFileName("diag", tempFile);
- ofstream stream(tempFile);
- if (stream.bad())
+ FILE* file = fopen(tempFile, "w");
+ if (! file)
{
wxEndBusyCursor();
delete database;
return FALSE;
}
-
- database->Write(stream);
- stream.close();
+
+ database->Write(file);
+ fclose(file);
delete database;
/*
bool wxDiagram::LoadFile(const wxString& filename)
{
wxBeginBusyCursor();
-
+
wxExprDatabase database(wxExprInteger, "id");
if (!database.Read(filename))
{
wxEndBusyCursor();
return FALSE;
}
-
+
DeleteAllShapes();
database.BeginFind();
ReadNodes(database);
ReadContainerGeometry(database);
ReadLines(database);
-
+
OnDatabaseLoad(database);
wxEndBusyCursor();
{
wxShape *shape = (wxShape *)classInfo->CreateObject();
OnShapeLoad(database, *shape, *clause);
-
+
shape->SetCanvas(GetCanvas());
shape->Show(TRUE);
}
if (type)
delete[] type;
-
+
clause = database.FindClauseByFunctor("shape");
}
return;