Component table improvements
This commit is contained in:
parent
6cefb68c7d
commit
d4e41c4f97
|
@ -88,13 +88,16 @@ protected:
|
||||||
bool m_Show; ///< Is this column visible?
|
bool m_Show; ///< Is this column visible?
|
||||||
bool m_ReadOnly; ///< Is this column read only?
|
bool m_ReadOnly; ///< Is this column read only?
|
||||||
|
|
||||||
|
bool m_sort; ///< Is this column used for sorting?
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BOM_COLUMN( unsigned int aId, BOM_COLUMN_TYPE aType, const wxString aTitle, bool aShow, bool aReadOnly = false ) :
|
BOM_COLUMN( unsigned int aId, BOM_COLUMN_TYPE aType, const wxString aTitle, bool aShow, bool aReadOnly = false, bool aSort = true ) :
|
||||||
m_id( aId ),
|
m_id( aId ),
|
||||||
m_Type( aType ),
|
m_Type( aType ),
|
||||||
m_Title( aTitle.Strip( wxString::both ) ),
|
m_Title( aTitle.Strip( wxString::both ) ),
|
||||||
m_Show( aShow ),
|
m_Show( aShow ),
|
||||||
m_ReadOnly( aReadOnly )
|
m_ReadOnly( aReadOnly ),
|
||||||
|
m_sort( aSort )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,11 +106,13 @@ public:
|
||||||
wxString Title() const { return m_Title; }
|
wxString Title() const { return m_Title; }
|
||||||
bool IsVisible() const { return m_Show; }
|
bool IsVisible() const { return m_Show; }
|
||||||
bool IsReadOnly() const { return m_ReadOnly; }
|
bool IsReadOnly() const { return m_ReadOnly; }
|
||||||
|
bool IsUsedToSort() const { return m_sort; }
|
||||||
|
|
||||||
//TODO - Should renaming of columns be allowed?
|
//TODO - Should renaming of columns be allowed?
|
||||||
//bool SetTitle( const wxString aTitle );
|
//bool SetTitle( const wxString aTitle );
|
||||||
void SetVisible( bool aShow = true ) { m_Show = aShow; }
|
void SetVisible( bool aShow = true ) { m_Show = aShow; }
|
||||||
void SetReadOnly( bool aReadOnly = true ) { m_ReadOnly = aReadOnly; }
|
void SetReadOnly( bool aReadOnly = true ) { m_ReadOnly = aReadOnly; }
|
||||||
|
void SetUsedToSort( bool aSort = true ) { m_sort = aSort; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,9 @@ static BOM_TABLE_ROW const* ItemToRow( wxDataViewItem aItem )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOM_FIELD_VALUES::BOM_FIELD_VALUES( wxString aRefDes ) : m_refDes( aRefDes )
|
BOM_FIELD_VALUES::BOM_FIELD_VALUES( wxString aRefDes, FIELD_VALUE_MAP* aTemplate ) :
|
||||||
|
m_refDes( aRefDes ),
|
||||||
|
m_templateValues( aTemplate )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,6 +89,24 @@ bool BOM_FIELD_VALUES::GetBackupValue( unsigned int aFieldId, wxString& aValue )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the template value for a provided field ID (if it exists)
|
||||||
|
*/
|
||||||
|
bool BOM_FIELD_VALUES::GetTemplateValue( unsigned int aFieldId, wxString& aValue ) const
|
||||||
|
{
|
||||||
|
if( !m_templateValues )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
auto search = m_templateValues->find( aFieldId );
|
||||||
|
|
||||||
|
if( search == m_templateValues->end() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
aValue = search->second;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value for the provided field ID
|
* Set the value for the provided field ID
|
||||||
* Field value is set under any of the following conditions:
|
* Field value is set under any of the following conditions:
|
||||||
|
@ -102,18 +122,6 @@ void BOM_FIELD_VALUES::SetFieldValue( unsigned int aFieldId, wxString aValue, bo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the backup value for the provided field ID
|
|
||||||
* If the backup value is already set, new value is ignored
|
|
||||||
*/
|
|
||||||
void BOM_FIELD_VALUES::SetBackupValue( unsigned int aFieldId, wxString aValue )
|
|
||||||
{
|
|
||||||
if( m_backupValues.count( aFieldId ) == 0 || m_backupValues[aFieldId].IsEmpty() )
|
|
||||||
{
|
|
||||||
m_backupValues[aFieldId] = aValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BOM_FIELD_VALUES::HasValueChanged( unsigned int aFieldId) const
|
bool BOM_FIELD_VALUES::HasValueChanged( unsigned int aFieldId) const
|
||||||
{
|
{
|
||||||
wxString currentValue, backupValue;
|
wxString currentValue, backupValue;
|
||||||
|
@ -133,6 +141,14 @@ void BOM_FIELD_VALUES::RevertChanges( unsigned int aFieldId )
|
||||||
SetFieldValue( aFieldId, backupValue, true );
|
SetFieldValue( aFieldId, backupValue, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BOM_FIELD_VALUES::SetBackupPoint()
|
||||||
|
{
|
||||||
|
for( auto it = m_currentValues.begin(); it != m_currentValues.end(); ++it )
|
||||||
|
{
|
||||||
|
m_backupValues[it->first] = it->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BOM_TABLE_ROW::BOM_TABLE_ROW() : m_columnList( nullptr )
|
BOM_TABLE_ROW::BOM_TABLE_ROW() : m_columnList( nullptr )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -317,6 +333,10 @@ bool BOM_TABLE_GROUP::AddComponent( BOM_TABLE_COMPONENT* aComponent )
|
||||||
|
|
||||||
for( auto* column : m_columnList->Columns )
|
for( auto* column : m_columnList->Columns )
|
||||||
{
|
{
|
||||||
|
// Ignore any columns marked as "not used for sorting"
|
||||||
|
if( !column->IsUsedToSort() )
|
||||||
|
continue;
|
||||||
|
|
||||||
match = TestField( column, aComponent );
|
match = TestField( column, aComponent );
|
||||||
|
|
||||||
// Escape on first mismatch
|
// Escape on first mismatch
|
||||||
|
@ -554,7 +574,6 @@ bool BOM_TABLE_COMPONENT::AddUnit( SCH_REFERENCE aUnit )
|
||||||
}
|
}
|
||||||
|
|
||||||
m_fieldValues->SetFieldValue( column->Id(), value );
|
m_fieldValues->SetFieldValue( column->Id(), value );
|
||||||
m_fieldValues->SetBackupValue( column->Id(), value );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -563,6 +582,7 @@ bool BOM_TABLE_COMPONENT::AddUnit( SCH_REFERENCE aUnit )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the value associated with a particular field
|
* Return the value associated with a particular field
|
||||||
* If no field is found, return an empty string
|
* If no field is found, return an empty string
|
||||||
|
@ -582,8 +602,15 @@ wxString BOM_TABLE_COMPONENT::GetFieldValue( unsigned int aFieldId ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_fieldValues )
|
if( m_fieldValues )
|
||||||
|
{
|
||||||
m_fieldValues->GetFieldValue( aFieldId, value );
|
m_fieldValues->GetFieldValue( aFieldId, value );
|
||||||
|
|
||||||
|
if( value.IsEmpty() )
|
||||||
|
{
|
||||||
|
m_fieldValues->GetTemplateValue( aFieldId, value );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -966,9 +993,9 @@ void BOM_TABLE_MODEL::AddComponentFields( SCH_COMPONENT* aCmp )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ColumnList.AddColumn( new BOM_COLUMN( ColumnList.NextFieldId(),
|
ColumnList.AddColumn( new BOM_COLUMN( ColumnList.NextFieldId(),
|
||||||
BOM_COL_TYPE_USER,
|
BOM_COL_TYPE_USER,
|
||||||
field->GetName(),
|
field->GetName(),
|
||||||
true, false ) );
|
true, false ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -976,8 +1003,9 @@ void BOM_TABLE_MODEL::AddComponentFields( SCH_COMPONENT* aCmp )
|
||||||
* Add a list of component items to the BOM manager
|
* Add a list of component items to the BOM manager
|
||||||
* Creates consolidated groups of components as required
|
* Creates consolidated groups of components as required
|
||||||
*/
|
*/
|
||||||
void BOM_TABLE_MODEL::SetComponents( SCH_REFERENCE_LIST aRefs )
|
void BOM_TABLE_MODEL::SetComponents( SCH_REFERENCE_LIST aRefs, const TEMPLATE_FIELDNAMES& aTemplateFields )
|
||||||
{
|
{
|
||||||
|
|
||||||
// Add default columns
|
// Add default columns
|
||||||
AddDefaultColumns();
|
AddDefaultColumns();
|
||||||
|
|
||||||
|
@ -993,10 +1021,33 @@ void BOM_TABLE_MODEL::SetComponents( SCH_REFERENCE_LIST aRefs )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add template fields if they are not already added
|
||||||
|
for( auto field : aTemplateFields )
|
||||||
|
{
|
||||||
|
BOM_COLUMN* col;
|
||||||
|
|
||||||
|
col = ColumnList.GetColumnByTitle( field.m_Name );
|
||||||
|
|
||||||
|
if( !col )
|
||||||
|
{
|
||||||
|
col = new BOM_COLUMN( ColumnList.NextFieldId(),
|
||||||
|
BOM_COL_TYPE_USER,
|
||||||
|
field.m_Name,
|
||||||
|
true, false );
|
||||||
|
|
||||||
|
ColumnList.AddColumn( col );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add template value for that field
|
||||||
|
m_fieldTemplates[col->Id()] = field.m_Value;
|
||||||
|
}
|
||||||
|
|
||||||
// Group multi-unit components together
|
// Group multi-unit components together
|
||||||
m_components.clear();
|
m_components.clear();
|
||||||
m_fieldValues.clear();
|
m_fieldValues.clear();
|
||||||
|
|
||||||
|
|
||||||
|
// Iterate through each unique component
|
||||||
for( unsigned int ii=0; ii<aRefs.GetCount(); ii++ )
|
for( unsigned int ii=0; ii<aRefs.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
auto ref = aRefs.GetItem( ii );
|
auto ref = aRefs.GetItem( ii );
|
||||||
|
@ -1033,7 +1084,7 @@ void BOM_TABLE_MODEL::SetComponents( SCH_REFERENCE_LIST aRefs )
|
||||||
|
|
||||||
if( !dataFound )
|
if( !dataFound )
|
||||||
{
|
{
|
||||||
values = new BOM_FIELD_VALUES( refDes );
|
values = new BOM_FIELD_VALUES( refDes, &m_fieldTemplates );
|
||||||
m_fieldValues.push_back( std::unique_ptr<BOM_FIELD_VALUES>( values ) );
|
m_fieldValues.push_back( std::unique_ptr<BOM_FIELD_VALUES>( values ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1043,6 +1094,17 @@ void BOM_TABLE_MODEL::SetComponents( SCH_REFERENCE_LIST aRefs )
|
||||||
m_components.push_back( std::unique_ptr<BOM_TABLE_COMPONENT>( newComponent ) );
|
m_components.push_back( std::unique_ptr<BOM_TABLE_COMPONENT>( newComponent ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetBackupPoint();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BOM_TABLE_MODEL::SetBackupPoint()
|
||||||
|
{
|
||||||
|
// Mark backup locations for all values
|
||||||
|
for( auto& vals : m_fieldValues )
|
||||||
|
{
|
||||||
|
vals->SetBackupPoint();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -58,13 +58,13 @@ typedef std::map<unsigned int, wxString> FIELD_VALUE_MAP;
|
||||||
class BOM_FIELD_VALUES
|
class BOM_FIELD_VALUES
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BOM_FIELD_VALUES(wxString aRefDes);
|
BOM_FIELD_VALUES( wxString aRefDes, FIELD_VALUE_MAP* aTemplate );
|
||||||
|
|
||||||
bool GetFieldValue( unsigned int aFieldId, wxString& aValue ) const;
|
bool GetFieldValue( unsigned int aFieldId, wxString& aValue ) const;
|
||||||
bool GetBackupValue( unsigned int aFieldId, wxString& aValue ) const;
|
bool GetBackupValue( unsigned int aFieldId, wxString& aValue ) const;
|
||||||
|
bool GetTemplateValue( unsigned int aFieldId, wxString& aValue ) const;
|
||||||
|
|
||||||
void SetFieldValue( unsigned int aFieldId, wxString aValue, bool aOverwrite = false );
|
void SetFieldValue( unsigned int aFieldId, wxString aValue, bool aOverwrite = false );
|
||||||
void SetBackupValue( unsigned int aFieldId, wxString aValue );
|
|
||||||
|
|
||||||
wxString GetReference() const { return m_refDes; }
|
wxString GetReference() const { return m_refDes; }
|
||||||
|
|
||||||
|
@ -72,6 +72,8 @@ public:
|
||||||
|
|
||||||
void RevertChanges( unsigned int aFieldId );
|
void RevertChanges( unsigned int aFieldId );
|
||||||
|
|
||||||
|
void SetBackupPoint();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! The RefDes to which these values correspond
|
//! The RefDes to which these values correspond
|
||||||
wxString m_refDes;
|
wxString m_refDes;
|
||||||
|
@ -81,6 +83,9 @@ protected:
|
||||||
|
|
||||||
//! Backup values for each column
|
//! Backup values for each column
|
||||||
FIELD_VALUE_MAP m_backupValues;
|
FIELD_VALUE_MAP m_backupValues;
|
||||||
|
|
||||||
|
//! Template values for each column
|
||||||
|
FIELD_VALUE_MAP* m_templateValues;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -140,7 +145,7 @@ public:
|
||||||
BOM_TABLE_GROUP( BOM_COLUMN_LIST* aColumnList );
|
BOM_TABLE_GROUP( BOM_COLUMN_LIST* aColumnList );
|
||||||
virtual ~BOM_TABLE_GROUP() {}
|
virtual ~BOM_TABLE_GROUP() {}
|
||||||
|
|
||||||
// Set display properties for
|
// Set display properties for a group row
|
||||||
virtual bool GetAttr( unsigned int aFieldId, wxDataViewItemAttr& aAttr ) const override;
|
virtual bool GetAttr( unsigned int aFieldId, wxDataViewItemAttr& aAttr ) const override;
|
||||||
|
|
||||||
// Get group row value
|
// Get group row value
|
||||||
|
@ -231,6 +236,9 @@ protected:
|
||||||
// Vector of field values mapped to field IDs
|
// Vector of field values mapped to field IDs
|
||||||
std::vector<std::unique_ptr<BOM_FIELD_VALUES>> m_fieldValues;
|
std::vector<std::unique_ptr<BOM_FIELD_VALUES>> m_fieldValues;
|
||||||
|
|
||||||
|
// Template field values
|
||||||
|
FIELD_VALUE_MAP m_fieldTemplates;
|
||||||
|
|
||||||
// BOM Preferences
|
// BOM Preferences
|
||||||
//! Group components based on values
|
//! Group components based on values
|
||||||
bool m_groupColumns = true;
|
bool m_groupColumns = true;
|
||||||
|
@ -307,7 +315,7 @@ public:
|
||||||
|
|
||||||
wxArrayString GetRowData( unsigned int aRow, std::vector<BOM_COLUMN*> aColumns ) const;
|
wxArrayString GetRowData( unsigned int aRow, std::vector<BOM_COLUMN*> aColumns ) const;
|
||||||
|
|
||||||
void SetComponents( SCH_REFERENCE_LIST aRefs );
|
void SetComponents( SCH_REFERENCE_LIST aRefs, const TEMPLATE_FIELDNAMES& aTemplateFields );
|
||||||
void AddComponentFields( SCH_COMPONENT* aCmp );
|
void AddComponentFields( SCH_COMPONENT* aCmp );
|
||||||
|
|
||||||
void RevertFieldChanges();
|
void RevertFieldChanges();
|
||||||
|
@ -315,6 +323,8 @@ public:
|
||||||
|
|
||||||
bool HaveFieldsChanged() const;
|
bool HaveFieldsChanged() const;
|
||||||
|
|
||||||
|
void SetBackupPoint();
|
||||||
|
|
||||||
std::vector<SCH_REFERENCE> GetChangedComponents();
|
std::vector<SCH_REFERENCE> GetChangedComponents();
|
||||||
unsigned int CountChangedComponents();
|
unsigned int CountChangedComponents();
|
||||||
};
|
};
|
||||||
|
|
|
@ -63,6 +63,12 @@ DIALOG_BOM_EDITOR::DIALOG_BOM_EDITOR( SCH_EDIT_FRAME* parent ) :
|
||||||
wxDATAVIEW_CELL_ACTIVATABLE,
|
wxDATAVIEW_CELL_ACTIVATABLE,
|
||||||
100 );
|
100 );
|
||||||
|
|
||||||
|
auto sortColumn = m_columnListCtrl->AppendToggleColumn(
|
||||||
|
_( "Sort" ),
|
||||||
|
wxDATAVIEW_CELL_ACTIVATABLE,
|
||||||
|
100 );
|
||||||
|
|
||||||
|
|
||||||
// Resize the columns appropriately
|
// Resize the columns appropriately
|
||||||
m_columnListCtrl->Update();
|
m_columnListCtrl->Update();
|
||||||
|
|
||||||
|
@ -75,6 +81,11 @@ DIALOG_BOM_EDITOR::DIALOG_BOM_EDITOR( SCH_EDIT_FRAME* parent ) :
|
||||||
nameColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE );
|
nameColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE );
|
||||||
nameColumn->SetResizeable( true );
|
nameColumn->SetResizeable( true );
|
||||||
|
|
||||||
|
sortColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE );
|
||||||
|
sortColumn->SetResizeable( true );
|
||||||
|
|
||||||
|
m_columnListCtrl->Update();
|
||||||
|
|
||||||
// Read all components
|
// Read all components
|
||||||
LoadComponents();
|
LoadComponents();
|
||||||
|
|
||||||
|
@ -109,6 +120,44 @@ DIALOG_BOM_EDITOR::~DIALOG_BOM_EDITOR()
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DIALOG_BOM_EDITOR::OnCloseButton( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
CloseDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DIALOG_BOM_EDITOR::CloseDialog()
|
||||||
|
{
|
||||||
|
if( !m_bom->HaveFieldsChanged() )
|
||||||
|
{
|
||||||
|
Destroy();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int result = DisplayExitDialog( this, _( "Changes exist in component table" ) );
|
||||||
|
|
||||||
|
switch( result )
|
||||||
|
{
|
||||||
|
case wxID_CANCEL:
|
||||||
|
return false;
|
||||||
|
case wxID_NO:
|
||||||
|
break;
|
||||||
|
case wxID_YES:
|
||||||
|
ApplyAllChanges();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Destroy();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DIALOG_BOM_EDITOR::OnDialogClosed( wxCloseEvent& event )
|
||||||
|
{
|
||||||
|
if( !CloseDialog() )
|
||||||
|
{
|
||||||
|
event.Veto();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Struct for keeping track of schematic sheet changes
|
/* Struct for keeping track of schematic sheet changes
|
||||||
* Stores:
|
* Stores:
|
||||||
* SHEET_PATH - Schematic to apply changes to
|
* SHEET_PATH - Schematic to apply changes to
|
||||||
|
@ -121,90 +170,85 @@ typedef struct
|
||||||
PICKED_ITEMS_LIST items;
|
PICKED_ITEMS_LIST items;
|
||||||
} SheetUndoList;
|
} SheetUndoList;
|
||||||
|
|
||||||
/**
|
void DIALOG_BOM_EDITOR::ApplyAllChanges()
|
||||||
* When the component table dialog is closed,
|
|
||||||
* work out if we need to save any changed.
|
|
||||||
* If so, capture those changes and push them to the undo stack.
|
|
||||||
*/
|
|
||||||
bool DIALOG_BOM_EDITOR::TransferDataFromWindow()
|
|
||||||
{
|
{
|
||||||
if( m_bom->HaveFieldsChanged() )
|
if( !m_bom->HaveFieldsChanged() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* As we may be saving changes across multiple sheets,
|
||||||
|
* we need to first determine which changes need to be made to which sheet.
|
||||||
|
* To this end, we perform the following:
|
||||||
|
* 1. Save the "path" of the currently displayed sheet
|
||||||
|
* 2. Create a MAP of <SheetPath:ChangeList> changes that need to be made
|
||||||
|
* 3. Push UNDO actions to appropriate sheets
|
||||||
|
* 4. Perform all the update actions
|
||||||
|
* 5. Reset the view to the current sheet
|
||||||
|
*/
|
||||||
|
|
||||||
|
auto currentSheet = m_parent->GetCurrentSheet();
|
||||||
|
|
||||||
|
//! Create a map of changes required for each sheet
|
||||||
|
std::map<wxString, SheetUndoList> undoSheetMap;
|
||||||
|
|
||||||
|
// List of components that have changed
|
||||||
|
auto changed = m_bom->GetChangedComponents();
|
||||||
|
|
||||||
|
ITEM_PICKER picker;
|
||||||
|
|
||||||
|
// Iterate through each of the components that were changed
|
||||||
|
for( auto ref : changed )
|
||||||
{
|
{
|
||||||
/**
|
// Extract the SCH_COMPONENT* object
|
||||||
* As we may be saving changes across multiple sheets,
|
auto cmp = ref.GetComp();
|
||||||
* we need to first determine which changes need to be made to which sheet.
|
|
||||||
* To this end, we perform the following:
|
wxString path = ref.GetSheetPath().Path();
|
||||||
* 1. Save the "path" of the currently displayed sheet
|
|
||||||
* 2. Create a MAP of <SheetPath:ChangeList> changes that need to be made
|
// Push the component into the picker list
|
||||||
* 3. Push UNDO actions to appropriate sheets
|
picker = ITEM_PICKER( cmp, UR_CHANGED );
|
||||||
* 4. Perform all the update actions
|
picker.SetFlags( cmp->GetFlags() );
|
||||||
* 5. Reset the view to the current sheet
|
|
||||||
|
/*
|
||||||
|
* If there is not currently an undo list for the given sheet,
|
||||||
|
* create an empty one
|
||||||
*/
|
*/
|
||||||
|
|
||||||
auto currentSheet = m_parent->GetCurrentSheet();
|
if( undoSheetMap.count( path ) == 0 )
|
||||||
|
|
||||||
//! Create a map of changes required for each sheet
|
|
||||||
std::map<wxString, SheetUndoList> undoSheetMap;
|
|
||||||
|
|
||||||
// List of components that have changed
|
|
||||||
auto changed = m_bom->GetChangedComponents();
|
|
||||||
|
|
||||||
ITEM_PICKER picker;
|
|
||||||
|
|
||||||
// Iterate through each of the components that were changed
|
|
||||||
for( auto ref : changed )
|
|
||||||
{
|
{
|
||||||
// Extract the SCH_COMPONENT* object
|
SheetUndoList newList;
|
||||||
auto cmp = ref.GetComp();
|
|
||||||
|
|
||||||
wxString path = ref.GetSheetPath().Path();
|
newList.path = ref.GetSheetPath();
|
||||||
|
|
||||||
// Push the component into the picker list
|
undoSheetMap[path] = newList;
|
||||||
picker = ITEM_PICKER( cmp, UR_CHANGED );
|
|
||||||
picker.SetFlags( cmp->GetFlags() );
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If there is not currently an undo list for the given sheet,
|
|
||||||
* create an empty one
|
|
||||||
*/
|
|
||||||
|
|
||||||
if( undoSheetMap.count( path ) == 0 )
|
|
||||||
{
|
|
||||||
SheetUndoList newList;
|
|
||||||
|
|
||||||
newList.path = ref.GetSheetPath();
|
|
||||||
|
|
||||||
undoSheetMap[path] = newList;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& pickerList = undoSheetMap[path];
|
|
||||||
|
|
||||||
pickerList.items.PushItem( picker );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterate through each sheet that needs updating
|
auto& pickerList = undoSheetMap[path];
|
||||||
for( auto it = undoSheetMap.begin(); it != undoSheetMap.end(); ++it )
|
|
||||||
{
|
|
||||||
auto undo = it->second;
|
|
||||||
|
|
||||||
m_parent->SetCurrentSheet( undo.path );
|
|
||||||
m_parent->SaveCopyInUndoList( undo.items, UR_CHANGED );
|
|
||||||
m_parent->OnModify();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make all component changes
|
|
||||||
m_bom->ApplyFieldChanges();
|
|
||||||
|
|
||||||
// Redraw the current sheet and mark as dirty
|
|
||||||
m_parent->Refresh();
|
|
||||||
m_parent->OnModify();
|
|
||||||
|
|
||||||
// Reset the view to where we left the user
|
|
||||||
m_parent->SetCurrentSheet(currentSheet);
|
|
||||||
|
|
||||||
|
pickerList.items.PushItem( picker );
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
// Iterate through each sheet that needs updating
|
||||||
|
for( auto it = undoSheetMap.begin(); it != undoSheetMap.end(); ++it )
|
||||||
|
{
|
||||||
|
auto undo = it->second;
|
||||||
|
|
||||||
|
m_parent->SetCurrentSheet( undo.path );
|
||||||
|
m_parent->SaveCopyInUndoList( undo.items, UR_CHANGED );
|
||||||
|
m_parent->OnModify();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make all component changes
|
||||||
|
m_bom->ApplyFieldChanges();
|
||||||
|
|
||||||
|
// Redraw the current sheet and mark as dirty
|
||||||
|
m_parent->Refresh();
|
||||||
|
m_parent->OnModify();
|
||||||
|
|
||||||
|
// Reset the view to where we left the user
|
||||||
|
m_parent->SetCurrentSheet(currentSheet);
|
||||||
|
|
||||||
|
// Instruct the table to set the current values as the new backup values
|
||||||
|
m_bom->SetBackupPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -252,7 +296,7 @@ void DIALOG_BOM_EDITOR::LoadComponents()
|
||||||
sheets.GetComponents( m_parent->Prj().SchLibs(), refs, false );
|
sheets.GetComponents( m_parent->Prj().SchLibs(), refs, false );
|
||||||
|
|
||||||
// Pass the references through to the model
|
// Pass the references through to the model
|
||||||
m_bom->SetComponents( refs );
|
m_bom->SetComponents( refs, m_parent->GetTemplateFieldNames() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -273,6 +317,7 @@ void DIALOG_BOM_EDITOR::LoadColumnNames()
|
||||||
|
|
||||||
data.push_back( wxVariant( col->Title() ) ); // Column title (string)
|
data.push_back( wxVariant( col->Title() ) ); // Column title (string)
|
||||||
data.push_back( wxVariant( col->IsVisible() ) ); // Column visibility (bool)
|
data.push_back( wxVariant( col->IsVisible() ) ); // Column visibility (bool)
|
||||||
|
data.push_back( wxVariant( col->IsUsedToSort() ) ); // Column is used to sort
|
||||||
|
|
||||||
m_columnListCtrl->AppendItem( data );
|
m_columnListCtrl->AppendItem( data );
|
||||||
}
|
}
|
||||||
|
@ -318,6 +363,10 @@ void DIALOG_BOM_EDITOR::OnColumnItemToggled( wxDataViewEvent& event )
|
||||||
m_bom->RemoveColumn( bomColumn );
|
m_bom->RemoveColumn( bomColumn );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 2: // Column used to sort
|
||||||
|
bomColumn->SetUsedToSort( bValue );
|
||||||
|
m_bom->ReloadTable();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +386,11 @@ void DIALOG_BOM_EDITOR::OnGroupComponentsToggled( wxCommandEvent& event )
|
||||||
void DIALOG_BOM_EDITOR::OnUpdateUI( wxUpdateUIEvent& event )
|
void DIALOG_BOM_EDITOR::OnUpdateUI( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
m_regroupComponentsButton->Enable( m_bom->GetColumnGrouping() );
|
m_regroupComponentsButton->Enable( m_bom->GetColumnGrouping() );
|
||||||
m_reloadTableButton->Enable( m_bom->HaveFieldsChanged() );
|
|
||||||
|
bool changes = m_bom->HaveFieldsChanged();
|
||||||
|
|
||||||
|
m_applyChangesButton->Enable( changes );
|
||||||
|
m_revertChangesButton->Enable( changes );
|
||||||
|
|
||||||
UpdateTitle();
|
UpdateTitle();
|
||||||
}
|
}
|
||||||
|
@ -353,6 +406,12 @@ void DIALOG_BOM_EDITOR::OnRegroupComponents( wxCommandEvent& event )
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DIALOG_BOM_EDITOR::OnApplyFieldChanges( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
ApplyAllChanges();
|
||||||
|
Update();
|
||||||
|
}
|
||||||
|
|
||||||
void DIALOG_BOM_EDITOR::OnRevertFieldChanges( wxCommandEvent& event )
|
void DIALOG_BOM_EDITOR::OnRevertFieldChanges( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
if( m_bom->HaveFieldsChanged() )
|
if( m_bom->HaveFieldsChanged() )
|
||||||
|
|
|
@ -57,13 +57,12 @@ private:
|
||||||
|
|
||||||
BOM_TABLE_MODEL::MODEL_PTR m_bom;
|
BOM_TABLE_MODEL::MODEL_PTR m_bom;
|
||||||
|
|
||||||
void LoadComponents( void );
|
void LoadComponents();
|
||||||
|
|
||||||
void LoadColumnNames( void );
|
void LoadColumnNames();
|
||||||
void ReloadColumns( void );
|
void ReloadColumns();
|
||||||
|
|
||||||
// Called when the OK button is pressed
|
void ApplyAllChanges();
|
||||||
virtual bool TransferDataFromWindow() override;
|
|
||||||
|
|
||||||
// Checkbox event callbacks
|
// Checkbox event callbacks
|
||||||
virtual void OnColumnItemToggled( wxDataViewEvent& event ) override;
|
virtual void OnColumnItemToggled( wxDataViewEvent& event ) override;
|
||||||
|
@ -71,6 +70,8 @@ private:
|
||||||
|
|
||||||
virtual void OnRevertFieldChanges( wxCommandEvent& event ) override;
|
virtual void OnRevertFieldChanges( wxCommandEvent& event ) override;
|
||||||
|
|
||||||
|
virtual void OnApplyFieldChanges( wxCommandEvent& event ) override;
|
||||||
|
|
||||||
virtual void OnRegroupComponents( wxCommandEvent& event ) override;
|
virtual void OnRegroupComponents( wxCommandEvent& event ) override;
|
||||||
|
|
||||||
// Called after a value in the table has changed
|
// Called after a value in the table has changed
|
||||||
|
@ -82,6 +83,12 @@ private:
|
||||||
// Called when a cell is right-clicked
|
// Called when a cell is right-clicked
|
||||||
virtual void OnTableItemContextMenu( wxDataViewEvent& event ) override;
|
virtual void OnTableItemContextMenu( wxDataViewEvent& event ) override;
|
||||||
|
|
||||||
|
// Called when the dialog is closed
|
||||||
|
virtual void OnDialogClosed( wxCloseEvent& event ) override;
|
||||||
|
virtual void OnCloseButton( wxCommandEvent& event ) override;
|
||||||
|
|
||||||
|
bool CloseDialog();
|
||||||
|
|
||||||
void UpdateTitle( void );
|
void UpdateTitle( void );
|
||||||
|
|
||||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) override;
|
virtual void OnUpdateUI( wxUpdateUIEvent& event ) override;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Feb 19 2017)
|
// C++ code generated with wxFormBuilder (version Apr 1 2017)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
@ -10,10 +10,10 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE( DIALOG_BOM_EDITOR_BASE, DIALOG_SHIM )
|
BEGIN_EVENT_TABLE( DIALOG_BOM_EDITOR_BASE, DIALOG_SHIM )
|
||||||
|
EVT_CLOSE( DIALOG_BOM_EDITOR_BASE::_wxFB_OnDialogClosed )
|
||||||
EVT_UPDATE_UI( wxID_ANY, DIALOG_BOM_EDITOR_BASE::_wxFB_OnUpdateUI )
|
EVT_UPDATE_UI( wxID_ANY, DIALOG_BOM_EDITOR_BASE::_wxFB_OnUpdateUI )
|
||||||
EVT_CHECKBOX( OPT_GROUP_COMPONENTS, DIALOG_BOM_EDITOR_BASE::_wxFB_OnGroupComponentsToggled )
|
EVT_CHECKBOX( OPT_GROUP_COMPONENTS, DIALOG_BOM_EDITOR_BASE::_wxFB_OnGroupComponentsToggled )
|
||||||
EVT_BUTTON( ID_BUTTON_REGROUP, DIALOG_BOM_EDITOR_BASE::_wxFB_OnRegroupComponents )
|
EVT_BUTTON( ID_BUTTON_REGROUP, DIALOG_BOM_EDITOR_BASE::_wxFB_OnRegroupComponents )
|
||||||
EVT_BUTTON( ID_BUTTON_REVERT_CHANGES, DIALOG_BOM_EDITOR_BASE::_wxFB_OnRevertFieldChanges )
|
|
||||||
EVT_DATAVIEW_ITEM_VALUE_CHANGED( wxID_ANY, DIALOG_BOM_EDITOR_BASE::_wxFB_OnColumnItemToggled )
|
EVT_DATAVIEW_ITEM_VALUE_CHANGED( wxID_ANY, DIALOG_BOM_EDITOR_BASE::_wxFB_OnColumnItemToggled )
|
||||||
EVT_DATAVIEW_COLUMN_REORDERED( wxID_ANY, DIALOG_BOM_EDITOR_BASE::_wxFB_OnBomColumReordered )
|
EVT_DATAVIEW_COLUMN_REORDERED( wxID_ANY, DIALOG_BOM_EDITOR_BASE::_wxFB_OnBomColumReordered )
|
||||||
EVT_DATAVIEW_COLUMN_SORTED( wxID_ANY, DIALOG_BOM_EDITOR_BASE::_wxFB_OnBomColumnSorted )
|
EVT_DATAVIEW_COLUMN_SORTED( wxID_ANY, DIALOG_BOM_EDITOR_BASE::_wxFB_OnBomColumnSorted )
|
||||||
|
@ -21,110 +21,116 @@ BEGIN_EVENT_TABLE( DIALOG_BOM_EDITOR_BASE, DIALOG_SHIM )
|
||||||
EVT_DATAVIEW_ITEM_CONTEXT_MENU( wxID_ANY, DIALOG_BOM_EDITOR_BASE::_wxFB_OnTableItemContextMenu )
|
EVT_DATAVIEW_ITEM_CONTEXT_MENU( wxID_ANY, DIALOG_BOM_EDITOR_BASE::_wxFB_OnTableItemContextMenu )
|
||||||
EVT_DATAVIEW_ITEM_EDITING_DONE( wxID_ANY, DIALOG_BOM_EDITOR_BASE::_wxFB_OnTableValueChanged )
|
EVT_DATAVIEW_ITEM_EDITING_DONE( wxID_ANY, DIALOG_BOM_EDITOR_BASE::_wxFB_OnTableValueChanged )
|
||||||
EVT_DATAVIEW_SELECTION_CHANGED( wxID_ANY, DIALOG_BOM_EDITOR_BASE::_wxFB_OnSelectionChanged )
|
EVT_DATAVIEW_SELECTION_CHANGED( wxID_ANY, DIALOG_BOM_EDITOR_BASE::_wxFB_OnSelectionChanged )
|
||||||
|
EVT_BUTTON( ID_BUTTON_APPLY, DIALOG_BOM_EDITOR_BASE::_wxFB_OnApplyFieldChanges )
|
||||||
|
EVT_BUTTON( ID_BUTTON_REVERT, DIALOG_BOM_EDITOR_BASE::_wxFB_OnRevertFieldChanges )
|
||||||
|
EVT_BUTTON( wxID_CANCEL, DIALOG_BOM_EDITOR_BASE::_wxFB_OnCloseButton )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
DIALOG_BOM_EDITOR_BASE::DIALOG_BOM_EDITOR_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
DIALOG_BOM_EDITOR_BASE::DIALOG_BOM_EDITOR_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||||
{
|
{
|
||||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||||
|
|
||||||
wxBoxSizer* bHorizontalSizer;
|
wxBoxSizer* bHorizontalSizer;
|
||||||
bHorizontalSizer = new wxBoxSizer( wxVERTICAL );
|
bHorizontalSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
wxBoxSizer* bSizer61;
|
||||||
|
bSizer61 = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
m_panel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
m_panel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||||
wxBoxSizer* bSizer7;
|
wxBoxSizer* bSizer7;
|
||||||
bSizer7 = new wxBoxSizer( wxVERTICAL );
|
bSizer7 = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
m_splitter1 = new wxSplitterWindow( m_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D );
|
m_splitter1 = new wxSplitterWindow( m_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D );
|
||||||
m_splitter1->Connect( wxEVT_IDLE, wxIdleEventHandler( DIALOG_BOM_EDITOR_BASE::m_splitter1OnIdle ), NULL, this );
|
m_splitter1->Connect( wxEVT_IDLE, wxIdleEventHandler( DIALOG_BOM_EDITOR_BASE::m_splitter1OnIdle ), NULL, this );
|
||||||
m_splitter1->SetMinimumPaneSize( 120 );
|
m_splitter1->SetMinimumPaneSize( 120 );
|
||||||
|
|
||||||
m_leftPanel = new wxPanel( m_splitter1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
m_leftPanel = new wxPanel( m_splitter1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||||
wxBoxSizer* bSizer6;
|
wxBoxSizer* bSizer6;
|
||||||
bSizer6 = new wxBoxSizer( wxVERTICAL );
|
bSizer6 = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
wxStaticBoxSizer* sbSizer1;
|
wxStaticBoxSizer* sbSizer1;
|
||||||
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_leftPanel, wxID_ANY, _("Options") ), wxVERTICAL );
|
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_leftPanel, wxID_ANY, _("Options") ), wxVERTICAL );
|
||||||
|
|
||||||
m_groupComponentsBox = new wxCheckBox( sbSizer1->GetStaticBox(), OPT_GROUP_COMPONENTS, _("Group components"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_groupComponentsBox = new wxCheckBox( sbSizer1->GetStaticBox(), OPT_GROUP_COMPONENTS, _("Group components"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_groupComponentsBox->SetValue(true);
|
m_groupComponentsBox->SetValue(true);
|
||||||
m_groupComponentsBox->SetToolTip( _("Group components together based on common properties") );
|
m_groupComponentsBox->SetToolTip( _("Group components together based on common properties") );
|
||||||
|
|
||||||
sbSizer1->Add( m_groupComponentsBox, 0, wxALL|wxEXPAND, 5 );
|
sbSizer1->Add( m_groupComponentsBox, 0, wxALL|wxEXPAND, 5 );
|
||||||
|
|
||||||
m_regroupComponentsButton = new wxButton( sbSizer1->GetStaticBox(), ID_BUTTON_REGROUP, _("Regroup components"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_regroupComponentsButton = new wxButton( sbSizer1->GetStaticBox(), ID_BUTTON_REGROUP, _("Regroup components"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
sbSizer1->Add( m_regroupComponentsButton, 0, wxALL|wxEXPAND, 5 );
|
sbSizer1->Add( m_regroupComponentsButton, 0, wxALL|wxEXPAND, 5 );
|
||||||
|
|
||||||
m_reloadTableButton = new wxButton( sbSizer1->GetStaticBox(), ID_BUTTON_REVERT_CHANGES, _("Revert all changes"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
m_reloadTableButton->Enable( false );
|
|
||||||
m_reloadTableButton->SetToolTip( _("Reload table (reverts component field changes)") );
|
|
||||||
|
|
||||||
sbSizer1->Add( m_reloadTableButton, 0, wxALL|wxEXPAND, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizer6->Add( sbSizer1, 0, wxEXPAND, 5 );
|
bSizer6->Add( sbSizer1, 0, wxEXPAND, 5 );
|
||||||
|
|
||||||
wxBoxSizer* bSizer9;
|
wxBoxSizer* bSizer9;
|
||||||
bSizer9 = new wxBoxSizer( wxVERTICAL );
|
bSizer9 = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
wxStaticBoxSizer* m_fieldListSizer;
|
wxStaticBoxSizer* m_fieldListSizer;
|
||||||
m_fieldListSizer = new wxStaticBoxSizer( new wxStaticBox( m_leftPanel, wxID_ANY, _("Fields") ), wxVERTICAL );
|
m_fieldListSizer = new wxStaticBoxSizer( new wxStaticBox( m_leftPanel, wxID_ANY, _("Fields") ), wxVERTICAL );
|
||||||
|
|
||||||
m_columnListCtrl = new wxDataViewListCtrl( m_fieldListSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
m_columnListCtrl = new wxDataViewListCtrl( m_fieldListSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_columnListCtrl->SetMinSize( wxSize( -1,250 ) );
|
m_columnListCtrl->SetMinSize( wxSize( -1,250 ) );
|
||||||
|
|
||||||
m_fieldListSizer->Add( m_columnListCtrl, 1, wxALL|wxEXPAND, 5 );
|
m_fieldListSizer->Add( m_columnListCtrl, 1, wxALL|wxEXPAND, 5 );
|
||||||
|
|
||||||
|
|
||||||
bSizer9->Add( m_fieldListSizer, 1, wxEXPAND, 5 );
|
bSizer9->Add( m_fieldListSizer, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
|
||||||
bSizer6->Add( bSizer9, 5, wxEXPAND, 5 );
|
bSizer6->Add( bSizer9, 5, wxEXPAND, 5 );
|
||||||
|
|
||||||
wxStaticBoxSizer* sbSizer4;
|
|
||||||
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_leftPanel, wxID_ANY, _("Apply changes") ), wxVERTICAL );
|
|
||||||
|
|
||||||
m_sdbSizer1 = new wxStdDialogButtonSizer();
|
|
||||||
m_sdbSizer1OK = new wxButton( sbSizer4->GetStaticBox(), wxID_OK );
|
|
||||||
m_sdbSizer1->AddButton( m_sdbSizer1OK );
|
|
||||||
m_sdbSizer1Cancel = new wxButton( sbSizer4->GetStaticBox(), wxID_CANCEL );
|
|
||||||
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
|
|
||||||
m_sdbSizer1->Realize();
|
|
||||||
|
|
||||||
sbSizer4->Add( m_sdbSizer1, 1, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizer6->Add( sbSizer4, 0, wxEXPAND, 10 );
|
|
||||||
|
|
||||||
|
|
||||||
m_leftPanel->SetSizer( bSizer6 );
|
m_leftPanel->SetSizer( bSizer6 );
|
||||||
m_leftPanel->Layout();
|
m_leftPanel->Layout();
|
||||||
bSizer6->Fit( m_leftPanel );
|
bSizer6->Fit( m_leftPanel );
|
||||||
m_panel4 = new wxPanel( m_splitter1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
m_panel4 = new wxPanel( m_splitter1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||||
wxBoxSizer* bSizer5;
|
wxBoxSizer* bSizer5;
|
||||||
bSizer5 = new wxBoxSizer( wxVERTICAL );
|
bSizer5 = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
m_bomView = new wxDataViewCtrl( m_panel4, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_MULTIPLE|wxDV_ROW_LINES|wxDV_VERT_RULES );
|
m_bomView = new wxDataViewCtrl( m_panel4, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_MULTIPLE|wxDV_ROW_LINES|wxDV_VERT_RULES );
|
||||||
m_bomView->SetMinSize( wxSize( 450,250 ) );
|
m_bomView->SetMinSize( wxSize( 450,250 ) );
|
||||||
|
|
||||||
bSizer5->Add( m_bomView, 1, wxALL|wxEXPAND, 5 );
|
bSizer5->Add( m_bomView, 1, wxALL|wxEXPAND, 5 );
|
||||||
|
|
||||||
|
|
||||||
m_panel4->SetSizer( bSizer5 );
|
m_panel4->SetSizer( bSizer5 );
|
||||||
m_panel4->Layout();
|
m_panel4->Layout();
|
||||||
bSizer5->Fit( m_panel4 );
|
bSizer5->Fit( m_panel4 );
|
||||||
m_splitter1->SplitVertically( m_leftPanel, m_panel4, 231 );
|
m_splitter1->SplitVertically( m_leftPanel, m_panel4, 231 );
|
||||||
bSizer7->Add( m_splitter1, 1, wxEXPAND, 5 );
|
bSizer7->Add( m_splitter1, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
|
||||||
m_panel->SetSizer( bSizer7 );
|
m_panel->SetSizer( bSizer7 );
|
||||||
m_panel->Layout();
|
m_panel->Layout();
|
||||||
bSizer7->Fit( m_panel );
|
bSizer7->Fit( m_panel );
|
||||||
bHorizontalSizer->Add( m_panel, 1, wxEXPAND | wxALL, 5 );
|
bSizer61->Add( m_panel, 1, wxEXPAND | wxALL, 5 );
|
||||||
|
|
||||||
|
wxBoxSizer* bSizer71;
|
||||||
|
bSizer71 = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
|
m_applyChangesButton = new wxButton( this, ID_BUTTON_APPLY, _("Apply Changes"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bSizer71->Add( m_applyChangesButton, 0, wxALL, 5 );
|
||||||
|
|
||||||
|
m_revertChangesButton = new wxButton( this, ID_BUTTON_REVERT, _("Revert Changes"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bSizer71->Add( m_revertChangesButton, 0, wxALL, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bSizer71->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
m_closeButton = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bSizer71->Add( m_closeButton, 0, wxALL, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bSizer61->Add( bSizer71, 0, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bHorizontalSizer->Add( bSizer61, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
|
||||||
this->SetSizer( bHorizontalSizer );
|
this->SetSizer( bHorizontalSizer );
|
||||||
this->Layout();
|
this->Layout();
|
||||||
|
|
||||||
this->Centre( wxBOTH );
|
this->Centre( wxBOTH );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Feb 19 2017)
|
// C++ code generated with wxFormBuilder (version Apr 1 2017)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
@ -32,7 +32,8 @@ class DIALOG_SHIM;
|
||||||
|
|
||||||
#define OPT_GROUP_COMPONENTS 1000
|
#define OPT_GROUP_COMPONENTS 1000
|
||||||
#define ID_BUTTON_REGROUP 1001
|
#define ID_BUTTON_REGROUP 1001
|
||||||
#define ID_BUTTON_REVERT_CHANGES 1002
|
#define ID_BUTTON_APPLY 1002
|
||||||
|
#define ID_BUTTON_REVERT 1003
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
/// Class DIALOG_BOM_EDITOR_BASE
|
/// Class DIALOG_BOM_EDITOR_BASE
|
||||||
|
@ -41,12 +42,12 @@ class DIALOG_BOM_EDITOR_BASE : public DIALOG_SHIM
|
||||||
{
|
{
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Private event handlers
|
// Private event handlers
|
||||||
|
void _wxFB_OnDialogClosed( wxCloseEvent& event ){ OnDialogClosed( event ); }
|
||||||
void _wxFB_OnUpdateUI( wxUpdateUIEvent& event ){ OnUpdateUI( event ); }
|
void _wxFB_OnUpdateUI( wxUpdateUIEvent& event ){ OnUpdateUI( event ); }
|
||||||
void _wxFB_OnGroupComponentsToggled( wxCommandEvent& event ){ OnGroupComponentsToggled( event ); }
|
void _wxFB_OnGroupComponentsToggled( wxCommandEvent& event ){ OnGroupComponentsToggled( event ); }
|
||||||
void _wxFB_OnRegroupComponents( wxCommandEvent& event ){ OnRegroupComponents( event ); }
|
void _wxFB_OnRegroupComponents( wxCommandEvent& event ){ OnRegroupComponents( event ); }
|
||||||
void _wxFB_OnRevertFieldChanges( wxCommandEvent& event ){ OnRevertFieldChanges( event ); }
|
|
||||||
void _wxFB_OnColumnItemToggled( wxDataViewEvent& event ){ OnColumnItemToggled( event ); }
|
void _wxFB_OnColumnItemToggled( wxDataViewEvent& event ){ OnColumnItemToggled( event ); }
|
||||||
void _wxFB_OnBomColumReordered( wxDataViewEvent& event ){ OnBomColumReordered( event ); }
|
void _wxFB_OnBomColumReordered( wxDataViewEvent& event ){ OnBomColumReordered( event ); }
|
||||||
void _wxFB_OnBomColumnSorted( wxDataViewEvent& event ){ OnBomColumnSorted( event ); }
|
void _wxFB_OnBomColumnSorted( wxDataViewEvent& event ){ OnBomColumnSorted( event ); }
|
||||||
|
@ -54,27 +55,29 @@ class DIALOG_BOM_EDITOR_BASE : public DIALOG_SHIM
|
||||||
void _wxFB_OnTableItemContextMenu( wxDataViewEvent& event ){ OnTableItemContextMenu( event ); }
|
void _wxFB_OnTableItemContextMenu( wxDataViewEvent& event ){ OnTableItemContextMenu( event ); }
|
||||||
void _wxFB_OnTableValueChanged( wxDataViewEvent& event ){ OnTableValueChanged( event ); }
|
void _wxFB_OnTableValueChanged( wxDataViewEvent& event ){ OnTableValueChanged( event ); }
|
||||||
void _wxFB_OnSelectionChanged( wxDataViewEvent& event ){ OnSelectionChanged( event ); }
|
void _wxFB_OnSelectionChanged( wxDataViewEvent& event ){ OnSelectionChanged( event ); }
|
||||||
|
void _wxFB_OnApplyFieldChanges( wxCommandEvent& event ){ OnApplyFieldChanges( event ); }
|
||||||
|
void _wxFB_OnRevertFieldChanges( wxCommandEvent& event ){ OnRevertFieldChanges( event ); }
|
||||||
|
void _wxFB_OnCloseButton( wxCommandEvent& event ){ OnCloseButton( event ); }
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxPanel* m_panel;
|
wxPanel* m_panel;
|
||||||
wxSplitterWindow* m_splitter1;
|
wxSplitterWindow* m_splitter1;
|
||||||
wxPanel* m_leftPanel;
|
wxPanel* m_leftPanel;
|
||||||
wxCheckBox* m_groupComponentsBox;
|
wxCheckBox* m_groupComponentsBox;
|
||||||
wxButton* m_regroupComponentsButton;
|
wxButton* m_regroupComponentsButton;
|
||||||
wxButton* m_reloadTableButton;
|
|
||||||
wxDataViewListCtrl* m_columnListCtrl;
|
wxDataViewListCtrl* m_columnListCtrl;
|
||||||
wxStdDialogButtonSizer* m_sdbSizer1;
|
|
||||||
wxButton* m_sdbSizer1OK;
|
|
||||||
wxButton* m_sdbSizer1Cancel;
|
|
||||||
wxPanel* m_panel4;
|
wxPanel* m_panel4;
|
||||||
wxDataViewCtrl* m_bomView;
|
wxDataViewCtrl* m_bomView;
|
||||||
|
wxButton* m_applyChangesButton;
|
||||||
|
wxButton* m_revertChangesButton;
|
||||||
|
wxButton* m_closeButton;
|
||||||
|
|
||||||
// Virtual event handlers, overide them in your derived class
|
// Virtual event handlers, overide them in your derived class
|
||||||
|
virtual void OnDialogClosed( wxCloseEvent& event ) { event.Skip(); }
|
||||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||||
virtual void OnGroupComponentsToggled( wxCommandEvent& event ) { event.Skip(); }
|
virtual void OnGroupComponentsToggled( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void OnRegroupComponents( wxCommandEvent& event ) { event.Skip(); }
|
virtual void OnRegroupComponents( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void OnRevertFieldChanges( wxCommandEvent& event ) { event.Skip(); }
|
|
||||||
virtual void OnColumnItemToggled( wxDataViewEvent& event ) { event.Skip(); }
|
virtual void OnColumnItemToggled( wxDataViewEvent& event ) { event.Skip(); }
|
||||||
virtual void OnBomColumReordered( wxDataViewEvent& event ) { event.Skip(); }
|
virtual void OnBomColumReordered( wxDataViewEvent& event ) { event.Skip(); }
|
||||||
virtual void OnBomColumnSorted( wxDataViewEvent& event ) { event.Skip(); }
|
virtual void OnBomColumnSorted( wxDataViewEvent& event ) { event.Skip(); }
|
||||||
|
@ -82,19 +85,22 @@ class DIALOG_BOM_EDITOR_BASE : public DIALOG_SHIM
|
||||||
virtual void OnTableItemContextMenu( wxDataViewEvent& event ) { event.Skip(); }
|
virtual void OnTableItemContextMenu( wxDataViewEvent& event ) { event.Skip(); }
|
||||||
virtual void OnTableValueChanged( wxDataViewEvent& event ) { event.Skip(); }
|
virtual void OnTableValueChanged( wxDataViewEvent& event ) { event.Skip(); }
|
||||||
virtual void OnSelectionChanged( wxDataViewEvent& event ) { event.Skip(); }
|
virtual void OnSelectionChanged( wxDataViewEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnApplyFieldChanges( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnRevertFieldChanges( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnCloseButton( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DIALOG_BOM_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("BOM editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 1047,471 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
DIALOG_BOM_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("BOM editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 775,654 ), long style = wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER );
|
||||||
~DIALOG_BOM_EDITOR_BASE();
|
~DIALOG_BOM_EDITOR_BASE();
|
||||||
|
|
||||||
void m_splitter1OnIdle( wxIdleEvent& )
|
void m_splitter1OnIdle( wxIdleEvent& )
|
||||||
{
|
{
|
||||||
m_splitter1->SetSashPosition( 231 );
|
m_splitter1->SetSashPosition( 231 );
|
||||||
m_splitter1->Disconnect( wxEVT_IDLE, wxIdleEventHandler( DIALOG_BOM_EDITOR_BASE::m_splitter1OnIdle ), NULL, this );
|
m_splitter1->Disconnect( wxEVT_IDLE, wxIdleEventHandler( DIALOG_BOM_EDITOR_BASE::m_splitter1OnIdle ), NULL, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //__DIALOG_BOM_EDITOR_BASE_H__
|
#endif //__DIALOG_BOM_EDITOR_BASE_H__
|
||||||
|
|
Loading…
Reference in New Issue