Break sch_text.h/.cpp into sch_text and sch_label.

Also moves SCH_NETCLASS_FLAG to SCH_DIRECTIVE_LABEL, and remaps Altium
harnesses from SCH_TEXT to SCH_DIRECTIVE_LABEL.
This commit is contained in:
Jeff Young 2022-01-24 13:40:39 +00:00
parent 0036f44e37
commit 3409783d9f
44 changed files with 2254 additions and 2163 deletions

View File

@ -347,7 +347,7 @@ static struct EDA_ITEM_DESC
.Map( SCH_BITMAP_T, _HKI( "Bitmap" ) ) .Map( SCH_BITMAP_T, _HKI( "Bitmap" ) )
.Map( SCH_TEXT_T, _HKI( "Text" ) ) .Map( SCH_TEXT_T, _HKI( "Text" ) )
.Map( SCH_LABEL_T, _HKI( "Net Label" ) ) .Map( SCH_LABEL_T, _HKI( "Net Label" ) )
.Map( SCH_NETCLASS_FLAG_T, _HKI( "Net Class Flag" ) ) .Map( SCH_DIRECTIVE_LABEL_T, _HKI( "Directive Label" ) )
.Map( SCH_GLOBAL_LABEL_T, _HKI( "Global Label" ) ) .Map( SCH_GLOBAL_LABEL_T, _HKI( "Global Label" ) )
.Map( SCH_HIER_LABEL_T, _HKI( "Hierarchical Label" ) ) .Map( SCH_HIER_LABEL_T, _HKI( "Hierarchical Label" ) )
.Map( SCH_FIELD_T, _HKI( "Field" ) ) .Map( SCH_FIELD_T, _HKI( "Field" ) )

View File

@ -92,7 +92,7 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath )
CLR( "schematic.label_global", LAYER_GLOBLABEL ); CLR( "schematic.label_global", LAYER_GLOBLABEL );
CLR( "schematic.label_hier", LAYER_HIERLABEL ); CLR( "schematic.label_hier", LAYER_HIERLABEL );
CLR( "schematic.label_local", LAYER_LOCLABEL ); CLR( "schematic.label_local", LAYER_LOCLABEL );
CLR( "schematic.netclass_flag", LAYER_NETCLASS_REFS ); CLR( "schematic.netclass_flag", LAYER_NETCLASS_REFS );
CLR( "schematic.no_connect", LAYER_NOCONNECT ); CLR( "schematic.no_connect", LAYER_NOCONNECT );
CLR( "schematic.note", LAYER_NOTES ); CLR( "schematic.note", LAYER_NOTES );
CLR( "schematic.note_background", LAYER_NOTES_BACKGROUND ); CLR( "schematic.note_background", LAYER_NOTES_BACKGROUND );

View File

@ -198,12 +198,11 @@ set( EESCHEMA_SRCS
sch_bus_entry.cpp sch_bus_entry.cpp
ee_collectors.cpp ee_collectors.cpp
sch_connection.cpp sch_connection.cpp
sch_plugins/eagle/sch_eagle_plugin.cpp
sch_field.cpp sch_field.cpp
sch_io_mgr.cpp sch_io_mgr.cpp
sch_item.cpp sch_item.cpp
sch_junction.cpp sch_junction.cpp
sch_plugins/legacy/sch_legacy_plugin.cpp sch_label.cpp
sch_line.cpp sch_line.cpp
sch_marker.cpp sch_marker.cpp
sch_no_connect.cpp sch_no_connect.cpp
@ -211,8 +210,6 @@ set( EESCHEMA_SRCS
sch_plugin.cpp sch_plugin.cpp
sch_preview_panel.cpp sch_preview_panel.cpp
sch_screen.cpp sch_screen.cpp
sch_plugins/kicad/sch_sexpr_parser.cpp
sch_plugins/kicad/sch_sexpr_plugin.cpp
sch_shape.cpp sch_shape.cpp
sch_sheet.cpp sch_sheet.cpp
sch_sheet_path.cpp sch_sheet_path.cpp
@ -243,6 +240,11 @@ set( EESCHEMA_SRCS
netlist_exporters/netlist_exporter_pspice.cpp netlist_exporters/netlist_exporter_pspice.cpp
netlist_exporters/netlist_generator.cpp netlist_exporters/netlist_generator.cpp
sch_plugins/eagle/sch_eagle_plugin.cpp
sch_plugins/kicad/sch_sexpr_parser.cpp
sch_plugins/kicad/sch_sexpr_plugin.cpp
sch_plugins/legacy/sch_legacy_plugin.cpp
# Simulator settings must get built even when the simulator build option is disabled. # Simulator settings must get built even when the simulator build option is disabled.
sim/spice_settings.cpp sim/spice_settings.cpp

View File

@ -283,7 +283,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( const SCH_SHEET_PATH& aS
if( sch_text ) if( sch_text )
{ {
if( m_orientation->GetStringSelection() != INDETERMINATE_ACTION ) if( m_orientation->GetStringSelection() != INDETERMINATE_ACTION )
sch_text->SetLabelSpinStyle( (LABEL_SPIN_STYLE::SPIN) m_orientation->GetSelection() ); sch_text->SetTextSpinStyle( (TEXT_SPIN_STYLE::SPIN) m_orientation->GetSelection() );
} }
if( aItem->HasLineStroke() ) if( aItem->HasLineStroke() )

View File

@ -40,6 +40,7 @@
#include <project/net_settings.h> #include <project/net_settings.h>
#include <project/project_file.h> #include <project/project_file.h>
#include <kiface_base.h> #include <kiface_base.h>
#include <sch_label.h>
class SCH_EDIT_FRAME; class SCH_EDIT_FRAME;
@ -82,7 +83,7 @@ DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_L
m_valueSingleLine->SetValidator( m_netNameValidator ); m_valueSingleLine->SetValidator( m_netNameValidator );
} }
else if( m_currentLabel->Type() == SCH_NETCLASS_FLAG_T ) else if( m_currentLabel->Type() == SCH_DIRECTIVE_LABEL_T )
{ {
SetInitialFocus( m_grid ); SetInitialFocus( m_grid );
m_delayedFocusRow = 0; m_delayedFocusRow = 0;
@ -98,12 +99,12 @@ DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_L
switch( m_currentLabel->Type() ) switch( m_currentLabel->Type() )
{ {
case SCH_GLOBAL_LABEL_T: SetTitle( _( "Global Label Properties" ) ); break; case SCH_GLOBAL_LABEL_T: SetTitle( _( "Global Label Properties" ) ); break;
case SCH_HIER_LABEL_T: SetTitle( _( "Hierarchical Label Properties" ) ); break; case SCH_HIER_LABEL_T: SetTitle( _( "Hierarchical Label Properties" ) ); break;
case SCH_LABEL_T: SetTitle( _( "Label Properties" ) ); break; case SCH_LABEL_T: SetTitle( _( "Label Properties" ) ); break;
case SCH_NETCLASS_FLAG_T: SetTitle( _( "Net Class Flag Properties" ) ); break; case SCH_DIRECTIVE_LABEL_T: SetTitle( _( "Directive Label Properties" ) ); break;
case SCH_SHEET_PIN_T: SetTitle( _( "Hierarchical Sheet Pin Properties" ) ); break; case SCH_SHEET_PIN_T: SetTitle( _( "Hierarchical Sheet Pin Properties" ) ); break;
default: UNIMPLEMENTED_FOR( m_currentLabel->GetClass() ); break; default: UNIMPLEMENTED_FOR( m_currentLabel->GetClass() ); break;
} }
// Give a bit more room for combobox editors // Give a bit more room for combobox editors
@ -158,7 +159,7 @@ DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_L
m_spin2->SetBitmap( KiBitmap( BITMAPS::label_align_bottom ) ); m_spin2->SetBitmap( KiBitmap( BITMAPS::label_align_bottom ) );
m_spin3->SetBitmap( KiBitmap( BITMAPS::label_align_top ) ); m_spin3->SetBitmap( KiBitmap( BITMAPS::label_align_top ) );
} }
else if( m_currentLabel->Type() == SCH_NETCLASS_FLAG_T ) else if( m_currentLabel->Type() == SCH_DIRECTIVE_LABEL_T )
{ {
m_input->Hide(); m_input->Hide();
m_output->Hide(); m_output->Hide();
@ -249,9 +250,10 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataToWindow()
m_valueCombo->Append( existingLabelArray ); m_valueCombo->Append( existingLabelArray );
} }
else if( m_currentLabel->Type() == SCH_NETCLASS_FLAG_T ) else if( m_currentLabel->Type() == SCH_DIRECTIVE_LABEL_T )
{ {
// Load the combobox with existing existingNetclassNames // Load the combobox with existing existing netclass names. While it's not the only
// think a directive is used for, it is the most common.
NET_SETTINGS& netSettings = m_Parent->Schematic().Prj().GetProjectFile().NetSettings(); NET_SETTINGS& netSettings = m_Parent->Schematic().Prj().GetProjectFile().NetSettings();
wxArrayString existingNetclassNames; wxArrayString existingNetclassNames;
@ -297,20 +299,20 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataToWindow()
m_fontCtrl->SetFontSelection( m_currentLabel->GetFont() ); m_fontCtrl->SetFontSelection( m_currentLabel->GetFont() );
if( m_currentLabel->Type() == SCH_NETCLASS_FLAG_T ) if( m_currentLabel->Type() == SCH_DIRECTIVE_LABEL_T )
m_textSize.SetValue( static_cast<SCH_NETCLASS_FLAG*>( m_currentLabel )->GetPinLength() ); m_textSize.SetValue( static_cast<SCH_DIRECTIVE_LABEL*>( m_currentLabel )->GetPinLength() );
else else
m_textSize.SetValue( m_currentLabel->GetTextWidth() ); m_textSize.SetValue( m_currentLabel->GetTextWidth() );
m_bold->Check( m_currentLabel->IsBold() ); m_bold->Check( m_currentLabel->IsBold() );
m_italic->Check( m_currentLabel->IsItalic() ); m_italic->Check( m_currentLabel->IsItalic() );
switch( m_currentLabel->GetLabelSpinStyle() ) switch( m_currentLabel->GetTextSpinStyle() )
{ {
case LABEL_SPIN_STYLE::RIGHT: m_spin0->Check( true ); break; case TEXT_SPIN_STYLE::RIGHT: m_spin0->Check( true ); break;
case LABEL_SPIN_STYLE::LEFT: m_spin1->Check( true ); break; case TEXT_SPIN_STYLE::LEFT: m_spin1->Check( true ); break;
case LABEL_SPIN_STYLE::UP: m_spin2->Check( true ); break; case TEXT_SPIN_STYLE::UP: m_spin2->Check( true ); break;
case LABEL_SPIN_STYLE::BOTTOM: m_spin3->Check( true ); break; case TEXT_SPIN_STYLE::BOTTOM: m_spin3->Check( true ); break;
} }
return true; return true;
@ -448,8 +450,8 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataFromWindow()
m_italic->IsChecked() ) ); m_italic->IsChecked() ) );
} }
if( m_currentLabel->Type() == SCH_NETCLASS_FLAG_T ) if( m_currentLabel->Type() == SCH_DIRECTIVE_LABEL_T )
static_cast<SCH_NETCLASS_FLAG*>( m_currentLabel )->SetPinLength( m_textSize.GetValue() ); static_cast<SCH_DIRECTIVE_LABEL*>( m_currentLabel )->SetPinLength( m_textSize.GetValue() );
else if( m_currentLabel->GetTextWidth() != m_textSize.GetValue() ) else if( m_currentLabel->GetTextWidth() != m_textSize.GetValue() )
m_currentLabel->SetTextSize( wxSize( m_textSize.GetValue(), m_textSize.GetValue() ) ); m_currentLabel->SetTextSize( wxSize( m_textSize.GetValue(), m_textSize.GetValue() ) );
@ -469,19 +471,19 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataFromWindow()
m_currentLabel->SetItalic( m_italic->IsChecked() ); m_currentLabel->SetItalic( m_italic->IsChecked() );
LABEL_SPIN_STYLE selectedSpinStyle= LABEL_SPIN_STYLE::LEFT; TEXT_SPIN_STYLE selectedSpinStyle= TEXT_SPIN_STYLE::LEFT;
if( m_spin0->IsChecked() ) if( m_spin0->IsChecked() )
selectedSpinStyle = LABEL_SPIN_STYLE::RIGHT; selectedSpinStyle = TEXT_SPIN_STYLE::RIGHT;
else if( m_spin1->IsChecked() ) else if( m_spin1->IsChecked() )
selectedSpinStyle = LABEL_SPIN_STYLE::LEFT; selectedSpinStyle = TEXT_SPIN_STYLE::LEFT;
else if( m_spin2->IsChecked() ) else if( m_spin2->IsChecked() )
selectedSpinStyle = LABEL_SPIN_STYLE::UP; selectedSpinStyle = TEXT_SPIN_STYLE::UP;
else if( m_spin3->IsChecked() ) else if( m_spin3->IsChecked() )
selectedSpinStyle = LABEL_SPIN_STYLE::BOTTOM; selectedSpinStyle = TEXT_SPIN_STYLE::BOTTOM;
if( m_currentLabel->GetLabelSpinStyle() != selectedSpinStyle ) if( m_currentLabel->GetTextSpinStyle() != selectedSpinStyle )
m_currentLabel->SetLabelSpinStyle( selectedSpinStyle ); m_currentLabel->SetTextSpinStyle( selectedSpinStyle );
if( doAutoplace ) if( doAutoplace )
m_currentLabel->AutoAutoplaceFields( m_Parent->GetScreen() ); m_currentLabel->AutoAutoplaceFields( m_Parent->GetScreen() );

View File

@ -121,12 +121,12 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
m_bold->Check( m_currentText->IsBold() ); m_bold->Check( m_currentText->IsBold() );
m_italic->Check( m_currentText->IsItalic() ); m_italic->Check( m_currentText->IsItalic() );
switch( m_currentText->GetLabelSpinStyle() ) switch( m_currentText->GetTextSpinStyle() )
{ {
case LABEL_SPIN_STYLE::RIGHT: m_spin0->Check( true ); break; case TEXT_SPIN_STYLE::RIGHT: m_spin0->Check( true ); break;
case LABEL_SPIN_STYLE::LEFT: m_spin1->Check( true ); break; case TEXT_SPIN_STYLE::LEFT: m_spin1->Check( true ); break;
case LABEL_SPIN_STYLE::UP: m_spin2->Check( true ); break; case TEXT_SPIN_STYLE::UP: m_spin2->Check( true ); break;
case LABEL_SPIN_STYLE::BOTTOM: m_spin3->Check( true ); break; case TEXT_SPIN_STYLE::BOTTOM: m_spin3->Check( true ); break;
} }
return true; return true;
@ -267,19 +267,19 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
m_currentText->SetItalic( m_italic->IsChecked() ); m_currentText->SetItalic( m_italic->IsChecked() );
LABEL_SPIN_STYLE selectedSpinStyle= LABEL_SPIN_STYLE::LEFT; TEXT_SPIN_STYLE selectedSpinStyle= TEXT_SPIN_STYLE::LEFT;
if( m_spin0->IsChecked() ) if( m_spin0->IsChecked() )
selectedSpinStyle = LABEL_SPIN_STYLE::RIGHT; selectedSpinStyle = TEXT_SPIN_STYLE::RIGHT;
else if( m_spin1->IsChecked() ) else if( m_spin1->IsChecked() )
selectedSpinStyle = LABEL_SPIN_STYLE::LEFT; selectedSpinStyle = TEXT_SPIN_STYLE::LEFT;
else if( m_spin2->IsChecked() ) else if( m_spin2->IsChecked() )
selectedSpinStyle = LABEL_SPIN_STYLE::UP; selectedSpinStyle = TEXT_SPIN_STYLE::UP;
else if( m_spin3->IsChecked() ) else if( m_spin3->IsChecked() )
selectedSpinStyle = LABEL_SPIN_STYLE::BOTTOM; selectedSpinStyle = TEXT_SPIN_STYLE::BOTTOM;
if( m_currentText->GetLabelSpinStyle() != selectedSpinStyle ) if( m_currentText->GetTextSpinStyle() != selectedSpinStyle )
m_currentText->SetLabelSpinStyle( selectedSpinStyle ); m_currentText->SetTextSpinStyle( selectedSpinStyle );
m_frame->UpdateItem( m_currentText, false, true ); m_frame->UpdateItem( m_currentText, false, true );
m_frame->GetCanvas()->Refresh(); m_frame->GetCanvas()->Refresh();

