Commit 72e845b2 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: plot Dialog: add a popup menu (try mouse right click in plot dialog)...

Pcbnew: plot Dialog: add a popup menu (try mouse right click in plot dialog) to selected/unselect groups of layers to plot.
All: For new zoom centering option: use Shift+Ctrl key instead of Alt key to select the new zoom centering, because Alt key has a special function under Windows.
2 very minor other changes.
parent 55526a10
......@@ -7,9 +7,9 @@
#ifndef KICAD_BUILD_VERSION
#if defined KICAD_GOST
# define KICAD_BUILD_VERSION "(2012-nov-02 GOST)"
# define KICAD_BUILD_VERSION "(2013-feb-21 GOST)"
#else
# define KICAD_BUILD_VERSION "(2012-nov-02)"
# define KICAD_BUILD_VERSION "(2013-feb-21)"
#endif
#endif
......
......@@ -877,7 +877,8 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
cmd.SetId( ID_PAN_UP );
else if( event.ControlDown() && !event.ShiftDown() )
cmd.SetId( ID_PAN_LEFT );
else if( event.AltDown() || m_enableZoomNoCenter)
else if( (event.ControlDown() && event.ShiftDown() )
|| m_enableZoomNoCenter)
cmd.SetId( ID_OFFCENTER_ZOOM_IN );
else
cmd.SetId( ID_POPUP_ZOOM_IN );
......
......@@ -159,7 +159,7 @@ void DIALOG_PLOT::Init_Dialog()
if( !m_board->IsLayerEnabled( layer ) )
continue;
layerList.push_back( layer );
m_layerList.push_back( layer );
checkIndex = m_layerCheckListBox->Append( m_board->GetLayerName( layer ) );
if( m_plotOpts.GetLayerSelection() & ( 1 << layer ) )
......@@ -223,6 +223,68 @@ void DIALOG_PLOT::OnClose( wxCloseEvent& event )
EndModal( 0 );
}
// A helper function to show a popup menu, when the dialog is right clicked.
void DIALOG_PLOT::OnRightClick( wxMouseEvent& event )
{
PopupMenu( m_popMenu );
}
// Select or deselect groups of layers in the layers list:
#include <layers_id_colors_and_visibility.h>
void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event )
{
unsigned int i;
switch( event.GetId() )
{
case ID_LAYER_FAB: // Select layers usually neede d to build a board
for( i = 0; i < m_layerList.size(); i++ )
{
long layermask = 1 << m_layerList[ i ];
if( ( layermask &
( ALL_CU_LAYERS | SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT |
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT |
SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT ) )
!= 0 )
m_layerCheckListBox->Check( i, true );
else
m_layerCheckListBox->Check( i, false );
}
break;
case ID_SELECT_COPPER_LAYERS:
for( i = 0; i < m_layerList.size(); i++ )
{
if( m_layerList[i] <= LAST_COPPER_LAYER )
m_layerCheckListBox->Check( i, true );
}
break;
case ID_DESELECT_COPPER_LAYERS:
for( i = 0; i < m_layerList.size(); i++ )
{
if( m_layerList[i] <= LAST_COPPER_LAYER )
m_layerCheckListBox->Check( i, false );
}
break;
case ID_SELECT_ALL_LAYERS:
for( i = 0; i < m_layerList.size(); i++ )
m_layerCheckListBox->Check( i, true );
break;
case ID_DESELECT_ALL_LAYERS:
for( i = 0; i < m_layerList.size(); i++ )
m_layerCheckListBox->Check( i, false );
break;
default:
break;
}
}
void DIALOG_PLOT::CreateDrillFile( wxCommandEvent& event )
{
......@@ -608,10 +670,10 @@ void DIALOG_PLOT::applyPlotSettings()
long selectedLayers = 0;
unsigned int i;
for( i = 0; i < layerList.size(); i++ )
for( i = 0; i < m_layerList.size(); i++ )
{
if( m_layerCheckListBox->IsChecked( i ) )
selectedLayers |= (1 << layerList[i]);
selectedLayers |= (1 << m_layerList[i]);
}
tempOptions.SetLayerSelection( selectedLayers );
......
......@@ -43,7 +43,7 @@ private:
BOARD* m_board;
BOARD_DESIGN_SETTINGS m_brdSettings;
wxConfig* m_config;
std::vector<int> layerList; // List to hold CheckListBox layer numbers
std::vector<int> m_layerList; // List to hold CheckListBox layer numbers
double m_XScaleAdjust; // X scale factor adjust to compensate
// plotter X scaling error
double m_YScaleAdjust; // X scale factor adjust to compensate
......@@ -63,6 +63,8 @@ private:
void OnQuit( wxCommandEvent& event );
void OnClose( wxCloseEvent& event );
void OnOutputDirectoryBrowseClicked( wxCommandEvent& event );
void OnRightClick( wxMouseEvent& event );
void OnPopUpLayers( wxCommandEvent& event );
void SetPlotFormat( wxCommandEvent& event );
void OnSetScaleOpt( wxCommandEvent& event );
void applyPlotSettings();
......
......@@ -375,18 +375,47 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
this->SetSizer( m_MainSizer );
this->Layout();
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 );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PLOT_BASE::OnClose ) );
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_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
m_scaleOpt->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnSetScaleOpt ), NULL, this );
m_plotButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::Plot ), NULL, this );
m_buttonDrill->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::CreateDrillFile ), NULL, this );
m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnQuit ), NULL, this );
this->Connect( m_menuItem1->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnPopUpLayers ) );
this->Connect( m_menuItem2->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnPopUpLayers ) );
this->Connect( m_menuItem3->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnPopUpLayers ) );
this->Connect( m_menuItem4->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnPopUpLayers ) );
this->Connect( m_menuItem5->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnPopUpLayers ) );
}
DIALOG_PLOT_BASE::~DIALOG_PLOT_BASE()
......@@ -394,11 +423,18 @@ DIALOG_PLOT_BASE::~DIALOG_PLOT_BASE()
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PLOT_BASE::OnClose ) );
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_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
m_scaleOpt->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnSetScaleOpt ), NULL, this );
m_plotButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::Plot ), NULL, this );
m_buttonDrill->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::CreateDrillFile ), NULL, this );
m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnQuit ), NULL, this );
this->Disconnect( ID_LAYER_FAB, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnPopUpLayers ) );
this->Disconnect( ID_SELECT_COPPER_LAYERS, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnPopUpLayers ) );
this->Disconnect( ID_DESELECT_COPPER_LAYERS, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnPopUpLayers ) );
this->Disconnect( ID_SELECT_ALL_LAYERS, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnPopUpLayers ) );
this->Disconnect( ID_DESELECT_ALL_LAYERS, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnPopUpLayers ) );
delete m_popMenu;
}
......@@ -81,7 +81,7 @@
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightDown">OnRightClick</event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
......@@ -4404,6 +4404,86 @@
</object>
</object>
</object>
<object class="wxMenu" expanded="1">
<property name="label">MyMenu</property>
<property name="name">m_popMenu</property>
<property name="permission">protected</property>
<object class="wxMenuItem" expanded="1">
<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>
<event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="1">
<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>
<event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="1">
<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>
<event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="1">
<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>
<event name="OnUpdateUI"></event>
</object>
<object class="wxMenuItem" expanded="1">
<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>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>
......@@ -25,6 +25,10 @@
#include <wx/checklst.h>
#include <wx/statbox.h>
#include <wx/checkbox.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/menu.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
......@@ -42,7 +46,12 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
ID_ALLOW_PRINT_PAD_ON_SILKSCREEN = 1000,
ID_PRINT_REF,
ID_MIROR_OPT,
ID_CREATE_DRILL_FILE
ID_CREATE_DRILL_FILE,
ID_LAYER_FAB,
ID_SELECT_COPPER_LAYERS,
ID_DESELECT_COPPER_LAYERS,
ID_SELECT_ALL_LAYERS,
ID_DESELECT_ALL_LAYERS
};
wxBoxSizer* m_MainSizer;
......@@ -97,22 +106,30 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
wxButton* m_plotButton;
wxButton* m_buttonDrill;
wxButton* m_buttonQuit;
wxMenu* m_popMenu;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& 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 OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSetScaleOpt( wxCommandEvent& event ) { event.Skip(); }
virtual void Plot( wxCommandEvent& event ) { event.Skip(); }
virtual void CreateDrillFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPopUpLayers( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PLOT_BASE();
void DIALOG_PLOT_BASEOnContextMenu( wxMouseEvent &event )
{
this->PopupMenu( m_popMenu, event.GetPosition() );
}
};
......
release version:
2011 nov 30
files (.zip,.tgz):
kicad-2011-11-30
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