Applied patch [ 868061 ] Warning free OGL

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25096 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2004-01-08 14:35:36 +00:00
parent 6c155d3387
commit 93210c68cb
12 changed files with 48 additions and 38 deletions

View File

@@ -530,7 +530,7 @@ class WXDLLIMPEXP_OGL wxShape: public wxShapeEvtHandler
wxPen* m_pen; wxPen* m_pen;
wxBrush* m_brush; wxBrush* m_brush;
wxFont* m_font; wxFont* m_font;
wxColour* m_textColour; wxColour m_textColour;
wxString m_textColourName; wxString m_textColourName;
wxShapeCanvas* m_canvas; wxShapeCanvas* m_canvas;
wxList m_lines; wxList m_lines;

View File

@@ -157,7 +157,7 @@ class WXDLLIMPEXP_OGL wxShapeRegion: public wxObject
inline int GetFormatMode() const { return m_formatMode; } inline int GetFormatMode() const { return m_formatMode; }
inline wxString GetName() const { return m_regionName; } inline wxString GetName() const { return m_regionName; }
inline wxString GetColour() const { return m_textColour; } inline wxString GetColour() const { return m_textColour; }
wxColour *GetActualColourObject(); wxColour GetActualColourObject();
inline wxList& GetFormattedText() { return m_formattedText; } inline wxList& GetFormattedText() { return m_formattedText; }
inline wxString GetPenColour() const { return m_penColour; } inline wxString GetPenColour() const { return m_penColour; }
inline int GetPenStyle() const { return m_penStyle; } inline int GetPenStyle() const { return m_penStyle; }
@@ -188,7 +188,7 @@ public:
int m_formatMode; // FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT | FORMAT_NONE int m_formatMode; // FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT | FORMAT_NONE
wxString m_regionName; wxString m_regionName;
wxString m_textColour; 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 // New members for specifying divided rectangle division colour/style 30/6/94
wxString m_penColour; wxString m_penColour;

View File

@@ -59,9 +59,9 @@ class WXDLLIMPEXP_OGL wxDrawOp: public wxObject
public: public:
inline wxDrawOp(int theOp) { m_op = theOp; } inline wxDrawOp(int theOp) { m_op = theOp; }
inline ~wxDrawOp() {} inline ~wxDrawOp() {}
inline virtual void Scale(double xScale, double yScale) {}; inline virtual void Scale(double WXUNUSED(xScale), double WXUNUSED(yScale)) {};
inline virtual void Translate(double x, double y) {}; inline virtual void Translate(double WXUNUSED(x), double WXUNUSED(y)) {};
inline virtual void Rotate(double x, double y, double theta, double sinTheta, double cosTheta) {}; 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 void Do(wxDC& dc, double xoffset, double yoffset) = 0;
virtual wxDrawOp *Copy(wxPseudoMetaFile *newImage) = 0; virtual wxDrawOp *Copy(wxPseudoMetaFile *newImage) = 0;
#if wxUSE_PROLOGIO #if wxUSE_PROLOGIO
@@ -71,15 +71,15 @@ public:
inline int GetOp() const { return m_op; } inline int GetOp() const { return m_op; }
// Draw an outline using the current operation. By default, return FALSE (not drawn) // 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, virtual bool OnDrawOutline(wxDC& WXUNUSED(dc), double WXUNUSED(x), double WXUNUSED(y), double WXUNUSED(w), double WXUNUSED(h),
double oldW, double oldH) { return FALSE; } double WXUNUSED(oldW), double WXUNUSED(oldH)) { return FALSE; }
// Get the perimeter point using this data // Get the perimeter point using this data
virtual bool GetPerimeterPoint(double x1, double y1, virtual bool GetPerimeterPoint(double WXUNUSED(x1), double WXUNUSED(y1),
double x2, double y2, double WXUNUSED(x2), double WXUNUSED(y2),
double *x3, double *y3, double *WXUNUSED(x3), double *WXUNUSED(y3),
double xOffset, double yOffset, double WXUNUSED(xOffset), double WXUNUSED(yOffset),
int attachmentMode) int WXUNUSED(attachmentMode))
{ return FALSE; } { return FALSE; }
protected: protected:

View File

