From 591428b0d99754d1e04722fb6a242ed315dfa763 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 4 Apr 2020 21:32:14 +0100 Subject: [PATCH] Remove some problematic global variables. Fixes https://gitlab.com/kicad/code/kicad/issues/4121 --- common/dialogs/panel_common_settings_base.cpp | 6 +- common/dialogs/panel_common_settings_base.fbp | 4 +- common/dialogs/panel_common_settings_base.h | 2 +- .../dialogs/dialog_edit_component_in_lib.cpp | 3 + .../dialog_edit_component_in_schematic.cpp | 3 + eeschema/dialogs/dialog_edit_label.cpp | 4 - eeschema/dialogs/dialog_edit_line_style.cpp | 2 +- eeschema/dialogs/dialog_lib_edit_text.cpp | 7 +- eeschema/dialogs/dialog_plot_schematic.cpp | 16 +- eeschema/dialogs/dialog_plot_schematic.h | 19 +- .../dialogs/dialog_print_using_printer.cpp | 2 +- .../dialogs/panel_eeschema_color_settings.cpp | 4 +- eeschema/dialogs/panel_eeschema_settings.cpp | 41 +- eeschema/dialogs/panel_eeschema_settings.h | 7 +- .../panel_eeschema_template_fieldnames.cpp | 8 + ...anel_eeschema_template_fieldnames_base.cpp | 16 +- ...anel_eeschema_template_fieldnames_base.fbp | 437 +- .../panel_eeschema_template_fieldnames_base.h | 2 + eeschema/dialogs/panel_libedit_settings.cpp | 51 +- eeschema/dialogs/panel_libedit_settings.h | 13 +- .../dialogs/panel_libedit_settings_base.cpp | 226 +- .../dialogs/panel_libedit_settings_base.fbp | 3825 ++++++++--------- .../dialogs/panel_libedit_settings_base.h | 28 +- eeschema/dialogs/panel_setup_formatting.cpp | 20 +- eeschema/dialogs/panel_setup_formatting.h | 1 + .../dialogs/panel_setup_formatting_base.cpp | 28 +- .../dialogs/panel_setup_formatting_base.fbp | 220 +- .../dialogs/panel_setup_formatting_base.h | 3 + eeschema/edit_label.cpp | 2 +- eeschema/eeschema_config.cpp | 92 +- eeschema/general.h | 46 - eeschema/lib_arc.cpp | 8 +- eeschema/lib_bezier.cpp | 8 +- eeschema/lib_circle.cpp | 8 +- eeschema/lib_field.cpp | 13 +- eeschema/lib_pin.cpp | 20 +- eeschema/lib_polyline.cpp | 8 +- eeschema/lib_rectangle.cpp | 8 +- eeschema/lib_text.cpp | 10 +- eeschema/libedit/lib_edit_frame.cpp | 14 +- eeschema/libedit/lib_edit_frame.h | 2 - eeschema/libedit/libedit_plot_component.cpp | 2 +- eeschema/libedit/libedit_settings.cpp | 2 + eeschema/libedit/libedit_settings.h | 1 + eeschema/plot_schematic_PDF.cpp | 5 +- eeschema/plot_schematic_PS.cpp | 10 +- eeschema/plot_schematic_SVG.cpp | 8 +- eeschema/sch_base_frame.cpp | 49 +- eeschema/sch_base_frame.h | 25 + eeschema/sch_bus_entry.cpp | 4 +- eeschema/sch_edit_frame.cpp | 2 +- eeschema/sch_edit_frame.h | 7 - eeschema/sch_field.cpp | 36 +- eeschema/sch_junction.cpp | 12 +- eeschema/sch_junction.h | 4 +- eeschema/sch_legacy_plugin.cpp | 2 +- eeschema/sch_line.cpp | 29 +- eeschema/sch_line.h | 2 - eeschema/sch_no_connect.cpp | 6 +- eeschema/sch_no_connect.h | 2 +- eeschema/sch_painter.cpp | 33 +- eeschema/sch_painter.h | 4 + eeschema/sch_screen.cpp | 6 +- eeschema/sch_sexpr_plugin.cpp | 17 +- eeschema/sch_sheet.cpp | 16 +- eeschema/sch_sheet_pin.cpp | 2 +- eeschema/sch_text.cpp | 64 +- eeschema/sheet.cpp | 16 +- eeschema/tools/lib_drawing_tools.cpp | 10 +- eeschema/tools/lib_edit_tool.cpp | 1 - eeschema/tools/sch_drawing_tools.cpp | 3 + eeschema/tools/sch_line_wire_bus_tool.cpp | 3 +- 72 files changed, 2663 insertions(+), 2957 deletions(-) diff --git a/common/dialogs/panel_common_settings_base.cpp b/common/dialogs/panel_common_settings_base.cpp index 22071f63ef..b988b9d674 100644 --- a/common/dialogs/panel_common_settings_base.cpp +++ b/common/dialogs/panel_common_settings_base.cpp @@ -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 ) ); diff --git a/common/dialogs/panel_common_settings_base.fbp b/common/dialogs/panel_common_settings_base.fbp index b6068ceadb..de99083fda 100644 --- a/common/dialogs/panel_common_settings_base.fbp +++ b/common/dialogs/panel_common_settings_base.fbp @@ -767,7 +767,7 @@ 5 1 1 - wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM 0 1 @@ -1044,7 +1044,7 @@ 5 1 1 - wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM 3 1 diff --git a/common/dialogs/panel_common_settings_base.h b/common/dialogs/panel_common_settings_base.h index 414e2d3d12..cfbec7d1a2 100644 --- a/common/dialogs/panel_common_settings_base.h +++ b/common/dialogs/panel_common_settings_base.h @@ -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! diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.cpp b/eeschema/dialogs/dialog_edit_component_in_lib.cpp index fbba5e6d89..0832df51c4 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_lib.cpp @@ -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 diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp index 1c745d7e6c..60bdf3cfc5 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp @@ -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 diff --git a/eeschema/dialogs/dialog_edit_label.cpp b/eeschema/dialogs/dialog_edit_label.cpp index 9035ba11c0..901ecd7bf1 100644 --- a/eeschema/dialogs/dialog_edit_label.cpp +++ b/eeschema/dialogs/dialog_edit_label.cpp @@ -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; } diff --git a/eeschema/dialogs/dialog_edit_line_style.cpp b/eeschema/dialogs/dialog_edit_line_style.cpp index b5fcd6108e..90b4a784f4 100644 --- a/eeschema/dialogs/dialog_edit_line_style.cpp +++ b/eeschema/dialogs/dialog_edit_line_style.cpp @@ -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() ); diff --git a/eeschema/dialogs/dialog_lib_edit_text.cpp b/eeschema/dialogs/dialog_lib_edit_text.cpp index 3642c746f0..d4b98875e1 100644 --- a/eeschema/dialogs/dialog_lib_edit_text.cpp +++ b/eeschema/dialogs/dialog_lib_edit_text.cpp @@ -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 ) diff --git a/eeschema/dialogs/dialog_plot_schematic.cpp b/eeschema/dialogs/dialog_plot_schematic.cpp index 9abdbc84a2..1f4d8e564f 100644 --- a/eeschema/dialogs/dialog_plot_schematic.cpp +++ b/eeschema/dialogs/dialog_plot_schematic.cpp @@ -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() ); diff --git a/eeschema/dialogs/dialog_plot_schematic.h b/eeschema/dialogs/dialog_plot_schematic.h index 8c2fb6a5b6..60609cbf1a 100644 --- a/eeschema/dialogs/dialog_plot_schematic.h +++ b/eeschema/dialogs/dialog_plot_schematic.h @@ -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 ); }; diff --git a/eeschema/dialogs/dialog_print_using_printer.cpp b/eeschema/dialogs/dialog_print_using_printer.cpp index 9a707c51b7..b23c853dfe 100644 --- a/eeschema/dialogs/dialog_print_using_printer.cpp +++ b/eeschema/dialogs/dialog_print_using_printer.cpp @@ -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 ) ); } diff --git a/eeschema/dialogs/panel_eeschema_color_settings.cpp b/eeschema/dialogs/panel_eeschema_color_settings.cpp index ed989be061..abcf0db140 100644 --- a/eeschema/dialogs/panel_eeschema_color_settings.cpp +++ b/eeschema/dialogs/panel_eeschema_color_settings.cpp @@ -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 ); diff --git a/eeschema/dialogs/panel_eeschema_settings.cpp b/eeschema/dialogs/panel_eeschema_settings.cpp index 3ff6281f46..e881ae3462 100644 --- a/eeschema/dialogs/panel_eeschema_settings.cpp +++ b/eeschema/dialogs/panel_eeschema_settings.cpp @@ -23,7 +23,6 @@ */ #include -#include #include #include #include @@ -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; } diff --git a/eeschema/dialogs/panel_eeschema_settings.h b/eeschema/dialogs/panel_eeschema_settings.h index c07b308878..7593287e2f 100644 --- a/eeschema/dialogs/panel_eeschema_settings.h +++ b/eeschema/dialogs/panel_eeschema_settings.h @@ -20,6 +20,7 @@ #ifndef KICAD_PANEL_EESCHEMA_SETTINGS_H #define KICAD_PANEL_EESCHEMA_SETTINGS_H +#include #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 ); diff --git a/eeschema/dialogs/panel_eeschema_template_fieldnames.cpp b/eeschema/dialogs/panel_eeschema_template_fieldnames.cpp index cf4e12c8e8..fe14055f3e 100644 --- a/eeschema/dialogs/panel_eeschema_template_fieldnames.cpp +++ b/eeschema/dialogs/panel_eeschema_template_fieldnames.cpp @@ -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 ) ); diff --git a/eeschema/dialogs/panel_eeschema_template_fieldnames_base.cpp b/eeschema/dialogs/panel_eeschema_template_fieldnames_base.cpp index 5ed72bf7ca..1476ada95d 100644 --- a/eeschema/dialogs/panel_eeschema_template_fieldnames_base.cpp +++ b/eeschema/dialogs/panel_eeschema_template_fieldnames_base.cpp @@ -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 ); diff --git a/eeschema/dialogs/panel_eeschema_template_fieldnames_base.fbp b/eeschema/dialogs/panel_eeschema_template_fieldnames_base.fbp index 1cdd757373..2b86cbf895 100644 --- a/eeschema/dialogs/panel_eeschema_template_fieldnames_base.fbp +++ b/eeschema/dialogs/panel_eeschema_template_fieldnames_base.fbp @@ -55,178 +55,28 @@ wxHORIZONTAL none - 10 - wxEXPAND|wxRIGHT|wxLEFT + 5 + wxEXPAND 1 - bSizer4 - wxVERTICAL - none + m_leftMargin + wxHORIZONTAL + protected - 5 - wxTOP|wxBOTTOM - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - %s field name templates: - 0 - - 0 - - - 0 - - 1 - m_title - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - 10 - wxEXPAND + wxEXPAND|wxRIGHT|wxLEFT 1 - - 1 - 1 - 1 - 1 - - - - - 0 - 0 - - - - 1 - - - wxALIGN_LEFT - - wxALIGN_TOP - 0 - 1 - wxALIGN_CENTER - 22 - "Name" "Visible" "URL" - wxALIGN_CENTER - 3 - 300,60,60 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - 0 - 1 - 1 - 1 - - 1 - - - 1 - 0 - 0 - wxID_ANY - - - - 0 - 0 - - 0 - - -1,-1 - 0 - -1,180 - 1 - m_grid - 1 - - - protected - 1 - - Resizable - wxALIGN_CENTER - 0 - - wxALIGN_CENTER - - 0 - 1 - - WX_GRID; widgets/wx_grid.h; forward_declare - 0 - - - - - OnSizeGrid - - - - 10 - wxEXPAND - 0 - bSizer10 - wxHORIZONTAL - none + m_topMargin + wxVERTICAL + protected 5 - wxTOP|wxRIGHT + wxTOP|wxBOTTOM 0 - + 1 1 1 @@ -237,79 +87,57 @@ - 1 0 1 1 - - 0 0 - Dock 0 Left 1 1 - 0 0 wxID_ANY - Add Field - + %s field name templates: 0 0 0 - 29,29 + 1 - m_addFieldButton + m_title 1 protected 1 - - Resizable 1 - ; forward_declare + ; ; forward_declare 0 - - wxFILTER_NONE - wxDefaultValidator - - OnAddButtonClick + -1 - - 5 - wxEXPAND|wxRIGHT|wxLEFT - 0 - - 0 - protected - 0 - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - + + 10 + wxEXPAND + 1 + 1 1 1 @@ -318,64 +146,247 @@ + 0 + 0 - 1 + + + wxALIGN_LEFT + + wxALIGN_TOP 0 1 + wxALIGN_CENTER + 22 + "Name" "Visible" "URL" + wxALIGN_CENTER + 3 + 300,60,60 1 - - 0 0 - Dock 0 Left + 0 + 1 + 0 + 1 + 1 1 1 - + + 1 0 0 wxID_ANY - Delete Field - - 0 + + + + 0 + 0 0 - + -1,-1 0 - 29,29 + -1,180 1 - m_deleteFieldButton + m_grid 1 protected 1 - - Resizable + wxALIGN_CENTER + 0 + + wxALIGN_CENTER + + 0 1 - - ; forward_declare + WX_GRID; widgets/wx_grid.h; forward_declare 0 - - wxFILTER_NONE - wxDefaultValidator - - OnDeleteButtonClick + OnSizeGrid + + + + 10 + wxEXPAND + 0 + + + bSizer10 + wxHORIZONTAL + none + + 5 + wxTOP|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Add Field + + 0 + + 0 + + + 0 + 29,29 + 1 + m_addFieldButton + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddButtonClick + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 0 + protected + 0 + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Delete Field + + 0 + + 0 + + + 0 + 29,29 + 1 + m_deleteFieldButton + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnDeleteButtonClick + + diff --git a/eeschema/dialogs/panel_eeschema_template_fieldnames_base.h b/eeschema/dialogs/panel_eeschema_template_fieldnames_base.h index ec9dc3df82..20653729cd 100644 --- a/eeschema/dialogs/panel_eeschema_template_fieldnames_base.h +++ b/eeschema/dialogs/panel_eeschema_template_fieldnames_base.h @@ -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; diff --git a/eeschema/dialogs/panel_libedit_settings.cpp b/eeschema/dialogs/panel_libedit_settings.cpp index dfc4d0d240..e8d8ab65fa 100644 --- a/eeschema/dialogs/panel_libedit_settings.cpp +++ b/eeschema/dialogs/panel_libedit_settings.cpp @@ -23,9 +23,7 @@ */ #include -#include #include -#include #include #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() ); diff --git a/eeschema/dialogs/panel_libedit_settings.h b/eeschema/dialogs/panel_libedit_settings.h index d74b3036a4..05a22d1a56 100644 --- a/eeschema/dialogs/panel_libedit_settings.h +++ b/eeschema/dialogs/panel_libedit_settings.h @@ -20,6 +20,7 @@ #ifndef PANEL_LIBEDIT_SETTINGS_H #define PANEL_LIBEDIT_SETTINGS_H +#include #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 ); diff --git a/eeschema/dialogs/panel_libedit_settings_base.cpp b/eeschema/dialogs/panel_libedit_settings_base.cpp index d70ebae62d..7c11153dbc 100644 --- a/eeschema/dialogs/panel_libedit_settings_base.cpp +++ b/eeschema/dialogs/panel_libedit_settings_base.cpp @@ -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,146 +9,164 @@ /////////////////////////////////////////////////////////////////////////// -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_lineWidthUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); + + 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( defaults->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); m_lineWidthUnits->Wrap( -1 ); fgSizer->Add( m_lineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 ); - - - fgSizer->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 10 ); - - + + 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 ); + + 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 ); - - + + 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 ); - - - fgSizer->Add( 0, 0, 1, wxEXPAND, 5 ); - - - fgSizer->Add( 0, 0, 1, wxEXPAND, 5 ); - - - 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 ); + + + 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 ); + + + leftColumn->Add( defaults, 0, wxEXPAND|wxALL, 5 ); + + wxStaticBoxSizer* repeats; + repeats = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Repeated Items") ), wxVERTICAL ); + + wxFlexGridSizer* fgSizer1; + fgSizer1 = new wxFlexGridSizer( 0, 3, 3, 0 ); + fgSizer1->AddGrowableCol( 1 ); + fgSizer1->SetFlexibleDirection( wxBOTH ); + fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + 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 ); - - m_hPitchCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS ); - fgSizer->Add( m_hPitchCtrl, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_hPitchUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer1->Add( m_hPitchLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 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( repeats->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); m_hPitchUnits->Wrap( -1 ); - fgSizer->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 ); + fgSizer1->Add( m_hPitchUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 ); + + 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 ); - - m_vPitchCtrl = new wxTextCtrl( this, wxID_ANY, _("100"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS ); - fgSizer->Add( m_vPitchCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - m_vPitchUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer1->Add( m_vPitchLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 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( repeats->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); m_vPitchUnits->Wrap( -1 ); - fgSizer->Add( m_vPitchUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - m_pinPitchLabel = new wxStaticText( this, wxID_ANY, _("&Pitch of repeated pins:"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer1->Add( m_vPitchUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); + + 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 ); - - 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_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_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 ); - - - fgSizer->Add( 0, 0, 0, 0, 5 ); - - - bLeftColumn->Add( fgSizer, 0, wxALL, 5 ); - - - p1mainSizer->Add( bLeftColumn, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - + fgSizer1->Add( m_choicePinDisplacement, 0, wxEXPAND|wxRIGHT|wxLEFT, 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_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( repeats->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, -10, 10, 1 ); + fgSizer1->Add( m_spinRepeatLabel, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + fgSizer1->Add( 0, 0, 0, 0, 5 ); + + + repeats->Add( fgSizer1, 1, wxEXPAND, 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 ); this->Layout(); p1mainSizer->Fit( this ); diff --git a/eeschema/dialogs/panel_libedit_settings_base.fbp b/eeschema/dialogs/panel_libedit_settings_base.fbp index d4db21ddf0..28281e763d 100644 --- a/eeschema/dialogs/panel_libedit_settings_base.fbp +++ b/eeschema/dialogs/panel_libedit_settings_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -14,6 +14,7 @@ panel_libedit_settings_base 1000 none + 1 PanelLibeditSettingsBase @@ -48,36 +49,6 @@ wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - p1mainSizer @@ -89,1086 +60,1002 @@ 1 - bLeftColumn + leftColumn wxVERTICAL none 5 - wxALL + wxEXPAND|wxALL 0 - - 3 - wxBOTH - 0,1,2 - - 0 + + wxID_ANY + Defaults for New Objects - fgSizer - wxFLEX_GROWMODE_SPECIFIED + defaults + wxVERTICAL + 1 none - 0 - 3 - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - &Default line width: - - 0 - - - 0 - - 1 - m_lineWidthLabel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - m_lineWidthCtrl - 1 - - - protected - 1 - - Resizable - 1 - - wxSP_ARROW_KEYS|wxSP_WRAP - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - mils - - 0 - - - 0 - - 1 - m_lineWidthUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 - wxEXPAND|wxTOP|wxBOTTOM - 1 - - 0 - protected - 0 - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 + wxBOTTOM|wxEXPAND + 0 + + 3 + wxBOTH + 1 + + 0 + + fgSizer + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 3 + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + &Default line width: + 0 + + 0 + + + 0 + + 1 + m_lineWidthLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_lineWidthCtrl + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS|wxSP_WRAP + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + mils + 0 + + 0 + + + 0 + + 1 + m_lineWidthUnits + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxRIGHT|wxALIGN_CENTER_VERTICAL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Default text size: + 0 + + 0 + + + 0 + + 1 + m_textSizeLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_textSizeCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxRIGHT|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + mils + 0 + + 0 + + + 0 + + 1 + m_textSizeUnits + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxEXPAND|wxTOP|wxBOTTOM + 1 + + 0 + protected + 0 + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + D&efault pin length: + 0 + + 0 + + + 0 + + 1 + m_pinLengthLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_pinLengthCtrl + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS|wxSP_WRAP + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + mils + 0 + + 0 + + + 0 + + 1 + m_pinLengthUnits + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + De&fault pin number size: + 0 + + 0 + + + 0 + + 1 + m_pinNumSizeLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_pinNumSizeCtrl + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS|wxSP_WRAP + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + mils + 0 + + 0 + + + 0 + + 1 + m_pinNumSizeUnits + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Def&ault pin name size: + 0 + + 0 + + + 0 + + 1 + m_pinNameSizeLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_pinNameSizeCtrl + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS|wxSP_WRAP + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 3 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + mils + 0 + + 0 + + + 0 + + 1 + m_pinNameSizeUnits + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + 5 - wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - D&efault pin length: - - 0 - - - 0 - - 1 - m_pinLengthLabel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - m_pinLengthCtrl - 1 - - - protected - 1 - - Resizable - 1 - - wxSP_ARROW_KEYS|wxSP_WRAP - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - mils - - 0 - - - 0 - - 1 - m_pinLengthUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - De&fault pin number size: - - 0 - - - 0 - - 1 - m_pinNumSizeLabel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - m_pinNumSizeCtrl - 1 - - - protected - 1 - - Resizable - 1 - - wxSP_ARROW_KEYS|wxSP_WRAP - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - mils - - 0 - - - 0 - - 1 - m_pinNumSizeUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Def&ault pin name size: - - 0 - - - 0 - - 1 - m_pinNameSizeLabel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - m_pinNameSizeCtrl - 1 - - - protected - 1 - - Resizable - 1 - - wxSP_ARROW_KEYS|wxSP_WRAP - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - mils - - 0 - - - 0 - - 1 - m_pinNameSizeUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - wxTOP|wxBOTTOM|wxRIGHT + wxBOTTOM 0 1 @@ -1228,1035 +1115,745 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + wxID_ANY + Repeated Items + + repeats + wxVERTICAL + 1 + none 5 wxEXPAND 1 - - 0 - protected - 0 - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 10 - wxEXPAND|wxTOP|wxBOTTOM - 1 - - 0 - protected - 0 - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - &Horizontal pitch of repeated items: - - 0 - - - 0 + + 3 + wxBOTH + 1 + + 0 - 1 - m_hPitchLabel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - m_hPitchCtrl - 1 - - - protected - 1 - - Resizable - 1 - - wxSP_ARROW_KEYS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - mils - - 0 - - - 0 - - 1 - m_hPitchUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - &Vertical pitch of repeated items: - - 0 - - - 0 - - 1 - m_vPitchLabel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - m_vPitchCtrl - 1 - - - protected - 1 - - Resizable - 1 - - wxSP_ARROW_KEYS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 100 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - mils - - 0 - - - 0 - - 1 - m_vPitchUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - &Pitch of repeated pins: - - 0 - - - 0 - - 1 - m_pinPitchLabel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "100" "50" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_choicePinDisplacement - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - mils - - 0 - - - 0 - - 1 - m_pinPitchUnis - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - &Increment of repeated labels: - - 0 - - - 0 - - 1 - m_labelIncrementLabel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 1 - 10 - - 0 - - -10 - - 0 - - 1 - m_spinRepeatLabel - 1 - - - protected - 1 - - Resizable - 1 - - wxSP_ARROW_KEYS - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - 0 - protected - 0 + fgSizer1 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 3 + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + &Horizontal pitch: + 0 + + 0 + + + 0 + + 1 + m_hPitchLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_hPitchCtrl + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + mils + 0 + + 0 + + + 0 + + 1 + m_hPitchUnits + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + &Vertical pitch: + 0 + + 0 + + + 0 + + 1 + m_vPitchLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_vPitchCtrl + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + 100 + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + mils + 0 + + 0 + + + 0 + + 1 + m_vPitchUnits + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + &Pitch of repeated pins: + 0 + + 0 + + + 0 + + 1 + m_pinPitchLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "100" "50" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_choicePinDisplacement + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + mils + 0 + + 0 + + + 0 + + 1 + m_pinPitchUnits + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Label increment: + 0 + + 0 + + + 0 + + 1 + m_labelIncrementLabel1 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 1 + 10 + + 0 + + -10 + + 0 + + 1 + m_spinRepeatLabel + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS + + 0 + + + + + + + + + 5 + + 0 + + 0 + protected + 0 + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + diff --git a/eeschema/dialogs/panel_libedit_settings_base.h b/eeschema/dialogs/panel_libedit_settings_base.h index 314416843b..ddaf36ee17 100644 --- a/eeschema/dialogs/panel_libedit_settings_base.h +++ b/eeschema/dialogs/panel_libedit_settings_base.h @@ -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 #include @@ -18,10 +17,11 @@ #include #include #include +#include #include +#include #include #include -#include #include /////////////////////////////////////////////////////////////////////////// @@ -30,14 +30,17 @@ /////////////////////////////////////////////////////////////////////////////// /// Class PANEL_LIBEDIT_SETTINGS_BASE /////////////////////////////////////////////////////////////////////////////// -class PANEL_LIBEDIT_SETTINGS_BASE : public wxPanel +class PANEL_LIBEDIT_SETTINGS_BASE : public wxPanel { private: - + protected: 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__ diff --git a/eeschema/dialogs/panel_setup_formatting.cpp b/eeschema/dialogs/panel_setup_formatting.cpp index 1eac5abff6..17a4b15605 100644 --- a/eeschema/dialogs/panel_setup_formatting.cpp +++ b/eeschema/dialogs/panel_setup_formatting.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -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(); diff --git a/eeschema/dialogs/panel_setup_formatting.h b/eeschema/dialogs/panel_setup_formatting.h index 76ac48f916..227621897a 100644 --- a/eeschema/dialogs/panel_setup_formatting.h +++ b/eeschema/dialogs/panel_setup_formatting.h @@ -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; diff --git a/eeschema/dialogs/panel_setup_formatting_base.cpp b/eeschema/dialogs/panel_setup_formatting_base.cpp index b127b7b324..d07332bd95 100644 --- a/eeschema/dialogs/panel_setup_formatting_base.cpp +++ b/eeschema/dialogs/panel_setup_formatting_base.cpp @@ -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 ); diff --git a/eeschema/dialogs/panel_setup_formatting_base.fbp b/eeschema/dialogs/panel_setup_formatting_base.fbp index 14b55001e7..ced00d6547 100644 --- a/eeschema/dialogs/panel_setup_formatting_base.fbp +++ b/eeschema/dialogs/panel_setup_formatting_base.fbp @@ -742,6 +742,224 @@ + + 5 + wxEXPAND|wxALL + 0 + + wxID_ANY + Symbols + + sbSizer41 + wxVERTICAL + 1 + none + + 5 + wxEXPAND|wxBOTTOM + 1 + + 3 + wxBOTH + 1 + + 0 + -1,-1 + fgSizer321 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + 5 + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Default line thickness: + 0 + + 0 + + + 0 + + 1 + m_lineWidthLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_lineWidthCtrl + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS|wxSP_WRAP + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + mils + 0 + + 0 + + + 0 + + 1 + m_lineWidthUnits + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + 5 wxEXPAND|wxALL @@ -756,7 +974,7 @@ none 5 - wxBOTTOM|wxRIGHT|wxEXPAND + wxEXPAND|wxBOTTOM 0 3 diff --git a/eeschema/dialogs/panel_setup_formatting_base.h b/eeschema/dialogs/panel_setup_formatting_base.h index 0c0e38f800..bf4738107a 100644 --- a/eeschema/dialogs/panel_setup_formatting_base.h +++ b/eeschema/dialogs/panel_setup_formatting_base.h @@ -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; diff --git a/eeschema/edit_label.cpp b/eeschema/edit_label.cpp index 75285f2123..064e18bb0c 100644 --- a/eeschema/edit_label.cpp +++ b/eeschema/edit_label.cpp @@ -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() ) diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index bdd33fa8c5..c0a8b00de4 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -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& 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& 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() ); diff --git a/eeschema/general.h b/eeschema/general.h index 5947cb4939..a2eb181fe6 100644 --- a/eeschema/general.h +++ b/eeschema/general.h @@ -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 */ diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp index 3180ac4532..f9393eda8a 100644 --- a/eeschema/lib_arc.cpp +++ b/eeschema/lib_arc.cpp @@ -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; } diff --git a/eeschema/lib_bezier.cpp b/eeschema/lib_bezier.cpp index eac900386b..4dae020f16 100644 --- a/eeschema/lib_bezier.cpp +++ b/eeschema/lib_bezier.cpp @@ -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; } diff --git a/eeschema/lib_circle.cpp b/eeschema/lib_circle.cpp index a8c7ce8609..9bfe69b6aa 100644 --- a/eeschema/lib_circle.cpp +++ b/eeschema/lib_circle.cpp @@ -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; } diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index 6c42ec1dd5..5d4290366b 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -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; } diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 4dd43d2b52..4874e38c51 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -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 ); diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp index c1dbb34bd3..019af7345a 100644 --- a/eeschema/lib_polyline.cpp +++ b/eeschema/lib_polyline.cpp @@ -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; } diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp index 8f620458a9..089ef0bcbb 100644 --- a/eeschema/lib_rectangle.cpp +++ b/eeschema/lib_rectangle.cpp @@ -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; } diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index 8d264cf152..cab253da23 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -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; } diff --git a/eeschema/libedit/lib_edit_frame.cpp b/eeschema/libedit/lib_edit_frame.cpp index f9cc1eaa07..04eaf6835d 100644 --- a/eeschema/libedit/lib_edit_frame.cpp +++ b/eeschema/libedit/lib_edit_frame.cpp @@ -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(); 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() ); diff --git a/eeschema/libedit/lib_edit_frame.h b/eeschema/libedit/lib_edit_frame.h index d45d444fa1..0c3f31542a 100644 --- a/eeschema/libedit/lib_edit_frame.h +++ b/eeschema/libedit/lib_edit_frame.h @@ -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 ); diff --git a/eeschema/libedit/libedit_plot_component.cpp b/eeschema/libedit/libedit_plot_component.cpp index 2cf79073f6..0e2db5d6b8 100644 --- a/eeschema/libedit/libedit_plot_component.cpp +++ b/eeschema/libedit/libedit_plot_component.cpp @@ -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; diff --git a/eeschema/libedit/libedit_settings.cpp b/eeschema/libedit/libedit_settings.cpp index 49dd04f51c..2705220f18 100644 --- a/eeschema/libedit/libedit_settings.cpp +++ b/eeschema/libedit/libedit_settings.cpp @@ -43,6 +43,8 @@ LIBEDIT_SETTINGS::LIBEDIT_SETTINGS() : APP_SETTINGS_BASE( "libedit", libeditSche m_params.emplace_back( new PARAM( "defaults.line_width", &m_Defaults.line_width, 6 ) ); + m_params.emplace_back( new PARAM( "defaults.text_size", &m_Defaults.text_size, 50 ) ); + m_params.emplace_back( new PARAM( "defaults.pin_length", &m_Defaults.pin_length, 100 ) ); m_params.emplace_back( diff --git a/eeschema/libedit/libedit_settings.h b/eeschema/libedit/libedit_settings.h index de487fd38b..4f292d4652 100644 --- a/eeschema/libedit/libedit_settings.h +++ b/eeschema/libedit/libedit_settings.h @@ -34,6 +34,7 @@ public: struct DEFAULTS { int line_width; + int text_size; int pin_length; int pin_name_size; int pin_num_size; diff --git a/eeschema/plot_schematic_PDF.cpp b/eeschema/plot_schematic_PDF.cpp index 15039f7452..302132f6df 100644 --- a/eeschema/plot_schematic_PDF.cpp +++ b/eeschema/plot_schematic_PDF.cpp @@ -40,7 +40,8 @@ #include #include -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" ) ); diff --git a/eeschema/plot_schematic_PS.cpp b/eeschema/plot_schematic_PS.cpp index 8c0ed02395..6ce9a385f5 100644 --- a/eeschema/plot_schematic_PS.cpp +++ b/eeschema/plot_schematic_PS.cpp @@ -37,7 +37,8 @@ #include #include -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 diff --git a/eeschema/plot_schematic_SVG.cpp b/eeschema/plot_schematic_SVG.cpp index ea5bf3bcff..ce31ed4526 100644 --- a/eeschema/plot_schematic_SVG.cpp +++ b/eeschema/plot_schematic_SVG.cpp @@ -41,7 +41,8 @@ #include #include -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; diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp index 3ee58c5835..9dde917a04 100644 --- a/eeschema/sch_base_frame.cpp +++ b/eeschema/sch_base_frame.cpp @@ -34,8 +34,6 @@ #include #include #include -#include -#include #include #include #include @@ -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 ); diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h index e1b4131b84..55bd0e1a9d 100644 --- a/eeschema/sch_base_frame.h +++ b/eeschema/sch_base_frame.h @@ -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 diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index 15167433df..9d54856d9f 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -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 } diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 8ce36cf732..abd05c4bf5 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -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 ); } diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index f431128181..b90a7c4215 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -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. * diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index 892e156f36..b250cf40eb 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -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; diff --git a/eeschema/sch_junction.cpp b/eeschema/sch_junction.cpp index 395c038147..74c9b5a507 100644 --- a/eeschema/sch_junction.cpp +++ b/eeschema/sch_junction.cpp @@ -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 ); } diff --git a/eeschema/sch_junction.h b/eeschema/sch_junction.h index f8f1a50934..fcaafbc704 100644 --- a/eeschema/sch_junction.h +++ b/eeschema/sch_junction.h @@ -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; diff --git a/eeschema/sch_legacy_plugin.cpp b/eeschema/sch_legacy_plugin.cpp index e5f09c169f..0ec1e56b7b 100644 --- a/eeschema/sch_legacy_plugin.cpp +++ b/eeschema/sch_legacy_plugin.cpp @@ -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() ) diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index c2140a80ae..72f2ee188c 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -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 ); } diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h index 89ffbcf538..f4ea16c506 100644 --- a/eeschema/sch_line.h +++ b/eeschema/sch_line.h @@ -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 ); /** diff --git a/eeschema/sch_no_connect.cpp b/eeschema/sch_no_connect.cpp index 4a3166b057..ef638efbb7 100644 --- a/eeschema/sch_no_connect.cpp +++ b/eeschema/sch_no_connect.cpp @@ -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; diff --git a/eeschema/sch_no_connect.h b/eeschema/sch_no_connect.h index 639f0725d8..8261464094 100644 --- a/eeschema/sch_no_connect.h +++ b/eeschema/sch_no_connect.h @@ -60,7 +60,7 @@ public: int GetSize() const { - return std::max( m_size, KiROUND( GetDefaultLineThickness() * 3 ) ); + return m_size; } int GetPenSize() const override; diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index e265025608..ca80171121 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -59,7 +58,6 @@ #include #include #include -#include #include #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 ) ); diff --git a/eeschema/sch_painter.h b/eeschema/sch_painter.h index 812f3b04ee..fca3936115 100644 --- a/eeschema/sch_painter.h +++ b/eeschema/sch_painter.h @@ -107,6 +107,10 @@ public: bool m_ShowPinsElectricalType; bool m_ShowDisabled; bool m_ShowUmbilicals; + + int m_DefaultLineWidth; + int m_DefaultWireThickness; + int m_DefaultBusThickness; }; diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 82e9320d1b..b8247ee115 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -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 ) ) diff --git a/eeschema/sch_sexpr_plugin.cpp b/eeschema/sch_sexpr_plugin.cpp index da8ee16d8b..1b0b5a1b6d 100644 --- a/eeschema/sch_sexpr_plugin.cpp +++ b/eeschema/sch_sexpr_plugin.cpp @@ -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() ); diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 52d3d244e1..32ac8ef077 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -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 ); diff --git a/eeschema/sch_sheet_pin.cpp b/eeschema/sch_sheet_pin.cpp index 8fda0f5bfc..2bb89c289b 100644 --- a/eeschema/sch_sheet_pin.cpp +++ b/eeschema/sch_sheet_pin.cpp @@ -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 } diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 90c8f29f17..970f9d7d32 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -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 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 & 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; diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index 113ebea7ea..9fb99dadc1 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -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() ); diff --git a/eeschema/tools/lib_drawing_tools.cpp b/eeschema/tools/lib_drawing_tools.cpp index d52c4cdac7..44aca72e06 100644 --- a/eeschema/tools/lib_drawing_tools.cpp +++ b/eeschema/tools/lib_drawing_tools.cpp @@ -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 #include -#include -#include #include -#include #include #include #include @@ -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 ) ); diff --git a/eeschema/tools/lib_edit_tool.cpp b/eeschema/tools/lib_edit_tool.cpp index e4b56108c9..3959d600bc 100644 --- a/eeschema/tools/lib_edit_tool.cpp +++ b/eeschema/tools/lib_edit_tool.cpp @@ -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(); diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index fa05bb284e..5160cbe478 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -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(); diff --git a/eeschema/tools/sch_line_wire_bus_tool.cpp b/eeschema/tools/sch_line_wire_bus_tool.cpp index 59f06ebd74..ea166d6323 100644 --- a/eeschema/tools/sch_line_wire_bus_tool.cpp +++ b/eeschema/tools/sch_line_wire_bus_tool.cpp @@ -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 );