#endif
// For compilers that support precompilation, includes "wx.h".
-#include <wx/wxprec.h>
+#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in wx_setup.h!
#endif
-#include <wx/wxexpr.h>
#include "ogledit.h"
#include "doc.h"
#include "view.h"
#if wxUSE_STD_IOSTREAM
-#include <iostream.h>
+#include <ioswrap.h>
#endif
IMPLEMENT_DYNAMIC_CLASS(DiagramDocument, wxDocument)
}
#if wxUSE_STD_IOSTREAM
-ostream& DiagramDocument::SaveObject(ostream& stream)
+wxSTD ostream& DiagramDocument::SaveObject(wxSTD ostream& stream)
{
wxDocument::SaveObject(stream);
return stream;
}
-istream& DiagramDocument::LoadObject(istream& stream)
+wxSTD istream& DiagramDocument::LoadObject(wxSTD istream& stream)
{
wxDocument::LoadObject(stream);
wxOutputStream& DiagramDocument::SaveObject(wxOutputStream& stream)
{
+#if wxUSE_PROLOGIO
+
wxDocument::SaveObject(stream);
- char buf[400];
- (void) wxGetTempFileName("diag", buf);
+ wxChar buf[400];
+ (void) wxGetTempFileName(_T("diag"), buf);
diagram.SaveFile(buf);
wxTransferFileToStream(buf, stream);
wxRemoveFile(buf);
-
+
+#endif
return stream;
}
wxInputStream& DiagramDocument::LoadObject(wxInputStream& stream)
{
+#if wxUSE_PROLOGIO
wxDocument::LoadObject(stream);
-
- char buf[400];
- (void) wxGetTempFileName("diag", buf);
+ wxChar buf[400];
+ (void) wxGetTempFileName(_T("diag"), buf);
wxTransferStreamToFile(stream, buf);
diagram.DeleteAllShapes();
diagram.LoadFile(buf);
wxRemoveFile(buf);
+#endif
return stream;
}
* Implementation of drawing command
*/
-DiagramCommand::DiagramCommand(char *name, int command, DiagramDocument *ddoc, wxClassInfo *info, double xx, double yy,
+DiagramCommand::DiagramCommand(const wxString& name, int command, DiagramDocument *ddoc, wxClassInfo *info, double xx, double yy,
bool sel, wxShape *theShape, wxShape *fs, wxShape *ts):
wxCommand(TRUE, name)
{
deleteShape = FALSE;
}
-DiagramCommand::DiagramCommand(char *name, int command, DiagramDocument *ddoc, wxBrush *backgroundColour, wxShape *theShape):
+DiagramCommand::DiagramCommand(const wxString& name, int command, DiagramDocument *ddoc, wxBrush *backgroundColour, wxShape *theShape):
wxCommand(TRUE, name)
{
doc = ddoc;
shapePen = NULL;
}
-DiagramCommand::DiagramCommand(char *name, int command, DiagramDocument *ddoc, const wxString& lab, wxShape *theShape):
+DiagramCommand::DiagramCommand(const wxString& name, int command, DiagramDocument *ddoc, const wxString& lab, wxShape *theShape):
wxCommand(TRUE, name)
{
doc = ddoc;
}
case OGLEDIT_ADD_SHAPE:
{
- wxShape *theShape = NULL;
+ wxShape *theShape;
if (shape)
theShape = shape; // Saved from undoing the shape
else
{
theShape = (wxShape *)shapeInfo->CreateObject();
theShape->AssignNewIds();
- theShape->SetEventHandler(new MyEvtHandler(theShape, theShape, wxString("")));
+ theShape->SetEventHandler(new MyEvtHandler(theShape, theShape, wxEmptyString));
theShape->SetCentreResize(FALSE);
theShape->SetPen(wxBLACK_PEN);
theShape->SetBrush(wxCYAN_BRUSH);
}
case OGLEDIT_ADD_LINE:
{
- wxShape *theShape = NULL;
+ wxShape *theShape;
if (shape)
theShape = shape; // Saved from undoing the line
else
{
theShape = (wxShape *)shapeInfo->CreateObject();
theShape->AssignNewIds();
- theShape->SetEventHandler(new MyEvtHandler(theShape, theShape, wxString("")));
+ theShape->SetEventHandler(new MyEvtHandler(theShape, theShape, wxEmptyString));
theShape->SetPen(wxBLACK_PEN);
theShape->SetBrush(wxRED_BRUSH);
// Yes, you can have more than 2 control points, in which case
// it becomes a multi-segment line.
lineShape->MakeLineControlPoints(2);
- lineShape->AddArrow(ARROW_ARROW, ARROW_POSITION_END, 10.0, 0.0, "Normal arrowhead");
+ lineShape->AddArrow(ARROW_ARROW, ARROW_POSITION_END, 10.0, 0.0, _T("Normal arrowhead"));
}
doc->GetDiagram()->AddShape(theShape);
wxClientDC dc(shape->GetCanvas());
shape->GetCanvas()->PrepareDC(dc);
- shape->FormatText(dc, (char*) (const char*) myHandler->label);
+ shape->FormatText(dc, /* (char*) (const char*) */ myHandler->label);
shape->Draw(dc);
doc->Modify(TRUE);
wxClientDC dc(shape->GetCanvas());
shape->GetCanvas()->PrepareDC(dc);
- shape->FormatText(dc, (char*) (const char*) myHandler->label);
+ shape->FormatText(dc, /* (char*) (const char*) */ myHandler->label);
shape->Draw(dc);
doc->Modify(TRUE);
// Remove each individual line connected to a shape by sending a command.
void DiagramCommand::RemoveLines(wxShape *shape)
{
- wxNode *node = shape->GetLines().First();
+ wxNode *node = shape->GetLines().GetFirst();
while (node)
{
- wxLineShape *line = (wxLineShape *)node->Data();
- doc->GetCommandProcessor()->Submit(new DiagramCommand("Cut", OGLEDIT_CUT, doc, NULL, 0.0, 0.0, line->Selected(), line));
+ wxLineShape *line = (wxLineShape *)node->GetData();
+ doc->GetCommandProcessor()->Submit(new DiagramCommand(_T("Cut"), OGLEDIT_CUT, doc, NULL, 0.0, 0.0, line->Selected(), line));
- node = shape->GetLines().First();
+ node = shape->GetLines().GetFirst();
}
}
* MyEvtHandler: an event handler class for all shapes
*/
-void MyEvtHandler::OnLeftClick(double x, double y, int keys, int attachment)
+void MyEvtHandler::OnLeftClick(double WXUNUSED(x), double WXUNUSED(y), int keys, int WXUNUSED(attachment))
{
wxClientDC dc(GetShape()->GetCanvas());
GetShape()->GetCanvas()->PrepareDC(dc);
{
// Ensure no other shape is selected, to simplify Undo/Redo code
bool redraw = FALSE;
- wxNode *node = GetShape()->GetCanvas()->GetDiagram()->GetShapeList()->First();
+ wxNode *node = GetShape()->GetCanvas()->GetDiagram()->GetShapeList()->GetFirst();
while (node)
{
- wxShape *eachShape = (wxShape *)node->Data();
+ wxShape *eachShape = (wxShape *)node->GetData();
if (eachShape->GetParent() == NULL)
{
if (eachShape->Selected())
redraw = TRUE;
}
}
- node = node->Next();
+ node = node->GetNext();
}
GetShape()->Select(TRUE, &dc);
if (redraw)
* Implement connection of two shapes by right-dragging between them.
*/
-void MyEvtHandler::OnBeginDragRight(double x, double y, int keys, int attachment)
+void MyEvtHandler::OnBeginDragRight(double x, double y, int WXUNUSED(keys), int attachment)
{
// 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.
GetShape()->GetCanvas()->CaptureMouse();
}
-void MyEvtHandler::OnDragRight(bool draw, double x, double y, int keys, int attachment)
+void MyEvtHandler::OnDragRight(bool WXUNUSED(draw), double x, double y, int WXUNUSED(keys), int attachment)
{
// Force attachment to be zero for now
attachment = 0;
dc.DrawLine((long) xp, (long) yp, (long) x, (long) y);
}
-void MyEvtHandler::OnEndDragRight(double x, double y, int keys, int attachment)
+void MyEvtHandler::OnEndDragRight(double x, double y, int WXUNUSED(keys), int WXUNUSED(attachment))
{
GetShape()->GetCanvas()->ReleaseMouse();
MyCanvas *canvas = (MyCanvas *)GetShape()->GetCanvas();
if (otherShape && !otherShape->IsKindOf(CLASSINFO(wxLineShape)))
{
canvas->view->GetDocument()->GetCommandProcessor()->Submit(
- new DiagramCommand("wxLineShape", OGLEDIT_ADD_LINE, (DiagramDocument *)canvas->view->GetDocument(), CLASSINFO(wxLineShape),
+ new DiagramCommand(_T("wxLineShape"), OGLEDIT_ADD_LINE, (DiagramDocument *)canvas->view->GetDocument(), CLASSINFO(wxLineShape),
0.0, 0.0, FALSE, NULL, GetShape(), otherShape));
}
}
-void MyEvtHandler::OnEndSize(double x, double y)
+void MyEvtHandler::OnEndSize(double WXUNUSED(x), double WXUNUSED(y))
{
wxClientDC dc(GetShape()->GetCanvas());
GetShape()->GetCanvas()->PrepareDC(dc);
- GetShape()->FormatText(dc, (char*) (const char*) label);
+ GetShape()->FormatText(dc, /* (char*) (const char*) */ label);
}
/*
* Diagram
*/
+
+#if wxUSE_PROLOGIO
bool MyDiagram::OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
{
wxDiagram::OnShapeSave(db, shape, expr);
MyEvtHandler *handler = (MyEvtHandler *)shape.GetEventHandler();
- expr.AddAttributeValueString("label", handler->label);
+ expr.AddAttributeValueString(_T("label"), handler->label);
return TRUE;
}
bool MyDiagram::OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
{
wxDiagram::OnShapeLoad(db, shape, expr);
- char *label = NULL;
- expr.AssignAttributeValue("label", &label);
+ wxChar *label = NULL;
+ expr.AssignAttributeValue(_T("label"), &label);
MyEvtHandler *handler = new MyEvtHandler(&shape, &shape, wxString(label));
shape.SetEventHandler(handler);
return TRUE;
}
+#endif
+
/*
* New shapes
*/