From e00e9ff41fb5bddd9b454a508d0356b422dba6b9 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 6 Jan 2022 18:59:34 +0100 Subject: [PATCH] PANEL_TEMPLATE_FIELDNAMES: fix incorrect management of boolean options (it was impossible to disable them) Fixes #10280 https://gitlab.com/kicad/code/kicad/issues/10280 --- eeschema/dialogs/panel_template_fieldnames.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/eeschema/dialogs/panel_template_fieldnames.cpp b/eeschema/dialogs/panel_template_fieldnames.cpp index 01e03a8781..f9a224791d 100644 --- a/eeschema/dialogs/panel_template_fieldnames.cpp +++ b/eeschema/dialogs/panel_template_fieldnames.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2009 Wayne Stambaugh - * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2022 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 @@ -151,8 +151,9 @@ bool PANEL_TEMPLATE_FIELDNAMES::TransferDataToGrid() for( int row = 0; row < m_grid->GetNumberRows(); ++row ) { m_grid->SetCellValue( row, 0, m_fields[row].m_Name ); - m_grid->SetCellValue( row, 1, m_fields[row].m_Visible ? wxT( "1" ) : wxEmptyString ); - m_grid->SetCellValue( row, 2, m_fields[row].m_URL ? wxT( "1" ) : wxEmptyString ); + // columns 1 and 2 show a boolean value (in a check box): + m_grid->SetCellValue( row, 1, m_fields[row].m_Visible ? "1" : "0" ); + m_grid->SetCellValue( row, 2, m_fields[row].m_URL ? "1" : "0" ); // Set cell properties m_grid->SetCellAlignment( row, 0, wxALIGN_LEFT, wxALIGN_CENTRE ); @@ -181,8 +182,8 @@ bool PANEL_TEMPLATE_FIELDNAMES::TransferDataFromGrid() for( int row = 0; row < m_grid->GetNumberRows(); ++row ) { m_fields[row].m_Name = m_grid->GetCellValue( row, 0 ); - m_fields[row].m_Visible = m_grid->GetCellValue( row, 1 ) != wxEmptyString; - m_fields[row].m_URL = m_grid->GetCellValue( row, 2 ) != wxEmptyString; + m_fields[row].m_Visible = m_grid->GetCellValue( row, 1 ) == "1"; + m_fields[row].m_URL = m_grid->GetCellValue( row, 2 ) == "1"; } return true;