Size fields list correctly in symbol edit.

Fixes: lp:1753323
* https://bugs.launchpad.net/kicad/+bug/1753323
This commit is contained in:
Jeff Young 2018-03-05 00:06:12 +00:00
parent 90e2c8dd7f
commit f4eb63f871
4 changed files with 16 additions and 4 deletions

View File

@ -142,6 +142,7 @@ private:
void showButtonHandler( wxCommandEvent& event ) override;
void OnTestChipName( wxCommandEvent& event ) override;
void OnSelectChipName( wxCommandEvent& event ) override;
void OnSizeFieldsList( wxSizeEvent& event ) override;
void OnInitDlg( wxInitDialogEvent& event ) override
{
TransferDataToWindow();
@ -919,8 +920,9 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::setRowItem( int aFieldNdx, const wxStri
fieldListCtrl->SetItem( aFieldNdx, 1, aValue );
// recompute the column widths here, after setting texts
int totalWidth = fieldListCtrl->GetSize().GetWidth();
fieldListCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE );
fieldListCtrl->SetColumnWidth( 1, wxLIST_AUTOSIZE );
fieldListCtrl->SetColumnWidth( 1, totalWidth - fieldListCtrl->GetColumnWidth( 0 ) );
}
@ -1264,3 +1266,10 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFields( wxCommandEvent& event )
copySelectedFieldToPanel();
updateDisplay();
}
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnSizeFieldsList( wxSizeEvent& event )
{
int newWidth = event.GetSize().GetX();
fieldListCtrl->SetColumnWidth( 1, newWidth - fieldListCtrl->GetColumnWidth( 0 ) );
event.Skip();
}

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017)
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -319,6 +319,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
updateFieldValues->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::UpdateFields ), NULL, this );
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this );
fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this );
fieldListCtrl->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnSizeFieldsList ), NULL, this );
moveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::moveUpButtonHandler ), NULL, this );
moveDownButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::moveDownButtonHandler ), NULL, this );
deleteFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::deleteFieldButtonHandler ), NULL, this );
@ -340,6 +341,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
updateFieldValues->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::UpdateFields ), NULL, this );
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this );
fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this );
fieldListCtrl->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnSizeFieldsList ), NULL, this );
moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::moveUpButtonHandler ), NULL, this );
moveDownButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::moveDownButtonHandler ), NULL, this );
deleteFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::deleteFieldButtonHandler ), NULL, this );

View File

@ -1672,7 +1672,7 @@
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnSize">OnSizeFieldsList</event>
<event name="OnUpdateUI"></event>
</object>
</object>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017)
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -98,6 +98,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM
virtual void UpdateFields( wxCommandEvent& event ) { event.Skip(); }
virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); }
virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); }
virtual void OnSizeFieldsList( wxSizeEvent& event ) { event.Skip(); }
virtual void moveUpButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void moveDownButtonHandler( wxCommandEvent& event ) { event.Skip(); }
virtual void deleteFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); }