-1->wxID_ANY, TRUE->true, FALSE->false and tabs replacements. Correct help system in non MSW builds of OGL-Studio sample.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27708 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-06-09 16:42:34 +00:00
parent 45b8a2566d
commit 2ba06d5a8c
50 changed files with 835 additions and 818 deletions

View File

@@ -6,7 +6,7 @@
// Created: 12/07/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -49,7 +49,7 @@ DiagramDocument::~DiagramDocument(void)
bool DiagramDocument::OnCloseDocument(void)
{
diagram.DeleteAllShapes();
return TRUE;
return true;
}
#if wxUSE_STD_IOSTREAM
@@ -130,7 +130,7 @@ wxInputStream& DiagramDocument::LoadObject(wxInputStream& stream)
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)
wxCommand(true, name)
{
doc = ddoc;
cmd = command;
@@ -143,11 +143,11 @@ DiagramCommand::DiagramCommand(const wxString& name, int command, DiagramDocumen
x = xx;
y = yy;
selected = sel;
deleteShape = FALSE;
deleteShape = false;
}
DiagramCommand::DiagramCommand(const wxString& name, int command, DiagramDocument *ddoc, wxBrush *backgroundColour, wxShape *theShape):
wxCommand(TRUE, name)
wxCommand(true, name)
{
doc = ddoc;
cmd = command;
@@ -157,14 +157,14 @@ DiagramCommand::DiagramCommand(const wxString& name, int command, DiagramDocumen
shapeInfo = NULL;
x = 0.0;
y = 0.0;
selected = FALSE;
deleteShape = FALSE;
selected = false;
deleteShape = false;
shapeBrush = backgroundColour;
shapePen = NULL;
}
DiagramCommand::DiagramCommand(const wxString& name, int command, DiagramDocument *ddoc, const wxString& lab, wxShape *theShape):
wxCommand(TRUE, name)
wxCommand(true, name)
{
doc = ddoc;
cmd = command;
@@ -174,8 +174,8 @@ DiagramCommand::DiagramCommand(const wxString& name, int command, DiagramDocumen
shapeInfo = NULL;
x = 0.0;
y = 0.0;
selected = FALSE;
deleteShape = FALSE;
selected = false;
deleteShape = false;
shapeBrush = NULL;
shapePen = NULL;
shapeLabel = lab;
@@ -198,9 +198,9 @@ bool DiagramCommand::Do(void)
{
if (shape)
{
deleteShape = TRUE;
deleteShape = true;
shape->Select(FALSE);
shape->Select(false);
// Generate commands to explicitly remove each connected line.
RemoveLines(shape);
@@ -214,7 +214,7 @@ bool DiagramCommand::Do(void)
}
shape->Unlink();
doc->Modify(TRUE);
doc->Modify(true);
doc->UpdateAllViews();
}
@@ -230,14 +230,14 @@ bool DiagramCommand::Do(void)
theShape = (wxShape *)shapeInfo->CreateObject();
theShape->AssignNewIds();
theShape->SetEventHandler(new MyEvtHandler(theShape, theShape, wxEmptyString));
theShape->SetCentreResize(FALSE);
theShape->SetCentreResize(false);
theShape->SetPen(wxBLACK_PEN);
theShape->SetBrush(wxCYAN_BRUSH);
theShape->SetSize(60, 60);
}
doc->GetDiagram()->AddShape(theShape);
theShape->Show(TRUE);
theShape->Show(true);
wxClientDC dc(theShape->GetCanvas());
theShape->GetCanvas()->PrepareDC(dc);
@@ -245,9 +245,9 @@ bool DiagramCommand::Do(void)
theShape->Move(dc, x, y);
shape = theShape;
deleteShape = FALSE;
deleteShape = false;
doc->Modify(TRUE);
doc->Modify(true);
doc->UpdateAllViews();
break;
}
@@ -276,7 +276,7 @@ bool DiagramCommand::Do(void)
fromShape->AddLine((wxLineShape *)theShape, toShape);
theShape->Show(TRUE);
theShape->Show(true);
wxClientDC dc(theShape->GetCanvas());
theShape->GetCanvas()->PrepareDC(dc);
@@ -287,9 +287,9 @@ bool DiagramCommand::Do(void)
toShape->Move(dc, toShape->GetX(), toShape->GetY());
shape = theShape;
deleteShape = FALSE;
deleteShape = false;
doc->Modify(TRUE);
doc->Modify(true);
doc->UpdateAllViews();
break;
}
@@ -305,7 +305,7 @@ bool DiagramCommand::Do(void)
shapeBrush = oldBrush;
shape->Draw(dc);
doc->Modify(TRUE);
doc->Modify(true);
doc->UpdateAllViews();
}
@@ -326,14 +326,14 @@ bool DiagramCommand::Do(void)
shape->FormatText(dc, /* (char*) (const char*) */ myHandler->label);
shape->Draw(dc);
doc->Modify(TRUE);
doc->Modify(true);
doc->UpdateAllViews();
}
break;
}
}
return TRUE;
return true;
}
bool DiagramCommand::Undo(void)
@@ -345,7 +345,7 @@ bool DiagramCommand::Undo(void)
if (shape)
{
doc->GetDiagram()->AddShape(shape);
shape->Show(TRUE);
shape->Show(true);
if (shape->IsKindOf(CLASSINFO(wxLineShape)))
{
@@ -354,11 +354,11 @@ bool DiagramCommand::Undo(void)
fromShape->AddLine(lineShape, toShape);
}
if (selected)
shape->Select(TRUE);
shape->Select(true);
deleteShape = FALSE;
deleteShape = false;
}
doc->Modify(TRUE);
doc->Modify(true);
doc->UpdateAllViews();
break;
}
@@ -370,12 +370,12 @@ bool DiagramCommand::Undo(void)
wxClientDC dc(shape->GetCanvas());
shape->GetCanvas()->PrepareDC(dc);
shape->Select(FALSE, &dc);
shape->Select(false, &dc);
doc->GetDiagram()->RemoveShape(shape);
shape->Unlink();
deleteShape = TRUE;
deleteShape = true;
}
doc->Modify(TRUE);
doc->Modify(true);
doc->UpdateAllViews();
break;
}
@@ -391,7 +391,7 @@ bool DiagramCommand::Undo(void)
shapeBrush = oldBrush;
shape->Draw(dc);
doc->Modify(TRUE);
doc->Modify(true);
doc->UpdateAllViews();
}
break;
@@ -411,14 +411,14 @@ bool DiagramCommand::Undo(void)
shape->FormatText(dc, /* (char*) (const char*) */ myHandler->label);
shape->Draw(dc);
doc->Modify(TRUE);
doc->Modify(true);
doc->UpdateAllViews();
}
break;
}
}
return TRUE;
return true;
}
// Remove each individual line connected to a shape by sending a command.
@@ -448,13 +448,13 @@ void MyEvtHandler::OnLeftClick(double WXUNUSED(x), double WXUNUSED(y), int keys,
// Selection is a concept the library knows about
if (GetShape()->Selected())
{
GetShape()->Select(FALSE, &dc);
GetShape()->Select(false, &dc);
GetShape()->GetCanvas()->Redraw(dc); // Redraw because bits of objects will be are missing
}
else
{
// Ensure no other shape is selected, to simplify Undo/Redo code
bool redraw = FALSE;
bool redraw = false;
wxNode *node = GetShape()->GetCanvas()->GetDiagram()->GetShapeList()->GetFirst();
while (node)
{
@@ -463,13 +463,13 @@ void MyEvtHandler::OnLeftClick(double WXUNUSED(x), double WXUNUSED(y), int keys,
{
if (eachShape->Selected())
{
eachShape->Select(FALSE, &dc);
redraw = TRUE;
eachShape->Select(false, &dc);
redraw = true;
}
}
node = node->GetNext();
}
GetShape()->Select(TRUE, &dc);
GetShape()->Select(true, &dc);
if (redraw)
GetShape()->GetCanvas()->Redraw(dc);
}
@@ -535,7 +535,7 @@ void MyEvtHandler::OnEndDragRight(double x, double y, int WXUNUSED(keys), int WX
{
canvas->view->GetDocument()->GetCommandProcessor()->Submit(
new DiagramCommand(_T("wxLineShape"), OGLEDIT_ADD_LINE, (DiagramDocument *)canvas->view->GetDocument(), CLASSINFO(wxLineShape),
0.0, 0.0, FALSE, NULL, GetShape(), otherShape));
0.0, 0.0, false, NULL, GetShape(), otherShape));
}
}
@@ -558,7 +558,7 @@ bool MyDiagram::OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
wxDiagram::OnShapeSave(db, shape, expr);
MyEvtHandler *handler = (MyEvtHandler *)shape.GetEventHandler();
expr.AddAttributeValueString(_T("label"), handler->label);
return TRUE;
return true;
}
bool MyDiagram::OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
@@ -571,7 +571,7 @@ bool MyDiagram::OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
if (label)
delete[] label;
return TRUE;
return true;
}
#endif

