kicad/eeschema/sch_painter.h

151 lines
5.5 KiB
C
Raw Normal View History

/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019-2020 CERN
* Copyright (C) 2020-2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* @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
*/
#ifndef SCH_PAINTER_H
#define SCH_PAINTER_H
#include <sch_render_settings.h>
#include <sch_symbol.h>
#include <gal/painter.h>
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;
class SCH_FIELD;
class SCH_JUNCTION;
class SCH_LABEL;
class SCH_TEXT;
class SCH_TEXTBOX;
class SCH_TABLE;
class SCH_HIERLABEL;
class SCH_DIRECTIVE_LABEL;
class SCH_GLOBALLABEL;
class SCH_SHEET;
class SCH_SHEET_PIN;
class SCH_SHAPE;
class SCH_MARKER;
class SCH_NO_CONNECT;
class SCH_LINE;
class SCH_BUS_ENTRY_BASE;
class SCH_BITMAP;
class SCHEMATIC;
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;
/// @copydoc PAINTER::GetSettings()
virtual SCH_RENDER_SETTINGS* GetSettings() override { return &m_schSettings; }
void SetSchematic( SCHEMATIC* aSchematic ) { m_schematic = aSchematic; }
private:
void drawItemBoundingBox( const EDA_ITEM* aItem );
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,
int aBodyStyle = 0, bool aDimmed = false );
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 );
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 );
void draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer );
void draw( const SCH_HIERLABEL* aLabel, int aLayer, bool aDimmed );
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 );
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 );
void drawAnchor( const VECTOR2I& aPos, bool aDrawingShadows );
2024-04-20 09:44:34 +00:00
int internalPinDecoSize( const SCH_PIN &aPin );
int externalPinDecoSize( const SCH_PIN &aPin );
// 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;
float getShadowWidth( bool aForHighlight ) const;
2024-04-20 09:44:34 +00:00
COLOR4D getRenderColor( const SCH_ITEM* aItem, int aLayer, bool aDrawingShadows,
bool aDimmed = false ) const;
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;
int getOperatingPointTextSize() const;
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 );
void bitmapText( const wxString& aText, const VECTOR2D& aPosition,
2024-04-20 20:50:40 +00:00
const TEXT_ATTRIBUTES& aAttrs );
void knockoutText( const wxString& aText, const VECTOR2D& aPosition,
const TEXT_ATTRIBUTES& aAttrs, const KIFONT::METRICS& aFontMetrics );
void boxText( const wxString& aText, const VECTOR2D& aPosition,
const TEXT_ATTRIBUTES& aAttrs, const KIFONT::METRICS& aFontMetrics );
wxString expandLibItemTextVars( const wxString& aSourceText, const SCH_SYMBOL* aSymbolContext );
public:
static std::vector<KICAD_T> g_ScaledSelectionTypes;
private:
SCH_RENDER_SETTINGS m_schSettings;
SCHEMATIC* m_schematic;
};
}; // namespace KIGFX
#endif // SCH_PAINTER_H