Formatting.
This commit is contained in:
parent
f6d0e17c8b
commit
39835fe82a
|
@ -168,8 +168,10 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent ) :
|
DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent ) :
|
||||||
DIALOG_SYMBOL_FIELDS_TABLE_BASE( parent ), m_currentBomPreset( nullptr ),
|
DIALOG_SYMBOL_FIELDS_TABLE_BASE( parent ),
|
||||||
m_lastSelectedBomPreset( nullptr ), m_parent( parent ),
|
m_currentBomPreset( nullptr ),
|
||||||
|
m_lastSelectedBomPreset( nullptr ),
|
||||||
|
m_parent( parent ),
|
||||||
m_schSettings( parent->Schematic().Settings() )
|
m_schSettings( parent->Schematic().Settings() )
|
||||||
{
|
{
|
||||||
// Get all symbols from the list of schematic sheets
|
// Get all symbols from the list of schematic sheets
|
||||||
|
@ -463,7 +465,7 @@ bool DIALOG_SYMBOL_FIELDS_TABLE::TransferDataToWindow()
|
||||||
|
|
||||||
if( selection.GetSize() == 1 )
|
if( selection.GetSize() == 1 )
|
||||||
{
|
{
|
||||||
EDA_ITEM* item = selection.Front();
|
EDA_ITEM* item = selection.Front();
|
||||||
|
|
||||||
if( item->Type() == SCH_SYMBOL_T )
|
if( item->Type() == SCH_SYMBOL_T )
|
||||||
symbol = (SCH_SYMBOL*) item;
|
symbol = (SCH_SYMBOL*) item;
|
||||||
|
@ -571,8 +573,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::AddField( const wxString& aFieldName, const wxS
|
||||||
m_dataModel->AddColumn( aFieldName, aLabelValue, addedByUser );
|
m_dataModel->AddColumn( aFieldName, aLabelValue, addedByUser );
|
||||||
|
|
||||||
wxVector<wxVariant> fieldsCtrlRow;
|
wxVector<wxVariant> fieldsCtrlRow;
|
||||||
|
std::string key( aFieldName.ToUTF8() );
|
||||||
std::string key( aFieldName.ToUTF8() );
|
|
||||||
|
|
||||||
// Don't change these to emplace_back: some versions of wxWidgets don't support it
|
// Don't change these to emplace_back: some versions of wxWidgets don't support it
|
||||||
fieldsCtrlRow.push_back( wxVariant( aFieldName ) );
|
fieldsCtrlRow.push_back( wxVariant( aFieldName ) );
|
||||||
|
@ -637,8 +638,10 @@ void DIALOG_SYMBOL_FIELDS_TABLE::LoadFieldNames()
|
||||||
m_schSettings.m_TemplateFieldNames.GetTemplateFieldNames() )
|
m_schSettings.m_TemplateFieldNames.GetTemplateFieldNames() )
|
||||||
{
|
{
|
||||||
if( userFieldNames.count( templateFieldname.m_Name ) == 0 )
|
if( userFieldNames.count( templateFieldname.m_Name ) == 0 )
|
||||||
|
{
|
||||||
AddField( templateFieldname.m_Name, GetTextVars( templateFieldname.m_Name ), false,
|
AddField( templateFieldname.m_Name, GetTextVars( templateFieldname.m_Name ), false,
|
||||||
false );
|
false );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -689,8 +692,8 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnRemoveField( wxCommandEvent& event )
|
||||||
wxString fieldName = m_fieldsCtrl->GetTextValue( row, FIELD_NAME_COLUMN );
|
wxString fieldName = m_fieldsCtrl->GetTextValue( row, FIELD_NAME_COLUMN );
|
||||||
wxString displayName = m_fieldsCtrl->GetTextValue( row, DISPLAY_NAME_COLUMN );
|
wxString displayName = m_fieldsCtrl->GetTextValue( row, DISPLAY_NAME_COLUMN );
|
||||||
|
|
||||||
wxString confirm_msg =
|
wxString confirm_msg = wxString::Format( _( "Are you sure you want to remove the field '%s'?" ),
|
||||||
wxString::Format( _( "Are you sure you want to remove the field '%s'?" ), displayName );
|
displayName );
|
||||||
|
|
||||||
if( !IsOK( this, confirm_msg ) )
|
if( !IsOK( this, confirm_msg ) )
|
||||||
return;
|
return;
|
||||||
|
@ -750,9 +753,8 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnRenameField( wxCommandEvent& event )
|
||||||
// New field name already exists
|
// New field name already exists
|
||||||
if( m_dataModel->GetFieldNameCol( newFieldName ) != -1 )
|
if( m_dataModel->GetFieldNameCol( newFieldName ) != -1 )
|
||||||
{
|
{
|
||||||
wxString confirm_msg = wxString::Format(
|
wxString confirm_msg = wxString::Format( _( "Field name %s already exists." ),
|
||||||
_( "Field name %s already exists. Cannot rename over existing field." ),
|
newFieldName );
|
||||||
newFieldName );
|
|
||||||
DisplayError( this, confirm_msg );
|
DisplayError( this, confirm_msg );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -818,9 +820,9 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnColumnItemToggled( wxDataViewEvent& event )
|
||||||
{
|
{
|
||||||
case SHOW_FIELD_COLUMN:
|
case SHOW_FIELD_COLUMN:
|
||||||
{
|
{
|
||||||
bool value = m_fieldsCtrl->GetToggleValue( row, col );
|
wxString name = m_fieldsCtrl->GetTextValue( row, FIELD_NAME_COLUMN );
|
||||||
int dataCol = m_dataModel->GetFieldNameCol(
|
bool value = m_fieldsCtrl->GetToggleValue( row, col );
|
||||||
m_fieldsCtrl->GetTextValue( row, FIELD_NAME_COLUMN ) );
|
int dataCol = m_dataModel->GetFieldNameCol( name );
|
||||||
|
|
||||||
m_dataModel->SetShowColumn( dataCol, value );
|
m_dataModel->SetShowColumn( dataCol, value );
|
||||||
|
|
||||||
|
@ -837,9 +839,9 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnColumnItemToggled( wxDataViewEvent& event )
|
||||||
|
|
||||||
case GROUP_BY_COLUMN:
|
case GROUP_BY_COLUMN:
|
||||||
{
|
{
|
||||||
bool value = m_fieldsCtrl->GetToggleValue( row, col );
|
wxString name = m_fieldsCtrl->GetTextValue( row, FIELD_NAME_COLUMN );
|
||||||
int dataCol = m_dataModel->GetFieldNameCol(
|
bool value = m_fieldsCtrl->GetToggleValue( row, col );
|
||||||
m_fieldsCtrl->GetTextValue( row, FIELD_NAME_COLUMN ) );
|
int dataCol = m_dataModel->GetFieldNameCol( name );
|
||||||
|
|
||||||
if( m_dataModel->ColIsQuantity( dataCol ) && value )
|
if( m_dataModel->ColIsQuantity( dataCol ) && value )
|
||||||
{
|
{
|
||||||
|
@ -1239,11 +1241,15 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnOutputFileBrowseClicked( wxCommandEvent& even
|
||||||
void DIALOG_SYMBOL_FIELDS_TABLE::OnExport( wxCommandEvent& aEvent )
|
void DIALOG_SYMBOL_FIELDS_TABLE::OnExport( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
if( m_dataModel->IsEdited() )
|
if( m_dataModel->IsEdited() )
|
||||||
|
{
|
||||||
if( OKOrCancelDialog( nullptr, _( "Unsaved data" ),
|
if( OKOrCancelDialog( nullptr, _( "Unsaved data" ),
|
||||||
_( "Changes are unsaved. Export unsaved data?" ), "", _( "OK" ),
|
_( "Changes have not yet been saved. Export unsaved data?" ), "",
|
||||||
_( "Cancel" ) )
|
_( "OK" ), _( "Cancel" ) )
|
||||||
== wxID_CANCEL )
|
== wxID_CANCEL )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create output directory if it does not exist (also transform it in absolute form).
|
// Create output directory if it does not exist (also transform it in absolute form).
|
||||||
// Bail if it fails.
|
// Bail if it fails.
|
||||||
|
@ -1854,9 +1860,9 @@ void DIALOG_SYMBOL_FIELDS_TABLE::ApplyBomFmtPreset( const BOM_FMT_PRESET& aPrese
|
||||||
else
|
else
|
||||||
m_currentBomFmtPreset = nullptr;
|
m_currentBomFmtPreset = nullptr;
|
||||||
|
|
||||||
m_lastSelectedBomFmtPreset = ( m_currentBomFmtPreset && !m_currentBomFmtPreset->readOnly )
|
m_lastSelectedBomFmtPreset = ( m_currentBomFmtPreset
|
||||||
? m_currentBomFmtPreset
|
&& !m_currentBomFmtPreset->readOnly ) ? m_currentBomFmtPreset
|
||||||
: nullptr;
|
: nullptr;
|
||||||
|
|
||||||
updateBomFmtPresetSelection( aPreset.name );
|
updateBomFmtPresetSelection( aPreset.name );
|
||||||
doApplyBomFmtPreset( aPreset );
|
doApplyBomFmtPreset( aPreset );
|
||||||
|
@ -2103,8 +2109,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::onBomFmtPresetChanged( wxCommandEvent& aEvent )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOM_FMT_PRESET* preset =
|
auto* preset = static_cast<BOM_FMT_PRESET*>( m_cbBomFmtPresets->GetClientData( index ) );
|
||||||
static_cast<BOM_FMT_PRESET*>( m_cbBomFmtPresets->GetClientData( index ) );
|
|
||||||
m_currentBomFmtPreset = preset;
|
m_currentBomFmtPreset = preset;
|
||||||
|
|
||||||
m_lastSelectedBomFmtPreset = ( !preset || preset->readOnly ) ? nullptr : preset;
|
m_lastSelectedBomFmtPreset = ( !preset || preset->readOnly ) ? nullptr : preset;
|
||||||
|
@ -2243,10 +2248,14 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnSchItemsRemoved( SCHEMATIC& aSch
|
||||||
for( SCH_ITEM* item : aSchItem )
|
for( SCH_ITEM* item : aSchItem )
|
||||||
{
|
{
|
||||||
if( item->Type() == SCH_SYMBOL_T )
|
if( item->Type() == SCH_SYMBOL_T )
|
||||||
|
{
|
||||||
m_dataModel->RemoveSymbol( *static_cast<SCH_SYMBOL*>( item ) );
|
m_dataModel->RemoveSymbol( *static_cast<SCH_SYMBOL*>( item ) );
|
||||||
|
}
|
||||||
else if( item->Type() == SCH_SHEET_T )
|
else if( item->Type() == SCH_SHEET_T )
|
||||||
|
{
|
||||||
m_dataModel->RemoveReferences(
|
m_dataModel->RemoveReferences(
|
||||||
getSheetSymbolReferences( *static_cast<SCH_SHEET*>( item ) ) );
|
getSheetSymbolReferences( *static_cast<SCH_SHEET*>( item ) ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DisableSelectionEvents();
|
DisableSelectionEvents();
|
||||||
|
|
|
@ -130,11 +130,6 @@ private:
|
||||||
void doApplyBomPreset( const BOM_PRESET& aPreset );
|
void doApplyBomPreset( const BOM_PRESET& aPreset );
|
||||||
void loadDefaultBomPresets();
|
void loadDefaultBomPresets();
|
||||||
|
|
||||||
std::map<wxString, BOM_PRESET> m_bomPresets;
|
|
||||||
BOM_PRESET* m_currentBomPreset;
|
|
||||||
BOM_PRESET* m_lastSelectedBomPreset;
|
|
||||||
wxArrayString m_bomPresetMRU;
|
|
||||||
|
|
||||||
void syncBomFmtPresetSelection();
|
void syncBomFmtPresetSelection();
|
||||||
void rebuildBomFmtPresetsWidget();
|
void rebuildBomFmtPresetsWidget();
|
||||||
void updateBomFmtPresetSelection( const wxString& aName );
|
void updateBomFmtPresetSelection( const wxString& aName );
|
||||||
|
@ -142,23 +137,29 @@ private:
|
||||||
void doApplyBomFmtPreset( const BOM_FMT_PRESET& aPreset );
|
void doApplyBomFmtPreset( const BOM_FMT_PRESET& aPreset );
|
||||||
void loadDefaultBomFmtPresets();
|
void loadDefaultBomFmtPresets();
|
||||||
|
|
||||||
|
void savePresetsToSchematic();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::map<wxString, BOM_PRESET> m_bomPresets;
|
||||||
|
BOM_PRESET* m_currentBomPreset;
|
||||||
|
BOM_PRESET* m_lastSelectedBomPreset;
|
||||||
|
wxArrayString m_bomPresetMRU;
|
||||||
|
|
||||||
std::map<wxString, BOM_FMT_PRESET> m_bomFmtPresets;
|
std::map<wxString, BOM_FMT_PRESET> m_bomFmtPresets;
|
||||||
BOM_FMT_PRESET* m_currentBomFmtPreset;
|
BOM_FMT_PRESET* m_currentBomFmtPreset;
|
||||||
BOM_FMT_PRESET* m_lastSelectedBomFmtPreset;
|
BOM_FMT_PRESET* m_lastSelectedBomFmtPreset;
|
||||||
wxArrayString m_bomFmtPresetMRU;
|
wxArrayString m_bomFmtPresetMRU;
|
||||||
|
|
||||||
void savePresetsToSchematic();
|
SCH_EDIT_FRAME* m_parent;
|
||||||
|
int m_fieldNameColWidth;
|
||||||
|
int m_labelColWidth;
|
||||||
|
int m_showColWidth;
|
||||||
|
int m_groupByColWidth;
|
||||||
|
|
||||||
SCH_EDIT_FRAME* m_parent;
|
SCH_REFERENCE_LIST m_symbolsList;
|
||||||
int m_fieldNameColWidth;
|
FIELDS_EDITOR_GRID_DATA_MODEL* m_dataModel;
|
||||||
int m_labelColWidth;
|
|
||||||
int m_showColWidth;
|
|
||||||
int m_groupByColWidth;
|
|
||||||
|
|
||||||
SCH_REFERENCE_LIST m_symbolsList;
|
SCHEMATIC_SETTINGS& m_schSettings;
|
||||||
FIELDS_EDITOR_GRID_DATA_MODEL* m_dataModel;
|
|
||||||
|
|
||||||
SCHEMATIC_SETTINGS& m_schSettings;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* DIALOG_SYMBOL_FIELDS_TABLE_H */
|
#endif /* DIALOG_SYMBOL_FIELDS_TABLE_H */
|
||||||
|
|
|
@ -38,10 +38,6 @@ class NGSPICE_SETTINGS;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These settings were stored in SCH_BASE_FRAME previously.
|
|
||||||
* The backing store is currently the project file.
|
|
||||||
* They should likely move to a project settings file (JSON) once that framework exists.
|
|
||||||
*
|
|
||||||
* These are loaded from Eeschema settings but then overwritten by the project settings.
|
* These are loaded from Eeschema settings but then overwritten by the project settings.
|
||||||
* All of the values are stored in IU, but the backing file stores in mils.
|
* All of the values are stored in IU, but the backing file stores in mils.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue