FOOTPRINT_WIZARD_FRAME: fis a serious issue when changing a parameter page when a parameter was currently edited

Also Fixes: lp:1739881
This commit is contained in:
jean-pierre charras 2017-12-23 18:34:57 +01:00
parent 3a74e5253b
commit b05a40e728
3 changed files with 47 additions and 22 deletions

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Miguel Angel Ajo Pelayo, miguelangel@nbee.es
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2017 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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file footprint_wizard.cpp
*/
@ -7,7 +32,6 @@
#include <class_drawpanel.h>
#include <wxPcbStruct.h>
#include <dialog_helpers.h>
//#include <3d_viewer/eda_3d_viewer.h>
#include <class_board.h>
#include <class_module.h>
@ -222,18 +246,16 @@ void FOOTPRINT_WIZARD_FRAME::DefaultParameters( wxCommandEvent& event )
void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event )
{
int page = m_pageList->GetSelection();
FOOTPRINT_WIZARD* footprintWizard = GetMyWizard();
if( !footprintWizard )
return;
if( page < 0 )
if( m_parameterGridPage < 0 )
return;
wxArrayString prmValues = footprintWizard->GetParameterValues( page );
wxArrayString ptList = footprintWizard->GetParameterTypes( page );
wxArrayString prmValues = footprintWizard->GetParameterValues( m_parameterGridPage );
wxArrayString ptList = footprintWizard->GetParameterTypes( m_parameterGridPage );
bool has_changed = false;
int count = m_parameterGrid->GetNumberRows();
@ -255,7 +277,7 @@ void FOOTPRINT_WIZARD_FRAME::ParametersUpdated( wxGridEvent& event )
if( has_changed )
{
wxString res = footprintWizard->SetParameterValues( page, prmValues );
wxString res = footprintWizard->SetParameterValues( m_parameterGridPage, prmValues );
if( !res.IsEmpty() )
wxMessageBox( res );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012-2015 Miguel Angel Ajo Pelayo <miguelangel@nbee.es>
* Copyright (C) 2012-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012-2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2017 KiCad Developers, see change_log.txt for contributors.
*
@ -159,7 +159,8 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway,
wxDefaultPosition, wxDefaultSize,
0, NULL, wxLB_HSCROLL );
// Creates the The list of parameters for the current parameter page
// Creates the list of parameters for the current parameter page
m_parameterGridPage = -1;
initParameterGrid();
ReCreatePageList();
@ -347,19 +348,18 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
if( footprintWizard == NULL )
return;
int page = m_pageList->GetSelection();
if( page<0 )
return;
m_parameterGridPage = m_pageList->GetSelection();
m_parameterGrid->ClearGrid();
if( m_parameterGridPage < 0 ) // Should not happen
return;
// Get the list of names, values, types, hints and designators
wxArrayString designatorsList = footprintWizard->GetParameterDesignators( page );
wxArrayString namesList = footprintWizard->GetParameterNames( page );
wxArrayString valuesList = footprintWizard->GetParameterValues( page );
wxArrayString typesList = footprintWizard->GetParameterTypes( page );
wxArrayString hintsList = footprintWizard->GetParameterHints( page );
wxArrayString designatorsList = footprintWizard->GetParameterDesignators( m_parameterGridPage );
wxArrayString namesList = footprintWizard->GetParameterNames( m_parameterGridPage );
wxArrayString valuesList = footprintWizard->GetParameterValues( m_parameterGridPage );
wxArrayString typesList = footprintWizard->GetParameterTypes( m_parameterGridPage );
wxArrayString hintsList = footprintWizard->GetParameterHints( m_parameterGridPage );
// Dimension the wxGrid
if( m_parameterGrid->GetNumberRows() > 0 )
@ -386,7 +386,7 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
// Set the editor type of the
// Boolean parameters can be displayed using a checkbox
// Boolean parameters are displayed using a checkbox
if( units == WIZARD_PARAM_UNITS_BOOL )
{
wxGridCellBoolEditor *boolEditor = new wxGridCellBoolEditor;

View File

@ -2,8 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Miguel Angel Ajo Pelayo, miguelangel@nbee.es
* Copyright (C) 2012 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2017 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
@ -59,6 +59,9 @@ private:
int m_pageListWidth; ///< width of the window
wxGrid* m_parameterGrid; ///< The list of parameters
int m_parameterGridWidth; ///< size of the grid
int m_parameterGridPage; ///< the page currently displayed by m_parameterGrid
///< it is most of time the m_pageList selection, but can differ
///< during transitions between pages.
FOOTPRINT_WIZARD_MESSAGES* m_messagesFrame;
protected: