Bring EEschema textboxes in line with PCBNew's.

Also adds Border checkboxes and fixes a bunch of bugs.
This commit is contained in:
Jeff Young 2022-01-31 19:11:21 +00:00
parent 5739505aa3
commit f3cd36d1d7
28 changed files with 2254 additions and 1473 deletions

View File

@ -124,6 +124,7 @@ set( BMAPS_SMALL
text_align_center
text_align_right
text_align_bottom
text_align_middle
text_align_top
text_valign_top
text_valign_center

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 B

View File

@ -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="text_align_middle.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="1432"
inkscape:window-height="800"
id="namedview30"
showgrid="true"
inkscape:zoom="21.189179"
inkscape:cx="12.468206"
inkscape:cy="13.225764"
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_glabel</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="defs174">
<style
id="style172">.cls-1,.cls-2{fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:2px;}.cls-1{stroke:#1a81c4;}.cls-2{stroke:#545454;}.cls-3{fill:#545454;}</style>
</defs>
<title
id="title176">add_glabel</title>
<path
style="fill:#333333;stroke:#333333;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 5.5,20 V 3"
id="path1471" />
<path
style="fill:none;stroke:#333333;stroke-width:0.978945;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 8.5,17.33 V 5.83"
id="path1473" />
<path
style="fill:none;stroke:#333333;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 11.5,20 V 3"
id="path1475" />
<path
style="fill:none;stroke:#333333;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 17.5,20 V 3"
id="path1477" />
<path
style="fill:none;stroke:#333333;stroke-width:0.945751;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 14.5,17.083333 V 6.35"
id="path1479" />
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -22,6 +22,7 @@
*/
#include <symbol_edit_frame.h>
#include <symbol_editor_settings.h>
#include <widgets/bitmap_button.h>
#include <widgets/font_choice.h>
#include <base_units.h>
@ -77,11 +78,15 @@ DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES( SYMBOL_EDIT_FRAME*
m_spin0->SetIsCheckButton();
m_spin0->SetBitmap( KiBitmap( BITMAPS::text_align_left ) );
m_spin1->SetIsCheckButton();
m_spin1->SetBitmap( KiBitmap( BITMAPS::text_align_right ) );
m_spin1->SetBitmap( KiBitmap( BITMAPS::text_align_center ) );
m_spin2->SetIsCheckButton();
m_spin2->SetBitmap( KiBitmap( BITMAPS::text_align_bottom ) );
m_spin2->SetBitmap( KiBitmap( BITMAPS::text_align_right ) );
m_spin3->SetIsCheckButton();
m_spin3->SetBitmap( KiBitmap( BITMAPS::text_align_top ) );
m_spin3->SetBitmap( KiBitmap( BITMAPS::text_align_bottom ) );
m_spin4->SetIsCheckButton();
m_spin4->SetBitmap( KiBitmap( BITMAPS::text_align_middle ) );
m_spin5->SetIsCheckButton();
m_spin5->SetBitmap( KiBitmap( BITMAPS::text_align_top ) );
m_separator3->SetIsSeparator();
@ -92,8 +97,8 @@ DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES( SYMBOL_EDIT_FRAME*
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 );
m_spin4->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onSpinButton, this );
m_spin5->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onSpinButton, this );
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
@ -122,6 +127,7 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow()
m_bold->Check( m_currentText->IsBold() );
m_italic->Check( m_currentText->IsItalic() );
m_borderCheckbox->SetValue( m_currentText->GetWidth() >= 0 );
m_borderWidth.SetValue( m_currentText->GetWidth() );
m_borderColorSwatch->SetSwatchColor( m_currentText->GetStroke().GetColor(), false );
@ -134,22 +140,35 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow()
else
wxFAIL_MSG( "Line type not found in the type lookup map" );
m_borderWidth.Enable( m_currentText->GetWidth() >= 0 );
m_borderColorLabel->Enable( m_currentText->GetWidth() >= 0 );
m_borderColorSwatch->Enable( m_currentText->GetWidth() >= 0 );
m_borderStyleLabel->Enable( m_currentText->GetWidth() >= 0 );
m_borderStyleCombo->Enable( m_currentText->GetWidth() >= 0 );
m_filledCtrl->SetValue( m_currentText->IsFilled() );
m_fillColorSwatch->SetSwatchColor( m_currentText->GetFillColor(), false );
m_fillColorLabel->Enable( m_currentText->IsFilled() );
m_fillColorSwatch->Enable( m_currentText->IsFilled() );
if( m_currentText->GetTextAngle() == ANGLE_VERTICAL )
{
if( m_currentText->GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
m_spin3->Check();
else
m_spin2->Check();
switch( m_currentText->GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT: m_spin3->Check(); break;
case GR_TEXT_H_ALIGN_CENTER: m_spin4->Check(); break;
case GR_TEXT_H_ALIGN_RIGHT: m_spin5->Check(); break;
}
}
else
{
if( m_currentText->GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
m_spin1->Check();
else
m_spin0->Check();
switch( m_currentText->GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT: m_spin0->Check(); break;
case GR_TEXT_H_ALIGN_CENTER: m_spin1->Check(); break;
case GR_TEXT_H_ALIGN_RIGHT: m_spin2->Check(); break;
}
}
m_privateCheckbox->SetValue( m_currentText->IsPrivate() );
@ -229,25 +248,40 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataFromWindow()
else if( m_spin1->IsChecked() )
{
m_currentText->SetTextAngle( ANGLE_HORIZONTAL );
m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
}
else if( m_spin2->IsChecked() )
{
m_currentText->SetTextAngle( ANGLE_VERTICAL );
m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
m_currentText->SetTextAngle( ANGLE_HORIZONTAL );
m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
}
else if( m_spin3->IsChecked() )
{
m_currentText->SetTextAngle( ANGLE_VERTICAL );
m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
}
else if( m_spin4->IsChecked() )
{
m_currentText->SetTextAngle( ANGLE_VERTICAL );
m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
}
else if( m_spin5->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() );
if( m_borderCheckbox->GetValue() )
{
if( !m_borderWidth.IsIndeterminate() )
stroke.SetWidth( m_borderWidth.GetValue() );
}
else
{
stroke.SetWidth( -1 );
}
auto it = lineTypeNames.begin();
std::advance( it, m_borderStyleCombo->GetSelection() );
@ -304,7 +338,27 @@ void DIALOG_LIB_TEXTBOX_PROPERTIES::onMultiLineTCLostFocus( wxFocusEvent& event
}
void DIALOG_LIB_TEXTBOX_PROPERTIES::onFillSwatch( wxCommandEvent& aEvent )
void DIALOG_LIB_TEXTBOX_PROPERTIES::onBorderChecked( wxCommandEvent& event )
{
m_filledCtrl->SetValue( true );
}
bool border = m_borderCheckbox->GetValue();
if( border && m_borderWidth.GetValue() < 0 )
m_borderWidth.SetValue( Mils2iu( m_frame->libeditconfig()->m_Defaults.line_width ) );
m_borderWidth.Enable( border );
m_borderColorLabel->Enable( border );
m_borderColorSwatch->Enable( border );
m_borderStyleLabel->Enable( border );
m_borderStyleCombo->Enable( border );
}
void DIALOG_LIB_TEXTBOX_PROPERTIES::onFillChecked( wxCommandEvent& event )
{
bool fill = m_filledCtrl->GetValue();
m_fillColorLabel->Enable( fill );
m_fillColorSwatch->Enable( fill );
}

View File

@ -43,7 +43,8 @@ public:
private:
void onSpinButton( wxCommandEvent &aEvent );
void onFillSwatch( wxCommandEvent& aEvent );
void onBorderChecked( wxCommandEvent& event ) override;
void onFillChecked( wxCommandEvent& event ) override;
void OnFormattingHelp( wxHyperlinkEvent& aEvent ) override;
void onMultiLineTCLostFocus( wxFocusEvent& event ) override;

View File

@ -59,7 +59,7 @@ DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( wxWindow
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_textEntrySizer->Add( m_textCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 5 ), wxEXPAND, 5 );
m_fontLabel = new wxStaticText( this, wxID_ANY, _("Font:"), wxDefaultPosition, wxDefaultSize, 0 );
m_fontLabel->Wrap( -1 );
@ -114,13 +114,23 @@ DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( wxWindow
bSizeCtrlSizer->Add( m_spin3, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_spin4 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_spin4->SetToolTip( _("Align top") );
bSizeCtrlSizer->Add( m_spin4, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_spin5 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_spin5->SetToolTip( _("Align top") );
bSizeCtrlSizer->Add( m_spin5, 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 );
bSizeCtrlSizer->Add( m_separator3, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textEntrySizer->Add( bSizeCtrlSizer, wxGBPosition( 1, 3 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP, 5 );
m_textEntrySizer->Add( bSizeCtrlSizer, wxGBPosition( 1, 3 ), wxGBSpan( 1, 2 ), wxEXPAND|wxTOP, 5 );
wxBoxSizer* bSizer41;
bSizer41 = new wxBoxSizer( wxVERTICAL );
@ -131,7 +141,7 @@ DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( wxWindow
bSizer41->Add( m_syntaxHelp, 0, wxRIGHT|wxLEFT, 5 );
m_textEntrySizer->Add( bSizer41, wxGBPosition( 1, 4 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_RIGHT|wxLEFT, 80 );
m_textEntrySizer->Add( bSizer41, wxGBPosition( 1, 5 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_RIGHT|wxLEFT, 80 );
m_textSizeLabel = new wxStaticText( this, wxID_ANY, _("Text size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textSizeLabel->Wrap( -1 );
@ -147,78 +157,95 @@ DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( wxWindow
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_borderCheckbox = new wxCheckBox( this, wxID_ANY, _("Border"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_borderCheckbox, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), 0, 5 );
m_borderWidthLabel = new wxStaticText( this, wxID_ANY, _("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_textEntrySizer->Add( m_borderWidthLabel, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
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 );
bSizer7->Add( m_borderWidthCtrl, 0, 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 );
bSizer7->Add( m_borderWidthUnits, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 3 );
m_borderColorLabel = new wxStaticText( this, wxID_ANY, _("Border color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderColorLabel = new wxStaticText( this, wxID_ANY, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderColorLabel->Wrap( -1 );
m_textEntrySizer->Add( m_borderColorLabel, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
bSizer7->Add( m_borderColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 15 );
bSizer7->Add( 5, 0, 0, 0, 5 );
m_panelBorderColor = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizer22;
bSizer22 = 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 );
bSizer22->Add( m_borderColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_panelBorderColor->SetSizer( bSizer2 );
m_panelBorderColor->SetSizer( bSizer22 );
m_panelBorderColor->Layout();
bSizer2->Fit( m_panelBorderColor );
m_textEntrySizer->Add( m_panelBorderColor, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
bSizer22->Fit( m_panelBorderColor );
bSizer7->Add( m_panelBorderColor, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_borderStyleLabel = new wxStaticText( this, wxID_ANY, _("Border style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( bSizer7, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_borderStyleLabel = new wxStaticText( this, wxID_ANY, _("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( m_borderStyleCombo, wxGBPosition( 6, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 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_textEntrySizer->Add( m_filledCtrl, wxGBPosition( 4, 4 ), wxGBSpan( 1, 2 ), wxRIGHT, 140 );
wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxHORIZONTAL );
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 );
bSizer8->Add( m_fillColorLabel, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_panelFillColor = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer21;
bSizer21 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizer211;
bSizer211 = 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 );
bSizer211->Add( m_fillColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_panelFillColor->SetSizer( bSizer21 );
m_panelFillColor->SetSizer( bSizer211 );
m_panelFillColor->Layout();
bSizer21->Fit( m_panelFillColor );
m_textEntrySizer->Add( m_panelFillColor, wxGBPosition( 5, 4 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
bSizer211->Fit( m_panelFillColor );
bSizer8->Add( m_panelFillColor, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textEntrySizer->Add( bSizer8, wxGBPosition( 5, 4 ), wxGBSpan( 1, 1 ), wxEXPAND, 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_textEntrySizer->Add( m_CommonUnit, wxGBPosition( 8, 4 ), wxGBSpan( 1, 2 ), 0, 5 );
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->Add( m_CommonConvert, wxGBPosition( 9, 4 ), wxGBSpan( 1, 2 ), 0, 5 );
m_textEntrySizer->AddGrowableCol( 1 );
m_textEntrySizer->AddGrowableCol( 4 );
m_textEntrySizer->AddGrowableCol( 3 );
bMainSizer->Add( m_textEntrySizer, 1, wxEXPAND|wxALL, 10 );
@ -248,6 +275,8 @@ DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( wxWindow
// 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 );
m_borderCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_filledCtrl->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::onFillChecked ), NULL, this );
}
DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::~DIALOG_LIB_TEXTBOX_PROPERTIES_BASE()
@ -255,5 +284,7 @@ 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 );
m_borderCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_filledCtrl->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::onFillChecked ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -31,9 +31,9 @@ class FONT_CHOICE;
#include <wx/sizer.h>
#include <wx/hyperlink.h>
#include <wx/textctrl.h>
#include <wx/checkbox.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>
@ -66,11 +66,14 @@ class DIALOG_LIB_TEXTBOX_PROPERTIES_BASE : public DIALOG_SHIM
BITMAP_BUTTON* m_spin1;
BITMAP_BUTTON* m_spin2;
BITMAP_BUTTON* m_spin3;
BITMAP_BUTTON* m_spin4;
BITMAP_BUTTON* m_spin5;
BITMAP_BUTTON* m_separator3;
wxHyperlinkCtrl* m_syntaxHelp;
wxStaticText* m_textSizeLabel;
wxTextCtrl* m_textSizeCtrl;
wxStaticText* m_textSizeUnits;
wxCheckBox* m_borderCheckbox;
wxStaticText* m_borderWidthLabel;
wxTextCtrl* m_borderWidthCtrl;
wxStaticText* m_borderWidthUnits;
@ -94,6 +97,8 @@ class DIALOG_LIB_TEXTBOX_PROPERTIES_BASE : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class
virtual void onMultiLineTCLostFocus( wxFocusEvent& event ) { event.Skip(); }
virtual void OnFormattingHelp( wxHyperlinkEvent& event ) { event.Skip(); }
virtual void onBorderChecked( wxCommandEvent& event ) { event.Skip(); }
virtual void onFillChecked( wxCommandEvent& event ) { event.Skip(); }
public:

View File

@ -63,6 +63,10 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_ITE
}
else
{
m_spin1->Show( false );
m_spin4->Show( false );
m_borderCheckbox->Show( false );
m_borderWidth.Show( false );
m_borderColorLabel->Show( false );
m_panelBorderColor->Show( false );
@ -96,11 +100,15 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_ITE
m_spin0->SetIsCheckButton();
m_spin0->SetBitmap( KiBitmap( BITMAPS::text_align_left ) );
m_spin1->SetIsCheckButton();
m_spin1->SetBitmap( KiBitmap( BITMAPS::text_align_right ) );
m_spin1->SetBitmap( KiBitmap( BITMAPS::text_align_center ) );
m_spin2->SetIsCheckButton();
m_spin2->SetBitmap( KiBitmap( BITMAPS::text_align_bottom ) );
m_spin2->SetBitmap( KiBitmap( BITMAPS::text_align_right ) );
m_spin3->SetIsCheckButton();
m_spin3->SetBitmap( KiBitmap( BITMAPS::text_align_top ) );
m_spin3->SetBitmap( KiBitmap( BITMAPS::text_align_bottom ) );
m_spin4->SetIsCheckButton();
m_spin4->SetBitmap( KiBitmap( BITMAPS::text_align_middle ) );
m_spin5->SetIsCheckButton();
m_spin5->SetBitmap( KiBitmap( BITMAPS::text_align_top ) );
m_separator3->SetIsSeparator();
@ -112,8 +120,8 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_ITE
m_spin1->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onSpinButton, this );
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 );
m_spin4->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onSpinButton, this );
m_spin5->Bind( wxEVT_BUTTON, &DIALOG_TEXT_PROPERTIES::onSpinButton, this );
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
@ -149,6 +157,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
{
SCH_TEXTBOX* textBox = static_cast<SCH_TEXTBOX*>( m_currentItem );
m_borderCheckbox->SetValue( textBox->GetWidth() >= 0 );
m_borderWidth.SetValue( textBox->GetWidth() );
m_borderColorSwatch->SetSwatchColor( textBox->GetStroke().GetColor(), false );
@ -161,22 +170,35 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
else
wxFAIL_MSG( "Line type not found in the type lookup map" );
m_borderWidth.Enable( textBox->GetWidth() >= 0 );
m_borderColorLabel->Enable( textBox->GetWidth() >= 0 );
m_borderColorSwatch->Enable( textBox->GetWidth() >= 0 );
m_borderStyleLabel->Enable( textBox->GetWidth() >= 0 );
m_borderStyleCombo->Enable( textBox->GetWidth() >= 0 );
m_filledCtrl->SetValue( textBox->IsFilled() );
m_fillColorSwatch->SetSwatchColor( textBox->GetFillColor(), false );
if( textBox->GetTextAngle() == ANGLE_VERTICAL )
m_fillColorLabel->Enable( textBox->IsFilled() );
m_fillColorSwatch->Enable( textBox->IsFilled() );
if( m_currentText->GetTextAngle() == ANGLE_VERTICAL )
{
if( textBox->GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
m_spin3->Check();
else
m_spin2->Check();
switch( m_currentText->GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT: m_spin3->Check(); break;
case GR_TEXT_H_ALIGN_CENTER: m_spin4->Check(); break;
case GR_TEXT_H_ALIGN_RIGHT: m_spin5->Check(); break;
}
}
else
{
if( textBox->GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
m_spin1->Check();
else
m_spin0->Check();
switch( m_currentText->GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT: m_spin0->Check(); break;
case GR_TEXT_H_ALIGN_CENTER: m_spin1->Check(); break;
case GR_TEXT_H_ALIGN_RIGHT: m_spin2->Check(); break;
}
}
}
else
@ -186,9 +208,9 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
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;
case TEXT_SPIN_STYLE::LEFT: m_spin2->Check( true ); break;
case TEXT_SPIN_STYLE::UP: m_spin3->Check( true ); break;
case TEXT_SPIN_STYLE::BOTTOM: m_spin5->Check( true ); break;
}
}
@ -196,6 +218,30 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
}
void DIALOG_TEXT_PROPERTIES::onBorderChecked( wxCommandEvent& event )
{
bool border = m_borderCheckbox->GetValue();
if( border && m_borderWidth.GetValue() < 0 )
m_borderWidth.SetValue( m_frame->eeconfig()->m_Drawing.default_line_thickness );
m_borderWidth.Enable( border );
m_borderColorLabel->Enable( border );
m_borderColorSwatch->Enable( border );
m_borderStyleLabel->Enable( border );
m_borderStyleCombo->Enable( border );
}
void DIALOG_TEXT_PROPERTIES::onFillChecked( wxCommandEvent& event )
{
bool fill = m_filledCtrl->GetValue();
m_fillColorLabel->Enable( fill );
m_fillColorSwatch->Enable( fill );
}
void DIALOG_TEXT_PROPERTIES::onScintillaCharAdded( wxStyledTextEvent &aEvent )
{
wxStyledTextCtrl* te = m_textCtrl;
@ -336,11 +382,11 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
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;
selectedSpinStyle = TEXT_SPIN_STYLE::LEFT;
else if( m_spin3->IsChecked() )
selectedSpinStyle = TEXT_SPIN_STYLE::UP;
else if( m_spin5->IsChecked() )
selectedSpinStyle = TEXT_SPIN_STYLE::BOTTOM;
static_cast<SCH_TEXT*>( m_currentItem )->SetTextSpinStyle( selectedSpinStyle );
@ -351,31 +397,46 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
if( m_spin0->IsChecked() )
{
textBox->SetTextAngle( ANGLE_HORIZONTAL );
textBox->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
m_currentText->SetTextAngle( ANGLE_HORIZONTAL );
m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
}
else if( m_spin1->IsChecked() )
{
textBox->SetTextAngle( ANGLE_HORIZONTAL );
textBox->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
m_currentText->SetTextAngle( ANGLE_HORIZONTAL );
m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
}
else if( m_spin2->IsChecked() )
{
textBox->SetTextAngle( ANGLE_VERTICAL );
textBox->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
m_currentText->SetTextAngle( ANGLE_HORIZONTAL );
m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
}
else if( m_spin3->IsChecked() )
{
textBox->SetTextAngle( ANGLE_VERTICAL );
textBox->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
m_currentText->SetTextAngle( ANGLE_VERTICAL );
m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
}
else if( m_spin4->IsChecked() )
{
m_currentText->SetTextAngle( ANGLE_VERTICAL );
m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
}
else if( m_spin5->IsChecked() )
{
m_currentText->SetTextAngle( ANGLE_VERTICAL );
m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
}
textBox->UpdateTextPosition();
STROKE_PARAMS stroke = textBox->GetStroke();
if( !m_borderWidth.IsIndeterminate() )
stroke.SetWidth( m_borderWidth.GetValue() );
if( m_borderCheckbox->GetValue() )
{
if( !m_borderWidth.IsIndeterminate() )
stroke.SetWidth( m_borderWidth.GetValue() );
}
else
{
stroke.SetWidth( -1 );
}
auto it = lineTypeNames.begin();
std::advance( it, m_borderStyleCombo->GetSelection() );
@ -414,9 +475,3 @@ void DIALOG_TEXT_PROPERTIES::onMultiLineTCLostFocus( wxFocusEvent& event )
event.Skip();
}
void DIALOG_TEXT_PROPERTIES::onFillSwatch( wxCommandEvent& aEvent )
{
m_filledCtrl->SetValue( true );
}

View File

@ -44,6 +44,8 @@ public:
private:
void onScintillaCharAdded( wxStyledTextEvent &aEvent );
void onSpinButton( wxCommandEvent &aEvent );
void onBorderChecked( wxCommandEvent& event ) override;
void onFillChecked( wxCommandEvent& event ) override;
void onFillSwatch( wxCommandEvent& aEvent );
void OnFormattingHelp( wxHyperlinkEvent& aEvent ) override;

View File

@ -59,17 +59,17 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi
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_textEntrySizer->Add( m_textCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 5 ), 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 );
m_textEntrySizer->Add( m_fontLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 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 );
m_textEntrySizer->Add( m_fontCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP, 5 );
wxBoxSizer* bSizeCtrlSizer;
bSizeCtrlSizer = new wxBoxSizer( wxHORIZONTAL );
@ -77,50 +77,60 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi
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 );
bSizeCtrlSizer->Add( m_separator1, 0, wxALIGN_CENTER_VERTICAL|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 );
bSizeCtrlSizer->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") );
bSizeCtrlSizer->Add( m_italic, 0, wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );
bSizeCtrlSizer->Add( m_italic, 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 );
bSizeCtrlSizer->Add( m_separator2, 0, wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );
bSizeCtrlSizer->Add( m_separator2, 0, 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 );
bSizeCtrlSizer->Add( m_spin0, 0, 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") );
m_spin1->SetToolTip( _("Align right") );
bSizeCtrlSizer->Add( m_spin1, 0, wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );
bSizeCtrlSizer->Add( m_spin1, 0, 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") );
m_spin2->SetToolTip( _("Align bottom") );
bSizeCtrlSizer->Add( m_spin2, 0, wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );
bSizeCtrlSizer->Add( m_spin2, 0, 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") );
m_spin3->SetToolTip( _("Align left") );
bSizeCtrlSizer->Add( m_spin3, 0, wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );
bSizeCtrlSizer->Add( m_spin3, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_spin4 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_spin4->SetToolTip( _("Align left") );
bSizeCtrlSizer->Add( m_spin4, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_spin5 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_spin5->SetToolTip( _("Align top") );
bSizeCtrlSizer->Add( m_spin5, 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 );
bSizeCtrlSizer->Add( m_separator3, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5 );
bSizeCtrlSizer->Add( m_separator3, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textEntrySizer->Add( bSizeCtrlSizer, wxGBPosition( 1, 3 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_textEntrySizer->Add( bSizeCtrlSizer, wxGBPosition( 1, 3 ), wxGBSpan( 1, 2 ), wxEXPAND|wxTOP, 5 );
wxBoxSizer* bSizer41;
bSizer41 = new wxBoxSizer( wxVERTICAL );
@ -128,10 +138,10 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi
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 );
bSizer41->Add( m_syntaxHelp, 0, wxBOTTOM|wxRIGHT|wxLEFT, 6 );
m_textEntrySizer->Add( bSizer41, wxGBPosition( 1, 4 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_RIGHT|wxLEFT, 80 );
m_textEntrySizer->Add( bSizer41, wxGBPosition( 1, 5 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_RIGHT|wxLEFT, 80 );
m_textSizeLabel = new wxStaticText( this, wxID_ANY, _("Text size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textSizeLabel->Wrap( -1 );
@ -144,20 +154,29 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi
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_borderCheckbox = new wxCheckBox( this, wxID_ANY, _("Border"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_borderCheckbox, wxGBPosition( 4, 0 ), wxGBSpan( 1, 2 ), wxRIGHT, 5 );
m_borderWidthLabel = new wxStaticText( this, wxID_ANY, _("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_textEntrySizer->Add( m_borderWidthLabel, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
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 );
bSizer7->Add( m_borderWidthCtrl, 0, 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 );
bSizer7->Add( m_borderWidthUnits, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 3 );
m_borderColorLabel = new wxStaticText( this, wxID_ANY, _("Border color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderColorLabel = new wxStaticText( this, wxID_ANY, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderColorLabel->Wrap( -1 );
m_textEntrySizer->Add( m_borderColorLabel, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
bSizer7->Add( m_borderColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 15 );
bSizer7->Add( 5, 0, 0, 0, 5 );
m_panelBorderColor = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer2;
@ -170,23 +189,29 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi
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 );
bSizer7->Add( m_panelBorderColor, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_borderStyleLabel = new wxStaticText( this, wxID_ANY, _("Border style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( bSizer7, wxGBPosition( 5, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_borderStyleLabel = new wxStaticText( this, wxID_ANY, _("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( m_borderStyleCombo, wxGBPosition( 6, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|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_textEntrySizer->Add( m_filledCtrl, wxGBPosition( 4, 4 ), wxGBSpan( 1, 2 ), wxRIGHT, 80 );
wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxHORIZONTAL );
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 );
bSizer8->Add( m_fillColorLabel, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_panelFillColor = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer21;
@ -199,11 +224,13 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi
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 );
bSizer8->Add( m_panelFillColor, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textEntrySizer->AddGrowableCol( 1 );
m_textEntrySizer->AddGrowableCol( 4 );
m_textEntrySizer->Add( bSizer8, wxGBPosition( 5, 4 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_textEntrySizer->AddGrowableCol( 3 );
bMainSizer->Add( m_textEntrySizer, 1, wxEXPAND|wxALL, 10 );
@ -233,6 +260,8 @@ DIALOG_TEXT_PROPERTIES_BASE::DIALOG_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWi
// Connect Events
m_textCtrl->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onMultiLineTCLostFocus ), NULL, this );
m_syntaxHelp->Connect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnFormattingHelp ), NULL, this );
m_borderCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_filledCtrl->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onFillChecked ), NULL, this );
}
DIALOG_TEXT_PROPERTIES_BASE::~DIALOG_TEXT_PROPERTIES_BASE()
@ -240,5 +269,7 @@ DIALOG_TEXT_PROPERTIES_BASE::~DIALOG_TEXT_PROPERTIES_BASE()
// Disconnect Events
m_textCtrl->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onMultiLineTCLostFocus ), NULL, this );
m_syntaxHelp->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( DIALOG_TEXT_PROPERTIES_BASE::OnFormattingHelp ), NULL, this );
m_borderCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_filledCtrl->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_TEXT_PROPERTIES_BASE::onFillChecked ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -31,9 +31,9 @@ class FONT_CHOICE;
#include <wx/sizer.h>
#include <wx/hyperlink.h>
#include <wx/textctrl.h>
#include <wx/checkbox.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>
@ -66,11 +66,14 @@ class DIALOG_TEXT_PROPERTIES_BASE : public DIALOG_SHIM
BITMAP_BUTTON* m_spin1;
BITMAP_BUTTON* m_spin2;
BITMAP_BUTTON* m_spin3;
BITMAP_BUTTON* m_spin4;
BITMAP_BUTTON* m_spin5;
BITMAP_BUTTON* m_separator3;
wxHyperlinkCtrl* m_syntaxHelp;
wxStaticText* m_textSizeLabel;
wxTextCtrl* m_textSizeCtrl;
wxStaticText* m_textSizeUnits;
wxCheckBox* m_borderCheckbox;
wxStaticText* m_borderWidthLabel;
wxTextCtrl* m_borderWidthCtrl;
wxStaticText* m_borderWidthUnits;
@ -91,6 +94,8 @@ class DIALOG_TEXT_PROPERTIES_BASE : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class
virtual void onMultiLineTCLostFocus( wxFocusEvent& event ) { event.Skip(); }
virtual void OnFormattingHelp( wxHyperlinkEvent& event ) { event.Skip(); }
virtual void onBorderChecked( wxCommandEvent& event ) { event.Skip(); }
virtual void onFillChecked( wxCommandEvent& event ) { event.Skip(); }
public:

View File

@ -1 +0,0 @@

View File

@ -65,6 +65,9 @@ void LIB_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
msg = wxT( "?" );
aList.emplace_back( _( "Converted" ), msg );
if( IsPrivate() )
aList.emplace_back( _( "Private" ), wxEmptyString );
}
@ -80,6 +83,9 @@ int LIB_ITEM::compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompareF
if( !( aCompareFlags & COMPARE_FLAGS::UNIT ) && m_convert != aOther.m_convert )
return m_convert - aOther.m_convert;
if( IsPrivate() != aOther.IsPrivate() )
return IsPrivate() < aOther.IsPrivate();
return 0;
}

View File

@ -112,13 +112,15 @@ void LIB_SHAPE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
void LIB_SHAPE::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
const TRANSFORM& aTransform ) const
{
if( IsPrivate() )
return;
VECTOR2I start = aTransform.TransformCoordinate( m_start ) + aOffset;
VECTOR2I end = aTransform.TransformCoordinate( m_end ) + aOffset;
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 );
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
static std::vector<VECTOR2I> cornerList;
@ -217,6 +219,9 @@ int LIB_SHAPE::GetPenWidth() const
void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform )
{
if( IsPrivate() )
return;
bool forceNoFill = static_cast<bool>( aData );
int penWidth = GetEffectivePenWidth( aSettings );
@ -227,7 +232,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( IsPrivate() ? LAYER_NOTES : LAYER_DEVICE );
COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
unsigned ptCount = 0;
VECTOR2I* buffer = nullptr;

View File

@ -62,7 +62,7 @@ public:
// For historical reasons, a stored value of 0 means "default width" and negative
// numbers meant "don't stroke".
if( GetPenWidth() < 0 && GetFillMode() != FILL_T::NO_FILL )
if( GetPenWidth() < 0 )
return 0;
else if( GetPenWidth() == 0 )
return aSettings->GetDefaultPenWidth();

View File

@ -65,30 +65,18 @@ int LIB_TEXTBOX::GetTextMargin() const
}
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 );
switch( GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT: SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT ); break;
case GR_TEXT_H_ALIGN_CENTER: break;
case GR_TEXT_H_ALIGN_RIGHT: SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); break;
}
}
UpdateTextPosition();
}
@ -97,24 +85,24 @@ 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 );
switch( GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT: SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT ); break;
case GR_TEXT_H_ALIGN_CENTER: break;
case GR_TEXT_H_ALIGN_RIGHT: SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); break;
}
}
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()
VECTOR2I LIB_TEXTBOX::GetDrawPos() const
{
int margin = GetTextMargin();
BOX2I bbox( VECTOR2I( std::min( m_start.x, m_end.x ), std::min( -m_start.y, -m_end.y ) ),
@ -122,17 +110,27 @@ void LIB_TEXTBOX::UpdateTextPosition()
if( GetTextAngle() == ANGLE_VERTICAL )
{
if( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
SetTextPos( VECTOR2I( bbox.GetLeft() + margin, bbox.GetTop() + margin ) );
else
SetTextPos( VECTOR2I( bbox.GetLeft() + margin, bbox.GetBottom() - margin ) );
switch( GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT:
return VECTOR2I( bbox.GetLeft() + margin, bbox.GetBottom() - margin );
case GR_TEXT_H_ALIGN_CENTER:
return VECTOR2I( bbox.GetLeft() + margin, ( bbox.GetTop() + bbox.GetBottom() ) / 2 );
case GR_TEXT_H_ALIGN_RIGHT:
return VECTOR2I( bbox.GetLeft() + margin, bbox.GetTop() + margin );
}
}
else
{
if( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
SetTextPos( VECTOR2I( bbox.GetRight() - margin, bbox.GetTop() + margin ) );
else
SetTextPos( VECTOR2I( bbox.GetLeft() + margin, bbox.GetTop() + margin ) );
switch( GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT:
return VECTOR2I( bbox.GetLeft() + margin, bbox.GetTop() + margin );
case GR_TEXT_H_ALIGN_CENTER:
return VECTOR2I( ( bbox.GetLeft() + bbox.GetRight() ) / 2, bbox.GetTop() + margin );
case GR_TEXT_H_ALIGN_RIGHT:
return VECTOR2I( bbox.GetRight() - margin, bbox.GetTop() + margin );
}
}
}
@ -175,12 +173,6 @@ int LIB_TEXTBOX::compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompa
}
int LIB_TEXTBOX::GetPenWidth() const
{
return GetEffectiveTextPenWidth();
}
KIFONT::FONT* LIB_TEXTBOX::GetDrawFont() const
{
KIFONT::FONT* font = EDA_TEXT::GetFont();
@ -195,16 +187,16 @@ KIFONT::FONT* LIB_TEXTBOX::GetDrawFont() const
void LIB_TEXTBOX::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
const TRANSFORM& aTransform )
{
if( IsPrivate() )
return;
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 );
COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
if( !forceNoFill && GetFillMode() == FILL_T::FILLED_WITH_COLOR )
GRFilledRect( DC, pt1, pt2, penWidth, color, GetFillColor() );
@ -212,27 +204,30 @@ void LIB_TEXTBOX::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffs
if( GetStroke().GetColor() != COLOR4D::UNSPECIFIED )
color = GetStroke().GetColor();
penWidth = std::max( penWidth, aSettings->GetMinPenWidth() );
if( GetStroke().GetPlotStyle() <= PLOT_DASH_TYPE::FIRST_TYPE )
if( penWidth > 0 )
{
GRRect( DC, pt1, pt2, penWidth, color );
}
else
{
std::vector<SHAPE*> shapes = MakeEffectiveShapes( true );
penWidth = std::max( penWidth, aSettings->GetMinPenWidth() );
for( SHAPE* shape : shapes )
if( GetStroke().GetPlotStyle() <= PLOT_DASH_TYPE::FIRST_TYPE )
{
STROKE_PARAMS::Stroke( shape, GetStroke().GetPlotStyle(), penWidth, aSettings,
[&]( const VECTOR2I& a, const VECTOR2I& b )
{
GRLine( DC, a.x, a.y, b.x, b.y, penWidth, color );
} );
GRRect( DC, pt1, pt2, penWidth, color );
}
else
{
std::vector<SHAPE*> shapes = MakeEffectiveShapes( true );
for( SHAPE* shape : shapes )
delete shape;
for( SHAPE* shape : shapes )
{
STROKE_PARAMS::Stroke( shape, GetStroke().GetPlotStyle(), penWidth, aSettings,
[&]( const VECTOR2I& a, const VECTOR2I& b )
{
GRLine( DC, a.x, a.y, b.x, b.y, penWidth, color );
} );
}
for( SHAPE* shape : shapes )
delete shape;
}
}
LIB_TEXTBOX text( *this );
@ -245,12 +240,11 @@ void LIB_TEXTBOX::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffs
: ANGLE_HORIZONTAL );
}
// NB: UpdateTextPosition() wants Symbol Editor (upside-down) coordinates
// NB: GetDrawPos() will want Symbol Editor (upside-down) coordinates
text.SetStart( VECTOR2I( pt1.x, -pt1.y ) );
text.SetEnd( VECTOR2I( pt2.x, -pt2.y ) );
text.UpdateTextPosition();
GRPrintText( DC, text.GetTextPos(), color, text.GetShownText(), text.GetTextAngle(),
GRPrintText( DC, text.GetDrawPos(), color, text.GetShownText(), text.GetTextAngle(),
text.GetTextSize(), text.GetHorizJustify(), text.GetVertJustify(), penWidth,
text.IsItalic(), text.IsBold(), text.GetDrawFont() );
}
@ -314,12 +308,14 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
{
wxASSERT( aPlotter != nullptr );
if( IsPrivate() )
return;
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 );
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
if( fill != FILL_T::NO_FILL )
{
COLOR4D fillColor = color;
@ -334,12 +330,13 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
aPlotter->SetColor( fillColor );
aPlotter->Rect( start, end, fill, 0 );
fill = FILL_T::NO_FILL;
}
aPlotter->SetColor( color );
aPlotter->Rect( start, end, fill, penWidth );
if( penWidth > 0 )
{
aPlotter->SetColor( color );
aPlotter->Rect( start, end, FILL_T::NO_FILL, penWidth );
}
LIB_TEXTBOX text( *this );
@ -351,10 +348,9 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
: ANGLE_HORIZONTAL );
}
// NB: UpdateTextPosition() wants Symbol Editor (upside-down) coordinates
// NB: GetDrawPos() will want 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;

View File

@ -53,17 +53,12 @@ public:
int GetTextMargin() const;
void UpdateTextPosition();
VECTOR2I GetDrawPos() const override;
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;

View File

@ -762,34 +762,37 @@ void SCH_PAINTER::draw( const LIB_SHAPE *aShape, int aLayer )
{
int lineWidth = getLineWidth( aShape, drawingShadows );
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
m_gal->SetLineWidth( lineWidth );
m_gal->SetStrokeColor( color );
if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE || drawingShadows )
if( lineWidth > 0 )
{
drawShape( aShape );
}
else
{
std::vector<SHAPE*> shapes = aShape->MakeEffectiveShapes( true );
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
m_gal->SetLineWidth( lineWidth );
m_gal->SetStrokeColor( color );
for( SHAPE* shape : shapes )
if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE || drawingShadows )
{
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 ) );
} );
drawShape( aShape );
}
else
{
std::vector<SHAPE*> shapes = aShape->MakeEffectiveShapes( true );
for( SHAPE* shape : shapes )
delete shape;
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;
}
}
}
}
@ -946,9 +949,10 @@ void SCH_PAINTER::draw( const LIB_TEXTBOX* aTextBox, int aLayer )
if( !shownText.IsEmpty() )
{
TEXT_ATTRIBUTES attrs = aTextBox->GetAttributes();
attrs.m_Angle = aTextBox->GetDrawRotation();
attrs.m_StrokeWidth = getTextThickness( aTextBox, drawingShadows );
strokeText( shownText, aTextBox->GetTextPos(), attrs );
strokeText( shownText, aTextBox->GetDrawPos(), attrs );
}
};
@ -991,33 +995,36 @@ void SCH_PAINTER::draw( const LIB_TEXTBOX* aTextBox, int aLayer )
}
else if( aLayer == LAYER_DEVICE || aLayer == LAYER_NOTES )
{
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
if( borderStyle <= PLOT_DASH_TYPE::FIRST_TYPE || drawingShadows )
if( aTextBox->GetEffectivePenWidth( &m_schSettings ) > 0 )
{
m_gal->DrawRectangle( mapCoords( aTextBox->GetPosition() ),
mapCoords( aTextBox->GetEnd() ) );
}
else
{
std::vector<SHAPE*> shapes = aTextBox->MakeEffectiveShapes( true );
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
for( SHAPE* shape : shapes )
if( borderStyle <= PLOT_DASH_TYPE::FIRST_TYPE || drawingShadows )
{
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 ) );
} );
m_gal->DrawRectangle( mapCoords( aTextBox->GetPosition() ),
mapCoords( aTextBox->GetEnd() ) );
}
else
{
std::vector<SHAPE*> shapes = aTextBox->MakeEffectiveShapes( true );
for( SHAPE* shape : shapes )
delete shape;
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();
@ -1650,46 +1657,52 @@ void SCH_PAINTER::draw( const SCH_SHAPE* aShape, int aLayer )
drawShape( aShape );
}
else if( aLayer == LAYER_NOTES_BACKGROUND && aShape->IsFilled() )
else if( aLayer == LAYER_NOTES_BACKGROUND )
{
m_gal->SetIsFill( true );
m_gal->SetIsStroke( false );
m_gal->SetFillColor( aShape->GetFillColor() );
if( aShape->IsFilled() )
{
m_gal->SetIsFill( true );
m_gal->SetIsStroke( false );
m_gal->SetFillColor( aShape->GetFillColor() );
drawShape( aShape );
drawShape( aShape );
}
}
else if( aLayer == LAYER_NOTES )
{
int lineWidth = getLineWidth( aShape, drawingShadows );
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
m_gal->SetLineWidth( lineWidth );
m_gal->SetStrokeColor( color );
if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE || drawingShadows )
if( lineWidth > 0 )
{
drawShape( aShape );
}
else
{
std::vector<SHAPE*> shapes = aShape->MakeEffectiveShapes( true );
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
m_gal->SetLineWidth( lineWidth );
m_gal->SetStrokeColor( color );
for( SHAPE* shape : shapes )
if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE || drawingShadows )
{
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( a+1, b );
else
m_gal->DrawLine( a, b );
} );
drawShape( aShape );
}
else
{
std::vector<SHAPE*> shapes = aShape->MakeEffectiveShapes( true );
for( SHAPE* shape : shapes )
delete shape;
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( a+1, b );
else
m_gal->DrawLine( a, b );
} );
}
for( SHAPE* shape : shapes )
delete shape;
}
}
}
}
@ -1766,6 +1779,7 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer )
if( !shownText.IsEmpty() )
{
TEXT_ATTRIBUTES attrs = aText->GetAttributes();
attrs.m_Angle = aText->GetDrawRotation();
attrs.m_StrokeWidth = getTextThickness( aText, drawingShadows );
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
@ -1780,7 +1794,7 @@ void SCH_PAINTER::draw( const SCH_TEXT *aText, int aLayer )
}
else
{
strokeText( shownText, aText->GetTextPos() + text_offset, attrs );
strokeText( shownText, aText->GetDrawPos() + text_offset, attrs );
}
}
}
@ -1800,6 +1814,7 @@ void SCH_PAINTER::draw( const SCH_TEXTBOX* aTextBox, int aLayer )
if( !shownText.IsEmpty() )
{
TEXT_ATTRIBUTES attrs = aTextBox->GetAttributes();
attrs.m_Angle = aTextBox->GetDrawRotation();
attrs.m_StrokeWidth = getTextThickness( aTextBox, drawingShadows );
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
@ -1813,7 +1828,7 @@ void SCH_PAINTER::draw( const SCH_TEXTBOX* aTextBox, int aLayer )
}
else
{
strokeText( shownText, aTextBox->GetTextPos(), attrs );
strokeText( shownText, aTextBox->GetDrawPos(), attrs );
}
}
};
@ -1857,32 +1872,35 @@ void SCH_PAINTER::draw( const SCH_TEXTBOX* aTextBox, int aLayer )
}
else if( aLayer == LAYER_NOTES )
{
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
if( borderStyle <= PLOT_DASH_TYPE::FIRST_TYPE || drawingShadows )
if( aTextBox->GetPenWidth() > 0 )
{
m_gal->DrawRectangle( aTextBox->GetPosition(), aTextBox->GetEnd() );
}
else
{
std::vector<SHAPE*> shapes = aTextBox->MakeEffectiveShapes( true );
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
for( SHAPE* shape : shapes )
if( borderStyle <= PLOT_DASH_TYPE::FIRST_TYPE || drawingShadows )
{
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 );
} );
m_gal->DrawRectangle( aTextBox->GetPosition(), aTextBox->GetEnd() );
}
else
{
std::vector<SHAPE*> shapes = aTextBox->MakeEffectiveShapes( true );
for( SHAPE* shape : shapes )
delete shape;
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();

View File

@ -1655,8 +1655,6 @@ LIB_TEXTBOX* SCH_SEXPR_PARSER::parseTextBox()
}
}
textBox->UpdateTextPosition();
return textBox.release();
}
@ -3461,8 +3459,6 @@ SCH_TEXTBOX* SCH_SEXPR_PARSER::parseSchTextBox()
}
}
textBox->UpdateTextPosition();
return textBox.release();
}

