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

Fix the minor bug 1016924 ( Unhandled event id 6263 in pcbnew ). Remove duplicate code.

parent 8412f2ad
Loading
Loading
Loading
Loading
+13 −26
Original line number Diff line number Diff line
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
 * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 2007-2011 KiCad Developers, see AUTHORS.txt for contributors.
 * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
 * Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 2007-2015 KiCad Developers, see AUTHORS.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
@@ -58,6 +58,7 @@ BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME )
    EVT_SIZE( DISPLAY_FOOTPRINTS_FRAME::OnSize )
    EVT_TOOL( ID_OPTIONS_SETUP, DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay )
    EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame )

    EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
              DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar)
    EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
@@ -251,13 +252,10 @@ void DISPLAY_FOOTPRINTS_FRAME::OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent )
    wxString msgTextsFill[2] = { _( "Show texts in filled mode" ),
                                 _( "Show texts in sketch mode" ) };

    unsigned i = displ_opts->m_DisplayModText + 1;

    if ( i > 2 )
        i = 1;
    unsigned i = displ_opts->m_DisplayModText == SKETCH ? 0 : 1;

    aEvent.Check( displ_opts->m_DisplayModText == 1 );
    m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, msgTextsFill[i-1] );
    aEvent.Check( displ_opts->m_DisplayModText == SKETCH );
    m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, msgTextsFill[i] );

}

@@ -266,16 +264,13 @@ void DISPLAY_FOOTPRINTS_FRAME::OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent )
{
    DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();

    wxString msgEdgesFill[3] = { _( "Show outlines in filled mode" ),
    wxString msgEdgesFill[2] = { _( "Show outlines in filled mode" ),
                                 _( "Show outlines in sketch mode" ) };

    int i = displ_opts->m_DisplayModEdge + 1;
    int i = displ_opts->m_DisplayModEdge == SKETCH ? 0 : 1;

    if ( i > 2 )
        i = 1;

    aEvent.Check( displ_opts->m_DisplayModEdge == 2 );
    m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, msgEdgesFill[i-1] );
    aEvent.Check( displ_opts->m_DisplayModEdge == SKETCH );
    m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, msgEdgesFill[i] );
}


@@ -303,20 +298,12 @@ void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
    switch( id )
    {
    case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
        displ_opts->m_DisplayModText++;

        if( displ_opts->m_DisplayModText > 2 )
            displ_opts->m_DisplayModText = 0;

        displ_opts->m_DisplayModText = displ_opts->m_DisplayModText == FILLED ? SKETCH : FILLED;
        m_canvas->Refresh( );
        break;

    case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
        displ_opts->m_DisplayModEdge++;

        if( displ_opts->m_DisplayModEdge > 2 )
            displ_opts->m_DisplayModEdge = 0;

        displ_opts->m_DisplayModEdge = displ_opts->m_DisplayModEdge == FILLED ? SKETCH : FILLED;
        m_canvas->Refresh();
        break;

+6 −4
Original line number Diff line number Diff line
/*
 * 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) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
 * Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
 * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
 * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
 * Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
@@ -110,6 +110,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
    case ID_POPUP_PCB_DELETE_ZONE:
    case ID_POPUP_PCB_MOVE_ZONE_CORNER:
    case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT:
    case ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT:
    case ID_POPUP_PCB_MOVE_ZONE_OUTLINES:
    case ID_POPUP_PCB_ADD_ZONE_CORNER:
    case ID_POPUP_PCB_DELETE_TRACKSEG:
@@ -609,6 +610,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )

    case ID_POPUP_PCB_PLACE_ZONE_OUTLINES:
    case ID_POPUP_PCB_PLACE_ZONE_CORNER:
    case ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT:
        {
            m_canvas->MoveCursorToCrossHair();
            ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
+1 −13
Original line number Diff line number Diff line
@@ -111,9 +111,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
    EVT_TOOL_RANGE( ID_MODEDIT_PAD_TOOL, ID_MODEDIT_PLACE_GRID_COORD,
                    FOOTPRINT_EDIT_FRAME::OnVerticalToolbar )

    // Options Toolbar
    EVT_TOOL( ID_TB_OPTIONS_SHOW_PADS_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar )
    EVT_TOOL( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar )
    // Options Toolbar (ID_TB_OPTIONS_SHOW_PADS_SKETCH id is managed in PCB_BASE_FRAME)
    EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar )
    EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar )
    EVT_TOOL( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar )
@@ -181,8 +179,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
                         FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar )

    // Option toolbar:
    EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
                   FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar )
    EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
                   FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar )
    EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
@@ -581,14 +577,6 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent )

    switch( id )
    {
    case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
        state = !displ_opts->m_DisplayPadFill;
        break;

    case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
        state = !displ_opts->m_DisplayViaFill;
        break;

    case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
        state = displ_opts->m_DisplayModText == SKETCH;
        break;
+3 −3
Original line number Diff line number Diff line
/*
 * 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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
 * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
 * Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
@@ -96,8 +96,8 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
        {
            LAYER_ID cur_layer = GetActiveLayer();

            // If after showing the dialog the user removed the active layer,
            // then use a sensible alternative layer to set as the active layer.
            // If after showing the dialog the user has removed the active layer,
            // then select a new active layer (front copper layer).
            if( !GetBoard()->GetEnabledLayers()[ cur_layer ] )
                cur_layer = F_Cu;