Schematic and symbol text boxes.
Also fixes some plot bugs with arcs. Also moves polygonization of arcs (when required) in plotting code from 5 degrees to calculated based on ARC_HIGH_DEF. Fixes https://gitlab.com/kicad/code/kicad/issues/5017
This commit is contained in:
parent
3409783d9f
commit
c6a8100d46
|
@ -1,7 +1,7 @@
|
|||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
# Copyright (C) 2011-2018 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
# Copyright (C) 2011-2022 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -174,6 +174,7 @@ set( BMAPS_MID
|
|||
add_radial_dimension
|
||||
add_rectangle
|
||||
add_symbol_to_schematic
|
||||
add_textbox
|
||||
add_tracks
|
||||
add_via
|
||||
add_zone_cutout
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 155 B |
Binary file not shown.
After Width: | Height: | Size: 307 B |
|
@ -0,0 +1,102 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
id="Слой_1"
|
||||
data-name="Слой 1"
|
||||
viewBox="0 0 24 24"
|
||||
version="1.1"
|
||||
sodipodi:docname="add_textbox.svg"
|
||||
inkscape:version="1.0.2 (e86c8708, 2021-01-15)">
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1440"
|
||||
inkscape:window-height="800"
|
||||
id="namedview30"
|
||||
showgrid="true"
|
||||
inkscape:zoom="29.462761"
|
||||
inkscape:cx="12"
|
||||
inkscape:cy="12"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="23"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:document-rotation="0"
|
||||
inkscape:current-layer="Слой_1">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid_kicad"
|
||||
spacingx="0.5"
|
||||
spacingy="0.5"
|
||||
color="#9999ff"
|
||||
opacity="0.13"
|
||||
empspacing="2" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata43">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>add_rectangle</dc:title>
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Distribution" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Notice" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Attribution" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs115735">
|
||||
<style
|
||||
id="style115733">.cls-1{fill:none;stroke:#545454;stroke-linecap:round;stroke-linejoin:round;stroke-width:2px;}.cls-2{fill:#1a81c4;}</style>
|
||||
</defs>
|
||||
<title
|
||||
id="title115737">add_rectangle</title>
|
||||
<rect
|
||||
class="cls-1"
|
||||
x="3"
|
||||
y="4"
|
||||
width="18"
|
||||
height="16"
|
||||
id="rect115739"
|
||||
style="fill:#c1c1c1;fill-opacity:1;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none" />
|
||||
<path
|
||||
style="fill:none;stroke:#545454;stroke-width:1.25858;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 6.3333333,8.32929 H 17.433333 v 0"
|
||||
id="path841" />
|
||||
<path
|
||||
style="fill:none;stroke:#545454;stroke-width:1.17167;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 6.3333333,11.599835 H 15"
|
||||
id="path843" />
|
||||
<path
|
||||
style="fill:none;stroke:#545454;stroke-width:1.25858;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 6.3333333,14.60029 H 17"
|
||||
id="path845" />
|
||||
</svg>
|
After Width: | Height: | Size: 3.5 KiB |
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -346,6 +346,7 @@ static struct EDA_ITEM_DESC
|
|||
.Map( SCH_LINE_T, _HKI( "Line" ) )
|
||||
.Map( SCH_BITMAP_T, _HKI( "Bitmap" ) )
|
||||
.Map( SCH_TEXT_T, _HKI( "Text" ) )
|
||||
.Map( SCH_TEXTBOX_T, _HKI( "Text Box" ) )
|
||||
.Map( SCH_LABEL_T, _HKI( "Net Label" ) )
|
||||
.Map( SCH_DIRECTIVE_LABEL_T, _HKI( "Directive Label" ) )
|
||||
.Map( SCH_GLOBAL_LABEL_T, _HKI( "Global Label" ) )
|
||||
|
@ -367,6 +368,7 @@ static struct EDA_ITEM_DESC
|
|||
.Map( LIB_ALIAS_T, _HKI( "Alias" ) )
|
||||
.Map( LIB_SHAPE_T, _HKI( "Graphic" ) )
|
||||
.Map( LIB_TEXT_T, _HKI( "Text" ) )
|
||||
.Map( LIB_TEXTBOX_T, _HKI( "Text Box" ) )
|
||||
.Map( LIB_PIN_T, _HKI( "Pin" ) )
|
||||
.Map( LIB_FIELD_T, _HKI( "Symbol Field" ) )
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ bool FONT::IsStroke( const wxString& aFontName )
|
|||
}
|
||||
|
||||
|
||||
void FONT::getLinePositions( const UTF8& aText, const VECTOR2I& aPosition,
|
||||
void FONT::getLinePositions( const wxString& aText, const VECTOR2I& aPosition,
|
||||
wxArrayString& aTextLines, std::vector<VECTOR2I>& aPositions,
|
||||
std::vector<VECTOR2I>& aExtents, const TEXT_ATTRIBUTES& aAttrs ) const
|
||||
{
|
||||
|
@ -161,7 +161,7 @@ void FONT::getLinePositions( const UTF8& aText, const VECTOR2I& aPosition,
|
|||
* object, such as a run of superscript characters)
|
||||
* @param aAttrs are the styling attributes of the text, including its rotation
|
||||
*/
|
||||
void FONT::Draw( KIGFX::GAL* aGal, const UTF8& aText, const VECTOR2I& aPosition,
|
||||
void FONT::Draw( KIGFX::GAL* aGal, const wxString& aText, const VECTOR2I& aPosition,
|
||||
const VECTOR2I& aCursor, const TEXT_ATTRIBUTES& aAttrs ) const
|
||||
{
|
||||
if( !aGal || aText.empty() )
|
||||
|
@ -232,7 +232,7 @@ VECTOR2I drawMarkup( BOX2I* aBoundingBox, std::vector<std::unique_ptr<GLYPH>>* a
|
|||
|
||||
|
||||
VECTOR2I FONT::drawMarkup( BOX2I* aBoundingBox, std::vector<std::unique_ptr<GLYPH>>* aGlyphs,
|
||||
const UTF8& aText, const VECTOR2I& aPosition, const VECTOR2I& aSize,
|
||||
const wxString& aText, const VECTOR2I& aPosition, const VECTOR2I& aSize,
|
||||
const EDA_ANGLE& aAngle, bool aMirror, const VECTOR2I& aOrigin,
|
||||
TEXT_STYLE_FLAGS aTextStyle ) const
|
||||
{
|
||||
|
@ -244,7 +244,7 @@ VECTOR2I FONT::drawMarkup( BOX2I* aBoundingBox, std::vector<std::unique_ptr<GLYP
|
|||
}
|
||||
|
||||
|
||||
void FONT::drawSingleLineText( KIGFX::GAL* aGal, BOX2I* aBoundingBox, const UTF8& aText,
|
||||
void FONT::drawSingleLineText( KIGFX::GAL* aGal, BOX2I* aBoundingBox, const wxString& aText,
|
||||
const VECTOR2I& aPosition, const VECTOR2I& aSize,
|
||||
const EDA_ANGLE& aAngle, bool aMirror, const VECTOR2I& aOrigin,
|
||||
bool aItalic ) const
|
||||
|
@ -267,7 +267,7 @@ void FONT::drawSingleLineText( KIGFX::GAL* aGal, BOX2I* aBoundingBox, const UTF8
|
|||
}
|
||||
|
||||
|
||||
VECTOR2I FONT::StringBoundaryLimits( const UTF8& aText, const VECTOR2I& aSize, int aThickness,
|
||||
VECTOR2I FONT::StringBoundaryLimits( const wxString& aText, const VECTOR2I& aSize, int aThickness,
|
||||
bool aBold, bool aItalic ) const
|
||||
{
|
||||
// TODO do we need to parse every time - have we already parsed?
|
||||
|
@ -297,8 +297,9 @@ VECTOR2I FONT::StringBoundaryLimits( const UTF8& aText, const VECTOR2I& aSize, i
|
|||
}
|
||||
|
||||
|
||||
VECTOR2I FONT::boundingBoxSingleLine( BOX2I* aBBox, const UTF8& aText, const VECTOR2I& aPosition,
|
||||
const VECTOR2I& aSize, bool aItalic ) const
|
||||
VECTOR2I FONT::boundingBoxSingleLine( BOX2I* aBBox, const wxString& aText,
|
||||
const VECTOR2I& aPosition, const VECTOR2I& aSize,
|
||||
bool aItalic ) const
|
||||
{
|
||||
TEXT_STYLE_FLAGS textStyle = 0;
|
||||
|
||||
|
@ -310,3 +311,162 @@ VECTOR2I FONT::boundingBoxSingleLine( BOX2I* aBBox, const UTF8& aText, const VEC
|
|||
|
||||
return extents;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Break marked-up text into "words". In this context, a "word" is EITHER a run of marked-up
|
||||
* text (subscript, superscript or overbar), OR a run of non-marked-up text separated by spaces.
|
||||
*/
|
||||
void wordbreakMarkup( std::vector<std::pair<wxString, int>>* aWords,
|
||||
const std::unique_ptr<MARKUP::NODE>& aNode, const KIFONT::FONT* aFont,
|
||||
const VECTOR2I& aSize, TEXT_STYLE_FLAGS aTextStyle )
|
||||
{
|
||||
TEXT_STYLE_FLAGS textStyle = aTextStyle;
|
||||
|
||||
if( !aNode->is_root() )
|
||||
{
|
||||
wxChar escapeChar = 0;
|
||||
|
||||
if( aNode->isSubscript() )
|
||||
{
|
||||
escapeChar = '_';
|
||||
textStyle = TEXT_STYLE::SUBSCRIPT;
|
||||
}
|
||||
else if( aNode->isSuperscript() )
|
||||
{
|
||||
escapeChar = '^';
|
||||
textStyle = TEXT_STYLE::SUPERSCRIPT;
|
||||
}
|
||||
|
||||
if( aNode->isOverbar() )
|
||||
{
|
||||
escapeChar = '~';
|
||||
textStyle |= TEXT_STYLE::OVERBAR;
|
||||
}
|
||||
|
||||
if( escapeChar )
|
||||
{
|
||||
wxString word = wxString::Format( "%c{", escapeChar );
|
||||
int width = 0;
|
||||
|
||||
if( aNode->has_content() )
|
||||
{
|
||||
VECTOR2I next = aFont->GetTextAsGlyphs( nullptr, nullptr, aNode->string(), aSize,
|
||||
{0,0}, ANGLE_0, false, {0,0}, textStyle );
|
||||
word += aNode->string();
|
||||
width += next.x;
|
||||
}
|
||||
|
||||
std::vector<std::pair<wxString, int>> childWords;
|
||||
|
||||
for( const std::unique_ptr<MARKUP::NODE>& child : aNode->children )
|
||||
wordbreakMarkup( &childWords, child, aFont, aSize, textStyle );
|
||||
|
||||
for( const std::pair<wxString, int>& childWord : childWords )
|
||||
{
|
||||
word += childWord.first;
|
||||
width += childWord.second;
|
||||
}
|
||||
|
||||
word += "}";
|
||||
aWords->emplace_back( std::make_pair( word, width ) );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxString space( wxT( " " ) );
|
||||
wxString textRun( aNode->string() );
|
||||
wxArrayString words;
|
||||
|
||||
wxStringSplit( textRun, words, ' ' );
|
||||
|
||||
if( textRun.EndsWith( " " ) )
|
||||
words.Add( " " );
|
||||
|
||||
for( size_t ii = 0; ii < words.size(); ++ii )
|
||||
{
|
||||
int w = aFont->GetTextAsGlyphs( nullptr, nullptr, words[ii], aSize, { 0, 0 },
|
||||
ANGLE_0, false, { 0, 0 }, textStyle ).x;
|
||||
|
||||
aWords->emplace_back( std::make_pair( words[ii], w ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for( const std::unique_ptr<MARKUP::NODE>& child : aNode->children )
|
||||
wordbreakMarkup( aWords, child, aFont, aSize, textStyle );
|
||||
}
|
||||
|
||||
|
||||
void FONT::wordbreakMarkup( std::vector<std::pair<wxString, int>>* aWords, const wxString& aText,
|
||||
const VECTOR2I& aSize, TEXT_STYLE_FLAGS aTextStyle ) const
|
||||
{
|
||||
MARKUP::MARKUP_PARSER markupParser( aText );
|
||||
std::unique_ptr<MARKUP::NODE> root = markupParser.Parse();
|
||||
|
||||
::wordbreakMarkup( aWords, root, this, aSize, aTextStyle );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This is a highly simplified line-breaker. KiCad is an EDA tool, not a word processor.
|
||||
*
|
||||
* 1) It breaks only on spaces. If you type a word wider than the column width then you get
|
||||
* overflow.
|
||||
* 2) It treats runs of formatted text (superscript, subscript, overbar) as single words.
|
||||
* 3) It does not perform justification.
|
||||
*
|
||||
* The results of the linebreaking are the addition of \n in the text. It is presumed that this
|
||||
* function is called on m_shownText (or equivalent) rather than the original source text.
|
||||
*/
|
||||
void FONT::LinebreakText( wxString& aText, int aColumnWidth, const VECTOR2I& aSize, int aThickness,
|
||||
bool aBold, bool aItalic ) const
|
||||
{
|
||||
TEXT_STYLE_FLAGS textStyle = 0;
|
||||
|
||||
if( aBold )
|
||||
textStyle |= TEXT_STYLE::BOLD;
|
||||
|
||||
if( aItalic )
|
||||
textStyle |= TEXT_STYLE::ITALIC;
|
||||
|
||||
int spaceWidth = GetTextAsGlyphs( nullptr, nullptr, " ", aSize, VECTOR2I(), ANGLE_0, false,
|
||||
VECTOR2I(), textStyle ).x;
|
||||
|
||||
wxArrayString textLines;
|
||||
wxStringSplit( aText, textLines, '\n' );
|
||||
|
||||
aText = wxEmptyString;
|
||||
|
||||
for( size_t ii = 0; ii < textLines.Count(); ++ii )
|
||||
{
|
||||
int lineWidth = 0;
|
||||
std::vector<std::pair<wxString, int>> words;
|
||||
|
||||
wordbreakMarkup( &words, textLines[ii], aSize, textStyle );
|
||||
|
||||
for( size_t jj = 0; jj < words.size(); /* advance in loop */ )
|
||||
{
|
||||
if( lineWidth + spaceWidth + words[jj].second < aColumnWidth - aThickness )
|
||||
{
|
||||
if( lineWidth > 0 )
|
||||
{
|
||||
aText += " ";
|
||||
lineWidth += spaceWidth;
|
||||
}
|
||||
|
||||
aText += words[jj].first;
|
||||
lineWidth += words[jj].second;
|
||||
|
||||
jj++;
|
||||
}
|
||||
else
|
||||
{
|
||||
aText += '\n';
|
||||
lineWidth = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ void OUTLINE_FONT::GetLinesAsGlyphs( std::vector<std::unique_ptr<GLYPH>>* aGlyph
|
|||
|
||||
|
||||
void OUTLINE_FONT::GetLinesAsGlyphs( std::vector<std::unique_ptr<GLYPH>>* aGlyphs,
|
||||
const UTF8& aText, const VECTOR2I& aPosition,
|
||||
const wxString& aText, const VECTOR2I& aPosition,
|
||||
const TEXT_ATTRIBUTES& aAttrs ) const
|
||||
{
|
||||
wxArrayString strings;
|
||||
|
@ -221,14 +221,14 @@ void OUTLINE_FONT::GetLinesAsGlyphs( std::vector<std::unique_ptr<GLYPH>>* aGlyph
|
|||
|
||||
for( size_t i = 0; i < strings.GetCount(); i++ )
|
||||
{
|
||||
(void) drawMarkup( nullptr, aGlyphs, UTF8( strings.Item( i ) ), positions[i],
|
||||
aAttrs.m_Size, aAttrs.m_Angle, aAttrs.m_Mirrored, aPosition, textStyle );
|
||||
(void) drawMarkup( nullptr, aGlyphs, strings.Item( i ), positions[i], aAttrs.m_Size,
|
||||
aAttrs.m_Angle, aAttrs.m_Mirrored, aPosition, textStyle );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VECTOR2I OUTLINE_FONT::GetTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_ptr<GLYPH>>* aGlyphs,
|
||||
const UTF8& aText, const VECTOR2I& aSize,
|
||||
const wxString& aText, const VECTOR2I& aSize,
|
||||
const VECTOR2I& aPosition, const EDA_ANGLE& aAngle,
|
||||
bool aMirror, const VECTOR2I& aOrigin,
|
||||
TEXT_STYLE_FLAGS aTextStyle ) const
|
||||
|
@ -396,7 +396,7 @@ VECTOR2I OUTLINE_FONT::GetTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_pt
|
|||
/*
|
||||
* WIP: eeschema (and PDF output?) should use pixel rendering instead of linear segmentation
|
||||
*/
|
||||
void OUTLINE_FONT::RenderToOpenGLCanvas( KIGFX::OPENGL_GAL& aGal, const UTF8& aString,
|
||||
void OUTLINE_FONT::RenderToOpenGLCanvas( KIGFX::OPENGL_GAL& aGal, const wxString& aString,
|
||||
const VECTOR2D& aGlyphSize, const VECTOR2I& aPosition,
|
||||
const EDA_ANGLE& aOrientation, bool aIsMirrored ) const
|
||||
{
|
||||
|
|
|
@ -209,7 +209,7 @@ double STROKE_FONT::ComputeOverbarVerticalPosition( double aGlyphHeight ) const
|
|||
|
||||
|
||||
VECTOR2I STROKE_FONT::GetTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_ptr<GLYPH>>* aGlyphs,
|
||||
const UTF8& aText, const VECTOR2I& aSize,
|
||||
const wxString& aText, const VECTOR2I& aSize,
|
||||
const VECTOR2I& aPosition, const EDA_ANGLE& aAngle,
|
||||
bool aMirror, const VECTOR2I& aOrigin,
|
||||
TEXT_STYLE_FLAGS aTextStyle ) const
|
||||
|
@ -236,25 +236,19 @@ VECTOR2I STROKE_FONT::GetTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_ptr
|
|||
}
|
||||
}
|
||||
|
||||
for( UTF8::uni_iter i = aText.ubegin(), end = aText.uend(); i < end; ++i )
|
||||
for( wxUniChar c : aText )
|
||||
{
|
||||
// Index into bounding boxes table
|
||||
int dd = (signed) *i - ' ';
|
||||
|
||||
if( dd >= (int) m_glyphBoundingBoxes->size() || dd < 0 )
|
||||
if( c >= (int) m_glyphBoundingBoxes->size() || c < 0 )
|
||||
{
|
||||
switch( *i )
|
||||
{
|
||||
case '\t':
|
||||
// TAB->SPACE
|
||||
dd = 0;
|
||||
break;
|
||||
default:
|
||||
// everything else is turned into a '?'
|
||||
dd = '?' - ' ';
|
||||
}
|
||||
if( c == '\t' )
|
||||
c = ' ';
|
||||
else
|
||||
c = '?';
|
||||
}
|
||||
|
||||
// Index into bounding boxes table
|
||||
int dd = (signed) c - ' ';
|
||||
|
||||
if( dd == 0 )
|
||||
{
|
||||
// 'space' character - draw nothing, advance cursor position
|
||||
|
@ -275,7 +269,7 @@ VECTOR2I STROKE_FONT::GetTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_ptr
|
|||
|
||||
glyphExtents *= glyphSize;
|
||||
|
||||
if( tilt )
|
||||
if( tilt > 0.0 )
|
||||
glyphExtents.x -= glyphExtents.y * tilt;
|
||||
|
||||
cursor.x += glyphExtents.x;
|
||||
|
|
|
@ -261,6 +261,62 @@ void PDF_PLOTTER::Circle( const VECTOR2I& pos, int diametre, FILL_T aFill, int w
|
|||
}
|
||||
|
||||
|
||||
void PDF_PLOTTER::Arc( const VECTOR2I& aCenter, const VECTOR2I& aStart, const VECTOR2I& aEnd,
|
||||
FILL_T aFill, int aWidth, int aMaxError )
|
||||
{
|
||||
wxASSERT( workFile );
|
||||
|
||||
/*
|
||||
* Arcs are not so easily approximated by beziers (in the general case), so we approximate
|
||||
* them in the old way
|
||||
*/
|
||||
EDA_ANGLE startAngle( aStart - aCenter );
|
||||
EDA_ANGLE endAngle( aEnd - aCenter );
|
||||
int radius = ( aStart - aCenter ).EuclideanNorm();
|
||||
int numSegs = GetArcToSegmentCount( radius, aMaxError, FULL_CIRCLE );
|
||||
EDA_ANGLE delta = ANGLE_360 / std::max( 8, numSegs );
|
||||
VECTOR2I start( aStart );
|
||||
VECTOR2I end( aEnd );
|
||||
VECTOR2I pt;
|
||||
|
||||
if( startAngle > endAngle )
|
||||
{
|
||||
if( endAngle < ANGLE_0 )
|
||||
endAngle.Normalize();
|
||||
else
|
||||
startAngle = startAngle.Normalize() - ANGLE_360;
|
||||
}
|
||||
|
||||
SetCurrentLineWidth( aWidth );
|
||||
VECTOR2D pos_dev = userToDeviceCoordinates( start );
|
||||
fprintf( workFile, "%g %g m ", pos_dev.x, pos_dev.y );
|
||||
|
||||
for( EDA_ANGLE ii = delta; startAngle + ii < endAngle; ii += delta )
|
||||
{
|
||||
pt = start;
|
||||
RotatePoint( pt, aCenter, -ii );
|
||||
|
||||
pos_dev = userToDeviceCoordinates( pt );
|
||||
fprintf( workFile, "%g %g l ", pos_dev.x, pos_dev.y );
|
||||
}
|
||||
|
||||
pos_dev = userToDeviceCoordinates( end );
|
||||
fprintf( workFile, "%g %g l ", pos_dev.x, pos_dev.y );
|
||||
|
||||
// The arc is drawn... if not filled we stroke it, otherwise we finish
|
||||
// closing the pie at the center
|
||||
if( aFill == FILL_T::NO_FILL )
|
||||
{
|
||||
fputs( "S\n", workFile );
|
||||
}
|
||||
else
|
||||
{
|
||||
pos_dev = userToDeviceCoordinates( aCenter );
|
||||
fprintf( workFile, "%g %g l b\n", pos_dev.x, pos_dev.y );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PDF_PLOTTER::Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
|
||||
const EDA_ANGLE& aEndAngle, int aRadius, FILL_T aFill, int aWidth )
|
||||
{
|
||||
|
@ -282,6 +338,9 @@ void PDF_PLOTTER::Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
|
|||
VECTOR2I end;
|
||||
const EDA_ANGLE delta( 5, DEGREES_T ); // increment to draw circles
|
||||
|
||||
startAngle = ANGLE_180 - startAngle;
|
||||
endAngle = ANGLE_180 - endAngle;
|
||||
|
||||
if( startAngle > endAngle )
|
||||
std::swap( startAngle, endAngle );
|
||||
|
||||
|
|
|
@ -587,48 +587,40 @@ void PS_PLOTTER::Circle( const VECTOR2I& pos, int diametre, FILL_T fill, int wid
|
|||
}
|
||||
|
||||
|
||||
void PS_PLOTTER::Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
|
||||
const EDA_ANGLE& aEndAngle, int aRadius, FILL_T aFill, int aWidth )
|
||||
VECTOR2D mapCoords( const VECTOR2D& aSource )
|
||||
{
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
if( aRadius <= 0 )
|
||||
return;
|
||||
|
||||
EDA_ANGLE startAngle( aStartAngle );
|
||||
EDA_ANGLE endAngle( aEndAngle );
|
||||
|
||||
if( startAngle > endAngle )
|
||||
std::swap( startAngle, endAngle );
|
||||
|
||||
SetCurrentLineWidth( aWidth );
|
||||
|
||||
// Calculate start point.
|
||||
VECTOR2D centre_dev = userToDeviceCoordinates( aCenter );
|
||||
double radius_dev = userToDeviceSize( aRadius );
|
||||
|
||||
if( m_plotMirror )
|
||||
{
|
||||
if( m_mirrorIsHorizontal )
|
||||
{
|
||||
startAngle = ANGLE_180 - startAngle;
|
||||
endAngle = ANGLE_180 - endAngle;
|
||||
std::swap( startAngle, endAngle );
|
||||
}
|
||||
else
|
||||
{
|
||||
startAngle = -startAngle;
|
||||
endAngle = -endAngle;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf( m_outputFile, "%g %g %g %g %g arc%d\n", centre_dev.x, centre_dev.y,
|
||||
radius_dev, startAngle.AsDegrees(), endAngle.AsDegrees(), getFillId( aFill ) );
|
||||
return VECTOR2D( aSource.x, aSource.y );
|
||||
}
|
||||
|
||||
|
||||
void PS_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
|
||||
int aWidth, void * aData )
|
||||
void PS_PLOTTER::Arc( const VECTOR2I& aCenter, const VECTOR2I& aStart, const VECTOR2I& aEnd,
|
||||
FILL_T aFill, int aWidth, int aMaxError )
|
||||
{
|
||||
wxASSERT( m_outputFile );
|
||||
|
||||
VECTOR2D center_device = userToDeviceCoordinates( aCenter );
|
||||
VECTOR2D start_device = userToDeviceCoordinates( aStart );
|
||||
VECTOR2D end_device = userToDeviceCoordinates( aEnd );
|
||||
double radius_device = ( start_device - center_device ).EuclideanNorm();
|
||||
EDA_ANGLE startAngle( mapCoords( start_device - center_device ) );
|
||||
EDA_ANGLE endAngle( mapCoords( end_device - center_device ) );
|
||||
|
||||
// userToDeviceCoordinates gets our start/ends out of order
|
||||
std::swap( startAngle, endAngle );
|
||||
|
||||
SetCurrentLineWidth( aWidth );
|
||||
|
||||
fprintf( m_outputFile, "%g %g %g %g %g arc%d\n",
|
||||
center_device.x,
|
||||
center_device.y,
|
||||
radius_device,
|
||||
startAngle.AsDegrees(),
|
||||
endAngle.AsDegrees(),
|
||||
getFillId( aFill ) );
|
||||
}
|
||||
|
||||
void PS_PLOTTER::PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill, int aWidth,
|
||||
void* aData )
|
||||
{
|
||||
if( aCornerList.size() <= 1 )
|
||||
return;
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include <callback_gal.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
|
||||
PLOTTER::PLOTTER( )
|
||||
{
|
||||
m_plotScale = 1;
|
||||
|
@ -154,6 +153,49 @@ double PLOTTER::GetDashGapLenIU() const
|
|||
}
|
||||
|
||||
|
||||
void PLOTTER::Arc( const VECTOR2I& aCenter, const VECTOR2I& aStart, const VECTOR2I& aEnd,
|
||||
FILL_T aFill, int aWidth, int aMaxError )
|
||||
{
|
||||
EDA_ANGLE startAngle( aStart - aCenter );
|
||||
EDA_ANGLE endAngle( aEnd - aCenter );
|
||||
int radius = ( aStart - aCenter ).EuclideanNorm();
|
||||
int numSegs = GetArcToSegmentCount( radius, aMaxError, FULL_CIRCLE );
|
||||
EDA_ANGLE delta = ANGLE_360 / std::max( 8, numSegs );
|
||||
VECTOR2I start( aStart );
|
||||
VECTOR2I end( aEnd );
|
||||
VECTOR2I pt;
|
||||
|
||||
if( startAngle > endAngle )
|
||||
{
|
||||
if( endAngle < ANGLE_0 )
|
||||
endAngle.Normalize();
|
||||
else
|
||||
startAngle = startAngle.Normalize() - ANGLE_360;
|
||||
}
|
||||
|
||||
SetCurrentLineWidth( aWidth );
|
||||
MoveTo( start );
|
||||
|
||||
for( EDA_ANGLE ii = delta; startAngle + ii < endAngle; ii += delta )
|
||||
{
|
||||
pt = start;
|
||||
RotatePoint( pt, aCenter, -ii );
|
||||
|
||||
LineTo( pt );
|
||||
}
|
||||
|
||||
if( aFill == FILL_T::NO_FILL )
|
||||
{
|
||||
FinishTo( end );
|
||||
}
|
||||
else
|
||||
{
|
||||
LineTo( end );
|
||||
FinishTo( aCenter );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PLOTTER::Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
|
||||
const EDA_ANGLE& aEndAngle, int aRadius, FILL_T aFill, int aWidth )
|
||||
{
|
||||
|
|
|
@ -1025,15 +1025,14 @@ void wxStringSplit( const wxString& aText, wxArrayString& aStrings, wxChar aSpli
|
|||
aStrings.Add( tmp );
|
||||
tmp.Clear();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
tmp << aText[ii];
|
||||
}
|
||||
}
|
||||
|
||||
if( !tmp.IsEmpty() )
|
||||
{
|
||||
aStrings.Add( tmp );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ set( EESCHEMA_DLGS
|
|||
dialogs/dialog_edit_symbols_libid.cpp
|
||||
dialogs/dialog_edit_symbols_libid_base.cpp
|
||||
dialogs/dialog_field_properties.cpp
|
||||
dialogs/dialog_field_properties_base.cpp
|
||||
dialogs/dialog_eeschema_page_settings.cpp
|
||||
dialogs/dialog_erc.cpp
|
||||
dialogs/dialog_erc_base.cpp
|
||||
|
@ -72,6 +73,8 @@ set( EESCHEMA_DLGS
|
|||
dialogs/dialog_lib_edit_pin_table_base.cpp
|
||||
dialogs/dialog_lib_text_properties.cpp
|
||||
dialogs/dialog_lib_text_properties_base.cpp
|
||||
dialogs/dialog_lib_textbox_properties.cpp
|
||||
dialogs/dialog_lib_textbox_properties_base.cpp
|
||||
dialogs/dialog_lib_new_symbol.cpp
|
||||
dialogs/dialog_lib_new_symbol_base.cpp
|
||||
dialogs/dialog_lib_shape_properties.cpp
|
||||
|
@ -187,6 +190,7 @@ set( EESCHEMA_SRCS
|
|||
lib_pin.cpp
|
||||
lib_symbol.cpp
|
||||
lib_text.cpp
|
||||
lib_textbox.cpp
|
||||
libarch.cpp
|
||||
menubar.cpp
|
||||
pin_numbers.cpp
|
||||
|
@ -216,6 +220,7 @@ set( EESCHEMA_SRCS
|
|||
sch_sheet_pin.cpp
|
||||
sch_symbol.cpp
|
||||
sch_text.cpp
|
||||
sch_textbox.cpp
|
||||
sch_validators.cpp
|
||||
schematic.cpp
|
||||
schematic_settings.cpp
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES( SCH_BASE_FRAME* aParent, const wxString& aTitle,
|
||||
const EDA_TEXT* aTextItem ) :
|
||||
DIALOG_LIB_TEXT_PROPERTIES_BASE( aParent ),
|
||||
DIALOG_FIELD_PROPERTIES_BASE( aParent ),
|
||||
m_posX( aParent, m_xPosLabel, m_xPosCtrl, m_xPosUnits, true ),
|
||||
m_posY( aParent, m_yPosLabel, m_yPosCtrl, m_yPosUnits, true ),
|
||||
m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true ),
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
|
||||
#ifndef DIALOG_EDIT_ONE_FIELD_H_
|
||||
#define DIALOG_EDIT_ONE_FIELD_H_
|
||||
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2016 Wayne Stambaugh, stambaughw@gmail.com
|
||||
* Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -27,7 +23,10 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <dialog_lib_text_properties_base.h>
|
||||
#ifndef DIALOG_FIELD_PROPERTIES_H
|
||||
#define DIALOG_FIELD_PROPERTIES_H
|
||||
|
||||
#include <dialog_field_properties_base.h>
|
||||
#include <widgets/unit_binder.h>
|
||||
#include <lib_field.h>
|
||||
#include <template_fieldnames.h>
|
||||
|
@ -44,7 +43,7 @@ class SCINTILLA_TRICKS;
|
|||
* This class is setup in expectation of its children possibly using Kiway player so
|
||||
* #DIALOG_SHIM::ShowQuasiModal is required when calling any subclasses.
|
||||
*/
|
||||
class DIALOG_FIELD_PROPERTIES : public DIALOG_LIB_TEXT_PROPERTIES_BASE
|
||||
class DIALOG_FIELD_PROPERTIES : public DIALOG_FIELD_PROPERTIES_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_FIELD_PROPERTIES( SCH_BASE_FRAME* aParent, const wxString& aTitle,
|
||||
|
@ -147,4 +146,4 @@ private:
|
|||
bool m_isSheetFilename;
|
||||
};
|
||||
|
||||
#endif // DIALOG_EDIT_ONE_FIELD_H_
|
||||
#endif // DIALOG_FIELD_PROPERTIES_H
|
||||
|
|
|
@ -0,0 +1,296 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "widgets/bitmap_button.h"
|
||||
#include "widgets/font_choice.h"
|
||||
|
||||
#include "dialog_field_properties_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_FIELD_PROPERTIES_BASE::DIALOG_FIELD_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bPropertiesSizer;
|
||||
bPropertiesSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bUpperBoxSizer;
|
||||
bUpperBoxSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bTextValueBoxSizer;
|
||||
bTextValueBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_textLabel = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textLabel->Wrap( -1 );
|
||||
bTextValueBoxSizer->Add( m_textLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_TextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bTextValueBoxSizer->Add( m_TextCtrl, 1, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_StyledTextCtrl = new wxStyledTextCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN, wxEmptyString );
|
||||
m_StyledTextCtrl->SetUseTabs( true );
|
||||
m_StyledTextCtrl->SetTabWidth( 4 );
|
||||
m_StyledTextCtrl->SetIndent( 4 );
|
||||
m_StyledTextCtrl->SetTabIndents( false );
|
||||
m_StyledTextCtrl->SetBackSpaceUnIndents( false );
|
||||
m_StyledTextCtrl->SetViewEOL( false );
|
||||
m_StyledTextCtrl->SetViewWhiteSpace( false );
|
||||
m_StyledTextCtrl->SetMarginWidth( 2, 0 );
|
||||
m_StyledTextCtrl->SetIndentationGuides( false );
|
||||
m_StyledTextCtrl->SetMarginWidth( 1, 0 );
|
||||
m_StyledTextCtrl->SetMarginWidth( 0, 0 );
|
||||
m_StyledTextCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUS );
|
||||
m_StyledTextCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDER, wxColour( wxT("BLACK") ) );
|
||||
m_StyledTextCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDER, wxColour( wxT("WHITE") ) );
|
||||
m_StyledTextCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_BOXMINUS );
|
||||
m_StyledTextCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDEROPEN, wxColour( wxT("BLACK") ) );
|
||||
m_StyledTextCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDEROPEN, wxColour( wxT("WHITE") ) );
|
||||
m_StyledTextCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_EMPTY );
|
||||
m_StyledTextCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_BOXPLUS );
|
||||
m_StyledTextCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDEREND, wxColour( wxT("BLACK") ) );
|
||||
m_StyledTextCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDEREND, wxColour( wxT("WHITE") ) );
|
||||
m_StyledTextCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_BOXMINUS );
|
||||
m_StyledTextCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDEROPENMID, wxColour( wxT("BLACK") ) );
|
||||
m_StyledTextCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDEROPENMID, wxColour( wxT("WHITE") ) );
|
||||
m_StyledTextCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_EMPTY );
|
||||
m_StyledTextCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_EMPTY );
|
||||
m_StyledTextCtrl->SetSelBackground( true, wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
|
||||
m_StyledTextCtrl->SetSelForeground( true, wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
|
||||
bTextValueBoxSizer->Add( m_StyledTextCtrl, 1, wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_TextValueSelectButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bTextValueBoxSizer->Add( m_TextValueSelectButton, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
bUpperBoxSizer->Add( bTextValueBoxSizer, 1, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_note = new wxStaticText( this, wxID_ANY, _("(%s)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_note->Wrap( -1 );
|
||||
bUpperBoxSizer->Add( m_note, 0, wxBOTTOM|wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
|
||||
bPropertiesSizer->Add( bUpperBoxSizer, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizer9;
|
||||
bSizer9 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_visible = new wxCheckBox( this, wxID_ANY, _("Visible"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer9->Add( m_visible, 0, wxALIGN_LEFT|wxBOTTOM, 2 );
|
||||
|
||||
|
||||
bPropertiesSizer->Add( bSizer9, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
wxGridBagSizer* gbSizer1;
|
||||
gbSizer1 = new wxGridBagSizer( 3, 0 );
|
||||
gbSizer1->SetFlexibleDirection( wxBOTH );
|
||||
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
gbSizer1->SetEmptyCellSize( wxSize( -1,10 ) );
|
||||
|
||||
m_fontLabel = new wxStaticText( this, wxID_ANY, _("Font:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_fontLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_fontLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
|
||||
|
||||
wxString m_fontCtrlChoices[] = { _("Default Font"), _("KiCad Font") };
|
||||
int m_fontCtrlNChoices = sizeof( m_fontCtrlChoices ) / sizeof( wxString );
|
||||
m_fontCtrl = new FONT_CHOICE( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_fontCtrlNChoices, m_fontCtrlChoices, 0 );
|
||||
m_fontCtrl->SetSelection( 0 );
|
||||
gbSizer1->Add( m_fontCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* formattingSizer;
|
||||
formattingSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_separator1 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_separator1->Enable( false );
|
||||
|
||||
formattingSizer->Add( m_separator1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_horizontal = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_horizontal->SetToolTip( _("Horizontal text") );
|
||||
|
||||
formattingSizer->Add( m_horizontal, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_vertical = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_vertical->SetToolTip( _("Vertical text") );
|
||||
|
||||
formattingSizer->Add( m_vertical, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_separator2 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_separator2->Enable( false );
|
||||
|
||||
formattingSizer->Add( m_separator2, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_bold = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_bold->SetToolTip( _("Bold") );
|
||||
|
||||
formattingSizer->Add( m_bold, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_italic = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_italic->SetToolTip( _("Italic") );
|
||||
|
||||
formattingSizer->Add( m_italic, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_separator3 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_separator3->Enable( false );
|
||||
|
||||
formattingSizer->Add( m_separator3, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_hAlignLeft = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_hAlignLeft->SetToolTip( _("Align left") );
|
||||
|
||||
formattingSizer->Add( m_hAlignLeft, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_hAlignCenter = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_hAlignCenter->SetToolTip( _("Align horizontal center") );
|
||||
|
||||
formattingSizer->Add( m_hAlignCenter, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_hAlignRight = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_hAlignRight->SetToolTip( _("Align right") );
|
||||
|
||||
formattingSizer->Add( m_hAlignRight, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_separator4 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_separator4->Enable( false );
|
||||
|
||||
formattingSizer->Add( m_separator4, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_vAlignTop = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_vAlignTop->SetToolTip( _("Align top") );
|
||||
|
||||
formattingSizer->Add( m_vAlignTop, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_vAlignCenter = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_vAlignCenter->SetToolTip( _("Align vertical center") );
|
||||
|
||||
formattingSizer->Add( m_vAlignCenter, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_vAlignBottom = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_vAlignBottom->SetToolTip( _("Align bottom") );
|
||||
|
||||
formattingSizer->Add( m_vAlignBottom, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_separator5 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_separator5->Enable( false );
|
||||
|
||||
formattingSizer->Add( m_separator5, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
gbSizer1->Add( formattingSizer, wxGBPosition( 0, 3 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
|
||||
|
||||
m_textSizeLabel = new wxStaticText( this, wxID_ANY, _("Text size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textSizeLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_textSizeLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_textSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_textSizeCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_textSizeUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textSizeUnits->Wrap( -1 );
|
||||
gbSizer1->Add( m_textSizeUnits, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_xPosLabel = new wxStaticText( this, wxID_ANY, _("Position X:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_xPosLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_xPosLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_xPosCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_xPosCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_xPosUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_xPosUnits->Wrap( -1 );
|
||||
gbSizer1->Add( m_xPosUnits, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_yPosLabel = new wxStaticText( this, wxID_ANY, _("Position Y:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_yPosLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_yPosLabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_yPosCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_yPosCtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_yPosUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_yPosUnits->Wrap( -1 );
|
||||
gbSizer1->Add( m_yPosUnits, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_CommonUnit = new wxCheckBox( this, wxID_ANY, _("Common to all units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_CommonUnit, wxGBPosition( 3, 4 ), wxGBSpan( 1, 1 ), wxRIGHT, 5 );
|
||||
|
||||
m_CommonConvert = new wxCheckBox( this, wxID_ANY, _("Common to all body styles"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_CommonConvert, wxGBPosition( 4, 4 ), wxGBSpan( 1, 1 ), wxRIGHT, 5 );
|
||||
|
||||
|
||||
bPropertiesSizer->Add( gbSizer1, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxFlexGridSizer* fgSizer3;
|
||||
fgSizer3 = new wxFlexGridSizer( 5, 4, 3, 3 );
|
||||
fgSizer3->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
|
||||
fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
fgSizer3->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bPropertiesSizer->Add( fgSizer3, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxBoxSizer* bBottomtBoxSizer;
|
||||
bBottomtBoxSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
bPropertiesSizer->Add( bBottomtBoxSizer, 0, wxEXPAND|wxTOP|wxLEFT, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( bPropertiesSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bMainSizer->Add( m_staticline2, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
m_sdbSizerButtons = new wxStdDialogButtonSizer();
|
||||
m_sdbSizerButtonsOK = new wxButton( this, wxID_OK );
|
||||
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsOK );
|
||||
m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL );
|
||||
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel );
|
||||
m_sdbSizerButtons->Realize();
|
||||
|
||||
bMainSizer->Add( m_sdbSizerButtons, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
bMainSizer->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIELD_PROPERTIES_BASE::OnCloseDialog ) );
|
||||
m_TextCtrl->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_FIELD_PROPERTIES_BASE::OnSetFocusText ), NULL, this );
|
||||
m_StyledTextCtrl->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_FIELD_PROPERTIES_BASE::onMultiLineTCLostFocus ), NULL, this );
|
||||
m_StyledTextCtrl->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_FIELD_PROPERTIES_BASE::OnSetFocusText ), NULL, this );
|
||||
m_TextValueSelectButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIELD_PROPERTIES_BASE::OnTextValueSelectButtonClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_FIELD_PROPERTIES_BASE::~DIALOG_FIELD_PROPERTIES_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIELD_PROPERTIES_BASE::OnCloseDialog ) );
|
||||
m_TextCtrl->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_FIELD_PROPERTIES_BASE::OnSetFocusText ), NULL, this );
|
||||
m_StyledTextCtrl->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_FIELD_PROPERTIES_BASE::onMultiLineTCLostFocus ), NULL, this );
|
||||
m_StyledTextCtrl->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_FIELD_PROPERTIES_BASE::OnSetFocusText ), NULL, this );
|
||||
m_TextValueSelectButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIELD_PROPERTIES_BASE::OnTextValueSelectButtonClick ), NULL, this );
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,99 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class BITMAP_BUTTON;
|
||||
class FONT_CHOICE;
|
||||
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/stc/stc.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/gbsizer.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_FIELD_PROPERTIES_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_FIELD_PROPERTIES_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_textLabel;
|
||||
wxTextCtrl* m_TextCtrl;
|
||||
wxStyledTextCtrl* m_StyledTextCtrl;
|
||||
wxBitmapButton* m_TextValueSelectButton;
|
||||
wxStaticText* m_note;
|
||||
wxCheckBox* m_visible;
|
||||
wxStaticText* m_fontLabel;
|
||||
FONT_CHOICE* m_fontCtrl;
|
||||
BITMAP_BUTTON* m_separator1;
|
||||
BITMAP_BUTTON* m_horizontal;
|
||||
BITMAP_BUTTON* m_vertical;
|
||||
BITMAP_BUTTON* m_separator2;
|
||||
BITMAP_BUTTON* m_bold;
|
||||
BITMAP_BUTTON* m_italic;
|
||||
BITMAP_BUTTON* m_separator3;
|
||||
BITMAP_BUTTON* m_hAlignLeft;
|
||||
BITMAP_BUTTON* m_hAlignCenter;
|
||||
BITMAP_BUTTON* m_hAlignRight;
|
||||
BITMAP_BUTTON* m_separator4;
|
||||
BITMAP_BUTTON* m_vAlignTop;
|
||||
BITMAP_BUTTON* m_vAlignCenter;
|
||||
BITMAP_BUTTON* m_vAlignBottom;
|
||||
BITMAP_BUTTON* m_separator5;
|
||||
wxStaticText* m_textSizeLabel;
|
||||
wxTextCtrl* m_textSizeCtrl;
|
||||
wxStaticText* m_textSizeUnits;
|
||||
wxStaticText* m_xPosLabel;
|
||||
wxTextCtrl* m_xPosCtrl;
|
||||
wxStaticText* m_xPosUnits;
|
||||
wxStaticText* m_yPosLabel;
|
||||
wxTextCtrl* m_yPosCtrl;
|
||||
wxStaticText* m_yPosUnits;
|
||||
wxCheckBox* m_CommonUnit;
|
||||
wxCheckBox* m_CommonConvert;
|
||||
wxStaticLine* m_staticline2;
|
||||
wxStdDialogButtonSizer* m_sdbSizerButtons;
|
||||
wxButton* m_sdbSizerButtonsOK;
|
||||
wxButton* m_sdbSizerButtonsCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void OnSetFocusText( wxFocusEvent& event ) { event.Skip(); }
|
||||
virtual void onMultiLineTCLostFocus( wxFocusEvent& event ) { event.Skip(); }
|
||||
virtual void OnTextValueSelectButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_FIELD_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Item Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_FIELD_PROPERTIES_BASE();
|
||||
|
||||
};
|
||||
|
|
@ -43,10 +43,6 @@
|
|||
#include <sch_label.h>
|
||||
|
||||
|
||||
class SCH_EDIT_FRAME;
|
||||
class SCH_TEXT;
|
||||
|
||||
|
||||
DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_LABEL_BASE* aLabel ) :
|
||||
DIALOG_LABEL_PROPERTIES_BASE( aParent ),
|
||||
m_activeTextEntry( nullptr ),
|
||||
|
@ -238,8 +234,8 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataToWindow()
|
|||
{
|
||||
for( SCH_ITEM* item : screen->Items().OfType( m_currentLabel->Type() ) )
|
||||
{
|
||||
const SCH_TEXT* textItem = static_cast<const SCH_TEXT*>( item );
|
||||
existingLabels.insert( UnescapeString( textItem->GetText() ) );
|
||||
const SCH_LABEL_BASE* label = static_cast<const SCH_LABEL_BASE*>( item );
|
||||
existingLabels.insert( UnescapeString( label->GetText() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -508,7 +504,7 @@ void DIALOG_LABEL_PROPERTIES::onSpinButton( wxCommandEvent& aEvent )
|
|||
|
||||
void DIALOG_LABEL_PROPERTIES::OnFormattingHelp( wxHyperlinkEvent& aEvent )
|
||||
{
|
||||
m_helpWindow = SCH_TEXT::ShowSyntaxHelp( this );
|
||||
m_helpWindow = SCH_LABEL_BASE::ShowSyntaxHelp( this );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -26,13 +26,11 @@
|
|||
|
||||
#include <fields_grid_table.h>
|
||||
#include <widgets/unit_binder.h>
|
||||
#include <sch_text.h>
|
||||
#include <sch_validators.h>
|
||||
#include <dialog_label_properties_base.h>
|
||||
|
||||
|
||||
class SCH_EDIT_FRAME;
|
||||
class SCH_TEXT;
|
||||
class HTML_MESSAGE_BOX;
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2006-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2006-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -73,6 +73,7 @@ bool DIALOG_LIB_SHAPE_PROPERTIES::TransferDataToWindow()
|
|||
if( shape )
|
||||
m_lineWidth.SetValue( shape->GetWidth() );
|
||||
|
||||
m_privateCheckbox->SetValue( m_item->IsPrivate() );
|
||||
m_checkApplyToAllUnits->SetValue( m_item->GetUnit() == 0 );
|
||||
m_checkApplyToAllUnits->Enable( symbol && symbol->GetUnitCount() > 1 );
|
||||
m_checkApplyToAllConversions->SetValue( m_item->GetConvert() == 0 );
|
||||
|
@ -183,6 +184,8 @@ bool DIALOG_LIB_SHAPE_PROPERTIES::TransferDataFromWindow()
|
|||
shape->SetStroke( stroke );
|
||||
}
|
||||
|
||||
m_item->SetPrivate( m_privateCheckbox->GetValue() );
|
||||
|
||||
if( GetApplyToAllConversions() )
|
||||
m_item->SetConvert( 0 );
|
||||
else
|
||||
|
|
|
@ -78,6 +78,12 @@ DIALOG_LIB_SHAPE_PROPERTIES_BASE::DIALOG_LIB_SHAPE_PROPERTIES_BASE( wxWindow* pa
|
|||
|
||||
dlgBorderSizer->Add( bSizerFill, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
m_privateCheckbox = new wxCheckBox( this, wxID_ANY, _("Private to Symbol Editor"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
dlgBorderSizer->Add( m_privateCheckbox, 0, wxALL, 3 );
|
||||
|
||||
|
||||
dlgBorderSizer->Add( 0, 8, 1, wxEXPAND, 5 );
|
||||
|
||||
m_checkApplyToAllUnits = new wxCheckBox( this, wxID_ANY, _("Common to all &units in symbol"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
dlgBorderSizer->Add( m_checkApplyToAllUnits, 0, wxALL, 3 );
|
||||
|
||||
|
|
|
@ -693,6 +693,80 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">3</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">Private to Symbol Editor</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_privateCheckbox</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="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">8</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">3</property>
|
||||
<property name="flag">wxALL</property>
|
||||
|
|
|
@ -61,6 +61,7 @@ class DIALOG_LIB_SHAPE_PROPERTIES_BASE : public DIALOG_SHIM
|
|||
wxRadioButton* m_rbFillBackground;
|
||||
wxRadioButton* m_rbFillCustom;
|
||||
COLOR_SWATCH* m_colorSwatch;
|
||||
wxCheckBox* m_privateCheckbox;
|
||||
wxCheckBox* m_checkApplyToAllUnits;
|
||||
wxCheckBox* m_checkApplyToAllConversions;
|
||||
wxStaticLine* m_staticline;
|
||||
|
|
|
@ -36,8 +36,6 @@
|
|||
DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES( SYMBOL_EDIT_FRAME* aParent,
|
||||
LIB_TEXT* aText ) :
|
||||
DIALOG_LIB_TEXT_PROPERTIES_BASE( aParent ),
|
||||
m_posX( aParent, m_xPosLabel, m_xPosCtrl, m_xPosUnits, true ),
|
||||
m_posY( aParent, m_yPosLabel, m_yPosCtrl, m_yPosUnits, true ),
|
||||
m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true )
|
||||
{
|
||||
m_parent = aParent;
|
||||
|
@ -49,15 +47,7 @@ DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES( SYMBOL_EDIT_FRAME* aPare
|
|||
wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
|
||||
} );
|
||||
|
||||
// Disable options for fieldedit, not existing in graphic text
|
||||
m_visible->Show( false );
|
||||
m_TextValueSelectButton->Hide();
|
||||
|
||||
m_note->SetFont( KIUI::GetInfoFont( this ).Italic() );
|
||||
m_note->Show( false );
|
||||
|
||||
SetInitialFocus( m_TextCtrl );
|
||||
m_StyledTextCtrl->Show( false );
|
||||
SetInitialFocus( m_StyledTextCtrl );
|
||||
|
||||
m_separator1->SetIsSeparator();
|
||||
|
||||
|
@ -128,15 +118,15 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow()
|
|||
{
|
||||
if( m_graphicText )
|
||||
{
|
||||
m_posX.SetValue( m_graphicText->GetPosition().x );
|
||||
m_posY.SetValue( m_graphicText->GetPosition().y );
|
||||
m_textSize.SetValue( m_graphicText->GetTextWidth() );
|
||||
m_TextCtrl->SetValue( m_graphicText->GetText() );
|
||||
m_StyledTextCtrl->SetValue( m_graphicText->GetText() );
|
||||
|
||||
m_fontCtrl->SetFontSelection( m_graphicText->GetFont() );
|
||||
|
||||
m_italic->Check( m_graphicText->IsItalic() );
|
||||
m_bold->Check( m_graphicText->IsBold() );
|
||||
|
||||
m_privateCheckbox->SetValue( m_graphicText->IsPrivate() );
|
||||
m_CommonUnit->SetValue( m_graphicText->GetUnit() == 0 );
|
||||
m_CommonConvert->SetValue( m_graphicText->GetConvert() == 0 );
|
||||
|
||||
|
@ -213,10 +203,10 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow()
|
|||
{
|
||||
if( m_graphicText )
|
||||
{
|
||||
if( m_TextCtrl->GetValue().IsEmpty() )
|
||||
if( m_StyledTextCtrl->GetValue().IsEmpty() )
|
||||
m_graphicText->SetText( wxT( "[null]" ) );
|
||||
else
|
||||
m_graphicText->SetText( m_TextCtrl->GetValue() );
|
||||
m_graphicText->SetText( m_StyledTextCtrl->GetValue() );
|
||||
|
||||
if( m_fontCtrl->HaveFontSelection() )
|
||||
{
|
||||
|
@ -224,8 +214,6 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow()
|
|||
m_italic->IsChecked() ) );
|
||||
}
|
||||
|
||||
m_graphicText->SetPosition( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) );
|
||||
|
||||
if( m_textSize.GetValue() != m_graphicText->GetTextWidth() )
|
||||
m_graphicText->SetTextSize( wxSize( m_textSize.GetValue(), m_textSize.GetValue() ) );
|
||||
|
||||
|
@ -234,6 +222,8 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow()
|
|||
else
|
||||
m_graphicText->SetTextAngle( ANGLE_VERTICAL );
|
||||
|
||||
m_graphicText->SetPrivate( m_privateCheckbox->GetValue() );
|
||||
|
||||
if( !m_CommonUnit->GetValue() )
|
||||
m_graphicText->SetUnit( m_parent->GetUnit() );
|
||||
else
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2001 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -52,8 +52,6 @@ private:
|
|||
SYMBOL_EDIT_FRAME* m_parent;
|
||||
LIB_TEXT* m_graphicText;
|
||||
|
||||
UNIT_BINDER m_posX;
|
||||
UNIT_BINDER m_posY;
|
||||
UNIT_BINDER m_textSize;
|
||||
SCINTILLA_TRICKS* m_scintillaTricks;
|
||||
};
|
||||
|
|
|
@ -22,18 +22,15 @@ DIALOG_LIB_TEXT_PROPERTIES_BASE::DIALOG_LIB_TEXT_PROPERTIES_BASE( wxWindow* pare
|
|||
wxBoxSizer* bPropertiesSizer;
|
||||
bPropertiesSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bUpperBoxSizer;
|
||||
bUpperBoxSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bTextValueBoxSizer;
|
||||
bTextValueBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
wxGridBagSizer* gbSizer1;
|
||||
gbSizer1 = new wxGridBagSizer( 3, 0 );
|
||||
gbSizer1->SetFlexibleDirection( wxBOTH );
|
||||
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
gbSizer1->SetEmptyCellSize( wxSize( -1,10 ) );
|
||||
|
||||
m_textLabel = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textLabel->Wrap( -1 );
|
||||
bTextValueBoxSizer->Add( m_textLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_TextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bTextValueBoxSizer->Add( m_TextCtrl, 1, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
gbSizer1->Add( m_textLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_StyledTextCtrl = new wxStyledTextCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN, wxEmptyString );
|
||||
m_StyledTextCtrl->SetUseTabs( true );
|
||||
|
@ -64,45 +61,17 @@ DIALOG_LIB_TEXT_PROPERTIES_BASE::DIALOG_LIB_TEXT_PROPERTIES_BASE( wxWindow* pare
|
|||
m_StyledTextCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_EMPTY );
|
||||
m_StyledTextCtrl->SetSelBackground( true, wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
|
||||
m_StyledTextCtrl->SetSelForeground( true, wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
|
||||
bTextValueBoxSizer->Add( m_StyledTextCtrl, 1, wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_TextValueSelectButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bTextValueBoxSizer->Add( m_TextValueSelectButton, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
bUpperBoxSizer->Add( bTextValueBoxSizer, 1, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_note = new wxStaticText( this, wxID_ANY, _("(%s)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_note->Wrap( -1 );
|
||||
bUpperBoxSizer->Add( m_note, 0, wxBOTTOM|wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
|
||||
bPropertiesSizer->Add( bUpperBoxSizer, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizer9;
|
||||
bSizer9 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_visible = new wxCheckBox( this, wxID_ANY, _("Visible"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer9->Add( m_visible, 0, wxALIGN_LEFT|wxBOTTOM, 2 );
|
||||
|
||||
|
||||
bPropertiesSizer->Add( bSizer9, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
wxGridBagSizer* gbSizer1;
|
||||
gbSizer1 = new wxGridBagSizer( 3, 0 );
|
||||
gbSizer1->SetFlexibleDirection( wxBOTH );
|
||||
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
gbSizer1->SetEmptyCellSize( wxSize( -1,10 ) );
|
||||
gbSizer1->Add( m_StyledTextCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 4 ), wxEXPAND, 5 );
|
||||
|
||||
m_fontLabel = new wxStaticText( this, wxID_ANY, _("Font:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_fontLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_fontLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
|
||||
gbSizer1->Add( m_fontLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
|
||||
|
||||
wxString m_fontCtrlChoices[] = { _("Default Font"), _("KiCad Font") };
|
||||
int m_fontCtrlNChoices = sizeof( m_fontCtrlChoices ) / sizeof( wxString );
|
||||
m_fontCtrl = new FONT_CHOICE( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_fontCtrlNChoices, m_fontCtrlChoices, 0 );
|
||||
m_fontCtrl->SetSelection( 0 );
|
||||
gbSizer1->Add( m_fontCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
|
||||
gbSizer1->Add( m_fontCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* formattingSizer;
|
||||
formattingSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
@ -183,49 +152,30 @@ DIALOG_LIB_TEXT_PROPERTIES_BASE::DIALOG_LIB_TEXT_PROPERTIES_BASE( wxWindow* pare
|
|||
formattingSizer->Add( m_separator5, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
gbSizer1->Add( formattingSizer, wxGBPosition( 0, 3 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
|
||||
gbSizer1->Add( formattingSizer, wxGBPosition( 2, 3 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
|
||||
|
||||
m_textSizeLabel = new wxStaticText( this, wxID_ANY, _("Text size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textSizeLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_textSizeLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
gbSizer1->Add( m_textSizeLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_textSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_textSizeCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
gbSizer1->Add( m_textSizeCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_textSizeUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textSizeUnits->Wrap( -1 );
|
||||
gbSizer1->Add( m_textSizeUnits, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
gbSizer1->Add( m_textSizeUnits, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_xPosLabel = new wxStaticText( this, wxID_ANY, _("Position X:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_xPosLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_xPosLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_xPosCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_xPosCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_xPosUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_xPosUnits->Wrap( -1 );
|
||||
gbSizer1->Add( m_xPosUnits, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_yPosLabel = new wxStaticText( this, wxID_ANY, _("Position Y:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_yPosLabel->Wrap( -1 );
|
||||
gbSizer1->Add( m_yPosLabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_yPosCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_yPosCtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_yPosUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_yPosUnits->Wrap( -1 );
|
||||
gbSizer1->Add( m_yPosUnits, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
m_privateCheckbox = new wxCheckBox( this, wxID_ANY, _("Private to Symbol Editor"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_privateCheckbox, wxGBPosition( 5, 0 ), wxGBSpan( 1, 2 ), wxLEFT, 5 );
|
||||
|
||||
m_CommonUnit = new wxCheckBox( this, wxID_ANY, _("Common to all units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_CommonUnit, wxGBPosition( 3, 4 ), wxGBSpan( 1, 1 ), wxRIGHT, 5 );
|
||||
gbSizer1->Add( m_CommonUnit, wxGBPosition( 5, 3 ), wxGBSpan( 1, 1 ), wxLEFT, 100 );
|
||||
|
||||
m_CommonConvert = new wxCheckBox( this, wxID_ANY, _("Common to all body styles"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
gbSizer1->Add( m_CommonConvert, wxGBPosition( 4, 4 ), wxGBSpan( 1, 1 ), wxRIGHT, 5 );
|
||||
gbSizer1->Add( m_CommonConvert, wxGBPosition( 6, 3 ), wxGBSpan( 1, 1 ), wxLEFT, 100 );
|
||||
|
||||
|
||||
bPropertiesSizer->Add( gbSizer1, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
bPropertiesSizer->Add( gbSizer1, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxFlexGridSizer* fgSizer3;
|
||||
fgSizer3 = new wxFlexGridSizer( 5, 4, 3, 3 );
|
||||
|
@ -278,19 +228,15 @@ DIALOG_LIB_TEXT_PROPERTIES_BASE::DIALOG_LIB_TEXT_PROPERTIES_BASE( wxWindow* pare
|
|||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_TEXT_PROPERTIES_BASE::OnCloseDialog ) );
|
||||
m_TextCtrl->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_LIB_TEXT_PROPERTIES_BASE::OnSetFocusText ), NULL, this );
|
||||
m_StyledTextCtrl->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_LIB_TEXT_PROPERTIES_BASE::onMultiLineTCLostFocus ), NULL, this );
|
||||
m_StyledTextCtrl->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_LIB_TEXT_PROPERTIES_BASE::OnSetFocusText ), NULL, this );
|
||||
m_TextValueSelectButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_TEXT_PROPERTIES_BASE::OnTextValueSelectButtonClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_LIB_TEXT_PROPERTIES_BASE::~DIALOG_LIB_TEXT_PROPERTIES_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_TEXT_PROPERTIES_BASE::OnCloseDialog ) );
|
||||
m_TextCtrl->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_LIB_TEXT_PROPERTIES_BASE::OnSetFocusText ), NULL, this );
|
||||
m_StyledTextCtrl->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_LIB_TEXT_PROPERTIES_BASE::onMultiLineTCLostFocus ), NULL, this );
|
||||
m_StyledTextCtrl->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_LIB_TEXT_PROPERTIES_BASE::OnSetFocusText ), NULL, this );
|
||||
m_TextValueSelectButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_TEXT_PROPERTIES_BASE::OnTextValueSelectButtonClick ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -20,16 +20,16 @@ class FONT_CHOICE;
|
|||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/stc/stc.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/gbsizer.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/dialog.h>
|
||||
|
@ -45,11 +45,7 @@ class DIALOG_LIB_TEXT_PROPERTIES_BASE : public DIALOG_SHIM
|
|||
|
||||
protected:
|
||||
wxStaticText* m_textLabel;
|
||||
wxTextCtrl* m_TextCtrl;
|
||||
wxStyledTextCtrl* m_StyledTextCtrl;
|
||||
wxBitmapButton* m_TextValueSelectButton;
|
||||
wxStaticText* m_note;
|
||||
wxCheckBox* m_visible;
|
||||
wxStaticText* m_fontLabel;
|
||||
FONT_CHOICE* m_fontCtrl;
|
||||
BITMAP_BUTTON* m_separator1;
|
||||
|
@ -70,12 +66,7 @@ class DIALOG_LIB_TEXT_PROPERTIES_BASE : public DIALOG_SHIM
|
|||
wxStaticText* m_textSizeLabel;
|
||||
wxTextCtrl* m_textSizeCtrl;
|
||||
wxStaticText* m_textSizeUnits;
|
||||
wxStaticText* m_xPosLabel;
|
||||
wxTextCtrl* m_xPosCtrl;
|
||||
wxStaticText* m_xPosUnits;
|
||||
wxStaticText* m_yPosLabel;
|
||||
wxTextCtrl* m_yPosCtrl;
|
||||
wxStaticText* m_yPosUnits;
|
||||
wxCheckBox* m_privateCheckbox;
|
||||
wxCheckBox* m_CommonUnit;
|
||||
wxCheckBox* m_CommonConvert;
|
||||
wxStaticLine* m_staticline2;
|
||||
|
@ -85,9 +76,8 @@ class DIALOG_LIB_TEXT_PROPERTIES_BASE : public DIALOG_SHIM
|
|||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void OnSetFocusText( wxFocusEvent& event ) { event.Skip(); }
|
||||
virtual void onMultiLineTCLostFocus( wxFocusEvent& event ) { event.Skip(); }
|
||||
virtual void OnTextValueSelectButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSetFocusText( wxFocusEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
|
|
@ -0,0 +1,310 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* 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 <symbol_edit_frame.h>
|
||||
#include <widgets/bitmap_button.h>
|
||||
#include <widgets/font_choice.h>
|
||||
#include <base_units.h>
|
||||
#include <general.h>
|
||||
#include <lib_textbox.h>
|
||||
#include <confirm.h>
|
||||
#include <dialogs/html_message_box.h>
|
||||
#include <string_utils.h>
|
||||
#include <scintilla_tricks.h>
|
||||
#include <dialog_lib_textbox_properties.h>
|
||||
#include <widgets/color_swatch.h>
|
||||
#include "symbol_editor_drawing_tools.h"
|
||||
|
||||
DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES( SYMBOL_EDIT_FRAME* aParent,
|
||||
LIB_TEXTBOX* aTextBox ) :
|
||||
DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( aParent ),
|
||||
m_frame( aParent ),
|
||||
m_currentText( aTextBox ),
|
||||
m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
|
||||
m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits ),
|
||||
m_scintillaTricks( nullptr ),
|
||||
m_helpWindow( nullptr )
|
||||
{
|
||||
m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
|
||||
|
||||
for( const std::pair<const PLOT_DASH_TYPE, lineTypeStruct>& typeEntry : lineTypeNames )
|
||||
m_borderStyleCombo->Append( typeEntry.second.name, KiBitmap( typeEntry.second.bitmap ) );
|
||||
|
||||
m_borderStyleCombo->Append( DEFAULT_STYLE );
|
||||
m_fillColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
|
||||
|
||||
m_textCtrl->SetEOLMode( wxSTC_EOL_LF );
|
||||
|
||||
m_scintillaTricks = new SCINTILLA_TRICKS( m_textCtrl, wxT( "{}" ), false,
|
||||
[this]()
|
||||
{
|
||||
wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
|
||||
} );
|
||||
|
||||
m_textEntrySizer->AddGrowableRow( 0 );
|
||||
|
||||
SetInitialFocus( m_textCtrl );
|
||||
|
||||
m_separator1->SetIsSeparator();
|
||||
|
||||
m_bold->SetIsCheckButton();
|
||||
m_bold->SetBitmap( KiBitmap( BITMAPS::text_bold ) );
|
||||
m_italic->SetIsCheckButton();
|
||||
m_italic->SetBitmap( KiBitmap( BITMAPS::text_italic ) );
|
||||
|
||||
m_separator2->SetIsSeparator();
|
||||
|
||||
m_spin0->SetIsCheckButton();
|
||||
m_spin0->SetBitmap( KiBitmap( BITMAPS::text_align_left ) );
|
||||
m_spin1->SetIsCheckButton();
|
||||
m_spin1->SetBitmap( KiBitmap( BITMAPS::text_align_right ) );
|
||||
m_spin2->SetIsCheckButton();
|
||||
m_spin2->SetBitmap( KiBitmap( BITMAPS::text_align_bottom ) );
|
||||
m_spin3->SetIsCheckButton();
|
||||
m_spin3->SetBitmap( KiBitmap( BITMAPS::text_align_top ) );
|
||||
|
||||
m_separator3->SetIsSeparator();
|
||||
|
||||
SetupStandardButtons();
|
||||
Layout();
|
||||
|
||||
m_spin0->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onSpinButton, this );
|
||||
m_spin1->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onSpinButton, this );
|
||||
m_spin2->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onSpinButton, this );
|
||||
m_spin3->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onSpinButton, this );
|
||||
|
||||
m_fillColorSwatch->Bind( COLOR_SWATCH_CHANGED, &DIALOG_LIB_TEXTBOX_PROPERTIES::onFillSwatch, this );
|
||||
|
||||
// Now all widgets have the size fixed, call FinishDialogSettings
|
||||
finishDialogSettings();
|
||||
}
|
||||
|
||||
|
||||
DIALOG_LIB_TEXTBOX_PROPERTIES::~DIALOG_LIB_TEXTBOX_PROPERTIES()
|
||||
{
|
||||
delete m_scintillaTricks;
|
||||
|
||||
if( m_helpWindow )
|
||||
m_helpWindow->Destroy();
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow()
|
||||
{
|
||||
if( !wxDialog::TransferDataToWindow() )
|
||||
return false;
|
||||
|
||||
m_textCtrl->SetValue( m_currentText->GetText() );
|
||||
|
||||
m_fontCtrl->SetFontSelection( m_currentText->GetFont() );
|
||||
m_textSize.SetValue( m_currentText->GetTextWidth() );
|
||||
|
||||
m_bold->Check( m_currentText->IsBold() );
|
||||
m_italic->Check( m_currentText->IsItalic() );
|
||||
|
||||
m_borderWidth.SetValue( m_currentText->GetWidth() );
|
||||
m_borderColorSwatch->SetSwatchColor( m_currentText->GetStroke().GetColor(), false );
|
||||
|
||||
int style = static_cast<int>( m_currentText->GetStroke().GetPlotStyle() );
|
||||
|
||||
if( style == -1 )
|
||||
m_borderStyleCombo->SetStringSelection( DEFAULT_STYLE );
|
||||
else if( style < (int) lineTypeNames.size() )
|
||||
m_borderStyleCombo->SetSelection( style );
|
||||
else
|
||||
wxFAIL_MSG( "Line type not found in the type lookup map" );
|
||||
|
||||
m_filledCtrl->SetValue( m_currentText->IsFilled() );
|
||||
m_fillColorSwatch->SetSwatchColor( m_currentText->GetFillColor(), false );
|
||||
|
||||
if( m_currentText->GetTextAngle() == ANGLE_VERTICAL )
|
||||
{
|
||||
if( m_currentText->GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
|
||||
m_spin3->Check();
|
||||
else
|
||||
m_spin2->Check();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_currentText->GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
|
||||
m_spin1->Check();
|
||||
else
|
||||
m_spin0->Check();
|
||||
}
|
||||
|
||||
m_privateCheckbox->SetValue( m_currentText->IsPrivate() );
|
||||
m_CommonUnit->SetValue( m_currentText->GetUnit() == 0 );
|
||||
m_CommonConvert->SetValue( m_currentText->GetConvert() == 0 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_LIB_TEXTBOX_PROPERTIES::onSpinButton( wxCommandEvent& aEvent )
|
||||
{
|
||||
for( BITMAP_BUTTON* btn : { m_spin0, m_spin1, m_spin2, m_spin3 } )
|
||||
{
|
||||
if( btn->IsChecked() && btn != aEvent.GetEventObject() )
|
||||
btn->Check( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataFromWindow()
|
||||
{
|
||||
if( !wxDialog::TransferDataFromWindow() )
|
||||
return false;
|
||||
|
||||
// Don't allow text to disappear; it can be difficult to correct if you can't select it
|
||||
if( !m_textSize.Validate( 0.01, 1000.0, EDA_UNITS::MILLIMETRES ) )
|
||||
return false;
|
||||
|
||||
wxString text = m_textCtrl->GetValue();
|
||||
|
||||
if( !text.IsEmpty() )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// On macOS CTRL+Enter produces '\r' instead of '\n' regardless of EOL setting
|
||||
text.Replace( "\r", "\n" );
|
||||
#endif
|
||||
|
||||
m_currentText->SetText( text );
|
||||
}
|
||||
else if( !m_currentText->IsNew() )
|
||||
{
|
||||
DisplayError( this, _( "Text can not be empty." ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( m_currentText->GetTextWidth() != m_textSize.GetValue() )
|
||||
m_currentText->SetTextSize( wxSize( m_textSize.GetValue(), m_textSize.GetValue() ) );
|
||||
|
||||
if( m_fontCtrl->HaveFontSelection() )
|
||||
{
|
||||
m_currentText->SetFont( m_fontCtrl->GetFontSelection( m_bold->IsChecked(),
|
||||
m_italic->IsChecked() ) );
|
||||
}
|
||||
|
||||
if( m_bold->IsChecked() != m_currentText->IsBold() )
|
||||
{
|
||||
if( m_bold->IsChecked() )
|
||||
{
|
||||
m_currentText->SetBold( true );
|
||||
m_currentText->SetTextThickness( GetPenSizeForBold( m_currentText->GetTextWidth() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_currentText->SetBold( false );
|
||||
m_currentText->SetTextThickness( 0 ); // Use default pen width
|
||||
}
|
||||
}
|
||||
|
||||
m_currentText->SetItalic( m_italic->IsChecked() );
|
||||
|
||||
if( m_spin0->IsChecked() )
|
||||
{
|
||||
m_currentText->SetTextAngle( ANGLE_HORIZONTAL );
|
||||
m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||
}
|
||||
else if( m_spin1->IsChecked() )
|
||||
{
|
||||
m_currentText->SetTextAngle( ANGLE_HORIZONTAL );
|
||||
m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
|
||||
}
|
||||
else if( m_spin2->IsChecked() )
|
||||
{
|
||||
m_currentText->SetTextAngle( ANGLE_VERTICAL );
|
||||
m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||
}
|
||||
else if( m_spin3->IsChecked() )
|
||||
{
|
||||
m_currentText->SetTextAngle( ANGLE_VERTICAL );
|
||||
m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
|
||||
}
|
||||
|
||||
m_currentText->UpdateTextPosition();
|
||||
|
||||
STROKE_PARAMS stroke = m_currentText->GetStroke();
|
||||
|
||||
if( !m_borderWidth.IsIndeterminate() )
|
||||
stroke.SetWidth( m_borderWidth.GetValue() );
|
||||
|
||||
auto it = lineTypeNames.begin();
|
||||
std::advance( it, m_borderStyleCombo->GetSelection() );
|
||||
|
||||
if( it == lineTypeNames.end() )
|
||||
stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
|
||||
else
|
||||
stroke.SetPlotStyle( it->first );
|
||||
|
||||
stroke.SetColor( m_borderColorSwatch->GetSwatchColor() );
|
||||
|
||||
m_currentText->SetStroke( stroke );
|
||||
|
||||
m_currentText->SetFillMode( m_filledCtrl->GetValue() ? FILL_T::FILLED_WITH_COLOR
|
||||
: FILL_T::NO_FILL );
|
||||
m_currentText->SetFillColor( m_fillColorSwatch->GetSwatchColor() );
|
||||
|
||||
m_currentText->SetPrivate( m_privateCheckbox->GetValue() );
|
||||
|
||||
if( !m_CommonUnit->GetValue() )
|
||||
m_currentText->SetUnit( m_frame->GetUnit() );
|
||||
else
|
||||
m_currentText->SetUnit( 0 );
|
||||
|
||||
if( !m_CommonConvert->GetValue() )
|
||||
m_currentText->SetConvert( m_frame->GetConvert() );
|
||||
else
|
||||
m_currentText->SetConvert( 0 );
|
||||
|
||||
// Record settings used for next time:
|
||||
auto* tools = m_frame->GetToolManager()->GetTool<SYMBOL_EDITOR_DRAWING_TOOLS>();
|
||||
tools->SetLastTextAngle( m_currentText->GetTextAngle() );
|
||||
tools->SetDrawSpecificConvert( !m_CommonConvert->GetValue() );
|
||||
tools->SetDrawSpecificUnit( !m_CommonUnit->GetValue() );
|
||||
|
||||
m_frame->SetMsgPanel( m_currentText );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_LIB_TEXTBOX_PROPERTIES::OnFormattingHelp( wxHyperlinkEvent& aEvent )
|
||||
{
|
||||
m_helpWindow = SCH_TEXT::ShowSyntaxHelp( this );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_LIB_TEXTBOX_PROPERTIES::onMultiLineTCLostFocus( wxFocusEvent& event )
|
||||
{
|
||||
if( m_scintillaTricks )
|
||||
m_scintillaTricks->CancelAutocomplete();
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_LIB_TEXTBOX_PROPERTIES::onFillSwatch( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_filledCtrl->SetValue( true );
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* 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 DIALOG_LIB_TEXTBOX_PROPERTIES_H
|
||||
#define DIALOG_LIB_TEXTBOX_PROPERTIES_H
|
||||
|
||||
#include <widgets/unit_binder.h>
|
||||
#include <sch_text.h>
|
||||
#include "dialog_lib_textbox_properties_base.h"
|
||||
|
||||
|
||||
class SYMBOL_EDIT_FRAME;
|
||||
class LIB_TEXTBOX;
|
||||
class SCINTILLA_TRICKS;
|
||||
class HTML_MESSAGE_BOX;
|
||||
|
||||
|
||||
class DIALOG_LIB_TEXTBOX_PROPERTIES : public DIALOG_LIB_TEXTBOX_PROPERTIES_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_LIB_TEXTBOX_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_TEXTBOX* aTextBox );
|
||||
~DIALOG_LIB_TEXTBOX_PROPERTIES();
|
||||
|
||||
private:
|
||||
void onSpinButton( wxCommandEvent &aEvent );
|
||||
void onFillSwatch( wxCommandEvent& aEvent );
|
||||
|
||||
void OnFormattingHelp( wxHyperlinkEvent& aEvent ) override;
|
||||
void onMultiLineTCLostFocus( wxFocusEvent& event ) override;
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
SYMBOL_EDIT_FRAME* m_frame;
|
||||
LIB_TEXTBOX* m_currentText;
|
||||
UNIT_BINDER m_textSize;
|
||||
UNIT_BINDER m_borderWidth;
|
||||
SCINTILLA_TRICKS* m_scintillaTricks;
|
||||
|
||||
HTML_MESSAGE_BOX* m_helpWindow;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // DIALOG_LIB_TEXTBOX_PROPERTIES_H
|
|
@ -0,0 +1,259 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "widgets/bitmap_button.h"
|
||||
#include "widgets/color_swatch.h"
|
||||
#include "widgets/font_choice.h"
|
||||
|
||||
#include "dialog_lib_textbox_properties_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_textEntrySizer = new wxGridBagSizer( 3, 0 );
|
||||
m_textEntrySizer->SetFlexibleDirection( wxBOTH );
|
||||
m_textEntrySizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_textLabel = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textLabel->Wrap( -1 );
|
||||
m_textEntrySizer->Add( m_textLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxRIGHT, 5 );
|
||||
|
||||
m_textCtrl = new wxStyledTextCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN, wxEmptyString );
|
||||
m_textCtrl->SetUseTabs( true );
|
||||
m_textCtrl->SetTabWidth( 4 );
|
||||
m_textCtrl->SetIndent( 4 );
|
||||
m_textCtrl->SetTabIndents( false );
|
||||
m_textCtrl->SetBackSpaceUnIndents( false );
|
||||
m_textCtrl->SetViewEOL( false );
|
||||
m_textCtrl->SetViewWhiteSpace( false );
|
||||
m_textCtrl->SetMarginWidth( 2, 0 );
|
||||
m_textCtrl->SetIndentationGuides( false );
|
||||
m_textCtrl->SetMarginWidth( 1, 0 );
|
||||
m_textCtrl->SetMarginWidth( 0, 0 );
|
||||
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUS );
|
||||
m_textCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDER, wxColour( wxT("BLACK") ) );
|
||||
m_textCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDER, wxColour( wxT("WHITE") ) );
|
||||
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_BOXMINUS );
|
||||
m_textCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDEROPEN, wxColour( wxT("BLACK") ) );
|
||||
m_textCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDEROPEN, wxColour( wxT("WHITE") ) );
|
||||
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_EMPTY );
|
||||
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_BOXPLUS );
|
||||
m_textCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDEREND, wxColour( wxT("BLACK") ) );
|
||||
m_textCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDEREND, wxColour( wxT("WHITE") ) );
|
||||
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_BOXMINUS );
|
||||
m_textCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDEROPENMID, wxColour( wxT("BLACK") ) );
|
||||
m_textCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDEROPENMID, wxColour( wxT("WHITE") ) );
|
||||
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_EMPTY );
|
||||
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_EMPTY );
|
||||
m_textCtrl->SetSelBackground( true, wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
|
||||
m_textCtrl->SetSelForeground( true, wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
|
||||
m_textCtrl->SetMinSize( wxSize( 500,140 ) );
|
||||
|
||||
m_textEntrySizer->Add( m_textCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 4 ), wxEXPAND, 5 );
|
||||
|
||||
m_fontLabel = new wxStaticText( this, wxID_ANY, _("Font:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_fontLabel->Wrap( -1 );
|
||||
m_textEntrySizer->Add( m_fontLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
wxString m_fontCtrlChoices[] = { _("Default Font"), _("KiCad Font") };
|
||||
int m_fontCtrlNChoices = sizeof( m_fontCtrlChoices ) / sizeof( wxString );
|
||||
m_fontCtrl = new FONT_CHOICE( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_fontCtrlNChoices, m_fontCtrlChoices, 0 );
|
||||
m_fontCtrl->SetSelection( 0 );
|
||||
m_textEntrySizer->Add( m_fontCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizeCtrlSizer;
|
||||
bSizeCtrlSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_separator1 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_separator1->Enable( false );
|
||||
|
||||
bSizeCtrlSizer->Add( m_separator1, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
m_bold = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_bold->SetToolTip( _("Bold") );
|
||||
|
||||
bSizeCtrlSizer->Add( m_bold, 0, wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_italic = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_italic->SetToolTip( _("Italic") );
|
||||
|
||||
bSizeCtrlSizer->Add( m_italic, 0, wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_separator2 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_separator2->Enable( false );
|
||||
|
||||
bSizeCtrlSizer->Add( m_separator2, 0, wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_spin0 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_spin0->SetToolTip( _("Align right") );
|
||||
|
||||
bSizeCtrlSizer->Add( m_spin0, 0, wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_spin1 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_spin1->SetToolTip( _("Align bottom") );
|
||||
|
||||
bSizeCtrlSizer->Add( m_spin1, 0, wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_spin2 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_spin2->SetToolTip( _("Align left") );
|
||||
|
||||
bSizeCtrlSizer->Add( m_spin2, 0, wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_spin3 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_spin3->SetToolTip( _("Align top") );
|
||||
|
||||
bSizeCtrlSizer->Add( m_spin3, 0, wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_separator3 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
|
||||
m_separator3->Enable( false );
|
||||
|
||||
bSizeCtrlSizer->Add( m_separator3, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
m_textEntrySizer->Add( bSizeCtrlSizer, wxGBPosition( 1, 3 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizer41;
|
||||
bSizer41 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_syntaxHelp = new wxHyperlinkCtrl( this, wxID_ANY, _("Syntax help"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
|
||||
m_syntaxHelp->SetToolTip( _("Show syntax help window") );
|
||||
|
||||
bSizer41->Add( m_syntaxHelp, 0, wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
m_textEntrySizer->Add( bSizer41, wxGBPosition( 1, 4 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_RIGHT|wxLEFT, 80 );
|
||||
|
||||
m_textSizeLabel = new wxStaticText( this, wxID_ANY, _("Text size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textSizeLabel->Wrap( -1 );
|
||||
m_textEntrySizer->Add( m_textSizeLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_textSizeCtrl = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textEntrySizer->Add( m_textSizeCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_textSizeUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textSizeUnits->Wrap( -1 );
|
||||
m_textEntrySizer->Add( m_textSizeUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
m_textEntrySizer->Add( 0, 15, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
|
||||
|
||||
m_borderWidthLabel = new wxStaticText( this, wxID_ANY, _("Border width:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_borderWidthLabel->Wrap( -1 );
|
||||
m_textEntrySizer->Add( m_borderWidthLabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_borderWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
|
||||
m_textEntrySizer->Add( m_borderWidthCtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_borderWidthUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_borderWidthUnits->Wrap( -1 );
|
||||
m_textEntrySizer->Add( m_borderWidthUnits, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_borderColorLabel = new wxStaticText( this, wxID_ANY, _("Border color:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_borderColorLabel->Wrap( -1 );
|
||||
m_textEntrySizer->Add( m_borderColorLabel, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_panelBorderColor = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizer2;
|
||||
bSizer2 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_borderColorSwatch = new COLOR_SWATCH( m_panelBorderColor, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer2->Add( m_borderColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
|
||||
m_panelBorderColor->SetSizer( bSizer2 );
|
||||
m_panelBorderColor->Layout();
|
||||
bSizer2->Fit( m_panelBorderColor );
|
||||
m_textEntrySizer->Add( m_panelBorderColor, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_borderStyleLabel = new wxStaticText( this, wxID_ANY, _("Border style:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_borderStyleLabel->Wrap( -1 );
|
||||
m_textEntrySizer->Add( m_borderStyleLabel, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_borderStyleCombo = new wxBitmapComboBox( this, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
|
||||
m_borderStyleCombo->SetMinSize( wxSize( 240,-1 ) );
|
||||
|
||||
m_textEntrySizer->Add( m_borderStyleCombo, wxGBPosition( 6, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
m_textEntrySizer->Add( 0, 15, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
|
||||
|
||||
m_filledCtrl = new wxCheckBox( this, wxID_ANY, _("Background fill"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textEntrySizer->Add( m_filledCtrl, wxGBPosition( 4, 3 ), wxGBSpan( 1, 2 ), wxLEFT, 100 );
|
||||
|
||||
m_fillColorLabel = new wxStaticText( this, wxID_ANY, _("Fill color:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_fillColorLabel->Wrap( -1 );
|
||||
m_textEntrySizer->Add( m_fillColorLabel, wxGBPosition( 5, 3 ), wxGBSpan( 1, 1 ), wxLEFT|wxALIGN_CENTER_VERTICAL, 100 );
|
||||
|
||||
m_panelFillColor = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizer21;
|
||||
bSizer21 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_fillColorSwatch = new COLOR_SWATCH( m_panelFillColor, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer21->Add( m_fillColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
|
||||
m_panelFillColor->SetSizer( bSizer21 );
|
||||
m_panelFillColor->Layout();
|
||||
bSizer21->Fit( m_panelFillColor );
|
||||
m_textEntrySizer->Add( m_panelFillColor, wxGBPosition( 5, 4 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_privateCheckbox = new wxCheckBox( this, wxID_ANY, _("Private to symbol editor"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textEntrySizer->Add( m_privateCheckbox, wxGBPosition( 8, 0 ), wxGBSpan( 1, 2 ), 0, 5 );
|
||||
|
||||
m_CommonUnit = new wxCheckBox( this, wxID_ANY, _("Common to all units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textEntrySizer->Add( m_CommonUnit, wxGBPosition( 8, 3 ), wxGBSpan( 1, 2 ), wxLEFT, 100 );
|
||||
|
||||
m_CommonConvert = new wxCheckBox( this, wxID_ANY, _("Common to all body styles"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textEntrySizer->Add( m_CommonConvert, wxGBPosition( 9, 3 ), wxGBSpan( 1, 2 ), wxLEFT, 100 );
|
||||
|
||||
|
||||
m_textEntrySizer->AddGrowableCol( 1 );
|
||||
m_textEntrySizer->AddGrowableCol( 4 );
|
||||
|
||||
bMainSizer->Add( m_textEntrySizer, 1, wxEXPAND|wxALL, 10 );
|
||||
|
||||
m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bMainSizer->Add( m_staticline, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxBoxSizer* bSizer4;
|
||||
bSizer4 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_sdbSizer1 = new wxStdDialogButtonSizer();
|
||||
m_sdbSizer1OK = new wxButton( this, wxID_OK );
|
||||
m_sdbSizer1->AddButton( m_sdbSizer1OK );
|
||||
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
|
||||
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
|
||||
m_sdbSizer1->Realize();
|
||||
|
||||
bSizer4->Add( m_sdbSizer1, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( bSizer4, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
bMainSizer->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
m_textCtrl->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::onMultiLineTCLostFocus ), NULL, this );
|
||||
m_syntaxHelp->Connect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::OnFormattingHelp ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::~DIALOG_LIB_TEXTBOX_PROPERTIES_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_textCtrl->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::onMultiLineTCLostFocus ), NULL, this );
|
||||
m_syntaxHelp->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::OnFormattingHelp ), NULL, this );
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,105 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class BITMAP_BUTTON;
|
||||
class COLOR_SWATCH;
|
||||
class FONT_CHOICE;
|
||||
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/stc/stc.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/hyperlink.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/bmpcbox.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/gbsizer.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_LIB_TEXTBOX_PROPERTIES_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_LIB_TEXTBOX_PROPERTIES_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
enum
|
||||
{
|
||||
wxID_SIZE = 1000
|
||||
};
|
||||
|
||||
wxGridBagSizer* m_textEntrySizer;
|
||||
wxStaticText* m_textLabel;
|
||||
wxStyledTextCtrl* m_textCtrl;
|
||||
wxStaticText* m_fontLabel;
|
||||
FONT_CHOICE* m_fontCtrl;
|
||||
BITMAP_BUTTON* m_separator1;
|
||||
BITMAP_BUTTON* m_bold;
|
||||
BITMAP_BUTTON* m_italic;
|
||||
BITMAP_BUTTON* m_separator2;
|
||||
BITMAP_BUTTON* m_spin0;
|
||||
BITMAP_BUTTON* m_spin1;
|
||||
BITMAP_BUTTON* m_spin2;
|
||||
BITMAP_BUTTON* m_spin3;
|
||||
BITMAP_BUTTON* m_separator3;
|
||||
wxHyperlinkCtrl* m_syntaxHelp;
|
||||
wxStaticText* m_textSizeLabel;
|
||||
wxTextCtrl* m_textSizeCtrl;
|
||||
wxStaticText* m_textSizeUnits;
|
||||
wxStaticText* m_borderWidthLabel;
|
||||
wxTextCtrl* m_borderWidthCtrl;
|
||||
wxStaticText* m_borderWidthUnits;
|
||||
wxStaticText* m_borderColorLabel;
|
||||
wxPanel* m_panelBorderColor;
|
||||
COLOR_SWATCH* m_borderColorSwatch;
|
||||
wxStaticText* m_borderStyleLabel;
|
||||
wxBitmapComboBox* m_borderStyleCombo;
|
||||
wxCheckBox* m_filledCtrl;
|
||||
wxStaticText* m_fillColorLabel;
|
||||
wxPanel* m_panelFillColor;
|
||||
COLOR_SWATCH* m_fillColorSwatch;
|
||||
wxCheckBox* m_privateCheckbox;
|
||||
wxCheckBox* m_CommonUnit;
|
||||
wxCheckBox* m_CommonConvert;
|
||||
wxStaticLine* m_staticline;
|
||||
wxStdDialogButtonSizer* m_sdbSizer1;
|
||||
wxButton* m_sdbSizer1OK;
|
||||
wxButton* m_sdbSizer1Cancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void onMultiLineTCLostFocus( wxFocusEvent& event ) { event.Skip(); }
|
||||
virtual void OnFormattingHelp( wxHyperlinkEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Box Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_LIB_TEXTBOX_PROPERTIES_BASE();
|
||||
|
||||
};
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2018 CERN
|
||||
* Copyright (C) 2019-2022 KiCad Developers, see change_log.txt for contributors.
|
||||
* @author Jon Evans <jon@craftyjon.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -24,6 +25,7 @@
|
|||
#include <tool/tool_manager.h>
|
||||
#include <tool/actions.h>
|
||||
#include <dialog_migrate_buses.h>
|
||||
#include <sch_label.h>
|
||||
|
||||
/**
|
||||
* Migrates buses using legacy multi-label joining behavior.
|
||||
|
@ -75,18 +77,18 @@ void DIALOG_MIGRATE_BUSES::loadGraphData()
|
|||
m_items.clear();
|
||||
auto subgraphs = m_frame->Schematic().ConnectionGraph()->GetBusesNeedingMigration();
|
||||
|
||||
for( auto subgraph : subgraphs )
|
||||
for( const CONNECTION_SUBGRAPH* subgraph : subgraphs )
|
||||
{
|
||||
BUS_MIGRATION_STATUS status;
|
||||
|
||||
status.subgraph = subgraph;
|
||||
status.approved = false;
|
||||
|
||||
auto labels = subgraph->GetBusLabels();
|
||||
std::vector<SCH_ITEM*> labels = subgraph->GetBusLabels();
|
||||
wxASSERT( labels.size() > 1 );
|
||||
|
||||
for( auto label : labels )
|
||||
status.labels.push_back( static_cast<SCH_TEXT*>( label )->GetText() );
|
||||
for( SCH_ITEM* label : labels )
|
||||
status.labels.push_back( static_cast<SCH_LABEL_BASE*>( label )->GetText() );
|
||||
|
||||
status.possible_labels = getProposedLabels( status.labels );
|
||||
m_items.push_back( status );
|
||||
|
@ -169,21 +171,18 @@ void DIALOG_MIGRATE_BUSES::onItemSelected( wxListEvent& aEvent )
|
|||
|
||||
m_selected_index = sel;
|
||||
|
||||
auto subgraph = m_items[sel].subgraph;
|
||||
const CONNECTION_SUBGRAPH* subgraph = m_items[sel].subgraph;
|
||||
const SCH_SHEET_PATH& sheet = subgraph->m_sheet;
|
||||
SCH_ITEM* driver = subgraph->m_driver;
|
||||
|
||||
auto sheet = subgraph->m_sheet;
|
||||
auto driver = subgraph->m_driver;
|
||||
|
||||
const SCH_SHEET_PATH& current = m_frame->GetCurrentSheet();
|
||||
|
||||
if( sheet != current )
|
||||
if( sheet != m_frame->GetCurrentSheet() )
|
||||
{
|
||||
sheet.UpdateAllScreenReferences();
|
||||
m_frame->Schematic().SetCurrentSheet( sheet );
|
||||
m_frame->TestDanglingEnds();
|
||||
}
|
||||
|
||||
auto pos = driver->GetPosition();
|
||||
VECTOR2I pos = driver->GetPosition();
|
||||
|
||||
m_frame->GetCanvas()->GetViewControls()->SetCrossHairCursorPosition( pos, false );
|
||||
m_frame->RedrawScreen( pos, false );
|
||||
|
@ -201,23 +200,21 @@ void DIALOG_MIGRATE_BUSES::onAcceptClicked( wxCommandEvent& aEvent )
|
|||
{
|
||||
wxASSERT( m_selected_index < m_items.size() );
|
||||
|
||||
auto sel = m_selected_index;
|
||||
unsigned sel = m_selected_index;
|
||||
|
||||
m_items[sel].approved_label = m_cb_new_name->GetStringSelection();
|
||||
m_items[sel].approved = true;
|
||||
|
||||
auto labels = m_items[sel].subgraph->GetBusLabels();
|
||||
std::vector<SCH_ITEM*> labels = m_items[sel].subgraph->GetBusLabels();
|
||||
|
||||
for( auto label : labels )
|
||||
static_cast<SCH_TEXT*>( label )->SetText( m_items[sel].approved_label );
|
||||
for( SCH_ITEM* label : labels )
|
||||
static_cast<SCH_LABEL_BASE*>( label )->SetText( m_items[sel].approved_label );
|
||||
|
||||
m_migration_list->SetItem( sel, 2, m_items[sel].approved_label );
|
||||
m_migration_list->SetItem( sel, 3, _( "Updated" ) );
|
||||
|
||||
if( sel < m_items.size() - 1 )
|
||||
{
|
||||
m_migration_list->Select( sel + 1 );
|
||||
}
|
||||
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ void DIALOG_SHEET_PIN_PROPERTIES::onOKButton( wxCommandEvent& event )
|
|||
|
||||
void DIALOG_SHEET_PIN_PROPERTIES::OnSyntaxHelp( wxHyperlinkEvent& aEvent )
|
||||
{
|
||||
m_helpWindow = SCH_TEXT::ShowSyntaxHelp( this );
|
||||
m_helpWindow = SCH_LABEL_BASE::ShowSyntaxHelp( this );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,26 +29,48 @@
|
|||
#include <base_units.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <general.h>
|
||||
#include <gr_text.h>
|
||||
#include <sch_textbox.h>
|
||||
#include <confirm.h>
|
||||
#include <schematic.h>
|
||||
#include <dialogs/html_message_box.h>
|
||||
#include <string_utils.h>
|
||||
#include <scintilla_tricks.h>
|
||||
#include <dialog_text_properties.h>
|
||||
|
||||
class SCH_EDIT_FRAME;
|
||||
class SCH_TEXT;
|
||||
#include <widgets/color_swatch.h>
|
||||
|
||||
|
||||
DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTextItem ) :
|
||||
DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_ITEM* aTextItem ) :
|
||||
DIALOG_TEXT_PROPERTIES_BASE( aParent ),
|
||||
m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, false ),
|
||||
m_frame( aParent ),
|
||||
m_currentItem( aTextItem ),
|
||||
m_currentText( dynamic_cast<EDA_TEXT*>( aTextItem ) ),
|
||||
m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
|
||||
m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits ),
|
||||
m_scintillaTricks( nullptr ),
|
||||
m_helpWindow( nullptr )
|
||||
{
|
||||
m_frame = aParent;
|
||||
m_currentText = aTextItem;
|
||||
if( aTextItem->Type() == SCH_TEXTBOX_T )
|
||||
{
|
||||
SetTitle( _( "Text Box Properties" ) );
|
||||
|
||||
m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
|
||||
|
||||
for( const std::pair<const PLOT_DASH_TYPE, lineTypeStruct>& typeEntry : lineTypeNames )
|
||||
m_borderStyleCombo->Append( typeEntry.second.name, KiBitmap( typeEntry.second.bitmap ) );
|
||||
|
||||
m_borderStyleCombo->Append( DEFAULT_STYLE );
|
||||
m_fillColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_borderWidth.Show( false );
|
||||
m_borderColorLabel->Show( false );
|
||||
m_panelBorderColor->Show( false );
|
||||
m_borderStyleLabel->Show( false );
|
||||
m_borderStyleCombo->Show( false );
|
||||
m_fillColorLabel->Show( false );
|
||||
m_panelFillColor->Show( false );
|
||||
}
|
||||
|
||||
m_textCtrl->SetEOLMode( wxSTC_EOL_LF );
|
||||
|
||||
|
@ -91,6 +113,8 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_TEX
|
|||
m_spin2->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onSpinButton, this );
|
||||
m_spin3->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onSpinButton, this );
|
||||
|
||||
m_fillColorSwatch->Bind( COLOR_SWATCH_CHANGED, &DIALOG_TEXT_PROPERTIES::onFillSwatch, this );
|
||||
|
||||
// Now all widgets have the size fixed, call FinishDialogSettings
|
||||
finishDialogSettings();
|
||||
}
|
||||
|
@ -121,12 +145,51 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
|
|||
m_bold->Check( m_currentText->IsBold() );
|
||||
m_italic->Check( m_currentText->IsItalic() );
|
||||
|
||||
switch( m_currentText->GetTextSpinStyle() )
|
||||
if( m_currentItem->Type() == SCH_TEXTBOX_T )
|
||||
{
|
||||
case TEXT_SPIN_STYLE::RIGHT: m_spin0->Check( true ); break;
|
||||
case TEXT_SPIN_STYLE::LEFT: m_spin1->Check( true ); break;
|
||||
case TEXT_SPIN_STYLE::UP: m_spin2->Check( true ); break;
|
||||
case TEXT_SPIN_STYLE::BOTTOM: m_spin3->Check( true ); break;
|
||||
SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( m_currentItem );
|
||||
|
||||
m_borderWidth.SetValue( textBox->GetWidth() );
|
||||
m_borderColorSwatch->SetSwatchColor( textBox->GetStroke().GetColor(), false );
|
||||
|
||||
int style = static_cast<int>( textBox->GetStroke().GetPlotStyle() );
|
||||
|
||||
if( style == -1 )
|
||||
m_borderStyleCombo->SetStringSelection( DEFAULT_STYLE );
|
||||
else if( style < (int) lineTypeNames.size() )
|
||||
m_borderStyleCombo->SetSelection( style );
|
||||
else
|
||||
wxFAIL_MSG( "Line type not found in the type lookup map" );
|
||||
|
||||
m_filledCtrl->SetValue( textBox->IsFilled() );
|
||||
m_fillColorSwatch->SetSwatchColor( textBox->GetFillColor(), false );
|
||||
|
||||
if( textBox->GetTextAngle() == ANGLE_VERTICAL )
|
||||
{
|
||||
if( textBox->GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
|
||||
m_spin3->Check();
|
||||
else
|
||||
m_spin2->Check();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( textBox->GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
|
||||
m_spin1->Check();
|
||||
else
|
||||
m_spin0->Check();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TEXT_SPIN_STYLE spin = static_cast<SCH_TEXT*>( m_currentItem )->GetTextSpinStyle();
|
||||
|
||||
switch( spin )
|
||||
{
|
||||
case TEXT_SPIN_STYLE::RIGHT: m_spin0->Check( true ); break;
|
||||
case TEXT_SPIN_STYLE::LEFT: m_spin1->Check( true ); break;
|
||||
case TEXT_SPIN_STYLE::UP: m_spin2->Check( true ); break;
|
||||
case TEXT_SPIN_STYLE::BOTTOM: m_spin3->Check( true ); break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -180,7 +243,7 @@ void DIALOG_TEXT_PROPERTIES::onScintillaCharAdded( wxStyledTextEvent &aEvent )
|
|||
{
|
||||
partial = te->GetTextRange( start, text_pos );
|
||||
|
||||
SCHEMATIC* schematic = m_currentText->Schematic();
|
||||
SCHEMATIC* schematic = m_currentItem->Schematic();
|
||||
|
||||
if( schematic && schematic->CurrentSheet().Last() )
|
||||
schematic->CurrentSheet().Last()->GetContextualTextVars( &autocompleteTokens );
|
||||
|
@ -216,9 +279,9 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
|
|||
wxString text;
|
||||
|
||||
/* save old text in undo list if not already in edit */
|
||||
if( m_currentText->GetEditFlags() == 0 )
|
||||
if( m_currentItem->GetEditFlags() == 0 )
|
||||
{
|
||||
m_frame->SaveCopyInUndoList( m_frame->GetScreen(), m_currentText, UNDO_REDO::CHANGED,
|
||||
m_frame->SaveCopyInUndoList( m_frame->GetScreen(), m_currentItem, UNDO_REDO::CHANGED,
|
||||
false );
|
||||
}
|
||||
|
||||
|
@ -236,7 +299,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
|
|||
|
||||
m_currentText->SetText( text );
|
||||
}
|
||||
else if( !m_currentText->IsNew() )
|
||||
else if( !m_currentItem->IsNew() )
|
||||
{
|
||||
DisplayError( this, _( "Text can not be empty." ) );
|
||||
return false;
|
||||
|
@ -267,21 +330,70 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
|
|||
|
||||
m_currentText->SetItalic( m_italic->IsChecked() );
|
||||
|
||||
TEXT_SPIN_STYLE selectedSpinStyle= TEXT_SPIN_STYLE::LEFT;
|
||||
if( m_currentItem->Type() == SCH_TEXT_T )
|
||||
{
|
||||
TEXT_SPIN_STYLE selectedSpinStyle= TEXT_SPIN_STYLE::LEFT;
|
||||
|
||||
if( m_spin0->IsChecked() )
|
||||
selectedSpinStyle = TEXT_SPIN_STYLE::RIGHT;
|
||||
else if( m_spin1->IsChecked() )
|
||||
selectedSpinStyle = TEXT_SPIN_STYLE::LEFT;
|
||||
else if( m_spin2->IsChecked() )
|
||||
selectedSpinStyle = TEXT_SPIN_STYLE::UP;
|
||||
else if( m_spin3->IsChecked() )
|
||||
selectedSpinStyle = TEXT_SPIN_STYLE::BOTTOM;
|
||||
if( m_spin0->IsChecked() )
|
||||
selectedSpinStyle = TEXT_SPIN_STYLE::RIGHT;
|
||||
else if( m_spin1->IsChecked() )
|
||||
selectedSpinStyle = TEXT_SPIN_STYLE::LEFT;
|
||||
else if( m_spin2->IsChecked() )
|
||||
selectedSpinStyle = TEXT_SPIN_STYLE::UP;
|
||||
else if( m_spin3->IsChecked() )
|
||||
selectedSpinStyle = TEXT_SPIN_STYLE::BOTTOM;
|
||||
|
||||
if( m_currentText->GetTextSpinStyle() != selectedSpinStyle )
|
||||
m_currentText->SetTextSpinStyle( selectedSpinStyle );
|
||||
static_cast<SCH_TEXT*>( m_currentItem )->SetTextSpinStyle( selectedSpinStyle );
|
||||
}
|
||||
else
|
||||
{
|
||||
SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( m_currentItem );
|
||||
|
||||
m_frame->UpdateItem( m_currentText, false, true );
|
||||
if( m_spin0->IsChecked() )
|
||||
{
|
||||
textBox->SetTextAngle( ANGLE_HORIZONTAL );
|
||||
textBox->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||
}
|
||||
else if( m_spin1->IsChecked() )
|
||||
{
|
||||
textBox->SetTextAngle( ANGLE_HORIZONTAL );
|
||||
textBox->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
|
||||
}
|
||||
else if( m_spin2->IsChecked() )
|
||||
{
|
||||
textBox->SetTextAngle( ANGLE_VERTICAL );
|
||||
textBox->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||
}
|
||||
else if( m_spin3->IsChecked() )
|
||||
{
|
||||
textBox->SetTextAngle( ANGLE_VERTICAL );
|
||||
textBox->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
|
||||
}
|
||||
|
||||
textBox->UpdateTextPosition();
|
||||
|
||||
STROKE_PARAMS stroke = textBox->GetStroke();
|
||||
|
||||
if( !m_borderWidth.IsIndeterminate() )
|
||||
stroke.SetWidth( m_borderWidth.GetValue() );
|
||||
|
||||
auto it = lineTypeNames.begin();
|
||||
std::advance( it, m_borderStyleCombo->GetSelection() );
|
||||
|
||||
if( it == lineTypeNames.end() )
|
||||
stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
|
||||
else
|
||||
stroke.SetPlotStyle( it->first );
|
||||
|
||||
stroke.SetColor( m_borderColorSwatch->GetSwatchColor() );
|
||||
|
||||
textBox->SetStroke( stroke );
|
||||
|
||||
textBox->SetFillMode( m_filledCtrl->GetValue() ? FILL_T::FILLED_WITH_COLOR : FILL_T::NO_FILL );
|
||||
textBox->SetFillColor( m_fillColorSwatch->GetSwatchColor() );
|
||||
}
|
||||
|
||||
m_frame->UpdateItem( m_currentItem, false, true );
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
m_frame->OnModify();
|
||||
|
||||
|
@ -302,3 +414,9 @@ void DIALOG_TEXT_PROPERTIES::onMultiLineTCLostFocus( wxFocusEvent& event )
|
|||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_TEXT_PROPERTIES::onFillSwatch( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_filledCtrl->SetValue( true );
|
||||
}
|
|
@ -38,12 +38,13 @@ class HTML_MESSAGE_BOX;
|
|||
class DIALOG_TEXT_PROPERTIES : public DIALOG_TEXT_PROPERTIES_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_TEXT_PROPERTIES( SCH_EDIT_FRAME* parent, SCH_TEXT* aTextItem );
|
||||
DIALOG_TEXT_PROPERTIES( SCH_EDIT_FRAME* parent, SCH_ITEM* aTextItem );
|
||||
~DIALOG_TEXT_PROPERTIES();
|
||||
|
||||
private:
|
||||
void onScintillaCharAdded( wxStyledTextEvent &aEvent );
|
||||
void onSpinButton( wxCommandEvent &aEvent );
|
||||
void onFillSwatch( wxCommandEvent& aEvent );
|
||||
|
||||
void OnFormattingHelp( wxHyperlinkEvent& aEvent ) override;
|
||||
void onMultiLineTCLostFocus( wxFocusEvent& event ) override;
|
||||
|
@ -52,8 +53,10 @@ private:
|
|||
bool TransferDataFromWindow() override;
|
||||
|
||||
SCH_EDIT_FRAME* m_frame;
|
||||
SCH_TEXT* m_currentText;
|
||||
SCH_ITEM* m_currentItem;
|
||||
EDA_TEXT* m_currentText;
|
||||
UNIT_BINDER m_textSize;
|
||||
UNIT_BINDER m_borderWidth;
|
||||
SCINTILLA_TRICKS* m_scintillaTricks;
|
||||
|
||||
HTML_MESSAGE_BOX* m_helpWindow;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "widgets/bitmap_button.h"
|
||||
#include "widgets/color_swatch.h"
|
||||
#include "widgets/font_choice.h"
|
||||
|
||||
#include "dialog_text_properties_base.h"
|
||||
|
@ -137,13 +138,71 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi
|
|||
m_textEntrySizer->Add( m_textSizeLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_textSizeCtrl = new wxTextCtrl( this, wxID_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textEntrySizer->Add( m_textSizeCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
m_textEntrySizer->Add( m_textSizeCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
|
||||
m_textSizeUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textSizeUnits->Wrap( -1 );
|
||||
m_textEntrySizer->Add( m_textSizeUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_borderWidthLabel = new wxStaticText( this, wxID_ANY, _("Border width:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_borderWidthLabel->Wrap( -1 );
|
||||
m_textEntrySizer->Add( m_borderWidthLabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_borderWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
|
||||
m_textEntrySizer->Add( m_borderWidthCtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_borderWidthUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_borderWidthUnits->Wrap( -1 );
|
||||
m_textEntrySizer->Add( m_borderWidthUnits, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_borderColorLabel = new wxStaticText( this, wxID_ANY, _("Border color:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_borderColorLabel->Wrap( -1 );
|
||||
m_textEntrySizer->Add( m_borderColorLabel, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_panelBorderColor = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizer2;
|
||||
bSizer2 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_borderColorSwatch = new COLOR_SWATCH( m_panelBorderColor, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer2->Add( m_borderColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
|
||||
m_panelBorderColor->SetSizer( bSizer2 );
|
||||
m_panelBorderColor->Layout();
|
||||
bSizer2->Fit( m_panelBorderColor );
|
||||
m_textEntrySizer->Add( m_panelBorderColor, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_borderStyleLabel = new wxStaticText( this, wxID_ANY, _("Border style:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_borderStyleLabel->Wrap( -1 );
|
||||
m_textEntrySizer->Add( m_borderStyleLabel, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_borderStyleCombo = new wxBitmapComboBox( this, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
|
||||
m_borderStyleCombo->SetMinSize( wxSize( 240,-1 ) );
|
||||
|
||||
m_textEntrySizer->Add( m_borderStyleCombo, wxGBPosition( 6, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
m_filledCtrl = new wxCheckBox( this, wxID_ANY, _("Background fill"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textEntrySizer->Add( m_filledCtrl, wxGBPosition( 4, 3 ), wxGBSpan( 1, 2 ), wxLEFT, 100 );
|
||||
|
||||
m_fillColorLabel = new wxStaticText( this, wxID_ANY, _("Fill color:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_fillColorLabel->Wrap( -1 );
|
||||
m_textEntrySizer->Add( m_fillColorLabel, wxGBPosition( 5, 3 ), wxGBSpan( 1, 1 ), wxLEFT|wxALIGN_CENTER_VERTICAL, 100 );
|
||||
|
||||
m_panelFillColor = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizer21;
|
||||
bSizer21 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_fillColorSwatch = new COLOR_SWATCH( m_panelFillColor, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer21->Add( m_fillColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
|
||||
|
||||
|
||||
m_panelFillColor->SetSizer( bSizer21 );
|
||||
m_panelFillColor->Layout();
|
||||
bSizer21->Fit( m_panelFillColor );
|
||||
m_textEntrySizer->Add( m_panelFillColor, wxGBPosition( 5, 4 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
m_textEntrySizer->AddGrowableCol( 1 );
|
||||
m_textEntrySizer->AddGrowableCol( 4 );
|
||||
|
||||
bMainSizer->Add( m_textEntrySizer, 1, wxEXPAND|wxALL, 10 );
|
||||
|
|
|
@ -63,9 +63,9 @@
|
|||
<property name="flag">wxEXPAND|wxALL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxGridBagSizer" expanded="1">
|
||||
<property name="empty_cell_size"></property>
|
||||
<property name="empty_cell_size">-1,-1</property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="growablecols">4</property>
|
||||
<property name="growablecols">1,4</property>
|
||||
<property name="growablerows"></property>
|
||||
<property name="hgap">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -345,16 +345,16 @@
|
|||
<property name="flag">wxEXPAND</property>
|
||||
<property name="row">1</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizeCtrlSizer</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="1">
|
||||
<object class="wxBitmapButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -422,11 +422,11 @@
|
|||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="1">
|
||||
<object class="wxBitmapButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -494,11 +494,11 @@
|
|||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="1">
|
||||
<object class="wxBitmapButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -566,11 +566,11 @@
|
|||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="1">
|
||||
<object class="wxBitmapButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -638,11 +638,11 @@
|
|||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="1">
|
||||
<object class="wxBitmapButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -710,11 +710,11 @@
|
|||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="1">
|
||||
<object class="wxBitmapButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -782,11 +782,11 @@
|
|||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="1">
|
||||
<object class="wxBitmapButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -854,11 +854,11 @@
|
|||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="1">
|
||||
<object class="wxBitmapButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -926,11 +926,11 @@
|
|||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="1">
|
||||
<object class="wxBitmapButton" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -1007,16 +1007,16 @@
|
|||
<property name="flag">wxEXPAND|wxALIGN_RIGHT|wxLEFT</property>
|
||||
<property name="row">1</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer41</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxHyperlinkCtrl" expanded="1">
|
||||
<object class="wxHyperlinkCtrl" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -1146,7 +1146,7 @@
|
|||
<property name="border">5</property>
|
||||
<property name="colspan">1</property>
|
||||
<property name="column">1</property>
|
||||
<property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
|
||||
<property name="row">2</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxTextCtrl" expanded="1">
|
||||
|
@ -1273,6 +1273,784 @@
|
|||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="colspan">1</property>
|
||||
<property name="column">0</property>
|
||||
<property name="flag">wxRIGHT|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="row">4</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxStaticText" 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="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">Border width:</property>
|
||||
<property name="markup">0</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_borderWidthLabel</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="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="colspan">1</property>
|
||||
<property name="column">1</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="row">4</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxTextCtrl" 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="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="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength">0</property>
|
||||
<property name="min_size">-1,-1</property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">-1,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_borderWidthCtrl</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">-1,-1</property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></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="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="colspan">1</property>
|
||||
<property name="column">2</property>
|
||||
<property name="flag">wxLEFT|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="row">4</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxStaticText" 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="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">mm</property>
|
||||
<property name="markup">0</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">-1,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_borderWidthUnits</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"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="colspan">1</property>
|
||||
<property name="column">0</property>
|
||||
<property name="flag">wxRIGHT|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="row">5</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxStaticText" 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="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">Border color:</property>
|
||||
<property name="markup">0</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_borderColorLabel</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">; ; Not forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="colspan">1</property>
|
||||
<property name="column">1</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="row">5</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxPanel" expanded="0">
|
||||
<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="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="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_panelBorderColor</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="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxBORDER_SIMPLE|wxTAB_TRAVERSAL</property>
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer2</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="CustomControl" expanded="0">
|
||||
<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="class">COLOR_SWATCH</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="construction"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="declaration"></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="include"></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_borderColorSwatch</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="settings"></property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="subclass">COLOR_SWATCH; widgets/color_swatch.h; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="colspan">1</property>
|
||||
<property name="column">0</property>
|
||||
<property name="flag">wxRIGHT|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="row">6</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxStaticText" 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="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">Border style:</property>
|
||||
<property name="markup">0</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_borderStyleLabel</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="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="colspan">2</property>
|
||||
<property name="column">1</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="row">6</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxBitmapComboBox" 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="choices"></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="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">240,-1</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_borderStyleCombo</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="selection">-1</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxCB_READONLY</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="value">Combo!</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="1">
|
||||
<property name="border">100</property>
|
||||
<property name="colspan">2</property>
|
||||
<property name="column">3</property>
|
||||
<property name="flag">wxLEFT</property>
|
||||
<property name="row">4</property>
|
||||
<property name="rowspan">1</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">Background fill</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_filledCtrl</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="gbsizeritem" expanded="1">
|
||||
<property name="border">100</property>
|
||||
<property name="colspan">1</property>
|
||||
<property name="column">3</property>
|
||||
<property name="flag">wxLEFT|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="row">5</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxStaticText" 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="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">Fill color:</property>
|
||||
<property name="markup">0</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_fillColorLabel</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="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="gbsizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="colspan">1</property>
|
||||
<property name="column">4</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="row">5</property>
|
||||
<property name="rowspan">1</property>
|
||||
<object class="wxPanel" 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="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="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_panelFillColor</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="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxBORDER_SIMPLE|wxTAB_TRAVERSAL</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer21</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="CustomControl" 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="class">COLOR_SWATCH</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="construction"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="declaration"></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="include"></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_fillColorSwatch</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="settings"></property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="subclass">COLOR_SWATCH; widgets/color_swatch.h; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class BITMAP_BUTTON;
|
||||
class COLOR_SWATCH;
|
||||
class FONT_CHOICE;
|
||||
|
||||
#include "dialog_shim.h"
|
||||
|
@ -30,6 +31,9 @@ class FONT_CHOICE;
|
|||
#include <wx/sizer.h>
|
||||
#include <wx/hyperlink.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/bmpcbox.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/gbsizer.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/dialog.h>
|
||||
|
@ -67,6 +71,18 @@ class DIALOG_TEXT_PROPERTIES_BASE : public DIALOG_SHIM
|
|||
wxStaticText* m_textSizeLabel;
|
||||
wxTextCtrl* m_textSizeCtrl;
|
||||
wxStaticText* m_textSizeUnits;
|
||||
wxStaticText* m_borderWidthLabel;
|
||||
wxTextCtrl* m_borderWidthCtrl;
|
||||
wxStaticText* m_borderWidthUnits;
|
||||
wxStaticText* m_borderColorLabel;
|
||||
wxPanel* m_panelBorderColor;
|
||||
COLOR_SWATCH* m_borderColorSwatch;
|
||||
wxStaticText* m_borderStyleLabel;
|
||||
wxBitmapComboBox* m_borderStyleCombo;
|
||||
wxCheckBox* m_filledCtrl;
|
||||
wxStaticText* m_fillColorLabel;
|
||||
wxPanel* m_panelFillColor;
|
||||
COLOR_SWATCH* m_fillColorSwatch;
|
||||
wxStaticLine* m_staticline;
|
||||
wxStdDialogButtonSizer* m_sdbSizer1;
|
||||
wxButton* m_sdbSizer1OK;
|
||||
|
|
|
@ -45,6 +45,7 @@ const KICAD_T EE_COLLECTOR::AllItems[] = {
|
|||
const KICAD_T EE_COLLECTOR::EditableItems[] = {
|
||||
SCH_SHAPE_T,
|
||||
SCH_TEXT_T,
|
||||
SCH_TEXTBOX_T,
|
||||
SCH_LABEL_T,
|
||||
SCH_GLOBAL_LABEL_T,
|
||||
SCH_HIER_LABEL_T,
|
||||
|
@ -84,6 +85,7 @@ const KICAD_T EE_COLLECTOR::MovableItems[] =
|
|||
SCH_BITMAP_T,
|
||||
SCH_SHAPE_T,
|
||||
SCH_TEXT_T,
|
||||
SCH_TEXTBOX_T,
|
||||
SCH_LABEL_T,
|
||||
SCH_GLOBAL_LABEL_T,
|
||||
SCH_HIER_LABEL_T,
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <sch_reference_list.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <sch_sheet_pin.h>
|
||||
#include <sch_textbox.h>
|
||||
#include <schematic.h>
|
||||
#include <drawing_sheet/ds_draw_item.h>
|
||||
#include <drawing_sheet/ds_proxy_view_item.h>
|
||||
|
@ -256,6 +257,18 @@ void ERC_TESTER::TestTextVars( DS_PROXY_VIEW_ITEM* aDrawingSheet )
|
|||
screen->Append( marker );
|
||||
}
|
||||
}
|
||||
else if( SCH_TEXTBOX* textBox = dynamic_cast<SCH_TEXTBOX*>( item ) )
|
||||
{
|
||||
if( textBox->GetShownText().Matches( wxT( "*${*}*" ) ) )
|
||||
{
|
||||
std::shared_ptr<ERC_ITEM> ercItem =
|
||||
ERC_ITEM::Create( ERCE_UNRESOLVED_VARIABLE );
|
||||
ercItem->SetItems( textBox );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( ercItem, textBox->GetPosition() );
|
||||
screen->Append( marker );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for( DS_DRAW_ITEM_BASE* item = wsItems.GetFirst(); item; item = wsItems.GetNext() )
|
||||
|
@ -629,7 +642,7 @@ int ERC_TESTER::TestSimilarLabels()
|
|||
|
||||
int errors = 0;
|
||||
|
||||
std::unordered_map<wxString, SCH_TEXT*> labelMap;
|
||||
std::unordered_map<wxString, SCH_LABEL_BASE*> labelMap;
|
||||
|
||||
for( const std::pair<NET_NAME_CODE, std::vector<CONNECTION_SUBGRAPH*>> net : nets )
|
||||
{
|
||||
|
@ -645,20 +658,20 @@ int ERC_TESTER::TestSimilarLabels()
|
|||
case SCH_HIER_LABEL_T:
|
||||
case SCH_GLOBAL_LABEL_T:
|
||||
{
|
||||
SCH_TEXT* text = static_cast<SCH_TEXT*>( item );
|
||||
SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( item );
|
||||
|
||||
wxString normalized = text->GetShownText().Lower();
|
||||
wxString normalized = label->GetShownText().Lower();
|
||||
|
||||
if( !labelMap.count( normalized ) )
|
||||
{
|
||||
labelMap[normalized] = text;
|
||||
labelMap[normalized] = label;
|
||||
}
|
||||
else if( labelMap.at( normalized )->GetShownText() != text->GetShownText() )
|
||||
else if( labelMap.at( normalized )->GetShownText() != label->GetShownText() )
|
||||
{
|
||||
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_SIMILAR_LABELS );
|
||||
ercItem->SetItems( text, labelMap.at( normalized ) );
|
||||
ercItem->SetItems( label, labelMap.at( normalized ) );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( ercItem, text->GetPosition() );
|
||||
SCH_MARKER* marker = new SCH_MARKER( ercItem, label->GetPosition() );
|
||||
subgraph->m_sheet.LastScreen()->Append( marker );
|
||||
errors += 1;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2013-2021 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2013-2022 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -44,16 +44,8 @@
|
|||
#include <list>
|
||||
#include <class_draw_panel_gal.h>
|
||||
|
||||
class wxFrame;
|
||||
class wxDialog;
|
||||
class SYMBOL_LIBS;
|
||||
class SCH_SYMBOL;
|
||||
class SCH_TEXT;
|
||||
class SCH_SHEET_PATH;
|
||||
class RESCUER;
|
||||
|
||||
// Often this is not used in the prototypes, since wxFrame is good enough and would
|
||||
// represent maximum information hiding.
|
||||
class SCH_EDIT_FRAME;
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,7 +38,8 @@ const int fill_tab[3] = { 'N', 'F', 'f' };
|
|||
LIB_ITEM::LIB_ITEM( KICAD_T aType, LIB_SYMBOL* aSymbol, int aUnit, int aConvert ) :
|
||||
EDA_ITEM( aSymbol, aType ),
|
||||
m_unit( aUnit ),
|
||||
m_convert( aConvert )
|
||||
m_convert( aConvert ),
|
||||
m_private( false )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -262,6 +262,9 @@ public:
|
|||
void SetConvert( int aConvert ) { m_convert = aConvert; }
|
||||
int GetConvert() const { return m_convert; }
|
||||
|
||||
void SetPrivate( bool aPrivate ) { m_private = aPrivate; }
|
||||
bool IsPrivate() const { return m_private; }
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||
#endif
|
||||
|
@ -316,6 +319,11 @@ protected:
|
|||
* body styles. This is typially used for representing DeMorgan variants in KiCad.
|
||||
*/
|
||||
int m_convert;
|
||||
|
||||
/**
|
||||
* Private items are shown only in the Symbol Editor.
|
||||
*/
|
||||
bool m_private;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2004-20212KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -33,8 +33,9 @@
|
|||
#include <lib_shape.h>
|
||||
|
||||
|
||||
LIB_SHAPE::LIB_SHAPE( LIB_SYMBOL* aParent, SHAPE_T aShape, int aLineWidth, FILL_T aFillType ) :
|
||||
LIB_ITEM( LIB_SHAPE_T, aParent ),
|
||||
LIB_SHAPE::LIB_SHAPE( LIB_SYMBOL* aParent, SHAPE_T aShape, int aLineWidth, FILL_T aFillType,
|
||||
KICAD_T aType ) :
|
||||
LIB_ITEM( aType, aParent ),
|
||||
EDA_SHAPE( aShape, aLineWidth, aFillType, true )
|
||||
{
|
||||
m_editState = 0;
|
||||
|
@ -113,11 +114,11 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
|
|||
{
|
||||
VECTOR2I start = aTransform.TransformCoordinate( m_start ) + aOffset;
|
||||
VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset;
|
||||
VECTOR2I center;
|
||||
EDA_ANGLE startAngle;
|
||||
EDA_ANGLE endAngle;
|
||||
int pen_size = GetEffectivePenWidth( aPlotter->RenderSettings() );
|
||||
VECTOR2I center = aTransform.TransformCoordinate( getCenter() ) + aOffset;
|
||||
int penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
|
||||
FILL_T fill = aFill ? m_fill : FILL_T::NO_FILL;
|
||||
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( IsPrivate() ? LAYER_NOTES
|
||||
: LAYER_DEVICE );
|
||||
|
||||
static std::vector<VECTOR2I> cornerList;
|
||||
|
||||
|
@ -136,26 +137,29 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
|
|||
for( const VECTOR2I& pt : m_bezierPoints )
|
||||
cornerList.push_back( aTransform.TransformCoordinate( pt ) + aOffset );
|
||||
}
|
||||
else if( GetShape() == SHAPE_T::ARC )
|
||||
{
|
||||
center = aTransform.TransformCoordinate( getCenter() ) + aOffset;
|
||||
|
||||
CalcArcAngles( startAngle, endAngle );
|
||||
aTransform.MapAngles( &startAngle, &endAngle );
|
||||
}
|
||||
|
||||
if( fill == FILL_T::FILLED_WITH_BG_BODYCOLOR )
|
||||
if( fill != FILL_T::NO_FILL )
|
||||
{
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||
COLOR4D fillColor = color;
|
||||
|
||||
if( aPlotter->GetColorMode() )
|
||||
{
|
||||
if( fill == FILL_T::FILLED_WITH_BG_BODYCOLOR )
|
||||
fillColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||
else if( fill == FILL_T::FILLED_WITH_COLOR )
|
||||
fillColor = GetFillColor();
|
||||
}
|
||||
|
||||
aPlotter->SetColor( fillColor );
|
||||
|
||||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
aPlotter->Arc( center, -endAngle, -startAngle, GetRadius(), fill, 0 );
|
||||
aPlotter->Arc( center, start, end, fill, 0, ARC_HIGH_DEF );
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
aPlotter->Circle( start, GetRadius() * 2, fill, 0 );
|
||||
aPlotter->Circle( center, GetRadius() * 2, fill, 0 );
|
||||
break;
|
||||
|
||||
case SHAPE_T::RECT:
|
||||
|
@ -171,31 +175,31 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
|
|||
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
|
||||
}
|
||||
|
||||
if( pen_size <= 0 )
|
||||
if( penWidth <= 0 )
|
||||
return;
|
||||
else
|
||||
fill = FILL_T::NO_FILL;
|
||||
}
|
||||
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
|
||||
aPlotter->SetColor( color );
|
||||
|
||||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
aPlotter->Arc( center, -endAngle, -startAngle, GetRadius(), fill, pen_size );
|
||||
aPlotter->Arc( center, start, end, fill, penWidth, ARC_HIGH_DEF );
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
aPlotter->Circle( start, GetRadius() * 2, fill, pen_size );
|
||||
aPlotter->Circle( center, GetRadius() * 2, fill, penWidth );
|
||||
break;
|
||||
|
||||
case SHAPE_T::RECT:
|
||||
aPlotter->Rect( start, end, fill, pen_size );
|
||||
aPlotter->Rect( start, end, fill, penWidth );
|
||||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
case SHAPE_T::BEZIER:
|
||||
aPlotter->PlotPoly( cornerList, fill, pen_size );
|
||||
aPlotter->PlotPoly( cornerList, fill, penWidth );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -223,8 +227,7 @@ void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
|
|||
VECTOR2I pt1 = aTransform.TransformCoordinate( m_start ) + aOffset;
|
||||
VECTOR2I pt2 = aTransform.TransformCoordinate( m_end ) + aOffset;
|
||||
VECTOR2I c;
|
||||
COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
|
||||
COLOR4D fillColor = color;
|
||||
COLOR4D color = aSettings->GetLayerColor( IsPrivate() ? LAYER_NOTES : LAYER_DEVICE );
|
||||
|
||||
unsigned ptCount = 0;
|
||||
VECTOR2I* buffer = nullptr;
|
||||
|
@ -291,8 +294,12 @@ void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
|
|||
}
|
||||
else
|
||||
{
|
||||
COLOR4D fillColor = color;
|
||||
|
||||
if( GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
|
||||
fillColor = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||
else if( GetFillMode() == FILL_T::FILLED_WITH_COLOR )
|
||||
fillColor = GetFillColor();
|
||||
|
||||
switch( GetShape() )
|
||||
{
|
||||
|
@ -421,3 +428,12 @@ void LIB_SHAPE::AddPoint( const VECTOR2I& aPosition )
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void LIB_SHAPE::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
{
|
||||
aCount = 3;
|
||||
aLayers[0] = IsPrivate() ? LAYER_NOTES : LAYER_DEVICE;
|
||||
aLayers[1] = IsPrivate() ? LAYER_NOTES_BACKGROUND : LAYER_DEVICE_BACKGROUND;
|
||||
aLayers[2] = LAYER_SELECTION_SHADOWS;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -33,7 +33,7 @@ class LIB_SHAPE : public LIB_ITEM, public EDA_SHAPE
|
|||
{
|
||||
public:
|
||||
LIB_SHAPE( LIB_SYMBOL* aParent, SHAPE_T aShape, int aLineWidth = 0,
|
||||
FILL_T aFillType = FILL_T::NO_FILL );
|
||||
FILL_T aFillType = FILL_T::NO_FILL, KICAD_T aType = LIB_SHAPE_T );
|
||||
|
||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||
|
||||
|
@ -78,8 +78,8 @@ public:
|
|||
bool ContinueEdit( const VECTOR2I& aPosition ) override { return continueEdit( aPosition ); }
|
||||
void CalcEdit( const VECTOR2I& aPosition ) override { calcEdit( aPosition ); }
|
||||
|
||||
void EndEdit() override { endEdit( false ); }
|
||||
void SetEditState( int aState ) { setEditState( aState ); }
|
||||
void EndEdit() override { endEdit( false ); }
|
||||
void SetEditState( int aState ) { setEditState( aState ); }
|
||||
|
||||
void AddPoint( const VECTOR2I& aPosition );
|
||||
|
||||
|
@ -87,7 +87,7 @@ public:
|
|||
|
||||
void MoveTo( const VECTOR2I& aPosition ) override;
|
||||
|
||||
VECTOR2I GetPosition() const override { return getPosition(); }
|
||||
VECTOR2I GetPosition() const override { return getPosition(); }
|
||||
void SetPosition( const VECTOR2I& aPosition ) override { setPosition( aPosition ); }
|
||||
|
||||
VECTOR2I GetCenter() const { return getCenter(); }
|
||||
|
@ -105,6 +105,8 @@ public:
|
|||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @copydoc LIB_ITEM::compare()
|
||||
|
|
|
@ -0,0 +1,415 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* 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 <pgm_base.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <plotters/plotter.h>
|
||||
#include <widgets/msgpanel.h>
|
||||
#include <bitmaps.h>
|
||||
#include <string_utils.h>
|
||||
#include <schematic.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <sch_painter.h>
|
||||
#include <wx/log.h>
|
||||
#include <dialogs/html_message_box.h>
|
||||
#include <project/project_file.h>
|
||||
#include <project/net_settings.h>
|
||||
#include <core/kicad_algo.h>
|
||||
#include <trigo.h>
|
||||
#include <lib_textbox.h>
|
||||
|
||||
using KIGFX::SCH_RENDER_SETTINGS;
|
||||
|
||||
|
||||
LIB_TEXTBOX::LIB_TEXTBOX( LIB_SYMBOL* aParent, int aLineWidth, FILL_T aFillType,
|
||||
const wxString& text ) :
|
||||
LIB_SHAPE( aParent, SHAPE_T::RECT, aLineWidth, aFillType, LIB_TEXTBOX_T ),
|
||||
EDA_TEXT( text )
|
||||
{
|
||||
SetTextSize( wxSize( Mils2iu( DEFAULT_TEXT_SIZE ), Mils2iu( DEFAULT_TEXT_SIZE ) ) );
|
||||
SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||
SetVertJustify( GR_TEXT_V_ALIGN_TOP );
|
||||
SetMultilineAllowed( true );
|
||||
}
|
||||
|
||||
|
||||
LIB_TEXTBOX::LIB_TEXTBOX( const LIB_TEXTBOX& aText ) :
|
||||
LIB_SHAPE( aText ),
|
||||
EDA_TEXT( aText )
|
||||
{ }
|
||||
|
||||
|
||||
int LIB_TEXTBOX::GetTextMargin() const
|
||||
{
|
||||
return KiROUND( GetTextSize().y * 0.8 );
|
||||
}
|
||||
|
||||
|
||||
void LIB_TEXTBOX::Offset( const VECTOR2I& aOffset )
|
||||
{
|
||||
LIB_SHAPE::Offset( aOffset );
|
||||
UpdateTextPosition();
|
||||
}
|
||||
|
||||
|
||||
void LIB_TEXTBOX::MoveTo( const VECTOR2I& newPosition )
|
||||
{
|
||||
LIB_SHAPE::MoveTo( newPosition );
|
||||
UpdateTextPosition();
|
||||
}
|
||||
|
||||
|
||||
void LIB_TEXTBOX::MirrorHorizontally( const VECTOR2I& center )
|
||||
{
|
||||
// Text is NOT really mirrored; it just has its justification flipped
|
||||
if( GetTextAngle() == ANGLE_HORIZONTAL )
|
||||
{
|
||||
SetHorizJustify( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT ? GR_TEXT_H_ALIGN_LEFT
|
||||
: GR_TEXT_H_ALIGN_RIGHT );
|
||||
}
|
||||
|
||||
UpdateTextPosition();
|
||||
}
|
||||
|
||||
|
||||
void LIB_TEXTBOX::MirrorVertically( const VECTOR2I& center )
|
||||
{
|
||||
// Text is NOT really mirrored; it just has its justification flipped
|
||||
if( GetTextAngle() == ANGLE_VERTICAL )
|
||||
{
|
||||
SetHorizJustify( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT ? GR_TEXT_H_ALIGN_LEFT
|
||||
: GR_TEXT_H_ALIGN_RIGHT );
|
||||
}
|
||||
|
||||
UpdateTextPosition();
|
||||
}
|
||||
|
||||
|
||||
void LIB_TEXTBOX::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
||||
{
|
||||
LIB_SHAPE::Rotate( aCenter, aRotateCCW );
|
||||
|
||||
SetTextAngle( GetTextAngle() == ANGLE_VERTICAL ? ANGLE_HORIZONTAL : ANGLE_VERTICAL );
|
||||
UpdateTextPosition();
|
||||
}
|
||||
|
||||
|
||||
void LIB_TEXTBOX::UpdateTextPosition()
|
||||
{
|
||||
int margin = GetTextMargin();
|
||||
BOX2I bbox( VECTOR2I( std::min( m_start.x, m_end.x ), std::min( -m_start.y, -m_end.y ) ),
|
||||
VECTOR2I( abs( m_end.x - m_start.x ), abs( m_end.y - m_start.y ) ) );
|
||||
|
||||
if( GetTextAngle() == ANGLE_HORIZONTAL )
|
||||
{
|
||||
if( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
|
||||
SetTextPos( VECTOR2I( bbox.GetRight() - margin, bbox.GetTop() + margin ) );
|
||||
else
|
||||
SetTextPos( VECTOR2I( bbox.GetLeft() + margin, bbox.GetTop() + margin ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
|
||||
SetTextPos( VECTOR2I( bbox.GetLeft() + margin, bbox.GetTop() + margin ) );
|
||||
else
|
||||
SetTextPos( VECTOR2I( bbox.GetLeft() + margin, bbox.GetBottom() - margin ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int LIB_TEXTBOX::compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompareFlags ) const
|
||||
{
|
||||
wxASSERT( aOther.Type() == LIB_TEXTBOX_T );
|
||||
|
||||
int retv = LIB_ITEM::compare( aOther, aCompareFlags );
|
||||
|
||||
if( retv )
|
||||
return retv;
|
||||
|
||||
const LIB_TEXTBOX* tmp = static_cast<const LIB_TEXTBOX*>( &aOther );
|
||||
|
||||
int result = GetText().CmpNoCase( tmp->GetText() );
|
||||
|
||||
if( result != 0 )
|
||||
return result;
|
||||
|
||||
if( GetTextWidth() != tmp->GetTextWidth() )
|
||||
return GetTextWidth() - tmp->GetTextWidth();
|
||||
|
||||
if( GetTextHeight() != tmp->GetTextHeight() )
|
||||
return GetTextHeight() - tmp->GetTextHeight();
|
||||
|
||||
if( IsBold() != tmp->IsBold() )
|
||||
return IsBold() - tmp->IsBold();
|
||||
|
||||
if( IsItalic() != tmp->IsItalic() )
|
||||
return IsItalic() - tmp->IsItalic();
|
||||
|
||||
if( GetHorizJustify() != tmp->GetHorizJustify() )
|
||||
return GetHorizJustify() - tmp->GetHorizJustify();
|
||||
|
||||
if( GetTextAngle().AsTenthsOfADegree() != tmp->GetTextAngle().AsTenthsOfADegree() )
|
||||
return GetTextAngle().AsTenthsOfADegree() - tmp->GetTextAngle().AsTenthsOfADegree();
|
||||
|
||||
return EDA_SHAPE::Compare( &static_cast<const LIB_SHAPE&>( aOther ) );
|
||||
}
|
||||
|
||||
|
||||
int LIB_TEXTBOX::GetPenWidth() const
|
||||
{
|
||||
return GetEffectiveTextPenWidth();
|
||||
}
|
||||
|
||||
|
||||
KIFONT::FONT* LIB_TEXTBOX::GetDrawFont() const
|
||||
{
|
||||
KIFONT::FONT* font = EDA_TEXT::GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
|
||||
void LIB_TEXTBOX::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
|
||||
const TRANSFORM& aTransform )
|
||||
{
|
||||
bool forceNoFill = static_cast<bool>( aData );
|
||||
int penWidth = GetEffectivePenWidth( aSettings );
|
||||
|
||||
if( forceNoFill && IsFilled() && penWidth == 0 )
|
||||
return;
|
||||
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
VECTOR2I pt1 = aTransform.TransformCoordinate( m_start ) + aOffset;
|
||||
VECTOR2I pt2 = aTransform.TransformCoordinate( m_end ) + aOffset;
|
||||
COLOR4D color = aSettings->GetLayerColor( IsPrivate() ? LAYER_NOTES : LAYER_DEVICE );
|
||||
|
||||
if( !forceNoFill && GetFillMode() == FILL_T::FILLED_WITH_COLOR )
|
||||
{
|
||||
GRFilledRect( nullptr, DC, pt1.x, pt1.y, pt2.x, pt2.y, penWidth, color, GetFillColor() );
|
||||
}
|
||||
|
||||
if( GetStroke().GetColor() != COLOR4D::UNSPECIFIED )
|
||||
color = GetStroke().GetColor();
|
||||
|
||||
penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() );
|
||||
|
||||
if( GetStroke().GetPlotStyle() <= PLOT_DASH_TYPE::FIRST_TYPE )
|
||||
{
|
||||
GRRect( nullptr, DC, pt1.x, pt1.y, pt2.x, pt2.y, penWidth, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<SHAPE*> shapes = MakeEffectiveShapes( true );
|
||||
|
||||
for( SHAPE* shape : shapes )
|
||||
{
|
||||
STROKE_PARAMS::Stroke( shape, GetStroke().GetPlotStyle(), penWidth, aSettings,
|
||||
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||
{
|
||||
GRLine( nullptr, DC, a.x, a.y, b.x, b.y, penWidth, color );
|
||||
} );
|
||||
}
|
||||
|
||||
for( SHAPE* shape : shapes )
|
||||
delete shape;
|
||||
}
|
||||
|
||||
// Calculate the text orientation, according to the symbol orientation/mirror (needed when
|
||||
// draw text in schematic)
|
||||
EDA_ANGLE orient = GetTextAngle();
|
||||
|
||||
if( aTransform.y1 ) // Rotate symbol 90 degrees.
|
||||
{
|
||||
if( orient == ANGLE_HORIZONTAL )
|
||||
orient = ANGLE_VERTICAL;
|
||||
else
|
||||
orient = ANGLE_HORIZONTAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the text justification, according to the symbol orientation/mirror.
|
||||
* This is a bit complicated due to cumulative calculations:
|
||||
* - numerous cases (mirrored or not, rotation)
|
||||
* - the GRText function will also recalculate H and V justifications according to the text
|
||||
* orientation.
|
||||
* - When a symbol is mirrored, the text is not mirrored and justifications are complicated
|
||||
* to calculate so the more easily way is to use no justifications (centered text) and
|
||||
* use GetBoundingBox to know the text coordinate considered as centered
|
||||
*/
|
||||
EDA_RECT bBox = GetBoundingBox();
|
||||
|
||||
// convert coordinates from draw Y axis to symbol_editor Y axis:
|
||||
bBox.RevertYAxis();
|
||||
VECTOR2I txtpos = bBox.Centre();
|
||||
|
||||
// Calculate pos according to mirror/rotation.
|
||||
txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset;
|
||||
|
||||
GRPrintText( DC, txtpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_H_ALIGN_CENTER,
|
||||
GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(), IsBold(), GetDrawFont() );
|
||||
}
|
||||
|
||||
|
||||
wxString LIB_TEXTBOX::GetShownText( int aDepth ) const
|
||||
{
|
||||
wxString text = EDA_TEXT::GetShownText();
|
||||
|
||||
KIFONT::FONT* font = GetDrawFont();
|
||||
VECTOR2D size = GetEnd() - GetStart();
|
||||
int colWidth = GetTextAngle() == ANGLE_HORIZONTAL ? size.x : size.y;
|
||||
|
||||
colWidth = abs( colWidth ) - GetTextMargin() * 2;
|
||||
font->LinebreakText( text, colWidth, GetTextSize(), GetTextThickness(), IsBold(), IsItalic() );
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
bool LIB_TEXTBOX::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
||||
{
|
||||
if( aAccuracy < Mils2iu( MINIMUM_SELECTION_DISTANCE ) )
|
||||
aAccuracy = Mils2iu( MINIMUM_SELECTION_DISTANCE );
|
||||
|
||||
EDA_RECT rect = GetBoundingBox();
|
||||
|
||||
rect.Inflate( aAccuracy );
|
||||
|
||||
return rect.Contains( aPosition );
|
||||
}
|
||||
|
||||
|
||||
bool LIB_TEXTBOX::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
|
||||
{
|
||||
EDA_RECT rect = aRect;
|
||||
|
||||
rect.Inflate( aAccuracy );
|
||||
|
||||
if( aContained )
|
||||
return rect.Contains( GetBoundingBox() );
|
||||
|
||||
return rect.Intersects( GetBoundingBox() );
|
||||
}
|
||||
|
||||
|
||||
wxString LIB_TEXTBOX::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
{
|
||||
return wxString::Format( _( "Graphic Text Box" ) );
|
||||
}
|
||||
|
||||
|
||||
BITMAPS LIB_TEXTBOX::GetMenuImage() const
|
||||
{
|
||||
return BITMAPS::add_textbox;
|
||||
}
|
||||
|
||||
|
||||
void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
|
||||
const TRANSFORM& aTransform ) const
|
||||
{
|
||||
wxASSERT( aPlotter != nullptr );
|
||||
|
||||
VECTOR2I start = aTransform.TransformCoordinate( m_start ) + aOffset;
|
||||
VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset;
|
||||
int penWidth = GetEffectivePenWidth( aPlotter->RenderSettings() );
|
||||
FILL_T fill = aFill ? m_fill : FILL_T::NO_FILL;
|
||||
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( IsPrivate() ? LAYER_NOTES
|
||||
: LAYER_DEVICE );
|
||||
if( fill != FILL_T::NO_FILL )
|
||||
{
|
||||
COLOR4D fillColor = color;
|
||||
|
||||
if( aPlotter->GetColorMode() )
|
||||
{
|
||||
if( fill == FILL_T::FILLED_WITH_BG_BODYCOLOR )
|
||||
fillColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||
else if( fill == FILL_T::FILLED_WITH_COLOR )
|
||||
fillColor = GetFillColor();
|
||||
}
|
||||
|
||||
aPlotter->SetColor( fillColor );
|
||||
aPlotter->Rect( start, end, fill, 0 );
|
||||
|
||||
fill = FILL_T::NO_FILL;
|
||||
}
|
||||
|
||||
aPlotter->SetColor( color );
|
||||
aPlotter->Rect( start, end, fill, penWidth );
|
||||
|
||||
KIFONT::FONT* font = GetDrawFont();
|
||||
LIB_TEXTBOX text( *this );
|
||||
|
||||
penWidth = std::max( GetEffectiveTextPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
|
||||
|
||||
if( aTransform.y1 != 0 && aTransform.x2 != 0 )
|
||||
{
|
||||
text.SetTextAngle( text.GetTextAngle() == ANGLE_HORIZONTAL ? ANGLE_VERTICAL
|
||||
: ANGLE_HORIZONTAL );
|
||||
}
|
||||
|
||||
// NB: UpdateTextPosition() wants Symbol Editor (upside-down) coordinates
|
||||
text.SetStart( VECTOR2I( start.x, -start.y ) );
|
||||
text.SetEnd( VECTOR2I( end.x, -end.y ) );
|
||||
text.UpdateTextPosition();
|
||||
|
||||
std::vector<VECTOR2I> positions;
|
||||
wxArrayString strings_list;
|
||||
wxStringSplit( GetShownText(), strings_list, '\n' );
|
||||
positions.reserve( strings_list.Count() );
|
||||
|
||||
text.GetLinePositions( positions, (int) strings_list.Count() );
|
||||
|
||||
for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
|
||||
{
|
||||
aPlotter->Text( positions[ii], color, strings_list.Item( ii ), text.GetTextAngle(),
|
||||
text.GetTextSize(), text.GetHorizJustify(), text.GetVertJustify(),
|
||||
penWidth, text.IsItalic(), text.IsBold(), false, font );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LIB_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
// Don't use GetShownText() here; we want to show the user the variable references
|
||||
aList.emplace_back( _( "Text Box" ), UnescapeString( GetText() ) );
|
||||
|
||||
wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
|
||||
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
|
||||
aList.emplace_back( _( "Style" ), textStyle[style] );
|
||||
|
||||
aList.emplace_back( _( "Text Size" ), MessageTextFromValue( aFrame->GetUserUnits(),
|
||||
GetTextWidth() ) );
|
||||
}
|
||||
|
||||
|
||||
void LIB_TEXTBOX::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
{
|
||||
aCount = 3;
|
||||
aLayers[0] = IsPrivate() ? LAYER_NOTES : LAYER_DEVICE;
|
||||
aLayers[1] = IsPrivate() ? LAYER_NOTES_BACKGROUND : LAYER_DEVICE_BACKGROUND;
|
||||
aLayers[2] = LAYER_SELECTION_SHADOWS;
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* 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 LIB_TEXTBOX_H
|
||||
#define LIB_TEXTBOX_H
|
||||
|
||||
|
||||
#include <eda_text.h>
|
||||
#include <lib_shape.h>
|
||||
|
||||
|
||||
class HTML_MESSAGE_BOX;
|
||||
|
||||
class LIB_TEXTBOX : public LIB_SHAPE, public EDA_TEXT
|
||||
{
|
||||
public:
|
||||
LIB_TEXTBOX( LIB_SYMBOL* aParent, int aLineWidth = 0, FILL_T aFillType = FILL_T::NO_FILL,
|
||||
const wxString& aText = wxEmptyString );
|
||||
|
||||
LIB_TEXTBOX( const LIB_TEXTBOX& aText );
|
||||
|
||||
~LIB_TEXTBOX() { }
|
||||
|
||||
static inline bool ClassOf( const EDA_ITEM* aItem )
|
||||
{
|
||||
return aItem && aItem->Type() == LIB_TEXTBOX_T;
|
||||
}
|
||||
|
||||
virtual wxString GetClass() const override
|
||||
{
|
||||
return wxT( "LIB_TEXTBOX" );
|
||||
}
|
||||
|
||||
int GetTextMargin() const;
|
||||
|
||||
void UpdateTextPosition();
|
||||
|
||||
wxString GetShownText( int aDepth = 0 ) const override;
|
||||
|
||||
int GetPenWidth() const override;
|
||||
|
||||
KIFONT::FONT* GetDrawFont() const override;
|
||||
|
||||
void Offset( const VECTOR2I& aOffset ) override;
|
||||
void MoveTo( const VECTOR2I& newPosition ) override;
|
||||
|
||||
void MirrorHorizontally( const VECTOR2I& center );
|
||||
void MirrorVertically( const VECTOR2I& center );
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
|
||||
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override
|
||||
{
|
||||
return LIB_ITEM::Matches( GetText(), aSearchData );
|
||||
}
|
||||
|
||||
bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData ) override
|
||||
{
|
||||
return EDA_TEXT::Replace( aSearchData );
|
||||
}
|
||||
|
||||
virtual bool IsReplaceable() const override { return true; }
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter, const VECTOR2I& offset, bool fill,
|
||||
const TRANSFORM& aTransform ) const override;
|
||||
|
||||
EDA_ITEM* Clone() const override
|
||||
{
|
||||
return new LIB_TEXTBOX( *this );
|
||||
}
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
private:
|
||||
int compare( const LIB_ITEM& aOther,
|
||||
LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override;
|
||||
|
||||
void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
|
||||
const TRANSFORM& aTransform ) override;
|
||||
};
|
||||
|
||||
|
||||
#endif /* LIB_TEXTBOX_H */
|
|
@ -220,11 +220,12 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
placeMenu->Add( EE_ACTIONS::importSheetPin );
|
||||
|
||||
placeMenu->AppendSeparator();
|
||||
placeMenu->Add( EE_ACTIONS::placeSchematicText );
|
||||
placeMenu->Add( EE_ACTIONS::drawTextBox );
|
||||
placeMenu->Add( EE_ACTIONS::drawRectangle );
|
||||
placeMenu->Add( EE_ACTIONS::drawCircle );
|
||||
placeMenu->Add( EE_ACTIONS::drawArc );
|
||||
placeMenu->Add( EE_ACTIONS::drawLines );
|
||||
placeMenu->Add( EE_ACTIONS::placeSchematicText );
|
||||
placeMenu->Add( EE_ACTIONS::placeImage );
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 1992-2013 jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -38,6 +38,7 @@
|
|||
#include <env_paths.h>
|
||||
#include <pgm_base.h>
|
||||
#include <common.h>
|
||||
#include <sch_textbox.h>
|
||||
|
||||
#include <wx/tokenzr.h>
|
||||
#include <wx/regex.h>
|
||||
|
@ -469,14 +470,21 @@ void NETLIST_EXPORTER_PSPICE::UpdateDirectives( unsigned aCtl )
|
|||
wxRE_ADVANCED );
|
||||
|
||||
m_directives.clear();
|
||||
bool controlBlock = false;
|
||||
bool circuitBlock = false;
|
||||
|
||||
bool controlBlock = false;
|
||||
bool circuitBlock = false;
|
||||
wxString text;
|
||||
|
||||
for( unsigned i = 0; i < sheetList.size(); i++ )
|
||||
{
|
||||
for( SCH_ITEM* item : sheetList[i].LastScreen()->Items().OfType( SCH_TEXT_T ) )
|
||||
for( SCH_ITEM* item : sheetList[i].LastScreen()->Items() )
|
||||
{
|
||||
wxString text = static_cast<SCH_TEXT*>( item )->GetShownText();
|
||||
if( item->Type() == SCH_TEXT_T )
|
||||
text = static_cast<SCH_TEXT*>( item )->GetShownText();
|
||||
else if( item->Type() == SCH_TEXTBOX_T )
|
||||
text = static_cast<SCH_TEXTBOX*>( item )->GetShownText();
|
||||
else
|
||||
continue;
|
||||
|
||||
if( text.IsEmpty() )
|
||||
continue;
|
||||
|
|
|
@ -519,8 +519,12 @@ void SCH_EDIT_FRAME::setupUIConditions()
|
|||
CURRENT_TOOL( EE_ACTIONS::placeHierLabel );
|
||||
CURRENT_TOOL( EE_ACTIONS::drawSheet );
|
||||
CURRENT_TOOL( EE_ACTIONS::importSheetPin );
|
||||
CURRENT_TOOL( EE_ACTIONS::drawRectangle );
|
||||
CURRENT_TOOL( EE_ACTIONS::drawCircle );
|
||||
CURRENT_TOOL( EE_ACTIONS::drawArc );
|
||||
CURRENT_TOOL( EE_ACTIONS::drawLines );
|
||||
CURRENT_TOOL( EE_ACTIONS::placeSchematicText );
|
||||
CURRENT_TOOL( EE_ACTIONS::drawTextBox );
|
||||
CURRENT_TOOL( EE_ACTIONS::placeImage );
|
||||
|
||||
#undef CURRENT_TOOL
|
||||
|
@ -1177,7 +1181,7 @@ bool SCH_EDIT_FRAME::isAutoSaveRequired() const
|
|||
}
|
||||
|
||||
|
||||
static void inheritNetclass( const SCH_SHEET_PATH& aSheetPath, SCH_TEXT* aItem )
|
||||
static void inheritNetclass( const SCH_SHEET_PATH& aSheetPath, SCH_LABEL_BASE* aItem )
|
||||
{
|
||||
if( CONNECTION_SUBGRAPH::GetDriverPriority( aItem ) == CONNECTION_SUBGRAPH::PRIORITY::NONE )
|
||||
return;
|
||||
|
@ -1285,8 +1289,8 @@ void SCH_EDIT_FRAME::AddItemToScreenAndUndoList( SCH_SCREEN* aScreen, SCH_ITEM*
|
|||
{
|
||||
RecalculateConnections( LOCAL_CLEANUP );
|
||||
|
||||
if( SCH_TEXT* textItem = dynamic_cast<SCH_TEXT*>( aItem ) )
|
||||
inheritNetclass( GetCurrentSheet(), textItem );
|
||||
if( SCH_LABEL_BASE* label = dynamic_cast<SCH_LABEL_BASE*>( aItem ) )
|
||||
inheritNetclass( GetCurrentSheet(), label );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020-2021 CERN
|
||||
*
|
||||
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* @author Wayne Stambaugh <stambaughw@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -42,7 +42,8 @@
|
|||
//#define SEXPR_SYMBOL_LIB_FILE_VERSION 20210619 // Change pin overbar syntax from `~...~` to `~{...}`.
|
||||
//#define SEXPR_SYMBOL_LIB_FILE_VERSION 20211014 // Arc formatting.
|
||||
//#define SEXPR_SYMBOL_LIB_FILE_VERSION 20220101 // Class flags.
|
||||
#define SEXPR_SYMBOL_LIB_FILE_VERSION 20220102 // Fonts.
|
||||
//#define SEXPR_SYMBOL_LIB_FILE_VERSION 20220102 // Fonts.
|
||||
#define SEXPR_SYMBOL_LIB_FILE_VERSION 20220126 // Text boxes.
|
||||
|
||||
|
||||
/**
|
||||
|
@ -73,4 +74,5 @@
|
|||
//#define SEXPR_SCHEMATIC_FILE_VERSION 20220102 // Dash-dot-dot
|
||||
//#define SEXPR_SCHEMATIC_FILE_VERSION 20220103 // Label fields
|
||||
//#define SEXPR_SCHEMATIC_FILE_VERSION 20220104 // Fonts
|
||||
#define SEXPR_SCHEMATIC_FILE_VERSION 20220124 // netclass_flag -> directive_label
|
||||
//#define SEXPR_SCHEMATIC_FILE_VERSION 20220124 // netclass_flag -> directive_label
|
||||
#define SEXPR_SCHEMATIC_FILE_VERSION 20220126 // Text boxes
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <lib_item.h>
|
||||
#include <lib_pin.h>
|
||||
#include <lib_text.h>
|
||||
#include <lib_textbox.h>
|
||||
#include <math/util.h>
|
||||
#include <sch_bitmap.h>
|
||||
#include <sch_bus_entry.h>
|
||||
|
@ -51,6 +52,7 @@
|
|||
#include <sch_sheet.h>
|
||||
#include <sch_sheet_pin.h>
|
||||
#include <sch_text.h>
|
||||
#include <sch_textbox.h>
|
||||
#include <schematic.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <view/view.h>
|
||||
|
@ -219,11 +221,13 @@ bool SCH_PAINTER::Draw( const VIEW_ITEM *aItem, int aLayer )
|
|||
HANDLE_ITEM( LIB_PIN_T, LIB_PIN );
|
||||
HANDLE_ITEM( LIB_FIELD_T, LIB_FIELD );
|
||||
HANDLE_ITEM( LIB_TEXT_T, LIB_TEXT );
|
||||
HANDLE_ITEM( LIB_TEXTBOX_T, LIB_TEXTBOX );
|
||||
HANDLE_ITEM( SCH_SYMBOL_T, SCH_SYMBOL );
|
||||
HANDLE_ITEM( SCH_JUNCTION_T, SCH_JUNCTION );
|
||||
HANDLE_ITEM( SCH_LINE_T, SCH_LINE );
|
||||
HANDLE_ITEM( SCH_SHAPE_T, SCH_SHAPE );
|
||||
HANDLE_ITEM( SCH_TEXT_T, SCH_TEXT );
|
||||
HANDLE_ITEM( SCH_TEXTBOX_T, SCH_TEXTBOX );
|
||||
HANDLE_ITEM( SCH_LABEL_T, SCH_LABEL );
|
||||
HANDLE_ITEM( SCH_DIRECTIVE_LABEL_T, SCH_DIRECTIVE_LABEL );
|
||||
HANDLE_ITEM( SCH_FIELD_T, SCH_FIELD );
|
||||
|
@ -334,6 +338,20 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDr
|
|||
if( color == COLOR4D::UNSPECIFIED )
|
||||
color = m_schSettings.GetLayerColor( aLayer );
|
||||
}
|
||||
else if( aItem->Type() == SCH_TEXTBOX_T )
|
||||
{
|
||||
const SCH_TEXTBOX* textBox = static_cast<const SCH_TEXTBOX*>( aItem );
|
||||
|
||||
if( m_schSettings.m_OverrideItemColors )
|
||||
color = m_schSettings.GetLayerColor( aLayer );
|
||||
else if( aLayer == LAYER_NOTES )
|
||||
color = textBox->GetStroke().GetColor();
|
||||
else if( aLayer == LAYER_NOTES_BACKGROUND )
|
||||
color = textBox->GetFillColor();
|
||||
|
||||
if( color == COLOR4D::UNSPECIFIED )
|
||||
color = m_schSettings.GetLayerColor( aLayer );
|
||||
}
|
||||
|
||||
if( aItem->IsBrightened() ) // Selection disambiguation, net highlighting, etc.
|
||||
{
|
||||
|
@ -360,22 +378,35 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDr
|
|||
}
|
||||
|
||||
|
||||
float SCH_PAINTER::getLineWidth( const LIB_ITEM* aItem, bool aDrawingShadows ) const
|
||||
float SCH_PAINTER::getLineWidth( const EDA_ITEM* aItem, bool aDrawingShadows ) const
|
||||
{
|
||||
float width = (float) aItem->GetEffectivePenWidth( &m_schSettings );
|
||||
wxCHECK( aItem, static_cast<float>( Mils2iu( DEFAULT_LINE_WIDTH_MILS ) ) );
|
||||
|
||||
if( ( aItem->IsBrightened() || aItem->IsSelected() ) && aDrawingShadows )
|
||||
width += getShadowWidth( aItem->IsBrightened() );
|
||||
int pen;
|
||||
|
||||
return width;
|
||||
}
|
||||
if( aItem->Type() == LIB_TEXTBOX_T )
|
||||
{
|
||||
pen = static_cast<const LIB_TEXTBOX*>( aItem )->GetStroke().GetWidth();
|
||||
}
|
||||
else if( aItem->Type() == SCH_TEXTBOX_T )
|
||||
{
|
||||
pen = static_cast<const SCH_TEXTBOX*>( aItem )->GetStroke().GetWidth();
|
||||
}
|
||||
else if( dynamic_cast<const LIB_ITEM*>( aItem ) )
|
||||
{
|
||||
pen = static_cast<const LIB_ITEM*>( aItem )->GetEffectivePenWidth( &m_schSettings );
|
||||
}
|
||||
else if( dynamic_cast<const SCH_ITEM*>( aItem ) )
|
||||
{
|
||||
pen = static_cast<const SCH_ITEM*>( aItem )->GetPenWidth();
|
||||
}
|
||||
else
|
||||
{
|
||||
pen = 0;
|
||||
UNIMPLEMENTED_FOR( aItem->GetClass() );
|
||||
}
|
||||
|
||||
|
||||
float SCH_PAINTER::getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows ) const
|
||||
{
|
||||
wxCHECK( aItem, static_cast<float>( Mils2iu( DEFAULT_WIRE_WIDTH_MILS ) ) );
|
||||
|
||||
float width = (float) aItem->GetPenWidth();
|
||||
float width = pen;
|
||||
|
||||
if( ( aItem->IsBrightened() || aItem->IsSelected() ) && aDrawingShadows )
|
||||
width += getShadowWidth( aItem->IsBrightened() );
|
||||
|
@ -384,44 +415,41 @@ float SCH_PAINTER::getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows ) c
|
|||
}
|
||||
|
||||
|
||||
float SCH_PAINTER::getTextThickness( const SCH_TEXT* aItem, bool aDrawingShadows ) const
|
||||
float SCH_PAINTER::getTextThickness( const EDA_ITEM* aItem, bool aDrawingShadows ) const
|
||||
{
|
||||
float width = (float) aItem->GetEffectiveTextPenWidth( m_schSettings.GetDefaultPenWidth() );
|
||||
int pen = m_schSettings.GetDefaultPenWidth();
|
||||
|
||||
if( ( aItem->IsBrightened() || aItem->IsSelected() ) && aDrawingShadows )
|
||||
width += getShadowWidth( aItem->IsBrightened() );
|
||||
switch( aItem->Type() )
|
||||
{
|
||||
case SCH_FIELD_T:
|
||||
pen = static_cast<const SCH_FIELD*>( aItem )->GetEffectiveTextPenWidth( pen );
|
||||
break;
|
||||
|
||||
return width;
|
||||
}
|
||||
case SCH_TEXT_T:
|
||||
pen = static_cast<const SCH_TEXT*>( aItem )->GetEffectiveTextPenWidth( pen );
|
||||
break;
|
||||
|
||||
case SCH_TEXTBOX_T:
|
||||
pen = static_cast<const SCH_TEXTBOX*>( aItem )->GetEffectiveTextPenWidth( pen );
|
||||
break;
|
||||
|
||||
float SCH_PAINTER::getTextThickness( const SCH_FIELD* aItem, bool aDrawingShadows ) const
|
||||
{
|
||||
float width = (float) aItem->GetEffectiveTextPenWidth( m_schSettings.GetDefaultPenWidth() );
|
||||
case LIB_FIELD_T:
|
||||
pen = std::max( pen, static_cast<const LIB_FIELD*>( aItem )->GetEffectiveTextPenWidth() );
|
||||
break;
|
||||
|
||||
if( ( aItem->IsBrightened() || aItem->IsSelected() ) && aDrawingShadows )
|
||||
width += getShadowWidth( aItem->IsBrightened() );
|
||||
case LIB_TEXT_T:
|
||||
pen = std::max( pen, static_cast<const LIB_TEXT*>( aItem )->GetEffectiveTextPenWidth() );
|
||||
break;
|
||||
|
||||
return width;
|
||||
}
|
||||
case LIB_TEXTBOX_T:
|
||||
pen = std::max( pen, static_cast<const LIB_TEXTBOX*>( aItem )->GetEffectiveTextPenWidth() );
|
||||
break;
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED_FOR( aItem->GetClass() );
|
||||
}
|
||||
|
||||
float SCH_PAINTER::getTextThickness( const LIB_FIELD* aItem, bool aDrawingShadows ) const
|
||||
{
|
||||
float width = (float) std::max( aItem->GetEffectiveTextPenWidth(),
|
||||
m_schSettings.GetDefaultPenWidth() );
|
||||
|
||||
if( ( aItem->IsBrightened() || aItem->IsSelected() ) && aDrawingShadows )
|
||||
width += getShadowWidth( aItem->IsBrightened() );
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
|
||||
float SCH_PAINTER::getTextThickness( const LIB_TEXT* aItem, bool aDrawingShadows ) const
|
||||
{
|
||||
float width = (float) std::max( aItem->GetEffectiveTextPenWidth(),
|
||||
m_schSettings.GetDefaultPenWidth() );
|
||||
float width = (float) pen;
|
||||
|
||||
if( ( aItem->IsBrightened() || aItem->IsSelected() ) && aDrawingShadows )
|
||||
width += getShadowWidth( aItem->IsBrightened() );
|
||||
|
@ -571,6 +599,7 @@ bool SCH_PAINTER::setDeviceColors( const LIB_ITEM* aItem, int aLayer )
|
|||
|
||||
return false;
|
||||
|
||||
case LAYER_NOTES_BACKGROUND:
|
||||
case LAYER_DEVICE_BACKGROUND:
|
||||
if( shape )
|
||||
{
|
||||
|
@ -593,6 +622,7 @@ bool SCH_PAINTER::setDeviceColors( const LIB_ITEM* aItem, int aLayer )
|
|||
|
||||
return false;
|
||||
|
||||
case LAYER_NOTES:
|
||||
case LAYER_DEVICE:
|
||||
m_gal->SetIsFill( shape && shape->GetFillMode() == FILL_T::FILLED_SHAPE );
|
||||
m_gal->SetFillColor( getRenderColor( aItem, LAYER_DEVICE, false ) );
|
||||
|
@ -621,68 +651,136 @@ void SCH_PAINTER::draw( const LIB_SHAPE *aShape, int aLayer )
|
|||
if( !isUnitAndConversionShown( aShape ) )
|
||||
return;
|
||||
|
||||
if( setDeviceColors( aShape, aLayer ) )
|
||||
{
|
||||
if( aLayer == LAYER_SELECTION_SHADOWS && eeconfig()->m_Selection.fill_shapes )
|
||||
{
|
||||
// Consider a NAND gate. We have no idea which side of the arc is "inside" so
|
||||
// we can't reliably fill.
|
||||
if( aShape->IsPrivate() && !m_schSettings.m_IsSymbolEditor )
|
||||
return;
|
||||
|
||||
if( !setDeviceColors( aShape, aLayer ) )
|
||||
return;
|
||||
|
||||
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
|
||||
PLOT_DASH_TYPE lineStyle = aShape->GetStroke().GetPlotStyle();
|
||||
COLOR4D color = getRenderColor( aShape, aLayer, drawingShadows );
|
||||
|
||||
auto drawShape =
|
||||
[&]( const LIB_SHAPE* shape )
|
||||
{
|
||||
switch( shape->GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
{
|
||||
EDA_ANGLE startAngle;
|
||||
EDA_ANGLE endAngle;
|
||||
shape->CalcArcAngles( startAngle, endAngle );
|
||||
|
||||
TRANSFORM().MapAngles( &startAngle, &endAngle );
|
||||
|
||||
m_gal->DrawArc( mapCoords( shape->GetCenter() ), shape->GetRadius(),
|
||||
startAngle, endAngle );
|
||||
}
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
m_gal->DrawCircle( mapCoords( shape->GetPosition() ), shape->GetRadius() );
|
||||
break;
|
||||
|
||||
case SHAPE_T::RECT:
|
||||
m_gal->DrawRectangle( mapCoords( shape->GetPosition() ),
|
||||
mapCoords( shape->GetEnd() ) );
|
||||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
{
|
||||
const SHAPE_LINE_CHAIN poly = shape->GetPolyShape().Outline( 0 );
|
||||
std::deque<VECTOR2D> mappedPts;
|
||||
|
||||
for( const VECTOR2I& pt : poly.CPoints() )
|
||||
mappedPts.push_back( mapCoords( pt ) );
|
||||
|
||||
m_gal->DrawPolygon( mappedPts );
|
||||
}
|
||||
break;
|
||||
|
||||
case SHAPE_T::BEZIER:
|
||||
{
|
||||
std::deque<VECTOR2D> mappedPts;
|
||||
|
||||
for( const VECTOR2I& p : shape->GetBezierPoints() )
|
||||
mappedPts.push_back( mapCoords( p ) );
|
||||
|
||||
m_gal->DrawPolygon( mappedPts );
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED_FOR( shape->SHAPE_T_asString() );
|
||||
}
|
||||
};
|
||||
|
||||
if( aLayer == LAYER_SELECTION_SHADOWS )
|
||||
{
|
||||
if( eeconfig()->m_Selection.fill_shapes )
|
||||
{
|
||||
// Consider a NAND gate. We have no idea which side of the arc is "inside"
|
||||
// so we can't reliably fill.
|
||||
if( aShape->GetShape() == SHAPE_T::ARC )
|
||||
m_gal->SetIsFill( aShape->IsFilled() );
|
||||
else
|
||||
m_gal->SetIsFill( true );
|
||||
}
|
||||
|
||||
switch( aShape->GetShape() )
|
||||
else
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
{
|
||||
EDA_ANGLE startAngle;
|
||||
EDA_ANGLE endAngle;
|
||||
aShape->CalcArcAngles( startAngle, endAngle );
|
||||
|
||||
TRANSFORM().MapAngles( &startAngle, &endAngle );
|
||||
|
||||
m_gal->DrawArc( mapCoords( aShape->GetCenter() ), aShape->GetRadius(), startAngle,
|
||||
endAngle );
|
||||
m_gal->SetIsStroke( true );
|
||||
m_gal->SetIsFill( false );
|
||||
m_gal->SetLineWidth( getLineWidth( aShape, true ) );
|
||||
m_gal->SetStrokeColor( color );
|
||||
}
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
m_gal->DrawCircle( mapCoords( aShape->GetPosition() ), aShape->GetRadius() );
|
||||
break;
|
||||
|
||||
case SHAPE_T::RECT:
|
||||
m_gal->DrawRectangle( mapCoords( aShape->GetPosition() ),
|
||||
mapCoords( aShape->GetEnd() ) );
|
||||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
drawShape( aShape );
|
||||
}
|
||||
else if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_NOTES_BACKGROUND )
|
||||
{
|
||||
if( aShape->IsFilled() )
|
||||
{
|
||||
const SHAPE_LINE_CHAIN poly = aShape->GetPolyShape().Outline( 0 );
|
||||
std::deque<VECTOR2D> mappedPts;
|
||||
m_gal->SetIsFill( true );
|
||||
m_gal->SetIsStroke( false );
|
||||
m_gal->SetFillColor( aShape->GetFillColor() );
|
||||
|
||||
for( const VECTOR2I& pt : poly.CPoints() )
|
||||
mappedPts.push_back( mapCoords( pt ) );
|
||||
|
||||
m_gal->DrawPolygon( mappedPts );
|
||||
drawShape( aShape );
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if( aLayer == LAYER_DEVICE
|
||||
|| ( m_schSettings.m_IsSymbolEditor && aLayer == LAYER_NOTES ) )
|
||||
{
|
||||
int lineWidth = getLineWidth( aShape, drawingShadows );
|
||||
|
||||
case SHAPE_T::BEZIER:
|
||||
m_gal->SetIsFill( false );
|
||||
m_gal->SetIsStroke( true );
|
||||
m_gal->SetLineWidth( lineWidth );
|
||||
m_gal->SetStrokeColor( color );
|
||||
|
||||
if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE || drawingShadows )
|
||||
{
|
||||
std::deque<VECTOR2D> mappedPts;
|
||||
|
||||
for( const VECTOR2I& p : aShape->GetBezierPoints() )
|
||||
mappedPts.push_back( mapCoords( p ) );
|
||||
|
||||
m_gal->DrawPolygon( mappedPts );
|
||||
drawShape( aShape );
|
||||
}
|
||||
break;
|
||||
else
|
||||
{
|
||||
std::vector<SHAPE*> shapes = aShape->MakeEffectiveShapes( true );
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED_FOR( aShape->SHAPE_T_asString() );
|
||||
for( SHAPE* shape : shapes )
|
||||
{
|
||||
STROKE_PARAMS::Stroke( shape, lineStyle, lineWidth, &m_schSettings,
|
||||
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||
{
|
||||
// DrawLine has problem with 0 length lines so enforce minimum
|
||||
if( a == b )
|
||||
m_gal->DrawLine( mapCoords( a+1 ), mapCoords( b ) );
|
||||
else
|
||||
m_gal->DrawLine( mapCoords( a ), mapCoords( b ) );
|
||||
} );
|
||||
}
|
||||
|
||||
for( SHAPE* shape : shapes )
|
||||
delete shape;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -729,9 +827,10 @@ void SCH_PAINTER::draw( const LIB_FIELD *aField, int aLayer )
|
|||
m_gal->SetFillColor( color );
|
||||
|
||||
EDA_RECT bbox = aField->GetBoundingBox();
|
||||
VECTOR2I textpos = bbox.Centre();
|
||||
VECTOR2I textpos = bbox.Centre();
|
||||
|
||||
if( drawingShadows && eeconfig()->m_Selection.text_as_box )
|
||||
if( drawingShadows && ( eeconfig()->m_Selection.text_as_box
|
||||
|| aField->GetDrawFont()->IsOutline() ) )
|
||||
{
|
||||
m_gal->SetIsStroke( true );
|
||||
m_gal->SetIsFill( true );
|
||||
|
@ -758,11 +857,14 @@ void SCH_PAINTER::draw( const LIB_FIELD *aField, int aLayer )
|
|||
}
|
||||
|
||||
|
||||
void SCH_PAINTER::draw( const LIB_TEXT *aText, int aLayer )
|
||||
void SCH_PAINTER::draw( const LIB_TEXT* aText, int aLayer )
|
||||
{
|
||||
if( !isUnitAndConversionShown( aText ) )
|
||||
return;
|
||||
|
||||
if( aText->IsPrivate() && !m_schSettings.m_IsSymbolEditor )
|
||||
return;
|
||||
|
||||
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
|
||||
|
||||
if( drawingShadows && !( aText->IsBrightened() || aText->IsSelected() ) )
|
||||
|
@ -784,18 +886,21 @@ void SCH_PAINTER::draw( const LIB_TEXT *aText, int aLayer )
|
|||
m_gal->SetFillColor( color );
|
||||
m_gal->SetStrokeColor( color );
|
||||
|
||||
if( drawingShadows && eeconfig()->m_Selection.text_as_box )
|
||||
if( drawingShadows && ( eeconfig()->m_Selection.text_as_box
|
||||
|| aText->GetDrawFont()->IsOutline() ) )
|
||||
{
|
||||
m_gal->SetIsStroke( true );
|
||||
m_gal->SetIsFill( true );
|
||||
m_gal->SetLineWidth( getTextThickness( aText, drawingShadows ) );
|
||||
m_gal->DrawRectangle( bBox.GetPosition(), bBox.GetEnd() );
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
wxString shownText( aText->GetShownText() );
|
||||
|
||||
if( !shownText.IsEmpty() )
|
||||
{
|
||||
TEXT_ATTRIBUTES attrs( aText->GetAttributes() );
|
||||
attrs.m_Halign = GR_TEXT_H_ALIGN_CENTER;
|
||||
attrs.m_Valign = GR_TEXT_V_ALIGN_CENTER;
|
||||
TEXT_ATTRIBUTES attrs = aText->GetAttributes();
|
||||
attrs.m_StrokeWidth = getTextThickness( aText, drawingShadows );
|
||||
|
||||
strokeText( aText->GetText(), pos, attrs );
|
||||
|
@ -803,6 +908,109 @@ void SCH_PAINTER::draw( const LIB_TEXT *aText, int aLayer )
|
|||
}
|
||||
|
||||
|
||||
void SCH_PAINTER::draw( const LIB_TEXTBOX* aTextBox, int aLayer )
|
||||
{
|
||||
if( !isUnitAndConversionShown( aTextBox ) )
|
||||
return;
|
||||
|
||||
if( aTextBox->IsPrivate() && !m_schSettings.m_IsSymbolEditor )
|
||||
return;
|
||||
|
||||
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
|
||||
|
||||
if( drawingShadows && !( aTextBox->IsBrightened() || aTextBox->IsSelected() ) )
|
||||
return;
|
||||
|
||||
COLOR4D color = getRenderColor( aTextBox, aLayer, drawingShadows );
|
||||
float borderWidth = getLineWidth( aTextBox, drawingShadows );
|
||||
PLOT_DASH_TYPE borderStyle = aTextBox->GetStroke().GetPlotStyle();
|
||||
wxString shownText = aTextBox->GetShownText();
|
||||
|
||||
auto drawText =
|
||||
[&]()
|
||||
{
|
||||
if( !shownText.IsEmpty() )
|
||||
{
|
||||
TEXT_ATTRIBUTES attrs = aTextBox->GetAttributes();
|
||||
attrs.m_StrokeWidth = getTextThickness( aTextBox, drawingShadows );
|
||||
|
||||
strokeText( shownText, aTextBox->GetTextPos(), attrs );
|
||||
}
|
||||
};
|
||||
|
||||
m_gal->SetStrokeColor( color );
|
||||
m_gal->SetFillColor( color );
|
||||
m_gal->SetLineWidth( borderWidth );
|
||||
|
||||
if( aLayer == LAYER_SELECTION_SHADOWS )
|
||||
{
|
||||
if( eeconfig()->m_Selection.fill_shapes
|
||||
|| eeconfig()->m_Selection.text_as_box
|
||||
|| aTextBox->GetDrawFont()->IsOutline() )
|
||||
{
|
||||
m_gal->SetIsFill( true );
|
||||
m_gal->SetIsStroke( false );
|
||||
|
||||
m_gal->DrawRectangle( mapCoords( aTextBox->GetPosition() ),
|
||||
mapCoords( aTextBox->GetEnd() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_gal->SetIsStroke( true );
|
||||
m_gal->SetIsFill( false );
|
||||
|
||||
m_gal->DrawRectangle( mapCoords( aTextBox->GetPosition() ),
|
||||
mapCoords( aTextBox->GetEnd() ) );
|
||||
drawText();
|
||||
}
|
||||
}
|
||||
else if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_NOTES_BACKGROUND )
|
||||
{
|
||||
if( aTextBox->IsFilled() )
|
||||
{
|
||||
m_gal->SetIsFill( true );
|
||||
m_gal->SetIsStroke( false );
|
||||
|
||||
m_gal->DrawRectangle( mapCoords( aTextBox->GetPosition() ),
|
||||
mapCoords( aTextBox->GetEnd() ) );
|
||||
}
|
||||
}
|
||||
else if( aLayer == LAYER_DEVICE || aLayer == LAYER_NOTES )
|
||||
{
|
||||
m_gal->SetIsFill( false );
|
||||
m_gal->SetIsStroke( true );
|
||||
|
||||
if( borderStyle <= PLOT_DASH_TYPE::FIRST_TYPE || drawingShadows )
|
||||
{
|
||||
m_gal->DrawRectangle( mapCoords( aTextBox->GetPosition() ),
|
||||
mapCoords( aTextBox->GetEnd() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<SHAPE*> shapes = aTextBox->MakeEffectiveShapes( true );
|
||||
|
||||
for( SHAPE* shape : shapes )
|
||||
{
|
||||
STROKE_PARAMS::Stroke( shape, borderStyle, borderWidth, &m_schSettings,
|
||||
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||
{
|
||||
// DrawLine has problem with 0 length lines so enforce minimum
|
||||
if( a == b )
|
||||
m_gal->DrawLine( mapCoords( a+1 ), mapCoords( b ) );
|
||||
else
|
||||
m_gal->DrawLine( mapCoords( a ), mapCoords( b ) );
|
||||
} );
|
||||
}
|
||||
|
||||
for( SHAPE* shape : shapes )
|
||||
delete shape;
|
||||
}
|
||||
|
||||
drawText();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int SCH_PAINTER::internalPinDecoSize( const LIB_PIN &aPin )
|
||||
{
|
||||
if( m_schSettings.m_PinSymbolSize > 0 )
|
||||
|
@ -1123,6 +1331,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
|
|||
if( text[i].IsEmpty() )
|
||||
return;
|
||||
|
||||
// Which of these gets used depends on the font technology, so set both
|
||||
m_gal->SetStrokeColor( colour[i] );
|
||||
m_gal->SetFillColor( colour[i] );
|
||||
|
||||
|
@ -1133,10 +1342,15 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
|
|||
attrs.m_Angle = aAngle;
|
||||
attrs.m_StrokeWidth = thickness[i];
|
||||
|
||||
if( drawingShadows && eeconfig()->m_Selection.text_as_box )
|
||||
if( drawingShadows && ( eeconfig()->m_Selection.text_as_box
|
||||
|| aPin->GetDrawFont()->IsOutline() ) )
|
||||
{
|
||||
boxText( text[i], aPos, attrs );
|
||||
}
|
||||
else
|
||||
{
|
||||
strokeText( text[i], aPos, attrs );
|
||||
}
|
||||
};
|
||||
|
||||
switch( orient )
|
||||
|
@ -1344,7 +1558,6 @@ void SCH_PAINTER::draw( const SCH_SHAPE* aShape, int aLayer )
|
|||
PLOT_DASH_TYPE lineStyle = aShape->GetEffectiveLineStyle();
|
||||
COLOR4D color = getRenderColor( aShape, aLayer, drawingShadows );
|
||||
|
||||
|
||||
if( drawingShadows && !( aShape->IsBrightened() || aShape->IsSelected() ) )
|
||||
return;
|
||||
|
||||
|
@ -1361,8 +1574,8 @@ void SCH_PAINTER::draw( const SCH_SHAPE* aShape, int aLayer )
|
|||
|
||||
m_gal->DrawArc( aShape->GetCenter(), aShape->GetRadius(), startAngle,
|
||||
endAngle );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
m_gal->DrawCircle( shape->GetPosition(), shape->GetRadius() );
|
||||
|
@ -1380,8 +1593,8 @@ void SCH_PAINTER::draw( const SCH_SHAPE* aShape, int aLayer )
|
|||
pts.push_back( pt );
|
||||
|
||||
m_gal->DrawPolygon( pts );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SHAPE_T::BEZIER:
|
||||
{
|
||||
|
@ -1391,8 +1604,8 @@ void SCH_PAINTER::draw( const SCH_SHAPE* aShape, int aLayer )
|
|||
pts.push_back( p );
|
||||
|
||||
m_gal->DrawPolygon( pts );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED_FOR( shape->SHAPE_T_asString() );
|
||||
|
@ -1403,7 +1616,13 @@ void SCH_PAINTER::draw( const SCH_SHAPE* aShape, int aLayer )
|
|||
{
|
||||
if( eeconfig()->m_Selection.fill_shapes )
|
||||
{
|
||||
m_gal->SetIsFill( true );
|
||||
// Consider a NAND gate. We have no idea which side of the arc is "inside"
|
||||
// so we can't reliably fill.
|
||||
if( aShape->GetShape() == SHAPE_T::ARC )
|
||||
m_gal->SetIsFill( aShape->IsFilled() );
|
||||
else
|
||||
m_gal->SetIsFill( true );
|
||||
|
||||
m_gal->SetIsStroke( false );
|
||||
m_gal->SetFillColor( color );
|
||||
}
|
||||
|
@ -1445,15 +1664,14 @@ void SCH_PAINTER::draw( const SCH_SHAPE* aShape, int aLayer )
|
|||
for( SHAPE* shape : shapes )
|
||||
{
|
||||
STROKE_PARAMS::Stroke( shape, lineStyle, lineWidth, &m_schSettings,
|
||||
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||
{
|
||||
// DrawLine has problem with 0 length lines
|
||||
// so draw a line with a minimal length
|
||||
if( a == b )
|
||||
m_gal->DrawLine( a+1, b );
|
||||
else
|
||||
m_gal->DrawLine( a, b );
|
||||
} );
|
||||
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||
{
|
||||
// DrawLine has problem with 0 length lines so enforce minimum
|
||||
if( a == b )
|
||||
m_gal->DrawLine( a+1, b );
|
||||
else
|
||||
m_gal->DrawLine( a, b );
|
||||
} );
|
||||
}
|
||||
|
||||
for( SHAPE* shape : shapes )
|
||||
|
@ -1519,7 +1737,8 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer )
|
|||
VECTOR2I text_offset = aText->GetSchematicTextOffset( &m_schSettings );
|
||||
wxString shownText( aText->GetShownText() );
|
||||
|
||||
if( drawingShadows && eeconfig()->m_Selection.text_as_box )
|
||||
if( drawingShadows && ( eeconfig()->m_Selection.text_as_box
|
||||
|| aText->GetDrawFont()->IsOutline() ) )
|
||||
{
|
||||
EDA_RECT bBox = aText->GetBoundingBox();
|
||||
bBox.RevertYAxis();
|
||||
|
@ -1553,6 +1772,110 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer )
|
|||
}
|
||||
|
||||
|
||||
void SCH_PAINTER::draw( const SCH_TEXTBOX* aTextBox, int aLayer )
|
||||
{
|
||||
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
|
||||
COLOR4D color = getRenderColor( aTextBox, aLayer, drawingShadows );
|
||||
float borderWidth = getLineWidth( aTextBox, drawingShadows );
|
||||
PLOT_DASH_TYPE borderStyle = aTextBox->GetEffectiveLineStyle();
|
||||
wxString shownText = aTextBox->GetShownText();
|
||||
|
||||
auto drawText =
|
||||
[&]()
|
||||
{
|
||||
if( !shownText.IsEmpty() )
|
||||
{
|
||||
TEXT_ATTRIBUTES attrs = aTextBox->GetAttributes();
|
||||
attrs.m_StrokeWidth = getTextThickness( aTextBox, drawingShadows );
|
||||
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
|
||||
|
||||
cache = aTextBox->GetRenderCache( shownText );
|
||||
|
||||
if( cache )
|
||||
{
|
||||
for( const std::unique_ptr<KIFONT::GLYPH>& glyph : *cache )
|
||||
m_gal->DrawGlyph( *glyph.get() );
|
||||
}
|
||||
else
|
||||
{
|
||||
strokeText( shownText, aTextBox->GetTextPos(), attrs );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if( drawingShadows && !( aTextBox->IsBrightened() || aTextBox->IsSelected() ) )
|
||||
return;
|
||||
|
||||
m_gal->SetFillColor( color );
|
||||
m_gal->SetStrokeColor( color );
|
||||
m_gal->SetLineWidth( borderWidth );
|
||||
|
||||
if( aLayer == LAYER_SELECTION_SHADOWS )
|
||||
{
|
||||
if( eeconfig()->m_Selection.fill_shapes
|
||||
|| eeconfig()->m_Selection.text_as_box
|
||||
|| aTextBox->GetDrawFont()->IsOutline() )
|
||||
{
|
||||
m_gal->SetIsFill( true );
|
||||
m_gal->SetIsStroke( false );
|
||||
|
||||
m_gal->DrawRectangle( aTextBox->GetPosition(), aTextBox->GetEnd() );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_gal->SetIsStroke( true );
|
||||
m_gal->SetIsFill( false );
|
||||
|
||||
m_gal->DrawRectangle( aTextBox->GetPosition(), aTextBox->GetEnd() );
|
||||
drawText();
|
||||
}
|
||||
}
|
||||
else if( aLayer == LAYER_NOTES_BACKGROUND )
|
||||
{
|
||||
if( aTextBox->IsFilled() )
|
||||
{
|
||||
m_gal->SetIsFill( true );
|
||||
m_gal->SetIsStroke( false );
|
||||
|
||||
m_gal->DrawRectangle( aTextBox->GetPosition(), aTextBox->GetEnd() );
|
||||
}
|
||||
}
|
||||
else if( aLayer == LAYER_NOTES )
|
||||
{
|
||||
m_gal->SetIsFill( false );
|
||||
m_gal->SetIsStroke( true );
|
||||
|
||||
if( borderStyle <= PLOT_DASH_TYPE::FIRST_TYPE || drawingShadows )
|
||||
{
|
||||
m_gal->DrawRectangle( aTextBox->GetPosition(), aTextBox->GetEnd() );
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<SHAPE*> shapes = aTextBox->MakeEffectiveShapes( true );
|
||||
|
||||
for( SHAPE* shape : shapes )
|
||||
{
|
||||
STROKE_PARAMS::Stroke( shape, borderStyle, borderWidth, &m_schSettings,
|
||||
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||
{
|
||||
// DrawLine has problem with 0 length lines so enforce minimum
|
||||
if( a == b )
|
||||
m_gal->DrawLine( a+1, b );
|
||||
else
|
||||
m_gal->DrawLine( a, b );
|
||||
} );
|
||||
}
|
||||
|
||||
for( SHAPE* shape : shapes )
|
||||
delete shape;
|
||||
}
|
||||
|
||||
drawText();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void orientSymbol( LIB_SYMBOL* symbol, int orientation )
|
||||
{
|
||||
struct ORIENT
|
||||
|
@ -1736,7 +2059,8 @@ void SCH_PAINTER::draw( const SCH_FIELD *aField, int aLayer )
|
|||
m_gal->SetStrokeColor( color );
|
||||
m_gal->SetFillColor( color );
|
||||
|
||||
if( drawingShadows && eeconfig()->m_Selection.text_as_box )
|
||||
if( drawingShadows && ( eeconfig()->m_Selection.text_as_box
|
||||
|| aField->GetDrawFont()->IsOutline() ) )
|
||||
{
|
||||
bbox.RevertYAxis();
|
||||
m_gal->SetIsStroke( true );
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019-2020 CERN
|
||||
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
|
@ -38,11 +38,13 @@ class LIB_ITEM;
|
|||
class LIB_SYMBOL;
|
||||
class LIB_FIELD;
|
||||
class LIB_TEXT;
|
||||
class LIB_TEXTBOX;
|
||||
class SCH_SYMBOL;
|
||||
class SCH_FIELD;
|
||||
class SCH_JUNCTION;
|
||||
class SCH_LABEL;
|
||||
class SCH_TEXT;
|
||||
class SCH_TEXTBOX;
|
||||
class SCH_HIERLABEL;
|
||||
class SCH_DIRECTIVE_LABEL;
|
||||
class SCH_GLOBALLABEL;
|
||||
|
@ -155,10 +157,12 @@ private:
|
|||
int aConvert = 0 );
|
||||
void draw( const LIB_FIELD* aField, int aLayer );
|
||||
void draw( const LIB_TEXT* aText, int aLayer );
|
||||
void draw( const LIB_TEXTBOX* aTextBox, int aLayer );
|
||||
void draw( SCH_SYMBOL* aSymbol, int aLayer );
|
||||
void draw( const SCH_JUNCTION* aJct, int aLayer );
|
||||
void draw( const SCH_FIELD* aField, int aLayer );
|
||||
void draw( const SCH_SHAPE* shape, int aLayer );
|
||||
void draw( const SCH_SHAPE* aShape, int aLayer );
|
||||
void draw( const SCH_TEXTBOX* aTextBox, int aLayer );
|
||||
void draw( const SCH_TEXT* aText, int aLayer );
|
||||
void draw( const SCH_LABEL* aText, int aLayer );
|
||||
void draw( const SCH_DIRECTIVE_LABEL* aLabel, int aLayer );
|
||||
|
@ -183,12 +187,8 @@ private:
|
|||
|
||||
float getShadowWidth( bool aForHighlight ) const;
|
||||
COLOR4D getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDrawingShadows ) const;
|
||||
float getLineWidth( const LIB_ITEM* aItem, bool aDrawingShadows ) const;
|
||||
float getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows ) const;
|
||||
float getTextThickness( const SCH_TEXT* aItem, bool aDrawingShadows ) const;
|
||||
float getTextThickness( const SCH_FIELD* aItem, bool aDrawingShadows ) const;
|
||||
float getTextThickness( const LIB_FIELD* aItem, bool aDrawingShadows ) const;
|
||||
float getTextThickness( const LIB_TEXT* aItem, bool aDrawingShadows ) const;
|
||||
float getLineWidth( const EDA_ITEM* aItem, bool aDrawingShadows ) const;
|
||||
float getTextThickness( const EDA_ITEM* aItem, bool aDrawingShadows ) const;
|
||||
|
||||
bool setDeviceColors( const LIB_ITEM* aItem, int aLayer );
|
||||
|
||||
|
|
|
@ -931,9 +931,9 @@ void SCH_ALTIUM_PLUGIN::ParseTextFrame( const std::map<wxString, wxString>& aPro
|
|||
break;
|
||||
}
|
||||
|
||||
// TODO: set size and word-wrap once KiCad supports wrapped text.
|
||||
// JEY TODO: set size and word-wrap once KiCad supports wrapped text.
|
||||
|
||||
// TODO: set border and background color once KiCad supports them.
|
||||
// JEY TODO: set border and background color once KiCad supports them.
|
||||
|
||||
size_t fontId = static_cast<int>( elem.fontId );
|
||||
|
||||
|
@ -1138,7 +1138,7 @@ void SCH_ALTIUM_PLUGIN::ParsePolyline( const std::map<wxString, wxString>& aProp
|
|||
|
||||
if( elem.ownerpartid == ALTIUM_COMPONENT_NONE )
|
||||
{
|
||||
SCH_SHAPE* poly = new SCH_SHAPE( SHAPE_T::POLY, SCH_LAYER_ID::LAYER_NOTES );
|
||||
SCH_SHAPE* poly = new SCH_SHAPE( SHAPE_T::POLY );
|
||||
|
||||
for( VECTOR2I& point : elem.points )
|
||||
poly->AddPoint( point + m_sheetOffset );
|
||||
|
@ -1184,7 +1184,7 @@ void SCH_ALTIUM_PLUGIN::ParsePolygon( const std::map<wxString, wxString>& aPrope
|
|||
|
||||
if( elem.ownerpartid == ALTIUM_COMPONENT_NONE )
|
||||
{
|
||||
SCH_SHAPE* poly = new SCH_SHAPE( SHAPE_T::POLY, SCH_LAYER_ID::LAYER_NOTES );
|
||||
SCH_SHAPE* poly = new SCH_SHAPE( SHAPE_T::POLY );
|
||||
|
||||
for( VECTOR2I& point : elem.points )
|
||||
poly->AddPoint( point + m_sheetOffset );
|
||||
|
@ -1236,7 +1236,7 @@ void SCH_ALTIUM_PLUGIN::ParseRoundRectangle( const std::map<wxString, wxString>&
|
|||
if( elem.ownerpartid == ALTIUM_COMPONENT_NONE )
|
||||
{
|
||||
// TODO: misses rounded edges
|
||||
SCH_SHAPE* rect = new SCH_SHAPE( SHAPE_T::RECT, SCH_LAYER_ID::LAYER_NOTES );
|
||||
SCH_SHAPE* rect = new SCH_SHAPE( SHAPE_T::RECT );
|
||||
|
||||
rect->SetPosition( sheetTopRight );
|
||||
rect->SetEnd( sheetBottomLeft );
|
||||
|
@ -1283,7 +1283,7 @@ void SCH_ALTIUM_PLUGIN::ParseArc( const std::map<wxString, wxString>& aPropertie
|
|||
{
|
||||
if( elem.startAngle == 0 && ( elem.endAngle == 0 || elem.endAngle == 360 ) )
|
||||
{
|
||||
SCH_SHAPE* circle = new SCH_SHAPE( SHAPE_T::CIRCLE, SCH_LAYER_ID::LAYER_NOTES );
|
||||
SCH_SHAPE* circle = new SCH_SHAPE( SHAPE_T::CIRCLE );
|
||||
|
||||
circle->SetPosition( elem.center + m_sheetOffset );
|
||||
circle->SetEnd( circle->GetPosition() + VECTOR2I( elem.radius, 0 ) );
|
||||
|
@ -1293,7 +1293,7 @@ void SCH_ALTIUM_PLUGIN::ParseArc( const std::map<wxString, wxString>& aPropertie
|
|||
}
|
||||
else
|
||||
{
|
||||
SCH_SHAPE* arc = new SCH_SHAPE( SHAPE_T::ARC, SCH_LAYER_ID::LAYER_NOTES );
|
||||
SCH_SHAPE* arc = new SCH_SHAPE( SHAPE_T::ARC );
|
||||
EDA_ANGLE includedAngle( elem.endAngle - elem.startAngle, DEGREES_T );
|
||||
EDA_ANGLE startAngle( elem.endAngle, DEGREES_T );
|
||||
VECTOR2I startOffset( KiROUND( elem.radius * startAngle.Cos() ),
|
||||
|
@ -1414,7 +1414,7 @@ void SCH_ALTIUM_PLUGIN::ParseRectangle( const std::map<wxString, wxString>& aPro
|
|||
|
||||
if( elem.ownerpartid == ALTIUM_COMPONENT_NONE )
|
||||
{
|
||||
SCH_SHAPE* rect = new SCH_SHAPE( SHAPE_T::RECT, SCH_LAYER_ID::LAYER_NOTES );
|
||||
SCH_SHAPE* rect = new SCH_SHAPE( SHAPE_T::RECT );
|
||||
|
||||
rect->SetPosition( sheetTopRight );
|
||||
rect->SetEnd( sheetBottomLeft );
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <lib_shape.h>
|
||||
#include <lib_pin.h>
|
||||
#include <lib_text.h>
|
||||
#include <lib_textbox.h>
|
||||
#include <math/util.h> // KiROUND, Clamp
|
||||
#include <font/font.h>
|
||||
#include <string_utils.h>
|
||||
|
@ -45,6 +46,7 @@
|
|||
#include <sch_edit_frame.h> // SYM_ORIENT_XXX
|
||||
#include <sch_field.h>
|
||||
#include <sch_line.h>
|
||||
#include <sch_textbox.h>
|
||||
#include <sch_label.h>
|
||||
#include <sch_junction.h>
|
||||
#include <sch_no_connect.h>
|
||||
|
@ -326,6 +328,7 @@ LIB_SYMBOL* SCH_SEXPR_PARSER::ParseSymbol( LIB_SYMBOL_MAP& aSymbolLibMap, int aF
|
|||
case T_polyline:
|
||||
case T_rectangle:
|
||||
case T_text:
|
||||
case T_text_box:
|
||||
item = ParseDrawItem();
|
||||
|
||||
wxCHECK_MSG( item, nullptr, "Invalid draw item pointer." );
|
||||
|
@ -351,6 +354,7 @@ LIB_SYMBOL* SCH_SEXPR_PARSER::ParseSymbol( LIB_SYMBOL_MAP& aSymbolLibMap, int aF
|
|||
case T_polyline:
|
||||
case T_rectangle:
|
||||
case T_text:
|
||||
case T_text_box:
|
||||
item = ParseDrawItem();
|
||||
|
||||
wxCHECK_MSG( item, nullptr, "Invalid draw item pointer." );
|
||||
|
@ -377,31 +381,35 @@ LIB_ITEM* SCH_SEXPR_PARSER::ParseDrawItem()
|
|||
switch( CurTok() )
|
||||
{
|
||||
case T_arc:
|
||||
return static_cast<LIB_ITEM*>( parseArc() );
|
||||
return parseArc();
|
||||
break;
|
||||
|
||||
case T_bezier:
|
||||
return static_cast<LIB_ITEM*>( parseBezier() );
|
||||
return parseBezier();
|
||||
break;
|
||||
|
||||
case T_circle:
|
||||
return static_cast<LIB_ITEM*>( parseCircle() );
|
||||
return parseCircle();
|
||||
break;
|
||||
|
||||
case T_pin:
|
||||
return static_cast<LIB_ITEM*>( parsePin() );
|
||||
return parsePin();
|
||||
break;
|
||||
|
||||
case T_polyline:
|
||||
return static_cast<LIB_ITEM*>( parsePolyLine() );
|
||||
return parsePolyLine();
|
||||
break;
|
||||
|
||||
case T_rectangle:
|
||||
return static_cast<LIB_ITEM*>( parseRectangle() );
|
||||
return parseRectangle();
|
||||
break;
|
||||
|
||||
case T_text:
|
||||
return static_cast<LIB_TEXT*>( parseText() );
|
||||
return parseText();
|
||||
break;
|
||||
|
||||
case T_text_box:
|
||||
return parseTextBox();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -900,7 +908,15 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseArc()
|
|||
arc->SetUnit( m_unit );
|
||||
arc->SetConvert( m_convert );
|
||||
|
||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_private )
|
||||
{
|
||||
arc->SetPrivate( true );
|
||||
token = NextTok();
|
||||
}
|
||||
|
||||
for( ; token != T_RIGHT; token = NextTok() )
|
||||
{
|
||||
if( token != T_LEFT )
|
||||
Expecting( T_LEFT );
|
||||
|
@ -1047,7 +1063,15 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseBezier()
|
|||
bezier->SetUnit( m_unit );
|
||||
bezier->SetConvert( m_convert );
|
||||
|
||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_private )
|
||||
{
|
||||
bezier->SetPrivate( true );
|
||||
token = NextTok();
|
||||
}
|
||||
|
||||
for( ; token != T_RIGHT; token = NextTok() )
|
||||
{
|
||||
if( token != T_LEFT )
|
||||
Expecting( T_LEFT );
|
||||
|
@ -1122,7 +1146,15 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseCircle()
|
|||
circle->SetUnit( m_unit );
|
||||
circle->SetConvert( m_convert );
|
||||
|
||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_private )
|
||||
{
|
||||
circle->SetPrivate( true );
|
||||
token = NextTok();
|
||||
}
|
||||
|
||||
for( ; token != T_RIGHT; token = NextTok() )
|
||||
{
|
||||
if( token != T_LEFT )
|
||||
Expecting( T_LEFT );
|
||||
|
@ -1387,7 +1419,15 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parsePolyLine()
|
|||
poly->SetUnit( m_unit );
|
||||
poly->SetConvert( m_convert );
|
||||
|
||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_private )
|
||||
{
|
||||
poly->SetPrivate( true );
|
||||
token = NextTok();
|
||||
}
|
||||
|
||||
for( ; token != T_RIGHT; token = NextTok() )
|
||||
{
|
||||
if( token != T_LEFT )
|
||||
Expecting( T_LEFT );
|
||||
|
@ -1447,7 +1487,15 @@ LIB_SHAPE* SCH_SEXPR_PARSER::parseRectangle()
|
|||
rectangle->SetUnit( m_unit );
|
||||
rectangle->SetConvert( m_convert );
|
||||
|
||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_private )
|
||||
{
|
||||
rectangle->SetPrivate( true );
|
||||
token = NextTok();
|
||||
}
|
||||
|
||||
for( ; token != T_RIGHT; token = NextTok() )
|
||||
{
|
||||
if( token != T_LEFT )
|
||||
Expecting( T_LEFT );
|
||||
|
@ -1499,6 +1547,12 @@ LIB_TEXT* SCH_SEXPR_PARSER::parseText()
|
|||
text->SetConvert( m_convert );
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_private )
|
||||
{
|
||||
text->SetPrivate( true );
|
||||
token = NextTok();
|
||||
}
|
||||
|
||||
if( !IsSymbol( token ) )
|
||||
{
|
||||
THROW_PARSE_ERROR( _( "Invalid text string" ), CurSource(), CurLine(), CurLineNumber(),
|
||||
|
@ -1536,6 +1590,77 @@ LIB_TEXT* SCH_SEXPR_PARSER::parseText()
|
|||
}
|
||||
|
||||
|
||||
LIB_TEXTBOX* SCH_SEXPR_PARSER::parseTextBox()
|
||||
{
|
||||
wxCHECK_MSG( CurTok() == T_text_box, nullptr,
|
||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a text box." ) );
|
||||
|
||||
T token;
|
||||
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
|
||||
FILL_PARAMS fill;
|
||||
std::unique_ptr<LIB_TEXTBOX> textBox = std::make_unique<LIB_TEXTBOX>( nullptr );
|
||||
|
||||
token = NextTok();
|
||||
|
||||
if( token == T_private )
|
||||
{
|
||||
textBox->SetPrivate( true );
|
||||
token = NextTok();
|
||||
}
|
||||
|
||||
if( !IsSymbol( token ) )
|
||||
{
|
||||
THROW_PARSE_ERROR( _( "Invalid text string" ), CurSource(), CurLine(), CurLineNumber(),
|
||||
CurOffset() );
|
||||
}
|
||||
|
||||
textBox->SetText( FromUTF8() );
|
||||
|
||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||
{
|
||||
if( token != T_LEFT )
|
||||
Expecting( T_LEFT );
|
||||
|
||||
token = NextTok();
|
||||
|
||||
switch( token )
|
||||
{
|
||||
case T_start:
|
||||
textBox->SetPosition( parseXY() );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
case T_end:
|
||||
textBox->SetEnd( parseXY() );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
case T_stroke:
|
||||
parseStroke( stroke );
|
||||
textBox->SetStroke( stroke );
|
||||
break;
|
||||
|
||||
case T_fill:
|
||||
parseFill( fill );
|
||||
textBox->SetFillMode( fill.m_FillType );
|
||||
textBox->SetFillColor( fill.m_Color );
|
||||
break;
|
||||
|
||||
case T_effects:
|
||||
parseEDA_TEXT( static_cast<EDA_TEXT*>( textBox.get() ), false );
|
||||
break;
|
||||
|
||||
default:
|
||||
Expecting( "start, end, stroke, fill or effects" );
|
||||
}
|
||||
}
|
||||
|
||||
textBox->UpdateTextPosition();
|
||||
|
||||
return textBox.release();
|
||||
}
|
||||
|
||||
|
||||
void SCH_SEXPR_PARSER::parsePAGE_INFO( PAGE_INFO& aPageInfo )
|
||||
{
|
||||
wxCHECK_RET( ( CurTok() == T_page && m_requiredVersion <= 20200506 ) || CurTok() == T_paper,
|
||||
|
@ -2132,45 +2257,45 @@ void SCH_SEXPR_PARSER::ParseSchematic( SCH_SHEET* aSheet, bool aIsCopyableOnly,
|
|||
// Complex hierarchies can have multiple copies of a sheet. This only
|
||||
// provides a simple tree to find the root sheet.
|
||||
sheet->SetParent( aSheet );
|
||||
screen->Append( static_cast<SCH_ITEM*>( sheet ) );
|
||||
screen->Append( sheet );
|
||||
break;
|
||||
}
|
||||
|
||||
case T_junction:
|
||||
screen->Append( static_cast<SCH_ITEM*>( parseJunction() ) );
|
||||
screen->Append( parseJunction() );
|
||||
break;
|
||||
|
||||
case T_no_connect:
|
||||
screen->Append( static_cast<SCH_ITEM*>( parseNoConnect() ) );
|
||||
screen->Append( parseNoConnect() );
|
||||
break;
|
||||
|
||||
case T_bus_entry:
|
||||
screen->Append( static_cast<SCH_ITEM*>( parseBusEntry() ) );
|
||||
screen->Append( parseBusEntry() );
|
||||
break;
|
||||
|
||||
case T_polyline:
|
||||
case T_bus:
|
||||
case T_wire:
|
||||
screen->Append( static_cast<SCH_ITEM*>( parseLine() ) );
|
||||
screen->Append( parseLine() );
|
||||
break;
|
||||
|
||||
case T_arc:
|
||||
screen->Append( static_cast<SCH_ITEM*>( parseSchArc() ) );
|
||||
screen->Append( parseSchArc() );
|
||||
break;
|
||||
|
||||
case T_circle:
|
||||
screen->Append( static_cast<SCH_ITEM*>( parseSchCircle() ) );
|
||||
screen->Append( parseSchCircle() );
|
||||
break;
|
||||
|
||||
case T_rectangle:
|
||||
screen->Append( static_cast<SCH_ITEM*>( parseSchRectangle() ) );
|
||||
screen->Append( parseSchRectangle() );
|
||||
break;
|
||||
|
||||
case T_bezier:
|
||||
screen->Append( static_cast<SCH_ITEM*>( parseSchBezier() ) );
|
||||
screen->Append( parseSchBezier() );
|
||||
break;
|
||||
|
||||
case T_netclass_flag: // legacy
|
||||
case T_netclass_flag: // present only during early development of 7.0
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
case T_text:
|
||||
|
@ -2178,7 +2303,11 @@ void SCH_SEXPR_PARSER::ParseSchematic( SCH_SHEET* aSheet, bool aIsCopyableOnly,
|
|||
case T_global_label:
|
||||
case T_hierarchical_label:
|
||||
case T_directive_label:
|
||||
screen->Append( static_cast<SCH_ITEM*>( parseSchText() ) );
|
||||
screen->Append( parseSchText() );
|
||||
break;
|
||||
|
||||
case T_text_box:
|
||||
screen->Append( parseSchTextBox() );
|
||||
break;
|
||||
|
||||
case T_sheet_instances:
|
||||
|
@ -3273,6 +3402,71 @@ SCH_TEXT* SCH_SEXPR_PARSER::parseSchText()
|
|||
}
|
||||
|
||||
|
||||
SCH_TEXTBOX* SCH_SEXPR_PARSER::parseSchTextBox()
|
||||
{
|
||||
wxCHECK_MSG( CurTok() == T_text_box, nullptr,
|
||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a text box." ) );
|
||||
|
||||
T token;
|
||||
STROKE_PARAMS stroke( Mils2iu( DEFAULT_LINE_WIDTH_MILS ), PLOT_DASH_TYPE::DEFAULT );
|
||||
FILL_PARAMS fill;
|
||||
std::unique_ptr<SCH_TEXTBOX> textBox = std::make_unique<SCH_TEXTBOX>();
|
||||
|
||||
NeedSYMBOL();
|
||||
|
||||
textBox->SetText( FromUTF8() );
|
||||
|
||||
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
|
||||
{
|
||||
if( token != T_LEFT )
|
||||
Expecting( T_LEFT );
|
||||
|
||||
token = NextTok();
|
||||
|
||||
switch( token )
|
||||
{
|
||||
case T_start:
|
||||
textBox->SetPosition( parseXY() );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
case T_end:
|
||||
textBox->SetEnd( parseXY() );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
case T_stroke:
|
||||
parseStroke( stroke );
|
||||
textBox->SetStroke( stroke );
|
||||
break;
|
||||
|
||||
case T_fill:
|
||||
parseFill( fill );
|
||||
textBox->SetFillMode( fill.m_FillType );
|
||||
textBox->SetFillColor( fill.m_Color );
|
||||
break;
|
||||
|
||||
case T_effects:
|
||||
parseEDA_TEXT( static_cast<EDA_TEXT*>( textBox.get() ), false );
|
||||
break;
|
||||
|
||||
case T_uuid:
|
||||
NeedSYMBOL();
|
||||
const_cast<KIID&>( textBox->m_Uuid ) = KIID( FromUTF8() );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
default:
|
||||
Expecting( "start, end, stroke, fill or uuid" );
|
||||
}
|
||||
}
|
||||
|
||||
textBox->UpdateTextPosition();
|
||||
|
||||
return textBox.release();
|
||||
}
|
||||
|
||||
|
||||
void SCH_SEXPR_PARSER::parseBusAlias( SCH_SCREEN* aScreen )
|
||||
{
|
||||
wxCHECK_RET( CurTok() == T_bus_alias,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 CERN
|
||||
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* @author Wayne Stambaugh <stambaughw@gmail.com>
|
||||
*
|
||||
|
@ -57,6 +57,7 @@ class SCH_SCREEN;
|
|||
class SCH_SHEET;
|
||||
class SCH_SHEET_PIN;
|
||||
class SCH_TEXT;
|
||||
class SCH_TEXTBOX;
|
||||
class TITLE_BLOCK;
|
||||
|
||||
|
||||
|
@ -177,6 +178,7 @@ class SCH_SEXPR_PARSER : public SCHEMATIC_LEXER
|
|||
LIB_SHAPE* parsePolyLine();
|
||||
LIB_SHAPE* parseRectangle();
|
||||
LIB_TEXT* parseText();
|
||||
LIB_TEXTBOX* parseTextBox();
|
||||
|
||||
void parsePAGE_INFO( PAGE_INFO& aPageInfo );
|
||||
void parseTITLE_BLOCK( TITLE_BLOCK& aTitleBlock );
|
||||
|
@ -197,6 +199,7 @@ class SCH_SEXPR_PARSER : public SCHEMATIC_LEXER
|
|||
SCH_SHAPE* parseSchRectangle();
|
||||
SCH_SHAPE* parseSchBezier();
|
||||
SCH_TEXT* parseSchText();
|
||||
SCH_TEXTBOX* parseSchTextBox();
|
||||
void parseBusAlias( SCH_SCREEN* aScreen );
|
||||
|
||||
public:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 CERN
|
||||
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2021-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* @author Wayne Stambaugh <stambaughw@gmail.com>
|
||||
*
|
||||
|
@ -40,6 +40,7 @@
|
|||
#include <sch_shape.h>
|
||||
#include <sch_no_connect.h>
|
||||
#include <sch_text.h>
|
||||
#include <sch_textbox.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <sch_sheet_pin.h>
|
||||
#include <schematic.h>
|
||||
|
@ -50,6 +51,7 @@
|
|||
#include <lib_field.h>
|
||||
#include <lib_pin.h>
|
||||
#include <lib_text.h>
|
||||
#include <lib_textbox.h>
|
||||
#include <eeschema_id.h> // for MAX_UNIT_COUNT_PER_PACKAGE definition
|
||||
#include <sch_file_versions.h>
|
||||
#include <schematic_lexer.h>
|
||||
|
@ -251,10 +253,11 @@ static const char* getTextTypeToken( KICAD_T aType )
|
|||
|
||||
|
||||
static void formatArc( OUTPUTFORMATTER* aFormatter, int aNestLevel, EDA_SHAPE* aArc,
|
||||
const STROKE_PARAMS& aStroke, FILL_T aFillMode, const COLOR4D& aFillColor,
|
||||
KIID aUuid = niluuid )
|
||||
bool aIsPrivate, const STROKE_PARAMS& aStroke, FILL_T aFillMode,
|
||||
const COLOR4D& aFillColor, KIID aUuid = niluuid )
|
||||
{
|
||||
aFormatter->Print( aNestLevel, "(arc (start %s) (mid %s) (end %s)\n",
|
||||
aFormatter->Print( aNestLevel, "(arc%s (start %s) (mid %s) (end %s)\n",
|
||||
aIsPrivate ? " private" : "",
|
||||
FormatInternalUnits( aArc->GetStart() ).c_str(),
|
||||
FormatInternalUnits( aArc->GetArcMid() ).c_str(),
|
||||
FormatInternalUnits( aArc->GetEnd() ).c_str() );
|
||||
|
@ -272,10 +275,11 @@ static void formatArc( OUTPUTFORMATTER* aFormatter, int aNestLevel, EDA_SHAPE* a
|
|||
|
||||
|
||||
static void formatCircle( OUTPUTFORMATTER* aFormatter, int aNestLevel, EDA_SHAPE* aCircle,
|
||||
const STROKE_PARAMS& aStroke, FILL_T aFillMode, const COLOR4D& aFillColor,
|
||||
KIID aUuid = niluuid )
|
||||
bool aIsPrivate, const STROKE_PARAMS& aStroke, FILL_T aFillMode,
|
||||
const COLOR4D& aFillColor, KIID aUuid = niluuid )
|
||||
{
|
||||
aFormatter->Print( aNestLevel, "(circle (center %s %s) (radius %s)\n",
|
||||
aFormatter->Print( aNestLevel, "(circle%s (center %s %s) (radius %s)\n",
|
||||
aIsPrivate ? " private" : "",
|
||||
FormatInternalUnits( aCircle->GetStart().x ).c_str(),
|
||||
FormatInternalUnits( aCircle->GetStart().y ).c_str(),
|
||||
FormatInternalUnits( aCircle->GetRadius() ).c_str() );
|
||||
|
@ -293,10 +297,11 @@ static void formatCircle( OUTPUTFORMATTER* aFormatter, int aNestLevel, EDA_SHAPE
|
|||
|
||||
|
||||
static void formatRect( OUTPUTFORMATTER* aFormatter, int aNestLevel, EDA_SHAPE* aRect,
|
||||
const STROKE_PARAMS& aStroke, FILL_T aFillMode, const COLOR4D& aFillColor,
|
||||
KIID aUuid = niluuid )
|
||||
bool aIsPrivate, const STROKE_PARAMS& aStroke, FILL_T aFillMode,
|
||||
const COLOR4D& aFillColor, KIID aUuid = niluuid )
|
||||
{
|
||||
aFormatter->Print( aNestLevel, "(rectangle (start %s %s) (end %s %s)\n",
|
||||
aFormatter->Print( aNestLevel, "(rectangle%s (start %s %s) (end %s %s)\n",
|
||||
aIsPrivate ? " private" : "",
|
||||
FormatInternalUnits( aRect->GetStart().x ).c_str(),
|
||||
FormatInternalUnits( aRect->GetStart().y ).c_str(),
|
||||
FormatInternalUnits( aRect->GetEnd().x ).c_str(),
|
||||
|
@ -314,10 +319,11 @@ static void formatRect( OUTPUTFORMATTER* aFormatter, int aNestLevel, EDA_SHAPE*
|
|||
|
||||
|
||||
static void formatBezier( OUTPUTFORMATTER* aFormatter, int aNestLevel, EDA_SHAPE* aBezier,
|
||||
const STROKE_PARAMS& aStroke, FILL_T aFillMode, const COLOR4D& aFillColor,
|
||||
KIID aUuid = niluuid )
|
||||
bool aIsPrivate, const STROKE_PARAMS& aStroke, FILL_T aFillMode,
|
||||
const COLOR4D& aFillColor, KIID aUuid = niluuid )
|
||||
{
|
||||
aFormatter->Print( aNestLevel, "(bezier (pts " );
|
||||
aFormatter->Print( aNestLevel, "(bezier%s (pts ",
|
||||
aIsPrivate ? " private" : "" );
|
||||
|
||||
for( const VECTOR2I& pt : { aBezier->GetStart(), aBezier->GetBezierC1(),
|
||||
aBezier->GetBezierC2(), aBezier->GetEnd() } )
|
||||
|
@ -342,12 +348,13 @@ static void formatBezier( OUTPUTFORMATTER* aFormatter, int aNestLevel, EDA_SHAPE
|
|||
|
||||
|
||||
static void formatPoly( OUTPUTFORMATTER* aFormatter, int aNestLevel, EDA_SHAPE* aPolyLine,
|
||||
const STROKE_PARAMS& aStroke, FILL_T aFillMode, const COLOR4D& aFillColor,
|
||||
KIID aUuid = niluuid )
|
||||
bool aIsPrivate, const STROKE_PARAMS& aStroke, FILL_T aFillMode,
|
||||
const COLOR4D& aFillColor, KIID aUuid = niluuid )
|
||||
{
|
||||
int newLine = 0;
|
||||
int lineCount = 1;
|
||||
aFormatter->Print( aNestLevel, "(polyline\n" );
|
||||
aFormatter->Print( aNestLevel, "(polyline%s\n",
|
||||
aIsPrivate ? " private" : "" );
|
||||
aFormatter->Print( aNestLevel + 1, "(pts" );
|
||||
|
||||
for( const VECTOR2I& pt : aPolyLine->GetPolyShape().Outline( 0 ).CPoints() )
|
||||
|
@ -418,6 +425,8 @@ class SCH_SEXPR_PLUGIN_CACHE
|
|||
static void saveField( LIB_FIELD* aField, OUTPUTFORMATTER& aFormatter, int aNestLevel );
|
||||
static void savePin( LIB_PIN* aPin, OUTPUTFORMATTER& aFormatter, int aNestLevel = 0 );
|
||||
static void saveText( LIB_TEXT* aText, OUTPUTFORMATTER& aFormatter, int aNestLevel = 0 );
|
||||
static void saveTextBox( LIB_TEXTBOX* aTextBox, OUTPUTFORMATTER& aFormatter,
|
||||
int aNestLevel = 0 );
|
||||
|
||||
static void saveDcmInfoAsFields( LIB_SYMBOL* aSymbol, OUTPUTFORMATTER& aFormatter,
|
||||
int& aNextFreeFieldId, int aNestLevel );
|
||||
|
@ -830,6 +839,10 @@ void SCH_SEXPR_PLUGIN::Format( SCH_SHEET* aSheet )
|
|||
saveText( static_cast<SCH_TEXT*>( item ), 1 );
|
||||
break;
|
||||
|
||||
case SCH_TEXTBOX_T:
|
||||
saveTextBox( static_cast<SCH_TEXTBOX*>( item ), 1 );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxASSERT( "Unexpected schematic object type in SCH_SEXPR_PLUGIN::Format()" );
|
||||
}
|
||||
|
@ -1339,27 +1352,27 @@ void SCH_SEXPR_PLUGIN::saveShape( SCH_SHAPE* aShape, int aNestLevel )
|
|||
switch( aShape->GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
formatArc( m_out, aNestLevel, aShape, aShape->GetStroke(), aShape->GetFillMode(),
|
||||
formatArc( m_out, aNestLevel, aShape, false, aShape->GetStroke(), aShape->GetFillMode(),
|
||||
aShape->GetFillColor(), aShape->m_Uuid );
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
formatCircle( m_out, aNestLevel, aShape, aShape->GetStroke(), aShape->GetFillMode(),
|
||||
formatCircle( m_out, aNestLevel, aShape, false, aShape->GetStroke(), aShape->GetFillMode(),
|
||||
aShape->GetFillColor(), aShape->m_Uuid );
|
||||
break;
|
||||
|
||||
case SHAPE_T::RECT:
|
||||
formatRect( m_out, aNestLevel, aShape, aShape->GetStroke(), aShape->GetFillMode(),
|
||||
formatRect( m_out, aNestLevel, aShape, false, aShape->GetStroke(), aShape->GetFillMode(),
|
||||
aShape->GetFillColor(), aShape->m_Uuid );
|
||||
break;
|
||||
|
||||
case SHAPE_T::BEZIER:
|
||||
formatBezier( m_out, aNestLevel, aShape, aShape->GetStroke(), aShape->GetFillMode(),
|
||||
formatBezier( m_out, aNestLevel, aShape, false, aShape->GetStroke(), aShape->GetFillMode(),
|
||||
aShape->GetFillColor(), aShape->m_Uuid );
|
||||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
formatPoly( m_out, aNestLevel, aShape, aShape->GetStroke(), aShape->GetFillMode(),
|
||||
formatPoly( m_out, aNestLevel, aShape, false, aShape->GetStroke(), aShape->GetFillMode(),
|
||||
aShape->GetFillColor(), aShape->m_Uuid );
|
||||
break;
|
||||
|
||||
|
@ -1438,7 +1451,6 @@ void SCH_SEXPR_PLUGIN::saveText( SCH_TEXT* aText, int aNestLevel )
|
|||
case TEXT_SPIN_STYLE::RIGHT: break;
|
||||
case TEXT_SPIN_STYLE::BOTTOM: angle += ANGLE_180; break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if( aText->GetText().Length() < 50 )
|
||||
|
@ -1461,7 +1473,7 @@ void SCH_SEXPR_PLUGIN::saveText( SCH_TEXT* aText, int aNestLevel )
|
|||
m_out->Print( 0, " (fields_autoplaced)" );
|
||||
|
||||
m_out->Print( 0, "\n" );
|
||||
aText->Format( m_out, aNestLevel, 0 );
|
||||
aText->EDA_TEXT::Format( m_out, aNestLevel, 0 );
|
||||
|
||||
m_out->Print( aNestLevel + 1, "(uuid %s)\n", TO_UTF8( aText->m_Uuid.AsString() ) );
|
||||
|
||||
|
@ -1475,6 +1487,33 @@ void SCH_SEXPR_PLUGIN::saveText( SCH_TEXT* aText, int aNestLevel )
|
|||
}
|
||||
|
||||
|
||||
void SCH_SEXPR_PLUGIN::saveTextBox( SCH_TEXTBOX* aTextBox, int aNestLevel )
|
||||
{
|
||||
wxCHECK_RET( aTextBox != nullptr && m_out != nullptr, "" );
|
||||
|
||||
m_out->Print( aNestLevel, "(text_box %s\n",
|
||||
m_out->Quotew( aTextBox->GetText() ).c_str() );
|
||||
|
||||
m_out->Print( aNestLevel + 1, "(start %s %s) (end %s %s)\n",
|
||||
FormatInternalUnits( aTextBox->GetStart().x ).c_str(),
|
||||
FormatInternalUnits( aTextBox->GetStart().y ).c_str(),
|
||||
FormatInternalUnits( aTextBox->GetEnd().x ).c_str(),
|
||||
FormatInternalUnits( aTextBox->GetEnd().y ).c_str() );
|
||||
|
||||
aTextBox->GetStroke().Format( m_out, aNestLevel + 1 );
|
||||
m_out->Print( 0, "\n" );
|
||||
formatFill( m_out, aNestLevel + 1, aTextBox->GetFillMode(), aTextBox->GetFillColor() );
|
||||
m_out->Print( 0, "\n" );
|
||||
|
||||
aTextBox->EDA_TEXT::Format( m_out, aNestLevel, 0 );
|
||||
|
||||
if( aTextBox->m_Uuid != niluuid )
|
||||
m_out->Print( aNestLevel + 1, "(uuid %s)\n", TO_UTF8( aTextBox->m_Uuid.AsString() ) );
|
||||
|
||||
m_out->Print( aNestLevel, ")\n" );
|
||||
}
|
||||
|
||||
|
||||
void SCH_SEXPR_PLUGIN::saveBusAlias( std::shared_ptr<BUS_ALIAS> aAlias, int aNestLevel )
|
||||
{
|
||||
wxCHECK_RET( aAlias != nullptr, "BUS_ALIAS* is NULL" );
|
||||
|
@ -1970,6 +2009,7 @@ void SCH_SEXPR_PLUGIN_CACHE::saveSymbolDrawItem( LIB_ITEM* aItem, OUTPUTFORMATTE
|
|||
LIB_SHAPE* shape = static_cast<LIB_SHAPE*>( aItem );
|
||||
STROKE_PARAMS stroke;
|
||||
FILL_T fillMode = shape->GetFillMode();
|
||||
bool isPrivate = shape->IsPrivate();
|
||||
|
||||
stroke.SetWidth( shape->GetWidth() );
|
||||
|
||||
|
@ -1978,23 +2018,23 @@ void SCH_SEXPR_PLUGIN_CACHE::saveSymbolDrawItem( LIB_ITEM* aItem, OUTPUTFORMATTE
|
|||
switch( shape->GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
formatArc( &aFormatter, aNestLevel, shape, stroke, fillMode, fillColor );
|
||||
formatArc( &aFormatter, aNestLevel, shape, isPrivate, stroke, fillMode, fillColor );
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
formatCircle( &aFormatter, aNestLevel, shape, stroke, fillMode, fillColor );
|
||||
formatCircle( &aFormatter, aNestLevel, shape, isPrivate, stroke, fillMode, fillColor );
|
||||
break;
|
||||
|
||||
case SHAPE_T::RECT:
|
||||
formatRect( &aFormatter, aNestLevel, shape, stroke, fillMode, fillColor );
|
||||
formatRect( &aFormatter, aNestLevel, shape, isPrivate, stroke, fillMode, fillColor );
|
||||
break;
|
||||
|
||||
case SHAPE_T::BEZIER:
|
||||
formatBezier(&aFormatter, aNestLevel, shape, stroke, fillMode, fillColor );
|
||||
formatBezier(&aFormatter, aNestLevel, shape, isPrivate, stroke, fillMode, fillColor );
|
||||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
formatPoly( &aFormatter, aNestLevel, shape, stroke, fillMode, fillColor );
|
||||
formatPoly( &aFormatter, aNestLevel, shape, isPrivate, stroke, fillMode, fillColor );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -2005,11 +2045,15 @@ void SCH_SEXPR_PLUGIN_CACHE::saveSymbolDrawItem( LIB_ITEM* aItem, OUTPUTFORMATTE
|
|||
}
|
||||
|
||||
case LIB_PIN_T:
|
||||
savePin( (LIB_PIN* ) aItem, aFormatter, aNestLevel );
|
||||
savePin( static_cast<LIB_PIN*>( aItem ), aFormatter, aNestLevel );
|
||||
break;
|
||||
|
||||
case LIB_TEXT_T:
|
||||
saveText( ( LIB_TEXT* ) aItem, aFormatter, aNestLevel );
|
||||
saveText( static_cast<LIB_TEXT*>( aItem ), aFormatter, aNestLevel );
|
||||
break;
|
||||
|
||||
case LIB_TEXTBOX_T:
|
||||
saveTextBox( static_cast<LIB_TEXTBOX*>( aItem ), aFormatter, aNestLevel );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -2089,12 +2133,40 @@ void SCH_SEXPR_PLUGIN_CACHE::saveText( LIB_TEXT* aText, OUTPUTFORMATTER& aFormat
|
|||
{
|
||||
wxCHECK_RET( aText && aText->Type() == LIB_TEXT_T, "Invalid LIB_TEXT object." );
|
||||
|
||||
aFormatter.Print( aNestLevel, "(text %s (at %s %s %g)\n",
|
||||
aFormatter.Print( aNestLevel, "(text%s %s (at %s %s %g)\n",
|
||||
aText->IsPrivate() ? " private" : "",
|
||||
aFormatter.Quotew( aText->GetText() ).c_str(),
|
||||
FormatInternalUnits( aText->GetPosition().x ).c_str(),
|
||||
FormatInternalUnits( aText->GetPosition().y ).c_str(),
|
||||
(double) aText->GetTextAngle().AsTenthsOfADegree() );
|
||||
aText->Format( &aFormatter, aNestLevel, 0 );
|
||||
|
||||
aText->EDA_TEXT::Format( &aFormatter, aNestLevel, 0 );
|
||||
aFormatter.Print( aNestLevel, ")\n" );
|
||||
}
|
||||
|
||||
|
||||
void SCH_SEXPR_PLUGIN_CACHE::saveTextBox( LIB_TEXTBOX* aTextBox, OUTPUTFORMATTER& aFormatter,
|
||||
int aNestLevel )
|
||||
{
|
||||
wxCHECK_RET( aTextBox && aTextBox->Type() == LIB_TEXTBOX_T, "Invalid LIB_TEXTBOX object." );
|
||||
|
||||
aFormatter.Print( aNestLevel, "(text_box%s %s\n",
|
||||
aTextBox->IsPrivate() ? " private" : "",
|
||||
aFormatter.Quotew( aTextBox->GetText() ).c_str() );
|
||||
|
||||
aFormatter.Print( aNestLevel + 1, "(start %s %s) (end %s %s)\n",
|
||||
FormatInternalUnits( aTextBox->GetStart().x ).c_str(),
|
||||
FormatInternalUnits( aTextBox->GetStart().y ).c_str(),
|
||||
FormatInternalUnits( aTextBox->GetEnd().x ).c_str(),
|
||||
FormatInternalUnits( aTextBox->GetEnd().y ).c_str() );
|
||||
|
||||
aTextBox->GetStroke().Format( &aFormatter, aNestLevel + 1 );
|
||||
aFormatter.Print( 0, "\n" );
|
||||
|
||||
formatFill( &aFormatter, aNestLevel + 1, aTextBox->GetFillMode(), aTextBox->GetFillColor() );
|
||||
aFormatter.Print( 0, "\n" );
|
||||
|
||||
aTextBox->EDA_TEXT::Format( &aFormatter, aNestLevel, 0 );
|
||||
aFormatter.Print( aNestLevel, ")\n" );
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ class SCH_LINE;
|
|||
class SCH_SHAPE;
|
||||
class SCH_BUS_ENTRY_BASE;
|
||||
class SCH_TEXT;
|
||||
class SCH_TEXTBOX;
|
||||
class SCH_SYMBOL;
|
||||
class SCH_FIELD;
|
||||
struct SYMBOL_INSTANCE_REFERENCE;
|
||||
|
@ -151,6 +152,7 @@ private:
|
|||
void saveLine( SCH_LINE* aLine, int aNestLevel );
|
||||
void saveShape( SCH_SHAPE* aShape, int aNestLevel );
|
||||
void saveText( SCH_TEXT* aText, int aNestLevel );
|
||||
void saveTextBox( SCH_TEXTBOX* aText, int aNestLevel );
|
||||
void saveBusAlias( std::shared_ptr<BUS_ALIAS> aAlias, int aNestLevel );
|
||||
void saveInstances( const std::vector<SCH_SHEET_INSTANCE>& aSheets,
|
||||
const std::vector<SYMBOL_INSTANCE_REFERENCE>& aSymbols, int aNestLevel );
|
||||
|
|
|
@ -547,34 +547,34 @@ bool SCH_SCREEN::IsTerminalPoint( const VECTOR2I& aPosition, int aLayer ) const
|
|||
wxCHECK_MSG( aLayer == LAYER_NOTES || aLayer == LAYER_BUS || aLayer == LAYER_WIRE, false,
|
||||
wxT( "Invalid layer type passed to SCH_SCREEN::IsTerminalPoint()." ) );
|
||||
|
||||
SCH_SHEET_PIN* sheetPin;
|
||||
SCH_LABEL_BASE* label;
|
||||
|
||||
switch( aLayer )
|
||||
{
|
||||
case LAYER_BUS:
|
||||
{
|
||||
if( GetBus( aPosition ) )
|
||||
return true;
|
||||
|
||||
SCH_SHEET_PIN* sheetPin = GetSheetPin( aPosition );
|
||||
sheetPin = GetSheetPin( aPosition );
|
||||
|
||||
if( sheetPin && sheetPin->IsConnected( aPosition ) )
|
||||
return true;
|
||||
|
||||
SCH_TEXT* label = GetLabel( aPosition );
|
||||
label = GetLabel( aPosition );
|
||||
|
||||
if( label && label->IsConnected( aPosition ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case LAYER_NOTES:
|
||||
{
|
||||
if( GetLine( aPosition ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case LAYER_WIRE:
|
||||
{
|
||||
if( GetItem( aPosition, 1, SCH_BUS_WIRE_ENTRY_T) )
|
||||
return true;
|
||||
|
||||
|
@ -587,16 +587,16 @@ bool SCH_SCREEN::IsTerminalPoint( const VECTOR2I& aPosition, int aLayer ) const
|
|||
if( GetWire( aPosition ) )
|
||||
return true;
|
||||
|
||||
SCH_TEXT* label = GetLabel( aPosition, 1 );
|
||||
label = GetLabel( aPosition, 1 );
|
||||
|
||||
if( label && label->IsConnected( aPosition ) )
|
||||
return true;
|
||||
|
||||
SCH_SHEET_PIN* sheetPin = GetSheetPin( aPosition );
|
||||
sheetPin = GetSheetPin( aPosition );
|
||||
|
||||
if( sheetPin && sheetPin->IsConnected( aPosition ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1110,7 +1110,7 @@ SCH_LINE* SCH_SCREEN::GetLine( const VECTOR2I& aPosition, int aAccuracy, int aLa
|
|||
}
|
||||
|
||||
|
||||
SCH_TEXT* SCH_SCREEN::GetLabel( const VECTOR2I& aPosition, int aAccuracy ) const
|
||||
SCH_LABEL_BASE* SCH_SCREEN::GetLabel( const VECTOR2I& aPosition, int aAccuracy ) const
|
||||
{
|
||||
for( SCH_ITEM* item : Items().Overlapping( aPosition, aAccuracy ) )
|
||||
{
|
||||
|
@ -1121,7 +1121,7 @@ SCH_TEXT* SCH_SCREEN::GetLabel( const VECTOR2I& aPosition, int aAccuracy ) const
|
|||
case SCH_HIER_LABEL_T:
|
||||
case SCH_DIRECTIVE_LABEL_T:
|
||||
if( item->HitTest( aPosition, aAccuracy ) )
|
||||
return static_cast<SCH_TEXT*>( item );
|
||||
return static_cast<SCH_LABEL_BASE*>( item );
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
@ -57,11 +57,10 @@ class LIB_SYMBOL;
|
|||
class LIB_PIN;
|
||||
class SCH_SYMBOL;
|
||||
class SCH_LINE;
|
||||
class SCH_TEXT;
|
||||
class SCH_LABEL_BASE;
|
||||
class PLOTTER;
|
||||
class REPORTER;
|
||||
class SCH_EDIT_FRAME;
|
||||
class SCH_SHEET;
|
||||
class SCH_SHEET_LIST;
|
||||
class SCH_SEXPR_PARSER;
|
||||
class SCH_SEXPR_PLUGIN;
|
||||
|
@ -437,10 +436,9 @@ public:
|
|||
*
|
||||
* @param[in] aPosition The VECTOR2I to test for label items.
|
||||
* @param aAccuracy Amount to inflate the item hit test bounding box.
|
||||
* @return The SCH_TEXT* of the label item found at \a aPosition or NULL if item not
|
||||
* found.
|
||||
* @return The SCH_LABEL_BASE* of the label item found or nullptr.
|
||||
*/
|
||||
SCH_TEXT* GetLabel( const VECTOR2I& aPosition, int aAccuracy = 0 ) const;
|
||||
SCH_LABEL_BASE* GetLabel( const VECTOR2I& aPosition, int aAccuracy = 0 ) const;
|
||||
|
||||
/**
|
||||
* Fetch a list of unique #LIB_SYMBOL object pointers required to properly render each
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
#include <sch_shape.h>
|
||||
|
||||
|
||||
SCH_SHAPE::SCH_SHAPE( SHAPE_T aShape, int aLineWidth, FILL_T aFillType ) :
|
||||
SCH_ITEM( nullptr, SCH_SHAPE_T ),
|
||||
SCH_SHAPE::SCH_SHAPE( SHAPE_T aShape, int aLineWidth, FILL_T aFillType, KICAD_T aType ) :
|
||||
SCH_ITEM( nullptr, aType ),
|
||||
EDA_SHAPE( aShape, aLineWidth, aFillType, false )
|
||||
{
|
||||
SetLayer( LAYER_NOTES );
|
||||
|
@ -83,17 +83,13 @@ void SCH_SHAPE::MirrorVertically( int aCenter )
|
|||
|
||||
void SCH_SHAPE::Rotate( const VECTOR2I& aCenter )
|
||||
{
|
||||
rotate( aCenter, ANGLE_90 );
|
||||
rotate( aCenter, -ANGLE_90 );
|
||||
}
|
||||
|
||||
|
||||
void SCH_SHAPE::Plot( PLOTTER* aPlotter ) const
|
||||
{
|
||||
int pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
|
||||
VECTOR2I center;
|
||||
int radius = 0;
|
||||
EDA_ANGLE startAngle;
|
||||
EDA_ANGLE endAngle;
|
||||
|
||||
static std::vector<VECTOR2I> cornerList;
|
||||
|
||||
|
@ -104,12 +100,6 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter ) const
|
|||
for( const VECTOR2I& pt : m_poly.Outline( 0 ).CPoints() )
|
||||
cornerList.push_back( pt );
|
||||
}
|
||||
else if( GetShape() == SHAPE_T::ARC )
|
||||
{
|
||||
center = getCenter();
|
||||
radius = GetRadius();
|
||||
CalcArcAngles( startAngle, endAngle );
|
||||
}
|
||||
|
||||
if( GetStroke().GetColor() == COLOR4D::UNSPECIFIED )
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_NOTES ) );
|
||||
|
@ -122,11 +112,11 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter ) const
|
|||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
aPlotter->Arc( center, -endAngle, -startAngle, radius, FILL_T::NO_FILL, pen_size );
|
||||
aPlotter->Arc( getCenter(), GetStart(), GetEnd(), FILL_T::NO_FILL, pen_size, ARC_HIGH_DEF );
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
aPlotter->Circle( GetStart(), GetRadius() * 2, FILL_T::NO_FILL, pen_size );
|
||||
aPlotter->Circle( getCenter(), GetRadius() * 2, FILL_T::NO_FILL, pen_size );
|
||||
break;
|
||||
|
||||
case SHAPE_T::RECT:
|
||||
|
@ -169,11 +159,11 @@ void SCH_SHAPE::Plot( PLOTTER* aPlotter ) const
|
|||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
aPlotter->Arc( center, -endAngle, -startAngle, radius, m_fill, 0 );
|
||||
aPlotter->Arc( getCenter(), GetStart(), GetEnd(), m_fill, 0, ARC_HIGH_DEF );
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
aPlotter->Circle( GetStart(), GetRadius() * 2, m_fill, 0 );
|
||||
aPlotter->Circle( getCenter(), GetRadius() * 2, m_fill, 0 );
|
||||
break;
|
||||
|
||||
case SHAPE_T::RECT:
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
class SCH_SHAPE : public SCH_ITEM, public EDA_SHAPE
|
||||
{
|
||||
public:
|
||||
SCH_SHAPE( SHAPE_T aShape, int aLineWidth = 0, FILL_T aFillType = FILL_T::NO_FILL );
|
||||
SCH_SHAPE( SHAPE_T aShape, int aLineWidth = 0, FILL_T aFillType = FILL_T::NO_FILL,
|
||||
KICAD_T aType = SCH_SHAPE_T );
|
||||
|
||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ wxString SCH_SHEET_PATH::PathHumanReadable( bool aUseShortRootName ) const
|
|||
}
|
||||
|
||||
|
||||
void SCH_SHEET_PATH::UpdateAllScreenReferences()
|
||||
void SCH_SHEET_PATH::UpdateAllScreenReferences() const
|
||||
{
|
||||
for( SCH_ITEM* item : LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
|
||||
{
|
||||
|
|
|
@ -283,7 +283,7 @@ public:
|
|||
* Mandatory in complex hierarchies because sheets may use the same screen (basic schematic)
|
||||
* more than once but with different references and units according to the displayed sheet.
|
||||
*/
|
||||
void UpdateAllScreenReferences();
|
||||
void UpdateAllScreenReferences() const;
|
||||
|
||||
/**
|
||||
* Append a #SCH_REFERENCE object to \a aReferences based on \a aSymbol
|
||||
|
|
|
@ -75,17 +75,14 @@ void SCH_SHEET_PIN::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOf
|
|||
void SCH_SHEET_PIN::SwapData( SCH_ITEM* aItem )
|
||||
{
|
||||
wxCHECK_RET( aItem->Type() == SCH_SHEET_PIN_T,
|
||||
wxString::Format( wxT( "SCH_SHEET_PIN object cannot swap data with %s object." ),
|
||||
wxString::Format( "SCH_SHEET_PIN object cannot swap data with %s object.",
|
||||
aItem->GetClass() ) );
|
||||
|
||||
SCH_SHEET_PIN* pin = ( SCH_SHEET_PIN* ) aItem;
|
||||
SCH_TEXT::SwapData( (SCH_TEXT*) pin );
|
||||
int tmp = pin->GetNumber();
|
||||
pin->SetNumber( GetNumber() );
|
||||
SetNumber( tmp );
|
||||
SHEET_SIDE stmp = pin->GetSide();
|
||||
pin->SetSide( GetSide() );
|
||||
SetSide( stmp );
|
||||
SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( aItem );
|
||||
|
||||
SCH_HIERLABEL::SwapData( pin );
|
||||
std::swap( m_number, pin->m_number );
|
||||
std::swap( m_edge, pin->m_edge );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -265,8 +265,6 @@ int SCH_TEXT::GetTextOffset( const RENDER_SETTINGS* aSettings ) const
|
|||
ratio = DEFAULT_TEXT_OFFSET_RATIO; // For previews (such as in Preferences), etc.
|
||||
|
||||
return KiROUND( ratio * GetTextSize().y );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,358 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* 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 <pgm_base.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <plotters/plotter.h>
|
||||
#include <widgets/msgpanel.h>
|
||||
#include <bitmaps.h>
|
||||
#include <string_utils.h>
|
||||
#include <schematic.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <sch_painter.h>
|
||||
#include <wx/log.h>
|
||||
#include <dialogs/html_message_box.h>
|
||||
#include <project/project_file.h>
|
||||
#include <project/net_settings.h>
|
||||
#include <core/kicad_algo.h>
|
||||
#include <trigo.h>
|
||||
#include <sch_textbox.h>
|
||||
|
||||
using KIGFX::SCH_RENDER_SETTINGS;
|
||||
|
||||
|
||||
SCH_TEXTBOX::SCH_TEXTBOX( int aLineWidth, FILL_T aFillType, const wxString& text ) :
|
||||
SCH_SHAPE( SHAPE_T::RECT, aLineWidth, aFillType, SCH_TEXTBOX_T ),
|
||||
EDA_TEXT( text )
|
||||
{
|
||||
m_layer = LAYER_NOTES;
|
||||
|
||||
SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||
SetVertJustify( GR_TEXT_V_ALIGN_TOP );
|
||||
SetMultilineAllowed( true );
|
||||
}
|
||||
|
||||
|
||||
SCH_TEXTBOX::SCH_TEXTBOX( const SCH_TEXTBOX& aText ) :
|
||||
SCH_SHAPE( aText ),
|
||||
EDA_TEXT( aText )
|
||||
{ }
|
||||
|
||||
|
||||
int SCH_TEXTBOX::GetTextMargin() const
|
||||
{
|
||||
return KiROUND( GetTextSize().y * 0.8 );
|
||||
}
|
||||
|
||||
|
||||
void SCH_TEXTBOX::MirrorHorizontally( int aCenter )
|
||||
{
|
||||
// Text is NOT really mirrored; it just has its justification flipped
|
||||
if( GetTextAngle() == ANGLE_HORIZONTAL )
|
||||
{
|
||||
SetHorizJustify( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT ? GR_TEXT_H_ALIGN_LEFT
|
||||
: GR_TEXT_H_ALIGN_RIGHT );
|
||||
}
|
||||
|
||||
UpdateTextPosition();
|
||||
}
|
||||
|
||||
|
||||
void SCH_TEXTBOX::MirrorVertically( int aCenter )
|
||||
{
|
||||
// Text is NOT really mirrored; it just has its justification flipped
|
||||
if( GetTextAngle() == ANGLE_VERTICAL )
|
||||
{
|
||||
SetHorizJustify( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT ? GR_TEXT_H_ALIGN_LEFT
|
||||
: GR_TEXT_H_ALIGN_RIGHT );
|
||||
}
|
||||
|
||||
UpdateTextPosition();
|
||||
}
|
||||
|
||||
|
||||
void SCH_TEXTBOX::Rotate( const VECTOR2I& aCenter )
|
||||
{
|
||||
SCH_SHAPE::Rotate( aCenter );
|
||||
|
||||
SetTextAngle( GetTextAngle() == ANGLE_VERTICAL ? ANGLE_HORIZONTAL : ANGLE_VERTICAL );
|
||||
UpdateTextPosition();
|
||||
}
|
||||
|
||||
|
||||
void SCH_TEXTBOX::Rotate90( bool aClockwise )
|
||||
{
|
||||
SetTextAngle( GetTextAngle() == ANGLE_VERTICAL ? ANGLE_HORIZONTAL : ANGLE_VERTICAL );
|
||||
UpdateTextPosition();
|
||||
}
|
||||
|
||||
|
||||
void SCH_TEXTBOX::UpdateTextPosition()
|
||||
{
|
||||
int margin = GetTextMargin();
|
||||
BOX2I bbox( m_start, m_end - m_start );
|
||||
|
||||
bbox.Normalize();
|
||||
|
||||
if( GetTextAngle() == ANGLE_HORIZONTAL )
|
||||
{
|
||||
if( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
|
||||
SetTextPos( VECTOR2I( bbox.GetRight() - margin, bbox.GetTop() + margin ) );
|
||||
else
|
||||
SetTextPos( VECTOR2I( bbox.GetLeft() + margin, bbox.GetTop() + margin ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
|
||||
SetTextPos( VECTOR2I( bbox.GetLeft() + margin, bbox.GetTop() + margin ) );
|
||||
else
|
||||
SetTextPos( VECTOR2I( bbox.GetLeft() + margin, bbox.GetBottom() - margin ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_TEXTBOX::SwapData( SCH_ITEM* aItem )
|
||||
{
|
||||
SCH_TEXTBOX* item = static_cast<SCH_TEXTBOX*>( aItem );
|
||||
|
||||
std::swap( m_layer, item->m_layer );
|
||||
|
||||
SwapText( *item );
|
||||
SwapAttributes( *item );
|
||||
|
||||
SCH_SHAPE::SwapData( aItem );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_TEXTBOX::operator<( const SCH_ITEM& aItem ) const
|
||||
{
|
||||
if( Type() != aItem.Type() )
|
||||
return Type() < aItem.Type();
|
||||
|
||||
auto other = static_cast<const SCH_TEXTBOX*>( &aItem );
|
||||
|
||||
if( GetLayer() != other->GetLayer() )
|
||||
return GetLayer() < other->GetLayer();
|
||||
|
||||
if( GetPosition().x != other->GetPosition().x )
|
||||
return GetPosition().x < other->GetPosition().x;
|
||||
|
||||
if( GetPosition().y != other->GetPosition().y )
|
||||
return GetPosition().y < other->GetPosition().y;
|
||||
|
||||
return GetText() < other->GetText();
|
||||
}
|
||||
|
||||
|
||||
int SCH_TEXTBOX::GetPenWidth() const
|
||||
{
|
||||
return GetEffectiveTextPenWidth();
|
||||
}
|
||||
|
||||
|
||||
KIFONT::FONT* SCH_TEXTBOX::GetDrawFont() const
|
||||
{
|
||||
KIFONT::FONT* font = EDA_TEXT::GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
|
||||
void SCH_TEXTBOX::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
|
||||
{
|
||||
COLOR4D color = aSettings->GetLayerColor( m_layer );
|
||||
EDA_TEXT::Print( aSettings, aOffset, color );
|
||||
}
|
||||
|
||||
|
||||
wxString SCH_TEXTBOX::GetShownText( int aDepth ) const
|
||||
{
|
||||
std::function<bool( wxString* )> textResolver =
|
||||
[&]( wxString* token ) -> bool
|
||||
{
|
||||
if( token->Contains( ':' ) )
|
||||
{
|
||||
if( Schematic()->ResolveCrossReference( token, aDepth ) )
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
SCHEMATIC* schematic = Schematic();
|
||||
SCH_SHEET* sheet = schematic ? schematic->CurrentSheet().Last() : nullptr;
|
||||
|
||||
if( sheet && sheet->ResolveTextVar( token, aDepth + 1 ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
std::function<bool( wxString* )> schematicTextResolver =
|
||||
[&]( wxString* token ) -> bool
|
||||
{
|
||||
return Schematic()->ResolveTextVar( token, aDepth + 1 );
|
||||
};
|
||||
|
||||
wxString text = EDA_TEXT::GetShownText();
|
||||
|
||||
if( HasTextVars() )
|
||||
{
|
||||
PROJECT* project = nullptr;
|
||||
|
||||
if( Schematic() )
|
||||
project = &Schematic()->Prj();
|
||||
|
||||
if( aDepth < 10 )
|
||||
text = ExpandTextVars( text, &textResolver, &schematicTextResolver, project );
|
||||
}
|
||||
|
||||
KIFONT::FONT* font = GetDrawFont();
|
||||
VECTOR2D size = GetEnd() - GetStart();
|
||||
int colWidth = GetTextAngle() == ANGLE_HORIZONTAL ? size.x : size.y;
|
||||
|
||||
colWidth = abs( colWidth ) - GetTextMargin() * 2;
|
||||
font->LinebreakText( text, colWidth, GetTextSize(), GetTextThickness(), IsBold(), IsItalic() );
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
bool SCH_TEXTBOX::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
||||
{
|
||||
EDA_RECT rect = GetBoundingBox();
|
||||
|
||||
rect.Inflate( aAccuracy );
|
||||
|
||||
return rect.Contains( aPosition );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_TEXTBOX::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
|
||||
{
|
||||
EDA_RECT rect = aRect;
|
||||
|
||||
rect.Inflate( aAccuracy );
|
||||
|
||||
if( aContained )
|
||||
return rect.Contains( GetBoundingBox() );
|
||||
|
||||
return rect.Intersects( GetBoundingBox() );
|
||||
}
|
||||
|
||||
|
||||
wxString SCH_TEXTBOX::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
{
|
||||
return wxString::Format( _( "Graphic Text Box" ) );
|
||||
}
|
||||
|
||||
|
||||
BITMAPS SCH_TEXTBOX::GetMenuImage() const
|
||||
{
|
||||
return BITMAPS::add_textbox;
|
||||
}
|
||||
|
||||
|
||||
void SCH_TEXTBOX::Plot( PLOTTER* aPlotter ) const
|
||||
{
|
||||
RENDER_SETTINGS* settings = aPlotter->RenderSettings();
|
||||
KIFONT::FONT* font = GetDrawFont();
|
||||
int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
|
||||
FILL_T fill = m_fill;
|
||||
COLOR4D color = settings->GetLayerColor( LAYER_NOTES );
|
||||
|
||||
if( fill != FILL_T::NO_FILL )
|
||||
{
|
||||
COLOR4D fillColor = color;
|
||||
|
||||
if( aPlotter->GetColorMode() )
|
||||
{
|
||||
if( fill == FILL_T::FILLED_WITH_BG_BODYCOLOR )
|
||||
fillColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||
else if( fill == FILL_T::FILLED_WITH_COLOR )
|
||||
fillColor = GetFillColor();
|
||||
}
|
||||
|
||||
aPlotter->SetColor( fillColor );
|
||||
aPlotter->Rect( m_start, m_end, fill, 0 );
|
||||
|
||||
fill = FILL_T::NO_FILL;
|
||||
}
|
||||
|
||||
aPlotter->SetColor( color );
|
||||
aPlotter->Rect( m_start, m_end, fill, penWidth );
|
||||
|
||||
penWidth = std::max( penWidth, settings->GetMinPenWidth() );
|
||||
aPlotter->SetCurrentLineWidth( penWidth );
|
||||
|
||||
std::vector<VECTOR2I> positions;
|
||||
wxArrayString strings_list;
|
||||
wxStringSplit( GetShownText(), strings_list, '\n' );
|
||||
positions.reserve( strings_list.Count() );
|
||||
|
||||
GetLinePositions( positions, (int) strings_list.Count() );
|
||||
|
||||
for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
|
||||
{
|
||||
aPlotter->Text( positions[ii], color, strings_list.Item( ii ), GetTextAngle(),
|
||||
GetTextSize(), GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(),
|
||||
IsBold(), false, font );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
// Don't use GetShownText() here; we want to show the user the variable references
|
||||
aList.emplace_back( _( "Text Box" ), UnescapeString( GetText() ) );
|
||||
|
||||
wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) };
|
||||
int style = IsBold() && IsItalic() ? 3 : IsBold() ? 2 : IsItalic() ? 1 : 0;
|
||||
aList.emplace_back( _( "Style" ), textStyle[style] );
|
||||
|
||||
aList.emplace_back( _( "Text Size" ), MessageTextFromValue( aFrame->GetUserUnits(),
|
||||
GetTextWidth() ) );
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
void SCH_TEXTBOX::Show( int nestLevel, std::ostream& os ) const
|
||||
{
|
||||
// XML output:
|
||||
wxString s = GetClass();
|
||||
|
||||
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str()
|
||||
<< " layer=\"" << m_layer << '"'
|
||||
<< '>'
|
||||
<< TO_UTF8( GetText() )
|
||||
<< "</" << s.Lower().mb_str() << ">\n";
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* 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 SCH_TEXTBOX_H
|
||||
#define SCH_TEXTBOX_H
|
||||
|
||||
|
||||
#include <eda_text.h>
|
||||
#include <sch_shape.h>
|
||||
|
||||
|
||||
class HTML_MESSAGE_BOX;
|
||||
|
||||
class SCH_TEXTBOX : public SCH_SHAPE, public EDA_TEXT
|
||||
{
|
||||
public:
|
||||
SCH_TEXTBOX( int aLineWidth = 0, FILL_T aFillType = FILL_T::NO_FILL,
|
||||
const wxString& aText = wxEmptyString );
|
||||
|
||||
SCH_TEXTBOX( const SCH_TEXTBOX& aText );
|
||||
|
||||
~SCH_TEXTBOX() { }
|
||||
|
||||
static inline bool ClassOf( const EDA_ITEM* aItem )
|
||||
{
|
||||
return aItem && SCH_TEXTBOX_T == aItem->Type();
|
||||
}
|
||||
|
||||
virtual wxString GetClass() const override
|
||||
{
|
||||
return wxT( "SCH_TEXTBOX" );
|
||||
}
|
||||
|
||||
int GetTextMargin() const;
|
||||
|
||||
void UpdateTextPosition();
|
||||
|
||||
wxString GetShownText( int aDepth = 0 ) const override;
|
||||
|
||||
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& offset ) override;
|
||||
|
||||
void SwapData( SCH_ITEM* aItem ) override;
|
||||
|
||||
bool operator<( const SCH_ITEM& aItem ) const override;
|
||||
|
||||
int GetPenWidth() const override;
|
||||
|
||||
KIFONT::FONT* GetDrawFont() const override;
|
||||
|
||||
void Move( const VECTOR2I& aMoveVector ) override
|
||||
{
|
||||
EDA_SHAPE::move( aMoveVector );
|
||||
EDA_TEXT::Offset( aMoveVector );
|
||||
}
|
||||
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter ) override;
|
||||
|
||||
virtual void Rotate90( bool aClockwise );
|
||||
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
|
||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
bool Matches( const wxFindReplaceData& aSearchData, void* aAuxData ) const override
|
||||
{
|
||||
return SCH_ITEM::Matches( GetText(), aSearchData );
|
||||
}
|
||||
|
||||
bool Replace( const wxFindReplaceData& aSearchData, void* aAuxData ) override
|
||||
{
|
||||
return EDA_TEXT::Replace( aSearchData );
|
||||
}
|
||||
|
||||
virtual bool IsReplaceable() const override { return true; }
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter ) const override;
|
||||
|
||||
EDA_ITEM* Clone() const override
|
||||
{
|
||||
return new SCH_TEXTBOX( *this );
|
||||
}
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const override;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#endif /* SCH_TEXTBOX_H */
|
|
@ -97,6 +97,7 @@ portrait
|
|||
power
|
||||
power_in
|
||||
power_out
|
||||
private
|
||||
property
|
||||
property_del
|
||||
pts
|
||||
|
@ -117,6 +118,7 @@ stroke
|
|||
symbol
|
||||
symbol_instances
|
||||
text
|
||||
text_box
|
||||
thickness
|
||||
title
|
||||
title_block
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -139,6 +139,7 @@ void SYMBOL_EDIT_FRAME::ReCreateMenuBar()
|
|||
|
||||
placeMenu->Add( EE_ACTIONS::placeSymbolPin );
|
||||
placeMenu->Add( EE_ACTIONS::placeSymbolText );
|
||||
placeMenu->Add( EE_ACTIONS::drawSymbolTextBox );
|
||||
placeMenu->Add( EE_ACTIONS::drawRectangle );
|
||||
placeMenu->Add( EE_ACTIONS::drawCircle );
|
||||
placeMenu->Add( EE_ACTIONS::drawArc );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -486,6 +486,7 @@ void SYMBOL_EDIT_FRAME::setupUIConditions()
|
|||
mgr->SetConditions( ACTIONS::deleteTool, EDIT_TOOL( ACTIONS::deleteTool ) );
|
||||
mgr->SetConditions( EE_ACTIONS::placeSymbolPin, EDIT_TOOL( EE_ACTIONS::placeSymbolPin ) );
|
||||
mgr->SetConditions( EE_ACTIONS::placeSymbolText, EDIT_TOOL( EE_ACTIONS::placeSymbolText ) );
|
||||
mgr->SetConditions( EE_ACTIONS::drawSymbolTextBox, EDIT_TOOL( EE_ACTIONS::drawSymbolTextBox ) );
|
||||
mgr->SetConditions( EE_ACTIONS::drawRectangle, EDIT_TOOL( EE_ACTIONS::drawRectangle ) );
|
||||
mgr->SetConditions( EE_ACTIONS::drawCircle, EDIT_TOOL( EE_ACTIONS::drawCircle ) );
|
||||
mgr->SetConditions( EE_ACTIONS::drawArc, EDIT_TOOL( EE_ACTIONS::drawArc ) );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -27,7 +27,6 @@
|
|||
#include <eeschema_id.h>
|
||||
#include <symbol_edit_frame.h>
|
||||
#include <sch_painter.h>
|
||||
#include <bitmaps.h>
|
||||
#include <symbol_library_manager.h>
|
||||
#include <tool/action_toolbar.h>
|
||||
#include <tool/tool_manager.h>
|
||||
|
@ -60,6 +59,7 @@ void SYMBOL_EDIT_FRAME::ReCreateVToolbar()
|
|||
m_drawToolBar->AddScaledSeparator( this );
|
||||
m_drawToolBar->Add( EE_ACTIONS::placeSymbolPin, ACTION_TOOLBAR::TOGGLE );
|
||||
m_drawToolBar->Add( EE_ACTIONS::placeSymbolText, ACTION_TOOLBAR::TOGGLE );
|
||||
m_drawToolBar->Add( EE_ACTIONS::drawSymbolTextBox, ACTION_TOOLBAR::TOGGLE );
|
||||
m_drawToolBar->Add( EE_ACTIONS::drawRectangle, ACTION_TOOLBAR::TOGGLE );
|
||||
m_drawToolBar->Add( EE_ACTIONS::drawCircle, ACTION_TOOLBAR::TOGGLE );
|
||||
m_drawToolBar->Add( EE_ACTIONS::drawArc, ACTION_TOOLBAR::TOGGLE );
|
||||
|
|
|
@ -160,8 +160,12 @@ void SCH_EDIT_FRAME::ReCreateVToolbar()
|
|||
m_drawToolBar->Add( EE_ACTIONS::importSheetPin, ACTION_TOOLBAR::TOGGLE );
|
||||
|
||||
m_drawToolBar->AddScaledSeparator( this );
|
||||
m_drawToolBar->Add( EE_ACTIONS::drawLines, ACTION_TOOLBAR::TOGGLE );
|
||||
m_drawToolBar->Add( EE_ACTIONS::placeSchematicText, ACTION_TOOLBAR::TOGGLE );
|
||||
m_drawToolBar->Add( EE_ACTIONS::drawTextBox, ACTION_TOOLBAR::TOGGLE );
|
||||
m_drawToolBar->Add( EE_ACTIONS::drawRectangle, ACTION_TOOLBAR::TOGGLE );
|
||||
m_drawToolBar->Add( EE_ACTIONS::drawCircle, ACTION_TOOLBAR::TOGGLE );
|
||||
m_drawToolBar->Add( EE_ACTIONS::drawArc, ACTION_TOOLBAR::TOGGLE );
|
||||
m_drawToolBar->Add( EE_ACTIONS::drawLines, ACTION_TOOLBAR::TOGGLE );
|
||||
m_drawToolBar->Add( EE_ACTIONS::placeImage, ACTION_TOOLBAR::TOGGLE );
|
||||
m_drawToolBar->Add( ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE );
|
||||
|
||||
|
|
|
@ -544,7 +544,7 @@ void BACK_ANNOTATE::processNetNameChange( const wxString& aRef, SCH_PIN* aPin,
|
|||
|
||||
m_frame->SaveCopyInUndoList( screen, driver, UNDO_REDO::CHANGED, m_appendUndo );
|
||||
m_appendUndo = true;
|
||||
static_cast<SCH_TEXT*>( driver )->SetText( aNewName );
|
||||
static_cast<SCH_LABEL_BASE*>( driver )->SetText( aNewName );
|
||||
}
|
||||
|
||||
m_reporter.ReportHead( msg, RPT_SEVERITY_ACTION );
|
||||
|
|
|
@ -225,6 +225,11 @@ TOOL_ACTION EE_ACTIONS::placeSymbolText( "eeschema.SymbolDrawing.placeSymbolText
|
|||
_( "Add Text" ), _( "Add a text item" ),
|
||||
BITMAPS::text, AF_ACTIVATE, (void*) LIB_TEXT_T );
|
||||
|
||||
TOOL_ACTION EE_ACTIONS::drawSymbolTextBox( "eeschema.SymbolDrawing.drawSymbolTextBox",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Add Text Box" ), _( "Add a text box item" ),
|
||||
BITMAPS::add_textbox, AF_ACTIVATE, (void*) LIB_TEXTBOX_T );
|
||||
|
||||
TOOL_ACTION EE_ACTIONS::drawSymbolLines( "eeschema.SymbolDrawing.drawSymbolLines",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Add Lines" ), _( "Add connected graphic lines" ),
|
||||
|
@ -335,6 +340,11 @@ TOOL_ACTION EE_ACTIONS::placeSchematicText( "eeschema.InteractiveDrawing.placeSc
|
|||
_( "Add Text" ), _( "Add text" ),
|
||||
BITMAPS::text, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION EE_ACTIONS::drawTextBox( "eeschema.InteractiveDrawing.drawTextBox",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Add Text Box" ), _( "Add a text box" ),
|
||||
BITMAPS::add_textbox, AF_ACTIVATE, (void*) SHAPE_T::RECT );
|
||||
|
||||
TOOL_ACTION EE_ACTIONS::drawRectangle( "eeschema.InteractiveDrawing.drawRectangle",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Add Rectangle" ), _( "Add a rectangle" ),
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019 CERN
|
||||
* Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -89,6 +89,7 @@ public:
|
|||
static TOOL_ACTION drawSheet;
|
||||
static TOOL_ACTION importSheetPin;
|
||||
static TOOL_ACTION placeSchematicText;
|
||||
static TOOL_ACTION drawTextBox;
|
||||
static TOOL_ACTION drawRectangle;
|
||||
static TOOL_ACTION drawCircle;
|
||||
static TOOL_ACTION drawArc;
|
||||
|
@ -103,6 +104,7 @@ public:
|
|||
// Symbol Tools
|
||||
static TOOL_ACTION placeSymbolPin;
|
||||
static TOOL_ACTION placeSymbolText;
|
||||
static TOOL_ACTION drawSymbolTextBox;
|
||||
static TOOL_ACTION drawSymbolLines;
|
||||
static TOOL_ACTION placeSymbolAnchor;
|
||||
static TOOL_ACTION finishDrawing;
|
||||
|
|
|
@ -69,7 +69,7 @@ VECTOR2I EE_GRID_HELPER::BestDragOrigin( const VECTOR2I& aMousePos, int aLayer,
|
|||
// we can only consider anchors from text objects if they are the only thing
|
||||
// selected.
|
||||
bool includeText = ( aItems.Size() == 1
|
||||
|| aItems.OnlyContains( { SCH_TEXT_T, SCH_FIELD_T } ) );
|
||||
|| aItems.OnlyContains( { SCH_TEXT_T, SCH_TEXTBOX_T, SCH_FIELD_T } ) );
|
||||
|
||||
for( EDA_ITEM* item : aItems )
|
||||
computeAnchors( static_cast<SCH_ITEM*>( item ), aMousePos, true, includeText );
|
||||
|
@ -274,6 +274,7 @@ void EE_GRID_HELPER::computeAnchors( SCH_ITEM *aItem, const VECTOR2I &aRefPos, b
|
|||
switch( aItem->Type() )
|
||||
{
|
||||
case SCH_TEXT_T:
|
||||
case SCH_TEXTBOX_T:
|
||||
case SCH_FIELD_T:
|
||||
{
|
||||
if( aIncludeText )
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019 CERN
|
||||
* Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -32,15 +32,16 @@ using namespace std::placeholders;
|
|||
#include <geometry/seg.h>
|
||||
#include <tools/ee_actions.h>
|
||||
#include <tools/ee_selection_tool.h>
|
||||
#include <bitmaps.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <sch_line.h>
|
||||
#include <sch_bitmap.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <sch_textbox.h>
|
||||
#include <sch_shape.h>
|
||||
#include <sch_sheet_pin.h>
|
||||
#include <symbol_edit_frame.h>
|
||||
#include <lib_shape.h>
|
||||
#include <lib_textbox.h>
|
||||
|
||||
|
||||
// Few constants to avoid using bare numbers for point indices
|
||||
|
@ -110,8 +111,8 @@ public:
|
|||
points->AddPoint( VECTOR2I( botRight.x, topLeft.y ) );
|
||||
points->AddPoint( VECTOR2I( topLeft.x, botRight.y ) );
|
||||
points->AddPoint( botRight );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
for( const VECTOR2I& pt : shape->GetPolyShape().Outline( 0 ).CPoints() )
|
||||
|
@ -126,8 +127,30 @@ public:
|
|||
default:
|
||||
UNIMPLEMENTED_FOR( shape->SHAPE_T_asString() );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case LIB_TEXTBOX_T:
|
||||
{
|
||||
LIB_TEXTBOX* textBox = static_cast<LIB_TEXTBOX*>( aItem );
|
||||
|
||||
// point editor works only with rectangles having width and height > 0
|
||||
// Some symbols can have rectangles with width or height < 0
|
||||
// So normalize the size:
|
||||
BOX2I dummy;
|
||||
dummy.SetOrigin( mapCoords( textBox->GetPosition() ) );
|
||||
dummy.SetEnd( mapCoords( textBox->GetEnd() ) );
|
||||
dummy.Normalize();
|
||||
VECTOR2I topLeft = dummy.GetPosition();
|
||||
VECTOR2I botRight = dummy.GetEnd();
|
||||
|
||||
points->AddPoint( topLeft );
|
||||
points->AddPoint( VECTOR2I( botRight.x, topLeft.y ) );
|
||||
points->AddPoint( VECTOR2I( topLeft.x, botRight.y ) );
|
||||
points->AddPoint( botRight );
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_SHAPE_T:
|
||||
{
|
||||
|
@ -162,8 +185,8 @@ public:
|
|||
points->AddPoint( VECTOR2I( botRight.x, topLeft.y ) );
|
||||
points->AddPoint( VECTOR2I( topLeft.x, botRight.y ) );
|
||||
points->AddPoint( botRight );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
for( const VECTOR2I& pt : shape->GetPolyShape().Outline( 0 ).CPoints() )
|
||||
|
@ -178,8 +201,30 @@ public:
|
|||
default:
|
||||
UNIMPLEMENTED_FOR( shape->SHAPE_T_asString() );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_TEXTBOX_T:
|
||||
{
|
||||
SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( aItem );
|
||||
|
||||
// point editor works only with rectangles having width and height > 0
|
||||
// Some symbols can have rectangles with width or height < 0
|
||||
// So normalize the size:
|
||||
BOX2I dummy;
|
||||
dummy.SetOrigin( textBox->GetPosition() );
|
||||
dummy.SetEnd( textBox->GetEnd() );
|
||||
dummy.Normalize();
|
||||
VECTOR2I topLeft = dummy.GetPosition();
|
||||
VECTOR2I botRight = dummy.GetEnd();
|
||||
|
||||
points->AddPoint( topLeft );
|
||||
points->AddPoint( VECTOR2I( botRight.x, topLeft.y ) );
|
||||
points->AddPoint( VECTOR2I( topLeft.x, botRight.y ) );
|
||||
points->AddPoint( botRight );
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_SHEET_T:
|
||||
{
|
||||
|
@ -191,8 +236,8 @@ public:
|
|||
points->AddPoint( VECTOR2I( botRight.x, topLeft.y ) );
|
||||
points->AddPoint( VECTOR2I( topLeft.x, botRight.y ) );
|
||||
points->AddPoint( botRight );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_BITMAP_T:
|
||||
{
|
||||
|
@ -204,8 +249,8 @@ public:
|
|||
points->AddPoint( VECTOR2I( botRight.x, topLeft.y ) );
|
||||
points->AddPoint( VECTOR2I( topLeft.x, botRight.y ) );
|
||||
points->AddPoint( botRight );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_LINE_T:
|
||||
{
|
||||
|
@ -243,8 +288,8 @@ public:
|
|||
|
||||
points->AddPoint( line->GetStartPoint(), connectedStart );
|
||||
points->AddPoint( line->GetEndPoint(), connectedEnd );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
points.reset();
|
||||
|
@ -327,7 +372,9 @@ int EE_POINT_EDITOR::Main( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
static KICAD_T supportedTypes[] = {
|
||||
LIB_SHAPE_T,
|
||||
LIB_TEXTBOX_T,
|
||||
SCH_SHAPE_T,
|
||||
SCH_TEXTBOX_T,
|
||||
SCH_SHEET_T,
|
||||
SCH_ITEM_LOCATE_GRAPHIC_LINE_T,
|
||||
SCH_BITMAP_T,
|
||||
|
@ -589,8 +636,8 @@ void EE_POINT_EDITOR::updateParentItem() const
|
|||
|
||||
shape->SetPosition( mapCoords( topLeft ) );
|
||||
shape->SetEnd( mapCoords( botRight ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SHAPE_T::BEZIER:
|
||||
// TODO
|
||||
|
@ -599,8 +646,27 @@ void EE_POINT_EDITOR::updateParentItem() const
|
|||
default:
|
||||
UNIMPLEMENTED_FOR( shape->SHAPE_T_asString() );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case LIB_TEXTBOX_T:
|
||||
{
|
||||
LIB_TEXTBOX* textbox = static_cast<LIB_TEXTBOX*>( item );
|
||||
EE_GRID_HELPER gridHelper( m_toolMgr );
|
||||
VECTOR2I topLeft = m_editPoints->Point( RECT_TOPLEFT ).GetPosition();
|
||||
VECTOR2I topRight = m_editPoints->Point( RECT_TOPRIGHT ).GetPosition();
|
||||
VECTOR2I botLeft = m_editPoints->Point( RECT_BOTLEFT ).GetPosition();
|
||||
VECTOR2I botRight = m_editPoints->Point( RECT_BOTRIGHT ).GetPosition();
|
||||
|
||||
pinEditedCorner( getEditedPointIndex(), Mils2iu( 1 ), Mils2iu( 1 ),
|
||||
topLeft, topRight, botLeft, botRight, &gridHelper );
|
||||
|
||||
textbox->SetPosition( mapCoords( topLeft ) );
|
||||
textbox->SetEnd( mapCoords( botRight ) );
|
||||
textbox->UpdateTextPosition();
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_SHAPE_T:
|
||||
{
|
||||
|
@ -656,8 +722,8 @@ void EE_POINT_EDITOR::updateParentItem() const
|
|||
|
||||
shape->SetPosition( topLeft );
|
||||
shape->SetEnd( botRight );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SHAPE_T::BEZIER:
|
||||
// TODO
|
||||
|
@ -666,8 +732,27 @@ void EE_POINT_EDITOR::updateParentItem() const
|
|||
default:
|
||||
UNIMPLEMENTED_FOR( shape->SHAPE_T_asString() );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_TEXTBOX_T:
|
||||
{
|
||||
SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( item );
|
||||
EE_GRID_HELPER gridHelper( m_toolMgr );
|
||||
VECTOR2I topLeft = m_editPoints->Point( RECT_TOPLEFT ).GetPosition();
|
||||
VECTOR2I topRight = m_editPoints->Point( RECT_TOPRIGHT ).GetPosition();
|
||||
VECTOR2I botLeft = m_editPoints->Point( RECT_BOTLEFT ).GetPosition();
|
||||
VECTOR2I botRight = m_editPoints->Point( RECT_BOTRIGHT ).GetPosition();
|
||||
|
||||
pinEditedCorner( getEditedPointIndex(), Mils2iu( 1 ), Mils2iu( 1 ),
|
||||
topLeft, topRight, botLeft, botRight, &gridHelper );
|
||||
|
||||
textBox->SetPosition( topLeft );
|
||||
textBox->SetEnd( botRight );
|
||||
textBox->UpdateTextPosition();
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_BITMAP_T:
|
||||
{
|
||||
|
@ -690,8 +775,8 @@ void EE_POINT_EDITOR::updateParentItem() const
|
|||
double heightRatio = newHeight / oldHeight;
|
||||
|
||||
bitmap->SetImageScale( bitmap->GetImageScale() * std::min( widthRatio, heightRatio ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_SHEET_T:
|
||||
{
|
||||
|
@ -737,8 +822,9 @@ void EE_POINT_EDITOR::updateParentItem() const
|
|||
|
||||
pin->SetPosition( pos );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_LINE_T:
|
||||
{
|
||||
|
@ -770,8 +856,9 @@ void EE_POINT_EDITOR::updateParentItem() const
|
|||
|
||||
updateItem( connected.first, true );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -847,8 +934,8 @@ void EE_POINT_EDITOR::updatePoints()
|
|||
m_editPoints->Point( RECT_TOPRIGHT ).SetPosition( VECTOR2I( botRight.x, topLeft.y ) );
|
||||
m_editPoints->Point( RECT_BOTLEFT ).SetPosition( VECTOR2I( topLeft.x, botRight.y ) );
|
||||
m_editPoints->Point( RECT_BOTRIGHT ).SetPosition( botRight );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SHAPE_T::BEZIER:
|
||||
// TODO
|
||||
|
@ -857,8 +944,30 @@ void EE_POINT_EDITOR::updatePoints()
|
|||
default:
|
||||
UNIMPLEMENTED_FOR( shape->SHAPE_T_asString() );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case LIB_TEXTBOX_T:
|
||||
{
|
||||
LIB_TEXTBOX* textbox = static_cast<LIB_TEXTBOX*>( item );
|
||||
|
||||
// point editor works only with rectangles having width and height > 0
|
||||
// Some symbols can have rectangles with width or height < 0
|
||||
// So normalize the size:
|
||||
BOX2I dummy;
|
||||
dummy.SetOrigin( mapCoords( textbox->GetPosition() ) );
|
||||
dummy.SetEnd( mapCoords( textbox->GetEnd() ) );
|
||||
dummy.Normalize();
|
||||
VECTOR2I topLeft = dummy.GetPosition();
|
||||
VECTOR2I botRight = dummy.GetEnd();
|
||||
|
||||
m_editPoints->Point( RECT_TOPLEFT ).SetPosition( topLeft );
|
||||
m_editPoints->Point( RECT_TOPRIGHT ).SetPosition( VECTOR2I( botRight.x, topLeft.y ) );
|
||||
m_editPoints->Point( RECT_BOTLEFT ).SetPosition( VECTOR2I( topLeft.x, botRight.y ) );
|
||||
m_editPoints->Point( RECT_BOTRIGHT ).SetPosition( botRight );
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_SHAPE_T:
|
||||
{
|
||||
|
@ -913,8 +1022,8 @@ void EE_POINT_EDITOR::updatePoints()
|
|||
m_editPoints->Point( RECT_TOPRIGHT ).SetPosition( VECTOR2I( botRight.x, topLeft.y ) );
|
||||
m_editPoints->Point( RECT_BOTLEFT ).SetPosition( VECTOR2I( topLeft.x, botRight.y ) );
|
||||
m_editPoints->Point( RECT_BOTRIGHT ).SetPosition( botRight );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SHAPE_T::BEZIER:
|
||||
// TODO
|
||||
|
@ -923,8 +1032,30 @@ void EE_POINT_EDITOR::updatePoints()
|
|||
default:
|
||||
UNIMPLEMENTED_FOR( shape->SHAPE_T_asString() );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_TEXTBOX_T:
|
||||
{
|
||||
SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( item );
|
||||
|
||||
// point editor works only with rectangles having width and height > 0
|
||||
// Some symbols can have rectangles with width or height < 0
|
||||
// So normalize the size:
|
||||
BOX2I dummy;
|
||||
dummy.SetOrigin( textBox->GetPosition() );
|
||||
dummy.SetEnd( textBox->GetEnd() );
|
||||
dummy.Normalize();
|
||||
VECTOR2I topLeft = dummy.GetPosition();
|
||||
VECTOR2I botRight = dummy.GetEnd();
|
||||
|
||||
m_editPoints->Point( RECT_TOPLEFT ).SetPosition( topLeft );
|
||||
m_editPoints->Point( RECT_TOPRIGHT ).SetPosition( VECTOR2I( botRight.x, topLeft.y ) );
|
||||
m_editPoints->Point( RECT_BOTLEFT ).SetPosition( VECTOR2I( topLeft.x, botRight.y ) );
|
||||
m_editPoints->Point( RECT_BOTRIGHT ).SetPosition( botRight );
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_BITMAP_T:
|
||||
{
|
||||
|
@ -936,8 +1067,8 @@ void EE_POINT_EDITOR::updatePoints()
|
|||
m_editPoints->Point( RECT_TOPRIGHT ).SetPosition( botRight.x, topLeft.y );
|
||||
m_editPoints->Point( RECT_BOTLEFT ).SetPosition( topLeft.x, botRight.y );
|
||||
m_editPoints->Point( RECT_BOTRIGHT ).SetPosition( botRight );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_SHEET_T:
|
||||
{
|
||||
|
@ -949,8 +1080,8 @@ void EE_POINT_EDITOR::updatePoints()
|
|||
m_editPoints->Point( RECT_TOPRIGHT ).SetPosition( botRight.x, topLeft.y );
|
||||
m_editPoints->Point( RECT_BOTLEFT ).SetPosition( topLeft.x, botRight.y );
|
||||
m_editPoints->Point( RECT_BOTRIGHT ).SetPosition( botRight );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_LINE_T:
|
||||
{
|
||||
|
@ -958,8 +1089,8 @@ void EE_POINT_EDITOR::updatePoints()
|
|||
|
||||
m_editPoints->Point( LINE_START ).SetPosition( line->GetStartPoint() );
|
||||
m_editPoints->Point( LINE_END ).SetPosition( line->GetEndPoint() );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <sch_junction.h>
|
||||
#include <sch_bus_entry.h>
|
||||
#include <sch_text.h>
|
||||
#include <sch_textbox.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <sch_sheet_pin.h>
|
||||
#include <sch_bitmap.h>
|
||||
|
@ -1057,7 +1058,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
else if( isNetLabel )
|
||||
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::LABEL_NET );
|
||||
else if( isClassLabel )
|
||||
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::LABEL_NET ); // JEY TODO: LABEL_CLASS cursor
|
||||
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::LABEL_NET ); // JEY TODO: netclass directive cursor
|
||||
else if( isHierLabel )
|
||||
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::LABEL_HIER );
|
||||
else
|
||||
|
@ -1299,6 +1300,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
else
|
||||
m_inDrawShape = true;
|
||||
|
||||
bool isTextBox = aEvent.IsAction( &EE_ACTIONS::drawTextBox );
|
||||
SHAPE_T type = aEvent.Parameter<SHAPE_T>();
|
||||
|
||||
// We might be running as the same shape in another co-routine. Make sure that one
|
||||
|
@ -1390,7 +1392,11 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
|
||||
int lineWidth = Mils2iu( cfg->m_Drawing.default_line_thickness );
|
||||
|
||||
item = new SCH_SHAPE( type, lineWidth, m_lastFillStyle );
|
||||
if( isTextBox )
|
||||
item = new SCH_TEXTBOX( lineWidth, m_lastFillStyle );
|
||||
else
|
||||
item = new SCH_SHAPE( type, lineWidth, m_lastFillStyle );
|
||||
|
||||
item->SetFlags( IS_NEW );
|
||||
item->BeginEdit( (wxPoint) cursorPos );
|
||||
|
||||
|
@ -1407,6 +1413,17 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
item->ClearEditFlags();
|
||||
item->SetFlags( IS_NEW );
|
||||
|
||||
if( isTextBox )
|
||||
{
|
||||
DIALOG_TEXT_PROPERTIES dlg( m_frame, item );
|
||||
|
||||
if( dlg.ShowQuasiModal() != wxID_OK )
|
||||
{
|
||||
cleanup();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), item, false );
|
||||
m_selectionTool->AddItemToSel( item );
|
||||
item = nullptr;
|
||||
|
@ -1664,5 +1681,6 @@ void SCH_DRAWING_TOOLS::setTransitions()
|
|||
Go( &SCH_DRAWING_TOOLS::DrawShape, EE_ACTIONS::drawRectangle.MakeEvent() );
|
||||
Go( &SCH_DRAWING_TOOLS::DrawShape, EE_ACTIONS::drawCircle.MakeEvent() );
|
||||
Go( &SCH_DRAWING_TOOLS::DrawShape, EE_ACTIONS::drawArc.MakeEvent() );
|
||||
Go( &SCH_DRAWING_TOOLS::DrawShape, EE_ACTIONS::drawTextBox.MakeEvent() );
|
||||
Go( &SCH_DRAWING_TOOLS::PlaceImage, EE_ACTIONS::placeImage.MakeEvent() );
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <sch_sheet.h>
|
||||
#include <sch_sheet_pin.h>
|
||||
#include <sch_text.h>
|
||||
#include <sch_textbox.h>
|
||||
#include <sch_bitmap.h>
|
||||
#include <sch_view.h>
|
||||
#include <sch_line.h>
|
||||
|
@ -250,6 +251,7 @@ bool SCH_EDIT_TOOL::Init()
|
|||
case SCH_SHEET_T:
|
||||
case SCH_SHEET_PIN_T:
|
||||
case SCH_TEXT_T:
|
||||
case SCH_TEXTBOX_T:
|
||||
case SCH_LABEL_T:
|
||||
case SCH_GLOBAL_LABEL_T:
|
||||
case SCH_HIER_LABEL_T:
|
||||
|
@ -430,6 +432,7 @@ bool SCH_EDIT_TOOL::Init()
|
|||
const KICAD_T rotatableItems[] = {
|
||||
SCH_SHAPE_T,
|
||||
SCH_TEXT_T,
|
||||
SCH_TEXTBOX_T,
|
||||
SCH_LABEL_T,
|
||||
SCH_GLOBAL_LABEL_T,
|
||||
SCH_HIER_LABEL_T,
|
||||
|
@ -482,8 +485,10 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
if( moving && selection.HasReferencePoint() )
|
||||
rotPoint = selection.GetReferencePoint();
|
||||
else
|
||||
else if( head->IsConnectable() )
|
||||
rotPoint = head->GetPosition();
|
||||
else
|
||||
rotPoint = m_frame->GetNearestHalfGridPosition( head->GetBoundingBox().GetCenter() );
|
||||
|
||||
if( !moving )
|
||||
saveCopyInUndoList( head, UNDO_REDO::CHANGED );
|
||||
|
@ -550,12 +555,12 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
case SCH_SHAPE_T:
|
||||
case SCH_TEXTBOX_T:
|
||||
for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
|
||||
head->Rotate( rotPoint );
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case SCH_BITMAP_T:
|
||||
for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
|
||||
head->Rotate( rotPoint );
|
||||
|
@ -731,6 +736,18 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
|
|||
break;
|
||||
}
|
||||
|
||||
case SCH_TEXTBOX_T:
|
||||
{
|
||||
SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( item );
|
||||
|
||||
if( vertical )
|
||||
textBox->MirrorVertically( mirrorPoint.y );
|
||||
else
|
||||
textBox->MirrorHorizontally( mirrorPoint.x );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_SHEET_PIN_T:
|
||||
{
|
||||
// mirror within parent sheet
|
||||
|
@ -947,6 +964,7 @@ static KICAD_T deletableItems[] =
|
|||
SCH_BUS_WIRE_ENTRY_T,
|
||||
SCH_SHAPE_T,
|
||||
SCH_TEXT_T,
|
||||
SCH_TEXTBOX_T,
|
||||
SCH_LABEL_T,
|
||||
SCH_GLOBAL_LABEL_T,
|
||||
SCH_HIER_LABEL_T,
|
||||
|
@ -1456,8 +1474,9 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
break;
|
||||
|
||||
case SCH_TEXT_T:
|
||||
case SCH_TEXTBOX_T:
|
||||
{
|
||||
DIALOG_TEXT_PROPERTIES dlg( m_frame, static_cast<SCH_TEXT*>( item ) );
|
||||
DIALOG_TEXT_PROPERTIES dlg( m_frame, static_cast<SCH_ITEM*>( item ) );
|
||||
|
||||
// Must be quasi modal for syntax help
|
||||
if( dlg.ShowQuasiModal() == wxID_OK )
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
#include <sch_screen.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <sch_sheet_pin.h>
|
||||
#include <sch_text.h>
|
||||
#include <schematic.h>
|
||||
#include <ee_actions.h>
|
||||
#include <ee_grid_helper.h>
|
||||
|
|
|
@ -585,7 +585,7 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, const VECTOR
|
|||
{
|
||||
if( item->Type() == SCH_LABEL_T || item->Type() == SCH_DIRECTIVE_LABEL_T )
|
||||
{
|
||||
SCH_TEXT* label = static_cast<SCH_TEXT*>( item );
|
||||
SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( item );
|
||||
|
||||
if( label->IsSelected() )
|
||||
continue; // These will be moved on their own because they're selected
|
||||
|
@ -655,9 +655,10 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aOriginalItem, const VECTOR
|
|||
// Select labels that are connected to a wire (or bus) being moved.
|
||||
if( aOriginalItem->Type() == SCH_LINE_T && test->CanConnect( aOriginalItem ) )
|
||||
{
|
||||
SCH_TEXT* label = static_cast<SCH_TEXT*>( test );
|
||||
SCH_LINE* line = static_cast<SCH_LINE*>( aOriginalItem );
|
||||
bool oneEndFixed = !line->HasFlag( STARTPOINT ) || !line->HasFlag( ENDPOINT );
|
||||
SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( test );
|
||||
SCH_LINE* line = static_cast<SCH_LINE*>( aOriginalItem );
|
||||
|
||||
bool oneEndFixed = !line->HasFlag( STARTPOINT ) || !line->HasFlag( ENDPOINT );
|
||||
|
||||
if( line->HitTest( label->GetTextPos(), 1 ) )
|
||||
{
|
||||
|
@ -776,7 +777,7 @@ void SCH_MOVE_TOOL::moveItem( EDA_ITEM* aItem, const VECTOR2I& aDelta )
|
|||
case SCH_LABEL_T:
|
||||
case SCH_DIRECTIVE_LABEL_T:
|
||||
{
|
||||
SCH_TEXT* label = static_cast<SCH_TEXT*>( aItem );
|
||||
SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( aItem );
|
||||
|
||||
if( m_specialCaseLabels.count( label ) )
|
||||
{
|
||||
|
|
|
@ -92,7 +92,7 @@ private:
|
|||
|
||||
// A map of labels to scaling factors. Used to scale the movement vector for labels that
|
||||
// are attached to wires which have only one end moving.
|
||||
std::map<SCH_TEXT*, SPECIAL_CASE_LABEL_INFO> m_specialCaseLabels;
|
||||
std::map<SCH_LABEL_BASE*, SPECIAL_CASE_LABEL_INFO> m_specialCaseLabels;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -29,10 +29,12 @@
|
|||
#include <lib_text.h>
|
||||
#include <dialogs/dialog_lib_text_properties.h>
|
||||
#include <lib_shape.h>
|
||||
#include <lib_textbox.h>
|
||||
#include <pgm_base.h>
|
||||
#include <symbol_editor/symbol_editor_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <string_utils.h>
|
||||
#include "dialog_lib_textbox_properties.h"
|
||||
|
||||
static void* g_lastPinWeakPtr;
|
||||
|
||||
|
@ -162,7 +164,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
case LIB_PIN_T:
|
||||
{
|
||||
item = pinTool->CreatePin( wxPoint( cursorPos.x, -cursorPos.y ), symbol );
|
||||
item = pinTool->CreatePin( VECTOR2I( cursorPos.x, -cursorPos.y ), symbol );
|
||||
g_lastPinWeakPtr = item;
|
||||
break;
|
||||
}
|
||||
|
@ -170,7 +172,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
LIB_TEXT* text = new LIB_TEXT( symbol );
|
||||
|
||||
text->SetPosition( wxPoint( cursorPos.x, -cursorPos.y ) );
|
||||
text->SetPosition( VECTOR2I( cursorPos.x, -cursorPos.y ) );
|
||||
text->SetTextSize( wxSize( Mils2iu( settings->m_Defaults.text_size ),
|
||||
Mils2iu( settings->m_Defaults.text_size ) ) );
|
||||
text->SetTextAngle( m_lastTextAngle );
|
||||
|
@ -239,7 +241,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
|
||||
{
|
||||
static_cast<LIB_ITEM*>( item )->SetPosition( wxPoint( cursorPos.x, -cursorPos.y ) );
|
||||
static_cast<LIB_ITEM*>( item )->SetPosition( VECTOR2I( cursorPos.x, -cursorPos.y ) );
|
||||
m_view->ClearPreview();
|
||||
m_view->AddToPreview( item->Clone() );
|
||||
}
|
||||
|
@ -267,6 +269,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
SHAPE_T type = aEvent.Parameter<SHAPE_T>();
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
LIB_ITEM* item = nullptr;
|
||||
bool isTextBox = aEvent.IsAction( &EE_ACTIONS::drawSymbolTextBox );
|
||||
|
||||
// We might be running as the same shape in another co-routine. Make sure that one
|
||||
// gets whacked.
|
||||
|
@ -353,9 +356,13 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
|
||||
int lineWidth = Mils2iu( settings->m_Defaults.line_width );
|
||||
|
||||
item = new LIB_SHAPE( symbol, type, lineWidth, m_lastFillStyle );
|
||||
if( isTextBox )
|
||||
item = new LIB_TEXTBOX( symbol, lineWidth, m_lastFillStyle );
|
||||
else
|
||||
item = new LIB_SHAPE( symbol, type, lineWidth, m_lastFillStyle );
|
||||
|
||||
item->SetFlags( IS_NEW );
|
||||
item->BeginEdit( wxPoint( cursorPos.x, -cursorPos.y ) );
|
||||
item->BeginEdit( VECTOR2I( cursorPos.x, -cursorPos.y ) );
|
||||
|
||||
if( m_drawSpecificUnit )
|
||||
item->SetUnit( m_frame->GetUnit() );
|
||||
|
@ -375,10 +382,22 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
if( evt->IsDblClick( BUT_LEFT ) || evt->IsAction( &EE_ACTIONS::finishDrawing )
|
||||
|| !item->ContinueEdit( wxPoint( cursorPos.x, -cursorPos.y ) ) )
|
||||
|| !item->ContinueEdit( VECTOR2I( cursorPos.x, -cursorPos.y ) ) )
|
||||
{
|
||||
item->EndEdit();
|
||||
item->ClearEditFlags();
|
||||
|
||||
if( isTextBox )
|
||||
{
|
||||
DIALOG_LIB_TEXTBOX_PROPERTIES dlg( m_frame, static_cast<LIB_TEXTBOX*>( item ) );
|
||||
|
||||
if( dlg.ShowQuasiModal() != wxID_OK )
|
||||
{
|
||||
cleanup();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
m_view->ClearPreview();
|
||||
|
||||
m_frame->SaveCopyInUndoList( symbol );
|
||||
|
@ -392,7 +411,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
|
||||
{
|
||||
item->CalcEdit( wxPoint( cursorPos.x, -cursorPos.y ) );
|
||||
item->CalcEdit( VECTOR2I( cursorPos.x, -cursorPos.y ) );
|
||||
m_view->ClearPreview();
|
||||
m_view->AddToPreview( item->Clone() );
|
||||
}
|
||||
|
@ -465,7 +484,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor( const TOOL_EVENT& aEvent )
|
|||
continue;
|
||||
|
||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->DisableGridSnapping() );
|
||||
wxPoint offset( -cursorPos.x, cursorPos.y );
|
||||
VECTOR2I offset( -cursorPos.x, cursorPos.y );
|
||||
|
||||
symbol->SetOffset( offset );
|
||||
|
||||
|
@ -531,6 +550,7 @@ void SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions()
|
|||
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape, EE_ACTIONS::drawCircle.MakeEvent() );
|
||||
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape, EE_ACTIONS::drawArc.MakeEvent() );
|
||||
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape, EE_ACTIONS::drawSymbolLines.MakeEvent() );
|
||||
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape, EE_ACTIONS::drawSymbolTextBox.MakeEvent() );
|
||||
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor, EE_ACTIONS::placeSymbolAnchor.MakeEvent() );
|
||||
Go( &SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem, EE_ACTIONS::repeatDrawItem.MakeEvent() );
|
||||
}
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#include <sch_plugins/kicad/sch_sexpr_plugin.h>
|
||||
#include <lib_text.h>
|
||||
#include "symbol_editor_edit_tool.h"
|
||||
#include "dialog_lib_textbox_properties.h"
|
||||
#include "lib_textbox.h"
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
SYMBOL_EDITOR_EDIT_TOOL::SYMBOL_EDITOR_EDIT_TOOL() :
|
||||
|
@ -440,6 +442,10 @@ int SYMBOL_EDITOR_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
editTextProperties( item );
|
||||
break;
|
||||
|
||||
case LIB_TEXTBOX_T:
|
||||
editTextBoxProperties( item );
|
||||
break;
|
||||
|
||||
case LIB_FIELD_T:
|
||||
editFieldProperties( (LIB_FIELD*) item );
|
||||
break;
|
||||
|
@ -485,7 +491,23 @@ void SYMBOL_EDITOR_EDIT_TOOL::editTextProperties( LIB_ITEM* aItem )
|
|||
if ( aItem->Type() != LIB_TEXT_T )
|
||||
return;
|
||||
|
||||
DIALOG_LIB_TEXT_PROPERTIES dlg( m_frame, (LIB_TEXT*) aItem );
|
||||
DIALOG_LIB_TEXT_PROPERTIES dlg( m_frame, static_cast<LIB_TEXT*>( aItem ) );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
updateItem( aItem, true );
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
m_frame->OnModify( );
|
||||
}
|
||||
|
||||
|
||||
void SYMBOL_EDITOR_EDIT_TOOL::editTextBoxProperties( LIB_ITEM* aItem )
|
||||
{
|
||||
if ( aItem->Type() != LIB_TEXTBOX_T )
|
||||
return;
|
||||
|
||||
DIALOG_LIB_TEXTBOX_PROPERTIES dlg( m_frame, static_cast<LIB_TEXTBOX*>( aItem ) );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
|
|
@ -66,6 +66,7 @@ public:
|
|||
private:
|
||||
void editShapeProperties( LIB_ITEM* aItem );
|
||||
void editTextProperties( LIB_ITEM* aItem );
|
||||
void editTextBoxProperties( LIB_ITEM* aItem );
|
||||
void editFieldProperties( LIB_FIELD* aField );
|
||||
void editSymbolProperties();
|
||||
|
||||
|
|
|
@ -192,6 +192,7 @@ const std::vector<BITMAP_INFO> g_BitmapInfo = {
|
|||
{ BITMAPS::add_radial_dimension, wxT( "add_radial_dimension_24.png" ), 24, wxT( "light" ) },
|
||||
{ BITMAPS::add_rectangle, wxT( "add_rectangle_24.png" ), 24, wxT( "light" ) },
|
||||
{ BITMAPS::add_symbol_to_schematic, wxT( "add_symbol_to_schematic_24.png" ), 24, wxT( "light" ) },
|
||||
{ BITMAPS::add_textbox, wxT( "add_textbox_24.png" ), 24, wxT( "light" ) },
|
||||
{ BITMAPS::add_tracks, wxT( "add_tracks_24.png" ), 24, wxT( "light" ) },
|
||||
{ BITMAPS::add_via, wxT( "add_via_24.png" ), 24, wxT( "light" ) },
|
||||
{ BITMAPS::add_zone_cutout, wxT( "add_zone_cutout_24.png" ), 24, wxT( "light" ) },
|
||||
|
|
|
@ -72,6 +72,7 @@ enum class BITMAPS : unsigned int
|
|||
add_radial_dimension,
|
||||
add_rectangle,
|
||||
add_symbol_to_schematic,
|
||||
add_textbox,
|
||||
add_tracks,
|
||||
add_via,
|
||||
add_zone,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 CERN
|
||||
* Copyright (C) 2004-2021 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2004-2022 KiCad Developers, see change_log.txt for contributors.
|
||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -134,6 +134,7 @@ enum KICAD_T
|
|||
SCH_LINE_T,
|
||||
SCH_SHAPE_T,
|
||||
SCH_BITMAP_T,
|
||||
SCH_TEXTBOX_T,
|
||||
SCH_TEXT_T,
|
||||
SCH_LABEL_T,
|
||||
SCH_GLOBAL_LABEL_T,
|
||||
|
@ -186,6 +187,7 @@ enum KICAD_T
|
|||
LIB_ALIAS_T,
|
||||
LIB_SHAPE_T,
|
||||
LIB_TEXT_T,
|
||||
LIB_TEXTBOX_T,
|
||||
LIB_PIN_T,
|
||||
|
||||
/*
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <wx/string.h>
|
||||
|
||||
#include <utf8.h>
|
||||
#include <font/glyph.h>
|
||||
#include <font/text_attributes.h>
|
||||
|
||||
|
@ -123,10 +121,10 @@ public:
|
|||
* object, such as a run of superscript characters)
|
||||
* @param aAttrs are the styling attributes of the text, including its rotation
|
||||
*/
|
||||
void Draw( KIGFX::GAL* aGal, const UTF8& aText, const VECTOR2I& aPosition,
|
||||
void Draw( KIGFX::GAL* aGal, const wxString& aText, const VECTOR2I& aPosition,
|
||||
const VECTOR2I& aCursor, const TEXT_ATTRIBUTES& aAttrs ) const;
|
||||
|
||||
void Draw( KIGFX::GAL* aGal, const UTF8& aText, const VECTOR2I& aPosition,
|
||||
void Draw( KIGFX::GAL* aGal, const wxString& aText, const VECTOR2I& aPosition,
|
||||
const TEXT_ATTRIBUTES& aAttributes ) const
|
||||
{
|
||||
Draw( aGal, aText, aPosition, VECTOR2I( 0, 0 ), aAttributes );
|
||||
|
@ -137,9 +135,15 @@ public:
|
|||
*
|
||||
* @return a VECTOR2I giving the width and height of text.
|
||||
*/
|
||||
VECTOR2I StringBoundaryLimits( const UTF8& aText, const VECTOR2I& aSize, int aThickness,
|
||||
VECTOR2I StringBoundaryLimits( const wxString& aText, const VECTOR2I& aSize, int aThickness,
|
||||
bool aBold, bool aItalic ) const;
|
||||
|
||||
/**
|
||||
* Insert \n characters into text to ensure that no lines are wider than \a aColumnWidth.
|
||||
*/
|
||||
void LinebreakText( wxString& aText, int aColumnWidth, const VECTOR2I& aGlyphSize,
|
||||
int aThickness, bool aBold, bool aItalic ) const;
|
||||
|
||||
/**
|
||||
* Compute the vertical position of an overbar. This is the distance between the text
|
||||
* baseline and the overbar.
|
||||
|
@ -167,7 +171,7 @@ public:
|
|||
* @return text cursor position after this text
|
||||
*/
|
||||
virtual VECTOR2I GetTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_ptr<GLYPH>>* aGlyphs,
|
||||
const UTF8& aText, const VECTOR2I& aSize,
|
||||
const wxString& aText, const VECTOR2I& aSize,
|
||||
const VECTOR2I& aPosition, const EDA_ANGLE& aAngle,
|
||||
bool aMirror, const VECTOR2I& aOrigin,
|
||||
TEXT_STYLE_FLAGS aTextStyle ) const = 0;
|
||||
|
@ -179,7 +183,7 @@ protected:
|
|||
* @param aText is the text to be checked.
|
||||
* @return unsigned - The number of lines in aText.
|
||||
*/
|
||||
inline unsigned linesCount( const UTF8& aText ) const
|
||||
inline unsigned linesCount( const wxString& aText ) const
|
||||
{
|
||||
if( aText.empty() )
|
||||
return 0; // std::count does not work well with empty strings
|
||||
|
@ -202,7 +206,7 @@ protected:
|
|||
* @param aOrigin is the point around which the text should be rotated, mirrored, etc.
|
||||
* @return new cursor position in non-rotated, non-mirrored coordinates
|
||||
*/
|
||||
void drawSingleLineText( KIGFX::GAL* aGal, BOX2I* aBoundingBox, const UTF8& aText,
|
||||
void drawSingleLineText( KIGFX::GAL* aGal, BOX2I* aBoundingBox, const wxString& aText,
|
||||
const VECTOR2I& aPosition, const VECTOR2I& aSize,
|
||||
const EDA_ANGLE& aAngle, bool aMirror, const VECTOR2I& aOrigin,
|
||||
bool aItalic ) const;
|
||||
|
@ -217,18 +221,21 @@ protected:
|
|||
* @param aSize is the cap-height and em-width of the text.
|
||||
* @return new cursor position
|
||||
*/
|
||||
VECTOR2I boundingBoxSingleLine( BOX2I* aBBox, const UTF8& aText, const VECTOR2I& aPosition,
|
||||
VECTOR2I boundingBoxSingleLine( BOX2I* aBBox, const wxString& aText, const VECTOR2I& aPosition,
|
||||
const VECTOR2I& aSize, bool aItalic ) const;
|
||||
|
||||
void getLinePositions( const UTF8& aText, const VECTOR2I& aPosition,
|
||||
void getLinePositions( const wxString& aText, const VECTOR2I& aPosition,
|
||||
wxArrayString& aTextLines, std::vector<VECTOR2I>& aPositions,
|
||||
std::vector<VECTOR2I>& aExtents, const TEXT_ATTRIBUTES& aAttrs ) const;
|
||||
|
||||
VECTOR2I drawMarkup( BOX2I* aBoundingBox, std::vector<std::unique_ptr<GLYPH>>* aGlyphs,
|
||||
const UTF8& aText, const VECTOR2I& aPosition, const VECTOR2I& aSize,
|
||||
const wxString& aText, const VECTOR2I& aPosition, const VECTOR2I& aSize,
|
||||
const EDA_ANGLE& aAngle, bool aMirror, const VECTOR2I& aOrigin,
|
||||
TEXT_STYLE_FLAGS aTextStyle ) const;
|
||||
|
||||
void wordbreakMarkup( std::vector<std::pair<wxString, int>>* aWords, const wxString& aText,
|
||||
const VECTOR2I& aSize, TEXT_STYLE_FLAGS aTextStyle ) const;
|
||||
|
||||
///< Factor that determines the pitch between 2 lines.
|
||||
static constexpr double INTERLINE_PITCH_RATIO = 1.62; // The golden mean
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
* @param aAttributes contains text attributes (angle, line spacing, ...)
|
||||
* @return bounding box width/height
|
||||
*/
|
||||
VECTOR2D Draw( KIGFX::GAL* aGal, const UTF8& aText, const VECTOR2D& aPosition,
|
||||
VECTOR2D Draw( KIGFX::GAL* aGal, const wxString& aText, const VECTOR2D& aPosition,
|
||||
const VECTOR2D& aOrigin, const TEXT_ATTRIBUTES& aAttributes ) const override;
|
||||
#endif
|
||||
|
||||
|
@ -100,9 +100,9 @@ public:
|
|||
double GetInterline( double aGlyphHeight = 0.0, double aLineSpacing = 1.0 ) const override;
|
||||
|
||||
VECTOR2I GetTextAsGlyphs( BOX2I* aBoundingBox, std::vector<std::unique_ptr<GLYPH>>* aGlyphs,
|
||||
const UTF8& aText, const VECTOR2I& aSize, const VECTOR2I& aPosition,
|
||||
const EDA_ANGLE& aAngle, bool aMirror, const VECTOR2I& aOrigin,
|
||||
TEXT_STYLE_FLAGS aTextStyle ) const override;
|
||||
const wxString& aText, const VECTOR2I& aSize,
|
||||
const VECTOR2I& aPosition, const EDA_ANGLE& aAngle, bool aMirror,
|
||||
const VECTOR2I& aOrigin, TEXT_STYLE_FLAGS aTextStyle ) const override;
|
||||
|
||||
/**
|
||||
* Like GetTextAsGlyphs, but handles multiple lines.
|
||||
|
@ -115,13 +115,13 @@ public:
|
|||
void GetLinesAsGlyphs( std::vector<std::unique_ptr<GLYPH>>* aGlyphs,
|
||||
const EDA_TEXT* aText ) const;
|
||||
|
||||
void GetLinesAsGlyphs( std::vector<std::unique_ptr<GLYPH>>* aGlyphs, const UTF8& aText,
|
||||
void GetLinesAsGlyphs( std::vector<std::unique_ptr<GLYPH>>* aGlyphs, const wxString& aText,
|
||||
const VECTOR2I& aPosition, const TEXT_ATTRIBUTES& aAttrs ) const;
|
||||
|
||||
const FT_Face& GetFace() const { return m_face; }
|
||||
|
||||
#if 0
|
||||
void RenderToOpenGLCanvas( KIGFX::OPENGL_FREETYPE& aTarget, const UTF8& aString,
|
||||
void RenderToOpenGLCanvas( KIGFX::OPENGL_FREETYPE& aTarget, const wxString& aString,
|
||||
const VECTOR2D& aSize, const wxPoint& aPosition,
|
||||
const EDA_ANGLE& aAngle, bool aMirror ) const;
|
||||
#endif
|
||||
|
|
|
@ -77,9 +77,9 @@ public:
|
|||
double GetInterline( double aGlyphHeight, double aLineSpacing = 1.0 ) const override;
|
||||
|
||||
VECTOR2I GetTextAsGlyphs( BOX2I* aBoundingBox, std::vector<std::unique_ptr<GLYPH>>* aGlyphs,
|
||||
const UTF8& aText, const VECTOR2I& aSize, const VECTOR2I& aPosition,
|
||||
const EDA_ANGLE& aAngle, bool aMirror, const VECTOR2I& aOrigin,
|
||||
TEXT_STYLE_FLAGS aTextStyle ) const override;
|
||||
const wxString& aText, const VECTOR2I& aSize,
|
||||
const VECTOR2I& aPosition, const EDA_ANGLE& aAngle, bool aMirror,
|
||||
const VECTOR2I& aOrigin, TEXT_STYLE_FLAGS aTextStyle ) const override;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
|
|
@ -217,6 +217,12 @@ public:
|
|||
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
|
||||
int width = USE_DEFAULT_LINE_WIDTH ) = 0;
|
||||
|
||||
/**
|
||||
* Generic fallback: arc rendered as a polyline.
|
||||
*/
|
||||
virtual void Arc( const VECTOR2I& aCenter, const VECTOR2I& aStart, const VECTOR2I& aEnd,
|
||||
FILL_T aFill, int aWidth, int aMaxError );
|
||||
|
||||
/**
|
||||
* Generic fallback: arc rendered as a polyline.
|
||||
*/
|
||||
|
|
|
@ -204,9 +204,8 @@ public:
|
|||
int width = USE_DEFAULT_LINE_WIDTH ) override;
|
||||
virtual void Circle( const VECTOR2I& pos, int diametre, FILL_T fill,
|
||||
int width = USE_DEFAULT_LINE_WIDTH ) override;
|
||||
virtual void Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
|
||||
const EDA_ANGLE& aEndAngle, int aRadius, FILL_T aFill,
|
||||
int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
|
||||
virtual void Arc( const VECTOR2I& aCenter, const VECTOR2I& aStart, const VECTOR2I& aEnd,
|
||||
FILL_T aFill, int aWidth, int aMaxError ) override;
|
||||
|
||||
virtual void PlotPoly( const std::vector<VECTOR2I>& aCornerList, FILL_T aFill,
|
||||
int aWidth = USE_DEFAULT_LINE_WIDTH, void* aData = nullptr ) override;
|
||||
|
@ -322,10 +321,13 @@ public:
|
|||
int width = USE_DEFAULT_LINE_WIDTH ) override;
|
||||
|
||||
/**
|
||||
* The PDF engine can't directly plot arcs, it uses the base emulation.
|
||||
* So no filled arcs (not a great loss... )
|
||||
* The PDF engine can't directly plot arcs so we use polygonization.
|
||||
*/
|
||||
virtual void Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle, const EDA_ANGLE& aEndAngle, int aRadius,
|
||||
virtual void Arc( const VECTOR2I& aCenter, const VECTOR2I& aStart, const VECTOR2I& aEnd,
|
||||
FILL_T aFill, int aWidth, int aMaxError ) override;
|
||||
|
||||
virtual void Arc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
|
||||
const EDA_ANGLE& aEndAngle, int aRadius,
|
||||
FILL_T aFill, int aWidth = USE_DEFAULT_LINE_WIDTH ) override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <sch_shape.h>
|
||||
#include <sch_bitmap.h>
|
||||
#include <sch_text.h>
|
||||
#include <sch_textbox.h>
|
||||
#include <sch_field.h>
|
||||
#include <sch_symbol.h>
|
||||
#include <sch_sheet_pin.h>
|
||||
|
@ -44,6 +45,7 @@
|
|||
|
||||
#include <lib_shape.h>
|
||||
#include <lib_text.h>
|
||||
#include <lib_textbox.h>
|
||||
#include <lib_pin.h>
|
||||
#include <lib_field.h>
|
||||
|
||||
|
@ -86,6 +88,7 @@ public:
|
|||
case SCH_SHAPE_T: return new SCH_SHAPE( SHAPE_T::ARC );
|
||||
case SCH_BITMAP_T: return new SCH_BITMAP();
|
||||
case SCH_TEXT_T: return new SCH_TEXT( wxPoint( 0, 0 ), "test text" );
|
||||
case SCH_TEXTBOX_T: return new SCH_TEXTBOX( 0, FILL_T::NO_FILL, "test textbox" );
|
||||
case SCH_LABEL_T: return new SCH_LABEL( wxPoint( 0, 0 ), "test label" );
|
||||
case SCH_DIRECTIVE_LABEL_T: return new SCH_DIRECTIVE_LABEL( wxPoint( 0, 0 ) );
|
||||
case SCH_GLOBAL_LABEL_T: return new SCH_GLOBALLABEL();
|
||||
|
@ -103,6 +106,7 @@ public:
|
|||
case SCH_SHEET_T: return new SCH_SHEET();
|
||||
case LIB_SHAPE_T: return new LIB_SHAPE( &m_symbol, SHAPE_T::ARC );
|
||||
case LIB_TEXT_T: return new LIB_TEXT( &m_symbol );
|
||||
case LIB_TEXTBOX_T: return new LIB_TEXTBOX( &m_symbol, 0, FILL_T::NO_FILL, "test" );
|
||||
case LIB_PIN_T: return new LIB_PIN( &m_symbol );
|
||||
case LIB_FIELD_T: return new LIB_FIELD( &m_symbol );
|
||||
|
||||
|
|
Loading…
Reference in New Issue