View File

@ -317,26 +317,26 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
addItem( e2 ); addItem( e2 );
SCH_TEXT* t1 = new SCH_TEXT( MILS_POINT( 2850, 2250 ), wxT( "PLAIN TEXT" ) ); SCH_TEXT* t1 = new SCH_TEXT( MILS_POINT( 2850, 2250 ), wxT( "PLAIN TEXT" ) );
t1->SetLabelSpinStyle( LABEL_SPIN_STYLE::SPIN::LEFT ); t1->SetTextSpinStyle( TEXT_SPIN_STYLE::SPIN::LEFT );
addItem( t1 ); addItem( t1 );
SCH_LABEL* t2 = new SCH_LABEL( MILS_POINT( 1975, 1500 ), wxT( "LABEL_{0}" ) ); SCH_LABEL* t2 = new SCH_LABEL( MILS_POINT( 1975, 1500 ), wxT( "LABEL_{0}" ) );
t2->SetLabelSpinStyle( LABEL_SPIN_STYLE::SPIN::RIGHT ); t2->SetTextSpinStyle( TEXT_SPIN_STYLE::SPIN::RIGHT );
t2->SetIsDangling( false ); t2->SetIsDangling( false );
addItem( t2 ); addItem( t2 );
SCH_LABEL* t3 = new SCH_LABEL( MILS_POINT( 1975, 2600 ), wxT( "LABEL_{1}" ) ); SCH_LABEL* t3 = new SCH_LABEL( MILS_POINT( 1975, 2600 ), wxT( "LABEL_{1}" ) );
t3->SetLabelSpinStyle( LABEL_SPIN_STYLE::SPIN::RIGHT ); t3->SetTextSpinStyle( TEXT_SPIN_STYLE::SPIN::RIGHT );
t3->SetIsDangling( false ); t3->SetIsDangling( false );
addItem( t3 ); addItem( t3 );
SCH_GLOBALLABEL* t4 = new SCH_GLOBALLABEL( MILS_POINT( 1750, 1400 ), wxT( "GLOBAL[0..3]" ) ); SCH_GLOBALLABEL* t4 = new SCH_GLOBALLABEL( MILS_POINT( 1750, 1400 ), wxT( "GLOBAL[0..3]" ) );
t4->SetLabelSpinStyle( LABEL_SPIN_STYLE::SPIN::LEFT ); t4->SetTextSpinStyle( TEXT_SPIN_STYLE::SPIN::LEFT );
t4->SetIsDangling( false ); t4->SetIsDangling( false );
addItem( t4 ); addItem( t4 );
SCH_HIERLABEL* t5 = new SCH_HIERLABEL( MILS_POINT( 3250, 1600 ), wxT( "HIER_LABEL" ) ); SCH_HIERLABEL* t5 = new SCH_HIERLABEL( MILS_POINT( 3250, 1600 ), wxT( "HIER_LABEL" ) );
t5->SetLabelSpinStyle( LABEL_SPIN_STYLE::SPIN::RIGHT ); t5->SetTextSpinStyle( TEXT_SPIN_STYLE::SPIN::RIGHT );
t5->SetIsDangling( false ); t5->SetIsDangling( false );
addItem( t5 ); addItem( t5 );

View File

@ -48,7 +48,7 @@ const KICAD_T EE_COLLECTOR::EditableItems[] = {
SCH_LABEL_T, SCH_LABEL_T,
SCH_GLOBAL_LABEL_T, SCH_GLOBAL_LABEL_T,
SCH_HIER_LABEL_T, SCH_HIER_LABEL_T,
SCH_NETCLASS_FLAG_T, SCH_DIRECTIVE_LABEL_T,
SCH_FIELD_T, SCH_FIELD_T,
SCH_SYMBOL_T, SCH_SYMBOL_T,
SCH_SHEET_PIN_T, SCH_SHEET_PIN_T,
@ -87,7 +87,7 @@ const KICAD_T EE_COLLECTOR::MovableItems[] =
SCH_LABEL_T, SCH_LABEL_T,
SCH_GLOBAL_LABEL_T, SCH_GLOBAL_LABEL_T,
SCH_HIER_LABEL_T, SCH_HIER_LABEL_T,
SCH_NETCLASS_FLAG_T, SCH_DIRECTIVE_LABEL_T,
SCH_FIELD_T, SCH_FIELD_T,
SCH_SYMBOL_T, SCH_SYMBOL_T,
SCH_SHEET_PIN_T, SCH_SHEET_PIN_T,
@ -108,7 +108,7 @@ const KICAD_T EE_COLLECTOR::FieldOwners[] = {
SCH_LABEL_T, SCH_LABEL_T,
SCH_GLOBAL_LABEL_T, SCH_GLOBAL_LABEL_T,
SCH_HIER_LABEL_T, SCH_HIER_LABEL_T,
SCH_NETCLASS_FLAG_T, SCH_DIRECTIVE_LABEL_T,
EOT EOT
}; };

View File

@ -27,7 +27,7 @@
#include <fields_grid_table.h> #include <fields_grid_table.h>
#include <sch_base_frame.h> #include <sch_base_frame.h>
#include <sch_field.h> #include <sch_field.h>
#include <sch_text.h> #include <sch_label.h>
#include <sch_validators.h> #include <sch_validators.h>
#include <validators.h> #include <validators.h>
#include <sch_edit_frame.h> #include <sch_edit_frame.h>

View File

@ -321,7 +321,7 @@ void SCH_BASE_FRAME::UpdateItem( EDA_ITEM* aItem, bool isAddOrDelete, bool aUpda
SCH_LABEL_T, SCH_LABEL_T,
SCH_GLOBAL_LABEL_T, SCH_GLOBAL_LABEL_T,
SCH_HIER_LABEL_T, SCH_HIER_LABEL_T,
SCH_NETCLASS_FLAG_T, SCH_DIRECTIVE_LABEL_T,
EOT }; EOT };
if( parent && parent->IsType( parentTypes ) ) if( parent && parent->IsType( parentTypes ) )

View File

@ -31,7 +31,7 @@
#include <sch_edit_frame.h> #include <sch_edit_frame.h>
#include <sch_junction.h> #include <sch_junction.h>
#include <sch_line.h> #include <sch_line.h>
#include <sch_text.h> #include <sch_label.h>
#include <project/net_settings.h> #include <project/net_settings.h>
#include <project/project_file.h> #include <project/project_file.h>
#include <settings/color_settings.h> #include <settings/color_settings.h>

View File

@ -44,6 +44,7 @@
#include <symbol_library.h> #include <symbol_library.h>
#include <sch_symbol.h> #include <sch_symbol.h>
#include <sch_field.h> #include <sch_field.h>
#include <sch_label.h>
#include <schematic.h> #include <schematic.h>
#include <settings/color_settings.h> #include <settings/color_settings.h>
#include <string_utils.h> #include <string_utils.h>

View File

@ -72,4 +72,5 @@
//#define SEXPR_SCHEMATIC_FILE_VERSION 20220101 // Circles, arcs, rects, polys & beziers //#define SEXPR_SCHEMATIC_FILE_VERSION 20220101 // Circles, arcs, rects, polys & beziers
//#define SEXPR_SCHEMATIC_FILE_VERSION 20220102 // Dash-dot-dot //#define SEXPR_SCHEMATIC_FILE_VERSION 20220102 // Dash-dot-dot
//#define SEXPR_SCHEMATIC_FILE_VERSION 20220103 // Label fields //#define SEXPR_SCHEMATIC_FILE_VERSION 20220103 // Label fields
#define SEXPR_SCHEMATIC_FILE_VERSION 20220104 // Fonts //#define SEXPR_SCHEMATIC_FILE_VERSION 20220104 // Fonts
#define SEXPR_SCHEMATIC_FILE_VERSION 20220124 // netclass_flag -> directive_label

1481
eeschema/sch_label.cpp Normal file

File diff suppressed because it is too large Load Diff

384
eeschema/sch_label.h Normal file
View File

@ -0,0 +1,384 @@
/*
* 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
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.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
*/
#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
extern const char* SheetLabelType[]; /* names of types of labels */
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 );
// Abstract class
virtual wxString GetClass() const override = 0;
bool IsType( const KICAD_T aScanTypes[] ) const override;
void SwapData( SCH_ITEM* aItem ) override;
LABEL_FLAG_SHAPE GetShape() const override { return m_shape; }
void SetShape( LABEL_FLAG_SHAPE aShape ) override { m_shape = aShape; }
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
}
/**
* 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 );
void Move( const VECTOR2I& aMoveVector ) override
{
SCH_TEXT::Move( aMoveVector );
for( SCH_FIELD& field : m_fields )
field.Offset( aMoveVector );
}
void Rotate( const VECTOR2I& aCenter ) override;
void Rotate90( bool aClockwise ) override;
void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
virtual bool ResolveTextVar( wxString* token, int aDepth ) const;
wxString GetShownText( int aDepth = 0 ) const override;
void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
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.
*/
virtual const EDA_RECT GetBodyBoundingBox() const;
/**
* Return the bounding box of the label including its fields.
*/
const EDA_RECT GetBoundingBox() const override;
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
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;
void Plot( PLOTTER* aPlotter ) const override;
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& offset ) override;
protected:
std::vector<SCH_FIELD> m_fields;
LABEL_FLAG_SHAPE m_shape;
CONNECTION_TYPE m_connectionType;
bool m_isDangling;
};
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" );
}
const EDA_RECT GetBodyBoundingBox() const override;
bool IsConnectable() const override { return true; }
bool CanConnect( const SCH_ITEM* aItem ) const override
{
return aItem->Type() == SCH_LINE_T &&
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
}
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
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;
}
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 );
}
int GetPinLength() const { return m_pinLength; }
void SetPinLength( int aLength ) { m_pinLength = aLength; }
void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
const VECTOR2I& aPos ) const override;
void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
bool IsConnectable() const override { return true; }
bool CanConnect( const SCH_ITEM* aItem ) const override
{
return aItem->Type() == SCH_LINE_T &&
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
}
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; }
void MirrorSpinStyle( bool aLeftRight ) override;
void MirrorHorizontally( int aCenter ) override;
void MirrorVertically( int aCenter ) override;
void SetTextSpinStyle( TEXT_SPIN_STYLE aSpinStyle ) override;
VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
void CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings, std::vector<VECTOR2I>& aPoints,
const VECTOR2I& aPos ) const override;
bool ResolveTextVar( wxString* token, int aDepth ) const override;
bool IsConnectable() const override { return true; }
bool CanConnect( const SCH_ITEM* aItem ) const override
{
return aItem->Type() == SCH_LINE_T &&
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
}
void ViewGetLayers( int aLayers[], int& aCount ) const override;
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
BITMAPS GetMenuImage() const override;
bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
{
return m_isDangling && GetPosition() == aPos;
}
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" );
}
void SetTextSpinStyle( TEXT_SPIN_STYLE aSpinStyle ) override;
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;
const EDA_RECT GetBodyBoundingBox() const override;
bool IsConnectable() const override { return true; }
bool CanConnect( const SCH_ITEM* aItem ) const override
{
return aItem->Type() == SCH_LINE_T &&
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
}
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
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;
}
private:
bool doIsConnected( const VECTOR2I& aPosition ) const override
{
return EDA_TEXT::GetTextPos() == aPosition;
}
};
#endif /* SCH_LABEL_H */

View File

@ -668,7 +668,7 @@ bool SCH_LINE::CanConnect( const SCH_ITEM* aItem ) const
case SCH_LABEL_T: case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T: case SCH_HIER_LABEL_T:
case SCH_NETCLASS_FLAG_T: case SCH_DIRECTIVE_LABEL_T:
case SCH_BUS_WIRE_ENTRY_T: case SCH_BUS_WIRE_ENTRY_T:
case SCH_SYMBOL_T: case SCH_SYMBOL_T:
case SCH_SHEET_T: case SCH_SHEET_T:
@ -686,7 +686,7 @@ bool SCH_LINE::CanConnect( const SCH_ITEM* aItem ) const
case SCH_LABEL_T: case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T: case SCH_HIER_LABEL_T:
case SCH_NETCLASS_FLAG_T: case SCH_DIRECTIVE_LABEL_T:
case SCH_BUS_WIRE_ENTRY_T: case SCH_BUS_WIRE_ENTRY_T:
case SCH_SHEET_T: case SCH_SHEET_T:
case SCH_SHEET_PIN_T: case SCH_SHEET_PIN_T:

View File

