diff --git a/eeschema/dialogs/dialog_edit_label_base.cpp b/eeschema/dialogs/dialog_edit_label_base.cpp index 5d97e45e0c..f7c52f901c 100644 --- a/eeschema/dialogs/dialog_edit_label_base.cpp +++ b/eeschema/dialogs/dialog_edit_label_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 26 2018) +// C++ code generated with wxFormBuilder (version 3.9.0 Jun 3 2020) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -86,7 +86,7 @@ DIALOG_LABEL_EDITOR_BASE::DIALOG_LABEL_EDITOR_BASE( wxWindow* parent, wxWindowID bSizeCtrlSizer = new wxBoxSizer( wxHORIZONTAL ); m_textSizeCtrl = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizeCtrlSizer->Add( m_textSizeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 6 ); + bSizeCtrlSizer->Add( m_textSizeCtrl, 0, wxBOTTOM|wxRIGHT|wxTOP, 6 ); m_textSizeUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); m_textSizeUnits->Wrap( -1 ); @@ -98,10 +98,10 @@ DIALOG_LABEL_EDITOR_BASE::DIALOG_LABEL_EDITOR_BASE( wxWindow* parent, wxWindowID m_formattingHelp = new wxHyperlinkCtrl( this, wxID_ANY, _("Syntax help"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE ); m_formattingHelp->SetToolTip( _("Show syntax help window") ); - bSizeCtrlSizer->Add( m_formattingHelp, 0, wxBOTTOM|wxRIGHT|wxLEFT, 7 ); + bSizeCtrlSizer->Add( m_formattingHelp, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); - m_textEntrySizer->Add( bSizeCtrlSizer, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM, 6 ); + m_textEntrySizer->Add( bSizeCtrlSizer, 1, wxEXPAND, 6 ); m_note1 = new wxStaticText( this, wxID_ANY, _("Note:"), wxDefaultPosition, wxDefaultSize, 0 ); m_note1->Wrap( -1 ); @@ -117,22 +117,22 @@ DIALOG_LABEL_EDITOR_BASE::DIALOG_LABEL_EDITOR_BASE( wxWindow* parent, wxWindowID wxBoxSizer* m_OptionsSizer; m_OptionsSizer = new wxBoxSizer( wxHORIZONTAL ); - wxString m_TextOrientChoices[] = { _("Left"), _("Up"), _("Right"), _("Down") }; + wxString m_TextOrientChoices[] = { _("Align right"), _("Align bottom"), _("Align left"), _("Align top") }; int m_TextOrientNChoices = sizeof( m_TextOrientChoices ) / sizeof( wxString ); - m_TextOrient = new wxRadioBox( this, wxID_ANY, _("Orientation"), wxDefaultPosition, wxDefaultSize, m_TextOrientNChoices, m_TextOrientChoices, 1, wxRA_SPECIFY_COLS ); - m_TextOrient->SetSelection( 0 ); + m_TextOrient = new wxRadioBox( this, wxID_ANY, _("Justification"), wxDefaultPosition, wxDefaultSize, m_TextOrientNChoices, m_TextOrientChoices, 1, wxRA_SPECIFY_COLS ); + m_TextOrient->SetSelection( 2 ); m_OptionsSizer->Add( m_TextOrient, 1, wxRIGHT|wxTOP|wxEXPAND, 3 ); wxString m_TextStyleChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold and italic") }; int m_TextStyleNChoices = sizeof( m_TextStyleChoices ) / sizeof( wxString ); m_TextStyle = new wxRadioBox( this, wxID_ANY, _("Style"), wxDefaultPosition, wxDefaultSize, m_TextStyleNChoices, m_TextStyleChoices, 1, wxRA_SPECIFY_COLS ); - m_TextStyle->SetSelection( 3 ); + m_TextStyle->SetSelection( 0 ); m_OptionsSizer->Add( m_TextStyle, 1, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 3 ); wxString m_TextShapeChoices[] = { _("Input"), _("Output"), _("Bidirectional"), _("Tri-state"), _("Passive") }; int m_TextShapeNChoices = sizeof( m_TextShapeChoices ) / sizeof( wxString ); m_TextShape = new wxRadioBox( this, wxID_ANY, _("Shape"), wxDefaultPosition, wxDefaultSize, m_TextShapeNChoices, m_TextShapeChoices, 1, wxRA_SPECIFY_COLS ); - m_TextShape->SetSelection( 3 ); + m_TextShape->SetSelection( 0 ); m_OptionsSizer->Add( m_TextShape, 1, wxEXPAND|wxTOP|wxLEFT, 3 ); diff --git a/eeschema/dialogs/dialog_edit_label_base.fbp b/eeschema/dialogs/dialog_edit_label_base.fbp index 2f67e8c176..6a8e5d0135 100644 --- a/eeschema/dialogs/dialog_edit_label_base.fbp +++ b/eeschema/dialogs/dialog_edit_label_base.fbp @@ -14,6 +14,7 @@ dialog_edit_label_base 1000 none + 1 dialog_edit_label_base @@ -25,6 +26,7 @@ 1 1 UI + 0 1 0 @@ -517,7 +519,7 @@ 6 - wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM + wxEXPAND 1 @@ -526,7 +528,7 @@ none 6 - wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT + wxBOTTOM|wxRIGHT|wxTOP 0 1 @@ -660,8 +662,8 @@ - 7 - wxBOTTOM|wxRIGHT|wxLEFT + 5 + wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT 0 1 @@ -876,7 +878,7 @@ 1 0 - "Left" "Up" "Right" "Down" + "Align right" "Align bottom" "Align left" "Align top" 1 1 @@ -891,7 +893,7 @@ 0 0 wxID_ANY - Orientation + Justification 1 0 @@ -908,7 +910,7 @@ 1 Resizable - 0 + 2 1 wxRA_SPECIFY_COLS @@ -974,7 +976,7 @@ 1 Resizable - 3 + 0 1 wxRA_SPECIFY_COLS @@ -1040,7 +1042,7 @@ 1 Resizable - 3 + 0 1 wxRA_SPECIFY_COLS diff --git a/eeschema/dialogs/dialog_edit_label_base.h b/eeschema/dialogs/dialog_edit_label_base.h index 61757d0eaa..5dc07244a7 100644 --- a/eeschema/dialogs/dialog_edit_label_base.h +++ b/eeschema/dialogs/dialog_edit_label_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 26 2018) +// C++ code generated with wxFormBuilder (version 3.9.0 Jun 3 2020) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp index 68e79b45ae..7565f2e53e 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp @@ -2895,6 +2895,26 @@ SCH_TEXT* SCH_SEXPR_PARSER::parseSchText() case T_effects: parseEDA_TEXT( static_cast( text.get() ) ); + + // Spin style is defined differently for graphical text (#SCH_TEXT) objects. + if( text->Type() == SCH_TEXT_T ) + { + if( text->GetHorizJustify() == GR_TEXT_HJUSTIFY_RIGHT + && text->GetTextAngle() == TEXT_ANGLE_VERT ) + { + // The vertically aligned text angle is always 90 (labels use 270 for the + // down direction) combined with the text justification flags. + text->SetLabelSpinStyle( LABEL_SPIN_STYLE::BOTTOM ); + } + else if( text->GetHorizJustify() == GR_TEXT_HJUSTIFY_RIGHT + && text->GetTextAngle() == TEXT_ANGLE_HORIZ ) + { + // The horizontally aligned text angle is always 0 (labels use 180 for the + // left direction) combined with the text justification flags. + text->SetLabelSpinStyle( LABEL_SPIN_STYLE::LEFT ); + } + } + break; case T_iref: // legacy format; current is a T_property (aka SCH_FIELD) diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 69a8e89af9..d11f54c23a 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2015 Wayne Stambaugh + * Copyright (C) 2015 Wayne Stambaugh * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -664,14 +664,14 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList ) switch( GetLabelSpinStyle() ) { - case LABEL_SPIN_STYLE::LEFT: msg = _( "Horizontal left" ); break; - case LABEL_SPIN_STYLE::UP: msg = _( "Vertical up" ); break; - case LABEL_SPIN_STYLE::RIGHT: msg = _( "Horizontal right" ); break; - case LABEL_SPIN_STYLE::BOTTOM: msg = _( "Vertical down" ); break; - default: msg = wxT( "???" ); break; + case LABEL_SPIN_STYLE::LEFT: msg = _( "Align right" ); break; + case LABEL_SPIN_STYLE::UP: msg = _( "Align bottom" ); break; + case LABEL_SPIN_STYLE::RIGHT: msg = _( "Align left" ); break; + case LABEL_SPIN_STYLE::BOTTOM: msg = _( "Align top" ); break; + default: msg = wxT( "???" ); break; } - aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), msg, BROWN ) ); + aList.push_back( MSG_PANEL_ITEM( _( "Justification" ), msg, BROWN ) ); wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) }; int style = 0; @@ -1216,6 +1216,7 @@ void SCH_GLOBALLABEL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aO m_intersheetRefsField.Print( aSettings, aOffset ); } + void SCH_GLOBALLABEL::Plot( PLOTTER* aPlotter ) const { SCH_TEXT::Plot( aPlotter ); @@ -1226,6 +1227,7 @@ void SCH_GLOBALLABEL::Plot( PLOTTER* aPlotter ) const m_intersheetRefsField.Plot( aPlotter ); } + void SCH_GLOBALLABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings, std::vector& aPoints, const wxPoint& Pos ) const { @@ -1463,7 +1465,8 @@ void SCH_HIERLABEL::CreateGraphicShape( const RENDER_SETTINGS* aSettings, void SCH_HIERLABEL::CreateGraphicShape( const RENDER_SETTINGS* aSettings, - std::vector& aPoints, const wxPoint& aPos, PINSHEETLABEL_SHAPE aShape ) const + std::vector& aPoints, const wxPoint& aPos, + PINSHEETLABEL_SHAPE aShape ) const { int* Template = TemplateShape[static_cast( aShape )][static_cast( m_spin_style )]; int halfSize = GetTextHeight() / 2; diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index f4112cc00e..c2559ef7bf 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -59,7 +59,7 @@ SCH_DRAWING_TOOLS::SCH_DRAWING_TOOLS() : EE_TOOL_BASE( "eeschema.InteractiveDrawing" ), m_lastSheetPinType( PINSHEETLABEL_SHAPE::PS_INPUT ), m_lastGlobalLabelShape( PINSHEETLABEL_SHAPE::PS_INPUT ), - m_lastTextOrientation( LABEL_SPIN_STYLE::LEFT ), + m_lastTextOrientation( LABEL_SPIN_STYLE::RIGHT ), m_lastTextBold( false ), m_lastTextItalic( false ), m_inPlaceSymbol( false ),