Eeschema, SCH_PAINTER: fix max text thickness issue, to have small texts readable.

This commit is contained in:
jean-pierre charras 2020-04-14 11:08:42 +02:00
parent e93684015c
commit 04ea20dd44
5 changed files with 214 additions and 170 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="13" />
<FileVersion major="1" minor="15" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="class_decoration" />
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
@ -16,9 +16,9 @@
<property name="help_provider">none</property>
<property name="internationalize">1</property>
<property name="name">dialog_text_entry_base</property>
<property name="namespace"></property>
<property name="namespace" />
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="precompiled_header" />
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
@ -29,67 +29,67 @@
<object class="Dialog" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="bg" />
<property name="center">wxBOTH</property>
<property name="context_help"></property>
<property name="context_help" />
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="font"></property>
<property name="extra_style" />
<property name="fg" />
<property name="font" />
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="maximum_size" />
<property name="minimum_size" />
<property name="name">WX_TEXT_ENTRY_DIALOG_BASE</property>
<property name="pos"></property>
<property name="pos" />
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnClose"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<property name="title" />
<property name="tooltip" />
<property name="window_extra_style" />
<property name="window_name" />
<property name="window_style" />
<event name="OnActivate" />
<event name="OnActivateApp" />
<event name="OnAuiFindManager" />
<event name="OnAuiPaneButton" />
<event name="OnAuiPaneClose" />
<event name="OnAuiPaneMaximize" />
<event name="OnAuiPaneRestore" />
<event name="OnAuiRender" />
<event name="OnChar" />
<event name="OnClose" />
<event name="OnEnterWindow" />
<event name="OnEraseBackground" />
<event name="OnHibernate" />
<event name="OnIconize" />
<event name="OnIdle" />
<event name="OnInitDialog" />
<event name="OnKeyDown" />
<event name="OnKeyUp" />
<event name="OnKillFocus" />
<event name="OnLeaveWindow" />
<event name="OnLeftDClick" />
<event name="OnLeftDown" />
<event name="OnLeftUp" />
<event name="OnMiddleDClick" />
<event name="OnMiddleDown" />
<event name="OnMiddleUp" />
<event name="OnMotion" />
<event name="OnMouseEvents" />
<event name="OnMouseWheel" />
<event name="OnPaint" />
<event name="OnRightDClick" />
<event name="OnRightDown" />
<event name="OnRightUp" />
<event name="OnSetFocus" />
<event name="OnSize" />
<event name="OnUpdateUI" />
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="minimum_size" />
<property name="name">bSizerMain</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
@ -98,7 +98,7 @@
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="minimum_size" />
<property name="name">bSizerContent</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
@ -111,78 +111,78 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="aui_layer" />
<property name="aui_name" />
<property name="aui_position" />
<property name="aui_row" />
<property name="best_size" />
<property name="bg" />
<property name="caption" />
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_help" />
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="fg" />
<property name="floatable">1</property>
<property name="font"></property>
<property name="font" />
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">MyLabel</property>
<property name="max_size"></property>
<property name="max_size" />
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="maximum_size" />
<property name="min_size" />
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="minimum_size" />
<property name="moveable">1</property>
<property name="name">m_label</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="pane_position" />
<property name="pane_size" />
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="pos" />
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="size" />
<property name="style" />
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="tooltip" />
<property name="window_extra_style" />
<property name="window_name" />
<property name="window_style" />
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<event name="OnChar" />
<event name="OnEnterWindow" />
<event name="OnEraseBackground" />
<event name="OnKeyDown" />
<event name="OnKeyUp" />
<event name="OnKillFocus" />
<event name="OnLeaveWindow" />
<event name="OnLeftDClick" />
<event name="OnLeftDown" />
<event name="OnLeftUp" />
<event name="OnMiddleDClick" />
<event name="OnMiddleDown" />
<event name="OnMiddleUp" />
<event name="OnMotion" />
<event name="OnMouseEvents" />
<event name="OnMouseWheel" />
<event name="OnPaint" />
<event name="OnRightDClick" />
<event name="OnRightDown" />
<event name="OnRightUp" />
<event name="OnSetFocus" />
<event name="OnSize" />
<event name="OnUpdateUI" />
</object>
</object>
<object class="sizeritem" expanded="0">
@ -194,86 +194,86 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="aui_layer" />
<property name="aui_name" />
<property name="aui_position" />
<property name="aui_row" />
<property name="best_size" />
<property name="bg" />
<property name="caption" />
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_help" />
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="fg" />
<property name="floatable">1</property>
<property name="font"></property>
<property name="font" />
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="max_size" />
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="maximum_size" />
<property name="maxlength" />
<property name="min_size" />
<property name="minimize_button">0</property>
<property name="minimum_size">300,-1</property>
<property name="moveable">1</property>
<property name="name">m_textCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="pane_position" />
<property name="pane_size" />
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="pos" />
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="size" />
<property name="style" />
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="tooltip" />
<property name="validator_data_type" />
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
<property name="validator_variable" />
<property name="value" />
<property name="window_extra_style" />
<property name="window_name" />
<property name="window_style" />
<event name="OnChar" />
<event name="OnEnterWindow" />
<event name="OnEraseBackground" />
<event name="OnKeyDown" />
<event name="OnKeyUp" />
<event name="OnKillFocus" />
<event name="OnLeaveWindow" />
<event name="OnLeftDClick" />
<event name="OnLeftDown" />
<event name="OnLeftUp" />
<event name="OnMiddleDClick" />
<event name="OnMiddleDown" />
<event name="OnMiddleUp" />
<event name="OnMotion" />
<event name="OnMouseEvents" />
<event name="OnMouseWheel" />
<event name="OnPaint" />
<event name="OnRightDClick" />
<event name="OnRightDown" />
<event name="OnRightUp" />
<event name="OnSetFocus" />
<event name="OnSize" />
<event name="OnText" />
<event name="OnTextEnter" />
<event name="OnTextMaxLen" />
<event name="OnTextURL" />
<event name="OnUpdateUI" />
</object>
</object>
</object>
@ -291,17 +291,17 @@
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="minimum_size" />
<property name="name">m_sdbSizer1</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick"></event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick"></event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
<event name="OnApplyButtonClick" />
<event name="OnCancelButtonClick" />
<event name="OnContextHelpButtonClick" />
<event name="OnHelpButtonClick" />
<event name="OnNoButtonClick" />
<event name="OnOKButtonClick" />
<event name="OnSaveButtonClick" />
<event name="OnYesButtonClick" />
</object>
</object>
</object>