@@ -169,6 +169,7 @@ bool wxDiagramClipboard::DoCopy(wxDiagram* diagramFrom, wxDiagram* diagramTo, bo
// these to the Windows clipboard // these to the Windows clipboard
bool wxDiagramClipboard::CopyToClipboard(double scale) bool wxDiagramClipboard::CopyToClipboard(double scale)
{ {
#if wxUSE_METAFILE
// Make a metafile DC // Make a metafile DC
wxMetaFileDC mfDC; wxMetaFileDC mfDC;
if (mfDC.Ok()) if (mfDC.Ok())
@@ -230,7 +231,11 @@ bool wxDiagramClipboard::CopyToClipboard(double scale)
delete mf; delete mf;
} }
return TRUE; return true;
#else
wxMessageBox("wxUSE_METAFILE in build required to use Clipboard", _T("Clipboard copy problem"));
return false;
#endif
} }
#endif #endif
// __WXMSW__ // __WXMSW__

View File

@@ -119,7 +119,7 @@ bool csApp::OnInit(void)
// area doesn't refresh properly when we change its position, under Windows. // area doesn't refresh properly when we change its position, under Windows.
#define wxDEFAULT_FRAME_STYLE_NO_CLIP \ #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, csFrame* frame = new csFrame(m_docManager, NULL, -1, _T("OGL Studio"), m_mainFramePos, m_mainFrameSize,
wxDEFAULT_FRAME_STYLE_NO_CLIP | wxHSCROLL | wxVSCROLL); wxDEFAULT_FRAME_STYLE_NO_CLIP | wxHSCROLL | wxVSCROLL);

View File

