[dasher] Fix box outlines, remove Opts::ColorScheme (as never used to do anything!)



commit 9e12a48dda818a512161fb03146679fb87a48ba5
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Tue Oct 12 15:50:49 2010 +0100

    Fix box outlines, remove Opts::ColorScheme (as never used to do anything!)
    
    Standardize meaning of iOutlineColor (-1 => use default 3) & iWidth (draw if >=1)
      inc fixing Win32 Screen, various comments; MacOSX default in COSXDasherScreen not DasherViewAqua/OpenGL/Cocoa
    DasherViewSquare renders nodes with outline colour -1 not node colour
      iff node different colour from parent (getColour() is never -1)
    DisjointRender always fills nodes, outlines if LP_OUTLINE_WIDTH!=0
    Make overlapping rects (NewRender()) the default RenderStyle.

 Src/DasherCore/ActionButton.cpp           |    2 +-
 Src/DasherCore/DasherNode.h               |    3 +-
 Src/DasherCore/DasherScreen.h             |    6 +--
 Src/DasherCore/DasherTypes.h              |    4 --
 Src/DasherCore/DasherView.cpp             |   16 +++-----
 Src/DasherCore/DasherView.h               |   14 ++++---
 Src/DasherCore/DasherViewSquare.cpp       |   58 +++++++++++++---------------
 Src/DasherCore/DefaultFilter.cpp          |    2 +-
 Src/DasherCore/OneButtonDynamicFilter.cpp |    4 +-
 Src/DasherCore/Parameters.h               |    2 +-
 Src/DasherCore/TwoBoxStartHandler.cpp     |    4 +-
 Src/DasherCore/TwoPushDynamicFilter.cpp   |    2 +-
 Src/Gtk2/Canvas.cpp                       |    2 +-
 Src/Gtk2/Canvas.h                         |    6 +--
 Src/Gtk2/CanvasExperimental.cpp           |    2 +-
 Src/Gtk2/CanvasExperimental.h             |    9 ++--
 Src/MacOSX/COSXDasherScreen.h             |    9 ++--
 Src/MacOSX/COSXDasherScreen.mm            |    6 +-
 Src/MacOSX/DasherViewAqua.mm              |    2 +-
 Src/MacOSX/DasherViewOpenGL.mm            |    3 +-
 Src/Win32/Widgets/Screen.cpp              |    5 +-
 Src/Win32/Widgets/Screen.h                |    2 -
 Src/Win32/Widgets/Screen.inl              |   19 +--------
 Src/iPhone/Classes/CDasherScreenBridge.h  |    8 ++--
 Src/iPhone/Classes/CDasherScreenBridge.mm |    2 +-
 25 files changed, 81 insertions(+), 111 deletions(-)
