]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/src/ogl/lines.cpp
set SMALL_FONT for controls here because InheritAttributes() doesn't do it any longer
[wxWidgets.git] / contrib / src / ogl / lines.cpp
index 76f10c4aeb6c71d6ef1624d7d24931a3dc196261..95e02cb53a3be9193ddd6794b6e2a9bdb122ea92 100644 (file)
@@ -25,7 +25,7 @@
 #include <wx/wx.h>
 #endif
 
 #include <wx/wx.h>
 #endif
 
-#if wxUSE_DEPRECATED
+#if wxUSE_PROLOGIO
 #include <wx/deprecated/wxexpr.h>
 #endif
 
 #include <wx/deprecated/wxexpr.h>
 #endif
 
 #include <ctype.h>
 #include <math.h>
 
 #include <ctype.h>
 #include <math.h>
 
-#include <wx/ogl/basic.h>
-#include <wx/ogl/basicp.h>
-#include <wx/ogl/lines.h>
-#include <wx/ogl/linesp.h>
-#include <wx/ogl/drawn.h>
-#include <wx/ogl/misc.h>
-#include <wx/ogl/canvas.h>
+#include "wx/ogl/ogl.h"
+
 
 // Line shape
 IMPLEMENT_DYNAMIC_CLASS(wxLineShape, wxShape)
 
 // Line shape
 IMPLEMENT_DYNAMIC_CLASS(wxLineShape, wxShape)
@@ -120,8 +115,7 @@ void wxLineShape::MakeLineControlPoints(int n)
   }
   m_lineControlPoints = new wxList;
 
   }
   m_lineControlPoints = new wxList;
 
-  int i = 0;
-  for (i = 0; i < n; i++)
+  for (int i = 0; i < n; i++)
   {
     wxRealPoint *point = new wxRealPoint(-999, -999);
     m_lineControlPoints->Append((wxObject*) point);
   {
     wxRealPoint *point = new wxRealPoint(-999, -999);
     m_lineControlPoints->Append((wxObject*) point);
@@ -293,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.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());
 
 #ifdef __WXMSW__
       dc.SetTextBackground(GetBackgroundBrush().GetColour());
@@ -519,7 +513,7 @@ bool wxLineShape::HitTest(double x, double y, int *attachment, double *distance)
       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);
       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)
     if ((fabs(distance_from_seg) < extra &&
          distance_from_prev >= 0 && distance_from_prev <= seg_len)
         || inLabelRegion)
