OGL fixes; documentation fixes; dialog editor updates

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@447 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1998-08-06 19:42:06 +00:00
parent c6cdf16c93
commit 5de76427c8
41 changed files with 911 additions and 361 deletions

View File

@@ -2108,8 +2108,8 @@ wxShape *wxShape::CreateNewCopy(bool resetMapping, bool recompute)
{
wxShapeEvtHandler* newHandler = GetEventHandler()->CreateNewCopy();
newObject->SetEventHandler(newHandler);
newObject->SetPreviousHandler(newObject);
newHandler->SetPreviousHandler(newHandler);
newObject->SetPreviousHandler(NULL);
newHandler->SetPreviousHandler(newObject);
newHandler->SetShape(newObject);
}

View File

@@ -467,6 +467,7 @@ class wxPolygonShape: public wxShape
// Takes a list of wxRealPoints; each point is an OFFSET from the centre.
// Deletes user's points in destructor.
virtual void Create(wxList *points);
virtual void ClearPoints();
void GetBoundingBoxMin(float *w, float *h);
void CalculateBoundingBox();

View File

@@ -67,6 +67,8 @@ wxPolygonShape::wxPolygonShape()
void wxPolygonShape::Create(wxList *the_points)
{
ClearPoints();
m_originalPoints = the_points;
// Duplicate the list of points
@@ -87,6 +89,11 @@ void wxPolygonShape::Create(wxList *the_points)
}
wxPolygonShape::~wxPolygonShape()
{
ClearPoints();
}
void wxPolygonShape::ClearPoints()
{
if (m_points)
{
@@ -99,6 +106,7 @@ wxPolygonShape::~wxPolygonShape()
node = m_points->First();
}
delete m_points;
m_points = NULL;
}
if (m_originalPoints)
{
@@ -111,6 +119,7 @@ wxPolygonShape::~wxPolygonShape()
node = m_originalPoints->First();
}
delete m_originalPoints;
m_originalPoints = NULL;
}
}
@@ -534,7 +543,7 @@ void wxPolygonShape::OnDrawOutline(wxDC& dc, float x, float y, float w, float h)
intPoints[i].y = (int) point->y;
}
dc.DrawPolygon(n, intPoints, x, y);
// wxShape::OnDrawOutline(x, y, w, h);
delete[] intPoints;
}
// Make as many control points as there are vertices.
@@ -834,14 +843,9 @@ void wxPolygonShape::Copy(wxShape& copy)
wxPolygonShape& polyCopy = (wxPolygonShape&) copy;
if (polyCopy.m_points)
delete polyCopy.m_points;
polyCopy.ClearPoints();
polyCopy.m_points = new wxList;
if (polyCopy.m_originalPoints)
delete polyCopy.m_originalPoints;
polyCopy.m_originalPoints = new wxList;
wxNode *node = m_points->First();

View File