@@ -276,7 +276,7 @@ wxShape::wxShape(wxShapeCanvas *can)
m_pen = g_oglBlackPen; m_pen = g_oglBlackPen;
m_brush = wxWHITE_BRUSH; m_brush = wxWHITE_BRUSH;
m_font = g_oglNormalFont; m_font = g_oglNormalFont;
m_textColour = wxBLACK; m_textColour = wxT("BLACK");
m_textColourName = wxT("BLACK"); m_textColourName = wxT("BLACK");
m_visible = FALSE; m_visible = FALSE;
m_selected = FALSE; m_selected = FALSE;
@@ -753,8 +753,7 @@ int wxShape::GetFormatMode(int regionId) const
void wxShape::SetTextColour(const wxString& the_colour, int regionId) void wxShape::SetTextColour(const wxString& the_colour, int regionId)
{ {
wxColour *wxcolour = wxTheColourDatabase->FindColour(the_colour); m_textColour = wxTheColourDatabase->Find(the_colour);
m_textColour = wxcolour;
m_textColourName = the_colour; m_textColourName = the_colour;
wxNode *node = m_regions.Item(regionId); wxNode *node = m_regions.Item(regionId);
@@ -920,7 +919,7 @@ void wxShape::OnDrawContents(wxDC& dc)
wxShapeRegion *region = (wxShapeRegion *)m_regions.GetFirst()->GetData(); wxShapeRegion *region = (wxShapeRegion *)m_regions.GetFirst()->GetData();
if (region->GetFont()) dc.SetFont(* region->GetFont()); if (region->GetFont()) dc.SetFont(* region->GetFont());
dc.SetTextForeground(* (region->GetActualColourObject())); dc.SetTextForeground(region->GetActualColourObject());
dc.SetBackgroundMode(wxTRANSPARENT); dc.SetBackgroundMode(wxTRANSPARENT);
if (!m_formatted) if (!m_formatted)
{ {

View File

@@ -1769,7 +1769,7 @@ wxShapeRegion::wxShapeRegion()
m_textColour = wxT("BLACK"); m_textColour = wxT("BLACK");
m_penColour = wxT("BLACK"); m_penColour = wxT("BLACK");
m_penStyle = wxSOLID; m_penStyle = wxSOLID;
m_actualColourObject = NULL; m_actualColourObject = wxTheColourDatabase->Find(wxT("BLACK"));
m_actualPenObject = NULL; m_actualPenObject = NULL;
} }
@@ -1790,7 +1790,7 @@ wxShapeRegion::wxShapeRegion(wxShapeRegion& region)
m_regionProportionX = region.m_regionProportionX; m_regionProportionX = region.m_regionProportionX;
m_regionProportionY = region.m_regionProportionY; m_regionProportionY = region.m_regionProportionY;
m_formatMode = region.m_formatMode; m_formatMode = region.m_formatMode;
m_actualColourObject = NULL; m_actualColourObject = region.m_actualColourObject;
m_actualPenObject = NULL; m_actualPenObject = NULL;
m_penStyle = region.m_penStyle; m_penStyle = region.m_penStyle;
m_penColour = region.m_penColour; m_penColour = region.m_penColour;
@@ -1862,15 +1862,12 @@ void wxShapeRegion::SetFormatMode(int mode)
void wxShapeRegion::SetColour(const wxString& col) void wxShapeRegion::SetColour(const wxString& col)
{ {
m_textColour = col; m_textColour = col;
m_actualColourObject = NULL; m_actualColourObject = col;
} }
wxColour *wxShapeRegion::GetActualColourObject() wxColour wxShapeRegion::GetActualColourObject()
{ {
if (!m_actualColourObject) m_actualColourObject = wxTheColourDatabase->Find(GetColour());
m_actualColourObject = wxTheColourDatabase->FindColour(GetColour());
if (!m_actualColourObject)
m_actualColourObject = wxBLACK;
return m_actualColourObject; return m_actualColourObject;
} }

View File

@@ -52,7 +52,7 @@ void wxBitmapShape::OnDraw(wxDC& dc)
if (!m_bitmap.Ok()) if (!m_bitmap.Ok())
return; return;
double x, y; int x, y;
x = WXROUND(m_xpos - m_bitmap.GetWidth() / 2.0); x = WXROUND(m_xpos - m_bitmap.GetWidth() / 2.0);
y = WXROUND(m_ypos - m_bitmap.GetHeight() / 2.0); y = WXROUND(m_ypos - m_bitmap.GetHeight() / 2.0);
dc.DrawBitmap(m_bitmap, x, y, true); dc.DrawBitmap(m_bitmap, x, y, true);

View File

@@ -81,7 +81,7 @@ void wxDividedShape::OnDrawContents(wxDC& dc)
if (m_pen) dc.SetPen(* m_pen); if (m_pen) dc.SetPen(* m_pen);
if (m_textColour) dc.SetTextForeground(* m_textColour); dc.SetTextForeground(m_textColour);
#ifdef __WXMSW__ #ifdef __WXMSW__
// For efficiency, don't do this under X - doesn't make // 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(); wxShapeRegion *region = (wxShapeRegion *)node->GetData();
dc.SetFont(* region->GetFont()); dc.SetFont(* region->GetFont());
dc.SetTextForeground(* region->GetActualColourObject()); dc.SetTextForeground(region->GetActualColourObject());
double proportion = double proportion =
region->m_regionProportionY < 0.0 ? defaultProportion : region->m_regionProportionY; region->m_regionProportionY < 0.0 ? defaultProportion : region->m_regionProportionY;

View 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); dc.DrawRectangle((long)(xp - w/2.0), (long)(yp - h/2.0), (long)w, (long)h);
if (m_pen) dc.SetPen(* m_pen); if (m_pen) dc.SetPen(* m_pen);
dc.SetTextForeground(* region->GetActualColourObject()); dc.SetTextForeground(region->GetActualColourObject());
#ifdef __WXMSW__ #ifdef __WXMSW__
dc.SetTextBackground(GetBackgroundBrush().GetColour()); dc.SetTextBackground(GetBackgroundBrush().GetColour());

View File

@@ -653,18 +653,26 @@ bool wxXMetaFile::ReadFile(const wxChar *file)
} }
break; 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: case BS_SOLID:
default: default:
style = wxSOLID; style = wxSOLID;
break; 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)); wxColour colour(GetRValue(colorref), GetGValue(colorref), GetBValue(colorref));
rec->param1 = (long)wxTheBrushList->FindOrCreateBrush(colour, style); rec->param1 = (long)wxTheBrushList->FindOrCreateBrush(colour, style);

View File

@@ -411,6 +411,7 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double
case 13: case 13:
{ {
new_line = TRUE; end_word = TRUE; i++; new_line = TRUE; end_word = TRUE; i++;
break;
} }
case wxT(' '): case wxT(' '):
{ {