Commit 82cc9233 authored by jean-pierre charras's avatar jean-pierre charras

Worksheet code: more cleanup, and fix compil issue with wxWidgets 2.8

parent a9a00902
...@@ -3,6 +3,30 @@ ...@@ -3,6 +3,30 @@
* @brief Kicad: Common plotting functions * @brief Kicad: Common plotting functions
*/ */
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2013 KiCad Developers, see change_log.txt for contributors.
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h> #include <fctsys.h>
#include <base_struct.h> #include <base_struct.h>
#include <plot_common.h> #include <plot_common.h>
...@@ -113,7 +137,8 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, ...@@ -113,7 +137,8 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
case WS_DRAW_ITEM_BASE::wsg_poly: case WS_DRAW_ITEM_BASE::wsg_poly:
{ {
WS_DRAW_ITEM_POLYGON* poly = (WS_DRAW_ITEM_POLYGON*) item; WS_DRAW_ITEM_POLYGON* poly = (WS_DRAW_ITEM_POLYGON*) item;
plotter->PlotPoly( poly->m_Corners, NO_FILL ); plotter->PlotPoly( poly->m_Corners,
poly->IsFilled() ? FILLED_SHAPE : NO_FILL );
} }
break; break;
} }
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#define GRID_REF_W 70 // height of the band reference grid #define GRID_REF_W 70 // height of the band reference grid
#define TEXTSIZE 60 // worksheet text size #define TEXTSIZE 60 // worksheet text size
#define FRMREF_TXTSIZE 50 // worksheet frame reference text size #define FRMREF_TXTSIZE 50 // worksheet frame reference text size
#define PAS_REF 2000 // reference markings on worksheet frame
#define VARIABLE_BLOCK_START_POSITION (TEXTSIZE * 10) #define VARIABLE_BLOCK_START_POSITION (TEXTSIZE * 10)
// The coordinates below are relative to the bottom right corner of page and // The coordinates below are relative to the bottom right corner of page and
...@@ -323,7 +322,8 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( ...@@ -323,7 +322,8 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
// lower right corner // lower right corner
wxPoint currpos; wxPoint currpos;
currpos = m_pageSize - m_RBmargin; currpos.x = m_pageSize.x - m_RBmargin.x;
currpos.y = m_pageSize.y - m_RBmargin.y;
// Draw the border. // Draw the border.
int ii, jj, ipas, gxpas, gypas; int ii, jj, ipas, gxpas, gypas;
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
*/ */
#define TEXTSIZE 100 // worksheet text size #define TEXTSIZE 100 // worksheet text size
#define PAS_REF 2000 // reference markings on worksheet frame
// used in worksheet.cpp
// Work sheet structure type definitions. // Work sheet structure type definitions.
enum TypeKi_WorkSheetData { enum TypeKi_WorkSheetData {
......
...@@ -123,7 +123,8 @@ void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas, ...@@ -123,7 +123,8 @@ void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas,
WS_DRAW_ITEM_POLYGON* poly = (WS_DRAW_ITEM_POLYGON*) item; WS_DRAW_ITEM_POLYGON* poly = (WS_DRAW_ITEM_POLYGON*) item;
GRPoly( aCanvas ? aCanvas->GetClipBox() : NULL, aDC, GRPoly( aCanvas ? aCanvas->GetClipBox() : NULL, aDC,
poly->m_Corners.size(), &poly->m_Corners[0], poly->m_Corners.size(), &poly->m_Corners[0],
true, poly->GetPenWidth(), poly->IsFilled() ? FILLED_SHAPE : NO_FILL,
poly->GetPenWidth(),
poly->GetColor(), poly->GetColor() ); poly->GetColor(), poly->GetColor() );
} }
break; break;
......
...@@ -66,18 +66,21 @@ public: ...@@ -66,18 +66,21 @@ public:
class WS_DRAW_ITEM_POLYGON : public WS_DRAW_ITEM_BASE class WS_DRAW_ITEM_POLYGON : public WS_DRAW_ITEM_BASE
{ {
int m_penWidth; int m_penWidth;
bool m_fill;
public: public:
std::vector <wxPoint> m_Corners; std::vector <wxPoint> m_Corners;
public: public:
WS_DRAW_ITEM_POLYGON( wxPoint aStart, wxPoint aEnd, WS_DRAW_ITEM_POLYGON( bool aFill, int aPenWidth, EDA_COLOR_T aColor ) :
int aPenWidth, EDA_COLOR_T aColor ) :
WS_DRAW_ITEM_BASE( wsg_poly, aColor ) WS_DRAW_ITEM_BASE( wsg_poly, aColor )
{ {
m_penWidth = aPenWidth; m_penWidth = aPenWidth;
m_fill = aFill;
} }
// Accessors: // Accessors:
int GetPenWidth() { return m_penWidth; } int GetPenWidth() { return m_penWidth; }
bool IsFilled() { return m_fill; }
}; };
// This class draws a not filled rectangle with thick segment // This class draws a not filled rectangle with thick segment
...@@ -171,7 +174,7 @@ public: ...@@ -171,7 +174,7 @@ public:
} }
/* Function SetMargins /* Function SetMargins
* Set the The left top margin and the right bottom margin * Set the left top margin and the right bottom margin
* of the page layout * of the page layout
* @param aLTmargin The left top margin of the page layout. * @param aLTmargin The left top margin of the page layout.
* @param aRBmargin The right bottom margin of the page layout. * @param aRBmargin The right bottom margin of the page layout.
...@@ -219,8 +222,8 @@ public: ...@@ -219,8 +222,8 @@ public:
* @param aTitleBlock The sheet title block, for basic inscriptions. * @param aTitleBlock The sheet title block, for basic inscriptions.
* @param aSheetCount The number of sheets (for basic inscriptions). * @param aSheetCount The number of sheets (for basic inscriptions).
* @param aSheetNumber The sheet number (for basic inscriptions). * @param aSheetNumber The sheet number (for basic inscriptions).
* @param aLineColor The color for drawing. * @param aLineColor The color for drawing and fixed text.
* @param aTextColor The color for inscriptions. * @param aTextColor The color for user inscriptions.
*/ */
void BuildWorkSheetGraphicList( const wxString& aPaperFormat, void BuildWorkSheetGraphicList( const wxString& aPaperFormat,
const wxString& aFileName, const wxString& aFileName,
......
...@@ -12,6 +12,7 @@ class EDA_DRAW_PANEL; ...@@ -12,6 +12,7 @@ class EDA_DRAW_PANEL;
class TITLE_BLOCK; class TITLE_BLOCK;
class PAGE_INFO; class PAGE_INFO;
#define PAS_REF 2000 // Pitch (in mils) of reference locations in worksheet
struct Ki_WorkSheetData struct Ki_WorkSheetData
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment