BOM Generator: minor bug fixes and string changes
This commit is contained in:
parent
c5cc313da9
commit
79a829395d
|
@ -442,18 +442,6 @@ bool DIALOG_SYMBOL_FIELDS_TABLE::TransferDataFromWindow()
|
||||||
if( !wxDialog::TransferDataFromWindow() )
|
if( !wxDialog::TransferDataFromWindow() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Save our BOM presets
|
|
||||||
std::vector<BOM_PRESET> presets;
|
|
||||||
|
|
||||||
for( const std::pair<const wxString, BOM_PRESET>& pair : m_bomPresets )
|
|
||||||
{
|
|
||||||
if( !pair.second.readOnly )
|
|
||||||
presets.emplace_back( pair.second );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_schSettings.m_BomPresets = presets;
|
|
||||||
|
|
||||||
|
|
||||||
SCH_SHEET_PATH currentSheet = m_parent->GetCurrentSheet();
|
SCH_SHEET_PATH currentSheet = m_parent->GetCurrentSheet();
|
||||||
|
|
||||||
std::function<void( SCH_SYMBOL&, SCH_SHEET_PATH & aPath )> changeHandler =
|
std::function<void( SCH_SYMBOL&, SCH_SHEET_PATH & aPath )> changeHandler =
|
||||||
|
@ -1385,13 +1373,9 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomPresetChanged( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
if( !exists )
|
if( !exists )
|
||||||
{
|
{
|
||||||
m_bomPresets[name] =
|
m_bomPresets[name] = m_schSettings.m_BomSettings;
|
||||||
( BOM_PRESET ){ .name = name,
|
m_bomPresets[name].readOnly = false;
|
||||||
.fieldsOrdered = m_schSettings.m_BomSettings.fieldsOrdered,
|
m_bomPresets[name].name = name;
|
||||||
.sortField = m_schSettings.m_BomSettings.sortField,
|
|
||||||
.sortAsc = m_schSettings.m_BomSettings.sortAsc,
|
|
||||||
.filterString = m_schSettings.m_BomSettings.filterString,
|
|
||||||
.groupSymbols = m_schSettings.m_BomSettings.groupSymbols };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOM_PRESET* preset = &m_bomPresets[name];
|
BOM_PRESET* preset = &m_bomPresets[name];
|
||||||
|
@ -1403,11 +1387,8 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomPresetChanged( wxCommandEvent& aEvent )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
preset->fieldsOrdered = m_schSettings.m_BomSettings.fieldsOrdered;
|
*preset = m_schSettings.m_BomSettings;
|
||||||
preset->sortField = m_schSettings.m_BomSettings.sortField;
|
preset->name = name;
|
||||||
preset->sortAsc = m_schSettings.m_BomSettings.sortAsc;
|
|
||||||
preset->filterString = m_schSettings.m_BomSettings.filterString;
|
|
||||||
preset->groupSymbols = m_schSettings.m_BomSettings.groupSymbols;
|
|
||||||
|
|
||||||
index = m_cbBomPresets->FindString( name );
|
index = m_cbBomPresets->FindString( name );
|
||||||
m_bomPresetMRU.Remove( name );
|
m_bomPresetMRU.Remove( name );
|
||||||
|
@ -1416,6 +1397,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomPresetChanged( wxCommandEvent& aEvent )
|
||||||
m_cbBomPresets->SetSelection( index );
|
m_cbBomPresets->SetSelection( index );
|
||||||
m_bomPresetMRU.Insert( name, 0 );
|
m_bomPresetMRU.Insert( name, 0 );
|
||||||
|
|
||||||
|
savePresetsToSchematic();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if( index == count - 1 )
|
else if( index == count - 1 )
|
||||||
|
@ -1456,6 +1438,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomPresetChanged( wxCommandEvent& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
resetSelection();
|
resetSelection();
|
||||||
|
savePresetsToSchematic();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1481,6 +1464,8 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomPresetChanged( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
void DIALOG_SYMBOL_FIELDS_TABLE::doApplyBomPreset( const BOM_PRESET& aPreset )
|
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
|
// 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.
|
// update our UI to reflect resulting the data model state, not the preset.
|
||||||
m_dataModel->ApplyBomPreset( aPreset );
|
m_dataModel->ApplyBomPreset( aPreset );
|
||||||
|
@ -1552,8 +1537,6 @@ void DIALOG_SYMBOL_FIELDS_TABLE::doApplyBomPreset( const BOM_PRESET& aPreset )
|
||||||
// and labels are right, then we refresh the shown grid data to match
|
// and labels are right, then we refresh the shown grid data to match
|
||||||
m_dataModel->RebuildRows();
|
m_dataModel->RebuildRows();
|
||||||
m_grid->ForceRefresh();
|
m_grid->ForceRefresh();
|
||||||
|
|
||||||
m_schSettings.m_BomSettings = aPreset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1776,6 +1759,8 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomFmtPresetChanged( wxCommandEvent& aEvent )
|
||||||
if( !exists )
|
if( !exists )
|
||||||
{
|
{
|
||||||
m_bomFmtPresets[name] = m_schSettings.m_BomFmtSettings;
|
m_bomFmtPresets[name] = m_schSettings.m_BomFmtSettings;
|
||||||
|
m_bomFmtPresets[name].readOnly = false;
|
||||||
|
m_bomFmtPresets[name].name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOM_FMT_PRESET* preset = &m_bomFmtPresets[name];
|
BOM_FMT_PRESET* preset = &m_bomFmtPresets[name];
|
||||||
|
@ -1797,6 +1782,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomFmtPresetChanged( wxCommandEvent& aEvent )
|
||||||
m_cbBomFmtPresets->SetSelection( index );
|
m_cbBomFmtPresets->SetSelection( index );
|
||||||
m_bomFmtPresetMRU.Insert( name, 0 );
|
m_bomFmtPresetMRU.Insert( name, 0 );
|
||||||
|
|
||||||
|
savePresetsToSchematic();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if( index == count - 1 )
|
else if( index == count - 1 )
|
||||||
|
@ -1837,6 +1823,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomFmtPresetChanged( wxCommandEvent& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
resetSelection();
|
resetSelection();
|
||||||
|
savePresetsToSchematic();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1863,19 +1850,41 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomFmtPresetChanged( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
void DIALOG_SYMBOL_FIELDS_TABLE::doApplyBomFmtPreset( const BOM_FMT_PRESET& aPreset )
|
void DIALOG_SYMBOL_FIELDS_TABLE::doApplyBomFmtPreset( const BOM_FMT_PRESET& aPreset )
|
||||||
{
|
{
|
||||||
|
m_schSettings.m_BomFmtSettings = aPreset;
|
||||||
|
|
||||||
m_textFieldDelimiter->ChangeValue( aPreset.fieldDelimiter );
|
m_textFieldDelimiter->ChangeValue( aPreset.fieldDelimiter );
|
||||||
m_textStringDelimiter->ChangeValue( aPreset.stringDelimiter );
|
m_textStringDelimiter->ChangeValue( aPreset.stringDelimiter );
|
||||||
m_textRefDelimiter->SetValue( aPreset.refDelimiter );
|
m_textRefDelimiter->ChangeValue( aPreset.refDelimiter );
|
||||||
m_textRefRangeDelimiter->SetValue( aPreset.refRangeDelimiter );
|
m_textRefRangeDelimiter->ChangeValue( aPreset.refRangeDelimiter );
|
||||||
m_checkKeepTabs->SetValue( aPreset.keepTabs );
|
m_checkKeepTabs->SetValue( aPreset.keepTabs );
|
||||||
m_checkKeepLineBreaks->SetValue( aPreset.keepLineBreaks );
|
m_checkKeepLineBreaks->SetValue( aPreset.keepLineBreaks );
|
||||||
|
|
||||||
PreviewRefresh();
|
PreviewRefresh();
|
||||||
|
}
|
||||||
m_schSettings.m_BomFmtSettings.fieldDelimiter = aPreset.fieldDelimiter;
|
|
||||||
m_schSettings.m_BomFmtSettings.stringDelimiter = aPreset.stringDelimiter;
|
|
||||||
m_schSettings.m_BomFmtSettings.refDelimiter = aPreset.refDelimiter;
|
void DIALOG_SYMBOL_FIELDS_TABLE::savePresetsToSchematic()
|
||||||
m_schSettings.m_BomFmtSettings.refRangeDelimiter = aPreset.refRangeDelimiter;
|
{
|
||||||
m_schSettings.m_BomFmtSettings.keepTabs = aPreset.keepTabs;
|
// Save our BOM presets
|
||||||
m_schSettings.m_BomFmtSettings.keepLineBreaks = aPreset.keepLineBreaks;
|
std::vector<BOM_PRESET> presets;
|
||||||
|
|
||||||
|
for( const std::pair<const wxString, BOM_PRESET>& pair : m_bomPresets )
|
||||||
|
{
|
||||||
|
if( !pair.second.readOnly )
|
||||||
|
presets.emplace_back( pair.second );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_schSettings.m_BomPresets = presets;
|
||||||
|
|
||||||
|
// Save our BOM Format presets
|
||||||
|
std::vector<BOM_FMT_PRESET> fmts;
|
||||||
|
|
||||||
|
for( const std::pair<const wxString, BOM_FMT_PRESET>& pair : m_bomFmtPresets )
|
||||||
|
{
|
||||||
|
if( !pair.second.readOnly )
|
||||||
|
fmts.emplace_back( pair.second );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_schSettings.m_BomFmtPresets = fmts;
|
||||||
|
m_parent->OnModify();
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,6 +121,8 @@ private:
|
||||||
BOM_FMT_PRESET* m_lastSelectedBomFmtPreset;
|
BOM_FMT_PRESET* m_lastSelectedBomFmtPreset;
|
||||||
wxArrayString m_bomFmtPresetMRU;
|
wxArrayString m_bomFmtPresetMRU;
|
||||||
|
|
||||||
|
void savePresetsToSchematic();
|
||||||
|
|
||||||
SCH_EDIT_FRAME* m_parent;
|
SCH_EDIT_FRAME* m_parent;
|
||||||
int m_fieldNameColWidth;
|
int m_fieldNameColWidth;
|
||||||
int m_labelColWidth;
|
int m_labelColWidth;
|
||||||
|
|
|
@ -42,8 +42,8 @@ namespace CLI
|
||||||
#define ARG_KEEP_TABS "--keep-tabs"
|
#define ARG_KEEP_TABS "--keep-tabs"
|
||||||
#define ARG_KEEP_TABS_DESC "Keep tab characters from input fields. Stripped by default."
|
#define ARG_KEEP_TABS_DESC "Keep tab characters from input fields. Stripped by default."
|
||||||
|
|
||||||
#define ARG_KEEP_LINE_BREAKS "--keep-newlines"
|
#define ARG_KEEP_LINE_BREAKS "--keep-line-breaks"
|
||||||
#define ARG_KEEP_LINE_BREAKS_DESC "Keep newline characters from input fields. Stripped by default."
|
#define ARG_KEEP_LINE_BREAKS_DESC "Keep line break characters from input fields. Stripped by default."
|
||||||
|
|
||||||
//Options for controlling the fields and the grouping
|
//Options for controlling the fields and the grouping
|
||||||
#define ARG_FIELDS "--fields"
|
#define ARG_FIELDS "--fields"
|
||||||
|
|
Loading…
Reference in New Issue