From 93210c68cb8ad36a5b2d7f07e93735041657c534 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 8 Jan 2004 14:35:36 +0000 Subject: [PATCH] Applied patch [ 868061 ] Warning free OGL git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25096 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/include/wx/ogl/basic.h | 2 +- contrib/include/wx/ogl/basicp.h | 4 ++-- contrib/include/wx/ogl/drawnp.h | 20 ++++++++++---------- contrib/samples/ogl/studio/csprint.cpp | 7 ++++++- contrib/samples/ogl/studio/studio.cpp | 2 +- contrib/src/ogl/basic.cpp | 7 +++---- contrib/src/ogl/basic2.cpp | 13 +++++-------- contrib/src/ogl/bmpshape.cpp | 2 +- contrib/src/ogl/divided.cpp | 4 ++-- contrib/src/ogl/lines.cpp | 2 +- contrib/src/ogl/mfutils.cpp | 22 +++++++++++++++------- contrib/src/ogl/oglmisc.cpp | 1 + 12 files changed, 48 insertions(+), 38 deletions(-) diff --git a/contrib/include/wx/ogl/basic.h b/contrib/include/wx/ogl/basic.h index 5839382e33..8a2debc068 100644 --- a/contrib/include/wx/ogl/basic.h +++ b/contrib/include/wx/ogl/basic.h @@ -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; diff --git a/contrib/include/wx/ogl/basicp.h b/contrib/include/wx/ogl/basicp.h index 6c0e1e8368..f9ce75c669 100644 --- a/contrib/include/wx/ogl/basicp.h +++ b/contrib/include/wx/ogl/basicp.h @@ -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; diff --git a/contrib/include/wx/ogl/drawnp.h b/contrib/include/wx/ogl/drawnp.h index d80643301b..d837811f7c 100644 --- a/contrib/include/wx/ogl/drawnp.h +++ b/contrib/include/wx/ogl/drawnp.h @@ -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: diff --git a/contrib/samples/ogl/studio/csprint.cpp b/contrib/samples/ogl/studio/csprint.cpp index 4d17b59ab7..680fef2ff8 100644 --- a/contrib/samples/ogl/studio/csprint.cpp +++ b/contrib/samples/ogl/studio/csprint.cpp @@ -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__ diff --git a/contrib/samples/ogl/studio/studio.cpp b/contrib/samples/ogl/studio/studio.cpp index 7940916eb5..f3d414eeee 100644 --- a/contrib/samples/ogl/studio/studio.cpp +++ b/contrib/samples/ogl/studio/studio.cpp @@ -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); diff --git a/contrib/src/ogl/basic.cpp b/contrib/src/ogl/basic.cpp index 3a7abc3fa1..f5f513f798 100644 --- a/contrib/src/ogl/basic.cpp +++ b/contrib/src/ogl/basic.cpp @@ -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) { diff --git a/contrib/src/ogl/basic2.cpp b/contrib/src/ogl/basic2.cpp index b65c7df5b2..35c591720c 100644 --- a/contrib/src/ogl/basic2.cpp +++ b/contrib/src/ogl/basic2.cpp @@ -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; } diff --git a/contrib/src/ogl/bmpshape.cpp b/contrib/src/ogl/bmpshape.cpp index 359457b8ff..682bb2ebdc 100644 --- a/contrib/src/ogl/bmpshape.cpp +++ b/contrib/src/ogl/bmpshape.cpp @@ -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); diff --git a/contrib/src/ogl/divided.cpp b/contrib/src/ogl/divided.cpp index 41e62564d3..50737984c0 100644 --- a/contrib/src/ogl/divided.cpp +++ b/contrib/src/ogl/divided.cpp @@ -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; diff --git a/contrib/src/ogl/lines.cpp b/contrib/src/ogl/lines.cpp index 639015bda6..95e02cb53a 100644 --- a/contrib/src/ogl/lines.cpp +++ b/contrib/src/ogl/lines.cpp @@ -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()); diff --git a/contrib/src/ogl/mfutils.cpp b/contrib/src/ogl/mfutils.cpp index 1fc7848fcb..8681b25c1d 100644 --- a/contrib/src/ogl/mfutils.cpp +++ b/contrib/src/ogl/mfutils.cpp @@ -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); diff --git a/contrib/src/ogl/oglmisc.cpp b/contrib/src/ogl/oglmisc.cpp index b0fdf825f7..0b773e393e 100644 --- a/contrib/src/ogl/oglmisc.cpp +++ b/contrib/src/ogl/oglmisc.cpp @@ -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(' '): { -- 2.45.2