---
diff --git a/Src/DasherCore/ActionButton.cpp b/Src/DasherCore/ActionButton.cpp
index 49b5586..2ab631d 100644
--- a/Src/DasherCore/ActionButton.cpp
+++ b/Src/DasherCore/ActionButton.cpp
@@ -19,7 +19,7 @@ void CActionButton::SetPosition(int iX, int iY, int iWidth, int iHeight) {
 
 void CActionButton::Draw(Dasher::CDasherScreen *pScreen, bool bVisible) {
   if(bVisible || m_bAlwaysVisible)
-    pScreen->DrawRectangle(m_iX, m_iY, m_iX + m_iWidth, m_iY + m_iHeight, 1, 2, Dasher::Opts::Nodes1, 1);
+    pScreen->DrawRectangle(m_iX, m_iY, m_iX + m_iWidth, m_iY + m_iHeight, 1, 2, 1);
 }
 
 bool CActionButton::HandleClickDown(int iTime, int iX, int iY, bool bVisible) {
diff --git a/Src/DasherCore/DasherNode.h b/Src/DasherCore/DasherNode.h
index b6f4f4a..bc7939e 100644
--- a/Src/DasherCore/DasherNode.h
+++ b/Src/DasherCore/DasherNode.h
@@ -62,7 +62,8 @@ class Dasher::CDasherNode:private NoClones {
  public:
 
   /// Display attributes of this node, used for rendering.
-  /// Colour: -1 for invisible
+  /// Colour; note invisible nodes just have the same colour as their parent.
+  /// (so we know what colour to use when their parents are deleted)
   inline int getColour() {return m_iColour;}
   inline std::string &getDisplayText() {return m_strDisplayText;}
   ///Whether labels on child nodes should be displaced to the right of this node's label.
diff --git a/Src/DasherCore/DasherScreen.h b/Src/DasherCore/DasherScreen.h
index 5be6704..6a0e3e1 100644
--- a/Src/DasherCore/DasherScreen.h
+++ b/Src/DasherCore/DasherScreen.h
@@ -71,11 +71,9 @@ public:
   /// \param x2 bottom right of rectangle (x coordinate)
   /// \param y2 bottom right of rectangle (y coordinate)
   /// \param Colour the colour to be used (numeric), or -1 for no fill
-  /// \param iOutlineColour The colour for the node outlines, or -1 for no outline
-  /// \param ColorScheme Which colourscheme is to be used
+  /// \param iOutlineColour The colour for the node outlines; -1 = use default
   /// \param iThickness Line thickness for outline; <1 for no outline
-
-  virtual void DrawRectangle(screenint x1, screenint y1, screenint x2, screenint y2, int Colour, int iOutlineColour, Opts::ColorSchemes ColorScheme, int iThickness) = 0;
+  virtual void DrawRectangle(screenint x1, screenint y1, screenint x2, screenint y2, int Colour, int iOutlineColour, int iThickness) = 0;
 
   virtual void DrawCircle(screenint iCX, screenint iCY, screenint iR, int iColour, int iFillColour, int iThickness, bool bFill) = 0;
 
diff --git a/Src/DasherCore/DasherTypes.h b/Src/DasherCore/DasherTypes.h
index 1de308c..cbb66b1 100644
--- a/Src/DasherCore/DasherTypes.h
+++ b/Src/DasherCore/DasherTypes.h
@@ -72,10 +72,6 @@ namespace Dasher {
     enum FileEncodingFormats { UserDefault = -1, AlphabetDefault = -2, UTF8 = 65001, UTF16LE = 1200, UTF16BE = 1201 };
     enum AlphabetTypes { MyNone = 0, Arabic = 1256, Baltic = 1257, CentralEurope = 1250, ChineseSimplified = 936, ChineseTraditional = 950, Cyrillic = 1251, Greek = 1253, Hebrew = 1255, Japanese = 932, Korean = 949, Thai = 874, Turkish = 1254, VietNam = 1258, Western = 1252 };
     enum ScreenOrientations { Alphabet = -2, LeftToRight = 0, RightToLeft = 1, TopToBottom = 2, BottomToTop = 3 };
-    // TODO: Possibly make colors long and add an RGB item to this {{{
-    // Would allow literal as well as semantic colors for
-    // greater flexibility. }}}
-    enum ColorSchemes { Nodes1 = 0, Nodes2 = 1, Special1 = 2, Special2 = 3, Groups = 4, Objects = 5 };
     enum FontSize { Normal = 1, Big = 2, VBig = 4 };
   }
   struct ControlTree {
diff --git a/Src/DasherCore/DasherView.cpp b/Src/DasherCore/DasherView.cpp
index b615b8b..6b5540e 100644
--- a/Src/DasherCore/DasherView.cpp
+++ b/Src/DasherCore/DasherView.cpp
@@ -177,18 +177,14 @@ void CDasherView::DasherPolyarrow(myint *x, myint *y, int n, int iWidth, int iCo
   ScreenPoints[n+2].x = ScreenPoints[n-1].x + iXvec - iYvec;
   ScreenPoints[n+2].y = ScreenPoints[n-1].y + iXvec + iYvec;
 
-  if(iColour != -1) {
-    Screen()->Polyline(ScreenPoints, n+3, iWidth, iColour);
-  }
-  else {
-    Screen()->Polyline(ScreenPoints, n+3, iWidth,0);//no color given
-  }
+  Screen()->Polyline(ScreenPoints, n+3, iWidth, (iColour==-1) ? 0 : iColour);
+  
   delete[]ScreenPoints;
 }
 
 // Draw a box specified in Dasher co-ordinates
 
-void CDasherView::DasherDrawRectangle(myint iLeft, myint iTop, myint iRight, myint iBottom, const int Color, int iOutlineColour, Opts::ColorSchemes ColorScheme, int iThickness) {
+void CDasherView::DasherDrawRectangle(myint iLeft, myint iTop, myint iRight, myint iBottom, const int Color, int iOutlineColour, int iThickness) {
   screenint iScreenLeft;
   screenint iScreenTop;
   screenint iScreenRight;
@@ -197,18 +193,18 @@ void CDasherView::DasherDrawRectangle(myint iLeft, myint iTop, myint iRight, myi
   Dasher2Screen(iLeft, iTop, iScreenLeft, iScreenTop);
   Dasher2Screen(iRight, iBottom, iScreenRight, iScreenBottom);
 
-  Screen()->DrawRectangle(iScreenLeft, iScreenTop, iScreenRight, iScreenBottom, Color, iOutlineColour, ColorScheme, iThickness);
+  Screen()->DrawRectangle(iScreenLeft, iScreenTop, iScreenRight, iScreenBottom, Color, iOutlineColour, iThickness);
 }
 
 /// Draw a rectangle centred on a given dasher co-ordinate, but with a size specified in screen co-ordinates (used for drawing the mouse blob)
 
-void CDasherView::DasherDrawCentredRectangle(myint iDasherX, myint iDasherY, screenint iSize, const int Color, Opts::ColorSchemes ColorScheme, bool bDrawOutline) {
+void CDasherView::DasherDrawCentredRectangle(myint iDasherX, myint iDasherY, screenint iSize, const int Color, bool bDrawOutline) {
   screenint iScreenX;
   screenint iScreenY;
 
   Dasher2Screen(iDasherX, iDasherY, iScreenX, iScreenY);
 
-  Screen()->DrawRectangle(iScreenX - iSize, iScreenY - iSize, iScreenX + iSize, iScreenY + iSize, Color, -1, ColorScheme, bDrawOutline ? 1 : 0);
+  Screen()->DrawRectangle(iScreenX - iSize, iScreenY - iSize, iScreenX + iSize, iScreenY + iSize, Color, -1, bDrawOutline ? 1 : 0);
 }
 
 void CDasherView::DrawText(const std::string & str, myint x, myint y, int Size, int iColor) {
diff --git a/Src/DasherCore/DasherView.h b/Src/DasherCore/DasherView.h
index 6a16135..9a25807 100644
--- a/Src/DasherCore/DasherView.h
+++ b/Src/DasherCore/DasherView.h
@@ -139,22 +139,24 @@ public:
   void DasherPolyline(myint * x, myint * y, int n, int iWidth, int iColour);
 
   /// Draw a polyarrow
-
+  /// \param iColour line colour, as per Polyline (-1 => use "default" 0)
   void DasherPolyarrow(myint * x, myint * y, int n, int iWidth, int iColour, double dArrowSizeFactor = 0.7071);
 
   ///
   /// Draw a rectangle specified in Dasher co-ordinates
-  /// Color of -1 => no fill; any other value => fill in that color
-  /// iOutlineColor of -1 => no outline; any other value => outline in that color, EXCEPT
-  /// Thickness < 1 => no outline.
+  /// \param Color color in which to fill, -1 => no fill
+  /// \param iOutlineColor colour in which to draw outline, -1 => use default
+  /// \param iThickness line width for outline, < 1 => no outline.
   ///
-  void DasherDrawRectangle(myint iLeft, myint iTop, myint iRight, myint iBottom, const int Color, int iOutlineColour, Opts::ColorSchemes ColorScheme, int iThickness);
+  void DasherDrawRectangle(myint iLeft, myint iTop, myint iRight, myint iBottom, const int Color, int iOutlineColour, int iThickness);
 
   ///
   /// Draw a centred rectangle specified in Dasher co-ordinates (used for mouse cursor)
+  /// \param Color fill color for rectangle (-1 => don't fill)
+  /// \param bDrawOutline if true, rectangle will be outlined with width 1 and default line colour (-1 => 3)
   ///
 
-  void DasherDrawCentredRectangle(myint iDasherX, myint iDasherY, screenint iSize, const int Color, Opts::ColorSchemes ColorScheme, bool bDrawOutline);
+  void DasherDrawCentredRectangle(myint iDasherX, myint iDasherY, screenint iSize, const int Color, bool bDrawOutline);
 
   void DrawText(const std::string & str, myint x, myint y, int Size, int iColor);
 
diff --git a/Src/DasherCore/DasherViewSquare.cpp b/Src/DasherCore/DasherViewSquare.cpp
index a07a582..967692b 100644
--- a/Src/DasherCore/DasherViewSquare.cpp
+++ b/Src/DasherCore/DasherViewSquare.cpp
@@ -120,23 +120,23 @@ CDasherNode *CDasherViewSquare::Render(CDasherNode *pRoot, myint iRootMin, myint
   // Blank the region around the root node:
   if (GetLongParameter(LP_SHAPE_TYPE)==0) { //disjoint rects, so go round root
     if(iRootMin > iDasherMinY)
-      DasherDrawRectangle(iDasherMaxX, iDasherMinY, iDasherMinX, iRootMin, 0, -1, Nodes1, 0);
+      DasherDrawRectangle(iDasherMaxX, iDasherMinY, iDasherMinX, iRootMin, 0, -1, 0);
   
     if(iRootMax < iDasherMaxY)
-      DasherDrawRectangle(iDasherMaxX, iRootMax, iDasherMinX, iDasherMaxY, 0, -1, Nodes1, 0);
+      DasherDrawRectangle(iDasherMaxX, iRootMax, iDasherMinX, iDasherMaxY, 0, -1, 0);
 
     //to left (greater Dasher X)
     if (iRootMax - iRootMin < iDasherMaxX)
-      DasherDrawRectangle(iDasherMaxX, std::max(iRootMin,iDasherMinY), iRootMax-iRootMin, std::min(iRootMax,iDasherMaxY), 0, -1, Nodes1, 0);
+      DasherDrawRectangle(iDasherMaxX, std::max(iRootMin,iDasherMinY), iRootMax-iRootMin, std::min(iRootMax,iDasherMaxY), 0, -1, 0);
 
     //to right (margin)
-    DasherDrawRectangle(0, iDasherMinY, iDasherMinX, iDasherMaxY, 0, -1, Nodes1, 0);
+    DasherDrawRectangle(0, iDasherMinY, iDasherMinX, iDasherMaxY, 0, -1, 0);
     
     //and render root.
     DisjointRender(pRoot, iRootMin, iRootMax, NULL, policy, std::numeric_limits<double>::infinity(), 0, pOutput);
   } else {
     //overlapping rects/shapes
-    Screen()->DrawRectangle(0, 0, Screen()->GetWidth(), Screen()->GetHeight(), 0, -1, Nodes1, 0);
+    Screen()->DrawRectangle(0, 0, Screen()->GetWidth(), Screen()->GetHeight(), 0, -1, 0);
     NewRender(pRoot, iRootMin, iRootMax, NULL, policy, std::numeric_limits<double>::infinity(), 0, pOutput);
   }
 
@@ -369,7 +369,7 @@ void CDasherViewSquare::Circle(myint Range, myint y1, myint y2, int fCol, int oC
     if (x2==iDasherMaxX && x1==iDasherMaxX) {
       //circle entirely covers screen
       DASHER_ASSERT(y1==iDasherMinY);
-      DasherDrawRectangle(iDasherMaxX, iDasherMaxY, 0, iDasherMinY, fCol, oCol, Nodes1, lWidth);
+      DasherDrawRectangle(iDasherMaxX, iDasherMaxY, 0, iDasherMinY, fCol, oCol, lWidth);
       return;
     }
     //will also need final point at top-right (0,y2 in dasher coords)....
@@ -510,10 +510,8 @@ void CDasherViewSquare::DisjointRender(CDasherNode *pRender, myint y1, myint y2,
   if (pRender->ChildCount() == 0) {
     //allow empty node to be expanded, it's big enough.
     policy.pushNode(pRender, y1, y2, true, dMaxCost);
-    if (GetLongParameter(LP_OUTLINE_WIDTH)>=0) {
-      //and render whole node in one go
-      DasherDrawRectangle(std::min(Range,iDasherMaxX), std::min(y2,iDasherMaxY),0, std::max(y1,iDasherMinY), myColor, -1, Nodes1, 0);
-    }
+    //and render whole node in one go
+    DasherDrawRectangle(std::min(Range,iDasherMaxX), std::min(y2,iDasherMaxY),0, std::max(y1,iDasherMinY), myColor, -1, 0);
     //fall through to draw outline
   } else {
     //Node has children. It can therefore be collapsed...however,
@@ -537,8 +535,8 @@ void CDasherViewSquare::DisjointRender(CDasherNode *pRender, myint y1, myint y2,
         //still covers entire screen. Parent should too...
         DASHER_ASSERT(dMaxCost == std::numeric_limits<double>::infinity());
         
-        if (GetLongParameter(LP_OUTLINE_WIDTH)>=0 && newy2-newy1 < iDasherMaxX) //fill in to it's left...
-          DasherDrawRectangle(std::min(Range,iDasherMaxX), std::max(y1,iDasherMinY), newy2-newy1, std::min(y2,iDasherMaxY), myColor, -1, Nodes1, 0);
+        if (newy2-newy1 < iDasherMaxX) //fill in to it's left...
+          DasherDrawRectangle(std::min(Range,iDasherMaxX), std::max(y1,iDasherMinY), newy2-newy1, std::min(y2,iDasherMaxY), myColor, -1, 0);
         DisjointRender(pChild, newy1, newy2, pPrevText, 
                         policy, dMaxCost, myColor, pOutput);
         //leave pRender->onlyChildRendered set, so remaining children are skipped
@@ -561,7 +559,7 @@ void CDasherViewSquare::DisjointRender(CDasherNode *pRender, myint y1, myint y2,
           DASHER_ASSERT(dMaxCost == std::numeric_limits<double>::infinity());
           pRender->onlyChildRendered = pChild;
           if (newy2-newy1 < iDasherMaxX)
-            DasherDrawRectangle(std::min(Range,iDasherMaxX), std::max(y1,iDasherMinY), newy2-newy1, std::min(y2,iDasherMaxY), myColor, -1, Nodes1, 0);
+            DasherDrawRectangle(std::min(Range,iDasherMaxX), std::max(y1,iDasherMinY), newy2-newy1, std::min(y2,iDasherMaxY), myColor, -1, 0);
           DisjointRender(pChild, newy1, newy2, pPrevText, policy, dMaxCost, myColor, pOutput);
           //ensure we don't blank over this child in "finishing off" the parent (!)
           lasty=newy2;
@@ -573,13 +571,11 @@ void CDasherViewSquare::DisjointRender(CDasherNode *pRender, myint y1, myint y2,
             && newy1 <= iDasherMaxY && newy2 >= iDasherMinY) //at least partly on screen
         {
           //child should be rendered!
-          if (GetLongParameter(LP_OUTLINE_WIDTH)>=0) {
-            //fill in to its left
-            DasherDrawRectangle(std::min(y2-y1,iDasherMaxX), std::max(newy1,iDasherMinY), std::min(newy2-newy1,iDasherMaxX), std::min(newy2,iDasherMaxY), myColor, -1, Nodes1, 0);
-          
-            if (lasty<newy1) //fill in interval above child up to the last drawn child
-              DasherDrawRectangle(std::min(Range,iDasherMaxX), std::min(newy1,iDasherMaxY),0, std::max(lasty,iDasherMinY), myColor, -1, Nodes1, 0);
-          }
+          //fill in to its left
+          DasherDrawRectangle(std::min(y2-y1,iDasherMaxX), std::max(newy1,iDasherMinY), std::min(newy2-newy1,iDasherMaxX), std::min(newy2,iDasherMaxY), myColor, -1, 0);
+        
+          if (lasty<newy1) //fill in interval above child up to the last drawn child
+            DasherDrawRectangle(std::min(Range,iDasherMaxX), std::min(newy1,iDasherMaxY),0, std::max(lasty,iDasherMinY), myColor, -1, 0);
           lasty = newy2;
           DisjointRender(pChild, newy1, newy2, pPrevText, policy, dMaxCost, myColor, pOutput);
         } else {
@@ -593,16 +589,16 @@ void CDasherViewSquare::DisjointRender(CDasherNode *pRender, myint y1, myint y2,
         }
       }
       //all children rendered.
-      if (GetLongParameter(LP_OUTLINE_WIDTH)>=0 && lasty<y2) {
+      if (lasty<y2) {
         // Finish off the drawing process, filling in any part of the parent below the last-rendered child
-        DasherDrawRectangle(std::min(Range,iDasherMaxX), std::min(y2, iDasherMaxY), 0, std::max(lasty, iDasherMinY), myColor, -1, Nodes1, 0);
+        DasherDrawRectangle(std::min(Range,iDasherMaxX), std::min(y2, iDasherMaxY), 0, std::max(lasty, iDasherMinY), myColor, -1, 0);
       }
     }
     //end rendering children, fall through to outline
   }
   // Lastly, draw the outline
-  if(GetLongParameter(LP_OUTLINE_WIDTH) && pRender->getColour()!=-1) {
-    DasherDrawRectangle(std::min(Range,iDasherMaxX), std::min(y2,iDasherMaxY),0, std::max(y1,iDasherMinY), -1, myColor, Nodes1, abs(GetLongParameter(LP_OUTLINE_WIDTH)));
+  if(GetLongParameter(LP_OUTLINE_WIDTH) && (!pRender->Parent() || pRender->getColour()!=pRender->Parent()->getColour())) {
+    DasherDrawRectangle(std::min(Range,iDasherMaxX), std::min(y2,iDasherMaxY),0, std::max(y1,iDasherMinY), -1, -1, abs(GetLongParameter(LP_OUTLINE_WIDTH)));
   }
 }
 
@@ -641,7 +637,7 @@ void CDasherViewSquare::NewRender(CDasherNode *pRender, myint y1, myint y2,
   if (GetLongParameter(LP_OUTLINE_WIDTH)>=0) {
     switch (GetLongParameter(LP_SHAPE_TYPE)) {
       case 1: //overlapping rects
-        DasherDrawRectangle(std::min(Range,iDasherMaxX), std::min(y2,iDasherMaxY),0, std::max(y1,iDasherMinY), myColor, -1, Nodes1, 0);
+        DasherDrawRectangle(std::min(Range,iDasherMaxX), std::min(y2,iDasherMaxY),0, std::max(y1,iDasherMinY), myColor, -1, 0);
         break;
       case 2: //simple triangles
         TruncateTri(Range, y1, y2, (y1+y2)/2, (y1+y2)/2, myColor, -1, 0);
@@ -780,22 +776,22 @@ void CDasherViewSquare::NewRender(CDasherNode *pRender, myint y1, myint y2,
     //end rendering children, fall through to outline
   }
   // Lastly, draw the outline
-  if(GetLongParameter(LP_OUTLINE_WIDTH) && pRender->getColour()!=-1) {
+  if(GetLongParameter(LP_OUTLINE_WIDTH) && (!pRender->Parent() || pRender->getColour()!=pRender->Parent()->getColour())) {
     switch (GetLongParameter(LP_SHAPE_TYPE)) {
       case 1: //overlapping rects
-        DasherDrawRectangle(std::min(Range,iDasherMaxX), std::min(y2,iDasherMaxY),0, std::max(y1,iDasherMinY), -1, myColor, Nodes1, abs(GetLongParameter(LP_OUTLINE_WIDTH)));
+        DasherDrawRectangle(std::min(Range,iDasherMaxX), std::min(y2,iDasherMaxY),0, std::max(y1,iDasherMinY), -1, -1, abs(GetLongParameter(LP_OUTLINE_WIDTH)));
         break;
       case 2: //simple triangles
-        TruncateTri(Range, y1, y2, (y1+y2)/2, (y1+y2)/2, -1, myColor, abs(GetLongParameter(LP_OUTLINE_WIDTH)));
+        TruncateTri(Range, y1, y2, (y1+y2)/2, (y1+y2)/2, -1, -1, abs(GetLongParameter(LP_OUTLINE_WIDTH)));
         break;
       case 3: //truncated triangles
-        TruncateTri(Range, y1, y2, (y1+y1+y2)/3, (y1+y2+y2)/3, -1, myColor, abs(GetLongParameter(LP_OUTLINE_WIDTH)));
+        TruncateTri(Range, y1, y2, (y1+y1+y2)/3, (y1+y2+y2)/3, -1, -1, abs(GetLongParameter(LP_OUTLINE_WIDTH)));
         break;
       case 4:
-        Quadric(Range, y1, y2, -1, myColor, abs(GetLongParameter(LP_OUTLINE_WIDTH)));
+        Quadric(Range, y1, y2, -1, -1, abs(GetLongParameter(LP_OUTLINE_WIDTH)));
         break;
       case 5:
-        Circle(Range, y1, y2, -1, myColor, abs(GetLongParameter(LP_OUTLINE_WIDTH)));
+        Circle(Range, y1, y2, -1, -1, abs(GetLongParameter(LP_OUTLINE_WIDTH)));
         break;        
     }
   }
diff --git a/Src/DasherCore/DefaultFilter.cpp b/Src/DasherCore/DefaultFilter.cpp
index c8e9276..7f32047 100644
--- a/Src/DasherCore/DefaultFilter.cpp
+++ b/Src/DasherCore/DefaultFilter.cpp
@@ -139,7 +139,7 @@ void CDefaultFilter::DrawMouse(CDasherView *pView) {
   ApplyAutoCalibration(iDasherX, iDasherY, false);
   ApplyTransform(iDasherX, iDasherY);
 
-  pView->DasherDrawCentredRectangle(iDasherX, iDasherY, 5, 2, Opts::ColorSchemes(Opts::Objects), false);
+  pView->DasherDrawCentredRectangle(iDasherX, iDasherY, 5, 2, false);
 }
 
 void CDefaultFilter::DrawMouseLine(CDasherView *pView) {
diff --git a/Src/DasherCore/OneButtonDynamicFilter.cpp b/Src/DasherCore/OneButtonDynamicFilter.cpp
index d78f0e7..6655a79 100644
--- a/Src/DasherCore/OneButtonDynamicFilter.cpp
+++ b/Src/DasherCore/OneButtonDynamicFilter.cpp
@@ -79,7 +79,7 @@ bool COneButtonDynamicFilter::DecorateView(CDasherView *pView) {
     pView->Dasher2Screen(-200, 4096, x2, y2);
   }
 
-  pScreen->DrawRectangle(x1, y1, x2, y2, -1, 1, Opts::ColorSchemes(Opts::Objects), 2);
+  pScreen->DrawRectangle(x1, y1, x2, y2, -1, 1, 2);
     
   if(m_iTarget == 1) {
     pView->Dasher2Screen(-100, 3096, x1, y1);
@@ -90,7 +90,7 @@ bool COneButtonDynamicFilter::DecorateView(CDasherView *pView) {
     pView->Dasher2Screen(-200, 1000, x2, y2);
   }
 
-  pScreen->DrawRectangle(x1, y1, x2, y2, -1, 2, Opts::ColorSchemes(Opts::Objects), 1);
+  pScreen->DrawRectangle(x1, y1, x2, y2, -1, 2, 1);
 
   bool bRV(m_bDecorationChanged);
   m_bDecorationChanged = false;
diff --git a/Src/DasherCore/Parameters.h b/Src/DasherCore/Parameters.h
index 64df3f3..352711c 100644
--- a/Src/DasherCore/Parameters.h
+++ b/Src/DasherCore/Parameters.h
@@ -194,7 +194,7 @@ static lp_table longparamtable[] = {
   {LP_VIEW_ID, "ViewID", PERS, 1, "ViewID"},
   {LP_LANGUAGE_MODEL_ID, "LanguageModelID", PERS, 0, "LanguageModelID"},
   {LP_DASHER_FONTSIZE, "DasherFontSize", PERS, 2, "DasherFontSize"},
-  {LP_SHAPE_TYPE, "RenderStyle", PERS, 0, "Shapes to render in (0/1=disjoint/overlapping rects, 2/3=triangles/truncated, 4=quadrics, 5=circles)"},
+  {LP_SHAPE_TYPE, "RenderStyle", PERS, 1, "Shapes to render in (0/1=disjoint/overlapping rects, 2/3=triangles/truncated, 4=quadrics, 5=circles)"},
   {LP_UNIFORM, "UniformTimes1000", PERS, 50, "UniformTimes1000"},
   {LP_YSCALE, "YScaling", PERS, 0, "YScaling"},
   {LP_MOUSEPOSDIST, "MousePositionBoxDistance", PERS, 50, "MousePositionBoxDistance"},
diff --git a/Src/DasherCore/TwoBoxStartHandler.cpp b/Src/DasherCore/TwoBoxStartHandler.cpp
index 4f35d7b..796db99 100644
--- a/Src/DasherCore/TwoBoxStartHandler.cpp
+++ b/Src/DasherCore/TwoBoxStartHandler.cpp
@@ -17,11 +17,11 @@ bool CTwoBoxStartHandler::DecorateView(CDasherView *pView) {
 
   switch (iDrawMousePosBox) {
   case 1:
-    pView->Screen()->DrawRectangle(8, iHeight / 2 - iMousePosDist + 50, iWidth-16, iHeight / 2 - iMousePosDist - 50, -1, 119, Opts::Nodes1, 4);
+    pView->Screen()->DrawRectangle(8, iHeight / 2 - iMousePosDist + 50, iWidth-16, iHeight / 2 - iMousePosDist - 50, -1, 119, 4);
     return true;
     break;
   case 2:
-    pView->Screen()->DrawRectangle(8, iHeight / 2 + iMousePosDist + 50, iWidth-16, iHeight / 2 + iMousePosDist - 50, -1, 120, Opts::Nodes1, 4);
+    pView->Screen()->DrawRectangle(8, iHeight / 2 + iMousePosDist + 50, iWidth-16, iHeight / 2 + iMousePosDist - 50, -1, 120, 4);
     return true;
     break;
   default:
diff --git a/Src/DasherCore/TwoPushDynamicFilter.cpp b/Src/DasherCore/TwoPushDynamicFilter.cpp
index 4569271..01f4959 100644
--- a/Src/DasherCore/TwoPushDynamicFilter.cpp
+++ b/Src/DasherCore/TwoPushDynamicFilter.cpp
@@ -76,7 +76,7 @@ bool CTwoPushDynamicFilter::DecorateView(CDasherView *pView)
     pView->Dasher2Screen(-100, m_aaiGuideAreas[i][0], x1, y1);
     pView->Dasher2Screen(-1000, m_aaiGuideAreas[i][1], x2, y2);
   
-    pScreen->DrawRectangle(x1, y1, x2, y2, 62/*pale yellow*/, -1, Opts::Nodes1, 0);
+    pScreen->DrawRectangle(x1, y1, x2, y2, 62/*pale yellow*/, -1, 0);
   }
 
   //inner guides (red lines)
diff --git a/Src/Gtk2/Canvas.cpp b/Src/Gtk2/Canvas.cpp
index 11d4a00..d692127 100644
--- a/Src/Gtk2/Canvas.cpp
+++ b/Src/Gtk2/Canvas.cpp
@@ -187,7 +187,7 @@ void CCanvas::Display() {
   // gtk_main_iteration_do(0);
 }
 
-void CCanvas::DrawRectangle(screenint x1, screenint y1, screenint x2, screenint y2, int Color, int iOutlineColour, Opts::ColorSchemes ColorScheme, int iThickness) {
+void CCanvas::DrawRectangle(screenint x1, screenint y1, screenint x2, screenint y2, int Color, int iOutlineColour, int iThickness) {
 
   //  std::cout << "Raw Rectangle, (" << x1 << ", " << y1 << ") - (" << x2 << ", " << y2 << ")" << std::endl;
 
diff --git a/Src/Gtk2/Canvas.h b/Src/Gtk2/Canvas.h
index 125ce96..47ea95e 100644
--- a/Src/Gtk2/Canvas.h
+++ b/Src/Gtk2/Canvas.h
@@ -144,12 +144,10 @@ public:
   /// \param x2 x coordiate of the bottom right corner
   /// \param y2 y coordiate of the bottom right corner
   /// \param Color Colour to fill the rectangle (-1 = don't fill)
-  /// \param ColorScheme Which of the alternating colour schemes to use (be more precise)
-  /// \param iOutlineColour Colour to draw the outline
+  /// \param iOutlineColour Colour to draw the outline (-1 = use default)
   /// \param iThickness line width of outline (<=0 = don't outline)
   ///
-
-  void DrawRectangle(screenint x1, screenint y1, screenint x2, screenint y2, int Color, int iOutlineColour, Opts::ColorSchemes ColorScheme, int iThickness);
+  void DrawRectangle(screenint x1, screenint y1, screenint x2, screenint y2, int Color, int iOutlineColour, int iThickness);
 
   void DrawCircle(screenint iCX, screenint iCY, screenint iR, int iColour, int iFillColour, int iThickness, bool bFill);
 
diff --git a/Src/Gtk2/CanvasExperimental.cpp b/Src/Gtk2/CanvasExperimental.cpp
index 2d0dc40..74b0ee4 100644
--- a/Src/Gtk2/CanvasExperimental.cpp
+++ b/Src/Gtk2/CanvasExperimental.cpp
@@ -183,7 +183,7 @@ void CCanvas::Display() {
   gdk_draw_pixbuf(m_pCanvas->window, graphics_context, display_pixbuf, 0, 0, 0, 0, m_iWidth,m_iHeight, GDK_RGB_DITHER_NORMAL, 0, 0);
 }
 
-void CCanvas::DrawRectangle(int x1, int y1, int x2, int y2, int Color, int iOutlineColour, Opts::ColorSchemes ColorScheme, int iThickness) {
+void CCanvas::DrawRectangle(int x1, int y1, int x2, int y2, int Color, int iOutlineColour, int iThickness) {
 bool bFill= Color!=-1 && IGNAS_DRAW_MAIN_RECTANGLES;
 IGNAS_RECTANGLE_STOP_VOID
 IGNAS_STOP_VOID
diff --git a/Src/Gtk2/CanvasExperimental.h b/Src/Gtk2/CanvasExperimental.h
index 0e15d75..d1b6f6e 100644
--- a/Src/Gtk2/CanvasExperimental.h
+++ b/Src/Gtk2/CanvasExperimental.h
@@ -112,12 +112,11 @@ public:
   /// \param y1 y coordiate of the top left corner
   /// \param x2 x coordiate of the bottom right corner
   /// \param y2 y coordiate of the bottom right corner
-  /// \param Color Colour to draw the rectangle
-  /// \param ColorScheme Which of the alternating colour schemes to use (be more precise)
-  /// \param bDrawOutline Whether or not to draw outlines for the boxes
+  /// \param iColour Colour to fill rectangle, -1 = don't
+  /// \param iOutlineColour Colour to draw outline; -1 = use default
+  /// \param iThickness Line width in which to draw outline; -1 = don't
   ///
-
-  void DrawRectangle(screenint x1, screenint y1, screenint x2, screenint y2, int Color, int iOutlineColour, Opts::ColorSchemes ColorScheme, int iThickness);
+  void DrawRectangle(screenint x1, screenint y1, screenint x2, screenint y2, int Color, int iOutlineColour, int iThickness);
 
   void DrawCircle(screenint iCX, screenint iCY, screenint iR, int iColour, int iFillColour, int iThickness, bool bFill);
 
diff --git a/Src/MacOSX/COSXDasherScreen.h b/Src/MacOSX/COSXDasherScreen.h
index c108257..c8cf4e7 100644
--- a/Src/MacOSX/COSXDasherScreen.h
+++ b/Src/MacOSX/COSXDasherScreen.h
@@ -93,12 +93,11 @@ public:
   /// \param y1 y coordiate of the top left corner
   /// \param x2 x coordiate of the bottom right corner
   /// \param y2 y coordiate of the bottom right corner
-  /// \param Color Colour to draw the rectangle
-  /// \param ColorScheme Which of the alternating colour schemes to use (be more precise)
-  /// \param bDrawOutline Whether or not to draw outlines for the boxes
+  /// \param Color Colour to fill the rectangle (-1 = don't fill)
+  /// \param iOutlineColour Colour to draw outline (-1 = use default)
+  /// \param iThickness Line width for outline (<=0 => don't outline)
   ///
-  
-  void DrawRectangle(screenint x1, screenint y1, screenint x2, screenint y2, int Color, int iOutlineColour, Opts::ColorSchemes ColorScheme, int iThickness);
+  void DrawRectangle(screenint x1, screenint y1, screenint x2, screenint y2, int Color, int iOutlineColour, int iThickness);
   
   void DrawCircle(screenint iCX, screenint iCY, screenint iR, int iColour, int iFillColour, int iThickness, bool bFill);
   
diff --git a/Src/MacOSX/COSXDasherScreen.mm b/Src/MacOSX/COSXDasherScreen.mm
index 91d206e..50d81b3 100644
--- a/Src/MacOSX/COSXDasherScreen.mm
+++ b/Src/MacOSX/COSXDasherScreen.mm
@@ -28,9 +28,9 @@ void COSXDasherScreen::Display() {
   [dasherView displayCallback];
 }
 
-void COSXDasherScreen::DrawRectangle(int x1, int y1, int x2, int y2, int Color, int iOutlineColour, Opts::ColorSchemes ColorScheme, int iThickness) {
+void COSXDasherScreen::DrawRectangle(int x1, int y1, int x2, int y2, int Color, int iOutlineColour, int iThickness) {
 
-  [dasherView rectangleCallbackX1:x1 y1:y1 x2:x2 y2:y2 fillColorIndex:Color outlineColorIndex:iOutlineColour lineWidth:iThickness];
+  [dasherView rectangleCallbackX1:x1 y1:y1 x2:x2 y2:y2 fillColorIndex:Color outlineColorIndex:(iOutlineColour==-1 ? 3 : iOutlineColour) lineWidth:iThickness];
 }
 
 void COSXDasherScreen::DrawCircle(screenint iCX, screenint iCY, screenint iR, int iColour, int iFillColour, int iThickness, bool bFill) {
@@ -46,7 +46,7 @@ void COSXDasherScreen::Polygon(Dasher::CDasherScreen::point *Points, int Number,
     [p addObject:[NSValue valueWithPoint:NSMakePoint(Points[i].x, Points[i].y)]];
   }
   
-  [dasherView polygonCallbackPoints:p fillColorIndex:fillColour outlineColorIndex:outlineColour lineWidth:iWidth];
+  [dasherView polygonCallbackPoints:p fillColorIndex:fillColour outlineColorIndex:(outlineColour==-1 ? 3 : outlineColour) lineWidth:iWidth];
 }
 
 void COSXDasherScreen::Polyline(Dasher::CDasherScreen::point *Points, int Number, int iWidth, int Colour) {
diff --git a/Src/MacOSX/DasherViewAqua.mm b/Src/MacOSX/DasherViewAqua.mm
index 6b8234d..9fb4a5e 100755
--- a/Src/MacOSX/DasherViewAqua.mm
+++ b/Src/MacOSX/DasherViewAqua.mm
@@ -146,7 +146,7 @@
   }
   
   if (aLineWidth>0) {
-    [[self colorWithColorIndex:anOutlineColorIndex == -1 ? 3 : anOutlineColorIndex] set];
+    [[self colorWithColorIndex:anOutlineColorIndex] set];
     
     [NSBezierPath setDefaultLineWidth:aLineWidth];
     // gtk also sets these: GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND
diff --git a/Src/MacOSX/DasherViewOpenGL.mm b/Src/MacOSX/DasherViewOpenGL.mm
index 2c2e1a8..47867d4 100755
--- a/Src/MacOSX/DasherViewOpenGL.mm
+++ b/Src/MacOSX/DasherViewOpenGL.mm
@@ -147,7 +147,7 @@
 }
 
 
-- (void)rectangleCallbackX1:(int)x1 y1:(int)y1 x2:(int)x2 y2:(int)y2 fillColorIndex:(int)aFillColorIndex outlineColorIndex:(int)anOutlineColorIndex lineWidth:(int)aLineWidth {
+- (void)rectangleCallbackX1:(int)x1 y1:(int)y1 x2:(int)x2 y2:(int)y2 fillColorIndex:(int)aFillColorIndex outlineColorIndex:(int)oci lineWidth:(int)aLineWidth {
   
   // don't know if this is needed with opengl...does it cope with wonky coords?
   //  float x, y, width, height;
@@ -179,7 +179,6 @@
   }
   
   if (aLineWidth>0) {
-    int oci = anOutlineColorIndex == -1 ? 3 : anOutlineColorIndex;
     glColor4f(colourTable[oci].r, colourTable[oci].g, colourTable[oci].b, 1.0);
     glLineWidth(aLineWidth);
     GLshort coords[] = {x1,y1, x2,y1, x2,y2, x1,y2};
diff --git a/Src/Win32/Widgets/Screen.cpp b/Src/Win32/Widgets/Screen.cpp
index 807a2c9..71894df 100644
--- a/Src/Win32/Widgets/Screen.cpp
+++ b/Src/Win32/Widgets/Screen.cpp
@@ -225,8 +225,6 @@ void CScreen::TextSize_Impl(const std::string &String, screenint *Width, screeni
 }*/
 
 void CScreen::Polygon(point *Points, int Number, int fillColour, int outlineColour, int iWidth) {
-  // TODO This function is never called. Should it be needed, drawing an outline
-  // if outlineColour != -1 should be implemented.
   HGDIOBJ hpOld;
   hpOld = (HPEN) SelectObject(m_hDCBuffer, CScreen::GetPen(fillColour, iWidth));
   POINT *WinPoints = new POINT[Number];
@@ -234,6 +232,9 @@ void CScreen::Polygon(point *Points, int Number, int fillColour, int outlineColo
   ::Polygon(m_hDCBuffer, WinPoints, Number);
   delete[]WinPoints;
   SelectObject(m_hDCBuffer, hpOld);
+  if (iWidth>0) {
+    Polyline(Points, Number, iWidth, outlineColour==-1 ? 3 : outlineColour);
+  }
 }
 
 /////////////////////////////////////////////////////////////////////////////
diff --git a/Src/Win32/Widgets/Screen.h b/Src/Win32/Widgets/Screen.h
index 5934b98..a1d5a0a 100644
--- a/Src/Win32/Widgets/Screen.h
+++ b/Src/Win32/Widgets/Screen.h
@@ -85,8 +85,6 @@ public:
   //virtual void Polygon(point * Points, int Number, int Color, int iWidth,int layer);
   virtual void Polygon(point * Points, int Number, int fillColour, int OutlineColour, int iWidth);
 
-  //void DrawPolygon(point * Points, int Number, int Color, Dasher::Opts::ColorSchemes ColorScheme,int layer=0);
-  void DrawPolygon(point * Points, int Number, int Color, Dasher::Opts::ColorSchemes ColorScheme);
   void Blank();
   void Display();
 
diff --git a/Src/Win32/Widgets/Screen.inl b/Src/Win32/Widgets/Screen.inl
index 3d8a9bb..1effc28 100644
--- a/Src/Win32/Widgets/Screen.inl
+++ b/Src/Win32/Widgets/Screen.inl
@@ -8,8 +8,7 @@
 
 /////////////////////////////////////////////////////////////////////////////
 
-inline void CScreen::DrawRectangle(screenint x1, screenint y1, screenint x2, screenint y2, int Colour, int iOutlineColour, Dasher::Opts::ColorSchemes ColorScheme, int iThickness) {
-//      HBRUSH brush=m_Brushes[ColorScheme][Color%m_Brushes[ColorScheme].size()];
+inline void CScreen::DrawRectangle(screenint x1, screenint y1, screenint x2, screenint y2, int Colour, int iOutlineColour, int iThickness) {
   HBRUSH brush = CScreen::GetBrush(Colour);
   RECT Rect;
   Rect.left = x1;
@@ -21,7 +20,7 @@ inline void CScreen::DrawRectangle(screenint x1, screenint y1, screenint x2, scr
 
 #ifndef DASHER_WINCE
 
-  if(iOutlineColour != -1) {
+  if(iWidth != -1) {
 
     point aPoints[5];
 
@@ -32,7 +31,7 @@ inline void CScreen::DrawRectangle(screenint x1, screenint y1, screenint x2, scr
     aPoints[4].x=x1; aPoints[4].y=y1;
 
 	//FrameRect(m_hDCBuffer, &Rect, CScreen::GetBrush(iOutlineColour));
-	Polyline(aPoints, 5, iThickness, iOutlineColour);
+	Polyline(aPoints, 5, iThickness, iOutlineColour==-1 ? 3 : iOutlineColour);
   }
 #endif
 
@@ -75,18 +74,6 @@ inline void CScreen::Polyline(point *Points, int Number, int iWidth, int iColour
   Polyline(Points, Number, iWidth, 0);
 }*/
 
-inline void CScreen::DrawPolygon(point *Points, int Number, int Color, Dasher::Opts::ColorSchemes ColorScheme) {
-  HPEN pen = (HPEN) GetStockObject(NULL_PEN);
-  HPEN hpold = (HPEN) SelectObject(m_hDCBuffer, pen);
-  HBRUSH hbold = (HBRUSH) SelectObject(m_hDCBuffer, CScreen::GetBrush(ColorScheme));
-  POINT *WinPoints = new POINT[Number];
-  point2POINT(Points, WinPoints, Number);
-  ::Polygon(m_hDCBuffer, WinPoints, Number);
-  delete[]WinPoints;
-  SelectObject(m_hDCBuffer, hpold);
-  SelectObject(m_hDCBuffer, hbold);
-}
-
 inline void CScreen::Blank() {
   RECT rect;
   rect.top = 0;
diff --git a/Src/iPhone/Classes/CDasherScreenBridge.h b/Src/iPhone/Classes/CDasherScreenBridge.h
index 33e6b64..cd30023 100644
--- a/Src/iPhone/Classes/CDasherScreenBridge.h
+++ b/Src/iPhone/Classes/CDasherScreenBridge.h
@@ -51,11 +51,11 @@ public:
   /// \param y1 y coordiate of the top left corner
   /// \param x2 x coordiate of the bottom right corner
   /// \param y2 y coordiate of the bottom right corner
-  /// \param Color Colour to fill the rectangle
-  /// \param ColorScheme Which of the alternating colour schemes to use (be more precise)
+  /// \param Color Colour to fill the rectangle (-1 = don't fill)
+  /// \param iOutlineColour Colour to draw box outline (-1 = use default)
+  /// \param iThickness Line width in which to draw box outline (<=0 => don't outline)
   ///
-  
-  void DrawRectangle(screenint x1, screenint y1, screenint x2, screenint y2, int Color, int iOutlineColour, Opts::ColorSchemes ColorScheme, int iThickness);
+  void DrawRectangle(screenint x1, screenint y1, screenint x2, screenint y2, int Color, int iOutlineColour, int iThickness);
   
   void DrawCircle(screenint iCX, screenint iCY, screenint iR, int iColour, int iFillColour, int iThickness, bool bFill);
   
diff --git a/Src/iPhone/Classes/CDasherScreenBridge.mm b/Src/iPhone/Classes/CDasherScreenBridge.mm
index d61e79c..033d2e5 100644
--- a/Src/iPhone/Classes/CDasherScreenBridge.mm
+++ b/Src/iPhone/Classes/CDasherScreenBridge.mm
@@ -27,7 +27,7 @@ void CDasherScreenBridge::Display() {
   [dasherView displayCallback];
 }
 
-void CDasherScreenBridge::DrawRectangle(int x1, int y1, int x2, int y2, int Color, int iOutlineColour, Opts::ColorSchemes ColorScheme, int iThickness) {
+void CDasherScreenBridge::DrawRectangle(int x1, int y1, int x2, int y2, int Color, int iOutlineColour, int iThickness) {
 
   [dasherView rectangleCallbackX1:x1 y1:y1 x2:x2 y2:y2 fillColorIndex:Color outlineColorIndex:iOutlineColour lineWidth:iThickness];
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]