@@ -603,7 +597,7 @@ void wxLineShape::DrawArrow(wxDC& dc, wxArrowHead *arrow, double xOffset, bool p
   double positionOnLineX, positionOnLineY;
 
   // Position of start point of line, at the end of which we draw the arrow.
   double positionOnLineX, positionOnLineY;
 
   // Position of start point of line, at the end of which we draw the arrow.
-  double startPositionX, startPositionY;
+  double startPositionX = 0.0 , startPositionY = 0.0;
 
   switch (arrow->GetPosition())
   {
 
   switch (arrow->GetPosition())
   {
@@ -696,7 +690,7 @@ void wxLineShape::DrawArrow(wxDC& dc, wxArrowHead *arrow, double xOffset, bool p
      double y3 = positionOnLineY;
      double d = -arrow->GetYOffset(); // Negate so +offset is above line
 
      double y3 = positionOnLineY;
      double d = -arrow->GetYOffset(); // Negate so +offset is above line
 
-     double theta = 0.0;
+     double theta;
      if (x3 == x1)
        theta = (double)(myPi/2.0);
      else
      if (x3 == x1)
        theta = (double)(myPi/2.0);
      else
@@ -751,7 +745,7 @@ void wxLineShape::DrawArrow(wxDC& dc, wxArrowHead *arrow, double xOffset, bool p
 
       dc.SetPen(* m_pen);
       if (arrow->_GetType() == ARROW_HOLLOW_CIRCLE)
 
       dc.SetPen(* m_pen);
       if (arrow->_GetType() == ARROW_HOLLOW_CIRCLE)
-        dc.SetBrush(* g_oglWhiteBackgroundBrush);
+        dc.SetBrush(GetBackgroundBrush());
       else
         dc.SetBrush(* m_brush);
 
       else
         dc.SetBrush(* m_brush);
 
@@ -967,7 +961,7 @@ void wxLineShape::FindNth(wxShape *image, int *nth, int *no_arcs, bool incoming)
   *no_arcs = num;
 }
 
   *no_arcs = num;
 }
 
-void wxLineShape::OnDrawOutline(wxDC& dc, double x, double y, double w, double h)
+void wxLineShape::OnDrawOutline(wxDC& dc, double WXUNUSED(x), double WXUNUSED(y), double WXUNUSED(w), double WXUNUSED(h))
 {
   wxPen *old_pen = m_pen;
   wxBrush *old_brush = m_brush;
 {
   wxPen *old_pen = m_pen;
   wxBrush *old_brush = m_brush;
@@ -984,7 +978,7 @@ void wxLineShape::OnDrawOutline(wxDC& dc, double x, double y, double w, double h
   else SetBrush(NULL);
 }
 
   else SetBrush(NULL);
 }
 
-bool wxLineShape::OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display)
+bool wxLineShape::OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool WXUNUSED(display))
 {
   double x_offset = x - old_x;
   double y_offset = y - old_y;
 {
   double x_offset = x - old_x;
   double y_offset = y - old_y;
@@ -1043,9 +1037,9 @@ void wxLineShape::OnMoveLink(wxDC& dc, bool moveControlPoints)
     FindLineEndPoints(&end_x, &end_y, &other_end_x, &other_end_y);
 
     wxNode *first = m_lineControlPoints->GetFirst();
     FindLineEndPoints(&end_x, &end_y, &other_end_x, &other_end_y);
 
     wxNode *first = m_lineControlPoints->GetFirst();
-    wxRealPoint *first_point = (wxRealPoint *)first->GetData();
+    /* wxRealPoint *first_point = */ (wxRealPoint *)first->GetData();
     wxNode *last = m_lineControlPoints->GetLast();
     wxNode *last = m_lineControlPoints->GetLast();
-    wxRealPoint *last_point = (wxRealPoint *)last->GetData();
+    /* wxRealPoint *last_point = */ (wxRealPoint *)last->GetData();
 
 /* This is redundant, surely? Done by SetEnds.
     first_point->x = end_x; first_point->y = end_y;
 
 /* This is redundant, surely? Done by SetEnds.
     first_point->x = end_x; first_point->y = end_y;
@@ -1100,9 +1094,9 @@ void wxLineShape::FindLineEndPoints(double *fromX, double *fromY, double *toX, d
   double other_end_x, other_end_y;
 
   wxNode *first = m_lineControlPoints->GetFirst();
   double other_end_x, other_end_y;
 
   wxNode *first = m_lineControlPoints->GetFirst();
-  wxRealPoint *first_point = (wxRealPoint *)first->GetData();
+  /* wxRealPoint *first_point = */ (wxRealPoint *)first->GetData();
   wxNode *last = m_lineControlPoints->GetLast();
   wxNode *last = m_lineControlPoints->GetLast();
-  wxRealPoint *last_point = (wxRealPoint *)last->GetData();
+  /* wxRealPoint *last_point = */ (wxRealPoint *)last->GetData();
 
   wxNode *second = first->GetNext();
   wxRealPoint *second_point = (wxRealPoint *)second->GetData();
 
   wxNode *second = first->GetNext();
   wxRealPoint *second_point = (wxRealPoint *)second->GetData();
@@ -1245,15 +1239,15 @@ void wxLineShape::OnEraseControlPoints(wxDC& dc)
   wxShape::OnEraseControlPoints(dc);
 }
 
   wxShape::OnEraseControlPoints(dc);
 }
 
-void wxLineShape::OnDragLeft(bool draw, double x, double y, int keys, int attachment)
+void wxLineShape::OnDragLeft(bool WXUNUSED(draw), double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys), int WXUNUSED(attachment))
 {
 }
 
 {
 }
 
-void wxLineShape::OnBeginDragLeft(double x, double y, int keys, int attachment)
+void wxLineShape::OnBeginDragLeft(double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys), int WXUNUSED(attachment))
 {
 }
 
 {
 }
 
-void wxLineShape::OnEndDragLeft(double x, double y, int keys, int attachment)
+void wxLineShape::OnEndDragLeft(double WXUNUSED(x), double WXUNUSED(y), int WXUNUSED(keys), int WXUNUSED(attachment))
 {
 }
 
 {
 }
 