View File

@ -89,7 +89,7 @@ void SCH_SHAPE::Rotate( const VECTOR2I& aCenter )
void SCH_SHAPE::Plot( PLOTTER* aPlotter ) const
{
int pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
int pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetMinPenWidth() );
static std::vector<VECTOR2I> cornerList;
@ -191,7 +191,7 @@ int SCH_SHAPE::GetPenWidth() const
return m_stroke.GetWidth();
// Historically 0 meant "default width" and negative numbers meant "don't stroke".
if( GetWidth() < 0 && GetFillMode() != FILL_T::NO_FILL )
if( GetWidth() < 0 )
return 0;
SCHEMATIC* schematic = Schematic();
@ -212,7 +212,7 @@ void SCH_SHAPE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
VECTOR2I c;
COLOR4D color;
penWidth = std::max( penWidth, aSettings->GetDefaultPenWidth() );
penWidth = std::max( penWidth, aSettings->GetMinPenWidth() );
unsigned ptCount = 0;
VECTOR2I* buffer = nullptr;

View File

@ -70,11 +70,13 @@ 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 );
switch( GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT: SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT ); break;
case GR_TEXT_H_ALIGN_CENTER: break;
case GR_TEXT_H_ALIGN_RIGHT: SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); break;
}
}
UpdateTextPosition();
}
@ -83,31 +85,30 @@ 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 );
switch( GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT: SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT ); break;
case GR_TEXT_H_ALIGN_CENTER: break;
case GR_TEXT_H_ALIGN_RIGHT: SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); break;
}
}
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()
VECTOR2I SCH_TEXTBOX::GetDrawPos() const
{
int margin = GetTextMargin();
BOX2I bbox( m_start, m_end - m_start );
@ -116,17 +117,27 @@ void SCH_TEXTBOX::UpdateTextPosition()
if( GetTextAngle() == ANGLE_VERTICAL )
{
if( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
SetTextPos( VECTOR2I( bbox.GetLeft() + margin, bbox.GetTop() + margin ) );
else
SetTextPos( VECTOR2I( bbox.GetLeft() + margin, bbox.GetBottom() - margin ) );
switch( GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT:
return VECTOR2I( bbox.GetLeft() + margin, bbox.GetBottom() - margin );
case GR_TEXT_H_ALIGN_CENTER:
return VECTOR2I( bbox.GetLeft() + margin, ( bbox.GetTop() + bbox.GetBottom() ) / 2 );
case GR_TEXT_H_ALIGN_RIGHT:
return VECTOR2I( bbox.GetLeft() + margin, bbox.GetTop() + margin );
}
}
else
{
if( GetHorizJustify() == GR_TEXT_H_ALIGN_RIGHT )
SetTextPos( VECTOR2I( bbox.GetRight() - margin, bbox.GetTop() + margin ) );
else
SetTextPos( VECTOR2I( bbox.GetLeft() + margin, bbox.GetTop() + margin ) );
switch( GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT:
return VECTOR2I( bbox.GetLeft() + margin, bbox.GetTop() + margin );
case GR_TEXT_H_ALIGN_CENTER:
return VECTOR2I( ( bbox.GetLeft() + bbox.GetRight() ) / 2, bbox.GetTop() + margin );
case GR_TEXT_H_ALIGN_RIGHT:
return VECTOR2I( bbox.GetRight() - margin, bbox.GetTop() + margin );
}
}
}
@ -164,12 +175,6 @@ bool SCH_TEXTBOX::operator<( const SCH_ITEM& aItem ) const
}
int SCH_TEXTBOX::GetPenWidth() const
{
return GetEffectiveTextPenWidth();
}
KIFONT::FONT* SCH_TEXTBOX::GetDrawFont() const
{
KIFONT::FONT* font = EDA_TEXT::GetFont();
@ -184,7 +189,7 @@ KIFONT::FONT* SCH_TEXTBOX::GetDrawFont() const
void SCH_TEXTBOX::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
{
wxDC* DC = aSettings->GetPrintDC();
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
int penWidth = GetPenWidth();
VECTOR2I pt1 = GetStart();
VECTOR2I pt2 = GetEnd();
COLOR4D color;
@ -192,30 +197,35 @@ void SCH_TEXTBOX::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffs
if( GetFillMode() == FILL_T::FILLED_WITH_COLOR )
GRFilledRect( DC, pt1, pt2, 0, GetFillColor(), GetFillColor() );
if( GetStroke().GetColor() == COLOR4D::UNSPECIFIED )
color = aSettings->GetLayerColor( m_layer );
else
color = GetStroke().GetColor();
if( GetStroke().GetPlotStyle() <= PLOT_DASH_TYPE::FIRST_TYPE )
if( penWidth > 0 )
{
GRRect( DC, pt1, pt2, penWidth, color );
}
else
{
std::vector<SHAPE*> shapes = MakeEffectiveShapes( true );
penWidth = std::max( penWidth, aSettings->GetMinPenWidth() );
for( SHAPE* shape : shapes )
if( GetStroke().GetColor() == COLOR4D::UNSPECIFIED )
color = aSettings->GetLayerColor( m_layer );
else
color = GetStroke().GetColor();
if( GetStroke().GetPlotStyle() <= PLOT_DASH_TYPE::FIRST_TYPE )
{
STROKE_PARAMS::Stroke( shape, GetStroke().GetPlotStyle(), penWidth, aSettings,
[&]( const VECTOR2I& a, const VECTOR2I& b )
{
GRLine( DC, a.x, a.y, b.x, b.y, penWidth, color );
} );
GRRect( DC, pt1, pt2, penWidth, color );
}
else
{
std::vector<SHAPE*> shapes = MakeEffectiveShapes( true );
for( SHAPE* shape : shapes )
delete shape;
for( SHAPE* shape : shapes )
{
STROKE_PARAMS::Stroke( shape, GetStroke().GetPlotStyle(), penWidth, aSettings,
[&]( const VECTOR2I& a, const VECTOR2I& b )
{
GRLine( DC, a.x, a.y, b.x, b.y, penWidth, color );
} );
}
for( SHAPE* shape : shapes )
delete shape;
}
}
color = aSettings->GetLayerColor( m_layer );
@ -314,7 +324,7 @@ void SCH_TEXTBOX::Plot( PLOTTER* aPlotter ) const
{
RENDER_SETTINGS* settings = aPlotter->RenderSettings();
KIFONT::FONT* font = GetDrawFont();
int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
int penWidth = GetPenWidth();
FILL_T fill = m_fill;
COLOR4D color = settings->GetLayerColor( LAYER_NOTES );
@ -332,13 +342,17 @@ void SCH_TEXTBOX::Plot( PLOTTER* aPlotter ) const
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 );
if( penWidth > 0 )
{
penWidth = std::max( penWidth, settings->GetMinPenWidth() );
aPlotter->SetColor( color );
aPlotter->Rect( m_start, m_end, FILL_T::NO_FILL, penWidth );
}
penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
penWidth = std::max( penWidth, settings->GetMinPenWidth() );
aPlotter->SetCurrentLineWidth( penWidth );

View File

@ -53,7 +53,7 @@ public:
int GetTextMargin() const;
void UpdateTextPosition();
VECTOR2I GetDrawPos() const override;
wxString GetShownText( int aDepth = 0 ) const override;
@ -63,8 +63,6 @@ public:
bool operator<( const SCH_ITEM& aItem ) const override;
int GetPenWidth() const override;
KIFONT::FONT* GetDrawFont() const override;
void Move( const VECTOR2I& aMoveVector ) override

View File

@ -664,7 +664,6 @@ void EE_POINT_EDITOR::updateParentItem() const
textbox->SetPosition( mapCoords( topLeft ) );
textbox->SetEnd( mapCoords( botRight ) );
textbox->UpdateTextPosition();
break;
}
@ -750,7 +749,6 @@ void EE_POINT_EDITOR::updateParentItem() const
textBox->SetPosition( topLeft );
textBox->SetEnd( botRight );
textBox->UpdateTextPosition();
break;
}

