]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/samples/ogl/studio/csprint.cpp
Starting to update the tarball and rpm spec files for 2.5. Mostly
[wxWidgets.git] / contrib / samples / ogl / studio / csprint.cpp
index f3f65e85cc4886131e082a0e6c5b32da332c9a1d..680fef2ff8ac102ea88681e26ccb45caf0938240 100644 (file)
@@ -70,10 +70,10 @@ bool wxDiagramClipboard::DoCopy(wxDiagram* diagramFrom, wxDiagram* diagramTo, bo
 
     // First copy all node shapes.
     wxList* shapeList = diagramFrom->GetShapeList();
-    wxNode* node = shapeList->First();
+    wxNode* node = shapeList->GetFirst();
     while (node)
     {
-        wxShape* shape = (wxShape*) node->Data();
+        wxShape* shape = (wxShape*) node->GetData();
         if (((diagramFrom == this) || shape->Selected()) && !shape->IsKindOf(CLASSINFO(wxLineShape)))
         {
             wxShape* newShape = shape->CreateNewCopy();
@@ -90,13 +90,13 @@ bool wxDiagramClipboard::DoCopy(wxDiagram* diagramFrom, wxDiagram* diagramTo, bo
             OnAddShape(diagramTo, newShape, dc);
 
         }
-        node = node->Next();
+        node = node->GetNext();
     }
 
-    node = shapeList->First();
+    node = shapeList->GetFirst();
     while (node)
     {
-        wxShape* shape = (wxShape*) node->Data();
+        wxShape* shape = (wxShape*) node->GetData();
         if (((diagramFrom == this) || shape->Selected()) && shape->IsKindOf(CLASSINFO(wxLineShape)))
         {
             wxLineShape* lineShape = (wxLineShape*) shape;
@@ -112,8 +112,8 @@ bool wxDiagramClipboard::DoCopy(wxDiagram* diagramFrom, wxDiagram* diagramTo, bo
                 wxShape* fromShape = (wxShape*) mapping.Get((long) lineShape->GetFrom());
                 wxShape* toShape = (wxShape*) mapping.Get((long) lineShape->GetTo());
 
-                wxASSERT_MSG( (fromShape != NULL), "Could not find 'from' shape");
-                wxASSERT_MSG( (toShape != NULL), "Could not find 'to' shape");
+                wxASSERT_MSG( (fromShape != NULL), _T("Could not find 'from' shape"));
+                wxASSERT_MSG( (toShape != NULL), _T("Could not find 'to' shape"));
 
                 fromShape->AddLine(newShape, toShape, newShape->GetAttachmentFrom(),
                   newShape->GetAttachmentTo());
@@ -122,14 +122,14 @@ bool wxDiagramClipboard::DoCopy(wxDiagram* diagramFrom, wxDiagram* diagramTo, bo
 
             }
         }
-        node = node->Next();
+        node = node->GetNext();
     }
 
     // Now make sure line ordering is correct
-    node = shapeList->First();
+    node = shapeList->GetFirst();
     while (node)
     {
-        wxShape* shape = (wxShape*) node->Data();
+        wxShape* shape = (wxShape*) node->GetData();
         if (((diagramFrom == this) || shape->Selected()) && !shape->IsKindOf(CLASSINFO(wxLineShape)))
         {
             wxShape* newShape = (wxShape*) mapping.Get((long) shape);
@@ -137,26 +137,26 @@ bool wxDiagramClipboard::DoCopy(wxDiagram* diagramFrom, wxDiagram* diagramTo, bo
             // Make a list of all the new lines, in the same order as the old lines.
             // Then apply the list of new lines to the shape.
             wxList newLines;
-            wxNode* lineNode = shape->GetLines().First();
+            wxNode* lineNode = shape->GetLines().GetFirst();
             while (lineNode)
             {
-                wxLineShape* lineShape = (wxLineShape*) lineNode->Data();
+                wxLineShape* lineShape = (wxLineShape*) lineNode->GetData();
                 if ((diagramFrom == this) || (lineShape->GetTo()->Selected() && lineShape->GetFrom()->Selected()))
                 {
                     wxLineShape* newLineShape = (wxLineShape*) mapping.Get((long) lineShape);
 
-                    wxASSERT_MSG( (newLineShape != NULL), "Could not find new line shape");
+                    wxASSERT_MSG( (newLineShape != NULL), _T("Could not find new line shape"));
 
                     newLines.Append(newLineShape);
                 }
 
-                lineNode = lineNode->Next();
+                lineNode = lineNode->GetNext();
             }
 
-            if (newLines.Number() > 0)
+            if (newLines.GetCount() > 0)
                 newShape->ApplyAttachmentOrdering(newLines);
         }
-        node = node->Next();
+        node = node->GetNext();
     }
 
     OnEndCopy(diagramTo);
@@ -169,6 +169,7 @@ bool wxDiagramClipboard::DoCopy(wxDiagram* diagramFrom, wxDiagram* diagramTo, bo
 // these to the Windows clipboard
 bool wxDiagramClipboard::CopyToClipboard(double scale)
 {
+#if wxUSE_METAFILE
   // Make a metafile DC
   wxMetaFileDC mfDC;
   if (mfDC.Ok())
@@ -178,8 +179,8 @@ bool wxDiagramClipboard::CopyToClipboard(double scale)
     // Draw on metafile DC
     Redraw(mfDC);
 
-    int printWidth = mfDC.MaxX() - mfDC.MinX();
-    int printHeight = mfDC.MaxY() - mfDC.MinY();
+    // int printWidth = mfDC.MaxX() - mfDC.MinX();
+    // int printHeight = mfDC.MaxY() - mfDC.MinY();
     int maxX = (int)mfDC.MaxX();
     int maxY = (int)mfDC.MaxY();
     wxMetaFile *mf = mfDC.Close();
@@ -190,9 +191,9 @@ bool wxDiagramClipboard::CopyToClipboard(double scale)
     {
       delete newBitmap;
       
-      char buf[200];
-      sprintf(buf, "Sorry, could not allocate clipboard bitmap (%dx%d)", (maxX+10), (maxY+10));
-      wxMessageBox(buf, "Clipboard copy problem");
+      wxChar buf[200];
+      wxSprintf(buf, _T("Sorry, could not allocate clipboard bitmap (%dx%d)"), (maxX+10), (maxY+10));
+      wxMessageBox(buf, _T("Clipboard copy problem"));
       return FALSE;
     }
 
@@ -230,7 +231,11 @@ bool wxDiagramClipboard::CopyToClipboard(double scale)
     delete mf;
 
   }
-  return TRUE;
+  return true;
+#else
+  wxMessageBox("wxUSE_METAFILE in build required to use Clipboard", _T("Clipboard copy problem"));
+  return false;
+#endif
 }
 #endif
     // __WXMSW__
@@ -268,7 +273,7 @@ bool csDiagramClipboard::OnStartCopy(wxDiagram* diagramTo)
     csDiagramDocument* doc = diagram->GetDocument();
     ((csDiagramView*)doc->GetFirstView())->SelectAll(FALSE);
 
-    m_currentCmd = new csDiagramCommand("Paste", doc);
+    m_currentCmd = new csDiagramCommand(_T("Paste"), doc);
 
     return TRUE;
 }
@@ -284,7 +289,7 @@ bool csDiagramClipboard::OnEndCopy(wxDiagram* diagramTo)
 
     if (m_currentCmd)
     {
-        if (m_currentCmd->GetStates().Number() == 0)
+        if (m_currentCmd->GetStates().GetCount() == 0)
         {
             delete m_currentCmd;
         }
@@ -299,7 +304,7 @@ bool csDiagramClipboard::OnEndCopy(wxDiagram* diagramTo)
 
 // Use the command framework to add the shapes, if we're copying to a diagram and
 // not the clipboard.
-bool csDiagramClipboard::OnAddShape(wxDiagram* diagramTo, wxShape* newShape, wxDC* dc)
+bool csDiagramClipboard::OnAddShape(wxDiagram* diagramTo, wxShape* newShape, wxDC* WXUNUSED(dc))
 {
     if (diagramTo == this)
     {
@@ -308,7 +313,7 @@ bool csDiagramClipboard::OnAddShape(wxDiagram* diagramTo, wxShape* newShape, wxD
     else
     {
         csDiagram* diagram = (csDiagram*) diagramTo;
-        csDiagramDocument* doc = diagram->GetDocument();
+        /* csDiagramDocument* doc = */ diagram->GetDocument();
 
         if (newShape->IsKindOf(CLASSINFO(wxLineShape)))
             m_currentCmd->AddState(new csCommandState(ID_CS_ADD_LINE_SELECT, newShape, NULL));