@ -225,7 +225,7 @@ bool SCH_PAINTER::Draw( const VIEW_ITEM *aItem, int aLayer )
HANDLE_ITEM( SCH_SHAPE_T, SCH_SHAPE ); HANDLE_ITEM( SCH_SHAPE_T, SCH_SHAPE );
HANDLE_ITEM( SCH_TEXT_T, SCH_TEXT ); HANDLE_ITEM( SCH_TEXT_T, SCH_TEXT );
HANDLE_ITEM( SCH_LABEL_T, SCH_LABEL ); HANDLE_ITEM( SCH_LABEL_T, SCH_LABEL );
HANDLE_ITEM( SCH_NETCLASS_FLAG_T, SCH_NETCLASS_FLAG ); HANDLE_ITEM( SCH_DIRECTIVE_LABEL_T, SCH_DIRECTIVE_LABEL );
HANDLE_ITEM( SCH_FIELD_T, SCH_FIELD ); HANDLE_ITEM( SCH_FIELD_T, SCH_FIELD );
HANDLE_ITEM( SCH_HIER_LABEL_T, SCH_HIERLABEL ); HANDLE_ITEM( SCH_HIER_LABEL_T, SCH_HIERLABEL );
HANDLE_ITEM( SCH_GLOBAL_LABEL_T, SCH_GLOBALLABEL ); HANDLE_ITEM( SCH_GLOBAL_LABEL_T, SCH_GLOBALLABEL );
@ -1473,12 +1473,12 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer )
switch( aText->Type() ) switch( aText->Type() )
{ {
case SCH_SHEET_PIN_T: aLayer = LAYER_SHEETLABEL; break; case SCH_SHEET_PIN_T: aLayer = LAYER_SHEETLABEL; break;
case SCH_HIER_LABEL_T: aLayer = LAYER_HIERLABEL; break; case SCH_HIER_LABEL_T: aLayer = LAYER_HIERLABEL; break;
case SCH_GLOBAL_LABEL_T: aLayer = LAYER_GLOBLABEL; break; case SCH_GLOBAL_LABEL_T: aLayer = LAYER_GLOBLABEL; break;
case SCH_NETCLASS_FLAG_T: aLayer = LAYER_NETCLASS_REFS; break; case SCH_DIRECTIVE_LABEL_T: aLayer = LAYER_NETCLASS_REFS; break;
case SCH_LABEL_T: aLayer = LAYER_LOCLABEL; break; case SCH_LABEL_T: aLayer = LAYER_LOCLABEL; break;
default: aLayer = LAYER_NOTES; break; default: aLayer = LAYER_NOTES; break;
} }
COLOR4D color = getRenderColor( aText, aLayer, drawingShadows ); COLOR4D color = getRenderColor( aText, aLayer, drawingShadows );
@ -1892,7 +1892,7 @@ void SCH_PAINTER::draw( const SCH_HIERLABEL *aLabel, int aLayer )
} }
void SCH_PAINTER::draw( const SCH_NETCLASS_FLAG *aLabel, int aLayer ) void SCH_PAINTER::draw( const SCH_DIRECTIVE_LABEL *aLabel, int aLayer )
{ {
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS; bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;

View File

@ -44,7 +44,7 @@ class SCH_JUNCTION;
class SCH_LABEL; class SCH_LABEL;
class SCH_TEXT; class SCH_TEXT;
class SCH_HIERLABEL; class SCH_HIERLABEL;
class SCH_NETCLASS_FLAG; class SCH_DIRECTIVE_LABEL;
class SCH_GLOBALLABEL; class SCH_GLOBALLABEL;
class SCH_SHEET; class SCH_SHEET;
class SCH_SHEET_PIN; class SCH_SHEET_PIN;
@ -161,7 +161,7 @@ private:
void draw( const SCH_SHAPE* shape, int aLayer ); void draw( const SCH_SHAPE* shape, int aLayer );
void draw( const SCH_TEXT* aText, int aLayer ); void draw( const SCH_TEXT* aText, int aLayer );
void draw( const SCH_LABEL* aText, int aLayer ); void draw( const SCH_LABEL* aText, int aLayer );
void draw( const SCH_NETCLASS_FLAG* aLabel, int aLayer ); void draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer );
void draw( const SCH_HIERLABEL* aLabel, int aLayer ); void draw( const SCH_HIERLABEL* aLabel, int aLayer );
void draw( const SCH_GLOBALLABEL* aLabel, int aLayer ); void draw( const SCH_GLOBALLABEL* aLabel, int aLayer );
void draw( const SCH_SHEET* aSheet, int aLayer ); void draw( const SCH_SHEET* aSheet, int aLayer );

View File

@ -45,9 +45,9 @@
#include <sch_line.h> #include <sch_line.h>
#include <sch_no_connect.h> #include <sch_no_connect.h>
#include <sch_screen.h> #include <sch_screen.h>
#include <sch_label.h>
#include <sch_sheet.h> #include <sch_sheet.h>
#include <sch_sheet_pin.h> #include <sch_sheet_pin.h>
#include <sch_text.h>
#include <bezier_curves.h> #include <bezier_curves.h>
#include <compoundfilereader.h> #include <compoundfilereader.h>
@ -920,14 +920,14 @@ void SCH_ALTIUM_PLUGIN::ParseTextFrame( const std::map<wxString, wxString>& aPro
{ {
default: default:
case ASCH_TEXT_FRAME_ALIGNMENT::LEFT: case ASCH_TEXT_FRAME_ALIGNMENT::LEFT:
text->SetLabelSpinStyle( LABEL_SPIN_STYLE::SPIN::RIGHT ); text->SetTextSpinStyle( TEXT_SPIN_STYLE::SPIN::RIGHT );
break; break;
case ASCH_TEXT_FRAME_ALIGNMENT::CENTER: case ASCH_TEXT_FRAME_ALIGNMENT::CENTER:
// No support for centered text in Eeschema yet... // No support for centered text in Eeschema yet...
text->SetLabelSpinStyle( LABEL_SPIN_STYLE::SPIN::RIGHT ); text->SetTextSpinStyle( TEXT_SPIN_STYLE::SPIN::RIGHT );
break; break;
case ASCH_TEXT_FRAME_ALIGNMENT::RIGHT: case ASCH_TEXT_FRAME_ALIGNMENT::RIGHT:
text->SetLabelSpinStyle( LABEL_SPIN_STYLE::SPIN::LEFT ); text->SetTextSpinStyle( TEXT_SPIN_STYLE::SPIN::LEFT );
break; break;
} }
@ -960,14 +960,14 @@ void SCH_ALTIUM_PLUGIN::ParseNote( const std::map<wxString, wxString>& aProperti
{ {
default: default:
case ASCH_TEXT_FRAME_ALIGNMENT::LEFT: case ASCH_TEXT_FRAME_ALIGNMENT::LEFT:
text->SetLabelSpinStyle( LABEL_SPIN_STYLE::SPIN::RIGHT ); text->SetTextSpinStyle( TEXT_SPIN_STYLE::SPIN::RIGHT );
break; break;
case ASCH_TEXT_FRAME_ALIGNMENT::CENTER: case ASCH_TEXT_FRAME_ALIGNMENT::CENTER:
// No support for centered text in Eeschema yet... // No support for centered text in Eeschema yet...
text->SetLabelSpinStyle( LABEL_SPIN_STYLE::SPIN::RIGHT ); text->SetTextSpinStyle( TEXT_SPIN_STYLE::SPIN::RIGHT );
break; break;
case ASCH_TEXT_FRAME_ALIGNMENT::RIGHT: case ASCH_TEXT_FRAME_ALIGNMENT::RIGHT:
text->SetLabelSpinStyle( LABEL_SPIN_STYLE::SPIN::LEFT ); text->SetTextSpinStyle( TEXT_SPIN_STYLE::SPIN::LEFT );
break; break;
} }
@ -1502,7 +1502,7 @@ void SCH_ALTIUM_PLUGIN::ParseSheetEntry( const std::map<wxString, wxString>& aPr
sheetPin->SetText( elem.name ); sheetPin->SetText( elem.name );
sheetPin->SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED ); sheetPin->SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED );
//sheetPin->SetLabelSpinStyle( getSpinStyle( term.OrientAngle, false ) ); //sheetPin->SetTextSpinStyle( getSpinStyle( term.OrientAngle, false ) );
//sheetPin->SetPosition( getKiCadPoint( term.Position ) ); //sheetPin->SetPosition( getKiCadPoint( term.Position ) );
VECTOR2I pos = sheetIt->second->GetPosition(); VECTOR2I pos = sheetIt->second->GetPosition();
@ -1513,22 +1513,22 @@ void SCH_ALTIUM_PLUGIN::ParseSheetEntry( const std::map<wxString, wxString>& aPr
default: default:
case ASCH_SHEET_ENTRY_SIDE::LEFT: case ASCH_SHEET_ENTRY_SIDE::LEFT:
sheetPin->SetPosition( { pos.x, pos.y + elem.distanceFromTop } ); sheetPin->SetPosition( { pos.x, pos.y + elem.distanceFromTop } );
sheetPin->SetLabelSpinStyle( LABEL_SPIN_STYLE::LEFT ); sheetPin->SetTextSpinStyle( TEXT_SPIN_STYLE::LEFT );
sheetPin->SetSide( SHEET_SIDE::LEFT ); sheetPin->SetSide( SHEET_SIDE::LEFT );
break; break;
case ASCH_SHEET_ENTRY_SIDE::RIGHT: case ASCH_SHEET_ENTRY_SIDE::RIGHT:
sheetPin->SetPosition( { pos.x + size.x, pos.y + elem.distanceFromTop } ); sheetPin->SetPosition( { pos.x + size.x, pos.y + elem.distanceFromTop } );
sheetPin->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT ); sheetPin->SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT );
sheetPin->SetSide( SHEET_SIDE::RIGHT ); sheetPin->SetSide( SHEET_SIDE::RIGHT );
break; break;
case ASCH_SHEET_ENTRY_SIDE::TOP: case ASCH_SHEET_ENTRY_SIDE::TOP:
sheetPin->SetPosition( { pos.x + elem.distanceFromTop, pos.y } ); sheetPin->SetPosition( { pos.x + elem.distanceFromTop, pos.y } );
sheetPin->SetLabelSpinStyle( LABEL_SPIN_STYLE::UP ); sheetPin->SetTextSpinStyle( TEXT_SPIN_STYLE::UP );
sheetPin->SetSide( SHEET_SIDE::TOP ); sheetPin->SetSide( SHEET_SIDE::TOP );
break; break;
case ASCH_SHEET_ENTRY_SIDE::BOTTOM: case ASCH_SHEET_ENTRY_SIDE::BOTTOM:
sheetPin->SetPosition( { pos.x + elem.distanceFromTop, pos.y + size.y } ); sheetPin->SetPosition( { pos.x + elem.distanceFromTop, pos.y + size.y } );
sheetPin->SetLabelSpinStyle( LABEL_SPIN_STYLE::BOTTOM ); sheetPin->SetTextSpinStyle( TEXT_SPIN_STYLE::BOTTOM );
sheetPin->SetSide( SHEET_SIDE::BOTTOM ); sheetPin->SetSide( SHEET_SIDE::BOTTOM );
break; break;
} }
@ -1900,17 +1900,18 @@ void SCH_ALTIUM_PLUGIN::ParsePort( const ASCH_PORT& aElem )
} }
// Select label position. In case both match, we will add a line later. // Select label position. In case both match, we will add a line later.
VECTOR2I position = ( startIsWireTerminal || startIsBusTerminal ) ? start : end; VECTOR2I position = ( startIsWireTerminal || startIsBusTerminal ) ? start : end;
SCH_TEXT* label; SCH_LABEL_BASE* label;
if( isHarness ) if( isHarness )
{ {
wxString name = wxT( "HARNESS: " ) + aElem.name; label = new SCH_DIRECTIVE_LABEL( position );
if( aElem.harnessType != aElem.name ) std::vector<SCH_FIELD>& fields = label->GetFields();
name += wxString::Format( wxT( " (%s)" ), aElem.harnessType );
label = new SCH_TEXT( position, name ); fields.emplace_back( SCH_FIELD( { 0, 0 }, 0, label, wxT( "Harness" ) ) );
fields[0].SetText( aElem.harnessType );
fields[0].SetVisible( true );
} }
// TODO: detect correct label type depending on sheet settings, etc. // TODO: detect correct label type depending on sheet settings, etc.
//{ //{
@ -1947,18 +1948,18 @@ void SCH_ALTIUM_PLUGIN::ParsePort( const ASCH_PORT& aElem )
case ASCH_PORT_STYLE::RIGHT: case ASCH_PORT_STYLE::RIGHT:
case ASCH_PORT_STYLE::LEFT_RIGHT: case ASCH_PORT_STYLE::LEFT_RIGHT:
if( ( startIsWireTerminal || startIsBusTerminal ) ) if( ( startIsWireTerminal || startIsBusTerminal ) )
label->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT ); label->SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT );
else else
label->SetLabelSpinStyle( LABEL_SPIN_STYLE::LEFT ); label->SetTextSpinStyle( TEXT_SPIN_STYLE::LEFT );
break; break;
case ASCH_PORT_STYLE::NONE_VERTICAL: case ASCH_PORT_STYLE::NONE_VERTICAL:
case ASCH_PORT_STYLE::TOP: case ASCH_PORT_STYLE::TOP:
case ASCH_PORT_STYLE::BOTTOM: case ASCH_PORT_STYLE::BOTTOM:
case ASCH_PORT_STYLE::TOP_BOTTOM: case ASCH_PORT_STYLE::TOP_BOTTOM:
if( ( startIsWireTerminal || startIsBusTerminal ) ) if( ( startIsWireTerminal || startIsBusTerminal ) )
label->SetLabelSpinStyle( LABEL_SPIN_STYLE::UP ); label->SetTextSpinStyle( TEXT_SPIN_STYLE::UP );
else else
label->SetLabelSpinStyle( LABEL_SPIN_STYLE::BOTTOM ); label->SetTextSpinStyle( TEXT_SPIN_STYLE::BOTTOM );
break; break;
} }
@ -2008,16 +2009,16 @@ void SCH_ALTIUM_PLUGIN::ParseNetLabel( const std::map<wxString, wxString>& aProp
switch( elem.orientation ) switch( elem.orientation )
{ {
case ASCH_RECORD_ORIENTATION::RIGHTWARDS: case ASCH_RECORD_ORIENTATION::RIGHTWARDS:
label->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT ); label->SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT );
break; break;
case ASCH_RECORD_ORIENTATION::UPWARDS: case ASCH_RECORD_ORIENTATION::UPWARDS:
label->SetLabelSpinStyle( LABEL_SPIN_STYLE::UP ); label->SetTextSpinStyle( TEXT_SPIN_STYLE::UP );
break; break;
case ASCH_RECORD_ORIENTATION::LEFTWARDS: case ASCH_RECORD_ORIENTATION::LEFTWARDS:
label->SetLabelSpinStyle( LABEL_SPIN_STYLE::LEFT ); label->SetTextSpinStyle( TEXT_SPIN_STYLE::LEFT );
break; break;
case ASCH_RECORD_ORIENTATION::DOWNWARDS: case ASCH_RECORD_ORIENTATION::DOWNWARDS:
label->SetLabelSpinStyle( LABEL_SPIN_STYLE::BOTTOM ); label->SetTextSpinStyle( TEXT_SPIN_STYLE::BOTTOM );
break; break;
default: default:
break; break;

View File

@ -42,7 +42,7 @@
#include <sch_sheet.h> #include <sch_sheet.h>
#include <sch_sheet_path.h> #include <sch_sheet_path.h>
#include <sch_sheet_pin.h> #include <sch_sheet_pin.h>
#include <sch_text.h> #include <sch_label.h>
#include <schematic.h> #include <schematic.h>
#include <trigo.h> #include <trigo.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
@ -347,7 +347,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadHierarchicalSheetPins()
sheetPin->SetText( name ); sheetPin->SetText( name );
sheetPin->SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED ); sheetPin->SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED );
sheetPin->SetLabelSpinStyle( getSpinStyle( term.OrientAngle, false ) ); sheetPin->SetTextSpinStyle( getSpinStyle( term.OrientAngle, false ) );
sheetPin->SetPosition( getKiCadPoint( term.Position ) ); sheetPin->SetPosition( getKiCadPoint( term.Position ) );
if( sheetPin->Type() == SCH_SHEET_PIN_T ) if( sheetPin->Type() == SCH_SHEET_PIN_T )
@ -661,7 +661,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
linkOrigin.Justification ); linkOrigin.Justification );
} }
netLabel->SetLabelSpinStyle( getSpinStyle( sym.OrientAngle, sym.Mirror ) ); netLabel->SetTextSpinStyle( getSpinStyle( sym.OrientAngle, sym.Mirror ) );
if( libSymDef.Alternate.Lower().Contains( "in" ) ) if( libSymDef.Alternate.Lower().Contains( "in" ) )
netLabel->SetShape( LABEL_FLAG_SHAPE::L_INPUT ); netLabel->SetShape( LABEL_FLAG_SHAPE::L_INPUT );
@ -1064,15 +1064,15 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
auto fixNetLabelsAndSheetPins = auto fixNetLabelsAndSheetPins =
[&]( const EDA_ANGLE& aWireAngle, NETELEMENT_ID& aNetEleID ) [&]( const EDA_ANGLE& aWireAngle, NETELEMENT_ID& aNetEleID )
{ {
LABEL_SPIN_STYLE spin = getSpinStyle( aWireAngle ); TEXT_SPIN_STYLE spin = getSpinStyle( aWireAngle );
if( netlabels.find( aNetEleID ) != netlabels.end() ) if( netlabels.find( aNetEleID ) != netlabels.end() )
netlabels.at( aNetEleID )->SetLabelSpinStyle( spin.MirrorY() ); netlabels.at( aNetEleID )->SetTextSpinStyle( spin.MirrorY() );
SCH_HIERLABEL* sheetPin = getHierarchicalLabel( aNetEleID ); SCH_HIERLABEL* sheetPin = getHierarchicalLabel( aNetEleID );
if( sheetPin ) if( sheetPin )
sheetPin->SetLabelSpinStyle( spin.MirrorX() ); sheetPin->SetTextSpinStyle( spin.MirrorX() );
}; };
// Now we can load the wires and fix the label orientations // Now we can load the wires and fix the label orientations
@ -1135,8 +1135,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadNets()
label->SetVisible( true ); label->SetVisible( true );
EDA_ANGLE labelAngle = getAngle( junc.NetLabel.OrientAngle ); EDA_ANGLE labelAngle = getAngle( junc.NetLabel.OrientAngle );
LABEL_SPIN_STYLE spin = getSpinStyle( labelAngle ); TEXT_SPIN_STYLE spin = getSpinStyle( labelAngle );
label->SetLabelSpinStyle( spin ); label->SetTextSpinStyle( spin );
m_sheetMap.at( junc.LayerID )->GetScreen()->Append( label ); m_sheetMap.at( junc.LayerID )->GetScreen()->Append( label );
} }
@ -2514,11 +2514,11 @@ int CADSTAR_SCH_ARCHIVE_LOADER::getKiCadUnitNumberFromGate( const GATE_ID& aCads
} }
LABEL_SPIN_STYLE CADSTAR_SCH_ARCHIVE_LOADER::getSpinStyle( const long long& aCadstarOrientation, TEXT_SPIN_STYLE CADSTAR_SCH_ARCHIVE_LOADER::getSpinStyle( const long long& aCadstarOrientation,
bool aMirror ) bool aMirror )
{ {
EDA_ANGLE orientation = getAngle( aCadstarOrientation ); EDA_ANGLE orientation = getAngle( aCadstarOrientation );
LABEL_SPIN_STYLE spinStyle = getSpinStyle( orientation ); TEXT_SPIN_STYLE spinStyle = getSpinStyle( orientation );
if( aMirror ) if( aMirror )
{ {
@ -2530,21 +2530,21 @@ LABEL_SPIN_STYLE CADSTAR_SCH_ARCHIVE_LOADER::getSpinStyle( const long long& aCad
} }
LABEL_SPIN_STYLE CADSTAR_SCH_ARCHIVE_LOADER::getSpinStyle( const EDA_ANGLE& aOrientation ) TEXT_SPIN_STYLE CADSTAR_SCH_ARCHIVE_LOADER::getSpinStyle( const EDA_ANGLE& aOrientation )
{ {
LABEL_SPIN_STYLE spinStyle = LABEL_SPIN_STYLE::LEFT; TEXT_SPIN_STYLE spinStyle = TEXT_SPIN_STYLE::LEFT;
EDA_ANGLE oDeg = aOrientation; EDA_ANGLE oDeg = aOrientation;
oDeg.Normalize180(); oDeg.Normalize180();
if( oDeg >= -ANGLE_45 && oDeg <= ANGLE_45 ) if( oDeg >= -ANGLE_45 && oDeg <= ANGLE_45 )
spinStyle = LABEL_SPIN_STYLE::RIGHT; // 0deg spinStyle = TEXT_SPIN_STYLE::RIGHT; // 0deg
else if( oDeg >= ANGLE_45 && oDeg <= ANGLE_135 ) else if( oDeg >= ANGLE_45 && oDeg <= ANGLE_135 )
spinStyle = LABEL_SPIN_STYLE::UP; // 90deg spinStyle = TEXT_SPIN_STYLE::UP; // 90deg
else if( oDeg >= ANGLE_135 || oDeg <= -ANGLE_135 ) else if( oDeg >= ANGLE_135 || oDeg <= -ANGLE_135 )
spinStyle = LABEL_SPIN_STYLE::LEFT; // 180deg spinStyle = TEXT_SPIN_STYLE::LEFT; // 180deg
else else
spinStyle = LABEL_SPIN_STYLE::BOTTOM; // 270deg spinStyle = TEXT_SPIN_STYLE::BOTTOM; // 270deg
return spinStyle; return spinStyle;
} }
@ -2694,8 +2694,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings( EDA_TEXT* aKiCadT
} }
}; };
LABEL_SPIN_STYLE spin = getSpinStyle( aCadstarOrientAngle, aMirrored ); TEXT_SPIN_STYLE spin = getSpinStyle( aCadstarOrientAngle, aMirrored );
EDA_ITEM* textEdaItem = dynamic_cast<EDA_ITEM*>( aKiCadTextItem ); EDA_ITEM* textEdaItem = dynamic_cast<EDA_ITEM*>( aKiCadTextItem );
wxCHECK( textEdaItem, /* void */ ); // ensure this is a EDA_ITEM wxCHECK( textEdaItem, /* void */ ); // ensure this is a EDA_ITEM
switch( textEdaItem->Type() ) switch( textEdaItem->Type() )
@ -2752,10 +2752,10 @@ void CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings( EDA_TEXT* aKiCadT
// And correct the error introduced by the text offsetting in KiCad // And correct the error introduced by the text offsetting in KiCad
switch( spin ) switch( spin )
{ {
case LABEL_SPIN_STYLE::BOTTOM: pos = { bb.GetRight() - off, bb.GetTop() }; break; case TEXT_SPIN_STYLE::BOTTOM: pos = { bb.GetRight() - off, bb.GetTop() }; break;
case LABEL_SPIN_STYLE::UP: pos = { bb.GetRight() - off, bb.GetBottom() }; break; case TEXT_SPIN_STYLE::UP: pos = { bb.GetRight() - off, bb.GetBottom() }; break;
case LABEL_SPIN_STYLE::LEFT: pos = { bb.GetRight() , bb.GetBottom() + off }; break; case TEXT_SPIN_STYLE::LEFT: pos = { bb.GetRight() , bb.GetBottom() + off }; break;
case LABEL_SPIN_STYLE::RIGHT: pos = { bb.GetLeft() , bb.GetBottom() + off }; break; case TEXT_SPIN_STYLE::RIGHT: pos = { bb.GetLeft() , bb.GetBottom() + off }; break;
} }
aKiCadTextItem->SetTextPos( pos ); aKiCadTextItem->SetTextPos( pos );
@ -2767,7 +2767,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::applyTextSettings( EDA_TEXT* aKiCadT
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T: case SCH_HIER_LABEL_T:
case SCH_SHEET_PIN_T: case SCH_SHEET_PIN_T:
static_cast<SCH_TEXT*>( aKiCadTextItem )->SetLabelSpinStyle( spin ); static_cast<SCH_TEXT*>( aKiCadTextItem )->SetTextSpinStyle( spin );
return; return;
default: default:

View File

@ -36,7 +36,7 @@
class BUS_ALIAS; class BUS_ALIAS;
class EDA_TEXT; class EDA_TEXT;
class LABEL_SPIN_STYLE; class TEXT_SPIN_STYLE;
class LIB_FIELD; class LIB_FIELD;
class LIB_SYMBOL; class LIB_SYMBOL;
class SCH_SYMBOL; class SCH_SYMBOL;
@ -211,17 +211,17 @@ private:
int getTextHeightFromTextCode( const TEXTCODE_ID& aCadstarTextCodeID ); int getTextHeightFromTextCode( const TEXTCODE_ID& aCadstarTextCodeID );
wxString getAttributeName( const ATTRIBUTE_ID& aCadstarAttributeID ); wxString getAttributeName( const ATTRIBUTE_ID& aCadstarAttributeID );
PART::DEFINITION::PIN getPartDefinitionPin( PART::DEFINITION::PIN getPartDefinitionPin( const PART& aCadstarPart, const GATE_ID& aGateID,
const PART& aCadstarPart, const GATE_ID& aGateID, const TERMINAL_ID& aTerminalID ); const TERMINAL_ID& aTerminalID );
//Helper Functions for obtaining individual elements as KiCad elements: //Helper Functions for obtaining individual elements as KiCad elements:
ELECTRICAL_PINTYPE getKiCadPinType( const PART::PIN_TYPE& aPinType ); ELECTRICAL_PINTYPE getKiCadPinType( const PART::PIN_TYPE& aPinType );
int getKiCadUnitNumberFromGate( const GATE_ID& aCadstarGateID ); int getKiCadUnitNumberFromGate( const GATE_ID& aCadstarGateID );
LABEL_SPIN_STYLE getSpinStyle( const long long& aCadstarOrientation, bool aMirror ); TEXT_SPIN_STYLE getSpinStyle( const long long& aCadstarOrientation, bool aMirror );
LABEL_SPIN_STYLE getSpinStyle( const EDA_ANGLE& aOrientation ); TEXT_SPIN_STYLE getSpinStyle( const EDA_ANGLE& aOrientation );
ALIGNMENT mirrorX( const ALIGNMENT& aCadstarAlignment ); ALIGNMENT mirrorX( const ALIGNMENT& aCadstarAlignment );
ALIGNMENT rotate180( const ALIGNMENT& aCadstarAlignment ); ALIGNMENT rotate180( const ALIGNMENT& aCadstarAlignment );
//General Graphical manipulation functions //General Graphical manipulation functions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017 CERN * Copyright (C) 2017 CERN
* Copyright (C) 2017-2021 Kicad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2017-2022 Kicad Developers, see AUTHORS.txt for contributors.
* *
* @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com> * @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
@ -54,7 +54,7 @@
#include <sch_screen.h> #include <sch_screen.h>
#include <sch_sheet.h> #include <sch_sheet.h>
#include <sch_sheet_path.h> #include <sch_sheet_path.h>
#include <sch_text.h> #include <sch_label.h>
#include <schematic.h> #include <schematic.h>
#include <symbol_lib_table.h> #include <symbol_lib_table.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
@ -1135,9 +1135,9 @@ void SCH_EAGLE_PLUGIN::loadSegments( wxXmlNode* aSegmentsNode, const wxString& n
label->SetTextSize( wxSize( Mils2iu( 40 ), Mils2iu( 40 ) ) ); label->SetTextSize( wxSize( Mils2iu( 40 ), Mils2iu( 40 ) ) );
if( firstWire->GetEndPoint().x > firstWire->GetStartPoint().x ) if( firstWire->GetEndPoint().x > firstWire->GetStartPoint().x )
label->SetLabelSpinStyle( LABEL_SPIN_STYLE::LEFT ); label->SetTextSpinStyle( TEXT_SPIN_STYLE::LEFT );
else else
label->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT ); label->SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT );
screen->Append( label.release() ); screen->Append( label.release() );
} }
@ -1207,7 +1207,7 @@ SCH_TEXT* SCH_EAGLE_PLUGIN::loadLabel( wxXmlNode* aLabelNode, const wxString& aN
label->SetPosition( elabelpos ); label->SetPosition( elabelpos );
label->SetText( escapeName( elabel.netname ) ); label->SetText( escapeName( elabel.netname ) );
label->SetTextSize( textSize ); label->SetTextSize( textSize );
label->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT ); label->SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT );
if( elabel.rot ) if( elabel.rot )
{ {
@ -2963,10 +2963,10 @@ void SCH_EAGLE_PLUGIN::addImplicitConnections( SCH_SYMBOL* aSymbol, SCH_SCREEN*
switch( pin->GetOrientation() ) switch( pin->GetOrientation() )
{ {
case PIN_LEFT: netLabel->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT ); break; case PIN_LEFT: netLabel->SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT ); break;
case PIN_RIGHT: netLabel->SetLabelSpinStyle( LABEL_SPIN_STYLE::LEFT ); break; case PIN_RIGHT: netLabel->SetTextSpinStyle( TEXT_SPIN_STYLE::LEFT ); break;
case PIN_UP: netLabel->SetLabelSpinStyle( LABEL_SPIN_STYLE::UP ); break; case PIN_UP: netLabel->SetTextSpinStyle( TEXT_SPIN_STYLE::UP ); break;
case PIN_DOWN: netLabel->SetLabelSpinStyle( LABEL_SPIN_STYLE::BOTTOM ); break; case PIN_DOWN: netLabel->SetTextSpinStyle( TEXT_SPIN_STYLE::BOTTOM ); break;
} }
aScreen->Append( netLabel ); aScreen->Append( netLabel );

View File

@ -45,6 +45,7 @@
#include <sch_edit_frame.h> // SYM_ORIENT_XXX #include <sch_edit_frame.h> // SYM_ORIENT_XXX
#include <sch_field.h> #include <sch_field.h>
#include <sch_line.h> #include <sch_line.h>
#include <sch_label.h>
#include <sch_junction.h> #include <sch_junction.h>
#include <sch_no_connect.h> #include <sch_no_connect.h>
#include <sch_screen.h> #include <sch_screen.h>
@ -2169,11 +2170,14 @@ void SCH_SEXPR_PARSER::ParseSchematic( SCH_SHEET* aSheet, bool aIsCopyableOnly,
screen->Append( static_cast<SCH_ITEM*>( parseSchBezier() ) ); screen->Append( static_cast<SCH_ITEM*>( parseSchBezier() ) );
break; break;
case T_netclass_flag: // legacy
KI_FALLTHROUGH;
case T_text: case T_text:
case T_label: case T_label:
case T_global_label: case T_global_label:
case T_hierarchical_label: case T_hierarchical_label:
case T_netclass_flag: case T_directive_label:
screen->Append( static_cast<SCH_ITEM*>( parseSchText() ) ); screen->Append( static_cast<SCH_ITEM*>( parseSchText() ) );
break; break;
@ -3105,11 +3109,12 @@ SCH_TEXT* SCH_SEXPR_PARSER::parseSchText()
switch( CurTok() ) switch( CurTok() )
{ {
case T_text: text = std::make_unique<SCH_TEXT>(); break; case T_text: text = std::make_unique<SCH_TEXT>(); break;
case T_label: text = std::make_unique<SCH_LABEL>(); break; case T_label: text = std::make_unique<SCH_LABEL>(); break;
case T_global_label: text = std::make_unique<SCH_GLOBALLABEL>(); break; case T_global_label: text = std::make_unique<SCH_GLOBALLABEL>(); break;
case T_hierarchical_label: text = std::make_unique<SCH_HIERLABEL>(); break; case T_hierarchical_label: text = std::make_unique<SCH_HIERLABEL>(); break;
case T_netclass_flag: text = std::make_unique<SCH_NETCLASS_FLAG>(); break; case T_netclass_flag: text = std::make_unique<SCH_DIRECTIVE_LABEL>(); break;
case T_directive_label: text = std::make_unique<SCH_DIRECTIVE_LABEL>(); break;
default: default:
wxCHECK_MSG( false, nullptr, "Cannot parse " + GetTokenString( CurTok() ) + " as text." ); wxCHECK_MSG( false, nullptr, "Cannot parse " + GetTokenString( CurTok() ) + " as text." );
} }
@ -3139,13 +3144,13 @@ SCH_TEXT* SCH_SEXPR_PARSER::parseSchText()
switch( static_cast<int>( parseDouble( "text angle" ) ) ) switch( static_cast<int>( parseDouble( "text angle" ) ) )
{ {
case 0: text->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT ); break; case 0: text->SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT ); break;
case 90: text->SetLabelSpinStyle( LABEL_SPIN_STYLE::UP ); break; case 90: text->SetTextSpinStyle( TEXT_SPIN_STYLE::UP ); break;
case 180: text->SetLabelSpinStyle( LABEL_SPIN_STYLE::LEFT ); break; case 180: text->SetTextSpinStyle( TEXT_SPIN_STYLE::LEFT ); break;
case 270: text->SetLabelSpinStyle( LABEL_SPIN_STYLE::BOTTOM ); break; case 270: text->SetTextSpinStyle( TEXT_SPIN_STYLE::BOTTOM ); break;
default: default:
wxFAIL; wxFAIL;
text->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT ); text->SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT );
break; break;
} }
@ -3153,22 +3158,25 @@ SCH_TEXT* SCH_SEXPR_PARSER::parseSchText()
break; break;
case T_shape: case T_shape:
{
if( text->Type() == SCH_TEXT_T || text->Type() == SCH_LABEL_T ) if( text->Type() == SCH_TEXT_T || text->Type() == SCH_LABEL_T )
Unexpected( T_shape ); Unexpected( T_shape );
SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( text.get() );
token = NextTok(); token = NextTok();
switch( token ) switch( token )
{ {
case T_input: text->SetShape( LABEL_FLAG_SHAPE::L_INPUT ); break; case T_input: label->SetShape( LABEL_FLAG_SHAPE::L_INPUT ); break;
case T_output: text->SetShape( LABEL_FLAG_SHAPE::L_OUTPUT ); break; case T_output: label->SetShape( LABEL_FLAG_SHAPE::L_OUTPUT ); break;
case T_bidirectional: text->SetShape( LABEL_FLAG_SHAPE::L_BIDI ); break; case T_bidirectional: label->SetShape( LABEL_FLAG_SHAPE::L_BIDI ); break;
case T_tri_state: text->SetShape( LABEL_FLAG_SHAPE::L_TRISTATE ); break; case T_tri_state: label->SetShape( LABEL_FLAG_SHAPE::L_TRISTATE ); break;
case T_passive: text->SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED ); break; case T_passive: label->SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED ); break;
case T_dot: text->SetShape( LABEL_FLAG_SHAPE::F_DOT ); break; case T_dot: label->SetShape( LABEL_FLAG_SHAPE::F_DOT ); break;
case T_round: text->SetShape( LABEL_FLAG_SHAPE::F_ROUND ); break; case T_round: label->SetShape( LABEL_FLAG_SHAPE::F_ROUND ); break;
case T_diamond: text->SetShape( LABEL_FLAG_SHAPE::F_DIAMOND ); break; case T_diamond: label->SetShape( LABEL_FLAG_SHAPE::F_DIAMOND ); break;
case T_rectangle: text->SetShape( LABEL_FLAG_SHAPE::F_RECTANGLE ); break; case T_rectangle: label->SetShape( LABEL_FLAG_SHAPE::F_RECTANGLE ); break;
default: default:
Expecting( "input, output, bidirectional, tri_state, passive, dot, round, diamond" Expecting( "input, output, bidirectional, tri_state, passive, dot, round, diamond"
"or rectangle" ); "or rectangle" );
@ -3176,13 +3184,14 @@ SCH_TEXT* SCH_SEXPR_PARSER::parseSchText()
NeedRIGHT(); NeedRIGHT();
break; break;
}
case T_length: case T_length:
{ {
if( text->Type() != SCH_NETCLASS_FLAG_T ) if( text->Type() != SCH_DIRECTIVE_LABEL_T )
Unexpected( T_length ); Unexpected( T_length );
SCH_NETCLASS_FLAG* label = static_cast<SCH_NETCLASS_FLAG*>( text.get() ); SCH_DIRECTIVE_LABEL* label = static_cast<SCH_DIRECTIVE_LABEL*>( text.get() );
label->SetPinLength( parseInternalUnits( "pin length" ) ); label->SetPinLength( parseInternalUnits( "pin length" ) );
NeedRIGHT(); NeedRIGHT();
@ -3205,14 +3214,14 @@ SCH_TEXT* SCH_SEXPR_PARSER::parseSchText()
{ {
// The vertically aligned text angle is always 90 (labels use 270 for the // The vertically aligned text angle is always 90 (labels use 270 for the
// down direction) combined with the text justification flags. // down direction) combined with the text justification flags.
text->SetLabelSpinStyle( LABEL_SPIN_STYLE::BOTTOM ); text->SetTextSpinStyle( TEXT_SPIN_STYLE::BOTTOM );
} }
else if( text->GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT else if( text->GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT
&& text->GetTextAngle().IsHorizontal() ) && text->GetTextAngle().IsHorizontal() )
{ {
// The horizontally aligned text angle is always 0 (labels use 180 for the // The horizontally aligned text angle is always 0 (labels use 180 for the
// left direction) combined with the text justification flags. // left direction) combined with the text justification flags.
text->SetLabelSpinStyle( LABEL_SPIN_STYLE::LEFT ); text->SetTextSpinStyle( TEXT_SPIN_STYLE::LEFT );
} }
} }

