Commit 0ae31f3e authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: better dialogs to select the active layer or a layer pair. Add an...

Pcbnew: better dialogs to select the active layer or a layer pair. Add an option (hotkey+popup menu) to place a via and select the new active layer
(useful for boards having more than 2 layers)
Eeschema:fix compatibility with old schematic files, when they  contain ERC markers.
Pcbnew: better test for allowed layers when creating/editing Dimensions and some other Graphic items
Drc:  fix comments and messages for some drc tests.
Fix minor bugs in cleanup dialog options and plot solder mask function (thanks to Lorenzo to locate these bugs)
parents 1e8430d5 c029dc39
...@@ -194,6 +194,7 @@ again." ); ...@@ -194,6 +194,7 @@ again." );
case 'K': // It is a Marker item. case 'K': // It is a Marker item.
// Markers are no more read from file. they are only created on // Markers are no more read from file. they are only created on
// demand in schematic // demand in schematic
itemLoaded = true; // Just skip descr and disable err message
break; break;
case 'N': // It is a NoConnect item. case 'N': // It is a NoConnect item.
...@@ -242,6 +243,9 @@ again." ); ...@@ -242,6 +243,9 @@ again." );
if( !itemLoaded ) if( !itemLoaded )
{ {
msgDiag.Printf( _( "Eeschema file object not loaded at line %d, aborted" ),
reader.LineNumber() );
msgDiag << wxT( "\n" ) << FROM_UTF8( line );
DisplayError( this, msgDiag ); DisplayError( this, msgDiag );
break; break;
} }
......
...@@ -139,14 +139,35 @@ typedef unsigned LAYER_MSK; ...@@ -139,14 +139,35 @@ typedef unsigned LAYER_MSK;
#define NO_LAYERS 0x00000000 #define NO_LAYERS 0x00000000
/** return a one bit layer mask from a layer number /**
* aLayerNumber = the layer number to convert (0 .. LAYERS-1) * @return a one bit layer mask from a layer number
* @param aLayerNumber = the layer number to convert (0 .. LAYERS-1)
*/ */
inline LAYER_MSK GetLayerMask( LAYER_NUM aLayerNumber ) inline LAYER_MSK GetLayerMask( LAYER_NUM aLayerNumber )
{ {
return 1 << aLayerNumber; return 1 << aLayerNumber;
} }
/**
* @return bool if aLayerNumber is a layer contained in aMask
* @param aMask = a layer mask
* @param aLayerNumber is the layer id to test
*/
inline bool IsLayerInList( LAYER_MSK aMask, LAYER_NUM aLayerNumber )
{
return (aMask & GetLayerMask( aLayerNumber )) != 0;
}
/**
* @return bool if 2 layer masks have a comman layer
* @param aMask1 = a layer mask
* @param aMask2 = an other layer mask
*/
inline bool IsLayerMasksIntersect( LAYER_MSK aMask1, LAYER_MSK aMask2 )
{
return (aMask1 & aMask2) != 0;
}
/** /**
* Count the number of set layers in the mask * Count the number of set layers in the mask
*/ */
......
...@@ -639,11 +639,19 @@ public: ...@@ -639,11 +639,19 @@ public:
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) = 0; const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) = 0;
// layerhandling: /** Install the dialog box for layer selection
// (See pcbnew/sel_layer.cpp for description of why null_layer parameter * @param aDefaultLayer = Preselection (NB_PCB_LAYERS for "(Deselect)" layer)
// is provided) * @param aNotAllowedLayersMask = a layer mask for not allowed layers
LAYER_NUM SelectLayer( LAYER_NUM default_layer, LAYER_NUM min_layer, LAYER_NUM max_layer, bool null_layer = false ); * (= 0 to show all layers in use)
void SelectLayerPair(); * @return the selected layer id
*/
LAYER_NUM SelectLayer( LAYER_NUM aDefaultLayer, LAYER_MSK aNotAllowedLayersMask = 0 );
/* Display a list of two copper layers to choose a pair of copper layers
* the layer pair is used to fast switch between copper layers when placing vias
*/
void SelectCopperLayerPair();
virtual void SwitchLayer( wxDC* DC, LAYER_NUM layer ); virtual void SwitchLayer( wxDC* DC, LAYER_NUM layer );
/** /**
......
...@@ -60,9 +60,9 @@ wxString DRC_ITEM::GetErrorText() const ...@@ -60,9 +60,9 @@ wxString DRC_ITEM::GetErrorText() const
case DRCE_ENDS_PROBLEM3: case DRCE_ENDS_PROBLEM3:
case DRCE_ENDS_PROBLEM4: case DRCE_ENDS_PROBLEM4:
case DRCE_ENDS_PROBLEM5: case DRCE_ENDS_PROBLEM5:
return wxString( _("Two track ends") ); return wxString( _("Two track ends too close") );
case DRCE_TRACK_UNKNOWN1: case DRCE_TRACK_SEGMENTS_TOO_CLOSE:
return wxString( _("This looks bad") ); ///< @todo check source code and change this comment return wxString( _("Two parallel track segments too close") );
case DRCE_TRACKS_CROSSING: case DRCE_TRACKS_CROSSING:
return wxString( _("Tracks crossing") ); return wxString( _("Tracks crossing") );
case DRCE_PAD_NEAR_PAD1: case DRCE_PAD_NEAR_PAD1:
......
...@@ -165,6 +165,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( ) ...@@ -165,6 +165,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( )
m_LayerSelectionCtrl->SetLayerMask( ALL_CU_LAYERS ); m_LayerSelectionCtrl->SetLayerMask( ALL_CU_LAYERS );
m_LayerSelectionCtrl->SetBoardFrame( m_parent ); m_LayerSelectionCtrl->SetBoardFrame( m_parent );
m_LayerSelectionCtrl->Resync(); m_LayerSelectionCtrl->Resync();
if( m_LayerSelectionCtrl->SetLayerSelection( m_Item->GetLayer() ) < 0 ) if( m_LayerSelectionCtrl->SetLayerSelection( m_Item->GetLayer() ) < 0 )
{ {
wxMessageBox( _("This item has an illegal layer id.\n" wxMessageBox( _("This item has an illegal layer id.\n"
......
...@@ -77,9 +77,6 @@ DIALOG_LAYER_SELECTION_BASE::DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWi ...@@ -77,9 +77,6 @@ DIALOG_LAYER_SELECTION_BASE::DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWi
bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 ); bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 );
m_buttonClear = new wxButton( this, wxID_ANY, _("Clear Selection"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerMain->Add( m_buttonClear, 0, wxALL|wxALIGN_RIGHT, 5 );
this->SetSizer( bSizerMain ); this->SetSizer( bSizerMain );
this->Layout(); this->Layout();
...@@ -87,17 +84,19 @@ DIALOG_LAYER_SELECTION_BASE::DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWi ...@@ -87,17 +84,19 @@ DIALOG_LAYER_SELECTION_BASE::DIALOG_LAYER_SELECTION_BASE( wxWindow* parent, wxWi
this->Centre( wxBOTH ); this->Centre( wxBOTH );
// Connect Events // Connect Events
m_leftGridLayers->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftGridClick ), NULL, this ); m_leftGridLayers->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftGridCellClick ), NULL, this );
m_rightGridLayers->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnRightGridClick ), NULL, this ); m_leftGridLayers->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftButtonReleased ), NULL, this );
m_buttonClear->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LAYER_SELECTION_BASE::OnClearSelection ), NULL, this ); m_rightGridLayers->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnRightGridCellClick ), NULL, this );
m_rightGridLayers->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftButtonReleased ), NULL, this );
} }
DIALOG_LAYER_SELECTION_BASE::~DIALOG_LAYER_SELECTION_BASE() DIALOG_LAYER_SELECTION_BASE::~DIALOG_LAYER_SELECTION_BASE()
{ {
// Disconnect Events // Disconnect Events
m_leftGridLayers->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftGridClick ), NULL, this ); m_leftGridLayers->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftGridCellClick ), NULL, this );
m_rightGridLayers->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnRightGridClick ), NULL, this ); m_leftGridLayers->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftButtonReleased ), NULL, this );
m_buttonClear->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LAYER_SELECTION_BASE::OnClearSelection ), NULL, this ); m_rightGridLayers->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_LAYER_SELECTION_BASE::OnRightGridCellClick ), NULL, this );
m_rightGridLayers->Disconnect( wxEVT_LEFT_UP, wxMouseEventHandler( DIALOG_LAYER_SELECTION_BASE::OnLeftButtonReleased ), NULL, this );
} }
...@@ -208,8 +207,8 @@ DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE ...@@ -208,8 +207,8 @@ DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
this->Centre( wxBOTH ); this->Centre( wxBOTH );
// Connect Events // Connect Events
m_leftGridLayers->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnLeftGridClick ), NULL, this ); m_leftGridLayers->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnLeftGridCellClick ), NULL, this );
m_rightGridLayers->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnRightGridClick ), NULL, this ); m_rightGridLayers->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnRightGridCellClick ), NULL, this );
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnCancelClick ), NULL, this ); m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnOKClick ), NULL, this ); m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnOKClick ), NULL, this );
} }
...@@ -217,8 +216,8 @@ DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE ...@@ -217,8 +216,8 @@ DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE
DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::~DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE() DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::~DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE()
{ {
// Disconnect Events // Disconnect Events
m_leftGridLayers->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnLeftGridClick ), NULL, this ); m_leftGridLayers->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnLeftGridCellClick ), NULL, this );
m_rightGridLayers->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnRightGridClick ), NULL, this ); m_rightGridLayers->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnRightGridCellClick ), NULL, this );
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnCancelClick ), NULL, this ); m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnOKClick ), NULL, this ); m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE::OnOKClick ), NULL, this );
......
...@@ -190,7 +190,7 @@ ...@@ -190,7 +190,7 @@
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
<event name="OnGridCellChange"></event> <event name="OnGridCellChange"></event>
<event name="OnGridCellLeftClick">OnLeftGridClick</event> <event name="OnGridCellLeftClick">OnLeftGridCellClick</event>
<event name="OnGridCellLeftDClick"></event> <event name="OnGridCellLeftDClick"></event>
<event name="OnGridCellRightClick"></event> <event name="OnGridCellRightClick"></event>
<event name="OnGridCellRightDClick"></event> <event name="OnGridCellRightDClick"></event>
...@@ -227,7 +227,7 @@ ...@@ -227,7 +227,7 @@
<event name="OnLeaveWindow"></event> <event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event> <event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event> <event name="OnLeftDown"></event>
<event name="OnLeftUp"></event> <event name="OnLeftUp">OnLeftButtonReleased</event>
<event name="OnMiddleDClick"></event> <event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event> <event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event> <event name="OnMiddleUp"></event>
...@@ -333,7 +333,7 @@ ...@@ -333,7 +333,7 @@
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
<event name="OnGridCellChange"></event> <event name="OnGridCellChange"></event>
<event name="OnGridCellLeftClick">OnRightGridClick</event> <event name="OnGridCellLeftClick">OnRightGridCellClick</event>
<event name="OnGridCellLeftDClick"></event> <event name="OnGridCellLeftDClick"></event>
<event name="OnGridCellRightClick"></event> <event name="OnGridCellRightClick"></event>
<event name="OnGridCellRightDClick"></event> <event name="OnGridCellRightDClick"></event>
...@@ -370,7 +370,7 @@ ...@@ -370,7 +370,7 @@
<event name="OnLeaveWindow"></event> <event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event> <event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event> <event name="OnLeftDown"></event>
<event name="OnLeftUp"></event> <event name="OnLeftUp">OnLeftButtonReleased</event>
<event name="OnMiddleDClick"></event> <event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event> <event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event> <event name="OnMiddleUp"></event>
...@@ -388,94 +388,6 @@ ...@@ -388,94 +388,6 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_RIGHT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">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">Clear Selection</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_buttonClear</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">OnClearSelection</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object> </object>
</object> </object>
<object class="Dialog" expanded="1"> <object class="Dialog" expanded="1">
...@@ -736,7 +648,7 @@ ...@@ -736,7 +648,7 @@
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
<event name="OnGridCellChange"></event> <event name="OnGridCellChange"></event>
<event name="OnGridCellLeftClick">OnLeftGridClick</event> <event name="OnGridCellLeftClick">OnLeftGridCellClick</event>
<event name="OnGridCellLeftDClick"></event> <event name="OnGridCellLeftDClick"></event>
<event name="OnGridCellRightClick"></event> <event name="OnGridCellRightClick"></event>
<event name="OnGridCellRightDClick"></event> <event name="OnGridCellRightDClick"></event>
...@@ -973,7 +885,7 @@ ...@@ -973,7 +885,7 @@
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event> <event name="OnEraseBackground"></event>
<event name="OnGridCellChange"></event> <event name="OnGridCellChange"></event>
<event name="OnGridCellLeftClick">OnRightGridClick</event> <event name="OnGridCellLeftClick">OnRightGridCellClick</event>
<event name="OnGridCellLeftDClick"></event> <event name="OnGridCellLeftDClick"></event>
<event name="OnGridCellRightClick"></event> <event name="OnGridCellRightClick"></event>
<event name="OnGridCellRightDClick"></event> <event name="OnGridCellRightDClick"></event>
......
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
#include <wx/grid.h> #include <wx/grid.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/button.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
...@@ -38,12 +38,11 @@ class DIALOG_LAYER_SELECTION_BASE : public wxDialog ...@@ -38,12 +38,11 @@ class DIALOG_LAYER_SELECTION_BASE : public wxDialog
protected: protected:
wxGrid* m_leftGridLayers; wxGrid* m_leftGridLayers;
wxGrid* m_rightGridLayers; wxGrid* m_rightGridLayers;
wxButton* m_buttonClear;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnLeftGridClick( wxGridEvent& event ) { event.Skip(); } virtual void OnLeftGridCellClick( wxGridEvent& event ) { event.Skip(); }
virtual void OnRightGridClick( wxGridEvent& event ) { event.Skip(); } virtual void OnLeftButtonReleased( wxMouseEvent& event ) { event.Skip(); }
virtual void OnClearSelection( wxCommandEvent& event ) { event.Skip(); } virtual void OnRightGridCellClick( wxGridEvent& event ) { event.Skip(); }
public: public:
...@@ -71,8 +70,8 @@ class DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE : public wxDialog ...@@ -71,8 +70,8 @@ class DIALOG_COPPER_LAYER_PAIR_SELECTION_BASE : public wxDialog
wxButton* m_sdbSizerCancel; wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnLeftGridClick( wxGridEvent& event ) { event.Skip(); } virtual void OnLeftGridCellClick( wxGridEvent& event ) { event.Skip(); }
virtual void OnRightGridClick( wxGridEvent& event ) { event.Skip(); } virtual void OnRightGridCellClick( wxGridEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); }
......
...@@ -138,7 +138,13 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent, ...@@ -138,7 +138,13 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent,
m_SelLayerBox->SetLayerMask( ALL_CU_LAYERS | EDGE_LAYER ); m_SelLayerBox->SetLayerMask( ALL_CU_LAYERS | EDGE_LAYER );
m_SelLayerBox->SetBoardFrame( m_Parent ); m_SelLayerBox->SetBoardFrame( m_Parent );
m_SelLayerBox->Resync(); m_SelLayerBox->Resync();
m_SelLayerBox->SetLayerSelection( aDimension->GetLayer() );
if( m_SelLayerBox->SetLayerSelection( aDimension->GetLayer() ) < 0 )
{
wxMessageBox( _("This item has an illegal layer id.\n"
"Now, forced on the drawings layer. Please, fix it") );
m_SelLayerBox->SetLayerSelection( DRAW_N );
}
GetSizer()->Fit( this ); GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
......
...@@ -420,6 +420,10 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) ...@@ -420,6 +420,10 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
if( segStartPoint.x > (-w_dist) && segStartPoint.x < (m_segmLength + w_dist) ) /* possible error drc */ if( segStartPoint.x > (-w_dist) && segStartPoint.x < (m_segmLength + w_dist) ) /* possible error drc */
{ {
// the start point is inside the reference range
// X........
// O--REF--+
// Fine test : we consider the rounded shape of each end of the track segment: // Fine test : we consider the rounded shape of each end of the track segment:
if( segStartPoint.x >= 0 && segStartPoint.x <= m_segmLength ) if( segStartPoint.x >= 0 && segStartPoint.x <= m_segmLength )
{ {
...@@ -438,7 +442,10 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) ...@@ -438,7 +442,10 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
if( segEndPoint.x > (-w_dist) && segEndPoint.x < (m_segmLength + w_dist) ) if( segEndPoint.x > (-w_dist) && segEndPoint.x < (m_segmLength + w_dist) )
{ {
/* Fine test : we consider the rounded shape of the ends */ // the end point is inside the reference range
// .....X
// O--REF--+
// Fine test : we consider the rounded shape of the ends
if( segEndPoint.x >= 0 && segEndPoint.x <= m_segmLength ) if( segEndPoint.x >= 0 && segEndPoint.x <= m_segmLength )
{ {
m_currentMarker = fillMarker( aRefSeg, track, m_currentMarker = fillMarker( aRefSeg, track,
...@@ -456,8 +463,13 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) ...@@ -456,8 +463,13 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
if( segStartPoint.x <=0 && segEndPoint.x >= 0 ) if( segStartPoint.x <=0 && segEndPoint.x >= 0 )
{ {
// the segment straddles the reference range (this actually only
// checks if it straddles the origin, because the other cases where already
// handled)
// X.............X
// O--REF--+
m_currentMarker = fillMarker( aRefSeg, track, m_currentMarker = fillMarker( aRefSeg, track,
DRCE_TRACK_UNKNOWN1, m_currentMarker ); DRCE_TRACK_SEGMENTS_TOO_CLOSE, m_currentMarker );
return false; return false;
} }
} }
......
...@@ -44,11 +44,11 @@ ...@@ -44,11 +44,11 @@
#define DRCE_TRACK_NEAR_VIA 5 ///< track too close to via #define DRCE_TRACK_NEAR_VIA 5 ///< track too close to via
#define DRCE_VIA_NEAR_VIA 6 ///< via too close to via #define DRCE_VIA_NEAR_VIA 6 ///< via too close to via
#define DRCE_VIA_NEAR_TRACK 7 ///< via too close to track #define DRCE_VIA_NEAR_TRACK 7 ///< via too close to track
#define DRCE_TRACK_ENDS1 8 ///< @todo say what this problem is #define DRCE_TRACK_ENDS1 8 ///< 2 parallel track segments too close: fine start point test
#define DRCE_TRACK_ENDS2 9 ///< @todo say what this problem is #define DRCE_TRACK_ENDS2 9 ///< 2 parallel track segments too close: fine start point test
#define DRCE_TRACK_ENDS3 10 ///< @todo say what this problem is #define DRCE_TRACK_ENDS3 10 ///< 2 parallel track segments too close: fine end point test
#define DRCE_TRACK_ENDS4 11 ///< @todo say what this problem is #define DRCE_TRACK_ENDS4 11 ///< 2 parallel track segments too close: fine end point test
#define DRCE_TRACK_UNKNOWN1 12 ///< @todo check source code and change this comment #define DRCE_TRACK_SEGMENTS_TOO_CLOSE 12 ///< 2 parallel track segments too close: segm ends between segref ends
#define DRCE_TRACKS_CROSSING 13 ///< tracks are crossing #define DRCE_TRACKS_CROSSING 13 ///< tracks are crossing
#define DRCE_ENDS_PROBLEM1 14 ///< track ends are too close #define DRCE_ENDS_PROBLEM1 14 ///< track ends are too close
#define DRCE_ENDS_PROBLEM2 15 ///< track ends are too close #define DRCE_ENDS_PROBLEM2 15 ///< track ends are too close
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -190,16 +190,19 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Width( EDGE_MODULE* aEdge ) ...@@ -190,16 +190,19 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Width( EDGE_MODULE* aEdge )
void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge ) void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge )
{ {
// note: if aEdge == NULL, all outline segments will be modified
MODULE* module = GetBoard()->m_Modules; MODULE* module = GetBoard()->m_Modules;
LAYER_NUM new_layer = SILKSCREEN_N_FRONT; LAYER_NUM layer = SILKSCREEN_N_FRONT;
bool modified = false;
if( aEdge ) if( aEdge )
new_layer = aEdge->GetLayer(); layer = aEdge->GetLayer();
// Ask for the new layer // Ask for the new layer
new_layer = SelectLayer( new_layer, FIRST_COPPER_LAYER, ECO2_N ); LAYER_NUM new_layer = SelectLayer(layer, EDGE_LAYER );
if( new_layer < 0 ) if( layer < 0 )
return; return;
if( IsCopperLayer( new_layer ) ) if( IsCopperLayer( new_layer ) )
...@@ -211,8 +214,6 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge ) ...@@ -211,8 +214,6 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge )
return; return;
} }
SaveCopyInUndoList( module, UR_MODEDIT );
if( aEdge == NULL ) if( aEdge == NULL )
{ {
aEdge = (EDGE_MODULE*) (BOARD_ITEM*) module->GraphicalItems(); aEdge = (EDGE_MODULE*) (BOARD_ITEM*) module->GraphicalItems();
...@@ -222,17 +223,27 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge ) ...@@ -222,17 +223,27 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge )
if( aEdge->Type() != PCB_MODULE_EDGE_T ) if( aEdge->Type() != PCB_MODULE_EDGE_T )
continue; continue;
if( aEdge->GetLayer() != new_layer )
{
if( ! modified ) // save only once
SaveCopyInUndoList( module, UR_MODEDIT );
aEdge->SetLayer( new_layer ); aEdge->SetLayer( new_layer );
modified = true;
} }
} }
else }
else if( aEdge->GetLayer() != new_layer )
{ {
SaveCopyInUndoList( module, UR_MODEDIT );
aEdge->SetLayer( new_layer ); aEdge->SetLayer( new_layer );
modified = true;
} }
OnModify(); if( modified )
{
module->CalculateBoundingBox(); module->CalculateBoundingBox();
module->SetLastEditTime(); module->SetLastEditTime();
}
} }
......
...@@ -95,7 +95,9 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -95,7 +95,9 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_BEGIN_TRACK: case ID_POPUP_PCB_BEGIN_TRACK:
case ID_POPUP_PCB_END_TRACK: case ID_POPUP_PCB_END_TRACK:
case ID_POPUP_PCB_PLACE_THROUGH_VIA: case ID_POPUP_PCB_PLACE_THROUGH_VIA:
case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA:
case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA: case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA:
case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA:
case ID_POPUP_PCB_PLACE_MICROVIA: case ID_POPUP_PCB_PLACE_MICROVIA:
case ID_POPUP_PCB_SWITCH_TRACK_POSTURE: case ID_POPUP_PCB_SWITCH_TRACK_POSTURE:
case ID_POPUP_PCB_IMPORT_PAD_SETTINGS: case ID_POPUP_PCB_IMPORT_PAD_SETTINGS:
...@@ -383,6 +385,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -383,6 +385,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
// fall through // fall through
case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA: case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA:
case ID_POPUP_PCB_PLACE_THROUGH_VIA: case ID_POPUP_PCB_PLACE_THROUGH_VIA:
case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA:
case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
if( GetCurItem()->IsDragging() ) if( GetCurItem()->IsDragging() )
...@@ -392,7 +396,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -392,7 +396,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
else else
{ {
int v_type = GetDesignSettings().m_CurrentViaType; int v_type = GetDesignSettings().m_CurrentViaType;
if( id == ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA ) if( id == ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA ||
id == ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA )
GetDesignSettings().m_CurrentViaType = VIA_BLIND_BURIED; GetDesignSettings().m_CurrentViaType = VIA_BLIND_BURIED;
else if( id == ID_POPUP_PCB_PLACE_MICROVIA ) else if( id == ID_POPUP_PCB_PLACE_MICROVIA )
GetDesignSettings().m_CurrentViaType = VIA_MICROVIA; GetDesignSettings().m_CurrentViaType = VIA_MICROVIA;
...@@ -400,7 +405,25 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -400,7 +405,25 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
GetDesignSettings().m_CurrentViaType = VIA_THROUGH; GetDesignSettings().m_CurrentViaType = VIA_THROUGH;
// place via and switch layer. // place via and switch layer.
if( id == ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA ||
id == ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA )
{
m_canvas->SetIgnoreMouseEvents( true );
LAYER_NUM layer = SelectLayer( getActiveLayer(), ALL_NO_CU_LAYERS );
m_canvas->SetIgnoreMouseEvents( false );
m_canvas->MoveCursorToCrossHair();
if( getActiveLayer() != layer )
{
GetScreen()->m_Route_Layer_TOP = getActiveLayer();
GetScreen()->m_Route_Layer_BOTTOM = layer;
Other_Layer_Route( (TRACK*) GetCurItem(), &dc ); Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
}
}
else
Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
GetDesignSettings().m_CurrentViaType = v_type; GetDesignSettings().m_CurrentViaType = v_type;
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
...@@ -922,7 +945,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -922,7 +945,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_SELECT_LAYER: case ID_POPUP_PCB_SELECT_LAYER:
itmp = SelectLayer( getActiveLayer(), UNDEFINED_LAYER, UNDEFINED_LAYER ); itmp = SelectLayer( getActiveLayer() );
if( itmp >= 0 ) if( itmp >= 0 )
{ {
...@@ -939,11 +962,11 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -939,11 +962,11 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR: case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
SelectLayerPair(); SelectCopperLayerPair();
break; break;
case ID_POPUP_PCB_SELECT_NO_CU_LAYER: case ID_POPUP_PCB_SELECT_NO_CU_LAYER:
itmp = SelectLayer( getActiveLayer(), FIRST_NON_COPPER_LAYER, UNDEFINED_LAYER ); itmp = SelectLayer( getActiveLayer(), ALL_CU_LAYERS );
if( itmp >= 0 ) if( itmp >= 0 )
setActiveLayer( itmp ); setActiveLayer( itmp );
...@@ -952,7 +975,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -952,7 +975,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_SELECT_CU_LAYER: case ID_POPUP_PCB_SELECT_CU_LAYER:
itmp = SelectLayer( getActiveLayer(), UNDEFINED_LAYER, LAST_COPPER_LAYER ); itmp = SelectLayer( getActiveLayer(), ALL_NO_CU_LAYERS );
if( itmp >= 0 ) if( itmp >= 0 )
setActiveLayer( itmp ); setActiveLayer( itmp );
...@@ -960,7 +983,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -960,7 +983,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_SELECT_LAYER_PAIR: case ID_POPUP_PCB_SELECT_LAYER_PAIR:
SelectLayerPair(); SelectCopperLayerPair();
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
break; break;
......
...@@ -61,8 +61,12 @@ static EDA_HOTKEY HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL ...@@ -61,8 +61,12 @@ static EDA_HOTKEY HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL
static EDA_HOTKEY HkBackspace( wxT( "Delete track segment" ), HK_BACK_SPACE, WXK_BACK ); static EDA_HOTKEY HkBackspace( wxT( "Delete track segment" ), HK_BACK_SPACE, WXK_BACK );
static EDA_HOTKEY HkAddNewTrack( wxT( "Add new track" ), HK_ADD_NEW_TRACK, 'X' ); static EDA_HOTKEY HkAddNewTrack( wxT( "Add new track" ), HK_ADD_NEW_TRACK, 'X' );
static EDA_HOTKEY HkAddThroughVia( wxT( "Add Through Via" ), HK_ADD_THROUGH_VIA, 'V' ); static EDA_HOTKEY HkAddThroughVia( wxT( "Add Through Via" ), HK_ADD_THROUGH_VIA, 'V' );
static EDA_HOTKEY HkSelLayerAndAddThroughVia( wxT( "Sel Layer and Add Through Via" ),
HK_SEL_LAYER_AND_ADD_THROUGH_VIA, '<' );
static EDA_HOTKEY HkAddMicroVia( wxT( "Add MicroVia" ), HK_ADD_MICROVIA, 'V' + GR_KB_CTRL ); static EDA_HOTKEY HkAddMicroVia( wxT( "Add MicroVia" ), HK_ADD_MICROVIA, 'V' + GR_KB_CTRL );
static EDA_HOTKEY HkAddBlindBuriedVia( wxT( "Add Blind/Buried Via" ), HK_ADD_BLIND_BURIED_VIA, 'V' + GR_KB_ALT ); static EDA_HOTKEY HkAddBlindBuriedVia( wxT( "Add Blind/Buried Via" ), HK_ADD_BLIND_BURIED_VIA, 'V' + GR_KB_ALT );
static EDA_HOTKEY HkSelLayerAndAddBlindBuriedVia( wxT( "Sel Layer and Add Blind/Buried Via" ),
HK_SEL_LAYER_AND_ADD_BLIND_BURIED_VIA, '<' + GR_KB_ALT );
static EDA_HOTKEY HkSwitchTrackPosture( wxT( "Switch Track Posture" ), HK_SWITCH_TRACK_POSTURE, '/' ); static EDA_HOTKEY HkSwitchTrackPosture( wxT( "Switch Track Posture" ), HK_SWITCH_TRACK_POSTURE, '/' );
static EDA_HOTKEY HkDragTrackKeepSlope( wxT( "Drag track keep slope" ), HK_DRAG_TRACK_KEEP_SLOPE, 'D' ); static EDA_HOTKEY HkDragTrackKeepSlope( wxT( "Drag track keep slope" ), HK_DRAG_TRACK_KEEP_SLOPE, 'D' );
static EDA_HOTKEY HkPlaceItem( wxT( "Place Item" ), HK_PLACE_ITEM, 'P' ); static EDA_HOTKEY HkPlaceItem( wxT( "Place Item" ), HK_PLACE_ITEM, 'P' );
...@@ -210,6 +214,7 @@ EDA_HOTKEY* board_edit_Hotkey_List[] = ...@@ -210,6 +214,7 @@ EDA_HOTKEY* board_edit_Hotkey_List[] =
&HkBackspace, &HkBackspace,
&HkAddNewTrack, &HkAddThroughVia, &HkAddBlindBuriedVia, &HkAddNewTrack, &HkAddThroughVia, &HkAddBlindBuriedVia,
&HkAddMicroVia, &HkAddMicroVia,
&HkSelLayerAndAddThroughVia, &HkSelLayerAndAddBlindBuriedVia,
&HkSwitchTrackPosture, &HkSwitchTrackPosture,
&HkDragTrackKeepSlope, &HkDragTrackKeepSlope,
&HkPlaceItem, &HkCopyItem, &HkPlaceItem, &HkCopyItem,
......
...@@ -22,7 +22,9 @@ enum hotkey_id_commnand { ...@@ -22,7 +22,9 @@ enum hotkey_id_commnand {
HK_LOCK_UNLOCK_FOOTPRINT, HK_LOCK_UNLOCK_FOOTPRINT,
HK_ADD_NEW_TRACK, HK_ADD_NEW_TRACK,
HK_ADD_THROUGH_VIA, HK_ADD_THROUGH_VIA,
HK_SEL_LAYER_AND_ADD_THROUGH_VIA,
HK_ADD_BLIND_BURIED_VIA, HK_ADD_BLIND_BURIED_VIA,
HK_SEL_LAYER_AND_ADD_BLIND_BURIED_VIA,
HK_ADD_MICROVIA, HK_ADD_MICROVIA,
HK_SWITCH_TRACK_POSTURE, HK_SWITCH_TRACK_POSTURE,
HK_DRAG_TRACK_KEEP_SLOPE, HK_DRAG_TRACK_KEEP_SLOPE,
......
...@@ -88,7 +88,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -88,7 +88,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
if( aHotkeyCode == 0 ) if( aHotkeyCode == 0 )
return; return;
bool itemCurrentlyEdited = (GetCurItem() && GetCurItem()->GetFlags()); bool itemCurrentlyEdited = GetCurItem() && GetCurItem()->GetFlags();
MODULE* module = NULL; MODULE* module = NULL;
int evt_type = 0; //Used to post a wxCommandEvent on demand int evt_type = 0; //Used to post a wxCommandEvent on demand
PCB_SCREEN* screen = GetScreen(); PCB_SCREEN* screen = GetScreen();
...@@ -374,7 +374,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -374,7 +374,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
break; break;
case HK_BACK_SPACE: case HK_BACK_SPACE:
if( /*m_ID_current_state == ID_TRACK_BUTT &&*/ (getActiveLayer() <= LAYER_N_FRONT) ) if( IsCopperLayer( getActiveLayer() ) )
{ {
if( !itemCurrentlyEdited ) if( !itemCurrentlyEdited )
{ {
...@@ -487,6 +487,17 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -487,6 +487,17 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA : ID_POPUP_PCB_PLACE_THROUGH_VIA; ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA : ID_POPUP_PCB_PLACE_THROUGH_VIA;
break; break;
case HK_SEL_LAYER_AND_ADD_THROUGH_VIA:
case HK_SEL_LAYER_AND_ADD_BLIND_BURIED_VIA:
if( GetCurItem() == NULL || !GetCurItem()->IsNew() ||
GetCurItem()->Type() != PCB_TRACE_T )
break;
evt_type = hk_id == HK_SEL_LAYER_AND_ADD_BLIND_BURIED_VIA ?
ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA :
ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA;
break;
case HK_SWITCH_TRACK_POSTURE: case HK_SWITCH_TRACK_POSTURE:
/* change the position of initial segment when creating new tracks /* change the position of initial segment when creating new tracks
* switch from _/ to -\ . * switch from _/ to -\ .
......
...@@ -367,9 +367,10 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -367,9 +367,10 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break; break;
case ID_PCB_DIMENSION_BUTT: case ID_PCB_DIMENSION_BUTT:
if( IsCopperLayer( getActiveLayer() ) ) if( IsLayerInList( EDGE_LAYER|ALL_CU_LAYERS ,getActiveLayer() ) )
{ {
DisplayError( this, _( "Dimension not allowed on Copper layers" ) ); DisplayError( this,
_( "Dimension not allowed on Copper or Edge Cut layers" ) );
break; break;
} }
......
This diff is collapsed.
...@@ -121,7 +121,9 @@ enum pcbnew_ids ...@@ -121,7 +121,9 @@ enum pcbnew_ids
ID_POPUP_PCB_EDIT_DIMENSION, ID_POPUP_PCB_EDIT_DIMENSION,
ID_POPUP_PCB_END_TRACK, ID_POPUP_PCB_END_TRACK,
ID_POPUP_PCB_PLACE_THROUGH_VIA, ID_POPUP_PCB_PLACE_THROUGH_VIA,
ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA,
ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA, ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA,
ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA,
ID_POPUP_PCB_PLACE_MICROVIA, ID_POPUP_PCB_PLACE_MICROVIA,
ID_POPUP_PCB_SWITCH_TRACK_POSTURE, ID_POPUP_PCB_SWITCH_TRACK_POSTURE,
......
This diff is collapsed.
...@@ -195,12 +195,11 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( PCB_BASE_FRAME* parent ) : ...@@ -195,12 +195,11 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( PCB_BASE_FRAME* parent ) :
item_ID = ID_TEXT_0 + ii; item_ID = ID_TEXT_0 + ii;
/* When the first of these text strings is being added, determine /* When the first of these text strings is being added, determine
* what size is necessary to to be able to display any possible * what size is necessary to to be able to display the longest
* string without it being truncated. Then specify that size as the * string without truncation. Then use that size as the
* minimum size for all of these text strings. (If this minimum * minimum size for all text strings. (If the minimum
* size is not determined in this fashion, then it is possible for * size is not this size, strings can be truncated after
* the display of one or more of these strings to be truncated after * some other layer is selected.)
* different layers are selected.)
*/ */
if( ii == 0 ) if( ii == 0 )
{ {
...@@ -235,8 +234,8 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( PCB_BASE_FRAME* parent ) : ...@@ -235,8 +234,8 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( PCB_BASE_FRAME* parent ) :
} }
/* Provide spacers to occupy otherwise blank cells within the second /* Provide spacers to occupy otherwise blank cells within the second
* FlexGrid sizer. (As it incorporates three columns, three spacers * FlexGrid sizer. (Becuse there are three columns, three spacers
* are thus required for each otherwise unused row.) * are thus required for each unused row.)
*/ */
for( int ii = 3 * NB_PCB_LAYERS; ii < 96; ii++ ) for( int ii = 3 * NB_PCB_LAYERS; ii < 96; ii++ )
{ {
...@@ -289,28 +288,16 @@ void WinEDA_SwapLayerFrame::Sel_Layer( wxCommandEvent& event ) ...@@ -289,28 +288,16 @@ void WinEDA_SwapLayerFrame::Sel_Layer( wxCommandEvent& event )
if( (jj < 0) || (jj > NB_PCB_LAYERS) ) if( (jj < 0) || (jj > NB_PCB_LAYERS) )
jj = LAYER_NO_CHANGE; // (Defaults to "No Change".) jj = LAYER_NO_CHANGE; // (Defaults to "No Change".)
jj = m_Parent->SelectLayer( jj, UNDEFINED_LAYER, UNDEFINED_LAYER, true ); jj = m_Parent->SelectLayer( jj );
if( !IsValidLayer( jj ) ) if( !IsValidLayer( jj ) )
return; return;
// No change if the selected layer matches the layer being edited.
// (Hence the only way to restore a layer to the "No Change"
// state is by specifically deselecting it; any attempt
// to select the same layer (instead) will be ignored.)
if( jj == ii )
{
wxString msg;
msg = _( "Deselect this layer to select the No Change state" );
DisplayInfoMessage( this, msg );
return;
}
if( jj != New_Layer[ii] ) if( jj != New_Layer[ii] )
{ {
New_Layer[ii] = jj; New_Layer[ii] = jj;
if( jj >= LAYER_NO_CHANGE ) if( jj >= LAYER_NO_CHANGE || jj == ii )
{ {
layer_list[ii]->SetLabel( _( "No Change" ) ); layer_list[ii]->SetLabel( _( "No Change" ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment