Remove some problematic global variables.

Fixes https://gitlab.com/kicad/code/kicad/issues/4121
This commit is contained in:
Jeff Young 2020-04-04 21:32:14 +01:00
parent 4a6c03e7fe
commit 591428b0d9
72 changed files with 2663 additions and 2957 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version v3.8.0)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -94,7 +94,7 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind
m_textEditorPath = new wxTextCtrl( sizerHelperApps->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_textEditorPath->SetMinSize( wxSize( 280,-1 ) );
gridHelperApps->Add( m_textEditorPath, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
gridHelperApps->Add( m_textEditorPath, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_textEditorBtn = new wxBitmapButton( sizerHelperApps->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_textEditorBtn->SetMinSize( wxSize( 29,29 ) );
@ -110,7 +110,7 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind
m_PDFViewerPath = new wxTextCtrl( sizerHelperApps->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_PDFViewerPath->SetMinSize( wxSize( 280,-1 ) );
gridHelperApps->Add( m_PDFViewerPath, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
gridHelperApps->Add( m_PDFViewerPath, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_pdfViewerBtn = new wxBitmapButton( sizerHelperApps->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_pdfViewerBtn->SetMinSize( wxSize( 29,29 ) );

View File

@ -767,7 +767,7 @@
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxTextCtrl" expanded="1">
@ -1044,7 +1044,7 @@
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxTextCtrl" expanded="1">

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version v3.8.0)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!

View File

@ -403,6 +403,9 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAddField( wxCommandEvent& event )
int fieldID = m_fields->size();
LIB_FIELD newField( m_libEntry, fieldID );
newField.SetTextSize( wxSize( m_Parent->GetDefaultTextSize(),
m_Parent->GetDefaultTextSize() ) );
m_fields->push_back( newField );
// notify the grid

View File

@ -535,6 +535,9 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnAddField( wxCommandEvent& event )
newField.SetName( TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldID ) );
newField.SetTextAngle( m_fields->at( REFERENCE ).GetTextAngle() );
newField.SetTextSize( wxSize( GetParent()->GetDefaultTextSize(),
GetParent()->GetDefaultTextSize() ) );
m_fields->push_back( newField );
// notify the grid

View File

@ -348,9 +348,5 @@ bool DIALOG_LABEL_EDITOR::TransferDataFromWindow()
m_Parent->GetCanvas()->Refresh();
m_Parent->OnModify();
// Make the text size the new default size ( if it is a new text ):
if( m_CurrentText->IsNew() )
SetDefaultTextSize( m_CurrentText->GetTextWidth() );
return true;
}

View File

@ -175,7 +175,7 @@ void DIALOG_EDIT_LINE_STYLE::updateColorButton( COLOR4D& aColor )
void DIALOG_EDIT_LINE_STYLE::resetDefaults( wxCommandEvent& event )
{
m_width.SetValue( m_lines.front()->GetDefaultWidth() );
m_width.SetValue( 0 );
setColor( COLOR4D::UNSPECIFIED );
auto typeIt = lineTypeNames.find( m_lines.front()->GetDefaultStyle() );

View File

@ -89,7 +89,7 @@ bool DIALOG_LIB_EDIT_TEXT::TransferDataToWindow()
}
else
{
m_textSize.SetValue( m_parent->g_LastTextSize );
m_textSize.SetValue( m_parent->GetDefaultTextSize() );
m_CommonUnit->SetValue( !m_parent->m_DrawSpecificUnit );
m_CommonConvert->SetValue( !m_parent->m_DrawSpecificConvert );
@ -103,8 +103,7 @@ bool DIALOG_LIB_EDIT_TEXT::TransferDataToWindow()
bool DIALOG_LIB_EDIT_TEXT::TransferDataFromWindow()
{
m_parent->g_LastTextAngle = m_orientChoice->GetSelection() ? TEXT_ANGLE_VERT
: TEXT_ANGLE_HORIZ;
m_parent->g_LastTextSize = m_textSize.GetValue();
: TEXT_ANGLE_HORIZ;
m_parent->m_DrawSpecificConvert = !m_CommonConvert->GetValue();
m_parent->m_DrawSpecificUnit = !m_CommonUnit->GetValue();
@ -116,7 +115,7 @@ bool DIALOG_LIB_EDIT_TEXT::TransferDataFromWindow()
m_graphicText->SetText( m_TextValue->GetValue() );
m_graphicText->SetPosition( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) );
m_graphicText->SetTextSize( wxSize( m_parent->g_LastTextSize, m_parent->g_LastTextSize ) );
m_graphicText->SetTextSize( wxSize( m_textSize.GetValue(), m_textSize.GetValue() ) );
m_graphicText->SetTextAngle( m_parent->g_LastTextAngle );
if( m_parent->m_DrawSpecificUnit )

View File

@ -135,7 +135,7 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
// Set the default line width (pen width which should be used for
// items that do not have a pen size defined (like frame ref)
m_defaultLineWidth.SetValue( GetDefaultLineThickness() );
m_defaultLineWidth.SetValue( m_parent->GetDefaultLineWidth() );
// Initialize HPGL specific widgets
m_penWidth.SetValue( m_HPGLPenSize );
@ -270,7 +270,7 @@ void DIALOG_PLOT_SCHEMATIC::OnUpdateUI( wxUpdateUIEvent& event )
}
void DIALOG_PLOT_SCHEMATIC::getPlotOptions()
void DIALOG_PLOT_SCHEMATIC::getPlotOptions( int* aDefaultLineWidth )
{
m_HPGLPenSize = m_penWidth.GetValue();
@ -292,7 +292,7 @@ void DIALOG_PLOT_SCHEMATIC::getPlotOptions()
cfg->m_PlotPanel.hpgl_pen_size = m_HPGLPenSize / IU_PER_MM;
}
SetDefaultLineThickness( m_defaultLineWidth.GetValue() );
*aDefaultLineWidth = (int) m_defaultLineWidth.GetValue();
// Plot directory
wxString path = m_outputDirectoryName->GetValue();
@ -319,22 +319,24 @@ void DIALOG_PLOT_SCHEMATIC::OnPlotAll( wxCommandEvent& event )
void DIALOG_PLOT_SCHEMATIC::PlotSchematic( bool aPlotAll )
{
getPlotOptions();
int defaultLineWidth;
getPlotOptions( &defaultLineWidth );
switch( GetPlotFileFormat() )
{
default:
case PLOT_FORMAT::POST:
createPSFile( aPlotAll, getPlotFrameRef() );
createPSFile( aPlotAll, getPlotFrameRef(), defaultLineWidth );
break;
case PLOT_FORMAT::DXF:
CreateDXFFile( aPlotAll, getPlotFrameRef() );
break;
case PLOT_FORMAT::PDF:
createPDFFile( aPlotAll, getPlotFrameRef() );
createPDFFile( aPlotAll, getPlotFrameRef(), defaultLineWidth );
break;
case PLOT_FORMAT::SVG:
createSVGFile( aPlotAll, getPlotFrameRef() );
createSVGFile( aPlotAll, getPlotFrameRef(), defaultLineWidth );
break;
case PLOT_FORMAT::HPGL:
createHPGLFile( aPlotAll, getPlotFrameRef() );

View File

@ -72,7 +72,7 @@ private:
void initDlg();
// common
void getPlotOptions();
void getPlotOptions( int* aDefaultLineWidth );
bool getModeColor()
{ return m_ModeColorOption->GetSelection() == 0; }
@ -93,7 +93,7 @@ private:
void PlotSchematic( bool aPlotAll );
// PDF
void createPDFFile( bool aPlotAll, bool aPlotFrameRef );
void createPDFFile( bool aPlotAll, bool aPlotFrameRef, int aDefaultLineWidth );
void plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, bool aPlotFrameRef);
void setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen );
@ -127,13 +127,13 @@ private:
wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
// PS
void createPSFile( bool aPlotAll, bool aPlotFrameRef );
bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
const PAGE_INFO& aPageInfo,
wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
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 );
// SVG
void createSVGFile( bool aPlotAll, bool aPlotFrameRef );
void createSVGFile( bool aPlotAll, bool aPlotFrameRef, int aDefaultLineWidth );
/**
* Create a file name with an absolute path name
@ -153,8 +153,7 @@ public:
// This function is static because it is called by libedit
// outside a dialog. This is the reason we need aFrame as parameter
static bool plotOneSheetSVG( EDA_DRAW_FRAME* aFrame, const wxString& aFileName,
SCH_SCREEN* aScreen,
SCH_SCREEN* aScreen, int aDefaultLineWidth,
bool aPlotBlackAndWhite, bool aPlotFrameRef,
bool aPlotBackgroundColor = false,
COLOR_SETTINGS* aColors = nullptr );
bool aPlotBackgroundColor, COLOR_SETTINGS* aColors );
};

View File

@ -426,7 +426,7 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
if( printReference )
{
m_parent->PrintWorkSheet( dc, aScreen, GetDefaultLineThickness(), IU_PER_MILS,
m_parent->PrintWorkSheet( dc, aScreen, m_parent->GetDefaultLineWidth(), IU_PER_MILS,
aScreen->GetFileName(), wxEmptyString,
m_parent->GetLayerColor( LAYER_SCHEMATIC_WORKSHEET ) );
}

View File

@ -187,9 +187,9 @@ bool PANEL_EESCHEMA_COLOR_SETTINGS::saveCurrentTheme()
COLOR4D color;
if( layer == LAYER_SHEET )
color = GetDefaultSheetBorderColor();
color = m_frame->GetDefaultSheetBorderColor();
else if( layer == LAYER_SHEET_BACKGROUND )
color = GetDefaultSheetBackgroundColor();
color = m_frame->GetDefaultSheetBackgroundColor();
else
color = m_currentSettings->GetColor( layer );

View File

@ -23,7 +23,6 @@
*/
#include <fctsys.h>
#include <base_screen.h>
#include <sch_edit_frame.h>
#include <settings/settings_manager.h>
#include <settings/color_settings.h>
@ -34,7 +33,10 @@
PANEL_EESCHEMA_SETTINGS::PANEL_EESCHEMA_SETTINGS( SCH_EDIT_FRAME* aFrame, wxWindow* aWindow ) :
PANEL_EESCHEMA_SETTINGS_BASE( aWindow ),
m_frame( aFrame )
m_frame( aFrame ),
m_defaultTextSize( aFrame, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true ),
m_hPitch( aFrame, m_hPitchLabel, m_hPitchCtrl, m_hPitchUnits, true ),
m_vPitch( aFrame, m_vPitchLabel, m_vPitchCtrl, m_vPitchUnits, true )
{}
@ -42,22 +44,19 @@ bool PANEL_EESCHEMA_SETTINGS::TransferDataToWindow()
{
m_choiceUnits->SetSelection( m_frame->GetUserUnits() == EDA_UNITS::INCHES ? 0 : 1 );
m_textSizeCtrl->SetValue(
StringFromValue( EDA_UNITS::INCHES, GetDefaultTextSize(), false, true ) );
m_hPitchCtrl->SetValue(
StringFromValue( EDA_UNITS::INCHES, m_frame->GetRepeatStep().x, false, true ) );
m_vPitchCtrl->SetValue(
StringFromValue( EDA_UNITS::INCHES, m_frame->GetRepeatStep().y, false, true ) );
m_defaultTextSize.SetValue( m_frame->GetDefaultTextSize() );
m_hPitch.SetValue( m_frame->GetRepeatStep().x );
m_vPitch.SetValue( m_frame->GetRepeatStep().y );
m_spinLabelRepeatStep->SetValue( m_frame->GetRepeatDeltaLabel() );
COLOR_SETTINGS* settings = m_frame->GetColorSettings();
COLOR4D schematicBackground = settings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
m_borderColorSwatch->SetSwatchBackground( schematicBackground );
m_borderColorSwatch->SetSwatchColor( GetDefaultSheetBorderColor(), false );
m_borderColorSwatch->SetSwatchColor( m_frame->GetDefaultSheetBorderColor(), false );
m_backgroundColorSwatch->SetSwatchBackground( schematicBackground );
m_backgroundColorSwatch->SetSwatchColor( GetDefaultSheetBackgroundColor(), false );
m_backgroundColorSwatch->SetSwatchColor( m_frame->GetDefaultSheetBackgroundColor(), false );
m_checkHVOrientation->SetValue( m_frame->GetForceHVLines() );
m_footprintPreview->SetValue( m_frame->GetShowFootprintPreviews() );
@ -77,23 +76,15 @@ bool PANEL_EESCHEMA_SETTINGS::TransferDataToWindow()
bool PANEL_EESCHEMA_SETTINGS::TransferDataFromWindow()
{
m_frame->SetUserUnits(
m_choiceUnits->GetSelection() == 0 ? EDA_UNITS::INCHES : EDA_UNITS::MILLIMETRES );
m_frame->SetUserUnits( m_choiceUnits->GetSelection() == 0 ? EDA_UNITS::INCHES
: EDA_UNITS::MILLIMETRES );
int textSize = (int) ValueFromString( EDA_UNITS::INCHES, m_textSizeCtrl->GetValue(), true );
m_frame->SetDefaultTextSize( (int) m_defaultTextSize.GetValue() );
if( textSize != GetDefaultTextSize() )
{
SetDefaultTextSize( textSize );
m_frame->SaveProjectSettings();
}
m_frame->SetDefaultSheetBorderColor( m_borderColorSwatch->GetSwatchColor() );
m_frame->SetDefaultSheetBackgroundColor( m_backgroundColorSwatch->GetSwatchColor() );
SetDefaultSheetBorderColor( m_borderColorSwatch->GetSwatchColor() );
SetDefaultSheetBackgroundColor( m_backgroundColorSwatch->GetSwatchColor() );
m_frame->SetRepeatStep(
wxPoint( (int) ValueFromString( EDA_UNITS::INCHES, m_hPitchCtrl->GetValue(), true ),
(int) ValueFromString( EDA_UNITS::INCHES, m_vPitchCtrl->GetValue(), true ) ) );
m_frame->SetRepeatStep( wxPoint( (int) m_hPitch.GetValue(), (int) m_vPitch.GetValue() ) );
m_frame->SetRepeatDeltaLabel( m_spinLabelRepeatStep->GetValue() );
m_frame->SetForceHVLines( m_checkHVOrientation->GetValue() );
@ -108,6 +99,8 @@ bool PANEL_EESCHEMA_SETTINGS::TransferDataFromWindow()
m_frame->SetSelectPinSelectSymbol( m_cbPinSelectionOpt->GetValue() );
m_frame->SaveProjectSettings();
return true;
}

View File

@ -20,6 +20,7 @@
#ifndef KICAD_PANEL_EESCHEMA_SETTINGS_H
#define KICAD_PANEL_EESCHEMA_SETTINGS_H
#include <widgets/unit_binder.h>
#include "panel_eeschema_settings_base.h"
class SCH_EDIT_FRAME;
@ -27,7 +28,11 @@ class SCH_EDIT_FRAME;
class PANEL_EESCHEMA_SETTINGS : public PANEL_EESCHEMA_SETTINGS_BASE
{
SCH_EDIT_FRAME* m_frame;
SCH_EDIT_FRAME* m_frame;
UNIT_BINDER m_defaultTextSize;
UNIT_BINDER m_hPitch;
UNIT_BINDER m_vPitch;
public:
PANEL_EESCHEMA_SETTINGS( SCH_EDIT_FRAME* aFrame, wxWindow* aWindow );

View File

@ -43,6 +43,14 @@ PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::PANEL_EESCHEMA_TEMPLATE_FIELDNAMES( SCH_EDIT
msg.Printf( m_title->GetLabel(), aGlobal ? _( "Global" ) : _( "Project" ) );
m_title->SetLabel( msg );
// Yep, it's a hack. I haven't a clue why the global and project versions don't lay
// out the same.
if( !aGlobal )
{
m_leftMargin->PrependSpacer( 10 );
m_topMargin->PrependSpacer( 10 );
}
m_addFieldButton->SetBitmap( KiBitmap( small_plus_xpm ) );
m_deleteFieldButton->SetBitmap( KiBitmap( trash_xpm ) );

View File

@ -16,12 +16,13 @@ PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE::PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE
wxBoxSizer* bPanelSizer;
bPanelSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxVERTICAL );
m_leftMargin = new wxBoxSizer( wxHORIZONTAL );
m_topMargin = new wxBoxSizer( wxVERTICAL );
m_title = new wxStaticText( this, wxID_ANY, _("%s field name templates:"), wxDefaultPosition, wxDefaultSize, 0 );
m_title->Wrap( -1 );
bSizer4->Add( m_title, 0, wxTOP|wxBOTTOM, 5 );
m_topMargin->Add( m_title, 0, wxTOP|wxBOTTOM, 5 );
m_grid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
@ -55,7 +56,7 @@ PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE::PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE
m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_grid->SetMinSize( wxSize( -1,180 ) );
bSizer4->Add( m_grid, 1, wxEXPAND, 10 );
m_topMargin->Add( m_grid, 1, wxEXPAND, 10 );
wxBoxSizer* bSizer10;
bSizer10 = new wxBoxSizer( wxHORIZONTAL );
@ -74,10 +75,13 @@ PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE::PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE
bSizer10->Add( m_deleteFieldButton, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
bSizer4->Add( bSizer10, 0, wxEXPAND, 10 );
m_topMargin->Add( bSizer10, 0, wxEXPAND, 10 );
bPanelSizer->Add( bSizer4, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 );
m_leftMargin->Add( m_topMargin, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 );
bPanelSizer->Add( m_leftMargin, 1, wxEXPAND, 5 );
this->SetSizer( bPanelSizer );

View File

@ -55,178 +55,28 @@
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer4</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<property name="name">m_leftMargin</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">%s field name templates:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_title</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">10</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxGrid" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="autosize_cols">0</property>
<property name="autosize_rows">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="cell_bg"></property>
<property name="cell_font"></property>
<property name="cell_horiz_alignment">wxALIGN_LEFT</property>
<property name="cell_text"></property>
<property name="cell_vert_alignment">wxALIGN_TOP</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
<property name="col_label_size">22</property>
<property name="col_label_values">&quot;Name&quot; &quot;Visible&quot; &quot;URL&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">3</property>
<property name="column_sizes">300,60,60</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_col_move">0</property>
<property name="drag_col_size">1</property>
<property name="drag_grid_size">0</property>
<property name="drag_row_size">1</property>
<property name="editing">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="grid_line_color"></property>
<property name="grid_lines">1</property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label_bg"></property>
<property name="label_font"></property>
<property name="label_text"></property>
<property name="margin_height">0</property>
<property name="margin_width">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size">-1,-1</property>
<property name="minimize_button">0</property>
<property name="minimum_size">-1,180</property>
<property name="moveable">1</property>
<property name="name">m_grid</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="row_label_horiz_alignment">wxALIGN_CENTER</property>
<property name="row_label_size">0</property>
<property name="row_label_values"></property>
<property name="row_label_vert_alignment">wxALIGN_CENTER</property>
<property name="row_sizes"></property>
<property name="rows">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">WX_GRID; widgets/wx_grid.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnSize">OnSizeGrid</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer10</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<property name="name">m_topMargin</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT</property>
<property name="flag">wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -237,79 +87,57 @@
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Add Field</property>
<property name="margins"></property>
<property name="label">%s field name templates:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">29,29</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_addFieldButton</property>
<property name="name">m_title</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnAddButtonClick</event>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">10</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxGrid" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -318,64 +146,247 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="autosize_cols">0</property>
<property name="autosize_rows">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="cell_bg"></property>
<property name="cell_font"></property>
<property name="cell_horiz_alignment">wxALIGN_LEFT</property>
<property name="cell_text"></property>
<property name="cell_vert_alignment">wxALIGN_TOP</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="col_label_horiz_alignment">wxALIGN_CENTER</property>
<property name="col_label_size">22</property>
<property name="col_label_values">&quot;Name&quot; &quot;Visible&quot; &quot;URL&quot;</property>
<property name="col_label_vert_alignment">wxALIGN_CENTER</property>
<property name="cols">3</property>
<property name="column_sizes">300,60,60</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_col_move">0</property>
<property name="drag_col_size">1</property>
<property name="drag_grid_size">0</property>
<property name="drag_row_size">1</property>
<property name="editing">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="grid_line_color"></property>
<property name="grid_lines">1</property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Delete Field</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="label_bg"></property>
<property name="label_font"></property>
<property name="label_text"></property>
<property name="margin_height">0</property>
<property name="margin_width">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="min_size">-1,-1</property>
<property name="minimize_button">0</property>
<property name="minimum_size">29,29</property>
<property name="minimum_size">-1,180</property>
<property name="moveable">1</property>
<property name="name">m_deleteFieldButton</property>
<property name="name">m_grid</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="row_label_horiz_alignment">wxALIGN_CENTER</property>
<property name="row_label_size">0</property>
<property name="row_label_values"></property>
<property name="row_label_vert_alignment">wxALIGN_CENTER</property>
<property name="row_sizes"></property>
<property name="rows">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="subclass">WX_GRID; widgets/wx_grid.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnDeleteButtonClick</event>
<event name="OnSize">OnSizeGrid</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer10</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Add Field</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">29,29</property>
<property name="moveable">1</property>
<property name="name">m_addFieldButton</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnAddButtonClick</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="current"></property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="disabled"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="focus"></property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Delete Field</property>
<property name="margins"></property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">29,29</property>
<property name="moveable">1</property>
<property name="name">m_deleteFieldButton</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="pressed"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnDeleteButtonClick</event>
</object>
</object>
</object>
</object>
</object>

View File

@ -37,6 +37,8 @@ class PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE : public wxPanel
private:
protected:
wxBoxSizer* m_leftMargin;
wxBoxSizer* m_topMargin;
wxStaticText* m_title;
WX_GRID* m_grid;
wxBitmapButton* m_addFieldButton;

View File

@ -23,9 +23,7 @@
*/
#include <fctsys.h>
#include <base_screen.h>
#include <lib_edit_frame.h>
#include <sch_view.h>
#include <sch_painter.h>
#include "panel_libedit_settings.h"
@ -33,24 +31,26 @@
PANEL_LIBEDIT_SETTINGS::PANEL_LIBEDIT_SETTINGS( LIB_EDIT_FRAME* aFrame, wxWindow* aWindow ) :
PANEL_LIBEDIT_SETTINGS_BASE( aWindow ),
m_frame( aFrame )
m_frame( aFrame ),
m_lineWidth( aFrame, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits, true ),
m_textSize( aFrame, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true ),
m_pinLength( aFrame, m_pinLengthLabel, m_pinLengthCtrl, m_pinLengthUnits, true ),
m_pinNameSize( aFrame, m_pinNameSizeLabel, m_pinNameSizeCtrl, m_pinNameSizeUnits, true ),
m_pinNumberSize( aFrame, m_pinNumSizeLabel, m_pinNumSizeCtrl, m_pinNumSizeUnits, true ),
m_hPitch( aFrame, m_hPitchLabel, m_hPitchCtrl, m_hPitchUnits, true ),
m_vPitch( aFrame, m_vPitchLabel, m_vPitchCtrl, m_vPitchUnits, true )
{}
bool PANEL_LIBEDIT_SETTINGS::TransferDataToWindow()
{
m_lineWidthCtrl->SetValue(
StringFromValue( EDA_UNITS::INCHES, GetDefaultLineThickness(), false, true ) );
m_pinLengthCtrl->SetValue(
StringFromValue( EDA_UNITS::INCHES, m_frame->GetDefaultPinLength(), false, true ) );
m_pinNumSizeCtrl->SetValue(
StringFromValue( EDA_UNITS::INCHES, m_frame->GetPinNumDefaultSize(), false, true ) );
m_pinNameSizeCtrl->SetValue(
StringFromValue( EDA_UNITS::INCHES, m_frame->GetPinNameDefaultSize(), false, true ) );
m_hPitchCtrl->SetValue(
StringFromValue( EDA_UNITS::INCHES, m_frame->GetRepeatStep().x, false, true ) );
m_vPitchCtrl->SetValue(
StringFromValue( EDA_UNITS::INCHES, m_frame->GetRepeatStep().y, false, true ) );
m_lineWidth.SetValue( m_frame->GetDefaultLineWidth() );
m_textSize.SetValue( m_frame->GetDefaultTextSize() );
m_pinLength.SetValue( m_frame->GetDefaultPinLength() );
m_pinNumberSize.SetValue( m_frame->GetPinNumDefaultSize() );
m_pinNameSize.SetValue( m_frame->GetPinNameDefaultSize() );
m_hPitch.SetValue( m_frame->GetRepeatStep().x );
m_vPitch.SetValue( m_frame->GetRepeatStep().y );
m_choicePinDisplacement->SetSelection( m_frame->GetRepeatPinStep() == Iu2Mils( 50 ) ? 1 : 0 );
m_spinRepeatLabel->SetValue( m_frame->GetRepeatDeltaLabel() );
@ -62,19 +62,14 @@ bool PANEL_LIBEDIT_SETTINGS::TransferDataToWindow()
bool PANEL_LIBEDIT_SETTINGS::TransferDataFromWindow()
{
SetDefaultLineThickness(
ValueFromString( EDA_UNITS::INCHES, m_lineWidthCtrl->GetValue(), true ) );
m_frame->SetDefaultPinLength(
ValueFromString( EDA_UNITS::INCHES, m_pinLengthCtrl->GetValue(), true ) );
m_frame->SetPinNumDefaultSize(
ValueFromString( EDA_UNITS::INCHES, m_pinNumSizeCtrl->GetValue(), true ) );
m_frame->SetPinNameDefaultSize(
ValueFromString( EDA_UNITS::INCHES, m_pinNameSizeCtrl->GetValue(), true ) );
m_frame->SetRepeatStep(
wxPoint( ValueFromString( EDA_UNITS::INCHES, m_hPitchCtrl->GetValue(), true ),
ValueFromString( EDA_UNITS::INCHES, m_vPitchCtrl->GetValue(), true ) ) );
m_frame->SetRepeatPinStep( m_choicePinDisplacement->GetSelection() == 1 ?
Mils2iu( 50 ) : Mils2iu( 100 ) );
m_frame->SetDefaultLineWidth( (int) m_lineWidth.GetValue() );
m_frame->SetDefaultTextSize( (int) m_textSize.GetValue() );
m_frame->SetDefaultPinLength( (int) m_pinLength.GetValue() );
m_frame->SetPinNumDefaultSize( (int) m_pinNumberSize.GetValue() );
m_frame->SetPinNameDefaultSize( (int) m_pinNameSize.GetValue() );
m_frame->SetRepeatStep( wxPoint( (int) m_hPitch.GetValue(), (int) m_vPitch.GetValue() ) );
m_frame->SetRepeatPinStep( m_choicePinDisplacement->GetSelection() == 1 ? Mils2iu( 50 )
: Mils2iu( 100 ) );
m_frame->SetRepeatDeltaLabel( m_spinRepeatLabel->GetValue() );
m_frame->SetShowElectricalType( m_checkShowPinElectricalType->GetValue() );

View File

@ -20,6 +20,7 @@
#ifndef PANEL_LIBEDIT_SETTINGS_H
#define PANEL_LIBEDIT_SETTINGS_H
#include <widgets/unit_binder.h>
#include "panel_libedit_settings_base.h"
class LIB_EDIT_FRAME;
@ -27,7 +28,17 @@ class LIB_EDIT_FRAME;
class PANEL_LIBEDIT_SETTINGS : public PANEL_LIBEDIT_SETTINGS_BASE
{
LIB_EDIT_FRAME* m_frame;
LIB_EDIT_FRAME* m_frame;
UNIT_BINDER m_lineWidth;
UNIT_BINDER m_textSize;
UNIT_BINDER m_pinLength;
UNIT_BINDER m_pinNameSize;
UNIT_BINDER m_pinNumberSize;
UNIT_BINDER m_hPitch;
UNIT_BINDER m_vPitch;
public:
PANEL_LIBEDIT_SETTINGS( LIB_EDIT_FRAME* aFrame, wxWindow* aWindow );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -9,35 +9,47 @@
///////////////////////////////////////////////////////////////////////////
PANEL_LIBEDIT_SETTINGS_BASE::PANEL_LIBEDIT_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
PANEL_LIBEDIT_SETTINGS_BASE::PANEL_LIBEDIT_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
{
wxBoxSizer* p1mainSizer;
p1mainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bLeftColumn;
bLeftColumn = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* leftColumn;
leftColumn = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* defaults;
defaults = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Defaults for New Objects") ), wxVERTICAL );
wxFlexGridSizer* fgSizer;
fgSizer = new wxFlexGridSizer( 0, 3, 3, 0 );
fgSizer->AddGrowableCol( 0 );
fgSizer->AddGrowableCol( 1 );
fgSizer->AddGrowableCol( 2 );
fgSizer->SetFlexibleDirection( wxBOTH );
fgSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_lineWidthLabel = new wxStaticText( this, wxID_ANY, _("&Default line width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineWidthLabel = new wxStaticText( defaults->GetStaticBox(), wxID_ANY, _("&Default line width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineWidthLabel->Wrap( -1 );
fgSizer->Add( m_lineWidthLabel, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_lineWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP );
fgSizer->Add( m_lineWidthCtrl, 0, wxALL|wxEXPAND, 5 );
m_lineWidthCtrl = new wxTextCtrl( defaults->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP );
fgSizer->Add( m_lineWidthCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_lineWidthUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineWidthUnits = new wxStaticText( defaults->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineWidthUnits->Wrap( -1 );
fgSizer->Add( m_lineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 );
m_textSizeLabel = new wxStaticText( defaults->GetStaticBox(), wxID_ANY, _("Default text size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textSizeLabel->Wrap( -1 );
fgSizer->Add( m_textSizeLabel, 1, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
fgSizer->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 10 );
m_textSizeCtrl = new wxTextCtrl( defaults->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer->Add( m_textSizeCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_textSizeUnits = new wxStaticText( defaults->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_textSizeUnits->Wrap( -1 );
fgSizer->Add( m_textSizeUnits, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
fgSizer->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
fgSizer->Add( 0, 0, 1, wxEXPAND, 5 );
@ -45,108 +57,114 @@ PANEL_LIBEDIT_SETTINGS_BASE::PANEL_LIBEDIT_SETTINGS_BASE( wxWindow* parent, wxWi
fgSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_pinLengthLabel = new wxStaticText( this, wxID_ANY, _("D&efault pin length:"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinLengthLabel = new wxStaticText( defaults->GetStaticBox(), wxID_ANY, _("D&efault pin length:"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinLengthLabel->Wrap( -1 );
fgSizer->Add( m_pinLengthLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
m_pinLengthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP );
m_pinLengthCtrl = new wxTextCtrl( defaults->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP );
fgSizer->Add( m_pinLengthCtrl, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_pinLengthUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinLengthUnits = new wxStaticText( defaults->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinLengthUnits->Wrap( -1 );
fgSizer->Add( m_pinLengthUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 3 );
m_pinNumSizeLabel = new wxStaticText( this, wxID_ANY, _("De&fault pin number size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinNumSizeLabel = new wxStaticText( defaults->GetStaticBox(), wxID_ANY, _("De&fault pin number size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinNumSizeLabel->Wrap( -1 );
fgSizer->Add( m_pinNumSizeLabel, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_pinNumSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP );
m_pinNumSizeCtrl = new wxTextCtrl( defaults->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP );
fgSizer->Add( m_pinNumSizeCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_pinNumSizeUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinNumSizeUnits = new wxStaticText( defaults->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinNumSizeUnits->Wrap( -1 );
fgSizer->Add( m_pinNumSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 );
m_pinNameSizeLabel = new wxStaticText( this, wxID_ANY, _("Def&ault pin name size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinNameSizeLabel = new wxStaticText( defaults->GetStaticBox(), wxID_ANY, _("Def&ault pin name size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinNameSizeLabel->Wrap( -1 );
fgSizer->Add( m_pinNameSizeLabel, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_pinNameSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP );
m_pinNameSizeCtrl = new wxTextCtrl( defaults->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP );
fgSizer->Add( m_pinNameSizeCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_pinNameSizeUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinNameSizeUnits = new wxStaticText( defaults->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinNameSizeUnits->Wrap( -1 );
fgSizer->Add( m_pinNameSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 );
m_checkShowPinElectricalType = new wxCheckBox( this, wxID_ANY, _("Show pin &electrical type"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer->Add( m_checkShowPinElectricalType, 0, wxTOP|wxBOTTOM|wxRIGHT, 3 );
defaults->Add( fgSizer, 0, wxBOTTOM|wxEXPAND, 5 );
m_checkShowPinElectricalType = new wxCheckBox( defaults->GetStaticBox(), wxID_ANY, _("Show pin &electrical type"), wxDefaultPosition, wxDefaultSize, 0 );
defaults->Add( m_checkShowPinElectricalType, 0, wxBOTTOM, 5 );
fgSizer->Add( 0, 0, 1, wxEXPAND, 5 );
leftColumn->Add( defaults, 0, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* repeats;
repeats = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Repeated Items") ), wxVERTICAL );
fgSizer->Add( 0, 0, 1, wxEXPAND, 5 );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 3, 3, 0 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
fgSizer->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 10 );
fgSizer->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_hPitchLabel = new wxStaticText( this, wxID_ANY, _("&Horizontal pitch of repeated items:"), wxDefaultPosition, wxDefaultSize, 0 );
m_hPitchLabel = new wxStaticText( repeats->GetStaticBox(), wxID_ANY, _("&Horizontal pitch:"), wxDefaultPosition, wxDefaultSize, 0 );
m_hPitchLabel->Wrap( -1 );
fgSizer->Add( m_hPitchLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
fgSizer1->Add( m_hPitchLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
m_hPitchCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS );
fgSizer->Add( m_hPitchCtrl, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_hPitchCtrl = new wxTextCtrl( repeats->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS );
fgSizer1->Add( m_hPitchCtrl, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_hPitchUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_hPitchUnits = new wxStaticText( repeats->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_hPitchUnits->Wrap( -1 );
fgSizer->Add( m_hPitchUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
fgSizer1->Add( m_hPitchUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
m_vPitchLabel = new wxStaticText( this, wxID_ANY, _("&Vertical pitch of repeated items:"), wxDefaultPosition, wxDefaultSize, 0 );
m_vPitchLabel = new wxStaticText( repeats->GetStaticBox(), wxID_ANY, _("&Vertical pitch:"), wxDefaultPosition, wxDefaultSize, 0 );
m_vPitchLabel->Wrap( -1 );
fgSizer->Add( m_vPitchLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
fgSizer1->Add( m_vPitchLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_vPitchCtrl = new wxTextCtrl( this, wxID_ANY, _("100"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS );
fgSizer->Add( m_vPitchCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_vPitchCtrl = new wxTextCtrl( repeats->GetStaticBox(), wxID_ANY, _("100"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS );
fgSizer1->Add( m_vPitchCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_vPitchUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_vPitchUnits = new wxStaticText( repeats->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_vPitchUnits->Wrap( -1 );
fgSizer->Add( m_vPitchUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
fgSizer1->Add( m_vPitchUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_pinPitchLabel = new wxStaticText( this, wxID_ANY, _("&Pitch of repeated pins:"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinPitchLabel = new wxStaticText( repeats->GetStaticBox(), wxID_ANY, _("&Pitch of repeated pins:"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinPitchLabel->Wrap( -1 );
fgSizer->Add( m_pinPitchLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
fgSizer1->Add( m_pinPitchLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
wxString m_choicePinDisplacementChoices[] = { _("100"), _("50") };
int m_choicePinDisplacementNChoices = sizeof( m_choicePinDisplacementChoices ) / sizeof( wxString );
m_choicePinDisplacement = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choicePinDisplacementNChoices, m_choicePinDisplacementChoices, 0 );
m_choicePinDisplacement = new wxChoice( repeats->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choicePinDisplacementNChoices, m_choicePinDisplacementChoices, 0 );
m_choicePinDisplacement->SetSelection( 0 );
fgSizer->Add( m_choicePinDisplacement, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
fgSizer1->Add( m_choicePinDisplacement, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_pinPitchUnis = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinPitchUnis->Wrap( -1 );
fgSizer->Add( m_pinPitchUnis, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_pinPitchUnits = new wxStaticText( repeats->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_pinPitchUnits->Wrap( -1 );
fgSizer1->Add( m_pinPitchUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_labelIncrementLabel = new wxStaticText( this, wxID_ANY, _("&Increment of repeated labels:"), wxDefaultPosition, wxDefaultSize, 0 );
m_labelIncrementLabel->Wrap( -1 );
fgSizer->Add( m_labelIncrementLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_labelIncrementLabel1 = new wxStaticText( repeats->GetStaticBox(), wxID_ANY, _("Label increment:"), wxDefaultPosition, wxDefaultSize, 0 );
m_labelIncrementLabel1->Wrap( -1 );
fgSizer1->Add( m_labelIncrementLabel1, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_spinRepeatLabel = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, -10, 10, 1 );
fgSizer->Add( m_spinRepeatLabel, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_spinRepeatLabel = new wxSpinCtrl( repeats->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, -10, 10, 1 );
fgSizer1->Add( m_spinRepeatLabel, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fgSizer->Add( 0, 0, 0, 0, 5 );
fgSizer1->Add( 0, 0, 0, 0, 5 );
bLeftColumn->Add( fgSizer, 0, wxALL, 5 );
repeats->Add( fgSizer1, 1, wxEXPAND, 5 );
p1mainSizer->Add( bLeftColumn, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
leftColumn->Add( repeats, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
p1mainSizer->Add( leftColumn, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
p1mainSizer->Add( 0, 0, 1, wxEXPAND, 5 );
this->SetSizer( p1mainSizer );

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,11 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __PANEL_LIBEDIT_SETTINGS_BASE_H__
#define __PANEL_LIBEDIT_SETTINGS_BASE_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@ -18,10 +17,11 @@
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/statbox.h>
#include <wx/choice.h>
#include <wx/spinctrl.h>
#include <wx/sizer.h>
#include <wx/panel.h>
///////////////////////////////////////////////////////////////////////////
@ -38,6 +38,9 @@ class PANEL_LIBEDIT_SETTINGS_BASE : public wxPanel
wxStaticText* m_lineWidthLabel;
wxTextCtrl* m_lineWidthCtrl;
wxStaticText* m_lineWidthUnits;
wxStaticText* m_textSizeLabel;
wxTextCtrl* m_textSizeCtrl;
wxStaticText* m_textSizeUnits;
wxStaticText* m_pinLengthLabel;
wxTextCtrl* m_pinLengthCtrl;
wxStaticText* m_pinLengthUnits;
@ -56,15 +59,14 @@ class PANEL_LIBEDIT_SETTINGS_BASE : public wxPanel
wxStaticText* m_vPitchUnits;
wxStaticText* m_pinPitchLabel;
wxChoice* m_choicePinDisplacement;
wxStaticText* m_pinPitchUnis;
wxStaticText* m_labelIncrementLabel;
wxStaticText* m_pinPitchUnits;
wxStaticText* m_labelIncrementLabel1;
wxSpinCtrl* m_spinRepeatLabel;
public:
PANEL_LIBEDIT_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
PANEL_LIBEDIT_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_LIBEDIT_SETTINGS_BASE();
};
#endif //__PANEL_LIBEDIT_SETTINGS_BASE_H__

View File

@ -23,6 +23,7 @@
#include <fctsys.h>
#include <sch_edit_frame.h>
#include <sch_painter.h>
#include <class_libentry.h>
#include <panel_setup_formatting.h>
#include <sch_junction.h>
@ -32,6 +33,7 @@ PANEL_SETUP_FORMATTING::PANEL_SETUP_FORMATTING( wxWindow* aWindow, SCH_EDIT_FRAM
PANEL_SETUP_FORMATTING_BASE( aWindow ),
m_frame( aFrame ),
m_textSize( aFrame, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true ),
m_lineWidth( aFrame, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits, true ),
m_busWidth( aFrame, m_busWidthLabel, m_busWidthCtrl, m_busWidthUnits, true ),
m_wireWidth( aFrame, m_wireWidthLabel, m_wireWidthCtrl, m_wireWidthUnits, true ),
m_junctionSize( aFrame, m_jctSizeLabel, m_jctSizeCtrl, m_jctSizeUnits, true )
@ -59,13 +61,15 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow()
m_choiceSeparatorRefId->SetSelection( refStyleSelection );
m_textSize.SetUnits( EDA_UNITS::INCHES, true );
m_lineWidth.SetUnits( EDA_UNITS::INCHES, true );
m_busWidth.SetUnits( EDA_UNITS::INCHES, true );
m_wireWidth.SetUnits( EDA_UNITS::INCHES, true );
m_junctionSize.SetUnits( EDA_UNITS::INCHES, true );
m_textSize.SetValue( GetDefaultTextSize() );
m_busWidth.SetValue( GetDefaultBusThickness() );
m_wireWidth.SetValue( GetDefaultWireThickness() );
m_textSize.SetValue( m_frame->GetDefaultTextSize() );
m_lineWidth.SetValue( m_frame->GetDefaultLineWidth() );
m_busWidth.SetValue( m_frame->GetDefaultBusThickness() );
m_wireWidth.SetValue( m_frame->GetDefaultWireThickness() );
m_junctionSize.SetValue( SCH_JUNCTION::g_SymbolSize );
m_textOffsetRatioCtrl->SetValue( wxString::Format( "%f", GetTextOffsetRatio() * 100.0 ) );
@ -101,10 +105,12 @@ bool PANEL_SETUP_FORMATTING::TransferDataFromWindow()
m_frame->SaveProjectSettings();
}
SetDefaultTextSize( m_textSize.GetValue() );
SetDefaultBusThickness( m_busWidth.GetValue() );
SetDefaultWireThickness( m_wireWidth.GetValue() );
SCH_JUNCTION::g_SymbolSize = m_junctionSize.GetValue();
m_frame->SetDefaultTextSize( (int) m_textSize.GetValue() );
m_frame->SetDefaultLineWidth( (int) m_lineWidth.GetValue() );
m_frame->SetDefaultWireThickness( (int) m_wireWidth.GetValue() );
m_frame->SetDefaultBusThickness( (int) m_busWidth.GetValue() );
SCH_JUNCTION::g_SymbolSize = (int) m_junctionSize.GetValue();
double dtmp = 0.0;
wxString msg = m_textOffsetRatioCtrl->GetValue();

View File

@ -32,6 +32,7 @@ class PANEL_SETUP_FORMATTING : public PANEL_SETUP_FORMATTING_BASE
SCH_EDIT_FRAME* m_frame;
UNIT_BINDER m_textSize;
UNIT_BINDER m_lineWidth;
UNIT_BINDER m_busWidth;
UNIT_BINDER m_wireWidth;

View File

@ -87,6 +87,32 @@ PANEL_SETUP_FORMATTING_BASE::PANEL_SETUP_FORMATTING_BASE( wxWindow* parent, wxWi
bLeftColumn->Add( sbSizer4, 1, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizer41;
sbSizer41 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Symbols") ), wxVERTICAL );
wxFlexGridSizer* fgSizer321;
fgSizer321 = new wxFlexGridSizer( 0, 3, 5, 0 );
fgSizer321->AddGrowableCol( 1 );
fgSizer321->SetFlexibleDirection( wxBOTH );
fgSizer321->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_lineWidthLabel = new wxStaticText( sbSizer41->GetStaticBox(), wxID_ANY, _("Default line thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineWidthLabel->Wrap( -1 );
fgSizer321->Add( m_lineWidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_lineWidthCtrl = new wxTextCtrl( sbSizer41->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP );
fgSizer321->Add( m_lineWidthCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_lineWidthUnits = new wxStaticText( sbSizer41->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineWidthUnits->Wrap( -1 );
fgSizer321->Add( m_lineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
sbSizer41->Add( fgSizer321, 1, wxEXPAND|wxBOTTOM, 5 );
bLeftColumn->Add( sbSizer41, 0, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Connections") ), wxVERTICAL );
@ -130,7 +156,7 @@ PANEL_SETUP_FORMATTING_BASE::PANEL_SETUP_FORMATTING_BASE( wxWindow* parent, wxWi
fgSizer32->Add( m_jctSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
sbSizer2->Add( fgSizer32, 0, wxBOTTOM|wxRIGHT|wxEXPAND, 5 );
sbSizer2->Add( fgSizer32, 0, wxEXPAND|wxBOTTOM, 5 );
bLeftColumn->Add( sbSizer2, 0, wxEXPAND|wxALL, 5 );

View File

@ -742,6 +742,224 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Symbols</property>
<property name="minimum_size"></property>
<property name="name">sbSizer41</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size">-1,-1</property>
<property name="name">fgSizer321</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">5</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Default line thickness:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_lineWidthLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_lineWidthCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxSP_ARROW_KEYS|wxSP_WRAP</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">mils</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_lineWidthUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
@ -756,7 +974,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxEXPAND</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property>

View File

@ -43,6 +43,9 @@ class PANEL_SETUP_FORMATTING_BASE : public wxPanel
wxStaticText* m_offsetRatioUnits;
wxCheckBox* m_checkSuperSub;
wxStaticText* m_superSubHint;
wxStaticText* m_lineWidthLabel;
wxTextCtrl* m_lineWidthCtrl;
wxStaticText* m_lineWidthUnits;
wxStaticText* m_busWidthLabel;
wxTextCtrl* m_busWidthCtrl;
wxStaticText* m_busWidthUnits;

View File

@ -93,7 +93,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( int aType )
textItem->SetBold( lastTextBold );
textItem->SetItalic( lastTextItalic );
textItem->SetLabelSpinStyle( lastTextOrientation );
textItem->SetTextSize( wxSize( GetDefaultTextSize(), GetDefaultTextSize() ) );
textItem->SetTextSize( wxSize( m_defaultTextSize, m_defaultTextSize ) );
textItem->SetFlags( IS_NEW | IS_MOVED );
if( InvokeDialogLabelEditor( this, textItem ) != wxID_OK || textItem->GetText().IsEmpty() )

View File

@ -54,12 +54,6 @@
#include "erc.h"
static int s_defaultBusThickness = Mils2iu( DEFAULTBUSTHICKNESS );
static int s_defaultWireThickness = Mils2iu( DEFAULTDRAWLINETHICKNESS );
static int s_defaultTextSize = Mils2iu( DEFAULT_SIZE_TEXT );
static int s_drawDefaultLineThickness = -1;
static COLOR4D s_defaultSheetBorderColor = MAGENTA;
static COLOR4D s_defaultSheetBackgroundColor = WHITE;
static double s_textOffsetRatio = 0.08;
static bool s_selectTextAsBox = false;
static bool s_selectDrawChildren = true;
@ -229,78 +223,6 @@ void SetSeverity( int aErrorCode, int aSeverity )
}
int GetDefaultBusThickness()
{
return s_defaultBusThickness;
}
void SetDefaultBusThickness( int aThickness )
{
s_defaultBusThickness = std::max( 1, aThickness );
}
int GetDefaultWireThickness()
{
return s_defaultWireThickness;
}
void SetDefaultWireThickness( int aThickness )
{
s_defaultWireThickness = std::max( 1, aThickness );
}
int GetDefaultTextSize()
{
return s_defaultTextSize;
}
void SetDefaultTextSize( int aTextSize )
{
s_defaultTextSize = aTextSize;
}
int GetDefaultLineThickness()
{
return s_drawDefaultLineThickness;
}
COLOR4D GetDefaultSheetBorderColor()
{
return s_defaultSheetBorderColor;
}
void SetDefaultSheetBorderColor( COLOR4D aColor )
{
s_defaultSheetBorderColor = aColor;
}
COLOR4D GetDefaultSheetBackgroundColor()
{
return s_defaultSheetBackgroundColor;
}
void SetDefaultSheetBackgroundColor( COLOR4D aColor )
{
s_defaultSheetBackgroundColor = aColor;
}
void SetDefaultLineThickness( int aThickness )
{
s_drawDefaultLineThickness = std::max( 1, aThickness );
}
double GetTextOffsetRatio()
{
return s_textOffsetRatio;
@ -403,7 +325,7 @@ void SCH_EDIT_FRAME::AddFormattingParameters( std::vector<PARAM_CFG*>& params )
LIB_PART::SubpartFirstIdPtr(), 'A', '1', 'z' ) );
params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "LabSize" ),
&s_defaultTextSize,
&m_defaultTextSize,
Mils2iu( DEFAULT_SIZE_TEXT ),
5, 1000, nullptr, 1 / IU_PER_MILS ) );
params.push_back( new PARAM_CFG_DOUBLE( wxT( "TextOffsetRatio" ),
@ -411,16 +333,16 @@ void SCH_EDIT_FRAME::AddFormattingParameters( std::vector<PARAM_CFG*>& params )
(double) TXT_MARGIN / DEFAULT_SIZE_TEXT,
-200.0, 200.0 ) );
params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "LineThickness" ),
&s_drawDefaultLineThickness,
&m_defaultLineWidth,
Mils2iu( appSettings->m_Drawing.default_line_thickness ),
5, 1000, nullptr, 1 / IU_PER_MILS ) );
params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "BusThickness" ),
&s_defaultBusThickness,
&m_defaultBusThickness,
Mils2iu( appSettings->m_Drawing.default_bus_thickness ),
5, 1000, nullptr, 1 / IU_PER_MILS ) );
params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "WireThickness" ),
&s_defaultWireThickness,
&m_defaultWireThickness,
Mils2iu( appSettings->m_Drawing.default_wire_thickness ),
5, 1000, nullptr, 1 / IU_PER_MILS ) );
params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "JunctionSize" ),
@ -469,6 +391,10 @@ bool SCH_EDIT_FRAME::LoadProjectFile()
bool ret = Prj().ConfigLoad( Kiface().KifaceSearch(), GROUP_SCH_EDIT,
GetProjectFileParameters() );
GetRenderSettings()->m_DefaultLineWidth = m_defaultLineWidth;
GetRenderSettings()->m_DefaultWireThickness = m_defaultWireThickness;
GetRenderSettings()->m_DefaultBusThickness = m_defaultBusThickness;
// Verify some values, because the config file can be edited by hand,
// and have bad values:
LIB_PART::SetSubpartIdNotation( LIB_PART::GetSubpartIdSeparator(),
@ -642,7 +568,7 @@ void LIB_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
book->AddPage( new wxPanel( book ), _( "Symbol Editor" ) );
book->AddSubPage( new PANEL_DISPLAY_OPTIONS( this, aParent ), _( "Display Options" ) );
book->AddSubPage( new PANEL_LIBEDIT_SETTINGS( this, book ), _( "Defaults" ) );
book->AddSubPage( new PANEL_LIBEDIT_SETTINGS( this, book ), _( "Editing Options" ) );
book->AddSubPage( new PANEL_LIBEDIT_COLOR_SETTINGS( this, book ), _( "Color Options" ) );
aHotkeysPanel->AddHotKeys( GetToolManager() );

View File

@ -43,21 +43,8 @@ class ERC_SETTINGS;
#define DANGLING_SYMBOL_SIZE 12
#define DEFAULT_REPEAT_OFFSET_X 0 ///< the default X value (overwritten by the eeschema config)
#define DEFAULT_REPEAT_OFFSET_Y 100 ///< the default Y value (overwritten by the eeschema config)
#define DEFAULT_REPEAT_LABEL_INC 1 ///< the default value (overwritten by the eeschema config)
#define DEFAULT_REPEAT_OFFSET_PIN 100 ///< the default value (overwritten by the eeschema config)
///< when repeating a pin
#define TXT_MARGIN 4
///< The thickness to draw buses that do not have a specific width
///< (can be changed in preference menu)
#define DEFAULTBUSTHICKNESS 12
///< The thickness to draw lines that thickness is set to 0 (default thickness)
///< (can be changed in preference menu)
#define DEFAULTDRAWLINETHICKNESS 6
///< The default pin len value when creating pins(can be changed in preference menu)
#define DEFAULTPINLENGTH 100
@ -101,45 +88,12 @@ extern ERC_SETTINGS* g_ErcSettings;
int GetSeverity( int aErrorCode );
void SetSeverity( int aErrorCode, int aSeverity );
/**
* Default line thickness used to draw/plot items having a
* default thickness line value (i.e. = 0 ).
*/
int GetDefaultLineThickness();
void SetDefaultLineThickness( int aThickness );
/**
* Defaults for new sheets.
*/
COLOR4D GetDefaultSheetBorderColor();
void SetDefaultSheetBorderColor( COLOR4D aColor );
COLOR4D GetDefaultSheetBackgroundColor();
void SetDefaultSheetBackgroundColor( COLOR4D aColor );
/**
* Default size for text in general
*/
int GetDefaultTextSize();
void SetDefaultTextSize( int aSize );
/**
* Amount to offset text above/below wires & buses. Expressed as a ratio of the text size.
*/
double GetTextOffsetRatio();
void SetTextOffsetRatio( double aOffsetRatio );
/**
* Default line thickness used to draw/plot buses.
*/
int GetDefaultBusThickness();
void SetDefaultBusThickness( int aThickness );
/**
* Default line thickness used to draw/plot wires.
*/
int GetDefaultWireThickness();
void SetDefaultWireThickness( int aThickness );
/**
* Draw selected text items as box
*/

View File

@ -291,13 +291,7 @@ void LIB_ARC::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
int LIB_ARC::GetPenSize() const
{
if( m_Width > 0 )
return m_Width;
if( m_Width == 0 )
return GetDefaultLineThickness();
return -1; // a value to use a minimal pen size
return m_Width;
}

View File

@ -207,13 +207,7 @@ void LIB_BEZIER::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
int LIB_BEZIER::GetPenSize() const
{
if( m_Width > 0 )
return m_Width;
if( m_Width == 0 )
return GetDefaultLineThickness();
return -1; // a value to use a minimal pen size
return m_Width;
}

View File

@ -194,13 +194,7 @@ void LIB_CIRCLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
int LIB_CIRCLE::GetPenSize() const
{
if( m_Width > 0 )
return m_Width;
if( m_Width == 0 )
return GetDefaultLineThickness();
return -1; // a value to use a minimal pen size
m_Width;
}

View File

@ -86,9 +86,6 @@ void LIB_FIELD::Init( int id )
{
m_id = id;
SetTextWidth( GetDefaultTextSize() );
SetTextHeight( GetDefaultTextSize() );
SetTextAngle( TEXT_ANGLE_HORIZ ); // constructor already did this.
// Fields in RAM must always have names, because we are trying to get less dependent on
@ -106,16 +103,12 @@ int LIB_FIELD::GetPenSize() const
{
int pensize = GetThickness();
if( pensize == 0 ) // Use default values for pen size
{
if( IsBold() )
pensize = GetPenSizeForBold( GetTextWidth() );
else
pensize = GetDefaultLineThickness();
}
if( pensize == 0 && IsBold() )
pensize = GetPenSizeForBold( GetTextWidth() );
// Clip pen size for small texts:
pensize = Clamp_Text_PenSize( pensize, GetTextSize(), IsBold() );
return pensize;
}

View File

@ -536,13 +536,7 @@ bool LIB_PIN::HitTest( const wxPoint& aPosition, int aAccuracy ) const
int LIB_PIN::GetPenSize() const
{
if( m_width > 0 )
return m_width;
if( m_width == 0 )
return GetDefaultLineThickness();
return 0;
return m_width;
}
@ -688,10 +682,8 @@ void LIB_PIN::PrintPinTexts( wxDC* DC, wxPoint& pin_pos, int orient, int TextIns
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 + GetDefaultLineThickness() ) / 2;
int num_offset = Mils2iu( PIN_TEXT_MARGIN ) +
( numLineWidth + GetDefaultLineThickness() ) / 2;
int name_offset = Mils2iu( PIN_TEXT_MARGIN ) + nameLineWidth;
int num_offset = Mils2iu( PIN_TEXT_MARGIN ) + numLineWidth;
/* Get the num and name colors */
COLOR4D NameColor = IsVisible() ? GetLayerColor( LAYER_PINNAM ) : GetInvisibleItemColor();
@ -1015,10 +1007,8 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
int numLineWidth = GetPenSize();
numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
int name_offset = Mils2iu( PIN_TEXT_MARGIN ) +
( nameLineWidth + GetDefaultLineThickness() ) / 2;
int num_offset = Mils2iu( PIN_TEXT_MARGIN ) +
( numLineWidth + GetDefaultLineThickness() ) / 2;
int name_offset = Mils2iu( PIN_TEXT_MARGIN ) + nameLineWidth;
int num_offset = Mils2iu( PIN_TEXT_MARGIN ) + numLineWidth;
/* Get the num and name colors */
COLOR4D NameColor = GetLayerColor( LAYER_PINNAM );

View File

@ -198,13 +198,7 @@ void LIB_POLYLINE::RemoveCorner( int aIdx )
int LIB_POLYLINE::GetPenSize() const
{
if( m_Width > 0 )
return m_Width;
if( m_Width == 0 )
return GetDefaultLineThickness();
return -1; // the minimal pen value
return m_Width;
}

View File

@ -159,13 +159,7 @@ void LIB_RECTANGLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
int LIB_RECTANGLE::GetPenSize() const
{
if( m_Width > 0 )
return m_Width;
if( m_Width == 0 )
return GetDefaultLineThickness();
return -1; // a value to use a minimal pen size
return m_Width;
}

View File

@ -302,16 +302,12 @@ int LIB_TEXT::GetPenSize() const
{
int pensize = GetThickness();
if( pensize == 0 ) // Use default values for pen size
{
if( IsBold() )
pensize = GetPenSizeForBold( GetTextWidth() );
else
pensize = GetDefaultLineThickness();
}
if( pensize == 0 && IsBold() )
pensize = GetPenSizeForBold( GetTextWidth() );
// Clip pen size for small texts:
pensize = Clamp_Text_PenSize( pensize, GetTextSize(), IsBold() );
return pensize;
}

View File

@ -64,9 +64,7 @@
bool LIB_EDIT_FRAME:: m_showDeMorgan = false;
int LIB_EDIT_FRAME:: g_LastTextSize = -1;
double LIB_EDIT_FRAME:: g_LastTextAngle = TEXT_ANGLE_HORIZ;
int LIB_EDIT_FRAME:: g_LastLineWidth = 0;
// these values are overridden when reading the config
int LIB_EDIT_FRAME:: m_textPinNumDefaultSize = Mils2iu( DEFAULTPINNUMSIZE );
@ -104,7 +102,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_DrawSpecificConvert = true;
m_DrawSpecificUnit = false;
m_SyncPinEdit = false;
m_repeatPinStep = Mils2iu( DEFAULT_REPEAT_OFFSET_PIN );
m_repeatPinStep = 0;
SetShowElectricalType( true );
m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs
@ -115,10 +113,6 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_convert = 1;
m_AboutTitle = "LibEdit";
// Delayed initialization
if( g_LastTextSize == -1 )
g_LastTextSize = GetDefaultTextSize();
// Initialize grid id to the default value 50 mils:
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
@ -226,8 +220,9 @@ void LIB_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
if( cfg )
{
SetDefaultLineThickness( Mils2iu( cfg->m_Defaults.line_width ) );
SetDefaultLineWidth( Mils2iu( cfg->m_Defaults.line_width ) );
SetDefaultPinLength( Mils2iu( cfg->m_Defaults.pin_length ) );
SetDefaultTextSize( Mils2iu( cfg->m_Defaults.text_size ) );
m_textPinNameDefaultSize = Mils2iu( cfg->m_Defaults.pin_name_size );
m_textPinNumDefaultSize = Mils2iu( cfg->m_Defaults.pin_num_size );
SetRepeatDeltaLabel( cfg->m_Repeat.label_delta );
@ -276,7 +271,8 @@ void LIB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg)
auto cfg = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
EDA_DRAW_FRAME::SaveSettings( cfg );
cfg->m_Defaults.line_width = Iu2Mils( GetDefaultLineThickness() );
cfg->m_Defaults.line_width = Iu2Mils( GetDefaultLineWidth() );
cfg->m_Defaults.text_size = Iu2Mils( GetDefaultTextSize() );
cfg->m_Defaults.pin_length = Iu2Mils( GetDefaultPinLength() );
cfg->m_Defaults.pin_name_size = Iu2Mils( GetPinNameDefaultSize() );
cfg->m_Defaults.pin_num_size = Iu2Mils( GetPinNumDefaultSize() );

View File

@ -111,10 +111,8 @@ public:
*/
bool m_DrawSpecificUnit;
static int g_LastTextSize;
static double g_LastTextAngle;
static FILL_T g_LastFillStyle;
static int g_LastLineWidth;
public:
LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );

View File

@ -39,7 +39,7 @@ void LIB_EDIT_FRAME::SVG_PlotComponent( const wxString& aFullFileName )
SVG_PLOTTER* plotter = new SVG_PLOTTER();
plotter->SetPageSettings( pageInfo );
plotter->SetDefaultLineWidth( GetDefaultLineThickness() );
plotter->SetDefaultLineWidth( GetDefaultLineWidth() );
plotter->SetColorMode( plotColor );
wxPoint plot_offset;

View File

@ -43,6 +43,8 @@ LIBEDIT_SETTINGS::LIBEDIT_SETTINGS() : APP_SETTINGS_BASE( "libedit", libeditSche
m_params.emplace_back( new PARAM<int>( "defaults.line_width", &m_Defaults.line_width, 6 ) );
m_params.emplace_back( new PARAM<int>( "defaults.text_size", &m_Defaults.text_size, 50 ) );
m_params.emplace_back( new PARAM<int>( "defaults.pin_length", &m_Defaults.pin_length, 100 ) );
m_params.emplace_back(

View File

@ -34,6 +34,7 @@ public:
struct DEFAULTS
{
int line_width;
int text_size;
int pin_length;
int pin_name_size;
int pin_num_size;

View File

@ -40,7 +40,8 @@
#include <dialog_plot_schematic.h>
#include <wx_html_report_panel.h>
void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef,
int aDefaultLineWidth )
{
SCH_SCREEN* screen = m_parent->GetScreen();
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
@ -64,7 +65,7 @@ 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( GetDefaultLineThickness() );
plotter->SetDefaultLineWidth( aDefaultLineWidth );
plotter->SetColorMode( getModeColor() );
plotter->SetColorSettings( colors );
plotter->SetCreator( wxT( "Eeschema-PDF" ) );

View File

@ -37,7 +37,8 @@
#include <dialog_plot_schematic.h>
#include <wx_html_report_panel.h>
void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef )
void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef,
int aDefaultLineWidth )
{
SCH_SCREEN* screen = m_parent->GetScreen();
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
@ -102,8 +103,8 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef )
wxFileName plotFileName = createPlotFileName( m_outputDirectoryName,
fname, ext, &reporter );
if( plotOneSheetPS( plotFileName.GetFullPath(), screen, plotPage, plot_offset,
scale, aPlotFrameRef ) )
if( plotOneSheetPS( plotFileName.GetFullPath(), screen, aDefaultLineWidth, plotPage,
plot_offset, scale, aPlotFrameRef ) )
{
msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() );
reporter.Report( msg, RPT_SEVERITY_ACTION );
@ -131,6 +132,7 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef )
bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
SCH_SCREEN* aScreen,
int aDefaultLineWidth,
const PAGE_INFO& aPageInfo,
wxPoint aPlot0ffset,
double aScale,
@ -141,7 +143,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
PS_PLOTTER* plotter = new PS_PLOTTER();
plotter->SetPageSettings( aPageInfo );
plotter->SetDefaultLineWidth( GetDefaultLineThickness() );
plotter->SetDefaultLineWidth( aDefaultLineWidth );
plotter->SetColorMode( getModeColor() );
plotter->SetColorSettings( colors );
// Currently, plot units are in decimil

View File

@ -41,7 +41,8 @@
#include <dialog_plot_schematic.h>
#include <wx_html_report_panel.h>
void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef )
void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef,
int aDefaultLineWidth )
{
wxString msg;
REPORTER& reporter = m_MessagesBox->Reporter();
@ -72,7 +73,7 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef )
fname, ext, &reporter );
bool success = plotOneSheetSVG( m_parent, plotFileName.GetFullPath(), screen,
getModeColor() ? false : true,
aDefaultLineWidth, getModeColor() ? false : true,
aPrintFrameRef, m_plotBackgroundColor->GetValue(),
colors );
@ -105,6 +106,7 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef )
bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( EDA_DRAW_FRAME* aFrame,
const wxString& aFileName,
SCH_SCREEN* aScreen,
int aDefaultLineWidth,
bool aPlotBlackAndWhite,
bool aPlotFrameRef,
bool aPlotBackgroundColor,
@ -117,7 +119,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( EDA_DRAW_FRAME* aFrame,
const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
plotter->SetPageSettings( pageInfo );
plotter->SetDefaultLineWidth( GetDefaultLineThickness() );
plotter->SetDefaultLineWidth( aDefaultLineWidth );
plotter->SetColorMode( aPlotBlackAndWhite ? false : true );
plotter->SetColorSettings( aColors );
wxPoint plot_offset;

View File

@ -34,8 +34,6 @@
#include <confirm.h>
#include <preview_items/selection_area.h>
#include <class_library.h>
#include <lib_edit_frame.h>
#include <lib_view_frame.h>
#include <sch_base_frame.h>
#include <symbol_lib_table.h>
#include <tool/action_toolbar.h>
@ -80,25 +78,25 @@ LIB_PART* SchGetLibPart( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable, PART
}
// Static members:
SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindowType,
const wxString& aTitle, const wxPoint& aPosition,
const wxSize& aSize, long aStyle, const wxString& aFrameName ) :
EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition, aSize, aStyle, aFrameName )
EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition, aSize, aStyle, aFrameName ),
m_defaultLineWidth( 0 ),
m_defaultWireThickness( 0 ),
m_defaultBusThickness( 0 ),
m_defaultTextSize( 0 ),
m_repeatDeltaLabel( 0 ),
m_showPinElectricalTypeName( false ),
m_dragActionIsMove( false ),
m_repeatComponent( false ),
m_useAllUnits( false )
{
createCanvas();
m_zoomLevelCoeff = 11.0 * IU_PER_MILS; // Adjusted to roughly displays zoom level = 1
// when the screen shows a 1:1 image
// obviously depends on the monitor,
// but this is an acceptable value
m_repeatStep = wxPoint( Mils2iu( DEFAULT_REPEAT_OFFSET_X ),
Mils2iu( DEFAULT_REPEAT_OFFSET_Y ) );
m_repeatDeltaLabel = DEFAULT_REPEAT_LABEL_INC;
m_showPinElectricalTypeName = false;
m_repeatComponent = false;
m_useAllUnits = false;
// Adjusted to display zoom level ~ 1 when the screen shows a 1:1 image
// Obviously depends on the monitor, but this is an acceptable value
m_zoomLevelCoeff = 11.0 * IU_PER_MILS;
}
@ -131,6 +129,27 @@ const wxString SCH_BASE_FRAME::GetZoomLevelIndicator() const
}
void SCH_BASE_FRAME::SetDefaultLineWidth( int aWidth )
{
m_defaultLineWidth = aWidth;
GetRenderSettings()->m_DefaultLineWidth = aWidth;
}
void SCH_BASE_FRAME::SetDefaultWireThickness( int aThickness )
{
m_defaultWireThickness = aThickness;
GetRenderSettings()->m_DefaultWireThickness = aThickness;
}
void SCH_BASE_FRAME::SetDefaultBusThickness( int aThickness )
{
m_defaultBusThickness = aThickness;
GetRenderSettings()->m_DefaultBusThickness = aThickness;
}
void SCH_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
{
GetScreen()->SetPageSettings( aPageSettings );

View File

@ -87,6 +87,13 @@ LIB_PART* SchGetLibPart( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable,
class SCH_BASE_FRAME : public EDA_DRAW_FRAME
{
protected:
int m_defaultLineWidth;
int m_defaultWireThickness;
int m_defaultBusThickness;
int m_defaultTextSize;
COLOR4D m_defaultSheetBorderColor;
COLOR4D m_defaultSheetBackgroundColor;
TEMPLATES m_templateFieldNames;
wxPoint m_repeatStep; // the increment value of the position of an item
// when it is repeated
@ -132,6 +139,24 @@ public:
bool GetShowElectricalType() { return m_showPinElectricalTypeName; }
void SetShowElectricalType( bool aShow ) { m_showPinElectricalTypeName = aShow; }
int GetDefaultLineWidth() const { return m_defaultLineWidth; }
void SetDefaultLineWidth( int aWidth );
int GetDefaultWireThickness() const { return m_defaultWireThickness; }
void SetDefaultWireThickness( int aThickness );
int GetDefaultBusThickness() const { return m_defaultBusThickness; }
void SetDefaultBusThickness( int aThickness );
int GetDefaultTextSize() const { return m_defaultTextSize; }
void SetDefaultTextSize( int aSize ) { m_defaultTextSize = aSize; }
COLOR4D GetDefaultSheetBorderColor() { return m_defaultSheetBorderColor; }
void SetDefaultSheetBorderColor( COLOR4D aColor ) { m_defaultSheetBorderColor = aColor; }
COLOR4D GetDefaultSheetBackgroundColor() { return m_defaultSheetBackgroundColor; }
void SetDefaultSheetBackgroundColor( COLOR4D aColor ) { m_defaultSheetBackgroundColor = aColor; }
/**
* @return the increment value of the position of an item
* for the repeat command

View File

@ -128,13 +128,13 @@ const EDA_RECT SCH_BUS_ENTRY_BASE::GetBoundingBox() const
int SCH_BUS_WIRE_ENTRY::GetPenSize() const
{
return GetDefaultWireThickness();
return 0; // use default wire thickness
}
int SCH_BUS_BUS_ENTRY::GetPenSize() const
{
return GetDefaultBusThickness();
return 0; // use default bus thickness
}

View File

@ -915,7 +915,7 @@ void SCH_EDIT_FRAME::PrintPage( wxDC* aDC )
aDC->SetLogicalFunction( wxCOPY );
GetScreen()->Print( aDC );
PrintWorkSheet( aDC, GetScreen(), GetDefaultLineThickness(), IU_PER_MILS, fileName );
PrintWorkSheet( aDC, GetScreen(), GetDefaultLineWidth(), IU_PER_MILS, fileName );
}

View File

@ -163,15 +163,8 @@ private:
*/
static PINSHEETLABEL_SHAPE m_lastSheetPinType; ///< Last sheet pin type.
static wxSize m_lastSheetPinTextSize; ///< Last sheet pin text size.
static wxPoint m_lastSheetPinPosition; ///< Last sheet pin position.
protected:
/**
* Initializing accessor for the pin text size
*/
const wxSize &GetLastSheetPinTextSize();
/**
* Save the schematic files that have been modified and not yet saved.
*

View File

@ -210,37 +210,22 @@ int SCH_FIELD::GetPenSize() const
{
int pensize = GetThickness();
if( pensize == 0 ) // Use default values for pen size
{
if( IsBold() )
pensize = GetPenSizeForBold( GetTextWidth() );
else
pensize = GetDefaultLineThickness();
}
if( pensize == 0 && IsBold() )
pensize = GetPenSizeForBold( GetTextWidth() );
// Clip pen size for small texts:
pensize = Clamp_Text_PenSize( pensize, GetTextSize(), IsBold() );
return pensize;
}
void SCH_FIELD::Print( wxDC* aDC, const wxPoint& aOffset )
{
int orient;
COLOR4D color;
wxPoint textpos;
int lineWidth = GetThickness();
if( lineWidth == 0 ) // Use default values for pen size
{
if( IsBold() )
lineWidth = GetPenSizeForBold( GetTextWidth() );
else
lineWidth = GetDefaultLineThickness();
}
// Clip pen size for small texts:
lineWidth = Clamp_Text_PenSize( lineWidth, GetTextSize(), IsBold() );
int orient;
COLOR4D color;
wxPoint textpos;
int lineWidth = GetPenSize();
if( ( !IsVisible() && !m_forceVisible) || IsVoid() )
return;
@ -306,11 +291,8 @@ void SCH_FIELD::SwapData( SCH_ITEM* aItem )
const EDA_RECT SCH_FIELD::GetBoundingBox() const
{
int linewidth = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
// We must pass the effective text thickness to GetTextBox
// when calculating the bounding box
linewidth = Clamp_Text_PenSize( linewidth, GetTextSize(), IsBold() );
// Use the maximum clamped pen width to give us a bit of wiggle room
int linewidth = Clamp_Text_PenSize( GetTextSize().x, GetTextSize(), IsBold() );
// Calculate the text bounding box:
EDA_RECT rect;

View File

@ -44,9 +44,9 @@
int SCH_JUNCTION::g_SymbolSize = Mils2iu( 40 ); // Default diameter of the junction symbol
int SCH_JUNCTION::GetEffectiveSymbolSize()
int SCH_JUNCTION::GetSymbolSize()
{
return std::max( GetDefaultLineThickness(), g_SymbolSize );
return g_SymbolSize;
}
@ -87,7 +87,7 @@ const EDA_RECT SCH_JUNCTION::GetBoundingBox() const
EDA_RECT rect;
rect.SetOrigin( m_pos );
rect.Inflate( ( GetPenSize() + GetEffectiveSymbolSize() ) / 2 );
rect.Inflate( ( GetPenSize() + GetSymbolSize() ) / 2 );
return rect;
}
@ -98,8 +98,8 @@ void SCH_JUNCTION::Print( wxDC* aDC, const wxPoint& aOffset )
auto conn = Connection( *g_CurrentSheet );
COLOR4D color = GetLayerColor( ( conn && conn->IsBus() ) ? LAYER_BUS : m_Layer );
GRFilledCircle( nullptr, aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y,
( GetEffectiveSymbolSize() / 2 ), 0, color, color );
GRFilledCircle( nullptr, aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, GetSymbolSize() / 2,
0, color, color );
}
@ -195,7 +195,7 @@ bool SCH_JUNCTION::doIsConnected( const wxPoint& aPosition ) const
void SCH_JUNCTION::Plot( PLOTTER* aPlotter )
{
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( GetLayer() ) );
aPlotter->Circle( m_pos, GetEffectiveSymbolSize(), FILLED_SHAPE );
aPlotter->Circle( m_pos, GetSymbolSize(), FILLED_SHAPE );
}

View File

@ -53,9 +53,7 @@ public:
return wxT( "SCH_JUNCTION" );
}
// Return the size the symbol should be drawn at. This is GetSymbolSize() clamped to be
// no less than the current wire width.
static int GetEffectiveSymbolSize();
static int GetSymbolSize();
void SwapData( SCH_ITEM* aItem ) override;

View File

@ -2282,7 +2282,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() != aLine->GetDefaultWidth() )
if( aLine->GetPenSize() != 0 )
m_out->Print( 0, " %s %d", T_WIDTH, Iu2Mils( aLine->GetLineSize() ) );
if( aLine->GetLineStyle() != aLine->GetDefaultStyle() )

View File

@ -283,32 +283,15 @@ PLOT_DASH_TYPE SCH_LINE::GetLineStyle() const
}
int SCH_LINE::GetDefaultWidth() const
{
if( m_Layer == LAYER_BUS )
return GetDefaultBusThickness();
else if( m_Layer == LAYER_WIRE )
return GetDefaultWireThickness();
return GetDefaultLineThickness();
}
void SCH_LINE::SetLineWidth( const int aSize )
{
if( aSize == GetDefaultWidth() )
m_size = 0;
else
m_size = aSize;
m_size = aSize;
}
int SCH_LINE::GetPenSize() const
{
if( m_size > 0 )
return m_size;
return GetDefaultWidth();
return m_size;
}
@ -814,10 +797,6 @@ bool SCH_LINE::IsGraphicLine() const
bool SCH_LINE::UsesDefaultStroke() const
{
if( ( m_size == GetDefaultWidth() || m_size == 0 )
&& ( m_style == GetDefaultStyle() || m_style == PLOT_DASH_TYPE::DEFAULT )
&& ( m_color == COLOR4D::UNSPECIFIED ) )
return true;
return false;
return m_size == 0 && m_color == COLOR4D::UNSPECIFIED
&& ( m_style == GetDefaultStyle() || m_style == PLOT_DASH_TYPE::DEFAULT );
}

View File

@ -121,8 +121,6 @@ public:
/// Returns COLOR4D::UNSPECIFIED if a custom color hasn't been set for this line
COLOR4D GetLineColor() const;
int GetDefaultWidth() const;
void SetLineWidth( const int aSize );
/**

View File

@ -97,14 +97,14 @@ void SCH_NO_CONNECT::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList )
int SCH_NO_CONNECT::GetPenSize() const
{
return GetDefaultLineThickness();
return 0; // use default pen size
}
void SCH_NO_CONNECT::Print( wxDC* aDC, const wxPoint& aOffset )
{
int half = GetSize() / 2;
int width = GetDefaultLineThickness();
int width = GetPenSize();
int pX = m_pos.x + aOffset.x;
int pY = m_pos.y + aOffset.y;
@ -161,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 = ( ( GetSize() + GetDefaultLineThickness() ) / 2 ) + aAccuracy;
int delta = ( GetPenSize() + GetSize() ) / 2 + aAccuracy;
wxPoint dist = aPosition - m_pos;

View File

@ -60,7 +60,7 @@ public:
int GetSize() const
{
return std::max( m_size, KiROUND( GetDefaultLineThickness() * 3 ) );
return m_size;
}
int GetPenSize() const override;

View File

@ -38,7 +38,6 @@
#include <lib_arc.h>
#include <lib_bezier.h>
#include <lib_circle.h>
#include <lib_edit_frame.h>
#include <lib_field.h>
#include <lib_item.h>
#include <lib_pin.h>
@ -59,7 +58,6 @@
#include <sch_sheet.h>
#include <sch_text.h>
#include <settings/color_settings.h>
#include <template_fieldnames.h>
#include <view/view.h>
#include "sch_painter.h"
@ -283,6 +281,9 @@ float SCH_PAINTER::getLineWidth( const LIB_ITEM* aItem, bool aDrawingShadows )
{
float width = (float) aItem->GetPenSize();
if( width == 0 )
width = (float) m_schSettings.m_DefaultLineWidth;
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
@ -292,12 +293,22 @@ 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 = (float) aItem->GetPenSize();
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
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;
}
return width;
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
return width;
}
@ -306,7 +317,7 @@ float SCH_PAINTER::getTextThickness( const SCH_TEXT* aItem, bool aDrawingShadows
float width = (float) aItem->GetThickness();
if( width == 0 )
width = (float) GetDefaultLineThickness();
width = (float) m_schSettings.m_DefaultLineWidth;
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
@ -404,7 +415,7 @@ bool SCH_PAINTER::setDeviceColors( const LIB_ITEM* aItem, int aLayer )
case LAYER_DEVICE:
m_gal->SetIsFill( aItem->GetFillMode() == FILLED_SHAPE );
m_gal->SetFillColor( getRenderColor( aItem, LAYER_DEVICE, false ) );
m_gal->SetIsStroke( aItem->GetPenSize() > 0 );
m_gal->SetIsStroke( true );
m_gal->SetLineWidth( getLineWidth( aItem, false ) );
m_gal->SetStrokeColor( getRenderColor( aItem, LAYER_DEVICE, false ) );
@ -905,7 +916,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
int insideOffset = textOffset;
int outsideOffset = 10;
float lineThickness = (float) GetDefaultLineThickness();
float lineThickness = (float) m_schSettings.m_DefaultLineWidth;
float aboveOffset = Mils2iu( PIN_TEXT_MARGIN ) + ( thickness[ABOVE] + lineThickness ) / 2.0;
float belowOffset = Mils2iu( PIN_TEXT_MARGIN ) + ( thickness[BELOW] + lineThickness ) / 2.0;
@ -1110,7 +1121,7 @@ void SCH_PAINTER::draw( SCH_JUNCTION *aJct, int aLayer )
m_gal->SetStrokeColor( color );
m_gal->SetIsFill( !drawingShadows );
m_gal->SetFillColor( color );
m_gal->DrawCircle( aJct->GetPosition(), SCH_JUNCTION::GetEffectiveSymbolSize() / 2.0 );
m_gal->DrawCircle( aJct->GetPosition(), SCH_JUNCTION::GetSymbolSize() / 2.0 );
}
@ -1596,7 +1607,7 @@ void SCH_PAINTER::draw( SCH_NO_CONNECT *aNC, int aLayer )
m_gal->SetIsFill( false );
VECTOR2D p = aNC->GetPosition();
int delta = aNC->GetSize() / 2;
int delta = std::max( aNC->GetSize(), m_schSettings.m_DefaultLineWidth * 3 ) / 2;
m_gal->DrawLine( p + VECTOR2D( -delta, -delta ), p + VECTOR2D( delta, delta ) );
m_gal->DrawLine( p + VECTOR2D( -delta, delta ), p + VECTOR2D( delta, -delta ) );

View File

@ -107,6 +107,10 @@ public:
bool m_ShowPinsElectricalType;
bool m_ShowDisabled;
bool m_ShowUmbilicals;
int m_DefaultLineWidth;
int m_DefaultWireThickness;
int m_DefaultBusThickness;
};

View File

@ -453,13 +453,13 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer )
break;
case LAYER_WIRE:
if( GetItem( aPosition, std::max( GetDefaultLineThickness(), 3 ), SCH_BUS_WIRE_ENTRY_T) )
if( GetItem( aPosition, Mils2iu( 6 ), SCH_BUS_WIRE_ENTRY_T) )
return true;
if( GetItem( aPosition, std::max( GetDefaultLineThickness(), 3 ), SCH_BUS_BUS_ENTRY_T) )
if( GetItem( aPosition, Mils2iu( 6 ), SCH_BUS_BUS_ENTRY_T) )
return true;
if( GetItem( aPosition, std::max( GetDefaultLineThickness(), 3 ), SCH_JUNCTION_T ) )
if( GetItem( aPosition, SCH_JUNCTION::GetSymbolSize(), SCH_JUNCTION_T ) )
return true;
if( GetPin( aPosition, NULL, true ) )

View File

@ -287,7 +287,7 @@ static void formatStroke( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aWidt
aFormatter->Print( aNestLevel, "(stroke" );
if( !( aWidth == GetDefaultLineThickness() || aWidth == 0 ) )
if( !( aWidth == 0 ) )
aFormatter->Print( 0, " (width %s)", FormatInternalUnits( aWidth ).c_str() );
if( !( aStyle == PLOT_DASH_TYPE::DEFAULT || aStyle == PLOT_DASH_TYPE::SOLID ) )
@ -1659,8 +1659,7 @@ void SCH_SEXPR_PLUGIN_CACHE::saveArc( LIB_ARC* aArc,
bool needsSpace = false;
bool onNewLine = false;
if( Iu2Mils( aArc->GetWidth() ) != DEFAULTDRAWLINETHICKNESS
&& aArc->GetWidth() != 0 )
if( aArc->GetWidth() != 0 )
{
aFormatter.Print( 0, "\n" );
aFormatter.Print( aNestLevel + 1, "(stroke (width %s))",
@ -1733,8 +1732,7 @@ void SCH_SEXPR_PLUGIN_CACHE::saveBezier( LIB_BEZIER* aBezier,
bool needsSpace = false;
if( Iu2Mils( aBezier->GetWidth() ) != DEFAULTDRAWLINETHICKNESS
&& aBezier->GetWidth() != 0 )
if( aBezier->GetWidth() != 0 )
{
aFormatter.Print( aNestLevel + 1, "(stroke (width %s))",
FormatInternalUnits( aBezier->GetWidth() ).c_str() );
@ -1774,8 +1772,7 @@ void SCH_SEXPR_PLUGIN_CACHE::saveCircle( LIB_CIRCLE* aCircle,
FormatInternalUnits( aCircle->GetPosition().y ).c_str(),
FormatInternalUnits( aCircle->GetRadius() ).c_str() );
if( Iu2Mils( aCircle->GetWidth() ) != DEFAULTDRAWLINETHICKNESS
&& aCircle->GetWidth() != 0 )
if( aCircle->GetWidth() != 0 )
{
aFormatter.Print( 0, " (stroke (width %s))",
FormatInternalUnits( aCircle->GetWidth() ).c_str() );
@ -1911,8 +1908,7 @@ void SCH_SEXPR_PLUGIN_CACHE::savePolyLine( LIB_POLYLINE* aPolyLine,
bool needsSpace = false;
if( Iu2Mils( aPolyLine->GetWidth() ) != DEFAULTDRAWLINETHICKNESS
&& aPolyLine->GetWidth() != 0 )
if( aPolyLine->GetWidth() != 0 )
{
aFormatter.Print( aNestLevel + 1, "(stroke (width %s))",
FormatInternalUnits( aPolyLine->GetWidth() ).c_str() );
@ -1956,8 +1952,7 @@ void SCH_SEXPR_PLUGIN_CACHE::saveRectangle( LIB_RECTANGLE* aRectangle,
bool needsSpace = false;
if( Iu2Mils( aRectangle->GetWidth() ) != DEFAULTDRAWLINETHICKNESS
&& aRectangle->GetWidth() != 0 )
if( aRectangle->GetWidth() != 0 )
{
aFormatter.Print( 0, " (stroke (width %s))",
FormatInternalUnits( aRectangle->GetWidth() ).c_str() );

View File

@ -90,9 +90,9 @@ SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
m_fieldsAutoplaced = FIELDS_AUTOPLACED_AUTO;
m_borderWidth = GetDefaultLineThickness();
m_borderColor = GetDefaultSheetBorderColor();
m_backgroundColor = GetDefaultSheetBackgroundColor();
m_borderWidth = 0;
m_borderColor = COLOR4D::UNSPECIFIED;
m_backgroundColor = COLOR4D::UNSPECIFIED;
}
@ -192,11 +192,7 @@ SCH_SHEET* SCH_SHEET::GetRootSheet()
bool SCH_SHEET::UsesDefaultStroke() const
{
if( ( m_borderWidth == GetDefaultLineThickness() || m_borderWidth == 0 )
&& ( m_borderColor == COLOR4D::UNSPECIFIED ) )
return true;
return false;
return m_borderWidth == 0 && m_borderColor == COLOR4D::UNSPECIFIED;
}
@ -913,7 +909,7 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
wxString Text;
wxPoint pos;
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( GetLayer() ) );
aPlotter->SetColor( GetBorderColor() );
int thickness = GetPenSize();
aPlotter->SetCurrentLineWidth( thickness );
@ -935,8 +931,6 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
for( SCH_FIELD field : m_fields )
field.Plot( aPlotter );
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( GetLayer() ) );
/* Draw texts : SheetLabel */
for( SCH_SHEET_PIN* sheetPin : m_pins )
sheetPin->Plot( aPlotter );

View File

@ -97,7 +97,7 @@ bool SCH_SHEET_PIN::operator==( const SCH_SHEET_PIN* aPin ) const
int SCH_SHEET_PIN::GetPenSize() const
{
return GetDefaultLineThickness();
return 0; // use default pen size
}

View File

@ -135,7 +135,7 @@ wxPoint SCH_TEXT::GetSchematicTextOffset() const
// 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() + GetDefaultLineThickness() ) / 2;
thick_offset += GetPenSize() / 2;
switch( GetLabelSpinStyle() )
{
@ -283,30 +283,23 @@ int SCH_TEXT::GetPenSize() const
{
int pensize = GetThickness();
if( pensize == 0 ) // Use default values for pen size
{
if( IsBold() )
pensize = GetPenSizeForBold( GetTextWidth() );
else
pensize = GetDefaultLineThickness();
}
if( pensize == 0 && IsBold() )
pensize = GetPenSizeForBold( GetTextWidth() );
// Clip pen size for small texts:
pensize = Clamp_Text_PenSize( pensize, GetTextSize(), IsBold() );
return pensize;
}
void SCH_TEXT::Print( wxDC* DC, const wxPoint& aOffset )
{
COLOR4D color = GetLayerColor( m_Layer );
int linewidth = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
linewidth = Clamp_Text_PenSize( linewidth, GetTextSize(), IsBold() );
COLOR4D color = GetLayerColor( m_Layer );
int linewidth = GetPenSize();
wxPoint text_offset = aOffset + GetSchematicTextOffset();
int savedWidth = GetThickness();
int savedWidth = GetThickness();
SetThickness( linewidth ); // Set the minimum width
EDA_TEXT::Print( DC, text_offset, color );
@ -421,11 +414,8 @@ void SCH_TEXT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
const EDA_RECT SCH_TEXT::GetBoundingBox() const
{
// We must pass the effective text thickness to GetTextBox
// when calculating the bounding box
int linewidth = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
linewidth = Clamp_Text_PenSize( linewidth, GetTextSize(), IsBold() );
// Use the maximum clamped pen width to give us a bit of wiggle room
int linewidth = Clamp_Text_PenSize( GetTextSize().x, GetTextSize(), IsBold() );
EDA_RECT rect = GetTextBox( -1, linewidth, false, GetTextMarkupFlags() );
@ -751,8 +741,10 @@ bool SCH_LABEL::IsType( const KICAD_T aScanTypes[] ) const
const EDA_RECT SCH_LABEL::GetBoundingBox() const
{
int linewidth = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
EDA_RECT rect = GetTextBox( -1, linewidth, false, GetTextMarkupFlags() );
// Use the maximum clamped pen width to give us a bit of wiggle room
int linewidth = Clamp_Text_PenSize( GetTextSize().x, GetTextSize(), IsBold() );
EDA_RECT rect = GetTextBox( -1, linewidth, false, GetTextMarkupFlags() );
if( GetTextAngle() != 0.0 )
{
@ -804,9 +796,7 @@ EDA_ITEM* SCH_GLOBALLABEL::Clone() const
wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset() const
{
wxPoint text_offset;
int width = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
width = Clamp_Text_PenSize( width, GetTextSize(), IsBold() );
int width = GetPenSize();
int halfSize = GetTextWidth() / 2;
int offset = width;
@ -891,14 +881,12 @@ void SCH_GLOBALLABEL::SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle )
void SCH_GLOBALLABEL::Print( wxDC* DC, const wxPoint& aOffset )
{
static std::vector <wxPoint> Poly;
COLOR4D color = GetLayerColor( m_Layer );
wxPoint text_offset = aOffset + GetSchematicTextOffset();
int linewidth = GetPenSize();
int save_width = GetThickness();
int linewidth = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
linewidth = Clamp_Text_PenSize( linewidth, GetTextSize(), IsBold() );
int save_width = GetThickness();
SetThickness( linewidth );
EDA_TEXT::Print( DC, text_offset, color );
@ -913,9 +901,9 @@ void SCH_GLOBALLABEL::Print( wxDC* DC, const wxPoint& aOffset )
void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const wxPoint& Pos )
{
int halfSize = GetTextHeight() / 2;
int linewidth = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
linewidth = Clamp_Text_PenSize( linewidth, GetTextSize(), IsBold() );
// Use the maximum clamped pen width to give us a bit of wiggle room
int linewidth = Clamp_Text_PenSize( GetTextSize().x, GetTextSize(), IsBold() );
aPoints.clear();
@ -1018,7 +1006,8 @@ const EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const
y = GetTextPos().y;
dx = dy = 0;
int width = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
// Use the maximum clamped pen width to give us a bit of wiggle room
int width = Clamp_Text_PenSize( GetTextSize().x, GetTextSize(), IsBold() );
height = ( (GetTextHeight() * 15) / 10 ) + width + 2 * TXT_MARGIN;
@ -1139,11 +1128,9 @@ void SCH_HIERLABEL::Print( wxDC* DC, const wxPoint& offset )
auto conn = Connection( *g_CurrentSheet );
COLOR4D color = GetLayerColor( ( conn && conn->IsBus() ) ? LAYER_BUS : m_Layer );
int linewidth = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
int linewidth = GetPenSize();
int save_width = GetThickness();
linewidth = Clamp_Text_PenSize( linewidth, GetTextSize(), IsBold() );
int save_width = GetThickness();
SetThickness( linewidth );
wxPoint text_offset = offset + GetSchematicTextOffset();
@ -1186,7 +1173,8 @@ const EDA_RECT SCH_HIERLABEL::GetBoundingBox() const
y = GetTextPos().y;
dx = dy = 0;
int width = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
// Use the maximum clamped pen width to give us a bit of wiggle room
int width = Clamp_Text_PenSize( GetTextSize().x, GetTextSize(), IsBold() );
height = GetTextHeight() + width + 2 * TXT_MARGIN;
length = LenSize( GetShownText(), width, GetTextMarkupFlags() )
@ -1234,7 +1222,7 @@ const EDA_RECT SCH_HIERLABEL::GetBoundingBox() const
wxPoint SCH_HIERLABEL::GetSchematicTextOffset() const
{
wxPoint text_offset;
int thickness = std::max( GetThickness(), GetDefaultLineThickness() );
int thickness = GetPenSize();
int offset = KiROUND( GetTextOffsetRatio() * GetTextSize().y );
int total_offset = GetTextWidth() + offset + thickness;

View File

@ -493,19 +493,6 @@ bool SCH_EDIT_FRAME::EditSheetProperties( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHi
PINSHEETLABEL_SHAPE SCH_EDIT_FRAME::m_lastSheetPinType = PINSHEETLABEL_SHAPE::PS_INPUT;
wxSize SCH_EDIT_FRAME::m_lastSheetPinTextSize( -1, -1 );
wxPoint SCH_EDIT_FRAME::m_lastSheetPinPosition;
const wxSize &SCH_EDIT_FRAME::GetLastSheetPinTextSize()
{
// Delayed initialization (need the preferences to be loaded)
if( m_lastSheetPinTextSize.x == -1 )
{
m_lastSheetPinTextSize.x = GetDefaultTextSize();
m_lastSheetPinTextSize.y = GetDefaultTextSize();
}
return m_lastSheetPinTextSize;
}
SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet, SCH_HIERLABEL* aLabel )
@ -521,7 +508,7 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet, SCH_HIERLABEL*
sheetPin = new SCH_SHEET_PIN( aSheet, wxPoint( 0, 0 ), text );
sheetPin->SetFlags( IS_NEW );
sheetPin->SetTextSize( GetLastSheetPinTextSize() );
sheetPin->SetTextSize( wxSize( GetDefaultTextSize(), GetDefaultTextSize() ) );
sheetPin->SetShape( m_lastSheetPinType );
if( !aLabel )
@ -536,7 +523,6 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet, SCH_HIERLABEL*
}
m_lastSheetPinType = sheetPin->GetShape();
m_lastSheetPinTextSize = sheetPin->GetTextSize();
sheetPin->SetPosition( (wxPoint) GetCanvas()->GetViewControls()->GetCursorPosition() );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 CERN
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -24,10 +24,7 @@
#include <ee_actions.h>
#include <lib_edit_frame.h>
#include <sch_view.h>
#include <confirm.h>
#include <view/view_controls.h>
#include <view/view.h>
#include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h>
#include <tools/lib_drawing_tools.h>
@ -148,7 +145,8 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
{
LIB_TEXT* text = new LIB_TEXT( part );
text->SetPosition( wxPoint( cursorPos.x, -cursorPos.y ) );
text->SetTextSize( wxSize( m_frame->g_LastTextSize, m_frame->g_LastTextSize ) );
text->SetTextSize( wxSize( m_frame->GetDefaultTextSize(),
m_frame->GetDefaultTextSize() ) );
text->SetTextAngle( m_frame->g_LastTextAngle );
DIALOG_LIB_EDIT_TEXT dlg( m_frame, text );
@ -319,7 +317,7 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
wxASSERT( item );
item->SetWidth( LIB_EDIT_FRAME::g_LastLineWidth );
item->SetWidth( m_frame->GetDefaultLineWidth() );
item->SetFillMode( LIB_EDIT_FRAME::g_LastFillStyle );
item->SetFlags( IS_NEW );
item->BeginEdit( wxPoint( cursorPos.x, -cursorPos.y ) );

View File

@ -442,7 +442,6 @@ void LIB_EDIT_TOOL::editGraphicProperties( LIB_ITEM* aItem )
m_frame->GetCanvas()->Refresh();
m_frame->OnModify( );
m_frame->g_LastLineWidth = dialog.GetWidth();
m_frame->m_DrawSpecificConvert = !dialog.GetApplyToAllConversions();
m_frame->m_DrawSpecificUnit = !dialog.GetApplyToAllUnits();

View File

@ -835,6 +835,9 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
sheet->SetFlags( IS_NEW | IS_RESIZED );
sheet->SetParent( m_frame->GetScreen() );
sheet->SetScreen( NULL );
sheet->SetBorderWidth( m_frame->GetDefaultLineWidth() );
sheet->SetBorderColor( m_frame->GetDefaultSheetBorderColor() );
sheet->SetBackgroundColor( m_frame->GetDefaultSheetBackgroundColor() );
sizeSheet( sheet, cursorPos );
m_view->ClearPreview();

View File

@ -374,7 +374,8 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet )
m_frame->AddToScreen( m_busUnfold.entry );
m_busUnfold.label = new SCH_LABEL( m_busUnfold.entry->m_End(), aNet );
m_busUnfold.label->SetTextSize( wxSize( GetDefaultTextSize(), GetDefaultTextSize() ) );
m_busUnfold.label->SetTextSize( wxSize( m_frame->GetDefaultTextSize(),
m_frame->GetDefaultTextSize() ) );
m_busUnfold.label->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT );
m_busUnfold.label->SetParent( m_frame->GetScreen() );
m_busUnfold.label->SetFlags( IS_NEW | IS_MOVED );