Removed BOM functionality

- Removed ability to generate BOM to file
- Removed Save/Cancel window when closing table
- No longer updates table <after> table is closed
- Bugfix for field names (previously comparison was case insensitive)
This commit is contained in:
Oliver Walters 2017-04-25 12:55:49 +10:00 committed by Wayne Stambaugh
parent 48893ab2b1
commit 29e3e55ad3
10 changed files with 44 additions and 1068 deletions

View File

@ -25,8 +25,8 @@ set( EESCHEMA_DLGS
dialogs/dialog_annotate_base.cpp
dialogs/dialog_bom.cpp
dialogs/dialog_bom_base.cpp
dialogs/dialog_bom_editor.cpp
dialogs/dialog_bom_editor_base.cpp
dialogs/dialog_bom_editor.cpp
dialogs/dialog_bom_editor_base.cpp
dialogs/dialog_bom_cfg_keywords.cpp
dialogs/dialog_choose_component.cpp
dialogs/dialog_lib_edit_text.cpp
@ -87,7 +87,6 @@ set( EESCHEMA_SRCS
backanno.cpp
block.cpp
block_libedit.cpp
bom_exporter.cpp
bom_table_model.cpp
bom_table_column.cpp
busentry.cpp

View File

@ -1,420 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Oliver Walters
* Copyright (C) 2017 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* 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 "bom_exporter.h"
/**
* BOM_FILE_WRITER class (pure virtual)
*/
BOM_FILE_WRITER::BOM_FILE_WRITER() :
m_includeExtraData( true ),
m_showRowNumbers( true )
{
}
void BOM_FILE_WRITER::SetHeader( const wxArrayString aHeader )
{
m_bomHeader = aHeader;
}
void BOM_FILE_WRITER::AddLine( wxArrayString aLine )
{
m_bomLines.push_back( aLine );
}
/**
* Function ExtraDataPairs
* Format extra data for writing to file
*/
wxArrayString BOM_FILE_WRITER::ExtraDataPairs()
{
wxArrayString pairs;
if( m_groupCount != m_componentCount )
{
pairs.Add( DataPair( _( "Group Count" ), m_groupCount ) );
}
pairs.Add( DataPair( _( "Component Count" ), m_componentCount ) );
pairs.Add( DataPair( _( "Schematic Title" ), m_schematicTitle ) );
pairs.Add( DataPair( _( "Schematic Date" ), m_schematicDate ) );
pairs.Add( DataPair( _( "Schematic Version" ), m_schematicVersion ) );
pairs.Add( DataPair( _( "KiCad Version" ), m_kicadVersion ) );
return pairs;
}
BOM_CSV_WRITER::BOM_CSV_WRITER( wxChar aDelim ) :
BOM_FILE_WRITER()
{
m_delim = aDelim;
}
/**
* Function WriteToFile
* Write delimited data to file
*/
bool BOM_CSV_WRITER::WriteToFile( wxFile& aFile )
{
// Generate table header
wxString line = wxJoin( EscapeLine( m_bomHeader ), m_delim )+ "\n";
if( m_showRowNumbers )
{
line = m_delim + line;
}
if( !aFile.Write( line ))
{
return false;
}
// Write each line in the file
for( unsigned int ii=0; ii<m_bomLines.size(); ii++ )
{
line = wxJoin( EscapeLine( m_bomLines[ii]), m_delim ) + "\n";
if( m_showRowNumbers )
{
line = wxString::Format( _( "%i" ), ii+1 ) + m_delim + line;
}
if( !aFile.Write( line ) )
{
return false;
}
}
// Write extra options
if( m_includeExtraData )
{
wxString extra;
extra += "\n\n";
for( wxString pair : ExtraDataPairs() )
{
extra += pair;
extra += "\n";
}
if( !aFile.Write( extra ) )
return false;
}
// File writing successful
return true;
}
/**
* Function DataPair
* Combine two items into a delimited pair
*/
wxString BOM_CSV_WRITER::DataPair( const wxString& aFirst, const wxString& aSecond )
{
wxArrayString pair;
pair.Add( aFirst );
pair.Add( aSecond );
return wxJoin( pair, m_delim );
}
/**
* Function EscapeLine
* Any values that contain the delimiter are escaped with quotes
*/
wxArrayString BOM_CSV_WRITER::EscapeLine( wxArrayString line )
{
wxArrayString escaped;
for( wxString item : line )
{
if( item.Contains( m_delim ) &&
!item.StartsWith( "\"" ) &&
!item.EndsWith( "\"" ) )
{
item = "\"" + item + "\"";
}
escaped.Add( item );
}
return escaped;
}
BOM_HTML_WRITER::BOM_HTML_WRITER() :
BOM_FILE_WRITER()
{
// Strings to check for hyperlinkable text
m_linkChecks.Add( "http:*" );
m_linkChecks.Add( "https:* " );
m_linkChecks.Add( "ftp:*" );
m_linkChecks.Add( "www.*" );
m_linkChecks.Add( "*.pdf" );
m_linkChecks.Add( "*.html" );
m_linkChecks.Add( "*.htm" );
}
/**
* Function WriteToFile
* Write HTML BoM Data
*/
bool BOM_HTML_WRITER::WriteToFile( wxFile& aFile )
{
// Write HTML header
if( !aFile.Write( HtmlHeader() ) )
return false;
if( m_includeExtraData )
{
if( !aFile.Write( ExtraData() ) )
return false;
}
// Table data
wxString tableTitle = "<h2>";
tableTitle += _( "Bill of Materials" );
tableTitle += "</h2>\n";
if( !aFile.Write( tableTitle ) )
return false;
if( !aFile.Write( "<table border=\"1\">\n" ) )
return false;
if( !aFile.Write( TableHeader( m_bomHeader ) ) )
return false;
// Write each line of the BOM
for( unsigned int ii=0; ii<m_bomLines.size(); ii++ )
{
if( !aFile.Write( TableRow( ii+1, m_bomLines[ii] ) ) )
return false;
}
if( !aFile.Write( "</table>\n" ) )
return false;
if( !aFile.Write( HtmlFooter() ) )
return false;
return true;
}
wxString BOM_HTML_WRITER::HtmlHeader()
{
wxString header = wxEmptyString;
header += "<html>\n<head>\n";
//TODO - Project title
header += "<title>";
header += m_schematicTitle;
header += "</title>\n";
header += HtmlMetaTag( "charset", "UTF-8" ) + "\n";
//TODO - KiCad reference data here
header += "</head>\n\n";
header += "<body>\n";
return header;
}
wxString BOM_HTML_WRITER::HtmlFooter()
{
wxString footer = wxEmptyString;
footer += "</body>\n\n";
footer += "</html>\n";
return footer;
}
wxString BOM_HTML_WRITER::HtmlMetaTag( const wxString aTitle, const wxString aData )
{
wxString tag = "<meta name=\"";
tag += aTitle + "\"";
tag += " content=\"";
tag += aData + "\"";
tag += ">";
return tag;
}
/**
* Function ExtraData
* Write extra project information
*/
wxString BOM_HTML_WRITER::ExtraData()
{
wxString extra;
extra += "<h2>";
extra += _( "Project details" );
extra += "</h2>\n";
extra += "<table border=\"1\">\n";
for( wxString pair : ExtraDataPairs() )
{
extra += pair + "\n";
}
extra += "</table>\n";
return extra;
}
/**
* Function LinkText
* Automatically detect linkable text, and wrap it in <a> tag
* @aText - Text to (potentially) link
*/
wxString BOM_HTML_WRITER::LinkText( const wxString& aText )
{
// Should we provide a link to the text?
wxString lower = aText.Lower();
bool found = false;
for( wxString check : m_linkChecks )
{
if( lower.Matches( check ) )
{
found = true;
break;
}
}
if( found )
{
wxString link = "<a href=\"";
link += aText;
link += "\">";
link += aText;
link += "</a>";
return link;
}
else
{
return aText;
}
}
wxString BOM_HTML_WRITER::TableHeader( const wxArrayString& aHeaderData )
{
wxString header = "<tr>\n";
if( m_showRowNumbers )
{
header += "<th></th>\n";
}
for( wxString item : aHeaderData )
{
header += "<th align=\"center\">";
header += item;
header += "</th>";
header += "\n";
}
header += "</tr>\n";
return header;
}
wxString BOM_HTML_WRITER::DataPair( const wxString& aFirst, const wxString& aSecond )
{
wxString html = "<tr>\n";
html += TableEntry( aFirst ) + "\n";
html += TableEntry( aSecond ) + "\n";
html += "</tr>\n";
return html;
}
/**
* Function TableRow
* Generate a single row of BOM data
* @aRowNum is the number of the row
* @aRowData is the array of data for the given row
*/
wxString BOM_HTML_WRITER::TableRow( const int& aRowNum, const wxArrayString& aRowData )
{
wxString row = wxEmptyString;
row += "<tr>\n";
if( m_showRowNumbers )
{
row += "<td>";
row += wxString::Format( "%i", aRowNum );
row += "</td>\n";
}
for( wxString data : aRowData )
{
row += TableEntry( data );
row += "\n";
}
row += "</tr>\n";
return row;
}
/**
* Function TableEntry
* Wrap a string in <td> tags
* @aData is the text to be wrapped
* @aColor is an (optional) HTML background color
*/
wxString BOM_HTML_WRITER::TableEntry( wxString aData, wxString aColor )
{
wxString cell = "<td align=\"center\"";
if( !aColor.IsEmpty() )
{
cell += " bgcolor=\"" + aColor + "\"";
}
cell += ">";
cell += LinkText( aData );
cell += "</td>";
return cell;
}

View File

@ -1,123 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Oliver Walters
* Copyright (C) 2017 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* 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
*/
#ifndef EESCHEMA_BOM_EXPORTER_H_
#define EESCHEMA_BOM_EXPORTER_H_
#include <vector>
#include <wx/file.h>
#include "bom_table_column.h"
#include "bom_table_model.h"
enum BOM_EXPORT_TYPE
{
BOM_EXPORT_CSV = 0,
BOM_EXPORT_HTML
};
class BOM_FILE_WRITER
{
public:
BOM_FILE_WRITER();
virtual ~BOM_FILE_WRITER() {};
virtual bool WriteToFile( wxFile& aFile ) = 0;
void SetHeader( const wxArrayString aHeader );
void AddLine( const wxArrayString aLine );
void IncludeExtraData( bool aInclude = true ) { m_includeExtraData = aInclude; }
void ShowRowNumbers( bool aShow = true ) { m_showRowNumbers = aShow; }
// Project information
void SetKicadVersion( const wxString aVersion ) { m_kicadVersion = aVersion; }
void SetSchematicTitle( const wxString aProject ) { m_schematicTitle = aProject; }
void SetSchematicVersion( const wxString aVersion ) { m_schematicVersion = aVersion; }
void SetSchematicDate( const wxString aDate ) { m_schematicDate = aDate; }
void SetGroupCount( unsigned int aCount ) { m_groupCount = wxString::Format( "%u", aCount ); }
void SetComponentCount( unsigned int aCount ) { m_componentCount = wxString::Format( "%u", aCount ); }
protected:
wxArrayString ExtraDataPairs();
virtual wxString DataPair( const wxString& aFirst, const wxString& aSecond ) = 0;
wxArrayString m_bomHeader;
std::vector< wxArrayString > m_bomLines;
bool m_includeExtraData;
bool m_showRowNumbers;
// Extra details for BOM file
wxString m_kicadVersion;
wxString m_schematicTitle;
wxString m_schematicVersion;
wxString m_schematicDate;
wxString m_componentCount;
wxString m_groupCount;
};
class BOM_CSV_WRITER : public BOM_FILE_WRITER
{
public:
BOM_CSV_WRITER( wxChar aDelim=',' );
virtual bool WriteToFile( wxFile& aFile ) override;
protected:
wxArrayString EscapeLine( wxArrayString line );
virtual wxString DataPair( const wxString& aFirst, const wxString& aSecond ) override;
wxChar m_delim;
};
class BOM_HTML_WRITER : public BOM_FILE_WRITER
{
public:
BOM_HTML_WRITER();
virtual bool WriteToFile( wxFile& aFile ) override;
protected:
virtual wxString DataPair( const wxString& aFirst, const wxString& aSecond ) override;
wxString HtmlHeader();
wxString HtmlFooter();
wxString HtmlMetaTag( const wxString aTitle, const wxString aData );
wxString ExtraData();
wxString LinkText( const wxString& aText );
wxString TableHeader( const wxArrayString& aHeaderData );
wxString TableRow( const int& aRowNum, const wxArrayString& aRowData );
wxString TableEntry( wxString aData, wxString aColor = wxEmptyString );
wxArrayString m_linkChecks;
};
#endif /* EESCHEMA_BOM_EXPORTER_H_ */

View File

@ -86,7 +86,7 @@ BOM_COLUMN* BOM_COLUMN_LIST::GetColumnByTitle( wxString aColTitle )
{
for( unsigned int ii=0; ii<Columns.size(); ii++ )
{
if( Columns[ii] && Columns[ii]->Title().CmpNoCase( aColTitle ) == 0 )
if( Columns[ii] && Columns[ii]->Title().Cmp( aColTitle ) == 0 )
return Columns[ii];
}

View File

@ -682,6 +682,7 @@ void BOM_TABLE_COMPONENT::ApplyFieldChanges()
break;
}
// New field needs to be added?
if( !field && !value.IsEmpty() )
{
SCH_FIELD newField( wxPoint( 0, 0 ), -1, cmp, column->Title() );
@ -1396,8 +1397,6 @@ void BOM_TABLE_MODEL::ApplyFieldChanges()
if( !group )
continue;
bool changed = false;
for( auto& component : group->Components )
{
if( !component )
@ -1406,15 +1405,8 @@ void BOM_TABLE_MODEL::ApplyFieldChanges()
if( component->HasChanged() )
{
component->ApplyFieldChanges();
ItemChanged( RowToItem( &*component ) );
changed = true;
}
}
if( changed )
{
ItemChanged( RowToItem( &*group ) );
}
}
}

View File

@ -35,8 +35,6 @@
#include <general.h>
#include <class_library.h>
#include <bom_exporter.h>
#include "dialog_bom_editor.h"
#include <bom_table_model.h>
@ -112,31 +110,9 @@ typedef struct
*/
bool DIALOG_BOM_EDITOR::TransferDataFromWindow()
{
bool saveChanges = false;
// If there are changed values, warn the user first
if( m_bom->HaveFieldsChanged() )
{
int result = DisplayExitDialog( this, _( "Changes exist in component table" ) );
switch( result )
{
// Save and exit
case wxID_YES:
saveChanges = true;
break;
// Cancel (do not exit)
case wxID_CANCEL:
return false;
// Do not save, exit
default:
return true;
}
}
if( saveChanges )
{
/**
/**
* 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:
@ -144,7 +120,7 @@ bool DIALOG_BOM_EDITOR::TransferDataFromWindow()
* 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 sheet view to the current sheet
* 5. Reset the view to the current sheet
*/
auto currentSheet = m_parent->GetCurrentSheet();
@ -169,7 +145,6 @@ bool DIALOG_BOM_EDITOR::TransferDataFromWindow()
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
@ -199,7 +174,7 @@ bool DIALOG_BOM_EDITOR::TransferDataFromWindow()
m_parent->OnModify();
}
// Apply all the field changes
// Make all component changes
m_bom->ApplyFieldChanges();
// Redraw the current sheet and mark as dirty
@ -209,7 +184,6 @@ bool DIALOG_BOM_EDITOR::TransferDataFromWindow()
// Reset the view to where we left the user
m_parent->SetCurrentSheet(currentSheet);
}
return true;
@ -352,131 +326,6 @@ void DIALOG_BOM_EDITOR::OnUpdateUI( wxUpdateUIEvent& event )
UpdateTitle();
}
/**
* Called when the "Export BOM" button is pressed
* Extract row data from the component table,
* and export it to a BOM file
*/
void DIALOG_BOM_EDITOR::OnExportBOM( wxCommandEvent& event )
{
// Allowable BOM file formats
static const wxString wildcard = _( "BOM Files" ) + wxString( " *.csv, *.tsv, *.html)|*.csv;*.tsv;*.htm;*.html" );
wxFileDialog bomFileDialog(this, _("Select BOM file"),
Prj().GetProjectPath(),
wxEmptyString,
wildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( bomFileDialog.ShowModal() == wxID_CANCEL )
{
return;
}
// Ensure the component groups are correct
m_bom->ReloadTable();
wxString msg;
wxFileName filename = bomFileDialog.GetPath();
// Ensure correct file format
BOM_FILE_WRITER* writer;
wxString fn = filename.GetFullPath().Lower();
// CSV File
if( fn.EndsWith( ".csv" ) )
{
writer = new BOM_CSV_WRITER();
}
// TSV file
else if( fn.EndsWith( ".tsv" ) )
{
writer = new BOM_CSV_WRITER( '\t' );
}
// HTML file
else if( fn.EndsWith( ".html" ) || fn.EndsWith( ".htm" ) )
{
writer = new BOM_HTML_WRITER();
}
// Unknown file!
else
{
msg.Printf("%s:\n%s",
_( "Unsupported file type" ),
filename.GetExt() );
wxMessageBox( msg );
return;
}
// Set export preferences
writer->IncludeExtraData( m_includeProjectData->GetValue() );
writer->ShowRowNumbers( m_showRowNumbers->GetValue() );
// Project information
writer->SetKicadVersion( GetBuildVersion() );
// Extract sheet info from top-level sheet
if( g_RootSheet )
{
const TITLE_BLOCK& tb = g_RootSheet->GetScreen()->GetTitleBlock();
writer->SetSchematicDate( tb.GetDate() );
writer->SetSchematicVersion( tb.GetRevision() );
writer->SetSchematicTitle( tb.GetTitle() );
}
std::vector<BOM_COLUMN*> columns;
wxArrayString headings;
// Extract the visible column data
for( auto column : m_bom->ColumnList.Columns )
{
if( column && column->IsVisible() )
{
columns.push_back( column );
headings.push_back( column->Title() );
}
}
writer->SetHeader( headings );
// Extract the row data
for( unsigned int row=0; row<m_bom->GroupCount(); row++ )
{
writer->AddLine( m_bom->GetRowData( row, columns ) );
}
writer->SetGroupCount( m_bom->GroupCount() );
writer->SetComponentCount( m_bom->ComponentCount() );
// Open the BOM file for writing
wxFile bomFile( filename.GetFullPath(), wxFile::write );
if( bomFile.IsOpened() )
{
if( !writer->WriteToFile( bomFile ) )
{
msg.Printf( "%s:\n%s",
_( "Error writing BOM file" ),
filename.GetFullPath() );
}
bomFile.Close();
}
else
{
msg.Printf( "%s:\n%s",
_( "Error opening BOM file" ),
filename.GetFullPath() );
wxMessageBox( msg );
}
}
void DIALOG_BOM_EDITOR::OnTableValueChanged( wxDataViewEvent& event )
{
Update();
@ -499,3 +348,24 @@ void DIALOG_BOM_EDITOR::OnRevertFieldChanges( wxCommandEvent& event )
}
}
}
// Called when a cell is left-clicked
void DIALOG_BOM_EDITOR::OnTableItemActivated( wxDataViewEvent& event )
{
/* TODO
* - Focus on component selected in SCH_FRAME
*/
event.Skip();
}
// Called when a cell is right-clicked
void DIALOG_BOM_EDITOR::OnTableItemContextMenu( wxDataViewEvent& event )
{
/* TODO
* - Display contect menu
* - Option to revert local changes if changes have been made
* - Option to select footprint if FOOTPRINT column selected
*/
event.Skip();
}

