Unicode compilation fixes for OGL (patch #791967)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23065 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -90,8 +90,8 @@ 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);
|
||||
|
||||
@@ -109,8 +109,8 @@ 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);
|
||||
|
||||
@@ -128,7 +128,7 @@ wxInputStream& DiagramDocument::LoadObject(wxInputStream& 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)
|
||||
{
|
||||
@@ -146,7 +146,7 @@ DiagramCommand::DiagramCommand(char *name, int command, DiagramDocument *ddoc, w
|
||||
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;
|
||||
@@ -163,7 +163,7 @@ DiagramCommand::DiagramCommand(char *name, int command, DiagramDocument *ddoc, w
|
||||
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;
|
||||
@@ -229,7 +229,7 @@ bool DiagramCommand::Do(void)
|
||||
{
|
||||
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);
|
||||
@@ -260,7 +260,7 @@ bool DiagramCommand::Do(void)
|
||||
{
|
||||
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);
|
||||
|
||||
@@ -269,7 +269,7 @@ bool DiagramCommand::Do(void)
|
||||
// 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);
|
||||
@@ -323,7 +323,7 @@ bool DiagramCommand::Do(void)
|
||||
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);
|
||||
@@ -408,7 +408,7 @@ bool DiagramCommand::Undo(void)
|
||||
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);
|
||||
@@ -428,7 +428,7 @@ void DiagramCommand::RemoveLines(wxShape *shape)
|
||||
while (node)
|
||||
{
|
||||
wxLineShape *line = (wxLineShape *)node->Data();
|
||||
doc->GetCommandProcessor()->Submit(new DiagramCommand("Cut", OGLEDIT_CUT, doc, NULL, 0.0, 0.0, line->Selected(), line));
|
||||
doc->GetCommandProcessor()->Submit(new DiagramCommand(_T("Cut"), OGLEDIT_CUT, doc, NULL, 0.0, 0.0, line->Selected(), line));
|
||||
|
||||
node = shape->GetLines().First();
|
||||
}
|
||||
@@ -438,7 +438,7 @@ void DiagramCommand::RemoveLines(wxShape *shape)
|
||||
* 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);
|
||||
@@ -488,7 +488,7 @@ void MyEvtHandler::OnLeftClick(double x, double y, int keys, int attachment)
|
||||
* 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.
|
||||
@@ -506,7 +506,7 @@ void MyEvtHandler::OnBeginDragRight(double x, double y, int keys, int attachment
|
||||
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;
|
||||
@@ -522,7 +522,7 @@ void MyEvtHandler::OnDragRight(bool draw, double x, double y, int keys, int atta
|
||||
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();
|
||||
@@ -534,17 +534,17 @@ void MyEvtHandler::OnEndDragRight(double x, double y, int keys, int attachment)
|
||||
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);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -557,15 +557,15 @@ 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);
|
||||
|
||||
|
@@ -76,7 +76,7 @@ class MyEvtHandler: public wxShapeEvtHandler
|
||||
{
|
||||
public:
|
||||
wxString label;
|
||||
MyEvtHandler(wxShapeEvtHandler *prev = NULL, wxShape *shape = NULL, const wxString& lab = ""):wxShapeEvtHandler(prev, shape)
|
||||
MyEvtHandler(wxShapeEvtHandler *prev = NULL, wxShape *shape = NULL, const wxString& lab = wxEmptyString):wxShapeEvtHandler(prev, shape)
|
||||
{
|
||||
label = lab;
|
||||
}
|
||||
@@ -163,12 +163,12 @@ class DiagramCommand: public wxCommand
|
||||
wxString shapeLabel;
|
||||
public:
|
||||
// Multi-purpose constructor for creating, deleting shapes
|
||||
DiagramCommand(char *name, int cmd, DiagramDocument *ddoc, wxClassInfo *shapeInfo = NULL,
|
||||
DiagramCommand(const wxString& name, int cmd, DiagramDocument *ddoc, wxClassInfo *shapeInfo = NULL,
|
||||
double x = 0.0, double y = 0.0, bool sel = FALSE, wxShape *theShape = NULL, wxShape *fs = NULL, wxShape *ts = NULL);
|
||||
|
||||
// Property-changing command constructors
|
||||
DiagramCommand(char *name, int cmd, DiagramDocument *ddoc, wxBrush *backgroundColour, wxShape *theShape);
|
||||
DiagramCommand(char *name, int cmd, DiagramDocument *ddoc, const wxString& lab, wxShape *theShape);
|
||||
DiagramCommand(const wxString& name, int cmd, DiagramDocument *ddoc, wxBrush *backgroundColour, wxShape *theShape);
|
||||
DiagramCommand(const wxString& name, int cmd, DiagramDocument *ddoc, const wxString& lab, wxShape *theShape);
|
||||
|
||||
~DiagramCommand(void);
|
||||
|
||||
|
@@ -57,7 +57,7 @@ bool MyApp::OnInit(void)
|
||||
myDocManager = new wxDocManager;
|
||||
|
||||
//// Create a template relating drawing documents to their views
|
||||
(void) new wxDocTemplate(myDocManager, "Diagram", "*.dia", "", "dia", "Diagram Doc", "Diagram View",
|
||||
(void) new wxDocTemplate(myDocManager, _T("Diagram"), _T("*.dia"), wxEmptyString, _T("dia"), _T("Diagram Doc"), _T("Diagram View"),
|
||||
CLASSINFO(DiagramDocument), CLASSINFO(DiagramView));
|
||||
|
||||
// If we've only got one window, we only get to edit
|
||||
@@ -65,7 +65,7 @@ bool MyApp::OnInit(void)
|
||||
myDocManager->SetMaxDocsOpen(1);
|
||||
|
||||
//// Create the main frame window
|
||||
frame = new MyFrame(myDocManager, NULL, "OGLEdit Demo", wxPoint(0, 0), wxSize(500, 400), wxDEFAULT_FRAME_STYLE);
|
||||
frame = new MyFrame(myDocManager, NULL, _T("OGLEdit Demo"), wxPoint(0, 0), wxSize(500, 400), wxDEFAULT_FRAME_STYLE);
|
||||
|
||||
//// Give it an icon
|
||||
frame->SetIcon(wxICON(ogl));
|
||||
@@ -74,47 +74,47 @@ bool MyApp::OnInit(void)
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
wxMenu *edit_menu = NULL;
|
||||
|
||||
file_menu->Append(wxID_NEW, "&New...");
|
||||
file_menu->Append(wxID_OPEN, "&Open...");
|
||||
file_menu->Append(wxID_NEW, _T("&New..."));
|
||||
file_menu->Append(wxID_OPEN, _T("&Open..."));
|
||||
|
||||
file_menu->Append(wxID_CLOSE, "&Close");
|
||||
file_menu->Append(wxID_SAVE, "&Save");
|
||||
file_menu->Append(wxID_SAVEAS, "Save &As...");
|
||||
file_menu->Append(wxID_CLOSE, _T("&Close"));
|
||||
file_menu->Append(wxID_SAVE, _T("&Save"));
|
||||
file_menu->Append(wxID_SAVEAS, _T("Save &As..."));
|
||||
file_menu->AppendSeparator();
|
||||
file_menu->Append(wxID_PRINT, "&Print...");
|
||||
file_menu->Append(wxID_PRINT_SETUP, "Print &Setup...");
|
||||
file_menu->Append(wxID_PREVIEW, "Print Pre&view");
|
||||
file_menu->Append(wxID_PRINT, _T("&Print..."));
|
||||
file_menu->Append(wxID_PRINT_SETUP, _T("Print &Setup..."));
|
||||
file_menu->Append(wxID_PREVIEW, _T("Print Pre&view"));
|
||||
|
||||
edit_menu = new wxMenu;
|
||||
edit_menu->Append(wxID_UNDO, "&Undo");
|
||||
edit_menu->Append(wxID_REDO, "&Redo");
|
||||
edit_menu->Append(wxID_UNDO, _T("&Undo"));
|
||||
edit_menu->Append(wxID_REDO, _T("&Redo"));
|
||||
edit_menu->AppendSeparator();
|
||||
edit_menu->Append(OGLEDIT_CUT, "&Cut");
|
||||
edit_menu->Append(OGLEDIT_CUT, _T("&Cut"));
|
||||
edit_menu->AppendSeparator();
|
||||
edit_menu->Append(OGLEDIT_CHANGE_BACKGROUND_COLOUR, "Change &background colour");
|
||||
edit_menu->Append(OGLEDIT_EDIT_LABEL, "Edit &label");
|
||||
edit_menu->Append(OGLEDIT_CHANGE_BACKGROUND_COLOUR, _T("Change &background colour"));
|
||||
edit_menu->Append(OGLEDIT_EDIT_LABEL, _T("Edit &label"));
|
||||
|
||||
frame->editMenu = edit_menu;
|
||||
|
||||
file_menu->AppendSeparator();
|
||||
file_menu->Append(wxID_EXIT, "E&xit");
|
||||
file_menu->Append(wxID_EXIT, _T("E&xit"));
|
||||
|
||||
// A nice touch: a history of files visited. Use this menu.
|
||||
myDocManager->FileHistoryUseMenu(file_menu);
|
||||
|
||||
wxMenu *help_menu = new wxMenu;
|
||||
help_menu->Append(OGLEDIT_ABOUT, "&About");
|
||||
help_menu->Append(OGLEDIT_ABOUT, _T("&About"));
|
||||
|
||||
wxMenuBar *menu_bar = new wxMenuBar;
|
||||
|
||||
menu_bar->Append(file_menu, "&File");
|
||||
menu_bar->Append(file_menu, _T("&File"));
|
||||
if (edit_menu)
|
||||
menu_bar->Append(edit_menu, "&Edit");
|
||||
menu_bar->Append(help_menu, "&Help");
|
||||
menu_bar->Append(edit_menu, _T("&Edit"));
|
||||
menu_bar->Append(help_menu, _T("&Help"));
|
||||
|
||||
frame->canvas = frame->CreateCanvas(NULL, frame);
|
||||
frame->palette = wxGetApp().CreatePalette(frame);
|
||||
myDocManager->CreateDocument("", wxDOC_NEW);
|
||||
myDocManager->CreateDocument(wxEmptyString, wxDOC_NEW);
|
||||
|
||||
//// Associate the menu bar with the frame
|
||||
frame->SetMenuBar(menu_bar);
|
||||
@@ -155,7 +155,7 @@ MyFrame::MyFrame(wxDocManager *manager, wxFrame *frame, const wxString& title,
|
||||
editMenu = NULL;
|
||||
}
|
||||
|
||||
void MyFrame::OnSize(wxSizeEvent& event)
|
||||
void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event))
|
||||
{
|
||||
if (canvas && palette)
|
||||
{
|
||||
@@ -185,9 +185,9 @@ void MyFrame::OnCloseWindow(wxCloseEvent& event)
|
||||
}
|
||||
|
||||
// Intercept menu commands
|
||||
void MyFrame::OnAbout(wxCommandEvent& event)
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
(void)wxMessageBox("OGLEdit Demo\nTo draw a shape, select a shape on the toolbar and left-click on the canvas.\nTo draw a line, right-drag between shapes.\nFor further details, see the OGL manual.\n (c) Julian Smart 1996", "About OGLEdit");
|
||||
(void)wxMessageBox(_T("OGLEdit Demo\nTo draw a shape, select a shape on the toolbar and left-click on the canvas.\nTo draw a line, right-drag between shapes.\nFor further details, see the OGL manual.\n (c) Julian Smart 1996"), _T("About OGLEdit"));
|
||||
}
|
||||
|
||||
// Creates a canvas. Called by OnInit as a child of the main window
|
||||
|
@@ -75,7 +75,7 @@ bool EditorToolPalette::OnLeftClick(int toolIndex, bool toggled)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void EditorToolPalette::OnMouseEnter(int toolIndex)
|
||||
void EditorToolPalette::OnMouseEnter(int WXUNUSED(toolIndex))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -88,11 +88,11 @@ EditorToolPalette *MyApp::CreatePalette(wxFrame *parent)
|
||||
{
|
||||
// Load palette bitmaps
|
||||
#ifdef __WXMSW__
|
||||
wxBitmap PaletteTool1("TOOL1");
|
||||
wxBitmap PaletteTool2("TOOL2");
|
||||
wxBitmap PaletteTool3("TOOL3");
|
||||
wxBitmap PaletteTool4("TOOL4");
|
||||
wxBitmap PaletteArrow("ARROWTOOL");
|
||||
wxBitmap PaletteTool1(_T("TOOL1"));
|
||||
wxBitmap PaletteTool2(_T("TOOL2"));
|
||||
wxBitmap PaletteTool3(_T("TOOL3"));
|
||||
wxBitmap PaletteTool4(_T("TOOL4"));
|
||||
wxBitmap PaletteArrow(_T("ARROWTOOL"));
|
||||
#elif defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXMAC__)
|
||||
wxBitmap PaletteTool1(tool1_xpm);
|
||||
wxBitmap PaletteTool2(tool2_xpm);
|
||||
@@ -106,11 +106,11 @@ EditorToolPalette *MyApp::CreatePalette(wxFrame *parent)
|
||||
palette->SetMargins(2, 2);
|
||||
palette->SetToolBitmapSize(wxSize(22, 22));
|
||||
|
||||
palette->AddTool(PALETTE_ARROW, PaletteArrow, wxNullBitmap, TRUE, 0, -1, NULL, "Pointer");
|
||||
palette->AddTool(PALETTE_TOOL1, PaletteTool1, wxNullBitmap, TRUE, 0, -1, NULL, "Tool 1");
|
||||
palette->AddTool(PALETTE_TOOL2, PaletteTool2, wxNullBitmap, TRUE, 0, -1, NULL, "Tool 2");
|
||||
palette->AddTool(PALETTE_TOOL3, PaletteTool3, wxNullBitmap, TRUE, 0, -1, NULL, "Tool 3");
|
||||
palette->AddTool(PALETTE_TOOL4, PaletteTool4, wxNullBitmap, TRUE, 0, -1, NULL, "Tool 4");
|
||||
palette->AddTool(PALETTE_ARROW, PaletteArrow, wxNullBitmap, TRUE, 0, -1, NULL, _T("Pointer"));
|
||||
palette->AddTool(PALETTE_TOOL1, PaletteTool1, wxNullBitmap, TRUE, 0, -1, NULL, _T("Tool 1"));
|
||||
palette->AddTool(PALETTE_TOOL2, PaletteTool2, wxNullBitmap, TRUE, 0, -1, NULL, _T("Tool 2"));
|
||||
palette->AddTool(PALETTE_TOOL3, PaletteTool3, wxNullBitmap, TRUE, 0, -1, NULL, _T("Tool 3"));
|
||||
palette->AddTool(PALETTE_TOOL4, PaletteTool4, wxNullBitmap, TRUE, 0, -1, NULL, _T("Tool 4"));
|
||||
|
||||
palette->Realize();
|
||||
|
||||
|
@@ -29,11 +29,14 @@
|
||||
// TODO for wxWin: wxToolBar95 cannot be moved to a non-0,0 position!
|
||||
// Needs to have a parent window...
|
||||
// So use a simple toolbar at present.
|
||||
#if 0 // def __WXGTK__
|
||||
// ABX: Simple toolbar is not available in default compilation
|
||||
// so I use wxToolBar anyway
|
||||
// #if 0 // def __WXGTK__
|
||||
// #define TOOLPALETTECLASS wxToolBar
|
||||
// #else
|
||||
// #define TOOLPALETTECLASS wxToolBarSimple
|
||||
// #endif
|
||||
#define TOOLPALETTECLASS wxToolBar
|
||||
#else
|
||||
#define TOOLPALETTECLASS wxToolBarSimple
|
||||
#endif
|
||||
|
||||
class EditorToolPalette: public TOOLPALETTECLASS
|
||||
{
|
||||
|
@@ -45,7 +45,7 @@ END_EVENT_TABLE()
|
||||
|
||||
// What to do when a view is created. Creates actual
|
||||
// windows for displaying the view.
|
||||
bool DiagramView::OnCreate(wxDocument *doc, long flags)
|
||||
bool DiagramView::OnCreate(wxDocument *doc, long WXUNUSED(flags))
|
||||
{
|
||||
frame = GetMainFrame();
|
||||
canvas = GetMainFrame()->canvas;
|
||||
@@ -105,16 +105,15 @@ void DiagramView::OnDraw(wxDC *dc)
|
||||
|
||||
float posX, posY;
|
||||
// Calculate the position on the DC for centring the graphic
|
||||
if (CENTER == TRUE) // center the drawing
|
||||
{
|
||||
#if 0
|
||||
// center the drawing
|
||||
posX = (float) ((w - (200 * actualScale)) / 2.0);
|
||||
posY = (float) ((h - (200 * actualScale)) / 2.0);
|
||||
}
|
||||
else // Use defined presets
|
||||
{
|
||||
#else
|
||||
// Use defined presets
|
||||
posX = 10;
|
||||
posY = 35;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Set the scale and origin
|
||||
@@ -127,7 +126,7 @@ void DiagramView::OnDraw(wxDC *dc)
|
||||
wxDiagram *diagram_p=((DiagramDocument*)GetDocument())->GetDiagram(); // Get the current diagram
|
||||
if (diagram_p->GetShapeList())
|
||||
{
|
||||
wxCursor *old_cursor = NULL;
|
||||
/* wxCursor *old_cursor = NULL; */
|
||||
wxNode *current = diagram_p->GetShapeList()->First();
|
||||
|
||||
while (current) // Loop through the entire list of shapes
|
||||
@@ -143,14 +142,14 @@ void DiagramView::OnDraw(wxDC *dc)
|
||||
dc->EndDrawing(); // Allows optimization of drawing code under MS Windows.
|
||||
}
|
||||
|
||||
void DiagramView::OnUpdate(wxView *sender, wxObject *hint)
|
||||
void DiagramView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint))
|
||||
{
|
||||
if (canvas)
|
||||
canvas->Refresh();
|
||||
}
|
||||
|
||||
// Clean up windows used for displaying the view.
|
||||
bool DiagramView::OnClose(bool deleteWindow)
|
||||
bool DiagramView::OnClose(bool WXUNUSED(deleteWindow))
|
||||
{
|
||||
if (!GetDocument()->Close())
|
||||
return FALSE;
|
||||
@@ -192,16 +191,16 @@ wxShape *DiagramView::FindSelectedShape(void)
|
||||
return theShape;
|
||||
}
|
||||
|
||||
void DiagramView::OnCut(wxCommandEvent& event)
|
||||
void DiagramView::OnCut(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
DiagramDocument *doc = (DiagramDocument *)GetDocument();
|
||||
|
||||
wxShape *theShape = FindSelectedShape();
|
||||
if (theShape)
|
||||
doc->GetCommandProcessor()->Submit(new DiagramCommand("Cut", OGLEDIT_CUT, doc, NULL, 0.0, 0.0, TRUE, theShape));
|
||||
doc->GetCommandProcessor()->Submit(new DiagramCommand(_T("Cut"), OGLEDIT_CUT, doc, NULL, 0.0, 0.0, TRUE, theShape));
|
||||
}
|
||||
|
||||
void DiagramView::OnChangeBackgroundColour(wxCommandEvent& event)
|
||||
void DiagramView::OnChangeBackgroundColour(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
DiagramDocument *doc = (DiagramDocument *)GetDocument();
|
||||
|
||||
@@ -223,18 +222,18 @@ void DiagramView::OnChangeBackgroundColour(wxCommandEvent& event)
|
||||
dialog->Close();
|
||||
|
||||
if (theBrush)
|
||||
doc->GetCommandProcessor()->Submit(new DiagramCommand("Change colour", OGLEDIT_CHANGE_BACKGROUND_COLOUR, doc,
|
||||
doc->GetCommandProcessor()->Submit(new DiagramCommand(_T("Change colour"), OGLEDIT_CHANGE_BACKGROUND_COLOUR, doc,
|
||||
theBrush, theShape));
|
||||
}
|
||||
}
|
||||
|
||||
void DiagramView::OnEditLabel(wxCommandEvent& event)
|
||||
void DiagramView::OnEditLabel(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxShape *theShape = FindSelectedShape();
|
||||
if (theShape)
|
||||
{
|
||||
wxString newLabel = wxGetTextFromUser("Enter new label", "Shape Label", ((MyEvtHandler *)theShape->GetEventHandler())->label);
|
||||
GetDocument()->GetCommandProcessor()->Submit(new DiagramCommand("Edit label", OGLEDIT_EDIT_LABEL, (DiagramDocument*) GetDocument(), newLabel, theShape));
|
||||
wxString newLabel = wxGetTextFromUser(_T("Enter new label"), _T("Shape Label"), ((MyEvtHandler *)theShape->GetEventHandler())->label);
|
||||
GetDocument()->GetCommandProcessor()->Submit(new DiagramCommand(_T("Edit label"), OGLEDIT_EDIT_LABEL, (DiagramDocument*) GetDocument(), newLabel, theShape));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,7 +260,7 @@ MyCanvas::~MyCanvas(void)
|
||||
{
|
||||
}
|
||||
|
||||
void MyCanvas::OnLeftClick(double x, double y, int keys)
|
||||
void MyCanvas::OnLeftClick(double x, double y, int WXUNUSED(keys))
|
||||
{
|
||||
EditorToolPalette *palette = wxGetApp().frame->palette;
|
||||
wxClassInfo *info = NULL;
|
||||
@@ -293,36 +292,36 @@ void MyCanvas::OnLeftClick(double x, double y, int keys)
|
||||
if (info)
|
||||
{
|
||||
view->GetDocument()->GetCommandProcessor()->Submit(
|
||||
new DiagramCommand((char*) info->GetClassName(), OGLEDIT_ADD_SHAPE, (DiagramDocument *)view->GetDocument(), info,
|
||||
new DiagramCommand( info->GetClassName(), OGLEDIT_ADD_SHAPE, (DiagramDocument *)view->GetDocument(), info,
|
||||
x, y));
|
||||
}
|
||||
}
|
||||
|
||||
void MyCanvas::OnRightClick(double x, double y, int keys)
|
||||
void MyCanvas::OnRightClick(double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys))
|
||||
{
|
||||
}
|
||||
|
||||
void MyCanvas::OnDragLeft(bool draw, double x, double y, int keys)
|
||||
void MyCanvas::OnDragLeft(bool WXUNUSED(draw), double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys))
|
||||
{
|
||||
}
|
||||
|
||||
void MyCanvas::OnBeginDragLeft(double x, double y, int keys)
|
||||
void MyCanvas::OnBeginDragLeft(double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys))
|
||||
{
|
||||
}
|
||||
|
||||
void MyCanvas::OnEndDragLeft(double x, double y, int keys)
|
||||
void MyCanvas::OnEndDragLeft(double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys))
|
||||
{
|
||||
}
|
||||
|
||||
void MyCanvas::OnDragRight(bool draw, double x, double y, int keys)
|
||||
void MyCanvas::OnDragRight(bool WXUNUSED(draw), double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys))
|
||||
{
|
||||
}
|
||||
|
||||
void MyCanvas::OnBeginDragRight(double x, double y, int keys)
|
||||
void MyCanvas::OnBeginDragRight(double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys))
|
||||
{
|
||||
}
|
||||
|
||||
void MyCanvas::OnEndDragRight(double x, double y, int keys)
|
||||
void MyCanvas::OnEndDragRight(double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys))
|
||||
{
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user