View File

@ -240,12 +240,12 @@ static const char* getTextTypeToken( KICAD_T aType )
{ {
switch( aType ) switch( aType )
{ {
case SCH_TEXT_T: return SCHEMATIC_LEXER::TokenName( T_text ); case SCH_TEXT_T: return SCHEMATIC_LEXER::TokenName( T_text );
case SCH_LABEL_T: return SCHEMATIC_LEXER::TokenName( T_label ); case SCH_LABEL_T: return SCHEMATIC_LEXER::TokenName( T_label );
case SCH_GLOBAL_LABEL_T: return SCHEMATIC_LEXER::TokenName( T_global_label ); case SCH_GLOBAL_LABEL_T: return SCHEMATIC_LEXER::TokenName( T_global_label );
case SCH_HIER_LABEL_T: return SCHEMATIC_LEXER::TokenName( T_hierarchical_label ); case SCH_HIER_LABEL_T: return SCHEMATIC_LEXER::TokenName( T_hierarchical_label );
case SCH_NETCLASS_FLAG_T: return SCHEMATIC_LEXER::TokenName( T_netclass_flag ); case SCH_DIRECTIVE_LABEL_T: return SCHEMATIC_LEXER::TokenName( T_netclass_flag );
default: wxFAIL; return SCHEMATIC_LEXER::TokenName( T_text ); default: wxFAIL; return SCHEMATIC_LEXER::TokenName( T_text );
} }
} }
@ -826,7 +826,7 @@ void SCH_SEXPR_PLUGIN::Format( SCH_SHEET* aSheet )
case SCH_LABEL_T: case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T: case SCH_HIER_LABEL_T:
case SCH_NETCLASS_FLAG_T: case SCH_DIRECTIVE_LABEL_T:
saveText( static_cast<SCH_TEXT*>( item ), 1 ); saveText( static_cast<SCH_TEXT*>( item ), 1 );
break; break;
@ -972,7 +972,7 @@ void SCH_SEXPR_PLUGIN::Format( EE_SELECTION* aSelection, SCH_SHEET_PATH* aSelect
case SCH_LABEL_T: case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T: case SCH_HIER_LABEL_T:
case SCH_NETCLASS_FLAG_T: case SCH_DIRECTIVE_LABEL_T:
saveText( static_cast< SCH_TEXT* >( item ), 0 ); saveText( static_cast< SCH_TEXT* >( item ), 0 );
break; break;
@ -1406,35 +1406,37 @@ void SCH_SEXPR_PLUGIN::saveText( SCH_TEXT* aText, int aNestLevel )
{ {
wxCHECK_RET( aText != nullptr && m_out != nullptr, "" ); wxCHECK_RET( aText != nullptr && m_out != nullptr, "" );
SCH_LABEL_BASE* label = dynamic_cast<SCH_LABEL_BASE*>( aText );
m_out->Print( aNestLevel, "(%s %s", m_out->Print( aNestLevel, "(%s %s",
getTextTypeToken( aText->Type() ), getTextTypeToken( aText->Type() ),
m_out->Quotew( aText->GetText() ).c_str() ); m_out->Quotew( aText->GetText() ).c_str() );
if( aText->Type() == SCH_NETCLASS_FLAG_T ) if( aText->Type() == SCH_DIRECTIVE_LABEL_T )
{ {
SCH_NETCLASS_FLAG* label = static_cast<SCH_NETCLASS_FLAG*>( aText ); SCH_DIRECTIVE_LABEL* flag = static_cast<SCH_DIRECTIVE_LABEL*>( aText );
m_out->Print( 0, " (length %s)", m_out->Print( 0, " (length %s)",
FormatInternalUnits( label->GetPinLength() ).c_str() ); FormatInternalUnits( flag->GetPinLength() ).c_str() );
} }
EDA_ANGLE angle = aText->GetTextAngle(); EDA_ANGLE angle = aText->GetTextAngle();
if( aText->Type() == SCH_GLOBAL_LABEL_T if( aText->Type() == SCH_GLOBAL_LABEL_T
|| aText->Type() == SCH_HIER_LABEL_T || aText->Type() == SCH_HIER_LABEL_T
|| aText->Type() == SCH_NETCLASS_FLAG_T ) || aText->Type() == SCH_DIRECTIVE_LABEL_T )
{ {
m_out->Print( 0, " (shape %s)", getSheetPinShapeToken( aText->GetShape() ) ); m_out->Print( 0, " (shape %s)", getSheetPinShapeToken( label->GetShape() ) );
// The angle of the text is always 0 or 90 degrees for readibility reasons, // The angle of the text is always 0 or 90 degrees for readibility reasons,
// but the item itself can have more rotation (-90 and 180 deg) // but the item itself can have more rotation (-90 and 180 deg)
switch( aText->GetLabelSpinStyle() ) switch( aText->GetTextSpinStyle() )
{ {
default: default:
case LABEL_SPIN_STYLE::LEFT: angle += ANGLE_180; break; case TEXT_SPIN_STYLE::LEFT: angle += ANGLE_180; break;
case LABEL_SPIN_STYLE::UP: break; case TEXT_SPIN_STYLE::UP: break;
case LABEL_SPIN_STYLE::RIGHT: break; case TEXT_SPIN_STYLE::RIGHT: break;
case LABEL_SPIN_STYLE::BOTTOM: angle += ANGLE_180; break; case TEXT_SPIN_STYLE::BOTTOM: angle += ANGLE_180; break;
} }
} }
@ -1463,8 +1465,6 @@ void SCH_SEXPR_PLUGIN::saveText( SCH_TEXT* aText, int aNestLevel )
m_out->Print( aNestLevel + 1, "(uuid %s)\n", TO_UTF8( aText->m_Uuid.AsString() ) ); m_out->Print( aNestLevel + 1, "(uuid %s)\n", TO_UTF8( aText->m_Uuid.AsString() ) );
SCH_LABEL_BASE* label = dynamic_cast<SCH_LABEL_BASE*>( aText );
if( label ) if( label )
{ {
for( SCH_FIELD& field : label->GetFields() ) for( SCH_FIELD& field : label->GetFields() )

View File

@ -1465,7 +1465,7 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( LINE_READER& aReader )
spinStyle = 0; spinStyle = 0;
} }
text->SetLabelSpinStyle( (LABEL_SPIN_STYLE::SPIN) spinStyle ); text->SetTextSpinStyle( static_cast<TEXT_SPIN_STYLE::SPIN>( spinStyle ) );
int size = Mils2Iu( parseInt( aReader, line, &line ) ); int size = Mils2Iu( parseInt( aReader, line, &line ) );
@ -2409,7 +2409,7 @@ void SCH_LEGACY_PLUGIN::saveText( SCH_TEXT* aText )
} }
// Local labels must have their spin style inverted for left and right // Local labels must have their spin style inverted for left and right
int spinStyle = static_cast<int>( aText->GetLabelSpinStyle() ); int spinStyle = static_cast<int>( aText->GetTextSpinStyle() );
if( spinStyle == 0 ) if( spinStyle == 0 )
spinStyle = 2; spinStyle = 2;
@ -2431,7 +2431,7 @@ void SCH_LEGACY_PLUGIN::saveText( SCH_TEXT* aText )
m_out->Print( 0, "Text %s %-4d %-4d %-4d %-4d %s %s %d\n%s\n", textType, m_out->Print( 0, "Text %s %-4d %-4d %-4d %-4d %s %s %d\n%s\n", textType,
Iu2Mils( aText->GetPosition().x ), Iu2Mils( aText->GetPosition().y ), Iu2Mils( aText->GetPosition().x ), Iu2Mils( aText->GetPosition().y ),
static_cast<int>( aText->GetLabelSpinStyle() ), static_cast<int>( aText->GetTextSpinStyle() ),
Iu2Mils( aText->GetTextWidth() ), Iu2Mils( aText->GetTextWidth() ),
shapeLabelIt->second, shapeLabelIt->second,
italics, italics,

View File

@ -1015,7 +1015,7 @@ void SCH_SCREEN::GetHierarchicalItems( std::vector<SCH_ITEM*>* aItems ) const
SCH_SHEET_T, SCH_SHEET_T,
SCH_LABEL_T, SCH_LABEL_T,
SCH_HIER_LABEL_T, SCH_HIER_LABEL_T,
SCH_NETCLASS_FLAG_T, SCH_DIRECTIVE_LABEL_T,
SCH_GLOBAL_LABEL_T, SCH_GLOBAL_LABEL_T,
EOT }; EOT };
@ -1119,7 +1119,7 @@ SCH_TEXT* SCH_SCREEN::GetLabel( const VECTOR2I& aPosition, int aAccuracy ) const
case SCH_LABEL_T: case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T: case SCH_HIER_LABEL_T:
case SCH_NETCLASS_FLAG_T: case SCH_DIRECTIVE_LABEL_T:
if( item->HitTest( aPosition, aAccuracy ) ) if( item->HitTest( aPosition, aAccuracy ) )
return static_cast<SCH_TEXT*>( item ); return static_cast<SCH_TEXT*>( item );

View File

@ -123,25 +123,25 @@ void SCH_SHEET_PIN::SetSide( SHEET_SIDE aEdge )
case SHEET_SIDE::LEFT: case SHEET_SIDE::LEFT:
m_edge = aEdge; m_edge = aEdge;
SetTextX( Sheet->m_pos.x ); SetTextX( Sheet->m_pos.x );
SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT ); // Orientation horiz inverse SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT ); // Orientation horiz inverse
break; break;
case SHEET_SIDE::RIGHT: case SHEET_SIDE::RIGHT:
m_edge = aEdge; m_edge = aEdge;
SetTextX( Sheet->m_pos.x + Sheet->m_size.x ); SetTextX( Sheet->m_pos.x + Sheet->m_size.x );
SetLabelSpinStyle( LABEL_SPIN_STYLE::LEFT ); // Orientation horiz normal SetTextSpinStyle( TEXT_SPIN_STYLE::LEFT ); // Orientation horiz normal
break; break;
case SHEET_SIDE::TOP: case SHEET_SIDE::TOP:
m_edge = aEdge; m_edge = aEdge;
SetTextY( Sheet->m_pos.y ); SetTextY( Sheet->m_pos.y );
SetLabelSpinStyle( LABEL_SPIN_STYLE::BOTTOM ); // Orientation vert BOTTOM SetTextSpinStyle( TEXT_SPIN_STYLE::BOTTOM ); // Orientation vert BOTTOM
break; break;
case SHEET_SIDE::BOTTOM: case SHEET_SIDE::BOTTOM:
m_edge = aEdge; m_edge = aEdge;
SetTextY( Sheet->m_pos.y + Sheet->m_size.y ); SetTextY( Sheet->m_pos.y + Sheet->m_size.y );
SetLabelSpinStyle( LABEL_SPIN_STYLE::UP ); // Orientation vert UP SetTextSpinStyle( TEXT_SPIN_STYLE::UP ); // Orientation vert UP
break; break;
default: default:

