X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2ba06d5a8ccf8c224fcfbd52fa01a55abf7befbd..4219b5e7c7886ae5985b47f622253ea7f5934151:/contrib/samples/ogl/studio/view.cpp?ds=sidebyside diff --git a/contrib/samples/ogl/studio/view.cpp b/contrib/samples/ogl/studio/view.cpp index fff71b629b..9ce1d68423 100644 --- a/contrib/samples/ogl/studio/view.cpp +++ b/contrib/samples/ogl/studio/view.cpp @@ -9,10 +9,6 @@ // Licence: ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -// #pragma implementation -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -198,25 +194,23 @@ void csDiagramView::OnSelectAll(wxCommandEvent& WXUNUSED(event)) 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 +305,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 +323,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 +355,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(); @@ -410,7 +402,7 @@ void csDiagramView::OnChangeBackgroundColour(wxCommandEvent& WXUNUSED(event)) 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 +471,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,7 +523,7 @@ 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(); @@ -544,7 +536,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(); @@ -579,7 +571,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(); @@ -634,7 +626,7 @@ void csDiagramView::ReflectPointSize(int pointSize) void csDiagramView::ReflectArrowState(wxLineShape* lineShape) { bool haveArrow = false; - wxNode *node = lineShape->GetArrows().GetFirst(); + wxObjectList::compatibility_iterator node = lineShape->GetArrows().GetFirst(); while (node) { wxArrowHead *arrow = (wxArrowHead *)node->GetData(); @@ -651,7 +643,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 +743,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 +764,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 +785,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 +847,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); @@ -879,6 +871,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 +885,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 +995,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();