summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6ee3c06)
Also fixed .dsp file to reflect oglmisc.cpp name
Fixed some warnings
Added test for wxUSE_PROLOGIO
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22237
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxOutputStream& DiagramDocument::SaveObject(wxOutputStream& stream)
{
wxOutputStream& DiagramDocument::SaveObject(wxOutputStream& stream)
{
wxDocument::SaveObject(stream);
char buf[400];
(void) wxGetTempFileName("diag", buf);
wxDocument::SaveObject(stream);
char buf[400];
(void) wxGetTempFileName("diag", buf);
wxTransferFileToStream(buf, stream);
wxRemoveFile(buf);
wxTransferFileToStream(buf, stream);
wxRemoveFile(buf);
return stream;
}
wxInputStream& DiagramDocument::LoadObject(wxInputStream& stream)
{
return stream;
}
wxInputStream& DiagramDocument::LoadObject(wxInputStream& stream)
{
wxDocument::LoadObject(stream);
wxDocument::LoadObject(stream);
char buf[400];
(void) wxGetTempFileName("diag", buf);
char buf[400];
(void) wxGetTempFileName("diag", buf);
diagram.DeleteAllShapes();
diagram.LoadFile(buf);
wxRemoveFile(buf);
diagram.DeleteAllShapes();
diagram.LoadFile(buf);
wxRemoveFile(buf);
bool MyDiagram::OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
{
bool MyDiagram::OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
{
#include <wx/string.h>
#include <wx/deprecated/setup.h>
#include <wx/string.h>
#include <wx/deprecated/setup.h>
#include <wx/deprecated/wxexpr.h>
#include <wx/deprecated/wxexpr.h>
#include <wx/ogl/ogl.h>
#if wxUSE_STD_IOSTREAM
#include <wx/ogl/ogl.h>
#if wxUSE_STD_IOSTREAM
{
public:
MyDiagram(void) {}
{
public:
MyDiagram(void) {}
bool OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr);
bool OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr);
bool OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr);
bool OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr);
# End Source File
# Begin Source File
# End Source File
# Begin Source File
# End Source File
# Begin Source File
# End Source File
# Begin Source File
# End Source File
# End Target
# End Project
# End Source File
# End Target
# End Project
{
// Don't preserve old ordering if we have new ordering instructions
m_lines.DeleteObject(line);
{
// Don't preserve old ordering if we have new ordering instructions
m_lines.DeleteObject(line);
- if (positionFrom < m_lines.GetCount())
+ if (positionFrom < (int) m_lines.GetCount())
{
wxNode* node = m_lines.Item(positionFrom);
m_lines.Insert(node, line);
{
wxNode* node = m_lines.Item(positionFrom);
m_lines.Insert(node, line);
{
// Don't preserve old ordering if we have new ordering instructions
other->m_lines.DeleteObject(line);
{
// Don't preserve old ordering if we have new ordering instructions
other->m_lines.DeleteObject(line);
- if (positionTo < other->m_lines.GetCount())
+ if (positionTo < (int) other->m_lines.GetCount())
{
wxNode* node = other->m_lines.Item(positionTo);
other->m_lines.Insert(node, line);
{
wxNode* node = other->m_lines.Item(positionTo);
other->m_lines.Insert(node, line);
// Return the zero-based position in m_lines of line.
int wxShape::GetLinePosition(wxLineShape* line)
{
// Return the zero-based position in m_lines of line.
int wxShape::GetLinePosition(wxLineShape* line)
{
for (i = 0; i < m_lines.GetCount(); i++)
if ((wxLineShape*) (m_lines.Item(i)->GetData()) == line)
return i;
for (i = 0; i < m_lines.GetCount(); i++)
if ((wxLineShape*) (m_lines.Item(i)->GetData()) == line)
return i;
double y = (double)((secondPoint->y - firstPoint->y)/2.0 + firstPoint->y);
wxRealPoint *point = new wxRealPoint(x, y);
double y = (double)((secondPoint->y - firstPoint->y)/2.0 + firstPoint->y);
wxRealPoint *point = new wxRealPoint(x, y);
- if (pos >= (m_points->GetCount() - 1))
+ if (pos >= (int) (m_points->GetCount() - 1))
m_points->Append((wxObject*) point);
else
m_points->Insert(node2, (wxObject*) point);
m_points->Append((wxObject*) point);
else
m_points->Insert(node2, (wxObject*) point);
bool wxPolygonShape::GetAttachmentPosition(int attachment, double *x, double *y,
int nth, int no_arcs, wxLineShape *line)
{
bool wxPolygonShape::GetAttachmentPosition(int attachment, double *x, double *y,
int nth, int no_arcs, wxLineShape *line)
{
- if ((m_attachmentMode == ATTACHMENT_MODE_EDGE) && m_points && attachment < m_points->GetCount())
+ if ((m_attachmentMode == ATTACHMENT_MODE_EDGE) && m_points && attachment < (int) m_points->GetCount())
{
wxRealPoint *point = (wxRealPoint *)m_points->Item(attachment)->GetData();
*x = point->x + m_xpos;
{
wxRealPoint *point = (wxRealPoint *)m_points->Item(attachment)->GetData();
*x = point->x + m_xpos;
if (!m_points)
return FALSE;
if (!m_points)
return FALSE;
- if ((attachment >= 0) && (attachment < m_points->GetCount()))
+ if ((attachment >= 0) && (attachment < (int) m_points->GetCount()))
return TRUE;
wxNode *node = m_attachmentPoints.GetFirst();
return TRUE;
wxNode *node = m_attachmentPoints.GetFirst();
wxRealPoint *point1 = (wxRealPoint *)node->GetData();
wxRealPoint *point2 = (wxRealPoint *)node->GetNext()->GetData();
wxRealPoint *point1 = (wxRealPoint *)node->GetData();
wxRealPoint *point2 = (wxRealPoint *)node->GetNext()->GetData();
- // Allow for inaccurate mousing or vert/horiz lines
+ // For inaccurate mousing allow 8 pixel corridor
- double left = wxMin(point1->x, point2->x) - extra;
- double right = wxMax(point1->x, point2->x) + extra;
- double bottom = wxMin(point1->y, point2->y) - extra;
- double top = wxMax(point1->y, point2->y) + extra;
-
- if ((x > left && x < right && y > bottom && y < top) || inLabelRegion)
+ double dx = point2->x - point1->x;
+ double dy = point2->y - point1->y;
+ double seg_len = sqrt(dx*dx+dy*dy);
+ double distance_from_seg =
+ seg_len*((x-point1->x)*dy-(y-point1->y)*dx)/(dy*dy+dx*dx);
+ double distance_from_prev =
+ seg_len*((y-point1->y)*dy+(x-point1->x)*dx)/(dy*dy+dx*dx);
+
+ if ((fabs(distance_from_seg) < extra &&
+ distance_from_prev >= 0 && distance_from_prev <= seg_len)
+ || inLabelRegion)
- // Work out distance from centre of line
- double centre_x = (double)(left + (right - left)/2.0);
- double centre_y = (double)(bottom + (top - bottom)/2.0);
-
- *distance = (double)sqrt((centre_x - x)*(centre_x - x) + (centre_y - y)*(centre_y - y));
+ *distance = distance_from_seg;
wxLineShape* lineShape1 = (wxLineShape*) shape1;
// Iterate through the segments
wxList* pts1 = lineShape1->GetLineControlPoints();
wxLineShape* lineShape1 = (wxLineShape*) shape1;
// Iterate through the segments
wxList* pts1 = lineShape1->GetLineControlPoints();
for (i = 0; i < (pts1->GetCount() - 1); i++)
{
wxRealPoint* pt1_a = (wxRealPoint*) (pts1->Item(i)->GetData());
for (i = 0; i < (pts1->GetCount() - 1); i++)
{
wxRealPoint* pt1_a = (wxRealPoint*) (pts1->Item(i)->GetData());
// Iterate through the segments
wxList* pts2 = lineShape2->GetLineControlPoints();
int j;
// Iterate through the segments
wxList* pts2 = lineShape2->GetLineControlPoints();
int j;
- for (j = 0; j < (pts2->GetCount() - 1); j++)
+ for (j = 0; j < (int) (pts2->GetCount() - 1); j++)
{
wxRealPoint* pt2_a = (wxRealPoint*) (pts2->Item(j)->GetData());
wxRealPoint* pt2_b = (wxRealPoint*) (pts2->Item(j+1)->GetData());
{
wxRealPoint* pt2_a = (wxRealPoint*) (pts2->Item(j)->GetData());
wxRealPoint* pt2_b = (wxRealPoint*) (pts2->Item(j+1)->GetData());