]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch [ 868061 ] Warning free OGL
authorJulian Smart <julian@anthemion.co.uk>
Thu, 8 Jan 2004 14:35:36 +0000 (14:35 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 8 Jan 2004 14:35:36 +0000 (14:35 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25096 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

12 files changed:
contrib/include/wx/ogl/basic.h
contrib/include/wx/ogl/basicp.h
contrib/include/wx/ogl/drawnp.h
contrib/samples/ogl/studio/csprint.cpp
contrib/samples/ogl/studio/studio.cpp
contrib/src/ogl/basic.cpp
contrib/src/ogl/basic2.cpp
contrib/src/ogl/bmpshape.cpp
contrib/src/ogl/divided.cpp
contrib/src/ogl/lines.cpp
contrib/src/ogl/mfutils.cpp
contrib/src/ogl/oglmisc.cpp

index 5839382e33592dc13cfb3553be44e456697c6d28..8a2debc068ead22757fb2c886c7bb87a1a955903 100644 (file)
@@ -530,7 +530,7 @@ class WXDLLIMPEXP_OGL wxShape: public wxShapeEvtHandler
   wxPen*                m_pen;
   wxBrush*              m_brush;
   wxFont*               m_font;
-  wxColour*             m_textColour;
+  wxColour              m_textColour;
   wxString              m_textColourName;
   wxShapeCanvas*        m_canvas;
   wxList                m_lines;
index 6c0e1e8368d65fbd7862424b502d2c905c0088ce..f9ce75c66921eeaed177ca79b40fbfc5e74b5924 100644 (file)
@@ -157,7 +157,7 @@ class WXDLLIMPEXP_OGL wxShapeRegion: public wxObject
   inline int GetFormatMode() const { return m_formatMode; }
   inline wxString GetName() const { return m_regionName; }
   inline wxString GetColour() const { return m_textColour; }
-  wxColour *GetActualColourObject();
+  wxColour GetActualColourObject();
   inline wxList& GetFormattedText() { return m_formattedText; }
   inline wxString GetPenColour() const { return m_penColour; }
   inline int GetPenStyle() const { return m_penStyle; }
@@ -188,7 +188,7 @@ public:
   int                   m_formatMode;        // FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT | FORMAT_NONE
   wxString              m_regionName;
   wxString              m_textColour;
-  wxColour*             m_actualColourObject; // For speed purposes
+  wxColour              m_actualColourObject; // For speed purposes
 
   // New members for specifying divided rectangle division colour/style 30/6/94
   wxString              m_penColour;
index d80643301b3bfb4f5244cd83aea7e4a2356f93e1..d837811f7cce1e4a04200f5a6f33d7edc91091a5 100644 (file)
@@ -59,9 +59,9 @@ class WXDLLIMPEXP_OGL wxDrawOp: public wxObject
 public:
   inline wxDrawOp(int theOp) { m_op = theOp; }
   inline ~wxDrawOp() {}
-  inline virtual void Scale(double xScale, double yScale) {};
-  inline virtual void Translate(double x, double y) {};
-  inline virtual void Rotate(double x, double y, double theta, double sinTheta, double cosTheta) {};
+  inline virtual void Scale(double WXUNUSED(xScale), double WXUNUSED(yScale)) {};
+  inline virtual void Translate(double WXUNUSED(x), double WXUNUSED(y)) {};
+  inline virtual void Rotate(double WXUNUSED(x), double WXUNUSED(y), double WXUNUSED(theta), double WXUNUSED(sinTheta), double WXUNUSED(cosTheta)) {};
   virtual void Do(wxDC& dc, double xoffset, double yoffset) = 0;
   virtual wxDrawOp *Copy(wxPseudoMetaFile *newImage) = 0;
 #if wxUSE_PROLOGIO
@@ -71,15 +71,15 @@ public:
   inline int GetOp() const { return m_op; }
 
   // Draw an outline using the current operation. By default, return FALSE (not drawn)
-  virtual bool OnDrawOutline(wxDC& dc, double x, double y, double w, double h,
-    double oldW, double oldH) { return FALSE; }
+  virtual bool OnDrawOutline(wxDC& WXUNUSED(dc), double WXUNUSED(x), double WXUNUSED(y), double WXUNUSED(w), double WXUNUSED(h),
+    double WXUNUSED(oldW), double WXUNUSED(oldH)) { return FALSE; }
 
   // Get the perimeter point using this data
-  virtual bool GetPerimeterPoint(double x1, double y1,
-                                     double x2, double y2,
-                                     double *x3, double *y3,
-                                     double xOffset, double yOffset,
-                                     int attachmentMode)
+  virtual bool GetPerimeterPoint(double WXUNUSED(x1), double WXUNUSED(y1),
+                                     double WXUNUSED(x2), double WXUNUSED(y2),
+                                     double *WXUNUSED(x3), double *WXUNUSED(y3),
+                                     double WXUNUSED(xOffset), double WXUNUSED(yOffset),
+                                     int WXUNUSED(attachmentMode))
   { return FALSE; }
 
 protected:
index 4d17b59ab76ab52886562f6cc4c1ee560dd6f611..680fef2ff8ac102ea88681e26ccb45caf0938240 100644 (file)
@@ -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())
@@ -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__
index 7940916eb59f63bc47e119d55f1cb6f14ffff128..f3d414eeeeb0649400f79d8dda47d0a42a5223a6 100644 (file)
@@ -119,7 +119,7 @@ bool csApp::OnInit(void)
   // area doesn't refresh properly when we change its position, under Windows.
 
 #define wxDEFAULT_FRAME_STYLE_NO_CLIP \
-  (wxSYSTEM_MENU | wxRESIZE_BORDER | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxTHICK_FRAME | wxSYSTEM_MENU | wxCAPTION)
+  (wxDEFAULT_FRAME_STYLE & ~wxCLIP_CHILDREN)
 
   csFrame* frame = new csFrame(m_docManager, NULL, -1, _T("OGL Studio"), m_mainFramePos, m_mainFrameSize,
    wxDEFAULT_FRAME_STYLE_NO_CLIP | wxHSCROLL | wxVSCROLL);
index 3a7abc3fa1ea508eaacb102283285da0a263495c..f5f513f79897a6e46f768c787b015e706c0b5d6a 100644 (file)
@@ -276,7 +276,7 @@ wxShape::wxShape(wxShapeCanvas *can)
   m_pen = g_oglBlackPen;
   m_brush = wxWHITE_BRUSH;
   m_font = g_oglNormalFont;
-  m_textColour = wxBLACK;
+  m_textColour = wxT("BLACK");
   m_textColourName = wxT("BLACK");
   m_visible = FALSE;
   m_selected = FALSE;
@@ -753,8 +753,7 @@ int wxShape::GetFormatMode(int regionId) const
 
 void wxShape::SetTextColour(const wxString& the_colour, int regionId)
 {
-  wxColour *wxcolour = wxTheColourDatabase->FindColour(the_colour);
-  m_textColour = wxcolour;
+  m_textColour = wxTheColourDatabase->Find(the_colour);
   m_textColourName = the_colour;
 
   wxNode *node = m_regions.Item(regionId);
@@ -920,7 +919,7 @@ void wxShape::OnDrawContents(wxDC& dc)
     wxShapeRegion *region = (wxShapeRegion *)m_regions.GetFirst()->GetData();
     if (region->GetFont()) dc.SetFont(* region->GetFont());
 
-    dc.SetTextForeground(* (region->GetActualColourObject()));
+    dc.SetTextForeground(region->GetActualColourObject());
     dc.SetBackgroundMode(wxTRANSPARENT);
     if (!m_formatted)
     {
index b65c7df5b21884a5994512eaff0c5e24f739216f..35c591720c79c9fa697945462ad1560d999fbc8b 100644 (file)
@@ -1769,7 +1769,7 @@ wxShapeRegion::wxShapeRegion()
   m_textColour = wxT("BLACK");
   m_penColour = wxT("BLACK");
   m_penStyle = wxSOLID;
-  m_actualColourObject = NULL;
+  m_actualColourObject = wxTheColourDatabase->Find(wxT("BLACK"));
   m_actualPenObject = NULL;
 }
 
@@ -1790,7 +1790,7 @@ wxShapeRegion::wxShapeRegion(wxShapeRegion& region)
   m_regionProportionX = region.m_regionProportionX;
   m_regionProportionY = region.m_regionProportionY;
   m_formatMode = region.m_formatMode;
-  m_actualColourObject = NULL;
+  m_actualColourObject = region.m_actualColourObject;
   m_actualPenObject = NULL;
   m_penStyle = region.m_penStyle;
   m_penColour = region.m_penColour;
@@ -1862,15 +1862,12 @@ void wxShapeRegion::SetFormatMode(int mode)
 void wxShapeRegion::SetColour(const wxString& col)
 {
   m_textColour = col;
-  m_actualColourObject = NULL;
+  m_actualColourObject = col;
 }
 
-wxColour *wxShapeRegion::GetActualColourObject()
+wxColour wxShapeRegion::GetActualColourObject()
 {
-  if (!m_actualColourObject)
-    m_actualColourObject = wxTheColourDatabase->FindColour(GetColour());
-  if (!m_actualColourObject)
-    m_actualColourObject = wxBLACK;
+  m_actualColourObject = wxTheColourDatabase->Find(GetColour());
   return m_actualColourObject;
 }
 
index 359457b8ff28ce0fc3779c2a7ce4c6eeb43f9110..682bb2ebdcc4dfdb13204b3425194aa1da53aace 100644 (file)
@@ -52,7 +52,7 @@ void wxBitmapShape::OnDraw(wxDC& dc)
   if (!m_bitmap.Ok())
     return;
 
-  double x, y;
+  int x, y;
   x = WXROUND(m_xpos - m_bitmap.GetWidth() / 2.0);
   y = WXROUND(m_ypos - m_bitmap.GetHeight() / 2.0);
   dc.DrawBitmap(m_bitmap, x, y, true);
index 41e62564d38d55bd0711adfbe41ca5f9ac8e83db..50737984c032dc384c993b36a7ce56ef252bddbb 100644 (file)
@@ -81,7 +81,7 @@ void wxDividedShape::OnDrawContents(wxDC& dc)
 
   if (m_pen) dc.SetPen(* m_pen);
 
-  if (m_textColour) dc.SetTextForeground(* m_textColour);
+  dc.SetTextForeground(m_textColour);
 
 #ifdef __WXMSW__
   // For efficiency, don't do this under X - doesn't make
@@ -107,7 +107,7 @@ void wxDividedShape::OnDrawContents(wxDC& dc)
   {
     wxShapeRegion *region = (wxShapeRegion *)node->GetData();
     dc.SetFont(* region->GetFont());
-    dc.SetTextForeground(region->GetActualColourObject());
+    dc.SetTextForeground(region->GetActualColourObject());
 
     double proportion =
       region->m_regionProportionY < 0.0 ? defaultProportion : region->m_regionProportionY;
index 639015bda6710b0d0c35e24379f7434f4f50fdc6..95e02cb53a3be9193ddd6794b6e2a9bdb122ea92 100644 (file)
@@ -287,7 +287,7 @@ void wxLineShape::DrawRegion(wxDC& dc, wxShapeRegion *region, double x, double y
       dc.DrawRectangle((long)(xp - w/2.0), (long)(yp - h/2.0), (long)w, (long)h);
 
       if (m_pen) dc.SetPen(* m_pen);
-      dc.SetTextForeground(region->GetActualColourObject());
+      dc.SetTextForeground(region->GetActualColourObject());
 
 #ifdef __WXMSW__
       dc.SetTextBackground(GetBackgroundBrush().GetColour());
index 1fc7848fcb93d0c5e35228686f9adbbc76afcddb..8681b25c1d5ea943510ef936e6f08512790ee1e9 100644 (file)
@@ -653,18 +653,26 @@ bool wxXMetaFile::ReadFile(const wxChar *file)
             }
             break;
           }
+#if PS_DOT != BS_HATCHED
+          /* ABX 30.12.2003                                   */
+          /* in microsoft/include/wingdi.h  both are the same */
+          /* in fact I'm not sure  why pen related PS_XXX and */
+          /* BS_XXX constants are all mixed into single style */
+          case PS_DOT:
+            style = wxDOT;
+            break;
+#endif
+          case PS_DASH:
+            style = wxSHORT_DASH;
+            break;
+          case PS_NULL:
+            style = wxTRANSPARENT;
+            break;
           case BS_SOLID:
           default:
             style = wxSOLID;
             break;
         }
-        if (msStyle == PS_DOT)
-          style = wxDOT;
-        else if (msStyle == PS_DASH)
-          style = wxSHORT_DASH;
-        else if (msStyle == PS_NULL)
-          style = wxTRANSPARENT;
-        else style = wxSOLID;
 
         wxColour colour(GetRValue(colorref), GetGValue(colorref), GetBValue(colorref));
         rec->param1 = (long)wxTheBrushList->FindOrCreateBrush(colour, style);
index b0fdf825f7b51b165f469c37223157fff8f7f0cb..0b773e393ed07646a948aacc8c911f1c26b1b0f6 100644 (file)
@@ -411,6 +411,7 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double
       case 13:
       {
         new_line = TRUE; end_word = TRUE; i++;
+        break;
       }
       case wxT(' '):
       {