Save order of all-layers in Plot Dialog.

Also adds an all-layers-specific context menu which includes an item
to sort in board-stackup order.
This commit is contained in:
Jeff Young 2023-11-06 19:56:20 +00:00
parent 1bbe532021
commit 5f6dab931a
5 changed files with 190 additions and 195 deletions

View File

@ -50,8 +50,9 @@
#include <wx/dirdlg.h> #include <wx/dirdlg.h>
LSET DIALOG_PLOT::m_lastLayerSet; LSET DIALOG_PLOT::s_lastLayerSet;
LSEQ DIALOG_PLOT::m_lastPlotOnAllLayersOrder; LSET DIALOG_PLOT::s_lastAllLayersSet;
LSEQ DIALOG_PLOT::s_lastAllLayersOrder;
/** /**
@ -60,18 +61,28 @@ LSEQ DIALOG_PLOT::m_lastPlotOnAllLayersOrder;
class PCB_LAYER_ID_CLIENT_DATA : public wxClientData class PCB_LAYER_ID_CLIENT_DATA : public wxClientData
{ {
public: public:
PCB_LAYER_ID_CLIENT_DATA() : m_id( UNDEFINED_LAYER ) { } PCB_LAYER_ID_CLIENT_DATA() :
PCB_LAYER_ID_CLIENT_DATA( PCB_LAYER_ID aId ) : m_id( aId ) { } m_id( UNDEFINED_LAYER )
{ }
PCB_LAYER_ID_CLIENT_DATA( PCB_LAYER_ID aId ) :
m_id( aId )
{ }
void SetData( PCB_LAYER_ID aId ) { m_id = aId; } void SetData( PCB_LAYER_ID aId ) { m_id = aId; }
PCB_LAYER_ID Layer() const { return m_id; }
PCB_LAYER_ID GetData() const { return m_id; }
private: private:
PCB_LAYER_ID m_id; PCB_LAYER_ID m_id;
}; };
PCB_LAYER_ID_CLIENT_DATA* getLayerClientData( const wxRearrangeList* aList, int aIdx )
{
return static_cast<PCB_LAYER_ID_CLIENT_DATA*>( aList->GetClientObject( aIdx ) );
}
DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) : DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
DIALOG_PLOT_BASE( aParent ), DIALOG_PLOT_BASE( aParent ),
m_parent( aParent ), m_parent( aParent ),
@ -93,7 +104,7 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
std::vector<PCB_LAYER_ID> layersIdChoiceList; std::vector<PCB_LAYER_ID> layersIdChoiceList;
int textWidth = 0; int textWidth = 0;
for( LSEQ seq = board->GetEnabledLayers().UIOrder(); seq; ++seq ) for( LSEQ seq = board->GetEnabledLayers().SeqStackupBottom2Top(); seq; ++seq )
{ {
PCB_LAYER_ID id = *seq; PCB_LAYER_ID id = *seq;
wxString layerName = board->GetLayerName( id ); wxString layerName = board->GetLayerName( id );
@ -149,7 +160,7 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
m_plotAllLayersList->SetClientObject( list_idx, new PCB_LAYER_ID_CLIENT_DATA( layer_id ) ); m_plotAllLayersList->SetClientObject( list_idx, new PCB_LAYER_ID_CLIENT_DATA( layer_id ) );
} }
sbSizer->Add( m_plotAllLayersList, 1, wxALL | wxEXPAND, 5 ); sbSizer->Add( m_plotAllLayersList, 1, wxALL | wxEXPAND, 3 );
wxBoxSizer* bButtonSizer; wxBoxSizer* bButtonSizer;
bButtonSizer = new wxBoxSizer( wxHORIZONTAL ); bButtonSizer = new wxBoxSizer( wxHORIZONTAL );
@ -159,7 +170,7 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
m_bpMoveUp->SetToolTip( _( "Move current selection up" ) ); m_bpMoveUp->SetToolTip( _( "Move current selection up" ) );
m_bpMoveUp->SetBitmap( KiBitmapBundle( BITMAPS::small_up ) ); m_bpMoveUp->SetBitmap( KiBitmapBundle( BITMAPS::small_up ) );
bButtonSizer->Add( m_bpMoveUp, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5 ); bButtonSizer->Add( m_bpMoveUp, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 3 );
m_bpMoveDown = new STD_BITMAP_BUTTON( sbSizer->GetStaticBox(), wxID_ANY, wxNullBitmap, m_bpMoveDown = new STD_BITMAP_BUTTON( sbSizer->GetStaticBox(), wxID_ANY, wxNullBitmap,
wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW | 0 ); wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW | 0 );
@ -168,9 +179,9 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
bButtonSizer->Add( m_bpMoveDown, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5 ); bButtonSizer->Add( m_bpMoveDown, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5 );
sbSizer->Add( bButtonSizer, 0, wxALL | wxEXPAND, 5 ); sbSizer->Add( bButtonSizer, 0, wxALL | wxEXPAND, 3 );
bmiddleSizer->Insert( 1, sbSizer, 1, wxALL | wxEXPAND, 3 ); bmiddleSizer->Insert( 1, sbSizer, 1, wxALL | wxEXPAND, 5 );
init_Dialog(); init_Dialog();
@ -183,11 +194,24 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
m_bpMoveUp->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveUp, this ); m_bpMoveUp->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveUp, this );
m_bpMoveDown->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveDown, this ); m_bpMoveDown->Bind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveDown, this );
m_layerCheckListBox->Connect( wxEVT_RIGHT_DOWN,
wxMouseEventHandler( DIALOG_PLOT::OnRightClickLayers ), nullptr,
this );
m_plotAllLayersList->Connect( wxEVT_RIGHT_DOWN,
wxMouseEventHandler( DIALOG_PLOT::OnRightClickAllLayers ), nullptr,
this );
} }
DIALOG_PLOT::~DIALOG_PLOT() DIALOG_PLOT::~DIALOG_PLOT()
{ {
s_lastAllLayersOrder.clear();
for( int ii = 0; ii < (int) m_plotAllLayersList->GetCount(); ++ii )
s_lastAllLayersOrder.push_back( getLayerClientData( m_plotAllLayersList, ii )->Layer() );
m_bpMoveDown->Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveDown, this ); m_bpMoveDown->Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveDown, this );
m_bpMoveUp->Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveUp, this ); m_bpMoveUp->Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &DIALOG_PLOT::onPlotAllListMoveUp, this );
} }
@ -271,6 +295,8 @@ void DIALOG_PLOT::init_Dialog()
m_layerCheckListBox->Check( checkIndex ); m_layerCheckListBox->Check( checkIndex );
} }
arrangeAllLayersList( s_lastAllLayersOrder );
// Option for disabling Gerber Aperture Macro (for broken Gerber readers) // Option for disabling Gerber Aperture Macro (for broken Gerber readers)
m_disableApertMacros->SetValue( m_plotOpts.GetDisableGerberMacros() ); m_disableApertMacros->SetValue( m_plotOpts.GetDisableGerberMacros() );
@ -400,22 +426,68 @@ void DIALOG_PLOT::reInitDialog()
} }
// A helper function to show a popup menu, when the dialog is right clicked. void DIALOG_PLOT::arrangeAllLayersList( const LSEQ& aSeq )
void DIALOG_PLOT::OnRightClick( wxMouseEvent& event )
{ {
PopupMenu( m_popMenu ); auto findLayer =
[&]( wxRearrangeList* aList, PCB_LAYER_ID aLayer ) -> int
{
for( int ii = 0; ii < (int) aList->GetCount(); ++ii )
{
if( getLayerClientData( aList, ii )->Layer() == aLayer )
return ii;
}
return -1;
};
int idx = 0;
for( LSEQ seq = aSeq; seq; ++seq, ++idx )
{
int currentPos = findLayer( m_plotAllLayersList, *seq );
while( currentPos > idx )
{
m_plotAllLayersList->Select( currentPos );
m_plotAllLayersList->MoveCurrentUp();
currentPos--;
}
}
} }
// Select or deselect groups of layers in the layers list: #define ID_LAYER_FAB 13001
void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event ) #define ID_SELECT_COPPER_LAYERS 13002
#define ID_DESELECT_COPPER_LAYERS 13003
#define ID_SELECT_ALL_LAYERS 13004
#define ID_DESELECT_ALL_LAYERS 13005
#define ID_STACKUP_ORDER 13006
// A helper function to show a popup menu, when the dialog is right clicked.
void DIALOG_PLOT::OnRightClickLayers( wxMouseEvent& event )
{ {
// Build a list of layers for usual fabrication: copper layers + tech layers without courtyard // Build a list of layers for usual fabrication: copper layers + tech layers without courtyard
LSET fab_layer_set = ( LSET::AllCuMask() | LSET::AllTechMask() ) & ~LSET( 2, B_CrtYd, F_CrtYd ); LSET fab_layer_set = ( LSET::AllCuMask() | LSET::AllTechMask() ) & ~LSET( 2, B_CrtYd, F_CrtYd );
switch( event.GetId() ) wxMenu menu;
menu.Append( new wxMenuItem( &menu, ID_LAYER_FAB, _( "Select Fab Layers" ) ) );
menu.AppendSeparator();
menu.Append( new wxMenuItem( &menu, ID_SELECT_COPPER_LAYERS, _( "Select All Copper Layers" ) ) );
menu.Append( new wxMenuItem( &menu, ID_DESELECT_COPPER_LAYERS, _( "Deselect All Copper Layers" ) ) );
menu.AppendSeparator();
menu.Append( new wxMenuItem( &menu, ID_SELECT_ALL_LAYERS, _( "Select All Layers" ) ) );
menu.Append( new wxMenuItem( &menu, ID_DESELECT_ALL_LAYERS, _( "Deselect All Layers" ) ) );
menu.Bind( wxEVT_COMMAND_MENU_SELECTED,
[&]( wxCommandEvent& aCmd )
{
switch( aCmd.GetId() )
{ {
case ID_LAYER_FAB: // Select layers usually needed to build a board case ID_LAYER_FAB: // Select layers usually needed to build a board
{
for( unsigned i = 0; i < m_layerList.size(); i++ ) for( unsigned i = 0; i < m_layerList.size(); i++ )
{ {
LSET layermask( m_layerList[ i ] ); LSET layermask( m_layerList[ i ] );
@ -427,6 +499,7 @@ void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event )
} }
break; break;
}
case ID_SELECT_COPPER_LAYERS: case ID_SELECT_COPPER_LAYERS:
for( unsigned i = 0; i < m_layerList.size(); i++ ) for( unsigned i = 0; i < m_layerList.size(); i++ )
@ -459,8 +532,54 @@ void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event )
break; break;
default: default:
aCmd.Skip();
}
} );
PopupMenu( &menu );
}
void DIALOG_PLOT::OnRightClickAllLayers( wxMouseEvent& event )
{
wxMenu menu;
menu.Append( new wxMenuItem( &menu, ID_SELECT_ALL_LAYERS, _( "Select All Layers" ) ) );
menu.Append( new wxMenuItem( &menu, ID_DESELECT_ALL_LAYERS, _( "Deselect All Layers" ) ) );
menu.AppendSeparator();
menu.Append( new wxMenuItem( &menu, ID_STACKUP_ORDER, _( "Order as Board Stackup" ) ) );
menu.Bind( wxEVT_COMMAND_MENU_SELECTED,
[&]( wxCommandEvent& aCmd )
{
switch( aCmd.GetId() )
{
case ID_SELECT_ALL_LAYERS:
for( unsigned i = 0; i < m_plotAllLayersList->GetCount(); i++ )
m_plotAllLayersList->Check( i, true );
break;
case ID_DESELECT_ALL_LAYERS:
for( unsigned i = 0; i < m_plotAllLayersList->GetCount(); i++ )
m_plotAllLayersList->Check( i, false );
break;
case ID_STACKUP_ORDER:
{
LSEQ stackup = m_parent->GetBoard()->GetEnabledLayers().SeqStackupBottom2Top();
arrangeAllLayersList( stackup );
m_plotAllLayersList->Select( -1 );
break; break;
} }
default:
aCmd.Skip();
}
} );
PopupMenu( &menu );
} }
@ -926,7 +1045,7 @@ void DIALOG_PLOT::applyPlotSettings()
wxCHECK2( layerId, continue ); wxCHECK2( layerId, continue );
plotOnAllLayers.set( layerId->GetData() ); plotOnAllLayers.set( layerId->Layer() );
} }
tempOptions.SetPlotOnAllLayersSelection( plotOnAllLayers ); tempOptions.SetPlotOnAllLayersSelection( plotOnAllLayers );
@ -1072,17 +1191,13 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
for( size_t i = 0; i < count; i++ ) for( size_t i = 0; i < count; i++ )
{ {
int index = plotOnAllLayers.Item( i ); int index = plotOnAllLayers.Item( i );
wxClientData* tmp = m_plotAllLayersList->GetClientObject( index ); PCB_LAYER_ID layer = getLayerClientData( m_plotAllLayersList, index )->Layer();
PCB_LAYER_ID_CLIENT_DATA* layerId = dynamic_cast<PCB_LAYER_ID_CLIENT_DATA*>( tmp );
wxCHECK2( layerId, continue );
// Don't plot the same layer more than once; // Don't plot the same layer more than once;
if( find( plotSequence.begin(), plotSequence.end(), layerId->GetData() ) != if( find( plotSequence.begin(), plotSequence.end(), layer ) != plotSequence.end() )
plotSequence.end() )
continue; continue;
plotSequence.push_back( layerId->GetData() ); plotSequence.push_back( layer );
} }
} }

View File

@ -47,8 +47,8 @@ private:
// Event called functions // Event called functions
void Plot( wxCommandEvent& event ) override; void Plot( wxCommandEvent& event ) override;
void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) override; void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) override;
void OnRightClick( wxMouseEvent& event ) override; void OnRightClickLayers( wxMouseEvent& event );
void OnPopUpLayers( wxCommandEvent& event ) override; void OnRightClickAllLayers( wxMouseEvent& event );
void SetPlotFormat( wxCommandEvent& event ) override; void SetPlotFormat( wxCommandEvent& event ) override;
void OnChangeDXFPlotMode( wxCommandEvent& event ) override; void OnChangeDXFPlotMode( wxCommandEvent& event ) override;
void OnSetScaleOpt( wxCommandEvent& event ) override; void OnSetScaleOpt( wxCommandEvent& event ) override;
@ -75,6 +75,9 @@ private:
m_plotModeOpt->SetSelection( aPlotMode == SKETCH ? 1 : 0 ); m_plotModeOpt->SetSelection( aPlotMode == SKETCH ? 1 : 0 );
} }
void arrangeAllLayersList( const LSEQ& aSeq );
private:
PCB_EDIT_FRAME* m_parent; PCB_EDIT_FRAME* m_parent;
LSEQ m_layerList; // List to hold CheckListBox layer numbers LSEQ m_layerList; // List to hold CheckListBox layer numbers
double m_XScaleAdjust; // X scale factor adjust to compensate double m_XScaleAdjust; // X scale factor adjust to compensate
@ -101,8 +104,9 @@ private:
STD_BITMAP_BUTTON* m_bpMoveDown; STD_BITMAP_BUTTON* m_bpMoveDown;
/// The plot layer set that last time the dialog was opened. /// The plot layer set that last time the dialog was opened.
static LSET m_lastLayerSet; static LSET s_lastLayerSet;
static LSET s_lastAllLayersSet;
/// The plot on all layers ordering the last time the dialog was opened. /// The plot on all layers ordering the last time the dialog was opened.
static LSEQ m_lastPlotOnAllLayersOrder; static LSEQ s_lastAllLayersOrder;
}; };

View File

@ -57,10 +57,10 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
m_layerCheckListBox = new wxCheckListBox( m_LayersSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_layerCheckListBoxChoices, 0 ); m_layerCheckListBox = new wxCheckListBox( m_LayersSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_layerCheckListBoxChoices, 0 );
m_layerCheckListBox->SetMinSize( wxSize( 150,-1 ) ); m_layerCheckListBox->SetMinSize( wxSize( 150,-1 ) );
m_LayersSizer->Add( m_layerCheckListBox, 1, wxALL|wxEXPAND, 5 ); m_LayersSizer->Add( m_layerCheckListBox, 1, wxALL|wxEXPAND, 3 );
bmiddleSizer->Add( m_LayersSizer, 1, wxALL|wxEXPAND, 3 ); bmiddleSizer->Add( m_LayersSizer, 1, wxALL|wxEXPAND, 5 );
m_PlotOptionsSizer = new wxBoxSizer( wxVERTICAL ); m_PlotOptionsSizer = new wxBoxSizer( wxVERTICAL );
@ -463,38 +463,13 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
this->SetSizer( m_MainSizer ); this->SetSizer( m_MainSizer );
this->Layout(); this->Layout();
m_MainSizer->Fit( this ); m_MainSizer->Fit( this );
m_popMenu = new wxMenu();
wxMenuItem* m_menuItem1;
m_menuItem1 = new wxMenuItem( m_popMenu, ID_LAYER_FAB, wxString( _("Select Fab Layers") ) , wxEmptyString, wxITEM_NORMAL );
m_popMenu->Append( m_menuItem1 );
wxMenuItem* m_menuItem2;
m_menuItem2 = new wxMenuItem( m_popMenu, ID_SELECT_COPPER_LAYERS, wxString( _("Select all Copper Layers") ) , wxEmptyString, wxITEM_NORMAL );
m_popMenu->Append( m_menuItem2 );
wxMenuItem* m_menuItem3;
m_menuItem3 = new wxMenuItem( m_popMenu, ID_DESELECT_COPPER_LAYERS, wxString( _("Deselect all Copper Layers") ) , wxEmptyString, wxITEM_NORMAL );
m_popMenu->Append( m_menuItem3 );
wxMenuItem* m_menuItem4;
m_menuItem4 = new wxMenuItem( m_popMenu, ID_SELECT_ALL_LAYERS, wxString( _("Select all Layers") ) , wxEmptyString, wxITEM_NORMAL );
m_popMenu->Append( m_menuItem4 );
wxMenuItem* m_menuItem5;
m_menuItem5 = new wxMenuItem( m_popMenu, ID_DESELECT_ALL_LAYERS, wxString( _("Deselect all Layers") ) , wxEmptyString, wxITEM_NORMAL );
m_popMenu->Append( m_menuItem5 );
this->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( DIALOG_PLOT_BASE::DIALOG_PLOT_BASEOnContextMenu ), NULL, this );
this->Centre( wxBOTH ); this->Centre( wxBOTH );
// Connect Events // Connect Events
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PLOT_BASE::OnInitDialog ) ); this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PLOT_BASE::OnInitDialog ) );
this->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( DIALOG_PLOT_BASE::OnRightClick ) );
m_plotFormatOpt->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::SetPlotFormat ), NULL, this ); m_plotFormatOpt->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::SetPlotFormat ), NULL, this );
m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnOutputDirectoryBrowseClicked ), NULL, this ); m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
m_layerCheckListBox->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( DIALOG_PLOT_BASE::OnRightClick ), NULL, this );
m_plotFootprintValues->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onPlotFPValues ), NULL, this ); m_plotFootprintValues->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onPlotFPValues ), NULL, this );
m_plotFootprintRefs->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onPlotFPRefs ), NULL, this ); m_plotFootprintRefs->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onPlotFPRefs ), NULL, this );
m_plotFootprintText->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onPlotFPText ), NULL, this ); m_plotFootprintText->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onPlotFPText ), NULL, this );
@ -505,21 +480,14 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
m_buttonDRC->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onRunDRC ), NULL, this ); m_buttonDRC->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onRunDRC ), NULL, this );
m_sdbSizer1Apply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::CreateDrillFile ), NULL, this ); m_sdbSizer1Apply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::CreateDrillFile ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::Plot ), NULL, this ); m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::Plot ), NULL, this );
m_popMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnPopUpLayers ), this, m_menuItem1->GetId());
m_popMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnPopUpLayers ), this, m_menuItem2->GetId());
m_popMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnPopUpLayers ), this, m_menuItem3->GetId());
m_popMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnPopUpLayers ), this, m_menuItem4->GetId());
m_popMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnPopUpLayers ), this, m_menuItem5->GetId());
} }
DIALOG_PLOT_BASE::~DIALOG_PLOT_BASE() DIALOG_PLOT_BASE::~DIALOG_PLOT_BASE()
{ {
// Disconnect Events // Disconnect Events
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PLOT_BASE::OnInitDialog ) ); this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_PLOT_BASE::OnInitDialog ) );
this->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( DIALOG_PLOT_BASE::OnRightClick ) );
m_plotFormatOpt->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::SetPlotFormat ), NULL, this ); m_plotFormatOpt->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::SetPlotFormat ), NULL, this );
m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnOutputDirectoryBrowseClicked ), NULL, this ); m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
m_layerCheckListBox->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( DIALOG_PLOT_BASE::OnRightClick ), NULL, this );
m_plotFootprintValues->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onPlotFPValues ), NULL, this ); m_plotFootprintValues->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onPlotFPValues ), NULL, this );
m_plotFootprintRefs->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onPlotFPRefs ), NULL, this ); m_plotFootprintRefs->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onPlotFPRefs ), NULL, this );
m_plotFootprintText->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onPlotFPText ), NULL, this ); m_plotFootprintText->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::onPlotFPText ), NULL, this );
@ -531,5 +499,4 @@ DIALOG_PLOT_BASE::~DIALOG_PLOT_BASE()
m_sdbSizer1Apply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::CreateDrillFile ), NULL, this ); m_sdbSizer1Apply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::CreateDrillFile ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::Plot ), NULL, this ); m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::Plot ), NULL, this );
delete m_popMenu;
} }

View File

@ -57,7 +57,6 @@
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnInitDialog">OnInitDialog</event> <event name="OnInitDialog">OnInitDialog</event>
<event name="OnRightDown">OnRightClick</event>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_MainSizer</property> <property name="name">m_MainSizer</property>
@ -419,7 +418,7 @@
<property name="orient">wxHORIZONTAL</property> <property name="orient">wxHORIZONTAL</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">3</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1"> <object class="wxStaticBoxSizer" expanded="1">
@ -431,7 +430,7 @@
<property name="parent">1</property> <property name="parent">1</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">3</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxCheckListBox" expanded="1"> <object class="wxCheckListBox" expanded="1">
@ -491,7 +490,6 @@
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnRightDown">OnRightClick</event>
</object> </object>
</object> </object>
</object> </object>
@ -4407,81 +4405,6 @@
</object> </object>
</object> </object>
</object> </object>
<object class="wxMenu" expanded="0">
<property name="label">MyMenu</property>
<property name="name">m_popMenu</property>
<property name="permission">protected</property>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help"></property>
<property name="id">ID_LAYER_FAB</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">Select Fab Layers</property>
<property name="name">m_menuItem1</property>
<property name="permission">none</property>
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnPopUpLayers</event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help"></property>
<property name="id">ID_SELECT_COPPER_LAYERS</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">Select all Copper Layers</property>
<property name="name">m_menuItem2</property>
<property name="permission">none</property>
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnPopUpLayers</event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help"></property>
<property name="id">ID_DESELECT_COPPER_LAYERS</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">Deselect all Copper Layers</property>
<property name="name">m_menuItem3</property>
<property name="permission">none</property>
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnPopUpLayers</event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help"></property>
<property name="id">ID_SELECT_ALL_LAYERS</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">Select all Layers</property>
<property name="name">m_menuItem4</property>
<property name="permission">none</property>
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnPopUpLayers</event>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help"></property>
<property name="id">ID_DESELECT_ALL_LAYERS</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">Deselect all Layers</property>
<property name="name">m_menuItem5</property>
<property name="permission">none</property>
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection">OnPopUpLayers</event>
</object>
</object>
</object> </object>
</object> </object>
</wxFormBuilder_Project> </wxFormBuilder_Project>

View File

@ -36,7 +36,6 @@ class WX_HTML_REPORT_PANEL;
#include <wx/hyperlink.h> #include <wx/hyperlink.h>
#include <wx/spinctrl.h> #include <wx/spinctrl.h>
#include <wx/panel.h> #include <wx/panel.h>
#include <wx/menu.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -53,12 +52,7 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
{ {
ID_PRINT_REF = 1000, ID_PRINT_REF = 1000,
ID_ALLOW_PRINT_PAD_ON_SILKSCREEN, ID_ALLOW_PRINT_PAD_ON_SILKSCREEN,
ID_MIROR_OPT, ID_MIROR_OPT
ID_LAYER_FAB,
ID_SELECT_COPPER_LAYERS,
ID_DESELECT_COPPER_LAYERS,
ID_SELECT_ALL_LAYERS,
ID_DESELECT_ALL_LAYERS
}; };
wxBoxSizer* m_MainSizer; wxBoxSizer* m_MainSizer;
@ -138,11 +132,9 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Apply; wxButton* m_sdbSizer1Apply;
wxButton* m_sdbSizer1Cancel; wxButton* m_sdbSizer1Cancel;
wxMenu* m_popMenu;
// Virtual event handlers, override them in your derived class // Virtual event handlers, override them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); } virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnRightClick( wxMouseEvent& event ) { event.Skip(); }
virtual void SetPlotFormat( wxCommandEvent& event ) { event.Skip(); } virtual void SetPlotFormat( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); } virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void onPlotFPValues( wxCommandEvent& event ) { event.Skip(); } virtual void onPlotFPValues( wxCommandEvent& event ) { event.Skip(); }
@ -155,7 +147,6 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
virtual void onRunDRC( wxCommandEvent& event ) { event.Skip(); } virtual void onRunDRC( wxCommandEvent& event ) { event.Skip(); }
virtual void CreateDrillFile( wxCommandEvent& event ) { event.Skip(); } virtual void CreateDrillFile( wxCommandEvent& event ) { event.Skip(); }
virtual void Plot( wxCommandEvent& event ) { event.Skip(); } virtual void Plot( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPopUpLayers( wxCommandEvent& event ) { event.Skip(); }
public: public:
@ -164,10 +155,5 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
~DIALOG_PLOT_BASE(); ~DIALOG_PLOT_BASE();
void DIALOG_PLOT_BASEOnContextMenu( wxMouseEvent &event )
{
this->PopupMenu( m_popMenu, event.GetPosition() );
}
}; };