View File

@ -22,10 +22,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifndef _SCH_SHEEET_PIN_H_ #ifndef SCH_SHEEET_PIN_H
#define _SCH_SHEEET_PIN_H_ #define SCH_SHEEET_PIN_H
#include <sch_text.h> #include <sch_label.h>
class KIID; class KIID;
class LINE_READER; class LINE_READER;
@ -206,4 +206,4 @@ private:
SHEET_SIDE m_edge; SHEET_SIDE m_edge;
}; };
#endif // _SCH_SHEEET_PIN_H_ #endif // SCH_SHEEET_PIN_H

View File

@ -605,7 +605,7 @@ public:
( aItem->Type() == SCH_NO_CONNECT_T ) || ( aItem->Type() == SCH_NO_CONNECT_T ) ||
( aItem->Type() == SCH_JUNCTION_T ) || ( aItem->Type() == SCH_JUNCTION_T ) ||
( aItem->Type() == SCH_SYMBOL_T ) || ( aItem->Type() == SCH_SYMBOL_T ) ||
( aItem->Type() == SCH_NETCLASS_FLAG_T ) || ( aItem->Type() == SCH_DIRECTIVE_LABEL_T ) ||
( aItem->Type() == SCH_LABEL_T ) || ( aItem->Type() == SCH_LABEL_T ) ||
( aItem->Type() == SCH_HIER_LABEL_T ) || ( aItem->Type() == SCH_HIER_LABEL_T ) ||
( aItem->Type() == SCH_GLOBAL_LABEL_T ); ( aItem->Type() == SCH_GLOBAL_LABEL_T );

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * 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 * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -22,8 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifndef CLASS_TEXT_LABEL_H #ifndef SCH_TEXT_H
#define CLASS_TEXT_LABEL_H #define SCH_TEXT_H
#include <eda_text.h> #include <eda_text.h>
@ -32,14 +32,13 @@
#include <sch_connection.h> // for CONNECTION_TYPE #include <sch_connection.h> // for CONNECTION_TYPE
class NETLIST_OBJECT_LIST;
class HTML_MESSAGE_BOX; class HTML_MESSAGE_BOX;
/* /*
* Spin style for text items of all kinds on schematics * Spin style for text items of all kinds on schematics
* Basically a higher level abstraction of rotation and justification of text * Basically a higher level abstraction of rotation and justification of text
*/ */
class LABEL_SPIN_STYLE class TEXT_SPIN_STYLE
{ {
public: public:
enum SPIN : int enum SPIN : int
@ -51,8 +50,8 @@ public:
}; };
LABEL_SPIN_STYLE() = default; TEXT_SPIN_STYLE() = default;
constexpr LABEL_SPIN_STYLE( SPIN aSpin ) : m_spin( aSpin ) constexpr TEXT_SPIN_STYLE( SPIN aSpin ) : m_spin( aSpin )
{ {
} }
@ -71,26 +70,27 @@ public:
return static_cast<int>( m_spin ); return static_cast<int>( m_spin );
} }
LABEL_SPIN_STYLE RotateCW(); TEXT_SPIN_STYLE RotateCW();
LABEL_SPIN_STYLE RotateCCW(); TEXT_SPIN_STYLE RotateCCW();
/** /**
* Mirror the label spin style across the X axis or simply swaps up and bottom. * Mirror the label spin style across the X axis or simply swaps up and bottom.
*/ */
LABEL_SPIN_STYLE MirrorX(); TEXT_SPIN_STYLE MirrorX();
/** /**
* Mirror the label spin style across the Y axis or simply swaps left and right. * Mirror the label spin style across the Y axis or simply swaps left and right.
*/ */
LABEL_SPIN_STYLE MirrorY(); TEXT_SPIN_STYLE MirrorY();
private: private:
SPIN m_spin; SPIN m_spin;
}; };
/* /*
* Shape/Type of #SCH_HIERLABEL, #SCH_GLOBALLABEL and #SCH_NETCLASS_FLAG. * Label and flag shapes used with text objects.
*/ */
enum LABEL_FLAG_SHAPE enum LABEL_FLAG_SHAPE
{ {
@ -114,7 +114,7 @@ extern const char* SheetLabelType[]; /* names of types of labels */
class SCH_TEXT : public SCH_ITEM, public EDA_TEXT class SCH_TEXT : public SCH_ITEM, public EDA_TEXT
{ {
public: public:
SCH_TEXT( const VECTOR2I& aPos = VECTOR2I( 0, 0 ), const wxString& aText = wxEmptyString, SCH_TEXT( const VECTOR2I& aPos = { 0, 0 }, const wxString& aText = wxEmptyString,
KICAD_T aType = SCH_TEXT_T ); KICAD_T aType = SCH_TEXT_T );
SCH_TEXT( const SCH_TEXT& aText ); SCH_TEXT( const SCH_TEXT& aText );
@ -133,22 +133,15 @@ public:
wxString GetShownText( int aDepth = 0 ) const override; wxString GetShownText( int aDepth = 0 ) const override;
/**
* 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 );
/** /**
* Set a spin or rotation angle, along with specific horizontal and vertical justification * Set a spin or rotation angle, along with specific horizontal and vertical justification
* styles with each angle. * styles with each angle.
* *
* @param aSpinStyle Spin style as per #LABEL_SPIN_STYLE storage class, may be the enum * @param aSpinStyle Spin style as per #TEXT_SPIN_STYLE storage class, may be the enum
* values or int value * values or int value
*/ */
virtual void SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle ); virtual void SetTextSpinStyle( TEXT_SPIN_STYLE aSpinStyle );
LABEL_SPIN_STYLE GetLabelSpinStyle() const { return m_spin_style; } TEXT_SPIN_STYLE GetTextSpinStyle() const { return m_spin_style; }
virtual LABEL_FLAG_SHAPE GetShape() const { return L_UNSPECIFIED; } virtual LABEL_FLAG_SHAPE GetShape() const { return L_UNSPECIFIED; }
virtual void SetShape( LABEL_FLAG_SHAPE aShape ) { } virtual void SetShape( LABEL_FLAG_SHAPE aShape ) { }
@ -237,348 +230,8 @@ protected:
* This is a duplication of m_Orient, m_HJustified, and m_VJustified in #EDA_TEXT but is * This is a duplication of m_Orient, m_HJustified, and m_VJustified in #EDA_TEXT but is
* easier to handle than 3 parameters when editing and reading and saving files. * easier to handle than 3 parameters when editing and reading and saving files.
*/ */
LABEL_SPIN_STYLE m_spin_style; TEXT_SPIN_STYLE m_spin_style;
}; };
class SCH_LABEL_BASE : public SCH_TEXT #endif /* SCH_TEXT_H */
{
public:
SCH_LABEL_BASE( const VECTOR2I& aPos, const wxString& aText, KICAD_T aType );
SCH_LABEL_BASE( const SCH_LABEL_BASE& aLabel );
// Abstract class
virtual wxString GetClass() const override = 0;
bool IsType( const KICAD_T aScanTypes[] ) const override;
void SwapData( SCH_ITEM* aItem ) override;
LABEL_FLAG_SHAPE GetShape() const override { return m_shape; }
void SetShape( LABEL_FLAG_SHAPE aShape ) override { m_shape = aShape; }
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
}
void Move( const VECTOR2I& aMoveVector ) override
{
SCH_TEXT::Move( aMoveVector );
for( SCH_FIELD& field : m_fields )
field.Offset( aMoveVector );
}
void Rotate( const VECTOR2I& aCenter ) override;
void Rotate90( bool aClockwise ) override;
void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
virtual bool ResolveTextVar( wxString* token, int aDepth ) const;
wxString GetShownText( int aDepth = 0 ) const override;
void RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction ) override;
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
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.
*/
virtual const EDA_RECT GetBodyBoundingBox() const;
/**
* Return the bounding box of the label including its fields.
*/
const EDA_RECT GetBoundingBox() const override;
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
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;
void Plot( PLOTTER* aPlotter ) const override;
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& offset ) override;
protected:
std::vector<SCH_FIELD> m_fields;
LABEL_FLAG_SHAPE m_shape;
CONNECTION_TYPE m_connectionType;
bool m_isDangling;
};
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" );
}
const EDA_RECT GetBodyBoundingBox() const override;
bool IsConnectable() const override { return true; }
bool CanConnect( const SCH_ITEM* aItem ) const override
{
return aItem->Type() == SCH_LINE_T &&
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
}
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
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;
}
private:
bool doIsConnected( const VECTOR2I& aPosition ) const override
{
return EDA_TEXT::GetTextPos() == aPosition;
}
};
class SCH_NETCLASS_FLAG : public SCH_LABEL_BASE
{
public:
SCH_NETCLASS_FLAG( const VECTOR2I& aPos = VECTOR2I( 0, 0 ) );
SCH_NETCLASS_FLAG( const SCH_NETCLASS_FLAG& aClassLabel );
~SCH_NETCLASS_FLAG() { }
static inline bool ClassOf( const EDA_ITEM* aItem )
{
return aItem && SCH_NETCLASS_FLAG_T == aItem->Type();
}
wxString GetClass() const override
{
return wxT( "SCH_NETCLASS_FLAG" );
}
EDA_ITEM* Clone() const override
{
return new SCH_NETCLASS_FLAG( *this );
}
int GetPinLength() const { return m_pinLength; }
void SetPinLength( int aLength ) { m_pinLength = aLength; }
void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
const VECTOR2I& aPos ) const override;
void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
bool IsConnectable() const override { return true; }
bool CanConnect( const SCH_ITEM* aItem ) const override
{
return aItem->Type() == SCH_LINE_T &&
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
}
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; }
void MirrorSpinStyle( bool aLeftRight ) override;
void MirrorHorizontally( int aCenter ) override;
void MirrorVertically( int aCenter ) override;
void SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle ) override;
VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
void CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings, std::vector<VECTOR2I>& aPoints,
const VECTOR2I& aPos ) const override;
bool ResolveTextVar( wxString* token, int aDepth ) const override;
bool IsConnectable() const override { return true; }
bool CanConnect( const SCH_ITEM* aItem ) const override
{
return aItem->Type() == SCH_LINE_T &&
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
}
void ViewGetLayers( int aLayers[], int& aCount ) const override;
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
BITMAPS GetMenuImage() const override;
bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override
{
return m_isDangling && GetPosition() == aPos;
}
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" );
}
void SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle ) override;
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;
const EDA_RECT GetBodyBoundingBox() const override;
bool IsConnectable() const override { return true; }
bool CanConnect( const SCH_ITEM* aItem ) const override
{
return aItem->Type() == SCH_LINE_T &&
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
}
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
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;
}
private:
bool doIsConnected( const VECTOR2I& aPosition ) const override
{
return EDA_TEXT::GetTextPos() == aPosition;
}
};
#endif /* CLASS_TEXT_LABEL_H */