@@ -1376,23 +1370,23 @@ void wxLineShape::WriteAttributes(wxExpr *clause)
   wxShape::WriteAttributes(clause);
 
   if (m_from)
   wxShape::WriteAttributes(clause);
 
   if (m_from)
-    clause->AddAttributeValue("from", m_from->GetId());
+    clause->AddAttributeValue(_T("from"), m_from->GetId());
   if (m_to)
   if (m_to)
-    clause->AddAttributeValue("to", m_to->GetId());
+    clause->AddAttributeValue(_T("to"), m_to->GetId());
 
   if (m_attachmentTo != 0)
 
   if (m_attachmentTo != 0)
-    clause->AddAttributeValue("attachment_to", (long)m_attachmentTo);
+    clause->AddAttributeValue(_T("attachment_to"), (long)m_attachmentTo);
   if (m_attachmentFrom != 0)
   if (m_attachmentFrom != 0)
-    clause->AddAttributeValue("attachment_from", (long)m_attachmentFrom);
+    clause->AddAttributeValue(_T("attachment_from"), (long)m_attachmentFrom);
 
   if (m_alignmentStart != 0)
 
   if (m_alignmentStart != 0)
-    clause->AddAttributeValue("align_start", (long)m_alignmentStart);
+    clause->AddAttributeValue(_T("align_start"), (long)m_alignmentStart);
   if (m_alignmentEnd != 0)
   if (m_alignmentEnd != 0)
-    clause->AddAttributeValue("align_end", (long)m_alignmentEnd);
+    clause->AddAttributeValue(_T("align_end"), (long)m_alignmentEnd);
 
 
-  clause->AddAttributeValue("is_spline", (long)m_isSpline);
+  clause->AddAttributeValue(_T("is_spline"), (long)m_isSpline);
   if (m_maintainStraightLines)
   if (m_maintainStraightLines)
-    clause->AddAttributeValue("keep_lines_straight", (long)m_maintainStraightLines);
+    clause->AddAttributeValue(_T("keep_lines_straight"), (long)m_maintainStraightLines);
 
   // Make a list of lists for the (sp)line controls
   wxExpr *list = new wxExpr(wxExprList);
 
   // Make a list of lists for the (sp)line controls
   wxExpr *list = new wxExpr(wxExprList);
@@ -1409,7 +1403,7 @@ void wxLineShape::WriteAttributes(wxExpr *clause)
 
     node = node->GetNext();
   }
 
     node = node->GetNext();
   }
-  clause->AddAttributeValue("controls", list);
+  clause->AddAttributeValue(_T("controls"), list);
 
   // Write arc arrows in new OGL format, if there are any.
   // This is a list of lists. Each sublist comprises:
 
   // Write arc arrows in new OGL format, if there are any.
   // This is a list of lists. Each sublist comprises:
@@ -1437,7 +1431,7 @@ void wxLineShape::WriteAttributes(wxExpr *clause)
 
       node = node->GetNext();
     }
 
       node = node->GetNext();
     }
-    clause->AddAttributeValue("arrows", arrow_list);
+    clause->AddAttributeValue(_T("arrows"), arrow_list);
   }
 }
 
   }
 }
 