@@ -32,7 +32,7 @@
#include "constrnt.h"
#include "canvas.h"
wxList OGLConstraintTypes(wxKEY_INTEGER);
wxList *OGLConstraintTypes = NULL;
/*
* Constraint type
@@ -54,52 +54,73 @@ OGLConstraintType::~OGLConstraintType()
void OGLInitializeConstraintTypes()
{
OGLConstraintTypes.Append(gyCONSTRAINT_CENTRED_VERTICALLY,
new OGLConstraintType(gyCONSTRAINT_CENTRED_VERTICALLY, "Centre vertically", "centred vertically w.r.t."));
if (!OGLConstraintTypes)
return;
OGLConstraintTypes.Append(gyCONSTRAINT_CENTRED_HORIZONTALLY,
new OGLConstraintType(gyCONSTRAINT_CENTRED_HORIZONTALLY, "Centre horizontally", "centred horizontally w.r.t."));
OGLConstraintTypes = new wxList(wxKEY_INTEGER);
OGLConstraintTypes.Append(gyCONSTRAINT_CENTRED_BOTH,
new OGLConstraintType(gyCONSTRAINT_CENTRED_BOTH, "Centre", "centred w.r.t."));
OGLConstraintTypes->Append(gyCONSTRAINT_CENTRED_VERTICALLY,
new OGLConstraintType(gyCONSTRAINT_CENTRED_VERTICALLY, "Centre vertically", "centred vertically w.r.t."));
OGLConstraintTypes.Append(gyCONSTRAINT_LEFT_OF,
new OGLConstraintType(gyCONSTRAINT_LEFT_OF, "Left of", "left of"));
OGLConstraintTypes->Append(gyCONSTRAINT_CENTRED_HORIZONTALLY,
new OGLConstraintType(gyCONSTRAINT_CENTRED_HORIZONTALLY, "Centre horizontally", "centred horizontally w.r.t."));
OGLConstraintTypes.Append(gyCONSTRAINT_RIGHT_OF,
new OGLConstraintType(gyCONSTRAINT_RIGHT_OF, "Right of", "right of"));
OGLConstraintTypes->Append(gyCONSTRAINT_CENTRED_BOTH,
new OGLConstraintType(gyCONSTRAINT_CENTRED_BOTH, "Centre", "centred w.r.t."));
OGLConstraintTypes.Append(gyCONSTRAINT_ABOVE,
new OGLConstraintType(gyCONSTRAINT_ABOVE, "Above", "above"));
OGLConstraintTypes->Append(gyCONSTRAINT_LEFT_OF,
new OGLConstraintType(gyCONSTRAINT_LEFT_OF, "Left of", "left of"));
OGLConstraintTypes.Append(gyCONSTRAINT_BELOW,
new OGLConstraintType(gyCONSTRAINT_BELOW, "Below", "below"));
OGLConstraintTypes->Append(gyCONSTRAINT_RIGHT_OF,
new OGLConstraintType(gyCONSTRAINT_RIGHT_OF, "Right of", "right of"));
// Alignment
OGLConstraintTypes.Append(gyCONSTRAINT_ALIGNED_TOP,
new OGLConstraintType(gyCONSTRAINT_ALIGNED_TOP, "Top-aligned", "aligned to the top of"));
OGLConstraintTypes->Append(gyCONSTRAINT_ABOVE,
new OGLConstraintType(gyCONSTRAINT_ABOVE, "Above", "above"));
OGLConstraintTypes.Append(gyCONSTRAINT_ALIGNED_BOTTOM,
new OGLConstraintType(gyCONSTRAINT_ALIGNED_BOTTOM, "Bottom-aligned", "aligned to the bottom of"));
OGLConstraintTypes->Append(gyCONSTRAINT_BELOW,
new OGLConstraintType(gyCONSTRAINT_BELOW, "Below", "below"));
OGLConstraintTypes.Append(gyCONSTRAINT_ALIGNED_LEFT,
new OGLConstraintType(gyCONSTRAINT_ALIGNED_LEFT, "Left-aligned", "aligned to the left of"));
// Alignment
OGLConstraintTypes->Append(gyCONSTRAINT_ALIGNED_TOP,
new OGLConstraintType(gyCONSTRAINT_ALIGNED_TOP, "Top-aligned", "aligned to the top of"));
OGLConstraintTypes.Append(gyCONSTRAINT_ALIGNED_RIGHT,
new OGLConstraintType(gyCONSTRAINT_ALIGNED_RIGHT, "Right-aligned", "aligned to the right of"));
OGLConstraintTypes->Append(gyCONSTRAINT_ALIGNED_BOTTOM,
new OGLConstraintType(gyCONSTRAINT_ALIGNED_BOTTOM, "Bottom-aligned", "aligned to the bottom of"));
// Mid-alignment
OGLConstraintTypes.Append(gyCONSTRAINT_MIDALIGNED_TOP,
new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_TOP, "Top-midaligned", "centred on the top of"));
OGLConstraintTypes->Append(gyCONSTRAINT_ALIGNED_LEFT,
new OGLConstraintType(gyCONSTRAINT_ALIGNED_LEFT, "Left-aligned", "aligned to the left of"));
OGLConstraintTypes.Append(gyCONSTRAINT_MIDALIGNED_BOTTOM,
new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_BOTTOM, "Bottom-midaligned", "centred on the bottom of"));
OGLConstraintTypes->Append(gyCONSTRAINT_ALIGNED_RIGHT,
new OGLConstraintType(gyCONSTRAINT_ALIGNED_RIGHT, "Right-aligned", "aligned to the right of"));
OGLConstraintTypes.Append(gyCONSTRAINT_MIDALIGNED_LEFT,
new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_LEFT, "Left-midaligned", "centred on the left of"));
// Mid-alignment
OGLConstraintTypes->Append(gyCONSTRAINT_MIDALIGNED_TOP,
new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_TOP, "Top-midaligned", "centred on the top of"));
OGLConstraintTypes.Append(gyCONSTRAINT_MIDALIGNED_RIGHT,
new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_RIGHT, "Right-midaligned", "centred on the right of"));
OGLConstraintTypes->Append(gyCONSTRAINT_MIDALIGNED_BOTTOM,
new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_BOTTOM, "Bottom-midaligned", "centred on the bottom of"));
OGLConstraintTypes->Append(gyCONSTRAINT_MIDALIGNED_LEFT,
new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_LEFT, "Left-midaligned", "centred on the left of"));
OGLConstraintTypes->Append(gyCONSTRAINT_MIDALIGNED_RIGHT,
new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_RIGHT, "Right-midaligned", "centred on the right of"));
}
void OGLCleanUpConstraintTypes()
{
if (!OGLConstraintTypes)
return;
wxNode* node = OGLConstraintTypes->First();
while (node)
{
OGLConstraintType* ct = (OGLConstraintType*) node->Data();
delete ct;
node = node->Next();
}
delete OGLConstraintTypes;
OGLConstraintTypes = NULL;
}
/*

View File

@@ -35,7 +35,7 @@ public:
};
extern wxList OGLConstraintTypes;
extern wxList* OGLConstraintTypes;
#define gyCONSTRAINT_CENTRED_VERTICALLY 1
#define gyCONSTRAINT_CENTRED_HORIZONTALLY 2
@@ -81,6 +81,7 @@ class OGLConstraint: public wxObject
};
void OGLInitializeConstraintTypes();
void OGLCleanUpConstraintTypes();
#endif
// _OGL_CONSTRNT_H_

View File

@@ -109,6 +109,7 @@ wxLineShape::~wxLineShape()
m_labelObjects[i] = NULL;
}
}
ClearArrowsAtPosition(-1);
}
void wxLineShape::MakeLineControlPoints(int n)

View File

@@ -89,17 +89,49 @@ void wxOGLInitialize()
void wxOGLCleanUp()
{
if (GraphicsBuffer)
{
delete[] GraphicsBuffer;
if (GraphicsBuffer)
{
delete[] GraphicsBuffer;
GraphicsBuffer = NULL;
}
GraphicsBuffer = NULL;
}
GraphicsBuffer = NULL;
if (oglPopupDivisionMenu)
{
delete oglPopupDivisionMenu;
oglPopupDivisionMenu = NULL;
}
if (oglPopupDivisionMenu)
{
delete oglPopupDivisionMenu;
oglPopupDivisionMenu = NULL;
}
if (g_oglNormalFont)
{
delete g_oglNormalFont;
g_oglNormalFont = NULL;
}
if (black_pen)
{
delete black_pen;
black_pen = NULL;
}
if (white_background_pen)
{
delete white_background_pen;
white_background_pen = NULL;
}
if (transparent_pen)
{
delete transparent_pen;
transparent_pen = NULL;
}
if (white_background_brush)
{
delete white_background_brush;
white_background_brush = NULL;
}
if (black_foreground_pen)
{
delete black_foreground_pen;
black_foreground_pen = NULL;
}
OGLCleanUpConstraintTypes();
}
wxFont *MatchFont(int point_size)