Tracks & vias properties dialog.
This commit is contained in:
parent
9c44750ae0
commit
33e1797116
|
@ -133,6 +133,8 @@ set( PCBNEW_DIALOGS
|
|||
dialogs/dialog_set_grid.cpp
|
||||
dialogs/dialog_set_grid_base.cpp
|
||||
dialogs/dialog_target_properties_base.cpp
|
||||
dialogs/dialog_track_via_properties.cpp
|
||||
dialogs/dialog_track_via_properties_base.cpp
|
||||
dialogs/dialog_track_via_size.cpp
|
||||
dialogs/dialog_track_via_size_base.cpp
|
||||
footprint_wizard.cpp
|
||||
|
|
|
@ -0,0 +1,365 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 CERN
|
||||
* @author Maciej Suminski <maciej.suminski@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 <dialogs/dialog_track_via_properties.h>
|
||||
#include <class_pcb_layer_box_selector.h>
|
||||
#include <tools/selection_tool.h>
|
||||
#include <class_track.h>
|
||||
#include <wxPcbStruct.h>
|
||||
#include <confirm.h>
|
||||
|
||||
DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParent, const SELECTION& aItems ) :
|
||||
DIALOG_TRACK_VIA_PROPERTIES_BASE( aParent ), m_items( aItems ),
|
||||
m_trackStartX( aParent, m_TrackStartXCtrl, m_TrackStartXUnit ),
|
||||
m_trackStartY( aParent, m_TrackStartYCtrl, m_TrackStartYUnit ),
|
||||
m_trackEndX( aParent, m_TrackEndXCtrl, m_TrackEndXUnit ),
|
||||
m_trackEndY( aParent, m_TrackEndYCtrl, m_TrackEndYUnit ),
|
||||
m_trackWidth( aParent, m_TrackWidthCtrl, m_TrackWidthUnit ),
|
||||
m_viaX( aParent, m_ViaXCtrl, m_ViaXUnit ), m_viaY( aParent, m_ViaYCtrl, m_ViaYUnit ),
|
||||
m_viaDiameter( aParent, m_ViaDiameterCtrl, m_ViaDiameterUnit ),
|
||||
m_viaDrill( aParent, m_ViaDrillCtrl, m_ViaDrillUnit ),
|
||||
m_tracks( false ), m_vias( false )
|
||||
{
|
||||
assert( !m_items.Empty() );
|
||||
|
||||
boost::optional<int> trackStartX, trackStartY, trackEndX, trackEndY, trackWidth;
|
||||
boost::optional<LAYER_ID> trackLayer;
|
||||
boost::optional<int> viaX, viaY, viaDiameter, viaDrill;
|
||||
|
||||
// Look for values that are common for every item that is selected
|
||||
for( int i = 0; i < m_items.Size(); ++i )
|
||||
{
|
||||
const BOARD_ITEM* item = m_items.Item<BOARD_ITEM>( i );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_TRACE_T:
|
||||
{
|
||||
const TRACK* t = static_cast<const TRACK*>( item );
|
||||
|
||||
if( !m_tracks ) // first track in the list
|
||||
{
|
||||
trackStartX = t->GetStart().x;
|
||||
trackStartY = t->GetStart().y;
|
||||
trackEndX = t->GetEnd().x;
|
||||
trackEndY = t->GetEnd().y;
|
||||
trackWidth = t->GetWidth();
|
||||
trackLayer = t->GetLayer();
|
||||
m_tracks = true;
|
||||
}
|
||||
else // check if values are the same for every selected track
|
||||
{
|
||||
if( trackStartX && *trackStartX != t->GetStart().x )
|
||||
trackStartX = boost::none;
|
||||
|
||||
if( trackStartY && *trackStartY != t->GetStart().y )
|
||||
trackStartY = boost::none;
|
||||
|
||||
if( trackEndX && *trackEndX != t->GetEnd().x )
|
||||
trackEndX = boost::none;
|
||||
|
||||
if( trackEndY && *trackEndY != t->GetEnd().y )
|
||||
trackEndY = boost::none;
|
||||
|
||||
if( trackWidth && *trackWidth != t->GetWidth() )
|
||||
trackWidth = boost::none;
|
||||
|
||||
if( trackLayer && *trackLayer != t->GetLayer() )
|
||||
trackLayer = boost::none;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_VIA_T:
|
||||
{
|
||||
const VIA* v = static_cast<const VIA*>( item );
|
||||
|
||||
if( !m_vias ) // first via in the list
|
||||
{
|
||||
viaX = v->GetPosition().x;
|
||||
viaY = v->GetPosition().y;
|
||||
viaDiameter = v->GetWidth();
|
||||
viaDrill = v->GetDrillValue();
|
||||
m_vias = true;
|
||||
}
|
||||
else // check if values are the same for every selected via
|
||||
{
|
||||
if( viaX && *viaX != v->GetPosition().x )
|
||||
viaX = boost::none;
|
||||
|
||||
if( viaY && *viaY != v->GetPosition().y )
|
||||
viaY = boost::none;
|
||||
|
||||
if( viaDiameter && *viaDiameter != v->GetWidth() )
|
||||
viaDiameter = boost::none;
|
||||
|
||||
if( viaDrill && *viaDrill != v->GetDrillValue() )
|
||||
viaDrill = boost::none;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( m_tracks )
|
||||
{
|
||||
setCommonVal( trackStartX, m_TrackStartXCtrl, m_trackStartX );
|
||||
setCommonVal( trackStartY, m_TrackStartYCtrl, m_trackStartY );
|
||||
setCommonVal( trackEndX, m_TrackEndXCtrl, m_trackEndX );
|
||||
setCommonVal( trackEndY, m_TrackEndYCtrl, m_trackEndY );
|
||||
setCommonVal( trackWidth, m_TrackWidthCtrl, m_trackWidth );
|
||||
|
||||
m_TrackLayerCtrl->SetLayersHotkeys( false );
|
||||
m_TrackLayerCtrl->SetLayerSet( LSET::AllNonCuMask() );
|
||||
m_TrackLayerCtrl->SetBoardFrame( aParent );
|
||||
m_TrackLayerCtrl->Resync();
|
||||
|
||||
if( trackLayer )
|
||||
m_TrackLayerCtrl->SetLayerSelection( *trackLayer );
|
||||
}
|
||||
else
|
||||
{
|
||||
// you cannot access sizers directly if the code was generated by wxFormBuilder
|
||||
wxSizer* s = m_trackStaticLine->GetContainingSizer();
|
||||
m_mainSizerAccessor->GetContainingSizer()->Hide( s, true );
|
||||
}
|
||||
|
||||
if( m_vias )
|
||||
{
|
||||
setCommonVal( viaX, m_ViaXCtrl, m_viaX );
|
||||
setCommonVal( viaY, m_ViaYCtrl, m_viaY );
|
||||
setCommonVal( viaDiameter, m_ViaDiameterCtrl, m_viaDiameter );
|
||||
setCommonVal( viaDrill, m_ViaDrillCtrl, m_viaDrill );
|
||||
}
|
||||
else
|
||||
{
|
||||
// you cannot access sizers directly if the code was generated by wxFormBuilder
|
||||
wxSizer* s = m_viaStaticLine->GetContainingSizer();
|
||||
m_mainSizerAccessor->GetContainingSizer()->Hide( s, true );
|
||||
}
|
||||
|
||||
m_StdButtonsOK->SetDefault();
|
||||
|
||||
Layout();
|
||||
Fit();
|
||||
|
||||
// Pressing ENTER when any of the text input fields is active applies changes
|
||||
#if wxCHECK_VERSION( 3, 0, 0 )
|
||||
Connect( wxEVT_TEXT_ENTER, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES::onOkClick ), NULL, this );
|
||||
#else
|
||||
Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES::onOkClick ), NULL, this );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_TRACK_VIA_PROPERTIES::Apply()
|
||||
{
|
||||
if( !check() )
|
||||
return false;
|
||||
|
||||
for( int i = 0; i < m_items.Size(); ++i )
|
||||
{
|
||||
BOARD_ITEM* item = m_items.Item<BOARD_ITEM>( i );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_TRACE_T:
|
||||
{
|
||||
assert( m_tracks );
|
||||
TRACK* t = static_cast<TRACK*>( item );
|
||||
|
||||
if( m_trackStartX.Valid() || m_trackStartY.Valid() )
|
||||
{
|
||||
wxPoint start = t->GetStart();
|
||||
|
||||
if( m_trackStartX.Valid() )
|
||||
start.x = m_trackStartX.GetValue();
|
||||
|
||||
if( m_trackStartY.Valid() )
|
||||
start.y = m_trackStartY.GetValue();
|
||||
|
||||
t->SetStart( start );
|
||||
}
|
||||
|
||||
if( m_trackEndX.Valid() || m_trackEndY.Valid() )
|
||||
{
|
||||
wxPoint end = t->GetEnd();
|
||||
|
||||
if( m_trackEndX.Valid() )
|
||||
end.x = m_trackEndX.GetValue();
|
||||
|
||||
if( m_trackEndY.Valid() )
|
||||
end.y = m_trackEndY.GetValue();
|
||||
|
||||
t->SetEnd( end );
|
||||
}
|
||||
|
||||
if( m_trackNetclass->IsChecked() )
|
||||
{
|
||||
t->SetWidth( t->GetNetClass()->GetTrackWidth() );
|
||||
}
|
||||
else if( m_trackWidth.Valid() )
|
||||
{
|
||||
t->SetWidth( m_trackWidth.GetValue() );
|
||||
}
|
||||
|
||||
LAYER_NUM layer = m_TrackLayerCtrl->GetLayerSelection();
|
||||
|
||||
if( layer != UNDEFINED_LAYER )
|
||||
t->SetLayer( (LAYER_ID) layer );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_VIA_T:
|
||||
{
|
||||
assert( m_vias );
|
||||
|
||||
VIA* v = static_cast<VIA*>( item );
|
||||
|
||||
if( m_viaX.Valid() || m_viaY.Valid() )
|
||||
{
|
||||
wxPoint pos = v->GetPosition();
|
||||
|
||||
if( m_viaX.Valid() )
|
||||
pos.x = m_viaX.GetValue();
|
||||
|
||||
if( m_viaY.Valid() )
|
||||
pos.y = m_viaY.GetValue();
|
||||
|
||||
v->SetPosition( pos );
|
||||
}
|
||||
|
||||
if( m_viaNetclass->IsChecked() )
|
||||
{
|
||||
v->SetWidth( v->GetNetClass()->GetViaDiameter() );
|
||||
v->SetDrill( v->GetNetClass()->GetViaDrill() );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_viaDiameter.Valid() )
|
||||
v->SetWidth( m_viaDiameter.GetValue() );
|
||||
|
||||
if( m_viaDrill.Valid() )
|
||||
v->SetDrill( m_viaDrill.GetValue() );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_TRACK_VIA_PROPERTIES::onClose( wxCloseEvent& aEvent )
|
||||
{
|
||||
EndModal( 0 );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_TRACK_VIA_PROPERTIES::onTrackNetclassCheck( wxCommandEvent& aEvent )
|
||||
{
|
||||
bool enableNC = aEvent.IsChecked();
|
||||
|
||||
m_TrackWidthLabel->Enable( !enableNC );
|
||||
m_TrackWidthCtrl->Enable( !enableNC );
|
||||
m_TrackWidthUnit->Enable( !enableNC );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_TRACK_VIA_PROPERTIES::onViaNetclassCheck( wxCommandEvent& aEvent )
|
||||
{
|
||||
bool enableNC = aEvent.IsChecked();
|
||||
|
||||
m_ViaDiameterLabel->Enable( !enableNC );
|
||||
m_ViaDiameterCtrl->Enable( !enableNC );
|
||||
m_ViaDiameterUnit->Enable( !enableNC );
|
||||
|
||||
m_ViaDrillLabel->Enable( !enableNC );
|
||||
m_ViaDrillCtrl->Enable( !enableNC );
|
||||
m_ViaDrillUnit->Enable( !enableNC );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_TRACK_VIA_PROPERTIES::onCancelClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
EndModal( 0 );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_TRACK_VIA_PROPERTIES::onOkClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
if( check() )
|
||||
EndModal( 1 );
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_TRACK_VIA_PROPERTIES::check() const
|
||||
{
|
||||
bool trackNetclass = m_trackNetclass->IsChecked();
|
||||
bool viaNetclass = m_trackNetclass->IsChecked();
|
||||
|
||||
if( m_tracks && !trackNetclass && m_trackWidth.Valid() && m_trackWidth.GetValue() <= 0 )
|
||||
{
|
||||
DisplayError( GetParent(), _( "Invalid track width" ) );
|
||||
m_TrackWidthCtrl->SetFocus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if( m_vias && !viaNetclass )
|
||||
{
|
||||
if( m_viaDiameter.Valid() && m_viaDiameter.GetValue() <= 0 )
|
||||
{
|
||||
DisplayError( GetParent(), _( "Invalid via diameter" ) );
|
||||
m_ViaDiameterCtrl->SetFocus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if( m_viaDrill.Valid() && m_viaDrill.GetValue() <= 0 )
|
||||
{
|
||||
DisplayError( GetParent(), _( "Invalid via drill size" ) );
|
||||
m_ViaDrillCtrl->SetFocus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if( m_viaDiameter.Valid() && m_viaDrill.Valid() && m_viaDiameter.GetValue() <= m_viaDrill.GetValue() )
|
||||
{
|
||||
DisplayError( GetParent(), _( "Via drill size has to be smaller than via diameter" ) );
|
||||
m_ViaDrillCtrl->SetFocus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 CERN
|
||||
* @author Maciej Suminski <maciej.suminski@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 <dialogs/dialog_track_via_properties_base.h>
|
||||
#include <wx_unit_binder.h>
|
||||
#include <boost/optional.hpp>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
|
||||
class SELECTION;
|
||||
class PCB_BASE_FRAME;
|
||||
|
||||
class DIALOG_TRACK_VIA_PROPERTIES : public DIALOG_TRACK_VIA_PROPERTIES_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParent, const SELECTION& aItems );
|
||||
|
||||
///> Applies values from the dialog to the selected items.
|
||||
bool Apply();
|
||||
|
||||
private:
|
||||
void onClose( wxCloseEvent& aEvent );
|
||||
void onTrackNetclassCheck( wxCommandEvent& aEvent );
|
||||
void onViaNetclassCheck( wxCommandEvent& aEvent );
|
||||
void onCancelClick( wxCommandEvent& aEvent );
|
||||
void onOkClick( wxCommandEvent& aEvent );
|
||||
|
||||
///> Checks if the dialog values are correct.
|
||||
bool check() const;
|
||||
|
||||
///> Sets wxTextCtrl to the value stored in boost::optional<T> or "<...>" if it is not available.
|
||||
template<typename T>
|
||||
void setCommonVal( const boost::optional<T>& aVal, wxTextCtrl* aTxtCtrl, WX_UNIT_BINDER& aBinder )
|
||||
{
|
||||
if( aVal )
|
||||
aBinder.SetValue( *aVal );
|
||||
else
|
||||
aTxtCtrl->SetValue( "<...>" );
|
||||
}
|
||||
|
||||
///> Selected items to be modified.
|
||||
const SELECTION& m_items;
|
||||
|
||||
WX_UNIT_BINDER m_trackStartX, m_trackStartY;
|
||||
WX_UNIT_BINDER m_trackEndX, m_trackEndY;
|
||||
WX_UNIT_BINDER m_trackWidth;
|
||||
|
||||
WX_UNIT_BINDER m_viaX, m_viaY;
|
||||
WX_UNIT_BINDER m_viaDiameter, m_viaDrill;
|
||||
|
||||
///> Flag that determines if the dialog displays track properties.
|
||||
bool m_tracks;
|
||||
|
||||
///> Flag that determines if the dialog displays via properties.
|
||||
bool m_vias;
|
||||
};
|
|
@ -0,0 +1,245 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Mar 9 2015)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "class_pcb_layer_box_selector.h"
|
||||
|
||||
#include "dialog_track_via_properties_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_TRACK_VIA_PROPERTIES_BASE::DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxStaticBoxSizer* sbTrackSizer;
|
||||
sbTrackSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Tracks") ), wxHORIZONTAL );
|
||||
|
||||
wxFlexGridSizer* fgTrackLeftGridSizer;
|
||||
fgTrackLeftGridSizer = new wxFlexGridSizer( 4, 3, 0, 0 );
|
||||
fgTrackLeftGridSizer->SetFlexibleDirection( wxBOTH );
|
||||
fgTrackLeftGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_TrackStartXLabel = new wxStaticText( this, wxID_ANY, _("Start point X"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackStartXLabel->Wrap( -1 );
|
||||
fgTrackLeftGridSizer->Add( m_TrackStartXLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_TrackStartXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackStartXCtrl->SetMaxLength( 0 );
|
||||
fgTrackLeftGridSizer->Add( m_TrackStartXCtrl, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
m_TrackStartXUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackStartXUnit->Wrap( -1 );
|
||||
fgTrackLeftGridSizer->Add( m_TrackStartXUnit, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_TrackStartYLabel = new wxStaticText( this, wxID_ANY, _("Start point Y"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackStartYLabel->Wrap( -1 );
|
||||
fgTrackLeftGridSizer->Add( m_TrackStartYLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_TrackStartYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackStartYCtrl->SetMaxLength( 0 );
|
||||
fgTrackLeftGridSizer->Add( m_TrackStartYCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_TrackStartYUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackStartYUnit->Wrap( -1 );
|
||||
fgTrackLeftGridSizer->Add( m_TrackStartYUnit, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_TrackEndXLabel = new wxStaticText( this, wxID_ANY, _("End point X"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackEndXLabel->Wrap( -1 );
|
||||
fgTrackLeftGridSizer->Add( m_TrackEndXLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_TrackEndXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackEndXCtrl->SetMaxLength( 0 );
|
||||
fgTrackLeftGridSizer->Add( m_TrackEndXCtrl, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
m_TrackEndXUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackEndXUnit->Wrap( -1 );
|
||||
fgTrackLeftGridSizer->Add( m_TrackEndXUnit, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_TrackEndYLabel = new wxStaticText( this, wxID_ANY, _("End point Y"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackEndYLabel->Wrap( -1 );
|
||||
fgTrackLeftGridSizer->Add( m_TrackEndYLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_TrackEndYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackEndYCtrl->SetMaxLength( 0 );
|
||||
fgTrackLeftGridSizer->Add( m_TrackEndYCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_TrackEndYUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackEndYUnit->Wrap( -1 );
|
||||
fgTrackLeftGridSizer->Add( m_TrackEndYUnit, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
sbTrackSizer->Add( fgTrackLeftGridSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
m_trackStaticLine = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
|
||||
sbTrackSizer->Add( m_trackStaticLine, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
wxFlexGridSizer* fgTrackRightSizer;
|
||||
fgTrackRightSizer = new wxFlexGridSizer( 0, 3, 0, 0 );
|
||||
fgTrackRightSizer->SetFlexibleDirection( wxBOTH );
|
||||
fgTrackRightSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_TrackWidthLabel = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackWidthLabel->Wrap( -1 );
|
||||
fgTrackRightSizer->Add( m_TrackWidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
m_TrackWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackWidthCtrl->SetMaxLength( 0 );
|
||||
fgTrackRightSizer->Add( m_TrackWidthCtrl, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
m_TrackWidthUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackWidthUnit->Wrap( -1 );
|
||||
fgTrackRightSizer->Add( m_TrackWidthUnit, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
fgTrackRightSizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_trackNetclass = new wxCheckBox( this, wxID_ANY, _("Use net class width"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgTrackRightSizer->Add( m_trackNetclass, 0, wxALL, 5 );
|
||||
|
||||
|
||||
fgTrackRightSizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_TrackLayerLabel = new wxStaticText( this, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_TrackLayerLabel->Wrap( -1 );
|
||||
fgTrackRightSizer->Add( m_TrackLayerLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
m_TrackLayerCtrl = new PCB_LAYER_BOX_SELECTOR( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
|
||||
fgTrackRightSizer->Add( m_TrackLayerCtrl, 0, wxALL, 5 );
|
||||
|
||||
|
||||
fgTrackRightSizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sbTrackSizer->Add( fgTrackRightSizer, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( sbTrackSizer, 0, wxEXPAND, 5 );
|
||||
|
||||
m_mainSizerAccessor = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_mainSizerAccessor->Wrap( -1 );
|
||||
m_mainSizerAccessor->SetMaxSize( wxSize( 0,0 ) );
|
||||
|
||||
bMainSizer->Add( m_mainSizerAccessor, 0, wxALL, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbViaSizer;
|
||||
sbViaSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Vias") ), wxHORIZONTAL );
|
||||
|
||||
wxFlexGridSizer* fgViaLeftSizer;
|
||||
fgViaLeftSizer = new wxFlexGridSizer( 2, 3, 0, 0 );
|
||||
fgViaLeftSizer->SetFlexibleDirection( wxBOTH );
|
||||
fgViaLeftSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_ViaXLabel = new wxStaticText( this, wxID_ANY, _("Position X"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ViaXLabel->Wrap( -1 );
|
||||
fgViaLeftSizer->Add( m_ViaXLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_ViaXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ViaXCtrl->SetMaxLength( 0 );
|
||||
fgViaLeftSizer->Add( m_ViaXCtrl, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
m_ViaXUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ViaXUnit->Wrap( -1 );
|
||||
fgViaLeftSizer->Add( m_ViaXUnit, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_ViaYLabel = new wxStaticText( this, wxID_ANY, _("Position Y"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ViaYLabel->Wrap( -1 );
|
||||
fgViaLeftSizer->Add( m_ViaYLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_ViaYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ViaYCtrl->SetMaxLength( 0 );
|
||||
fgViaLeftSizer->Add( m_ViaYCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_ViaYUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ViaYUnit->Wrap( -1 );
|
||||
fgViaLeftSizer->Add( m_ViaYUnit, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
sbViaSizer->Add( fgViaLeftSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
m_viaStaticLine = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
|
||||
sbViaSizer->Add( m_viaStaticLine, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
wxFlexGridSizer* fgViaRightSizer;
|
||||
fgViaRightSizer = new wxFlexGridSizer( 0, 3, 0, 0 );
|
||||
fgViaRightSizer->SetFlexibleDirection( wxBOTH );
|
||||
fgViaRightSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_ViaDiameterLabel = new wxStaticText( this, wxID_ANY, _("Diameter"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ViaDiameterLabel->Wrap( -1 );
|
||||
fgViaRightSizer->Add( m_ViaDiameterLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_ViaDiameterCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ViaDiameterCtrl->SetMaxLength( 0 );
|
||||
fgViaRightSizer->Add( m_ViaDiameterCtrl, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
m_ViaDiameterUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ViaDiameterUnit->Wrap( -1 );
|
||||
fgViaRightSizer->Add( m_ViaDiameterUnit, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_ViaDrillLabel = new wxStaticText( this, wxID_ANY, _("Drill"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ViaDrillLabel->Wrap( -1 );
|
||||
fgViaRightSizer->Add( m_ViaDrillLabel, 0, wxALIGN_RIGHT|wxTOP|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_ViaDrillCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ViaDrillCtrl->SetMaxLength( 0 );
|
||||
fgViaRightSizer->Add( m_ViaDrillCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_ViaDrillUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ViaDrillUnit->Wrap( -1 );
|
||||
fgViaRightSizer->Add( m_ViaDrillUnit, 0, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
fgViaRightSizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_viaNetclass = new wxCheckBox( this, wxID_ANY, _("Use net class size"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgViaRightSizer->Add( m_viaNetclass, 0, wxALL, 5 );
|
||||
|
||||
|
||||
fgViaRightSizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sbViaSizer->Add( fgViaRightSizer, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( sbViaSizer, 0, wxEXPAND, 5 );
|
||||
|
||||
m_StdButtons = new wxStdDialogButtonSizer();
|
||||
m_StdButtonsOK = new wxButton( this, wxID_OK );
|
||||
m_StdButtons->AddButton( m_StdButtonsOK );
|
||||
m_StdButtonsCancel = new wxButton( this, wxID_CANCEL );
|
||||
m_StdButtons->AddButton( m_StdButtonsCancel );
|
||||
m_StdButtons->Realize();
|
||||
|
||||
bMainSizer->Add( m_StdButtons, 0, wxALIGN_RIGHT|wxALL, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onClose ) );
|
||||
m_trackNetclass->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onTrackNetclassCheck ), NULL, this );
|
||||
m_viaNetclass->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaNetclassCheck ), NULL, this );
|
||||
m_StdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onCancelClick ), NULL, this );
|
||||
m_StdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onOkClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_TRACK_VIA_PROPERTIES_BASE::~DIALOG_TRACK_VIA_PROPERTIES_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onClose ) );
|
||||
m_trackNetclass->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onTrackNetclassCheck ), NULL, this );
|
||||
m_viaNetclass->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onViaNetclassCheck ), NULL, this );
|
||||
m_StdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onCancelClick ), NULL, this );
|
||||
m_StdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_PROPERTIES_BASE::onOkClick ), NULL, this );
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,95 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Mar 9 2015)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DIALOG_TRACK_VIA_PROPERTIES_BASE_H__
|
||||
#define __DIALOG_TRACK_VIA_PROPERTIES_BASE_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class PCB_LAYER_BOX_SELECTOR;
|
||||
|
||||
#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/textctrl.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/bmpcbox.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_TRACK_VIA_PROPERTIES_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_TRACK_VIA_PROPERTIES_BASE : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_TrackStartXLabel;
|
||||
wxTextCtrl* m_TrackStartXCtrl;
|
||||
wxStaticText* m_TrackStartXUnit;
|
||||
wxStaticText* m_TrackStartYLabel;
|
||||
wxTextCtrl* m_TrackStartYCtrl;
|
||||
wxStaticText* m_TrackStartYUnit;
|
||||
wxStaticText* m_TrackEndXLabel;
|
||||
wxTextCtrl* m_TrackEndXCtrl;
|
||||
wxStaticText* m_TrackEndXUnit;
|
||||
wxStaticText* m_TrackEndYLabel;
|
||||
wxTextCtrl* m_TrackEndYCtrl;
|
||||
wxStaticText* m_TrackEndYUnit;
|
||||
wxStaticLine* m_trackStaticLine;
|
||||
wxStaticText* m_TrackWidthLabel;
|
||||
wxTextCtrl* m_TrackWidthCtrl;
|
||||
wxStaticText* m_TrackWidthUnit;
|
||||
wxCheckBox* m_trackNetclass;
|
||||
wxStaticText* m_TrackLayerLabel;
|
||||
PCB_LAYER_BOX_SELECTOR* m_TrackLayerCtrl;
|
||||
wxStaticText* m_mainSizerAccessor;
|
||||
wxStaticText* m_ViaXLabel;
|
||||
wxTextCtrl* m_ViaXCtrl;
|
||||
wxStaticText* m_ViaXUnit;
|
||||
wxStaticText* m_ViaYLabel;
|
||||
wxTextCtrl* m_ViaYCtrl;
|
||||
wxStaticText* m_ViaYUnit;
|
||||
wxStaticLine* m_viaStaticLine;
|
||||
wxStaticText* m_ViaDiameterLabel;
|
||||
wxTextCtrl* m_ViaDiameterCtrl;
|
||||
wxStaticText* m_ViaDiameterUnit;
|
||||
wxStaticText* m_ViaDrillLabel;
|
||||
wxTextCtrl* m_ViaDrillCtrl;
|
||||
wxStaticText* m_ViaDrillUnit;
|
||||
wxCheckBox* m_viaNetclass;
|
||||
wxStdDialogButtonSizer* m_StdButtons;
|
||||
wxButton* m_StdButtonsOK;
|
||||
wxButton* m_StdButtonsCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void onClose( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void onTrackNetclassCheck( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onViaNetclassCheck( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onCancelClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onOkClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_TRACK_VIA_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Track & Via Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 576,333 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU );
|
||||
~DIALOG_TRACK_VIA_PROPERTIES_BASE();
|
||||
|
||||
};
|
||||
|
||||
#endif //__DIALOG_TRACK_VIA_PROPERTIES_BASE_H__
|
|
@ -53,6 +53,7 @@
|
|||
|
||||
#include <dialogs/dialog_create_array.h>
|
||||
#include <dialogs/dialog_move_exact.h>
|
||||
#include <dialogs/dialog_track_via_properties.h>
|
||||
|
||||
EDIT_TOOL::EDIT_TOOL() :
|
||||
TOOL_INTERACTIVE( "pcbnew.InteractiveEdit" ), m_selectionTool( NULL ),
|
||||
|
@ -80,12 +81,17 @@ bool EDIT_TOOL::Init()
|
|||
return false;
|
||||
}
|
||||
|
||||
// Vector storing track & via types, used for specifying 'Properties' menu entry condition
|
||||
m_tracksViasType.push_back( PCB_TRACE_T );
|
||||
m_tracksViasType.push_back( PCB_VIA_T );
|
||||
|
||||
// Add context menu entries that are displayed when selection tool is active
|
||||
m_selectionTool->GetMenu().AddItem( COMMON_ACTIONS::editActivate, SELECTION_CONDITIONS::NotEmpty );
|
||||
m_selectionTool->GetMenu().AddItem( COMMON_ACTIONS::rotate, SELECTION_CONDITIONS::NotEmpty );
|
||||
m_selectionTool->GetMenu().AddItem( COMMON_ACTIONS::flip, SELECTION_CONDITIONS::NotEmpty );
|
||||
m_selectionTool->GetMenu().AddItem( COMMON_ACTIONS::remove, SELECTION_CONDITIONS::NotEmpty );
|
||||
m_selectionTool->GetMenu().AddItem( COMMON_ACTIONS::properties, SELECTION_CONDITIONS::Count( 1 ) );
|
||||
m_selectionTool->GetMenu().AddItem( COMMON_ACTIONS::properties, SELECTION_CONDITIONS::Count( 1 )
|
||||
|| SELECTION_CONDITIONS::OnlyTypes( m_tracksViasType ) );
|
||||
m_selectionTool->GetMenu().AddItem( COMMON_ACTIONS::moveExact, SELECTION_CONDITIONS::NotEmpty );
|
||||
m_selectionTool->GetMenu().AddItem( COMMON_ACTIONS::duplicate, SELECTION_CONDITIONS::NotEmpty );
|
||||
m_selectionTool->GetMenu().AddItem( COMMON_ACTIONS::createArray, SELECTION_CONDITIONS::NotEmpty );
|
||||
|
@ -340,11 +346,32 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
const SELECTION& selection = m_selectionTool->GetSelection();
|
||||
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
|
||||
|
||||
// Shall the selection be cleared at the end?
|
||||
bool unselect = selection.Empty();
|
||||
|
||||
if( !hoverSelection( selection, false ) )
|
||||
return 0;
|
||||
|
||||
// Properties are displayed when there is only one item selected
|
||||
if( selection.Size() == 1 )
|
||||
// Tracks & vias are treated in a special way:
|
||||
if( ( SELECTION_CONDITIONS::OnlyTypes( m_tracksViasType ) )( selection ) )
|
||||
{
|
||||
DIALOG_TRACK_VIA_PROPERTIES dlg( editFrame, selection );
|
||||
|
||||
if( dlg.ShowModal() )
|
||||
{
|
||||
RN_DATA* ratsnest = getModel<BOARD>()->GetRatsnest();
|
||||
|
||||
editFrame->OnModify();
|
||||
editFrame->SaveCopyInUndoList( selection.items, UR_CHANGED );
|
||||
dlg.Apply();
|
||||
|
||||
selection.ForAll<KIGFX::VIEW_ITEM>( boost::bind( &KIGFX::VIEW_ITEM::ViewUpdate, _1,
|
||||
KIGFX::VIEW_ITEM::ALL ) );
|
||||
selection.ForAll<BOARD_ITEM>( boost::bind( &RN_DATA::Update, ratsnest, _1 ) );
|
||||
ratsnest->Recalculate();
|
||||
}
|
||||
}
|
||||
else if( selection.Size() == 1 ) // Properties are displayed when there is only one item selected
|
||||
{
|
||||
// Display properties dialog
|
||||
BOARD_ITEM* item = selection.Item<BOARD_ITEM>( 0 );
|
||||
|
@ -359,7 +386,7 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
// It is necessary to determine if anything has changed
|
||||
PICKED_ITEMS_LIST* lastChange = undoList.empty() ? NULL : undoList.back();
|
||||
|
||||
// Display properties dialog
|
||||
// Display properties dialog provided by the legacy canvas frame
|
||||
editFrame->OnEditItemRequest( NULL, item );
|
||||
|
||||
PICKED_ITEMS_LIST* currentChange = undoList.empty() ? NULL : undoList.back();
|
||||
|
@ -380,6 +407,9 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
item->SetFlags( flags );
|
||||
}
|
||||
|
||||
if( unselect )
|
||||
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -149,6 +149,9 @@ private:
|
|||
/// Counter of undo inhibitions. When zero, undo is not inhibited.
|
||||
int m_undoInhibit;
|
||||
|
||||
// Vector storing track & via types, used for specifying 'Properties' menu entry condition
|
||||
std::vector<KICAD_T> m_tracksViasType;
|
||||
|
||||
///> Removes and frees a single BOARD_ITEM.
|
||||
void remove( BOARD_ITEM* aItem );
|
||||
|
||||
|
|
|
@ -71,8 +71,17 @@ struct SELECTION
|
|||
return static_cast<T*>( items.GetPickedItem( aIndex ) );
|
||||
}
|
||||
|
||||
/// Returns the center point of the selection area bounding box.
|
||||
VECTOR2I GetCenter() const;
|
||||
|
||||
/// Runs a function on all selected items.
|
||||
template <typename T>
|
||||
void ForAll( boost::function<void (T*)> aFunction ) const
|
||||
{
|
||||
for( unsigned int i = 0; i < items.GetCount(); ++i )
|
||||
aFunction( Item<T>( i ) );
|
||||
}
|
||||
|
||||
private:
|
||||
/// Clears both the VIEW_GROUP and set of selected items. Please note that it does not
|
||||
/// change properties of selected items (e.g. selection flag).
|
||||
|
|
Loading…
Reference in New Issue