2017-04-02 12:09:01 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2017 Oliver Walters
|
2018-01-07 03:37:49 +00:00
|
|
|
* Copyright (C) 2017-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2017-04-02 12:09:01 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <wx/colour.h>
|
|
|
|
#include <wx/msgdlg.h>
|
|
|
|
#include <wx/progdlg.h>
|
|
|
|
#include <wx/file.h>
|
|
|
|
#include <wx/filename.h>
|
|
|
|
|
|
|
|
#include <confirm.h>
|
|
|
|
|
|
|
|
#include <build_version.h>
|
|
|
|
#include <general.h>
|
|
|
|
#include <class_library.h>
|
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
#include "dialog_fields_editor_global.h"
|
|
|
|
#include <fields_editor_table_model.h>
|
2017-04-02 12:09:01 +00:00
|
|
|
|
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
// Create and show fields editor
|
2017-06-07 16:43:28 +00:00
|
|
|
void InvokeDialogCreateBOMEditor( SCH_EDIT_FRAME* aCaller )
|
2017-04-02 12:09:01 +00:00
|
|
|
{
|
2018-02-09 16:35:45 +00:00
|
|
|
DIALOG_FIELDS_EDITOR_GLOBAL dlg( aCaller );
|
2017-06-07 16:43:28 +00:00
|
|
|
dlg.ShowQuasiModal();
|
2017-04-02 12:09:01 +00:00
|
|
|
}
|
|
|
|
|
2017-11-03 08:41:48 +00:00
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL( SCH_EDIT_FRAME* parent ) :
|
|
|
|
DIALOG_FIELDS_EDITOR_GLOBAL_BASE( parent ),
|
2017-04-02 12:09:01 +00:00
|
|
|
m_parent( parent )
|
|
|
|
{
|
2018-02-09 16:35:45 +00:00
|
|
|
m_bom = FIELDS_EDITOR_TABLE_MODEL::Create();
|
2017-04-02 12:09:01 +00:00
|
|
|
|
|
|
|
auto nameColumn = m_columnListCtrl->AppendTextColumn( _( "Field" ) );
|
|
|
|
|
|
|
|
auto showColumn = m_columnListCtrl->AppendToggleColumn(
|
|
|
|
_( "Show" ),
|
|
|
|
wxDATAVIEW_CELL_ACTIVATABLE,
|
|
|
|
100 );
|
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
auto sortColumn = m_columnListCtrl->AppendToggleColumn(
|
|
|
|
_( "Sort" ),
|
|
|
|
wxDATAVIEW_CELL_ACTIVATABLE,
|
|
|
|
100 );
|
|
|
|
|
|
|
|
|
2017-04-02 12:09:01 +00:00
|
|
|
// Read all components
|
|
|
|
LoadComponents();
|
|
|
|
|
|
|
|
LoadColumnNames();
|
|
|
|
ReloadColumns();
|
|
|
|
|
|
|
|
m_bom->ReloadTable();
|
|
|
|
|
2017-12-05 12:51:09 +00:00
|
|
|
// Set default column widths for fields table
|
|
|
|
showColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE );
|
|
|
|
showColumn->SetResizeable( false );
|
2017-05-02 17:51:02 +00:00
|
|
|
|
2017-12-05 12:51:09 +00:00
|
|
|
nameColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE );
|
|
|
|
nameColumn->SetResizeable( true );
|
|
|
|
|
|
|
|
sortColumn->SetWidth( wxCOL_WIDTH_AUTOSIZE );
|
|
|
|
sortColumn->SetResizeable( false );
|
2017-05-03 06:24:45 +00:00
|
|
|
|
2017-12-05 12:51:09 +00:00
|
|
|
// Set default column widths for BOM table
|
2017-05-03 06:24:45 +00:00
|
|
|
for( unsigned int ii = 0; ii < m_bomView->GetColumnCount(); ii++ )
|
|
|
|
{
|
|
|
|
auto col = m_bomView->GetColumn( ii );
|
|
|
|
|
|
|
|
if( !col )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
col->SetWidth( wxCOL_WIDTH_AUTOSIZE );
|
|
|
|
col->SetResizeable( true );
|
|
|
|
}
|
|
|
|
|
2017-05-02 17:51:02 +00:00
|
|
|
Layout();
|
2018-01-07 03:37:49 +00:00
|
|
|
SetSizeInDU( 400, 240 );
|
|
|
|
Center();
|
2017-04-02 12:09:01 +00:00
|
|
|
}
|
|
|
|
|
2017-06-07 16:43:28 +00:00
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
DIALOG_FIELDS_EDITOR_GLOBAL::~DIALOG_FIELDS_EDITOR_GLOBAL()
|
2017-04-02 12:09:01 +00:00
|
|
|
{
|
2017-06-07 16:43:28 +00:00
|
|
|
// Nothing to do.
|
2017-04-02 12:09:01 +00:00
|
|
|
}
|
|
|
|
|
2017-06-07 16:43:28 +00:00
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
void DIALOG_FIELDS_EDITOR_GLOBAL::OnCloseButton( wxCommandEvent& event )
|
2017-05-08 10:41:46 +00:00
|
|
|
{
|
2018-02-09 16:35:45 +00:00
|
|
|
// DIALOG_FIELDS_EDITOR_GLOBAL::OnDialogClosed() will be called,
|
2017-06-07 16:43:28 +00:00
|
|
|
// when closing this dialog.
|
|
|
|
// The default wxID_CANCEL handler is not suitable for us,
|
|
|
|
// because it calls DIALOG_SHIM::EndQuasiModal() without calling
|
2018-02-09 16:35:45 +00:00
|
|
|
// DIALOG_FIELDS_EDITOR_GLOBAL::OnDialogClosed()
|
2017-06-07 16:43:28 +00:00
|
|
|
Close();
|
2017-05-08 10:41:46 +00:00
|
|
|
}
|
|
|
|
|
2017-06-07 16:43:28 +00:00
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
bool DIALOG_FIELDS_EDITOR_GLOBAL::CanCloseDialog()
|
2017-05-08 10:41:46 +00:00
|
|
|
{
|
|
|
|
if( !m_bom->HaveFieldsChanged() )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
int result = DisplayExitDialog( this, _( "Changes exist in component table" ) );
|
|
|
|
|
|
|
|
switch( result )
|
|
|
|
{
|
|
|
|
case wxID_CANCEL:
|
|
|
|
return false;
|
2017-06-07 16:43:28 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
case wxID_NO:
|
|
|
|
break;
|
2017-06-07 16:43:28 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
case wxID_YES:
|
|
|
|
ApplyAllChanges();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-06-07 16:43:28 +00:00
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
void DIALOG_FIELDS_EDITOR_GLOBAL::OnDialogClosed( wxCloseEvent& event )
|
2017-05-08 10:41:46 +00:00
|
|
|
{
|
2017-06-07 16:43:28 +00:00
|
|
|
if( !CanCloseDialog() )
|
2017-05-08 10:41:46 +00:00
|
|
|
{
|
|
|
|
event.Veto();
|
|
|
|
}
|
2017-06-07 16:43:28 +00:00
|
|
|
else
|
|
|
|
// Mandatory to call DIALOG_SHIM::OnCloseWindow( wxCloseEvent& aEvent )
|
|
|
|
// and actually close the dialog
|
|
|
|
event.Skip();
|
2017-05-08 10:41:46 +00:00
|
|
|
}
|
|
|
|
|
2017-06-07 16:43:28 +00:00
|
|
|
|
2017-04-18 14:10:17 +00:00
|
|
|
/* Struct for keeping track of schematic sheet changes
|
|
|
|
* Stores:
|
|
|
|
* SHEET_PATH - Schematic to apply changes to
|
|
|
|
* PICKED_ITEMS_LIST - List of changes to apply
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
SCH_SHEET_PATH path;
|
|
|
|
PICKED_ITEMS_LIST items;
|
|
|
|
} SheetUndoList;
|
|
|
|
|
2017-12-29 15:44:33 +00:00
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
void DIALOG_FIELDS_EDITOR_GLOBAL::ApplyAllChanges()
|
2017-04-02 12:09:01 +00:00
|
|
|
{
|
2017-05-08 10:41:46 +00:00
|
|
|
if( !m_bom->HaveFieldsChanged() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
/**
|
2017-12-29 15:44:33 +00:00
|
|
|
* 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
|
|
|
|
*/
|
2017-04-18 14:10:17 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
auto currentSheet = m_parent->GetCurrentSheet();
|
2017-04-02 12:09:01 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
//! Create a map of changes required for each sheet
|
|
|
|
std::map<wxString, SheetUndoList> undoSheetMap;
|
2017-04-02 12:09:01 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
// List of components that have changed
|
|
|
|
auto changed = m_bom->GetChangedComponents();
|
2017-04-02 12:09:01 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
ITEM_PICKER picker;
|
2017-04-18 14:10:17 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
// Iterate through each of the components that were changed
|
2017-09-24 18:11:58 +00:00
|
|
|
for( const auto& ref : changed )
|
2017-05-08 10:41:46 +00:00
|
|
|
{
|
|
|
|
// Extract the SCH_COMPONENT* object
|
|
|
|
auto cmp = ref.GetComp();
|
2017-04-02 12:09:01 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
wxString path = ref.GetSheetPath().Path();
|
2017-04-18 14:10:17 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
// Push the component into the picker list
|
|
|
|
picker = ITEM_PICKER( cmp, UR_CHANGED );
|
|
|
|
picker.SetFlags( cmp->GetFlags() );
|
2017-04-18 14:10:17 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
/*
|
|
|
|
* If there is not currently an undo list for the given sheet,
|
|
|
|
* create an empty one
|
|
|
|
*/
|
2017-04-18 14:10:17 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
if( undoSheetMap.count( path ) == 0 )
|
|
|
|
{
|
|
|
|
SheetUndoList newList;
|
2017-04-18 14:10:17 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
newList.path = ref.GetSheetPath();
|
2017-04-18 14:10:17 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
undoSheetMap[path] = newList;
|
2017-04-02 12:09:01 +00:00
|
|
|
}
|
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
auto& pickerList = undoSheetMap[path];
|
2017-04-18 14:10:17 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
pickerList.items.PushItem( picker );
|
|
|
|
}
|
2017-04-16 06:43:59 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
// Iterate through each sheet that needs updating
|
|
|
|
for( auto it = undoSheetMap.begin(); it != undoSheetMap.end(); ++it )
|
|
|
|
{
|
|
|
|
auto undo = it->second;
|
2017-04-18 14:10:17 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
m_parent->SetCurrentSheet( undo.path );
|
|
|
|
m_parent->SaveCopyInUndoList( undo.items, UR_CHANGED );
|
2017-04-16 06:43:59 +00:00
|
|
|
m_parent->OnModify();
|
2017-05-08 10:41:46 +00:00
|
|
|
}
|
2017-04-18 14:10:17 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
// Make all component changes
|
|
|
|
m_bom->ApplyFieldChanges();
|
2017-04-18 14:10:17 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
// Redraw the current sheet and mark as dirty
|
|
|
|
m_parent->Refresh();
|
|
|
|
m_parent->OnModify();
|
2017-04-02 12:09:01 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
// 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();
|
2017-04-02 12:09:01 +00:00
|
|
|
}
|
|
|
|
|
2017-06-07 16:43:28 +00:00
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
void DIALOG_FIELDS_EDITOR_GLOBAL::UpdateTitle()
|
2017-04-02 12:09:01 +00:00
|
|
|
{
|
2017-05-02 17:51:02 +00:00
|
|
|
wxString title;
|
2017-04-02 12:09:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
if( m_bom->GetColumnGrouping() )
|
|
|
|
{
|
2017-12-29 15:44:33 +00:00
|
|
|
title.Printf ( _( "Symbol Table - %u symbols in %u groups" ),
|
2017-05-02 17:51:02 +00:00
|
|
|
m_bom->ComponentCount(),
|
|
|
|
(unsigned int) m_bom->Groups.size() );
|
2017-04-02 12:09:01 +00:00
|
|
|
}
|
2017-05-02 17:51:02 +00:00
|
|
|
else
|
2017-12-24 15:04:02 +00:00
|
|
|
title.Printf ( _( "Symbol Table - %u components" ),
|
2017-05-02 17:51:02 +00:00
|
|
|
m_bom->ComponentCount() );
|
2017-04-02 12:09:01 +00:00
|
|
|
|
|
|
|
unsigned int count = m_bom->CountChangedComponents();
|
|
|
|
|
|
|
|
if( count > 0 )
|
2017-05-02 17:51:02 +00:00
|
|
|
title += wxString::Format( _( " - %u changed" ), count );
|
2017-04-02 12:09:01 +00:00
|
|
|
|
2017-05-02 17:51:02 +00:00
|
|
|
// Update title only if it has changed, to avoid flicker created by
|
|
|
|
// useless update, for instance when moving the mouse, because UpdateTitle()
|
|
|
|
// is called by a wxUpdateUIEvent:
|
|
|
|
if( GetTitle() != title )
|
|
|
|
SetTitle( title );
|
2017-04-02 12:09:01 +00:00
|
|
|
}
|
|
|
|
|
2017-06-07 16:43:28 +00:00
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
void DIALOG_FIELDS_EDITOR_GLOBAL::LoadComponents()
|
2017-04-02 12:09:01 +00:00
|
|
|
{
|
|
|
|
if( !m_parent ) return;
|
|
|
|
|
|
|
|
// List of component objects
|
|
|
|
SCH_REFERENCE_LIST refs;
|
|
|
|
|
|
|
|
// Generate a list of schematic sheets
|
|
|
|
SCH_SHEET_LIST sheets( g_RootSheet );
|
2017-10-06 18:07:43 +00:00
|
|
|
sheets.GetComponents( refs, false );
|
2017-04-02 12:09:01 +00:00
|
|
|
|
|
|
|
// Pass the references through to the model
|
2017-05-08 10:41:46 +00:00
|
|
|
m_bom->SetComponents( refs, m_parent->GetTemplateFieldNames() );
|
2017-04-02 12:09:01 +00:00
|
|
|
}
|
|
|
|
|
2017-06-07 16:43:28 +00:00
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
void DIALOG_FIELDS_EDITOR_GLOBAL::LoadColumnNames()
|
2017-04-02 12:09:01 +00:00
|
|
|
{
|
|
|
|
m_columnListCtrl->DeleteAllItems();
|
|
|
|
|
|
|
|
wxVector< wxVariant > data;
|
|
|
|
|
|
|
|
for( auto* col : m_bom->ColumnList.Columns )
|
|
|
|
{
|
|
|
|
if( nullptr == col )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
data.clear();
|
|
|
|
|
|
|
|
data.push_back( wxVariant( col->Title() ) ); // Column title (string)
|
|
|
|
data.push_back( wxVariant( col->IsVisible() ) ); // Column visibility (bool)
|
2017-05-08 10:41:46 +00:00
|
|
|
data.push_back( wxVariant( col->IsUsedToSort() ) ); // Column is used to sort
|
2017-04-02 12:09:01 +00:00
|
|
|
|
|
|
|
m_columnListCtrl->AppendItem( data );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-07 16:43:28 +00:00
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
void DIALOG_FIELDS_EDITOR_GLOBAL::ReloadColumns()
|
2017-04-02 12:09:01 +00:00
|
|
|
{
|
|
|
|
m_bom->AttachTo( m_bomView );
|
|
|
|
UpdateTitle();
|
|
|
|
}
|
|
|
|
|
2017-06-07 16:43:28 +00:00
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
void DIALOG_FIELDS_EDITOR_GLOBAL::OnColumnItemToggled( wxDataViewEvent& event )
|
2017-04-02 12:09:01 +00:00
|
|
|
{
|
|
|
|
wxDataViewItem item = event.GetItem();
|
|
|
|
|
|
|
|
int row = m_columnListCtrl->ItemToRow( item );
|
|
|
|
int col = event.GetColumn();
|
|
|
|
|
2017-11-03 08:41:48 +00:00
|
|
|
if( row == wxNOT_FOUND || row < 0 || row >= (int) m_bom->ColumnCount() )
|
|
|
|
return;
|
2017-04-02 12:09:01 +00:00
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
FIELDS_EDITOR_COLUMN* bomColumn = m_bom->ColumnList.GetColumnByIndex( row );
|
2017-04-02 12:09:01 +00:00
|
|
|
|
2017-11-03 08:41:48 +00:00
|
|
|
if( nullptr == bomColumn )
|
|
|
|
return;
|
2017-04-02 12:09:01 +00:00
|
|
|
|
|
|
|
bool bValue = m_columnListCtrl->GetToggleValue( row, col );
|
|
|
|
|
|
|
|
switch ( col )
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
break;
|
2017-11-03 08:41:48 +00:00
|
|
|
|
2017-04-02 12:09:01 +00:00
|
|
|
case 1: // Column visibility
|
|
|
|
bomColumn->SetVisible( bValue );
|
|
|
|
|
|
|
|
// Insert a new column
|
|
|
|
if( bValue )
|
|
|
|
{
|
|
|
|
m_bom->AddColumn( bomColumn );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_bom->RemoveColumn( bomColumn );
|
|
|
|
}
|
|
|
|
break;
|
2017-11-03 08:41:48 +00:00
|
|
|
|
2017-05-08 10:41:46 +00:00
|
|
|
case 2: // Column used to sort
|
|
|
|
bomColumn->SetUsedToSort( bValue );
|
|
|
|
m_bom->ReloadTable();
|
|
|
|
break;
|
2017-04-02 12:09:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-07 16:43:28 +00:00
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
void DIALOG_FIELDS_EDITOR_GLOBAL::OnGroupComponentsToggled( wxCommandEvent& event )
|
2017-04-02 12:09:01 +00:00
|
|
|
{
|
|
|
|
bool group = m_groupComponentsBox->GetValue();
|
|
|
|
|
|
|
|
m_bom->SetColumnGrouping( group );
|
|
|
|
m_bom->ReloadTable();
|
|
|
|
|
2017-04-18 09:25:02 +00:00
|
|
|
Update();
|
|
|
|
}
|
|
|
|
|
2017-06-07 16:43:28 +00:00
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
void DIALOG_FIELDS_EDITOR_GLOBAL::OnUpdateUI( wxUpdateUIEvent& event )
|
2017-04-18 09:25:02 +00:00
|
|
|
{
|
|
|
|
m_regroupComponentsButton->Enable( m_bom->GetColumnGrouping() );
|
2017-05-08 10:41:46 +00:00
|
|
|
|
|
|
|
bool changes = m_bom->HaveFieldsChanged();
|
|
|
|
|
|
|
|
m_applyChangesButton->Enable( changes );
|
|
|
|
m_revertChangesButton->Enable( changes );
|
2017-04-02 12:09:01 +00:00
|
|
|
|
|
|
|
UpdateTitle();
|
|
|
|
}
|
|
|
|
|
2017-06-07 16:43:28 +00:00
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
void DIALOG_FIELDS_EDITOR_GLOBAL::OnTableValueChanged( wxDataViewEvent& event )
|
2017-04-02 12:09:01 +00:00
|
|
|
{
|
2017-04-18 09:25:02 +00:00
|
|
|
Update();
|
2017-04-02 12:09:01 +00:00
|
|
|
}
|
|
|
|
|
2017-06-07 16:43:28 +00:00
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
void DIALOG_FIELDS_EDITOR_GLOBAL::OnRegroupComponents( wxCommandEvent& event )
|
2017-04-02 12:09:01 +00:00
|
|
|
{
|
|
|
|
m_bom->ReloadTable();
|
2017-04-18 09:25:02 +00:00
|
|
|
Update();
|
2017-04-02 12:09:01 +00:00
|
|
|
}
|
|
|
|
|
2017-11-03 08:41:48 +00:00
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
void DIALOG_FIELDS_EDITOR_GLOBAL::OnApplyFieldChanges( wxCommandEvent& event )
|
2017-05-08 10:41:46 +00:00
|
|
|
{
|
|
|
|
ApplyAllChanges();
|
|
|
|
Update();
|
|
|
|
}
|
|
|
|
|
2017-06-07 16:43:28 +00:00
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
void DIALOG_FIELDS_EDITOR_GLOBAL::OnRevertFieldChanges( wxCommandEvent& event )
|
2017-04-02 12:09:01 +00:00
|
|
|
{
|
|
|
|
if( m_bom->HaveFieldsChanged() )
|
|
|
|
{
|
2017-12-24 15:04:02 +00:00
|
|
|
if( IsOK( this, _( "Revert all symbol table changes?" ) ) )
|
2017-04-02 12:09:01 +00:00
|
|
|
{
|
|
|
|
m_bom->RevertFieldChanges();
|
2017-04-18 09:25:02 +00:00
|
|
|
Update();
|
2017-04-02 12:09:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-04-25 02:55:49 +00:00
|
|
|
|
2017-11-03 08:41:48 +00:00
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
void DIALOG_FIELDS_EDITOR_GLOBAL::OnTableItemActivated( wxDataViewEvent& event )
|
2017-04-25 02:55:49 +00:00
|
|
|
{
|
|
|
|
/* TODO
|
|
|
|
* - Focus on component selected in SCH_FRAME
|
|
|
|
*/
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|
2017-06-07 16:43:28 +00:00
|
|
|
|
|
|
|
|
2018-02-09 16:35:45 +00:00
|
|
|
void DIALOG_FIELDS_EDITOR_GLOBAL::OnTableItemContextMenu( wxDataViewEvent& event )
|
2017-04-25 02:55:49 +00:00
|
|
|
{
|
|
|
|
/* TODO
|
|
|
|
* - Display contect menu
|
|
|
|
* - Option to revert local changes if changes have been made
|
|
|
|
* - Option to select footprint if FOOTPRINT column selected
|
|
|
|
*/
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|