View File

@ -69,8 +69,6 @@ private:
virtual void OnColumnItemToggled( wxDataViewEvent& event ) override;
virtual void OnGroupComponentsToggled( wxCommandEvent& event ) override;
virtual void OnExportBOM( wxCommandEvent& event ) override;
virtual void OnRevertFieldChanges( wxCommandEvent& event ) override;
virtual void OnRegroupComponents( wxCommandEvent& event ) override;
@ -78,6 +76,12 @@ private:
// Called after a value in the table has changed
virtual void OnTableValueChanged( wxDataViewEvent& event ) override;
// Called when a cell is left-clicked
virtual void OnTableItemActivated( wxDataViewEvent& event ) override;
// Called when a cell is right-clicked
virtual void OnTableItemContextMenu( wxDataViewEvent& event ) override;
void UpdateTitle( void );
virtual void OnUpdateUI( wxUpdateUIEvent& event ) override;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 22 2017)
// C++ code generated with wxFormBuilder (version Apr 1 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -15,9 +15,10 @@ BEGIN_EVENT_TABLE( DIALOG_BOM_EDITOR_BASE, DIALOG_SHIM )
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_BUTTON( wxID_BOM_BUTTON_EXPORT, DIALOG_BOM_EDITOR_BASE::_wxFB_OnExportBOM )
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_ITEM_ACTIVATED( wxID_ANY, DIALOG_BOM_EDITOR_BASE::_wxFB_OnTableItemActivated )
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_SELECTION_CHANGED( wxID_ANY, DIALOG_BOM_EDITOR_BASE::_wxFB_OnSelectionChanged )
END_EVENT_TABLE()
@ -79,39 +80,6 @@ DIALOG_BOM_EDITOR_BASE::DIALOG_BOM_EDITOR_BASE( wxWindow* parent, wxWindowID id,
bSizer6->Add( 0, 0, 0, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( m_leftPanel, wxID_ANY, _("Export options") ), wxVERTICAL );
m_includeProjectData = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_BOM_OPT_INC_PRJ_DATA, _("Include project data"), wxDefaultPosition, wxDefaultSize, 0 );
m_includeProjectData->SetValue(true);
m_includeProjectData->SetToolTip( _("Include project information in BOM file") );
sbSizer2->Add( m_includeProjectData, 0, wxALL|wxEXPAND, 5 );
m_showRowNumbers = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_BOM_OPT_SHOW_ROW_NUMS, _("Show row numbers"), wxDefaultPosition, wxDefaultSize, 0 );
m_showRowNumbers->SetValue(true);
m_showRowNumbers->SetToolTip( _("Show BOM row numbers ") );
sbSizer2->Add( m_showRowNumbers, 0, wxALL|wxEXPAND, 5 );
sbSizer2->Add( 0, 0, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer13;
bSizer13 = new wxBoxSizer( wxHORIZONTAL );
bSizer13->Add( 0, 0, 1, wxEXPAND, 5 );
m_exportButton = new wxButton( sbSizer2->GetStaticBox(), wxID_BOM_BUTTON_EXPORT, _("Export BOM"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer13->Add( m_exportButton, 0, wxALL, 5 );
sbSizer2->Add( bSizer13, 0, wxEXPAND, 5 );
bSizer6->Add( sbSizer2, 0, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer4;
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_leftPanel, wxID_ANY, _("Apply changes") ), wxVERTICAL );

View File

@ -727,316 +727,6 @@
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="0">
<property name="id">wxID_ANY</property>
<property name="label">Export options</property>
<property name="minimum_size"></property>
<property name="name">sbSizer2</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">1</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_BOM_OPT_INC_PRJ_DATA</property>
<property name="label">Include project data</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_includeProjectData</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Include project information in BOM file</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">1</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_BOM_OPT_SHOW_ROW_NUMS</property>
<property name="label">Show row numbers</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_showRowNumbers</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Show BOM row numbers </property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0">
<property name="minimum_size"></property>
<property name="name">bSizer13</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="0">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_BOM_BUTTON_EXPORT</property>
<property name="label">Export BOM</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_exportButton</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnExportBOM</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
@ -1191,11 +881,11 @@
<event name="OnDataViewCtrlColumnHeaderRightClick"></event>
<event name="OnDataViewCtrlColumnReordered">OnBomColumReordered</event>
<event name="OnDataViewCtrlColumnSorted">OnBomColumnSorted</event>
<event name="OnDataViewCtrlItemActivated"></event>
<event name="OnDataViewCtrlItemActivated">OnTableItemActivated</event>
<event name="OnDataViewCtrlItemBeginDrag"></event>
<event name="OnDataViewCtrlItemCollapsed"></event>
<event name="OnDataViewCtrlItemCollapsing"></event>
<event name="OnDataViewCtrlItemContextMenu"></event>
<event name="OnDataViewCtrlItemContextMenu">OnTableItemContextMenu</event>
<event name="OnDataViewCtrlItemDrop"></event>
<event name="OnDataViewCtrlItemDropPossible"></event>
<event name="OnDataViewCtrlItemEditingDone">OnTableValueChanged</event>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Mar 22 2017)
// C++ code generated with wxFormBuilder (version Apr 1 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -33,9 +33,6 @@ class DIALOG_SHIM;
#define OPT_GROUP_COMPONENTS 1000
#define ID_BUTTON_REGROUP 1001
#define ID_BUTTON_REVERT_CHANGES 1002
#define wxID_BOM_OPT_INC_PRJ_DATA 1003
#define wxID_BOM_OPT_SHOW_ROW_NUMS 1004
#define wxID_BOM_BUTTON_EXPORT 1005
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_BOM_EDITOR_BASE
@ -51,9 +48,10 @@ class DIALOG_BOM_EDITOR_BASE : public DIALOG_SHIM
void _wxFB_OnRegroupComponents( wxCommandEvent& event ){ OnRegroupComponents( event ); }
void _wxFB_OnRevertFieldChanges( wxCommandEvent& event ){ OnRevertFieldChanges( event ); }
void _wxFB_OnColumnItemToggled( wxDataViewEvent& event ){ OnColumnItemToggled( event ); }
void _wxFB_OnExportBOM( wxCommandEvent& event ){ OnExportBOM( event ); }
void _wxFB_OnBomColumReordered( wxDataViewEvent& event ){ OnBomColumReordered( event ); }
void _wxFB_OnBomColumnSorted( wxDataViewEvent& event ){ OnBomColumnSorted( event ); }
void _wxFB_OnTableItemActivated( wxDataViewEvent& event ){ OnTableItemActivated( event ); }
void _wxFB_OnTableItemContextMenu( wxDataViewEvent& event ){ OnTableItemContextMenu( event ); }
void _wxFB_OnTableValueChanged( wxDataViewEvent& event ){ OnTableValueChanged( event ); }
void _wxFB_OnSelectionChanged( wxDataViewEvent& event ){ OnSelectionChanged( event ); }
@ -66,9 +64,6 @@ class DIALOG_BOM_EDITOR_BASE : public DIALOG_SHIM
wxButton* m_regroupComponentsButton;
wxButton* m_reloadTableButton;
wxDataViewListCtrl* m_columnListCtrl;
wxCheckBox* m_includeProjectData;
wxCheckBox* m_showRowNumbers;
wxButton* m_exportButton;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
@ -81,9 +76,10 @@ class DIALOG_BOM_EDITOR_BASE : public DIALOG_SHIM
virtual void OnRegroupComponents( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRevertFieldChanges( wxCommandEvent& event ) { event.Skip(); }
virtual void OnColumnItemToggled( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnExportBOM( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBomColumReordered( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnBomColumnSorted( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnTableItemActivated( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnTableItemContextMenu( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnTableValueChanged( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnSelectionChanged( wxDataViewEvent& event ) { event.Skip(); }