diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 27c4f1e713..46f56a4d29 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -339,6 +340,7 @@ static const wxString RepeatStepYEntry = "RepeatStepY"; static const wxString RepeatLabelIncrementEntry = "RepeatLabelIncrement"; // Library editor wxConfig entry names. +static const wxChar defaultLibWidthEntry[] = wxT( "LibeditLibWidth" ); static const wxChar defaultPinNumSizeEntry[] = wxT( "LibeditPinNumSize" ); static const wxChar defaultPinNameSizeEntry[] = wxT( "LibeditPinNameSize" ); static const wxChar DefaultPinLengthEntry[] = wxT( "DefaultPinLength" ); @@ -525,11 +527,13 @@ void LIB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) m_textPinNameDefaultSize = (int) aCfg->Read( defaultPinNameSizeEntry, DEFAULTPINNAMESIZE ); SetRepeatDeltaLabel( (int) aCfg->Read( repeatLibLabelIncEntry, DEFAULT_REPEAT_LABEL_INC ) ); SetRepeatPinStep( (int) aCfg->Read( pinRepeatStepEntry, DEFAULT_REPEAT_OFFSET_PIN ) ); + wxPoint step; - step.x = (int) aCfg->Read( repeatLibStepXEntry, (long) DEFAULT_REPEAT_OFFSET_X ); - step.y = (int) aCfg->Read( repeatLibStepYEntry, (long) DEFAULT_REPEAT_OFFSET_Y ); + aCfg->Read( repeatLibStepXEntry, &step.x, DEFAULT_REPEAT_OFFSET_X ); + aCfg->Read( repeatLibStepYEntry, &step.y, DEFAULT_REPEAT_OFFSET_Y ); SetRepeatStep( step ); m_showPinElectricalTypeName = aCfg->ReadBool( showPinElectricalType, true ); + aCfg->Read( defaultLibWidthEntry, &m_defaultLibWidth, DEFAULTLIBWIDTH ); wxString templateFieldNames = aCfg->Read( FieldNamesEntry, wxEmptyString ); @@ -563,14 +567,15 @@ void LIB_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg ) { EDA_DRAW_FRAME::SaveSettings( aCfg ); - aCfg->Write( DefaultPinLengthEntry, (long) GetDefaultPinLength() ); - aCfg->Write( defaultPinNumSizeEntry, (long) GetPinNumDefaultSize() ); - aCfg->Write( defaultPinNameSizeEntry, (long) GetPinNameDefaultSize() ); - aCfg->Write( repeatLibLabelIncEntry, (long) GetRepeatDeltaLabel() ); - aCfg->Write( pinRepeatStepEntry, (long) GetRepeatPinStep() ); - aCfg->Write( repeatLibStepXEntry, (long) GetRepeatStep().x ); - aCfg->Write( repeatLibStepYEntry, (long) GetRepeatStep().y ); + aCfg->Write( DefaultPinLengthEntry, GetDefaultPinLength() ); + aCfg->Write( defaultPinNumSizeEntry, GetPinNumDefaultSize() ); + aCfg->Write( defaultPinNameSizeEntry, GetPinNameDefaultSize() ); + aCfg->Write( repeatLibLabelIncEntry, GetRepeatDeltaLabel() ); + aCfg->Write( pinRepeatStepEntry, GetRepeatPinStep() ); + aCfg->Write( repeatLibStepXEntry, GetRepeatStep().x ); + aCfg->Write( repeatLibStepYEntry, GetRepeatStep().y ); aCfg->Write( showPinElectricalType, GetShowElectricalType() ); + aCfg->Write( defaultLibWidthEntry, m_treePane->GetSize().x ); } diff --git a/eeschema/general.h b/eeschema/general.h index a15012c295..c147204081 100644 --- a/eeschema/general.h +++ b/eeschema/general.h @@ -67,6 +67,9 @@ class SCH_SHEET; ///< The default pin name size when creating pins(can be changed in preference menu) #define DEFAULTPINNAMESIZE 50 +///< The default library pane width +#define DEFAULTLIBWIDTH 250 + #define GR_DEFAULT_DRAWMODE GR_COPY /* Rotation, mirror of graphic items in components bodies are handled by a diff --git a/eeschema/libedit/lib_edit_frame.cpp b/eeschema/libedit/lib_edit_frame.cpp index 9c71655411..dbf68cbd4a 100644 --- a/eeschema/libedit/lib_edit_frame.cpp +++ b/eeschema/libedit/lib_edit_frame.cpp @@ -75,7 +75,6 @@ int LIB_EDIT_FRAME:: m_convert = 1; LIB_ITEM* LIB_EDIT_FRAME::m_lastDrawItem = NULL; bool LIB_EDIT_FRAME:: m_showDeMorgan = false; -wxSize LIB_EDIT_FRAME:: m_clientSize = wxSize( -1, -1 ); int LIB_EDIT_FRAME:: m_textSize = -1; double LIB_EDIT_FRAME:: m_current_text_angle = TEXT_ANGLE_HORIZ; int LIB_EDIT_FRAME:: m_drawLineWidth = 0; @@ -262,7 +261,8 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) ); m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "ComponentTree" ).Left().Layer(1) - .Caption( _( "Libraries" ) ).MinSize( 250, -1 ).Resizable() ); + .Caption( _( "Libraries" ) ).MinSize( 250, -1 ) + .BestSize( m_defaultLibWidth, -1 ).Resizable() ); m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(1) ); m_auimgr.AddPane( m_canvas->GetWindow(), wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() ); diff --git a/eeschema/libedit/lib_edit_frame.h b/eeschema/libedit/lib_edit_frame.h index 1daed6156f..9576726813 100644 --- a/eeschema/libedit/lib_edit_frame.h +++ b/eeschema/libedit/lib_edit_frame.h @@ -142,7 +142,7 @@ class LIB_EDIT_FRAME : public SCH_BASE_FRAME /// Default repeat offset for pins in repeat place pin int m_repeatPinStep; - static wxSize m_clientSize; + int m_defaultLibWidth; friend class DIALOG_LIB_EDIT_TEXT; diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index 259150381f..116dd7c8a3 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -742,7 +742,6 @@ void LIB_VIEW_FRAME::LoadSettings( wxConfigBase* aCfg ) aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 150 ); aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 ); - aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 ); m_showPinElectricalTypeName = aCfg->Read( CMPVIEW_SHOW_PINELECTRICALTYPE_KEY, true ); // Set parameters to a reasonable value. @@ -821,4 +820,4 @@ const BOX2I LIB_VIEW_FRAME::GetDocumentExtents() const return BOX2I( bbox.GetOrigin(), VECTOR2I( bbox.GetWidth(), bbox.GetHeight() ) ); } -} \ No newline at end of file +} diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 7789d84b72..2453e31091 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -209,6 +209,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) END_EVENT_TABLE() +static const wxChar defaultLibWidthEntry[] = wxT( "ModeditLibWidth" ); FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, EDA_DRAW_PANEL_GAL::GAL_TYPE aBackend ) : @@ -310,7 +311,8 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, // Vertical items; layers 1 - 3 m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) ); m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "Footprints" ).Left().Layer(1) - .Caption( _( "Libraries" ) ).MinSize( 250, 400 ) ); + .Caption( _( "Libraries" ) ).MinSize( 250, 400 ) + .BestSize( m_defaultLibWidth, -1 ) ); m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(1) ); m_auimgr.AddPane( m_Layers, EDA_PANE().Palette().Name( "LayersManager" ).Right().Layer(3) @@ -511,6 +513,8 @@ void FOOTPRINT_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) if( ( settings.m_ValueDefaultlayer != F_SilkS ) && ( settings.m_ValueDefaultlayer != F_Fab ) ) settings.m_ValueDefaultlayer = F_Fab; + + aCfg->Read( defaultLibWidthEntry, &m_defaultLibWidth, 250 ); } @@ -520,6 +524,8 @@ void FOOTPRINT_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg ) PCB_BASE_FRAME::SaveSettings( aCfg ); wxConfigSaveSetups( aCfg, GetConfigurationSettings() ); + + aCfg->Write( defaultLibWidthEntry, m_treePane->GetSize().x ); } diff --git a/pcbnew/footprint_edit_frame.h b/pcbnew/footprint_edit_frame.h index 78ebed0033..1f821b3f5f 100644 --- a/pcbnew/footprint_edit_frame.h +++ b/pcbnew/footprint_edit_frame.h @@ -51,6 +51,8 @@ class FOOTPRINT_EDIT_FRAME : public PCB_BASE_EDIT_FRAME std::unique_ptr m_revertModule; wxString m_footprintNameWhenLoaded; + int m_defaultLibWidth; + public: ~FOOTPRINT_EDIT_FRAME(); @@ -556,6 +558,7 @@ private: * @param aIncrement increment the number of pad (if that is what is selected) */ void duplicateItems( bool aIncrement ) override; + }; #endif // FOOTPRINT_EDIT_FRAME_H