From 5f581aa6ad2cebf2059908caa2d2ff616ecae5cd Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Tue, 1 Jun 2021 19:13:53 -0400 Subject: [PATCH] Move some LABEL_SPIN_STYLE to the cpp to add back warnings --- eeschema/sch_text.cpp | 68 +++++++++++++++++++++++++++++++++++++++++++ eeschema/sch_text.h | 64 +++------------------------------------- 2 files changed, 72 insertions(+), 60 deletions(-) diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index d11f54c23a..2bf92396ab 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -130,6 +130,74 @@ static int* TemplateShape[5][4] = }; +LABEL_SPIN_STYLE LABEL_SPIN_STYLE::RotateCW() +{ + SPIN newSpin = m_spin; + + switch( m_spin ) + { + case LABEL_SPIN_STYLE::LEFT: newSpin = LABEL_SPIN_STYLE::UP; break; + case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::RIGHT; break; + case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::BOTTOM; break; + case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::LEFT; break; + default: wxLogWarning( "RotateCW encountered unknown current spin style" ); break; + } + + return LABEL_SPIN_STYLE( newSpin ); +} + + +LABEL_SPIN_STYLE LABEL_SPIN_STYLE::RotateCCW() +{ + SPIN newSpin = m_spin; + + switch( m_spin ) + { + case LABEL_SPIN_STYLE::LEFT: newSpin = LABEL_SPIN_STYLE::BOTTOM; break; + case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::RIGHT; break; + case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::UP; break; + case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::LEFT; break; + default: wxLogWarning( "RotateCCW encountered unknown current spin style" ); break; + } + + return LABEL_SPIN_STYLE( newSpin ); +} + + +LABEL_SPIN_STYLE LABEL_SPIN_STYLE::MirrorX() +{ + SPIN newSpin = m_spin; + + switch( m_spin ) + { + case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::BOTTOM; break; + case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::UP; break; + case LABEL_SPIN_STYLE::LEFT: break; + case LABEL_SPIN_STYLE::RIGHT: break; + default: wxLogWarning( "MirrorX encountered unknown current spin style" ); break; + } + + return LABEL_SPIN_STYLE( newSpin ); +} + + +LABEL_SPIN_STYLE LABEL_SPIN_STYLE::MirrorY() +{ + SPIN newSpin = m_spin; + + switch( m_spin ) + { + case LABEL_SPIN_STYLE::LEFT: newSpin = LABEL_SPIN_STYLE::RIGHT; break; + case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::LEFT; break; + case LABEL_SPIN_STYLE::UP: break; + case LABEL_SPIN_STYLE::BOTTOM: break; + default: wxLogWarning( "MirrorY encountered unknown current spin style" ); break; + } + + return LABEL_SPIN_STYLE( newSpin ); +} + + SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) : SCH_ITEM( NULL, aType ), EDA_TEXT( text ), diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h index df8b8a5a09..75db9a9624 100644 --- a/eeschema/sch_text.h +++ b/eeschema/sch_text.h @@ -71,75 +71,19 @@ public: return static_cast( m_spin ); } - LABEL_SPIN_STYLE RotateCW() - { - SPIN newSpin = m_spin; + LABEL_SPIN_STYLE RotateCW(); - switch( m_spin ) - { - case LABEL_SPIN_STYLE::LEFT: newSpin = LABEL_SPIN_STYLE::UP; break; - case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::RIGHT; break; - case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::BOTTOM; break; - case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::LEFT; break; - default: break; - } - - return LABEL_SPIN_STYLE( newSpin ); - } - - LABEL_SPIN_STYLE RotateCCW() - { - SPIN newSpin = m_spin; - - switch( m_spin ) - { - case LABEL_SPIN_STYLE::LEFT: newSpin = LABEL_SPIN_STYLE::BOTTOM; break; - case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::RIGHT; break; - case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::UP; break; - case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::LEFT; break; - default: break; - } - - return LABEL_SPIN_STYLE( newSpin ); - } + LABEL_SPIN_STYLE RotateCCW(); /* * Mirrors the label spin style across the X axis or simply swaps up and bottom */ - LABEL_SPIN_STYLE MirrorX() - { - SPIN newSpin = m_spin; - - switch( m_spin ) - { - case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::BOTTOM; break; - case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::UP; break; - case LABEL_SPIN_STYLE::LEFT: break; - case LABEL_SPIN_STYLE::RIGHT: break; - default: break; - } - - return LABEL_SPIN_STYLE( newSpin ); - } + LABEL_SPIN_STYLE MirrorX(); /* * Mirrors the label spin style across the Y axis or simply swaps left and right */ - LABEL_SPIN_STYLE MirrorY() - { - SPIN newSpin = m_spin; - - switch( m_spin ) - { - case LABEL_SPIN_STYLE::LEFT: newSpin = LABEL_SPIN_STYLE::RIGHT; break; - case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::LEFT; break; - case LABEL_SPIN_STYLE::UP: break; - case LABEL_SPIN_STYLE::BOTTOM: break; - default: break; - } - - return LABEL_SPIN_STYLE( newSpin ); - } + LABEL_SPIN_STYLE MirrorY(); private: SPIN m_spin;