diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 792387d9db..97990d848c 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -41,7 +41,6 @@ set( GAL_SRCS gl_context_mgr.cpp ${FONT_SRC} painter.cpp - text_utils.cpp gal/color4d.cpp gal/gal_display_options.cpp gal/graphics_abstraction_layer.cpp diff --git a/common/eda_text.cpp b/common/eda_text.cpp index 309739a954..1ff069d4a2 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -162,14 +162,14 @@ bool EDA_TEXT::Replace( wxFindReplaceData& aSearchData ) } -int EDA_TEXT::LenSize( const wxString& aLine, int aThickness ) const +int EDA_TEXT::LenSize( const wxString& aLine, int aThickness, int aMarkupFlags ) const { basic_gal.SetFontItalic( IsItalic() ); basic_gal.SetFontBold( IsBold() ); basic_gal.SetLineWidth( (float) aThickness ); basic_gal.SetGlyphSize( VECTOR2D( GetTextSize() ) ); - VECTOR2D tsize = basic_gal.GetTextLineSize( aLine ); + VECTOR2D tsize = basic_gal.GetTextLineSize( aLine, aMarkupFlags ); return KiROUND( tsize.x ); } @@ -196,7 +196,7 @@ int EDA_TEXT::GetInterline() const } -EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const +EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY, int aMarkupFlags ) const { EDA_RECT rect; wxArrayString strings; @@ -232,8 +232,10 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const } // calculate the H and V size - int dx = KiROUND( basic_gal.GetStrokeFont().ComputeStringBoundaryLimits( - text, VECTOR2D( GetTextSize() ), double( thickness ) ).x ); + const auto& font = basic_gal.GetStrokeFont(); + VECTOR2D size( GetTextSize() ); + double penWidth( thickness ); + int dx = KiROUND( font.ComputeStringBoundaryLimits( text, size, penWidth, aMarkupFlags ).x ); int dy = GetInterline(); // Creates bounding box (rectangle) for an horizontal @@ -258,9 +260,8 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const { // A overbar adds an extra size to the text // Height from the base line text of chars like [ or { double curr_height = GetTextHeight() * 1.15; - int extra_height = KiROUND( - basic_gal.GetStrokeFont().ComputeOverbarVerticalPosition( GetTextHeight(), thickness ) - curr_height ); - extra_height += thickness/2; + int extra_height = KiROUND( font.ComputeOverbarVerticalPosition( size.y, penWidth ) - curr_height ); + extra_height += thickness / 2; textsize.y += extra_height; rect.Move( wxPoint( 0, -extra_height ) ); } @@ -272,9 +273,8 @@ EDA_RECT EDA_TEXT::GetTextBox( int aLine, int aThickness, bool aInvertY ) const for( unsigned ii = 1; ii < strings.GetCount(); ii++ ) { text = strings.Item( ii ); - dx = KiROUND( basic_gal.GetStrokeFont().ComputeStringBoundaryLimits( - text, VECTOR2D( GetTextSize() ), double( thickness ) ).x ); - textsize.x = std::max( textsize.x, dx ); + dx = KiROUND( font.ComputeStringBoundaryLimits( text, size, penWidth, aMarkupFlags ).x ); + textsize.x = std::max( textsize.x, dx ); textsize.y += dy; } } diff --git a/common/gal/graphics_abstraction_layer.cpp b/common/gal/graphics_abstraction_layer.cpp index 2518a5fa5e..13607a3fcc 100644 --- a/common/gal/graphics_abstraction_layer.cpp +++ b/common/gal/graphics_abstraction_layer.cpp @@ -167,12 +167,12 @@ void GAL::ResetTextAttributes() } -VECTOR2D GAL::GetTextLineSize( const UTF8& aText ) const +VECTOR2D GAL::GetTextLineSize( const UTF8& aText, int aMarkupFlags ) const { // Compute the X and Y size of a given text. // Because computeTextLineSize expects a one line text, // aText is expected to be only one line text. - return strokeFont.computeTextLineSize( aText ); + return strokeFont.computeTextLineSize( aText, aMarkupFlags ); } diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index c91e6b5da2..29b02a3408 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -31,7 +31,6 @@ #include <gal/definitions.h> #include <gl_context_mgr.h> #include <geometry/shape_poly_set.h> -#include <text_utils.h> #include <bitmap_base.h> #include <macros.h> @@ -1125,10 +1124,7 @@ void OPENGL_GAL::BitmapText( const wxString& aText, const VECTOR2D& aPosition, { wxASSERT_MSG( !IsTextMirrored(), "No support for mirrored text using bitmap fonts." ); - auto processedText = ProcessOverbars( aText ); - const auto& text = processedText.first; - const auto& overbars = processedText.second; - + const UTF8 text( aText ); // Compute text size, so it can be properly justified VECTOR2D textSize; float commonOffset; @@ -1192,14 +1188,25 @@ void OPENGL_GAL::BitmapText( const wxString& aText, const VECTOR2D& aPosition, unsigned int c = *chIt; wxASSERT_MSG( c != '\n' && c != '\r', wxT( "No support for multiline bitmap text yet" ) ); - // Handle overbar - if( overbars[i] && !overbar ) + bool wasOverbar = overbar; + + if( *chIt == '~' ) { - overbar = true; // beginning of an overbar + if( ++chIt == end ) + break; + + if( *chIt == '~' ) + { + // double ~ is really a ~ so go ahead and process the second one + } + else + { + overbar = !overbar; + } } - else if( overbar && !overbars[i] ) + + if( wasOverbar && !overbar ) { - overbar = false; // end of an overbar drawBitmapOverbar( overbarLength, overbarHeight ); overbarLength = 0; } diff --git a/common/gal/stroke_font.cpp b/common/gal/stroke_font.cpp index 1798c1d0bf..e38531b0f9 100644 --- a/common/gal/stroke_font.cpp +++ b/common/gal/stroke_font.cpp @@ -28,7 +28,6 @@ #include <gal/stroke_font.h> #include <gal/graphics_abstraction_layer.h> -#include <text_utils.h> #include <wx/string.h> @@ -141,12 +140,10 @@ BOX2D STROKE_FONT::computeBoundingBox( const GLYPH& aGLYPH, const VECTOR2D& aGLY boundingPoints.emplace_back( VECTOR2D( aGLYPHBoundingX.x, 0 ) ); boundingPoints.emplace_back( VECTOR2D( aGLYPHBoundingX.y, 0 ) ); - for( const auto& pointList : aGLYPH ) + for( const std::vector<VECTOR2D>& pointList : aGLYPH ) { - for( const auto& pt : pointList ) - { - boundingPoints.emplace_back( aGLYPHBoundingX.x, pt.y ); - } + for( const VECTOR2D& point : pointList ) + boundingPoints.emplace_back( aGLYPHBoundingX.x, point.y ); } boundingBox.Compute( boundingPoints ); @@ -155,7 +152,8 @@ BOX2D STROKE_FONT::computeBoundingBox( const GLYPH& aGLYPH, const VECTOR2D& aGLY } -void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRotationAngle ) +void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRotationAngle, + int markupFlags ) { if( aText.empty() ) return; @@ -220,7 +218,7 @@ void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRo { size_t length = newlinePos - begin; - drawSingleLineText( aText.substr( begin, length ) ); + drawSingleLineText( aText.substr( begin, length ), markupFlags ); m_gal->Translate( VECTOR2D( 0.0, lineHeight ) ); begin = newlinePos + 1; @@ -229,15 +227,16 @@ void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRo // Draw the last (or the only one) line if( !aText.empty() ) - drawSingleLineText( aText.substr( begin ) ); + drawSingleLineText( aText.substr( begin ), markupFlags ); m_gal->Restore(); } -void STROKE_FONT::drawSingleLineText( const UTF8& aText ) +void STROKE_FONT::drawSingleLineText( const UTF8& aText, int markupFlags ) { double xOffset; + double yOffset; VECTOR2D glyphSize( m_gal->GetGlyphSize() ); double overbar_italic_comp = computeOverbarVerticalPosition() * ITALIC_TILT; @@ -245,7 +244,7 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText ) overbar_italic_comp = -overbar_italic_comp; // Compute the text size - VECTOR2D textSize = computeTextLineSize( aText ); + VECTOR2D textSize = computeTextLineSize( aText, markupFlags ); double half_thickness = m_gal->GetLineWidth()/2; // Context needs to be saved before any transformations @@ -296,13 +295,13 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText ) // must not be indented on subsequent letters to ensure that the bar segments // overlap. bool last_had_overbar = false; - auto processedText = ProcessOverbars( aText ); - const auto& text = processedText.first; - const auto& overbars = processedText.second; - int overbar_index = 0; + bool in_overbar = false; - for( UTF8::uni_iter chIt = text.ubegin(), end = text.uend(); chIt < end; ++chIt ) + yOffset = 0; + + for( UTF8::uni_iter chIt = aText.ubegin(), end = aText.uend(); chIt < end; ++chIt ) { + // Index into bounding boxes table int dd = *chIt - ' '; // Handle tabs as locked to the nearest 4th column (counting in spaces) @@ -317,6 +316,63 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText ) // Set the character to ' ' instead of the '?' for tab dd = 0; + + glyphSize = m_gal->GetGlyphSize(); + yOffset = 0; + } + else if( *chIt == '~' ) + { + if( ++chIt == end ) + break; + + if( *chIt == '~' ) + { + // double ~ is really a ~ so go ahead and process the second one + } + else + { + in_overbar = !in_overbar; + } + } + else if( *chIt == '^' && ( markupFlags & ENABLE_SUPERSCRIPT_MARKUP ) ) + { + if( ++chIt == end ) + break; + + if( *chIt == '^' ) + { + // double ^ is really a ^ so go ahead and process the second one + } + else + { + // single ^ starts a superscript + dd = *chIt - ' '; + glyphSize = m_gal->GetGlyphSize() * 0.8; + yOffset = -m_gal->GetGlyphSize().y * 0.3; + } + } + else if( *chIt == '#' && ( markupFlags & ENABLE_SUBSCRIPT_MARKUP ) ) + { + if( ++chIt == end ) + break; + + if( *chIt == '#' ) + { + // double # is really a # so go ahead and process the second one + } + else + { + // single _ starts a subscript + dd = *chIt - ' '; + glyphSize = m_gal->GetGlyphSize() * 0.8; + yOffset = m_gal->GetGlyphSize().y * 0.1; + } + } + else if( *chIt == ' ' ) + { + // space ends a super- or subscript + glyphSize = m_gal->GetGlyphSize(); + yOffset = 0; } if( dd >= (int) m_glyphBoundingBoxes.size() || dd < 0 ) @@ -325,7 +381,7 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText ) GLYPH& glyph = m_glyphs[dd]; BOX2D& bbox = m_glyphBoundingBoxes[dd]; - if( overbars[overbar_index] ) + if( in_overbar ) { double overbar_start_x = xOffset; double overbar_start_y = - computeOverbarVerticalPosition(); @@ -350,32 +406,31 @@ void STROKE_FONT::drawSingleLineText( const UTF8& aText ) last_had_overbar = false; } - for( const auto& pointList : glyph ) + for( std::vector<VECTOR2D>& ptList : glyph ) { - std::deque<VECTOR2D> pointListScaled; + std::deque<VECTOR2D> ptListScaled; - for( const auto& pt : pointList ) + for( VECTOR2D& pt : ptList ) { - VECTOR2D pointPos( pt.x * glyphSize.x + xOffset, pt.y * glyphSize.y ); + VECTOR2D scaledPt( pt.x * glyphSize.x + xOffset, pt.y * glyphSize.y + yOffset ); if( m_gal->IsFontItalic() ) { // FIXME should be done other way - referring to the lowest Y value of point // because now italic fonts are translated a bit if( m_gal->IsTextMirrored() ) - pointPos.x += pointPos.y * STROKE_FONT::ITALIC_TILT; + scaledPt.x += scaledPt.y * STROKE_FONT::ITALIC_TILT; else - pointPos.x -= pointPos.y * STROKE_FONT::ITALIC_TILT; + scaledPt.x -= scaledPt.y * STROKE_FONT::ITALIC_TILT; } - pointListScaled.push_back( pointPos ); + ptListScaled.push_back( scaledPt ); } - m_gal->DrawPolyline( pointListScaled ); + m_gal->DrawPolyline( ptListScaled ); } xOffset += glyphSize.x * bbox.GetEnd().x; - ++overbar_index; } m_gal->Restore(); @@ -399,19 +454,23 @@ double STROKE_FONT::computeOverbarVerticalPosition() const } -VECTOR2D STROKE_FONT::computeTextLineSize( const UTF8& aText ) const +VECTOR2D STROKE_FONT::computeTextLineSize( const UTF8& aText, int aMarkupFlags ) const { - return ComputeStringBoundaryLimits( aText, m_gal->GetGlyphSize(), m_gal->GetLineWidth() ); + return ComputeStringBoundaryLimits( aText, m_gal->GetGlyphSize(), m_gal->GetLineWidth(), + aMarkupFlags ); } VECTOR2D STROKE_FONT::ComputeStringBoundaryLimits( const UTF8& aText, const VECTOR2D& aGlyphSize, - double aGlyphThickness ) const + double aGlyphThickness, int markupFlags ) const { VECTOR2D string_bbox; int line_count = 1; double maxX = 0.0, curX = 0.0; + double curScale = 1.0; + bool in_overbar = false; + for( UTF8::uni_iter it = aText.ubegin(), end = aText.uend(); it < end; ++it ) { if( *it == '\n' ) @@ -422,12 +481,68 @@ VECTOR2D STROKE_FONT::ComputeStringBoundaryLimits( const UTF8& aText, const VECT continue; } - // If it is double tilda, then it is displayed as a single tilda - // If it is single tilda, then it is toggling overbar, so we need to skip it - if( *it == '~' ) + // Handle tabs as locked to the nearest 4th column (counting in spaces) + // The choice of spaces is somewhat arbitrary but sufficient for aligning text + if( *it == '\t' ) { - if( ++it >= end ) + double fourSpaces = 4.0 * m_glyphBoundingBoxes[0].GetEnd().x; + double addlSpace = fourSpaces - std::fmod( curX, fourSpaces ); + + // Add the remaining space (between 0 and 3 spaces) + curX += addlSpace; + + // Tab ends a super- or subscript + curScale = 1.0; + } + else if( *it == '~' ) + { + if( ++it == end ) break; + + if( *it == '~' ) + { + // double ~ is really a ~ so go ahead and process the second one + } + else + { + // single ~ toggles overbar + in_overbar = !in_overbar; + } + } + else if( *it == '^' && ( markupFlags & ENABLE_SUPERSCRIPT_MARKUP ) ) + { + if( ++it == end ) + break; + + if( *it == '^' ) + { + // double ^ is really a ^ so go ahead and process the second one + } + else + { + // single ^ starts a superscript + curScale = 0.8; + } + } + else if( *it == '#' && ( markupFlags & ENABLE_SUBSCRIPT_MARKUP ) ) + { + if( ++it == end ) + break; + + if( *it == '#' ) + { + // double # is really a # so go ahead and process the second one + } + else + { + // single _ starts a subscript + curScale = 0.8; + } + } + else if( *it == ' ' ) + { + // space ends a super- or subscript + curScale = 1.0; } // Index in the bounding boxes table @@ -437,11 +552,10 @@ VECTOR2D STROKE_FONT::ComputeStringBoundaryLimits( const UTF8& aText, const VECT dd = '?' - ' '; const BOX2D& box = m_glyphBoundingBoxes[dd]; - curX += box.GetEnd().x; + curX += box.GetEnd().x * curScale; } - string_bbox.x = std::max( maxX, curX ); - string_bbox.x *= aGlyphSize.x; + string_bbox.x = std::max( maxX, curX ) * aGlyphSize.x; string_bbox.x += aGlyphThickness; string_bbox.y = line_count * GetInterline( aGlyphSize.y ); diff --git a/common/text_utils.cpp b/common/text_utils.cpp deleted file mode 100644 index 39ca03a028..0000000000 --- a/common/text_utils.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * This program source code file is part of KICAD, a free EDA CAD application. - * - * Copyright (C) 2017 CERN - * @author Maciej Suminski <maciej.suminski@cern.ch> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include <text_utils.h> - -std::pair<UTF8, std::vector<bool>> ProcessOverbars( const UTF8& aText ) -{ - UTF8 text; - std::vector<bool> flags; - bool overbar = false; - - for( UTF8::uni_iter chIt = aText.ubegin(), end = aText.uend(); chIt < end; ++chIt ) - { - if( *chIt == '~' ) - { - if( ++chIt >= end ) - break; - - // It was a single tilda, it toggles overbar - if( *chIt != '~' ) - overbar = !overbar; - - // If it is a double tilda, just process the second one - } - - // remember: *chIt is not necessary a ASCII7 char. - // it is an unsigned giving a multibyte char in UTF8 strings - text += *chIt; - - flags.push_back( overbar ); - } - - return std::make_pair( text, flags ); -} diff --git a/eeschema/dialogs/panel_eeschema_display_options.cpp b/eeschema/dialogs/panel_eeschema_display_options.cpp index 6334f94819..2e3e186d48 100644 --- a/eeschema/dialogs/panel_eeschema_display_options.cpp +++ b/eeschema/dialogs/panel_eeschema_display_options.cpp @@ -71,6 +71,11 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow() m_wireWidth.SetValue( GetDefaultWireThickness() ); m_junctionSize.SetValue( SCH_JUNCTION::GetSymbolSize() ); m_checkShowHiddenPins->SetValue( m_frame->GetShowAllPins() ); + + int superSubFlags = KIGFX::ENABLE_SUBSCRIPT_MARKUP | KIGFX::ENABLE_SUPERSCRIPT_MARKUP; + + m_checkSuperSub->SetValue( GetTextMarkupFlags() & superSubFlags ); + m_checkPageLimits->SetValue( m_frame->ShowPageLimits() ); m_galOptsPanel->TransferDataToWindow(); @@ -111,6 +116,14 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow() // Update canvas m_frame->GetRenderSettings()->m_ShowHiddenPins = m_checkShowHiddenPins->GetValue(); + + int superSubFlags = KIGFX::ENABLE_SUBSCRIPT_MARKUP | KIGFX::ENABLE_SUPERSCRIPT_MARKUP; + + if( m_checkSuperSub->GetValue() ) + SetTextMarkupFlags( GetTextMarkupFlags() | superSubFlags ); + else + SetTextMarkupFlags( GetTextMarkupFlags() & ~superSubFlags ); + m_frame->GetRenderSettings()->SetShowPageLimits( m_checkPageLimits->GetValue() ); m_frame->GetCanvas()->GetView()->MarkDirty(); m_frame->GetCanvas()->GetView()->UpdateAllItems( KIGFX::REPAINT ); diff --git a/eeschema/dialogs/panel_eeschema_display_options_base.cpp b/eeschema/dialogs/panel_eeschema_display_options_base.cpp index a415bc476b..16d2bcc2ac 100644 --- a/eeschema/dialogs/panel_eeschema_display_options_base.cpp +++ b/eeschema/dialogs/panel_eeschema_display_options_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 30 2017) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -9,103 +9,106 @@ /////////////////////////////////////////////////////////////////////////// -PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style ) +PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE::PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) { wxBoxSizer* bPanelSizer; bPanelSizer = new wxBoxSizer( wxHORIZONTAL ); - + m_galOptionsSizer = new wxBoxSizer( wxVERTICAL ); - - + + bPanelSizer->Add( m_galOptionsSizer, 1, wxEXPAND|wxLEFT, 5 ); - + wxBoxSizer* bRightColumn; bRightColumn = new wxBoxSizer( wxVERTICAL ); - + wxStaticBoxSizer* sbSizer2; sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimensions") ), wxVERTICAL ); - + wxFlexGridSizer* fgSizer32; fgSizer32 = new wxFlexGridSizer( 0, 3, 3, 0 ); fgSizer32->AddGrowableCol( 1 ); fgSizer32->SetFlexibleDirection( wxBOTH ); fgSizer32->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - + m_busWidthLabel = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("&Bus thickness:"), wxDefaultPosition, wxDefaultSize, 0 ); m_busWidthLabel->Wrap( -1 ); fgSizer32->Add( m_busWidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - + m_busWidthCtrl = new wxTextCtrl( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP ); fgSizer32->Add( m_busWidthCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - + m_busWidthUnits = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); m_busWidthUnits->Wrap( -1 ); fgSizer32->Add( m_busWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - + m_wireWidthLabel = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("&Wire thickness:"), wxDefaultPosition, wxDefaultSize, 0 ); m_wireWidthLabel->Wrap( -1 ); fgSizer32->Add( m_wireWidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - + m_wireWidthCtrl = new wxTextCtrl( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP ); fgSizer32->Add( m_wireWidthCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - + m_wireWidthUnits = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); m_wireWidthUnits->Wrap( -1 ); fgSizer32->Add( m_wireWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - + m_jctSizeLabel = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Junction size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_jctSizeLabel->Wrap( -1 ); fgSizer32->Add( m_jctSizeLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - + m_jctSizeCtrl = new wxTextCtrl( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizer32->Add( m_jctSizeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - + m_jctSizeUnits = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); m_jctSizeUnits->Wrap( -1 ); fgSizer32->Add( m_jctSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - - + + sbSizer2->Add( fgSizer32, 0, wxBOTTOM|wxRIGHT|wxEXPAND, 5 ); - - + + bRightColumn->Add( sbSizer2, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 ); - + wxStaticBoxSizer* sbSizer1; sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Annotations") ), wxVERTICAL ); - + wxBoxSizer* bSizer6; bSizer6 = new wxBoxSizer( wxHORIZONTAL ); - + m_staticText26 = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("Symbol unit notation:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText26->Wrap( -1 ); bSizer6->Add( m_staticText26, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - + wxString m_choiceSeparatorRefIdChoices[] = { _("A"), _(".A"), _("-A"), _("_A"), _(".1"), _("-1"), _("_1") }; int m_choiceSeparatorRefIdNChoices = sizeof( m_choiceSeparatorRefIdChoices ) / sizeof( wxString ); m_choiceSeparatorRefId = new wxChoice( sbSizer1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceSeparatorRefIdNChoices, m_choiceSeparatorRefIdChoices, 0 ); m_choiceSeparatorRefId->SetSelection( 0 ); bSizer6->Add( m_choiceSeparatorRefId, 1, wxEXPAND|wxRIGHT, 5 ); - - + + sbSizer1->Add( bSizer6, 0, wxEXPAND|wxRIGHT, 5 ); - - + + sbSizer1->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 10 ); - + m_checkShowHiddenPins = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("S&how hidden pins"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizer1->Add( m_checkShowHiddenPins, 0, wxEXPAND|wxALL, 5 ); - + + m_checkSuperSub = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Enable superscript/subscript markup"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer1->Add( m_checkSuperSub, 0, wxALL, 5 ); + m_checkPageLimits = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Show page limi&ts"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkPageLimits->SetValue(true); + m_checkPageLimits->SetValue(true); sbSizer1->Add( m_checkPageLimits, 0, wxEXPAND|wxALL, 5 ); - - + + bRightColumn->Add( sbSizer1, 1, wxEXPAND|wxTOP|wxRIGHT, 5 ); - - + + bPanelSizer->Add( bRightColumn, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 ); - - + + this->SetSizer( bPanelSizer ); this->Layout(); bPanelSizer->Fit( this ); diff --git a/eeschema/dialogs/panel_eeschema_display_options_base.fbp b/eeschema/dialogs/panel_eeschema_display_options_base.fbp index 1cf0093de2..da346789ea 100644 --- a/eeschema/dialogs/panel_eeschema_display_options_base.fbp +++ b/eeschema/dialogs/panel_eeschema_display_options_base.fbp @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <wxFormBuilder_Project> - <FileVersion major="1" minor="13" /> + <FileVersion major="1" minor="15" /> <object class="Project" expanded="1"> <property name="class_decoration"></property> <property name="code_generation">C++</property> @@ -14,6 +14,7 @@ <property name="file">panel_eeschema_display_options_base</property> <property name="first_id">1000</property> <property name="help_provider">none</property> + <property name="indent_with_spaces"></property> <property name="internationalize">1</property> <property name="name">PanelEeschemaDisplayOptions</property> <property name="namespace"></property> @@ -48,36 +49,6 @@ <property name="window_extra_style"></property> <property name="window_name"></property> <property name="window_style">wxTAB_TRAVERSAL</property> - <event name="OnAuiFindManager"></event> - <event name="OnAuiPaneButton"></event> - <event name="OnAuiPaneClose"></event> - <event name="OnAuiPaneMaximize"></event> - <event name="OnAuiPaneRestore"></event> - <event name="OnAuiRender"></event> - <event name="OnChar"></event> - <event name="OnEnterWindow"></event> - <event name="OnEraseBackground"></event> - <event name="OnInitDialog"></event> - <event name="OnKeyDown"></event> - <event name="OnKeyUp"></event> - <event name="OnKillFocus"></event> - <event name="OnLeaveWindow"></event> - <event name="OnLeftDClick"></event> - <event name="OnLeftDown"></event> - <event name="OnLeftUp"></event> - <event name="OnMiddleDClick"></event> - <event name="OnMiddleDown"></event> - <event name="OnMiddleUp"></event> - <event name="OnMotion"></event> - <event name="OnMouseEvents"></event> - <event name="OnMouseWheel"></event> - <event name="OnPaint"></event> - <event name="OnRightDClick"></event> - <event name="OnRightDown"></event> - <event name="OnRightUp"></event> - <event name="OnSetFocus"></event> - <event name="OnSize"></event> - <event name="OnUpdateUI"></event> <object class="wxBoxSizer" expanded="1"> <property name="minimum_size"></property> <property name="name">bPanelSizer</property> @@ -115,7 +86,6 @@ <property name="orient">wxVERTICAL</property> <property name="parent">1</property> <property name="permission">none</property> - <event name="OnUpdateUI"></event> <object class="sizeritem" expanded="1"> <property name="border">5</property> <property name="flag">wxBOTTOM|wxRIGHT|wxEXPAND</property> @@ -165,6 +135,7 @@ <property name="hidden">0</property> <property name="id">wxID_ANY</property> <property name="label">&Bus thickness:</property> + <property name="markup">0</property> <property name="max_size"></property> <property name="maximize_button">0</property> <property name="maximum_size"></property> @@ -190,29 +161,6 @@ <property name="window_name"></property> <property name="window_style"></property> <property name="wrap">-1</property> - <event name="OnChar"></event> - <event name="OnEnterWindow"></event> - <event name="OnEraseBackground"></event> - <event name="OnKeyDown"></event> - <event name="OnKeyUp"></event> - <event name="OnKillFocus"></event> - <event name="OnLeaveWindow"></event> - <event name="OnLeftDClick"></event> - <event name="OnLeftDown"></event> - <event name="OnLeftUp"></event> - <event name="OnMiddleDClick"></event> - <event name="OnMiddleDown"></event> - <event name="OnMiddleUp"></event> - <event name="OnMotion"></event> - <event name="OnMouseEvents"></event> - <event name="OnMouseWheel"></event> - <event name="OnPaint"></event> - <event name="OnRightDClick"></event> - <event name="OnRightDown"></event> - <event name="OnRightUp"></event> - <event name="OnSetFocus"></event> - <event name="OnSize"></event> - <event name="OnUpdateUI"></event> </object> </object> <object class="sizeritem" expanded="0"> @@ -277,33 +225,6 @@ <property name="window_extra_style"></property> <property name="window_name"></property> <property name="window_style"></property> - <event name="OnChar"></event> - <event name="OnEnterWindow"></event> - <event name="OnEraseBackground"></event> - <event name="OnKeyDown"></event> - <event name="OnKeyUp"></event> - <event name="OnKillFocus"></event> - <event name="OnLeaveWindow"></event> - <event name="OnLeftDClick"></event> - <event name="OnLeftDown"></event> - <event name="OnLeftUp"></event> - <event name="OnMiddleDClick"></event> - <event name="OnMiddleDown"></event> - <event name="OnMiddleUp"></event> - <event name="OnMotion"></event> - <event name="OnMouseEvents"></event> - <event name="OnMouseWheel"></event> - <event name="OnPaint"></event> - <event name="OnRightDClick"></event> - <event name="OnRightDown"></event> - <event name="OnRightUp"></event> - <event name="OnSetFocus"></event> - <event name="OnSize"></event> - <event name="OnText"></event> - <event name="OnTextEnter"></event> - <event name="OnTextMaxLen"></event> - <event name="OnTextURL"></event> - <event name="OnUpdateUI"></event> </object> </object> <object class="sizeritem" expanded="0"> @@ -339,6 +260,7 @@ <property name="hidden">0</property> <property name="id">wxID_ANY</property> <property name="label">mils</property> + <property name="markup">0</property> <property name="max_size"></property> <property name="maximize_button">0</property> <property name="maximum_size"></property> @@ -364,29 +286,6 @@ <property name="window_name"></property> <property name="window_style"></property> <property name="wrap">-1</property> - <event name="OnChar"></event> - <event name="OnEnterWindow"></event> - <event name="OnEraseBackground"></event> - <event name="OnKeyDown"></event> - <event name="OnKeyUp"></event> - <event name="OnKillFocus"></event> - <event name="OnLeaveWindow"></event> - <event name="OnLeftDClick"></event> - <event name="OnLeftDown"></event> - <event name="OnLeftUp"></event> - <event name="OnMiddleDClick"></event> - <event name="OnMiddleDown"></event> - <event name="OnMiddleUp"></event> - <event name="OnMotion"></event> - <event name="OnMouseEvents"></event> - <event name="OnMouseWheel"></event> - <event name="OnPaint"></event> - <event name="OnRightDClick"></event> - <event name="OnRightDown"></event> - <event name="OnRightUp"></event> - <event name="OnSetFocus"></event> - <event name="OnSize"></event> - <event name="OnUpdateUI"></event> </object> </object> <object class="sizeritem" expanded="0"> @@ -422,6 +321,7 @@ <property name="hidden">0</property> <property name="id">wxID_ANY</property> <property name="label">&Wire thickness:</property> + <property name="markup">0</property> <property name="max_size"></property> <property name="maximize_button">0</property> <property name="maximum_size"></property> @@ -447,29 +347,6 @@ <property name="window_name"></property> <property name="window_style"></property> <property name="wrap">-1</property> - <event name="OnChar"></event> - <event name="OnEnterWindow"></event> - <event name="OnEraseBackground"></event> - <event name="OnKeyDown"></event> - <event name="OnKeyUp"></event> - <event name="OnKillFocus"></event> - <event name="OnLeaveWindow"></event> - <event name="OnLeftDClick"></event> - <event name="OnLeftDown"></event> - <event name="OnLeftUp"></event> - <event name="OnMiddleDClick"></event> - <event name="OnMiddleDown"></event> - <event name="OnMiddleUp"></event> - <event name="OnMotion"></event> - <event name="OnMouseEvents"></event> - <event name="OnMouseWheel"></event> - <event name="OnPaint"></event> - <event name="OnRightDClick"></event> - <event name="OnRightDown"></event> - <event name="OnRightUp"></event> - <event name="OnSetFocus"></event> - <event name="OnSize"></event> - <event name="OnUpdateUI"></event> </object> </object> <object class="sizeritem" expanded="0"> @@ -534,33 +411,6 @@ <property name="window_extra_style"></property> <property name="window_name"></property> <property name="window_style"></property> - <event name="OnChar"></event> - <event name="OnEnterWindow"></event> - <event name="OnEraseBackground"></event> - <event name="OnKeyDown"></event> - <event name="OnKeyUp"></event> - <event name="OnKillFocus"></event> - <event name="OnLeaveWindow"></event> - <event name="OnLeftDClick"></event> - <event name="OnLeftDown"></event> - <event name="OnLeftUp"></event> - <event name="OnMiddleDClick"></event> - <event name="OnMiddleDown"></event> - <event name="OnMiddleUp"></event> - <event name="OnMotion"></event> - <event name="OnMouseEvents"></event> - <event name="OnMouseWheel"></event> - <event name="OnPaint"></event> - <event name="OnRightDClick"></event> - <event name="OnRightDown"></event> - <event name="OnRightUp"></event> - <event name="OnSetFocus"></event> - <event name="OnSize"></event> - <event name="OnText"></event> - <event name="OnTextEnter"></event> - <event name="OnTextMaxLen"></event> - <event name="OnTextURL"></event> - <event name="OnUpdateUI"></event> </object> </object> <object class="sizeritem" expanded="0"> @@ -596,6 +446,7 @@ <property name="hidden">0</property> <property name="id">wxID_ANY</property> <property name="label">mils</property> + <property name="markup">0</property> <property name="max_size"></property> <property name="maximize_button">0</property> <property name="maximum_size"></property> @@ -621,29 +472,6 @@ <property name="window_name"></property> <property name="window_style"></property> <property name="wrap">-1</property> - <event name="OnChar"></event> - <event name="OnEnterWindow"></event> - <event name="OnEraseBackground"></event> - <event name="OnKeyDown"></event> - <event name="OnKeyUp"></event> - <event name="OnKillFocus"></event> - <event name="OnLeaveWindow"></event> - <event name="OnLeftDClick"></event> - <event name="OnLeftDown"></event> - <event name="OnLeftUp"></event> - <event name="OnMiddleDClick"></event> - <event name="OnMiddleDown"></event> - <event name="OnMiddleUp"></event> - <event name="OnMotion"></event> - <event name="OnMouseEvents"></event> - <event name="OnMouseWheel"></event> - <event name="OnPaint"></event> - <event name="OnRightDClick"></event> - <event name="OnRightDown"></event> - <event name="OnRightUp"></event> - <event name="OnSetFocus"></event> - <event name="OnSize"></event> - <event name="OnUpdateUI"></event> </object> </object> <object class="sizeritem" expanded="1"> @@ -679,6 +507,7 @@ <property name="hidden">0</property> <property name="id">wxID_ANY</property> <property name="label">Junction size:</property> + <property name="markup">0</property> <property name="max_size"></property> <property name="maximize_button">0</property> <property name="maximum_size"></property> @@ -704,29 +533,6 @@ <property name="window_name"></property> <property name="window_style"></property> <property name="wrap">-1</property> - <event name="OnChar"></event> - <event name="OnEnterWindow"></event> - <event name="OnEraseBackground"></event> - <event name="OnKeyDown"></event> - <event name="OnKeyUp"></event> - <event name="OnKillFocus"></event> - <event name="OnLeaveWindow"></event> - <event name="OnLeftDClick"></event> - <event name="OnLeftDown"></event> - <event name="OnLeftUp"></event> - <event name="OnMiddleDClick"></event> - <event name="OnMiddleDown"></event> - <event name="OnMiddleUp"></event> - <event name="OnMotion"></event> - <event name="OnMouseEvents"></event> - <event name="OnMouseWheel"></event> - <event name="OnPaint"></event> - <event name="OnRightDClick"></event> - <event name="OnRightDown"></event> - <event name="OnRightUp"></event> - <event name="OnSetFocus"></event> - <event name="OnSize"></event> - <event name="OnUpdateUI"></event> </object> </object> <object class="sizeritem" expanded="1"> @@ -791,33 +597,6 @@ <property name="window_extra_style"></property> <property name="window_name"></property> <property name="window_style"></property> - <event name="OnChar"></event> - <event name="OnEnterWindow"></event> - <event name="OnEraseBackground"></event> - <event name="OnKeyDown"></event> - <event name="OnKeyUp"></event> - <event name="OnKillFocus"></event> - <event name="OnLeaveWindow"></event> - <event name="OnLeftDClick"></event> - <event name="OnLeftDown"></event> - <event name="OnLeftUp"></event> - <event name="OnMiddleDClick"></event> - <event name="OnMiddleDown"></event> - <event name="OnMiddleUp"></event> - <event name="OnMotion"></event> - <event name="OnMouseEvents"></event> - <event name="OnMouseWheel"></event> - <event name="OnPaint"></event> - <event name="OnRightDClick"></event> - <event name="OnRightDown"></event> - <event name="OnRightUp"></event> - <event name="OnSetFocus"></event> - <event name="OnSize"></event> - <event name="OnText"></event> - <event name="OnTextEnter"></event> - <event name="OnTextMaxLen"></event> - <event name="OnTextURL"></event> - <event name="OnUpdateUI"></event> </object> </object> <object class="sizeritem" expanded="1"> @@ -853,6 +632,7 @@ <property name="hidden">0</property> <property name="id">wxID_ANY</property> <property name="label">mils</property> + <property name="markup">0</property> <property name="max_size"></property> <property name="maximize_button">0</property> <property name="maximum_size"></property> @@ -878,29 +658,6 @@ <property name="window_name"></property> <property name="window_style"></property> <property name="wrap">-1</property> - <event name="OnChar"></event> - <event name="OnEnterWindow"></event> - <event name="OnEraseBackground"></event> - <event name="OnKeyDown"></event> - <event name="OnKeyUp"></event> - <event name="OnKillFocus"></event> - <event name="OnLeaveWindow"></event> - <event name="OnLeftDClick"></event> - <event name="OnLeftDown"></event> - <event name="OnLeftUp"></event> - <event name="OnMiddleDClick"></event> - <event name="OnMiddleDown"></event> - <event name="OnMiddleUp"></event> - <event name="OnMotion"></event> - <event name="OnMouseEvents"></event> - <event name="OnMouseWheel"></event> - <event name="OnPaint"></event> - <event name="OnRightDClick"></event> - <event name="OnRightDown"></event> - <event name="OnRightUp"></event> - <event name="OnSetFocus"></event> - <event name="OnSize"></event> - <event name="OnUpdateUI"></event> </object> </object> </object> @@ -919,7 +676,6 @@ <property name="orient">wxVERTICAL</property> <property name="parent">1</property> <property name="permission">none</property> - <event name="OnUpdateUI"></event> <object class="sizeritem" expanded="1"> <property name="border">5</property> <property name="flag">wxEXPAND|wxRIGHT</property> @@ -962,6 +718,7 @@ <property name="hidden">0</property> <property name="id">wxID_ANY</property> <property name="label">Symbol unit notation:</property> + <property name="markup">0</property> <property name="max_size"></property> <property name="maximize_button">0</property> <property name="maximum_size"></property> @@ -987,29 +744,6 @@ <property name="window_name"></property> <property name="window_style"></property> <property name="wrap">-1</property> - <event name="OnChar"></event> - <event name="OnEnterWindow"></event> - <event name="OnEraseBackground"></event> - <event name="OnKeyDown"></event> - <event name="OnKeyUp"></event> - <event name="OnKillFocus"></event> - <event name="OnLeaveWindow"></event> - <event name="OnLeftDClick"></event> - <event name="OnLeftDown"></event> - <event name="OnLeftUp"></event> - <event name="OnMiddleDClick"></event> - <event name="OnMiddleDown"></event> - <event name="OnMiddleUp"></event> - <event name="OnMotion"></event> - <event name="OnMouseEvents"></event> - <event name="OnMouseWheel"></event> - <event name="OnPaint"></event> - <event name="OnRightDClick"></event> - <event name="OnRightDown"></event> - <event name="OnRightUp"></event> - <event name="OnSetFocus"></event> - <event name="OnSize"></event> - <event name="OnUpdateUI"></event> </object> </object> <object class="sizeritem" expanded="0"> @@ -1074,30 +808,6 @@ <property name="window_extra_style"></property> <property name="window_name"></property> <property name="window_style"></property> - <event name="OnChar"></event> - <event name="OnChoice"></event> - <event name="OnEnterWindow"></event> - <event name="OnEraseBackground"></event> - <event name="OnKeyDown"></event> - <event name="OnKeyUp"></event> - <event name="OnKillFocus"></event> - <event name="OnLeaveWindow"></event> - <event name="OnLeftDClick"></event> - <event name="OnLeftDown"></event> - <event name="OnLeftUp"></event> - <event name="OnMiddleDClick"></event> - <event name="OnMiddleDown"></event> - <event name="OnMiddleUp"></event> - <event name="OnMotion"></event> - <event name="OnMouseEvents"></event> - <event name="OnMouseWheel"></event> - <event name="OnPaint"></event> - <event name="OnRightDClick"></event> - <event name="OnRightDown"></event> - <event name="OnRightUp"></event> - <event name="OnSetFocus"></event> - <event name="OnSize"></event> - <event name="OnUpdateUI"></event> </object> </object> </object> @@ -1174,30 +884,70 @@ <property name="window_extra_style"></property> <property name="window_name"></property> <property name="window_style"></property> - <event name="OnChar"></event> - <event name="OnCheckBox"></event> - <event name="OnEnterWindow"></event> - <event name="OnEraseBackground"></event> - <event name="OnKeyDown"></event> - <event name="OnKeyUp"></event> - <event name="OnKillFocus"></event> - <event name="OnLeaveWindow"></event> - <event name="OnLeftDClick"></event> - <event name="OnLeftDown"></event> - <event name="OnLeftUp"></event> - <event name="OnMiddleDClick"></event> - <event name="OnMiddleDown"></event> - <event name="OnMiddleUp"></event> - <event name="OnMotion"></event> - <event name="OnMouseEvents"></event> - <event name="OnMouseWheel"></event> - <event name="OnPaint"></event> - <event name="OnRightDClick"></event> - <event name="OnRightDown"></event> - <event name="OnRightUp"></event> - <event name="OnSetFocus"></event> - <event name="OnSize"></event> - <event name="OnUpdateUI"></event> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxALL</property> + <property name="proportion">0</property> + <object class="wxCheckBox" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="checked">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="label">Enable superscript/subscript markup</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_checkSuperSub</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style"></property> + <property name="subclass">; ; forward_declare</property> + <property name="toolbar_pane">0</property> + <property name="tooltip"></property> + <property name="validator_data_type"></property> + <property name="validator_style">wxFILTER_NONE</property> + <property name="validator_type">wxDefaultValidator</property> + <property name="validator_variable"></property> + <property name="window_extra_style"></property> + <property name="window_name"></property> + <property name="window_style"></property> </object> </object> <object class="sizeritem" expanded="0"> @@ -1262,30 +1012,6 @@ <property name="window_extra_style"></property> <property name="window_name"></property> <property name="window_style"></property> - <event name="OnChar"></event> - <event name="OnCheckBox"></event> - <event name="OnEnterWindow"></event> - <event name="OnEraseBackground"></event> - <event name="OnKeyDown"></event> - <event name="OnKeyUp"></event> - <event name="OnKillFocus"></event> - <event name="OnLeaveWindow"></event> - <event name="OnLeftDClick"></event> - <event name="OnLeftDown"></event> - <event name="OnLeftUp"></event> - <event name="OnMiddleDClick"></event> - <event name="OnMiddleDown"></event> - <event name="OnMiddleUp"></event> - <event name="OnMotion"></event> - <event name="OnMouseEvents"></event> - <event name="OnMouseWheel"></event> - <event name="OnPaint"></event> - <event name="OnRightDClick"></event> - <event name="OnRightDown"></event> - <event name="OnRightUp"></event> - <event name="OnSetFocus"></event> - <event name="OnSize"></event> - <event name="OnUpdateUI"></event> </object> </object> </object> diff --git a/eeschema/dialogs/panel_eeschema_display_options_base.h b/eeschema/dialogs/panel_eeschema_display_options_base.h index b01bb547d3..2c9e5f717e 100644 --- a/eeschema/dialogs/panel_eeschema_display_options_base.h +++ b/eeschema/dialogs/panel_eeschema_display_options_base.h @@ -1,12 +1,11 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 30 2017) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE_H__ -#define __PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE_H__ +#pragma once #include <wx/artprov.h> #include <wx/xrc/xmlres.h> @@ -29,10 +28,10 @@ /////////////////////////////////////////////////////////////////////////////// /// Class PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE /////////////////////////////////////////////////////////////////////////////// -class PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE : public wxPanel +class PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE : public wxPanel { private: - + protected: wxBoxSizer* m_galOptionsSizer; wxStaticText* m_busWidthLabel; @@ -47,13 +46,13 @@ class PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE : public wxPanel wxStaticText* m_staticText26; wxChoice* m_choiceSeparatorRefId; wxCheckBox* m_checkShowHiddenPins; + wxCheckBox* m_checkSuperSub; wxCheckBox* m_checkPageLimits; - + public: - - PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + + PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); ~PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE(); - + }; -#endif //__PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE_H__ diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 527a402624..b8a768691e 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -51,6 +51,7 @@ static int s_defaultBusThickness = DEFAULTBUSTHICKNESS; static int s_defaultWireThickness = DEFAULTDRAWLINETHICKNESS; static int s_defaultTextSize = DEFAULT_SIZE_TEXT; static int s_drawDefaultLineThickness = -1; +static int s_textMarkupFlags = 0; int GetDefaultBusThickness() @@ -95,6 +96,18 @@ int GetDefaultLineThickness() } +void SetTextMarkupFlags( int aMarkupFlags ) +{ + s_textMarkupFlags = aMarkupFlags; +} + + +int GetTextMarkupFlags() +{ + return s_textMarkupFlags; +} + + void SetDefaultLineThickness( int aThickness ) { s_drawDefaultLineThickness = std::max( 1, aThickness ); @@ -249,6 +262,7 @@ static const wxChar DefaultJctSizeEntry[] = wxT( "DefaultJunctionSize" ) static const wxChar ShowHiddenPinsEntry[] = wxT( "ShowHiddenPins" ); static const wxChar HorzVertLinesOnlyEntry[] = wxT( "HorizVertLinesOnly" ); static const wxChar FieldNamesEntry[] = wxT( "FieldNames" ); +static const wxString TextMarkupFlagsEntry = "TextMarkupFlags"; static const wxString ShowPageLimitsEntry = "ShowPageLimits"; static const wxString UnitsEntry = "Units"; static const wxString PrintMonochromeEntry = "PrintMonochrome"; @@ -325,6 +339,8 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) SetDefaultWireThickness( (int) tmp ); + SetTextMarkupFlags( (int) aCfg->Read( TextMarkupFlagsEntry, 0L ) ); + if( aCfg->Read( DefaultJctSizeEntry, &tmp ) ) SCH_JUNCTION::SetSymbolSize( (int) tmp ); @@ -389,6 +405,8 @@ void SCH_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg ) record.Replace( wxT(" "), wxT(" "), true ); // double space to single aCfg->Write( FieldNamesEntry, record ); + + aCfg->Write( TextMarkupFlagsEntry, GetTextMarkupFlags() ); } diff --git a/eeschema/general.h b/eeschema/general.h index 70a894df29..3bafdd0d3b 100644 --- a/eeschema/general.h +++ b/eeschema/general.h @@ -120,6 +120,9 @@ void SetDefaultBusThickness( int aThickness ); int GetDefaultWireThickness(); void SetDefaultWireThickness( int aThickness ); +int GetTextMarkupFlags(); +void SetTextMarkupFlags( int aMarkupFlags ); + COLOR4D GetLayerColor( SCH_LAYER_ID aLayer ); void SetLayerColor( COLOR4D aColor, SCH_LAYER_ID aLayer ); diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index 4461ee0c4b..2e983186e2 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -317,7 +317,7 @@ const EDA_RECT LIB_FIELD::GetBoundingBox() const /* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when * calling GetTextBox() that works using top to bottom Y axis orientation. */ - EDA_RECT rect = GetTextBox( -1, -1, true ); + EDA_RECT rect = GetTextBox( -1, -1, true, GetTextMarkupFlags() ); rect.RevertYAxis(); // We are using now a bottom to top Y axis. diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index f6b02612d5..6d19edc78b 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -273,7 +273,7 @@ const EDA_RECT LIB_TEXT::GetBoundingBox() const /* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when * calling GetTextBox() that works using top to bottom Y axis orientation. */ - EDA_RECT rect = GetTextBox( -1, -1, true ); + EDA_RECT rect = GetTextBox( -1, -1, true, GetTextMarkupFlags() ); rect.RevertYAxis(); // We are using now a bottom to top Y axis. diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index 13dbd0a800..ea25498be3 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -208,10 +208,10 @@ const EDA_RECT SCH_FIELD::GetBoundingBox() const SCH_FIELD text( *this ); // Make a local copy to change text // because GetBoundingBox() is const text.SetText( GetFullyQualifiedText() ); - rect = text.GetTextBox( -1, linewidth ); + rect = text.GetTextBox( -1, linewidth, false, GetTextMarkupFlags() ); } else - rect = GetTextBox( -1, linewidth ); + rect = GetTextBox( -1, linewidth, false, GetTextMarkupFlags() ); // Calculate the bounding box position relative to the component: wxPoint origin = parentComponent->GetPosition(); diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index cd6e7d81ab..ef816e9201 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -300,6 +300,12 @@ float SCH_PAINTER::getTextThickness( const SCH_TEXT* aItem, bool aDrawingShadows } +void SCH_PAINTER::strokeText( const wxString& aText, const VECTOR2D& aPosition, double aAngle ) +{ + m_gal->StrokeText( aText, aPosition, aAngle, GetTextMarkupFlags() ); +} + + void SCH_PAINTER::draw( LIB_PART *aPart, int aLayer, bool aDrawFields, int aUnit, int aConvert ) { if( !aUnit ) @@ -536,7 +542,7 @@ void SCH_PAINTER::draw( LIB_FIELD *aField, int aLayer ) auto pos = mapCoords( aField->GetPosition() ); double orient = aField->GetTextAngleRadians(); - m_gal->StrokeText( aField->GetText(), pos, orient ); + strokeText( aField->GetText(), pos, orient ); // Draw the umbilical line if( aField->IsMoving() && m_schSettings.m_ShowUmbilicals ) @@ -582,7 +588,7 @@ void SCH_PAINTER::draw( LIB_TEXT *aText, int aLayer ) m_gal->SetGlyphSize( VECTOR2D( aText->GetTextSize() ) ); m_gal->SetFontBold( aText->IsBold() ); m_gal->SetFontItalic( aText->IsItalic() ); - m_gal->StrokeText( aText->GetText(), pos, orient ); + strokeText( aText->GetText(), pos, orient ); } @@ -886,28 +892,28 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer ) SET_DC( INSIDE ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER ); - m_gal->StrokeText( text[INSIDE], pos + VECTOR2D( -insideOffset - len, 0 ), 0 ); + strokeText( text[INSIDE], pos + VECTOR2D( -insideOffset - len, 0 ), 0 ); } if( size[OUTSIDE] ) { SET_DC( OUTSIDE ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER ); - m_gal->StrokeText( text[OUTSIDE], pos + VECTOR2D( outsideOffset, 0 ), 0 ); + strokeText( text[OUTSIDE], pos + VECTOR2D( outsideOffset, 0 ), 0 ); } if( size[ABOVE] ) { SET_DC( ABOVE ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM ); - m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( -len / 2.0, -aboveOffset ), 0 ); + strokeText( text[ABOVE], pos + VECTOR2D( -len / 2.0, -aboveOffset ), 0 ); } if( size[BELOW] ) { SET_DC( BELOW ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP ); - m_gal->StrokeText( text[BELOW], pos + VECTOR2D( -len / 2.0, belowOffset ), 0 ); + strokeText( text[BELOW], pos + VECTOR2D( -len / 2.0, belowOffset ), 0 ); } break; @@ -918,28 +924,28 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer ) m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT ); - m_gal->StrokeText( text[INSIDE], pos + VECTOR2D( insideOffset + len, 0 ), 0 ); + strokeText( text[INSIDE], pos + VECTOR2D( insideOffset + len, 0 ), 0 ); } if( size[OUTSIDE] ) { SET_DC( OUTSIDE ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER ); - m_gal->StrokeText( text[OUTSIDE], pos + VECTOR2D( -outsideOffset, 0 ), 0 ); + strokeText( text[OUTSIDE], pos + VECTOR2D( -outsideOffset, 0 ), 0 ); } if( size[ABOVE] ) { SET_DC( ABOVE ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM ); - m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( len / 2.0, -aboveOffset ), 0 ); + strokeText( text[ABOVE], pos + VECTOR2D( len / 2.0, -aboveOffset ), 0 ); } if( size[BELOW] ) { SET_DC( BELOW ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP ); - m_gal->StrokeText( text[BELOW], pos + VECTOR2D( len / 2.0, belowOffset ), 0 ); + strokeText( text[BELOW], pos + VECTOR2D( len / 2.0, belowOffset ), 0 ); } break; @@ -949,28 +955,28 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer ) SET_DC( INSIDE ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER ); - m_gal->StrokeText ( text[INSIDE], pos + VECTOR2D( 0, insideOffset + len ), M_PI / 2); + strokeText ( text[INSIDE], pos + VECTOR2D( 0, insideOffset + len ), M_PI / 2); } if( size[OUTSIDE] ) { SET_DC( OUTSIDE ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER ); - m_gal->StrokeText ( text[OUTSIDE], pos + VECTOR2D( 0, -outsideOffset ), M_PI / 2); + strokeText ( text[OUTSIDE], pos + VECTOR2D( 0, -outsideOffset ), M_PI / 2); } if( size[ABOVE] ) { SET_DC( ABOVE ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM ); - m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, len / 2.0 ), M_PI / 2 ); + strokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, len / 2.0 ), M_PI / 2 ); } if( size[BELOW] ) { SET_DC( BELOW ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP ); - m_gal->StrokeText( text[BELOW], pos + VECTOR2D( belowOffset, len / 2.0 ), M_PI / 2 ); + strokeText( text[BELOW], pos + VECTOR2D( belowOffset, len / 2.0 ), M_PI / 2 ); } break; @@ -980,28 +986,28 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer ) SET_DC( INSIDE ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER ); - m_gal->StrokeText ( text[INSIDE], pos + VECTOR2D( 0, -insideOffset - len ), M_PI / 2); + strokeText ( text[INSIDE], pos + VECTOR2D( 0, -insideOffset - len ), M_PI / 2); } if( size[OUTSIDE] ) { SET_DC( OUTSIDE ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER ); - m_gal->StrokeText ( text[OUTSIDE], pos + VECTOR2D( 0, outsideOffset ), M_PI / 2); + strokeText ( text[OUTSIDE], pos + VECTOR2D( 0, outsideOffset ), M_PI / 2); } if( size[ABOVE] ) { SET_DC( ABOVE ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM ); - m_gal->StrokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, -len / 2.0 ), M_PI / 2 ); + strokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, -len / 2.0 ), M_PI / 2 ); } if( size[BELOW] ) { SET_DC( BELOW ); m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER ); m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP ); - m_gal->StrokeText( text[BELOW], pos + VECTOR2D( belowOffset, -len / 2.0 ), M_PI / 2 ); + strokeText( text[BELOW], pos + VECTOR2D( belowOffset, -len / 2.0 ), M_PI / 2 ); } break; @@ -1206,7 +1212,7 @@ void SCH_PAINTER::draw( SCH_TEXT *aText, int aLayer ) } if( !shownText.IsEmpty() ) - m_gal->StrokeText( shownText, text_offset, aText->GetTextAngleRadians() ); + strokeText( shownText, text_offset, aText->GetTextAngleRadians() ); if( aText->IsDangling() ) drawDanglingSymbol( aText->GetTextPos(), drawingShadows ); @@ -1373,7 +1379,7 @@ void SCH_PAINTER::draw( SCH_FIELD *aField, int aLayer ) m_gal->SetFontItalic( aField->IsItalic() ); m_gal->SetTextMirrored( aField->IsMirrored() ); m_gal->SetLineWidth( getLineWidth( aField, drawingShadows ) ); - m_gal->StrokeText( aField->GetFullyQualifiedText(), textpos, orient == TEXT_ANGLE_VERT ? M_PI/2 : 0 ); + strokeText( aField->GetFullyQualifiedText(), textpos, orient == TEXT_ANGLE_VERT ? M_PI/2 : 0 ); // Draw the umbilical line if( aField->IsMoving() ) @@ -1548,7 +1554,7 @@ void SCH_PAINTER::draw( SCH_SHEET *aSheet, int aLayer ) m_gal->SetFontBold( false ); m_gal->SetFontItalic( false ); - m_gal->StrokeText( text, pos_sheetname, nameAngle ); + strokeText( text, pos_sheetname, nameAngle ); txtSize = aSheet->GetFileNameSize(); m_gal->SetGlyphSize( VECTOR2D( txtSize, txtSize ) ); @@ -1556,7 +1562,7 @@ void SCH_PAINTER::draw( SCH_SHEET *aSheet, int aLayer ) m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP ); text = wxT( "File: " ) + aSheet->GetFileName(); - m_gal->StrokeText( text, pos_filename, nameAngle ); + strokeText( text, pos_filename, nameAngle ); } } diff --git a/eeschema/sch_painter.h b/eeschema/sch_painter.h index faddbd79cd..19650d4831 100644 --- a/eeschema/sch_painter.h +++ b/eeschema/sch_painter.h @@ -171,6 +171,7 @@ private: bool setDeviceColors( const LIB_ITEM* aItem, int aLayer ); void triLine ( const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c ); + void strokeText( const wxString& aText, const VECTOR2D& aPosition, double aRotationAngle ); SCH_RENDER_SETTINGS m_schSettings; }; diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index e43ee27321..4fc700c8f7 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -427,7 +427,7 @@ const EDA_RECT SCH_TEXT::GetBoundingBox() const linewidth = Clamp_Text_PenSize( linewidth, GetTextSize(), IsBold() ); - EDA_RECT rect = GetTextBox( -1, linewidth ); + EDA_RECT rect = GetTextBox( -1, linewidth, false, GetTextMarkupFlags() ); if( GetTextAngle() != 0 ) // Rotate rect { @@ -694,7 +694,7 @@ bool SCH_LABEL::IsType( const KICAD_T aScanTypes[] ) const EDA_RECT SCH_LABEL::GetBoundingBox() const { int linewidth = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness(); - EDA_RECT rect = GetTextBox( -1, linewidth ); + EDA_RECT rect = GetTextBox( -1, linewidth, false, GetTextMarkupFlags() ); if( GetTextAngle() != 0.0 ) { @@ -850,7 +850,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const aPoints.clear(); - int symb_len = LenSize( GetShownText(), linewidth ) + ( TXT_MARGIN * 2 ); + int symb_len = LenSize( GetShownText(), linewidth, GetTextMarkupFlags() ) + ( TXT_MARGIN * 2 ); // Create outline shape : 6 points int x = symb_len + linewidth + 3; @@ -947,7 +947,7 @@ const EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const height = ( (GetTextHeight() * 15) / 10 ) + width + 2 * TXT_MARGIN; // text X size add height for triangular shapes(bidirectional) - length = LenSize( GetShownText(), width ) + height + DANGLING_SYMBOL_SIZE; + length = LenSize( GetShownText(), width, GetTextMarkupFlags() ) + height + DANGLING_SYMBOL_SIZE; switch( GetLabelSpinStyle() ) // respect orientation { @@ -1109,7 +1109,7 @@ const EDA_RECT SCH_HIERLABEL::GetBoundingBox() const int width = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness(); height = GetTextHeight() + width + 2 * TXT_MARGIN; - length = LenSize( GetShownText(), width ) + length = LenSize( GetShownText(), width, GetTextMarkupFlags() ) + height // add height for triangular shapes + 2 * DANGLING_SYMBOL_SIZE; diff --git a/include/eda_text.h b/include/eda_text.h index a78c2aeddb..ada6f62998 100644 --- a/include/eda_text.h +++ b/include/eda_text.h @@ -303,8 +303,10 @@ public: * @param aLine : the line of text to consider. * For single line text, this parameter is always m_Text * @param aThickness : the stroke width of the text + * @param aMarkupFlags a flagset of MARKUP_FLAG enums indicating which markup tokens should + * be processed */ - int LenSize( const wxString& aLine, int aThickness ) const; + int LenSize( const wxString& aLine, int aThickness, int aMarkupFlags ) const; /** * Function GetTextBox @@ -321,8 +323,11 @@ public: * @param aThickness Overrides the current penwidth when greater than 0. * This is needed when the current penwidth is 0 and a default penwidth is used. * @param aInvertY Invert the Y axis when calculating bounding box. + * @param aMarkupFlags a flagset of MARKUP_FLAG enums indicating which markup tokens should + * be processed */ - EDA_RECT GetTextBox( int aLine = -1, int aThickness = -1, bool aInvertY = false ) const; + EDA_RECT GetTextBox( int aLine = -1, int aThickness = -1, bool aInvertY = false, + int aMarkupFlags = 0 ) const; /** * Return the distance between two lines of text. diff --git a/include/gal/graphics_abstraction_layer.h b/include/gal/graphics_abstraction_layer.h index 05bd5968af..5626744023 100644 --- a/include/gal/graphics_abstraction_layer.h +++ b/include/gal/graphics_abstraction_layer.h @@ -46,6 +46,12 @@ class BITMAP_BASE; namespace KIGFX { +enum TEXT_MARKUP_FLAGS +{ + ENABLE_SUBSCRIPT_MARKUP = 1 << 0, + ENABLE_SUPERSCRIPT_MARKUP = 1 << 1 +}; + /** * @brief Class GAL is the abstract interface for drawing on a 2D-surface. * @@ -335,11 +341,12 @@ public: * @param aText is the text to be drawn. * @param aPosition is the text position in world coordinates. * @param aRotationAngle is the text rotation angle. + * @param aMarkupFlags a bitset of TEXT_MARKUP_FLAGS. */ virtual void StrokeText( const wxString& aText, const VECTOR2D& aPosition, - double aRotationAngle ) + double aRotationAngle, int aMarkupFlags = 0 ) { - strokeFont.Draw( aText, aPosition, aRotationAngle ); + strokeFont.Draw( aText, aPosition, aRotationAngle, aMarkupFlags ); } /** @@ -370,9 +377,10 @@ public: * a only one line text. * * @param aText is the text string (one line). + * @param aMarkupFlags a bitset of TEXT_MARKUP_FLAGS. * @return is the text size. */ - VECTOR2D GetTextLineSize( const UTF8& aText ) const; + VECTOR2D GetTextLineSize( const UTF8& aText, int aMarkupFlags = 0 ) const; /** * Compute the vertical position of an overbar, sometimes used in texts. diff --git a/include/gal/stroke_font.h b/include/gal/stroke_font.h index cfe49d549c..98d7869302 100644 --- a/include/gal/stroke_font.h +++ b/include/gal/stroke_font.h @@ -73,8 +73,11 @@ public: * @param aText is the text to be drawn. * @param aPosition is the text position in world coordinates. * @param aRotationAngle is the text rotation angle in radians. + * @param markupFlags a flagset of MARKUP_FLAG enums indicating which markup tokens should + * be processed */ - void Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRotationAngle ); + void Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRotationAngle, + int markupFlags ); /** * Function SetGAL @@ -90,10 +93,12 @@ public: * Compute the boundary limits of aText (the bounding box of all shapes). * The overbar and alignment are not taken in account, '~' characters are skipped. * + * @param markupFlags a flagset of MARKUP_FLAG enums indicating which markup tokens should + * be processed * @return a VECTOR2D giving the width and height of text. */ VECTOR2D ComputeStringBoundaryLimits( const UTF8& aText, const VECTOR2D& aGlyphSize, - double aGlyphThickness ) const; + double aGlyphThickness, int markupFlags ) const; /** * Compute the vertical position of an overbar, sometimes used in texts. @@ -124,9 +129,10 @@ private: * a only one line text. * * @param aText is the text string (one line). + * @param aMarkupFlags a bitset of TEXT_MARKUP_FLAGS. * @return the text size. */ - VECTOR2D computeTextLineSize( const UTF8& aText ) const; + VECTOR2D computeTextLineSize( const UTF8& aText, int aMarkupFlags ) const; /** * Compute the vertical position of an overbar, sometimes used in texts. @@ -150,7 +156,7 @@ private: * * @param aText is the text to be drawn. */ - void drawSingleLineText( const UTF8& aText ); + void drawSingleLineText( const UTF8& aText, int markupFlags ); /** * @brief Returns number of lines for a given text. diff --git a/include/text_utils.h b/include/text_utils.h deleted file mode 100644 index b37d4cb0cc..0000000000 --- a/include/text_utils.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * This program source code file is part of KICAD, a free EDA CAD application. - * - * Copyright (C) 2017 CERN - * @author Maciej Suminski <maciej.suminski@cern.ch> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifndef TEXT_UTILS_H -#define TEXT_UTILS_H - -#include <utf8.h> -#include <vector> - -/** - * Processes a text to extract the raw text and overbar flags. - * @param aText is the text to be processed. - * @return Pair of raw text and overbar enable flags for each character in the raw text. - */ -std::pair<UTF8, std::vector<bool>> ProcessOverbars( const UTF8& aText ); - -#endif /* TEXT_UTILS_H */