@@ -1460,7 +1454,7 @@ void wxLineShape::ReadAttributes(wxExpr *clause)
   if (m_regions.GetCount() == 0)
   {
     wxShapeRegion *newRegion = new wxShapeRegion;
   if (m_regions.GetCount() == 0)
   {
     wxShapeRegion *newRegion = new wxShapeRegion;
-    newRegion->SetName("Middle");
+    newRegion->SetName(_T("Middle"));
     newRegion->SetSize(150, 50);
     m_regions.Append((wxObject *)newRegion);
     if (m_text.GetCount() > 0)
     newRegion->SetSize(150, 50);
     m_regions.Append((wxObject *)newRegion);
     if (m_text.GetCount() > 0)
@@ -1731,7 +1725,7 @@ void wxLineControlPoint::OnEndDragLeft(double x, double y, int keys, int attachm
 
 // Control points ('handles') redirect control to the actual shape, to make it easier
 // to override sizing behaviour.
 
 // Control points ('handles') redirect control to the actual shape, to make it easier
 // to override sizing behaviour.
-void wxLineShape::OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y, int keys, int attachment)
+void wxLineShape::OnSizingDragLeft(wxControlPoint* pt, bool WXUNUSED(draw), double x, double y, int WXUNUSED(keys), int WXUNUSED(attachment))
 {
   wxLineControlPoint* lpt = (wxLineControlPoint*) pt;
 
 {
   wxLineControlPoint* lpt = (wxLineControlPoint*) pt;
 
@@ -1773,7 +1767,7 @@ void wxLineShape::OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, doub
 
 }
 
 
 }
 
-void wxLineShape::OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys, int attachment)
+void wxLineShape::OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int WXUNUSED(keys), int WXUNUSED(attachment))
 {
   wxLineControlPoint* lpt = (wxLineControlPoint*) pt;
 
 {
   wxLineControlPoint* lpt = (wxLineControlPoint*) pt;
 
@@ -1821,7 +1815,7 @@ void wxLineShape::OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y,
   }
 }
 
   }
 }
 
-void wxLineShape::OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int keys, int attachment)
+void wxLineShape::OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int WXUNUSED(keys), int WXUNUSED(attachment))
 {
   wxLineControlPoint* lpt = (wxLineControlPoint*) pt;
 
 {
   wxLineControlPoint* lpt = (wxLineControlPoint*) pt;
 
@@ -2041,9 +2035,9 @@ bool wxLineShape::AddArrowOrdered(wxArrowHead *arrow, wxList& referenceList, int
     return TRUE;
   }
 
     return TRUE;
   }
 
+  wxArrowHead *currArrow = (wxArrowHead *)currNode->GetData();
   while (refNode && currNode)
   {
   while (refNode && currNode)
   {
-    wxArrowHead *currArrow = (wxArrowHead *)currNode->GetData();
     refArrow = (wxArrowHead *)refNode->GetData();
 
     // Matching: advance current arrow pointer
     refArrow = (wxArrowHead *)refNode->GetData();
 
     // Matching: advance current arrow pointer
@@ -2323,7 +2317,7 @@ int wxLineShape::GetAlignmentType(bool isEnd)
 wxRealPoint *wxLineShape::GetNextControlPoint(wxShape *nodeObject)
 {
   int n = m_lineControlPoints->GetCount();
 wxRealPoint *wxLineShape::GetNextControlPoint(wxShape *nodeObject)
 {
   int n = m_lineControlPoints->GetCount();
-  int nn = 0;
+  int nn;
   if (m_to == nodeObject)
   {
     // Must be END of line, so we want (n - 1)th control point.
   if (m_to == nodeObject)
   {
     // Must be END of line, so we want (n - 1)th control point.
@@ -2444,7 +2438,7 @@ void wxLabelShape::OnDraw(wxDC& dc)
       dc.DrawRectangle(WXROUND(x1), WXROUND(y1), WXROUND(m_width), WXROUND(m_height));
 }
 
       dc.DrawRectangle(WXROUND(x1), WXROUND(y1), WXROUND(m_width), WXROUND(m_height));
 }
 
-void wxLabelShape::OnDrawContents(wxDC& dc)
+void wxLabelShape::OnDrawContents(wxDC& WXUNUSED(dc))
 {
 }
 
 {
 }
 
@@ -2468,7 +2462,7 @@ bool wxLabelShape::OnMovePre(wxDC& dc, double x, double y, double old_x, double
     return m_lineShape->OnLabelMovePre(dc, this, x, y, old_x, old_y, display);
 }
 
     return m_lineShape->OnLabelMovePre(dc, this, x, y, old_x, old_y, display);
 }
 
-bool wxLineShape::OnLabelMovePre(wxDC& dc, wxLabelShape* labelShape, double x, double y, double old_x, double old_y, bool display)
+bool wxLineShape::OnLabelMovePre(wxDC& dc, wxLabelShape* labelShape, double x, double y, double WXUNUSED(old_x), double WXUNUSED(old_y), bool WXUNUSED(display))
 {
   labelShape->m_shapeRegion->SetSize(labelShape->GetWidth(), labelShape->GetHeight());
 
 {
   labelShape->m_shapeRegion->SetSize(labelShape->GetWidth(), labelShape->GetHeight());