2013-09-11 12:42:12 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 CERN
|
2020-10-18 20:30:37 +00:00
|
|
|
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
2013-09-11 12:42:12 +00:00
|
|
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2021-02-22 23:47:17 +00:00
|
|
|
#ifndef DS_PROXY_VIEW_ITEM_H
|
|
|
|
#define DS_PROXY_VIEW_ITEM_H
|
2013-09-11 12:42:12 +00:00
|
|
|
|
2020-10-14 01:06:53 +00:00
|
|
|
#include <eda_item.h>
|
2013-09-11 12:42:12 +00:00
|
|
|
|
|
|
|
class BOARD;
|
|
|
|
class PAGE_INFO;
|
2020-10-24 14:45:37 +00:00
|
|
|
class PROJECT;
|
2013-09-11 12:42:12 +00:00
|
|
|
class TITLE_BLOCK;
|
2021-02-22 23:47:17 +00:00
|
|
|
class DS_DRAW_ITEM_LINE;
|
|
|
|
class DS_DRAW_ITEM_RECT;
|
|
|
|
class DS_DRAW_ITEM_TEXT;
|
|
|
|
class DS_DRAW_ITEM_BITMAP;
|
|
|
|
class DS_DRAW_ITEM_LIST;
|
2013-09-11 12:42:12 +00:00
|
|
|
|
2013-10-14 14:13:35 +00:00
|
|
|
namespace KIGFX
|
2013-09-11 12:42:12 +00:00
|
|
|
{
|
2016-12-02 17:58:12 +00:00
|
|
|
class VIEW;
|
2013-09-11 12:42:12 +00:00
|
|
|
class GAL;
|
2021-02-22 23:47:17 +00:00
|
|
|
}
|
2013-09-11 12:42:12 +00:00
|
|
|
|
2021-02-22 23:47:17 +00:00
|
|
|
class DS_PROXY_VIEW_ITEM : public EDA_ITEM
|
2013-09-11 12:42:12 +00:00
|
|
|
{
|
|
|
|
public:
|
2021-02-22 23:47:17 +00:00
|
|
|
DS_PROXY_VIEW_ITEM( int aScaleFactor, const PAGE_INFO* aPageInfo, const PROJECT* aProject,
|
2020-03-26 11:02:59 +00:00
|
|
|
const TITLE_BLOCK* aTitleBlock );
|
2013-09-11 12:42:12 +00:00
|
|
|
|
|
|
|
/**
|
2020-10-18 20:30:37 +00:00
|
|
|
* Set the file name displayed in the title block.
|
2013-09-11 12:42:12 +00:00
|
|
|
*/
|
2020-03-26 11:02:59 +00:00
|
|
|
void SetFileName( const std::string& aFileName ) { m_fileName = aFileName; }
|
2013-09-11 12:42:12 +00:00
|
|
|
|
|
|
|
/**
|
2020-10-18 20:30:37 +00:00
|
|
|
* Set the sheet name displayed in the title block.
|
2013-09-11 12:42:12 +00:00
|
|
|
*/
|
2020-03-26 11:02:59 +00:00
|
|
|
void SetSheetName( const std::string& aSheetName ) { m_sheetName = aSheetName; }
|
2013-09-11 12:42:12 +00:00
|
|
|
|
2022-04-09 14:38:47 +00:00
|
|
|
/**
|
|
|
|
* Set the sheet path displayed in the title block.
|
|
|
|
*/
|
|
|
|
void SetSheetPath( const std::string& aSheetPath ) { m_sheetPath = aSheetPath; }
|
|
|
|
|
2013-09-11 12:42:12 +00:00
|
|
|
/**
|
2020-10-18 20:30:37 +00:00
|
|
|
* Changes the page number displayed in the title block.
|
2013-09-11 12:42:12 +00:00
|
|
|
*/
|
2020-10-18 20:30:37 +00:00
|
|
|
void SetPageNumber( const std::string& aPageNumber ) { m_pageNumber = aPageNumber; }
|
2013-09-11 12:42:12 +00:00
|
|
|
|
|
|
|
/**
|
2021-02-22 23:47:17 +00:00
|
|
|
* Changes the sheet-count number displayed in the title block.
|
2013-09-11 12:42:12 +00:00
|
|
|
*/
|
2020-03-26 11:02:59 +00:00
|
|
|
void SetSheetCount( int aSheetCount ) { m_sheetCount = aSheetCount; }
|
2013-09-11 12:42:12 +00:00
|
|
|
|
2020-10-18 20:30:37 +00:00
|
|
|
/**
|
|
|
|
* Change if this is first page.
|
|
|
|
*
|
|
|
|
* Title blocks have an option to allow all subsequent pages to not display a title
|
|
|
|
* block. This needs to be set to false when displaying any page but the first page.
|
|
|
|
*/
|
|
|
|
void SetIsFirstPage( bool aIsFirstPage ) { m_isFirstPage = aIsFirstPage; }
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
/**
|
2021-05-30 22:56:24 +00:00
|
|
|
* Can be used to override which layer ID is used for drawing sheet item colors
|
2021-02-22 16:37:43 +00:00
|
|
|
* @param aLayerId is the color to use (defaults to LAYER_DRAWINGSHEET if this is not called)
|
2020-01-13 01:44:19 +00:00
|
|
|
*/
|
|
|
|
void SetColorLayer( int aLayerId )
|
|
|
|
{
|
|
|
|
m_colorLayer = aLayerId;
|
|
|
|
}
|
|
|
|
|
2020-08-07 21:12:10 +00:00
|
|
|
/**
|
|
|
|
* Overrides the layer used to pick the color of the page border (normally LAYER_GRID)
|
|
|
|
* @param aLayerId is the layer to use
|
|
|
|
*/
|
|
|
|
void SetPageBorderColorLayer( int aLayerId )
|
|
|
|
{
|
|
|
|
m_pageBorderColorLayer = aLayerId;
|
|
|
|
}
|
|
|
|
|
2020-05-28 13:36:54 +00:00
|
|
|
const PAGE_INFO& GetPageInfo() { return *m_pageInfo; }
|
|
|
|
const TITLE_BLOCK& GetTitleBlock() { return *m_titleBlock; }
|
|
|
|
|
2013-09-11 12:42:12 +00:00
|
|
|
/// @copydoc VIEW_ITEM::ViewBBox()
|
2016-09-24 18:53:15 +00:00
|
|
|
const BOX2I ViewBBox() const override;
|
2013-09-11 12:42:12 +00:00
|
|
|
|
|
|
|
/// @copydoc VIEW_ITEM::ViewDraw()
|
2021-02-22 23:47:17 +00:00
|
|
|
void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
|
2013-09-11 12:42:12 +00:00
|
|
|
|
|
|
|
/// @copydoc VIEW_ITEM::ViewGetLayers()
|
2016-12-09 11:04:32 +00:00
|
|
|
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
2013-09-11 12:42:12 +00:00
|
|
|
|
2015-03-06 08:58:32 +00:00
|
|
|
#if defined(DEBUG)
|
2013-09-11 12:42:12 +00:00
|
|
|
/// @copydoc EDA_ITEM::Show()
|
2019-05-26 15:36:40 +00:00
|
|
|
void Show( int x, std::ostream& st ) const override { }
|
2015-03-06 08:58:32 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/** Get class name
|
2021-05-30 22:56:24 +00:00
|
|
|
* @return string "DS_PROXY_VIEW_ITEM"
|
2015-03-06 08:58:32 +00:00
|
|
|
*/
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual wxString GetClass() const override
|
2015-03-06 08:58:32 +00:00
|
|
|
{
|
2021-02-22 23:47:17 +00:00
|
|
|
return wxT( "DS_PROXY_VIEW_ITEM" );
|
2015-03-06 08:58:32 +00:00
|
|
|
}
|
2013-09-11 12:42:12 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
bool HitTestDrawingSheetItems( KIGFX::VIEW* aView, const VECTOR2I& aPosition );
|
2020-05-02 23:06:43 +00:00
|
|
|
|
2013-09-11 12:42:12 +00:00
|
|
|
protected:
|
2021-02-22 23:47:17 +00:00
|
|
|
void buildDrawList( KIGFX::VIEW* aView, DS_DRAW_ITEM_LIST* aDrawList ) const;
|
2020-05-02 23:06:43 +00:00
|
|
|
|
2021-05-30 22:56:24 +00:00
|
|
|
/// the factor between mils (units used in drawing sheet and internal units)
|
2018-06-01 07:11:43 +00:00
|
|
|
/// it is the value IU_PER_MILS used in the caller
|
2020-03-26 11:02:59 +00:00
|
|
|
int m_mils2IUscalefactor;
|
2013-09-11 12:42:12 +00:00
|
|
|
|
2020-03-26 11:02:59 +00:00
|
|
|
std::string m_fileName;
|
|
|
|
std::string m_sheetName;
|
2022-04-09 14:38:47 +00:00
|
|
|
std::string m_sheetPath;
|
2013-09-11 12:42:12 +00:00
|
|
|
const TITLE_BLOCK* m_titleBlock;
|
2020-03-26 11:02:59 +00:00
|
|
|
const PAGE_INFO* m_pageInfo;
|
2020-10-18 20:30:37 +00:00
|
|
|
std::string m_pageNumber;
|
2020-03-26 11:02:59 +00:00
|
|
|
int m_sheetCount;
|
2020-10-18 20:30:37 +00:00
|
|
|
bool m_isFirstPage;
|
2020-03-26 11:02:59 +00:00
|
|
|
const PROJECT* m_project;
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2021-05-30 22:56:24 +00:00
|
|
|
/// Layer that is used for drawing sheet color (LAYER_DRAWINGSHEET is always used for visibility)
|
2020-03-26 11:02:59 +00:00
|
|
|
int m_colorLayer;
|
2020-08-07 21:12:10 +00:00
|
|
|
|
|
|
|
/// Layer that is used for page border color
|
|
|
|
int m_pageBorderColorLayer;
|
2013-09-11 12:42:12 +00:00
|
|
|
};
|
|
|
|
|
2021-02-22 23:47:17 +00:00
|
|
|
#endif /* DS_PROXY_VIEW_ITEM_H */
|