ADDED: eeschema: Add intersheets references function
Add a new function to place intersheets references next to global labels.
This commit is contained in:
parent
ff463842a8
commit
2fc49045d1
|
@ -238,6 +238,7 @@ set( EESCHEMA_SRCS
|
|||
toolbars_lib_view.cpp
|
||||
toolbars_sch_editor.cpp
|
||||
transform.cpp
|
||||
sch_iref.cpp
|
||||
|
||||
netlist_exporters/netlist_exporter.cpp
|
||||
netlist_exporters/netlist_exporter_cadstar.cpp
|
||||
|
|
|
@ -66,4 +66,10 @@
|
|||
///< The offset of the pin name string from the end of the pin in mils.
|
||||
#define DEFAULT_PIN_NAME_OFFSET 20
|
||||
|
||||
///< The intersheets references prefix string
|
||||
#define DEFAULT_IREF_PREFIX "["
|
||||
|
||||
///< The intersheets references suffix string
|
||||
#define DEFAULT_IREF_SUFFIX "]"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <kicad_string.h>
|
||||
#include <tool/actions.h>
|
||||
#include <scintilla_tricks.h>
|
||||
#include <sch_iref.h>
|
||||
|
||||
class SCH_EDIT_FRAME;
|
||||
class SCH_TEXT;
|
||||
|
@ -345,6 +346,19 @@ bool DIALOG_LABEL_EDITOR::TransferDataFromWindow()
|
|||
m_Parent->GetCanvas()->Refresh();
|
||||
m_Parent->OnModify();
|
||||
|
||||
if( m_CurrentText->Type() == SCH_GLOBAL_LABEL_T )
|
||||
{
|
||||
SCH_GLOBALLABEL* label = static_cast<SCH_GLOBALLABEL*>( m_CurrentText );
|
||||
SCH_IREF* iref = label->GetIref();
|
||||
|
||||
if( iref )
|
||||
{
|
||||
if( iref->GetBoundingBox().Intersects( label->GetBoundingBox() ) )
|
||||
iref->PlaceAtDefaultPosition();
|
||||
iref->CopyParentStyle();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,6 +71,12 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow()
|
|||
m_pinSymbolSize.SetValue( settings.m_PinSymbolSize );
|
||||
m_junctionSize.SetValue( settings.m_JunctionSize );
|
||||
|
||||
m_showIntersheetsReferences->SetValue( settings.m_IntersheetsRefShow );
|
||||
m_radioFormatStandard->SetValue( !settings.m_IntersheetsRefFormatShort );
|
||||
m_radioFormatAbbreviated->SetValue( settings.m_IntersheetsRefFormatShort );
|
||||
m_prefixCtrl->ChangeValue( settings.m_IntersheetsRefPrefix );
|
||||
m_suffixCtrl->ChangeValue( settings.m_IntersheetsRefSuffix );
|
||||
|
||||
wxString offsetRatio = wxString::Format( "%f", settings.m_TextOffsetRatio * 100.0 );
|
||||
m_textOffsetRatioCtrl->SetValue( offsetRatio );
|
||||
|
||||
|
@ -108,6 +114,11 @@ bool PANEL_SETUP_FORMATTING::TransferDataFromWindow()
|
|||
settings.m_PinSymbolSize = (int) m_pinSymbolSize.GetValue();
|
||||
settings.m_JunctionSize = (int) m_junctionSize.GetValue();
|
||||
|
||||
settings.m_IntersheetsRefShow = m_showIntersheetsReferences->GetValue();
|
||||
settings.m_IntersheetsRefFormatShort = !m_radioFormatStandard->GetValue();
|
||||
settings.m_IntersheetsRefPrefix = m_prefixCtrl->GetValue();
|
||||
settings.m_IntersheetsRefSuffix = m_suffixCtrl->GetValue();
|
||||
|
||||
double dtmp = 0.0;
|
||||
wxString msg = m_textOffsetRatioCtrl->GetValue();
|
||||
msg.ToDouble( &dtmp );
|
||||
|
@ -133,6 +144,12 @@ void PANEL_SETUP_FORMATTING::ImportSettingsFrom( SCHEMATIC_SETTINGS& aSettings )
|
|||
m_pinSymbolSize.SetValue( aSettings.m_PinSymbolSize );
|
||||
m_junctionSize.SetValue( aSettings.m_JunctionSize );
|
||||
|
||||
m_showIntersheetsReferences->SetValue( aSettings.m_IntersheetsRefShow );
|
||||
m_radioFormatStandard->SetValue( aSettings.m_IntersheetsRefFormatShort );
|
||||
m_radioFormatAbbreviated->SetValue( !aSettings.m_IntersheetsRefFormatShort );
|
||||
m_prefixCtrl->ChangeValue( aSettings.m_IntersheetsRefPrefix );
|
||||
m_suffixCtrl->ChangeValue( aSettings.m_IntersheetsRefSuffix );
|
||||
|
||||
wxString offsetRatio = wxString::Format( "%f", aSettings.m_TextOffsetRatio * 100.0 );
|
||||
m_textOffsetRatioCtrl->SetValue( offsetRatio );
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// C++ code generated with wxFormBuilder (version 3.9.0 Sep 17 2020)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -147,16 +147,51 @@ PANEL_SETUP_FORMATTING_BASE::PANEL_SETUP_FORMATTING_BASE( wxWindow* parent, wxWi
|
|||
wxBoxSizer* bRightColumn;
|
||||
bRightColumn = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxStaticBoxSizer* sbSizerIREf;
|
||||
sbSizerIREf = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Intersheets References") ), wxVERTICAL );
|
||||
|
||||
m_showIntersheetsReferences = new wxCheckBox( sbSizerIREf->GetStaticBox(), wxID_ANY, _("Show intersheets references"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbSizerIREf->Add( m_showIntersheetsReferences, 0, wxALL, 5 );
|
||||
|
||||
m_radioFormatStandard = new wxRadioButton( sbSizerIREf->GetStaticBox(), wxID_ANY, _("Standard (1,2,3)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_radioFormatStandard->SetValue( true );
|
||||
sbSizerIREf->Add( m_radioFormatStandard, 0, wxALL, 5 );
|
||||
|
||||
m_radioFormatAbbreviated = new wxRadioButton( sbSizerIREf->GetStaticBox(), wxID_ANY, _("Abbreviated (1..3)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbSizerIREf->Add( m_radioFormatAbbreviated, 0, wxALL, 5 );
|
||||
|
||||
wxGridSizer* gSizer1;
|
||||
gSizer1 = new wxGridSizer( 0, 2, 0, 0 );
|
||||
|
||||
m_prefixLabel = new wxStaticText( sbSizerIREf->GetStaticBox(), wxID_ANY, _("Prefix"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_prefixLabel->Wrap( -1 );
|
||||
gSizer1->Add( m_prefixLabel, 0, wxALL, 5 );
|
||||
|
||||
m_prefixCtrl = new wxTextCtrl( sbSizerIREf->GetStaticBox(), wxID_ANY, _("["), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gSizer1->Add( m_prefixCtrl, 0, wxALL, 5 );
|
||||
|
||||
m_suffixLabel = new wxStaticText( sbSizerIREf->GetStaticBox(), wxID_ANY, _("Suffix"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_suffixLabel->Wrap( -1 );
|
||||
gSizer1->Add( m_suffixLabel, 0, wxALL, 5 );
|
||||
|
||||
m_suffixCtrl = new wxTextCtrl( sbSizerIREf->GetStaticBox(), wxID_ANY, _("]"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gSizer1->Add( m_suffixCtrl, 0, wxALL, 5 );
|
||||
|
||||
|
||||
sbSizerIREf->Add( gSizer1, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bRightColumn->Add( sbSizerIREf, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bRightColumn->Add( 0, 0, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bPanelSizer->Add( bRightColumn, 1, wxEXPAND, 5 );
|
||||
bPanelSizer->Add( bRightColumn, 1, wxLEFT|wxTOP, 10 );
|
||||
|
||||
|
||||
this->SetSizer( bPanelSizer );
|
||||
this->Layout();
|
||||
bPanelSizer->Fit( this );
|
||||
}
|
||||
|
||||
PANEL_SETUP_FORMATTING_BASE::~PANEL_SETUP_FORMATTING_BASE()
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<property name="file">panel_setup_formatting_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">PanelSetupFormatting</property>
|
||||
|
@ -25,6 +26,7 @@
|
|||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_array_enum">0</property>
|
||||
<property name="use_enum">1</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Panel" expanded="1">
|
||||
|
@ -43,7 +45,7 @@
|
|||
<property name="minimum_size"></property>
|
||||
<property name="name">PANEL_SETUP_FORMATTING_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="size">633,418</property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
|
@ -1242,14 +1244,484 @@
|
|||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="border">10</property>
|
||||
<property name="flag">wxLEFT|wxTOP</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bRightColumn</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBoxSizer" expanded="0">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Intersheets References</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">sbSizerIREf</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="parent">1</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Show intersheets references</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_showIntersheetsReferences</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxRadioButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Standard (1,2,3)</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_radioFormatStandard</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value">1</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxRadioButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Abbreviated (1..3)</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_radioFormatAbbreviated</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value">0</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxGridSizer" expanded="0">
|
||||
<property name="cols">2</property>
|
||||
<property name="hgap">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">gSizer1</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="rows">0</property>
|
||||
<property name="vgap">0</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Prefix</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_prefixLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_prefixCtrl</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value">[</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Suffix</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_suffixLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_suffixCtrl</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value">]</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// C++ code generated with wxFormBuilder (version 3.9.0 Sep 17 2020)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -20,6 +20,8 @@
|
|||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/radiobut.h>
|
||||
#include <wx/panel.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -49,10 +51,17 @@ class PANEL_SETUP_FORMATTING_BASE : public wxPanel
|
|||
wxStaticText* m_jctSizeLabel;
|
||||
wxTextCtrl* m_jctSizeCtrl;
|
||||
wxStaticText* m_jctSizeUnits;
|
||||
wxCheckBox* m_showIntersheetsReferences;
|
||||
wxRadioButton* m_radioFormatStandard;
|
||||
wxRadioButton* m_radioFormatAbbreviated;
|
||||
wxStaticText* m_prefixLabel;
|
||||
wxTextCtrl* m_prefixCtrl;
|
||||
wxStaticText* m_suffixLabel;
|
||||
wxTextCtrl* m_suffixCtrl;
|
||||
|
||||
public:
|
||||
|
||||
PANEL_SETUP_FORMATTING_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
|
||||
PANEL_SETUP_FORMATTING_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 633,418 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
|
||||
~PANEL_SETUP_FORMATTING_BASE();
|
||||
|
||||
};
|
||||
|
|
|
@ -338,6 +338,7 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
|
|||
|
||||
m_params.emplace_back( new PARAM<wxString>( "system.last_symbol_lib_dir",
|
||||
&m_lastSymbolLibDir, "" ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -73,6 +73,10 @@ public:
|
|||
wxString field_names;
|
||||
bool hv_lines_only;
|
||||
int repeat_label_increment;
|
||||
bool intersheets_ref_show;
|
||||
bool intersheets_ref_short;
|
||||
wxString intersheets_ref_prefix;
|
||||
wxString intersheets_ref_suffix;
|
||||
};
|
||||
|
||||
struct INPUT
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
#include <wildcards_and_files_ext.h>
|
||||
#include <ws_data_model.h>
|
||||
|
||||
|
||||
bool SCH_EDIT_FRAME::SaveEEFile( SCH_SHEET* aSheet, bool aSaveUnderNewName )
|
||||
{
|
||||
wxString msg;
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include <project/project_file.h>
|
||||
#include <reporter.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <sch_iref.h>
|
||||
#include <sch_painter.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <schematic.h>
|
||||
|
@ -1132,6 +1133,7 @@ void SCH_EDIT_FRAME::UpdateTitle()
|
|||
|
||||
void SCH_EDIT_FRAME::RecalculateConnections( SCH_CLEANUP_FLAGS aCleanupFlags )
|
||||
{
|
||||
SCHEMATIC_SETTINGS& settings = Schematic().Settings();
|
||||
SCH_SHEET_LIST list = Schematic().GetSheets();
|
||||
PROF_COUNTER timer;
|
||||
|
||||
|
@ -1149,14 +1151,182 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_CLEANUP_FLAGS aCleanupFlags )
|
|||
timer.Stop();
|
||||
wxLogTrace( "CONN_PROFILE", "SchematicCleanUp() %0.4f ms", timer.msecs() );
|
||||
|
||||
if( settings.m_IntersheetsRefShow == true )
|
||||
RecomputeIntersheetsRefs();
|
||||
|
||||
Schematic().ConnectionGraph()->Recalculate( list, true );
|
||||
}
|
||||
|
||||
int SCH_EDIT_FRAME::RecomputeIntersheetsRefs()
|
||||
{
|
||||
SCHEMATIC_SETTINGS& settings = Schematic().Settings();
|
||||
std::vector<int> pagesNumbers;
|
||||
SCH_GLOBALLABEL* gLabel;
|
||||
SCH_IREF* iref;
|
||||
|
||||
m_labelTable.clear();
|
||||
|
||||
SCH_SCREENS screens( Schematic().Root() );
|
||||
|
||||
/* Iterate over screens */
|
||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen != NULL; screen = screens.GetNext() )
|
||||
{
|
||||
|
||||
pagesNumbers.clear();
|
||||
|
||||
/* Find in which sheets this screen is used */
|
||||
for( const SCH_SHEET_PATH& sheet : Schematic().GetSheets() )
|
||||
{
|
||||
|
||||
if( sheet.LastScreen() == screen )
|
||||
pagesNumbers.push_back( sheet.GetPageNumber() );
|
||||
|
||||
}
|
||||
|
||||
for( SCH_ITEM* item : screen->Items() )
|
||||
{
|
||||
|
||||
if( item->Type() == SCH_GLOBAL_LABEL_T )
|
||||
{
|
||||
gLabel = static_cast<SCH_GLOBALLABEL*>( item );
|
||||
m_labelTable.push_back( gLabel );
|
||||
|
||||
if( gLabel->GetIref() == nullptr )
|
||||
{
|
||||
iref = new SCH_IREF();
|
||||
gLabel->SetIref( iref );
|
||||
|
||||
iref->SetParent( gLabel );
|
||||
iref->SetFlags( IS_NEW );
|
||||
iref->SetScreen( screen );
|
||||
|
||||
if( gLabel->GetIrefSavedPosition() != wxDefaultPosition )
|
||||
iref->SetPosition( gLabel->GetIrefSavedPosition() );
|
||||
else
|
||||
iref->PlaceAtDefaultPosition();
|
||||
|
||||
iref->CopyParentStyle();
|
||||
}
|
||||
else
|
||||
{
|
||||
iref = gLabel->GetIref();
|
||||
}
|
||||
|
||||
iref->GetRefTable()->clear();
|
||||
iref->GetRefTable()->insert( iref->GetRefTable()->end(),
|
||||
pagesNumbers.begin(),
|
||||
pagesNumbers.end() );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Fill intersheets references for each global label */
|
||||
for( SCH_GLOBALLABEL* item : m_labelTable )
|
||||
{
|
||||
for( SCH_GLOBALLABEL* iter : m_labelTable )
|
||||
{
|
||||
if( iter->GetText().IsSameAs( item->GetText() ) && ( iter != item ) )
|
||||
iter->GetIref()->GetRefTable()->insert( iter->GetIref()->GetRefTable()->end(),
|
||||
item->GetIref()->GetRefTable()->begin(),
|
||||
item->GetIref()->GetRefTable()->end() );
|
||||
}
|
||||
}
|
||||
|
||||
/* Refresh all global labels */
|
||||
for( SCH_GLOBALLABEL* item : m_labelTable )
|
||||
{
|
||||
wxString text, tmp;
|
||||
|
||||
iref = item->GetIref();
|
||||
|
||||
sort( iref->GetRefTable()->begin(), iref->GetRefTable()->end() );
|
||||
iref->GetRefTable()->erase( unique( iref->GetRefTable()->begin(), iref->GetRefTable()->end() ),
|
||||
iref->GetRefTable()->end() );
|
||||
|
||||
text.Printf( "%s", settings.m_IntersheetsRefPrefix );
|
||||
|
||||
if( ( settings.m_IntersheetsRefFormatShort ) && ( iref->GetRefTable()->size() > 2 ) )
|
||||
{
|
||||
tmp.Printf( "%d..%d", iref->GetRefTable()->front(), iref->GetRefTable()->back() );
|
||||
text.Append( tmp );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
for( int ref : *( iref->GetRefTable() ) )
|
||||
{
|
||||
tmp.Printf( "%d,", ref );
|
||||
text.Append( tmp );
|
||||
}
|
||||
|
||||
if( text.Last() == ',' )
|
||||
text.RemoveLast();
|
||||
}
|
||||
|
||||
text.Append( settings.m_IntersheetsRefSuffix );
|
||||
|
||||
iref->SetText( text );
|
||||
|
||||
SCH_SCREEN* screen = iref->GetScreen();
|
||||
|
||||
if( !screen->CheckIfOnDrawList( iref ) )
|
||||
AddToScreen( iref, screen );
|
||||
|
||||
iref->ClearFlags( IS_NEW );
|
||||
|
||||
screen->SetModify();
|
||||
Refresh( iref );
|
||||
|
||||
iref->ClearEditFlags();
|
||||
GetCanvas()->Refresh();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SCH_EDIT_FRAME::RemoveAllIntersheetsRefs()
|
||||
{
|
||||
SCH_SHEET_LIST sheets = Schematic().GetSheets();
|
||||
std::vector<SCH_IREF*> irefList;
|
||||
SCH_GLOBALLABEL* gLabel;
|
||||
|
||||
SCH_SCREENS screens( Schematic().Root() );
|
||||
|
||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
|
||||
{
|
||||
|
||||
for( SCH_ITEM* item : screen->Items() )
|
||||
{
|
||||
if( item->Type() == SCH_GLOBAL_LABEL_T )
|
||||
{
|
||||
gLabel = (SCH_GLOBALLABEL*)( item );
|
||||
SCH_IREF* iref = gLabel->GetIref();
|
||||
|
||||
if( iref )
|
||||
{
|
||||
gLabel->SetIref( nullptr );
|
||||
gLabel->SetIrefSavedPosition( wxDefaultPosition );
|
||||
irefList.push_back( iref );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for( SCH_IREF* iref : irefList )
|
||||
RemoveFromScreen( iref, iref->GetScreen() );
|
||||
}
|
||||
|
||||
void SCH_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
|
||||
{
|
||||
SCHEMATIC_SETTINGS& settings = Schematic().Settings();
|
||||
SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
|
||||
|
||||
if( settings.m_IntersheetsRefShow == false )
|
||||
RemoveAllIntersheetsRefs();
|
||||
else
|
||||
RecomputeIntersheetsRefs();
|
||||
|
||||
GetCanvas()->GetView()->UpdateAllItems( KIGFX::ALL );
|
||||
GetCanvas()->Refresh();
|
||||
|
||||
|
|
|
@ -136,6 +136,8 @@ private:
|
|||
|
||||
static PINSHEETLABEL_SHAPE m_lastSheetPinType; ///< Last sheet pin type.
|
||||
|
||||
std::vector<SCH_GLOBALLABEL*> m_labelTable;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Save the schematic files that have been modified and not yet saved.
|
||||
|
@ -946,6 +948,10 @@ public:
|
|||
*/
|
||||
void UpdateSymbolFromEditor( const LIB_PART& aSymbol );
|
||||
|
||||
int RecomputeIntersheetsRefs();
|
||||
|
||||
void RemoveAllIntersheetsRefs();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019-2020 Franck Jullien, franck.jullien at gmail.com
|
||||
* Copyright (C) 2019 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
|
||||
*/
|
||||
|
||||
#include <sch_text.h>
|
||||
#include <sch_iref.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <schematic.h>
|
||||
#include <tools/sch_editor_control.h>
|
||||
#include <tool/tool_manager.h>
|
||||
|
||||
SCH_IREF::SCH_IREF( const wxPoint& pos, const wxString& text, SCH_GLOBALLABEL* aParent, KICAD_T aType )
|
||||
: SCH_TEXT( pos, text, SCH_IREF_T )
|
||||
|
||||
{
|
||||
m_Layer = LAYER_GLOBLABEL;
|
||||
m_parent = aParent;
|
||||
SetMultilineAllowed( false );
|
||||
}
|
||||
|
||||
void SCH_IREF::PlaceAtDefaultPosition()
|
||||
{
|
||||
wxPoint offset;
|
||||
|
||||
int labelLen = m_parent->GetBoundingBox().GetSizeMax();
|
||||
|
||||
switch( m_parent->GetLabelSpinStyle() )
|
||||
{
|
||||
default:
|
||||
case LABEL_SPIN_STYLE::LEFT: offset.x -= labelLen; break;
|
||||
case LABEL_SPIN_STYLE::UP: offset.y -= labelLen; break;
|
||||
case LABEL_SPIN_STYLE::RIGHT: offset.x += labelLen; break;
|
||||
case LABEL_SPIN_STYLE::BOTTOM: offset.y += labelLen; break;
|
||||
}
|
||||
|
||||
SetTextPos( m_parent->GetPosition() + offset );
|
||||
}
|
||||
|
||||
wxPoint SCH_IREF::GetSchematicTextOffset( RENDER_SETTINGS* aSettings ) const
|
||||
{
|
||||
return m_parent->GetSchematicTextOffset( aSettings );
|
||||
}
|
||||
|
||||
EDA_ITEM* SCH_IREF::Clone() const
|
||||
{
|
||||
return new SCH_IREF( *this );
|
||||
}
|
||||
|
||||
void SCH_IREF::SetIrefOrientation( LABEL_SPIN_STYLE aSpinStyle )
|
||||
{
|
||||
wxPoint pt = GetTextPos() - GetParent()->GetPosition();
|
||||
int offset = std::max( abs( pt.x ), abs( pt.y ) );
|
||||
|
||||
switch( aSpinStyle )
|
||||
{
|
||||
case LABEL_SPIN_STYLE::RIGHT:
|
||||
SetTextAngle( TEXT_ANGLE_HORIZ );
|
||||
SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||
SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||
pt.y = 0;
|
||||
pt.x = offset;
|
||||
break;
|
||||
case LABEL_SPIN_STYLE::UP:
|
||||
SetTextAngle( TEXT_ANGLE_VERT );
|
||||
SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||
SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||
pt.y = -offset;
|
||||
pt.x = 0;
|
||||
break;
|
||||
case LABEL_SPIN_STYLE::LEFT:
|
||||
SetTextAngle( TEXT_ANGLE_HORIZ );
|
||||
SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
||||
SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||
pt.y = 0;
|
||||
pt.x = -offset;
|
||||
break;
|
||||
case LABEL_SPIN_STYLE::BOTTOM:
|
||||
SetTextAngle( TEXT_ANGLE_VERT );
|
||||
SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
||||
SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||
pt.y = offset;
|
||||
pt.x = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
SetPosition( GetParent()->GetPosition() + pt );
|
||||
}
|
||||
|
||||
void SCH_IREF::CopyParentStyle()
|
||||
{
|
||||
SetTextSize( m_parent->GetTextSize() );
|
||||
SetItalic( m_parent->IsItalic() );
|
||||
SetBold( m_parent->IsBold() );
|
||||
SetTextThickness( m_parent->GetTextThickness() );
|
||||
SetIrefOrientation( m_parent->GetLabelSpinStyle() );
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2019 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file sch_iref.h
|
||||
* @brief Definitions of the SCH_IREF class and derivatives for Eeschema.
|
||||
*/
|
||||
|
||||
#ifndef CLASS_IREF_H
|
||||
#define CLASS_IREF_H
|
||||
|
||||
|
||||
#include <macros.h>
|
||||
|
||||
class SCH_TEXT;
|
||||
class SCH_GLOBALLABEL;
|
||||
|
||||
class SCH_IREF : public SCH_TEXT
|
||||
{
|
||||
public:
|
||||
SCH_IREF( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
|
||||
SCH_GLOBALLABEL* aParent = nullptr, KICAD_T aType = SCH_IREF_T );
|
||||
|
||||
~SCH_IREF() { }
|
||||
|
||||
static inline bool ClassOf( const EDA_ITEM* aItem )
|
||||
{
|
||||
return aItem && SCH_IREF_T == aItem->Type();
|
||||
}
|
||||
|
||||
wxString GetClass() const override
|
||||
{
|
||||
return wxT( "SCH_IREF" );
|
||||
}
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
std::vector<int>* GetRefTable() { return &m_refTable; }
|
||||
|
||||
bool IsDangling() const override { return false; }
|
||||
|
||||
wxPoint GetSchematicTextOffset() const
|
||||
{
|
||||
return wxPoint(0, 0);
|
||||
}
|
||||
|
||||
void CopyParentStyle();
|
||||
void PlaceAtDefaultPosition();
|
||||
|
||||
wxPoint GetSchematicTextOffset( RENDER_SETTINGS* aSettings ) const override;
|
||||
|
||||
SCH_GLOBALLABEL* GetParent() { return m_parent; }
|
||||
|
||||
void SetParent( SCH_GLOBALLABEL* parent ) { m_parent = parent; }
|
||||
|
||||
int GetOwnPageNumber() { return m_ownPageNumber; }
|
||||
|
||||
void SetOwnPageNumber( int page ) { m_ownPageNumber = page; }
|
||||
|
||||
SCH_SCREEN* GetScreen() { return m_screen; }
|
||||
|
||||
void SetScreen( SCH_SCREEN* screen ) { m_screen = screen; }
|
||||
|
||||
private:
|
||||
void SetIrefOrientation( LABEL_SPIN_STYLE aSpinStyle );
|
||||
|
||||
std::vector<int> m_refTable;
|
||||
SCH_GLOBALLABEL* m_parent;
|
||||
int m_ownPageNumber;
|
||||
SCH_SCREEN* m_screen;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -51,6 +51,7 @@
|
|||
#include <sch_component.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <sch_field.h>
|
||||
#include <sch_iref.h>
|
||||
#include <sch_junction.h>
|
||||
#include <sch_line.h>
|
||||
#include <sch_marker.h>
|
||||
|
@ -220,6 +221,7 @@ bool SCH_PAINTER::Draw( const VIEW_ITEM *aItem, int aLayer )
|
|||
HANDLE_ITEM( SCH_BUS_BUS_ENTRY_T, SCH_BUS_ENTRY_BASE );
|
||||
HANDLE_ITEM( SCH_BITMAP_T, SCH_BITMAP );
|
||||
HANDLE_ITEM( SCH_MARKER_T, SCH_MARKER );
|
||||
HANDLE_ITEM( SCH_IREF_T, SCH_TEXT );
|
||||
|
||||
default: return false;
|
||||
}
|
||||
|
@ -1287,6 +1289,7 @@ void SCH_PAINTER::draw( SCH_TEXT *aText, int aLayer )
|
|||
case SCH_SHEET_PIN_T: aLayer = LAYER_SHEETLABEL; break;
|
||||
case SCH_HIER_LABEL_T: aLayer = LAYER_HIERLABEL; break;
|
||||
case SCH_GLOBAL_LABEL_T: aLayer = LAYER_GLOBLABEL; break;
|
||||
case SCH_IREF_T: aLayer = LAYER_GLOBLABEL; break;
|
||||
case SCH_LABEL_T: aLayer = LAYER_LOCLABEL; break;
|
||||
default: aLayer = LAYER_NOTES; break;
|
||||
}
|
||||
|
@ -1352,6 +1355,7 @@ void SCH_PAINTER::draw( SCH_TEXT *aText, int aLayer )
|
|||
drawDanglingSymbol( aText->GetTextPos(), Mils2iu( DANGLING_SYMBOL_SIZE / 2 ),
|
||||
drawingShadows );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2692,8 +2692,19 @@ SCH_TEXT* SCH_SEXPR_PARSER::parseSchText()
|
|||
parseEDA_TEXT( static_cast<EDA_TEXT*>( text.get() ) );
|
||||
break;
|
||||
|
||||
case T_iref:
|
||||
{
|
||||
if( text->Type() == SCH_GLOBAL_LABEL_T )
|
||||
{
|
||||
SCH_GLOBALLABEL* label = static_cast<SCH_GLOBALLABEL*>( text.get() );
|
||||
label->SetIrefSavedPosition( parseXY() );
|
||||
NeedRIGHT();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
Expecting( "at, shape, or effects" );
|
||||
Expecting( "at, shape, iref or effects" );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <sch_line.h>
|
||||
#include <sch_no_connect.h>
|
||||
#include <sch_text.h>
|
||||
#include <sch_iref.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <schematic.h>
|
||||
#include <sch_sexpr_plugin.h>
|
||||
|
@ -1181,6 +1182,18 @@ void SCH_SEXPR_PLUGIN::saveText( SCH_TEXT* aText, int aNestLevel )
|
|||
if( ( aText->Type() == SCH_GLOBAL_LABEL_T ) || ( aText->Type() == SCH_HIER_LABEL_T ) )
|
||||
m_out->Print( 0, " (shape %s)", getSheetPinShapeToken( aText->GetShape() ) );
|
||||
|
||||
if( ( aText->Type() == SCH_GLOBAL_LABEL_T ) )
|
||||
{
|
||||
SCH_GLOBALLABEL* label = static_cast<SCH_GLOBALLABEL*>( aText );
|
||||
|
||||
if( label->GetIref() != nullptr )
|
||||
{
|
||||
SCH_IREF* iref = label->GetIref();
|
||||
m_out->Print( 0, " (iref %s %s)", FormatInternalUnits( iref->GetPosition().x ).c_str(),
|
||||
FormatInternalUnits( iref->GetPosition().y ).c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
if( aText->GetText().Length() < 50 )
|
||||
{
|
||||
m_out->Print( 0, " (at %s %s %s)",
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include <html_messagebox.h>
|
||||
#include <project/project_file.h>
|
||||
#include <project/net_settings.h>
|
||||
#include <sch_iref.h>
|
||||
|
||||
using KIGFX::SCH_RENDER_SETTINGS;
|
||||
|
||||
|
@ -808,7 +809,9 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text )
|
|||
m_Layer = LAYER_GLOBLABEL;
|
||||
m_shape = PINSHEETLABEL_SHAPE::PS_BIDI;
|
||||
m_isDangling = true;
|
||||
m_iref = nullptr;
|
||||
SetMultilineAllowed( false );
|
||||
m_savedIrefPos = wxDefaultPosition;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
class NETLIST_OBJECT_LIST;
|
||||
class HTML_MESSAGE_BOX;
|
||||
|
||||
class SCH_IREF;
|
||||
|
||||
/*
|
||||
* Spin style for text items of all kinds on schematics
|
||||
|
@ -418,8 +418,16 @@ public:
|
|||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
SCH_IREF* GetIref() { return m_iref; }
|
||||
void SetIref( SCH_IREF* iref ) { m_iref = iref; }
|
||||
|
||||
wxPoint GetIrefSavedPosition() { return m_savedIrefPos; }
|
||||
void SetIrefSavedPosition( wxPoint pos ) { m_savedIrefPos = pos; }
|
||||
|
||||
private:
|
||||
bool doIsConnected( const wxPoint& aPosition ) const override { return EDA_TEXT::GetTextPos() == aPosition; }
|
||||
SCH_IREF* m_iref;
|
||||
wxPoint m_savedIrefPos;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ rev
|
|||
right
|
||||
scale
|
||||
shape
|
||||
iref
|
||||
sheet
|
||||
size
|
||||
solid
|
||||
|
|
|
@ -41,7 +41,11 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
|
|||
m_TextOffsetRatio( 0.08 ),
|
||||
m_PinSymbolSize( DEFAULT_TEXT_SIZE * IU_PER_MILS / 2 ),
|
||||
m_JunctionSize( DEFAULT_JUNCTION_DIAM * IU_PER_MILS ),
|
||||
m_SpiceAdjustPassiveValues( false )
|
||||
m_SpiceAdjustPassiveValues( false ),
|
||||
m_IntersheetsRefShow ( false ),
|
||||
m_IntersheetsRefFormatShort (false ),
|
||||
m_IntersheetsRefPrefix ( DEFAULT_IREF_PREFIX ),
|
||||
m_IntersheetsRefSuffix ( DEFAULT_IREF_SUFFIX )
|
||||
{
|
||||
EESCHEMA_SETTINGS* appSettings = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
|
||||
|
@ -57,6 +61,26 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
|
|||
appSettings ? appSettings->m_Drawing.pin_symbol_size : DEFAULT_TEXT_SIZE / 2;
|
||||
int defaultJunctionSize =
|
||||
appSettings ? appSettings->m_Drawing.default_junction_size : DEFAULT_JUNCTION_DIAM;
|
||||
bool defaultIntersheetsRefShow =
|
||||
appSettings ? appSettings->m_Drawing.intersheets_ref_show : false;
|
||||
bool defaultIntersheetsRefFormatShort =
|
||||
appSettings ? appSettings->m_Drawing.intersheets_ref_short : false;
|
||||
wxString defaultIntersheetsRefPrefix =
|
||||
appSettings ? appSettings->m_Drawing.intersheets_ref_prefix : DEFAULT_IREF_PREFIX;
|
||||
wxString defaultIntersheetsRefSuffix =
|
||||
appSettings ? appSettings->m_Drawing.intersheets_ref_suffix : DEFAULT_IREF_SUFFIX;
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "drawing.intersheets_ref_show",
|
||||
&m_IntersheetsRefShow, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "drawing.intersheets_ref_short",
|
||||
&m_IntersheetsRefFormatShort, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<wxString>( "drawing.intersheets_ref_prefix",
|
||||
&m_IntersheetsRefPrefix, "[" ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<wxString>( "drawing.intersheets_ref_suffix",
|
||||
&m_IntersheetsRefSuffix, "]" ) );
|
||||
|
||||
m_params.emplace_back( new PARAM_SCALED<int>( "drawing.default_line_thickness",
|
||||
&m_DefaultLineWidth, Mils2iu( defaultLineThickness ),
|
||||
|
|
|
@ -50,6 +50,11 @@ public:
|
|||
int m_PinSymbolSize;
|
||||
int m_JunctionSize;
|
||||
|
||||
bool m_IntersheetsRefShow;
|
||||
bool m_IntersheetsRefFormatShort;
|
||||
wxString m_IntersheetsRefPrefix;
|
||||
wxString m_IntersheetsRefSuffix;
|
||||
|
||||
wxString m_PageLayoutDescrFile;
|
||||
|
||||
wxString m_PlotDirectoryName;
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <sch_bitmap.h>
|
||||
#include <sch_view.h>
|
||||
#include <sch_line.h>
|
||||
#include <sch_iref.h>
|
||||
#include <sch_bus_entry.h>
|
||||
#include <sch_junction.h>
|
||||
#include <sch_edit_frame.h>
|
||||
|
@ -458,6 +459,15 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
else
|
||||
textItem->SetLabelSpinStyle( textItem->GetLabelSpinStyle().RotateCCW() );
|
||||
|
||||
if( item->Type() == SCH_GLOBAL_LABEL_T )
|
||||
{
|
||||
SCH_GLOBALLABEL* label = static_cast<SCH_GLOBALLABEL*>( item );
|
||||
SCH_IREF* iref = label->GetIref();
|
||||
|
||||
if( iref )
|
||||
iref->CopyParentStyle();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -641,6 +651,16 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
|
|||
textItem->SetLabelSpinStyle( textItem->GetLabelSpinStyle().MirrorX() );
|
||||
else
|
||||
textItem->SetLabelSpinStyle( textItem->GetLabelSpinStyle().MirrorY() );
|
||||
|
||||
if( item->Type() == SCH_GLOBAL_LABEL_T )
|
||||
{
|
||||
SCH_GLOBALLABEL* label = static_cast<SCH_GLOBALLABEL*>( item );
|
||||
SCH_IREF* iref = label->GetIref();
|
||||
|
||||
if( iref )
|
||||
iref->CopyParentStyle();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -828,6 +848,14 @@ int SCH_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
|||
case SCH_NO_CONNECT_T:
|
||||
newItem->SetParent( m_frame->GetScreen() );
|
||||
m_frame->AddToScreen( newItem, m_frame->GetScreen() );
|
||||
|
||||
if( newItem->Type() == SCH_GLOBAL_LABEL_T )
|
||||
{
|
||||
SCH_GLOBALLABEL* label = static_cast<SCH_GLOBALLABEL*>( newItem );
|
||||
label->SetIref( nullptr );
|
||||
label->SetIrefSavedPosition( wxDefaultPosition );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SCH_SHEET_T:
|
||||
|
@ -1028,6 +1056,16 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||
|
||||
sheet->RemovePin( pin );
|
||||
}
|
||||
else if( sch_item->Type() == SCH_GLOBAL_LABEL_T )
|
||||
{
|
||||
SCH_GLOBALLABEL* label = (SCH_GLOBALLABEL*) sch_item;
|
||||
SCH_IREF* iref = label->GetIref();
|
||||
|
||||
m_frame->RemoveFromScreen( sch_item, m_frame->GetScreen() );
|
||||
|
||||
if( iref )
|
||||
m_frame->RemoveFromScreen( iref, m_frame->GetScreen() );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->RemoveFromScreen( sch_item, m_frame->GetScreen() );
|
||||
|
|
|
@ -1529,6 +1529,13 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
|||
updatePastedInstances( pastePath, clipPath, sheet, forceKeepAnnotations );
|
||||
}
|
||||
|
||||
if( item->Type() == SCH_GLOBAL_LABEL_T )
|
||||
{
|
||||
SCH_GLOBALLABEL* label = static_cast<SCH_GLOBALLABEL*>( item );
|
||||
label->SetIref( nullptr );
|
||||
label->SetIrefSavedPosition( wxDefaultPosition );
|
||||
}
|
||||
|
||||
item->SetFlags( IS_NEW | IS_PASTED | IS_MOVED );
|
||||
m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), (SCH_ITEM*) item, i > 0 );
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <ee_actions.h>
|
||||
#include <bitmaps.h>
|
||||
#include <base_struct.h>
|
||||
#include <sch_iref.h>
|
||||
#include <sch_item.h>
|
||||
#include <sch_component.h>
|
||||
#include <sch_sheet.h>
|
||||
|
@ -97,6 +98,7 @@ static const KICAD_T movableItems[] =
|
|||
SCH_COMPONENT_T,
|
||||
SCH_SHEET_PIN_T,
|
||||
SCH_SHEET_T,
|
||||
SCH_IREF_T,
|
||||
EOT
|
||||
};
|
||||
|
||||
|
@ -703,6 +705,36 @@ void SCH_MOVE_TOOL::moveItem( EDA_ITEM* aItem, const VECTOR2I& aDelta )
|
|||
|
||||
break;
|
||||
}
|
||||
case SCH_GLOBAL_LABEL_T:
|
||||
{
|
||||
SCH_GLOBALLABEL* label = static_cast<SCH_GLOBALLABEL*>( aItem );
|
||||
EDA_ITEM* iref = (EDA_ITEM*) ( label->GetIref() );
|
||||
static_cast<SCH_ITEM*>( aItem )->Move( (wxPoint) aDelta );
|
||||
|
||||
if( iref )
|
||||
static_cast<SCH_ITEM*>( iref )->Move( (wxPoint) aDelta );
|
||||
|
||||
break;
|
||||
}
|
||||
case SCH_IREF_T:
|
||||
{
|
||||
SCH_IREF* iref = static_cast<SCH_IREF*>( aItem );
|
||||
wxPoint pt = (wxPoint) aDelta;
|
||||
|
||||
int style = iref->GetParent()->GetLabelSpinStyle();
|
||||
|
||||
if( iref->GetParent()->IsSelected() )
|
||||
break;
|
||||
|
||||
if( ( style == LABEL_SPIN_STYLE::RIGHT ) || ( style == LABEL_SPIN_STYLE::LEFT ) )
|
||||
pt.y = 0;
|
||||
|
||||
if( ( style == LABEL_SPIN_STYLE::UP ) || ( style == LABEL_SPIN_STYLE::BOTTOM ) )
|
||||
pt.x = 0;
|
||||
|
||||
iref->Move( pt );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
static_cast<SCH_ITEM*>( aItem )->Move( (wxPoint) aDelta );
|
||||
break;
|
||||
|
|
|
@ -137,6 +137,7 @@ enum KICAD_T
|
|||
SCH_SHEET_PIN_T,
|
||||
SCH_SHEET_T,
|
||||
SCH_PIN_T,
|
||||
SCH_IREF_T,
|
||||
|
||||
// Be prudent with these types:
|
||||
// they should be used only to locate a specific field type among SCH_FIELD_Ts
|
||||
|
|
Loading…
Reference in New Issue