Eeschema: fix text justification terminology.
Use justification instead of orientation relative to the anchor point when describing text direction and alignment. This seems to be the preferred method by most users so hopefully this will eliminate some confusion. Fix a bug in the s-expression schematic parser that failed to take into account how graphical text alignment is defined for graphic text objects compared to label text objects. Fixes https://gitlab.com/kicad/code/kicad/issues/6489
This commit is contained in:
parent
8513ca974c
commit
ebd53cd45c
|
@ -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 );
|
||||
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<property name="file">dialog_edit_label_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">dialog_edit_label_base</property>
|
||||
|
@ -25,6 +26,7 @@
|
|||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_array_enum">0</property>
|
||||
<property name="use_enum">1</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
|
@ -517,7 +519,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">6</property>
|
||||
<property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -526,7 +528,7 @@
|
|||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">6</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT|wxTOP</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -660,8 +662,8 @@
|
|||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">7</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxHyperlinkCtrl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -876,7 +878,7 @@
|
|||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"Left" "Up" "Right" "Down"</property>
|
||||
<property name="choices">"Align right" "Align bottom" "Align left" "Align top"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
|
@ -891,7 +893,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Orientation</property>
|
||||
<property name="label">Justification</property>
|
||||
<property name="majorDimension">1</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
|
@ -908,7 +910,7 @@
|
|||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">0</property>
|
||||
<property name="selection">2</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxRA_SPECIFY_COLS</property>
|
||||
|
@ -974,7 +976,7 @@
|
|||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">3</property>
|
||||
<property name="selection">0</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxRA_SPECIFY_COLS</property>
|
||||
|
@ -1040,7 +1042,7 @@
|
|||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">3</property>
|
||||
<property name="selection">0</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxRA_SPECIFY_COLS</property>
|
||||
|
|
|
@ -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!
|
||||
|
|
|
@ -2895,6 +2895,26 @@ SCH_TEXT* SCH_SEXPR_PARSER::parseSchText()
|
|||
|
||||
case T_effects:
|
||||
parseEDA_TEXT( static_cast<EDA_TEXT*>( 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)
|
||||
|
|
|
@ -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 <stambaughw@verizon.net>
|
||||
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* 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<wxPoint>& 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<wxPoint>& aPoints, const wxPoint& aPos, PINSHEETLABEL_SHAPE aShape ) const
|
||||
std::vector<wxPoint>& aPoints, const wxPoint& aPos,
|
||||
PINSHEETLABEL_SHAPE aShape ) const
|
||||
{
|
||||
int* Template = TemplateShape[static_cast<int>( aShape )][static_cast<int>( m_spin_style )];
|
||||
int halfSize = GetTextHeight() / 2;
|
||||
|
|
|
@ -59,7 +59,7 @@ SCH_DRAWING_TOOLS::SCH_DRAWING_TOOLS() :
|
|||
EE_TOOL_BASE<SCH_EDIT_FRAME>( "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 ),
|
||||
|
|
Loading…
Reference in New Issue