2022-01-24 13:40:39 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2023-02-05 20:47:27 +00:00
|
|
|
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2022-01-24 13:40:39 +00:00
|
|
|
*
|
|
|
|
* 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_LABEL_H
|
|
|
|
#define SCH_LABEL_H
|
|
|
|
|
|
|
|
#include <sch_text.h>
|
|
|
|
#include <sch_item.h>
|
|
|
|
#include <sch_field.h>
|
|
|
|
#include <sch_connection.h> // for CONNECTION_TYPE
|
|
|
|
|
|
|
|
|
2023-09-07 16:09:53 +00:00
|
|
|
/*
|
|
|
|
* Spin style for labels of all kinds on schematics
|
|
|
|
* Basically a higher level abstraction of rotation and justification of text
|
|
|
|
*/
|
|
|
|
class SPIN_STYLE
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum SPIN : int
|
|
|
|
{
|
|
|
|
LEFT = 0,
|
|
|
|
UP = 1,
|
|
|
|
RIGHT = 2,
|
|
|
|
BOTTOM = 3
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
SPIN_STYLE() = default;
|
|
|
|
constexpr SPIN_STYLE( SPIN aSpin ) : m_spin( aSpin )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
constexpr bool operator==( SPIN a ) const
|
|
|
|
{
|
|
|
|
return m_spin == a;
|
|
|
|
}
|
|
|
|
|
|
|
|
constexpr bool operator!=( SPIN a ) const
|
|
|
|
{
|
|
|
|
return m_spin != a;
|
|
|
|
}
|
|
|
|
|
|
|
|
operator int() const
|
|
|
|
{
|
|
|
|
return static_cast<int>( m_spin );
|
|
|
|
}
|
|
|
|
|
|
|
|
SPIN_STYLE RotateCCW();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Mirror the label spin style across the X axis or simply swaps up and bottom.
|
|
|
|
*/
|
|
|
|
SPIN_STYLE MirrorX();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Mirror the label spin style across the Y axis or simply swaps left and right.
|
|
|
|
*/
|
|
|
|
SPIN_STYLE MirrorY();
|
|
|
|
|
|
|
|
private:
|
|
|
|
SPIN m_spin;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Label and flag shapes used with text objects.
|
|
|
|
*/
|
|
|
|
enum LABEL_FLAG_SHAPE
|
|
|
|
{
|
|
|
|
L_INPUT,
|
|
|
|
L_OUTPUT,
|
|
|
|
L_BIDI,
|
|
|
|
L_TRISTATE,
|
|
|
|
L_UNSPECIFIED,
|
|
|
|
|
|
|
|
F_FIRST,
|
|
|
|
F_DOT = F_FIRST,
|
|
|
|
F_ROUND,
|
|
|
|
F_DIAMOND,
|
|
|
|
F_RECTANGLE
|
|
|
|
};
|
|
|
|
|
2023-10-22 11:15:53 +00:00
|
|
|
/*
|
|
|
|
* Specific enums for property manager (not used elsewhere)
|
|
|
|
*/
|
|
|
|
enum LABEL_SHAPE
|
|
|
|
{
|
|
|
|
LABEL_INPUT = L_INPUT,
|
|
|
|
LABEL_OUTPUT = L_OUTPUT,
|
|
|
|
LABEL_BIDI = L_BIDI,
|
|
|
|
LABEL_TRISTATE = L_TRISTATE,
|
|
|
|
LABEL_PASSIVE = L_UNSPECIFIED
|
|
|
|
};
|
|
|
|
|
|
|
|
enum FLAG_SHAPE
|
|
|
|
{
|
|
|
|
FLAG_DOT = F_DOT,
|
|
|
|
FLAG_CIRCLE = F_ROUND,
|
|
|
|
FLAG_DIAMOND = F_DIAMOND,
|
|
|
|
FLAG_RECTANGLE = F_RECTANGLE
|
|
|
|
};
|
|
|
|
|
2023-09-07 16:09:53 +00:00
|
|
|
|
2022-01-24 13:40:39 +00:00
|
|
|
class SCH_LABEL_BASE : public SCH_TEXT
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SCH_LABEL_BASE( const VECTOR2I& aPos, const wxString& aText, KICAD_T aType );
|
|
|
|
|
|
|
|
SCH_LABEL_BASE( const SCH_LABEL_BASE& aLabel );
|
|
|
|
|
2023-08-07 22:21:58 +00:00
|
|
|
SCH_LABEL_BASE& operator=( const SCH_LABEL_BASE& aLabel );
|
|
|
|
|
2022-01-24 13:40:39 +00:00
|
|
|
// Abstract class
|
|
|
|
virtual wxString GetClass() const override = 0;
|
|
|
|
|
2022-08-21 19:54:07 +00:00
|
|
|
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override;
|
2022-01-24 13:40:39 +00:00
|
|
|
|
|
|
|
void SwapData( SCH_ITEM* aItem ) override;
|
|
|
|
|
2022-06-27 02:31:38 +00:00
|
|
|
bool CanConnect( const SCH_ITEM* aItem ) const override
|
|
|
|
{
|
|
|
|
switch( aItem->Type() )
|
|
|
|
{
|
|
|
|
case SCH_LINE_T:
|
|
|
|
return aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS;
|
|
|
|
|
|
|
|
case SCH_BUS_WIRE_ENTRY_T:
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case SCH_SYMBOL_T:
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case SCH_LABEL_T:
|
|
|
|
case SCH_GLOBAL_LABEL_T:
|
|
|
|
case SCH_HIER_LABEL_T:
|
|
|
|
case SCH_DIRECTIVE_LABEL_T:
|
|
|
|
case SCH_SHEET_PIN_T:
|
|
|
|
return true;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-07 16:09:53 +00:00
|
|
|
LABEL_FLAG_SHAPE GetShape() const { return m_shape; }
|
|
|
|
void SetShape( LABEL_FLAG_SHAPE aShape ) { m_shape = aShape; }
|
2022-01-24 13:40:39 +00:00
|
|
|
|
2023-10-22 11:15:53 +00:00
|
|
|
// Type-specific versions for property manager
|
|
|
|
LABEL_SHAPE GetLabelShape() const { return (LABEL_SHAPE) m_shape; }
|
|
|
|
void SetLabelShape( LABEL_SHAPE aShape ) { m_shape = (LABEL_FLAG_SHAPE) aShape; }
|
|
|
|
|
2022-09-24 22:50:52 +00:00
|
|
|
COLOR4D GetLabelColor() const;
|
|
|
|
|
2023-09-07 16:09:53 +00:00
|
|
|
virtual void SetSpinStyle( SPIN_STYLE aSpinStyle );
|
|
|
|
SPIN_STYLE GetSpinStyle() const;
|
|
|
|
|
2022-09-24 22:50:52 +00:00
|
|
|
void SetLastResolvedState( const SCH_ITEM* aItem ) override
|
|
|
|
{
|
|
|
|
const SCH_LABEL_BASE* aLabel = dynamic_cast<const SCH_LABEL_BASE*>( aItem );
|
|
|
|
|
|
|
|
if( aLabel )
|
|
|
|
m_lastResolvedColor = aLabel->m_lastResolvedColor;
|
|
|
|
}
|
|
|
|
|
2022-01-24 13:40:39 +00:00
|
|
|
static const wxString GetDefaultFieldName( const wxString& aName, bool aUseDefaultName );
|
|
|
|
|
|
|
|
virtual int GetMandatoryFieldCount() { return 0; }
|
|
|
|
|
|
|
|
std::vector<SCH_FIELD>& GetFields() { return m_fields; }
|
|
|
|
const std::vector<SCH_FIELD>& GetFields() const { return m_fields; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set multiple schematic fields.
|
|
|
|
*
|
|
|
|
* @param aFields are the fields to set in this symbol.
|
|
|
|
*/
|
|
|
|
void SetFields( const std::vector<SCH_FIELD>& aFields )
|
|
|
|
{
|
|
|
|
m_fields = aFields; // vector copying, length is changed possibly
|
|
|
|
}
|
|
|
|
|
2023-04-09 10:06:01 +00:00
|
|
|
void AddFields( const std::vector<SCH_FIELD>& aFields )
|
|
|
|
{
|
|
|
|
m_fields.insert( m_fields.end(), aFields.begin(), aFields.end() );
|
|
|
|
}
|
|
|
|
|
2023-04-25 14:09:17 +00:00
|
|
|
void AddField( const SCH_FIELD& aField )
|
|
|
|
{
|
|
|
|
m_fields.push_back( aField );
|
|
|
|
}
|
|
|
|
|
2022-01-24 13:40:39 +00:00
|
|
|
/**
|
|
|
|
* Increment the label text, if it ends with a number.
|
|
|
|
*
|
|
|
|
* @param aIncrement = the increment value to add to the number ending the text.
|
|
|
|
*/
|
|
|
|
bool IncrementLabel( int aIncrement );
|
|
|
|
|
2023-04-12 09:15:17 +00:00
|
|
|
void Move( const VECTOR2I& aMoveVector ) override;
|
2022-01-24 13:40:39 +00:00
|
|
|
void Rotate( const VECTOR2I& aCenter ) override;
|
|
|
|
void Rotate90( bool aClockwise ) override;
|
|
|
|
|
2023-05-18 08:28:27 +00:00
|
|
|
void MirrorSpinStyle( bool aLeftRight ) override;
|
|
|
|
|
2023-05-23 07:42:24 +00:00
|
|
|
void MirrorHorizontally( int aCenter ) override;
|
|
|
|
void MirrorVertically( int aCenter ) override;
|
|
|
|
|
2023-04-12 09:15:17 +00:00
|
|
|
void SetPosition( const VECTOR2I& aPosition ) override;
|
|
|
|
|
2022-01-24 13:40:39 +00:00
|
|
|
void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
|
|
|
|
|
2022-08-27 22:28:31 +00:00
|
|
|
/**
|
|
|
|
* Builds an array of { pageNumber, pageName } pairs.
|
|
|
|
* @param pages [out] Array of { pageNumber, pageName } pairs.
|
|
|
|
*/
|
|
|
|
void GetIntersheetRefs( std::vector<std::pair<wxString, wxString>>* pages );
|
|
|
|
|
2023-02-05 20:47:27 +00:00
|
|
|
/**
|
|
|
|
* Return the list of system text vars & fields for this label.
|
|
|
|
*/
|
|
|
|
void GetContextualTextVars( wxArrayString* aVars ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Resolve any references to system tokens supported by the label.
|
|
|
|
*
|
|
|
|
* @param aDepth a counter to limit recursion and circular references.
|
|
|
|
*/
|
2023-04-27 11:56:15 +00:00
|
|
|
virtual bool ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, int aDepth ) const;
|
2022-01-24 13:40:39 +00:00
|
|
|
|
2023-05-05 13:21:56 +00:00
|
|
|
wxString GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
|
|
|
|
int aDepth = 0 ) const override;
|
2023-04-27 11:56:15 +00:00
|
|
|
|
2023-05-05 13:21:56 +00:00
|
|
|
wxString GetShownText( bool aAllowExtraText, int aDepth = 0 ) const override
|
2023-04-27 11:56:15 +00:00
|
|
|
{
|
2023-11-12 14:14:41 +00:00
|
|
|
SCHEMATIC* schematic = Schematic();
|
|
|
|
|
|
|
|
if( schematic )
|
|
|
|
return GetShownText( &schematic->CurrentSheet(), aAllowExtraText, aDepth );
|
|
|
|
else
|
|
|
|
return GetText();
|
2023-04-27 11:56:15 +00:00
|
|
|
}
|
2022-01-24 13:40:39 +00:00
|
|
|
|
2023-08-07 20:43:36 +00:00
|
|
|
bool HasCachedDriverName() const override;
|
|
|
|
const wxString& GetCachedDriverName() const override;
|
|
|
|
|
2022-01-24 13:40:39 +00:00
|
|
|
void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
|
|
|
|
|
2022-08-20 09:27:35 +00:00
|
|
|
INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
|
2022-08-21 19:54:07 +00:00
|
|
|
const std::vector<KICAD_T>& scanTypes ) override;
|
2022-01-24 13:40:39 +00:00
|
|
|
|
2022-11-04 00:26:30 +00:00
|
|
|
bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
|
|
|
|
bool Replace( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) override;
|
|
|
|
|
2022-01-24 13:40:39 +00:00
|
|
|
VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Calculate the graphic shape (a polygon) associated to the text.
|
|
|
|
*
|
|
|
|
* @param aPoints A buffer to fill with polygon corners coordinates
|
|
|
|
* @param Pos Position of the shape, for texts and labels: do nothing
|
|
|
|
*/
|
|
|
|
virtual void CreateGraphicShape( const RENDER_SETTINGS* aSettings,
|
|
|
|
std::vector<VECTOR2I>& aPoints, const VECTOR2I& Pos ) const
|
|
|
|
{
|
|
|
|
aPoints.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
int GetLabelBoxExpansion( const RENDER_SETTINGS* aSettings = nullptr ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the bounding box of the label only, without taking in account its fields.
|
|
|
|
*/
|
2022-08-30 23:28:18 +00:00
|
|
|
virtual const BOX2I GetBodyBoundingBox() const;
|
2022-01-24 13:40:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the bounding box of the label including its fields.
|
|
|
|
*/
|
2022-08-31 09:15:42 +00:00
|
|
|
const BOX2I GetBoundingBox() const override;
|
2022-01-24 13:40:39 +00:00
|
|
|
|
|
|
|
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
2022-08-31 09:33:46 +00:00
|
|
|
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
2022-01-24 13:40:39 +00:00
|
|
|
|
|
|
|
std::vector<VECTOR2I> GetConnectionPoints() const override;
|
|
|
|
|
|
|
|
void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
|
|
|
|
|
|
|
|
bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList,
|
|
|
|
const SCH_SHEET_PATH* aPath = nullptr ) override;
|
|
|
|
|
|
|
|
bool IsDangling() const override { return m_isDangling; }
|
|
|
|
void SetIsDangling( bool aIsDangling ) { m_isDangling = aIsDangling; }
|
|
|
|
|
|
|
|
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
|
|
|
|
|
|
|
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
|
|
|
|
2023-10-21 20:52:51 +00:00
|
|
|
void Plot( PLOTTER* aPlotter, bool aBackground,
|
|
|
|
const SCH_PLOT_SETTINGS& aPlotSettings ) const override;
|
2022-01-24 13:40:39 +00:00
|
|
|
|
|
|
|
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& offset ) override;
|
|
|
|
|
2022-03-26 16:27:45 +00:00
|
|
|
/**
|
|
|
|
* @brief autoRotateOnPlacement
|
|
|
|
* @return Returns true if the label rotation will be automatically set on the placement
|
|
|
|
*/
|
|
|
|
bool AutoRotateOnPlacement() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief setAutoRotateOnPlacement
|
|
|
|
* @param autoRotate If set to true when the label is placed in the connection to a
|
|
|
|
* pin/net the direction will be automatically set according to the positioning of the net/pin
|
|
|
|
*/
|
|
|
|
void SetAutoRotateOnPlacement( bool autoRotate = true );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief AutoRotateOnPlacementSupported
|
|
|
|
* @return true if the automated rotation of the label is supported after the placement
|
|
|
|
* At the moment it is supported for global and hierarchial labels
|
|
|
|
*/
|
|
|
|
virtual bool AutoRotateOnPlacementSupported() const = 0;
|
|
|
|
|
2023-09-14 21:39:42 +00:00
|
|
|
double Similarity( const SCH_ITEM& aItem ) const override;
|
|
|
|
|
|
|
|
bool operator==( const SCH_ITEM& aItem ) const override;
|
|
|
|
|
2023-08-07 20:43:36 +00:00
|
|
|
protected:
|
|
|
|
void cacheShownText() override;
|
|
|
|
|
2022-01-24 13:40:39 +00:00
|
|
|
protected:
|
|
|
|
std::vector<SCH_FIELD> m_fields;
|
|
|
|
|
|
|
|
LABEL_FLAG_SHAPE m_shape;
|
|
|
|
|
|
|
|
CONNECTION_TYPE m_connectionType;
|
|
|
|
bool m_isDangling;
|
2022-03-26 16:27:45 +00:00
|
|
|
bool m_autoRotateOnPlacement = false;
|
2022-09-24 22:50:52 +00:00
|
|
|
|
|
|
|
mutable COLOR4D m_lastResolvedColor;
|
2023-08-07 20:43:36 +00:00
|
|
|
|
|
|
|
wxString m_cached_driver_name;
|
2022-01-24 13:40:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class SCH_LABEL : public SCH_LABEL_BASE
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SCH_LABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString );
|
|
|
|
|
|
|
|
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
|
|
|
|
|
|
|
~SCH_LABEL() { }
|
|
|
|
|
|
|
|
static inline bool ClassOf( const EDA_ITEM* aItem )
|
|
|
|
{
|
|
|
|
return aItem && SCH_LABEL_T == aItem->Type();
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString GetClass() const override
|
|
|
|
{
|
|
|
|
return wxT( "SCH_LABEL" );
|
|
|
|
}
|
|
|
|
|
2022-08-30 23:28:18 +00:00
|
|
|
const BOX2I GetBodyBoundingBox() const override;
|
2022-01-24 13:40:39 +00:00
|
|
|
|
|
|
|
bool IsConnectable() const override { return true; }
|
|
|
|
|
2023-01-12 03:27:44 +00:00
|
|
|
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
|
2022-01-24 13:40:39 +00:00
|
|
|
|
|
|
|
BITMAPS GetMenuImage() const override;
|
|
|
|
|
|
|
|
bool IsReplaceable() const override { return true; }
|
|
|
|
|
|
|
|
EDA_ITEM* Clone() const override
|
|
|
|
{
|
|
|
|
return new SCH_LABEL( *this );
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
|
|
|
|
{
|
|
|
|
return m_isDangling && GetPosition() == aPos;
|
|
|
|
}
|
|
|
|
|
2022-03-26 16:27:45 +00:00
|
|
|
bool AutoRotateOnPlacementSupported() const override { return false; }
|
|
|
|
|
2022-01-24 13:40:39 +00:00
|
|
|
private:
|
|
|
|
bool doIsConnected( const VECTOR2I& aPosition ) const override
|
|
|
|
{
|
|
|
|
return EDA_TEXT::GetTextPos() == aPosition;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class SCH_DIRECTIVE_LABEL : public SCH_LABEL_BASE
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SCH_DIRECTIVE_LABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ) );
|
|
|
|
|
|
|
|
SCH_DIRECTIVE_LABEL( const SCH_DIRECTIVE_LABEL& aClassLabel );
|
|
|
|
|
|
|
|
~SCH_DIRECTIVE_LABEL() { }
|
|
|
|
|
|
|
|
static inline bool ClassOf( const EDA_ITEM* aItem )
|
|
|
|
{
|
|
|
|
return aItem && SCH_DIRECTIVE_LABEL_T == aItem->Type();
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString GetClass() const override
|
|
|
|
{
|
|
|
|
return wxT( "SCH_DIRECTIVE_LABEL" );
|
|
|
|
}
|
|
|
|
|
|
|
|
EDA_ITEM* Clone() const override
|
|
|
|
{
|
|
|
|
return new SCH_DIRECTIVE_LABEL( *this );
|
|
|
|
}
|
|
|
|
|
2022-03-03 09:27:17 +00:00
|
|
|
void SwapData( SCH_ITEM* aItem ) override;
|
|
|
|
|
2023-10-22 11:15:53 +00:00
|
|
|
FLAG_SHAPE GetFlagShape() const { return (FLAG_SHAPE) m_shape; }
|
|
|
|
void SetFlagShape( FLAG_SHAPE aShape ) { m_shape = (LABEL_FLAG_SHAPE) aShape; }
|
|
|
|
|
|
|
|
int GetPinLength() const { return m_pinLength; }
|
2022-01-24 13:40:39 +00:00
|
|
|
void SetPinLength( int aLength ) { m_pinLength = aLength; }
|
|
|
|
|
2022-05-13 21:36:20 +00:00
|
|
|
int GetPenWidth() const override;
|
|
|
|
|
2022-01-24 13:40:39 +00:00
|
|
|
void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
|
|
|
|
const VECTOR2I& aPos ) const override;
|
|
|
|
|
|
|
|
void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
|
|
|
|
|
2023-01-12 03:27:44 +00:00
|
|
|
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
|
2022-01-24 13:40:39 +00:00
|
|
|
|
|
|
|
bool IsConnectable() const override { return true; }
|
|
|
|
|
2022-03-26 16:27:45 +00:00
|
|
|
bool AutoRotateOnPlacementSupported() const override { return false; }
|
|
|
|
|
2023-05-18 08:28:27 +00:00
|
|
|
void MirrorSpinStyle( bool aLeftRight ) override;
|
|
|
|
|
2023-05-23 07:42:24 +00:00
|
|
|
void MirrorHorizontally( int aCenter ) override;
|
|
|
|
void MirrorVertically( int aCenter ) override;
|
|
|
|
|
2022-01-24 13:40:39 +00:00
|
|
|
private:
|
|
|
|
int m_pinLength;
|
|
|
|
int m_symbolSize;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class SCH_GLOBALLABEL : public SCH_LABEL_BASE
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SCH_GLOBALLABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString );
|
|
|
|
|
|
|
|
SCH_GLOBALLABEL( const SCH_GLOBALLABEL& aGlobalLabel );
|
|
|
|
|
|
|
|
~SCH_GLOBALLABEL() { }
|
|
|
|
|
|
|
|
static inline bool ClassOf( const EDA_ITEM* aItem )
|
|
|
|
{
|
|
|
|
return aItem && SCH_GLOBAL_LABEL_T == aItem->Type();
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString GetClass() const override
|
|
|
|
{
|
|
|
|
return wxT( "SCH_GLOBALLABEL" );
|
|
|
|
}
|
|
|
|
|
|
|
|
EDA_ITEM* Clone() const override
|
|
|
|
{
|
|
|
|
return new SCH_GLOBALLABEL( *this );
|
|
|
|
}
|
|
|
|
|
|
|
|
int GetMandatoryFieldCount() override { return 1; }
|
|
|
|
|
2023-09-07 16:09:53 +00:00
|
|
|
void SetSpinStyle( SPIN_STYLE aSpinStyle ) override;
|
2022-01-24 13:40:39 +00:00
|
|
|
|
|
|
|
VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
|
|
|
|
|
|
|
|
void CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings, std::vector<VECTOR2I>& aPoints,
|
|
|
|
const VECTOR2I& aPos ) const override;
|
|
|
|
|
2023-04-27 11:56:15 +00:00
|
|
|
bool ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, int aDepth ) const override;
|
2022-01-24 13:40:39 +00:00
|
|
|
|
|
|
|
bool IsConnectable() const override { return true; }
|
|
|
|
|
|
|
|
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
|
|
|
|
2023-01-12 03:27:44 +00:00
|
|
|
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
|
2022-01-24 13:40:39 +00:00
|
|
|
|
|
|
|
BITMAPS GetMenuImage() const override;
|
|
|
|
|
|
|
|
bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
|
|
|
|
{
|
|
|
|
return m_isDangling && GetPosition() == aPos;
|
|
|
|
}
|
|
|
|
|
2022-03-26 16:27:45 +00:00
|
|
|
bool AutoRotateOnPlacementSupported() const override { return true; }
|
|
|
|
|
2022-01-24 13:40:39 +00:00
|
|
|
private:
|
|
|
|
bool doIsConnected( const VECTOR2I& aPosition ) const override
|
|
|
|
{
|
|
|
|
return EDA_TEXT::GetTextPos() == aPosition;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class SCH_HIERLABEL : public SCH_LABEL_BASE
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SCH_HIERLABEL( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString,
|
|
|
|
KICAD_T aType = SCH_HIER_LABEL_T );
|
|
|
|
|
|
|
|
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
|
|
|
|
|
|
|
~SCH_HIERLABEL() { }
|
|
|
|
|
|
|
|
static inline bool ClassOf( const EDA_ITEM* aItem )
|
|
|
|
{
|
|
|
|
return aItem && SCH_HIER_LABEL_T == aItem->Type();
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString GetClass() const override
|
|
|
|
{
|
|
|
|
return wxT( "SCH_HIERLABEL" );
|
|
|
|
}
|
|
|
|
|
2023-09-07 16:09:53 +00:00
|
|
|
void SetSpinStyle( SPIN_STYLE aSpinStyle ) override;
|
2022-01-24 13:40:39 +00:00
|
|
|
|
|
|
|
VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
|
|
|
|
|
|
|
|
void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
|
|
|
|
const VECTOR2I& aPos ) const override;
|
|
|
|
void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
|
|
|
|
const VECTOR2I& aPos, LABEL_FLAG_SHAPE aShape ) const;
|
|
|
|
|
2022-08-30 23:28:18 +00:00
|
|
|
const BOX2I GetBodyBoundingBox() const override;
|
2022-01-24 13:40:39 +00:00
|
|
|
|
|
|
|
bool IsConnectable() const override { return true; }
|
|
|
|
|
2023-01-12 03:27:44 +00:00
|
|
|
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
|
2022-01-24 13:40:39 +00:00
|
|
|
|
|
|
|
BITMAPS GetMenuImage() const override;
|
|
|
|
|
|
|
|
EDA_ITEM* Clone() const override
|
|
|
|
{
|
|
|
|
return new SCH_HIERLABEL( *this );
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
|
|
|
|
{
|
|
|
|
return m_isDangling && GetPosition() == aPos;
|
|
|
|
}
|
|
|
|
|
2022-03-26 16:27:45 +00:00
|
|
|
bool AutoRotateOnPlacementSupported() const override { return true; }
|
|
|
|
|
2022-01-24 13:40:39 +00:00
|
|
|
private:
|
|
|
|
bool doIsConnected( const VECTOR2I& aPosition ) const override
|
|
|
|
{
|
|
|
|
return EDA_TEXT::GetTextPos() == aPosition;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* SCH_LABEL_H */
|