2018-08-03 12:18:26 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2020-06-19 11:48:00 +00:00
|
|
|
* Copyright (C) 2019-2020 CERN
|
2024-03-13 16:42:05 +00:00
|
|
|
* Copyright (C) 2020-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
2021-02-24 13:48:02 +00:00
|
|
|
*
|
2018-08-03 12:18:26 +00:00
|
|
|
* @author Tomasz Wlostowski <tomasz.wlostowski@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
|
|
|
|
*/
|
|
|
|
|
2024-05-25 20:39:51 +00:00
|
|
|
#ifndef SCH_PAINTER_H
|
|
|
|
#define SCH_PAINTER_H
|
2018-08-03 12:18:26 +00:00
|
|
|
|
2024-04-02 17:28:17 +00:00
|
|
|
#include <sch_render_settings.h>
|
2021-02-24 13:48:02 +00:00
|
|
|
#include <sch_symbol.h>
|
2019-04-03 09:14:36 +00:00
|
|
|
|
2023-09-07 00:23:19 +00:00
|
|
|
#include <gal/painter.h>
|
2018-08-03 12:18:26 +00:00
|
|
|
|
2019-04-03 09:14:36 +00:00
|
|
|
|
2024-04-20 09:44:34 +00:00
|
|
|
class SCH_PIN;
|
2021-06-10 18:51:46 +00:00
|
|
|
class LIB_SYMBOL;
|
2021-06-10 14:10:55 +00:00
|
|
|
class SCH_SYMBOL;
|
2018-08-03 12:18:26 +00:00
|
|
|
class SCH_FIELD;
|
|
|
|
class SCH_JUNCTION;
|
|
|
|
class SCH_LABEL;
|
|
|
|
class SCH_TEXT;
|
2022-01-25 22:33:37 +00:00
|
|
|
class SCH_TEXTBOX;
|
2023-11-25 12:38:24 +00:00
|
|
|
class SCH_TABLE;
|
2018-08-03 12:18:26 +00:00
|
|
|
class SCH_HIERLABEL;
|
2022-01-24 13:40:39 +00:00
|
|
|
class SCH_DIRECTIVE_LABEL;
|
2018-08-03 12:18:26 +00:00
|
|
|
class SCH_GLOBALLABEL;
|
|
|
|
class SCH_SHEET;
|
|
|
|
class SCH_SHEET_PIN;
|
2021-07-17 19:56:18 +00:00
|
|
|
class SCH_SHAPE;
|
2018-08-03 12:18:26 +00:00
|
|
|
class SCH_MARKER;
|
|
|
|
class SCH_NO_CONNECT;
|
|
|
|
class SCH_LINE;
|
|
|
|
class SCH_BUS_ENTRY_BASE;
|
2018-08-27 13:25:48 +00:00
|
|
|
class SCH_BITMAP;
|
2020-05-13 02:00:37 +00:00
|
|
|
class SCHEMATIC;
|
2018-08-03 12:18:26 +00:00
|
|
|
|
|
|
|
namespace KIGFX
|
|
|
|
{
|
|
|
|
class GAL;
|
|
|
|
class SCH_PAINTER;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Contains methods for drawing schematic-specific items.
|
|
|
|
*/
|
|
|
|
class SCH_PAINTER : public PAINTER
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SCH_PAINTER( GAL* aGal );
|
|
|
|
|
|
|
|
/// @copydoc PAINTER::Draw()
|
|
|
|
virtual bool Draw( const VIEW_ITEM*, int ) override;
|
|
|
|
|
2021-01-30 14:41:31 +00:00
|
|
|
/// @copydoc PAINTER::GetSettings()
|
2022-08-20 09:27:35 +00:00
|
|
|
virtual SCH_RENDER_SETTINGS* GetSettings() override { return &m_schSettings; }
|
2018-08-03 12:18:26 +00:00
|
|
|
|
2022-08-20 09:27:35 +00:00
|
|
|
void SetSchematic( SCHEMATIC* aSchematic ) { m_schematic = aSchematic; }
|
2020-05-13 02:00:37 +00:00
|
|
|
|
2018-08-03 12:18:26 +00:00
|
|
|
private:
|
2024-03-13 16:42:05 +00:00
|
|
|
void drawItemBoundingBox( const EDA_ITEM* aItem );
|
2022-09-16 16:20:36 +00:00
|
|
|
void draw( const EDA_ITEM*, int, bool aDimmed );
|
2024-04-20 09:44:34 +00:00
|
|
|
void draw( const SCH_PIN* aPin, int aLayer, bool aDimmed );
|
2021-06-10 18:51:46 +00:00
|
|
|
void draw( const LIB_SYMBOL* aSymbol, int, bool aDrawFields = true, int aUnit = 0,
|
2024-01-26 16:16:13 +00:00
|
|
|
int aBodyStyle = 0, bool aDimmed = false );
|
2022-09-16 16:20:36 +00:00
|
|
|
void draw( const SCH_SYMBOL* aSymbol, int aLayer );
|
2024-04-15 20:18:54 +00:00
|
|
|
void draw( const SCH_SHAPE* aShape, int aLayer, bool aDimmed );
|
2020-12-20 18:44:13 +00:00
|
|
|
void draw( const SCH_JUNCTION* aJct, int aLayer );
|
2022-09-16 16:20:36 +00:00
|
|
|
void draw( const SCH_FIELD* aField, int aLayer, bool aDimmed );
|
2024-04-15 20:18:54 +00:00
|
|
|
void draw( const SCH_TEXTBOX* aTextBox, int aLayer, bool aDimmed );
|
2024-04-14 18:04:53 +00:00
|
|
|
void draw( const SCH_TEXT* aText, int aLayer, bool aDimmed );
|
2024-04-15 20:18:54 +00:00
|
|
|
void draw( const SCH_TABLE* aTable, int aLayer, bool aDimmed );
|
2024-04-20 20:50:40 +00:00
|
|
|
void draw( const SCH_LABEL* aLabel, int aLayer );
|
2022-01-24 13:40:39 +00:00
|
|
|
void draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer );
|
2024-06-02 21:26:49 +00:00
|
|
|
void draw( const SCH_HIERLABEL* aLabel, int aLayer, bool aDimmed );
|
2021-10-12 20:05:37 +00:00
|
|
|
void draw( const SCH_GLOBALLABEL* aLabel, int aLayer );
|
2020-12-20 18:44:13 +00:00
|
|
|
void draw( const SCH_SHEET* aSheet, int aLayer );
|
|
|
|
void draw( const SCH_NO_CONNECT* aNC, int aLayer );
|
|
|
|
void draw( const SCH_MARKER* aMarker, int aLayer );
|
|
|
|
void draw( const SCH_BITMAP* aBitmap, int aLayer );
|
|
|
|
void draw( const SCH_LINE* aLine, int aLayer );
|
|
|
|
void draw( const SCH_BUS_ENTRY_BASE* aEntry, int aLayer );
|
2018-08-03 12:18:26 +00:00
|
|
|
|
2023-12-18 19:16:33 +00:00
|
|
|
void drawPinDanglingIndicator( const VECTOR2I& aPos, const COLOR4D& aColor,
|
|
|
|
bool aDrawingShadows, bool aBrightened );
|
|
|
|
void drawDanglingIndicator( const VECTOR2I& aPos, const COLOR4D& aColor, int aWidth,
|
|
|
|
bool aDangling, bool aDrawingShadows, bool aBrightened );
|
2024-05-25 20:39:51 +00:00
|
|
|
void drawAnchor( const VECTOR2I& aPos, bool aDrawingShadows );
|
2019-07-30 01:57:41 +00:00
|
|
|
|
2024-04-20 09:44:34 +00:00
|
|
|
int internalPinDecoSize( const SCH_PIN &aPin );
|
|
|
|
int externalPinDecoSize( const SCH_PIN &aPin );
|
2020-05-03 23:55:31 +00:00
|
|
|
|
2022-02-24 18:15:47 +00:00
|
|
|
// Indicates the item is drawn on a non-cached layer in OpenGL
|
|
|
|
bool nonCached( const EDA_ITEM* aItem );
|
|
|
|
|
2024-04-06 13:14:44 +00:00
|
|
|
bool isUnitAndConversionShown( const SCH_ITEM* aItem ) const;
|
2018-08-03 12:18:26 +00:00
|
|
|
|
2021-09-15 20:03:07 +00:00
|
|
|
float getShadowWidth( bool aForHighlight ) const;
|
2024-04-20 09:44:34 +00:00
|
|
|
COLOR4D getRenderColor( const SCH_ITEM* aItem, int aLayer, bool aDrawingShadows,
|
2022-10-21 21:42:09 +00:00
|
|
|
bool aDimmed = false ) const;
|
2023-01-28 20:01:58 +00:00
|
|
|
KIFONT::FONT* getFont( const EDA_TEXT* aText ) const;
|
2024-04-20 09:44:34 +00:00
|
|
|
float getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows ) const;
|
|
|
|
float getTextThickness( const SCH_ITEM* aItem ) const;
|
2019-04-19 15:54:29 +00:00
|
|
|
|
2023-02-09 17:18:56 +00:00
|
|
|
int getOperatingPointTextSize() const;
|
|
|
|
|
2022-08-20 09:27:35 +00:00
|
|
|
void triLine( const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c );
|
2021-12-31 14:07:24 +00:00
|
|
|
void strokeText( const wxString& aText, const VECTOR2D& aPosition,
|
2024-04-20 20:50:40 +00:00
|
|
|
const TEXT_ATTRIBUTES& aAttrs, const KIFONT::METRICS& aFontMetrics );
|
2022-02-23 12:07:33 +00:00
|
|
|
void bitmapText( const wxString& aText, const VECTOR2D& aPosition,
|
2024-04-20 20:50:40 +00:00
|
|
|
const TEXT_ATTRIBUTES& aAttrs );
|
2023-02-09 17:18:56 +00:00
|
|
|
void knockoutText( const wxString& aText, const VECTOR2D& aPosition,
|
2023-08-06 19:20:53 +00:00
|
|
|
const TEXT_ATTRIBUTES& aAttrs, const KIFONT::METRICS& aFontMetrics );
|
2023-02-09 17:18:56 +00:00
|
|
|
void boxText( const wxString& aText, const VECTOR2D& aPosition,
|
2024-04-27 12:47:56 +00:00
|
|
|
const TEXT_ATTRIBUTES& aAttrs, const KIFONT::METRICS& aFontMetrics );
|
2018-08-03 12:18:26 +00:00
|
|
|
|
2023-05-06 18:22:14 +00:00
|
|
|
wxString expandLibItemTextVars( const wxString& aSourceText, const SCH_SYMBOL* aSymbolContext );
|
|
|
|
|
2022-05-13 21:36:20 +00:00
|
|
|
public:
|
2022-08-21 19:54:07 +00:00
|
|
|
static std::vector<KICAD_T> g_ScaledSelectionTypes;
|
2022-05-13 21:36:20 +00:00
|
|
|
|
2021-09-15 20:15:55 +00:00
|
|
|
private:
|
2018-08-03 12:18:26 +00:00
|
|
|
SCH_RENDER_SETTINGS m_schSettings;
|
2022-08-20 09:27:35 +00:00
|
|
|
SCHEMATIC* m_schematic;
|
2018-08-03 12:18:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}; // namespace KIGFX
|
|
|
|
|
|
|
|
|
2024-05-25 20:39:51 +00:00
|
|
|
#endif // SCH_PAINTER_H
|