From 9c8941e04049d4a7d85f8fa0654bd4ba1bf0aab4 Mon Sep 17 00:00:00 2001
From: Jeff Young
Date: Tue, 14 Apr 2020 13:25:00 +0100
Subject: [PATCH] Remove a bunch of globals.
---
.../3d_canvas/create_3Dgraphic_brd_items.cpp | 14 +-
common/CMakeLists.txt | 1 +
common/dialogs/dialog_page_settings.cpp | 11 +-
common/eda_draw_frame.cpp | 37 ++-
common/eda_text.cpp | 102 +++----
common/gr_text.cpp | 31 +-
common/marker_base.cpp | 7 +-
common/page_layout/ws_data_item.cpp | 2 +-
common/page_layout/ws_draw_item.cpp | 54 ++--
common/page_layout/ws_painter.cpp | 8 +-
common/painter.cpp | 37 ---
common/plotters/DXF_plotter.cpp | 8 +-
common/plotters/GERBER_plotter.cpp | 32 +--
common/plotters/HPGL_plotter.cpp | 1 -
common/plotters/PDF_plotter.cpp | 33 +--
common/plotters/PS_plotter.cpp | 41 +--
common/plotters/SVG_plotter.cpp | 27 +-
common/plotters/common_plot_functions.cpp | 20 +-
common/plotters/plotter.cpp | 8 +-
common/render_settings.cpp | 64 +++++
eeschema/class_libentry.cpp | 16 +-
eeschema/class_libentry.h | 25 +-
.../dialog_edit_component_in_schematic.cpp | 11 +-
eeschema/dialogs/dialog_edit_label.cpp | 4 +-
eeschema/dialogs/dialog_edit_line_style.cpp | 4 +-
.../dialogs/dialog_fields_editor_global.cpp | 3 +-
eeschema/dialogs/dialog_lib_edit_pin.cpp | 8 +-
eeschema/dialogs/dialog_plot_schematic.cpp | 22 +-
eeschema/dialogs/dialog_plot_schematic.h | 19 +-
.../dialogs/dialog_print_using_printer.cpp | 16 +-
eeschema/dialogs/dialog_sch_sheet_props.cpp | 5 +-
eeschema/dialogs/dialog_update_fields.cpp | 3 +-
.../dialogs/panel_eeschema_color_settings.cpp | 3 +-
eeschema/dialogs/panel_setup_formatting.cpp | 20 +-
eeschema/edit_label.cpp | 31 +-
eeschema/eeschema.cpp | 7 -
eeschema/eeschema_config.cpp | 26 +-
eeschema/files-io.cpp | 3 +
eeschema/general.h | 12 -
eeschema/lib_arc.cpp | 38 ++-
eeschema/lib_arc.h | 6 +-
eeschema/lib_bezier.cpp | 50 +---
eeschema/lib_bezier.h | 11 +-
eeschema/lib_circle.cpp | 48 ++--
eeschema/lib_circle.h | 11 +-
eeschema/lib_field.cpp | 48 ++--
eeschema/lib_field.h | 12 +-
eeschema/lib_item.cpp | 9 +-
eeschema/lib_item.h | 23 +-
eeschema/lib_pin.cpp | 212 +++++++-------
eeschema/lib_pin.h | 47 +--
eeschema/lib_polyline.cpp | 54 ++--
eeschema/lib_polyline.h | 6 +-
eeschema/lib_rectangle.cpp | 44 +--
eeschema/lib_rectangle.h | 6 +-
eeschema/lib_text.cpp | 53 ++--
eeschema/lib_text.h | 12 +-
eeschema/libedit/lib_edit_frame.cpp | 25 ++
eeschema/libedit/lib_edit_frame.h | 2 +-
eeschema/libedit/libedit_plot_component.cpp | 19 +-
eeschema/plot_schematic_DXF.cpp | 12 +-
eeschema/plot_schematic_HPGL.cpp | 2 +-
eeschema/plot_schematic_PDF.cpp | 13 +-
eeschema/plot_schematic_PS.cpp | 20 +-
eeschema/plot_schematic_SVG.cpp | 23 +-
eeschema/project_rescue.cpp | 2 +
eeschema/sch_base_frame.cpp | 4 +-
eeschema/sch_base_frame.h | 8 +
eeschema/sch_bitmap.cpp | 10 +-
eeschema/sch_bitmap.h | 4 +-
eeschema/sch_bus_entry.cpp | 39 ++-
eeschema/sch_bus_entry.h | 6 +-
eeschema/sch_component.cpp | 21 +-
eeschema/sch_component.h | 2 +-
eeschema/sch_eagle_plugin.cpp | 2 +-
eeschema/sch_edit_frame.cpp | 8 +-
eeschema/sch_edit_frame.h | 2 +-
eeschema/sch_field.cpp | 43 ++-
eeschema/sch_field.h | 6 +-
eeschema/sch_item.h | 11 +-
eeschema/sch_junction.cpp | 14 +-
eeschema/sch_junction.h | 2 +-
eeschema/sch_legacy_plugin.cpp | 8 +-
eeschema/sch_line.cpp | 39 +--
eeschema/sch_line.h | 4 +-
eeschema/sch_marker.cpp | 4 +-
eeschema/sch_marker.h | 2 +-
eeschema/sch_no_connect.cpp | 43 ++-
eeschema/sch_no_connect.h | 4 +-
eeschema/sch_painter.cpp | 101 +++----
eeschema/sch_painter.h | 31 +-
eeschema/sch_pin.h | 9 +-
eeschema/sch_preview_panel.cpp | 2 +-
eeschema/sch_screen.cpp | 87 ++++--
eeschema/sch_screen.h | 8 +-
eeschema/sch_sexpr_parser.cpp | 2 +-
eeschema/sch_sheet.cpp | 33 +--
eeschema/sch_sheet.h | 23 +-
eeschema/sch_sheet_pin.cpp | 11 +-
eeschema/sch_text.cpp | 203 +++++++------
eeschema/sch_text.h | 35 +--
eeschema/sheet.cpp | 7 +-
eeschema/tools/lib_drawing_tools.cpp | 2 +-
eeschema/tools/lib_edit_tool.cpp | 2 +-
eeschema/tools/sch_editor_control.cpp | 2 +
eeschema/tools/sch_line_wire_bus_tool.cpp | 3 +-
include/eda_draw_frame.h | 15 +-
include/eda_text.h | 84 +++---
include/gr_text.h | 12 +-
include/marker_base.h | 10 +-
include/painter.h | 227 +--------------
include/plotter.h | 123 ++++----
include/render_settings.h | 271 ++++++++++++++++++
include/ws_draw_item.h | 50 ++--
include/ws_painter.h | 11 +-
.../dialogs/dialogs_for_printing.cpp | 8 +-
pagelayout_editor/pl_editor_frame.cpp | 4 +-
pagelayout_editor/pl_editor_frame.h | 2 +-
pcbnew/altium2kicadpcb_plugin/altium_pcb.cpp | 6 +-
...board_items_to_polygon_shape_transform.cpp | 16 +-
pcbnew/class_dimension.cpp | 6 +-
pcbnew/class_marker_pcb.cpp | 10 +
pcbnew/class_marker_pcb.h | 5 +-
pcbnew/class_pcb_text.cpp | 19 +-
pcbnew/class_pcb_text.h | 2 +-
pcbnew/class_text_mod.cpp | 16 +-
pcbnew/class_text_mod.h | 2 +-
pcbnew/class_track.cpp | 2 +-
.../dialog_edit_footprint_for_BoardEditor.cpp | 2 +-
.../dialog_edit_footprint_for_fp_editor.cpp | 2 +-
.../dialog_global_edit_text_and_graphics.cpp | 4 +-
pcbnew/dialogs/dialog_text_properties.cpp | 10 +-
pcbnew/drc/drc.cpp | 4 +-
pcbnew/eagle_plugin.cpp | 8 +-
pcbnew/exporters/export_vrml.cpp | 14 +-
pcbnew/exporters/gen_drill_report_files.cpp | 12 +-
pcbnew/footprint_libraries_utils.cpp | 4 +-
pcbnew/gpcb_plugin.cpp | 4 +-
.../import_gfx/graphics_importer_pcbnew.cpp | 2 +-
pcbnew/legacy_plugin.cpp | 6 +-
pcbnew/microwave/microwave_footprint.cpp | 4 +-
pcbnew/pad_print_functions.cpp | 4 +-
pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp | 4 +-
pcbnew/pcad2kicadpcb_plugin/pcb_text.cpp | 2 +-
pcbnew/pcb_painter.cpp | 15 +-
pcbnew/pcb_parser.cpp | 3 +-
pcbnew/pcbplot.cpp | 3 +
pcbnew/plot_board_layers.cpp | 20 +-
pcbnew/plot_brditems_plotter.cpp | 31 +-
pcbnew/router/pns_kicad_iface.cpp | 2 +-
pcbnew/text_mod_grid_table.cpp | 5 +-
pcbnew/tools/drawing_tool.cpp | 6 +-
152 files changed, 1738 insertions(+), 1765 deletions(-)
create mode 100644 common/render_settings.cpp
create mode 100644 include/render_settings.h
diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp
index a6a7299745..e6fdbc83e1 100644
--- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp
+++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp
@@ -93,7 +93,7 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const TEXTE_PCB* aText,
s_boardItem = (const BOARD_ITEM *) &aText;
s_dstcontainer = aDstContainer;
- s_textWidth = aText->GetEffectiveTextPenWidth( nullptr ) + ( 2 * aClearanceValue );
+ s_textWidth = aText->GetEffectiveTextPenWidth() + ( 2 * aClearanceValue );
s_biuTo3Dunits = m_biuTo3Dunits;
// not actually used, but needed by GRText
@@ -107,22 +107,22 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const TEXTE_PCB* aText,
wxStringSplit( aText->GetShownText(), strings_list, '\n' );
std::vector positions;
positions.reserve( strings_list.Count() );
- aText->GetPositionsOfLinesOfMultilineText( positions, strings_list.Count() );
+ aText->GetLinePositions( positions, strings_list.Count());
for( unsigned ii = 0; ii < strings_list.Count(); ++ii )
{
wxString txt = strings_list.Item( ii );
GRText( nullptr, positions[ii], dummy_color, txt, aText->GetTextAngle(), size,
- aText->GetHorizJustify(), aText->GetVertJustify(), penWidth, aText->IsItalic(),
- penWidth, addTextSegmToContainer );
+ aText->GetHorizJustify(), aText->GetVertJustify(), penWidth,
+ aText->IsItalic(), forceBold, 0, addTextSegmToContainer );
}
}
else
{
GRText( nullptr, aText->GetTextPos(), dummy_color, aText->GetShownText(),
aText->GetTextAngle(), size, aText->GetHorizJustify(), aText->GetVertJustify(),
- penWidth, aText->IsItalic(), penWidth, addTextSegmToContainer );
+ penWidth, aText->IsItalic(), forceBold, 0, addTextSegmToContainer );
}
}
@@ -217,7 +217,7 @@ void BOARD_ADAPTER::AddGraphicsShapesWithClearanceToContainer( const MODULE* aMo
for( TEXTE_MODULE* text : texts )
{
- s_textWidth = text->GetEffectiveTextPenWidth( nullptr ) + ( 2 * aInflateValue );
+ s_textWidth = text->GetEffectiveTextPenWidth() + ( 2 * aInflateValue );
wxSize size = text->GetTextSize();
bool forceBold = true;
int penWidth = 0; // force max width for bold
@@ -227,7 +227,7 @@ void BOARD_ADAPTER::AddGraphicsShapesWithClearanceToContainer( const MODULE* aMo
GRText( NULL, text->GetTextPos(), BLACK, text->GetShownText(), text->GetDrawRotation(),
size, text->GetHorizJustify(), text->GetVertJustify(), penWidth, text->IsItalic(),
- forceBold, addTextSegmToContainer );
+ forceBold, 0, addTextSegmToContainer );
}
}
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 821e787afc..b7df8e01d9 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -330,6 +330,7 @@ set( COMMON_SRCS
ptree.cpp
rc_item.cpp
refdes_utils.cpp
+ render_settings.cpp
reporter.cpp
richio.cpp
search_stack.cpp
diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp
index 5647f715a7..639a3208d5 100644
--- a/common/dialogs/dialog_page_settings.cpp
+++ b/common/dialogs/dialog_page_settings.cpp
@@ -756,10 +756,15 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
GRResetPenAndBrush( &memDC );
WS_DATA_MODEL::SetAltInstance( m_pagelayout );
+ KIGFX::WS_RENDER_SETTINGS renderSettings;
+ renderSettings.SetDefaultPenWidth( 1 );
+ renderSettings.SetLayerColor( LAYER_WORKSHEET, COLOR4D( RED ) );
+ renderSettings.SetPrintDC( &memDC );
+
GRFilledRect( NULL, &memDC, 0, 0, m_layout_size.x, m_layout_size.y, WHITE, WHITE );
- PrintPageLayout( &memDC, pageDUMMY, emptyString, emptyString, m_tb,
- m_screen->m_NumberOfScreens, m_screen->m_ScreenNumber, 1, 1, RED,
- &Prj() );
+
+ PrintPageLayout( &renderSettings, pageDUMMY, emptyString, emptyString, m_tb,
+ m_screen->m_NumberOfScreens, m_screen->m_ScreenNumber, 1, &Prj() );
memDC.SelectObject( wxNullBitmap );
m_PageLayoutExampleBitmap->SetBitmap( *m_page_bitmap );
diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp
index cfb369994a..5e902ecee9 100644
--- a/common/eda_draw_frame.cpp
+++ b/common/eda_draw_frame.cpp
@@ -243,7 +243,7 @@ void EDA_DRAW_FRAME::OnUpdateSelectGrid( wxUpdateUIEvent& aEvent )
}
-void EDA_DRAW_FRAME::PrintPage( wxDC* aDC )
+void EDA_DRAW_FRAME::PrintPage( RENDER_SETTINGS* aSettings )
{
wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error") );
}
@@ -728,14 +728,14 @@ void EDA_DRAW_FRAME::FocusOnLocation( const wxPoint& aPos )
static const wxString productName = wxT( "KiCad E.D.A. " );
-void PrintPageLayout( wxDC* aDC, const PAGE_INFO& aPageInfo, const wxString& aFullSheetName,
- const wxString& aFileName, const TITLE_BLOCK& aTitleBlock, int aSheetCount,
- int aSheetNumber, int aPenWidth, double aScalar, COLOR4D aColor,
- const PROJECT* aProject, const wxString& aSheetLayer )
+void PrintPageLayout( RENDER_SETTINGS* aSettings, const PAGE_INFO& aPageInfo,
+ const wxString& aFullSheetName, const wxString& aFileName,
+ const TITLE_BLOCK& aTitleBlock, int aSheetCount, int aSheetNumber,
+ double aScalar, const PROJECT* aProject, const wxString& aSheetLayer )
{
WS_DRAW_ITEM_LIST drawList;
- drawList.SetDefaultPenSize( aPenWidth );
+ drawList.SetDefaultPenSize( aSettings->GetDefaultPenWidth() );
drawList.SetMilsToIUfactor( aScalar );
drawList.SetSheetNumber( aSheetNumber );
drawList.SetSheetCount( aSheetCount );
@@ -747,35 +747,34 @@ void PrintPageLayout( wxDC* aDC, const PAGE_INFO& aPageInfo, const wxString& aFu
drawList.BuildWorkSheetGraphicList( aPageInfo, aTitleBlock );
// Draw item list
- drawList.Print( aDC, aColor );
+ drawList.Print( aSettings );
}
-void EDA_DRAW_FRAME::PrintWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
+void EDA_DRAW_FRAME::PrintWorkSheet( RENDER_SETTINGS* aSettings, BASE_SCREEN* aScreen,
double aScalar, const wxString &aFilename,
- const wxString &aSheetLayer, COLOR4D aColor )
+ const wxString &aSheetLayer )
{
if( !m_showBorderAndTitleBlock )
return;
- COLOR4D color = ( aColor != COLOR4D::UNSPECIFIED ) ? aColor : COLOR4D( RED );
-
- wxPoint origin = aDC->GetDeviceOrigin();
+ wxDC* DC = aSettings->GetPrintDC();
+ wxPoint origin = DC->GetDeviceOrigin();
if( origin.y > 0 )
{
- aDC->SetDeviceOrigin( 0, 0 );
- aDC->SetAxisOrientation( true, false );
+ DC->SetDeviceOrigin( 0, 0 );
+ DC->SetAxisOrientation( true, false );
}
- PrintPageLayout( aDC, GetPageSettings(), GetScreenDesc(), aFilename, GetTitleBlock(),
- aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber, aLineWidth, aScalar,
- color, &Prj(), aSheetLayer );
+ PrintPageLayout( aSettings, GetPageSettings(), GetScreenDesc(), aFilename, GetTitleBlock(),
+ aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber, aScalar, &Prj(),
+ aSheetLayer );
if( origin.y > 0 )
{
- aDC->SetDeviceOrigin( origin.x, origin.y );
- aDC->SetAxisOrientation( true, true );
+ DC->SetDeviceOrigin( origin.x, origin.y );
+ DC->SetAxisOrientation( true, true );
}
}
diff --git a/common/eda_text.cpp b/common/eda_text.cpp
index 4d90b74c91..6de857e015 100644
--- a/common/eda_text.cpp
+++ b/common/eda_text.cpp
@@ -83,7 +83,8 @@ EDA_TEXT_VJUSTIFY_T EDA_TEXT::MapVertJustify( int aVertJustify )
}
-EDA_TEXT::EDA_TEXT( const wxString& text ) :
+EDA_TEXT::EDA_TEXT( const wxString& text, int aTextMarkupFlags ) :
+ m_textMarkupFlags( aTextMarkupFlags ),
m_text( text ),
m_e( 1<GetDefaultTextThickness();
+ if( width <= 0 )
+ {
+ if( IsBold() )
+ width = GetPenSizeForBold( GetTextWidth() );
+ else
+ width = 1;
+ }
// Clip pen size for small texts:
width = Clamp_Text_PenSize( width, GetTextSize(), IsBold() );
@@ -198,15 +202,14 @@ int EDA_TEXT::GetInterline() const
}
-EDA_RECT EDA_TEXT::GetTextBox( RENDER_SETTINGS* aSettings, int aLine, bool aInvertY ) const
+EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
{
EDA_RECT rect;
wxArrayString strings;
wxString text = GetShownText();
- int thickness = GetEffectiveTextPenWidth( aSettings );
+ int thickness = GetEffectiveTextPenWidth();
int linecount = 1;
bool hasOverBar = false; // true if the first line of text as an overbar
- int markupFlags = aSettings ? aSettings->GetTextMarkupFlags() : 0;
if( IsMultilineAllowed() )
{
@@ -236,14 +239,14 @@ EDA_RECT EDA_TEXT::GetTextBox( RENDER_SETTINGS* aSettings, int aLine, bool aInve
// calculate the H and V size
const auto& font = basic_gal.GetStrokeFont();
- VECTOR2D size( GetTextSize() );
+ VECTOR2D fontSize( GetTextSize() );
double penWidth( thickness );
- int dx = KiROUND( font.ComputeStringBoundaryLimits( text, size, penWidth, markupFlags ).x );
- int dy = GetInterline();
+ int dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth,
+ m_textMarkupFlags ).x );
+ int dy = GetInterline();
- // Creates bounding box (rectangle) for an horizontal
- // and left and top justified text. the bounding box will be moved later
- // according to the actual text options
+ // Creates bounding box (rectangle) for horizontal, left and top justified text. The
+ // bounding box will be moved later according to the actual text options
wxSize textsize = wxSize( dx, dy );
wxPoint pos = GetTextPos();
@@ -263,7 +266,9 @@ EDA_RECT EDA_TEXT::GetTextBox( RENDER_SETTINGS* aSettings, int aLine, bool aInve
{ // A overbar adds an extra size to the text
// Height from the base line text of chars like [ or {
double curr_height = GetTextHeight() * 1.15;
- int extra_height = KiROUND( font.ComputeOverbarVerticalPosition( size.y, penWidth ) - curr_height );
+ double overbarPosition = font.ComputeOverbarVerticalPosition( fontSize.y, penWidth );
+ int extra_height = KiROUND( overbarPosition - curr_height );
+
extra_height += thickness / 2;
textsize.y += extra_height;
rect.Move( wxPoint( 0, -extra_height ) );
@@ -276,7 +281,8 @@ EDA_RECT EDA_TEXT::GetTextBox( RENDER_SETTINGS* aSettings, int aLine, bool aInve
for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
{
text = strings.Item( ii );
- dx = KiROUND( font.ComputeStringBoundaryLimits( text, size, penWidth, markupFlags ).x );
+ dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth,
+ m_textMarkupFlags ).x );
textsize.x = std::max( textsize.x, dx );
textsize.y += dy;
}
@@ -353,7 +359,7 @@ EDA_RECT EDA_TEXT::GetTextBox( RENDER_SETTINGS* aSettings, int aLine, bool aInve
bool EDA_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
{
- EDA_RECT rect = GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
+ EDA_RECT rect = GetTextBox();
wxPoint location = aPoint;
rect.Inflate( aAccuracy );
@@ -370,13 +376,14 @@ bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy
rect.Inflate( aAccuracy );
if( aContains )
- return rect.Contains( GetTextBox( nullptr ) ); // JEY TODO: requires RENDER_SETTINGS
+ return rect.Contains( GetTextBox() );
- return rect.Intersects( GetTextBox( nullptr ), GetTextAngle() ); // JEY TODO: requires RENDER_SETTINGS
+ return rect.Intersects( GetTextBox(), GetTextAngle() );
}
-void EDA_TEXT::Print( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor, EDA_DRAW_MODE_T aFillMode )
+void EDA_TEXT::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, COLOR4D aColor,
+ EDA_DRAW_MODE_T aFillMode )
{
if( IsMultilineAllowed() )
{
@@ -386,21 +393,19 @@ void EDA_TEXT::Print( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor, EDA_DRA
positions.reserve( strings.Count() );
- GetPositionsOfLinesOfMultilineText( positions, strings.Count() );
+ GetLinePositions( positions, strings.Count());
for( unsigned ii = 0; ii < strings.Count(); ii++ )
- {
- wxString& txt = strings.Item( ii );
- printOneLineOfText( aDC, aOffset, aColor, aFillMode, txt, positions[ii] );
- }
+ printOneLineOfText( aSettings, aOffset, aColor, aFillMode, strings[ii], positions[ii] );
}
else
- printOneLineOfText( aDC, aOffset, aColor, aFillMode, GetShownText(), GetTextPos() );
+ {
+ printOneLineOfText( aSettings, aOffset, aColor, aFillMode, GetShownText(), GetTextPos() );
+ }
}
-void EDA_TEXT::GetPositionsOfLinesOfMultilineText(
- std::vector& aPositions, int aLineCount ) const
+void EDA_TEXT::GetLinePositions( std::vector& aPositions, int aLineCount ) const
{
wxPoint pos = GetTextPos(); // Position of first line of the
// multiline text according to
@@ -441,22 +446,23 @@ void EDA_TEXT::GetPositionsOfLinesOfMultilineText(
}
}
-void EDA_TEXT::printOneLineOfText( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor,
- EDA_DRAW_MODE_T aFillMode, const wxString& aText,
- const wxPoint &aPos )
+void EDA_TEXT::printOneLineOfText( RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
+ COLOR4D aColor, EDA_DRAW_MODE_T aFillMode,
+ const wxString& aText, const wxPoint &aPos )
{
- int width = GetEffectiveTextPenWidth( nullptr );
+ wxDC* DC = aSettings->GetPrintDC();
+ int penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetDefaultPenWidth() );
if( aFillMode == SKETCH )
- width = -width;
+ penWidth = -penWidth;
wxSize size = GetTextSize();
if( IsMirrored() )
size.x = -size.x;
- GRText( aDC, aOffset + aPos, aColor, aText, GetTextAngle(), size, GetHorizJustify(),
- GetVertJustify(), width, IsItalic(), IsBold() );
+ GRText( DC, aOffset + aPos, aColor, aText, GetTextAngle(), size, GetHorizJustify(),
+ GetVertJustify(), penWidth, IsItalic(), IsBold(), m_textMarkupFlags );
}
@@ -483,11 +489,11 @@ wxString EDA_TEXT::GetTextStyleName()
bool EDA_TEXT::IsDefaultFormatting() const
{
- return ( IsVisible()
- && !IsMirrored()
- && GetHorizJustify() == GR_TEXT_HJUSTIFY_CENTER
- && GetVertJustify() == GR_TEXT_VJUSTIFY_CENTER
- && GetTextPenWidth() == 0
+ return ( IsVisible()
+ && !IsMirrored()
+ && GetHorizJustify() == GR_TEXT_HJUSTIFY_CENTER
+ && GetVertJustify() == GR_TEXT_VJUSTIFY_CENTER
+ && GetTextThickness() == 0
&& !IsItalic()
&& !IsBold()
&& !IsMultilineAllowed()
@@ -510,8 +516,8 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
FormatInternalUnits( GetTextHeight() ).c_str(),
FormatInternalUnits( GetTextWidth() ).c_str() );
- if( GetTextPenWidth() )
- aFormatter->Print( 0, " (thickness %s)", FormatInternalUnits( GetTextPenWidth() ).c_str() );
+ if( GetTextThickness() )
+ aFormatter->Print( 0, " (thickness %s)", FormatInternalUnits( GetTextThickness() ).c_str() );
if( IsBold() )
aFormatter->Print( 0, " bold" );
@@ -577,20 +583,20 @@ void EDA_TEXT::TransformTextShapeToSegmentList( std::vector& aCornerBuf
wxStringSplit( GetShownText(), strings_list, wxChar('\n') );
std::vector positions;
positions.reserve( strings_list.Count() );
- GetPositionsOfLinesOfMultilineText( positions,strings_list.Count() );
+ GetLinePositions( positions, strings_list.Count());
for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
{
wxString txt = strings_list.Item( ii );
GRText( NULL, positions[ii], color, txt, GetTextAngle(), size, GetHorizJustify(),
- GetVertJustify(), penWidth, IsItalic(), forceBold, addTextSegmToBuffer,
+ GetVertJustify(), penWidth, IsItalic(), forceBold, 0, addTextSegmToBuffer,
&aCornerBuffer );
}
}
else
{
GRText( NULL, GetTextPos(), color, GetText(), GetTextAngle(), size, GetHorizJustify(),
- GetVertJustify(), penWidth, IsItalic(), forceBold, addTextSegmToBuffer,
+ GetVertJustify(), penWidth, IsItalic(), forceBold, 0, addTextSegmToBuffer,
&aCornerBuffer );
}
}
diff --git a/common/gr_text.cpp b/common/gr_text.cpp
index e9f04d53cf..5525706a68 100644
--- a/common/gr_text.cpp
+++ b/common/gr_text.cpp
@@ -43,21 +43,6 @@
#include
-static int s_textMarkupFlags = 0;
-
-
-void SetTextMarkupFlags( int aMarkupFlags )
-{
- s_textMarkupFlags = aMarkupFlags;
-}
-
-
-int GetTextMarkupFlags()
-{
- return s_textMarkupFlags;
-}
-
-
/**
* Function GetPensizeForBold
* @return the "best" value for a pen size to draw/plot a bold text
@@ -143,7 +128,7 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool aItalic,
void GRText( wxDC* aDC, const wxPoint& aPos, COLOR4D aColor, const wxString& aText,
double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold,
- void (* aCallback)( int x0, int y0, int xf, int yf, void* aData ),
+ int aMarkupFlags, void (* aCallback)( int x0, int y0, int xf, int yf, void* aData ),
void* aCallbackData, PLOTTER* aPlotter )
{
bool fill_mode = true;
@@ -181,14 +166,14 @@ void GRText( wxDC* aDC, const wxPoint& aPos, COLOR4D aColor, const wxString& aTe
basic_gal.m_Color = aColor;
basic_gal.SetClipBox( nullptr );
- basic_gal.StrokeText( aText, VECTOR2D( aPos ), aOrient * M_PI/1800, GetTextMarkupFlags() );
+ basic_gal.StrokeText( aText, VECTOR2D( aPos ), aOrient * M_PI/1800, aMarkupFlags );
}
-void GRHaloText( wxDC * aDC, const wxPoint &aPos, const COLOR4D aBgColor, COLOR4D aColor1,
+void GRHaloText( wxDC * aDC, const wxPoint &aPos, COLOR4D aBgColor, COLOR4D aColor1,
COLOR4D aColor2, const wxString &aText, double aOrient, const wxSize &aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify,
- int aWidth, bool aItalic, bool aBold,
+ int aWidth, bool aItalic, bool aBold, int aMarkupFlags,
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ),
void* aCallbackData, PLOTTER * aPlotter )
{
@@ -203,13 +188,14 @@ void GRHaloText( wxDC * aDC, const wxPoint &aPos, const COLOR4D aBgColor, COLOR4
// Draw the background
GRText( aDC, aPos, aColor1, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
- aBold, aCallback, aCallbackData, aPlotter );
+ aBold, aMarkupFlags, aCallback, aCallbackData, aPlotter );
// Draw the text
GRText( aDC, aPos, aColor2, aText, aOrient, aSize, aH_justify, aV_justify, aWidth/4, aItalic,
- aBold, aCallback, aCallbackData, aPlotter );
+ aBold, aMarkupFlags, aCallback, aCallbackData, aPlotter );
}
+
/**
* Function PLOTTER::Text
* same as GRText, but plot graphic text insteed of draw it
@@ -237,11 +223,12 @@ void PLOTTER::Text( const wxPoint& aPos,
int aPenWidth,
bool aItalic,
bool aBold,
+ int aTextMarkupFlags,
bool aMultilineAllowed,
void* aData )
{
SetColor( aColor );
GRText( NULL, aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aPenWidth,
- aItalic, aBold, nullptr, nullptr, this );
+ aItalic, aBold, aTextMarkupFlags, nullptr, nullptr, this );
}
diff --git a/common/marker_base.cpp b/common/marker_base.cpp
index 486417c3d3..50481f97a6 100644
--- a/common/marker_base.cpp
+++ b/common/marker_base.cpp
@@ -36,6 +36,7 @@
#include "macros.h"
#include "marker_base.h"
#include
+#include
#include "dialog_display_info_HTML_base.h"
@@ -182,8 +183,10 @@ EDA_RECT MARKER_BASE::GetBoundingBoxMarker() const
}
-void MARKER_BASE::PrintMarker( wxDC* aDC, const wxPoint& aOffset )
+void MARKER_BASE::PrintMarker( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
+ wxDC* DC = aSettings->GetPrintDC();
+
// Build the marker shape polygon in internal units:
std::vector shape;
shape.reserve( CORNERS_COUNT );
@@ -191,5 +194,5 @@ void MARKER_BASE::PrintMarker( wxDC* aDC, const wxPoint& aOffset )
for( const VECTOR2I& corner : MarkerShapeCorners )
shape.emplace_back( corner * MarkerScale() + m_Pos + aOffset );
- GRClosedPoly( nullptr, aDC, CORNERS_COUNT, &shape[0], true, 0, getColor(), getColor() );
+ GRClosedPoly( nullptr, DC, CORNERS_COUNT, &shape[0], true, 0, getColor(), getColor() );
}
diff --git a/common/page_layout/ws_data_item.cpp b/common/page_layout/ws_data_item.cpp
index 63704135cf..4c2359bc38 100644
--- a/common/page_layout/ws_data_item.cpp
+++ b/common/page_layout/ws_data_item.cpp
@@ -714,7 +714,7 @@ void WS_DATA_ITEM_TEXT::SetConstrainedTextSize()
dummy.SetVertJustify( m_Vjustify );
dummy.SetTextAngle( m_Orient * 10 );
- EDA_RECT rect = dummy.GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
+ EDA_RECT rect = dummy.GetTextBox();
DSIZE size;
size.x = rect.GetWidth() / FSCALE;
size.y = rect.GetHeight() / FSCALE;
diff --git a/common/page_layout/ws_draw_item.cpp b/common/page_layout/ws_draw_item.cpp
index 41d5186526..a4e6f1b973 100644
--- a/common/page_layout/ws_draw_item.cpp
+++ b/common/page_layout/ws_draw_item.cpp
@@ -155,15 +155,15 @@ void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aLis
// ============================ TEXT ==============================
-void WS_DRAW_ITEM_TEXT::PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor )
+void WS_DRAW_ITEM_TEXT::PrintWsItem( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
- Print( aDC, aOffset, aColor, FILLED );
+ Print( aSettings, aOffset, aSettings->GetLayerColor( LAYER_WORKSHEET ), FILLED );
}
const EDA_RECT WS_DRAW_ITEM_TEXT::GetBoundingBox() const
{
- return EDA_TEXT::GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
+ return EDA_TEXT::GetTextBox();
}
@@ -190,8 +190,12 @@ wxString WS_DRAW_ITEM_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
// ============================ POLYGON =================================
-void WS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor )
+void WS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
+ wxDC* DC = aSettings->GetPrintDC();
+ COLOR4D color = aSettings->GetLayerColor( LAYER_WORKSHEET );
+ int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
+
std::vector points_moved;
for( int idx = 0; idx < m_Polygons.OutlineCount(); ++idx )
@@ -200,11 +204,13 @@ void WS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem( wxDC* aDC, const wxPoint& aOffset,
SHAPE_LINE_CHAIN& outline = m_Polygons.Outline( idx );
for( int ii = 0; ii < outline.PointCount(); ii++ )
- points_moved.emplace_back(
- outline.CPoint( ii ).x + aOffset.x, outline.CPoint( ii ).y + aOffset.y );
+ {
+ points_moved.emplace_back( outline.CPoint( ii ).x + aOffset.x,
+ outline.CPoint( ii ).y + aOffset.y );
+ }
- GRPoly( nullptr, aDC, points_moved.size(), &points_moved[0], FILLED_SHAPE,
- GetPenWidth(), aColor, aColor );
+ GRPoly( nullptr, DC, points_moved.size(), &points_moved[0], FILLED_SHAPE, penWidth,
+ color, color );
}
}
@@ -289,10 +295,14 @@ wxString WS_DRAW_ITEM_POLYPOLYGONS::GetSelectMenuText( EDA_UNITS aUnits ) const
// ============================ RECT ==============================
-void WS_DRAW_ITEM_RECT::PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor )
+void WS_DRAW_ITEM_RECT::PrintWsItem( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
- GRRect( nullptr, aDC, GetStart().x + aOffset.x, GetStart().y + aOffset.y,
- GetEnd().x + aOffset.x, GetEnd().y + aOffset.y, GetPenWidth(), aColor );
+ wxDC* DC = aSettings->GetPrintDC();
+ COLOR4D color = aSettings->GetLayerColor( LAYER_WORKSHEET );
+ int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
+
+ GRRect( nullptr, DC, GetStart().x + aOffset.x, GetStart().y + aOffset.y,
+ GetEnd().x + aOffset.x, GetEnd().y + aOffset.y, penWidth, color );
}
@@ -348,9 +358,13 @@ wxString WS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS aUnits ) const
// ============================ LINE ==============================
-void WS_DRAW_ITEM_LINE::PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor )
+void WS_DRAW_ITEM_LINE::PrintWsItem( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
- GRLine( nullptr, aDC, GetStart() + aOffset, GetEnd() + aOffset, GetPenWidth(), aColor );
+ wxDC* DC = aSettings->GetPrintDC();
+ COLOR4D color = aSettings->GetLayerColor( LAYER_WORKSHEET );
+ int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
+
+ GRLine( nullptr, DC, GetStart() + aOffset, GetEnd() + aOffset, penWidth, color );
}
@@ -362,7 +376,7 @@ const EDA_RECT WS_DRAW_ITEM_LINE::GetBoundingBox() const
bool WS_DRAW_ITEM_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
- int mindist = aAccuracy + ( GetPenWidth() / 2 );
+ int mindist = aAccuracy + ( GetPenWidth() / 2 ) + 1;
return TestSegmentHit( aPosition, GetStart(), GetEnd(), mindist );
}
@@ -379,12 +393,12 @@ wxString WS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const
// ============== BITMAP ================
-void WS_DRAW_ITEM_BITMAP::PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor )
+void WS_DRAW_ITEM_BITMAP::PrintWsItem( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
WS_DATA_ITEM_BITMAP* bitmap = (WS_DATA_ITEM_BITMAP*) GetPeer();
- if( bitmap->m_ImageBitmap )
- bitmap->m_ImageBitmap->DrawBitmap( aDC, m_pos + aOffset );
+ if( bitmap->m_ImageBitmap )
+ bitmap->m_ImageBitmap->DrawBitmap( aSettings->GetPrintDC(), m_pos + aOffset );
}
@@ -480,20 +494,20 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( const PAGE_INFO& aPageInfo,
* The selected items are drawn after (usually 0 or 1)
* to be sure they are seen, even for overlapping items
*/
-void WS_DRAW_ITEM_LIST::Print( wxDC* aDC, COLOR4D aColor )
+void WS_DRAW_ITEM_LIST::Print( RENDER_SETTINGS* aSettings )
{
std::vector second_items;
for( WS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() )
{
if( item->Type() == WSG_BITMAP_T )
- item->PrintWsItem( aDC, aColor );
+ item->PrintWsItem( aSettings );
else
second_items.push_back( item );
}
for( auto item : second_items )
- item->PrintWsItem( aDC, aColor );
+ item->PrintWsItem( aSettings );
}
diff --git a/common/page_layout/ws_painter.cpp b/common/page_layout/ws_painter.cpp
index bdddedad56..eaec92dbbd 100644
--- a/common/page_layout/ws_painter.cpp
+++ b/common/page_layout/ws_painter.cpp
@@ -250,7 +250,7 @@ void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_LINE* aItem, int aLayer ) const
m_gal->SetIsStroke( true );
m_gal->SetIsFill( false );
m_gal->SetStrokeColor( m_renderSettings.GetColor( aItem, aLayer ) );
- m_gal->SetLineWidth( aItem->GetPenWidth() );
+ m_gal->SetLineWidth( std::max( aItem->GetPenWidth(), m_renderSettings.GetDefaultPenWidth() ) );
m_gal->DrawLine( VECTOR2D( aItem->GetStart() ), VECTOR2D( aItem->GetEnd() ) );
}
@@ -260,7 +260,7 @@ void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_RECT* aItem, int aLayer ) const
m_gal->SetIsStroke( true );
m_gal->SetIsFill( false );
m_gal->SetStrokeColor( m_renderSettings.GetColor( aItem, aLayer ) );
- m_gal->SetLineWidth( aItem->GetPenWidth() );
+ m_gal->SetLineWidth( std::max( aItem->GetPenWidth(), m_renderSettings.GetDefaultPenWidth() ) );
m_gal->DrawRectangle( VECTOR2D( aItem->GetStart() ), VECTOR2D( aItem->GetEnd() ) );
}
@@ -284,12 +284,14 @@ void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_POLYPOLYGONS* aItem, int aLayer
void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_TEXT* aItem, int aLayer ) const
{
VECTOR2D position( aItem->GetTextPos().x, aItem->GetTextPos().y );
+ int penWidth = std::max( aItem->GetEffectiveTextPenWidth(),
+ m_renderSettings.GetDefaultPenWidth() );
m_gal->Save();
m_gal->Translate( position );
m_gal->Rotate( -aItem->GetTextAngle() * M_PI / 1800.0 );
m_gal->SetStrokeColor( m_renderSettings.GetColor( aItem, aLayer ) );
- m_gal->SetLineWidth( aItem->GetEffectiveTextPenWidth( nullptr ) ); // JEY TODO: requires RENDER_SETTINGS
+ m_gal->SetLineWidth( penWidth );
m_gal->SetTextAttributes( aItem );
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
diff --git a/common/painter.cpp b/common/painter.cpp
index bb994e38d1..525203f693 100644
--- a/common/painter.cpp
+++ b/common/painter.cpp
@@ -29,43 +29,6 @@
using namespace KIGFX;
-RENDER_SETTINGS::RENDER_SETTINGS()
-{
- // Set the default initial values
- m_highlightFactor = 0.5f;
- m_selectFactor = 0.5f;
- m_highlightItems = false;
- m_highlightEnabled = false;
- m_hiContrastEnabled = false;
- m_hiContrastFactor = 0.2f; //TODO: Make this user-configurable
- m_highlightNetcode = -1;
- m_outlineWidth = 1;
- m_worksheetLineWidth = 100000;
- m_defaultPenWidth = 0;
- m_textMarkupFlags = 0;
- m_showPageLimits = false;
-}
-
-
-RENDER_SETTINGS::~RENDER_SETTINGS()
-{
-}
-
-
-void RENDER_SETTINGS::update()
-{
- // Calculate darkened/highlighted variants of layer colors
- for( int i = 0; i < LAYER_ID_COUNT; i++ )
- {
- m_hiContrastColor[i] = m_layerColors[i].Mix( m_layerColors[LAYER_PCB_BACKGROUND],
- m_hiContrastFactor );
- m_layerColorsHi[i] = m_layerColors[i].Brightened( m_highlightFactor );
- m_layerColorsDark[i] = m_layerColors[i].Darkened( 1.0 - m_highlightFactor );
- m_layerColorsSel[i] = m_layerColors[i].Brightened( m_selectFactor );
- }
-}
-
-
PAINTER::PAINTER( GAL* aGal ) :
m_gal( aGal ),
m_brightenedColor( 0.0, 1.0, 0.0, 0.9 )
diff --git a/common/plotters/DXF_plotter.cpp b/common/plotters/DXF_plotter.cpp
index a5e7fd3e5f..145f529a4c 100644
--- a/common/plotters/DXF_plotter.cpp
+++ b/common/plotters/DXF_plotter.cpp
@@ -169,7 +169,6 @@ void DXF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
iuPerDeviceUnit = 1.0 / aIusPerDecimil; // Gives a DXF in decimils
iuPerDeviceUnit *= GetUnitScaling(); // Get the scaling factor for the current units
- SetDefaultLineWidth( 0 ); // No line width on DXF
m_plotMirror = false; // No mirroring on DXF
m_currentColor = COLOR4D::BLACK;
}
@@ -871,6 +870,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
int aWidth,
bool aItalic,
bool aBold,
+ int aTextMarkupFlags,
bool aMultilineAllowed,
void* aData )
{
@@ -880,10 +880,10 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
bool processSuperSub = false;
- if( ( GetTextMarkupFlags() & ENABLE_SUBSCRIPT_MARKUP ) && aText.Contains( wxT( "#" ) ) )
+ if( ( aTextMarkupFlags & ENABLE_SUBSCRIPT_MARKUP ) && aText.Contains( wxT( "#" ) ) )
processSuperSub = true;
- if( ( GetTextMarkupFlags() & ENABLE_SUPERSCRIPT_MARKUP ) && aText.Contains( wxT( "^" ) ) )
+ if( ( aTextMarkupFlags & ENABLE_SUPERSCRIPT_MARKUP ) && aText.Contains( wxT( "^" ) ) )
processSuperSub = true;
if( m_textAsLines || containsNonAsciiChars( aText ) || aMultilineAllowed || processSuperSub )
@@ -892,7 +892,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
// Perhaps multiline texts could be handled as DXF text entity
// but I do not want spend time about this (JPC)
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
- aWidth, aItalic, aBold, aMultilineAllowed );
+ aWidth, aItalic, aBold, aTextMarkupFlags, aMultilineAllowed );
}
else
{
diff --git a/common/plotters/GERBER_plotter.cpp b/common/plotters/GERBER_plotter.cpp
index 96c93f39a8..e41ec0646a 100644
--- a/common/plotters/GERBER_plotter.cpp
+++ b/common/plotters/GERBER_plotter.cpp
@@ -83,7 +83,6 @@ void GERBER_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
// origin at the origin
paperSize.x = 0;
paperSize.y = 0;
- SetDefaultLineWidth( 100 * aIusPerDecimil ); // Arbitrary default
}
@@ -283,30 +282,13 @@ bool GERBER_PLOTTER::EndPlot()
}
-void GERBER_PLOTTER::SetDefaultLineWidth( int width )
+void GERBER_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
{
- defaultPenWidth = width;
- m_currentApertureIdx = -1;
-}
-
-
-void GERBER_PLOTTER::SetCurrentLineWidth( int width, void* aData )
-{
- if( width == DO_NOT_SET_LINE_WIDTH )
- return;
-
- int pen_width;
-
- if( width > 0 )
- pen_width = width;
- else
- pen_width = defaultPenWidth;
-
GBR_METADATA* gbr_metadata = static_cast( aData );
int aperture_attribute = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
- selectAperture( wxSize( pen_width, pen_width ), APERTURE::AT_PLOTTING, aperture_attribute );
- currentPenWidth = pen_width;
+ selectAperture( wxSize( aWidth, aWidth ), APERTURE::AT_PLOTTING, aperture_attribute );
+ currentPenWidth = aWidth;
}
@@ -1183,16 +1165,16 @@ void GERBER_PLOTTER::FlashRegularPolygon( const wxPoint& aShapePos,
void GERBER_PLOTTER::Text( const wxPoint& aPos, const COLOR4D aColor,
const wxString& aText, double aOrient, const wxSize& aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify,
- int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed,
- void* aData )
+ int aWidth, bool aItalic, bool aBold, int aTextMarkupFlags,
+ bool aMultilineAllowed, void* aData )
{
GBR_METADATA* gbr_metadata = static_cast( aData );
if( gbr_metadata )
formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
- PLOTTER::Text( aPos, aColor, aText, aOrient, aSize,
- aH_justify, aV_justify, aWidth, aItalic, aBold, aMultilineAllowed, aData );
+ PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
+ aBold, aTextMarkupFlags, aMultilineAllowed, aData );
}
diff --git a/common/plotters/HPGL_plotter.cpp b/common/plotters/HPGL_plotter.cpp
index e206ac1217..2949b30060 100644
--- a/common/plotters/HPGL_plotter.cpp
+++ b/common/plotters/HPGL_plotter.cpp
@@ -234,7 +234,6 @@ void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
paperSize = pageInfo.GetSizeMils();
paperSize.x *= 10.0 * aIusPerDecimil;
paperSize.y *= 10.0 * aIusPerDecimil;
- SetDefaultLineWidth( 0 ); // HPGL has pen sizes instead
m_plotMirror = aMirror;
}
diff --git a/common/plotters/PDF_plotter.cpp b/common/plotters/PDF_plotter.cpp
index 68ef28dce0..5e15dd7ea9 100644
--- a/common/plotters/PDF_plotter.cpp
+++ b/common/plotters/PDF_plotter.cpp
@@ -74,8 +74,6 @@ void PDF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
// The CTM is set to 1 user unit per decimil
iuPerDeviceUnit = 1.0 / aIusPerDecimil;
- SetDefaultLineWidth( 100 / iuPerDeviceUnit ); // arbitrary default
-
/* The paper size in this engined is handled page by page
Look in the StartPage function */
}
@@ -89,23 +87,17 @@ void PDF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
* no outline thickness
* use in this case pen width = 1 does not actally change the polygon
*/
-void PDF_PLOTTER::SetCurrentLineWidth( int width, void* aData )
+void PDF_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
{
wxASSERT( workFile );
- int pen_width;
- if( width > 0 )
- pen_width = width;
- else if( width == 0 )
- pen_width = 1;
- else
- pen_width = defaultPenWidth;
+ if( aWidth == 0 )
+ aWidth = 1;
- if( pen_width != currentPenWidth )
- fprintf( workFile, "%g w\n",
- userToDeviceSize( pen_width ) );
+ if( aWidth != currentPenWidth )
+ fprintf( workFile, "%g w\n", userToDeviceSize( aWidth ) );
- currentPenWidth = pen_width;
+ currentPenWidth = aWidth;
}
@@ -585,7 +577,7 @@ void PDF_PLOTTER::StartPage()
fprintf( workFile,
"%g 0 0 %g 0 0 cm 1 J 1 j 0 0 0 rg 0 0 0 RG %g w\n",
0.0072 * plotScaleAdjX, 0.0072 * plotScaleAdjY,
- userToDeviceSize( defaultPenWidth ) );
+ userToDeviceSize( m_renderSettings->GetDefaultPenWidth() ) );
}
/**
@@ -812,6 +804,7 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
int aWidth,
bool aItalic,
bool aBold,
+ int aTextMarkupFlags,
bool aMultilineAllowed,
void* aData )
{
@@ -840,9 +833,9 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
double wideningFactor, heightFactor;
computeTextParameters( aPos, aText, aOrient, aSize, m_plotMirror, aH_justify,
- aV_justify, aWidth, aItalic, aBold,
- &wideningFactor, &ctm_a, &ctm_b, &ctm_c,
- &ctm_d, &ctm_e, &ctm_f, &heightFactor );
+ aV_justify, aWidth, aItalic, aBold,
+ &wideningFactor, &ctm_a, &ctm_b, &ctm_c,
+ &ctm_d, &ctm_e, &ctm_f, &heightFactor );
SetColor( aColor );
SetCurrentLineWidth( aWidth, aData );
@@ -886,8 +879,8 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
// Plot the stroked text (if requested)
if( !use_native_font )
{
- PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
- aWidth, aItalic, aBold, aMultilineAllowed );
+ PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth,
+ aItalic, aBold, aTextMarkupFlags, aMultilineAllowed );
}
}
diff --git a/common/plotters/PS_plotter.cpp b/common/plotters/PS_plotter.cpp
index 7a80002892..48923c3ee9 100644
--- a/common/plotters/PS_plotter.cpp
+++ b/common/plotters/PS_plotter.cpp
@@ -50,13 +50,6 @@ const double PSLIKE_PLOTTER::postscriptTextAscent = 0.718;
// Common routines for Postscript-like plotting engines
-void PSLIKE_PLOTTER::SetDefaultLineWidth( int width )
-{
- defaultPenWidth = width;
- currentPenWidth = -1;
-}
-
-
void PSLIKE_PLOTTER::SetColor( COLOR4D color )
{
if( colorMode )
@@ -422,7 +415,6 @@ void PS_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
paperSize = pageInfo.GetSizeMils();
paperSize.x *= 10.0 * aIusPerDecimil;
paperSize.y *= 10.0 * aIusPerDecimil;
- SetDefaultLineWidth( 100 * aIusPerDecimil ); // arbitrary default
}
@@ -525,20 +517,14 @@ void PSLIKE_PLOTTER::computeTextParameters( const wxPoint& aPos,
/* Set the current line width (in IUs) for the next plot
*/
-void PS_PLOTTER::SetCurrentLineWidth( int width, void* aData )
+void PS_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
{
wxASSERT( outputFile );
- int pen_width;
- if( width >= 0 )
- pen_width = width;
- else
- pen_width = defaultPenWidth;
+ if( aWidth != GetCurrentLineWidth() )
+ fprintf( outputFile, "%g setlinewidth\n", userToDeviceSize( aWidth ) );
- if( pen_width != GetCurrentLineWidth() )
- fprintf( outputFile, "%g setlinewidth\n", userToDeviceSize( pen_width ) );
-
- currentPenWidth = pen_width;
+ currentPenWidth = aWidth;
}
@@ -942,9 +928,9 @@ bool PS_PLOTTER::StartPlot()
// within the Document Structuring Convention.
fputs( "%%Page: 1 1\n"
"%%BeginPageSetup\n"
- "gsave\n"
- "0.0072 0.0072 scale\n" // Configure postscript for decimils coordinates
- "linemode1\n", outputFile );
+ "gsave\n"
+ "0.0072 0.0072 scale\n" // Configure postscript for decimils coordinates
+ "linemode1\n", outputFile );
// Rototranslate the coordinate to achieve the landscape layout
@@ -953,11 +939,11 @@ bool PS_PLOTTER::StartPlot()
// Apply the user fine scale adjustments
if( plotScaleAdjX != 1.0 || plotScaleAdjY != 1.0 )
- fprintf( outputFile, "%g %g scale\n",
- plotScaleAdjX, plotScaleAdjY );
+ fprintf( outputFile, "%g %g scale\n", plotScaleAdjX, plotScaleAdjY );
// Set default line width
- fprintf( outputFile, "%g setlinewidth\n", userToDeviceSize( defaultPenWidth ) );
+ fprintf( outputFile, "%g setlinewidth\n",
+ userToDeviceSize( m_renderSettings->GetDefaultPenWidth() ) );
fputs( "%%EndPageSetup\n", outputFile );
return true;
@@ -988,6 +974,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
int aWidth,
bool aItalic,
bool aBold,
+ int aTextMarkupFlags,
bool aMultilineAllowed,
void* aData )
{
@@ -1000,10 +987,10 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
bool processSuperSub = false;
- if( ( GetTextMarkupFlags() & ENABLE_SUBSCRIPT_MARKUP ) && aText.Contains( wxT( "#" ) ) )
+ if( ( aTextMarkupFlags & ENABLE_SUBSCRIPT_MARKUP ) && aText.Contains( wxT( "#" ) ) )
processSuperSub = true;
- if( ( GetTextMarkupFlags() & ENABLE_SUPERSCRIPT_MARKUP ) && aText.Contains( wxT( "^" ) ) )
+ if( ( aTextMarkupFlags & ENABLE_SUPERSCRIPT_MARKUP ) && aText.Contains( wxT( "^" ) ) )
processSuperSub = true;
// Draw the native postscript text (if requested)
@@ -1067,7 +1054,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
if( !use_native )
{
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
- aWidth, aItalic, aBold, aMultilineAllowed );
+ aWidth, aItalic, aBold, aTextMarkupFlags, aMultilineAllowed );
}
}
diff --git a/common/plotters/SVG_plotter.cpp b/common/plotters/SVG_plotter.cpp
index 8f56a71d6b..bd5de4f2fd 100644
--- a/common/plotters/SVG_plotter.cpp
+++ b/common/plotters/SVG_plotter.cpp
@@ -187,7 +187,6 @@ void SVG_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
paperSize = pageInfo.GetSizeMils();
paperSize.x *= 10.0 * aIusPerDecimil;
paperSize.y *= 10.0 * aIusPerDecimil;
- SetDefaultLineWidth( 100 * aIusPerDecimil ); // arbitrary default
}
@@ -276,19 +275,12 @@ void SVG_PLOTTER::setSVGPlotStyle( bool aIsGroup, const std::string& aExtraStyle
/* Set the current line width (in IUs) for the next plot
*/
-void SVG_PLOTTER::SetCurrentLineWidth( int width, void* aData )
+void SVG_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
{
- int pen_width;
-
- if( width >= 0 )
- pen_width = width;
- else
- pen_width = defaultPenWidth;
-
- if( pen_width != currentPenWidth )
+ if( aWidth != currentPenWidth )
{
m_graphics_changed = true;
- currentPenWidth = pen_width;
+ currentPenWidth = aWidth;
}
if( m_graphics_changed )
@@ -756,6 +748,7 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
int aWidth,
bool aItalic,
bool aBold,
+ int aTextMarkupFlags,
bool aMultilineAllowed,
void* aData )
{
@@ -763,14 +756,6 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
SetColor( aColor );
SetCurrentLineWidth( aWidth );
- int width = currentPenWidth;
-
- if( aWidth <= 0 && aBold )
- width = GetPenSizeForBold( std::min( aSize.x, aSize.y ) );
-
- if( aWidth <= 0 )
- width = currentPenWidth;
-
wxPoint text_pos = aPos;
const char *hjust = "start";
@@ -806,7 +791,7 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
wxSize text_size;
// aSize.x or aSize.y is < 0 for mirrored texts.
// The actual text size value is the absolue value
- text_size.x = std::abs( GraphicTextWidth( aText, aSize, aItalic, width ) );
+ text_size.x = std::abs( GraphicTextWidth( aText, aSize, aItalic, aWidth ) );
text_size.y = std::abs( aSize.x * 4/3 ); // Hershey font height to em size conversion
DPOINT anchor_pos_dev = userToDeviceCoordinates( aPos );
DPOINT text_pos_dev = userToDeviceCoordinates( text_pos );
@@ -833,6 +818,6 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
"%s\n",
TO_UTF8( XmlEsc( aText ) ) );
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
- aWidth, aItalic, aBold, aMultilineAllowed );
+ aWidth, aItalic, aBold, aTextMarkupFlags, aMultilineAllowed );
fputs( "", outputFile );
}
diff --git a/common/plotters/common_plot_functions.cpp b/common/plotters/common_plot_functions.cpp
index aac97abf4f..30a0890ec2 100644
--- a/common/plotters/common_plot_functions.cpp
+++ b/common/plotters/common_plot_functions.cpp
@@ -64,8 +64,8 @@ void PlotWorkSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BLOCK
/* Note: Page sizes values are given in mils
*/
double iusPerMil = plotter->GetIUsPerDecimil() * 10.0;
-
- COLOR4D plotColor = plotter->GetColorMode() ? aColor : COLOR4D::BLACK;
+ COLOR4D plotColor = plotter->GetColorMode() ? aColor : COLOR4D::BLACK;
+ int defaultPenWidth = plotter->RenderSettings()->GetDefaultPenWidth();
if( plotColor == COLOR4D::UNSPECIFIED )
plotColor = COLOR4D( RED );
@@ -97,7 +97,7 @@ void PlotWorkSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BLOCK
case WSG_LINE_T:
{
WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) item;
- plotter->SetCurrentLineWidth( line->GetPenWidth() );
+ plotter->SetCurrentLineWidth( std::max( line->GetPenWidth(), defaultPenWidth ) );
plotter->MoveTo( line->GetStart() );
plotter->FinishTo( line->GetEnd() );
}
@@ -106,24 +106,26 @@ void PlotWorkSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BLOCK
case WSG_RECT_T:
{
WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item;
- plotter->Rect( rect->GetStart(), rect->GetEnd(), NO_FILL, rect->GetPenWidth() );
+ int penWidth = std::max( rect->GetPenWidth(), defaultPenWidth );
+ plotter->Rect( rect->GetStart(), rect->GetEnd(), NO_FILL, penWidth );
}
break;
case WSG_TEXT_T:
{
WS_DRAW_ITEM_TEXT* text = (WS_DRAW_ITEM_TEXT*) item;
+ int penWidth = std::max( text->GetEffectiveTextPenWidth(), defaultPenWidth );
plotter->Text( text->GetTextPos(), plotColor, text->GetShownText(),
- text->GetTextAngle(), text->GetTextSize(),
- text->GetHorizJustify(), text->GetVertJustify(),
- text->GetEffectiveTextPenWidth( nullptr ),
- text->IsItalic(), text->IsBold(), text->IsMultilineAllowed() );
+ text->GetTextAngle(), text->GetTextSize(), text->GetHorizJustify(),
+ text->GetVertJustify(), penWidth, text->IsItalic(), text->IsBold(),
+ text->GetTextMarkupFlags(), text->IsMultilineAllowed() );
}
break;
case WSG_POLY_T:
{
WS_DRAW_ITEM_POLYPOLYGONS* poly = (WS_DRAW_ITEM_POLYPOLYGONS*) item;
+ int penWidth = std::max( poly->GetPenWidth(), defaultPenWidth );
std::vector points;
for( int idx = 0; idx < poly->GetPolygons().OutlineCount(); ++idx )
@@ -134,7 +136,7 @@ void PlotWorkSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BLOCK
for( int ii = 0; ii < outline.PointCount(); ii++ )
points.emplace_back( outline.CPoint( ii ).x, outline.CPoint( ii ).y );
- plotter->PlotPoly( points, FILLED_SHAPE, poly->GetPenWidth() );
+ plotter->PlotPoly( points, FILLED_SHAPE, penWidth );
}
}
break;
diff --git a/common/plotters/plotter.cpp b/common/plotters/plotter.cpp
index b6d6bb6bb4..5d2be2a0d0 100644
--- a/common/plotters/plotter.cpp
+++ b/common/plotters/plotter.cpp
@@ -39,14 +39,9 @@
#include
#include
-
#include
-#include
#include
-#include
#include
-#include
-#include
#include
#include
#include
@@ -56,19 +51,18 @@
PLOTTER::PLOTTER( )
{
plotScale = 1;
- defaultPenWidth = 0;
currentPenWidth = -1; // To-be-set marker
penState = 'Z'; // End-of-path idle
m_plotMirror = false; // Plot mirror option flag
m_mirrorIsHorizontal = true;
m_yaxisReversed = false;
outputFile = 0;
- m_colors = nullptr;
colorMode = false; // Starts as a BW plot
negativeMode = false;
// Temporary init to avoid not initialized vars, will be set later
m_IUsPerDecimil = 1; // will be set later to the actual value
iuPerDeviceUnit = 1; // will be set later to the actual value
+ m_renderSettings = nullptr;
}
PLOTTER::~PLOTTER()
diff --git a/common/render_settings.cpp b/common/render_settings.cpp
new file mode 100644
index 0000000000..c232773f57
--- /dev/null
+++ b/common/render_settings.cpp
@@ -0,0 +1,64 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2020 KiCad Developers, see CHANGELOG.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
+
+using namespace KIGFX;
+
+
+RENDER_SETTINGS::RENDER_SETTINGS() :
+ m_printDC( nullptr )
+{
+ // Set the default initial values
+ m_highlightFactor = 0.5f;
+ m_selectFactor = 0.5f;
+ m_highlightItems = false;
+ m_highlightEnabled = false;
+ m_hiContrastEnabled = false;
+ m_hiContrastFactor = 0.2f; //TODO: Make this user-configurable
+ m_highlightNetcode = -1;
+ m_outlineWidth = 1;
+ m_worksheetLineWidth = 100000;
+ m_defaultPenWidth = 0;
+ m_showPageLimits = false;
+}
+
+
+RENDER_SETTINGS::~RENDER_SETTINGS()
+{
+}
+
+
+void RENDER_SETTINGS::update()
+{
+ // Calculate darkened/highlighted variants of layer colors
+ for( int i = 0; i < LAYER_ID_COUNT; i++ )
+ {
+ m_hiContrastColor[i] = m_layerColors[i].Mix( m_layerColors[LAYER_PCB_BACKGROUND],
+ m_hiContrastFactor );
+ m_layerColorsHi[i] = m_layerColors[i].Brightened( m_highlightFactor );
+ m_layerColorsDark[i] = m_layerColors[i].Darkened( 1.0 - m_highlightFactor );
+ m_layerColorsSel[i] = m_layerColors[i].Brightened( m_selectFactor );
+ }
+}
+
diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp
index 0e4891f070..e19ab5f7a0 100644
--- a/eeschema/class_libentry.cpp
+++ b/eeschema/class_libentry.cpp
@@ -426,8 +426,8 @@ wxString LIB_PART::SubReference( int aUnit, bool aAddSeparator )
}
-void LIB_PART::Print( wxDC* aDc, const wxPoint& aOffset, int aMulti, int aConvert,
- const PART_DRAW_OPTIONS& aOpts )
+void LIB_PART::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, int aMulti,
+ int aConvert, const PART_DRAW_OPTIONS& aOpts )
{
/* draw background for filled items using background option
* Solid lines will be drawn after the background
@@ -452,7 +452,7 @@ void LIB_PART::Print( wxDC* aDc, const wxPoint& aOffset, int aMulti, int aConver
// Now, draw only the background for items with
// m_Fill == FILLED_WITH_BG_BODYCOLOR:
- drawItem.Print( aDc, aOffset, (void*) false, aOpts.transform );
+ drawItem.Print( aSettings, aOffset, (void*) false, aOpts.transform );
}
}
@@ -478,16 +478,16 @@ void LIB_PART::Print( wxDC* aDc, const wxPoint& aOffset, int aMulti, int aConver
if( drawItem.Type() == LIB_PIN_T )
{
- drawItem.Print( aDc, aOffset, (void*) &aOpts, aOpts.transform );
+ drawItem.Print( aSettings, aOffset, (void*) &aOpts, aOpts.transform );
}
else if( drawItem.Type() == LIB_FIELD_T )
{
- drawItem.Print( aDc, aOffset, (void*) NULL, aOpts.transform );
+ drawItem.Print( aSettings, aOffset, (void*) NULL, aOpts.transform );
}
else
{
bool forceNoFill = drawItem.m_Fill == FILLED_WITH_BG_BODYCOLOR;
- drawItem.Print( aDc, aOffset, (void*) forceNoFill, aOpts.transform );
+ drawItem.Print( aSettings, aOffset, (void*) forceNoFill, aOpts.transform );
}
}
}
@@ -498,7 +498,7 @@ void LIB_PART::Plot( PLOTTER* aPlotter, int aUnit, int aConvert,
{
wxASSERT( aPlotter != NULL );
- aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE ) );
+ aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
bool fill = aPlotter->GetColorMode();
// draw background for filled items using background option
@@ -544,7 +544,7 @@ void LIB_PART::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert,
{
wxASSERT( aPlotter != NULL );
- aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_FIELDS ) );
+ aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_FIELDS ) );
bool fill = aPlotter->GetColorMode();
for( LIB_ITEM& item : m_drawings )
diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h
index d5cd65d9f0..4107efa5fd 100644
--- a/eeschema/class_libentry.h
+++ b/eeschema/class_libentry.h
@@ -65,19 +65,19 @@ extern bool operator<( const LIB_PART& aItem1, const LIB_PART& aItem2 );
struct PART_DRAW_OPTIONS
{
- TRANSFORM transform; ///< Coordinate adjustment settings
- bool draw_visible_fields; ///< Whether to draw "visible" fields
- bool draw_hidden_fields; ///< Whether to draw "hidden" fields
- bool show_elec_type; ///< Whether to show the pin electrical type
+ TRANSFORM transform; // Coordinate adjustment settings
+ bool draw_visible_fields; // Whether to draw "visible" fields
+ bool draw_hidden_fields; // Whether to draw "hidden" fields
+ bool show_elec_type; // Whether to show the pin electrical type
+ int text_markup_flags; // Whether to process various text markups
- static PART_DRAW_OPTIONS Default()
+ PART_DRAW_OPTIONS()
{
- PART_DRAW_OPTIONS def;
- def.transform = DefaultTransform;
- def.draw_visible_fields = true;
- def.draw_hidden_fields = true;
- def.show_elec_type = false;
- return def;
+ transform = DefaultTransform;
+ draw_visible_fields = true;
+ draw_hidden_fields = true;
+ show_elec_type = false;
+ text_markup_flags = 0;
}
};
@@ -294,13 +294,12 @@ public:
/**
* Print part.
*
- * @param aDc - Device context to draw on.
* @param aOffset - Position of part.
* @param aMulti - unit if multiple units per part.
* @param aConvert - Component conversion (DeMorgan) if available.
* @param aOpts - Drawing options
*/
- void Print( wxDC* aDc, const wxPoint& aOffset, int aMulti, int aConvert,
+ void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, int aMulti, int aConvert,
const PART_DRAW_OPTIONS& aOpts );
/**
diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp
index 60bdf3cfc5..effc9a74f7 100644
--- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp
+++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp
@@ -160,7 +160,8 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow()
{
if( defined.count( templateFieldname.m_Name ) <= 0 )
{
- SCH_FIELD field( wxPoint( 0, 0 ), -1, m_cmp, templateFieldname.m_Name );
+ SCH_FIELD field( wxPoint( 0, 0 ), -1, m_cmp, templateFieldname.m_Name,
+ GetParent()->GetTextMarkupFlags() );
field.SetVisible( templateFieldname.m_Visible );
m_fields->push_back( field );
}
@@ -530,9 +531,10 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnAddField( wxCommandEvent& event )
return;
int fieldID = m_fields->size();
- SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_cmp );
+ SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_cmp,
+ TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldID ),
+ GetParent()->GetTextMarkupFlags() );
- newField.SetName( TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldID ) );
newField.SetTextAngle( m_fields->at( REFERENCE ).GetTextAngle() );
newField.SetTextSize( wxSize( GetParent()->GetDefaultTextSize(),
@@ -662,7 +664,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary( wxCommandEvent
{
if( defined.count( templateFieldname.m_Name ) <= 0 )
{
- SCH_FIELD field( wxPoint( 0, 0 ), -1, m_cmp, templateFieldname.m_Name );
+ SCH_FIELD field( wxPoint( 0, 0 ), -1, m_cmp, templateFieldname.m_Name,
+ GetParent()->GetTextMarkupFlags() );
field.SetVisible( templateFieldname.m_Visible );
m_fields->push_back( field );
}
diff --git a/eeschema/dialogs/dialog_edit_label.cpp b/eeschema/dialogs/dialog_edit_label.cpp
index 6812fc8ce6..3a65f91d13 100644
--- a/eeschema/dialogs/dialog_edit_label.cpp
+++ b/eeschema/dialogs/dialog_edit_label.cpp
@@ -460,12 +460,12 @@ bool DIALOG_LABEL_EDITOR::TransferDataFromWindow()
if( ( style & 2 ) )
{
m_CurrentText->SetBold( true );
- m_CurrentText->SetTextPenWidth( GetPenSizeForBold( m_CurrentText->GetTextWidth() ) );
+ m_CurrentText->SetTextThickness( GetPenSizeForBold( m_CurrentText->GetTextWidth() ) );
}
else
{
m_CurrentText->SetBold( false );
- m_CurrentText->SetTextPenWidth( 0 ); // Use default pen width
+ m_CurrentText->SetTextThickness( 0 ); // Use default pen width
}
m_Parent->RefreshItem( m_CurrentText );
diff --git a/eeschema/dialogs/dialog_edit_line_style.cpp b/eeschema/dialogs/dialog_edit_line_style.cpp
index 90b4a784f4..6e0eb44a0c 100644
--- a/eeschema/dialogs/dialog_edit_line_style.cpp
+++ b/eeschema/dialogs/dialog_edit_line_style.cpp
@@ -82,10 +82,10 @@ bool DIALOG_EDIT_LINE_STYLE::TransferDataToWindow()
if( std::all_of( m_lines.begin() + 1, m_lines.end(),
[&]( const SCH_LINE* r )
{
- return r->GetPenSize() == first_line->GetPenSize();
+ return r->GetPenWidth() == first_line->GetPenWidth();
} ) )
{
- m_width.SetValue( first_line->GetPenSize() );
+ m_width.SetValue( first_line->GetPenWidth() );
}
else
{
diff --git a/eeschema/dialogs/dialog_fields_editor_global.cpp b/eeschema/dialogs/dialog_fields_editor_global.cpp
index 767ff4dd6c..7fbdff967c 100644
--- a/eeschema/dialogs/dialog_fields_editor_global.cpp
+++ b/eeschema/dialogs/dialog_fields_editor_global.cpp
@@ -608,7 +608,8 @@ public:
if( !destField && !srcValue.IsEmpty() )
{
const auto compOrigin = comp.GetPosition();
- destField = comp.AddField( SCH_FIELD( compOrigin, -1, &comp, srcName ) );
+ destField = comp.AddField( SCH_FIELD( compOrigin, -1, &comp, srcName,
+ m_frame->GetTextMarkupFlags() ) );
}
if( !destField )
diff --git a/eeschema/dialogs/dialog_lib_edit_pin.cpp b/eeschema/dialogs/dialog_lib_edit_pin.cpp
index 5e0cb4924a..81b2f9ec84 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin.cpp
+++ b/eeschema/dialogs/dialog_lib_edit_pin.cpp
@@ -186,10 +186,14 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
dc.SetUserScale( scale, scale );
GRResetPenAndBrush( &dc );
- PART_DRAW_OPTIONS opts = PART_DRAW_OPTIONS::Default();
+ PART_DRAW_OPTIONS opts;
opts.draw_hidden_fields = true;
+ opts.text_markup_flags = libframe->GetTextMarkupFlags();
- m_dummyPin->Print( &dc, -bBox.Centre(), (void*) &opts, DefaultTransform );
+ RENDER_SETTINGS* renderSettings = libframe->GetRenderSettings();
+ renderSettings->SetPrintDC( &dc );
+
+ m_dummyPin->Print( renderSettings, -bBox.Centre(), (void*) &opts, DefaultTransform );
m_dummyPin->SetParent( nullptr );
diff --git a/eeschema/dialogs/dialog_plot_schematic.cpp b/eeschema/dialogs/dialog_plot_schematic.cpp
index 8e52c1b7f6..99290e9323 100644
--- a/eeschema/dialogs/dialog_plot_schematic.cpp
+++ b/eeschema/dialogs/dialog_plot_schematic.cpp
@@ -35,7 +35,7 @@
#include
#include
#include
-
+#include
// static members (static to remember last state):
int DIALOG_PLOT_SCHEMATIC::m_pageSizeSelect = PAGE_SIZE_AUTO;
@@ -268,19 +268,18 @@ void DIALOG_PLOT_SCHEMATIC::OnUpdateUI( wxUpdateUIEvent& event )
}
-void DIALOG_PLOT_SCHEMATIC::getPlotOptions( int* aDefaultLineWidth )
+void DIALOG_PLOT_SCHEMATIC::getPlotOptions( RENDER_SETTINGS* aSettings )
{
m_HPGLPenSize = m_penWidth.GetValue();
- auto cfg = dynamic_cast( Kiface().KifaceSettings() );
+ EESCHEMA_SETTINGS* cfg = dynamic_cast( Kiface().KifaceSettings() );
wxASSERT( cfg );
if( cfg )
{
cfg->m_PlotPanel.background_color = m_plotBackgroundColor->GetValue();
cfg->m_PlotPanel.color = getModeColor();
- cfg->m_PlotPanel.color_theme = static_cast(
- m_colorTheme->GetClientData( m_colorTheme->GetSelection() ) )->GetFilename();
+ cfg->m_PlotPanel.color_theme = getColorSettings()->GetFilename();
cfg->m_PlotPanel.frame_reference = getPlotFrameRef();
cfg->m_PlotPanel.format = static_cast( GetPlotFileFormat() );
cfg->m_PlotPanel.hpgl_origin = GetPlotOriginCenter();
@@ -290,7 +289,8 @@ void DIALOG_PLOT_SCHEMATIC::getPlotOptions( int* aDefaultLineWidth )
cfg->m_PlotPanel.hpgl_pen_size = m_HPGLPenSize / IU_PER_MM;
}
- *aDefaultLineWidth = (int) m_defaultLineWidth.GetValue();
+ aSettings->LoadColors( getColorSettings() );
+ aSettings->SetDefaultPenWidth( (int) m_defaultLineWidth.GetValue() );
// Plot directory
wxString path = m_outputDirectoryName->GetValue();
@@ -324,24 +324,24 @@ void DIALOG_PLOT_SCHEMATIC::OnPlotAll( wxCommandEvent& event )
void DIALOG_PLOT_SCHEMATIC::PlotSchematic( bool aPlotAll )
{
- int defaultLineWidth;
+ KIGFX::SCH_RENDER_SETTINGS renderSettings( *m_parent->GetRenderSettings() );
- getPlotOptions( &defaultLineWidth );
+ getPlotOptions( &renderSettings );
switch( GetPlotFileFormat() )
{
default:
case PLOT_FORMAT::POST:
- createPSFile( aPlotAll, getPlotFrameRef(), defaultLineWidth );
+ createPSFile( aPlotAll, getPlotFrameRef(), &renderSettings );
break;
case PLOT_FORMAT::DXF:
CreateDXFFile( aPlotAll, getPlotFrameRef() );
break;
case PLOT_FORMAT::PDF:
- createPDFFile( aPlotAll, getPlotFrameRef(), defaultLineWidth );
+ createPDFFile( aPlotAll, getPlotFrameRef(), &renderSettings );
break;
case PLOT_FORMAT::SVG:
- createSVGFile( aPlotAll, getPlotFrameRef(), defaultLineWidth );
+ createSVGFile( aPlotAll, getPlotFrameRef(), &renderSettings );
break;
case PLOT_FORMAT::HPGL:
createHPGLFile( aPlotAll, getPlotFrameRef() );
diff --git a/eeschema/dialogs/dialog_plot_schematic.h b/eeschema/dialogs/dialog_plot_schematic.h
index 4d8a390e09..40a3fabd04 100644
--- a/eeschema/dialogs/dialog_plot_schematic.h
+++ b/eeschema/dialogs/dialog_plot_schematic.h
@@ -71,7 +71,7 @@ private:
void initDlg();
// common
- void getPlotOptions( int* aDefaultLineWidth );
+ void getPlotOptions( RENDER_SETTINGS* aSettings );
bool getModeColor()
{ return m_ModeColorOption->GetSelection() == 0; }
@@ -94,7 +94,7 @@ private:
void PlotSchematic( bool aPlotAll );
// PDF
- void createPDFFile( bool aPlotAll, bool aPlotFrameRef, int aDefaultLineWidth );
+ void createPDFFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aRenderSettings );
void plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, bool aPlotFrameRef);
void setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen );
@@ -128,15 +128,16 @@ private:
wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
// PS
- void createPSFile( bool aPlotAll, bool aPlotFrameRef, int aDefaultLineWidth );
- bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen, int aDefaultLineWidth,
- const PAGE_INFO& aPageInfo, wxPoint aPlot0ffset, double aScale,
- bool aPlotFrameRef );
+ void createPSFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings );
+ bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
+ RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo,
+ wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
// SVG
- void createSVGFile( bool aPlotAll, bool aPlotFrameRef, int aDefaultLineWidth );
- bool plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScreen, int aDefaultLineWidth,
- bool aPlotBlackAndWhite, bool aPlotFrameRef );
+ void createSVGFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings );
+ bool plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScreen,
+ RENDER_SETTINGS* aRenderSettings, bool aPlotBlackAndWhite,
+ bool aPlotFrameRef );
/**
* Create a file name with an absolute path name
diff --git a/eeschema/dialogs/dialog_print_using_printer.cpp b/eeschema/dialogs/dialog_print_using_printer.cpp
index b23c853dfe..d0e21be94e 100644
--- a/eeschema/dialogs/dialog_print_using_printer.cpp
+++ b/eeschema/dialogs/dialog_print_using_printer.cpp
@@ -33,7 +33,7 @@
#include
#include
#include
-
+#include
class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_BASE
{
@@ -424,14 +424,20 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
if( m_parent->GetPrintMonochrome() )
GRForceBlackPen( true );
+ KIGFX::SCH_RENDER_SETTINGS renderSettings( *m_parent->GetRenderSettings() );
+ renderSettings.SetPrintDC( dc );
+ // The worksheet item print code is shared between PCBNew and EESchema, so it's easier
+ // if they just use the PCB layer.
+ renderSettings.SetLayerColor( LAYER_WORKSHEET,
+ renderSettings.GetLayerColor( LAYER_SCHEMATIC_WORKSHEET ) );
+
if( printReference )
{
- m_parent->PrintWorkSheet( dc, aScreen, m_parent->GetDefaultLineWidth(), IU_PER_MILS,
- aScreen->GetFileName(), wxEmptyString,
- m_parent->GetLayerColor( LAYER_SCHEMATIC_WORKSHEET ) );
+ m_parent->PrintWorkSheet( &renderSettings, aScreen, IU_PER_MILS, aScreen->GetFileName(),
+ wxEmptyString );
}
- aScreen->Print( dc );
+ aScreen->Print( &renderSettings );
m_parent->SetDrawBgColor( bgColor );
aScreen->m_IsPrinting = false;
diff --git a/eeschema/dialogs/dialog_sch_sheet_props.cpp b/eeschema/dialogs/dialog_sch_sheet_props.cpp
index 51a9654ce3..6b6d2540b6 100644
--- a/eeschema/dialogs/dialog_sch_sheet_props.cpp
+++ b/eeschema/dialogs/dialog_sch_sheet_props.cpp
@@ -561,9 +561,10 @@ void DIALOG_SCH_SHEET_PROPS::OnAddField( wxCommandEvent& event )
return;
int fieldID = m_fields->size();
- SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_sheet );
+ SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_sheet,
+ SCH_SHEET::GetDefaultFieldName( fieldID ),
+ m_frame->GetTextMarkupFlags() );
- newField.SetName( SCH_SHEET::GetDefaultFieldName( fieldID ) );
newField.SetTextAngle( m_fields->at( SHEETNAME ).GetTextAngle() );
m_fields->push_back( newField );
diff --git a/eeschema/dialogs/dialog_update_fields.cpp b/eeschema/dialogs/dialog_update_fields.cpp
index 3ce4f5cec1..2db169fdb6 100644
--- a/eeschema/dialogs/dialog_update_fields.cpp
+++ b/eeschema/dialogs/dialog_update_fields.cpp
@@ -233,7 +233,8 @@ void DIALOG_UPDATE_FIELDS::updateFields( SCH_COMPONENT* aComponent )
else
{
// Missing field, it has to be added to the component
- SCH_FIELD newField( wxPoint( 0, 0 ), newFields.size(), aComponent, fieldName );
+ SCH_FIELD newField( wxPoint( 0, 0 ), newFields.size(), aComponent, fieldName,
+ m_frame->GetTextMarkupFlags() );
newField.ImportValues( *libField );
newField.SetText( libField->GetText() );
diff --git a/eeschema/dialogs/panel_eeschema_color_settings.cpp b/eeschema/dialogs/panel_eeschema_color_settings.cpp
index c093eba6c1..715d6ee76a 100644
--- a/eeschema/dialogs/panel_eeschema_color_settings.cpp
+++ b/eeschema/dialogs/panel_eeschema_color_settings.cpp
@@ -364,8 +364,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
t3->SetIsDangling( false );
addItem( t3 );
- auto t4 = new SCH_GLOBALLABEL(
- wxPoint( Mils2iu( 1750 ), Mils2iu( 1400 ) ), wxT( "GLOBAL[3..0]" ) );
+ auto t4 = new SCH_GLOBALLABEL( wxPoint( Mils2iu( 1750 ), Mils2iu( 1400 ) ), wxT( "GLOBAL[3..0]" ) );
t4->SetLabelSpinStyle( LABEL_SPIN_STYLE::SPIN::LEFT );
t4->SetIsDangling( false );
addItem( t4 );
diff --git a/eeschema/dialogs/panel_setup_formatting.cpp b/eeschema/dialogs/panel_setup_formatting.cpp
index 17a4b15605..0c95b104d9 100644
--- a/eeschema/dialogs/panel_setup_formatting.cpp
+++ b/eeschema/dialogs/panel_setup_formatting.cpp
@@ -72,10 +72,11 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow()
m_wireWidth.SetValue( m_frame->GetDefaultWireThickness() );
m_junctionSize.SetValue( SCH_JUNCTION::g_SymbolSize );
- m_textOffsetRatioCtrl->SetValue( wxString::Format( "%f", GetTextOffsetRatio() * 100.0 ) );
+ wxString offsetRatio = wxString::Format( "%f", m_frame->GetTextOffsetRatio() * 100.0 );
+ m_textOffsetRatioCtrl->SetValue( offsetRatio );
int superSubFlags = ENABLE_SUBSCRIPT_MARKUP | ENABLE_SUPERSCRIPT_MARKUP;
- m_checkSuperSub->SetValue( GetTextMarkupFlags() & superSubFlags );
+ m_checkSuperSub->SetValue( m_frame->GetTextMarkupFlags() & superSubFlags );
return true;
}
@@ -111,18 +112,25 @@ bool PANEL_SETUP_FORMATTING::TransferDataFromWindow()
m_frame->SetDefaultBusThickness( (int) m_busWidth.GetValue() );
SCH_JUNCTION::g_SymbolSize = (int) m_junctionSize.GetValue();
-
double dtmp = 0.0;
wxString msg = m_textOffsetRatioCtrl->GetValue();
msg.ToDouble( &dtmp );
- SetTextOffsetRatio( dtmp / 100.0 );
+ m_frame->SetTextOffsetRatio( dtmp / 100.0 );
int superSubFlags = ENABLE_SUBSCRIPT_MARKUP | ENABLE_SUPERSCRIPT_MARKUP;
if( m_checkSuperSub->GetValue() )
- SetTextMarkupFlags( GetTextMarkupFlags() | superSubFlags );
+ m_frame->SetTextMarkupFlags( m_frame->GetTextMarkupFlags() | superSubFlags );
else
- SetTextMarkupFlags( GetTextMarkupFlags() & ~superSubFlags );
+ m_frame->SetTextMarkupFlags( m_frame->GetTextMarkupFlags() & ~superSubFlags );
+
+ m_frame->GetRenderSettings()->SetDefaultPenWidth( m_frame->GetDefaultLineWidth() );
+ m_frame->GetRenderSettings()->m_DefaultWireThickness = m_frame->GetDefaultWireThickness();
+ m_frame->GetRenderSettings()->m_DefaultBusThickness = m_frame->GetDefaultBusThickness();
+ m_frame->GetRenderSettings()->m_TextOffsetRatio = m_frame->GetTextOffsetRatio();
+
+ SCH_SCREENS schematic;
+ schematic.UpdateTextMarkupFlags( m_frame->GetTextMarkupFlags() );
m_frame->GetCanvas()->GetView()->MarkDirty();
m_frame->GetCanvas()->GetView()->UpdateAllItems( KIGFX::REPAINT );
diff --git a/eeschema/edit_label.cpp b/eeschema/edit_label.cpp
index 61bb7e0628..4e6aa41bc1 100644
--- a/eeschema/edit_label.cpp
+++ b/eeschema/edit_label.cpp
@@ -60,28 +60,29 @@ SCH_TEXT* SCH_EDIT_FRAME::GetNextNewText()
SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( int aType )
{
- wxPoint cursorPos = (wxPoint) GetCanvas()->GetViewControls()->GetCursorPosition();
+ wxPoint cursorPos = (wxPoint) GetCanvas()->GetViewControls()->GetCursorPosition();
SCH_TEXT* textItem = nullptr;
+ int markupFlags = GetTextMarkupFlags();
s_queuedTexts.clear();
switch( aType )
{
case LAYER_NOTES:
- textItem = new SCH_TEXT( cursorPos );
+ textItem = new SCH_TEXT( cursorPos, wxEmptyString, SCH_TEXT_T, markupFlags );
break;
case LAYER_LOCLABEL:
- textItem = new SCH_LABEL( cursorPos );
+ textItem = new SCH_LABEL( cursorPos, wxEmptyString, markupFlags );
break;
case LAYER_HIERLABEL:
- textItem = new SCH_HIERLABEL( cursorPos );
+ textItem = new SCH_HIERLABEL( cursorPos, wxEmptyString, SCH_HIER_LABEL_T, markupFlags );
textItem->SetShape( lastGlobalLabelShape );
break;
case LAYER_GLOBLABEL:
- textItem = new SCH_GLOBALLABEL( cursorPos );
+ textItem = new SCH_GLOBALLABEL( cursorPos, wxEmptyString, markupFlags );
textItem->SetShape( lastGlobalLabelShape );
break;
@@ -199,6 +200,7 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* aText, KICAD_T aNewType )
const wxPoint& position = aText->GetPosition();
LABEL_SPIN_STYLE orientation = aText->GetLabelSpinStyle();
wxString txt = UnescapeString( aText->GetText() );
+ int markupFlags = GetTextMarkupFlags();
// There can be characters in a SCH_TEXT object that can break labels so we have to
// fix them here.
@@ -216,11 +218,18 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* aText, KICAD_T aNewType )
switch( aNewType )
{
- case SCH_LABEL_T: newtext = new SCH_LABEL( position, txt ); break;
- case SCH_GLOBAL_LABEL_T: newtext = new SCH_GLOBALLABEL( position, txt ); break;
- case SCH_HIER_LABEL_T: newtext = new SCH_HIERLABEL( position, txt ); break;
- case SCH_TEXT_T: newtext = new SCH_TEXT( position, txt ); break;
-
+ case SCH_LABEL_T:
+ newtext = new SCH_LABEL( position, txt, markupFlags );
+ break;
+ case SCH_GLOBAL_LABEL_T:
+ newtext = new SCH_GLOBALLABEL( position, txt, markupFlags );
+ break;
+ case SCH_HIER_LABEL_T:
+ newtext = new SCH_HIERLABEL( position, txt, SCH_HIER_LABEL_T, markupFlags );
+ break;
+ case SCH_TEXT_T:
+ newtext = new SCH_TEXT( position, txt, SCH_TEXT_T, markupFlags );
+ break;
default:
wxFAIL_MSG( wxString::Format( "Invalid text type: %d.", aNewType ) );
return;
@@ -234,7 +243,7 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* aText, KICAD_T aNewType )
newtext->SetShape( aText->GetShape() );
newtext->SetLabelSpinStyle( orientation );
newtext->SetTextSize( aText->GetTextSize() );
- newtext->SetTextPenWidth( aText->GetTextPenWidth() );
+ newtext->SetTextThickness( aText->GetTextThickness() );
newtext->SetItalic( aText->IsItalic() );
newtext->SetBold( aText->IsBold() );
newtext->SetIsDangling( aText->IsDangling() );
diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp
index c65f5f6b1b..2d9dcd1bd8 100644
--- a/eeschema/eeschema.cpp
+++ b/eeschema/eeschema.cpp
@@ -218,13 +218,6 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
void IFACE::OnKifaceEnd()
{
- COLOR_SETTINGS* cs = Pgm().GetSettingsManager().GetColorSettings();
-
- for( SCH_LAYER_ID layer = SCH_LAYER_ID_START; layer < SCH_LAYER_ID_END; ++layer )
- {
- cs->SetColor( layer, GetLayerColor( layer ) );
- }
-
end_common();
}
diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp
index e1e119a765..6e72aedade 100644
--- a/eeschema/eeschema_config.cpp
+++ b/eeschema/eeschema_config.cpp
@@ -55,9 +55,6 @@
#include // For some default values
-static double s_textOffsetRatio = 0.08;
-static int s_textMarkupFlags = 0;
-
#define FieldNameTemplatesKey wxT( "FieldNameTemplates" )
@@ -221,18 +218,6 @@ void SetSeverity( int aErrorCode, int aSeverity )
}
-double GetTextOffsetRatio()
-{
- return s_textOffsetRatio;
-}
-
-
-void SetTextOffsetRatio( double aOffsetRatio )
-{
- s_textOffsetRatio = aOffsetRatio;
-}
-
-
/// Helper for all the old plotting/printing code while it still exists
COLOR4D GetLayerColor( SCH_LAYER_ID aLayer )
{
@@ -279,11 +264,11 @@ void SCH_EDIT_FRAME::AddFormattingParameters( std::vector& params )
Mils2iu( DEFAULT_SIZE_TEXT ),
5, 1000, nullptr, 1 / IU_PER_MILS ) );
params.push_back( new PARAM_CFG_DOUBLE( wxT( "TextOffsetRatio" ),
- &s_textOffsetRatio,
+ &m_textOffsetRatio,
(double) TXT_MARGIN / DEFAULT_SIZE_TEXT,
-200.0, 200.0 ) );
params.push_back( new PARAM_CFG_INT( wxT( "TextMarkupFlags" ),
- &s_textMarkupFlags, 0 ) );
+ &m_textMarkupFlags, 0 ) );
params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "LineThickness" ),
&m_defaultLineWidth,
Mils2iu( appSettings->m_Drawing.default_line_thickness ),
@@ -343,11 +328,10 @@ bool SCH_EDIT_FRAME::LoadProjectFile()
bool ret = Prj().ConfigLoad( Kiface().KifaceSearch(), GROUP_SCH_EDIT,
GetProjectFileParameters() );
- SetTextMarkupFlags( s_textMarkupFlags );
-
- GetRenderSettings()->m_DefaultLineWidth = GetDefaultLineWidth();
+ GetRenderSettings()->SetDefaultPenWidth( GetDefaultLineWidth() );
GetRenderSettings()->m_DefaultWireThickness = GetDefaultWireThickness();
GetRenderSettings()->m_DefaultBusThickness = GetDefaultBusThickness();
+ GetRenderSettings()->m_TextOffsetRatio = m_textOffsetRatio;
// Verify some values, because the config file can be edited by hand,
// and have bad values:
@@ -397,8 +381,6 @@ void SCH_EDIT_FRAME::SaveProjectSettings()
wxString path = fn.GetFullPath();
- s_textMarkupFlags = GetTextMarkupFlags();
-
prj.ConfigSave( Kiface().KifaceSearch(), GROUP_SCH_EDIT, GetProjectFileParameters(), path );
}
diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp
index 564b02d4e3..54c2025c6b 100644
--- a/eeschema/files-io.cpp
+++ b/eeschema/files-io.cpp
@@ -407,6 +407,8 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in
}
schematic.UpdateSymbolLinks( true ); // Update all symbol library links for all sheets.
+ schematic.UpdateTextMarkupFlags( GetTextMarkupFlags() );
+
g_ConnectionGraph->Reset();
RecalculateConnections( GLOBAL_CLEANUP );
SetScreen( g_CurrentSheet->LastScreen() );
@@ -682,6 +684,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
UpdateFileHistory( aFileName );
SCH_SCREENS schematic;
schematic.UpdateSymbolLinks(); // Update all symbol library links for all sheets.
+ schematic.UpdateTextMarkupFlags( GetTextMarkupFlags() );
GetScreen()->m_Initialized = true;
SCH_SCREENS allScreens;
diff --git a/eeschema/general.h b/eeschema/general.h
index a2d553dd6c..fc247552ab 100644
--- a/eeschema/general.h
+++ b/eeschema/general.h
@@ -71,16 +71,4 @@ extern ERC_SETTINGS* g_ErcSettings;
int GetSeverity( int aErrorCode );
void SetSeverity( int aErrorCode, int aSeverity );
-/**
- * Amount to offset text above/below wires & buses. Expressed as a ratio of the text size.
- */
-double GetTextOffsetRatio();
-void SetTextOffsetRatio( double aOffsetRatio );
-
-// Color to draw items flagged invisible, in libedit (they are invisible in Eeschema
-COLOR4D GetInvisibleItemColor();
-
-// TODO(JE) Remove this once wxDC printing is gone
-COLOR4D GetLayerColor( SCH_LAYER_ID aLayer );
-
#endif // _GENERAL_H_
diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp
index f9393eda8a..48676dc416 100644
--- a/eeschema/lib_arc.cpp
+++ b/eeschema/lib_arc.cpp
@@ -61,7 +61,7 @@ LIB_ARC::LIB_ARC( LIB_PART* aParent ) : LIB_ITEM( LIB_ARC_T, aParent )
bool LIB_ARC::HitTest( const wxPoint& aRefPoint, int aAccuracy ) const
{
- int mindist = std::max( aAccuracy + GetPenSize() / 2,
+ int mindist = std::max( aAccuracy + GetPenWidth() / 2,
Mils2iu( MINIMUM_SELECTION_DISTANCE ) );
wxPoint relativePosition = aRefPoint;
@@ -168,13 +168,6 @@ void LIB_ARC::Offset( const wxPoint& aOffset )
}
-bool LIB_ARC::Inside( EDA_RECT& aRect ) const
-{
- return aRect.Contains( m_ArcStart.x, -m_ArcStart.y )
- || aRect.Contains( m_ArcEnd.x, -m_ArcEnd.y );
-}
-
-
void LIB_ARC::MoveTo( const wxPoint& aPosition )
{
wxPoint offset = aPosition - m_Pos;
@@ -273,33 +266,35 @@ void LIB_ARC::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
{
- aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE_BACKGROUND ) );
+ aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->Arc( pos, -t2, -t1, m_Radius, FILLED_WITH_BG_BODYCOLOR, 0 );
}
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
- auto pen_size = GetPenSize();
+ auto pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
if( !already_filled || pen_size > 0 )
{
pen_size = std::max( 0, pen_size );
- aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE ) );
+ aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
aPlotter->Arc( pos, -t2, -t1, m_Radius, already_filled ? NO_FILL : m_Fill, pen_size );
}
}
-int LIB_ARC::GetPenSize() const
+int LIB_ARC::GetPenWidth() const
{
- return m_Width;
+ return std::max( m_Width, 1 );
}
-void LIB_ARC::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANSFORM& aTransform )
+void LIB_ARC::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
+ const TRANSFORM& aTransform )
{
+ wxDC* DC = aSettings->GetPrintDC();
wxPoint pos1, pos2, posc;
- COLOR4D color = GetLayerColor( LAYER_DEVICE );
- COLOR4D bgColor = GetLayerColor( LAYER_DEVICE_BACKGROUND );
+ COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
+ COLOR4D bgColor = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
pos1 = aTransform.TransformCoordinate( m_ArcEnd ) + aOffset;
pos2 = aTransform.TransformCoordinate( m_ArcStart ) + aOffset;
@@ -315,15 +310,14 @@ void LIB_ARC::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANS
}
FILL_T fill = aData ? NO_FILL : m_Fill;
-
- int penSize = GetPenSize();
+ int penSize = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
if( fill == FILLED_WITH_BG_BODYCOLOR )
- GRFilledArc( nullptr, aDC, posc.x, posc.y, pt1, pt2, m_Radius, penSize, bgColor, bgColor );
+ GRFilledArc( nullptr, DC, posc.x, posc.y, pt1, pt2, m_Radius, penSize, bgColor, bgColor );
else if( fill == FILLED_SHAPE && !aData )
- GRFilledArc( nullptr, aDC, posc.x, posc.y, pt1, pt2, m_Radius, color, color );
+ GRFilledArc( nullptr, DC, posc.x, posc.y, pt1, pt2, m_Radius, color, color );
else
- GRArc1( nullptr, aDC, pos1.x, pos1.y, pos2.x, pos2.y, posc.x, posc.y, penSize, color );
+ GRArc1( nullptr, DC, pos1.x, pos1.y, pos2.x, pos2.y, posc.x, posc.y, penSize, color );
}
@@ -384,7 +378,7 @@ const EDA_RECT LIB_ARC::GetBoundingBox() const
rect.SetOrigin( minX, minY );
rect.SetEnd( maxX, maxY );
- rect.Inflate( ( GetPenSize()+1 ) / 2 );
+ rect.Inflate( ( GetPenWidth() / 2 ) + 1 );
return rect;
}
diff --git a/eeschema/lib_arc.h b/eeschema/lib_arc.h
index 6c8ab21cee..7530a52f2c 100644
--- a/eeschema/lib_arc.h
+++ b/eeschema/lib_arc.h
@@ -50,7 +50,7 @@ class LIB_ARC : public LIB_ITEM
int m_Width; /* Line width */
int m_editState;
- void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
+ void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
public:
@@ -77,7 +77,7 @@ public:
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override;
- int GetPenSize() const override;
+ int GetPenWidth() const override;
void BeginEdit( const wxPoint aStartPoint ) override;
void CalcEdit( const wxPoint& aPosition ) override;
@@ -85,8 +85,6 @@ public:
void Offset( const wxPoint& aOffset ) override;
- bool Inside( EDA_RECT& aRect ) const override;
-
void MoveTo( const wxPoint& aPosition ) override;
wxPoint GetPosition() const override { return m_Pos; }
diff --git a/eeschema/lib_bezier.cpp b/eeschema/lib_bezier.cpp
index f2141f2bec..869cd6e2ec 100644
--- a/eeschema/lib_bezier.cpp
+++ b/eeschema/lib_bezier.cpp
@@ -35,7 +35,6 @@
#include
#include
#include
-#include // For some default values
LIB_BEZIER::LIB_BEZIER( LIB_PART* aParent ) :
@@ -92,18 +91,6 @@ void LIB_BEZIER::Offset( const wxPoint& aOffset )
}
-bool LIB_BEZIER::Inside( EDA_RECT& aRect ) const
-{
- for( size_t i = 0; i < m_PolyPoints.size(); i++ )
- {
- if( aRect.Contains( m_PolyPoints[i].x, -m_PolyPoints[i].y ) )
- return true;
- }
-
- return false;
-}
-
-
void LIB_BEZIER::MoveTo( const wxPoint& aPosition )
{
if ( !m_PolyPoints.size() )
@@ -190,43 +177,35 @@ void LIB_BEZIER::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
{
- aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE_BACKGROUND ) );
+ aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->PlotPoly( cornerList, FILLED_WITH_BG_BODYCOLOR, 0 );
}
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
- auto pen_size = GetPenSize();
+ auto pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
if( !already_filled || pen_size > 0 )
{
- pen_size = std::max( 0, pen_size );
- aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE ) );
+ aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
aPlotter->PlotPoly( cornerList, already_filled ? NO_FILL : m_Fill, pen_size );
}
}
-int LIB_BEZIER::GetPenSize() const
+int LIB_BEZIER::GetPenWidth() const
{
- if( m_Width )
- return m_Width;
-
-#if 1
- // Temporary code not using RENDER_SETTINGS
- return DEFAULT_LINE_THICKNESS * IU_PER_MILS;
-#else
- // JEY TODO: requires RENDER_SETTINGS
-#endif
+ return std::max( m_Width, 1 );
}
-void LIB_BEZIER::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
+void LIB_BEZIER::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform )
{
std::vector PolyPointsTraslated;
- COLOR4D color = GetLayerColor( LAYER_DEVICE );
- COLOR4D bgColor = GetLayerColor( LAYER_DEVICE_BACKGROUND );
+ wxDC* DC = aSettings->GetPrintDC();
+ COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
+ COLOR4D bgColor = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
BEZIER_POLY converter( m_BezierPoints );
converter.GetPoly( m_PolyPoints );
@@ -236,20 +215,21 @@ void LIB_BEZIER::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
PolyPointsTraslated.push_back( aTransform.TransformCoordinate( point ) + aOffset );
FILL_T fill = aData ? NO_FILL : m_Fill;
+ int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
if( fill == FILLED_WITH_BG_BODYCOLOR )
{
- GRPoly( nullptr, aDC, m_PolyPoints.size(), &PolyPointsTraslated[0], true, GetPenSize(),
+ GRPoly( nullptr, DC, m_PolyPoints.size(), &PolyPointsTraslated[0], true, penWidth,
bgColor, bgColor );
}
else if( fill == FILLED_SHAPE )
{
- GRPoly( nullptr, aDC, m_PolyPoints.size(), &PolyPointsTraslated[0], true, GetPenSize(),
+ GRPoly( nullptr, DC, m_PolyPoints.size(), &PolyPointsTraslated[0], true, penWidth,
color, color );
}
else
{
- GRPoly( nullptr, aDC, m_PolyPoints.size(), &PolyPointsTraslated[0], false, GetPenSize(),
+ GRPoly( nullptr, DC, m_PolyPoints.size(), &PolyPointsTraslated[0], false, penWidth,
color, color );
}
}
@@ -257,7 +237,7 @@ void LIB_BEZIER::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
bool LIB_BEZIER::HitTest( const wxPoint& aRefPos, int aAccuracy ) const
{
- int mindist = std::max( aAccuracy + GetPenSize() / 2,
+ int mindist = std::max( aAccuracy + GetPenWidth() / 2,
Mils2iu( MINIMUM_SELECTION_DISTANCE ) );
wxPoint start, end;
@@ -334,7 +314,7 @@ const EDA_RECT LIB_BEZIER::GetBoundingBox() const
rect.SetOrigin( xmin, ymin );
rect.SetEnd( xmax, ymax );
- rect.Inflate( ( GetPenSize()+1 ) / 2 );
+ rect.Inflate( ( GetPenWidth() / 2 ) + 1 );
rect.RevertYAxis();
diff --git a/eeschema/lib_bezier.h b/eeschema/lib_bezier.h
index f328f60649..0094ad10bf 100644
--- a/eeschema/lib_bezier.h
+++ b/eeschema/lib_bezier.h
@@ -37,9 +37,6 @@ class LIB_BEZIER : public LIB_ITEM
std::vector m_BezierPoints; // list of parameter (3|4)
std::vector m_PolyPoints; // list of points (>= 2)
- void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
- const TRANSFORM& aTransform ) override;
-
public:
LIB_BEZIER( LIB_PART * aParent );
@@ -75,8 +72,6 @@ public:
const EDA_RECT GetBoundingBox() const override;
- bool Inside( EDA_RECT& aRect ) const override;
-
void MoveTo( const wxPoint& aPosition ) override;
wxPoint GetPosition() const override;
@@ -91,14 +86,13 @@ public:
int GetWidth() const override { return m_Width; }
void SetWidth( int aWidth ) override { m_Width = aWidth; }
- int GetPenSize( ) const override;
+ int GetPenWidth() const override;
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override;
EDA_ITEM* Clone() const override;
private:
-
/**
* @copydoc LIB_ITEM::compare()
*
@@ -108,6 +102,9 @@ private:
*/
int compare( const LIB_ITEM& aOther,
LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override;
+
+ void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
+ const TRANSFORM& aTransform ) override;
};
diff --git a/eeschema/lib_circle.cpp b/eeschema/lib_circle.cpp
index 3c3ec0409f..6e19d7e4be 100644
--- a/eeschema/lib_circle.cpp
+++ b/eeschema/lib_circle.cpp
@@ -37,7 +37,6 @@
#include
#include
#include
-#include // For some default values
LIB_CIRCLE::LIB_CIRCLE( LIB_PART* aParent ) :
@@ -51,7 +50,7 @@ LIB_CIRCLE::LIB_CIRCLE( LIB_PART* aParent ) :
bool LIB_CIRCLE::HitTest( const wxPoint& aPosRef, int aAccuracy ) const
{
- int mindist = std::max( aAccuracy + GetPenSize() / 2,
+ int mindist = std::max( aAccuracy + GetPenWidth() / 2,
Mils2iu( MINIMUM_SELECTION_DISTANCE ) );
int dist = KiROUND( GetLineLength( aPosRef, DefaultTransform.TransformCoordinate( m_Pos ) ) );
@@ -126,13 +125,6 @@ void LIB_CIRCLE::Offset( const wxPoint& aOffset )
}
-bool LIB_CIRCLE::Inside( EDA_RECT& aRect ) const
-{
- wxPoint center(m_Pos.x, -m_Pos.y);
- return aRect.IntersectsCircle( center, GetRadius() );
-}
-
-
void LIB_CIRCLE::MoveTo( const wxPoint& aPosition )
{
Offset( aPosition - m_Pos );
@@ -177,50 +169,44 @@ void LIB_CIRCLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
{
- aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE_BACKGROUND ) );
+ aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->Circle( pos, GetRadius() * 2, FILLED_WITH_BG_BODYCOLOR, 0 );
}
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
- auto pen_size = GetPenSize();
+ auto pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
if( !already_filled || pen_size > 0 )
{
pen_size = std::max( 0, pen_size );
- aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE ) );
+ aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
aPlotter->Circle( pos, GetRadius() * 2, already_filled ? NO_FILL : m_Fill, pen_size );
}
}
-int LIB_CIRCLE::GetPenSize() const
+int LIB_CIRCLE::GetPenWidth() const
{
- if( m_Width )
- return m_Width;
-
-#if 1
- // Temporary code not using RENDER_SETTINGS
- return DEFAULT_LINE_THICKNESS * IU_PER_MILS;
-#else
- // JEY TODO: requires RENDER_SETTINGS
-#endif
+ return std::max( m_Width, 1 );
}
-void LIB_CIRCLE::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
+void LIB_CIRCLE::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform )
{
- wxPoint pos1 = aTransform.TransformCoordinate( m_Pos ) + aOffset;
- COLOR4D color = GetLayerColor( LAYER_DEVICE );
- COLOR4D bgColor = GetLayerColor( LAYER_DEVICE_BACKGROUND );
- FILL_T fill = aData ? NO_FILL : m_Fill;
+ wxDC* DC = aSettings->GetPrintDC();
+ wxPoint pos1 = aTransform.TransformCoordinate( m_Pos ) + aOffset;
+ COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
+ COLOR4D bgColor = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
+ FILL_T fill = aData ? NO_FILL : m_Fill;
+ int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
if( fill == FILLED_WITH_BG_BODYCOLOR )
- GRFilledCircle( nullptr, aDC, pos1.x, pos1.y, GetRadius(), GetPenSize(), bgColor, bgColor );
+ GRFilledCircle( nullptr, DC, pos1.x, pos1.y, GetRadius(), penWidth, bgColor, bgColor );
else if( fill == FILLED_SHAPE )
- GRFilledCircle( nullptr, aDC, pos1.x, pos1.y, GetRadius(), 0, color, color );
+ GRFilledCircle( nullptr, DC, pos1.x, pos1.y, GetRadius(), 0, color, color );
else
- GRCircle( nullptr, aDC, pos1.x, pos1.y, GetRadius(), GetPenSize(), color );
+ GRCircle( nullptr, DC, pos1.x, pos1.y, GetRadius(), penWidth, color );
}
@@ -231,7 +217,7 @@ const EDA_RECT LIB_CIRCLE::GetBoundingBox() const
rect.SetOrigin( m_Pos.x - radius, m_Pos.y - radius );
rect.SetEnd( m_Pos.x + radius, m_Pos.y + radius );
- rect.Inflate( ( GetPenSize()+1 ) / 2 );
+ rect.Inflate( ( GetPenWidth() / 2 ) + 1 );
rect.RevertYAxis();
diff --git a/eeschema/lib_circle.h b/eeschema/lib_circle.h
index 8deb833a03..417cb30843 100644
--- a/eeschema/lib_circle.h
+++ b/eeschema/lib_circle.h
@@ -35,9 +35,6 @@ class LIB_CIRCLE : public LIB_ITEM
wxPoint m_EndPos; // A point on the circumference of the circle.
int m_Width; // Line width.
- void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
- const TRANSFORM& aTransform ) override;
-
public:
LIB_CIRCLE( LIB_PART * aParent );
@@ -58,7 +55,7 @@ public:
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
- int GetPenSize( ) const override;
+ int GetPenWidth() const override;
const EDA_RECT GetBoundingBox() const override;
@@ -69,8 +66,6 @@ public:
void Offset( const wxPoint& aOffset ) override;
- bool Inside( EDA_RECT& aRect ) const override;
-
void MoveTo( const wxPoint& aPosition ) override;
wxPoint GetPosition() const override { return m_Pos; }
@@ -98,7 +93,6 @@ public:
EDA_ITEM* Clone() const override;
private:
-
/**
* @copydoc LIB_ITEM::compare()
*
@@ -109,6 +103,9 @@ private:
*/
int compare( const LIB_ITEM& aOther,
LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override;
+
+ void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
+ const TRANSFORM& aTransform ) override;
};
diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp
index 62cde9905f..a54e691b74 100644
--- a/eeschema/lib_field.cpp
+++ b/eeschema/lib_field.cpp
@@ -34,12 +34,12 @@
#include
#include
#include
+#include
#include
#include
#include
#include
#include
-#include // For some default values
LIB_FIELD::LIB_FIELD(LIB_PART * aParent, int idfield ) :
@@ -99,29 +99,23 @@ void LIB_FIELD::Init( int id )
}
-int LIB_FIELD::GetPenSize() const
+int LIB_FIELD::GetPenWidth() const
{
-#if 1
- // Temporary code not using RENDER_SETTINGS
- int textThickness = DEFAULT_LINE_THICKNESS * IU_PER_MILS;
- textThickness = Clamp_Text_PenSize( textThickness, GetTextSize(), IsBold() );
- return textThickness;
-#else
- return GetEffectiveTextPenWidth( nullptr ); // JEY TODO: requires RENDER_SETTINGS
-#endif
+ return GetEffectiveTextPenWidth();
}
-void LIB_FIELD::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
+void LIB_FIELD::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform )
{
- COLOR4D color = IsVisible() ? GetDefaultColor() : GetInvisibleItemColor();
- int linewidth = GetPenSize();
+ wxDC* DC = aSettings->GetPrintDC();
+ COLOR4D color = aSettings->GetLayerColor( IsVisible() ? GetDefaultLayer() : LAYER_HIDDEN );
+ int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
wxPoint text_pos = aTransform.TransformCoordinate( GetTextPos() ) + aOffset;
wxString text = aData ? *static_cast( aData ) : GetText();
- GRText( aDC, text_pos, color, text, GetTextAngle(), GetTextSize(), GetHorizJustify(),
- GetVertJustify(), linewidth, IsItalic(), IsBold() );
+ GRText( DC, text_pos, color, text, GetTextAngle(), GetTextSize(), GetHorizJustify(),
+ GetVertJustify(), penWidth, IsItalic(), IsBold(), m_textMarkupFlags );
}
@@ -220,12 +214,6 @@ void LIB_FIELD::Offset( const wxPoint& aOffset )
}
-bool LIB_FIELD::Inside( EDA_RECT& rect ) const
-{
- return rect.Intersects( GetBoundingBox() );
-}
-
-
void LIB_FIELD::MoveTo( const wxPoint& newPosition )
{
EDA_TEXT::SetTextPos( newPosition );
@@ -295,12 +283,16 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
COLOR4D color;
if( aPlotter->GetColorMode() )
- color = aPlotter->ColorSettings()->GetColor( GetDefaultLayer() );
+ color = aPlotter->RenderSettings()->GetLayerColor( GetDefaultLayer() );
else
color = COLOR4D::BLACK;
- aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(),
- hjustify, vjustify, GetPenSize(), IsItalic(), IsBold() );
+ int penWidth = std::max( GetPenWidth(),aPlotter->RenderSettings()->GetDefaultPenWidth() );
+
+ // NOTE: do NOT use m_textMarkupFlags; those are from the library, not the schematic
+
+ aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(), hjustify, vjustify,
+ penWidth, IsItalic(), IsBold(), aPlotter->GetTextMarkupFlags() );
}
@@ -324,7 +316,7 @@ const EDA_RECT LIB_FIELD::GetBoundingBox() const
/* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when
* calling GetTextBox() that works using top to bottom Y axis orientation.
*/
- EDA_RECT rect = GetTextBox( nullptr, -1, true ); // JEY TODO: requires RENDER_SETTINGS
+ EDA_RECT rect = GetTextBox( -1, true );
rect.RevertYAxis();
// We are using now a bottom to top Y axis.
@@ -370,12 +362,6 @@ SCH_LAYER_ID LIB_FIELD::GetDefaultLayer()
}
-COLOR4D LIB_FIELD::GetDefaultColor()
-{
- return GetLayerColor( GetDefaultLayer() );
-}
-
-
wxString LIB_FIELD::GetName( bool aUseDefaultName ) const
{
if( m_name.IsEmpty() && aUseDefaultName )
diff --git a/eeschema/lib_field.h b/eeschema/lib_field.h
index ab7c1ade44..3f2703ff5d 100644
--- a/eeschema/lib_field.h
+++ b/eeschema/lib_field.h
@@ -68,7 +68,7 @@ class LIB_FIELD : public LIB_ITEM, public EDA_TEXT
* the m_Text
*
*/
- void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
+ void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
/**
@@ -138,7 +138,7 @@ public:
int GetId() const { return m_id; }
void SetId( int aId ) { m_id = aId; }
- int GetPenSize( ) const override;
+ int GetPenWidth() const override;
/**
* Copy parameters of this field to another field. Pointers are not copied.
@@ -169,16 +169,12 @@ public:
*/
wxString GetFullText( int unit = 1 ) const;
- COLOR4D GetDefaultColor() override;
-
SCH_LAYER_ID GetDefaultLayer();
void BeginEdit( const wxPoint aStartPoint ) override;
void Offset( const wxPoint& aOffset ) override;
- bool Inside( EDA_RECT& aRect ) const override;
-
void MoveTo( const wxPoint& aPosition ) override;
wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); }
@@ -190,8 +186,8 @@ public:
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) override;
- int GetWidth() const override { return GetTextPenWidth(); }
- void SetWidth( int aWidth ) override { SetTextPenWidth( aWidth ); }
+ int GetWidth() const override { return GetTextThickness(); }
+ void SetWidth( int aWidth ) override { SetTextThickness( aWidth ); }
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
diff --git a/eeschema/lib_item.cpp b/eeschema/lib_item.cpp
index 9db4020cd6..88fe1077bb 100644
--- a/eeschema/lib_item.cpp
+++ b/eeschema/lib_item.cpp
@@ -133,9 +133,10 @@ bool LIB_ITEM::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
}
-void LIB_ITEM::Print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANSFORM& aTransform )
+void LIB_ITEM::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
+ const TRANSFORM& aTransform )
{
- print( aDC, aOffset, aData, aTransform );
+ print( aSettings, aOffset, aData, aTransform );
}
@@ -149,7 +150,3 @@ void LIB_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
}
-COLOR4D LIB_ITEM::GetDefaultColor()
-{
- return GetLayerColor( LAYER_DEVICE );
-}
diff --git a/eeschema/lib_item.h b/eeschema/lib_item.h
index 4ae95633a6..dbdd7e002e 100644
--- a/eeschema/lib_item.h
+++ b/eeschema/lib_item.h
@@ -30,7 +30,7 @@
#include
#include
#include
-
+#include
class LINE_READER;
class OUTPUTFORMATTER;
@@ -39,6 +39,7 @@ class PLOTTER;
class LIB_PIN;
class MSG_PANEL_ITEM;
+using KIGFX::RENDER_SETTINGS;
extern const int fill_tab[];
@@ -62,13 +63,12 @@ class LIB_ITEM : public EDA_ITEM
/**
* Print the item to \a aDC.
*
- * @param aDC A pointer to the device context used to draw the object.
* @param aOffset A reference to a wxPoint object containing the offset where to draw
* from the object's current position.
* @param aData A pointer to any object specific data required to perform the draw.
* @param aTransform A reference to a #TRANSFORM object containing drawing transform.
*/
- virtual void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
+ virtual void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) = 0;
friend class LIB_PART;
@@ -174,13 +174,10 @@ public:
* pass reference to the lib component for pins.
* @param aTransform Transform Matrix (rotation, mirror ..)
*/
- virtual void Print( wxDC* aDC, const wxPoint &aOffset, void* aData,
+ virtual void Print( RENDER_SETTINGS* aSettings, const wxPoint &aOffset, void* aData,
const TRANSFORM& aTransform );
- /**
- * @return the size of the "pen" that be used to draw or plot this item
- */
- virtual int GetPenSize() const = 0;
+ virtual int GetPenWidth() const = 0;
LIB_PART* GetParent() const
{
@@ -241,14 +238,6 @@ public:
*/
virtual void Offset( const wxPoint& aOffset ) = 0;
- /**
- * Test if any part of the draw object is inside rectangle bounds of \a aRect.
- *
- * @param aRect Rectangle to check against.
- * @return True if object is inside rectangle.
- */
- virtual bool Inside( EDA_RECT& aRect ) const = 0;
-
/**
* Move a draw object to \a aPosition.
*
@@ -303,8 +292,6 @@ public:
*/
bool IsFillable() const { return m_isFillable; }
- virtual COLOR4D GetDefaultColor();
-
void SetUnit( int aUnit ) { m_Unit = aUnit; }
int GetUnit() const { return m_Unit; }
diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp
index 910f9c1f90..9f638ae96a 100644
--- a/eeschema/lib_pin.cpp
+++ b/eeschema/lib_pin.cpp
@@ -551,21 +551,14 @@ bool LIB_PIN::HitTest( const wxPoint& aPosition, int aAccuracy ) const
}
-int LIB_PIN::GetPenSize() const
+int LIB_PIN::GetPenWidth() const
{
- if( m_width )
- return m_width;
-
-#if 1
- // Temporary code not using RENDER_SETTINGS
- return DEFAULT_LINE_THICKNESS * IU_PER_MILS;
-#else
- // JEY TODO: requires RENDER_SETTINGS
-#endif
+ return std::max( m_width, 1 );
}
-void LIB_PIN::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANSFORM& aTransform )
+void LIB_PIN::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
+ const TRANSFORM& aTransform )
{
PART_DRAW_OPTIONS* opts = (PART_DRAW_OPTIONS*) aData;
LIB_PART* part = GetParent();
@@ -578,23 +571,24 @@ void LIB_PIN::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANS
if( IsVisible() || ( opts && opts->draw_hidden_fields ) )
{
- PrintPinSymbol( aDC, pos1, orient );
+ PrintPinSymbol( aSettings, pos1, orient );
- PrintPinTexts( aDC, pos1, orient, part->GetPinNameOffset(), part->ShowPinNumbers(),
- part->ShowPinNames() );
+ PrintPinTexts( aSettings, pos1, orient, part->GetPinNameOffset(), part->ShowPinNumbers(),
+ part->ShowPinNames(), opts->text_markup_flags );
if( opts && opts->show_elec_type )
- PrintPinElectricalTypeName( aDC, pos1, orient );
+ PrintPinElectricalTypeName( aSettings, pos1, orient );
}
}
-void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
+void LIB_PIN::PrintPinSymbol( RENDER_SETTINGS* aSettings, const wxPoint& aPos, int aOrient )
{
+ wxDC* DC = aSettings->GetPrintDC();
int MapX1, MapY1, x1, y1;
- int width = GetPenSize();
- int posX = aPos.x, posY = aPos.y, len = m_length;
- COLOR4D color = IsVisible() ? GetLayerColor( LAYER_PIN ) : GetInvisibleItemColor();
+ int width = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
+ int posX = aPos.x, posY = aPos.y, len = m_length;
+ COLOR4D color = aSettings->GetLayerColor( IsVisible() ? LAYER_PIN : LAYER_HIDDEN );
MapX1 = MapY1 = 0;
x1 = posX;
@@ -611,15 +605,15 @@ void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
if( m_shape == GRAPHIC_PINSHAPE::INVERTED || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
{
const int radius = ExternalPinDecoSize( *this );
- GRCircle( nullptr, aDC, MapX1 * radius + x1, MapY1 * radius + y1, radius, width, color );
+ GRCircle( nullptr, DC, MapX1 * radius + x1, MapY1 * radius + y1, radius, width, color );
GRMoveTo( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 );
- GRLineTo( nullptr, aDC, posX, posY, width, color );
+ GRLineTo( nullptr, DC, posX, posY, width, color );
}
else
{
GRMoveTo( x1, y1 );
- GRLineTo( nullptr, aDC, posX, posY, width, color );
+ GRLineTo( nullptr, DC, posX, posY, width, color );
}
// Draw the clock shape (>)inside the symbol
@@ -631,14 +625,14 @@ void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
if( MapY1 == 0 ) /* MapX1 = +- 1 */
{
GRMoveTo( x1, y1 + clock_size );
- GRLineTo( nullptr, aDC, x1 - MapX1 * clock_size * 2, y1, width, color );
- GRLineTo( nullptr, aDC, x1, y1 - clock_size, width, color );
+ GRLineTo( nullptr, DC, x1 - MapX1 * clock_size * 2, y1, width, color );
+ GRLineTo( nullptr, DC, x1, y1 - clock_size, width, color );
}
else /* MapX1 = 0 */
{
GRMoveTo( x1 + clock_size, y1 );
- GRLineTo( nullptr, aDC, x1, y1 - MapY1 * clock_size * 2, width, color );
- GRLineTo( nullptr, aDC, x1 - clock_size, y1, width, color );
+ GRLineTo( nullptr, DC, x1, y1 - MapY1 * clock_size * 2, width, color );
+ GRLineTo( nullptr, DC, x1 - clock_size, y1, width, color );
}
}
@@ -650,14 +644,14 @@ void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
if( MapY1 == 0 ) /* MapX1 = +- 1 */
{
GRMoveTo( x1 + MapX1 * deco_size * 2, y1 );
- GRLineTo( nullptr, aDC, x1 + MapX1 * deco_size * 2, y1 - deco_size * 2, width, color );
- GRLineTo( nullptr, aDC, x1, y1, width, color );
+ GRLineTo( nullptr, DC, x1 + MapX1 * deco_size * 2, y1 - deco_size * 2, width, color );
+ GRLineTo( nullptr, DC, x1, y1, width, color );
}
else /* MapX1 = 0 */
{
GRMoveTo( x1, y1 + MapY1 * deco_size * 2 );
- GRLineTo( nullptr, aDC, x1 - deco_size * 2, y1 + MapY1 * deco_size * 2, width, color );
- GRLineTo( nullptr, aDC, x1, y1, width, color );
+ GRLineTo( nullptr, DC, x1 - deco_size * 2, y1 + MapY1 * deco_size * 2, width, color );
+ GRLineTo( nullptr, DC, x1, y1, width, color );
}
}
@@ -667,52 +661,58 @@ void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
if( MapY1 == 0 ) /* MapX1 = +- 1 */
{
GRMoveTo( x1, y1 - deco_size * 2 );
- GRLineTo( nullptr, aDC, x1 + MapX1 * deco_size * 2, y1, width, color );
+ GRLineTo( nullptr, DC, x1 + MapX1 * deco_size * 2, y1, width, color );
}
else /* MapX1 = 0 */
{
GRMoveTo( x1 - deco_size * 2, y1 );
- GRLineTo( nullptr, aDC, x1, y1 + MapY1 * deco_size * 2, width, color );
+ GRLineTo( nullptr, DC, x1, y1 + MapY1 * deco_size * 2, width, color );
}
}
else if( m_shape == GRAPHIC_PINSHAPE::NONLOGIC ) /* NonLogic pin symbol */
{
const int deco_size = ExternalPinDecoSize( *this );
GRMoveTo( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size );
- GRLineTo( nullptr, aDC, x1 + (MapX1 + MapY1) * deco_size, y1 + (MapY1 - MapX1) * deco_size, width,
- color );
+ GRLineTo( nullptr, DC, x1 + (MapX1 + MapY1) * deco_size,
+ y1 + ( MapY1 - MapX1 ) * deco_size, width, color );
GRMoveTo( x1 - (MapX1 - MapY1) * deco_size, y1 - (MapY1 + MapX1) * deco_size );
- GRLineTo( nullptr, aDC, x1 + (MapX1 - MapY1) * deco_size, y1 + (MapY1 + MapX1) * deco_size, width,
- color );
+ GRLineTo( nullptr, DC, x1 + (MapX1 - MapY1) * deco_size,
+ y1 + ( MapY1 + MapX1 ) * deco_size, width, color );
}
if( m_type == ELECTRICAL_PINTYPE::PT_NC ) // Draw a N.C. symbol
{
const int deco_size = TARGET_PIN_RADIUS;
- GRLine( nullptr, aDC, posX - deco_size, posY - deco_size, posX + deco_size, posY + deco_size, width, color );
- GRLine( nullptr, aDC, posX + deco_size, posY - deco_size, posX - deco_size, posY + deco_size, width, color );
+ GRLine( nullptr, DC, posX - deco_size, posY - deco_size, posX + deco_size,
+ posY + deco_size, width, color );
+ GRLine( nullptr, DC, posX + deco_size, posY - deco_size, posX - deco_size,
+ posY + deco_size, width, color );
}
}
-void LIB_PIN::PrintPinTexts( wxDC* DC, wxPoint& pin_pos, int orient, int TextInside,
- bool DrawPinNum, bool DrawPinName )
+void LIB_PIN::PrintPinTexts( RENDER_SETTINGS* aSettings, wxPoint& pin_pos, int orient,
+ int TextInside, bool DrawPinNum, bool DrawPinName, int aMarkupFlags )
{
if( !DrawPinName && !DrawPinNum )
return;
int x, y;
-
+ wxDC* DC = aSettings->GetPrintDC();
wxSize PinNameSize( m_nameTextSize, m_nameTextSize );
wxSize PinNumSize( m_numTextSize, m_numTextSize );
- int nameLineWidth = Clamp_Text_PenSize( GetPenSize(), m_nameTextSize, false );
- int numLineWidth = Clamp_Text_PenSize( GetPenSize(), m_numTextSize, false );
- int name_offset = Mils2iu( PIN_TEXT_MARGIN ) + nameLineWidth;
- int num_offset = Mils2iu( PIN_TEXT_MARGIN ) + numLineWidth;
+
+ int namePenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_nameTextSize, false ),
+ aSettings->GetDefaultPenWidth() );
+ int numPenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_numTextSize, false ),
+ aSettings->GetDefaultPenWidth() );
+
+ int name_offset = Mils2iu( PIN_TEXT_MARGIN ) + namePenWidth;
+ int num_offset = Mils2iu( PIN_TEXT_MARGIN ) + numPenWidth;
/* Get the num and name colors */
- COLOR4D NameColor = IsVisible() ? GetLayerColor( LAYER_PINNAM ) : GetInvisibleItemColor();
- COLOR4D NumColor = IsVisible() ? GetLayerColor( LAYER_PINNUM ) : GetInvisibleItemColor();
+ COLOR4D NameColor = aSettings->GetLayerColor( IsVisible() ? LAYER_PINNAM : LAYER_HIDDEN );
+ COLOR4D NumColor = aSettings->GetLayerColor( IsVisible() ? LAYER_PINNUM : LAYER_HIDDEN );
int x1 = pin_pos.x;
int y1 = pin_pos.y;
@@ -740,14 +740,14 @@ void LIB_PIN::PrintPinTexts( wxDC* DC, wxPoint& pin_pos, int orient, int TextIns
x = x1 + TextInside;
GRText( DC, wxPoint( x, y1 ), NameColor, m_name, TEXT_ANGLE_HORIZ,
PinNameSize, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
- nameLineWidth, false, false );
+ namePenWidth, false, false, aMarkupFlags );
}
else // Orient == PIN_LEFT
{
x = x1 - TextInside;
GRText( DC, wxPoint( x, y1 ), NameColor, m_name, TEXT_ANGLE_HORIZ,
PinNameSize, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER,
- nameLineWidth, false, false );
+ namePenWidth, false, false, aMarkupFlags );
}
}
@@ -755,7 +755,7 @@ void LIB_PIN::PrintPinTexts( wxDC* DC, wxPoint& pin_pos, int orient, int TextIns
{
GRText( DC, wxPoint( (x1 + pin_pos.x) / 2, y1 - num_offset ), NumColor, m_number,
TEXT_ANGLE_HORIZ, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
- GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth, false, false );
+ GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false, aMarkupFlags );
}
}
else /* Its a vertical line. */
@@ -767,13 +767,13 @@ void LIB_PIN::PrintPinTexts( wxDC* DC, wxPoint& pin_pos, int orient, int TextIns
if( DrawPinName )
GRText( DC, wxPoint( x1, y ), NameColor, m_name, TEXT_ANGLE_VERT, PinNameSize,
- GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, nameLineWidth, false,
- false );
+ GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, namePenWidth, false,
+ false, aMarkupFlags );
if( DrawPinNum )
GRText( DC, wxPoint( x1 - num_offset, (y1 + pin_pos.y) / 2 ), NumColor,
m_number, TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
- GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth, false, false );
+ GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false, aMarkupFlags );
}
else /* PIN_UP */
{
@@ -781,13 +781,13 @@ void LIB_PIN::PrintPinTexts( wxDC* DC, wxPoint& pin_pos, int orient, int TextIns
if( DrawPinName )
GRText( DC, wxPoint( x1, y ), NameColor, m_name, TEXT_ANGLE_VERT, PinNameSize,
- GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, nameLineWidth, false,
- false );
+ GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, namePenWidth, false,
+ false, aMarkupFlags );
if( DrawPinNum )
- GRText( DC, wxPoint( x1 - num_offset, (y1 + pin_pos.y) / 2 ), NumColor,
+ GRText( DC, wxPoint( x1 - num_offset, (y1 + pin_pos.y) / 2 ), NumColor,
m_number, TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
- GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth, false, false );
+ GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false, aMarkupFlags );
}
}
}
@@ -801,14 +801,14 @@ void LIB_PIN::PrintPinTexts( wxDC* DC, wxPoint& pin_pos, int orient, int TextIns
x = (x1 + pin_pos.x) / 2;
GRText( DC, wxPoint( x, y1 - name_offset ), NameColor, m_name, TEXT_ANGLE_HORIZ,
PinNameSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
- nameLineWidth, false, false );
+ namePenWidth, false, false, aMarkupFlags );
}
if( DrawPinNum )
{
x = (x1 + pin_pos.x) / 2;
GRText( DC, wxPoint( x, y1 + num_offset ), NumColor, m_number, TEXT_ANGLE_HORIZ,
- PinNumSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, numLineWidth,
- false, false );
+ PinNumSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, numPenWidth,
+ false, false, aMarkupFlags );
}
}
else /* Its a vertical line. */
@@ -818,14 +818,14 @@ void LIB_PIN::PrintPinTexts( wxDC* DC, wxPoint& pin_pos, int orient, int TextIns
y = (y1 + pin_pos.y) / 2;
GRText( DC, wxPoint( x1 - name_offset, y ), NameColor, m_name, TEXT_ANGLE_VERT,
PinNameSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
- nameLineWidth, false, false );
+ namePenWidth, false, false, aMarkupFlags );
}
if( DrawPinNum )
{
GRText( DC, wxPoint( x1 + num_offset, (y1 + pin_pos.y) / 2 ), NumColor, m_number,
TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP,
- numLineWidth, false, false );
+ numPenWidth, false, false, aMarkupFlags );
}
}
}
@@ -833,14 +833,16 @@ void LIB_PIN::PrintPinTexts( wxDC* DC, wxPoint& pin_pos, int orient, int TextIns
-void LIB_PIN::PrintPinElectricalTypeName( wxDC* aDC, wxPoint& aPosition, int aOrientation )
+void LIB_PIN::PrintPinElectricalTypeName( RENDER_SETTINGS* aSettings, wxPoint& aPosition,
+ int aOrientation )
{
+ wxDC* DC = aSettings->GetPrintDC();
wxString typeName = GetElectricalTypeName();
// Use a reasonable (small) size to draw the text
- int textSize = (m_nameTextSize*3)/4;
+ int textSize = ( m_nameTextSize * 3 ) / 4;
- #define ETXT_MAX_SIZE Millimeter2iu(0.7 )
+ #define ETXT_MAX_SIZE Millimeter2iu( 0.7 )
if( textSize > ETXT_MAX_SIZE )
textSize = ETXT_MAX_SIZE;
@@ -848,7 +850,7 @@ void LIB_PIN::PrintPinElectricalTypeName( wxDC* aDC, wxPoint& aPosition, int aOr
int pensize = textSize/6;
// Get a suitable color
- COLOR4D color = IsVisible() ? GetLayerColor( LAYER_NOTES ) : GetInvisibleItemColor();
+ COLOR4D color = aSettings->GetLayerColor( IsVisible() ? LAYER_NOTES : LAYER_HIDDEN );
wxPoint txtpos = aPosition;
int offset = Millimeter2iu( 0.4 );
@@ -878,18 +880,19 @@ void LIB_PIN::PrintPinElectricalTypeName( wxDC* aDC, wxPoint& aPosition, int aOr
break;
}
- GRText( aDC, txtpos, color, typeName, orient, wxSize( textSize, textSize ), hjustify,
- GR_TEXT_VJUSTIFY_CENTER, pensize, false, false );
+ GRText( DC, txtpos, color, typeName, orient, wxSize( textSize, textSize ), hjustify,
+ GR_TEXT_VJUSTIFY_CENTER, pensize, false, false, 0 );
}
void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation )
{
- int MapX1, MapY1, x1, y1;
- COLOR4D color = aPlotter->ColorSettings()->GetColor( LAYER_PIN );
+ int MapX1, MapY1, x1, y1;
+ COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( LAYER_PIN );
+ int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
aPlotter->SetColor( color );
- aPlotter->SetCurrentLineWidth( GetPenSize() );
+ aPlotter->SetCurrentLineWidth( penWidth );
MapX1 = MapY1 = 0;
x1 = aPosition.x; y1 = aPosition.y;
@@ -905,8 +908,8 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
if( m_shape == GRAPHIC_PINSHAPE::INVERTED || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
{
const int radius = ExternalPinDecoSize( *this );
- aPlotter->Circle( wxPoint( MapX1 * radius + x1, MapY1 * radius + y1 ),
- radius * 2, NO_FILL, GetPenSize() );
+ aPlotter->Circle( wxPoint( MapX1 * radius + x1, MapY1 * radius + y1 ), radius * 2,
+ NO_FILL, penWidth );
aPlotter->MoveTo( wxPoint( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 ) );
aPlotter->FinishTo( aPosition );
@@ -1010,9 +1013,8 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
}
-void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
- int TextInside, bool DrawPinNum,
- bool DrawPinName, int aWidth )
+void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, int TextInside,
+ bool DrawPinNum, bool DrawPinName, int aMarkupFlags )
{
if( m_name.IsEmpty() || m_name == wxT( "~" ) )
DrawPinName = false;
@@ -1027,17 +1029,17 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
wxSize PinNameSize = wxSize( m_nameTextSize, m_nameTextSize );
wxSize PinNumSize = wxSize( m_numTextSize, m_numTextSize );
- int nameLineWidth = GetPenSize();
- nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_nameTextSize, false );
- int numLineWidth = GetPenSize();
- numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
+ int namePenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_nameTextSize, false ),
+ plotter->RenderSettings()->GetDefaultPenWidth() );
+ int numPenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_numTextSize, false ),
+ plotter->RenderSettings()->GetDefaultPenWidth() );
- int name_offset = Mils2iu( PIN_TEXT_MARGIN ) + nameLineWidth;
- int num_offset = Mils2iu( PIN_TEXT_MARGIN ) + numLineWidth;
+ int name_offset = Mils2iu( PIN_TEXT_MARGIN ) + namePenWidth;
+ int num_offset = Mils2iu( PIN_TEXT_MARGIN ) + numPenWidth;
/* Get the num and name colors */
- COLOR4D NameColor = GetLayerColor( LAYER_PINNAM );
- COLOR4D NumColor = GetLayerColor( LAYER_PINNUM );
+ COLOR4D NameColor = plotter->RenderSettings()->GetLayerColor( LAYER_PINNAM );
+ COLOR4D NumColor = plotter->RenderSettings()->GetLayerColor( LAYER_PINNUM );
int x1 = pin_pos.x;
int y1 = pin_pos.y;
@@ -1066,7 +1068,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
PinNameSize,
GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER,
- aWidth, false, false );
+ namePenWidth, false, false, aMarkupFlags );
}
else // orient == PIN_LEFT
{
@@ -1078,7 +1080,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER,
- aWidth, false, false );
+ namePenWidth, false, false, aMarkupFlags );
}
}
if( DrawPinNum )
@@ -1089,7 +1091,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
TEXT_ANGLE_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM,
- aWidth, false, false );
+ numPenWidth, false, false, aMarkupFlags );
}
}
else /* Its a vertical line. */
@@ -1104,7 +1106,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
TEXT_ANGLE_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER,
- aWidth, false, false );
+ namePenWidth, false, false, aMarkupFlags );
if( DrawPinNum )
{
@@ -1114,7 +1116,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
TEXT_ANGLE_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM,
- aWidth, false, false );
+ numPenWidth, false, false, aMarkupFlags );
}
}
else /* PIN_UP */
@@ -1127,7 +1129,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
TEXT_ANGLE_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER,
- aWidth, false, false );
+ namePenWidth, false, false, aMarkupFlags );
if( DrawPinNum )
{
@@ -1137,7 +1139,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
TEXT_ANGLE_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM,
- aWidth, false, false );
+ numPenWidth, false, false, aMarkupFlags );
}
}
}
@@ -1155,7 +1157,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
TEXT_ANGLE_HORIZ, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM,
- aWidth, false, false );
+ namePenWidth, false, false, aMarkupFlags );
}
if( DrawPinNum )
@@ -1166,7 +1168,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
TEXT_ANGLE_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP,
- aWidth, false, false );
+ numPenWidth, false, false, aMarkupFlags );
}
}
else /* Its a vertical line. */
@@ -1179,7 +1181,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
TEXT_ANGLE_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM,
- aWidth, false, false );
+ namePenWidth, false, false, aMarkupFlags );
}
if( DrawPinNum )
@@ -1190,7 +1192,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
TEXT_ANGLE_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP,
- aWidth, false, false );
+ numPenWidth, false, false, aMarkupFlags );
}
}
}
@@ -1314,14 +1316,6 @@ void LIB_PIN::Offset( const wxPoint& aOffset )
}
-bool LIB_PIN::Inside( EDA_RECT& rect ) const
-{
- wxPoint end = PinEndPoint();
-
- return rect.Contains( m_position.x, -m_position.y ) || rect.Contains( end.x, -end.y );
-}
-
-
void LIB_PIN::MoveTo( const wxPoint& newPosition )
{
if( m_position != newPosition )
@@ -1392,12 +1386,12 @@ void LIB_PIN::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
return;
int orient = PinDrawOrient( aTransform );
-
wxPoint pos = aTransform.TransformCoordinate( m_position ) + offset;
PlotSymbol( plotter, pos, orient );
PlotPinTexts( plotter, pos, orient, GetParent()->GetPinNameOffset(),
- GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames(), GetPenSize() );
+ GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames(),
+ plotter->GetTextMarkupFlags() );
}
@@ -1451,8 +1445,8 @@ void LIB_PIN::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
}
-void LIB_PIN::GetMsgPanelInfo(
- EDA_UNITS aUnits, std::vector& aList, SCH_COMPONENT* aComponent )
+void LIB_PIN::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList,
+ SCH_COMPONENT* aComponent )
{
getMsgPanelInfoBase( aUnits, aList );
@@ -1586,7 +1580,7 @@ const EDA_RECT LIB_PIN::GetBoundingBox( bool aIncludeInvisibles ) const
bbox.SetOrigin( begin );
bbox.SetEnd( end );
bbox.Normalize();
- bbox.Inflate( ( GetPenSize() / 2 ) + 1 );
+ bbox.Inflate( ( GetPenWidth() / 2 ) + 1 );
// Draw Y axis is reversed in schematic:
bbox.RevertYAxis();
@@ -1595,7 +1589,7 @@ const EDA_RECT LIB_PIN::GetBoundingBox( bool aIncludeInvisibles ) const
}
-wxArrayString LIB_PIN::GetOrientationNames( void )
+wxArrayString LIB_PIN::GetOrientationNames()
{
wxArrayString tmp;
diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h
index 7e70f8621d..0527f7246b 100644
--- a/eeschema/lib_pin.h
+++ b/eeschema/lib_pin.h
@@ -67,28 +67,29 @@ class LIB_PIN : public LIB_ITEM
// flag. So the LEGACY_PLUGIN_CACHE needs direct access to the member variables.
friend class SCH_LEGACY_PLUGIN_CACHE;
- wxPoint m_position; ///< Position of the pin.
- int m_length; ///< Length of the pin.
- int m_orientation; ///< Pin orientation (Up, Down, Left, Right)
- GRAPHIC_PINSHAPE m_shape; ///< Shape drawn around pin
- int m_width; ///< Line width of the pin.
- ELECTRICAL_PINTYPE m_type; ///< Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
- int m_attributes; ///< Set bit 0 to indicate pin is invisible.
- wxString m_name;
- wxString m_number;
- int m_numTextSize;
- int m_nameTextSize; ///< Pin num and Pin name sizes
-
+ wxPoint m_position; // Position of the pin.
+ int m_length; // Length of the pin.
+ int m_orientation; // Pin orientation (Up, Down, Left, Right)
+ GRAPHIC_PINSHAPE m_shape; // Shape drawn around pin
+ int m_width; // Line width of the pin.
+ ELECTRICAL_PINTYPE m_type; // Electrical type of the pin.
+ int m_attributes; // Set bit 0 to indicate pin is invisible.
+ wxString m_name;
+ wxString m_number;
+ int m_numTextSize; // Pin num and Pin name sizes
+ int m_nameTextSize;
+ int m_textMarkupFlags; // Set of TEXT_MARKUP_FLAGS indicating which markup
+ // features are to be processed within the pin name
+ // and number.
/**
* Print a pin, with or without the pin texts
*
- * @param aDC Device Context (can be null)
* @param aOffset Offset to draw
* @param aData = used here as a boolean indicating whether or not to draw the pin
* electrical types
* @param aTransform Transform Matrix (rotation, mirror ..)
*/
- void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
+ void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
public:
@@ -355,13 +356,13 @@ public:
&& ( !IsVisible() || (LIB_PART*) GetParent()->IsPower() );
}
- int GetPenSize() const override;
+ int GetPenWidth() const override;
/**
* Print the pin symbol without text.
* If \a aColor != 0, draw with \a aColor, else with the normal pin color.
*/
- void PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrientation );
+ void PrintPinSymbol( RENDER_SETTINGS* aSettings, const wxPoint& aPos, int aOrientation );
/**
* Put the pin number and pin text info, given the pin line coordinates.
@@ -371,13 +372,14 @@ public:
* If TextInside then the text is been put inside,otherwise all is drawn outside.
* Pin Name: substring between '~' is negated
*/
- void PrintPinTexts( wxDC* aDC, wxPoint& aPosition, int aOrientation, int TextInside,
- bool DrawPinNum, bool DrawPinName );
+ void PrintPinTexts( RENDER_SETTINGS* aSettings, wxPoint& aPosition, int aOrientation,
+ int TextInside, bool DrawPinNum, bool DrawPinName, int aMarkupFlags );
/**
* Draw the electrical type text of the pin (only for the footprint editor)
*/
- void PrintPinElectricalTypeName( wxDC* aDC, wxPoint& aPosition, int aOrientation );
+ void PrintPinElectricalTypeName( RENDER_SETTINGS* aSettings, wxPoint& aPosition,
+ int aOrientation );
/**
* Plot the pin number and pin text info, given the pin line coordinates.
@@ -387,7 +389,7 @@ public:
* the opposite direction to x2,y2), otherwise all is drawn outside.
*/
void PlotPinTexts( PLOTTER *aPlotter, wxPoint& aPosition, int aOrientation,
- int aTextInside, bool aDrawPinNum, bool aDrawPinName, int aWidth );
+ int aTextInside, bool aDrawPinNum, bool aDrawPinName, int aMarkupFlags );
void PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation );
@@ -425,8 +427,6 @@ public:
void Offset( const wxPoint& aOffset ) override;
- bool Inside( EDA_RECT& aRect ) const override;
-
void MoveTo( const wxPoint& aPosition ) override;
wxPoint GetPosition() const override { return m_position; }
@@ -449,6 +449,9 @@ public:
int GetWidth() const override { return m_width; }
void SetWidth( int aWidth ) override;
+ int GetTextMarkupFlags() const { return m_textMarkupFlags; }
+ void SetTextMarkupFlags( int aFlags ) { m_textMarkupFlags = aFlags; }
+
BITMAP_DEF GetMenuImage() const override;
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp
index 51017dda7e..43cc6ea200 100644
--- a/eeschema/lib_polyline.cpp
+++ b/eeschema/lib_polyline.cpp
@@ -36,7 +36,6 @@
#include
#include
#include
-#include // For some default values
LIB_POLYLINE::LIB_POLYLINE( LIB_PART* aParent ) :
@@ -88,18 +87,6 @@ void LIB_POLYLINE::Offset( const wxPoint& aOffset )
}
-bool LIB_POLYLINE::Inside( EDA_RECT& aRect ) const
-{
- for( const wxPoint& point : m_PolyPoints )
- {
- if( aRect.Contains( point.x, -point.y ) )
- return true;
- }
-
- return false;
-}
-
-
void LIB_POLYLINE::MoveTo( const wxPoint& aPosition )
{
Offset( aPosition - m_PolyPoints[ 0 ] );
@@ -149,17 +136,16 @@ void LIB_POLYLINE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
{
- aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE_BACKGROUND ) );
+ aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->PlotPoly( cornerList, FILLED_WITH_BG_BODYCOLOR, 0 );
}
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
- auto pen_size = GetPenSize();
+ auto pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
if( !already_filled || pen_size > 0 )
{
- pen_size = std::max( 0, pen_size );
- aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE ) );
+ aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
aPlotter->PlotPoly( cornerList, already_filled ? NO_FILL : m_Fill, pen_size );
}
}
@@ -197,39 +183,32 @@ void LIB_POLYLINE::RemoveCorner( int aIdx )
}
-int LIB_POLYLINE::GetPenSize() const
+int LIB_POLYLINE::GetPenWidth() const
{
- if( m_Width )
- return m_Width;
-
-#if 1
- // Temporary code not using RENDER_SETTINGS
- return DEFAULT_LINE_THICKNESS * IU_PER_MILS;
-#else
- // JEY TODO: requires RENDER_SETTINGS
-#endif
+ return std::max( m_Width, 1 );
}
-void LIB_POLYLINE::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
+void LIB_POLYLINE::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform )
{
- COLOR4D color = GetLayerColor( LAYER_DEVICE );
- COLOR4D bgColor = GetLayerColor( LAYER_DEVICE_BACKGROUND );
-
+ wxDC* DC = aSettings->GetPrintDC();
+ COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
+ COLOR4D bgColor = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
wxPoint* buffer = new wxPoint[ m_PolyPoints.size() ];
for( unsigned ii = 0; ii < m_PolyPoints.size(); ii++ )
buffer[ii] = aTransform.TransformCoordinate( m_PolyPoints[ii] ) + aOffset;
FILL_T fill = aData ? NO_FILL : m_Fill;
+ int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
if( fill == FILLED_WITH_BG_BODYCOLOR )
- GRPoly( nullptr, aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(), bgColor, bgColor );
+ GRPoly( nullptr, DC, m_PolyPoints.size(), buffer, true, penWidth, bgColor, bgColor );
else if( fill == FILLED_SHAPE )
- GRPoly( nullptr, aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(), color, color );
+ GRPoly( nullptr, DC, m_PolyPoints.size(), buffer, true, penWidth, color, color );
else
- GRPoly( nullptr, aDC, m_PolyPoints.size(), buffer, 0, GetPenSize(), color, color );
+ GRPoly( nullptr, DC, m_PolyPoints.size(), buffer, false, penWidth, color, color );
delete[] buffer;
}
@@ -237,8 +216,7 @@ void LIB_POLYLINE::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
bool LIB_POLYLINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
- int delta = std::max( aAccuracy + GetPenSize() / 2,
- Mils2iu( MINIMUM_SELECTION_DISTANCE ) );
+ int delta = std::max( aAccuracy + GetPenWidth() / 2, Mils2iu( MINIMUM_SELECTION_DISTANCE ) );
SHAPE_LINE_CHAIN shape;
for( wxPoint pt : m_PolyPoints )
@@ -272,7 +250,7 @@ bool LIB_POLYLINE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccurac
return false;
// Account for the width of the line
- sel.Inflate( GetPenSize() / 2 );
+ sel.Inflate( ( GetPenWidth() / 2 ) + 1 );
// Only test closing segment if the polyline is filled
int count = m_Fill == NO_FILL ? m_PolyPoints.size() - 1 : m_PolyPoints.size();
@@ -313,7 +291,7 @@ const EDA_RECT LIB_POLYLINE::GetBoundingBox() const
rect.SetOrigin( xmin, ymin );
rect.SetEnd( xmax, ymax );
- rect.Inflate( ( GetPenSize()+1 ) / 2 );
+ rect.Inflate( ( GetPenWidth() / 2 ) + 1 );
rect.RevertYAxis();
diff --git a/eeschema/lib_polyline.h b/eeschema/lib_polyline.h
index dea4453011..255d61a80c 100644
--- a/eeschema/lib_polyline.h
+++ b/eeschema/lib_polyline.h
@@ -33,7 +33,7 @@ class LIB_POLYLINE : public LIB_ITEM
int m_Width; // Line width
std::vector m_PolyPoints; // list of points (>= 2)
- void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
+ void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
public:
@@ -77,7 +77,7 @@ public:
const EDA_RECT GetBoundingBox() const override;
- int GetPenSize( ) const override;
+ int GetPenWidth() const override;
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override;
@@ -88,8 +88,6 @@ public:
void Offset( const wxPoint& aOffset ) override;
- bool Inside( EDA_RECT& aRect ) const override;
-
void MoveTo( const wxPoint& aPosition ) override;
wxPoint GetPosition() const override { return m_PolyPoints[0]; }
diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp
index 12a4181b31..1b339d5632 100644
--- a/eeschema/lib_rectangle.cpp
+++ b/eeschema/lib_rectangle.cpp
@@ -36,7 +36,6 @@
#include
#include
#include
-#include // For some default values
LIB_RECTANGLE::LIB_RECTANGLE( LIB_PART* aParent ) :
@@ -88,12 +87,6 @@ void LIB_RECTANGLE::Offset( const wxPoint& aOffset )
}
-bool LIB_RECTANGLE::Inside( EDA_RECT& aRect ) const
-{
- return aRect.Contains( m_Pos.x, -m_Pos.y ) || aRect.Contains( m_End.x, -m_End.y );
-}
-
-
void LIB_RECTANGLE::MoveTo( const wxPoint& aPosition )
{
wxPoint size = m_End - m_Pos;
@@ -142,52 +135,45 @@ void LIB_RECTANGLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
{
- aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE_BACKGROUND ) );
+ aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->Rect( pos, end, FILLED_WITH_BG_BODYCOLOR, 0 );
}
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
- auto pen_size = GetPenSize();
+ auto pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
if( !already_filled || pen_size > 0 )
{
- pen_size = std::max( 0, pen_size );
- aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE ) );
+ aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
aPlotter->Rect( pos, end, already_filled ? NO_FILL : m_Fill, pen_size );
}
}
-int LIB_RECTANGLE::GetPenSize() const
+int LIB_RECTANGLE::GetPenWidth() const
{
- if( m_Width )
- return m_Width;
-
-#if 1
- // Temporary code not using RENDER_SETTINGS
- return DEFAULT_LINE_THICKNESS * IU_PER_MILS;
-#else
- // JEY TODO: requires RENDER_SETTINGS
-#endif
+ return std::max( m_Width, 1 );
}
-void LIB_RECTANGLE::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
+void LIB_RECTANGLE::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform )
{
- COLOR4D color = GetLayerColor( LAYER_DEVICE );
- COLOR4D bgColor = GetLayerColor( LAYER_DEVICE_BACKGROUND );
+ wxDC* DC = aSettings->GetPrintDC();
+ COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
+ COLOR4D bgColor = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
wxPoint pt1 = aTransform.TransformCoordinate( m_Pos ) + aOffset;
wxPoint pt2 = aTransform.TransformCoordinate( m_End ) + aOffset;
FILL_T fill = aData ? NO_FILL : m_Fill;
+ int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
if( fill == FILLED_WITH_BG_BODYCOLOR && !aData )
- GRFilledRect( nullptr, aDC, pt1.x, pt1.y, pt2.x, pt2.y, GetPenSize( ), bgColor, bgColor );
+ GRFilledRect( nullptr, DC, pt1.x, pt1.y, pt2.x, pt2.y, penWidth, bgColor, bgColor );
else if( m_Fill == FILLED_SHAPE && !aData )
- GRFilledRect( nullptr, aDC, pt1.x, pt1.y, pt2.x, pt2.y, GetPenSize(), color, color );
+ GRFilledRect( nullptr, DC, pt1.x, pt1.y, pt2.x, pt2.y, penWidth, color, color );
else
- GRRect( nullptr, aDC, pt1.x, pt1.y, pt2.x, pt2.y, GetPenSize(), color );
+ GRRect( nullptr, DC, pt1.x, pt1.y, pt2.x, pt2.y, penWidth, color );
}
@@ -207,7 +193,7 @@ const EDA_RECT LIB_RECTANGLE::GetBoundingBox() const
rect.SetOrigin( m_Pos );
rect.SetEnd( m_End );
- rect.Inflate( ( GetPenSize()+1 ) / 2 );
+ rect.Inflate( ( GetPenWidth() / 2 ) + 1 );
rect.RevertYAxis();
@@ -217,7 +203,7 @@ const EDA_RECT LIB_RECTANGLE::GetBoundingBox() const
bool LIB_RECTANGLE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
- int mindist = std::max( aAccuracy + GetPenSize() / 2,
+ int mindist = std::max( aAccuracy + GetPenWidth() / 2,
Mils2iu( MINIMUM_SELECTION_DISTANCE ) );
wxPoint actualStart = DefaultTransform.TransformCoordinate( m_Pos );
wxPoint actualEnd = DefaultTransform.TransformCoordinate( m_End );
diff --git a/eeschema/lib_rectangle.h b/eeschema/lib_rectangle.h
index 4ef345542b..c741f6c548 100644
--- a/eeschema/lib_rectangle.h
+++ b/eeschema/lib_rectangle.h
@@ -34,7 +34,7 @@ class LIB_RECTANGLE : public LIB_ITEM
wxPoint m_Pos; // Rectangle start point.
int m_Width; // Line width
- void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
+ void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
public:
@@ -58,7 +58,7 @@ public:
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
- int GetPenSize( ) const override;
+ int GetPenWidth() const override;
const EDA_RECT GetBoundingBox() const override;
@@ -69,8 +69,6 @@ public:
void Offset( const wxPoint& aOffset ) override;
- bool Inside( EDA_RECT& aRect ) const override;
-
void MoveTo( const wxPoint& aPosition ) override;
wxPoint GetPosition() const override { return m_Pos; }
diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp
index 0a8999d6f9..9865e43a23 100644
--- a/eeschema/lib_text.cpp
+++ b/eeschema/lib_text.cpp
@@ -44,9 +44,9 @@
#include // For some default values
-LIB_TEXT::LIB_TEXT( LIB_PART * aParent ) :
+LIB_TEXT::LIB_TEXT( LIB_PART* aParent, int aMarkupFlags ) :
LIB_ITEM( LIB_TEXT_T, aParent ),
- EDA_TEXT()
+ EDA_TEXT( wxEmptyString, aMarkupFlags )
{
SetTextSize( wxSize( Mils2iu( DEFAULT_TEXT_SIZE ), Mils2iu( DEFAULT_TEXT_SIZE ) ) );
}
@@ -78,7 +78,7 @@ bool LIB_TEXT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
EDA_ITEM* LIB_TEXT::Clone() const
{
- LIB_TEXT* newitem = new LIB_TEXT( nullptr );
+ LIB_TEXT* newitem = new LIB_TEXT( nullptr, GetTextMarkupFlags() );
newitem->m_Unit = m_Unit;
newitem->m_Convert = m_Convert;
@@ -129,12 +129,6 @@ void LIB_TEXT::Offset( const wxPoint& aOffset )
}
-bool LIB_TEXT::Inside( EDA_RECT& rect ) const
-{
- return rect.Intersects( GetBoundingBox() );
-}
-
-
void LIB_TEXT::MoveTo( const wxPoint& newPosition )
{
SetTextPos( newPosition );
@@ -144,7 +138,7 @@ void LIB_TEXT::MoveTo( const wxPoint& newPosition )
void LIB_TEXT::NormalizeJustification( bool inverse )
{
wxPoint delta( 0, 0 );
- EDA_RECT bbox = GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
+ EDA_RECT bbox = GetTextBox();
if( GetTextAngle() == 0.0 )
{
@@ -289,32 +283,33 @@ void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
COLOR4D color;
if( plotter->GetColorMode() ) // Used normal color or selected color
- color = plotter->ColorSettings()->GetColor( LAYER_DEVICE );
+ color = plotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
else
color = COLOR4D::BLACK;
- plotter->Text( pos, color, GetText(), t1 ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT,
- GetTextSize(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
- GetPenSize(), IsItalic(), IsBold() );
+ int penWidth = std::max( GetEffectiveTextPenWidth(),
+ plotter->RenderSettings()->GetDefaultPenWidth() );
+
+ // NOTE: do NOT use m_textMarkupFlags; those are from the library, not the schematic
+
+ plotter->Text( pos, color, GetText(), t1 ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT, GetTextSize(),
+ GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, penWidth, IsItalic(),
+ IsBold(), plotter->GetTextMarkupFlags() );
}
-int LIB_TEXT::GetPenSize() const
+int LIB_TEXT::GetPenWidth() const
{
-#if 1
- // Temporary code not using RENDER_SETTINGS
- int textThickness = DEFAULT_LINE_THICKNESS * IU_PER_MILS;
- textThickness = Clamp_Text_PenSize( textThickness, GetTextSize(), IsBold() );
- return textThickness;
-#else
- return GetEffectiveTextPenWidth( nullptr ); // JEY TODO: requires RENDER_SETTINGS
-#endif
+ return GetEffectiveTextPenWidth();
}
-void LIB_TEXT::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANSFORM& aTransform )
+void LIB_TEXT::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
+ const TRANSFORM& aTransform )
{
- COLOR4D color = GetDefaultColor();
+ wxDC* DC = aSettings->GetPrintDC();
+ COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
+ int penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetDefaultPenWidth() );
/* Calculate the text orientation, according to the component
* orientation/mirror (needed when draw text in schematic)
@@ -349,8 +344,8 @@ void LIB_TEXT::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRAN
// Calculate pos according to mirror/rotation.
txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset;
- GRText( aDC, txtpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_HJUSTIFY_CENTER,
- GR_TEXT_VJUSTIFY_CENTER, GetEffectiveTextPenWidth( nullptr ), IsItalic(), IsBold() );
+ GRText( DC, txtpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_HJUSTIFY_CENTER,
+ GR_TEXT_VJUSTIFY_CENTER, penWidth, IsItalic(), IsBold(), m_textMarkupFlags );
}
@@ -358,7 +353,7 @@ void LIB_TEXT::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
{
LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
- wxString msg = MessageTextFromValue( aUnits, GetTextPenWidth(), true );
+ wxString msg = MessageTextFromValue( aUnits, GetTextThickness(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
}
@@ -368,7 +363,7 @@ const EDA_RECT LIB_TEXT::GetBoundingBox() const
/* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when
* calling GetTextBox() that works using top to bottom Y axis orientation.
*/
- EDA_RECT rect = GetTextBox( nullptr, -1, true ); // JEY TODO: requires RENDER_SETTINGS
+ EDA_RECT rect = GetTextBox( -1, true );
rect.RevertYAxis();
// We are using now a bottom to top Y axis.
diff --git a/eeschema/lib_text.h b/eeschema/lib_text.h
index 00ebb54078..70607fa72e 100644
--- a/eeschema/lib_text.h
+++ b/eeschema/lib_text.h
@@ -39,11 +39,11 @@
*/
class LIB_TEXT : public LIB_ITEM, public EDA_TEXT
{
- void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
+ void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
public:
- LIB_TEXT( LIB_PART * aParent );
+ LIB_TEXT( LIB_PART* aParent, int aMarkupFlags = 0 );
// Do not create a copy constructor. The one generated by the compiler is adequate.
@@ -68,7 +68,7 @@ public:
return TextHitTest( aRect, aContained, aAccuracy );
}
- int GetPenSize( ) const override;
+ int GetPenWidth() const override;
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override;
@@ -79,8 +79,6 @@ public:
void Offset( const wxPoint& aOffset ) override;
- bool Inside( EDA_RECT& aRect ) const override;
-
void MoveTo( const wxPoint& aPosition ) override;
wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); }
@@ -94,8 +92,8 @@ public:
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) override;
- int GetWidth() const override { return GetTextPenWidth(); }
- void SetWidth( int aWidth ) override { SetTextPenWidth( aWidth ); }
+ int GetWidth() const override { return GetTextThickness(); }
+ void SetWidth( int aWidth ) override { SetTextThickness( aWidth ); }
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
diff --git a/eeschema/libedit/lib_edit_frame.cpp b/eeschema/libedit/lib_edit_frame.cpp
index fd8cd56ee4..e097c79a02 100644
--- a/eeschema/libedit/lib_edit_frame.cpp
+++ b/eeschema/libedit/lib_edit_frame.cpp
@@ -34,6 +34,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -774,6 +775,30 @@ void LIB_EDIT_FRAME::SetScreen( BASE_SCREEN* aScreen )
void LIB_EDIT_FRAME::RebuildView()
{
+ if( m_my_part )
+ {
+ for( LIB_ITEM& item : m_my_part->GetDrawItems() )
+ {
+ switch( item.Type() )
+ {
+ case LIB_FIELD_T:
+ static_cast( &item )->SetTextMarkupFlags( m_textMarkupFlags );
+ break;
+
+ case LIB_TEXT_T:
+ static_cast( &item )->SetTextMarkupFlags( m_textMarkupFlags );
+ break;
+
+ case LIB_PIN_T:
+ static_cast( &item )->SetTextMarkupFlags( m_textMarkupFlags );
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+
GetRenderSettings()->m_ShowUnit = m_unit;
GetRenderSettings()->m_ShowConvert = m_convert;
GetRenderSettings()->m_ShowDisabled = m_my_part && m_my_part->IsAlias();
diff --git a/eeschema/libedit/lib_edit_frame.h b/eeschema/libedit/lib_edit_frame.h
index 2932bb6411..7d9ef57a52 100644
--- a/eeschema/libedit/lib_edit_frame.h
+++ b/eeschema/libedit/lib_edit_frame.h
@@ -390,7 +390,7 @@ public:
*
* @param aDC = wxDC given by the calling print function
*/
- void PrintPage( wxDC* aDC ) override;
+ void PrintPage( RENDER_SETTINGS* aSettings ) override;
/**
* Creates the SVG print file for the current edited component.
diff --git a/eeschema/libedit/libedit_plot_component.cpp b/eeschema/libedit/libedit_plot_component.cpp
index 0e2db5d6b8..b8851c7d05 100644
--- a/eeschema/libedit/libedit_plot_component.cpp
+++ b/eeschema/libedit/libedit_plot_component.cpp
@@ -23,10 +23,7 @@
#include
-#include
-#include
-#include
-#include
+#include
#include
#include
#include
@@ -34,13 +31,17 @@
void LIB_EDIT_FRAME::SVG_PlotComponent( const wxString& aFullFileName )
{
- const bool plotColor = true;
+ KIGFX::SCH_RENDER_SETTINGS renderSettings;
+ renderSettings.LoadColors( GetColorSettings() );
+ renderSettings.SetDefaultPenWidth( GetRenderSettings()->GetDefaultPenWidth() );
+
const PAGE_INFO& pageInfo = GetScreen()->GetPageSettings();
SVG_PLOTTER* plotter = new SVG_PLOTTER();
+ plotter->SetRenderSettings( &renderSettings );
plotter->SetPageSettings( pageInfo );
- plotter->SetDefaultLineWidth( GetDefaultLineWidth() );
- plotter->SetColorMode( plotColor );
+ plotter->SetColorMode( true );
+ plotter->SetTextMarkupFlags( GetTextMarkupFlags() );
wxPoint plot_offset;
const double scale = 1.0;
@@ -80,7 +81,7 @@ void LIB_EDIT_FRAME::SVG_PlotComponent( const wxString& aFullFileName )
}
-void LIB_EDIT_FRAME::PrintPage( wxDC* aDC )
+void LIB_EDIT_FRAME::PrintPage( RENDER_SETTINGS* aSettings )
{
if( !m_my_part )
return;
@@ -95,5 +96,5 @@ void LIB_EDIT_FRAME::PrintPage( wxDC* aDC )
plot_offset.x = pagesize.x / 2;
plot_offset.y = pagesize.y / 2;
- m_my_part->Print( aDC, plot_offset, m_unit, m_convert, PART_DRAW_OPTIONS::Default() );
+ m_my_part->Print( aSettings, plot_offset, m_unit, m_convert, PART_DRAW_OPTIONS() );
}
diff --git a/eeschema/plot_schematic_DXF.cpp b/eeschema/plot_schematic_DXF.cpp
index b88aa9c119..8f4079de13 100644
--- a/eeschema/plot_schematic_DXF.cpp
+++ b/eeschema/plot_schematic_DXF.cpp
@@ -32,7 +32,7 @@
#include
#include
#include
-
+#include
#include
#include
@@ -109,12 +109,16 @@ bool DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF( const wxString& aFileName,
double aScale,
bool aPlotFrameRef )
{
- DXF_PLOTTER* plotter = new DXF_PLOTTER();
+ KIGFX::SCH_RENDER_SETTINGS renderSettings;
+ renderSettings.LoadColors( getColorSettings() );
+ renderSettings.SetDefaultPenWidth( 0 );
- const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
+ const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
+ DXF_PLOTTER* plotter = new DXF_PLOTTER();
+
+ plotter->SetRenderSettings( &renderSettings );
plotter->SetPageSettings( pageInfo );
plotter->SetColorMode( getModeColor() );
- plotter->SetColorSettings( getColorSettings() );
// Currently, plot units are in decimil
plotter->SetViewport( aPlotOffset, IU_PER_MILS/10, aScale, false );
diff --git a/eeschema/plot_schematic_HPGL.cpp b/eeschema/plot_schematic_HPGL.cpp
index 725329e955..054f179aef 100644
--- a/eeschema/plot_schematic_HPGL.cpp
+++ b/eeschema/plot_schematic_HPGL.cpp
@@ -183,7 +183,7 @@ bool DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL( const wxString& aFileName,
// Currently, plot units are in decimil
plotter->SetPageSettings( aPageInfo );
- plotter->SetColorSettings( getColorSettings() );
+ plotter->RenderSettings()->LoadColors( getColorSettings() );
plotter->SetColorMode( getModeColor() );
plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false );
diff --git a/eeschema/plot_schematic_PDF.cpp b/eeschema/plot_schematic_PDF.cpp
index a488dd2e5c..e07f18f931 100644
--- a/eeschema/plot_schematic_PDF.cpp
+++ b/eeschema/plot_schematic_PDF.cpp
@@ -30,6 +30,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -41,9 +42,8 @@
#include
void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef,
- int aDefaultLineWidth )
+ RENDER_SETTINGS* aRenderSettings )
{
- SCH_SCREEN* screen = m_parent->GetScreen();
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
/* When printing all pages, the printed page is not the current page. In
@@ -62,9 +62,8 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef,
// Allocate the plotter and set the job level parameter
PDF_PLOTTER* plotter = new PDF_PLOTTER();
- plotter->SetDefaultLineWidth( aDefaultLineWidth );
+ plotter->SetRenderSettings( aRenderSettings );
plotter->SetColorMode( getModeColor() );
- plotter->SetColorSettings( getColorSettings() );
plotter->SetCreator( wxT( "Eeschema-PDF" ) );
plotter->SetTitle( m_parent->GetTitleBlock().GetTitle() );
@@ -78,7 +77,7 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef,
m_parent->SetCurrentSheet( sheetList[i] );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
- screen = m_parent->GetCurrentSheet().LastScreen();
+ SCH_SCREEN* screen = m_parent->GetCurrentSheet().LastScreen();
if( i == 0 )
{
@@ -151,7 +150,7 @@ void DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF( PLOTTER* aPlotter,
{
if( m_plotBackgroundColor->GetValue() )
{
- aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_SCHEMATIC_BACKGROUND ) );
+ aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
wxPoint end( aPlotter->PageSettings().GetWidthIU(),
aPlotter->PageSettings().GetHeightIU() );
aPlotter->Rect( wxPoint( 0, 0 ), end, FILLED_SHAPE, 1.0 );
@@ -170,7 +169,7 @@ void DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF( PLOTTER* aPlotter,
}
-void DIALOG_PLOT_SCHEMATIC::setupPlotPagePDF( PLOTTER * aPlotter, SCH_SCREEN* aScreen )
+void DIALOG_PLOT_SCHEMATIC::setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen )
{
PAGE_INFO plotPage; // page size selected to plot
// Considerations on page size and scaling requests
diff --git a/eeschema/plot_schematic_PS.cpp b/eeschema/plot_schematic_PS.cpp
index be842b2abd..b99cd0efdf 100644
--- a/eeschema/plot_schematic_PS.cpp
+++ b/eeschema/plot_schematic_PS.cpp
@@ -33,16 +33,14 @@
#include
#include
#include
-
+#include
#include
#include
void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef,
- int aDefaultLineWidth )
+ RENDER_SETTINGS* aRenderSettings )
{
- SCH_SCREEN* screen = m_parent->GetScreen();
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
- PAGE_INFO actualPage; // page size selected in schematic
PAGE_INFO plotPage; // page size selected to plot
/* When printing all pages, the printed page is not the current page.
@@ -63,8 +61,9 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef,
m_parent->SetCurrentSheet( sheetList[i] );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
- screen = m_parent->GetCurrentSheet().LastScreen();
- actualPage = screen->GetPageSettings();
+
+ SCH_SCREEN* screen = m_parent->GetCurrentSheet().LastScreen();
+ PAGE_INFO actualPage = screen->GetPageSettings();
switch( m_pageSizeSelect )
{
@@ -100,7 +99,7 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef,
wxString ext = PS_PLOTTER::GetDefaultFileExtension();
wxFileName plotFileName = createPlotFileName( fname, ext, &reporter );
- if( plotOneSheetPS( plotFileName.GetFullPath(), screen, aDefaultLineWidth, plotPage,
+ if( plotOneSheetPS( plotFileName.GetFullPath(), screen, aRenderSettings, plotPage,
plot_offset, scale, aPlotFrameRef ) )
{
msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() );
@@ -129,17 +128,16 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef,
bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
SCH_SCREEN* aScreen,
- int aDefaultLineWidth,
+ RENDER_SETTINGS* aRenderSettings,
const PAGE_INFO& aPageInfo,
wxPoint aPlot0ffset,
double aScale,
bool aPlotFrameRef )
{
PS_PLOTTER* plotter = new PS_PLOTTER();
+ plotter->SetRenderSettings( aRenderSettings );
plotter->SetPageSettings( aPageInfo );
- plotter->SetDefaultLineWidth( aDefaultLineWidth );
plotter->SetColorMode( getModeColor() );
- plotter->SetColorSettings( getColorSettings() );
// Currently, plot units are in decimil
plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false );
@@ -158,7 +156,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
if( m_plotBackgroundColor->GetValue() )
{
- plotter->SetColor( plotter->ColorSettings()->GetColor( LAYER_SCHEMATIC_BACKGROUND ) );
+ plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
wxPoint end( plotter->PageSettings().GetWidthIU(),
plotter->PageSettings().GetHeightIU() );
plotter->Rect( wxPoint( 0, 0 ), end, FILLED_SHAPE, 1.0 );
diff --git a/eeschema/plot_schematic_SVG.cpp b/eeschema/plot_schematic_SVG.cpp
index c9eb1fb0c1..30fcd4dde5 100644
--- a/eeschema/plot_schematic_SVG.cpp
+++ b/eeschema/plot_schematic_SVG.cpp
@@ -40,9 +40,10 @@
#include
#include
+#include "sch_painter.h"
void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef,
- int aDefaultLineWidth )
+ RENDER_SETTINGS* aRenderSettings )
{
wxString msg;
REPORTER& reporter = m_MessagesBox->Reporter();
@@ -68,7 +69,7 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef,
wxString ext = SVG_PLOTTER::GetDefaultFileExtension();
wxFileName plotFileName = createPlotFileName( fname, ext, &reporter );
- bool success = plotOneSheetSVG( plotFileName.GetFullPath(), screen, aDefaultLineWidth,
+ bool success = plotOneSheetSVG( plotFileName.GetFullPath(), screen, aRenderSettings,
getModeColor() ? false : true, aPrintFrameRef );
if( !success )
@@ -97,18 +98,18 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef,
}
-bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( const wxString& aFileName,
- SCH_SCREEN* aScreen,
- int aDefaultLineWidth,
- bool aPlotBlackAndWhite,
- bool aPlotFrameRef )
+bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( const wxString& aFileName,
+ SCH_SCREEN* aScreen,
+ RENDER_SETTINGS* aRenderSettings,
+ bool aPlotBlackAndWhite,
+ bool aPlotFrameRef )
{
+ const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
+
SVG_PLOTTER* plotter = new SVG_PLOTTER();
- const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
+ plotter->SetRenderSettings( aRenderSettings );
plotter->SetPageSettings( pageInfo );
- plotter->SetDefaultLineWidth( aDefaultLineWidth );
plotter->SetColorMode( aPlotBlackAndWhite ? false : true );
- plotter->SetColorSettings( getColorSettings() );
wxPoint plot_offset;
double scale = 1.0;
// Currently, plot units are in decimil
@@ -129,7 +130,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( const wxString& aFileName,
if( m_plotBackgroundColor->GetValue() )
{
- plotter->SetColor( plotter->ColorSettings()->GetColor( LAYER_SCHEMATIC_BACKGROUND ) );
+ plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
wxPoint end( plotter->PageSettings().GetWidthIU(),
plotter->PageSettings().GetHeightIU() );
plotter->Rect( wxPoint( 0, 0 ), end, FILLED_SHAPE, 1.0 );
diff --git a/eeschema/project_rescue.cpp b/eeschema/project_rescue.cpp
index 4bf6e1227d..3dd5ce43dd 100644
--- a/eeschema/project_rescue.cpp
+++ b/eeschema/project_rescue.cpp
@@ -574,6 +574,8 @@ bool SCH_EDIT_FRAME::rescueProject( RESCUER& aRescuer, bool aRunningOnDemand )
SCH_SCREENS schematic;
schematic.UpdateSymbolLinks( true );
+ schematic.UpdateTextMarkupFlags( GetTextMarkupFlags() );
+
g_ConnectionGraph->Reset();
RecalculateConnections( GLOBAL_CLEANUP );
}
diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp
index 8528941e60..336ad0ac91 100644
--- a/eeschema/sch_base_frame.cpp
+++ b/eeschema/sch_base_frame.cpp
@@ -87,6 +87,8 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
m_defaultWireThickness( DEFAULT_WIRE_THICKNESS * IU_PER_MILS ),
m_defaultBusThickness( DEFAULT_BUS_THICKNESS * IU_PER_MILS ),
m_defaultTextSize( DEFAULT_TEXT_SIZE * IU_PER_MILS ),
+ m_textOffsetRatio( 0.08 ),
+ m_textMarkupFlags( 0 ),
m_showPinElectricalTypeName( false )
{
createCanvas();
@@ -129,7 +131,7 @@ const wxString SCH_BASE_FRAME::GetZoomLevelIndicator() const
void SCH_BASE_FRAME::SetDefaultLineWidth( int aWidth )
{
m_defaultLineWidth = aWidth;
- GetRenderSettings()->m_DefaultLineWidth = aWidth;
+ GetRenderSettings()->SetDefaultPenWidth( aWidth );
}
diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h
index 49bf16453a..f6af92f628 100644
--- a/eeschema/sch_base_frame.h
+++ b/eeschema/sch_base_frame.h
@@ -92,6 +92,8 @@ protected:
int m_defaultWireThickness;
int m_defaultBusThickness;
int m_defaultTextSize;
+ double m_textOffsetRatio;
+ int m_textMarkupFlags;
TEMPLATES m_templateFieldNames;
@@ -142,6 +144,12 @@ public:
int GetDefaultTextSize() const { return m_defaultTextSize; }
void SetDefaultTextSize( int aSize ) { m_defaultTextSize = aSize; }
+ double GetTextOffsetRatio() const { return m_textOffsetRatio; }
+ void SetTextOffsetRatio( double aRatio ) { m_textOffsetRatio = aRatio; }
+
+ int GetTextMarkupFlags() const { return m_textMarkupFlags; }
+ void SetTextMarkupFlags( int aFlags ) { m_textMarkupFlags = aFlags; }
+
/**
* Function GetZoomLevelIndicator
* returns a human readable value which can be displayed as zoom
diff --git a/eeschema/sch_bitmap.cpp b/eeschema/sch_bitmap.cpp
index 6025db6de6..64c80e9b99 100644
--- a/eeschema/sch_bitmap.cpp
+++ b/eeschema/sch_bitmap.cpp
@@ -59,7 +59,7 @@ SCH_BITMAP::SCH_BITMAP( const SCH_BITMAP& aSchBitmap ) :
}
-SCH_ITEM& SCH_BITMAP::operator=( const SCH_ITEM& aItem )
+SCH_BITMAP& SCH_BITMAP::operator=( const SCH_ITEM& aItem )
{
wxCHECK_MSG( Type() == aItem.Type(), *this,
wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
@@ -114,11 +114,11 @@ const EDA_RECT SCH_BITMAP::GetBoundingBox() const
}
-void SCH_BITMAP::Print( wxDC* aDC, const wxPoint& aOffset )
+void SCH_BITMAP::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
wxPoint pos = m_pos + aOffset;
- m_image->DrawBitmap( aDC, pos );
+ m_image->DrawBitmap( aSettings->GetPrintDC(), pos );
}
@@ -185,8 +185,8 @@ bool SCH_BITMAP::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
void SCH_BITMAP::Plot( PLOTTER* aPlotter )
{
- m_image->PlotImage(
- aPlotter, m_pos, aPlotter->ColorSettings()->GetColor( GetLayer() ), GetPenSize() );
+ m_image->PlotImage( aPlotter, m_pos, aPlotter->RenderSettings()->GetLayerColor( GetLayer() ),
+ aPlotter->RenderSettings()->GetDefaultPenWidth() );
}
diff --git a/eeschema/sch_bitmap.h b/eeschema/sch_bitmap.h
index 9aa1a8fe1d..f7bbdceb48 100644
--- a/eeschema/sch_bitmap.h
+++ b/eeschema/sch_bitmap.h
@@ -54,7 +54,7 @@ public:
delete m_image;
}
- SCH_ITEM& operator=( const SCH_ITEM& aItem );
+ SCH_BITMAP& operator=( const SCH_ITEM& aItem );
BITMAP_BASE* GetImage()
{
@@ -97,7 +97,7 @@ public:
void SwapData( SCH_ITEM* aItem ) override;
- void Print( wxDC* aDC, const wxPoint& aOffset ) override;
+ void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
/// @copydoc VIEW_ITEM::ViewGetLayers()
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp
index 10ee4eea95..b6becbc6df 100644
--- a/eeschema/sch_bus_entry.cpp
+++ b/eeschema/sch_bus_entry.cpp
@@ -37,6 +37,7 @@
#include
#include
#include
+#include "sch_painter.h"
#include // For some default values
@@ -121,31 +122,21 @@ const EDA_RECT SCH_BUS_ENTRY_BASE::GetBoundingBox() const
box.SetEnd( m_End() );
box.Normalize();
- box.Inflate( GetPenSize() / 2 );
+ box.Inflate( ( GetPenWidth() / 2 ) + 1 );
return box;
}
-int SCH_BUS_WIRE_ENTRY::GetPenSize() const
+int SCH_BUS_WIRE_ENTRY::GetPenWidth() const
{
-#if 1
- // Temporary code not using RENDER_SETTINGS
- return DEFAULT_WIRE_THICKNESS * IU_PER_MILS;
-#else
- // JEY TODO: requires RENDER_SETTINGS
-#endif
+ return 1;
}
-int SCH_BUS_BUS_ENTRY::GetPenSize() const
+int SCH_BUS_BUS_ENTRY::GetPenWidth() const
{
-#if 1
- // Temporary code not using RENDER_SETTINGS
- return DEFAULT_BUS_THICKNESS * IU_PER_MILS;
-#else
- // JEY TODO: requires RENDER_SETTINGS
-#endif
+ return 1;
}
@@ -169,12 +160,14 @@ void SCH_BUS_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemLis
}
-void SCH_BUS_ENTRY_BASE::Print( wxDC* aDC, const wxPoint& aOffset )
+void SCH_BUS_ENTRY_BASE::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
- COLOR4D color = GetLayerColor( m_Layer );
+ wxDC* DC = aSettings->GetPrintDC();
+ COLOR4D color = aSettings->GetLayerColor( m_Layer );
+ int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
- GRLine( nullptr, aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, m_End().x + aOffset.x,
- m_End().y + aOffset.y, GetPenSize(), color );
+ GRLine( nullptr, DC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, m_End().x + aOffset.x,
+ m_End().y + aOffset.y, penWidth, color );
}
@@ -341,7 +334,7 @@ bool SCH_BUS_ENTRY_BASE::HitTest( const wxPoint& aPosition, int aAccuracy ) cons
{
// Insure minimum accuracy
if( aAccuracy == 0 )
- aAccuracy = ( GetPenSize() / 2 ) + 4;
+ aAccuracy = ( GetPenWidth() / 2 ) + 4;
return TestSegmentHit( aPosition, m_pos, m_End(), aAccuracy );
}
@@ -362,8 +355,10 @@ bool SCH_BUS_ENTRY_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aA
void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter )
{
- aPlotter->SetCurrentLineWidth( GetPenSize() );
- aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( GetLayer() ) );
+ int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
+
+ aPlotter->SetCurrentLineWidth( penWidth );
+ aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( GetLayer() ) );
aPlotter->MoveTo( m_pos );
aPlotter->FinishTo( m_End() );
}
diff --git a/eeschema/sch_bus_entry.h b/eeschema/sch_bus_entry.h
index 9f76c27622..4f8623b091 100644
--- a/eeschema/sch_bus_entry.h
+++ b/eeschema/sch_bus_entry.h
@@ -82,7 +82,7 @@ public:
void ViewGetLayers( int aLayers[], int& aCount ) const override;
- void Print( wxDC* aDC, const wxPoint& aOffset ) override;
+ void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
const EDA_RECT GetBoundingBox() const override;
@@ -141,7 +141,7 @@ public:
return wxT( "SCH_BUS_WIRE_ENTRY" );
}
- int GetPenSize() const override;
+ int GetPenWidth() const override;
void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
@@ -189,7 +189,7 @@ public:
return wxT( "SCH_BUS_BUS_ENTRY" );
}
- int GetPenSize() const override;
+ int GetPenWidth() const override;
void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp
index 8c479d1283..42e3563db2 100644
--- a/eeschema/sch_component.cpp
+++ b/eeschema/sch_component.cpp
@@ -529,24 +529,25 @@ int SCH_COMPONENT::GetUnitCount() const
}
-void SCH_COMPONENT::Print( wxDC* aDC, const wxPoint& aOffset )
+void SCH_COMPONENT::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
- auto opts = PART_DRAW_OPTIONS::Default();
+ PART_DRAW_OPTIONS opts;
opts.transform = m_transform;
opts.draw_visible_fields = false;
opts.draw_hidden_fields = false;
+ opts.text_markup_flags = m_Fields[0].GetTextMarkupFlags();
if( m_part )
{
- m_part->Print( aDC, m_Pos + aOffset, m_unit, m_convert, opts );
+ m_part->Print( aSettings, m_Pos + aOffset, m_unit, m_convert, opts );
}
else // Use dummy() part if the actual cannot be found.
{
- dummy()->Print( aDC, m_Pos + aOffset, 0, 0, opts );
+ dummy()->Print( aSettings, m_Pos + aOffset, 0, 0, opts );
}
for( SCH_FIELD& field : m_Fields )
- field.Print( aDC, aOffset );
+ field.Print( aSettings, aOffset );
}
@@ -821,7 +822,8 @@ void SCH_COMPONENT::UpdateFields( bool aResetStyle, bool aResetRef )
if( !schField )
{
wxString fieldName = libField.GetCanonicalName();
- SCH_FIELD newField( wxPoint( 0, 0), GetFieldCount(), this, fieldName );
+ SCH_FIELD newField( wxPoint( 0, 0), GetFieldCount(), this, fieldName,
+ GetField( REFERENCE )->GetTextMarkupFlags() );
schField = AddField( newField );
}
}
@@ -1821,13 +1823,14 @@ bool SCH_COMPONENT::IsInNetlist() const
void SCH_COMPONENT::Plot( PLOTTER* aPlotter )
{
- TRANSFORM temp;
-
if( m_part )
{
- temp = GetTransform();
+ TRANSFORM temp = GetTransform();
aPlotter->StartBlock( nullptr );
+ // A cheater since we don't want to modify the various LIB_ITEMs' m_textMarkupFlags
+ aPlotter->SetTextMarkupFlags( m_Fields[0].GetTextMarkupFlags() );
+
m_part->Plot( aPlotter, GetUnit(), GetConvert(), m_Pos, temp );
for( SCH_FIELD field : m_Fields )
diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h
index 0461245370..756cab8f78 100644
--- a/eeschema/sch_component.h
+++ b/eeschema/sch_component.h
@@ -474,7 +474,7 @@ public:
* @param aOffset is the drawing offset (usually wxPoint(0,0),
* but can be different when moving an object)
*/
- void Print( wxDC* aDC, const wxPoint& aOffset ) override;
+ void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
void SwapData( SCH_ITEM* aItem ) override;
diff --git a/eeschema/sch_eagle_plugin.cpp b/eeschema/sch_eagle_plugin.cpp
index 577a444ba1..9c7eb30b4f 100644
--- a/eeschema/sch_eagle_plugin.cpp
+++ b/eeschema/sch_eagle_plugin.cpp
@@ -1839,7 +1839,7 @@ void SCH_EAGLE_PLUGIN::loadTextAttributes( EDA_TEXT* aText, const ETEXT& aAttrib
if( aAttribs.ratio.CGet() > 12 )
{
aText->SetBold( true );
- aText->SetTextPenWidth( GetPenSizeForBold( aText->GetTextWidth() ) );
+ aText->SetTextThickness( GetPenSizeForBold( aText->GetTextWidth() ) );
}
}
diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp
index a029201825..3fc4405f02 100644
--- a/eeschema/sch_edit_frame.cpp
+++ b/eeschema/sch_edit_frame.cpp
@@ -906,13 +906,13 @@ void SCH_EDIT_FRAME::Print()
}
-void SCH_EDIT_FRAME::PrintPage( wxDC* aDC )
+void SCH_EDIT_FRAME::PrintPage( RENDER_SETTINGS* aSettings )
{
wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() );
- aDC->SetLogicalFunction( wxCOPY );
- GetScreen()->Print( aDC );
- PrintWorkSheet( aDC, GetScreen(), GetDefaultLineWidth(), IU_PER_MILS, fileName );
+ aSettings->GetPrintDC()->SetLogicalFunction( wxCOPY );
+ GetScreen()->Print( aSettings );
+ PrintWorkSheet( aSettings, GetScreen(), IU_PER_MILS, fileName );
}
diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h
index fc3cfda64b..74466f779b 100644
--- a/eeschema/sch_edit_frame.h
+++ b/eeschema/sch_edit_frame.h
@@ -950,7 +950,7 @@ public:
*
* @param aDC = wxDC given by the calling print function
*/
- virtual void PrintPage( wxDC* aDC ) override;
+ virtual void PrintPage( RENDER_SETTINGS* aSettings ) override;
void SetNetListerCommand( const wxString& aCommand ) { m_netListerCommand = aCommand; }
diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp
index 099cb89d60..8ef4067510 100644
--- a/eeschema/sch_field.cpp
+++ b/eeschema/sch_field.cpp
@@ -46,12 +46,12 @@
#include
#include
#include
-#include // For some default values
-SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent, const wxString& aName ) :
+SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent, const wxString& aName,
+ int aMarkupFlags ) :
SCH_ITEM( aParent, SCH_FIELD_T ),
- EDA_TEXT()
+ EDA_TEXT( wxEmptyString, aMarkupFlags )
{
SetTextPos( aPos );
m_id = aFieldId;
@@ -130,25 +130,19 @@ wxString SCH_FIELD::GetShownText( int aDepth ) const
}
-int SCH_FIELD::GetPenSize() const
+int SCH_FIELD::GetPenWidth() const
{
-#if 1
- // Temporary code not using RENDER_SETTINGS
- int textThickness = DEFAULT_LINE_THICKNESS * IU_PER_MILS;
- textThickness = Clamp_Text_PenSize( textThickness, GetTextSize(), IsBold() );
- return textThickness;
-#else
- return GetEffectiveTextPenWidth( nullptr ); // JEY TODO: requires RENDER_SETTINGS
-#endif
+ return GetEffectiveTextPenWidth();
}
-void SCH_FIELD::Print( wxDC* aDC, const wxPoint& aOffset )
+void SCH_FIELD::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
+ wxDC* DC = aSettings->GetPrintDC();
+ COLOR4D color = aSettings->GetLayerColor( m_forceVisible ? LAYER_HIDDEN : m_Layer );
int orient;
- COLOR4D color;
wxPoint textpos;
- int lineWidth = GetPenSize();
+ int penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetDefaultPenWidth() );
if( ( !IsVisible() && !m_forceVisible) || IsVoid() )
return;
@@ -183,13 +177,8 @@ void SCH_FIELD::Print( wxDC* aDC, const wxPoint& aOffset )
EDA_RECT boundaryBox = GetBoundingBox();
textpos = boundaryBox.Centre() + aOffset;
- if( m_forceVisible )
- color = COLOR4D( DARKGRAY );
- else
- color = GetLayerColor( m_Layer );
-
- GRText( aDC, textpos, color, GetShownText(), orient, GetTextSize(),
- GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, lineWidth, IsItalic(), IsBold() );
+ GRText( DC, textpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_HJUSTIFY_CENTER,
+ GR_TEXT_VJUSTIFY_CENTER, penWidth, IsItalic(), IsBold(), m_textMarkupFlags );
}
@@ -219,7 +208,7 @@ const EDA_RECT SCH_FIELD::GetBoundingBox() const
SCH_FIELD text( *this ); // Make a local copy to change text
// because GetBoundingBox() is const
text.SetText( GetShownText() );
- rect = text.GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
+ rect = text.GetTextBox();
// Calculate the bounding box position relative to the parent:
wxPoint origin = GetParentPosition();
@@ -498,7 +487,9 @@ bool SCH_FIELD::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
void SCH_FIELD::Plot( PLOTTER* aPlotter )
{
- COLOR4D color = aPlotter->ColorSettings()->GetColor( GetLayer() );
+ COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( GetLayer() );
+ int penWidth = std::max( GetEffectiveTextPenWidth(),
+ aPlotter->RenderSettings()->GetDefaultPenWidth() );
if( !IsVisible() )
return;
@@ -538,10 +529,8 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter )
EDA_TEXT_VJUSTIFY_T vjustify = GR_TEXT_VJUSTIFY_CENTER;
wxPoint textpos = BoundaryBox.Centre();
- int thickness = GetPenSize();
-
aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(), hjustify, vjustify,
- thickness, IsItalic(), IsBold() );
+ penWidth, IsItalic(), IsBold(), m_textMarkupFlags );
}
diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h
index a199a0a2dc..e5775020f3 100644
--- a/eeschema/sch_field.h
+++ b/eeschema/sch_field.h
@@ -57,7 +57,7 @@ class SCH_FIELD : public SCH_ITEM, public EDA_TEXT
public:
SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent,
- const wxString& aName = wxEmptyString );
+ const wxString& aName = wxEmptyString, int aMarkupFlags = 0 );
// Do not create a copy constructor. The one generated by the compiler is adequate.
@@ -142,9 +142,9 @@ public:
*/
void ImportValues( const LIB_FIELD& aSource );
- int GetPenSize() const override;
+ int GetPenWidth() const override;
- void Print( wxDC* aDC, const wxPoint& aOffset ) override;
+ void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
void Move( const wxPoint& aMoveVector ) override
{
diff --git a/eeschema/sch_item.h b/eeschema/sch_item.h
index 2ef471247d..6ce242f02c 100644
--- a/eeschema/sch_item.h
+++ b/eeschema/sch_item.h
@@ -32,6 +32,7 @@
#include
#include
#include
+#include
class SCH_CONNECTION;
class SCH_SHEET_PATH;
@@ -42,6 +43,8 @@ class PLOTTER;
class NETLIST_OBJECT;
class NETLIST_OBJECT_LIST;
+using KIGFX::RENDER_SETTINGS;
+
enum FIELDS_AUTOPLACED
{
@@ -240,16 +243,14 @@ public:
* Function GetPenSize virtual pure
* @return the size of the "pen" that be used to draw or plot this item
*/
- virtual int GetPenSize() const { return 0; }
+ virtual int GetPenWidth() const { return 0; }
/**
* Function Print
* Print a schematic item. Each schematic item should have its own method
- * @param aDC Device Context (can be null)
- * @param aOffset drawing Offset (usually wxPoint(0,0),
- * but can be different when moving an object)
+ * @param aOffset drawing offset (usually {0,0} but can be different when moving an object)
*/
- virtual void Print( wxDC* aDC, const wxPoint& aOffset ) = 0;
+ virtual void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) = 0;
/**
* Function Move
diff --git a/eeschema/sch_junction.cpp b/eeschema/sch_junction.cpp
index 74c9b5a507..1d696d6692 100644
--- a/eeschema/sch_junction.cpp
+++ b/eeschema/sch_junction.cpp
@@ -87,18 +87,20 @@ const EDA_RECT SCH_JUNCTION::GetBoundingBox() const
EDA_RECT rect;
rect.SetOrigin( m_pos );
- rect.Inflate( ( GetPenSize() + GetSymbolSize() ) / 2 );
+ rect.Inflate( ( GetPenWidth() + GetSymbolSize() ) / 2 );
return rect;
}
-void SCH_JUNCTION::Print( wxDC* aDC, const wxPoint& aOffset )
+void SCH_JUNCTION::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
- auto conn = Connection( *g_CurrentSheet );
- COLOR4D color = GetLayerColor( ( conn && conn->IsBus() ) ? LAYER_BUS : m_Layer );
+ wxDC* DC = aSettings->GetPrintDC();
+ SCH_CONNECTION* conn = Connection( *g_CurrentSheet );
+ bool isBus = conn && conn->IsBus();
+ COLOR4D color = aSettings->GetLayerColor( isBus ? LAYER_BUS : m_Layer );
- GRFilledCircle( nullptr, aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, GetSymbolSize() / 2,
+ GRFilledCircle( nullptr, DC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, GetSymbolSize() / 2,
0, color, color );
}
@@ -194,7 +196,7 @@ bool SCH_JUNCTION::doIsConnected( const wxPoint& aPosition ) const
void SCH_JUNCTION::Plot( PLOTTER* aPlotter )
{
- aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( GetLayer() ) );
+ aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( GetLayer() ) );
aPlotter->Circle( m_pos, GetSymbolSize(), FILLED_SHAPE );
}
diff --git a/eeschema/sch_junction.h b/eeschema/sch_junction.h
index fcaafbc704..e449ea0eb2 100644
--- a/eeschema/sch_junction.h
+++ b/eeschema/sch_junction.h
@@ -61,7 +61,7 @@ public:
const EDA_RECT GetBoundingBox() const override;
- void Print( wxDC* aDC, const wxPoint& aOffset ) override;
+ void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
void Move( const wxPoint& aMoveVector ) override
{
diff --git a/eeschema/sch_legacy_plugin.cpp b/eeschema/sch_legacy_plugin.cpp
index 0e5604eeb7..efb495dfc1 100644
--- a/eeschema/sch_legacy_plugin.cpp
+++ b/eeschema/sch_legacy_plugin.cpp
@@ -1449,7 +1449,7 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( LINE_READER& aReader )
}
text->SetBold( penWidth != 0 );
- text->SetTextPenWidth( penWidth != 0 ? GetPenSizeForBold( size ) : 0 );
+ text->SetTextThickness( penWidth != 0 ? GetPenSizeForBold( size ) : 0 );
// Read the text string for the text.
char* tmp = aReader.ReadLine();
@@ -2283,7 +2283,7 @@ void SCH_LEGACY_PLUGIN::saveLine( SCH_LINE* aLine )
// Write line style (width, type, color) only for non default values
if( aLine->IsGraphicLine() )
{
- if( aLine->GetPenSize() != 0 )
+ if( aLine->GetLineSize() != 0 )
m_out->Print( 0, " %s %d", T_WIDTH, Iu2Mils( aLine->GetLineSize() ) );
if( aLine->GetLineStyle() != aLine->GetDefaultStyle() )
@@ -2358,7 +2358,7 @@ void SCH_LEGACY_PLUGIN::saveText( SCH_TEXT* aText )
Iu2Mils( aText->GetPosition().x ), Iu2Mils( aText->GetPosition().y ),
spinStyle,
Iu2Mils( aText->GetTextWidth() ),
- italics, Iu2Mils( aText->GetTextPenWidth() ), TO_UTF8( text ) );
+ italics, Iu2Mils( aText->GetTextThickness() ), TO_UTF8( text ) );
}
else if( layer == LAYER_GLOBLABEL || layer == LAYER_HIERLABEL )
{
@@ -2373,7 +2373,7 @@ void SCH_LEGACY_PLUGIN::saveText( SCH_TEXT* aText )
Iu2Mils( aText->GetTextWidth() ),
shapeLabelIt->second,
italics,
- Iu2Mils( aText->GetTextPenWidth() ), TO_UTF8( text ) );
+ Iu2Mils( aText->GetTextThickness() ), TO_UTF8( text ) );
}
}
diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp
index 19c53462fc..75477b2f76 100644
--- a/eeschema/sch_line.cpp
+++ b/eeschema/sch_line.cpp
@@ -40,7 +40,6 @@
#include
#include
#include
-#include // For some default values
static wxPenStyle getwxPenStyle( PLOT_DASH_TYPE aType )
@@ -290,35 +289,24 @@ void SCH_LINE::SetLineWidth( const int aSize )
}
-int SCH_LINE::GetPenSize() const
+int SCH_LINE::GetPenWidth() const
{
- if( m_size )
- return m_size;
-
-#if 1
- // Temporary code not using RENDER_SETTINGS
- int thickness = DEFAULT_LINE_THICKNESS * IU_PER_MILS;
-
- if( GetLayer() == LAYER_BUS )
- thickness = DEFAULT_BUS_THICKNESS * IU_PER_MILS;
- else if( GetLayer() == LAYER_WIRE )
- thickness = DEFAULT_WIRE_THICKNESS * IU_PER_MILS;
-
- return thickness;
-#else
- // JEY TODO: requires RENDER_SETTINGS
-#endif
+ return std::max( m_size, 1 );
}
-void SCH_LINE::Print( wxDC* DC, const wxPoint& offset )
+void SCH_LINE::Print( RENDER_SETTINGS* aSettings, const wxPoint& offset )
{
- COLOR4D color = ( m_color != COLOR4D::UNSPECIFIED ) ? m_color : GetLayerColor( m_Layer );
- int width = GetPenSize();
+ wxDC* DC = aSettings->GetPrintDC();
+ COLOR4D color = m_color;
wxPoint start = m_start;
wxPoint end = m_end;
+ int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
- GRLine( nullptr, DC, start.x, start.y, end.x, end.y, width, color,
+ if( color == COLOR4D::UNSPECIFIED )
+ color = aSettings->GetLayerColor( m_Layer );
+
+ GRLine( nullptr, DC, start.x, start.y, end.x, end.y, penWidth, color,
getwxPenStyle( (PLOT_DASH_TYPE) GetLineStyle() ) );
}
@@ -705,7 +693,7 @@ bool SCH_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
// Insure minimum accuracy
if( aAccuracy == 0 )
- aAccuracy = ( GetPenSize() / 2 ) + 4;
+ aAccuracy = ( GetPenWidth() / 2 ) + 4;
return TestSegmentHit( aPosition, m_start, m_end, aAccuracy );
}
@@ -758,10 +746,11 @@ void SCH_LINE::Plot( PLOTTER* aPlotter )
if( m_color != COLOR4D::UNSPECIFIED )
aPlotter->SetColor( m_color );
else
- aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( GetLayer() ) );
+ aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( GetLayer() ) );
- aPlotter->SetCurrentLineWidth( GetPenSize() );
+ int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
+ aPlotter->SetCurrentLineWidth( penWidth );
aPlotter->SetDash( GetLineStyle() );
aPlotter->MoveTo( m_start );
diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h
index f4ea16c506..184ae1fc4f 100644
--- a/eeschema/sch_line.h
+++ b/eeschema/sch_line.h
@@ -143,9 +143,9 @@ public:
*/
double GetLength() const;
- void Print( wxDC* aDC, const wxPoint& aOffset ) override;
+ void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
- int GetPenSize() const override;
+ int GetPenWidth() const override;
void Move( const wxPoint& aMoveVector ) override;
void MoveStart( const wxPoint& aMoveVector );
diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp
index f816c40d4d..1e58bcbf8f 100644
--- a/eeschema/sch_marker.cpp
+++ b/eeschema/sch_marker.cpp
@@ -105,9 +105,9 @@ KIGFX::COLOR4D SCH_MARKER::getColor() const
}
-void SCH_MARKER::Print( wxDC* aDC, const wxPoint& aOffset )
+void SCH_MARKER::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
- PrintMarker( aDC, aOffset );
+ PrintMarker( aSettings, aOffset );
}
diff --git a/eeschema/sch_marker.h b/eeschema/sch_marker.h
index 0f2fc46ad5..911618b3b4 100644
--- a/eeschema/sch_marker.h
+++ b/eeschema/sch_marker.h
@@ -54,7 +54,7 @@ public:
SCH_LAYER_ID GetColorLayer() const;
- void Print( wxDC* aDC, const wxPoint& aOffset ) override;
+ void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
void Plot( PLOTTER* aPlotter ) override
{
diff --git a/eeschema/sch_no_connect.cpp b/eeschema/sch_no_connect.cpp
index 2d24909788..2fff2e9ae5 100644
--- a/eeschema/sch_no_connect.cpp
+++ b/eeschema/sch_no_connect.cpp
@@ -70,7 +70,7 @@ void SCH_NO_CONNECT::SwapData( SCH_ITEM* aItem )
const EDA_RECT SCH_NO_CONNECT::GetBoundingBox() const
{
- int delta = ( GetPenSize() + GetSize() ) / 2;
+ int delta = ( GetPenWidth() + GetSize() ) / 2;
EDA_RECT box;
box.SetOrigin( m_pos );
@@ -95,29 +95,23 @@ void SCH_NO_CONNECT::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList )
}
-int SCH_NO_CONNECT::GetPenSize() const
+int SCH_NO_CONNECT::GetPenWidth() const
{
-#if 1
- // Temporary code not using RENDER_SETTINGS
- int thickness = DEFAULT_LINE_THICKNESS * IU_PER_MILS;
- return thickness;
-#else
- // JEY TODO: requires RENDER_SETTINGS
-#endif
+ return 1;
}
-void SCH_NO_CONNECT::Print( wxDC* aDC, const wxPoint& aOffset )
+void SCH_NO_CONNECT::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
- int half = GetSize() / 2;
- int width = GetPenSize();
- int pX = m_pos.x + aOffset.x;
- int pY = m_pos.y + aOffset.y;
+ wxDC* DC = aSettings->GetPrintDC();
+ int half = GetSize() / 2;
+ int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
+ int pX = m_pos.x + aOffset.x;
+ int pY = m_pos.y + aOffset.y;
+ COLOR4D color = aSettings->GetLayerColor( LAYER_NOCONNECT );
- COLOR4D color = GetLayerColor( LAYER_NOCONNECT );
-
- GRLine( nullptr, aDC, pX - half, pY - half, pX + half, pY + half, width, color );
- GRLine( nullptr, aDC, pX + half, pY - half, pX - half, pY + half, width, color );
+ GRLine( nullptr, DC, pX - half, pY - half, pX + half, pY + half, penWidth, color );
+ GRLine( nullptr, DC, pX + half, pY - half, pX - half, pY + half, penWidth, color );
}
@@ -167,7 +161,7 @@ bool SCH_NO_CONNECT::doIsConnected( const wxPoint& aPosition ) const
bool SCH_NO_CONNECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
- int delta = ( GetPenSize() + GetSize() ) / 2 + aAccuracy;
+ int delta = ( GetPenWidth() + GetSize() ) / 2 + aAccuracy;
wxPoint dist = aPosition - m_pos;
@@ -194,13 +188,12 @@ bool SCH_NO_CONNECT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccur
void SCH_NO_CONNECT::Plot( PLOTTER* aPlotter )
{
int delta = GetSize() / 2;
- int pX, pY;
+ int pX = m_pos.x;
+ int pY = m_pos.y;
+ int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
- pX = m_pos.x;
- pY = m_pos.y;
-
- aPlotter->SetCurrentLineWidth( GetPenSize() );
- aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_NOCONNECT ) );
+ aPlotter->SetCurrentLineWidth( penWidth );
+ aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_NOCONNECT ) );
aPlotter->MoveTo( wxPoint( pX - delta, pY - delta ) );
aPlotter->FinishTo( wxPoint( pX + delta, pY + delta ) );
aPlotter->MoveTo( wxPoint( pX + delta, pY - delta ) );
diff --git a/eeschema/sch_no_connect.h b/eeschema/sch_no_connect.h
index 8261464094..fe2d510975 100644
--- a/eeschema/sch_no_connect.h
+++ b/eeschema/sch_no_connect.h
@@ -63,13 +63,13 @@ public:
return m_size;
}
- int GetPenSize() const override;
+ int GetPenWidth() const override;
void SwapData( SCH_ITEM* aItem ) override;
void ViewGetLayers( int aLayers[], int& aCount ) const override;
- void Print( wxDC* aDC, const wxPoint& aOffset ) override;
+ void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp
index aca97cd67e..7321259faa 100644
--- a/eeschema/sch_painter.cpp
+++ b/eeschema/sch_painter.cpp
@@ -61,7 +61,6 @@
#include
#include
#include
-
#include "sch_painter.h"
namespace KIGFX
@@ -76,12 +75,9 @@ SCH_RENDER_SETTINGS::SCH_RENDER_SETTINGS() :
m_ShowDisabled( false ),
m_ShowUmbilicals( true ),
m_OverrideItemColors( false ),
- m_DefaultLineWidth( DEFAULT_LINE_THICKNESS * IU_PER_MILS ),
m_DefaultWireThickness( DEFAULT_WIRE_THICKNESS * IU_PER_MILS ),
m_DefaultBusThickness( DEFAULT_BUS_THICKNESS * IU_PER_MILS )
-{
- m_defaultPenWidth = m_DefaultLineWidth;
-}
+{ }
void SCH_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings )
@@ -178,7 +174,7 @@ bool SCH_PAINTER::Draw( const VIEW_ITEM *aItem, int aLayer )
m_gal->SetStrokeColor( COLOR4D( LIGHTRED ) );
m_gal->SetLineWidth( Mils2ui( 2 ) );
m_gal->SetGlyphSize( VECTOR2D( Mils2ui( 20 ), Mils2ui( 20 ) ) );
- m_gal->StrokeText( conn->Name( true ), pos, 0.0 );
+ m_gal->StrokeText( conn->Name( true ), pos, 0.0, 0 );
}
#endif
@@ -299,10 +295,7 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDr
float SCH_PAINTER::getLineWidth( const LIB_ITEM* aItem, bool aDrawingShadows )
{
- float width = (float) aItem->GetPenSize();
-
- if( width == 0 )
- width = (float) m_schSettings.m_DefaultLineWidth;
+ float width = (float) std::max( aItem->GetPenWidth(), m_schSettings.GetDefaultPenWidth() );
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
@@ -313,17 +306,14 @@ float SCH_PAINTER::getLineWidth( const LIB_ITEM* aItem, bool aDrawingShadows )
float SCH_PAINTER::getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows )
{
- float width = (float) aItem->GetPenSize();
+ float width;
- if( width == 0 )
- {
- if( aItem->GetLayer() == LAYER_WIRE )
- width = (float) m_schSettings.m_DefaultWireThickness;
- else if( aItem->GetLayer() == LAYER_BUS )
- width = (float) m_schSettings.m_DefaultBusThickness;
- else
- width = (float) m_schSettings.m_DefaultLineWidth;
- }
+ if( aItem->GetLayer() == LAYER_WIRE )
+ width = (float) m_schSettings.m_DefaultWireThickness;
+ else if( aItem->GetLayer() == LAYER_BUS )
+ width = (float) m_schSettings.m_DefaultBusThickness;
+ else
+ width = (float) std::max( aItem->GetPenWidth(), m_schSettings.GetDefaultPenWidth() );
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
@@ -334,7 +324,8 @@ float SCH_PAINTER::getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows )
float SCH_PAINTER::getTextThickness( const SCH_TEXT* aItem, bool aDrawingShadows )
{
- float width = (float) aItem->GetEffectiveTextPenWidth( &m_schSettings );
+ float width = (float) std::max( aItem->GetEffectiveTextPenWidth(),
+ m_schSettings.GetDefaultPenWidth() );
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
@@ -345,7 +336,8 @@ float SCH_PAINTER::getTextThickness( const SCH_TEXT* aItem, bool aDrawingShadows
float SCH_PAINTER::getTextThickness( const SCH_FIELD* aItem, bool aDrawingShadows )
{
- float width = (float) aItem->GetEffectiveTextPenWidth( &m_schSettings );
+ float width = (float) std::max( aItem->GetEffectiveTextPenWidth(),
+ m_schSettings.GetDefaultPenWidth() );
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
@@ -356,7 +348,8 @@ float SCH_PAINTER::getTextThickness( const SCH_FIELD* aItem, bool aDrawingShadow
float SCH_PAINTER::getTextThickness( const LIB_FIELD* aItem, bool aDrawingShadows )
{
- float width = (float) aItem->GetEffectiveTextPenWidth( &m_schSettings );
+ float width = (float) std::max( aItem->GetEffectiveTextPenWidth(),
+ m_schSettings.GetDefaultPenWidth() );
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
@@ -367,7 +360,8 @@ float SCH_PAINTER::getTextThickness( const LIB_FIELD* aItem, bool aDrawingShadow
float SCH_PAINTER::getTextThickness( const LIB_TEXT* aItem, bool aDrawingShadows )
{
- float width = (float) aItem->GetEffectiveTextPenWidth( &m_schSettings );
+ float width = (float) std::max( aItem->GetEffectiveTextPenWidth(),
+ m_schSettings.GetDefaultPenWidth() );
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
@@ -376,9 +370,10 @@ float SCH_PAINTER::getTextThickness( const LIB_TEXT* aItem, bool aDrawingShadows
}
-void SCH_PAINTER::strokeText( const wxString& aText, const VECTOR2D& aPosition, double aAngle )
+void SCH_PAINTER::strokeText( const wxString& aText, const VECTOR2D& aPosition, double aAngle,
+ int aTextMarkupFlags )
{
- m_gal->StrokeText( aText, aPosition, aAngle, GetTextMarkupFlags() );
+ m_gal->StrokeText( aText, aPosition, aAngle, aTextMarkupFlags );
}
@@ -637,7 +632,7 @@ void SCH_PAINTER::draw( LIB_FIELD *aField, int aLayer )
double orient = aField->GetTextAngleRadians();
- strokeText( aField->GetText(), pos, orient );
+ strokeText( aField->GetText(), pos, orient, aField->GetTextMarkupFlags() );
}
// Draw the umbilical line
@@ -684,7 +679,7 @@ void SCH_PAINTER::draw( LIB_TEXT *aText, int aLayer )
m_gal->SetGlyphSize( VECTOR2D( aText->GetTextSize() ) );
m_gal->SetFontBold( aText->IsBold() );
m_gal->SetFontItalic( aText->IsItalic() );
- strokeText( aText->GetText(), pos, orient );
+ strokeText( aText->GetText(), pos, orient, aText->GetTextMarkupFlags() );
}
@@ -719,6 +714,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
return;
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
+ int flags = aPin->GetTextMarkupFlags();
if( drawingShadows && !aPin->IsSelected() )
return;
@@ -966,7 +962,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
int insideOffset = textOffset;
int outsideOffset = 10;
- float lineThickness = (float) m_schSettings.m_DefaultLineWidth;
+ float lineThickness = (float) m_schSettings.GetDefaultPenWidth();
float aboveOffset = Mils2iu( PIN_TEXT_MARGIN ) + ( thickness[ABOVE] + lineThickness ) / 2.0;
float belowOffset = Mils2iu( PIN_TEXT_MARGIN ) + ( thickness[BELOW] + lineThickness ) / 2.0;
@@ -992,28 +988,28 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
SET_DC( INSIDE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
- strokeText( text[INSIDE], pos + VECTOR2D( -insideOffset - len, 0 ), 0 );
+ strokeText( text[INSIDE], pos + VECTOR2D( -insideOffset - len, 0 ), 0, flags );
}
if( size[OUTSIDE] )
{
SET_DC( OUTSIDE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
- strokeText( text[OUTSIDE], pos + VECTOR2D( outsideOffset, 0 ), 0 );
+ strokeText( text[OUTSIDE], pos + VECTOR2D( outsideOffset, 0 ), 0, flags );
}
if( size[ABOVE] )
{
SET_DC( ABOVE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
- strokeText( text[ABOVE], pos + VECTOR2D( -len / 2.0, -aboveOffset ), 0 );
+ strokeText( text[ABOVE], pos + VECTOR2D( -len / 2.0, -aboveOffset ), 0, flags );
}
if( size[BELOW] )
{
SET_DC( BELOW );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
- strokeText( text[BELOW], pos + VECTOR2D( -len / 2.0, belowOffset ), 0 );
+ strokeText( text[BELOW], pos + VECTOR2D( -len / 2.0, belowOffset ), 0, flags );
}
break;
@@ -1024,28 +1020,28 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
- strokeText( text[INSIDE], pos + VECTOR2D( insideOffset + len, 0 ), 0 );
+ strokeText( text[INSIDE], pos + VECTOR2D( insideOffset + len, 0 ), 0, flags );
}
if( size[OUTSIDE] )
{
SET_DC( OUTSIDE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
- strokeText( text[OUTSIDE], pos + VECTOR2D( -outsideOffset, 0 ), 0 );
+ strokeText( text[OUTSIDE], pos + VECTOR2D( -outsideOffset, 0 ), 0, flags );
}
if( size[ABOVE] )
{
SET_DC( ABOVE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
- strokeText( text[ABOVE], pos + VECTOR2D( len / 2.0, -aboveOffset ), 0 );
+ strokeText( text[ABOVE], pos + VECTOR2D( len / 2.0, -aboveOffset ), 0, flags );
}
if( size[BELOW] )
{
SET_DC( BELOW );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
- strokeText( text[BELOW], pos + VECTOR2D( len / 2.0, belowOffset ), 0 );
+ strokeText( text[BELOW], pos + VECTOR2D( len / 2.0, belowOffset ), 0, flags );
}
break;
@@ -1055,28 +1051,28 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
SET_DC( INSIDE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
- strokeText( text[INSIDE], pos + VECTOR2D( 0, insideOffset + len ), M_PI / 2 );
+ strokeText( text[INSIDE], pos + VECTOR2D( 0, insideOffset + len ), M_PI / 2, flags );
}
if( size[OUTSIDE] )
{
SET_DC( OUTSIDE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
- strokeText( text[OUTSIDE], pos + VECTOR2D( 0, -outsideOffset ), M_PI / 2 );
+ strokeText( text[OUTSIDE], pos + VECTOR2D( 0, -outsideOffset ), M_PI / 2, flags );
}
if( size[ABOVE] )
{
SET_DC( ABOVE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
- strokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, len / 2.0 ), M_PI / 2 );
+ strokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, len / 2.0 ), M_PI / 2, flags );
}
if( size[BELOW] )
{
SET_DC( BELOW );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
- strokeText( text[BELOW], pos + VECTOR2D( belowOffset, len / 2.0 ), M_PI / 2 );
+ strokeText( text[BELOW], pos + VECTOR2D( belowOffset, len / 2.0 ), M_PI / 2, flags );
}
break;
@@ -1086,28 +1082,28 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
SET_DC( INSIDE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
- strokeText( text[INSIDE], pos + VECTOR2D( 0, -insideOffset - len ), M_PI / 2 );
+ strokeText( text[INSIDE], pos + VECTOR2D( 0, -insideOffset - len ), M_PI / 2, flags );
}
if( size[OUTSIDE] )
{
SET_DC( OUTSIDE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
- strokeText( text[OUTSIDE], pos + VECTOR2D( 0, outsideOffset ), M_PI / 2 );
+ strokeText( text[OUTSIDE], pos + VECTOR2D( 0, outsideOffset ), M_PI / 2, flags );
}
if( size[ABOVE] )
{
SET_DC( ABOVE );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
- strokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, -len / 2.0 ), M_PI / 2 );
+ strokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, -len / 2.0 ), M_PI / 2, flags );
}
if( size[BELOW] )
{
SET_DC( BELOW );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
- strokeText( text[BELOW], pos + VECTOR2D( belowOffset, -len / 2.0 ), M_PI / 2 );
+ strokeText( text[BELOW], pos + VECTOR2D( belowOffset, -len / 2.0 ), M_PI / 2, flags );
}
break;
@@ -1283,7 +1279,7 @@ void SCH_PAINTER::draw( SCH_TEXT *aText, int aLayer )
m_gal->SetStrokeColor( color );
m_gal->SetTextAttributes( aText );
- VECTOR2D text_offset = aText->GetTextPos() + aText->GetSchematicTextOffset();
+ VECTOR2D text_offset = aText->GetTextPos() + aText->GetSchematicTextOffset( &m_schSettings );
wxString shownText( aText->GetShownText() );
if( drawingShadows )
@@ -1319,7 +1315,10 @@ void SCH_PAINTER::draw( SCH_TEXT *aText, int aLayer )
}
if( !shownText.IsEmpty() )
- strokeText( shownText, text_offset, aText->GetTextAngleRadians() );
+ {
+ strokeText( shownText, text_offset, aText->GetTextAngleRadians(),
+ aText->GetTextMarkupFlags() );
+ }
if( aText->IsDangling() )
drawDanglingSymbol( aText->GetTextPos(), drawingShadows );
@@ -1406,6 +1405,7 @@ void SCH_PAINTER::draw( SCH_COMPONENT *aComp, int aLayer )
tempPin->ClearFlags();
tempPin->SetFlags( compPin->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
+ tempPin->SetTextMarkupFlags( compPin->GetTextMarkupFlags() );
if( compPin->IsDangling() )
tempPin->SetFlags( IS_DANGLING );
@@ -1499,7 +1499,8 @@ void SCH_PAINTER::draw( SCH_FIELD *aField, int aLayer )
m_gal->SetTextMirrored( aField->IsMirrored() );
m_gal->SetLineWidth( getTextThickness( aField, drawingShadows ) );
- strokeText( aField->GetShownText(), textpos, orient == TEXT_ANGLE_VERT ? M_PI / 2 : 0 );
+ strokeText( aField->GetShownText(), textpos, orient == TEXT_ANGLE_VERT ? M_PI / 2 : 0,
+ aField->GetTextMarkupFlags() );
}
// Draw the umbilical line
@@ -1599,7 +1600,7 @@ void SCH_PAINTER::draw( SCH_SHEET *aSheet, int aLayer )
break;
}
- int width = aSheet->GetPenSize();
+ int width = std::max( aSheet->GetPenWidth(), m_schSettings.GetDefaultPenWidth() );
wxPoint initial_pos = sheetPin->GetTextPos();
wxPoint offset_pos = initial_pos;
@@ -1663,7 +1664,7 @@ void SCH_PAINTER::draw( SCH_NO_CONNECT *aNC, int aLayer )
m_gal->SetIsFill( false );
VECTOR2D p = aNC->GetPosition();
- int delta = std::max( aNC->GetSize(), m_schSettings.m_DefaultLineWidth * 3 ) / 2;
+ int delta = std::max( aNC->GetSize(), m_schSettings.GetDefaultPenWidth() * 3 ) / 2;
m_gal->DrawLine( p + VECTOR2D( -delta, -delta ), p + VECTOR2D( delta, delta ) );
m_gal->DrawLine( p + VECTOR2D( -delta, delta ), p + VECTOR2D( delta, -delta ) );
diff --git a/eeschema/sch_painter.h b/eeschema/sch_painter.h
index 9409d62d59..f58ec1c046 100644
--- a/eeschema/sch_painter.h
+++ b/eeschema/sch_painter.h
@@ -99,26 +99,22 @@ public:
const COLOR4D& GetCursorColor() override { return m_layerColors[ LAYER_SCHEMATIC_CURSOR ]; }
- int GetDefaultTextThickness() const override
- {
- return m_DefaultLineWidth;
- }
+ int m_ShowUnit; // Show all units if 0
+ int m_ShowConvert; // Show all conversions if 0
+ bool m_ShowHiddenText;
+ bool m_ShowHiddenPins;
+ bool m_ShowPinsElectricalType;
+ bool m_ShowDisabled;
+ bool m_ShowUmbilicals;
- int m_ShowUnit; // Show all units if 0
- int m_ShowConvert; // Show all conversions if 0
+ bool m_OverrideItemColors;
- bool m_ShowHiddenText;
- bool m_ShowHiddenPins;
- bool m_ShowPinsElectricalType;
- bool m_ShowDisabled;
- bool m_ShowUmbilicals;
+ double m_TextOffsetRatio; // Proportion of font size to offset text above/below
+ // wires, buses, etc.
- bool m_OverrideItemColors;
-
- int m_DefaultLineWidth;
- int m_DefaultWireThickness;
- int m_DefaultBusThickness;
+ int m_DefaultWireThickness;
+ int m_DefaultBusThickness;
};
@@ -187,7 +183,8 @@ private:
void fillIfSelection( int aLayer );
void triLine ( const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c );
- void strokeText( const wxString& aText, const VECTOR2D& aPosition, double aRotationAngle );
+ void strokeText( const wxString& aText, const VECTOR2D& aPosition, double aRotationAngle,
+ int aTextMarkupFlags );
SCH_RENDER_SETTINGS m_schSettings;
};
diff --git a/eeschema/sch_pin.h b/eeschema/sch_pin.h
index d416c0d703..de236d9206 100644
--- a/eeschema/sch_pin.h
+++ b/eeschema/sch_pin.h
@@ -39,6 +39,10 @@ class SCH_PIN : public SCH_ITEM
wxPoint m_position;
bool m_isDangling;
+ int m_textMarkupFlags; // Set of TEXT_MARKUP_FLAGS indicating which markup
+ // features are to be processed within the pin name
+ // and number.
+
/// The name that this pin connection will drive onto a net
std::mutex m_netmap_mutex;
std::map m_net_name_map;
@@ -70,7 +74,7 @@ public:
void GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) override;
wxString GetDescription( const SCH_SHEET_PATH* aSheet );
- void Print( wxDC* aDC, const wxPoint& aOffset ) override {}
+ void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override {}
void Move( const wxPoint& aMoveVector ) override {}
@@ -85,6 +89,9 @@ public:
const EDA_RECT GetBoundingBox() const override;
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
+ int GetTextMarkupFlags() const { return m_textMarkupFlags; }
+ void SetTextMarkupFlags( int aFlags ) { m_textMarkupFlags = aFlags; }
+
bool IsDangling() const override { return m_isDangling; }
void SetIsDangling( bool isDangling ) { m_isDangling = isDangling; }
diff --git a/eeschema/sch_preview_panel.cpp b/eeschema/sch_preview_panel.cpp
index 7a7eb197e4..6f358b669f 100644
--- a/eeschema/sch_preview_panel.cpp
+++ b/eeschema/sch_preview_panel.cpp
@@ -67,7 +67,7 @@ SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL( wxWindow* aParentWindow, wxWindowID aWindo
// on updated viewport data.
m_viewControls = new KIGFX::WX_VIEW_CONTROLS( m_view, this );
- m_gal->SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
+ m_gal->SetGridColor( m_painter->GetSettings()->GetLayerColor( LAYER_SCHEMATIC_GRID ) );
m_gal->SetCursorEnabled( false );
m_gal->SetGridSize( VECTOR2D( Mils2iu( 50.0 ), Mils2iu( 50.0 ) ) );
diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp
index b8247ee115..65fdf838d2 100644
--- a/eeschema/sch_screen.cpp
+++ b/eeschema/sch_screen.cpp
@@ -31,9 +31,7 @@
#include
#include
-#include
#include
-#include
#include
#include
#include
@@ -48,15 +46,11 @@
#include
#include
#include
-#include
#include
-#include
#include
#include
#include
#include
-#include
-#include
#include
#include
#include
@@ -65,7 +59,6 @@
#include
#include
#include
-#include
// TODO(JE) Debugging only
#include
@@ -499,10 +492,10 @@ void SCH_SCREEN::UpdateSymbolLinks( bool aForce )
SYMBOL_LIB_TABLE* libs = Prj().SchSymbolLibTable();
int mod_hash = libs->GetModifyHash();
- for( auto aItem : Items().OfType( SCH_COMPONENT_T ) )
+ for( SCH_ITEM* aItem : Items().OfType( SCH_COMPONENT_T ) )
cmps.push_back( static_cast( aItem ) );
- for( auto cmp : cmps )
+ for( SCH_COMPONENT* cmp : cmps )
Remove( cmp );
// Must we resolve?
@@ -516,19 +509,56 @@ void SCH_SCREEN::UpdateSymbolLinks( bool aForce )
// even if the libraries don't change.
else
{
- for( auto cmp : cmps )
+ for( SCH_COMPONENT* cmp : cmps )
cmp->UpdatePins();
}
// Changing the symbol may adjust the bbox of the symbol. This re-inserts the
// item with the new bbox
- for( auto cmp : cmps )
+ for( SCH_COMPONENT* cmp : cmps )
Append( cmp );
}
}
-void SCH_SCREEN::Print( wxDC* aDC )
+void SCH_SCREEN::UpdateTextMarkupFlags( int aMarkupFlags )
+{
+ for( SCH_ITEM* aItem : Items() )
+ {
+ switch( aItem->Type() )
+ {
+ case SCH_TEXT_T:
+ case SCH_LABEL_T:
+ case SCH_HIER_LABEL_T:
+ case SCH_GLOBAL_LABEL_T:
+ case SCH_SHEET_PIN_T:
+ static_cast( aItem )->SetTextMarkupFlags( aMarkupFlags );
+ break;
+
+ case SCH_COMPONENT_T:
+ for( SCH_FIELD& field : static_cast( aItem )->GetFields() )
+ field.SetTextMarkupFlags( aMarkupFlags );
+
+ break;
+
+ case SCH_PIN_T:
+ static_cast( aItem )->SetTextMarkupFlags( aMarkupFlags );
+ break;
+
+ case SCH_SHEET_T:
+ for( SCH_FIELD& field : static_cast( aItem )->GetFields() )
+ field.SetTextMarkupFlags( aMarkupFlags );
+
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+
+void SCH_SCREEN::Print( RENDER_SETTINGS* aSettings )
{
// Ensure links are up to date, even if a library was reloaded for some reason:
std::vector< SCH_ITEM* > junctions;
@@ -552,21 +582,23 @@ void SCH_SCREEN::Print( wxDC* aDC )
}
/// Sort to ensure plot-order consistency with screen drawing
- std::sort( other.begin(), other.end(), []( const SCH_ITEM* a, const SCH_ITEM* b ) {
- if( a->Type() == b->Type() )
- return a->GetLayer() > b->GetLayer();
+ std::sort( other.begin(), other.end(),
+ []( const SCH_ITEM* a, const SCH_ITEM* b )
+ {
+ if( a->Type() == b->Type() )
+ return a->GetLayer() > b->GetLayer();
- return a->Type() > b->Type();
- } );
+ return a->Type() > b->Type();
+ } );
for( auto item : bitmaps )
- item->Print( aDC, wxPoint( 0, 0 ) );
+ item->Print( aSettings, wxPoint( 0, 0 ) );
for( auto item : other )
- item->Print( aDC, wxPoint( 0, 0 ) );
+ item->Print( aSettings, wxPoint( 0, 0 ) );
for( auto item : junctions )
- item->Print( aDC, wxPoint( 0, 0 ) );
+ item->Print( aSettings, wxPoint( 0, 0 ) );
}
@@ -601,24 +633,26 @@ void SCH_SCREEN::Plot( PLOTTER* aPlotter )
return a->Type() > b->Type();
} );
+ int defaultPenWidth = aPlotter->RenderSettings()->GetDefaultPenWidth();
+
// Bitmaps are drawn first to ensure they are in the background
// This is particularly important for the wxPostscriptDC (used in *nix printers) as
// the bitmap PS command clears the screen
for( auto item : bitmaps )
{
- aPlotter->SetCurrentLineWidth( item->GetPenSize() );
+ aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
item->Plot( aPlotter );
}
for( auto item : other )
{
- aPlotter->SetCurrentLineWidth( item->GetPenSize() );
+ aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
item->Plot( aPlotter );
}
for( auto item : junctions )
{
- aPlotter->SetCurrentLineWidth( item->GetPenSize() );
+ aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
item->Plot( aPlotter );
}
}
@@ -1155,6 +1189,13 @@ void SCH_SCREENS::UpdateSymbolLinks( bool aForce )
}
+void SCH_SCREENS::UpdateTextMarkupFlags( int aMarkupFlags )
+{
+ for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
+ screen->UpdateTextMarkupFlags( aMarkupFlags );
+}
+
+
void SCH_SCREENS::TestDanglingEnds()
{
std::vector screens;
diff --git a/eeschema/sch_screen.h b/eeschema/sch_screen.h
index 56ae4f69f9..08d0a939b6 100644
--- a/eeschema/sch_screen.h
+++ b/eeschema/sch_screen.h
@@ -235,15 +235,15 @@ public:
*/
void UpdateSymbolLinks( bool aForce = false );
+ void UpdateTextMarkupFlags( int aMarkupFlags );
+
/**
* Print all the items in the screen to \a aDC.
*
* @note This function is useful only for schematic. The library editor and library viewer
* do not use a draw list and therefore draws nothing.
- *
- * @param aDC The device context to draw on.
*/
- void Print( wxDC* aDC );
+ void Print( RENDER_SETTINGS* aSettings );
/**
* Plot all the schematic objects to \a aPlotter.
@@ -556,6 +556,8 @@ public:
*/
void UpdateSymbolLinks( bool aForce = false );
+ void UpdateTextMarkupFlags( int aMarkupFlags );
+
void TestDanglingEnds();
/**
diff --git a/eeschema/sch_sexpr_parser.cpp b/eeschema/sch_sexpr_parser.cpp
index 26b18ef838..b97d93a09e 100644
--- a/eeschema/sch_sexpr_parser.cpp
+++ b/eeschema/sch_sexpr_parser.cpp
@@ -535,7 +535,7 @@ void SCH_SEXPR_PARSER::parseEDA_TEXT( EDA_TEXT* aText )
}
case T_thickness:
- aText->SetTextPenWidth( parseInternalUnits( "text thickness" ) );
+ aText->SetTextThickness( parseInternalUnits( "text thickness" ) );
NeedRIGHT();
break;
diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp
index 67602ef458..f7388ea9fa 100644
--- a/eeschema/sch_sheet.cpp
+++ b/eeschema/sch_sheet.cpp
@@ -463,9 +463,9 @@ SCH_SHEET_PIN* SCH_SHEET::GetPin( const wxPoint& aPosition )
}
-int SCH_SHEET::GetPenSize() const
+int SCH_SHEET::GetPenWidth() const
{
- return GetBorderWidth();
+ return std::max( GetBorderWidth(), 1 );
}
@@ -473,8 +473,9 @@ void SCH_SHEET::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
{
wxASSERT_MSG( !aManual, "manual autoplacement not currently supported for sheets" );
- wxSize textSize = m_fields[ SHEETNAME ].GetTextSize();
- int margin = KiROUND( GetPenSize() / 2.0 + 4 + std::max( textSize.x, textSize.y ) * 0.5 );
+ wxSize textSize = m_fields[ SHEETNAME ].GetTextSize();
+ int borderMargin = KiROUND( GetPenWidth() / 2.0 ) + 4;
+ int margin = borderMargin + KiROUND( std::max( textSize.x, textSize.y ) * 0.5 );
if( IsVerticalOrientation() )
{
@@ -492,7 +493,7 @@ void SCH_SHEET::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
}
textSize = m_fields[ SHEETFILENAME ].GetTextSize();
- margin = KiROUND( GetPenSize() / 2.0 + 4 + std::max( textSize.x, textSize.y ) * 0.4 );
+ margin = borderMargin + KiROUND( std::max( textSize.x, textSize.y ) * 0.4 );
if( IsVerticalOrientation() )
{
@@ -523,21 +524,21 @@ void SCH_SHEET::ViewGetLayers( int aLayers[], int& aCount ) const
}
-void SCH_SHEET::Print( wxDC* aDC, const wxPoint& aOffset )
+void SCH_SHEET::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
- wxString Text;
+ wxDC* DC = aSettings->GetPrintDC();
wxPoint pos = m_pos + aOffset;
- int lineWidth = GetPenSize();
+ int lineWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
COLOR4D color = GetBorderColor();
- GRRect( nullptr, aDC, pos.x, pos.y, pos.x + m_size.x, pos.y + m_size.y, lineWidth, color );
+ GRRect( nullptr, DC, pos.x, pos.y, pos.x + m_size.x, pos.y + m_size.y, lineWidth, color );
for( SCH_FIELD& field : m_fields )
- field.Print( aDC, aOffset );
+ field.Print( aSettings, aOffset );
/* Draw text : SheetLabel */
for( SCH_SHEET_PIN* sheetPin : m_pins )
- sheetPin->Print( aDC, aOffset );
+ sheetPin->Print( aSettings, aOffset );
}
@@ -545,7 +546,7 @@ const EDA_RECT SCH_SHEET::GetBodyBoundingBox() const
{
wxPoint end;
EDA_RECT box( m_pos, m_size );
- int lineWidth = GetPenSize();
+ int lineWidth = GetPenWidth();
int textLength = 0;
// Calculate bounding box X size:
@@ -937,12 +938,12 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
COLOR4D borderColor = GetBorderColor();
if( borderColor == COLOR4D::UNSPECIFIED )
- borderColor = aPlotter->ColorSettings()->GetColor( LAYER_SHEET );
+ borderColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_SHEET );
- aPlotter->SetColor( GetBorderColor() );
+ aPlotter->SetColor( borderColor );
- int thickness = GetPenSize();
- aPlotter->SetCurrentLineWidth( thickness );
+ int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
+ aPlotter->SetCurrentLineWidth( penWidth );
aPlotter->MoveTo( m_pos );
pos = m_pos;
diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h
index 2400b88de4..08c9f2f497 100644
--- a/eeschema/sch_sheet.h
+++ b/eeschema/sch_sheet.h
@@ -120,7 +120,7 @@ public:
*/
bool IsMovableFromAnchorPoint() override { return true; }
- void Print( wxDC* aDC, const wxPoint& aOffset ) override;
+ void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
/**
* Calculate the graphic shape (a polygon) associated to the text.
@@ -132,7 +132,7 @@ public:
void SwapData( SCH_ITEM* aItem ) override;
- int GetPenSize() const override;
+ int GetPenWidth() const override;
/**
* Get the sheet label number.
@@ -216,18 +216,17 @@ class SCH_SHEET : public SCH_ITEM
{
friend class SCH_SHEET_PIN;
- /// Screen that contains the physical data for the sheet. In complex hierarchies
- /// multiple sheets can share a common screen.
- SCH_SCREEN* m_screen;
- /// The list of sheet connection points.
- std::vector m_pins;
+ SCH_SCREEN* m_screen; // Screen that contains the physical data for the sheet. In
+ // complex hierarchies multiple sheets can share a common screen.
+
+ std::vector m_pins; // The list of sheet connection points.
std::vector m_fields;
- FIELDS_AUTOPLACED m_fieldsAutoplaced; // indicates status of field autoplacement
+ FIELDS_AUTOPLACED m_fieldsAutoplaced; // Indicates status of field autoplacement.
- wxPoint m_pos; // The position of the sheet.
- wxSize m_size; // The size of the sheet.
+ wxPoint m_pos; // The position of the sheet.
+ wxSize m_size; // The size of the sheet.
int m_borderWidth;
KIGFX::COLOR4D m_borderColor;
@@ -434,9 +433,9 @@ public:
*/
int GetMinHeight() const;
- int GetPenSize() const override;
+ int GetPenWidth() const override;
- void Print( wxDC* aDC, const wxPoint& aOffset ) override;
+ void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
/**
* Return a bounding box for the sheet body but not the fields.
diff --git a/eeschema/sch_sheet_pin.cpp b/eeschema/sch_sheet_pin.cpp
index 2bb89c289b..853872969e 100644
--- a/eeschema/sch_sheet_pin.cpp
+++ b/eeschema/sch_sheet_pin.cpp
@@ -35,6 +35,7 @@
#include
#include
#include
+#include
#include
@@ -65,10 +66,10 @@ EDA_ITEM* SCH_SHEET_PIN::Clone() const
}
-void SCH_SHEET_PIN::Print( wxDC* aDC, const wxPoint& aOffset )
+void SCH_SHEET_PIN::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
// The icon selection is handle by the virtual method CreateGraphicShape called by ::Print
- SCH_HIERLABEL::Print( aDC, aOffset );
+ SCH_HIERLABEL::Print( aSettings, aOffset );
}
@@ -95,9 +96,9 @@ bool SCH_SHEET_PIN::operator==( const SCH_SHEET_PIN* aPin ) const
}
-int SCH_SHEET_PIN::GetPenSize() const
+int SCH_SHEET_PIN::GetPenWidth() const
{
- return 0; // use default pen size
+ return 1;
}
@@ -252,7 +253,7 @@ void SCH_SHEET_PIN::Rotate( wxPoint aPosition )
}
-void SCH_SHEET_PIN::CreateGraphicShape( std::vector & aPoints, const wxPoint& aPos )
+void SCH_SHEET_PIN::CreateGraphicShape( std::vector& aPoints, const wxPoint& aPos )
{
/*
* These are the same icon shapes as SCH_HIERLABEL but the graphic icon is slightly
diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp
index 655315ce26..7492526ee2 100644
--- a/eeschema/sch_text.cpp
+++ b/eeschema/sch_text.cpp
@@ -46,11 +46,14 @@
#include
#include
#include
-#include // For some default values
-
+#include
+#include
#include
+using KIGFX::SCH_RENDER_SETTINGS;
+
+
extern void IncrementLabelMember( wxString& name, int aIncrement );
/* Coding polygons for global symbol graphic shapes.
@@ -93,8 +96,10 @@ static int* TemplateShape[5][4] =
};
-SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType )
- : SCH_ITEM( NULL, aType ), EDA_TEXT( text ), m_shape( PINSHEETLABEL_SHAPE::PS_INPUT )
+SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType, int aMarkupFlags ) :
+ SCH_ITEM( NULL, aType ),
+ EDA_TEXT( text, aMarkupFlags ),
+ m_shape( PINSHEETLABEL_SHAPE::PS_INPUT )
{
m_Layer = LAYER_NOTES;
m_isDangling = false;
@@ -131,24 +136,23 @@ void SCH_TEXT::IncrementLabel( int aIncrement )
}
-wxPoint SCH_TEXT::GetSchematicTextOffset() const
+wxPoint SCH_TEXT::GetSchematicTextOffset( RENDER_SETTINGS* aSettings ) const
{
wxPoint text_offset;
// add an offset to x (or y) position to aid readability of text on a wire or line
- int thick_offset = KiROUND( GetTextOffsetRatio() * GetTextSize().y );
- thick_offset += GetPenSize() / 2;
+ int dist = GetTextOffset( aSettings ) + GetPenWidth();
switch( GetLabelSpinStyle() )
{
case LABEL_SPIN_STYLE::UP:
case LABEL_SPIN_STYLE::BOTTOM:
- text_offset.x = -thick_offset;
+ text_offset.x = -dist;
break; // Vert Orientation
default:
case LABEL_SPIN_STYLE::LEFT:
case LABEL_SPIN_STYLE::RIGHT:
- text_offset.y = -thick_offset;
+ text_offset.y = -dist;
break; // Horiz Orientation
}
@@ -281,25 +285,29 @@ bool SCH_TEXT::operator<( const SCH_ITEM& aItem ) const
}
-int SCH_TEXT::GetPenSize() const
+int SCH_TEXT::GetTextOffset( RENDER_SETTINGS* aSettings ) const
{
-#if 1
- // Temporary code not using RENDER_SETTINGS
- int textThickness = DEFAULT_LINE_THICKNESS * IU_PER_MILS;
- textThickness = Clamp_Text_PenSize( textThickness, GetTextSize(), IsBold() );
- return textThickness;
-#else
- return GetEffectiveTextPenWidth( nullptr ); // JEY TODO: requires RENDER_SETTINGS
-#endif
+ SCH_RENDER_SETTINGS* renderSettings = static_cast( aSettings );
+
+ if( renderSettings )
+ return KiROUND( renderSettings->m_TextOffsetRatio * GetTextSize().y );
+
+ return 0;
}
-void SCH_TEXT::Print( wxDC* DC, const wxPoint& aOffset )
+int SCH_TEXT::GetPenWidth() const
{
- COLOR4D color = GetLayerColor( m_Layer );
- wxPoint text_offset = aOffset + GetSchematicTextOffset();
+ return GetEffectiveTextPenWidth();
+}
- EDA_TEXT::Print( DC, text_offset, color );
+
+void SCH_TEXT::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
+{
+ COLOR4D color = aSettings->GetLayerColor( m_Layer );
+ wxPoint text_offset = aOffset + GetSchematicTextOffset( aSettings );
+
+ EDA_TEXT::Print( aSettings, text_offset, color );
}
@@ -409,7 +417,7 @@ void SCH_TEXT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
const EDA_RECT SCH_TEXT::GetBoundingBox() const
{
- EDA_RECT rect = GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
+ EDA_RECT rect = GetTextBox();
if( GetTextAngle() != 0 ) // Rotate rect
{
@@ -577,8 +585,9 @@ bool SCH_TEXT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
void SCH_TEXT::Plot( PLOTTER* aPlotter )
{
static std::vector Poly;
- COLOR4D color = aPlotter->ColorSettings()->GetColor( GetLayer() );
- int penWidth = GetPenSize();
+ COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( GetLayer() );
+ int penWidth = std::max( GetEffectiveTextPenWidth(),
+ aPlotter->RenderSettings()->GetDefaultPenWidth() );
aPlotter->SetCurrentLineWidth( penWidth );
@@ -589,28 +598,29 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
wxStringSplit( GetShownText(), strings_list, '\n' );
positions.reserve( strings_list.Count() );
- GetPositionsOfLinesOfMultilineText(positions, (int) strings_list.Count() );
+ GetLinePositions( positions, (int) strings_list.Count() );
for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
{
- wxPoint textpos = positions[ii] + GetSchematicTextOffset();
+ wxPoint textpos = positions[ii] + GetSchematicTextOffset( aPlotter->RenderSettings() );
wxString& txt = strings_list.Item( ii );
aPlotter->Text( textpos, color, txt, GetTextAngle(), GetTextSize(), GetHorizJustify(),
- GetVertJustify(), penWidth, IsItalic(), IsBold() );
+ GetVertJustify(), penWidth, IsItalic(), IsBold(), m_textMarkupFlags );
}
}
else
{
- wxPoint textpos = GetTextPos() + GetSchematicTextOffset();
+ wxPoint textpos = GetTextPos() + GetSchematicTextOffset( aPlotter->RenderSettings() );
aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(),
- GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold() );
+ GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold(),
+ m_textMarkupFlags );
}
// Draw graphic symbol for global or hierarchical labels
CreateGraphicShape( Poly, GetTextPos() );
- aPlotter->SetCurrentLineWidth( GetPenSize() );
+ aPlotter->SetCurrentLineWidth( penWidth );
if( Poly.size() )
aPlotter->PlotPoly( Poly, NO_FILL );
@@ -695,8 +705,8 @@ void SCH_TEXT::Show( int nestLevel, std::ostream& os ) const
#endif
-SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text )
- : SCH_TEXT( pos, text, SCH_LABEL_T )
+SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text, int aMarkupFlags )
+ : SCH_TEXT( pos, text, SCH_LABEL_T, aMarkupFlags )
{
m_Layer = LAYER_LOCLABEL;
m_shape = PINSHEETLABEL_SHAPE::PS_INPUT;
@@ -749,7 +759,7 @@ bool SCH_LABEL::IsType( const KICAD_T aScanTypes[] ) const
const EDA_RECT SCH_LABEL::GetBoundingBox() const
{
- EDA_RECT rect = GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
+ EDA_RECT rect = GetTextBox();
if( GetTextAngle() != 0.0 )
{
@@ -782,8 +792,8 @@ BITMAP_DEF SCH_LABEL::GetMenuImage() const
}
-SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text )
- : SCH_TEXT( pos, text, SCH_GLOBAL_LABEL_T )
+SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text, int aMarkupFlags )
+ : SCH_TEXT( pos, text, SCH_GLOBAL_LABEL_T, aMarkupFlags )
{
m_Layer = LAYER_GLOBLABEL;
m_shape = PINSHEETLABEL_SHAPE::PS_BIDI;
@@ -798,25 +808,22 @@ EDA_ITEM* SCH_GLOBALLABEL::Clone() const
}
-wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset() const
+wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset( RENDER_SETTINGS* aSettings ) const
{
wxPoint text_offset;
- int width = GetPenSize();
- int halfSize = GetTextWidth() / 2;
- int offset = width;
+ int dist = GetEffectiveTextPenWidth();
switch( m_shape )
{
case PINSHEETLABEL_SHAPE::PS_INPUT:
case PINSHEETLABEL_SHAPE::PS_BIDI:
case PINSHEETLABEL_SHAPE::PS_TRISTATE:
- offset += halfSize;
+ dist += GetTextWidth() / 2;
break;
case PINSHEETLABEL_SHAPE::PS_OUTPUT:
case PINSHEETLABEL_SHAPE::PS_UNSPECIFIED:
- offset += KiROUND( GetTextOffsetRatio() * GetTextSize().y );
- ;
+ dist += GetTextOffset( aSettings );
break;
default:
@@ -826,18 +833,10 @@ wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset() const
switch( GetLabelSpinStyle() )
{
default:
- case LABEL_SPIN_STYLE::LEFT:
- text_offset.x -= offset;
- break; // Orientation horiz normal
- case LABEL_SPIN_STYLE::UP:
- text_offset.y -= offset;
- break; // Orientation vert UP
- case LABEL_SPIN_STYLE::RIGHT:
- text_offset.x += offset;
- break; // Orientation horiz inverse
- case LABEL_SPIN_STYLE::BOTTOM:
- text_offset.y += offset;
- break; // Orientation vert BOTTOM
+ case LABEL_SPIN_STYLE::LEFT: text_offset.x -= dist; break;
+ case LABEL_SPIN_STYLE::UP: text_offset.y -= dist; break;
+ case LABEL_SPIN_STYLE::RIGHT: text_offset.x += dist; break;
+ case LABEL_SPIN_STYLE::BOTTOM: text_offset.y += dist; break;
}
return text_offset;
@@ -883,31 +882,30 @@ void SCH_GLOBALLABEL::SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle )
}
-void SCH_GLOBALLABEL::Print( wxDC* DC, const wxPoint& aOffset )
+void SCH_GLOBALLABEL::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
{
static std::vector Poly;
- COLOR4D color = GetLayerColor( m_Layer );
- wxPoint text_offset = aOffset + GetSchematicTextOffset();
+ wxDC* DC = aSettings->GetPrintDC();
+ COLOR4D color = aSettings->GetLayerColor( m_Layer );
+ int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
+ wxPoint text_offset = aOffset + GetSchematicTextOffset( aSettings );
- EDA_TEXT::Print( DC, text_offset, color );
+ EDA_TEXT::Print( aSettings, text_offset, color );
CreateGraphicShape( Poly, GetTextPos() + aOffset );
- GRPoly( nullptr, DC, Poly.size(), &Poly[0], false, GetTextPenWidth(), color, color );
+ GRPoly( nullptr, DC, Poly.size(), &Poly[0], false, penWidth, color, color );
}
-void SCH_GLOBALLABEL::CreateGraphicShape( std::vector & aPoints, const wxPoint& Pos )
+void SCH_GLOBALLABEL::CreateGraphicShape( std::vector& aPoints, const wxPoint& Pos )
{
int halfSize = GetTextHeight() / 2;
-
- // Use the maximum clamped pen width to give us a bit of wiggle room
- int linewidth = Clamp_Text_PenSize( GetTextSize().x, GetTextSize(), IsBold() );
+ int linewidth = GetPenWidth();
+ int symb_len = LenSize( GetShownText(), linewidth, m_textMarkupFlags ) + ( TXT_MARGIN * 2 );
aPoints.clear();
- int symb_len = LenSize( GetShownText(), linewidth, GetTextMarkupFlags() ) + ( TXT_MARGIN * 2 );
-
// Create outline shape : 6 points
int x = symb_len + linewidth + 3;
@@ -969,17 +967,10 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector & aPoints, const
switch( GetLabelSpinStyle() )
{
default:
- case LABEL_SPIN_STYLE::LEFT:
- break; // Orientation horiz normal
- case LABEL_SPIN_STYLE::UP:
- angle = -900;
- break; // Orientation vert UP
- case LABEL_SPIN_STYLE::RIGHT:
- angle = 1800;
- break; // Orientation horiz inverse
- case LABEL_SPIN_STYLE::BOTTOM:
- angle = 900;
- break; // Orientation vert BOTTOM
+ case LABEL_SPIN_STYLE::LEFT: break;
+ case LABEL_SPIN_STYLE::UP: angle = -900; break;
+ case LABEL_SPIN_STYLE::RIGHT: angle = 1800; break;
+ case LABEL_SPIN_STYLE::BOTTOM: angle = 900; break;
}
// Rotate outlines and move corners in real position
@@ -1011,7 +1002,7 @@ const EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const
height = ( (GetTextHeight() * 15) / 10 ) + width + 2 * TXT_MARGIN;
// text X size add height for triangular shapes(bidirectional)
- length = LenSize( GetShownText(), width, GetTextMarkupFlags() ) + height +
+ length = LenSize( GetShownText(), width, m_textMarkupFlags ) + height +
Mils2iu( DANGLING_SYMBOL_SIZE );
switch( GetLabelSpinStyle() ) // respect orientation
@@ -1064,8 +1055,9 @@ BITMAP_DEF SCH_GLOBALLABEL::GetMenuImage() const
}
-SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text, KICAD_T aType )
- : SCH_TEXT( pos, text, aType )
+SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text, KICAD_T aType,
+ int aMarkupFlags )
+ : SCH_TEXT( pos, text, aType, aMarkupFlags )
{
m_Layer = LAYER_HIERLABEL;
m_shape = PINSHEETLABEL_SHAPE::PS_INPUT;
@@ -1121,22 +1113,25 @@ void SCH_HIERLABEL::SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle )
}
-void SCH_HIERLABEL::Print( wxDC* DC, const wxPoint& offset )
+void SCH_HIERLABEL::Print( RENDER_SETTINGS* aSettings, const wxPoint& offset )
{
static std::vector Poly;
- auto conn = Connection( *g_CurrentSheet );
- COLOR4D color = GetLayerColor( ( conn && conn->IsBus() ) ? LAYER_BUS : m_Layer );
- wxPoint text_offset = offset + GetSchematicTextOffset();
+ wxDC* DC = aSettings->GetPrintDC();
+ SCH_CONNECTION* conn = Connection( *g_CurrentSheet );
+ bool isBus = conn && conn->IsBus();
+ COLOR4D color = aSettings->GetLayerColor( isBus ? LAYER_BUS : m_Layer );
+ int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
+ wxPoint textOffset = offset + GetSchematicTextOffset( aSettings );
- EDA_TEXT::Print( DC, text_offset, color );
+ EDA_TEXT::Print( aSettings, textOffset, color );
CreateGraphicShape( Poly, GetTextPos() + offset );
- GRPoly( nullptr, DC, Poly.size(), &Poly[0], false, GetTextPenWidth(), color, color );
+ GRPoly( nullptr, DC, Poly.size(), &Poly[0], false, penWidth, color, color );
}
-void SCH_HIERLABEL::CreateGraphicShape( std::vector & aPoints, const wxPoint& Pos )
+void SCH_HIERLABEL::CreateGraphicShape( std::vector& aPoints, const wxPoint& Pos )
{
int* Template = TemplateShape[static_cast( m_shape )][static_cast( m_spin_style )];
int halfSize = GetTextWidth() / 2;
@@ -1160,19 +1155,17 @@ void SCH_HIERLABEL::CreateGraphicShape( std::vector & aPoints, const wx
const EDA_RECT SCH_HIERLABEL::GetBoundingBox() const
{
- int x, y, dx, dy, length, height;
+ int penWidth = GetEffectiveTextPenWidth();
- x = GetTextPos().x;
- y = GetTextPos().y;
- dx = dy = 0;
+ int x = GetTextPos().x;
+ int y = GetTextPos().y;
- // Use the maximum clamped pen width to give us a bit of wiggle room
- int width = Clamp_Text_PenSize( GetTextSize().x, GetTextSize(), IsBold() );
+ int height = GetTextHeight() + penWidth + 2 * TXT_MARGIN;
+ int length = LenSize( GetShownText(), penWidth, m_textMarkupFlags )
+ + height // add height for triangular shapes
+ + 2 * Mils2iu( DANGLING_SYMBOL_SIZE );
- height = GetTextHeight() + width + 2 * TXT_MARGIN;
- length = LenSize( GetShownText(), width, GetTextMarkupFlags() )
- + height // add height for triangular shapes
- + 2 * Mils2iu( DANGLING_SYMBOL_SIZE );
+ int dx, dy;
switch( GetLabelSpinStyle() )
{
@@ -1212,27 +1205,27 @@ const EDA_RECT SCH_HIERLABEL::GetBoundingBox() const
}
-wxPoint SCH_HIERLABEL::GetSchematicTextOffset() const
+wxPoint SCH_HIERLABEL::GetSchematicTextOffset( RENDER_SETTINGS* aSettings ) const
{
wxPoint text_offset;
- int thickness = GetPenSize();
- int offset = KiROUND( GetTextOffsetRatio() * GetTextSize().y );
- int total_offset = GetTextWidth() + offset + thickness;
+ int dist = GetTextOffset( aSettings ) + GetPenWidth();
+
+ dist += GetTextWidth();
switch( GetLabelSpinStyle() )
{
default:
case LABEL_SPIN_STYLE::LEFT:
- text_offset.x = -total_offset;
+ text_offset.x = -dist;
break; // Orientation horiz normale
case LABEL_SPIN_STYLE::UP:
- text_offset.y = -total_offset;
+ text_offset.y = -dist;
break; // Orientation vert UP
case LABEL_SPIN_STYLE::RIGHT:
- text_offset.x = total_offset;
+ text_offset.x = dist;
break; // Orientation horiz inverse
case LABEL_SPIN_STYLE::BOTTOM:
- text_offset.y = total_offset;
+ text_offset.y = dist;
break; // Orientation vert BOTTOM
}
diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h
index cb24caeca2..d780593c6c 100644
--- a/eeschema/sch_text.h
+++ b/eeschema/sch_text.h
@@ -184,8 +184,8 @@ protected:
LABEL_SPIN_STYLE m_spin_style;
public:
- SCH_TEXT( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
- KICAD_T aType = SCH_TEXT_T );
+ SCH_TEXT( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString,
+ KICAD_T aType = SCH_TEXT_T, int aMarkupFlags = 0 );
/**
* Clones \a aText into a new object. All members are copied as is except
@@ -238,9 +238,9 @@ public:
* This offset depends on the orientation, the type of text, and the area required to
* draw the associated graphic symbol or to put the text above a wire.
*/
- virtual wxPoint GetSchematicTextOffset() const;
+ virtual wxPoint GetSchematicTextOffset( RENDER_SETTINGS* aSettings ) const;
- void Print( wxDC* DC, const wxPoint& offset ) override;
+ void Print( RENDER_SETTINGS* aSettings, const wxPoint& offset ) override;
/**
* Calculate the graphic shape (a polygon) associated to the text.
@@ -260,7 +260,9 @@ public:
bool operator<( const SCH_ITEM& aItem ) const override;
- int GetPenSize() const override;
+ int GetTextOffset( RENDER_SETTINGS* aSettings ) const;
+
+ int GetPenWidth() const override;
// Geometric transforms (used in block operations):
@@ -322,7 +324,8 @@ public:
class SCH_LABEL : public SCH_TEXT
{
public:
- SCH_LABEL( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
+ SCH_LABEL( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString,
+ int aMarkupFlags = 0 );
// Do not create a copy constructor. The one generated by the compiler is adequate.
@@ -366,13 +369,14 @@ private:
class SCH_GLOBALLABEL : public SCH_TEXT
{
public:
- SCH_GLOBALLABEL( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
+ SCH_GLOBALLABEL( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString,
+ int aMarkupFlags = 0 );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~SCH_GLOBALLABEL() { }
- void Print( wxDC* DC, const wxPoint& offset ) override;
+ void Print( RENDER_SETTINGS* aSettings, const wxPoint& offset ) override;
static inline bool ClassOf( const EDA_ITEM* aItem )
{
@@ -386,11 +390,11 @@ public:
void SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle ) override;
- wxPoint GetSchematicTextOffset() const override;
+ wxPoint GetSchematicTextOffset( RENDER_SETTINGS* aSettings ) const override;
const EDA_RECT GetBoundingBox() const override;
- void CreateGraphicShape( std::vector & aPoints, const wxPoint& aPos ) override;
+ void CreateGraphicShape( std::vector& aPoints, const wxPoint& aPos ) override;
bool IsConnectable() const override { return true; }
@@ -414,15 +418,14 @@ private:
class SCH_HIERLABEL : public SCH_TEXT
{
public:
- SCH_HIERLABEL( const wxPoint& pos = wxPoint( 0, 0 ),
- const wxString& text = wxEmptyString,
- KICAD_T aType = SCH_HIER_LABEL_T );
+ SCH_HIERLABEL( const wxPoint& aPos = wxPoint( 0, 0 ), const wxString& aText = wxEmptyString,
+ KICAD_T aType = SCH_HIER_LABEL_T, int aMarkupFlags = 0 );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~SCH_HIERLABEL() { }
- void Print( wxDC* DC, const wxPoint& offset ) override;
+ void Print( RENDER_SETTINGS* aSettings, const wxPoint& offset ) override;
static inline bool ClassOf( const EDA_ITEM* aItem )
{
@@ -436,9 +439,9 @@ public:
void SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle ) override;
- wxPoint GetSchematicTextOffset() const override;
+ wxPoint GetSchematicTextOffset( RENDER_SETTINGS* aSettings ) const override;
- void CreateGraphicShape( std::vector & aPoints, const wxPoint& Pos ) override;
+ void CreateGraphicShape( std::vector& aPoints, const wxPoint& Pos ) override;
const EDA_RECT GetBoundingBox() const override;
diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp
index 2ca804fc93..51c8d8b87b 100644
--- a/eeschema/sheet.cpp
+++ b/eeschema/sheet.cpp
@@ -35,6 +35,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -471,6 +472,7 @@ bool SCH_EDIT_FRAME::LoadSheetFromFile( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHier
SCH_SCREENS screens( aSheet );
screens.UpdateSymbolLinks( true );
+ screens.UpdateTextMarkupFlags( GetTextMarkupFlags() );
return true;
}
@@ -598,7 +600,10 @@ void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard()
dc.SetUserScale( scale, scale );
dc.Clear();
- PrintPage( &dc );
+ GetRenderSettings()->SetPrintDC( &dc );
+
+ PrintPage( GetRenderSettings() );
+
screen->m_IsPrinting = false;
if( wxTheClipboard->Open() )
diff --git a/eeschema/tools/lib_drawing_tools.cpp b/eeschema/tools/lib_drawing_tools.cpp
index 44aca72e06..43e06dbe18 100644
--- a/eeschema/tools/lib_drawing_tools.cpp
+++ b/eeschema/tools/lib_drawing_tools.cpp
@@ -143,7 +143,7 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
}
case LIB_TEXT_T:
{
- LIB_TEXT* text = new LIB_TEXT( part );
+ LIB_TEXT* text = new LIB_TEXT( part, m_frame->GetTextMarkupFlags() );
text->SetPosition( wxPoint( cursorPos.x, -cursorPos.y ) );
text->SetTextSize( wxSize( m_frame->GetDefaultTextSize(),
m_frame->GetDefaultTextSize() ) );
diff --git a/eeschema/tools/lib_edit_tool.cpp b/eeschema/tools/lib_edit_tool.cpp
index 3959d600bc..fca9b003be 100644
--- a/eeschema/tools/lib_edit_tool.cpp
+++ b/eeschema/tools/lib_edit_tool.cpp
@@ -661,7 +661,7 @@ int LIB_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
{
// If it's not a part then paste as text
newPart = new LIB_PART( "dummy_part" );
- LIB_TEXT* newText = new LIB_TEXT( newPart );
+ LIB_TEXT* newText = new LIB_TEXT( newPart, m_frame->GetTextMarkupFlags() );
newText->SetText( text );
newPart->AddDrawItem( newText );
}
diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp
index 8211710ea8..dcaef76472 100644
--- a/eeschema/tools/sch_editor_control.cpp
+++ b/eeschema/tools/sch_editor_control.cpp
@@ -1133,6 +1133,8 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
}
}
+ paste_screen.UpdateTextMarkupFlags( m_frame->GetTextMarkupFlags() );
+
// Remove the references from our temporary screen to prevent freeing on the DTOR
paste_screen.Clear( false );
diff --git a/eeschema/tools/sch_line_wire_bus_tool.cpp b/eeschema/tools/sch_line_wire_bus_tool.cpp
index 385c2028dd..50da9ce342 100644
--- a/eeschema/tools/sch_line_wire_bus_tool.cpp
+++ b/eeschema/tools/sch_line_wire_bus_tool.cpp
@@ -373,7 +373,8 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet )
m_busUnfold.entry->SetParent( m_frame->GetScreen() );
m_frame->AddToScreen( m_busUnfold.entry );
- m_busUnfold.label = new SCH_LABEL( m_busUnfold.entry->m_End(), aNet );
+ m_busUnfold.label = new SCH_LABEL( m_busUnfold.entry->m_End(), aNet,
+ m_frame->GetTextMarkupFlags() );
m_busUnfold.label->SetTextSize( wxSize( m_frame->GetDefaultTextSize(),
m_frame->GetDefaultTextSize() ) );
m_busUnfold.label->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT );
diff --git a/include/eda_draw_frame.h b/include/eda_draw_frame.h
index d01be2d8af..8ca9db301b 100644
--- a/include/eda_draw_frame.h
+++ b/include/eda_draw_frame.h
@@ -41,13 +41,15 @@ class COLOR_SETTINGS;
class TOOL_MENU;
class APP_SETTINGS_BASE;
-using KIGFX::COLOR4D;
-
namespace KIGFX
{
class GAL_DISPLAY_OPTIONS;
+ class RENDER_SETTINGS;
}
+using KIGFX::COLOR4D;
+using KIGFX::RENDER_SETTINGS;
+
#define DEFAULT_MAX_UNDO_ITEMS 0
#define ABS_MAX_UNDO_ITEMS (INT_MAX / 2)
#define LIB_EDIT_FRAME_NAME wxT( "LibeditFrame" )
@@ -356,16 +358,13 @@ public:
/**
* Prints the page layout with the frame and the basic inscriptions.
*
- * @param aDC The device context.
* @param aScreen screen to draw
- * @param aLineWidth The pen width to use to draw the layout.
* @param aScale The mils to Iu conversion factor.
* @param aFilename The filename to display in basic inscriptions.
* @param aSheetLayer The layer displayed from pcbnew.
*/
- void PrintWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth, double aScale,
- const wxString &aFilename, const wxString &aSheetLayer = wxEmptyString,
- COLOR4D aColor = COLOR4D::UNSPECIFIED );
+ void PrintWorkSheet( RENDER_SETTINGS* aSettings, BASE_SCREEN* aScreen, double aScale,
+ const wxString &aFilename, const wxString &aSheetLayer = wxEmptyString );
void DisplayToolMsg( const wxString& msg ) override;
@@ -443,7 +442,7 @@ public:
*
* @param aDC = wxDC given by the calling print function
*/
- virtual void PrintPage( wxDC* aDC );
+ virtual void PrintPage( RENDER_SETTINGS* aSettings );
/**
* Returns the canvas type stored in the application settings.
diff --git a/include/eda_text.h b/include/eda_text.h
index e3446990e7..656e6e7a8e 100644
--- a/include/eda_text.h
+++ b/include/eda_text.h
@@ -90,7 +90,7 @@ struct TEXT_EFFECTS
angle( 0.0 )
{}
- short bits; ///< any set of booleans a client uses.
+ int bits; ///< any set of booleans a client uses.
signed char hjustify; ///< horizontal justification
signed char vjustify; ///< vertical justification
wxSize size;
@@ -112,7 +112,7 @@ struct TEXT_EFFECTS
class EDA_TEXT
{
public:
- EDA_TEXT( const wxString& text = wxEmptyString );
+ EDA_TEXT( const wxString& text = wxEmptyString, int aMarkupFlags = 0 );
EDA_TEXT( const EDA_TEXT& aText );
@@ -140,22 +140,18 @@ public:
virtual void SetText( const wxString& aText );
/**
- * The TextPenWidth is that set by the user. The EffectiveTextPenWidth also factors
- * in bold text, default text thickness, and thickness clamping.
+ * The TextThickness is that set by the user. The EffectiveTextPenWidth also factors
+ * in bold text and thickness clamping.
*/
- void SetTextPenWidth( int aWidth ) { m_e.penwidth = aWidth; };
- int GetTextPenWidth() const { return m_e.penwidth; };
- int GetEffectiveTextPenWidth( RENDER_SETTINGS* aSettings ) const;
+ void SetTextThickness( int aWidth ) { m_e.penwidth = aWidth; };
+ int GetTextThickness() const { return m_e.penwidth; };
+ int GetEffectiveTextPenWidth() const;
- // JEY TODO: delete
- int GetThickness() const { return m_e.penwidth; };
-
- void SetTextAngle( double aAngle )
+ virtual void SetTextAngle( double aAngle )
{
- // Higher level classes may be more restrictive than this by
- // overloading SetTextAngle() (probably non-virtual) or merely
- // calling EDA_TEXT::SetTextAngle() after clamping aAngle
- // before calling this lowest inline accessor.
+ // Higher level classes may be more restrictive than this by overloading
+ // SetTextAngle() or merely calling EDA_TEXT::SetTextAngle() after clamping
+ // aAngle before calling this lowest inline accessor.
m_e.angle = aAngle;
}
double GetTextAngle() const { return m_e.angle; }
@@ -222,8 +218,11 @@ public:
bool IsDefaultFormatting() const;
- void SetTextSize( const wxSize& aNewSize ) { m_e.size = aNewSize; };
- const wxSize& GetTextSize() const { return m_e.size; };
+ void SetTextMarkupFlags( int aFlags ) { m_textMarkupFlags = aFlags; }
+ int GetTextMarkupFlags() const { return m_textMarkupFlags; }
+
+ void SetTextSize( const wxSize& aNewSize ) { m_e.size = aNewSize; }
+ const wxSize& GetTextSize() const { return m_e.size; }
void SetTextWidth( int aWidth ) { m_e.size.x = aWidth; }
int GetTextWidth() const { return m_e.size.x; }
@@ -253,7 +252,7 @@ public:
* @param aColor = text color
* @param aDisplay_mode = FILLED or SKETCH
*/
- void Print( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor,
+ void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, COLOR4D aColor,
EDA_DRAW_MODE_T aDisplay_mode = FILLED );
/**
@@ -312,14 +311,13 @@ public:
/**
* Useful in multiline texts to calculate the full text or a line area (for zones filling,
* locate functions....)
- * @param aSettings An options rendering context to provide defaults, processing flags, etc.
* @param aLine The line of text to consider. Pass -1 for all lines.
* @param aInvertY Invert the Y axis when calculating bounding box.
* @return the rect containing the line of text (i.e. the position and the size of one line)
* this rectangle is calculated for 0 orient text.
* If orientation is not 0 the rect must be rotated to match the physical area
*/
- EDA_RECT GetTextBox( RENDER_SETTINGS* aSettings, int aLine = -1, bool aInvertY = false ) const;
+ EDA_RECT GetTextBox( int aLine = -1, bool aInvertY = false ) const;
/**
* Return the distance between two lines of text.
@@ -344,8 +342,7 @@ public:
* @param aLineCount is the number of lines (not recalculated here
* for efficiency reasons
*/
- void GetPositionsOfLinesOfMultilineText(
- std::vector& aPositions, int aLineCount ) const;
+ void GetLinePositions( std::vector& aPositions, int aLineCount ) const;
/**
* Output the object to \a aFormatter in s-expression form.
*
@@ -356,37 +353,36 @@ public:
*/
virtual void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const;
+protected:
+ int m_textMarkupFlags; // Set of TEXT_MARKUP_FLAGS indicating which markup
+ // features are to be processed.
private:
- wxString m_text;
- wxString m_shown_text; // Cache of unescaped text for efficient access
+ wxString m_text;
+ wxString m_shown_text; // Cache of unescaped text for efficient access
-private:
- /**
- * Print each line of this EDA_TEXT.
- *
- * @param aDC = the current Device Context
- * @param aOffset = draw offset (usually (0,0))
- * @param aColor = text color
- * @param aFillMode = FILLED or SKETCH
- * @param aText = the single line of text to draw.
- * @param aPos = the position of this line ).
- */
- void printOneLineOfText( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor,
- EDA_DRAW_MODE_T aFillMode, const wxString& aText,
- const wxPoint& aPos );
-
- // Private text effects data. API above provides accessor funcs.
- TEXT_EFFECTS m_e;
-
- /// EDA_TEXT effects bools
+ TEXT_EFFECTS m_e; // Private bitflags for text styling. API above
+ // provides accessor funcs.
enum TE_FLAGS {
- // start at zero, sequence is irrelevant
TE_MIRROR,
TE_ITALIC,
TE_BOLD,
TE_MULTILINE,
TE_VISIBLE,
};
+
+private:
+ /**
+ * Print each line of this EDA_TEXT.
+ *
+ * @param aOffset = draw offset (usually (0,0))
+ * @param aColor = text color
+ * @param aFillMode = FILLED or SKETCH
+ * @param aText = the single line of text to draw.
+ * @param aPos = the position of this line ).
+ */
+ void printOneLineOfText( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, COLOR4D aColor,
+ EDA_DRAW_MODE_T aFillMode, const wxString& aText,
+ const wxPoint& aPos );
};
diff --git a/include/gr_text.h b/include/gr_text.h
index 7794f80968..43f9e8cd82 100644
--- a/include/gr_text.h
+++ b/include/gr_text.h
@@ -56,9 +56,6 @@ enum TEXT_MARKUP_FLAGS
ENABLE_SUPERSCRIPT_MARKUP = 1 << 1
};
-int GetTextMarkupFlags();
-void SetTextMarkupFlags( int aMarkupFlags );
-
/**
* Function Clamp_Text_PenSize
*As a rule, pen width should not be >1/4em, otherwise the character
@@ -106,6 +103,8 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool italic, b
* Use a value min(aSize.x, aSize.y) / 5 for a bold text
* @param aItalic = true to simulate an italic font
* @param aBold = true to use a bold font
+ * @param aMarkupFlags a set of TEXT_MARKUP_FLAGS indicating what markup features are to
+ * be processed
* @param aCallback( int x0, int y0, int xf, int yf, void* aData ) is a function called
* (if non null) to draw each segment. used to draw 3D texts or for plotting.
* NULL for normal drawings
@@ -114,9 +113,10 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool italic, b
* @param aPlotter = a pointer to a PLOTTER instance, when this function is used to plot
* the text. NULL to draw this text.
*/
-void GRText( wxDC * aDC, const wxPoint &aPos, const COLOR4D aColor, const wxString &aText,
+void GRText( wxDC * aDC, const wxPoint &aPos, COLOR4D aColor, const wxString &aText,
double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold,
+ int aMarkupFlags,
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
void* aCallbackData = nullptr, PLOTTER * aPlotter = nullptr );
@@ -127,10 +127,10 @@ void GRText( wxDC * aDC, const wxPoint &aPos, const COLOR4D aColor, const wxStri
* If aBgColor is a dark color text is drawn in aColor2 with aColor1
* border; otherwise colors are swapped.
*/
-void GRHaloText( wxDC * aDC, const wxPoint &aPos, const COLOR4D aBgColor, COLOR4D aColor1,
+void GRHaloText( wxDC * aDC, const wxPoint &aPos, COLOR4D aBgColor, COLOR4D aColor1,
COLOR4D aColor2, const wxString &aText, double aOrient, const wxSize &aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify,
- int aWidth, bool aItalic, bool aBold,
+ int aWidth, bool aItalic, bool aBold, int aMarkupFlags,
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
void* aCallbackData = nullptr, PLOTTER * aPlotter = nullptr );
diff --git a/include/marker_base.h b/include/marker_base.h
index b661353248..e7856aa9e3 100644
--- a/include/marker_base.h
+++ b/include/marker_base.h
@@ -33,6 +33,14 @@
class SHAPE_LINE_CHAIN;
+namespace KIGFX
+{
+ class RENDER_SETTINGS;
+}
+
+using KIGFX::RENDER_SETTINGS;
+
+
/*
* Marker are mainly used to show a DRC or ERC error or warning
*/
@@ -81,7 +89,7 @@ public:
* Function PrintMarker
* Prints the shape is the polygon defined in m_Corners (array of wxPoints).
*/
- void PrintMarker( wxDC* aDC, const wxPoint& aOffset );
+ void PrintMarker( RENDER_SETTINGS* aSettings, const wxPoint& aOffset );
/**
* Function GetPos
diff --git a/include/painter.h b/include/painter.h
index c0c0da7fdc..349830d857 100644
--- a/include/painter.h
+++ b/include/painter.h
@@ -31,6 +31,7 @@
#include
#include
+#include
#include
#include
@@ -42,231 +43,6 @@ namespace KIGFX
class GAL;
class VIEW_ITEM;
-/**
- * RENDER_SETTINGS
- * Contains all the knowledge about how graphical objects are drawn on any output
- * surface/device. This includes:
- * - color/transparency settings
- * - highlighting and high contrast mode control
- * - drawing quality control (sketch/outline mode)
- * - text processing flags
- * The class acts as an interface between the PAINTER object and the GUI (i.e. Layers/Items
- * widget or display options dialog).
- */
-class RENDER_SETTINGS
-{
-public:
- RENDER_SETTINGS();
- virtual ~RENDER_SETTINGS();
-
- virtual void LoadColors( const COLOR_SETTINGS* aSettings ) { }
-
- /**
- * Function SetActiveLayer
- * Sets the specified layer as active - it means that it can be drawn in a specific mode
- * (eg. highlighted, so it differs from other layers).
- * @param aLayerId is a layer number that should be displayed in a specific mode.
- * @param aEnabled is the new layer state ( true = active or false = not active).
- */
- inline void SetActiveLayer( int aLayerId, bool aEnabled = true )
- {
- if( aEnabled )
- m_activeLayers.insert( aLayerId );
- else
- m_activeLayers.erase( aLayerId );
- }
-
- /**
- * Function GetActiveLayers()
- * Returns the set of currently active layers.
- * @return The set of currently active layers.
- */
- const std::set GetActiveLayers()
- {
- return m_activeLayers;
- }
-
- /**
- * Function ClearActiveLayers
- * Clears the list of active layers.
- */
- inline void ClearActiveLayers()
- {
- m_activeLayers.clear();
- }
-
- /**
- * Function IsActiveLayer
- * Returns information whether the queried layer is marked as active.
- * @return True if the queried layer is marked as active.
- */
- inline bool IsActiveLayer( int aLayerId ) const
- {
- return ( m_activeLayers.count( aLayerId ) > 0 );
- }
-
- /**
- * Function IsHighlightEnabled
- * Returns current highlight setting.
- * @return True if highlight is enabled, false otherwise.
- */
- inline bool IsHighlightEnabled() const
- {
- return m_highlightEnabled;
- }
-
- /**
- * Function GetHighlightNetCode
- * Returns netcode of currently highlighted net.
- * @return Netcode of currently highlighted net.
- */
- inline int GetHighlightNetCode() const
- {
- return m_highlightNetcode;
- }
-
- /**
- * Function SetHighlight
- * Turns on/off highlighting - it may be done for the active layer, the specified net, or
- * items with their HIGHLIGHTED flags set.
- * @param aEnabled tells if highlighting should be enabled.
- * @param aNetcode is optional and if specified, turns on higlighting only for the net with
- * number given as the parameter.
- */
- inline void SetHighlight( bool aEnabled, int aNetcode = -1, bool aHighlightItems = false )
- {
- m_highlightEnabled = aEnabled;
- m_highlightNetcode = aEnabled ? aNetcode : -1;
- m_highlightItems = aEnabled ? aHighlightItems : false;
- }
-
- /**
- * Function SetHighContrast
- * Turns on/off high contrast display mode.
- */
- void SetHighContrast( bool aEnabled ) { m_hiContrastEnabled = aEnabled; }
- bool GetHighContrast() const { return m_hiContrastEnabled; }
-
- /**
- * Function GetColor
- * Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer
- * using currently used render settings.
- * @param aItem is the VIEW_ITEM.
- * @param aLayer is the layer.
- * @return The color.
- */
- virtual const COLOR4D& GetColor( const VIEW_ITEM* aItem, int aLayer ) const = 0;
-
- float GetWorksheetLineWidth() const { return m_worksheetLineWidth; }
-
- virtual int GetDefaultTextThickness() const { return m_defaultPenWidth; }
- int GetTextMarkupFlags() const { return m_textMarkupFlags; }
-
- bool GetShowPageLimits() const { return m_showPageLimits; }
- void SetShowPageLimits( bool aDraw ) { m_showPageLimits = aDraw; }
-
- /**
- * Function GetBackgroundColor
- * Returns current background color settings.
- */
- virtual const COLOR4D& GetBackgroundColor() = 0;
-
- /**
- * Sets the background color.
- */
- virtual void SetBackgroundColor( const COLOR4D& aColor ) = 0;
-
- /**
- * Function GetGridColor
- * Returns current grid color settings.
- */
- virtual const COLOR4D& GetGridColor() = 0;
-
- /**
- * Function GetCursorColor
- * Returns current cursor color settings.
- */
- virtual const COLOR4D& GetCursorColor() = 0;
-
- /**
- * Function GetLayerColor
- * Returns the color used to draw a layer.
- * @param aLayer is the layer number.
- */
- inline const COLOR4D& GetLayerColor( int aLayer ) const
- {
- return m_layerColors[aLayer];
- }
-
- /**
- * Function SetLayerColor
- * Changes the color used to draw a layer.
- * @param aLayer is the layer number.
- * @param aColor is the new color.
- */
- inline void SetLayerColor( int aLayer, const COLOR4D& aColor )
- {
- m_layerColors[aLayer] = aColor;
-
- update(); // recompute other shades of the color
- }
-
- virtual bool IsBackgroundDark() const
- {
- return false;
- }
-
- /**
- * Set line width used for drawing outlines.
- *
- * @param aWidth is the new width.
- */
- void SetOutlineWidth( float aWidth )
- {
- m_outlineWidth = aWidth;
- }
-
-protected:
- /**
- * Function update
- * Precalculates extra colors for layers (e.g. highlighted, darkened and any needed version
- * of base colors).
- */
- virtual void update();
-
- std::set m_activeLayers; ///< Stores active layers number
-
- COLOR4D m_layerColors[LAYER_ID_COUNT]; // Layer colors
- COLOR4D m_layerColorsHi[LAYER_ID_COUNT]; // Layer colors for highlighted objects
- COLOR4D m_layerColorsSel[LAYER_ID_COUNT]; // Layer colors for selected objects
-
- COLOR4D m_hiContrastColor[LAYER_ID_COUNT]; // High-contrast mode layer colors
- COLOR4D m_layerColorsDark[LAYER_ID_COUNT]; // Darkened layer colors (for high-contrast mode)
-
- COLOR4D m_backgroundColor; // The background color
-
- /// Parameters for display modes
- bool m_hiContrastEnabled; // High contrast display mode on/off
- float m_hiContrastFactor; // Factor used for computing high contrast color
-
- bool m_highlightEnabled; // Highlight display mode on/off
- int m_highlightNetcode; // Net number that is displayed in highlight
- // -1 means that there is no specific net, and whole active
- // layer is highlighted
- bool m_highlightItems; // Highlight items with their HIGHLIGHT flags set
- float m_highlightFactor; // Factor used for computing highlight color
-
- float m_selectFactor; // Specifies how color of selected items is changed
- float m_outlineWidth; // Line width used when drawing outlines
- float m_worksheetLineWidth; // Line width used when drawing worksheet
-
- int m_defaultPenWidth;
- int m_textMarkupFlags; // Indicates whether or not certain markups (such as super-
- // and subscript) should be processed.
- bool m_showPageLimits;
-};
-
-
/**
* PAINTER
* contains all the knowledge about how to draw graphical object onto
@@ -336,6 +112,7 @@ protected:
/// Color of brightened item frame
COLOR4D m_brightenedColor;
};
+
} // namespace KIGFX
#endif /* __CLASS_PAINTER_H */
diff --git a/include/plotter.h b/include/plotter.h
index 07cd259b5f..07f1260db8 100644
--- a/include/plotter.h
+++ b/include/plotter.h
@@ -130,29 +130,17 @@ public:
/** Plot in B/W or color.
* @param aColorMode = true to plot in color, false to plot in black and white
*/
- virtual void SetColorMode( bool aColorMode )
- {
- colorMode = aColorMode;
- }
+ virtual void SetColorMode( bool aColorMode ) { colorMode = aColorMode; }
+ bool GetColorMode() const { return colorMode; }
- bool GetColorMode() const
- {
- return colorMode;
- }
+ void SetTextMarkupFlags( bool aMarkupFlags ) { m_textMarkupFlags = aMarkupFlags; }
+ int GetTextMarkupFlags() const { return m_textMarkupFlags; }
- void SetColorSettings( COLOR_SETTINGS* aSettings ) { m_colors = aSettings; }
+ void SetRenderSettings( RENDER_SETTINGS* aSettings ) { m_renderSettings = aSettings; }
+ RENDER_SETTINGS* RenderSettings() { return m_renderSettings; }
- COLOR_SETTINGS* ColorSettings() { return m_colors; }
-
- virtual void SetPageSettings( const PAGE_INFO& aPageSettings )
- {
- pageInfo = aPageSettings;
- }
-
- PAGE_INFO& PageSettings()
- {
- return pageInfo;
- }
+ virtual void SetPageSettings( const PAGE_INFO& aPageSettings ) { pageInfo = aPageSettings; }
+ PAGE_INFO& PageSettings() { return pageInfo; }
/**
* Set the line width for the next drawing.
@@ -160,18 +148,7 @@ public:
* @param aData is an auxiliary parameter, mainly used in gerber plotter
*/
virtual void SetCurrentLineWidth( int width, void* aData = NULL ) = 0;
-
- /**
- * Set the default line width. Used at the beginning and when a width
- * of -1 (USE_DEFAULT_LINE_WIDTH) is requested.
- * @param width is specified in IUs
- */
- virtual void SetDefaultLineWidth( int width ) = 0;
-
- virtual int GetCurrentLineWidth() const
- {
- return currentPenWidth;
- }
+ virtual int GetCurrentLineWidth() const { return currentPenWidth; }
virtual void SetColor( COLOR4D color ) = 0;
@@ -435,6 +412,7 @@ public:
int aWidth,
bool aItalic,
bool aBold,
+ int aTextMarkupFlags,
bool aMultilineAllowed = false,
void* aData = NULL );
@@ -597,25 +575,22 @@ protected: // variables used in most of plotters:
FILE* outputFile;
// Pen handling
- bool colorMode; /// true to plot in color, false to plot in black and white
- bool negativeMode; /// true to generate a negative image (PS mode mainly)
- int defaultPenWidth;
- int currentPenWidth;
- /// Current pen state: 'U', 'D' or 'Z' (see PenTo)
- char penState;
- /// Last pen positions; set to -1,-1 when the pen is at rest
- wxPoint penLastpos;
- wxString creator;
- wxString filename;
- wxString title;
- PAGE_INFO pageInfo;
- /// Paper size in IU - not in mils
- wxSize paperSize;
+ bool colorMode; // true to plot in color, false to plot in black & white
+ bool negativeMode; // true to generate a negative image (PS mode mainly)
+ int currentPenWidth;
+ char penState; // Current pen state: 'U', 'D' or 'Z' (see PenTo)
+ wxPoint penLastpos; // Last pen positions; set to -1,-1 when the pen is
+ // at rest
+ wxString creator;
+ wxString filename;
+ wxString title;
+ PAGE_INFO pageInfo;
+ wxSize paperSize; // Paper size in IU - not in mils
- wxArrayString m_headerExtraLines; /// a set of string to print in header file
+ wxArrayString m_headerExtraLines; // a set of string to print in header file
- /// Pointer to active color settings that is used for plotting
- COLOR_SETTINGS* m_colors;
+ RENDER_SETTINGS* m_renderSettings;
+ int m_textMarkupFlags;
};
@@ -644,7 +619,6 @@ public:
currentPenWidth = userToDeviceSize( penDiameter );
}
- virtual void SetDefaultLineWidth( int width ) override {}
virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
virtual void SetColor( COLOR4D color ) override {}
@@ -710,7 +684,10 @@ protected:
class PSLIKE_PLOTTER : public PLOTTER
{
public:
- PSLIKE_PLOTTER() : plotScaleAdjX( 1 ), plotScaleAdjY( 1 ), m_textMode( PLOT_TEXT_MODE::PHANTOM )
+ PSLIKE_PLOTTER() :
+ plotScaleAdjX( 1 ),
+ plotScaleAdjY( 1 ),
+ m_textMode( PLOT_TEXT_MODE::PHANTOM )
{
}
@@ -723,8 +700,6 @@ public:
m_textMode = mode;
}
- virtual void SetDefaultLineWidth( int width ) override;
-
/**
* Set the 'fine' scaling for the postscript engine
*/
@@ -852,6 +827,7 @@ public:
int aWidth,
bool aItalic,
bool aBold,
+ int aTextMarkupFlags,
bool aMultilineAllowed = false,
void* aData = NULL ) override;
protected:
@@ -861,11 +837,13 @@ protected:
class PDF_PLOTTER : public PSLIKE_PLOTTER
{
public:
- PDF_PLOTTER() : pageStreamHandle( 0 ), workFile( NULL )
+ PDF_PLOTTER() :
+ pageTreeHandle( 0 ),
+ fontResDictHandle( 0 ),
+ pageStreamHandle( 0 ),
+ streamLengthHandle( 0 ),
+ workFile( nullptr )
{
- // Avoid non initialized variables:
- pageStreamHandle = streamLengthHandle = fontResDictHandle = 0;
- pageTreeHandle = 0;
}
virtual PLOT_FORMAT GetPlotterType() const override
@@ -922,6 +900,7 @@ public:
int aWidth,
bool aItalic,
bool aBold,
+ int aTextMarkupFlags,
bool aMultilineAllowed = false,
void* aData = NULL ) override;
@@ -1015,6 +994,7 @@ public:
int aWidth,
bool aItalic,
bool aBold,
+ int aTextMarkupFlags,
bool aMultilineAllowed = false,
void* aData = NULL ) override;
@@ -1176,7 +1156,6 @@ public:
virtual bool StartPlot() override;
virtual bool EndPlot() override;
virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
- virtual void SetDefaultLineWidth( int width ) override;
// RS274X has no dashing, nor colours
virtual void SetDash( PLOT_DASH_TYPE dashed ) override
@@ -1223,6 +1202,7 @@ public:
int aWidth,
bool aItalic,
bool aBold,
+ int aTextMarkupFlags,
bool aMultilineAllowed = false,
void* aData = NULL ) override;
@@ -1412,17 +1392,17 @@ protected:
*/
void writeApertureList();
- std::vector m_apertures; // The list of available apertures
- int m_currentApertureIdx; // The index of the current aperture in m_apertures
+ std::vector m_apertures; // The list of available apertures
+ int m_currentApertureIdx; // The index of the current aperture in m_apertures
- bool m_gerberUnitInch; // true if the gerber units are inches, false for mm
- int m_gerberUnitFmt; // number of digits in mantissa.
- // usually 6 in Inches and 5 or 6 in mm
- bool m_useX2format; // In recent gerber files, attributes are added.
- // Attributes in file header will be added using X2 format if true
- // If false (X1 format), these attributes will be added as comments.
- bool m_useNetAttributes; // In recent gerber files, netlist info can be added.
- // It will be added if this param is true, using X2 or X1 format
+ bool m_gerberUnitInch; // true if the gerber units are inches, false for mm
+ int m_gerberUnitFmt; // number of digits in mantissa.
+ // usually 6 in Inches and 5 or 6 in mm
+ bool m_useX2format; // Add X2 file header attributes. If false, attributes
+ // will be added as comments.
+ bool m_useNetAttributes; // In recent gerber files, netlist info can be added.
+ // It will be added if this param is true, using X2 or
+ // X1 format
};
@@ -1465,12 +1445,6 @@ public:
currentPenWidth = 0;
}
- virtual void SetDefaultLineWidth( int width ) override
- {
- // DXF lines are infinitesimal
- defaultPenWidth = 0;
- }
-
virtual void SetDash( PLOT_DASH_TYPE dashed ) override;
virtual void SetColor( COLOR4D color ) override;
@@ -1516,6 +1490,7 @@ public:
int aWidth,
bool aItalic,
bool aBold,
+ int aTextMarkupFlags,
bool aMultilineAllowed = false,
void* aData = NULL ) override;
diff --git a/include/render_settings.h b/include/render_settings.h
new file mode 100644
index 0000000000..9a5f800847
--- /dev/null
+++ b/include/render_settings.h
@@ -0,0 +1,271 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2019 KiCad Developers, see CHANGELOG.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 RENDER_SETTINGS_H
+#define RENDER_SETTINGS_H
+
+#include