From 08b15a69906823620c3e599cb6b04a5fddbabcfb Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 18 Jan 2018 09:31:56 +0100 Subject: [PATCH] Pcbnew: graphic segments type S_POLYGON: allows 0 for outline thickness (this allows to create easily the exact polygonal shape). Fixes: lp:1743982 https://bugs.launchpad.net/kicad/+bug/1743982 --- pcbnew/dialogs/dialog_graphic_item_properties.cpp | 15 +++++++++++---- ...dialog_graphic_item_properties_for_Modedit.cpp | 15 +++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index 3de9cf956b..4d5641d4bd 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2010 Jean-Pierre Charras - * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2018 Jean-Pierre Charras jp.charras at wanadoo.fr + * Copyright (C) 1992-2018 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 @@ -335,10 +335,17 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate() break; } - // Check the item thickness. + // Check the item thickness. Note the polygon outline thickness is allowed + // to be set to 0, because if the shape is exactly the polygon, its outline + // thickness must be 0 int thickness = ValueFromString( g_UserUnit, m_ThicknessCtrl->GetValue() ); - if( thickness <= 0 ) + if( m_item->GetShape() == S_POLYGON ) + { + if( thickness < 0 ) + error_msgs.Add( _( "The polygon outline thickness must be >= 0." ) ); + } + else if( thickness <= 0 ) error_msgs.Add( _( "The item thickness must be greater than zero." ) ); // And the default thickness. diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp b/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp index 8080c88aee..6083171acf 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr - * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2012-2018 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2018 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 @@ -331,10 +331,17 @@ bool DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::Validate() break; } - // Check the item thickness. + // Check the item thickness. Note the polygon outline thickness is allowed + // to be set to 0, because if the shape is exactly the polygon, its outline + // thickness must be 0 int thickness = ValueFromString( g_UserUnit, m_ThicknessCtrl->GetValue() ); - if( thickness <= 0 ) + if( m_item->GetShape() == S_POLYGON ) + { + if( thickness < 0 ) + error_msgs.Add( _( "The polygon outline thickness must be >= 0." ) ); + } + else if( thickness <= 0 ) error_msgs.Add( _( "The item thickness must be greater than zero." ) ); // And the default thickness.