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

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
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -7,9 +7,9 @@


#ifndef KICAD_BUILD_VERSION
#ifndef KICAD_BUILD_VERSION
#if defined KICAD_GOST
#if defined KICAD_GOST
#   define KICAD_BUILD_VERSION "(2012-nov-02 GOST)"
#   define KICAD_BUILD_VERSION "(2013-feb-21 GOST)"
#else
#else
#   define KICAD_BUILD_VERSION "(2012-nov-02)"
#   define KICAD_BUILD_VERSION "(2013-feb-21)"
#endif
#endif
#endif
#endif


+2 −1
Original line number Original line Diff line number Diff line
@@ -877,7 +877,8 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
            cmd.SetId( ID_PAN_UP );
            cmd.SetId( ID_PAN_UP );
        else if( event.ControlDown() && !event.ShiftDown() )
        else if( event.ControlDown() && !event.ShiftDown() )
            cmd.SetId( ID_PAN_LEFT );
            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 );
            cmd.SetId( ID_OFFCENTER_ZOOM_IN );
        else
        else
            cmd.SetId( ID_POPUP_ZOOM_IN );
            cmd.SetId( ID_POPUP_ZOOM_IN );
+65 −3
Original line number Original line Diff line number Diff line
@@ -159,7 +159,7 @@ void DIALOG_PLOT::Init_Dialog()
        if( !m_board->IsLayerEnabled( layer ) )
        if( !m_board->IsLayerEnabled( layer ) )
            continue;
            continue;


        layerList.push_back( layer );
        m_layerList.push_back( layer );
        checkIndex = m_layerCheckListBox->Append( m_board->GetLayerName( layer ) );
        checkIndex = m_layerCheckListBox->Append( m_board->GetLayerName( layer ) );


        if( m_plotOpts.GetLayerSelection() & ( 1 << layer ) )
        if( m_plotOpts.GetLayerSelection() & ( 1 << layer ) )
@@ -223,6 +223,68 @@ void DIALOG_PLOT::OnClose( wxCloseEvent& event )
    EndModal( 0 );
    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 )
void DIALOG_PLOT::CreateDrillFile( wxCommandEvent& event )
{
{
@@ -608,10 +670,10 @@ void DIALOG_PLOT::applyPlotSettings()
    long            selectedLayers = 0;
    long            selectedLayers = 0;
    unsigned int    i;
    unsigned int    i;


    for( i = 0; i < layerList.size(); i++ )
    for( i = 0; i < m_layerList.size(); i++ )
    {
    {
        if( m_layerCheckListBox->IsChecked( i ) )
        if( m_layerCheckListBox->IsChecked( i ) )
            selectedLayers |= (1 << layerList[i]);
            selectedLayers |= (1 << m_layerList[i]);
    }
    }


    tempOptions.SetLayerSelection( selectedLayers );
    tempOptions.SetLayerSelection( selectedLayers );
+3 −1
Original line number Original line Diff line number Diff line
@@ -43,7 +43,7 @@ private:
    BOARD*              m_board;
    BOARD*              m_board;
    BOARD_DESIGN_SETTINGS  m_brdSettings;
    BOARD_DESIGN_SETTINGS  m_brdSettings;
    wxConfig*           m_config;
    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
    double              m_XScaleAdjust;             // X scale factor adjust to compensate
                                                    // plotter X scaling error
                                                    // plotter X scaling error
    double              m_YScaleAdjust;             // X scale factor adjust to compensate
    double              m_YScaleAdjust;             // X scale factor adjust to compensate
@@ -63,6 +63,8 @@ private:
    void        OnQuit( wxCommandEvent& event );
    void        OnQuit( wxCommandEvent& event );
    void        OnClose( wxCloseEvent& event );
    void        OnClose( wxCloseEvent& event );
    void        OnOutputDirectoryBrowseClicked( wxCommandEvent& event );
    void        OnOutputDirectoryBrowseClicked( wxCommandEvent& event );
    void        OnRightClick( wxMouseEvent& event );
    void        OnPopUpLayers( wxCommandEvent& event );
    void        SetPlotFormat( wxCommandEvent& event );
    void        SetPlotFormat( wxCommandEvent& event );
    void        OnSetScaleOpt( wxCommandEvent& event );
    void        OnSetScaleOpt( wxCommandEvent& event );
    void        applyPlotSettings();
    void        applyPlotSettings();
+36 −0
Original line number Original line Diff line number Diff line
@@ -375,18 +375,47 @@ 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_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PLOT_BASE::OnClose ) );
	this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PLOT_BASE::OnClose ) );
	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_scaleOpt->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnSetScaleOpt ), 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_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_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 );
	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()
DIALOG_PLOT_BASE::~DIALOG_PLOT_BASE()
@@ -394,11 +423,18 @@ DIALOG_PLOT_BASE::~DIALOG_PLOT_BASE()
	// Disconnect Events
	// Disconnect Events
	this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PLOT_BASE::OnClose ) );
	this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PLOT_BASE::OnClose ) );
	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_scaleOpt->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_BASE::OnSetScaleOpt ), 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_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_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 );
	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; 
}
}
Loading