UI fixes and enhancements in dialog_edit_components_libid.
This commit is contained in:
parent
4d0d56fbd7
commit
76d08c8bd2
|
@ -89,7 +89,7 @@ public:
|
|||
|
||||
private:
|
||||
SCH_EDIT_FRAME* m_parent;
|
||||
bool m_isModified; // set to true is the schemaic is modified
|
||||
bool m_isModified; // set to true if the schematic is modified
|
||||
|
||||
std::vector<CMP_CANDIDATE> m_components;
|
||||
|
||||
|
@ -102,19 +102,24 @@ private:
|
|||
* @param aReferences is the value of cell( aRowId, COL_REFS)
|
||||
* @param aStrLibId is the value of cell( aRowId, COL_CURR_LIBID)
|
||||
*/
|
||||
void AddRowToGrid( int aRowId, bool aMarkRow, const wxString& aReferences, const wxString& aStrLibId );
|
||||
void AddRowToGrid( int aRowId, bool aMarkRow,
|
||||
const wxString& aReferences, const wxString& aStrLibId );
|
||||
|
||||
// returns true if all new lib id are valid
|
||||
/// returns true if all new lib id are valid
|
||||
bool validateLibIds();
|
||||
|
||||
// Reverts all changes already made
|
||||
/// Reverts all changes already made
|
||||
void revertChanges();
|
||||
|
||||
// Events handlers
|
||||
|
||||
// called on a right click or a left double click:
|
||||
void onCellBrowseLib( wxGridEvent& event ) override;
|
||||
|
||||
// Apply changes, but do not close the dialog
|
||||
void onApplyButton( wxCommandEvent& event ) override;
|
||||
|
||||
// Cancel all changes, and close the dialog
|
||||
void onCancel( wxCommandEvent& event ) override
|
||||
{
|
||||
if( m_isModified )
|
||||
|
@ -122,8 +127,15 @@ private:
|
|||
event.Skip();
|
||||
}
|
||||
|
||||
// Undo all changes, and clear the list of new lib_ids
|
||||
void onUndoChangesButton( wxCommandEvent& event ) override;
|
||||
|
||||
void updateUIChangesButton( wxUpdateUIEvent& event ) override
|
||||
{
|
||||
m_buttonUndo->Enable( m_isModified );
|
||||
}
|
||||
|
||||
// Automatically called when click on OK button
|
||||
bool TransferDataFromWindow() override;
|
||||
};
|
||||
|
||||
|
@ -159,6 +171,8 @@ static bool sort_by_libid( const CMP_CANDIDATE& cmp1, const CMP_CANDIDATE& cmp2
|
|||
|
||||
void DIALOG_EDIT_COMPONENTS_LIBID::initDlg()
|
||||
{
|
||||
m_isModified = false;
|
||||
|
||||
// Build the component list:
|
||||
#if 0
|
||||
// This option build a component list that works fine to edit LIB_ID fields, but does not display
|
||||
|
@ -258,10 +272,16 @@ void DIALOG_EDIT_COMPONENTS_LIBID::initDlg()
|
|||
AddRowToGrid( row, mark_cell, refs, last_str_libid );
|
||||
|
||||
m_grid->AutoSizeColumn( COL_CURR_LIBID );
|
||||
// ensure the column title is correctly displayed
|
||||
// (the min size is already fixed by AutoSizeColumn() )
|
||||
m_grid->AutoSizeColLabelSize( COL_CURR_LIBID );
|
||||
|
||||
// Gives a similar width to COL_NEW_LIBID because it can conatains similar strings
|
||||
// Gives a similar width to COL_NEW_LIBID because it can contains similar strings
|
||||
if( m_grid->GetColSize( COL_CURR_LIBID ) > m_grid->GetColSize( COL_NEW_LIBID ) )
|
||||
m_grid->SetColSize( COL_NEW_LIBID, m_grid->GetColSize( COL_CURR_LIBID ) );
|
||||
// ensure the column title is correctly displayed
|
||||
m_grid->SetColMinimalWidth( COL_NEW_LIBID, m_grid->GetColSize( COL_NEW_LIBID ) );
|
||||
m_grid->AutoSizeColLabelSize( COL_NEW_LIBID );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ DIALOG_EDIT_COMPONENTS_LIBID_BASE::DIALOG_EDIT_COMPONENTS_LIBID_BASE( wxWindow*
|
|||
|
||||
// Columns
|
||||
m_grid->SetColSize( 0, 500 );
|
||||
m_grid->SetColSize( 1, 150 );
|
||||
m_grid->SetColSize( 2, 150 );
|
||||
m_grid->SetColSize( 1, 100 );
|
||||
m_grid->SetColSize( 2, 100 );
|
||||
m_grid->EnableDragColMove( false );
|
||||
m_grid->EnableDragColSize( true );
|
||||
m_grid->SetColLabelSize( 30 );
|
||||
|
@ -63,9 +63,6 @@ DIALOG_EDIT_COMPONENTS_LIBID_BASE::DIALOG_EDIT_COMPONENTS_LIBID_BASE( wxWindow*
|
|||
m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bSizerMain->Add( m_staticline, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
wxBoxSizer* bSizerButtons;
|
||||
bSizerButtons = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bSizerMsgWarning;
|
||||
bSizerMsgWarning = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
@ -76,7 +73,10 @@ DIALOG_EDIT_COMPONENTS_LIBID_BASE::DIALOG_EDIT_COMPONENTS_LIBID_BASE( wxWindow*
|
|||
bSizerMsgWarning->Add( m_staticTextWarning, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
bSizerButtons->Add( bSizerMsgWarning, 1, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
bSizerMain->Add( bSizerMsgWarning, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
wxBoxSizer* bSizerButtons;
|
||||
bSizerButtons = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_sdbSizer = new wxStdDialogButtonSizer();
|
||||
m_sdbSizerOK = new wxButton( this, wxID_OK );
|
||||
|
@ -93,7 +93,7 @@ DIALOG_EDIT_COMPONENTS_LIBID_BASE::DIALOG_EDIT_COMPONENTS_LIBID_BASE( wxWindow*
|
|||
bSizerButtons->Add( m_buttonUndo, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( bSizerButtons, 0, wxALIGN_RIGHT|wxEXPAND, 5 );
|
||||
bSizerMain->Add( bSizerButtons, 0, wxALIGN_RIGHT, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizerMain );
|
||||
|
@ -107,6 +107,7 @@ DIALOG_EDIT_COMPONENTS_LIBID_BASE::DIALOG_EDIT_COMPONENTS_LIBID_BASE( wxWindow*
|
|||
m_sdbSizerApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENTS_LIBID_BASE::onApplyButton ), NULL, this );
|
||||
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENTS_LIBID_BASE::onCancel ), NULL, this );
|
||||
m_buttonUndo->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENTS_LIBID_BASE::onUndoChangesButton ), NULL, this );
|
||||
m_buttonUndo->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EDIT_COMPONENTS_LIBID_BASE::updateUIChangesButton ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_EDIT_COMPONENTS_LIBID_BASE::~DIALOG_EDIT_COMPONENTS_LIBID_BASE()
|
||||
|
@ -117,5 +118,6 @@ DIALOG_EDIT_COMPONENTS_LIBID_BASE::~DIALOG_EDIT_COMPONENTS_LIBID_BASE()
|
|||
m_sdbSizerApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENTS_LIBID_BASE::onApplyButton ), NULL, this );
|
||||
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENTS_LIBID_BASE::onCancel ), NULL, this );
|
||||
m_buttonUndo->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENTS_LIBID_BASE::onUndoChangesButton ), NULL, this );
|
||||
m_buttonUndo->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_EDIT_COMPONENTS_LIBID_BASE::updateUIChangesButton ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<property name="minimum_size"></property>
|
||||
<property name="name">DIALOG_EDIT_COMPONENTS_LIBID_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">839,311</property>
|
||||
<property name="size">766,311</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||
<property name="title">Edit Components Links to Symbols in Libraries</property>
|
||||
|
@ -207,7 +207,7 @@
|
|||
<property name="col_label_values">"Components" "Current Symbol" "New Symbol"</property>
|
||||
<property name="col_label_vert_alignment">wxALIGN_CENTRE</property>
|
||||
<property name="cols">3</property>
|
||||
<property name="column_sizes">500,150,150</property>
|
||||
<property name="column_sizes">500,100,100</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
|
@ -405,17 +405,8 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_RIGHT|wxEXPAND</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerButtons</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerMsgWarning</property>
|
||||
|
@ -506,6 +497,15 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_RIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerButtons</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||
|
@ -617,7 +617,7 @@
|
|||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<event name="OnUpdateUI">updateUIChangesButton</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
|
|
@ -53,11 +53,12 @@ class DIALOG_EDIT_COMPONENTS_LIBID_BASE : public DIALOG_SHIM
|
|||
virtual void onApplyButton( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onCancel( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onUndoChangesButton( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void updateUIChangesButton( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_EDIT_COMPONENTS_LIBID_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Edit Components Links to Symbols in Libraries"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 839,311 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
DIALOG_EDIT_COMPONENTS_LIBID_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Edit Components Links to Symbols in Libraries"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 766,311 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_EDIT_COMPONENTS_LIBID_BASE();
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue