X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1fc25a89ac1e6c5208db24bfc0abc8666b791dc6..adb8a71bbc0ba11aad0b417db24f7267a250b6c3:/contrib/samples/ogl/studio/doc.cpp diff --git a/contrib/samples/ogl/studio/doc.cpp b/contrib/samples/ogl/studio/doc.cpp index ea8cb82eb7..865a03a1ae 100644 --- a/contrib/samples/ogl/studio/doc.cpp +++ b/contrib/samples/ogl/studio/doc.cpp @@ -14,7 +14,7 @@ #endif // For compilers that support precompilation, includes "wx.h". -#include +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop @@ -24,8 +24,6 @@ #include #endif -#include - #include "studio.h" #include "doc.h" #include "view.h" @@ -33,7 +31,7 @@ IMPLEMENT_DYNAMIC_CLASS(csDiagramDocument, wxDocument) -#ifdef _MSC_VER +#ifdef __VISUALC__ #pragma warning(disable:4355) #endif @@ -41,7 +39,7 @@ csDiagramDocument::csDiagramDocument():m_diagram(this) { } -#ifdef _MSC_VER +#ifdef __VISUALC__ #pragma warning(default:4355) #endif @@ -57,18 +55,18 @@ bool csDiagramDocument::OnCloseDocument() bool csDiagramDocument::OnSaveDocument(const wxString& file) { - if (file == "") + if (file == wxEmptyString) return FALSE; if (!m_diagram.SaveFile(file)) { wxString msgTitle; - if (wxTheApp->GetAppName() != "") + if (wxTheApp->GetAppName() != wxEmptyString) msgTitle = wxTheApp->GetAppName(); else - msgTitle = wxString("File error"); + msgTitle = wxString(_T("File error")); - (void)wxMessageBox("Sorry, could not open this file for saving.", msgTitle, wxOK | wxICON_EXCLAMATION, + (void)wxMessageBox(_T("Sorry, could not open this file for saving."), msgTitle, wxOK | wxICON_EXCLAMATION, GetDocumentWindow()); return FALSE; } @@ -84,15 +82,15 @@ bool csDiagramDocument::OnOpenDocument(const wxString& file) return FALSE; wxString msgTitle; - if (wxTheApp->GetAppName() != "") + if (wxTheApp->GetAppName() != wxEmptyString) msgTitle = wxTheApp->GetAppName(); else - msgTitle = wxString("File error"); + msgTitle = wxString(_T("File error")); m_diagram.DeleteAllShapes(); if (!m_diagram.LoadFile(file)) { - (void)wxMessageBox("Sorry, could not open this file.", msgTitle, wxOK|wxICON_EXCLAMATION, + (void)wxMessageBox(_T("Sorry, could not open this file."), msgTitle, wxOK|wxICON_EXCLAMATION, GetDocumentWindow()); return FALSE; } @@ -122,12 +120,12 @@ csDiagramCommand::csDiagramCommand(const wxString& name, csDiagramDocument *doc, csDiagramCommand::~csDiagramCommand() { - wxNode* node = m_states.First(); + wxNode* node = m_states.GetFirst(); while (node) { - csCommandState* state = (csCommandState*) node->Data(); + csCommandState* state = (csCommandState*) node->GetData(); delete state; - node = node->Next(); + node = node->GetNext(); } } @@ -149,51 +147,51 @@ void csDiagramCommand::InsertState(csCommandState* state) // Schedule all lines connected to the states to be cut. void csDiagramCommand::RemoveLines() { - wxNode* node = m_states.First(); + wxNode* node = m_states.GetFirst(); while (node) { - csCommandState* state = (csCommandState*) node->Data(); + csCommandState* state = (csCommandState*) node->GetData(); wxShape* shape = state->GetShapeOnCanvas(); wxASSERT( (shape != NULL) ); - wxNode *node1 = shape->GetLines().First(); + wxNode *node1 = shape->GetLines().GetFirst(); while (node1) { - wxLineShape *line = (wxLineShape *)node1->Data(); + wxLineShape *line = (wxLineShape *)node1->GetData(); if (!FindStateByShape(line)) { csCommandState* newState = new csCommandState(ID_CS_CUT, NULL, line); InsertState(newState); } - node1 = node1->Next(); + node1 = node1->GetNext(); } - node = node->Next(); + node = node->GetNext(); } } csCommandState* csDiagramCommand::FindStateByShape(wxShape* shape) { - wxNode* node = m_states.First(); + wxNode* node = m_states.GetFirst(); while (node) { - csCommandState* state = (csCommandState*) node->Data(); + csCommandState* state = (csCommandState*) node->GetData(); if (shape == state->GetShapeOnCanvas() || shape == state->GetSavedState()) return state; - node = node->Next(); + node = node->GetNext(); } return NULL; } bool csDiagramCommand::Do() { - wxNode* node = m_states.First(); + wxNode* node = m_states.GetFirst(); while (node) { - csCommandState* state = (csCommandState*) node->Data(); + csCommandState* state = (csCommandState*) node->GetData(); if (!state->Do()) return FALSE; - node = node->Next(); + node = node->GetNext(); } return TRUE; } @@ -202,13 +200,13 @@ bool csDiagramCommand::Undo() { // Undo in reverse order, so e.g. shapes get added // back before the lines do. - wxNode* node = m_states.Last(); + wxNode* node = m_states.GetLast(); while (node) { - csCommandState* state = (csCommandState*) node->Data(); + csCommandState* state = (csCommandState*) node->GetData(); if (!state->Undo()) return FALSE; - node = node->Previous(); + node = node->GetPrevious(); } return TRUE; } @@ -459,7 +457,7 @@ bool csCommandState::Do() m_shapeOnCanvas->Show(TRUE); // Recursively redraw links if we have a composite. - if (m_shapeOnCanvas->GetChildren().Number() > 0) + if (m_shapeOnCanvas->GetChildren().GetCount() > 0) m_shapeOnCanvas->DrawLinks(dc, -1, TRUE); m_shapeOnCanvas->GetEventHandler()->OnEndSize(width, height);