View File

@ -96,6 +96,7 @@ const std::vector<BITMAP_INFO> g_BitmapInfo = {
{ BITMAPS::text_align_center, wxT( "text_align_center_16.png" ), 16, wxT( "light" ) },
{ BITMAPS::text_align_right, wxT( "text_align_right_16.png" ), 16, wxT( "light" ) },
{ BITMAPS::text_align_bottom, wxT( "text_align_bottom_16.png" ), 16, wxT( "light" ) },
{ BITMAPS::text_align_middle, wxT( "text_align_middle_16.png" ), 16, wxT( "light" ) },
{ BITMAPS::text_align_top, wxT( "text_align_top_16.png" ), 16, wxT( "light" ) },
{ BITMAPS::text_valign_top, wxT( "text_valign_top_16.png" ), 16, wxT( "light" ) },
{ BITMAPS::text_valign_center, wxT( "text_valign_center_16.png" ), 16, wxT( "light" ) },

View File

@ -542,6 +542,7 @@ enum class BITMAPS : unsigned int
text_align_center,
text_align_right,
text_align_top,
text_align_middle,
text_align_bottom,
text_valign_top,
text_valign_center,

View File

@ -113,7 +113,8 @@ class SHAPE_LINE_CHAIN;
//#define SEXPR_BOARD_FILE_VERSION 20211229 // Stroke formatting
//#define SEXPR_BOARD_FILE_VERSION 20211230 // Dimensions in footprints
//#define SEXPR_BOARD_FILE_VERSION 20211231 // Private footprint layers
#define SEXPR_BOARD_FILE_VERSION 20211232 // Fonts
//#define SEXPR_BOARD_FILE_VERSION 20211232 // Fonts
#define SEXPR_BOARD_FILE_VERSION 20220131 // Textboxes
#define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag
#define LEGACY_ARC_FORMATTING 20210925 ///< These were the last to use old arc formatting