Cvpcb: Add a tool to solve conflict assignments when the schematic netlist and the .cmp file do not contain the same assignment and both are valid fpid.
It happens when footprint assignments are modified outside Cvpcb (when editing the footprint assignment field in schematic)
This commit is contained in:
parent
a7b916d641
commit
3abfb6ca97
|
@ -21,6 +21,8 @@ include_directories(
|
|||
|
||||
|
||||
set( CVPCB_DIALOGS
|
||||
dialogs/fp_conflict_assignment_selector_base.cpp
|
||||
dialogs/fp_conflict_assignment_selector.cpp
|
||||
dialogs/dialog_display_options.cpp
|
||||
dialogs/dialog_display_options_base.cpp
|
||||
../pcbnew/dialogs/dialog_fp_lib_table.cpp
|
||||
|
|
|
@ -0,0 +1,207 @@
|
|||
/**
|
||||
* @file fp_choice_selector.cpp
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2010-2014 Jean-Pierre Charras <jp.charras at wanadoo.fr>
|
||||
* Copyright (C) 1992-2014 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 <common.h>
|
||||
|
||||
#include <fp_conflict_assignment_selector.h>
|
||||
|
||||
|
||||
DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR( wxWindow* aParent )
|
||||
: DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE( aParent )
|
||||
{
|
||||
m_listFp->InsertColumn( 0, _( "Ref" ) );
|
||||
m_listFp->InsertColumn( 1, _( "Schematic assignment" ) );
|
||||
m_listFp->InsertColumn( 2, wxT( "<=" ) );
|
||||
m_listFp->InsertColumn( 3, wxT( "=>" ) );
|
||||
m_listFp->InsertColumn( 4, _( "Cmp file assignment" ) );
|
||||
|
||||
m_lineCount = 0;
|
||||
}
|
||||
|
||||
void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::Add( const wxString& aRef, const wxString& aFpSchName,
|
||||
const wxString& aFpCmpName )
|
||||
{
|
||||
wxListItem item;
|
||||
|
||||
item.SetId( m_lineCount );
|
||||
item.SetText( aRef );
|
||||
item.SetColumn( COL_REF );
|
||||
m_listFp->InsertItem( item );
|
||||
|
||||
item.SetText( aFpSchName );
|
||||
item.SetColumn( COL_FPSCH );
|
||||
m_listFp->SetItem( item );
|
||||
|
||||
|
||||
item.SetText( wxT("") );
|
||||
item.SetColumn( COL_SELSCH );
|
||||
m_listFp->SetItem( item );
|
||||
|
||||
item.SetText( wxT("X") );
|
||||
item.SetColumn( COL_SELCMP );
|
||||
m_listFp->SetItem( item );
|
||||
|
||||
item.SetText( aFpCmpName );
|
||||
item.SetColumn( COL_FPCMP );
|
||||
m_listFp->SetItem( item );
|
||||
|
||||
m_lineCount ++;
|
||||
}
|
||||
|
||||
int DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::GetSelection( const wxString& aReference )
|
||||
{
|
||||
// Find Reference
|
||||
for( int ii = 0; ii < m_listFp->GetItemCount(); ii++ )
|
||||
{
|
||||
if( m_listFp->GetItemText( ii, COL_REF ) == aReference )
|
||||
{
|
||||
if( m_listFp->GetItemText( ii, COL_SELSCH ) != wxT("X") )
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnColumnClick( wxListEvent& event )
|
||||
{
|
||||
// When clicking on the column title:
|
||||
// when it is the COL_SELCMP column, set all item choices to cmp file assigment.
|
||||
// when it is the COL_SELSCH column, set all item choices to schematic assigment.
|
||||
|
||||
wxListItem item = event.GetItem();
|
||||
|
||||
int column = event.GetColumn();
|
||||
int colclr, colset;
|
||||
|
||||
switch( column )
|
||||
{
|
||||
case COL_SELSCH:
|
||||
colclr = COL_SELCMP;
|
||||
colset = COL_SELSCH;
|
||||
break;
|
||||
|
||||
case COL_SELCMP:
|
||||
colclr = COL_SELSCH;
|
||||
colset = COL_SELCMP;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
for( int i = 0; i < m_listFp->GetItemCount(); i++ )
|
||||
{
|
||||
m_listFp->SetItem( i, colclr, wxT("") );
|
||||
m_listFp->SetItem( i, colset, wxT("X") );
|
||||
}
|
||||
}
|
||||
|
||||
void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnItemClicked( wxMouseEvent& event )
|
||||
{
|
||||
wxPoint pos = event.GetPosition();
|
||||
int flgs = wxLIST_HITTEST_ONITEMLABEL;
|
||||
long idx = m_listFp->HitTest( pos, flgs );
|
||||
|
||||
// Try to find the column clicked (must be COL_SELCMP or COL_SELSCH)
|
||||
int colclr = -1, colset;
|
||||
int minpx = m_listFp->GetColumnWidth( 0 ) + m_listFp->GetColumnWidth( 1 );
|
||||
int maxpx = minpx + m_listFp->GetColumnWidth( 2 );
|
||||
|
||||
if( pos.x > minpx && pos.x < maxpx )
|
||||
{
|
||||
colclr = COL_SELCMP;
|
||||
colset = COL_SELSCH;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
minpx = maxpx;
|
||||
int maxpx = minpx + m_listFp->GetColumnWidth( 3 );
|
||||
|
||||
if( pos.x > minpx && pos.x < maxpx )
|
||||
{
|
||||
colclr = COL_SELSCH;
|
||||
colset = COL_SELCMP;
|
||||
}
|
||||
}
|
||||
|
||||
if( colclr < 0 )
|
||||
return;
|
||||
|
||||
// Move selection to schematic or cmp file choice
|
||||
// according to the column position (COL_SELCMP or COL_SELSCH)
|
||||
m_listFp->SetItem( idx, colclr, wxT("") );
|
||||
m_listFp->SetItem( idx, colset, wxT("X") );
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnSize( wxSizeEvent& aEvent )
|
||||
{
|
||||
recalculateColumns();
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::recalculateColumns()
|
||||
{
|
||||
const int margin = 16;
|
||||
int totalLength = 0;
|
||||
int sel_length = GetTextSize( wxT("XX"), m_listFp ).x;
|
||||
int maxRefLength = GetTextSize( wxT("XXX"), m_listFp ).x;
|
||||
|
||||
sel_length += margin;
|
||||
m_listFp->SetColumnWidth( COL_SELSCH, sel_length );
|
||||
m_listFp->SetColumnWidth( COL_SELCMP, sel_length );
|
||||
|
||||
// Find max character width of column Reference
|
||||
for( int i = 0; i < m_listFp->GetItemCount(); i++ )
|
||||
{
|
||||
int length = GetTextSize( m_listFp->GetItemText( i, COL_REF ), m_listFp ).x;
|
||||
|
||||
if( length > maxRefLength )
|
||||
maxRefLength = length;
|
||||
}
|
||||
|
||||
|
||||
// Use the lengths of column texts to create a scale of the max list width
|
||||
// to set the column widths
|
||||
maxRefLength += margin;
|
||||
totalLength = maxRefLength + sel_length + sel_length;
|
||||
|
||||
int cwidth = (GetClientSize().x - totalLength) / 2;
|
||||
|
||||
m_listFp->SetColumnWidth( COL_REF, maxRefLength );
|
||||
m_listFp->SetColumnWidth( COL_FPSCH, cwidth - 2 );
|
||||
m_listFp->SetColumnWidth( COL_FPCMP, cwidth );
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/**
|
||||
* @file fp_choice_selector.h
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2010-2014 Jean-Pierre Charras <jp.charras at wanadoo.fr>
|
||||
* Copyright (C) 1992-2014 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 <fp_conflict_assignment_selector_base.h>
|
||||
|
||||
|
||||
class DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR : public DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE
|
||||
{
|
||||
private:
|
||||
enum COL_ID
|
||||
{
|
||||
COL_REF, COL_FPSCH, COL_SELSCH, COL_SELCMP, COL_FPCMP,
|
||||
COL_COUNT
|
||||
};
|
||||
|
||||
int m_lineCount;
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR( wxWindow* parent );
|
||||
|
||||
/**
|
||||
* Add a line to the selection list.
|
||||
* @param aRef = component reference text
|
||||
* @param aFpSchName = fpid text from the netlist
|
||||
* @param aFpCmpName = fpid text from the .cmp file
|
||||
*/
|
||||
void Add( const wxString& aRef, const wxString& aFpSchName,
|
||||
const wxString& aFpCmpName );
|
||||
|
||||
/**
|
||||
* @return the selection option:
|
||||
* 0 for fpid text from the netlist
|
||||
* 1 for fpid text from the cmp file
|
||||
* -1 on error
|
||||
* @param aReference = the compoent schematic reference
|
||||
*/
|
||||
int GetSelection( const wxString& aReference );
|
||||
|
||||
private:
|
||||
void OnSize( wxSizeEvent& event );
|
||||
|
||||
// Virtual: called when clicking on the column title:
|
||||
// when it is a column choice, set all item choices.
|
||||
void OnColumnClick( wxListEvent& event );
|
||||
|
||||
void OnItemClicked( wxMouseEvent& event );
|
||||
|
||||
void OnCancelClick( wxCommandEvent& event ) { EndModal( wxID_CANCEL ); }
|
||||
void OnOKClick( wxCommandEvent& event ) { EndModal( wxID_OK ); }
|
||||
|
||||
void recalculateColumns();
|
||||
|
||||
};
|
|
@ -0,0 +1,58 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 5 2014)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "fp_conflict_assignment_selector_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_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 );
|
||||
|
||||
wxBoxSizer* bSizerMain;
|
||||
bSizerMain = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticTextInfo = new wxStaticText( this, wxID_ANY, wxT("Footprint assignments from schematic netlist and from .cmp file are conflicting\nPlease choose the assignment."), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE );
|
||||
m_staticTextInfo->Wrap( -1 );
|
||||
bSizerMain->Add( m_staticTextInfo, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_listFp = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_ICON|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES );
|
||||
bSizerMain->Add( m_listFp, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_sdbSizer = new wxStdDialogButtonSizer();
|
||||
m_sdbSizerOK = new wxButton( this, wxID_OK );
|
||||
m_sdbSizer->AddButton( m_sdbSizerOK );
|
||||
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
|
||||
m_sdbSizer->AddButton( m_sdbSizerCancel );
|
||||
m_sdbSizer->Realize();
|
||||
|
||||
bSizerMain->Add( m_sdbSizer, 0, wxALIGN_RIGHT, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizerMain );
|
||||
this->Layout();
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnSize ) );
|
||||
m_listFp->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnItemClicked ), NULL, this );
|
||||
m_listFp->Connect( wxEVT_COMMAND_LIST_COL_CLICK, wxListEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnColumnClick ), NULL, this );
|
||||
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnCancelClick ), NULL, this );
|
||||
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnOKClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::~DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnSize ) );
|
||||
m_listFp->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnItemClicked ), NULL, this );
|
||||
m_listFp->Disconnect( wxEVT_COMMAND_LIST_COL_CLICK, wxListEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnColumnClick ), NULL, this );
|
||||
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnCancelClick ), NULL, this );
|
||||
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE::OnOKClick ), NULL, this );
|
||||
|
||||
}
|
|
@ -0,0 +1,313 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="13" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="disconnect_events">1</property>
|
||||
<property name="disconnect_mode">source_name</property>
|
||||
<property name="disconnect_php_events">0</property>
|
||||
<property name="disconnect_python_events">0</property>
|
||||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">fp_conflict_assignment_selector_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="internationalize">0</property>
|
||||
<property name="name">fp_conflict_assignment_selector</property>
|
||||
<property name="namespace"></property>
|
||||
<property name="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
<property name="relative_path">1</property>
|
||||
<property name="skip_lua_events">1</property>
|
||||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<property name="bg"></property>
|
||||
<property name="center">wxBOTH</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="extra_style"></property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">478,294</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||
<property name="title">Footprint Assignment Conflicts</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnActivate"></event>
|
||||
<event name="OnActivateApp"></event>
|
||||
<event name="OnAuiFindManager"></event>
|
||||
<event name="OnAuiPaneButton"></event>
|
||||
<event name="OnAuiPaneClose"></event>
|
||||
<event name="OnAuiPaneMaximize"></event>
|
||||
<event name="OnAuiPaneRestore"></event>
|
||||
<event name="OnAuiRender"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnClose"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnHibernate"></event>
|
||||
<event name="OnIconize"></event>
|
||||
<event name="OnIdle"></event>
|
||||
<event name="OnInitDialog"></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">OnSize</event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerMain</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<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_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_ANY</property>
|
||||
<property name="label">Footprint assignments from schematic netlist and from .cmp file are conflicting
Please choose the assignment.</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_staticTextInfo</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">wxALIGN_CENTRE</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
<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 class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxListCtrl" expanded="1">
|
||||
<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_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_ANY</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_listFp</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">wxLC_HRULES|wxLC_ICON|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES</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="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">OnItemClicked</event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnListBeginDrag"></event>
|
||||
<event name="OnListBeginLabelEdit"></event>
|
||||
<event name="OnListBeginRDrag"></event>
|
||||
<event name="OnListCacheHint"></event>
|
||||
<event name="OnListColBeginDrag"></event>
|
||||
<event name="OnListColClick">OnColumnClick</event>
|
||||
<event name="OnListColDragging"></event>
|
||||
<event name="OnListColEndDrag"></event>
|
||||
<event name="OnListColRightClick"></event>
|
||||
<event name="OnListDeleteAllItems"></event>
|
||||
<event name="OnListDeleteItem"></event>
|
||||
<event name="OnListEndLabelEdit"></event>
|
||||
<event name="OnListInsertItem"></event>
|
||||
<event name="OnListItemActivated"></event>
|
||||
<event name="OnListItemDeselected"></event>
|
||||
<event name="OnListItemFocused"></event>
|
||||
<event name="OnListItemMiddleClick"></event>
|
||||
<event name="OnListItemRightClick"></event>
|
||||
<event name="OnListItemSelected"></event>
|
||||
<event name="OnListKeyDown"></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="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_RIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStdDialogButtonSizer" expanded="1">
|
||||
<property name="Apply">0</property>
|
||||
<property name="Cancel">1</property>
|
||||
<property name="ContextHelp">0</property>
|
||||
<property name="Help">0</property>
|
||||
<property name="No">0</property>
|
||||
<property name="OK">1</property>
|
||||
<property name="Save">0</property>
|
||||
<property name="Yes">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_sdbSizer</property>
|
||||
<property name="permission">protected</property>
|
||||
<event name="OnApplyButtonClick"></event>
|
||||
<event name="OnCancelButtonClick">OnCancelClick</event>
|
||||
<event name="OnContextHelpButtonClick"></event>
|
||||
<event name="OnHelpButtonClick"></event>
|
||||
<event name="OnNoButtonClick"></event>
|
||||
<event name="OnOKButtonClick">OnOKClick</event>
|
||||
<event name="OnSaveButtonClick"></event>
|
||||
<event name="OnYesButtonClick"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxFormBuilder_Project>
|
|
@ -0,0 +1,59 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 5 2014)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE_H__
|
||||
#define __FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
class DIALOG_SHIM;
|
||||
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_staticTextInfo;
|
||||
wxListCtrl* m_listFp;
|
||||
wxStdDialogButtonSizer* m_sdbSizer;
|
||||
wxButton* m_sdbSizerOK;
|
||||
wxButton* m_sdbSizerCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnSize( wxSizeEvent& event ) { event.Skip(); }
|
||||
virtual void OnItemClicked( wxMouseEvent& event ) { event.Skip(); }
|
||||
virtual void OnColumnClick( wxListEvent& event ) { event.Skip(); }
|
||||
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Footprint Assignment Conflicts"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 478,294 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE();
|
||||
|
||||
};
|
||||
|
||||
#endif //__FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE_H__
|
|
@ -42,6 +42,7 @@
|
|||
#include <cvpcb_mainframe.h>
|
||||
#include <cvstruct.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <fp_conflict_assignment_selector.h>
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
|
||||
|
@ -290,6 +291,58 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Display a dialog to select footprint selection, if the netlist
|
||||
// and the .cmp file give 2 different valid footprints
|
||||
std::vector <int > m_indexes; // indexes of footprints in netlist
|
||||
|
||||
for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ )
|
||||
{
|
||||
COMPONENT* component = m_netlist.GetComponent( ii );
|
||||
|
||||
if( component->GetAltFPID().empty() )
|
||||
continue;
|
||||
|
||||
if( component->GetFPID().IsLegacy() || component->GetAltFPID().IsLegacy())
|
||||
continue;
|
||||
|
||||
m_indexes.push_back( ii );;
|
||||
}
|
||||
|
||||
// If a n assignment conflict is found,
|
||||
// open a dialog to chose between schematic assignment
|
||||
// and .cmp file assignment:
|
||||
if( m_indexes.size() > 0 )
|
||||
{
|
||||
DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR dlg( this );
|
||||
|
||||
for( unsigned ii = 0; ii < m_indexes.size(); ii++ )
|
||||
{
|
||||
COMPONENT* component = m_netlist.GetComponent( m_indexes[ii] );
|
||||
|
||||
wxString cmpfpid = component->GetFPID().Format();
|
||||
wxString schfpid = component->GetAltFPID().Format();
|
||||
|
||||
dlg.Add( component->GetReference(), schfpid, cmpfpid );
|
||||
}
|
||||
|
||||
if( dlg.ShowModal() == wxID_OK )
|
||||
{
|
||||
|
||||
// Update the fp selection:
|
||||
for( unsigned ii = 0; ii < m_indexes.size(); ii++ )
|
||||
{
|
||||
COMPONENT* component = m_netlist.GetComponent( m_indexes[ii] );
|
||||
|
||||
int choice = dlg.GetSelection( component->GetReference() );
|
||||
|
||||
if( choice == 0 ) // the schematic (alt fpid) is chosen:
|
||||
component->SetFPID( component->GetAltFPID() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Populates the component list box:
|
||||
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
|
||||
{
|
||||
COMPONENT* component = m_netlist.GetComponent( i );
|
||||
|
|
|
@ -209,6 +209,13 @@ bool CMP_READER::Load( NETLIST* aNetlist ) throw( IO_ERROR, PARSE_ERROR )
|
|||
THROW_IO_ERROR( error );
|
||||
}
|
||||
|
||||
// For checking purpose, store the existing FPID (if any) in the alternate fpid copy
|
||||
// if this existing FPID differs from the FPID read from the .cmp file.
|
||||
// Cvpcb can ask for user to chose the right FPID.
|
||||
// It happens if the FPIT was modified outside CvPcb.
|
||||
if( fpid != component->GetFPID() && !component->GetFPID().empty() )
|
||||
component->SetAltFPID( component->GetFPID() );
|
||||
|
||||
component->SetFPID( fpid );
|
||||
}
|
||||
else
|
||||
|
|
|
@ -98,6 +98,11 @@ class COMPONENT
|
|||
/// The #FPID of the footprint assigned to the component.
|
||||
FPID m_fpid;
|
||||
|
||||
/// The alt FPID of the footprint, when there are 2 different assigned footprints,
|
||||
/// One from the netlist, the other from the .cmp file.
|
||||
/// this one is a copy of the netlist footprint assignment
|
||||
FPID m_altFpid;
|
||||
|
||||
/// The #MODULE loaded for #m_fpid.
|
||||
std::auto_ptr< MODULE > m_footprint;
|
||||
|
||||
|
@ -150,9 +155,16 @@ public:
|
|||
m_fpid = aFPID;
|
||||
}
|
||||
|
||||
const FPID& GetFPID() const { return m_fpid; }
|
||||
void SetAltFPID( const FPID& aFPID )
|
||||
{
|
||||
m_altFpid = aFPID;
|
||||
}
|
||||
|
||||
const wxString& GetTimeStamp() const { return m_timeStamp; }
|
||||
const FPID& GetFPID() const { return m_fpid; }
|
||||
|
||||
const FPID& GetAltFPID() const { return m_altFpid; }
|
||||
|
||||
const wxString& GetTimeStamp() const { return m_timeStamp; }
|
||||
|
||||
void SetFootprintFilters( const wxArrayString& aFilterList )
|
||||
{
|
||||
|
@ -261,7 +273,7 @@ public:
|
|||
*/
|
||||
void AddComponent( COMPONENT* aComponent );
|
||||
|
||||
/*
|
||||
/**
|
||||
* Function GetComponentByReference
|
||||
* returns a #COMPONENT by \a aReference.
|
||||
*
|
||||
|
@ -270,7 +282,7 @@ public:
|
|||
*/
|
||||
COMPONENT* GetComponentByReference( const wxString& aReference );
|
||||
|
||||
/*
|
||||
/**
|
||||
* Function GetComponentByTimeStamp
|
||||
* returns a #COMPONENT by \a aTimeStamp.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue