From ece008e7908f9e2203ec776abcc38398b4100d9c Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 23 May 2013 18:38:17 +0200 Subject: [PATCH] Worksheet code: more cleanup, and fix compil issue with wxWidgets 2.8 --- common/common_plot_functions.cpp | 27 ++++++++++++++++++++++++++- common/title_block_shapes.h | 4 ++-- common/title_block_shapes_gost.h | 2 -- common/worksheet.cpp | 3 ++- common/worksheet_shape_builder.h | 13 ++++++++----- include/worksheet.h | 1 + 6 files changed, 39 insertions(+), 11 deletions(-) diff --git a/common/common_plot_functions.cpp b/common/common_plot_functions.cpp index e957191026..251b1150a2 100644 --- a/common/common_plot_functions.cpp +++ b/common/common_plot_functions.cpp @@ -3,6 +3,30 @@ * @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 #include #include @@ -113,7 +137,8 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, case WS_DRAW_ITEM_BASE::wsg_poly: { 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; } diff --git a/common/title_block_shapes.h b/common/title_block_shapes.h index 7ae17700db..46b348d9a7 100644 --- a/common/title_block_shapes.h +++ b/common/title_block_shapes.h @@ -39,7 +39,6 @@ #define GRID_REF_W 70 // height of the band reference grid #define TEXTSIZE 60 // worksheet 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) // The coordinates below are relative to the bottom right corner of page and @@ -323,7 +322,8 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( // lower right corner 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. int ii, jj, ipas, gxpas, gypas; diff --git a/common/title_block_shapes_gost.h b/common/title_block_shapes_gost.h index d8affc0243..dd8629f797 100644 --- a/common/title_block_shapes_gost.h +++ b/common/title_block_shapes_gost.h @@ -36,8 +36,6 @@ */ #define TEXTSIZE 100 // worksheet text size -#define PAS_REF 2000 // reference markings on worksheet frame - // used in worksheet.cpp // Work sheet structure type definitions. enum TypeKi_WorkSheetData { diff --git a/common/worksheet.cpp b/common/worksheet.cpp index 4e382dadf8..f6b99b2b7f 100644 --- a/common/worksheet.cpp +++ b/common/worksheet.cpp @@ -123,7 +123,8 @@ void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas, WS_DRAW_ITEM_POLYGON* poly = (WS_DRAW_ITEM_POLYGON*) item; GRPoly( aCanvas ? aCanvas->GetClipBox() : NULL, aDC, poly->m_Corners.size(), &poly->m_Corners[0], - true, poly->GetPenWidth(), + poly->IsFilled() ? FILLED_SHAPE : NO_FILL, + poly->GetPenWidth(), poly->GetColor(), poly->GetColor() ); } break; diff --git a/common/worksheet_shape_builder.h b/common/worksheet_shape_builder.h index 45affcba06..961b27bbf0 100644 --- a/common/worksheet_shape_builder.h +++ b/common/worksheet_shape_builder.h @@ -66,18 +66,21 @@ public: class WS_DRAW_ITEM_POLYGON : public WS_DRAW_ITEM_BASE { int m_penWidth; + bool m_fill; + public: std::vector m_Corners; public: - WS_DRAW_ITEM_POLYGON( wxPoint aStart, wxPoint aEnd, - int aPenWidth, EDA_COLOR_T aColor ) : + WS_DRAW_ITEM_POLYGON( bool aFill, int aPenWidth, EDA_COLOR_T aColor ) : WS_DRAW_ITEM_BASE( wsg_poly, aColor ) { m_penWidth = aPenWidth; + m_fill = aFill; } // Accessors: int GetPenWidth() { return m_penWidth; } + bool IsFilled() { return m_fill; } }; // This class draws a not filled rectangle with thick segment @@ -171,7 +174,7 @@ public: } /* 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 * @param aLTmargin The left top margin of the page layout. * @param aRBmargin The right bottom margin of the page layout. @@ -219,8 +222,8 @@ public: * @param aTitleBlock The sheet title block, for basic inscriptions. * @param aSheetCount The number of sheets (for basic inscriptions). * @param aSheetNumber The sheet number (for basic inscriptions). - * @param aLineColor The color for drawing. - * @param aTextColor The color for inscriptions. + * @param aLineColor The color for drawing and fixed text. + * @param aTextColor The color for user inscriptions. */ void BuildWorkSheetGraphicList( const wxString& aPaperFormat, const wxString& aFileName, diff --git a/include/worksheet.h b/include/worksheet.h index 450444f060..7978742db7 100644 --- a/include/worksheet.h +++ b/include/worksheet.h @@ -12,6 +12,7 @@ class EDA_DRAW_PANEL; class TITLE_BLOCK; class PAGE_INFO; +#define PAS_REF 2000 // Pitch (in mils) of reference locations in worksheet struct Ki_WorkSheetData {