From d0a860ed8f41cdcb55a2276bf12125dfb271f64a Mon Sep 17 00:00:00 2001 From: Kevin Cozens Date: Mon, 30 May 2016 14:17:39 -0400 Subject: [PATCH] Don't change angle when editing footprint value or reference text Added 180 degrees to list of selection angles and entry of angles from -180 to 180 in Footprint Text Properties dialog. Fixes lp:613616 https://bugs.launchpad.net/kicad/+bug/613616 --- pcbnew/dialogs/dialog_edit_module_text.cpp | 35 +++++++++++++------ .../dialogs/dialog_edit_module_text_base.cpp | 6 ++-- .../dialogs/dialog_edit_module_text_base.fbp | 4 +-- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/pcbnew/dialogs/dialog_edit_module_text.cpp b/pcbnew/dialogs/dialog_edit_module_text.cpp index e45b997a41..de5854f2cc 100644 --- a/pcbnew/dialogs/dialog_edit_module_text.cpp +++ b/pcbnew/dialogs/dialog_edit_module_text.cpp @@ -8,8 +8,8 @@ * * Copyright (C) 2015 Jean-Pierre Charras * Copyright (C) 2013 Dick Hollenbeck, dick@softplc.com - * Copyright (C) 2008-2013 Wayne Stambaugh - * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2008 Wayne Stambaugh + * Copyright (C) 1992-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 @@ -75,7 +75,7 @@ DialogEditModuleText::DialogEditModuleText( PCB_BASE_FRAME* aParent, m_currentText = aTextMod; m_OrientValue = 0; - m_OrientValidator.SetRange( -90.0, 90.0 ); + m_OrientValidator.SetRange( -180.0, 180.0 ); m_OrientValueCtrl->SetValidator( m_OrientValidator ); m_OrientValidator.SetWindow( m_OrientValueCtrl ); @@ -150,10 +150,6 @@ bool DialogEditModuleText::TransferDataToWindow() PutValueInLocalUnits( *m_TxtWidthCtlr, m_currentText->GetThickness() ); double text_orient = m_currentText->GetTextAngle(); - NORMALIZE_ANGLE_90( text_orient ); - - if( text_orient != 0.0 ) - m_Orient->SetSelection( 1 ); if( !m_currentText->IsVisible() ) m_Show->SetSelection( 1 ); @@ -166,15 +162,22 @@ bool DialogEditModuleText::TransferDataToWindow() break; case 900: + case -2700: m_Orient->SetSelection( 1 ); break; case -900: + case 2700: m_Orient->SetSelection( 2 ); break; - default: + case -1800: + case 1800: m_Orient->SetSelection( 3 ); + break; + + default: + m_Orient->SetSelection( 4 ); custom_orientation = true; break; } @@ -279,6 +282,10 @@ bool DialogEditModuleText::TransferDataFromWindow() m_currentText->SetTextAngle( -900 ); break; + case 3: + m_currentText->SetTextAngle( 1800 ); + break; + default: custom_orientation = true; m_currentText->SetTextAngle( KiROUND( m_OrientValue * 10.0 ) ); @@ -301,8 +308,13 @@ bool DialogEditModuleText::TransferDataFromWindow() m_Orient->SetSelection( 2 ); break; - default: + case -1800: + case 1800: m_Orient->SetSelection( 3 ); + break; + + default: + m_Orient->SetSelection( 4 ); m_currentText->SetTextAngle( KiROUND( m_OrientValue * 10.0 ) ); custom_orientation = true; break; @@ -354,6 +366,10 @@ void DialogEditModuleText::ModuleOrientEvent( wxCommandEvent& event ) m_OrientValue = -90.0; break; + case 3: + m_OrientValue = 180.0; + break; + default: custom_orientation = true; break; @@ -362,4 +378,3 @@ void DialogEditModuleText::ModuleOrientEvent( wxCommandEvent& event ) m_OrientValidator.TransferToWindow(); m_OrientValueCtrl->Enable( custom_orientation ); } - diff --git a/pcbnew/dialogs/dialog_edit_module_text_base.cpp b/pcbnew/dialogs/dialog_edit_module_text_base.cpp index 73f98f978a..1450116260 100644 --- a/pcbnew/dialogs/dialog_edit_module_text_base.cpp +++ b/pcbnew/dialogs/dialog_edit_module_text_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version May 6 2016) +// C++ code generated with wxFormBuilder (version Apr 24 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -115,13 +115,13 @@ DialogEditModuleText_base::DialogEditModuleText_base( wxWindow* parent, wxWindow bSizer4->Add( bSizer5, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 ); - wxString m_OrientChoices[] = { _("0.0"), _("+90.0"), _("-90.0"), _("Other") }; + wxString m_OrientChoices[] = { _("0.0"), _("+90.0"), _("-90.0"), _("180.0"), _("Other") }; int m_OrientNChoices = sizeof( m_OrientChoices ) / sizeof( wxString ); m_Orient = new wxRadioBox( this, wxID_ANY, _("Orientation"), wxDefaultPosition, wxDefaultSize, m_OrientNChoices, m_OrientChoices, 1, wxRA_SPECIFY_COLS ); m_Orient->SetSelection( 2 ); bSizer4->Add( m_Orient, 0, wxALL|wxEXPAND, 5 ); - m_staticTextRotation = new wxStaticText( this, wxID_ANY, _("Rotation (-90.0 to 90.0)"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextRotation = new wxStaticText( this, wxID_ANY, _("Rotation (-180.0 to 180.0)"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextRotation->Wrap( -1 ); bSizer4->Add( m_staticTextRotation, 0, wxEXPAND|wxTOP|wxLEFT, 5 ); diff --git a/pcbnew/dialogs/dialog_edit_module_text_base.fbp b/pcbnew/dialogs/dialog_edit_module_text_base.fbp index 46c09744fd..558f058b2b 100644 --- a/pcbnew/dialogs/dialog_edit_module_text_base.fbp +++ b/pcbnew/dialogs/dialog_edit_module_text_base.fbp @@ -1739,7 +1739,7 @@ 1 0 - "0.0" "+90.0" "-90.0" "Other" + "0.0" "+90.0" "-90.0" "180.0" "Other" 1 1 @@ -1843,7 +1843,7 @@ 0 0 wxID_ANY - Rotation (-90.0 to 90.0) + Rotation (-180.0 to 180.0) 0