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

Pcbnew: fix a minor bug I created in rev 3912.

Still try to find a better fix for Bug #1100876, however I am thinking the bug is not in Kicad:
looks like a buggy version of wxWidgets is used, which sends sometimes an unwanted wxCommandEvent event,
when an event::Check() is called inside a function called by a  wxUpdateUIEvent event.
parent 7b8c8914
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -77,10 +77,6 @@ class PCB_EDIT_FRAME : public PCB_BASE_FRAME
    int             m_RecordingMacros;
    MACROS_RECORDED m_Macros[10];

    /// The command ID of the current auto place mode which will be set for either
    /// automatic placement of tracks or modules.
    int m_autoPlaceModeId;

    /// The auxiliary right vertical tool bar used to access the microwave tools.
    wxAuiToolBar* m_microWaveToolBar;

+6 −11
Original line number Diff line number Diff line
@@ -289,7 +289,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
    m_hasAutoSave = true;
    m_RecordingMacros = -1;
    m_microWaveToolBar = NULL;
    m_autoPlaceModeId = 0;
#ifdef KICAD_SCRIPTING_WXPYTHON
    m_pythonPanel = NULL;
#endif
@@ -837,19 +836,15 @@ void PCB_EDIT_FRAME::OnSelectAutoPlaceMode( wxCommandEvent& aEvent )
    switch( aEvent.GetId() )
    {
        case ID_TOOLBARH_PCB_MODE_MODULE:
            if( aEvent.IsChecked() )
                m_autoPlaceModeId = ID_TOOLBARH_PCB_MODE_MODULE;
            else if( m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_MODULE )
                // clear m_autoPlaceModeId only if it was activated by this tool
                m_autoPlaceModeId = 0;
            if( aEvent.IsChecked() &&
                m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_TRACKS ) )
                m_mainToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_TRACKS, false );
            break;

        case ID_TOOLBARH_PCB_MODE_TRACKS:
            if( aEvent.IsChecked() )
                m_autoPlaceModeId = ID_TOOLBARH_PCB_MODE_TRACKS;
            else if( m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_TRACKS )
                // clear m_autoPlaceModeId only if it was activated by this tool
                m_autoPlaceModeId = 0;
            if( aEvent.IsChecked() &&
                m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_MODULE ) )
                m_mainToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_MODULE, false );
            break;
        }
}
+3 −11
Original line number Diff line number Diff line
@@ -206,20 +206,12 @@ void PCB_EDIT_FRAME::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )


void PCB_EDIT_FRAME::OnUpdateAutoPlaceTracksMode( wxUpdateUIEvent& aEvent )
{return;
    // Automatic placement of modules and tracks is a mutually exclusive operation
    // So this tool is activated only if
    // m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_TRACKS.
    bool state = m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_TRACKS;
    m_mainToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_TRACKS, state );
{
    //Nothing to do.
}


void PCB_EDIT_FRAME::OnUpdateAutoPlaceModulesMode( wxUpdateUIEvent& aEvent )
{
    // Automatic placement of modules and tracks is a mutually exclusive operation,
    // So this tool is activated only if
    // m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_MODULE.
    bool state = m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_MODULE;
    m_mainToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_MODULE, state );
    //Nothing to do.
}