[dasher] Windows build fixes: - const_iterator for MandarinAlphMgr as pointed out by Gergo Zsiak - g/c BP_STA



commit 5cd72f6031dbdcf5a2d8a4a55a9f7e3e70a8622e
Author: Patrick Welche <prlw1 cam ac uk>
Date:   Fri Jul 16 16:14:04 2010 +0100

    Windows build fixes:
    - const_iterator for MandarinAlphMgr as pointed out by Gergo Zsiak
    - g/c BP_START_STYLUS c.f., 99a06797
    - propagate changes in signature of DrawRectangle, DrawString and Polygon
    - distribute Super Pin Yin (experimental)

 Src/DasherCore/DasherCore_vc80.vcproj |    8 ++++++++
 Src/DasherCore/DasherScreen.h         |   14 +++++++-------
 Src/DasherCore/MandarinAlphMgr.cpp    |    2 +-
 Src/Installer/Dasher.wxs              |    4 ++--
 Src/Win32/Widgets/ControlPage.cpp     |    1 -
 Src/Win32/Widgets/Screen.cpp          |   12 +++++++-----
 Src/Win32/Widgets/Screen.h            |   11 ++++++-----
 Src/Win32/Widgets/Screen.inl          |   16 ++++++----------
 Src/Win32/resource.h                  |    2 +-
 9 files changed, 38 insertions(+), 32 deletions(-)
---
diff --git a/Src/DasherCore/DasherCore_vc80.vcproj b/Src/DasherCore/DasherCore_vc80.vcproj
index 3a33147..ca16602 100644
--- a/Src/DasherCore/DasherCore_vc80.vcproj
+++ b/Src/DasherCore/DasherCore_vc80.vcproj
@@ -2166,6 +2166,14 @@
 			>
 		</File>
 		<File
+			RelativePath=".\PinyinParser.cpp"
+			>
+		</File>
+		<File
+			RelativePath=".\PinyinParser.h"
+			>
+		</File>
+		<File
 			RelativePath=".\SCENode.cpp"
 			>
 		</File>
diff --git a/Src/DasherCore/DasherScreen.h b/Src/DasherCore/DasherScreen.h
index afe04a6..319fc1d 100644
--- a/Src/DasherCore/DasherScreen.h
+++ b/Src/DasherCore/DasherScreen.h
@@ -56,7 +56,7 @@ public:
   virtual void TextSize(const std::string & String, screenint * Width, screenint * Height, int Size) = 0;
 
   //! Draw UTF8-encoded string String of size Size positioned at x1 and y1
-  virtual void DrawString(const std::string & String, screenint x1, screenint y1, int Size, int iColor) = 0;
+  virtual void DrawString(const std::string & String, screenint x1, screenint y1, int Size, int iColour) = 0;
 
   // Send a marker to indicate 'phases' of drawing. 
 
@@ -70,12 +70,12 @@ public:
   /// \param y1 top left corner of rectangle (y coordinate)
   /// \param x2 bottom right of rectangle (x coordinate)
   /// \param y2 bottom right of rectangle (y coordinate)
-  /// \param Color the colour to be used (numeric), or -1 for no fill
+  /// \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 iThickness Line thickness for outline; <1 for no outline
 
-  virtual void DrawRectangle(screenint x1, screenint y1, screenint x2, screenint y2, int Color, int iOutlineColour, Opts::ColorSchemes ColorScheme, int iThickness) = 0;
+  virtual void DrawRectangle(screenint x1, screenint y1, screenint x2, screenint y2, int Colour, int iOutlineColour, Opts::ColorSchemes ColorScheme, int iThickness) = 0;
 
   virtual void DrawCircle(screenint iCX, screenint iCY, screenint iR, int iColour, int iFillColour, int iThickness, bool bFill) = 0;
 
@@ -101,14 +101,14 @@ public:
 
   virtual void Polyline(point * Points, int Number, int iWidth, int Colour) = 0;
 
-  /// Draw a polygon - given vertices and color id
+  /// Draw a polygon - given vertices and colour id
   ///
   /// \param Points Vertices of polygon in clockwise order. (No need to repeat the first point at the end)
   /// \param Number number of points in the array
