X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8552e6f031ded8ae61b4a5b489fbf06962365da7..94709f191133613e115fdbf913eba5a81ddd207e:/contrib/samples/ogl/studio/view.cpp diff --git a/contrib/samples/ogl/studio/view.cpp b/contrib/samples/ogl/studio/view.cpp index 4b894fd48f..5e4d579c1e 100644 --- a/contrib/samples/ogl/studio/view.cpp +++ b/contrib/samples/ogl/studio/view.cpp @@ -95,7 +95,7 @@ bool csDiagramView::OnCreate(wxDocument *doc, long WXUNUSED(flags)) canvas->SetView(this); SetFrame(frame); - Activate(TRUE); + Activate(true); // Initialize the edit menu Undo and Redo items doc->GetCommandProcessor()->SetEditMenu(editMenu); @@ -112,12 +112,12 @@ bool csDiagramView::OnCreate(wxDocument *doc, long WXUNUSED(flags)) { case csGRID_STYLE_NONE: { - diagramDoc->GetDiagram()->SetSnapToGrid(FALSE); + diagramDoc->GetDiagram()->SetSnapToGrid(false); break; } case csGRID_STYLE_INVISIBLE: { - diagramDoc->GetDiagram()->SetSnapToGrid(TRUE); + diagramDoc->GetDiagram()->SetSnapToGrid(true); break; } case csGRID_STYLE_DOTTED: @@ -128,7 +128,7 @@ bool csDiagramView::OnCreate(wxDocument *doc, long WXUNUSED(flags)) } - return TRUE; + return true; } csDiagramView::~csDiagramView(void) @@ -155,7 +155,7 @@ void csDiagramView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint)) bool csDiagramView::OnClose(bool deleteWindow) { if (!GetDocument()->Close()) - return FALSE; + return false; csDiagramDocument *diagramDoc = (csDiagramDocument *)GetDocument(); diagramDoc->GetDiagram()->SetCanvas(NULL); @@ -170,15 +170,15 @@ bool csDiagramView::OnClose(bool deleteWindow) // Remove file menu from those managed by the command history wxGetApp().GetDocManager()->FileHistoryRemoveMenu(fileMenu); - Activate(FALSE); - frame->Show(FALSE); + Activate(false); + frame->Show(false); if (deleteWindow) { frame->Destroy(); } - return TRUE; + return true; } // Adds or removes shape from m_selections @@ -192,31 +192,29 @@ void csDiagramView::SelectShape(wxShape* shape, bool select) void csDiagramView::OnSelectAll(wxCommandEvent& WXUNUSED(event)) { - SelectAll(TRUE); + SelectAll(true); } wxShape *csDiagramView::FindFirstSelectedShape(void) { csDiagramDocument *doc = (csDiagramDocument *)GetDocument(); - wxShape *theShape = NULL; - wxNode *node = doc->GetDiagram()->GetShapeList()->GetFirst(); + wxObjectList::compatibility_iterator node = doc->GetDiagram()->GetShapeList()->GetFirst(); while (node) { wxShape *eachShape = (wxShape *)node->GetData(); if ((eachShape->GetParent() == NULL) && !eachShape->IsKindOf(CLASSINFO(wxLabelShape)) && eachShape->Selected()) { - theShape = eachShape; - node = NULL; + return eachShape; } else node = node->GetNext(); } - return theShape; + return NULL; } void csDiagramView::FindSelectedShapes(wxList& selections, wxClassInfo* toFind) { csDiagramDocument *doc = (csDiagramDocument *)GetDocument(); - wxNode *node = doc->GetDiagram()->GetShapeList()->GetFirst(); + wxObjectList::compatibility_iterator node = doc->GetDiagram()->GetShapeList()->GetFirst(); while (node) { wxShape *eachShape = (wxShape *)node->GetData(); @@ -311,8 +309,6 @@ void csDiagramView::OnCopyUpdate(wxUpdateUIEvent& event) void csDiagramView::OnPasteUpdate(wxUpdateUIEvent& event) { - /* csDiagramDocument *doc = */ (csDiagramDocument *)GetDocument(); - int n = wxGetApp().GetDiagramClipboard().GetCount(); event.Enable( (n > 0) ); @@ -331,7 +327,7 @@ void csDiagramView::DoCut(wxList& shapes) { csDiagramCommand* cmd = new csDiagramCommand(_T("Cut"), doc); - wxNode* node = shapes.GetFirst(); + wxObjectList::compatibility_iterator node = shapes.GetFirst(); while (node) { wxShape *theShape = (wxShape*) node->GetData(); @@ -363,8 +359,8 @@ void csDiagramView::DoCmd(wxList& shapes, wxList& oldShapes, int cmd, const wxSt { csDiagramCommand* command = new csDiagramCommand(op, doc); - wxNode* node = shapes.GetFirst(); - wxNode* node1 = oldShapes.GetFirst(); + wxObjectList::compatibility_iterator node = shapes.GetFirst(); + wxObjectList::compatibility_iterator node1 = oldShapes.GetFirst(); while (node && node1) { wxShape *theShape = (wxShape*) node->GetData(); @@ -389,7 +385,7 @@ void csDiagramView::OnChangeBackgroundColour(wxCommandEvent& WXUNUSED(event)) if (selections.GetCount() > 0) { wxColourData data; - data.SetChooseFull(TRUE); + data.SetChooseFull(true); if (selections.GetCount() == 1) { wxShape* firstShape = (wxShape*) selections.GetFirst()->GetData(); @@ -404,13 +400,13 @@ void csDiagramView::OnChangeBackgroundColour(wxCommandEvent& WXUNUSED(event)) wxColour col = retData.GetColour(); theBrush = wxTheBrushList->FindOrCreateBrush(col, wxSOLID); } - dialog->Close(TRUE); + dialog->Close(true); if (!theBrush) return; csDiagramCommand* cmd = new csDiagramCommand(_T("Change colour"), doc); - wxNode* node = selections.GetFirst(); + wxObjectList::compatibility_iterator node = selections.GetFirst(); while (node) { wxShape *theShape = (wxShape*) node->GetData(); @@ -479,7 +475,7 @@ void csDiagramView::ApplyPointSize(int pointSize) { csDiagramCommand* cmd = new csDiagramCommand(_T("Point size"), doc); - wxNode* node = selections.GetFirst(); + wxObjectList::compatibility_iterator node = selections.GetFirst(); while (node) { wxShape *theShape = (wxShape*) node->GetData(); @@ -531,12 +527,12 @@ void csDiagramView::SelectAll(bool select) wxList selections; FindSelectedShapes(selections); - wxNode* node = selections.GetFirst(); + wxObjectList::compatibility_iterator node = selections.GetFirst(); while (node) { wxShape *theShape = (wxShape*) node->GetData(); - theShape->Select(FALSE, &dc); - SelectShape(theShape, FALSE); + theShape->Select(false, &dc); + SelectShape(theShape, false); node = node->GetNext(); } @@ -544,7 +540,7 @@ void csDiagramView::SelectAll(bool select) else { csDiagramDocument *doc = (csDiagramDocument *)GetDocument(); - wxNode *node = doc->GetDiagram()->GetShapeList()->GetFirst(); + wxObjectList::compatibility_iterator node = doc->GetDiagram()->GetShapeList()->GetFirst(); while (node) { wxShape *eachShape = (wxShape *)node->GetData(); @@ -552,8 +548,8 @@ void csDiagramView::SelectAll(bool select) !eachShape->IsKindOf(CLASSINFO(wxControlPoint)) && !eachShape->IsKindOf(CLASSINFO(wxLabelShape))) { - eachShape->Select(TRUE, &dc); - SelectShape(eachShape, TRUE); + eachShape->Select(true, &dc); + SelectShape(eachShape, true); } node = node->GetNext(); } @@ -579,7 +575,7 @@ void csDiagramView::OnToggleArrowTool(wxCommandEvent& WXUNUSED(event)) { csDiagramCommand* cmd = new csDiagramCommand(stateName, doc); - wxNode* node = selections.GetFirst(); + wxObjectList::compatibility_iterator node = selections.GetFirst(); while (node) { wxLineShape *theShape = (wxLineShape*) node->GetData(); @@ -633,13 +629,13 @@ void csDiagramView::ReflectPointSize(int pointSize) // Make the arrow toggle button reflect the state of the line void csDiagramView::ReflectArrowState(wxLineShape* lineShape) { - bool haveArrow = FALSE; - wxNode *node = lineShape->GetArrows().GetFirst(); + bool haveArrow = false; + wxObjectList::compatibility_iterator node = lineShape->GetArrows().GetFirst(); while (node) { wxArrowHead *arrow = (wxArrowHead *)node->GetData(); if (ARROW_POSITION_MIDDLE == arrow->GetArrowEnd()) - haveArrow = TRUE; + haveArrow = true; node = node->GetNext(); } @@ -651,7 +647,7 @@ void csDiagramView::OnAlign(wxCommandEvent& event) // Make a copy of the selections, keeping only those shapes // that are top-level non-line shapes. wxList selections; - wxNode* node = GetSelectionList().GetFirst(); + wxObjectList::compatibility_iterator node = GetSelectionList().GetFirst(); while (node) { wxShape* shape = (wxShape*) node->GetData(); @@ -751,7 +747,7 @@ void csDiagramView::OnNewLinePoint(wxCommandEvent& WXUNUSED(event)) csDiagramDocument *doc = (csDiagramDocument *)GetDocument(); csDiagramCommand* cmd = new csDiagramCommand(_T("New line point"), doc); - wxNode* node = m_selections.GetFirst(); + wxObjectList::compatibility_iterator node = m_selections.GetFirst(); while (node) { wxShape* shape = (wxShape*) node->GetData(); @@ -772,7 +768,7 @@ void csDiagramView::OnCutLinePoint(wxCommandEvent& WXUNUSED(event)) csDiagramDocument *doc = (csDiagramDocument *)GetDocument(); csDiagramCommand* cmd = new csDiagramCommand(_T("Cut line point"), doc); - wxNode* node = m_selections.GetFirst(); + wxObjectList::compatibility_iterator node = m_selections.GetFirst(); while (node) { wxShape* shape = (wxShape*) node->GetData(); @@ -793,7 +789,7 @@ void csDiagramView::OnStraightenLines(wxCommandEvent& WXUNUSED(event)) csDiagramDocument *doc = (csDiagramDocument *)GetDocument(); csDiagramCommand* cmd = new csDiagramCommand(_T("Straighten lines"), doc); - wxNode* node = m_selections.GetFirst(); + wxObjectList::compatibility_iterator node = m_selections.GetFirst(); while (node) { wxShape* shape = (wxShape*) node->GetData(); @@ -855,7 +851,7 @@ csCanvas::~csCanvas(void) void csCanvas::DrawOutline(wxDC& dc, double x1, double y1, double x2, double y2) { - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); + wxPen dottedPen(*wxBLACK, 1, wxDOT); dc.SetPen(dottedPen); dc.SetBrush(* wxTRANSPARENT_BRUSH); @@ -868,7 +864,7 @@ void csCanvas::OnLeftClick(double x, double y, int WXUNUSED(keys)) if (palette->GetSelection() == PALETTE_ARROW) { - GetView()->SelectAll(FALSE); + GetView()->SelectAll(false); wxClientDC dc(this); PrepareDC(dc); @@ -879,6 +875,9 @@ void csCanvas::OnLeftClick(double x, double y, int WXUNUSED(keys)) if (palette->GetSelection() == PALETTE_TEXT_TOOL) { + wxString newLabel; + +#if wxUSE_WX_RESOURCES // Ask for a label and create a new free-floating text region csLabelEditingDialog* dialog = new csLabelEditingDialog(GetParent()); @@ -890,8 +889,9 @@ void csCanvas::OnLeftClick(double x, double y, int WXUNUSED(keys)) return; } - wxString newLabel = dialog->GetShapeLabel(); + newLabel = dialog->GetShapeLabel(); dialog->Destroy(); +#endif // wxUSE_WX_RESOURCES wxShape* shape = new csTextBoxShape; shape->AssignNewIds(); @@ -999,7 +999,7 @@ void csCanvas::OnEndDragLeft(double x, double y, int WXUNUSED(keys)) min_y = wxMin(y, sg_initialY); max_y = wxMax(y, sg_initialY); - wxNode *node = GetDiagram()->GetShapeList()->GetFirst(); + wxObjectList::compatibility_iterator node = GetDiagram()->GetShapeList()->GetFirst(); while (node) { wxShape *shape = (wxShape *)node->GetData(); @@ -1010,8 +1010,8 @@ void csCanvas::OnEndDragLeft(double x, double y, int WXUNUSED(keys)) if (image_x >= min_x && image_x <= max_x && image_y >= min_y && image_y <= max_y) { - shape->Select(TRUE, &dc); - GetView()->SelectShape(shape, TRUE); + shape->Select(true, &dc); + GetView()->SelectShape(shape, true); } } node = node->GetNext();