Fix a few bugs with Sheet field dragging and rotating.

Fixes https://gitlab.com/kicad/code/kicad/issues/4046
This commit is contained in:
Jeff Young 2020-03-12 13:56:44 +00:00
parent 78a7c7dfe0
commit dc9882c3b9
9 changed files with 223 additions and 606 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -12,136 +12,137 @@
DIALOG_SCH_FIND_BASE::DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* topSizer;
topSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* leftSizer;
leftSizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* leftGridSizer;
leftGridSizer = new wxFlexGridSizer( 3, 2, 3, 3 );
leftGridSizer->AddGrowableCol( 1 );
leftGridSizer->SetFlexibleDirection( wxBOTH );
leftGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("&Search for:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
leftGridSizer->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL, 6 );
m_comboFind = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN|wxTE_PROCESS_ENTER );
m_comboFind = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN|wxTE_PROCESS_ENTER );
m_comboFind->SetToolTip( _("Text with optional wildcards") );
m_comboFind->SetMinSize( wxSize( 220,-1 ) );
leftGridSizer->Add( m_comboFind, 0, wxEXPAND, 6 );
m_staticReplace = new wxStaticText( this, wxID_ANY, _("Replace &with:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticReplace->Wrap( -1 );
m_staticReplace->Hide();
leftGridSizer->Add( m_staticReplace, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_comboReplace = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER );
m_comboReplace = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER );
m_comboReplace->Hide();
leftGridSizer->Add( m_comboReplace, 0, wxEXPAND, 5 );
m_staticDirection = new wxStaticText( this, wxID_ANY, _("Direction:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticDirection->Wrap( -1 );
m_staticDirection->Hide();
leftGridSizer->Add( m_staticDirection, 0, 0, 5 );
wxBoxSizer* directionSizer;
directionSizer = new wxBoxSizer( wxVERTICAL );
m_radioForward = new wxRadioButton( this, wxID_ANY, _("F&orward"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_radioForward->Hide();
directionSizer->Add( m_radioForward, 0, wxALL, 3 );
m_radioBackward = new wxRadioButton( this, wxID_ANY, _("&Backward"), wxDefaultPosition, wxDefaultSize, 0 );
m_radioBackward->Hide();
directionSizer->Add( m_radioBackward, 0, wxALL, 3 );
leftGridSizer->Add( directionSizer, 1, wxEXPAND, 5 );
leftSizer->Add( leftGridSizer, 0, wxALL|wxEXPAND, 5 );
wxGridBagSizer* gbSizer2;
gbSizer2 = new wxGridBagSizer( 0, 20 );
gbSizer2->SetFlexibleDirection( wxHORIZONTAL );
gbSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_NONE );
m_checkMatchCase = new wxCheckBox( this, wxID_ANY, _("&Match case"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_checkMatchCase, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_checkWholeWord = new wxCheckBox( this, wxID_ANY, _("Words"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkWholeWord->SetValue(true);
m_checkWholeWord->SetValue(true);
gbSizer2->Add( m_checkWholeWord, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_checkWildcardMatch = new wxCheckBox( this, wxID_ANY, _("Wildcards"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_checkWildcardMatch, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_checkAllFields = new wxCheckBox( this, wxID_ANY, _("Search all com&ponent fields"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkAllFields = new wxCheckBox( this, wxID_ANY, _("Search user-defined fields"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_checkAllFields, wxGBPosition( 1, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkAllPins = new wxCheckBox( this, wxID_ANY, _("Search all pin &names and numbers"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkAllPins = new wxCheckBox( this, wxID_ANY, _("Search pin &names and numbers"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_checkAllPins, wxGBPosition( 2, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkCurrentSheetOnly = new wxCheckBox( this, wxID_ANY, _("Search the current &sheet only"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_checkCurrentSheetOnly, wxGBPosition( 3, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkReplaceReferences = new wxCheckBox( this, wxID_ANY, _("Replace componen&t reference designators"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkReplaceReferences->Hide();
gbSizer2->Add( m_checkReplaceReferences, wxGBPosition( 4, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
leftSizer->Add( gbSizer2, 1, wxEXPAND, 5 );
topSizer->Add( leftSizer, 1, wxEXPAND|wxALL, 5 );
wxBoxSizer* rightSizer;
rightSizer = new wxBoxSizer( wxVERTICAL );
m_buttonFind = new wxButton( this, wxID_FIND, _("&Find"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonFind->SetDefault();
m_buttonFind->SetDefault();
rightSizer->Add( m_buttonFind, 0, wxALL|wxEXPAND, 6 );
m_buttonReplace = new wxButton( this, wxID_REPLACE, _("&Replace"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonReplace->Hide();
rightSizer->Add( m_buttonReplace, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 6 );
m_buttonReplaceAll = new wxButton( this, wxID_REPLACE_ALL, _("Replace &All"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonReplaceAll->Hide();
rightSizer->Add( m_buttonReplaceAll, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 6 );
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
rightSizer->Add( m_buttonCancel, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 6 );
topSizer->Add( rightSizer, 0, wxALL|wxEXPAND, 6 );
mainSizer->Add( topSizer, 1, wxEXPAND, 5 );
this->SetSizer( mainSizer );
this->Layout();
mainSizer->Fit( this );
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_SCH_FIND_BASE::OnClose ) );
m_comboFind->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnSearchForText ), NULL, this );
@ -184,5 +185,5 @@ DIALOG_SCH_FIND_BASE::~DIALOG_SCH_FIND_BASE()
m_buttonReplaceAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnReplace ), NULL, this );
m_buttonReplaceAll->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateReplaceAllUI ), NULL, this );
m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnCancel ), NULL, this );
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="13" />
<FileVersion major="1" minor="15" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@ -14,6 +14,7 @@
<property name="file">dialog_schematic_find_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_sch_find</property>
<property name="namespace"></property>
@ -52,42 +53,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnClose">OnClose</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">mainSizer</property>
@ -160,6 +126,7 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Search for:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -185,29 +152,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@ -273,31 +217,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCombobox"></event>
<event name="OnComboboxCloseup"></event>
<event name="OnComboboxDropdown"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText">OnSearchForText</event>
<event name="OnTextEnter">OnTextEnter</event>
<event name="OnUpdateUI">OnUpdateDrcUI</event>
@ -336,6 +255,7 @@
<property name="hidden">1</property>
<property name="id">wxID_ANY</property>
<property name="label">Replace &amp;with:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -361,29 +281,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@ -449,32 +346,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCombobox"></event>
<event name="OnComboboxCloseup"></event>
<event name="OnComboboxDropdown"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter">OnTextEnter</event>
<event name="OnUpdateUI">OnUpdateDrcUI</event>
</object>
@ -512,6 +383,7 @@
<property name="hidden">1</property>
<property name="id">wxID_ANY</property>
<property name="label">Direction:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -537,29 +409,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
@ -633,30 +482,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioButton"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@ -721,30 +546,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioButton"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
@ -831,30 +632,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox">OnOptions</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="gbsizeritem" expanded="1">
@ -922,30 +700,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox">OnOptions</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="gbsizeritem" expanded="1">
@ -1013,30 +768,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox">OnOptions</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="gbsizeritem" expanded="1">
@ -1075,7 +807,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Search all com&amp;ponent fields</property>
<property name="label">Search user-defined fields</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -1104,30 +836,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox">OnOptions</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="gbsizeritem" expanded="1">
@ -1166,7 +875,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Search all pin &amp;names and numbers</property>
<property name="label">Search pin &amp;names and numbers</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -1195,30 +904,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox">OnOptions</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="gbsizeritem" expanded="1">
@ -1286,30 +972,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox">OnOptions</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="gbsizeritem" expanded="1">
@ -1377,30 +1040,6 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
@ -1431,25 +1070,31 @@
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></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="current"></property>
<property name="default">1</property>
<property name="default_pane">0</property>
<property name="disabled"></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="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_FIND</property>
<property name="label">&amp;Find</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -1464,6 +1109,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@ -1479,29 +1126,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnFind</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@ -1519,25 +1143,31 @@
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></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="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></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="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">1</property>
<property name="id">wxID_REPLACE</property>
<property name="label">&amp;Replace</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -1552,6 +1182,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@ -1567,28 +1199,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnReplace</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI">OnUpdateReplaceUI</event>
</object>
</object>
@ -1607,25 +1217,31 @@
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></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="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></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="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">1</property>
<property name="id">wxID_REPLACE_ALL</property>
<property name="label">Replace &amp;All</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -1640,6 +1256,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@ -1655,28 +1273,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnReplace</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI">OnUpdateReplaceAllUI</event>
</object>
</object>
@ -1695,25 +1291,31 @@
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></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="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></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="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">Close</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -1728,6 +1330,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
@ -1743,29 +1347,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnCancel</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>

View File

@ -1,12 +1,11 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_SCHEMATIC_FIND_BASE_H__
#define __DIALOG_SCHEMATIC_FIND_BASE_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@ -23,6 +22,9 @@
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/gbsizer.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/dialog.h>
@ -35,7 +37,7 @@
class DIALOG_SCH_FIND_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* m_staticText1;
wxComboBox* m_comboFind;
@ -55,7 +57,7 @@ class DIALOG_SCH_FIND_BASE : public DIALOG_SHIM
wxButton* m_buttonReplace;
wxButton* m_buttonReplaceAll;
wxButton* m_buttonCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnSearchForText( wxCommandEvent& event ) { event.Skip(); }
@ -67,13 +69,12 @@ class DIALOG_SCH_FIND_BASE : public DIALOG_SHIM
virtual void OnUpdateReplaceUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnUpdateReplaceAllUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_SCH_FIND_BASE();
};
#endif //__DIALOG_SCHEMATIC_FIND_BASE_H__

View File

@ -370,6 +370,8 @@ void SCH_BASE_FRAME::RefreshItem( EDA_ITEM* aItem, bool isAddOrDelete )
// Component children are drawn from their parents. Mark them for re-paint.
if( parent && parent->Type() == SCH_COMPONENT_T )
GetCanvas()->GetView()->Update( parent, KIGFX::REPAINT );
else if( parent && parent->Type() == SCH_SHEET_T )
GetCanvas()->GetView()->Update( parent, KIGFX::REPAINT );
}
GetCanvas()->Refresh();

View File

@ -807,7 +807,7 @@ public:
* it can happens when the edited sheet used an existying file, or becomes a new instance
* of a already existing sheet.
*/
bool EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy, bool* aClearAnnotationNewItems );
bool EditSheetProperties( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy, bool* aClearAnnotationNewItems );
void InitSheet( SCH_SHEET* aSheet, const wxString& aNewFilename );

View File

@ -80,19 +80,23 @@ const wxString SCH_FIELD::GetFullyQualifiedText() const
// Note that the IDs of FIELDS and SHEETS overlap, so one must check *both* the
// id and the parent's type.
if( m_id == REFERENCE && m_Parent && m_Parent->Type() == SCH_COMPONENT_T )
if( m_Parent && m_Parent->Type() == SCH_COMPONENT_T )
{
// For more than one part per package, we must add the part selection
// A, B, ... or 1, 2, .. to the reference.
SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( m_Parent );
if( component->GetUnitCount() > 1 )
text << LIB_PART::SubReference( component->GetUnit() );
if( m_id == REFERENCE )
{
// For more than one part per package, we must add the part selection
// A, B, ... or 1, 2, .. to the reference.
if( component->GetUnitCount() > 1 )
text << LIB_PART::SubReference( component->GetUnit() );
}
}
if( m_id == SHEETFILENAME && m_Parent && m_Parent->Type() == SCH_SHEET_T )
if( m_Parent && m_Parent->Type() == SCH_SHEET_T )
{
text = _( "File: " ) + text;
if( m_id == SHEETFILENAME )
text = _( "File: " ) + text;
}
return text;
@ -122,7 +126,6 @@ void SCH_FIELD::Print( wxDC* aDC, const wxPoint& aOffset )
int orient;
COLOR4D color;
wxPoint textpos;
SCH_COMPONENT* parentComponent = dynamic_cast<SCH_COMPONENT*>( m_Parent );
int lineWidth = GetThickness();
if( lineWidth == 0 ) // Use default values for pen size
@ -142,12 +145,17 @@ void SCH_FIELD::Print( wxDC* aDC, const wxPoint& aOffset )
// Calculate the text orientation according to the component orientation.
orient = GetTextAngle();
if( parentComponent && parentComponent->GetTransform().y1 ) // Rotate component 90 degrees.
if( m_Parent && m_Parent->Type() == SCH_COMPONENT_T )
{
if( orient == TEXT_ANGLE_HORIZ )
orient = TEXT_ANGLE_VERT;
else
orient = TEXT_ANGLE_HORIZ;
SCH_COMPONENT* parentComponent = static_cast<SCH_COMPONENT*>( m_Parent );
if( parentComponent && parentComponent->GetTransform().y1 ) // Rotate component 90 degrees.
{
if( orient == TEXT_ANGLE_HORIZ )
orient = TEXT_ANGLE_VERT;
else
orient = TEXT_ANGLE_HORIZ;
}
}
/* Calculate the text justification, according to the component
@ -221,12 +229,13 @@ const EDA_RECT SCH_FIELD::GetBoundingBox() const
if( m_Parent && m_Parent->Type() == SCH_COMPONENT_T )
{
SCH_COMPONENT* parentComponent = static_cast<SCH_COMPONENT*>( m_Parent );
// Due to the Y axis direction, we must mirror the bounding box,
// relative to the text position:
MIRROR( begin.y, pos.y );
MIRROR( end.y, pos.y );
SCH_COMPONENT* parentComponent = static_cast<SCH_COMPONENT*>( m_Parent );
transform = parentComponent->GetTransform();
}
else
@ -271,31 +280,37 @@ bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
{
wxString text = GetFullyQualifiedText();
int flags = aSearchData.GetFlags();
bool isReference = m_Parent && m_Parent->Type() == SCH_COMPONENT_T && m_id == REFERENCE;
bool isValue = m_Parent && m_Parent->Type() == SCH_COMPONENT_T && m_id == VALUE;
bool searchUserDefinedFields = flags & FR_SEARCH_ALL_FIELDS;
bool searchAndReplace = flags & FR_SEARCH_REPLACE;
bool replaceReferences = flags & FR_REPLACE_REFERENCES;
// User defined fields have an ID of -1.
if( !isReference && !isValue && !( flags & FR_SEARCH_ALL_FIELDS ) )
return false;
if( ( flags & FR_SEARCH_REPLACE ) && isReference && !( flags & FR_REPLACE_REFERENCES ) )
return false;
wxLogTrace( traceFindItem, wxT( " child item " )
wxLogTrace( traceFindItem, wxT( " child item " )
+ GetSelectMenuText( EDA_UNITS::MILLIMETRES ) );
// Take sheet path into account which effects the reference field and the unit for
// components with multiple parts.
if( isReference && aAuxData != NULL )
if( m_Parent && m_Parent->Type() == SCH_COMPONENT_T )
{
SCH_COMPONENT* component = (SCH_COMPONENT*) m_Parent;
SCH_COMPONENT* parentComponent = static_cast<SCH_COMPONENT*>( m_Parent );
wxCHECK_MSG( component != NULL, false, wxT( "No symbol associated with field" ) + text );
if( !searchUserDefinedFields && m_id >= MANDATORY_FIELDS )
return false;
text = component->GetRef( (SCH_SHEET_PATH*) aAuxData );
if( searchAndReplace && m_id == REFERENCE && !replaceReferences )
return false;
if( component->GetUnitCount() > 1 )
text << LIB_PART::SubReference( component->GetUnit() );
// Take sheet path into account which effects the reference field and the unit for
// components with multiple parts.
if( m_id == REFERENCE && aAuxData != NULL )
{
text = parentComponent->GetRef( (SCH_SHEET_PATH*) aAuxData );
if( parentComponent->GetUnitCount() > 1 )
text << LIB_PART::SubReference( parentComponent->GetUnit() );
}
}
else if( m_Parent && m_Parent->Type() == SCH_SHEET_T )
{
if( !searchUserDefinedFields && m_id >= SHEET_MANDATORY_FIELDS )
return false;
}
return SCH_ITEM::Matches( text, aSearchData );
@ -306,9 +321,11 @@ bool SCH_FIELD::IsReplaceable() const
{
if( m_Parent && m_Parent->Type() == SCH_COMPONENT_T )
{
SCH_COMPONENT* parentComponent = static_cast<SCH_COMPONENT*>( m_Parent );
if( m_id == VALUE )
{
LIB_PART* part = static_cast<SCH_COMPONENT*>( GetParent() )->GetPartRef().get();
LIB_PART* part = parentComponent->GetPartRef().get();
if( part && part->IsPower() )
return false;
@ -316,6 +333,7 @@ bool SCH_FIELD::IsReplaceable() const
}
else if( m_Parent && m_Parent->Type() == SCH_SHEET_T )
{
// See comments in SCH_FIELD::Replace(), below.
if( m_id == SHEETFILENAME )
return false;
}
@ -326,36 +344,42 @@ bool SCH_FIELD::IsReplaceable() const
bool SCH_FIELD::Replace( wxFindReplaceData& aSearchData, void* aAuxData )
{
bool isReplaced = false;
wxString text = GetFullyQualifiedText();
bool isReplaced = false;
if( m_Parent && m_Parent->Type() == SCH_COMPONENT_T && m_id == REFERENCE )
{
wxCHECK_MSG( aAuxData != NULL, false,
wxT( "Cannot replace reference designator without valid sheet path." ) );
SCH_COMPONENT* parentComponent = static_cast<SCH_COMPONENT*>( m_Parent );
wxCHECK_MSG( aSearchData.GetFlags() & FR_REPLACE_REFERENCES, false,
wxT( "Invalid replace symbol reference field call." ) ) ;
if( m_id == REFERENCE )
{
wxCHECK_MSG( aAuxData != NULL, false,
wxT( "Cannot replace reference designator without valid sheet path." ) );
SCH_COMPONENT* component = (SCH_COMPONENT*) m_Parent;
wxCHECK_MSG( aSearchData.GetFlags() & FR_REPLACE_REFERENCES, false,
wxT( "Invalid replace symbol reference field call." ) ) ;
text = component->GetRef( (SCH_SHEET_PATH*) aAuxData );
wxString text = parentComponent->GetRef( (SCH_SHEET_PATH*) aAuxData );
// if( component->GetUnitCount() > 1 )
// text << LIB_PART::SubReference( component->GetUnit() );
isReplaced = EDA_ITEM::Replace( aSearchData, text );
isReplaced = EDA_ITEM::Replace( aSearchData, text );
if( isReplaced )
component->SetRef( (SCH_SHEET_PATH*) aAuxData, text );
if( isReplaced )
parentComponent->SetRef( (SCH_SHEET_PATH*) aAuxData, text );
}
else
{
isReplaced = EDA_TEXT::Replace( aSearchData );
}
}
else if( m_Parent && m_Parent->Type() == SCH_SHEET_T && m_id == SHEETFILENAME )
{
// This is likely too dangerous to allow....
}
else
else if( m_Parent && m_Parent->Type() == SCH_SHEET_T )
{
isReplaced = EDA_TEXT::Replace( aSearchData );
if( m_id == SHEETFILENAME && isReplaced )
{
// If we allowed this we'd have a bunch of work to do here, including warning
// about it not being undoable, checking for recursive hierarchies, reloading
// sheets, etc. See DIALOG_SCH_SHEET_PROPS::TransferDataFromWindow().
}
}
return isReplaced;
@ -442,11 +466,6 @@ bool SCH_FIELD::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
void SCH_FIELD::Plot( PLOTTER* aPlotter )
{
SCH_COMPONENT* parent = ( SCH_COMPONENT* ) GetParent();
wxCHECK_RET( parent != NULL && parent->Type() == SCH_COMPONENT_T,
wxT( "Cannot plot field with invalid parent." ) );
COLOR4D color = aPlotter->ColorSettings()->GetColor( GetLayer() );
if( !IsVisible() )
@ -459,12 +478,17 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter )
* orientation/mirror */
int orient = GetTextAngle();
if( parent->GetTransform().y1 ) // Rotate component 90 deg.
if( m_Parent && m_Parent->Type() == SCH_COMPONENT_T )
{
if( orient == TEXT_ANGLE_HORIZ )
orient = TEXT_ANGLE_VERT;
else
orient = TEXT_ANGLE_HORIZ;
SCH_COMPONENT* parentComponent = static_cast<SCH_COMPONENT*>( m_Parent );
if( parentComponent->GetTransform().y1 ) // Rotate component 90 deg.
{
if( orient == TEXT_ANGLE_HORIZ )
orient = TEXT_ANGLE_VERT;
else
orient = TEXT_ANGLE_HORIZ;
}
}
/* Calculate the text justification, according to the component
@ -493,29 +517,36 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter )
void SCH_FIELD::SetPosition( const wxPoint& aPosition )
{
wxPoint pos = GetParentPosition();
// Actual positions are calculated by the rotation/mirror transform of the
// parent component of the field. The inverse transform is used to calculate
// the position relative to the parent component.
if( m_Parent && m_Parent->Type() == SCH_COMPONENT_T )
{
SCH_COMPONENT* component = (SCH_COMPONENT*) GetParent();
wxPoint pt = aPosition - pos;
SCH_COMPONENT* parentComponent = static_cast<SCH_COMPONENT*>( m_Parent );
wxPoint relativePos = aPosition - parentComponent->GetPosition();
pos += component->GetTransform().InverseTransform().TransformCoordinate( pt );
parentComponent->GetTransform().InverseTransform().TransformCoordinate( relativePos );
SetTextPos( relativePos + parentComponent->GetPosition() );
}
SetTextPos( pos );
SetTextPos( aPosition );
}
wxPoint SCH_FIELD::GetPosition() const
{
SCH_COMPONENT* component = (SCH_COMPONENT*) GetParent();
wxPoint pos = GetTextPos() - component->GetPosition();
if( m_Parent && m_Parent->Type() == SCH_COMPONENT_T )
{
SCH_COMPONENT* parentComponent = static_cast<SCH_COMPONENT*>( m_Parent );
wxPoint relativePos = GetTextPos() - parentComponent->GetPosition();
return component->GetTransform().TransformCoordinate( pos ) + component->GetPosition();
parentComponent->GetTransform().TransformCoordinate( relativePos );
return relativePos + parentComponent->GetPosition();
}
return GetTextPos();
}

View File

@ -476,8 +476,8 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHier
}
bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
bool* aClearAnnotationNewItems )
bool SCH_EDIT_FRAME::EditSheetProperties( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
bool* aClearAnnotationNewItems )
{
if( aSheet == NULL || aHierarchy == NULL )
return false;

View File

@ -848,7 +848,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
getViewControls()->SetAutoPan( false );
getViewControls()->CaptureCursor( false );
if( m_frame->EditSheet( (SCH_SHEET*)sheet, g_CurrentSheet, nullptr ) )
if( m_frame->EditSheetProperties((SCH_SHEET*) sheet, g_CurrentSheet, nullptr ) )
{
sheet->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );

View File

@ -1224,12 +1224,13 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
case SCH_SHEET_T:
{
bool doClearAnnotation;
bool doRefresh = false;
SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
bool doClearAnnotation;
bool doRefresh = false;
// Keep track of existing sheet paths. EditSheet() can modify this list
SCH_SHEET_LIST initial_sheetpathList( g_RootSheet );
doRefresh = m_frame->EditSheet( (SCH_SHEET*) item, g_CurrentSheet, &doClearAnnotation );
doRefresh = m_frame->EditSheetProperties( sheet, g_CurrentSheet, &doClearAnnotation );
if( doClearAnnotation ) // happens when the current sheet load a existing file
{ // we must clear "new" components annotation
@ -1239,7 +1240,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
// Clear annotation of g_CurrentSheet itself, because its sheetpath
// is not a new path, but components managed by its sheet path must have
// their annotation cleared, because they are new:
((SCH_SHEET*) item)->GetScreen()->ClearAnnotation( g_CurrentSheet );
sheet->GetScreen()->ClearAnnotation( g_CurrentSheet );
}
if( doRefresh )