Add filter to net selector widget.
Also fixes a bug where nets wouldn't get changed because the pads weren't changed and so the pad nets would propagate and wipe out the changed nets on the tracks. Also includes warning dialogs that pad nets will be changed if the track nets are. Fixes: lp:1779854 * https://bugs.launchpad.net/kicad/+bug/1779854
This commit is contained in:
parent
8957008c2a
commit
ec9d38e21f
|
@ -447,7 +447,7 @@ set( PCB_COMMON_SRCS
|
|||
../pcbnew/ratsnest_viewitem.cpp
|
||||
../pcbnew/sel_layer.cpp
|
||||
../pcbnew/zone_settings.cpp
|
||||
widgets/widget_net_selector.cpp
|
||||
widgets/net_selector.cpp
|
||||
)
|
||||
|
||||
# add -DPCBNEW to compilation of these PCBNEW sources
|
||||
|
|
|
@ -0,0 +1,290 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2018 KiCad Developers, see AUTHORS.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 <widgets/net_selector.h>
|
||||
|
||||
#include <class_board.h>
|
||||
#include <netinfo.h>
|
||||
#include <wx/arrstr.h>
|
||||
|
||||
|
||||
wxDEFINE_EVENT( NET_SELECTED, wxCommandEvent );
|
||||
|
||||
#define LIST_ITEM_PADDING 5 // these are probably going to be platform-specific...
|
||||
#define LIST_PADDING 5
|
||||
|
||||
#define NO_NET _( "<no net>" )
|
||||
|
||||
|
||||
class NET_SELECTOR_COMBOPOPUP : public wxPanel, public wxComboPopup
|
||||
{
|
||||
public:
|
||||
NET_SELECTOR_COMBOPOPUP() :
|
||||
m_filterCtrl( nullptr ),
|
||||
m_netListBox( nullptr ),
|
||||
m_popupWidth( -1 ),
|
||||
m_maxPopupHeight( 1000 ),
|
||||
m_netinfoList( nullptr ),
|
||||
m_selectedNet( 0 )
|
||||
{ }
|
||||
|
||||
bool Create(wxWindow* aParent) override
|
||||
{
|
||||
wxPanel::Create( aParent );
|
||||
|
||||
wxBoxSizer* mainSizer;
|
||||
mainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_filterCtrl = new wxTextCtrl( this, wxID_ANY );
|
||||
m_filterCtrl->SetHint( _( "Filter" ) );
|
||||
mainSizer->Add( m_filterCtrl, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 0 );
|
||||
|
||||
m_netListBox = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, 0,
|
||||
wxLB_SINGLE|wxLB_NEEDED_SB );
|
||||
mainSizer->Add( m_netListBox, 0, wxALL|wxEXPAND, 0 );
|
||||
|
||||
SetSizer( mainSizer );
|
||||
Layout();
|
||||
|
||||
// wxPopupTransientWindow's mouse capture strategy is an absolute nightmare. We can't
|
||||
// tell where mouse-down events will come from, so we have to accept them from either
|
||||
// ourselves (the popup) or our child (the net listbox). Mouse-move events are even
|
||||
// worse as the above strategy doesn't even work -- so we process them on idle.
|
||||
Connect( wxEVT_IDLE, wxIdleEventHandler( NET_SELECTOR_COMBOPOPUP::onIdle ), NULL, this );
|
||||
Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( NET_SELECTOR_COMBOPOPUP::onMouseClick ), NULL, this );
|
||||
m_netListBox->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( NET_SELECTOR_COMBOPOPUP::onMouseClick ), NULL, this );
|
||||
m_filterCtrl->Connect( wxEVT_TEXT, wxCommandEventHandler( NET_SELECTOR_COMBOPOPUP::onFilterEdit ), NULL, this );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxWindow *GetControl() override { return this; }
|
||||
|
||||
void SetStringValue( const wxString& aNetName ) override
|
||||
{
|
||||
// shouldn't be here (combo is read-only)
|
||||
}
|
||||
|
||||
wxString GetStringValue() const override
|
||||
{
|
||||
NETINFO_ITEM* netInfo = m_netinfoList->GetNetItem( m_selectedNet );
|
||||
|
||||
if( netInfo && netInfo->GetNet() > 0 )
|
||||
return netInfo->GetNetname();
|
||||
|
||||
return NO_NET;
|
||||
}
|
||||
|
||||
void SetNetInfo( NETINFO_LIST* aNetInfoList )
|
||||
{
|
||||
m_netinfoList = aNetInfoList;
|
||||
rebuildList();
|
||||
}
|
||||
|
||||
void SetIndeterminate() { m_selectedNet = -1; }
|
||||
bool IsIndeterminate() { return m_selectedNet == -1; }
|
||||
|
||||
void SetSelectedNetcode( int aNetcode ) { m_selectedNet = aNetcode; }
|
||||
int GetSelectedNetcode() { return m_selectedNet; }
|
||||
|
||||
wxSize GetAdjustedSize( int aMinWidth, int aPrefHeight, int aMaxHeight ) override
|
||||
{
|
||||
// Called when the popup is first shown. Stash the width and maxHeight so we
|
||||
// can use them later when refreshing the sizes after filter changes.
|
||||
m_popupWidth = aMinWidth;
|
||||
m_maxPopupHeight = aMaxHeight;
|
||||
|
||||
return updateSize();
|
||||
}
|
||||
|
||||
void OnPopup() override
|
||||
{
|
||||
// The updateSize() call in GetAdjustedSize() leaves the height off-by-one for
|
||||
// some reason, so do it again.
|
||||
updateSize();
|
||||
}
|
||||
|
||||
protected:
|
||||
wxSize updateSize()
|
||||
{
|
||||
wxSize popupSize( m_popupWidth, m_maxPopupHeight );
|
||||
int listTop = m_netListBox->GetRect().y;
|
||||
int itemHeight = GetTextSize( wxT( "Xy" ), this ).y + LIST_ITEM_PADDING;
|
||||
int listHeight = m_netListBox->GetCount() * itemHeight + LIST_PADDING;
|
||||
|
||||
if( listTop + listHeight >= m_maxPopupHeight )
|
||||
listHeight = m_maxPopupHeight - listTop - 1;
|
||||
|
||||
popupSize.y = listTop + listHeight;
|
||||
SetSize( popupSize ); // us
|
||||
GetParent()->SetSize( popupSize ); // the window that wxComboCtrl put us in
|
||||
|
||||
m_netListBox->SetSize( wxSize( m_popupWidth, listHeight ) );
|
||||
m_netListBox->Refresh();
|
||||
|
||||
return popupSize;
|
||||
}
|
||||
|
||||
void rebuildList()
|
||||
{
|
||||
wxArrayString netNames;
|
||||
wxString filter = m_filterCtrl->GetValue().MakeLower();
|
||||
|
||||
if( !filter.IsEmpty() )
|
||||
filter = wxT( "*" ) + filter + wxT( "*" );
|
||||
|
||||
for( NETINFO_ITEM* netinfo : *m_netinfoList )
|
||||
{
|
||||
if( netinfo->GetNet() == 0 )
|
||||
continue; // we'll insert NO_NET after sorting
|
||||
|
||||
if( filter.IsEmpty() || wxString( netinfo->GetNetname() ).MakeLower().Matches( filter ) )
|
||||
netNames.push_back( netinfo->GetNetname() );
|
||||
}
|
||||
std::sort( netNames.begin(), netNames.end() );
|
||||
|
||||
if( filter.IsEmpty() || wxString( NO_NET ).MakeLower().Matches( filter ) )
|
||||
netNames.insert( netNames.begin(), NO_NET );
|
||||
|
||||
m_netListBox->Set( netNames );
|
||||
}
|
||||
|
||||
// Hot-track mouse.
|
||||
void onIdle( wxIdleEvent& aEvent )
|
||||
{
|
||||
wxPoint screenPos = wxGetMousePosition();
|
||||
|
||||
if( m_netListBox->GetScreenRect().Contains( screenPos ) )
|
||||
{
|
||||
if( HasCapture() )
|
||||
ReleaseMouse();
|
||||
|
||||
#ifdef __WXOSX_MAC__
|
||||
m_netListBox->OSXForceFocus();
|
||||
#else
|
||||
m_netListBox->SetFocus();
|
||||
#endif
|
||||
|
||||
wxPoint relativePos = m_netListBox->ScreenToClient( screenPos );
|
||||
int item = m_netListBox->HitTest( relativePos );
|
||||
|
||||
if( item >= 0 )
|
||||
m_netListBox->SetSelection( item );
|
||||
}
|
||||
else if( m_filterCtrl->GetScreenRect().Contains( screenPos ) )
|
||||
{
|
||||
if( HasCapture() )
|
||||
ReleaseMouse();
|
||||
|
||||
m_filterCtrl->SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
// Accecpt single-click closure from m_netListBox
|
||||
void onMouseClick( wxMouseEvent& aEvent )
|
||||
{
|
||||
wxPoint relativePos = m_netListBox->ScreenToClient( wxGetMousePosition() );
|
||||
int item = m_netListBox->HitTest( relativePos );
|
||||
|
||||
if( item >= 0 )
|
||||
{
|
||||
wxString selectedNetName = m_netListBox->GetString( (unsigned) item );
|
||||
|
||||
if( selectedNetName.IsEmpty() )
|
||||
{
|
||||
m_selectedNet = -1;
|
||||
GetComboCtrl()->SetValue( INDETERMINATE );
|
||||
}
|
||||
else if( selectedNetName == NO_NET )
|
||||
{
|
||||
m_selectedNet = 0;
|
||||
GetComboCtrl()->SetValue( NO_NET );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_selectedNet = m_netinfoList->GetNetItem( selectedNetName )->GetNet();
|
||||
GetComboCtrl()->SetValue( selectedNetName );
|
||||
}
|
||||
|
||||
wxCommandEvent changeEvent( NET_SELECTED );
|
||||
wxPostEvent( GetComboCtrl(), changeEvent );
|
||||
|
||||
Dismiss();
|
||||
}
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
||||
void onFilterEdit( wxCommandEvent& aEvent )
|
||||
{
|
||||
rebuildList();
|
||||
updateSize();
|
||||
}
|
||||
|
||||
protected:
|
||||
wxTextCtrl* m_filterCtrl;
|
||||
wxListBox* m_netListBox;
|
||||
int m_popupWidth;
|
||||
int m_maxPopupHeight;
|
||||
|
||||
NETINFO_LIST* m_netinfoList;
|
||||
|
||||
int m_selectedNet;
|
||||
};
|
||||
|
||||
|
||||
NET_SELECTOR::NET_SELECTOR( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint &pos, const wxSize &size, long style ) :
|
||||
wxComboCtrl( parent, id, wxEmptyString, pos, size, style|wxCB_READONLY )
|
||||
{
|
||||
m_netSelectorPopup = new NET_SELECTOR_COMBOPOPUP();
|
||||
SetPopupControl( m_netSelectorPopup );
|
||||
}
|
||||
|
||||
void NET_SELECTOR::SetNetInfo( NETINFO_LIST* aNetInfoList )
|
||||
{
|
||||
m_netSelectorPopup->SetNetInfo( aNetInfoList );
|
||||
}
|
||||
|
||||
void NET_SELECTOR::SetSelectedNetcode( int aNetcode )
|
||||
{
|
||||
m_netSelectorPopup->SetSelectedNetcode( aNetcode );
|
||||
SetValue( m_netSelectorPopup->GetStringValue() );
|
||||
}
|
||||
|
||||
void NET_SELECTOR::SetIndeterminate()
|
||||
{
|
||||
m_netSelectorPopup->SetIndeterminate();
|
||||
SetValue( INDETERMINATE );
|
||||
}
|
||||
|
||||
bool NET_SELECTOR::IsIndeterminate()
|
||||
{
|
||||
return m_netSelectorPopup->IsIndeterminate();
|
||||
}
|
||||
|
||||
int NET_SELECTOR::GetSelectedNetcode()
|
||||
{
|
||||
return m_netSelectorPopup->GetSelectedNetcode();
|
||||
}
|
||||
|
|
@ -1,124 +0,0 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 CERN
|
||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* 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 <widgets/widget_net_selector.h>
|
||||
|
||||
#include <class_board.h>
|
||||
#include <netinfo.h>
|
||||
#include <wx/arrstr.h>
|
||||
|
||||
WIDGET_NET_SELECTOR::WIDGET_NET_SELECTOR( wxWindow *parent, wxWindowID id,
|
||||
const wxString &value, const wxPoint &pos, const wxSize &size,
|
||||
int n, const wxString choices[], long style,
|
||||
const wxValidator &validator, const wxString &name ) :
|
||||
wxComboBox( parent, id, value, pos, size, n, choices, style, validator, name ),
|
||||
m_multiple( false )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
WIDGET_NET_SELECTOR::~WIDGET_NET_SELECTOR()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void WIDGET_NET_SELECTOR::SetMultiple( bool aMultiple )
|
||||
{
|
||||
if ( aMultiple )
|
||||
{
|
||||
m_multiple = true;
|
||||
|
||||
int k = Append( wxT("<multiple nets>") );
|
||||
SetSelection( k );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WIDGET_NET_SELECTOR::SetSelectedNet ( int aNetcode )
|
||||
{
|
||||
for( const auto& net : m_nets )
|
||||
{
|
||||
if( net.m_Code == aNetcode )
|
||||
{
|
||||
SetSelection( net.m_Pos );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SetSelection( 0 );
|
||||
}
|
||||
|
||||
|
||||
int WIDGET_NET_SELECTOR::GetSelectedNet()
|
||||
{
|
||||
int pos = GetSelection();
|
||||
|
||||
for( const auto& net : m_nets )
|
||||
{
|
||||
if( net.m_Pos == pos )
|
||||
return net.m_Code;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool WIDGET_NET_SELECTOR::IsUniqueNetSelected() const
|
||||
{
|
||||
if( m_multiple && ( GetSelection() == ( (int)GetCount() - 1 ) ) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void WIDGET_NET_SELECTOR::SetBoard( BOARD* aBoard )
|
||||
{
|
||||
auto& netinfo = aBoard->GetNetInfo();
|
||||
|
||||
for( unsigned i = 1; i < netinfo.GetNetCount(); i++ )
|
||||
{
|
||||
NETINFO_ITEM* ni = netinfo.GetNetItem( i );
|
||||
NET net;
|
||||
net.m_Name = ni->GetNetname();
|
||||
net.m_Code = i;
|
||||
m_nets.push_back( net );
|
||||
}
|
||||
|
||||
std::sort( m_nets.begin(), m_nets.end() );
|
||||
|
||||
// Add the list of selectable nets to the wxComboBox.
|
||||
// Using a wxArrayString is much faster than adding each name separately
|
||||
wxArrayString netnames;
|
||||
|
||||
netnames.Add( wxT( "<no net>" ) ); // Always on top of the list
|
||||
|
||||
for( auto& net : m_nets )
|
||||
{
|
||||
net.m_Pos = netnames.Add( net.m_Name );
|
||||
}
|
||||
|
||||
Append( netnames );
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2018 KiCad Developers, see AUTHORS.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 __WIDGET_NET_SELECTOR_H
|
||||
#define __WIDGET_NET_SELECTOR_H
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/combo.h>
|
||||
|
||||
|
||||
class BOARD;
|
||||
class NETINFO_LIST;
|
||||
class NET_SELECTOR_COMBOPOPUP;
|
||||
|
||||
|
||||
wxDECLARE_EVENT( NET_SELECTED, wxCommandEvent );
|
||||
|
||||
|
||||
class NET_SELECTOR : public wxComboCtrl
|
||||
{
|
||||
public:
|
||||
// Note: this list of arguments is here because it keeps us from having to customize
|
||||
// the constructor calls in wxFormBuilder.
|
||||
NET_SELECTOR( wxWindow *parent, wxWindowID id,
|
||||
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
|
||||
long style = 0 );
|
||||
|
||||
void SetNetInfo( NETINFO_LIST* aNetInfoList );
|
||||
|
||||
void SetSelectedNetcode( int aNetcode );
|
||||
void SetIndeterminate();
|
||||
|
||||
bool IsIndeterminate();
|
||||
int GetSelectedNetcode();
|
||||
|
||||
protected:
|
||||
NET_SELECTOR_COMBOPOPUP* m_netSelectorPopup;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -1,73 +0,0 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 CERN
|
||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* 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 __WIDGET_NET_SELECTOR_H
|
||||
#define __WIDGET_NET_SELECTOR_H
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <vector>
|
||||
|
||||
class BOARD;
|
||||
|
||||
class WIDGET_NET_SELECTOR : public wxComboBox
|
||||
{
|
||||
public:
|
||||
// Note: this list of arguments is here because WIDGET_NET_SELECTOR must
|
||||
// have the same arguments as wxComboBox to be used inside wxFormaBuilder
|
||||
WIDGET_NET_SELECTOR( wxWindow *parent, wxWindowID id,
|
||||
const wxString &value=wxEmptyString,
|
||||
const wxPoint &pos=wxDefaultPosition,
|
||||
const wxSize &size=wxDefaultSize,
|
||||
int n=0, const wxString choices[]=NULL,
|
||||
long style=0, const wxValidator &validator=wxDefaultValidator,
|
||||
const wxString &name=wxComboBoxNameStr);
|
||||
|
||||
~WIDGET_NET_SELECTOR();
|
||||
|
||||
void SetMultiple( bool aMultiple = true );
|
||||
void SetSelectedNet ( int aNetcode );
|
||||
int GetSelectedNet();
|
||||
|
||||
bool IsUniqueNetSelected() const;
|
||||
|
||||
// Build the list of netnames and populate the wxComboBox
|
||||
void SetBoard( BOARD* aBoard );
|
||||
|
||||
private:
|
||||
struct NET {
|
||||
int m_Code;
|
||||
int m_Pos;
|
||||
wxString m_Name;
|
||||
|
||||
bool operator <( const NET& aOther ) const
|
||||
{
|
||||
return m_Name < aOther.m_Name;
|
||||
}
|
||||
};
|
||||
|
||||
bool m_multiple;
|
||||
std::vector<NET> m_nets;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -462,22 +462,27 @@ const
|
|||
}
|
||||
|
||||
|
||||
const std::vector<D_PAD*> CONNECTIVITY_DATA::GetConnectedPads( const BOARD_CONNECTED_ITEM* aItem )
|
||||
const
|
||||
const void CONNECTIVITY_DATA::GetConnectedPads( const BOARD_CONNECTED_ITEM* aItem,
|
||||
std::set<D_PAD*>* pads ) const
|
||||
{
|
||||
auto& entry = m_connAlgo->ItemEntry( aItem );
|
||||
|
||||
std::set<D_PAD*> pads;
|
||||
std::vector<D_PAD*> rv;
|
||||
|
||||
for( auto citem : entry.GetItems() )
|
||||
for( auto citem : m_connAlgo->ItemEntry( aItem ).GetItems() )
|
||||
{
|
||||
for( auto connected : citem->ConnectedItems() )
|
||||
{
|
||||
if( connected->Valid() && connected->Parent()->Type() == PCB_PAD_T )
|
||||
pads.insert( static_cast<D_PAD*> ( connected->Parent() ) );
|
||||
pads->insert( static_cast<D_PAD*> ( connected->Parent() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const std::vector<D_PAD*> CONNECTIVITY_DATA::GetConnectedPads( const BOARD_CONNECTED_ITEM* aItem )
|
||||
const
|
||||
{
|
||||
std::set<D_PAD*> pads;
|
||||
std::vector<D_PAD*> rv;
|
||||
|
||||
GetConnectedPads( aItem, &pads );
|
||||
|
||||
std::copy( pads.begin(), pads.end(), std::back_inserter( rv ) );
|
||||
return rv;
|
||||
|
|
|
@ -174,6 +174,8 @@ public:
|
|||
|
||||
const std::vector<D_PAD*> GetConnectedPads( const BOARD_CONNECTED_ITEM* aItem ) const;
|
||||
|
||||
const void GetConnectedPads( const BOARD_CONNECTED_ITEM* aItem, std::set<D_PAD*>* pads ) const;
|
||||
|
||||
const std::vector<BOARD_CONNECTED_ITEM*> GetConnectedItems( const BOARD_CONNECTED_ITEM* aItem, const VECTOR2I& aAnchor, KICAD_T aTypes[] );
|
||||
|
||||
void GetUnconnectedEdges( std::vector<CN_EDGE>& aEdges ) const;
|
||||
|
|
|
@ -68,7 +68,7 @@ private:
|
|||
void OnSizeNetclassGrid( wxSizeEvent& event ) override;
|
||||
void AdjustNetclassGridColumns( int aWidth );
|
||||
|
||||
void OnNetFilterSelect( wxCommandEvent& event ) override
|
||||
void OnNetFilterSelect( wxCommandEvent& event )
|
||||
{
|
||||
m_netFilterOpt->SetValue( true );
|
||||
}
|
||||
|
@ -115,98 +115,79 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS( PCB_EDIT
|
|||
m_netclassGrid->SetCellHighlightPenWidth( 0 );
|
||||
m_sdbSizerOK->SetDefault();
|
||||
|
||||
m_netFilter->Connect( NET_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnNetFilterSelect ), NULL, this );
|
||||
|
||||
FinishDialogSettings();
|
||||
}
|
||||
|
||||
|
||||
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS()
|
||||
{
|
||||
m_netFilter->Disconnect( NET_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnNetFilterSelect ), NULL, this );
|
||||
|
||||
delete[] m_originalColWidths;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists()
|
||||
{
|
||||
int currentNet = m_brd->GetHighLightNetCode();
|
||||
|
||||
if( currentNet < 0 && m_parent->GetCurItem() && m_parent->GetCurItem()->IsConnected() )
|
||||
currentNet = static_cast<BOARD_CONNECTED_ITEM*>( m_parent->GetCurItem() )->GetNetCode();
|
||||
|
||||
wxString currentNetClass = m_brd->GetDesignSettings().GetCurrentNetClassName();
|
||||
LAYER_NUM currentLayer = m_parent->GetActiveLayer();
|
||||
|
||||
// Populate the net filter list with net names
|
||||
for( unsigned netcode = 0; netcode < m_brd->GetNetCount(); netcode++ )
|
||||
{
|
||||
wxString netname;
|
||||
|
||||
if( netcode == 0 ) // netcode 0 is the netcode of not connected items
|
||||
netname = "<no net>";
|
||||
else
|
||||
netname = m_brd->GetNetInfo().GetNetItem( netcode )->GetNetname();
|
||||
|
||||
m_netFilter->Append( netname );
|
||||
|
||||
if( (int) netcode == currentNet )
|
||||
m_netFilter->SetSelection( m_netFilter->GetCount() - 1 );
|
||||
}
|
||||
m_netFilter->SetNetInfo( &m_brd->GetNetInfo() );
|
||||
m_netFilter->SetSelectedNetcode( m_brd->GetHighLightNetCode() );
|
||||
|
||||
// Populate the netclass filter list with netclass names
|
||||
NETCLASSES& netclasses = m_brd->GetDesignSettings().m_NetClasses;
|
||||
wxArrayString netclassNames;
|
||||
NETCLASSES& netclasses = m_brd->GetDesignSettings().m_NetClasses;
|
||||
|
||||
m_netclassFilter->Append( netclasses.GetDefault()->GetName() );
|
||||
netclassNames.push_back(netclasses.GetDefault()->GetName() );
|
||||
|
||||
for( NETCLASSES::const_iterator nc = netclasses.begin(); nc != netclasses.end(); ++nc )
|
||||
m_netclassFilter->Append( nc->second->GetName() );
|
||||
netclassNames.push_back( nc->second->GetName() );
|
||||
|
||||
m_netclassFilter->SetSelection( m_netclassFilter->FindString( currentNetClass ) );
|
||||
m_netclassFilter->Set( netclassNames );
|
||||
m_netclassFilter->SetStringSelection( m_brd->GetDesignSettings().GetCurrentNetClassName() );
|
||||
|
||||
// Populate the layer filter list
|
||||
m_layerFilter->SetBoardFrame( m_parent );
|
||||
m_layerFilter->SetLayersHotkeys( false );
|
||||
m_layerFilter->SetNotAllowedLayerSet( LSET::AllNonCuMask() );
|
||||
m_layerFilter->Resync();
|
||||
|
||||
m_layerFilter->SetLayerSelection( currentLayer );
|
||||
m_layerFilter->SetLayerSelection( m_parent->GetActiveLayer() );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildNetclassesGrid()
|
||||
{
|
||||
#define SET_NETCLASS_VALUE( aRow, aGrid, aCol, aValue ) \
|
||||
aGrid->SetCellValue( aRow, aCol, StringFromValue( GetUserUnits(), aValue, true, true ) )
|
||||
#define SET_NETCLASS_VALUE( row, col, val ) \
|
||||
m_netclassGrid->SetCellValue( row, col, StringFromValue( GetUserUnits(), val, true, true ) )
|
||||
|
||||
m_netclassGrid->SetCellValue( 0, GRID_NAME, wxEmptyString );
|
||||
m_netclassGrid->SetCellValue( 0, GRID_TRACKSIZE, _( "Track width" ) );
|
||||
m_netclassGrid->SetCellValue( 0, GRID_VIASIZE, _( "Via size" ) );
|
||||
m_netclassGrid->SetCellValue( 0, GRID_VIADRILL, _( "Via drill" ) );
|
||||
m_netclassGrid->SetCellValue( 0, GRID_uVIASIZE, _( "uVia size" ) );
|
||||
m_netclassGrid->SetCellValue( 0, GRID_uVIADRILL, _( "uVia drill" ) );
|
||||
m_netclassGrid->SetCellValue( 0, GRID_TRACKSIZE, _( "Track Width" ) );
|
||||
m_netclassGrid->SetCellValue( 0, GRID_VIASIZE, _( "Via Size" ) );
|
||||
m_netclassGrid->SetCellValue( 0, GRID_VIADRILL, _( "Via Drill" ) );
|
||||
m_netclassGrid->SetCellValue( 0, GRID_uVIASIZE, _( "uVia Size" ) );
|
||||
m_netclassGrid->SetCellValue( 0, GRID_uVIADRILL, _( "uVia Drill" ) );
|
||||
|
||||
NETCLASSES& netclasses = m_brd->GetDesignSettings().m_NetClasses;
|
||||
NETCLASSPTR defaultNetclass = m_brd->GetDesignSettings().GetDefault();
|
||||
m_netclassGrid->AppendRows( netclasses.GetCount() + 1 );
|
||||
|
||||
NETCLASSPTR netclass = m_brd->GetDesignSettings().GetDefault();
|
||||
int row = 1;
|
||||
m_netclassGrid->SetCellValue( 1, GRID_NAME, defaultNetclass->GetName() );
|
||||
SET_NETCLASS_VALUE( 1, GRID_TRACKSIZE, defaultNetclass->GetTrackWidth() );
|
||||
SET_NETCLASS_VALUE( 1, GRID_VIASIZE, defaultNetclass->GetViaDiameter() );
|
||||
SET_NETCLASS_VALUE( 1, GRID_VIADRILL, defaultNetclass->GetViaDrill() );
|
||||
SET_NETCLASS_VALUE( 1, GRID_uVIASIZE, defaultNetclass->GetuViaDiameter() );
|
||||
SET_NETCLASS_VALUE( 1, GRID_uVIADRILL, defaultNetclass->GetuViaDrill() );
|
||||
|
||||
m_netclassGrid->SetCellValue( row, GRID_NAME, netclass->GetName() );
|
||||
SET_NETCLASS_VALUE( row, m_netclassGrid, GRID_TRACKSIZE, netclass->GetTrackWidth() );
|
||||
SET_NETCLASS_VALUE( row, m_netclassGrid, GRID_VIASIZE, netclass->GetViaDiameter() );
|
||||
SET_NETCLASS_VALUE( row, m_netclassGrid, GRID_VIADRILL, netclass->GetViaDrill() );
|
||||
SET_NETCLASS_VALUE( row, m_netclassGrid, GRID_uVIASIZE, netclass->GetuViaDiameter() );
|
||||
SET_NETCLASS_VALUE( row, m_netclassGrid, GRID_uVIADRILL, netclass->GetuViaDrill() );
|
||||
|
||||
row++;
|
||||
|
||||
for( NETCLASSES::const_iterator nc = netclasses.begin(); nc != netclasses.end(); ++nc, ++row )
|
||||
int row = 2;
|
||||
for( const auto& netclass : netclasses )
|
||||
{
|
||||
netclass = nc->second;
|
||||
m_netclassGrid->SetCellValue( row, GRID_NAME, netclass->GetName() );
|
||||
SET_NETCLASS_VALUE( row, m_netclassGrid, GRID_TRACKSIZE, netclass->GetTrackWidth() );
|
||||
SET_NETCLASS_VALUE( row, m_netclassGrid, GRID_VIASIZE, netclass->GetViaDiameter() );
|
||||
SET_NETCLASS_VALUE( row, m_netclassGrid, GRID_VIADRILL, netclass->GetViaDrill() );
|
||||
SET_NETCLASS_VALUE( row, m_netclassGrid, GRID_uVIASIZE, netclass->GetuViaDiameter() );
|
||||
SET_NETCLASS_VALUE( row, m_netclassGrid, GRID_uVIADRILL, netclass->GetuViaDrill() );
|
||||
m_netclassGrid->SetCellValue( row, GRID_NAME, netclass.first );
|
||||
SET_NETCLASS_VALUE( row, GRID_TRACKSIZE, netclass.second->GetTrackWidth() );
|
||||
SET_NETCLASS_VALUE( row, GRID_VIASIZE, netclass.second->GetViaDiameter() );
|
||||
SET_NETCLASS_VALUE( row, GRID_VIADRILL, netclass.second->GetViaDrill() );
|
||||
SET_NETCLASS_VALUE( row, GRID_uVIASIZE, netclass.second->GetuViaDiameter() );
|
||||
SET_NETCLASS_VALUE( row, GRID_uVIADRILL, netclass.second->GetuViaDrill() );
|
||||
row++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,7 +198,7 @@ bool DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow()
|
|||
|
||||
if( item )
|
||||
{
|
||||
m_netFilter->SetStringSelection( item->GetNetname() );
|
||||
m_netFilter->SetSelectedNetcode( item->GetNetCode() );
|
||||
m_netclassFilter->SetStringSelection( item->GetNet()->GetClassName() );
|
||||
m_layerFilter->SetLayerSelection( item->GetLayer() );
|
||||
}
|
||||
|
@ -241,11 +222,13 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem( PICKED_ITEMS_LIST* aUndoLi
|
|||
{
|
||||
unsigned int prevTrackWidthIndex = brdSettings.GetTrackWidthIndex();
|
||||
unsigned int prevViaSizeIndex = brdSettings.GetViaSizeIndex();
|
||||
|
||||
brdSettings.SetTrackWidthIndex( (unsigned) m_trackWidthSelectBox->GetSelection() );
|
||||
brdSettings.SetViaSizeIndex( (unsigned) m_viaSizesSelectBox->GetSelection() );
|
||||
|
||||
m_parent->SetTrackSegmentWidth( aItem, aUndoList, false );
|
||||
{
|
||||
brdSettings.SetTrackWidthIndex( (unsigned) m_trackWidthSelectBox->GetSelection() );
|
||||
brdSettings.SetViaSizeIndex( (unsigned) m_viaSizesSelectBox->GetSelection() );
|
||||
m_parent->SetTrackSegmentWidth( aItem, aUndoList, false );
|
||||
}
|
||||
brdSettings.SetTrackWidthIndex( prevTrackWidthIndex );
|
||||
brdSettings.SetViaSizeIndex( prevViaSizeIndex );
|
||||
|
||||
if( m_layerBox->GetLayerSelection() != UNDEFINED_LAYER && aItem->Type() == PCB_TRACE_T )
|
||||
{
|
||||
|
@ -259,9 +242,6 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem( PICKED_ITEMS_LIST* aUndoLi
|
|||
aItem->SetLayer( ToLAYER_ID( m_layerBox->GetLayerSelection() ) );
|
||||
m_parent->GetBoard()->GetConnectivity()->Update( aItem );
|
||||
}
|
||||
|
||||
brdSettings.SetTrackWidthIndex( prevTrackWidthIndex );
|
||||
brdSettings.SetViaSizeIndex( prevViaSizeIndex );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -272,13 +252,13 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::processItem( PICKED_ITEMS_LIST* aUndoLi
|
|||
|
||||
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::visitItem( PICKED_ITEMS_LIST* aUndoList, TRACK* aItem )
|
||||
{
|
||||
if( m_netFilterOpt->GetValue() )
|
||||
if( m_netFilterOpt->GetValue() && m_netFilter->GetSelectedNetcode() >= 0 )
|
||||
{
|
||||
if( aItem->GetNetCode() != m_netFilter->GetSelection() )
|
||||
if( aItem->GetNetCode() != m_netFilter->GetSelectedNetcode() )
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_netclassFilterOpt->GetValue() )
|
||||
if( m_netclassFilterOpt->GetValue() && !m_netclassFilter->GetStringSelection().IsEmpty() )
|
||||
{
|
||||
if( aItem->GetNetClassName() != m_netclassFilter->GetStringSelection() )
|
||||
return;
|
||||
|
@ -318,9 +298,7 @@ bool DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataFromWindow()
|
|||
m_parent->GetGalCanvas()->GetView()->Update( segment );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_parent->GetCanvas()->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -342,7 +320,6 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::AdjustNetclassGridColumns( int aWidth )
|
|||
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnSizeNetclassGrid( wxSizeEvent& event )
|
||||
{
|
||||
AdjustNetclassGridColumns( event.GetSize().GetX() );
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
@ -350,6 +327,6 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnSizeNetclassGrid( wxSizeEvent& event
|
|||
void PCB_EDIT_FRAME::OnEditTracksAndVias( wxCommandEvent& event )
|
||||
{
|
||||
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS dlg( this );
|
||||
dlg.ShowModal();
|
||||
dlg.ShowQuasiModal(); // QuasiModal required for NET_SELECTOR
|
||||
}
|
||||
|
||||
|
|
|
@ -49,16 +49,14 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE
|
|||
fgSizer3 = new wxFlexGridSizer( 0, 3, 0, 0 );
|
||||
fgSizer3->AddGrowableCol( 1 );
|
||||
fgSizer3->AddGrowableCol( 2 );
|
||||
fgSizer3->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer3->SetFlexibleDirection( wxHORIZONTAL );
|
||||
fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_netFilterOpt = new wxCheckBox( sbFilters->GetStaticBox(), wxID_ANY, _("Filter items by net:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer3->Add( m_netFilterOpt, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
fgSizer3->Add( m_netFilterOpt, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxArrayString m_netFilterChoices;
|
||||
m_netFilter = new wxChoice( sbFilters->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_netFilterChoices, 0 );
|
||||
m_netFilter->SetSelection( 0 );
|
||||
fgSizer3->Add( m_netFilter, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
m_netFilter = new NET_SELECTOR( sbFilters->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer3->Add( m_netFilter, 1, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
|
||||
fgSizer3->Add( 0, 0, 1, wxEXPAND|wxRIGHT|wxLEFT, 100 );
|
||||
|
@ -75,10 +73,10 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE
|
|||
fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_layerFilterOpt = new wxCheckBox( sbFilters->GetStaticBox(), wxID_ANY, _("Filter items by layer:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer3->Add( m_layerFilterOpt, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
fgSizer3->Add( m_layerFilterOpt, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_layerFilter = new PCB_LAYER_BOX_SELECTOR( sbFilters->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
|
||||
fgSizer3->Add( m_layerFilter, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
fgSizer3->Add( m_layerFilter, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
|
||||
fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
@ -174,7 +172,6 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE
|
|||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnUpdateUI ) );
|
||||
m_netFilter->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnNetFilterSelect ), NULL, this );
|
||||
m_netclassFilter->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnNetclassFilterSelect ), NULL, this );
|
||||
m_layerFilter->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnLayerFilterSelect ), NULL, this );
|
||||
m_netclassGrid->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSizeNetclassGrid ), NULL, this );
|
||||
|
@ -184,7 +181,6 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BAS
|
|||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnUpdateUI ) );
|
||||
m_netFilter->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnNetFilterSelect ), NULL, this );
|
||||
m_netclassFilter->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnNetclassFilterSelect ), NULL, this );
|
||||
m_layerFilter->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnLayerFilterSelect ), NULL, this );
|
||||
m_netclassGrid->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSizeNetclassGrid ), NULL, this );
|
||||
|
|
|
@ -321,7 +321,7 @@
|
|||
<property name="proportion">1</property>
|
||||
<object class="wxFlexGridSizer" expanded="1">
|
||||
<property name="cols">3</property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="flexible_direction">wxHORIZONTAL</property>
|
||||
<property name="growablecols">1,2</property>
|
||||
<property name="growablerows"></property>
|
||||
<property name="hgap">0</property>
|
||||
|
@ -333,7 +333,7 @@
|
|||
<property name="vgap">0</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -421,9 +421,9 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="flag">wxEXPAND|wxRIGHT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxChoice" expanded="1">
|
||||
<object class="CustomControl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -437,10 +437,12 @@
|
|||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices"></property>
|
||||
<property name="class">NET_SELECTOR</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="construction"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="declaration"></property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
|
@ -452,6 +454,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="include">#include <widgets/net_selector.h></property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
@ -467,22 +470,16 @@
|
|||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">0</property>
|
||||
<property name="settings"></property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="subclass">; forward_declare</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="OnChoice">OnNetFilterSelect</event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
|
@ -705,7 +702,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -793,7 +790,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||
<property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapComboBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
|
|
@ -22,6 +22,7 @@ class PCB_LAYER_BOX_SELECTOR;
|
|||
#include <wx/settings.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <widgets/net_selector.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/bmpcbox.h>
|
||||
#include <wx/radiobut.h>
|
||||
|
@ -45,7 +46,7 @@ class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE : public DIALOG_SHIM
|
|||
wxCheckBox* m_tracks;
|
||||
wxCheckBox* m_vias;
|
||||
wxCheckBox* m_netFilterOpt;
|
||||
wxChoice* m_netFilter;
|
||||
NET_SELECTOR* m_netFilter;
|
||||
wxCheckBox* m_netclassFilterOpt;
|
||||
wxChoice* m_netclassFilter;
|
||||
wxCheckBox* m_layerFilterOpt;
|
||||
|
@ -62,7 +63,6 @@ class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE : public DIALOG_SHIM
|
|||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
virtual void OnNetFilterSelect( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnNetclassFilterSelect( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnLayerFilterSelect( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSizeNetclassGrid( wxSizeEvent& event ) { event.Skip(); }
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
/**
|
||||
* @file dialog_pad_properties.cpp
|
||||
* @brief dialog pad properties editor.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
|
@ -47,7 +42,7 @@
|
|||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
#include <pcb_painter.h>
|
||||
#include <widgets/widget_net_selector.h>
|
||||
#include <widgets/net_selector.h>
|
||||
|
||||
#include <dialog_pad_properties.h>
|
||||
#include <html_messagebox.h>
|
||||
|
@ -101,7 +96,7 @@ static const LSET std_pad_layers[] =
|
|||
void PCB_BASE_FRAME::InstallPadOptionsFrame( D_PAD* aPad )
|
||||
{
|
||||
DIALOG_PAD_PROPERTIES dlg( this, aPad );
|
||||
dlg.ShowModal();
|
||||
dlg.ShowQuasiModal(); // QuasiModal required for NET_SELECTOR
|
||||
}
|
||||
|
||||
|
||||
|
@ -132,7 +127,7 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aP
|
|||
|
||||
m_board = m_parent->GetBoard();
|
||||
|
||||
m_PadNetNameCombo->SetBoard( m_board );
|
||||
m_PadNetSelector->SetNetInfo( &m_board->GetNetInfo() );
|
||||
|
||||
m_OrientValidator.SetRange( -360.0, 360.0 );
|
||||
m_orientation->SetValidator( m_OrientValidator );
|
||||
|
@ -163,8 +158,7 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aP
|
|||
m_nonCopperNote->SetFont( infoFont );
|
||||
|
||||
// Usually, TransferDataToWindow is called by OnInitDialog
|
||||
// calling it here fixes all widgets sizes, and FinishDialogSettings can
|
||||
// safely fix minsizes
|
||||
// calling it here fixes all widget sizes so FinishDialogSettings can safely fix minsizes
|
||||
TransferDataToWindow();
|
||||
|
||||
// Initialize canvas to be able to display the dummy pad:
|
||||
|
@ -174,10 +168,22 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aP
|
|||
m_sdbSizerOK->SetDefault();
|
||||
m_canUpdate = true;
|
||||
|
||||
m_PadNetSelector->Connect( NET_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES::OnValuesChanged ), NULL, this );
|
||||
|
||||
// Now all widgets have the size fixed, call FinishDialogSettings
|
||||
FinishDialogSettings();
|
||||
}
|
||||
|
||||
|
||||
DIALOG_PAD_PROPERTIES::~DIALOG_PAD_PROPERTIES()
|
||||
{
|
||||
m_PadNetSelector->Disconnect( NET_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES::OnValuesChanged ), NULL, this );
|
||||
|
||||
delete m_dummyPad;
|
||||
delete m_axisOrigin;
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_PAD_PROPERTIES::m_sketchPreview = false; // Stores the pad draw option during a session
|
||||
|
||||
|
||||
|
@ -212,14 +218,12 @@ void DIALOG_PAD_PROPERTIES::enablePrimitivePage( bool aEnable )
|
|||
m_buttonAddShape->Enable( aEnable );
|
||||
m_buttonDup->Enable( aEnable );
|
||||
m_buttonGeometry->Enable( aEnable );
|
||||
m_buttonImport->Enable( aEnable );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PAD_PROPERTIES::prepareCanvas()
|
||||
{
|
||||
// Initialize the canvases (legacy or gal) to display the pad
|
||||
// Enable the suitable canvas and make some inits
|
||||
|
||||
// Show the X and Y axis. It is usefull because pad shape can have an offset
|
||||
// or be a complex shape.
|
||||
|
@ -282,8 +286,7 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
|
|||
if( m_dummyPad->GetLayerSet()[B_Cu] )
|
||||
color = color.LegacyMix( m_parent->Settings().Colors().GetItemColor( LAYER_PAD_BK ) );
|
||||
|
||||
// What could happen: the pad color is *actually* black, or no
|
||||
// copper was selected
|
||||
// What could happen: the pad color is *actually* black, or no copper was selected
|
||||
if( color == BLACK )
|
||||
color = LIGHTGRAY;
|
||||
|
||||
|
@ -355,7 +358,6 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
|
|||
|
||||
// draw selected primitives:
|
||||
long select = m_listCtrlPrimitives->GetFirstSelected();
|
||||
wxPoint start, end, center;
|
||||
|
||||
while( select >= 0 )
|
||||
{
|
||||
|
@ -565,7 +567,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
|
|||
m_FlippedWarningSizer->Show( m_isFlipped );
|
||||
|
||||
m_PadNumCtrl->SetValue( m_dummyPad->GetName() );
|
||||
m_PadNetNameCombo->SetSelectedNet( m_dummyPad->GetNetCode() );
|
||||
m_PadNetSelector->SetSelectedNetcode( m_dummyPad->GetNetCode() );
|
||||
|
||||
// Display current pad parameters units:
|
||||
m_posX.SetValue( m_dummyPad->GetPosition().x );
|
||||
|
@ -706,7 +708,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
|
|||
m_PadNumText->Enable( enable );
|
||||
m_PadNumCtrl->Enable( enable );
|
||||
m_PadNameText->Enable( enable && m_canEditNetName && m_currentPad );
|
||||
m_PadNetNameCombo->Enable( enable && m_canEditNetName && m_currentPad );
|
||||
m_PadNetSelector->Enable( enable && m_canEditNetName && m_currentPad );
|
||||
m_padToDie.Enable( enable );
|
||||
|
||||
if( m_dummyPad->GetDrillShape() != PAD_DRILL_SHAPE_OBLONG )
|
||||
|
@ -976,13 +978,13 @@ void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
|
|||
if( !hasConnection )
|
||||
{
|
||||
m_PadNumCtrl->SetValue( wxEmptyString );
|
||||
m_PadNetNameCombo->SetSelectedNet( 0 );
|
||||
m_PadNetSelector->SetSelectedNetcode( 0 );
|
||||
m_padToDie.SetValue( 0 );
|
||||
}
|
||||
else if( m_PadNumCtrl->GetValue().IsEmpty() && m_currentPad )
|
||||
{
|
||||
m_PadNumCtrl->SetValue( m_currentPad->GetName() );
|
||||
m_PadNetNameCombo->SetSelectedNet( m_currentPad->GetNetCode() );
|
||||
m_PadNetSelector->SetSelectedNetcode( m_currentPad->GetNetCode() );
|
||||
}
|
||||
|
||||
transferDataToPad( m_dummyPad );
|
||||
|
@ -1019,7 +1021,7 @@ void DIALOG_PAD_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
|
|||
m_PadNumText->Enable( hasConnection );
|
||||
m_PadNumCtrl->Enable( hasConnection );
|
||||
m_PadNameText->Enable( hasConnection );
|
||||
m_PadNetNameCombo->Enable( hasConnection && m_canEditNetName && m_currentPad );
|
||||
m_PadNetSelector->Enable( hasConnection && m_canEditNetName && m_currentPad );
|
||||
m_padToDie.Enable( hasConnection );
|
||||
|
||||
// Enable/disable Copper Layers control
|
||||
|
@ -1163,9 +1165,7 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK()
|
|||
}
|
||||
|
||||
if( error )
|
||||
{
|
||||
error_msgs.Add( _( "Too large value for pad delta size" ) );
|
||||
}
|
||||
|
||||
switch( m_dummyPad->GetAttribute() )
|
||||
{
|
||||
|
@ -1448,7 +1448,7 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
|
|||
|
||||
// For PAD_ATTRIB_HOLE_NOT_PLATED, ensure there is no net name selected
|
||||
if( m_padMaster->GetAttribute() != PAD_ATTRIB_HOLE_NOT_PLATED )
|
||||
padNetcode = m_PadNetNameCombo->GetSelectedNet();
|
||||
padNetcode = m_PadNetSelector->GetSelectedNetcode();
|
||||
|
||||
if( m_currentPad->GetNetCode() != padNetcode )
|
||||
{
|
||||
|
@ -1629,7 +1629,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
|
|||
aPad->SetOffset( wxPoint( m_offsetX.GetValue(), m_offsetY.GetValue() ) );
|
||||
aPad->SetOrientation( m_OrientValue * 10.0 );
|
||||
aPad->SetName( m_PadNumCtrl->GetValue() );
|
||||
aPad->SetNetCode( m_PadNetNameCombo->GetSelectedNet() );
|
||||
aPad->SetNetCode( m_PadNetSelector->GetSelectedNetcode() );
|
||||
|
||||
// Clear some values, according to the pad type and shape
|
||||
switch( aPad->GetShape() )
|
||||
|
@ -1906,12 +1906,6 @@ void DIALOG_PAD_PROPERTIES::onAddPrimitive( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_PAD_PROPERTIES::onImportPrimitives( wxCommandEvent& event )
|
||||
{
|
||||
wxMessageBox( "Not yet available" );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PAD_PROPERTIES::onGeometryTransform( wxCommandEvent& event )
|
||||
{
|
||||
long select = m_listCtrlPrimitives->GetFirstSelected();
|
||||
|
|
|
@ -57,11 +57,7 @@ class DIALOG_PAD_PROPERTIES : public DIALOG_PAD_PROPERTIES_BASE
|
|||
{
|
||||
public:
|
||||
DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aPad );
|
||||
~DIALOG_PAD_PROPERTIES()
|
||||
{
|
||||
delete m_dummyPad;
|
||||
delete m_axisOrigin;
|
||||
}
|
||||
~DIALOG_PAD_PROPERTIES();
|
||||
|
||||
private:
|
||||
PCB_BASE_FRAME* m_parent;
|
||||
|
@ -157,7 +153,6 @@ private:
|
|||
void onDeletePrimitive( wxCommandEvent& event ) override;
|
||||
void onEditPrimitive( wxCommandEvent& event ) override;
|
||||
void onAddPrimitive( wxCommandEvent& event ) override;
|
||||
void onImportPrimitives( wxCommandEvent& event ) override;
|
||||
void onGeometryTransform( wxCommandEvent& event ) override;
|
||||
void onDuplicatePrimitive( wxCommandEvent& event ) override;
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "widgets/text_ctrl_eval.h"
|
||||
#include "widgets/widget_net_selector.h"
|
||||
|
||||
#include "dialog_pad_properties_base.h"
|
||||
|
||||
|
@ -52,8 +51,8 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
|
|||
m_PadNameText->Wrap( -1 );
|
||||
fgSizerShapeType->Add( m_PadNameText, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 3 );
|
||||
|
||||
m_PadNetNameCombo = new WIDGET_NET_SELECTOR( m_panelGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
|
||||
fgSizerShapeType->Add( m_PadNetNameCombo, 0, wxEXPAND|wxLEFT|wxTOP, 3 );
|
||||
m_PadNetSelector = new NET_SELECTOR( m_panelGeneral, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizerShapeType->Add( m_PadNetSelector, 0, wxTOP|wxLEFT|wxEXPAND, 3 );
|
||||
|
||||
|
||||
fgSizerShapeType->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
@ -630,21 +629,12 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
|
|||
m_buttonDup = new wxButton( m_panelCustomShapePrimitives, wxID_ANY, _("Duplicate Primitive"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerButtonsUpper->Add( m_buttonDup, 0, wxALL, 5 );
|
||||
|
||||
m_buttonGeometry = new wxButton( m_panelCustomShapePrimitives, wxID_ANY, _("Transform Primitive"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerButtonsUpper->Add( m_buttonGeometry, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bSizerButtons->Add( bSizerButtonsUpper, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
wxBoxSizer* bSizerButtonsLower;
|
||||
bSizerButtonsLower = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_buttonGeometry = new wxButton( m_panelCustomShapePrimitives, wxID_ANY, _("Geometry Transform"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerButtonsLower->Add( m_buttonGeometry, 0, wxALL, 5 );
|
||||
|
||||
m_buttonImport = new wxButton( m_panelCustomShapePrimitives, wxID_ANY, _("Import Primitives"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerButtonsLower->Add( m_buttonImport, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bSizerButtons->Add( bSizerButtonsLower, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
|
||||
m_bSizerPanelPrimitives->Add( bSizerButtons, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
|
@ -723,7 +713,6 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
|
|||
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnInitDialog ) );
|
||||
m_panelGeneral->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnUpdateUI ), NULL, this );
|
||||
m_PadNumCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
|
||||
m_PadNetNameCombo->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
|
||||
m_PadType->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::PadTypeSelected ), NULL, this );
|
||||
m_PadShape->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPadShapeSelection ), NULL, this );
|
||||
m_sizeXCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
|
||||
|
@ -760,7 +749,6 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
|
|||
m_buttonAddShape->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onAddPrimitive ), NULL, this );
|
||||
m_buttonDup->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onDuplicatePrimitive ), NULL, this );
|
||||
m_buttonGeometry->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onGeometryTransform ), NULL, this );
|
||||
m_buttonImport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onImportPrimitives ), NULL, this );
|
||||
m_panelShowPad->Connect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPaintShowPanel ), NULL, this );
|
||||
m_cbShowPadOutline->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onChangePadMode ), NULL, this );
|
||||
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnCancel ), NULL, this );
|
||||
|
@ -772,7 +760,6 @@ DIALOG_PAD_PROPERTIES_BASE::~DIALOG_PAD_PROPERTIES_BASE()
|
|||
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnInitDialog ) );
|
||||
m_panelGeneral->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnUpdateUI ), NULL, this );
|
||||
m_PadNumCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
|
||||
m_PadNetNameCombo->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
|
||||
m_PadType->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::PadTypeSelected ), NULL, this );
|
||||
m_PadShape->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPadShapeSelection ), NULL, this );
|
||||
m_sizeXCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
|
||||
|
@ -809,7 +796,6 @@ DIALOG_PAD_PROPERTIES_BASE::~DIALOG_PAD_PROPERTIES_BASE()
|
|||
m_buttonAddShape->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onAddPrimitive ), NULL, this );
|
||||
m_buttonDup->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onDuplicatePrimitive ), NULL, this );
|
||||
m_buttonGeometry->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onGeometryTransform ), NULL, this );
|
||||
m_buttonImport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onImportPrimitives ), NULL, this );
|
||||
m_panelShowPad->Disconnect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPaintShowPanel ), NULL, this );
|
||||
m_cbShowPadOutline->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onChangePadMode ), NULL, this );
|
||||
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnCancel ), NULL, this );
|
||||
|
|
|
@ -561,9 +561,9 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">3</property>
|
||||
<property name="flag">wxEXPAND|wxLEFT|wxTOP</property>
|
||||
<property name="flag">wxTOP|wxLEFT|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxComboBox" expanded="1">
|
||||
<object class="CustomControl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -577,10 +577,12 @@
|
|||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices"></property>
|
||||
<property name="class">NET_SELECTOR</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="construction"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="declaration"></property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
|
@ -592,6 +594,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="include">#include <widgets/net_selector.h></property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
@ -599,7 +602,7 @@
|
|||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_PadNetNameCombo</property>
|
||||
<property name="name">m_PadNetSelector</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
|
@ -607,25 +610,16 @@
|
|||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">-1</property>
|
||||
<property name="settings"></property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxCB_READONLY</property>
|
||||
<property name="subclass">WIDGET_NET_SELECTOR; widgets/widget_net_selector.h; forward_declare</property>
|
||||
<property name="subclass">; forward_declare</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="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCombobox">OnValuesChanged</event>
|
||||
<event name="OnComboboxCloseup"></event>
|
||||
<event name="OnComboboxDropdown"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
|
@ -647,8 +641,6 @@
|
|||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnText"></event>
|
||||
<event name="OnTextEnter"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
|
@ -9616,20 +9608,20 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_HORIZONTAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerButtons</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_HORIZONTAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerButtonsUpper</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
|
@ -9986,17 +9978,6 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_HORIZONTAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerButtonsLower</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
|
@ -10030,7 +10011,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Geometry Transform</property>
|
||||
<property name="label">Transform Primitive</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
@ -10085,94 +10066,6 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</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_ANY</property>
|
||||
<property name="label">Import Primitives</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_buttonImport</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">onImportPrimitives</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>
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class TEXT_CTRL_EVAL;
|
||||
class WIDGET_NET_SELECTOR;
|
||||
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/string.h>
|
||||
|
@ -22,8 +21,9 @@ class WIDGET_NET_SELECTOR;
|
|||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/combobox.h>
|
||||
#include <widgets/net_selector.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/combobox.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
|
@ -65,7 +65,7 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM
|
|||
wxStaticText* m_PadNumText;
|
||||
wxTextCtrl* m_PadNumCtrl;
|
||||
wxStaticText* m_PadNameText;
|
||||
WIDGET_NET_SELECTOR* m_PadNetNameCombo;
|
||||
NET_SELECTOR* m_PadNetSelector;
|
||||
wxStaticText* m_staticText44;
|
||||
wxChoice* m_PadType;
|
||||
wxStaticText* m_staticText45;
|
||||
|
@ -174,7 +174,6 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM
|
|||
wxButton* m_buttonAddShape;
|
||||
wxButton* m_buttonDup;
|
||||
wxButton* m_buttonGeometry;
|
||||
wxButton* m_buttonImport;
|
||||
wxStaticText* m_parentInfoLine1;
|
||||
wxStaticText* m_parentInfoLine2;
|
||||
wxPanel* m_panelShowPad;
|
||||
|
@ -204,7 +203,6 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM
|
|||
virtual void onAddPrimitive( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onDuplicatePrimitive( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onGeometryTransform( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onImportPrimitives( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnPaintShowPanel( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void onChangePadMode( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 CERN
|
||||
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -28,8 +29,9 @@
|
|||
#include <class_track.h>
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <confirm.h>
|
||||
|
||||
#include <widgets/widget_net_selector.h>
|
||||
#include <connectivity_data.h>
|
||||
#include <class_module.h>
|
||||
#include <widgets/net_selector.h>
|
||||
#include <board_commit.h>
|
||||
|
||||
#define MIN_SIZE ( int )( 0.001 * IU_PER_MM )
|
||||
|
@ -38,7 +40,9 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
|||
const SELECTION& aItems,
|
||||
COMMIT& aCommit ) :
|
||||
DIALOG_TRACK_VIA_PROPERTIES_BASE( aParent ),
|
||||
m_items( aItems ), m_commit( aCommit ),
|
||||
m_frame( aParent ),
|
||||
m_items( aItems ),
|
||||
m_commit( aCommit ),
|
||||
m_trackStartX( aParent, m_TrackStartXLabel, m_TrackStartXCtrl, m_TrackStartXUnit ),
|
||||
m_trackStartY( aParent, m_TrackStartYLabel, m_TrackStartYCtrl, m_TrackStartYUnit ),
|
||||
m_trackEndX( aParent, m_TrackEndXLabel, m_TrackEndXCtrl, m_TrackEndXUnit ),
|
||||
|
@ -55,11 +59,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
|||
|
||||
VIATYPE_T viaType = VIA_NOT_DEFINED;
|
||||
|
||||
m_haveUniqueNet = true;
|
||||
int prevNet = -1;
|
||||
|
||||
m_NetComboBox->SetBoard( aParent->GetBoard() );
|
||||
m_NetComboBox->Enable( true );
|
||||
m_netSelector->SetNetInfo( &aParent->GetBoard()->GetNetInfo() );
|
||||
|
||||
m_TrackLayerCtrl->SetLayersHotkeys( false );
|
||||
m_TrackLayerCtrl->SetNotAllowedLayerSet( LSET::AllNonCuMask() );
|
||||
|
@ -76,32 +76,24 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
|||
m_ViaEndLayer->SetBoardFrame( aParent );
|
||||
m_ViaEndLayer->Resync();
|
||||
|
||||
bool nets = false;
|
||||
int net = 0;
|
||||
bool hasLocked = false;
|
||||
bool hasUnlocked = false;
|
||||
|
||||
for( auto& item : m_items )
|
||||
{
|
||||
int net = static_cast<BOARD_CONNECTED_ITEM*>(item)->GetNetCode();
|
||||
|
||||
if( prevNet >= 0 && net != prevNet )
|
||||
{
|
||||
DBG( printf("prev %d net %d\n", net, prevNet ) );
|
||||
m_haveUniqueNet = false;
|
||||
break;
|
||||
}
|
||||
|
||||
prevNet = net;
|
||||
}
|
||||
|
||||
if ( m_haveUniqueNet )
|
||||
m_NetComboBox->SetSelectedNet( prevNet );
|
||||
else
|
||||
m_NetComboBox->SetMultiple( true );
|
||||
|
||||
|
||||
// Look for values that are common for every item that is selected
|
||||
for( auto& item : m_items )
|
||||
{
|
||||
if( !nets )
|
||||
{
|
||||
net = static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNetCode();
|
||||
nets = true;
|
||||
}
|
||||
else if( net != static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNetCode() )
|
||||
{
|
||||
net = -1;
|
||||
}
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_TRACE_T:
|
||||
|
@ -116,7 +108,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
|||
m_trackEndY.SetValue( t->GetEnd().y );
|
||||
m_trackWidth.SetValue( t->GetWidth() );
|
||||
m_TrackLayerCtrl->SetLayerSelection( t->GetLayer() );
|
||||
m_tracks = true;
|
||||
m_tracks = true;
|
||||
}
|
||||
else // check if values are the same for every selected track
|
||||
{
|
||||
|
@ -202,6 +194,11 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
|||
}
|
||||
}
|
||||
|
||||
if ( net >= 0 )
|
||||
m_netSelector->SetSelectedNetcode( net );
|
||||
else
|
||||
m_netSelector->SetIndeterminate();
|
||||
|
||||
wxASSERT( m_tracks || m_vias );
|
||||
|
||||
if( m_vias )
|
||||
|
@ -236,14 +233,13 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
|||
|
||||
m_ViaTypeChoice->Enable();
|
||||
|
||||
if( viaType == VIA_THROUGH )
|
||||
m_ViaTypeChoice->SetSelection( 0 );
|
||||
else if( viaType == VIA_MICROVIA )
|
||||
m_ViaTypeChoice->SetSelection( 1 );
|
||||
else if ( viaType == VIA_BLIND_BURIED )
|
||||
m_ViaTypeChoice->SetSelection( 2 );
|
||||
else if( viaType == VIA_NOT_DEFINED )
|
||||
m_ViaTypeChoice->SetSelection( 3 );
|
||||
switch( viaType )
|
||||
{
|
||||
case VIA_THROUGH: m_ViaTypeChoice->SetSelection( 0 ); break;
|
||||
case VIA_MICROVIA: m_ViaTypeChoice->SetSelection( 1 ); break;
|
||||
case VIA_BLIND_BURIED: m_ViaTypeChoice->SetSelection( 2 ); break;
|
||||
case VIA_NOT_DEFINED: m_ViaTypeChoice->SetSelection( 3 ); break;
|
||||
}
|
||||
|
||||
m_ViaStartLayer->Enable( viaType != VIA_THROUGH );
|
||||
m_ViaEndLayer->Enable( viaType != VIA_THROUGH );
|
||||
|
@ -297,16 +293,72 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
|||
}
|
||||
|
||||
|
||||
bool DIALOG_TRACK_VIA_PROPERTIES::confirmPadChange( const std::set<D_PAD*>& connectedPads )
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
if( connectedPads.size() == 1 )
|
||||
{
|
||||
D_PAD* pad = *connectedPads.begin();
|
||||
msg.Printf( _( "This will change the net assigned to %s pad %s to %s.\n"
|
||||
"Do you wish to continue?" ),
|
||||
pad->GetParent()->GetReference(),
|
||||
pad->GetName(),
|
||||
m_netSelector->GetValue() );
|
||||
}
|
||||
else if( connectedPads.size() == 2 )
|
||||
{
|
||||
D_PAD* pad1 = *connectedPads.begin();
|
||||
D_PAD* pad2 = *( ++connectedPads.begin() );
|
||||
msg.Printf( _( "This will change the net assigned to %s pad %s and %s pad %s to %s.\n"
|
||||
"Do you wish to continue?" ),
|
||||
pad1->GetParent()->GetReference(),
|
||||
pad1->GetName(),
|
||||
pad2->GetParent()->GetReference(),
|
||||
pad2->GetName(),
|
||||
m_netSelector->GetValue() );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Printf( _( "This will change the net assigned to %d connected pads to %s.\n"
|
||||
"Do you wish to continue?" ),
|
||||
connectedPads.size(),
|
||||
m_netSelector->GetValue() );
|
||||
}
|
||||
|
||||
KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
|
||||
dlg.SetOKLabel( _( "Continue" ) );
|
||||
dlg.DoNotShowCheckbox();
|
||||
|
||||
return dlg.ShowModal() == wxID_OK;
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow()
|
||||
{
|
||||
std::set<D_PAD*> connectedPads;
|
||||
auto connectivity = m_frame->GetBoard()->GetConnectivity();
|
||||
|
||||
if ( !m_netSelector->IsIndeterminate() )
|
||||
{
|
||||
for( auto& item : m_items )
|
||||
{
|
||||
auto boardItem = static_cast<BOARD_CONNECTED_ITEM*>( item );
|
||||
connectivity->GetConnectedPads( boardItem, &connectedPads );
|
||||
}
|
||||
}
|
||||
|
||||
// Run validations:
|
||||
|
||||
if( connectedPads.size() )
|
||||
{
|
||||
if( !confirmPadChange( connectedPads ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( m_vias )
|
||||
{
|
||||
if( !m_viaDiameter.Validate( true ) )
|
||||
return false;
|
||||
|
||||
if( !m_viaDrill.Validate( true ) )
|
||||
if( !m_viaDiameter.Validate( true ) || !m_viaDrill.Validate( true ) )
|
||||
return false;
|
||||
|
||||
if( !m_trackNetclass->IsChecked() && m_viaDiameter.GetValue() <= m_viaDrill.GetValue() )
|
||||
|
@ -372,11 +424,8 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow()
|
|||
if( changeLock )
|
||||
t->SetLocked( setLock );
|
||||
|
||||
if ( m_NetComboBox->IsUniqueNetSelected() )
|
||||
{
|
||||
DBG( printf( "snc %d\n", m_NetComboBox->GetSelectedNet() ) );
|
||||
t->SetNetCode( m_NetComboBox->GetSelectedNet() );
|
||||
}
|
||||
if ( !m_netSelector->IsIndeterminate() )
|
||||
t->SetNetCode( m_netSelector->GetSelectedNetcode() );
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -396,18 +445,10 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow()
|
|||
{
|
||||
switch( m_ViaTypeChoice->GetSelection() )
|
||||
{
|
||||
case 0:
|
||||
v->SetViaType( VIA_THROUGH );
|
||||
v->SanitizeLayers();
|
||||
break;
|
||||
case 1:
|
||||
v->SetViaType( VIA_MICROVIA );
|
||||
break;
|
||||
case 2:
|
||||
v->SetViaType( VIA_BLIND_BURIED );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
case 0: v->SetViaType( VIA_THROUGH ); v->SanitizeLayers(); break;
|
||||
case 1: v->SetViaType( VIA_MICROVIA ); break;
|
||||
case 2: v->SetViaType( VIA_BLIND_BURIED ); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -439,7 +480,6 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow()
|
|||
case VIA_MICROVIA:
|
||||
v->SetWidth( v->GetNetClass()->GetuViaDiameter() );
|
||||
v->SetDrill( v->GetNetClass()->GetuViaDrill() );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -452,11 +492,8 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow()
|
|||
v->SetDrill( m_viaDrill.GetValue() );
|
||||
}
|
||||
|
||||
if ( m_NetComboBox->IsUniqueNetSelected() )
|
||||
{
|
||||
DBG( printf( "snc %d\n", m_NetComboBox->GetSelectedNet() ) );
|
||||
v->SetNetCode( m_NetComboBox->GetSelectedNet() );
|
||||
}
|
||||
if ( !m_netSelector->IsIndeterminate() )
|
||||
v->SetNetCode( m_netSelector->GetSelectedNetcode() );
|
||||
|
||||
if( changeLock )
|
||||
v->SetLocked( setLock );
|
||||
|
@ -470,6 +507,18 @@ bool DIALOG_TRACK_VIA_PROPERTIES::TransferDataFromWindow()
|
|||
}
|
||||
}
|
||||
|
||||
if ( !m_netSelector->IsIndeterminate() )
|
||||
{
|
||||
// Commit::Push() will rebuild connectivitiy propagating nets from connected pads
|
||||
// outwards. We therefore have to update the connected pads in order for the net
|
||||
// change to "stick".
|
||||
for( D_PAD* pad : connectedPads )
|
||||
{
|
||||
m_commit.Modify( pad );
|
||||
pad->SetNetCode( m_netSelector->GetSelectedNetcode() );
|
||||
}
|
||||
}
|
||||
|
||||
m_commit.Push( _( "Edit track/via properties" ) );
|
||||
|
||||
return true;
|
||||
|
|
|
@ -29,8 +29,9 @@
|
|||
|
||||
class SELECTION;
|
||||
class COMMIT;
|
||||
|
||||
class NET_SELECTOR_COMBO_POPUP;
|
||||
class PCB_BASE_FRAME;
|
||||
class D_PAD;
|
||||
|
||||
class DIALOG_TRACK_VIA_PROPERTIES : public DIALOG_TRACK_VIA_PROPERTIES_BASE
|
||||
{
|
||||
|
@ -48,6 +49,9 @@ private:
|
|||
void onViaSelect( wxCommandEvent& aEvent );
|
||||
void onViaEdit( wxCommandEvent& aEvent );
|
||||
|
||||
bool confirmPadChange( const std::set<D_PAD*>& connectedPads );
|
||||
|
||||
PCB_BASE_FRAME* m_frame;
|
||||
const SELECTION& m_items; // List of items to be modified.
|
||||
COMMIT& m_commit; // An undo record to add any changes to.
|
||||
|
||||
|
@ -60,7 +64,4 @@ private:
|
|||
|
||||
bool m_tracks; // True if dialog displays any track properties.
|
||||
bool m_vias; // True if dialog displays any via properties.
|
||||
|
||||
///> Fixme
|
||||
bool m_haveUniqueNet;
|
||||
};
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "pcb_layer_box_selector.h"
|
||||
#include "widgets/widget_net_selector.h"
|
||||
|
||||
#include "dialog_track_via_properties_base.h"
|
||||
|
||||
|
@ -20,12 +19,12 @@ DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* pa
|
|||
|
||||
m_sbCommonSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Common") ), wxHORIZONTAL );
|
||||
|
||||
m_staticText24 = new wxStaticText( m_sbCommonSizer->GetStaticBox(), wxID_ANY, _("Net:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText24->Wrap( -1 );
|
||||
m_sbCommonSizer->Add( m_staticText24, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
m_netSelectorLabel = new wxStaticText( m_sbCommonSizer->GetStaticBox(), wxID_ANY, _("Net:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_netSelectorLabel->Wrap( -1 );
|
||||
m_sbCommonSizer->Add( m_netSelectorLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_NetComboBox = new WIDGET_NET_SELECTOR( m_sbCommonSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN|wxCB_READONLY );
|
||||
m_sbCommonSizer->Add( m_NetComboBox, 6, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
m_netSelector = new NET_SELECTOR( m_sbCommonSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_sbCommonSizer->Add( m_netSelector, 5, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
m_sbCommonSizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
|
|
@ -146,7 +146,7 @@
|
|||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticText24</property>
|
||||
<property name="name">m_netSelectorLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
|
@ -189,11 +189,11 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">6</property>
|
||||
<object class="wxComboBox" expanded="0">
|
||||
<property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">5</property>
|
||||
<object class="CustomControl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -207,10 +207,12 @@
|
|||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices"></property>
|
||||
<property name="class">NET_SELECTOR</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="construction"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="declaration"></property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
|
@ -222,6 +224,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="include">#include <widgets/net_selector.h></property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
@ -229,7 +232,7 @@
|
|||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_NetComboBox</property>
|
||||
<property name="name">m_netSelector</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
|
@ -237,25 +240,16 @@
|
|||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">-1</property>
|
||||
<property name="settings"></property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxCB_DROPDOWN|wxCB_READONLY</property>
|
||||
<property name="subclass">WIDGET_NET_SELECTOR; widgets/widget_net_selector.h</property>
|
||||
<property name="subclass">; ; forward_declare</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="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCombobox"></event>
|
||||
<event name="OnComboboxCloseup"></event>
|
||||
<event name="OnComboboxDropdown"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
|
@ -277,8 +271,6 @@
|
|||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnText"></event>
|
||||
<event name="OnTextEnter"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class PCB_LAYER_BOX_SELECTOR;
|
||||
class WIDGET_NET_SELECTOR;
|
||||
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/string.h>
|
||||
|
@ -21,7 +20,7 @@ class WIDGET_NET_SELECTOR;
|
|||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/combobox.h>
|
||||
#include <widgets/net_selector.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
|
@ -44,8 +43,8 @@ class DIALOG_TRACK_VIA_PROPERTIES_BASE : public DIALOG_SHIM
|
|||
protected:
|
||||
wxBoxSizer* m_MainSizer;
|
||||
wxStaticBoxSizer* m_sbCommonSizer;
|
||||
wxStaticText* m_staticText24;
|
||||
WIDGET_NET_SELECTOR* m_NetComboBox;
|
||||
wxStaticText* m_netSelectorLabel;
|
||||
NET_SELECTOR* m_netSelector;
|
||||
wxCheckBox* m_lockedCbox;
|
||||
wxStaticBoxSizer* m_sbTrackSizer;
|
||||
wxStaticText* m_TrackStartXLabel;
|
||||
|
|
|
@ -630,7 +630,7 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
if ( !changeTrackWidthOnClick( selection ) )
|
||||
{
|
||||
DIALOG_TRACK_VIA_PROPERTIES dlg( editFrame, selection, *m_commit );
|
||||
dlg.ShowModal();
|
||||
dlg.ShowQuasiModal(); // QuasiModal required for NET_SELECTOR
|
||||
}
|
||||
}
|
||||
else if( selection.Size() == 1 ) // Properties are displayed when there is only one item selected
|
||||
|
|
Loading…
Reference in New Issue