View File

@ -26,6 +26,7 @@ date
default default
diameter diameter
diamond diamond
directive_label
dot dot
edge_clock_high edge_clock_high
effects effects

View File

@ -31,6 +31,7 @@
#include <reporter.h> #include <reporter.h>
#include <sch_edit_frame.h> #include <sch_edit_frame.h>
#include <sch_sheet_path.h> #include <sch_sheet_path.h>
#include <sch_label.h>
#include <schematic.h> #include <schematic.h>
#include <string_utils.h> #include <string_utils.h>
#include <kiface_base.h> #include <kiface_base.h>
@ -417,17 +418,17 @@ void BACK_ANNOTATE::applyChangelist()
} }
static LABEL_SPIN_STYLE orientLabel( SCH_PIN* aPin ) static TEXT_SPIN_STYLE orientLabel( SCH_PIN* aPin )
{ {
LABEL_SPIN_STYLE spin = LABEL_SPIN_STYLE::RIGHT; TEXT_SPIN_STYLE spin = TEXT_SPIN_STYLE::RIGHT;
// Initial orientation from the pin // Initial orientation from the pin
switch( aPin->GetLibPin()->GetOrientation() ) switch( aPin->GetLibPin()->GetOrientation() )
{ {
case PIN_UP: spin = LABEL_SPIN_STYLE::BOTTOM; break; case PIN_UP: spin = TEXT_SPIN_STYLE::BOTTOM; break;
case PIN_DOWN: spin = LABEL_SPIN_STYLE::UP; break; case PIN_DOWN: spin = TEXT_SPIN_STYLE::UP; break;
case PIN_LEFT: spin = LABEL_SPIN_STYLE::RIGHT; break; case PIN_LEFT: spin = TEXT_SPIN_STYLE::RIGHT; break;
case PIN_RIGHT: spin = LABEL_SPIN_STYLE::LEFT; break; case PIN_RIGHT: spin = TEXT_SPIN_STYLE::LEFT; break;
} }
// Reorient based on the actual symbol orientation now // Reorient based on the actual symbol orientation now
@ -551,8 +552,8 @@ void BACK_ANNOTATE::processNetNameChange( const wxString& aRef, SCH_PIN* aPin,
case SCH_PIN_T: case SCH_PIN_T:
{ {
SCH_PIN* schPin = static_cast<SCH_PIN*>( driver ); SCH_PIN* schPin = static_cast<SCH_PIN*>( driver );
LABEL_SPIN_STYLE spin = orientLabel( schPin ); TEXT_SPIN_STYLE spin = orientLabel( schPin );
if( schPin->IsPowerConnection() ) if( schPin->IsPowerConnection() )
{ {
@ -576,7 +577,7 @@ void BACK_ANNOTATE::processNetNameChange( const wxString& aRef, SCH_PIN* aPin,
SCH_LABEL* label = new SCH_LABEL( driver->GetPosition(), aNewName ); SCH_LABEL* label = new SCH_LABEL( driver->GetPosition(), aNewName );
label->SetParent( &m_frame->Schematic() ); label->SetParent( &m_frame->Schematic() );
label->SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) ); label->SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) );
label->SetLabelSpinStyle( spin ); label->SetTextSpinStyle( spin );
label->SetFlags( IS_NEW ); label->SetFlags( IS_NEW );
SCH_SCREEN* screen = aConnection->Sheet().LastScreen(); SCH_SCREEN* screen = aConnection->Sheet().LastScreen();

View File

@ -298,7 +298,7 @@ TOOL_ACTION EE_ACTIONS::placeLabel( "eeschema.InteractiveDrawing.placeLabel",
TOOL_ACTION EE_ACTIONS::placeClassLabel( "eeschema.InteractiveDrawing.placeClassLabel", TOOL_ACTION EE_ACTIONS::placeClassLabel( "eeschema.InteractiveDrawing.placeClassLabel",
AS_GLOBAL, 0, "", AS_GLOBAL, 0, "",
_( "Add Net Class Flag" ), _( "Add a net class flag" ), _( "Add Net Class Directive" ), _( "Add a net class directive label" ),
BITMAPS::add_class_flag, AF_ACTIVATE ); BITMAPS::add_class_flag, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::placeHierLabel( "eeschema.InteractiveDrawing.placeHierarchicalLabel", TOOL_ACTION EE_ACTIONS::placeHierLabel( "eeschema.InteractiveDrawing.placeHierarchicalLabel",
@ -475,8 +475,8 @@ TOOL_ACTION EE_ACTIONS::toLabel( "eeschema.InteractiveEdit.toLabel",
TOOL_ACTION EE_ACTIONS::toCLabel( "eeschema.InteractiveEdit.toCLabel", TOOL_ACTION EE_ACTIONS::toCLabel( "eeschema.InteractiveEdit.toCLabel",
AS_GLOBAL, 0, "", AS_GLOBAL, 0, "",
_( "Change to Net Class Flag" ), _( "Change existing item to a net class flag" ), _( "Change to Directive Label" ), _( "Change existing item to a directive label" ),
BITMAPS::add_class_flag, AF_NONE, (void*) SCH_NETCLASS_FLAG_T ); BITMAPS::add_class_flag, AF_NONE, (void*) SCH_DIRECTIVE_LABEL_T );
TOOL_ACTION EE_ACTIONS::toHLabel( "eeschema.InteractiveEdit.toHLabel", TOOL_ACTION EE_ACTIONS::toHLabel( "eeschema.InteractiveEdit.toHLabel",
AS_GLOBAL, 0, "", AS_GLOBAL, 0, "",

View File

@ -293,7 +293,7 @@ void EE_GRID_HELPER::computeAnchors( SCH_ITEM *aItem, const VECTOR2I &aRefPos, b
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T: case SCH_HIER_LABEL_T:
case SCH_LABEL_T: case SCH_LABEL_T:
case SCH_NETCLASS_FLAG_T: case SCH_DIRECTIVE_LABEL_T:
case SCH_BUS_WIRE_ENTRY_T: case SCH_BUS_WIRE_ENTRY_T:
{ {
std::vector<VECTOR2I> pts = aItem->GetConnectionPoints(); std::vector<VECTOR2I> pts = aItem->GetConnectionPoints();

View File

@ -166,7 +166,7 @@ bool EE_SELECTION_TOOL::Init()
SCH_GLOBAL_LABEL_T, SCH_GLOBAL_LABEL_T,
SCH_HIER_LABEL_T, SCH_HIER_LABEL_T,
SCH_LABEL_T, SCH_LABEL_T,
SCH_NETCLASS_FLAG_T, SCH_DIRECTIVE_LABEL_T,
SCH_SHEET_PIN_T, SCH_SHEET_PIN_T,
SCH_PIN_T, SCH_PIN_T,
EOT }; EOT };
@ -1341,19 +1341,19 @@ bool EE_SELECTION_TOOL::selectMultiple()
static KICAD_T nodeTypes[] = static KICAD_T nodeTypes[] =
{ {
SCH_SYMBOL_LOCATE_POWER_T, SCH_SYMBOL_LOCATE_POWER_T,
SCH_PIN_T, SCH_PIN_T,
SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_WIRE_T,
SCH_ITEM_LOCATE_BUS_T, SCH_ITEM_LOCATE_BUS_T,
SCH_BUS_WIRE_ENTRY_T, SCH_BUS_WIRE_ENTRY_T,
SCH_BUS_BUS_ENTRY_T, SCH_BUS_BUS_ENTRY_T,
SCH_LABEL_T, SCH_LABEL_T,
SCH_HIER_LABEL_T, SCH_HIER_LABEL_T,
SCH_GLOBAL_LABEL_T, SCH_GLOBAL_LABEL_T,
SCH_SHEET_PIN_T, SCH_SHEET_PIN_T,
SCH_NETCLASS_FLAG_T, SCH_DIRECTIVE_LABEL_T,
SCH_JUNCTION_T, SCH_JUNCTION_T,
EOT EOT
}; };

View File

@ -31,7 +31,6 @@
#include <id.h> #include <id.h>
#include <eeschema_id.h> #include <eeschema_id.h>
#include <confirm.h> #include <confirm.h>
#include <widgets/infobar.h>
#include <view/view_controls.h> #include <view/view_controls.h>
#include <view/view.h> #include <view/view.h>
#include <sch_symbol.h> #include <sch_symbol.h>
@ -61,10 +60,10 @@ SCH_DRAWING_TOOLS::SCH_DRAWING_TOOLS() :
m_lastSheetPinType( LABEL_FLAG_SHAPE::L_INPUT ), m_lastSheetPinType( LABEL_FLAG_SHAPE::L_INPUT ),
m_lastGlobalLabelShape( LABEL_FLAG_SHAPE::L_INPUT ), m_lastGlobalLabelShape( LABEL_FLAG_SHAPE::L_INPUT ),
m_lastNetClassFlagShape( LABEL_FLAG_SHAPE::F_ROUND ), m_lastNetClassFlagShape( LABEL_FLAG_SHAPE::F_ROUND ),
m_lastTextOrientation( LABEL_SPIN_STYLE::RIGHT ), m_lastTextOrientation( TEXT_SPIN_STYLE::RIGHT ),
m_lastTextBold( false ), m_lastTextBold( false ),
m_lastTextItalic( false ), m_lastTextItalic( false ),
m_lastNetClassFlagItalic( true ), m_lastNetClassDirectiveItalic( true ),
m_lastFillStyle( FILL_T::NO_FILL ), m_lastFillStyle( FILL_T::NO_FILL ),
m_inPlaceSymbol( false ), m_inPlaceSymbol( false ),
m_inDrawShape( false ), m_inDrawShape( false ),
@ -868,6 +867,7 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType
SCHEMATIC* schematic = getModel<SCHEMATIC>(); SCHEMATIC* schematic = getModel<SCHEMATIC>();
SCHEMATIC_SETTINGS& settings = schematic->Settings(); SCHEMATIC_SETTINGS& settings = schematic->Settings();
SCH_TEXT* textItem = nullptr; SCH_TEXT* textItem = nullptr;
SCH_LABEL_BASE* labelItem = nullptr;
switch( aType ) switch( aType )
{ {
@ -876,23 +876,30 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType
break; break;
case LAYER_LOCLABEL: case LAYER_LOCLABEL:
textItem = new SCH_LABEL( aPosition ); labelItem = new SCH_LABEL( aPosition );
textItem = labelItem;
break; break;
case LAYER_NETCLASS_REFS: case LAYER_NETCLASS_REFS:
textItem = new SCH_NETCLASS_FLAG( aPosition ); labelItem = new SCH_DIRECTIVE_LABEL( aPosition );
textItem->SetShape( m_lastNetClassFlagShape ); labelItem->SetShape( m_lastNetClassFlagShape );
labelItem->GetFields().emplace_back( SCH_FIELD( {0,0}, 0, labelItem, wxT( "Netclass" ) ) );
labelItem->GetFields().back().SetItalic( true );
labelItem->GetFields().back().SetVisible( true );
textItem = labelItem;
break; break;
case LAYER_HIERLABEL: case LAYER_HIERLABEL:
textItem = new SCH_HIERLABEL( aPosition ); labelItem = new SCH_HIERLABEL( aPosition );
textItem->SetShape( m_lastGlobalLabelShape ); labelItem->SetShape( m_lastGlobalLabelShape );
textItem = labelItem;
break; break;
case LAYER_GLOBLABEL: case LAYER_GLOBLABEL:
textItem = new SCH_GLOBALLABEL( aPosition ); labelItem = new SCH_GLOBALLABEL( aPosition );
textItem->SetShape( m_lastGlobalLabelShape ); labelItem->SetShape( m_lastGlobalLabelShape );
static_cast<SCH_GLOBALLABEL*>( textItem )->GetFields()[0].SetVisible( true ); labelItem->GetFields()[0].SetVisible( true );
textItem = labelItem;
break; break;
default: default:
@ -903,16 +910,16 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType
textItem->SetParent( schematic ); textItem->SetParent( schematic );
textItem->SetBold( m_lastTextBold ); textItem->SetBold( m_lastTextBold );
if( textItem->Type() == SCH_NETCLASS_FLAG_T ) if( aType == LAYER_NETCLASS_REFS )
textItem->SetItalic( m_lastNetClassFlagItalic ); textItem->SetItalic( m_lastNetClassDirectiveItalic );
else else
textItem->SetItalic( m_lastTextItalic ); textItem->SetItalic( m_lastTextItalic );
textItem->SetLabelSpinStyle( m_lastTextOrientation ); textItem->SetTextSpinStyle( m_lastTextOrientation );
textItem->SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) ); textItem->SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) );
textItem->SetFlags( IS_NEW | IS_MOVING ); textItem->SetFlags( IS_NEW | IS_MOVING );
if( aType == LAYER_NOTES ) if( !labelItem )
{ {
DIALOG_TEXT_PROPERTIES dlg( m_frame, textItem ); DIALOG_TEXT_PROPERTIES dlg( m_frame, textItem );
@ -930,14 +937,14 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType
// Must be quasi modal for syntax help // Must be quasi modal for syntax help
if( dlg.ShowQuasiModal() != wxID_OK ) if( dlg.ShowQuasiModal() != wxID_OK )
{ {
delete textItem; delete labelItem;
return nullptr; return nullptr;
} }
} }
wxString text = textItem->GetText(); wxString text = textItem->GetText();
if( textItem->Type() != SCH_NETCLASS_FLAG_T && NoPrintableChars( text ) ) if( textItem->Type() != SCH_DIRECTIVE_LABEL_T && NoPrintableChars( text ) )
{ {
delete textItem; delete textItem;
return nullptr; return nullptr;
@ -945,17 +952,17 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType
m_lastTextBold = textItem->IsBold(); m_lastTextBold = textItem->IsBold();
if( textItem->Type() == SCH_NETCLASS_FLAG_T ) if( aType == LAYER_NETCLASS_REFS )
m_lastNetClassFlagItalic = textItem->IsItalic(); m_lastNetClassDirectiveItalic = textItem->IsItalic();
else else
m_lastTextItalic = textItem->IsItalic(); m_lastTextItalic = textItem->IsItalic();
m_lastTextOrientation = textItem->GetLabelSpinStyle(); m_lastTextOrientation = textItem->GetTextSpinStyle();
if( textItem->Type() == SCH_GLOBAL_LABEL_T || textItem->Type() == SCH_HIER_LABEL_T ) if( aType == LAYER_GLOBLABEL || aType == LAYER_HIERLABEL )
m_lastGlobalLabelShape = textItem->GetShape(); m_lastGlobalLabelShape = labelItem->GetShape();
else if( textItem->Type() == SCH_NETCLASS_FLAG_T ) else if( aType == LAYER_NETCLASS_REFS )
m_lastNetClassFlagShape = textItem->GetShape(); m_lastNetClassFlagShape = labelItem->GetShape();
return textItem; return textItem;
} }

View File

@ -27,11 +27,11 @@
#include <tools/ee_tool_base.h> #include <tools/ee_tool_base.h>
#include <sch_base_frame.h> #include <sch_base_frame.h>
#include <sch_label.h>
#include <status_popup.h> #include <status_popup.h>
class SCH_SYMBOL; class SCH_SYMBOL;
class SCH_BUS_WIRE_ENTRY; class SCH_BUS_WIRE_ENTRY;
class SCH_LABEL;
class SCHLIB_FILTER; class SCHLIB_FILTER;
class SCH_EDIT_FRAME; class SCH_EDIT_FRAME;
class EE_SELECTION_TOOL; class EE_SELECTION_TOOL;
@ -87,10 +87,10 @@ private:
LABEL_FLAG_SHAPE m_lastSheetPinType; LABEL_FLAG_SHAPE m_lastSheetPinType;
LABEL_FLAG_SHAPE m_lastGlobalLabelShape; LABEL_FLAG_SHAPE m_lastGlobalLabelShape;
LABEL_FLAG_SHAPE m_lastNetClassFlagShape; LABEL_FLAG_SHAPE m_lastNetClassFlagShape;
LABEL_SPIN_STYLE m_lastTextOrientation; TEXT_SPIN_STYLE m_lastTextOrientation;
bool m_lastTextBold; bool m_lastTextBold;
bool m_lastTextItalic; bool m_lastTextItalic;
bool m_lastNetClassFlagItalic; bool m_lastNetClassDirectiveItalic;
FILL_T m_lastFillStyle; FILL_T m_lastFillStyle;
///< Re-entrancy guards ///< Re-entrancy guards

View File

@ -253,7 +253,7 @@ bool SCH_EDIT_TOOL::Init()
case SCH_LABEL_T: case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T: case SCH_HIER_LABEL_T:
case SCH_NETCLASS_FLAG_T: case SCH_DIRECTIVE_LABEL_T:
case SCH_FIELD_T: case SCH_FIELD_T:
case SCH_SHAPE_T: case SCH_SHAPE_T:
case SCH_BITMAP_T: case SCH_BITMAP_T:
@ -284,13 +284,13 @@ bool SCH_EDIT_TOOL::Init()
}; };
static KICAD_T allLabelTypes[] = { SCH_LABEL_T, static KICAD_T allLabelTypes[] = { SCH_LABEL_T,
SCH_NETCLASS_FLAG_T, SCH_DIRECTIVE_LABEL_T,
SCH_GLOBAL_LABEL_T, SCH_GLOBAL_LABEL_T,
SCH_HIER_LABEL_T, SCH_HIER_LABEL_T,
SCH_TEXT_T, SCH_TEXT_T,
EOT }; EOT };
static KICAD_T toLabelTypes[] = { SCH_NETCLASS_FLAG_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT }; static KICAD_T toLabelTypes[] = { SCH_DIRECTIVE_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT };
auto toLabelCondition = ( E_C::Count( 1 ) && E_C::OnlyTypes( toLabelTypes ) ) auto toLabelCondition = ( E_C::Count( 1 ) && E_C::OnlyTypes( toLabelTypes ) )
|| ( E_C::MoreThan( 1 ) && E_C::OnlyTypes( allLabelTypes ) ); || ( E_C::MoreThan( 1 ) && E_C::OnlyTypes( allLabelTypes ) );
@ -298,15 +298,15 @@ bool SCH_EDIT_TOOL::Init()
auto toCLabelCondition = ( E_C::Count( 1 ) && E_C::OnlyTypes( toCLabelTypes ) ) auto toCLabelCondition = ( E_C::Count( 1 ) && E_C::OnlyTypes( toCLabelTypes ) )
|| ( E_C::MoreThan( 1 ) && E_C::OnlyTypes( allLabelTypes ) ); || ( E_C::MoreThan( 1 ) && E_C::OnlyTypes( allLabelTypes ) );
static KICAD_T toHLabelTypes[] = { SCH_LABEL_T, SCH_NETCLASS_FLAG_T, SCH_GLOBAL_LABEL_T, SCH_TEXT_T, EOT }; static KICAD_T toHLabelTypes[] = { SCH_LABEL_T, SCH_DIRECTIVE_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_TEXT_T, EOT };
auto toHLabelCondition = ( E_C::Count( 1 ) && E_C::OnlyTypes( toHLabelTypes ) ) auto toHLabelCondition = ( E_C::Count( 1 ) && E_C::OnlyTypes( toHLabelTypes ) )
|| ( E_C::MoreThan( 1 ) && E_C::OnlyTypes( allLabelTypes ) ); || ( E_C::MoreThan( 1 ) && E_C::OnlyTypes( allLabelTypes ) );
static KICAD_T toGLabelTypes[] = { SCH_LABEL_T, SCH_NETCLASS_FLAG_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT }; static KICAD_T toGLabelTypes[] = { SCH_LABEL_T, SCH_DIRECTIVE_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT };
auto toGLabelCondition = ( E_C::Count( 1 ) && E_C::OnlyTypes( toGLabelTypes ) ) auto toGLabelCondition = ( E_C::Count( 1 ) && E_C::OnlyTypes( toGLabelTypes ) )
|| ( E_C::MoreThan( 1 ) && E_C::OnlyTypes( allLabelTypes ) ); || ( E_C::MoreThan( 1 ) && E_C::OnlyTypes( allLabelTypes ) );
static KICAD_T toTextTypes[] = { SCH_LABEL_T, SCH_NETCLASS_FLAG_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, EOT }; static KICAD_T toTextTypes[] = { SCH_LABEL_T, SCH_DIRECTIVE_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, EOT };
auto toTextCondition = ( E_C::Count( 1 ) && E_C::OnlyTypes( toTextTypes ) ) auto toTextCondition = ( E_C::Count( 1 ) && E_C::OnlyTypes( toTextTypes ) )
|| ( E_C::MoreThan( 1 ) && E_C::OnlyTypes( allLabelTypes ) ); || ( E_C::MoreThan( 1 ) && E_C::OnlyTypes( allLabelTypes ) );
@ -433,7 +433,7 @@ const KICAD_T rotatableItems[] = {
SCH_LABEL_T, SCH_LABEL_T,
SCH_GLOBAL_LABEL_T, SCH_GLOBAL_LABEL_T,
SCH_HIER_LABEL_T, SCH_HIER_LABEL_T,
SCH_NETCLASS_FLAG_T, SCH_DIRECTIVE_LABEL_T,
SCH_FIELD_T, SCH_FIELD_T,
SCH_SYMBOL_T, SCH_SYMBOL_T,
SCH_SHEET_PIN_T, SCH_SHEET_PIN_T,
@ -507,7 +507,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
case SCH_LABEL_T: case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T: case SCH_HIER_LABEL_T:
case SCH_NETCLASS_FLAG_T: case SCH_DIRECTIVE_LABEL_T:
{ {
SCH_TEXT* textItem = static_cast<SCH_TEXT*>( head ); SCH_TEXT* textItem = static_cast<SCH_TEXT*>( head );
textItem->Rotate90( clockwise ); textItem->Rotate90( clockwise );
@ -724,7 +724,7 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
case SCH_LABEL_T: case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T: case SCH_HIER_LABEL_T:
case SCH_NETCLASS_FLAG_T: case SCH_DIRECTIVE_LABEL_T:
{ {
SCH_TEXT* textItem = static_cast<SCH_TEXT*>( item ); SCH_TEXT* textItem = static_cast<SCH_TEXT*>( item );
textItem->MirrorSpinStyle( !vertical ); textItem->MirrorSpinStyle( !vertical );
@ -894,13 +894,11 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
{ {
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>(); EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
if( dynamic_cast<SCH_TEXT*>( newItem ) ) if( SCH_LABEL_BASE* label = dynamic_cast<SCH_LABEL_BASE*>( newItem ) )
{ {
SCH_TEXT* text = static_cast<SCH_TEXT*>( newItem );
// If incrementing tries to go below zero, tell user why the value is repeated // If incrementing tries to go below zero, tell user why the value is repeated
if( !text->IncrementLabel( cfg->m_Drawing.repeat_label_increment ) ) if( !label->IncrementLabel( cfg->m_Drawing.repeat_label_increment ) )
m_frame->ShowInfoBarWarning( _( "Label value cannot go below zero" ), true ); m_frame->ShowInfoBarWarning( _( "Label value cannot go below zero" ), true );
} }
@ -952,7 +950,7 @@ static KICAD_T deletableItems[] =
SCH_LABEL_T, SCH_LABEL_T,
SCH_GLOBAL_LABEL_T, SCH_GLOBAL_LABEL_T,
SCH_HIER_LABEL_T, SCH_HIER_LABEL_T,
SCH_NETCLASS_FLAG_T, SCH_DIRECTIVE_LABEL_T,
SCH_NO_CONNECT_T, SCH_NO_CONNECT_T,
SCH_SHEET_T, SCH_SHEET_T,
SCH_SHEET_PIN_T, SCH_SHEET_PIN_T,
@ -1473,7 +1471,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
case SCH_LABEL_T: case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T: case SCH_HIER_LABEL_T:
case SCH_NETCLASS_FLAG_T: case SCH_DIRECTIVE_LABEL_T:
{ {
DIALOG_LABEL_PROPERTIES dlg( m_frame, static_cast<SCH_LABEL_BASE*>( item ) ); DIALOG_LABEL_PROPERTIES dlg( m_frame, static_cast<SCH_LABEL_BASE*>( item ) );
@ -1602,7 +1600,7 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent )
SCH_GLOBAL_LABEL_T, SCH_GLOBAL_LABEL_T,
SCH_HIER_LABEL_T, SCH_HIER_LABEL_T,
SCH_TEXT_T, SCH_TEXT_T,
SCH_NETCLASS_FLAG_T, SCH_DIRECTIVE_LABEL_T,
EOT }; EOT };
EE_SELECTION selection = m_selectionTool->RequestSelection( allTextTypes ); EE_SELECTION selection = m_selectionTool->RequestSelection( allTextTypes );
@ -1612,11 +1610,11 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent )
if( text && text->Type() != convertTo ) if( text && text->Type() != convertTo )
{ {
bool selected = text->IsSelected(); bool selected = text->IsSelected();
SCH_TEXT* newtext = nullptr; SCH_TEXT* newtext = nullptr;
const VECTOR2I& position = text->GetPosition(); const VECTOR2I& position = text->GetPosition();
LABEL_SPIN_STYLE orientation = text->GetLabelSpinStyle(); TEXT_SPIN_STYLE orientation = text->GetTextSpinStyle();
wxString txt = UnescapeString( text->GetText() ); wxString txt = UnescapeString( text->GetText() );
// There can be characters in a SCH_TEXT object that can break labels so we have to // There can be characters in a SCH_TEXT object that can break labels so we have to
// fix them here. // fix them here.
@ -1639,12 +1637,12 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent )
switch( convertTo ) switch( convertTo )
{ {
case SCH_LABEL_T: newtext = new SCH_LABEL( position, txt ); break; case SCH_LABEL_T: newtext = new SCH_LABEL( position, txt ); break;
case SCH_GLOBAL_LABEL_T: newtext = new SCH_GLOBALLABEL( position, txt ); break; case SCH_GLOBAL_LABEL_T: newtext = new SCH_GLOBALLABEL( position, txt ); break;
case SCH_HIER_LABEL_T: newtext = new SCH_HIERLABEL( position, txt ); break; case SCH_HIER_LABEL_T: newtext = new SCH_HIERLABEL( position, txt ); break;
case SCH_TEXT_T: newtext = new SCH_TEXT( position, txt ); break; case SCH_TEXT_T: newtext = new SCH_TEXT( position, txt ); break;
case SCH_NETCLASS_FLAG_T: newtext = new SCH_NETCLASS_FLAG( position ); break; case SCH_DIRECTIVE_LABEL_T: newtext = new SCH_DIRECTIVE_LABEL( position ); break;
default: UNIMPLEMENTED_FOR( wxString::Format( "%d.", convertTo ) ); break; default: UNIMPLEMENTED_FOR( wxString::Format( "%d.", convertTo ) ); break;
} }
// Copy the old text item settings to the new one. Justifications are not copied // Copy the old text item settings to the new one. Justifications are not copied
@ -1653,7 +1651,7 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent )
// //
newtext->SetFlags( text->GetEditFlags() ); newtext->SetFlags( text->GetEditFlags() );
newtext->SetShape( text->GetShape() ); newtext->SetShape( text->GetShape() );
newtext->SetLabelSpinStyle( orientation ); newtext->SetTextSpinStyle( orientation );
newtext->SetTextSize( text->GetTextSize() ); newtext->SetTextSize( text->GetTextSize() );
newtext->SetTextThickness( text->GetTextThickness() ); newtext->SetTextThickness( text->GetTextThickness() );
newtext->SetItalic( text->IsItalic() ); newtext->SetItalic( text->IsItalic() );

View File

@ -1591,7 +1591,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
{ {
// If it wasn't content, then paste as content // If it wasn't content, then paste as content
SCH_TEXT* text_item = new SCH_TEXT( wxPoint( 0, 0 ), content ); SCH_TEXT* text_item = new SCH_TEXT( wxPoint( 0, 0 ), content );
text_item->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT ); // Left alignment text_item->SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT ); // Left alignment
tempScreen->Append( text_item ); tempScreen->Append( text_item );
} }

View File

@ -376,7 +376,7 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet, const VECTO
m_busUnfold.label = new SCH_LABEL( m_busUnfold.entry->GetEnd(), aNet ); m_busUnfold.label = new SCH_LABEL( m_busUnfold.entry->GetEnd(), aNet );
m_busUnfold.label->SetTextSize( wxSize( cfg.m_DefaultTextSize, cfg.m_DefaultTextSize ) ); m_busUnfold.label->SetTextSize( wxSize( cfg.m_DefaultTextSize, cfg.m_DefaultTextSize ) );
m_busUnfold.label->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT ); m_busUnfold.label->SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT );
m_busUnfold.label->SetParent( m_frame->GetScreen() ); m_busUnfold.label->SetParent( m_frame->GetScreen() );
m_busUnfold.label->SetFlags( IS_NEW | IS_MOVING ); m_busUnfold.label->SetFlags( IS_NEW | IS_MOVING );

View File

@ -583,7 +583,7 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, const VECTOR
// end. // end.
for( SCH_ITEM* item : itemsOverlapping ) for( SCH_ITEM* item : itemsOverlapping )
{ {
if( item->Type() == SCH_LABEL_T || item->Type() == SCH_NETCLASS_FLAG_T ) if( item->Type() == SCH_LABEL_T || item->Type() == SCH_DIRECTIVE_LABEL_T )
{ {
SCH_TEXT* label = static_cast<SCH_TEXT*>( item ); SCH_TEXT* label = static_cast<SCH_TEXT*>( item );
@ -647,7 +647,7 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, const VECTOR
case SCH_LABEL_T: case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T: case SCH_HIER_LABEL_T:
case SCH_NETCLASS_FLAG_T: case SCH_DIRECTIVE_LABEL_T:
// Performance optimization: // Performance optimization:
if( test->HasFlag( TEMP_SELECTED ) ) if( test->HasFlag( TEMP_SELECTED ) )
break; break;
@ -774,7 +774,7 @@ void SCH_MOVE_TOOL::moveItem( EDA_ITEM* aItem, const VECTOR2I& aDelta )
break; break;
} }
case SCH_LABEL_T: case SCH_LABEL_T:
case SCH_NETCLASS_FLAG_T: case SCH_DIRECTIVE_LABEL_T:
{ {
SCH_TEXT* label = static_cast<SCH_TEXT*>( aItem ); SCH_TEXT* label = static_cast<SCH_TEXT*>( aItem );

View File

@ -138,7 +138,7 @@ enum KICAD_T
SCH_LABEL_T, SCH_LABEL_T,
SCH_GLOBAL_LABEL_T, SCH_GLOBAL_LABEL_T,
SCH_HIER_LABEL_T, SCH_HIER_LABEL_T,
SCH_NETCLASS_FLAG_T, SCH_DIRECTIVE_LABEL_T,
SCH_FIELD_T, SCH_FIELD_T,
SCH_SYMBOL_T, SCH_SYMBOL_T,
SCH_SHEET_PIN_T, SCH_SHEET_PIN_T,
@ -349,7 +349,7 @@ constexpr bool IsEeschemaType( const KICAD_T aType )
case SCH_BITMAP_T: case SCH_BITMAP_T:
case SCH_TEXT_T: case SCH_TEXT_T:
case SCH_LABEL_T: case SCH_LABEL_T:
case SCH_NETCLASS_FLAG_T: case SCH_DIRECTIVE_LABEL_T:
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T: case SCH_HIER_LABEL_T:
case SCH_FIELD_T: case SCH_FIELD_T:

View File

@ -77,21 +77,21 @@ public:
switch( aType ) switch( aType )
{ {
case SCH_MARKER_T: return new SCH_MARKER( m_ercItem, wxPoint( 0, 0 ) ); case SCH_MARKER_T: return new SCH_MARKER( m_ercItem, wxPoint( 0, 0 ) );
case SCH_JUNCTION_T: return new SCH_JUNCTION(); case SCH_JUNCTION_T: return new SCH_JUNCTION();
case SCH_NO_CONNECT_T: return new SCH_NO_CONNECT(); case SCH_NO_CONNECT_T: return new SCH_NO_CONNECT();
case SCH_BUS_WIRE_ENTRY_T: return new SCH_BUS_WIRE_ENTRY(); case SCH_BUS_WIRE_ENTRY_T: return new SCH_BUS_WIRE_ENTRY();
case SCH_BUS_BUS_ENTRY_T: return new SCH_BUS_BUS_ENTRY(); case SCH_BUS_BUS_ENTRY_T: return new SCH_BUS_BUS_ENTRY();
case SCH_LINE_T: return new SCH_LINE(); case SCH_LINE_T: return new SCH_LINE();
case SCH_SHAPE_T: return new SCH_SHAPE( SHAPE_T::ARC ); case SCH_SHAPE_T: return new SCH_SHAPE( SHAPE_T::ARC );
case SCH_BITMAP_T: return new SCH_BITMAP(); case SCH_BITMAP_T: return new SCH_BITMAP();
case SCH_TEXT_T: return new SCH_TEXT( wxPoint( 0, 0 ), "test text" ); case SCH_TEXT_T: return new SCH_TEXT( wxPoint( 0, 0 ), "test text" );
case SCH_LABEL_T: return new SCH_LABEL( wxPoint( 0, 0 ), "test label" ); case SCH_LABEL_T: return new SCH_LABEL( wxPoint( 0, 0 ), "test label" );
case SCH_NETCLASS_FLAG_T: return new SCH_NETCLASS_FLAG( wxPoint( 0, 0 ) ); case SCH_DIRECTIVE_LABEL_T: return new SCH_DIRECTIVE_LABEL( wxPoint( 0, 0 ) );
case SCH_GLOBAL_LABEL_T: return new SCH_GLOBALLABEL(); case SCH_GLOBAL_LABEL_T: return new SCH_GLOBALLABEL();
case SCH_HIER_LABEL_T: return new SCH_HIERLABEL(); case SCH_HIER_LABEL_T: return new SCH_HIERLABEL();
case SCH_FIELD_T: return new SCH_FIELD( wxPoint( 0, 0 ), 0, nullptr ); case SCH_FIELD_T: return new SCH_FIELD( wxPoint( 0, 0 ), 0, nullptr );
case SCH_SYMBOL_T: return new SCH_SYMBOL(); case SCH_SYMBOL_T: return new SCH_SYMBOL();
case SCH_SHEET_PIN_T: case SCH_SHEET_PIN_T:
// XXX: m_sheet pins currently have to have their initial positions calculated manually. // XXX: m_sheet pins currently have to have their initial positions calculated manually.
@ -100,17 +100,16 @@ public:
m_sheet.GetPosition().y + Millimeter2iu( 40 ) ), m_sheet.GetPosition().y + Millimeter2iu( 40 ) ),
"test aPin" ); "test aPin" );
case SCH_SHEET_T: return new SCH_SHEET(); case SCH_SHEET_T: return new SCH_SHEET();
case LIB_SHAPE_T: return new LIB_SHAPE( &m_symbol, SHAPE_T::ARC ); case LIB_SHAPE_T: return new LIB_SHAPE( &m_symbol, SHAPE_T::ARC );
case LIB_TEXT_T: return new LIB_TEXT( &m_symbol ); case LIB_TEXT_T: return new LIB_TEXT( &m_symbol );
case LIB_PIN_T: return new LIB_PIN( &m_symbol ); case LIB_PIN_T: return new LIB_PIN( &m_symbol );
case LIB_FIELD_T: return new LIB_FIELD( &m_symbol ); case LIB_FIELD_T: return new LIB_FIELD( &m_symbol );
case SCHEMATIC_T: case SCHEMATIC_T:
case SCH_PIN_T: case SCH_PIN_T:
case LIB_SYMBOL_T: case LIB_SYMBOL_T:
case LIB_ALIAS_T: case LIB_ALIAS_T: return nullptr;
return nullptr;
default: default:
BOOST_FAIL( wxString::Format( BOOST_FAIL( wxString::Format(