-  /// \param fillColor colour to fill polygon (numeric); -1 for don't fill
-  /// \param outlineColor colour to draw polygon outline (right the way around, i.e. repeating first point)
+  /// \param fillColour colour to fill polygon (numeric); -1 for don't fill
+  /// \param outlineColour colour to draw polygon outline (right the way around, i.e. repeating first point)
   /// \param lineWidth thickness of outline; 0 or less => don't draw outline.
-  virtual void Polygon(point * Points, int Number, int fillColor, int outlineColor, int lineWidth) = 0;
+  virtual void Polygon(point * Points, int Number, int fillColour, int outlineColour, int lineWidth) = 0;
 
   // Signal the screen when a frame is started and finished
   //! Signal that a frame is being started
diff --git a/Src/DasherCore/MandarinAlphMgr.cpp b/Src/DasherCore/MandarinAlphMgr.cpp
index 7f186a8..939301b 100644
--- a/Src/DasherCore/MandarinAlphMgr.cpp
+++ b/Src/DasherCore/MandarinAlphMgr.cpp
@@ -101,7 +101,7 @@ void CMandarinAlphMgr::CConvRoot::BuildConversions() {
     DASHER_ASSERT(false);
     return;
   }
-  for(set<string>::iterator it = m_pTrie->list()->begin(); it != m_pTrie->list()->end(); ++it) {
+  for(set<string>::const_iterator it = m_pTrie->list()->begin(); it != m_pTrie->list()->end(); ++it) {
     std::vector<symbol> vSyms;
     m_pMgr->m_pCHAlphabet->GetSymbols(vSyms, *it);
     DASHER_ASSERT(vSyms.size()==1); //does it ever happen? if so, Will's code would effectively push -1
diff --git a/Src/Installer/Dasher.wxs b/Src/Installer/Dasher.wxs
index 44d1a14..bdcf04c 100644
--- a/Src/Installer/Dasher.wxs
+++ b/Src/Installer/Dasher.wxs
@@ -100,7 +100,7 @@
                 <File Id="alphabet.cherokee.xml" Name="alphabet.cherokee.xml" DiskId="1" Source="..\..\Data\alphabets\alphabet.cherokee.xml" />
                 <File Id="alphabet.chinese.xml" Name="alphabet.chinese.xml" DiskId="1" Source="..\..\Data\alphabets\alphabet.chinese.xml" />
                 <File Id="alphabet.chineseRuby.xml" Name="alphabet.chineseRuby.xml" DiskId="1" Source="..\..\Data\alphabets\alphabet.chineseRuby.xml" />
-                <!-- File Id="alphabet.spyDict.xml" Name="alphabet.spyDict.xml" DiskId="1" Source="..\..\Data\alphabets\alphabet.spyDict.xml" /-->
+                <File Id="alphabet.spyDict.xml" Name="alphabet.spyDict.xml" DiskId="1" Source="..\..\Data\alphabets\alphabet.spyDict.xml" />
                 <File Id="alphabet.corsican.xml" Name="alphabet.corsican.xml" DiskId="1" Source="..\..\Data\alphabets\alphabet.corsican.xml" />
                 <File Id="alphabet.croatian.xml" Name="alphabet.croatian.xml" DiskId="1" Source="..\..\Data\alphabets\alphabet.croatian.xml" />
                 <File Id="alphabet.czech.xml" Name="alphabet.czech.xml" DiskId="1" Source="..\..\Data\alphabets\alphabet.czech.xml" />
@@ -176,7 +176,7 @@
                 <File Id="training_bengali_BD.txt" Name="training_bengali_BD.txt" DiskId="1" Source="..\..\Data\training\training_bengali_BD.txt" />
                 <!--<File Id="training_bengali_bn.txt" Name="training_bengali_bn.txt" DiskId="1" Source="..\..\Data\training\training_bengali_bn.txt" />-->
                 <File Id="training_canna_JP.txt" Name="training_canna_JP.txt" DiskId="1" Source="..\..\Data\training\training_canna_JP.txt" />
-                <!--File Id="training_spyDict.txt" Name="training_spyDict.txt" DiskId="1" Source="..\..\Data\training\training_spyDict.txt" /-->
+                <File Id="training_spyDict.txt" Name="training_spyDict.txt" DiskId="1" Source="..\..\Data\training\training_spyDict.txt" />
                 <File Id="training_czech_CS.txt" Name="training_czech_CS.txt" DiskId="1" Source="..\..\Data\training\training_czech_CS.txt" />
                 <File Id="training_danish_DK.txt" Name="training_danish_DK.txt" DiskId="1" Source="..\..\Data\training\training_danish_DK.txt" />
                 <File Id="training_dutch_NL.txt" Name="training_dutch_NL.txt" DiskId="1" Source="..\..\Data\training\training_dutch_NL.txt" />
diff --git a/Src/Win32/Widgets/ControlPage.cpp b/Src/Win32/Widgets/ControlPage.cpp
index 9516214..a53505e 100644
--- a/Src/Win32/Widgets/ControlPage.cpp
+++ b/Src/Win32/Widgets/ControlPage.cpp
@@ -34,7 +34,6 @@ struct menuentry {
 static menuentry menutable[] = {
   {BP_START_MOUSE, IDC_LEFT},
   {BP_START_SPACE, IDC_SPACE},
-  {BP_START_STYLUS, IDC_STYLUS},
   {BP_STOP_IDLE, IDC_STOPIDLE},
   {BP_PAUSE_OUTSIDE, IDC_WINDOWPAUSE},
   {BP_AUTO_SPEEDCONTROL, IDC_AUTOSPEED},
diff --git a/Src/Win32/Widgets/Screen.cpp b/Src/Win32/Widgets/Screen.cpp
index 38c3659..807a2c9 100644
--- a/Src/Win32/Widgets/Screen.cpp
+++ b/Src/Win32/Widgets/Screen.cpp
@@ -145,7 +145,7 @@ void CScreen::DrawMousePosBox(int which, int iMousePosDist,int layer) {
   Display();
 }
 
-void CScreen::DrawString(const std::string &OutputString, Dasher::screenint x1, Dasher::screenint y1, int iSize) {
+void CScreen::DrawString(const std::string &OutputString, Dasher::screenint x1, Dasher::screenint y1, int iSize, int Colour) {
 
   Tstring OutputText;
 
@@ -162,8 +162,8 @@ void CScreen::DrawString(const std::string &OutputString, Dasher::screenint x1,
   COLORREF iCRefOld;
   COLORREF iCRefNew;
 
-  // TODO: Hardcoded numbers
-  iCRefNew = RGB(m_pColours->Reds[4], m_pColours->Greens[4], m_pColours->Blues[4]);
+  // Colour was hardcoded to 4
+  iCRefNew = RGB(m_pColours->Reds[Colour], m_pColours->Greens[Colour], m_pColours->Blues[Colour]);
   
   iCRefOld = SetTextColor(m_hDCBuffer, iCRefNew);
 
@@ -224,9 +224,11 @@ void CScreen::TextSize_Impl(const std::string &String, screenint *Width, screeni
   CScreen::Polygon( Points, Number, iColour, 1);
 }*/
 
-void CScreen::Polygon(point *Points, int Number, int iColour, int iWidth) {
+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(iColour, iWidth));
+  hpOld = (HPEN) SelectObject(m_hDCBuffer, CScreen::GetPen(fillColour, iWidth));
   POINT *WinPoints = new POINT[Number];
   point2POINT(Points, WinPoints, Number);
   ::Polygon(m_hDCBuffer, WinPoints, Number);
diff --git a/Src/Win32/Widgets/Screen.h b/Src/Win32/Widgets/Screen.h
index b4c812e..0a8de65 100644
--- a/Src/Win32/Widgets/Screen.h
+++ b/Src/Win32/Widgets/Screen.h
@@ -48,10 +48,10 @@ public:
   //! Draw UTF8-encoded string String of size Size positioned at x1 and y1
   
   //void DrawString(const std::string & String, Dasher::screenint x1, Dasher::screenint y1, int Size,int layer=0);
-  void DrawString(const std::string & String, Dasher::screenint x1, Dasher::screenint y1, int Size);
+  void DrawString(const std::string & String, Dasher::screenint x1, Dasher::screenint y1, int Size, int Colour);
 
   //void DrawRectangle(Dasher::screenint x1, Dasher::screenint y1, Dasher::screenint x2, Dasher::screenint y2, int Color, int iOutlineColour, Dasher::Opts::ColorSchemes ColorScheme, bool bDrawOutlines, bool bFill, int iThickness,int layer=0);
-  void DrawRectangle(Dasher::screenint x1, Dasher::screenint y1, Dasher::screenint x2, Dasher::screenint y2, int Color, int iOutlineColour, Dasher::Opts::ColorSchemes ColorScheme, bool bDrawOutlines, bool bFill, int iThickness);
+  void DrawRectangle(Dasher::screenint x1, Dasher::screenint y1, Dasher::screenint x2, Dasher::screenint y2, int Colour, int iOutlineColour, Dasher::Opts::ColorSchemes ColorScheme, int iThickness);
 
   ///WHY is this defined like that?
   //void CScreen::DrawCircle(screenint iCX, screenint iCY, screenint iR, int iColour, int iFillColour, int iThickness, bool bFill,int layer=0);
@@ -79,10 +79,11 @@ public:
   //!
   //! \param Points array of points defining the edge of the polygon
   //! \param Number number of points in the array
-  //! \param Color colour of the polygon (numeric)
-  //virtual void Polygon(point * Points, int Number, int Color);
+  //! \param fillColour colour to fill polygon (numeric); -1 for don't fill
+  //! \param outlineColour colour to draw polygon outline (right the way around, i.e. repeating first point)
+   //virtual void Polygon(point * Points, int Number, int Color);
   //virtual void Polygon(point * Points, int Number, int Color, int iWidth,int layer);
-  virtual void Polygon(point * Points, int Number, int Color, int iWidth);
+  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);
diff --git a/Src/Win32/Widgets/Screen.inl b/Src/Win32/Widgets/Screen.inl
index 1543639..3d8a9bb 100644
--- a/Src/Win32/Widgets/Screen.inl
+++ b/Src/Win32/Widgets/Screen.inl
@@ -8,20 +8,20 @@
 
 /////////////////////////////////////////////////////////////////////////////
 
-inline void CScreen::DrawRectangle(screenint x1, screenint y1, screenint x2, screenint y2, int Color, int iOutlineColour, Dasher::Opts::ColorSchemes ColorScheme, bool bDrawOutlines, bool bFill, int iThickness) {
+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()];
-  HBRUSH brush = CScreen::GetBrush(Color);
+  HBRUSH brush = CScreen::GetBrush(Colour);
   RECT Rect;
   Rect.left = x1;
   Rect.top = y1;
   Rect.right = x2;
   Rect.bottom = y2;
-  if(bFill)
+  if(Colour != -1)
     FillRect(m_hDCBuffer, &Rect, brush);
 
 #ifndef DASHER_WINCE
 
-  if(bDrawOutlines) {
+  if(iOutlineColour != -1) {
 
     point aPoints[5];
 
@@ -31,12 +31,8 @@ inline void CScreen::DrawRectangle(screenint x1, screenint y1, screenint x2, scr
     aPoints[3].x=x1; aPoints[3].y=y2;
     aPoints[4].x=x1; aPoints[4].y=y1;
 
-    if(iOutlineColour == -1)
-     //FrameRect(m_hDCBuffer, &Rect, CScreen::GetBrush(3));
-     Polyline(aPoints, 5, iThickness, 3);
-    else
-      //FrameRect(m_hDCBuffer, &Rect, CScreen::GetBrush(iOutlineColour));
-      Polyline(aPoints, 5, iThickness, iOutlineColour);
+	//FrameRect(m_hDCBuffer, &Rect, CScreen::GetBrush(iOutlineColour));
+	Polyline(aPoints, 5, iThickness, iOutlineColour);
   }
 #endif
 
diff --git a/Src/Win32/resource.h b/Src/Win32/resource.h
index 6ad88ad..4e34c0b 100644
--- a/Src/Win32/resource.h
+++ b/Src/Win32/resource.h
@@ -140,7 +140,7 @@
 #define IDC_OUTLINE                     1091
 #define IDC_STOPIDLE                    1091
 #define IDC_TIMESTAMP                   1092
-#define IDC_STYLUS                      1092
+//#define IDC_STYLUS                      1092
 #define IDC_COPYALLONSTOP               1093
 #define IDC_DRAWMOUSE                   1094
 #define IDC_SPEECH                      1096



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