Symbol Fields Table: general settings saving cleanup
This commit is contained in:
parent
9c3d93eb34
commit
b7b7dc6558
|
@ -146,7 +146,6 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent )
|
|||
m_lastSelectedBomPreset( nullptr ), m_parent( parent ),
|
||||
m_schSettings( parent->Schematic().Settings() )
|
||||
{
|
||||
wxSize defaultDlgSize = ConvertDialogToPixels( wxSize( 600, 300 ) );
|
||||
int nameColWidthMargin = 44;
|
||||
|
||||
// Get all symbols from the list of schematic sheets
|
||||
|
@ -257,7 +256,18 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent )
|
|||
SetupStandardButtons();
|
||||
|
||||
finishDialogSettings();
|
||||
SetSize( defaultDlgSize );
|
||||
|
||||
if( EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ) )
|
||||
{
|
||||
EESCHEMA_SETTINGS::PANEL_FIELD_EDITOR& panelCfg = cfg->m_FieldEditorPanel;
|
||||
|
||||
wxSize dlgSize( panelCfg.width > 0 ? panelCfg.width : horizPixelsFromDU( 600 ),
|
||||
panelCfg.height > 0 ? panelCfg.height : vertPixelsFromDU( 300 ) );
|
||||
SetSize( dlgSize );
|
||||
|
||||
m_nbPages->SetSelection( cfg->m_FieldEditorPanel.page );
|
||||
}
|
||||
|
||||
Center();
|
||||
|
||||
// Connect Events
|
||||
|
@ -274,6 +284,7 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent )
|
|||
|
||||
void DIALOG_SYMBOL_FIELDS_TABLE::SetupColumnProperties()
|
||||
{
|
||||
EESCHEMA_SETTINGS* cfg = static_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
wxSize defaultDlgSize = ConvertDialogToPixels( wxSize( 600, 300 ) );
|
||||
|
||||
// Restore column sorting order and widths
|
||||
|
@ -320,34 +331,10 @@ void DIALOG_SYMBOL_FIELDS_TABLE::SetupColumnProperties()
|
|||
m_grid->SetColFormatCustom( col, wxGRID_VALUE_STRING );
|
||||
}
|
||||
|
||||
// Columns are hidden by setting their width to 0 so if we resize them they will
|
||||
// become unhidden.
|
||||
if( m_grid->IsColShown( col ) )
|
||||
{
|
||||
EESCHEMA_SETTINGS* cfg = static_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
std::string key( m_dataModel->GetColFieldName( col ).ToUTF8() );
|
||||
|
||||
if( cfg->m_FieldEditorPanel.field_widths.count( key ) )
|
||||
{
|
||||
int width = cfg->m_FieldEditorPanel.field_widths.at( key );
|
||||
m_grid->SetColSize( col, width );
|
||||
}
|
||||
else
|
||||
{
|
||||
int textWidth = m_dataModel->GetDataWidth( col ) + COLUMN_MARGIN;
|
||||
int maxWidth = defaultDlgSize.x / 3;
|
||||
|
||||
if( col == m_grid->GetNumberCols() - 1 )
|
||||
m_grid->SetColSize( col, Clamp( 50, textWidth, maxWidth ) );
|
||||
else
|
||||
m_grid->SetColSize( col, Clamp( 100, textWidth, maxWidth ) );
|
||||
}
|
||||
}
|
||||
|
||||
if( m_schSettings.m_BomSettings.sortField == m_dataModel->GetColFieldName( col ) )
|
||||
if( col == m_dataModel->GetSortCol() )
|
||||
{
|
||||
sortCol = col;
|
||||
sortAscending = m_schSettings.m_BomSettings.sortAsc;
|
||||
sortAscending = m_dataModel->GetSortAsc();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -363,9 +350,31 @@ void DIALOG_SYMBOL_FIELDS_TABLE::SetupColumnProperties()
|
|||
m_dataModel->SetShowColumn( col, show );
|
||||
|
||||
if( show )
|
||||
{
|
||||
m_grid->ShowCol( col );
|
||||
|
||||
std::string key( m_dataModel->GetColFieldName( col ).ToUTF8() );
|
||||
|
||||
if( cfg && cfg->m_FieldEditorPanel.field_widths.count( key )
|
||||
&& ( cfg->m_FieldEditorPanel.field_widths.at( key ) > 0 ) )
|
||||
{
|
||||
m_grid->SetColSize( col, cfg->m_FieldEditorPanel.field_widths.at( key ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
int textWidth = m_dataModel->GetDataWidth( col ) + COLUMN_MARGIN;
|
||||
int maxWidth = defaultDlgSize.x / 3;
|
||||
|
||||
if( col == m_grid->GetNumberCols() - 1 )
|
||||
m_grid->SetColSize( col, Clamp( 50, textWidth, maxWidth ) );
|
||||
else
|
||||
m_grid->SetColSize( col, Clamp( 100, textWidth, maxWidth ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_grid->HideCol( col );
|
||||
}
|
||||
}
|
||||
|
||||
m_dataModel->SetSorting( sortCol, sortAscending );
|
||||
|
@ -375,6 +384,24 @@ void DIALOG_SYMBOL_FIELDS_TABLE::SetupColumnProperties()
|
|||
|
||||
DIALOG_SYMBOL_FIELDS_TABLE::~DIALOG_SYMBOL_FIELDS_TABLE()
|
||||
{
|
||||
savePresetsToSchematic();
|
||||
|
||||
if( EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() ) )
|
||||
{
|
||||
cfg->m_FieldEditorPanel.width = GetSize().x;
|
||||
cfg->m_FieldEditorPanel.height = GetSize().y;
|
||||
cfg->m_FieldEditorPanel.page = m_nbPages->GetSelection();
|
||||
|
||||
for( int i = 0; i < m_grid->GetNumberCols(); i++ )
|
||||
{
|
||||
if( m_grid->IsColShown( i ) )
|
||||
{
|
||||
std::string fieldName( m_dataModel->GetColFieldName( i ).ToUTF8() );
|
||||
cfg->m_FieldEditorPanel.field_widths[fieldName] = m_grid->GetColSize( i );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Disconnect Events
|
||||
m_grid->Disconnect( wxEVT_GRID_COL_SORT,
|
||||
wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE::OnColSort ), nullptr,
|
||||
|
@ -565,10 +592,6 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnAddField( wxCommandEvent& event )
|
|||
}
|
||||
}
|
||||
|
||||
std::string key( fieldName.ToUTF8() );
|
||||
|
||||
m_parent->Schematic().Settings().m_BomSettings.fieldsOrdered.emplace_back(
|
||||
( BOM_FIELD ){ .name = key, .label = key, .show = true, .groupBy = false } );
|
||||
AddField( fieldName, fieldName, true, false, true );
|
||||
|
||||
wxGridTableMessage msg( m_dataModel, wxGRIDTABLE_NOTIFY_COLS_APPENDED, 1 );
|
||||
|
@ -692,7 +715,6 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnRenameField( wxCommandEvent& event )
|
|||
|
||||
void DIALOG_SYMBOL_FIELDS_TABLE::OnFilterText( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_schSettings.m_BomSettings.filterString = m_filter->GetValue();
|
||||
m_dataModel->SetFilter( m_filter->GetValue() );
|
||||
m_dataModel->RebuildRows();
|
||||
m_grid->ForceRefresh();
|
||||
|
@ -788,7 +810,6 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnColumnItemToggled( wxDataViewEvent& event )
|
|||
|
||||
void DIALOG_SYMBOL_FIELDS_TABLE::OnGroupSymbolsToggled( wxCommandEvent& event )
|
||||
{
|
||||
m_schSettings.m_BomSettings.groupSymbols = m_groupSymbolsBox->GetValue();
|
||||
m_dataModel->SetGroupingEnabled( m_groupSymbolsBox->GetValue() );
|
||||
m_dataModel->RebuildRows();
|
||||
m_grid->ForceRefresh();
|
||||
|
@ -799,8 +820,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnGroupSymbolsToggled( wxCommandEvent& event )
|
|||
|
||||
void DIALOG_SYMBOL_FIELDS_TABLE::OnExcludeDNPToggled( wxCommandEvent& event )
|
||||
{
|
||||
m_schSettings.m_BomSettings.excludeDNP = m_checkExludeDNP->GetValue();
|
||||
m_dataModel->SetExcludeDNP( m_checkExludeDNP->GetValue() );
|
||||
m_dataModel->SetExcludeDNP( m_checkExcludeDNP->GetValue() );
|
||||
m_dataModel->RebuildRows();
|
||||
m_grid->ForceRefresh();
|
||||
|
||||
|
@ -827,10 +847,6 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnColSort( wxGridEvent& aEvent )
|
|||
ascending = true;
|
||||
}
|
||||
|
||||
// We only support sorting on one column at this time
|
||||
m_schSettings.m_BomSettings.sortField = m_dataModel->GetColFieldName( sortCol );
|
||||
m_schSettings.m_BomSettings.sortAsc = ascending;
|
||||
|
||||
m_dataModel->SetSorting( sortCol, ascending );
|
||||
m_dataModel->RebuildRows();
|
||||
m_grid->ForceRefresh();
|
||||
|
@ -850,8 +866,6 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnColMove( wxGridEvent& aEvent )
|
|||
|
||||
m_dataModel->MoveColumn( origPos, newPos );
|
||||
|
||||
m_schSettings.m_BomSettings.fieldsOrdered = m_dataModel->GetFieldsOrdered();
|
||||
|
||||
// "Unmove" the column since we've moved the column internally
|
||||
m_grid->ResetColPos();
|
||||
|
||||
|
@ -1012,8 +1026,21 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnPreviewRefresh( wxCommandEvent& event )
|
|||
|
||||
void DIALOG_SYMBOL_FIELDS_TABLE::PreviewRefresh()
|
||||
{
|
||||
BOM_FMT_PRESET& current = m_parent->Schematic().Settings().m_BomFmtSettings;
|
||||
m_dataModel->SetIncludeExcludedFromBOM( false );
|
||||
m_dataModel->RebuildRows();
|
||||
|
||||
m_textOutput->SetValue( m_dataModel->Export( GetCurrentBomFmtSettings() ) );
|
||||
|
||||
m_dataModel->SetIncludeExcludedFromBOM( true );
|
||||
m_dataModel->RebuildRows();
|
||||
}
|
||||
|
||||
|
||||
BOM_FMT_PRESET DIALOG_SYMBOL_FIELDS_TABLE::GetCurrentBomFmtSettings()
|
||||
{
|
||||
BOM_FMT_PRESET current;
|
||||
|
||||
current.name = m_cbBomFmtPresets->GetStringSelection();
|
||||
current.fieldDelimiter = m_textFieldDelimiter->GetValue();
|
||||
current.stringDelimiter = m_textStringDelimiter->GetValue();
|
||||
current.refDelimiter = m_textRefDelimiter->GetValue();
|
||||
|
@ -1021,13 +1048,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::PreviewRefresh()
|
|||
current.keepTabs = m_checkKeepTabs->GetValue();
|
||||
current.keepLineBreaks = m_checkKeepLineBreaks->GetValue();
|
||||
|
||||
m_dataModel->SetIncludeExcludedFromBOM( false );
|
||||
m_dataModel->RebuildRows();
|
||||
|
||||
m_textOutput->SetValue( m_dataModel->Export( current ) );
|
||||
|
||||
m_dataModel->SetIncludeExcludedFromBOM( true );
|
||||
m_dataModel->RebuildRows();
|
||||
return current;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1269,11 +1290,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::rebuildBomPresetsWidget()
|
|||
|
||||
void DIALOG_SYMBOL_FIELDS_TABLE::syncBomPresetSelection()
|
||||
{
|
||||
// We need to check for matching an existing preset all the places we also
|
||||
// need to update the settings, so do it here.
|
||||
m_schSettings.m_BomSettings.fieldsOrdered = m_dataModel->GetFieldsOrdered();
|
||||
|
||||
BOM_PRESET& current = m_parent->Schematic().Settings().m_BomSettings;
|
||||
BOM_PRESET current = m_dataModel->GetBomSettings();
|
||||
|
||||
auto it = std::find_if( m_bomPresets.begin(), m_bomPresets.end(),
|
||||
[&]( const std::pair<const wxString, BOM_PRESET>& aPair )
|
||||
|
@ -1284,7 +1301,8 @@ void DIALOG_SYMBOL_FIELDS_TABLE::syncBomPresetSelection()
|
|||
if( !( preset.sortField == current.sortField
|
||||
&& preset.sortAsc == current.sortAsc
|
||||
&& preset.filterString == current.filterString
|
||||
&& preset.groupSymbols == current.groupSymbols ) )
|
||||
&& preset.groupSymbols == current.groupSymbols
|
||||
&& preset.excludeDNP == current.excludeDNP ) )
|
||||
return false;
|
||||
|
||||
// Only compare shown or grouped fields
|
||||
|
@ -1394,7 +1412,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomPresetChanged( wxCommandEvent& aEvent )
|
|||
|
||||
if( !exists )
|
||||
{
|
||||
m_bomPresets[name] = m_schSettings.m_BomSettings;
|
||||
m_bomPresets[name] = m_dataModel->GetBomSettings();
|
||||
m_bomPresets[name].readOnly = false;
|
||||
m_bomPresets[name].name = name;
|
||||
}
|
||||
|
@ -1408,7 +1426,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomPresetChanged( wxCommandEvent& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
*preset = m_schSettings.m_BomSettings;
|
||||
*preset = m_dataModel->GetBomSettings();
|
||||
preset->name = name;
|
||||
|
||||
index = m_cbBomPresets->FindString( name );
|
||||
|
@ -1418,7 +1436,6 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomPresetChanged( wxCommandEvent& aEvent )
|
|||
m_cbBomPresets->SetSelection( index );
|
||||
m_bomPresetMRU.Insert( name, 0 );
|
||||
|
||||
savePresetsToSchematic();
|
||||
return;
|
||||
}
|
||||
else if( index == count - 1 )
|
||||
|
@ -1459,7 +1476,6 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomPresetChanged( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
resetSelection();
|
||||
savePresetsToSchematic();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1485,8 +1501,6 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomPresetChanged( wxCommandEvent& aEvent )
|
|||
|
||||
void DIALOG_SYMBOL_FIELDS_TABLE::doApplyBomPreset( const BOM_PRESET& aPreset )
|
||||
{
|
||||
m_schSettings.m_BomSettings = aPreset;
|
||||
|
||||
// Basically, we apply the BOM preset to the data model and then
|
||||
// update our UI to reflect resulting the data model state, not the preset.
|
||||
m_dataModel->ApplyBomPreset( aPreset );
|
||||
|
@ -1527,7 +1541,12 @@ void DIALOG_SYMBOL_FIELDS_TABLE::doApplyBomPreset( const BOM_PRESET& aPreset )
|
|||
EESCHEMA_SETTINGS* cfg = static_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||
std::string fieldNameStr( fieldName.ToUTF8() );
|
||||
|
||||
if( cfg->m_FieldEditorPanel.field_widths.count( fieldNameStr ) )
|
||||
// Set column labels
|
||||
const wxString& label = m_dataModel->GetColLabelValue( col );
|
||||
m_fieldsCtrl->SetTextValue( label, i, LABEL_COLUMN );
|
||||
m_grid->SetColLabelValue( col, label );
|
||||
|
||||
if( cfg && cfg->m_FieldEditorPanel.field_widths.count( fieldNameStr ) )
|
||||
m_grid->SetColMinimalWidth( col,
|
||||
cfg->m_FieldEditorPanel.field_widths.at( fieldNameStr ) );
|
||||
|
||||
|
@ -1551,7 +1570,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::doApplyBomPreset( const BOM_PRESET& aPreset )
|
|||
m_grid->SetSortingColumn( m_dataModel->GetSortCol(), m_dataModel->GetSortAsc() );
|
||||
m_groupSymbolsBox->SetValue( m_dataModel->GetGroupingEnabled() );
|
||||
m_filter->ChangeValue( m_dataModel->GetFilter() );
|
||||
m_checkExludeDNP->SetValue( m_dataModel->GetExcludeDNP() );
|
||||
m_checkExcludeDNP->SetValue( m_dataModel->GetExcludeDNP() );
|
||||
|
||||
SetupColumnProperties();
|
||||
|
||||
|
@ -1673,7 +1692,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::rebuildBomFmtPresetsWidget()
|
|||
|
||||
void DIALOG_SYMBOL_FIELDS_TABLE::syncBomFmtPresetSelection()
|
||||
{
|
||||
BOM_FMT_PRESET& current = m_parent->Schematic().Settings().m_BomFmtSettings;
|
||||
BOM_FMT_PRESET current = GetCurrentBomFmtSettings();
|
||||
|
||||
auto it = std::find_if( m_bomFmtPresets.begin(), m_bomFmtPresets.end(),
|
||||
[&]( const std::pair<const wxString, BOM_FMT_PRESET>& aPair )
|
||||
|
@ -1780,7 +1799,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomFmtPresetChanged( wxCommandEvent& aEvent )
|
|||
|
||||
if( !exists )
|
||||
{
|
||||
m_bomFmtPresets[name] = m_schSettings.m_BomFmtSettings;
|
||||
m_bomFmtPresets[name] = GetCurrentBomFmtSettings();
|
||||
m_bomFmtPresets[name].readOnly = false;
|
||||
m_bomFmtPresets[name].name = name;
|
||||
}
|
||||
|
@ -1794,7 +1813,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomFmtPresetChanged( wxCommandEvent& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
*preset = m_schSettings.m_BomFmtSettings;
|
||||
*preset = GetCurrentBomFmtSettings();
|
||||
preset->name = name;
|
||||
|
||||
index = m_cbBomFmtPresets->FindString( name );
|
||||
|
@ -1804,7 +1823,6 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomFmtPresetChanged( wxCommandEvent& aEvent )
|
|||
m_cbBomFmtPresets->SetSelection( index );
|
||||
m_bomFmtPresetMRU.Insert( name, 0 );
|
||||
|
||||
savePresetsToSchematic();
|
||||
return;
|
||||
}
|
||||
else if( index == count - 1 )
|
||||
|
@ -1845,7 +1863,6 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomFmtPresetChanged( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
resetSelection();
|
||||
savePresetsToSchematic();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1872,8 +1889,6 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomFmtPresetChanged( wxCommandEvent& aEvent )
|
|||
|
||||
void DIALOG_SYMBOL_FIELDS_TABLE::doApplyBomFmtPreset( const BOM_FMT_PRESET& aPreset )
|
||||
{
|
||||
m_schSettings.m_BomFmtSettings = aPreset;
|
||||
|
||||
m_textFieldDelimiter->ChangeValue( aPreset.fieldDelimiter );
|
||||
m_textStringDelimiter->ChangeValue( aPreset.stringDelimiter );
|
||||
m_textRefDelimiter->ChangeValue( aPreset.refDelimiter );
|
||||
|
@ -1897,6 +1912,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::savePresetsToSchematic()
|
|||
}
|
||||
|
||||
m_schSettings.m_BomPresets = presets;
|
||||
m_schSettings.m_BomSettings = m_dataModel->GetBomSettings();
|
||||
|
||||
// Save our BOM Format presets
|
||||
std::vector<BOM_FMT_PRESET> fmts;
|
||||
|
@ -1908,5 +1924,5 @@ void DIALOG_SYMBOL_FIELDS_TABLE::savePresetsToSchematic()
|
|||
}
|
||||
|
||||
m_schSettings.m_BomFmtPresets = fmts;
|
||||
m_parent->OnModify();
|
||||
m_schSettings.m_BomFmtSettings = GetCurrentBomFmtSettings();
|
||||
}
|
||||
|
|
|
@ -92,6 +92,9 @@ private:
|
|||
void ApplyBomPreset( const wxString& aPresetName );
|
||||
void ApplyBomPreset( const BOM_PRESET& aPreset );
|
||||
|
||||
/// Returns a formatting configuration corresponding to the values in the UI controls
|
||||
/// of the dialog.
|
||||
BOM_FMT_PRESET GetCurrentBomFmtSettings();
|
||||
std::vector<BOM_FMT_PRESET> GetUserBomFmtPresets() const;
|
||||
void SetUserBomFmtPresets( std::vector<BOM_FMT_PRESET>& aPresetList );
|
||||
void ApplyBomFmtPreset( const wxString& aPresetName );
|
||||
|
|
|
@ -19,8 +19,8 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
|
|||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_notebook1 = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_panelEdit = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
m_nbPages = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_panelEdit = new wxPanel( m_nbPages, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bEditSizer;
|
||||
bEditSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
@ -92,8 +92,8 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
|
|||
|
||||
bControls->Add( m_separator1, 0, wxALL, 5 );
|
||||
|
||||
m_checkExludeDNP = new wxCheckBox( m_rightPanel, wxID_ANY, _("Exclude DNP"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bControls->Add( m_checkExludeDNP, 0, wxALL, 5 );
|
||||
m_checkExcludeDNP = new wxCheckBox( m_rightPanel, wxID_ANY, _("Exclude DNP"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bControls->Add( m_checkExcludeDNP, 0, wxALL, 5 );
|
||||
|
||||
m_separator2 = new BITMAP_BUTTON( m_rightPanel, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_separator2->Enable( false );
|
||||
|
@ -158,8 +158,8 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
|
|||
m_panelEdit->SetSizer( bEditSizer );
|
||||
m_panelEdit->Layout();
|
||||
bEditSizer->Fit( m_panelEdit );
|
||||
m_notebook1->AddPage( m_panelEdit, _("Edit"), true );
|
||||
m_panelExport = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
m_nbPages->AddPage( m_panelEdit, _("Edit"), true );
|
||||
m_panelExport = new wxPanel( m_nbPages, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxGridBagSizer* gbExport;
|
||||
gbExport = new wxGridBagSizer( 0, 0 );
|
||||
gbExport->SetFlexibleDirection( wxBOTH );
|
||||
|
@ -275,9 +275,9 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
|
|||
m_panelExport->SetSizer( gbExport );
|
||||
m_panelExport->Layout();
|
||||
gbExport->Fit( m_panelExport );
|
||||
m_notebook1->AddPage( m_panelExport, _("Export"), false );
|
||||
m_nbPages->AddPage( m_panelExport, _("Export"), false );
|
||||
|
||||
bMainSizer->Add( m_notebook1, 1, wxEXPAND | wxALL, 5 );
|
||||
bMainSizer->Add( m_nbPages, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
wxBoxSizer* bButtonsSizer;
|
||||
bButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
@ -312,7 +312,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
|
|||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnClose ) );
|
||||
m_notebook1->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnPageChanged ), NULL, this );
|
||||
m_nbPages->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnPageChanged ), NULL, this );
|
||||
m_fieldsCtrl->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnColumnItemToggled ), NULL, this );
|
||||
m_fieldsCtrl->Connect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnFieldsCtrlSelectionChanged ), NULL, this );
|
||||
m_fieldsCtrl->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnSizeFieldList ), NULL, this );
|
||||
|
@ -321,7 +321,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
|
|||
m_renameFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnRenameField ), NULL, this );
|
||||
m_filter->Connect( wxEVT_MOTION, wxMouseEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnFilterMouseMoved ), NULL, this );
|
||||
m_filter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnFilterText ), NULL, this );
|
||||
m_checkExludeDNP->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnExcludeDNPToggled ), NULL, this );
|
||||
m_checkExcludeDNP->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnExcludeDNPToggled ), NULL, this );
|
||||
m_groupSymbolsBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnGroupSymbolsToggled ), NULL, this );
|
||||
m_bRefresh->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnRegroupSymbols ), NULL, this );
|
||||
m_grid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnTableValueChanged ), NULL, this );
|
||||
|
@ -347,7 +347,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::~DIALOG_SYMBOL_FIELDS_TABLE_BASE()
|
|||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnClose ) );
|
||||
m_notebook1->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnPageChanged ), NULL, this );
|
||||
m_nbPages->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnPageChanged ), NULL, this );
|
||||
m_fieldsCtrl->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnColumnItemToggled ), NULL, this );
|
||||
m_fieldsCtrl->Disconnect( wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED, wxDataViewEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnFieldsCtrlSelectionChanged ), NULL, this );
|
||||
m_fieldsCtrl->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnSizeFieldList ), NULL, this );
|
||||
|
@ -356,7 +356,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::~DIALOG_SYMBOL_FIELDS_TABLE_BASE()
|
|||
m_renameFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnRenameField ), NULL, this );
|
||||
m_filter->Disconnect( wxEVT_MOTION, wxMouseEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnFilterMouseMoved ), NULL, this );
|
||||
m_filter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnFilterText ), NULL, this );
|
||||
m_checkExludeDNP->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnExcludeDNPToggled ), NULL, this );
|
||||
m_checkExcludeDNP->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnExcludeDNPToggled ), NULL, this );
|
||||
m_groupSymbolsBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnGroupSymbolsToggled ), NULL, this );
|
||||
m_bRefresh->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnRegroupSymbols ), NULL, this );
|
||||
m_grid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE_BASE::OnTableValueChanged ), NULL, this );
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_notebook1</property>
|
||||
<property name="name">m_nbPages</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
|
@ -947,7 +947,7 @@
|
|||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_checkExludeDNP</property>
|
||||
<property name="name">m_checkExcludeDNP</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
|
|
|
@ -50,7 +50,7 @@ class DIALOG_SYMBOL_FIELDS_TABLE_BASE : public DIALOG_SHIM
|
|||
private:
|
||||
|
||||
protected:
|
||||
wxNotebook* m_notebook1;
|
||||
wxNotebook* m_nbPages;
|
||||
wxPanel* m_panelEdit;
|
||||
wxSplitterWindow* m_splitterMainWindow;
|
||||
wxPanel* m_leftPanel;
|
||||
|
@ -63,7 +63,7 @@ class DIALOG_SYMBOL_FIELDS_TABLE_BASE : public DIALOG_SHIM
|
|||
wxPanel* m_rightPanel;
|
||||
wxSearchCtrl* m_filter;
|
||||
BITMAP_BUTTON* m_separator1;
|
||||
wxCheckBox* m_checkExludeDNP;
|
||||
wxCheckBox* m_checkExcludeDNP;
|
||||
BITMAP_BUTTON* m_separator2;
|
||||
wxCheckBox* m_groupSymbolsBox;
|
||||
BITMAP_BUTTON* m_separator3;
|
||||
|
|
|
@ -356,6 +356,15 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
|
|||
m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment9",
|
||||
&m_PageSettings.export_comment9, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM_MAP<int>( "field_editor.field_widths",
|
||||
&m_FieldEditorPanel.field_widths, {} ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "field_editor.width", &m_FieldEditorPanel.width, 0 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "field_editor.height", &m_FieldEditorPanel.height, 0 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "field_editor.page", &m_FieldEditorPanel.page, 0 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "plot.background_color",
|
||||
&m_PlotPanel.background_color, false ) );
|
||||
|
||||
|
|
|
@ -195,6 +195,9 @@ public:
|
|||
struct PANEL_FIELD_EDITOR
|
||||
{
|
||||
std::map<std::string, int> field_widths;
|
||||
int width;
|
||||
int height;
|
||||
int page;
|
||||
};
|
||||
|
||||
struct PANEL_LIB_VIEW
|
||||
|
|
|
@ -643,6 +643,22 @@ void FIELDS_EDITOR_GRID_DATA_MODEL::ApplyBomPreset( const BOM_PRESET& aPreset )
|
|||
RebuildRows();
|
||||
}
|
||||
|
||||
|
||||
BOM_PRESET FIELDS_EDITOR_GRID_DATA_MODEL::GetBomSettings()
|
||||
{
|
||||
BOM_PRESET current;
|
||||
current.readOnly = false;
|
||||
current.fieldsOrdered = GetFieldsOrdered();
|
||||
current.sortField = GetColFieldName( GetSortCol() );
|
||||
current.sortAsc = GetSortAsc();
|
||||
current.filterString = GetFilter();
|
||||
current.groupSymbols = GetGroupingEnabled();
|
||||
current.excludeDNP = GetExcludeDNP();
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
|
||||
wxString FIELDS_EDITOR_GRID_DATA_MODEL::Export( const BOM_FMT_PRESET& settings )
|
||||
{
|
||||
wxString out;
|
||||
|
|
|
@ -183,6 +183,7 @@ public:
|
|||
}
|
||||
|
||||
void ApplyBomPreset( const BOM_PRESET& preset );
|
||||
BOM_PRESET GetBomSettings();
|
||||
wxString Export( const BOM_FMT_PRESET& settings );
|
||||
|
||||
private:
|
||||
|
|
|
@ -26,14 +26,11 @@
|
|||
#include <macros.h>
|
||||
#include <pgm_base.h>
|
||||
#include <schematic_settings.h>
|
||||
#include <settings/json_settings.h>
|
||||
#include <settings/json_settings_internals.h>
|
||||
#include <settings/parameters.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <settings/bom_settings.h>
|
||||
#include <sim/spice_settings.h>
|
||||
#include <i18n_utility.h>
|
||||
#include <wx/string.h>
|
||||
|
||||
|
||||
const int schSettingsSchemaVersion = 1;
|
||||
|
@ -199,7 +196,7 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
|
|||
m_params.emplace_back(
|
||||
new PARAM<BOM_FMT_PRESET>( "bom_fmt_settings", &m_BomFmtSettings, BOM_FMT_PRESET::CSV() ) );
|
||||
m_params.emplace_back(
|
||||
new PARAM_LIST<BOM_FMT_PRESET>( "bom_fmt_settings", &m_BomFmtPresets, {} ) );
|
||||
new PARAM_LIST<BOM_FMT_PRESET>( "bom_fmt_presets", &m_BomFmtPresets, {} ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<wxString>( "page_layout_descr_file",
|
||||
&m_SchDrawingSheetFileName, "" ) );
|
||||
|
|
|
@ -20,16 +20,10 @@
|
|||
#ifndef KICAD_SCHEMATIC_SETTINGS_H
|
||||
#define KICAD_SCHEMATIC_SETTINGS_H
|
||||
|
||||
#include <set>
|
||||
|
||||
#include <default_values.h>
|
||||
#include <settings/nested_settings.h>
|
||||
#include <settings/parameters.h>
|
||||
#include <settings/bom_settings.h>
|
||||
#include <template_fieldnames.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include <utility>
|
||||
|
||||
class NGSPICE_SIMULATOR_SETTINGS;
|
||||
|
||||
|
|
Loading…
Reference in New Issue