Relax fully-annotated constraint for BOM editor.

Also fixes a bug where unannotated components would get references
of the form R-1 (because their reference number was -1).

Fixes: lp:1768814
* https://bugs.launchpad.net/kicad/+bug/1768814
This commit is contained in:
Jeff Young 2018-05-11 10:32:54 +01:00
parent f73b9a55a7
commit 6e83f99c72
4 changed files with 18 additions and 20 deletions

View File

@ -41,14 +41,6 @@
#include "dialog_fields_editor_global.h"
// Create and show fields editor
void InvokeDialogCreateBOMEditor( SCH_EDIT_FRAME* aCaller )
{
DIALOG_FIELDS_EDITOR_GLOBAL dlg( aCaller );
dlg.ShowQuasiModal();
}
#define FIELD_NAME_COLUMN 0
#define SHOW_FIELD_COLUMN 1
#define GROUP_BY_COLUMN 2
@ -162,8 +154,16 @@ public:
if( aCol == REFERENCE || aCol == QUANTITY_COLUMN )
{
// Remove duplicates (other units of multi-unit parts)
rootReferences.erase( std::unique( rootReferences.begin(), rootReferences.end() ),
rootReferences.end() );
auto logicalEnd = std::unique( rootReferences.begin(), rootReferences.end(),
[]( const wxString& l, const wxString& r )
{
// If not annotated then we don't really know if it's a duplicate
if( l.EndsWith( wxT( "?" ) ) )
return false;
return l == r;
} );
rootReferences.erase( logicalEnd, rootReferences.end() );
}
if( aCol == REFERENCE )
@ -247,7 +247,8 @@ public:
wxCheckBox* groupComponentsBox, wxDataViewListCtrl* fieldsCtrl )
{
// Units of same component always match
if( lhRef.GetRef() == rhRef.GetRef() && lhRef.GetRefNumber() == rhRef.GetRefNumber() )
if( lhRef.GetRef() == rhRef.GetRef() && lhRef.GetRefNumber() != wxT( "?" )
&& lhRef.GetRefNumber() == rhRef.GetRefNumber() )
return true;
// If we're not grouping, then nothing else matches

View File

@ -77,9 +77,6 @@ int InvokeDialogPrintUsingPrinter( SCH_EDIT_FRAME* aCaller );
/// DIALOG_BOM::ShowModal() returns.
int InvokeDialogCreateBOM( SCH_EDIT_FRAME* aCaller );
/// Create and show DIALOG_BOM_EDITOR
void InvokeDialogCreateBOMEditor( SCH_EDIT_FRAME* aCaller );
/// Update symbol fields
int InvokeDialogUpdateFields( SCH_EDIT_FRAME* aCaller,
const std::list<SCH_COMPONENT*> aComponents, bool aCreateUndoEntry );

View File

@ -67,7 +67,7 @@
#include <netlist_exporter_kicad.h>
#include <kiway.h>
#include <dialogs/dialog_fields_editor_global.h>
// non-member so it can be moved easily, and kept REALLY private.
// Do NOT Clear() in here.
@ -941,11 +941,8 @@ void SCH_EDIT_FRAME::OnCreateBillOfMaterials( wxCommandEvent& )
void SCH_EDIT_FRAME::OnLaunchBomManager( wxCommandEvent& event )
{
// First ensure that entire schematic is annotated
if( !prepareForNetlist() )
return;
InvokeDialogCreateBOMEditor( this );
DIALOG_FIELDS_EDITOR_GLOBAL dlg( this );
dlg.ShowQuasiModal();
}

View File

@ -144,6 +144,9 @@ public:
{
wxString ref;
if( m_NumRef < 0 )
return wxT( "?" );
// To avoid a risk of duplicate, for power components
// the ref number is 0nnn instead of nnn.
// Just because sometimes only power components are annotated