View File

@@ -6,7 +6,7 @@
// Created: 12/07/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _OGLSAMPLE_DOC_H_
@@ -164,7 +164,7 @@ class DiagramCommand: public wxCommand
public:
// Multi-purpose constructor for creating, deleting shapes
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);
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(const wxString& name, int cmd, DiagramDocument *ddoc, wxBrush *backgroundColour, wxShape *theShape);

View File

@@ -6,7 +6,7 @@
// Created: 12/07/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -121,9 +121,9 @@ bool MyApp::OnInit(void)
frame->CreateStatusBar(1);
frame->Centre(wxBOTH);
frame->Show(TRUE);
frame->Show(true);
return TRUE;
return true;
}
int MyApp::OnExit(void)
@@ -147,7 +147,7 @@ END_EVENT_TABLE()
MyFrame::MyFrame(wxDocManager *manager, wxFrame *frame, const wxString& title,
const wxPoint& pos, const wxSize& size, long type):
wxDocParentFrame(manager, frame, -1, title, pos, size, type)
wxDocParentFrame(manager, frame, wxID_ANY, title, pos, size, type)
{
canvas = NULL;
palette = NULL;
@@ -197,7 +197,7 @@ MyCanvas *MyFrame::CreateCanvas(wxView *view, wxFrame *parent)
parent->GetClientSize(&width, &height);
// Non-retained canvas
MyCanvas *canvas = new MyCanvas(view, parent, -1, wxPoint(0, 0), wxSize(width, height), 0);
MyCanvas *canvas = new MyCanvas(view, parent, wxID_ANY, wxPoint(0, 0), wxSize(width, height), 0);
canvas->SetCursor(wxCursor(wxCURSOR_HAND));
// Give it scrollbars

View File

@@ -6,7 +6,7 @@
// Created: 12/07/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(__APPLE__)

View File

@@ -6,7 +6,7 @@
// Created: 12/07/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -49,7 +49,7 @@
EditorToolPalette::EditorToolPalette(wxWindow* parent, const wxPoint& pos, const wxSize& size,
long style):
TOOLPALETTECLASS(parent, -1, pos, size, style)
TOOLPALETTECLASS(parent, wxID_ANY, pos, size, style)
{
currentlySelected = -1;
}
@@ -58,7 +58,7 @@ bool EditorToolPalette::OnLeftClick(int toolIndex, bool toggled)
{
// BEGIN mutual exclusivity code
if (toggled && (currentlySelected != -1) && (toolIndex != currentlySelected))
ToggleTool(currentlySelected, FALSE);
ToggleTool(currentlySelected, false);
if (toggled)
currentlySelected = toolIndex;
@@ -66,7 +66,7 @@ bool EditorToolPalette::OnLeftClick(int toolIndex, bool toggled)
currentlySelected = -1;
// END mutual exclusivity code
return TRUE;
return true;
}
void EditorToolPalette::OnMouseEnter(int WXUNUSED(toolIndex))
@@ -96,21 +96,21 @@ EditorToolPalette *MyApp::CreatePalette(wxFrame *parent)
wxBitmap PaletteArrow(arrow_xpm);
#endif
EditorToolPalette *palette = new EditorToolPalette(parent, wxPoint(0, 0), wxSize(-1, -1),
EditorToolPalette *palette = new EditorToolPalette(parent, wxPoint(0, 0), wxDefaultSize,
wxTB_VERTICAL);
palette->SetMargins(2, 2);
palette->SetToolBitmapSize(wxSize(22, 22));
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->AddTool(PALETTE_ARROW, PaletteArrow, wxNullBitmap, true, 0, wxDefaultPosition.y, NULL, _T("Pointer"));
palette->AddTool(PALETTE_TOOL1, PaletteTool1, wxNullBitmap, true, 0, wxDefaultPosition.y, NULL, _T("Tool 1"));
palette->AddTool(PALETTE_TOOL2, PaletteTool2, wxNullBitmap, true, 0, wxDefaultPosition.y, NULL, _T("Tool 2"));
palette->AddTool(PALETTE_TOOL3, PaletteTool3, wxNullBitmap, true, 0, wxDefaultPosition.y, NULL, _T("Tool 3"));
palette->AddTool(PALETTE_TOOL4, PaletteTool4, wxNullBitmap, true, 0, wxDefaultPosition.y, NULL, _T("Tool 4"));
palette->Realize();
palette->ToggleTool(PALETTE_ARROW, TRUE);
palette->ToggleTool(PALETTE_ARROW, true);
palette->currentlySelected = PALETTE_ARROW;
return palette;
}

View File

@@ -6,7 +6,7 @@
// Created: 12/07/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _OGLSAMPLE_PALETTE_H_

View File

@@ -6,7 +6,7 @@
// Created: 12/07/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@ -52,7 +52,7 @@ bool DiagramView::OnCreate(wxDocument *doc, long WXUNUSED(flags))
canvas->view = this;
SetFrame(frame);
Activate(TRUE);
Activate(true);
// Initialize the edit menu Undo and Redo items
doc->GetCommandProcessor()->SetEditMenu(((MyFrame *)frame)->editMenu);
@@ -63,10 +63,10 @@ bool DiagramView::OnCreate(wxDocument *doc, long WXUNUSED(flags))
shapeCanvas->SetDiagram(diagramDoc->GetDiagram());
diagramDoc->GetDiagram()->SetCanvas(shapeCanvas);
return TRUE;
return true;
}
#define CENTER FALSE // Place the drawing to the center of the page
#define CENTER false // Place the drawing to the center of the page
// Sneakily gets used for default print/preview
@@ -152,7 +152,7 @@ void DiagramView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint))
bool DiagramView::OnClose(bool WXUNUSED(deleteWindow))
{
if (!GetDocument()->Close())
return FALSE;
return false;
DiagramDocument *diagramDoc = (DiagramDocument *)GetDocument();
diagramDoc->GetDiagram()->SetCanvas(NULL);
@@ -168,9 +168,9 @@ bool DiagramView::OnClose(bool WXUNUSED(deleteWindow))
SetFrame(NULL);
Activate(FALSE);
Activate(false);
return TRUE;
return true;
}
wxShape *DiagramView::FindSelectedShape(void)
@@ -197,7 +197,7 @@ void DiagramView::OnCut(wxCommandEvent& WXUNUSED(event))
wxShape *theShape = FindSelectedShape();
if (theShape)
doc->GetCommandProcessor()->Submit(new DiagramCommand(_T("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& WXUNUSED(event))
@@ -208,7 +208,7 @@ void DiagramView::OnChangeBackgroundColour(wxCommandEvent& WXUNUSED(event))
if (theShape)
{
wxColourData data;
data.SetChooseFull(TRUE);
data.SetChooseFull(true);
data.SetColour(theShape->GetBrush()->GetColour());
wxColourDialog *dialog = new wxColourDialog(frame, &data);

View File

@@ -6,7 +6,7 @@
// Created: 12/07/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _OGLSAMPLE_VIEW_H_
@@ -26,7 +26,7 @@ class MyCanvas: public wxShapeCanvas
public:
wxView *view;
MyCanvas(wxView *view, wxWindow *parent = NULL, wxWindowID id = -1,
MyCanvas(wxView *view, wxWindow *parent = NULL, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxRETAINED);
~MyCanvas(void);
@@ -62,7 +62,7 @@ class DiagramView: public wxView
bool OnCreate(wxDocument *doc, long flags);
void OnDraw(wxDC *dc);
void OnUpdate(wxView *sender, wxObject *hint = NULL);
bool OnClose(bool deleteWindow = TRUE);
bool OnClose(bool deleteWindow = true);
wxShape *FindSelectedShape(void);