View File

@ -149,7 +149,7 @@ int EDA_TEXT::GetEffectiveTextPenWidth( RENDER_SETTINGS* aSettings ) const
width = GetPenSizeForBold( GetTextWidth() );
if( width <= 0 && aSettings )
width = aSettings->GetDefaultPenWidth();
width = aSettings->GetDefaultTextThickness();
// Clip pen size for small texts:
width = Clamp_Text_PenSize( width, GetTextSize(), IsBold() );

View File

@ -78,7 +78,9 @@ SCH_RENDER_SETTINGS::SCH_RENDER_SETTINGS() :
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 )
@ -340,6 +342,39 @@ 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 );
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
return width;
}
float SCH_PAINTER::getTextThickness( const LIB_FIELD* aItem, bool aDrawingShadows )
{
float width = (float) aItem->GetEffectiveTextPenWidth( &m_schSettings );
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
return width;
}
float SCH_PAINTER::getTextThickness( const LIB_TEXT* aItem, bool aDrawingShadows )
{
float width = (float) aItem->GetEffectiveTextPenWidth( &m_schSettings );
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
return width;
}
void SCH_PAINTER::strokeText( const wxString& aText, const VECTOR2D& aPosition, double aAngle )
{
m_gal->StrokeText( aText, aPosition, aAngle, GetTextMarkupFlags() );
@ -572,7 +607,7 @@ void SCH_PAINTER::draw( LIB_FIELD *aField, int aLayer )
return;
}
m_gal->SetLineWidth( getLineWidth( aField, drawingShadows ) );
m_gal->SetLineWidth( getTextThickness( aField, drawingShadows ) );
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
m_gal->SetStrokeColor( color );
@ -641,7 +676,7 @@ void SCH_PAINTER::draw( LIB_TEXT *aText, int aLayer )
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
m_gal->SetLineWidth( getLineWidth( aText, drawingShadows ) );
m_gal->SetLineWidth( getTextThickness( aText, drawingShadows ) );
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
m_gal->SetStrokeColor( color );
@ -1243,7 +1278,7 @@ void SCH_PAINTER::draw( SCH_TEXT *aText, int aLayer )
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
m_gal->SetLineWidth( getLineWidth( aText, drawingShadows ) );
m_gal->SetLineWidth( getTextThickness( aText, drawingShadows ) );
m_gal->SetStrokeColor( color );
m_gal->SetTextAttributes( aText );
@ -1441,7 +1476,6 @@ void SCH_PAINTER::draw( SCH_FIELD *aField, int aLayer )
m_gal->SetStrokeColor( color );
m_gal->SetIsStroke( true );
m_gal->SetLineWidth( getLineWidth( aField, drawingShadows ) );
if( drawingShadows && eeconfig()->m_Selection.text_as_box )
{
@ -1462,6 +1496,7 @@ void SCH_PAINTER::draw( SCH_FIELD *aField, int aLayer )
m_gal->SetFontBold( aField->IsBold() );
m_gal->SetFontItalic( aField->IsItalic() );
m_gal->SetTextMirrored( aField->IsMirrored() );
m_gal->SetLineWidth( getTextThickness( aField, drawingShadows ) );
strokeText( aField->GetShownText(), textpos, orient == TEXT_ANGLE_VERT ? M_PI / 2 : 0 );
}

View File

@ -99,6 +99,12 @@ 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
@ -173,6 +179,9 @@ private:
float getLineWidth( const LIB_ITEM* aItem, bool aDrawingShadows );
float getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows );
float getTextThickness( const SCH_TEXT* aItem, bool aDrawingShadows );
float getTextThickness( const SCH_FIELD* aItem, bool aDrawingShadows );
float getTextThickness( const LIB_FIELD* aItem, bool aDrawingShadows );
float getTextThickness( const LIB_TEXT* aItem, bool aDrawingShadows );
bool setDeviceColors( const LIB_ITEM* aItem, int aLayer );
void fillIfSelection( int aLayer );

View File

@ -159,7 +159,7 @@ public:
float GetWorksheetLineWidth() const { return m_worksheetLineWidth; }
int GetDefaultPenWidth() const { return m_defaultPenWidth; }
virtual int GetDefaultTextThickness() const { return m_defaultPenWidth; }
int GetTextMarkupFlags() const { return m_textMarkupFlags; }
bool GetShowPageLimits() const { return m_showPageLimits; }