libtree: Remember pane width

Stores the library pane width in settings to keep user preferences
This commit is contained in:
Seth Hillbrand 2019-02-05 07:06:36 -08:00
parent ea84020b1f
commit 3524bed75a
7 changed files with 31 additions and 15 deletions

View File

@ -47,6 +47,7 @@
#include <dialogs/panel_eeschema_display_options.h> #include <dialogs/panel_eeschema_display_options.h>
#include <dialogs/panel_libedit_display_options.h> #include <dialogs/panel_libedit_display_options.h>
#include <widgets/widget_eeschema_color_config.h> #include <widgets/widget_eeschema_color_config.h>
#include <widgets/symbol_tree_pane.h>
#include <dialogs/panel_libedit_settings.h> #include <dialogs/panel_libedit_settings.h>
#include <sch_view.h> #include <sch_view.h>
#include <sch_painter.h> #include <sch_painter.h>
@ -339,6 +340,7 @@ static const wxString RepeatStepYEntry = "RepeatStepY";
static const wxString RepeatLabelIncrementEntry = "RepeatLabelIncrement"; static const wxString RepeatLabelIncrementEntry = "RepeatLabelIncrement";
// Library editor wxConfig entry names. // Library editor wxConfig entry names.
static const wxChar defaultLibWidthEntry[] = wxT( "LibeditLibWidth" );
static const wxChar defaultPinNumSizeEntry[] = wxT( "LibeditPinNumSize" ); static const wxChar defaultPinNumSizeEntry[] = wxT( "LibeditPinNumSize" );
static const wxChar defaultPinNameSizeEntry[] = wxT( "LibeditPinNameSize" ); static const wxChar defaultPinNameSizeEntry[] = wxT( "LibeditPinNameSize" );
static const wxChar DefaultPinLengthEntry[] = wxT( "DefaultPinLength" ); static const wxChar DefaultPinLengthEntry[] = wxT( "DefaultPinLength" );
@ -525,11 +527,13 @@ void LIB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
m_textPinNameDefaultSize = (int) aCfg->Read( defaultPinNameSizeEntry, DEFAULTPINNAMESIZE ); m_textPinNameDefaultSize = (int) aCfg->Read( defaultPinNameSizeEntry, DEFAULTPINNAMESIZE );
SetRepeatDeltaLabel( (int) aCfg->Read( repeatLibLabelIncEntry, DEFAULT_REPEAT_LABEL_INC ) ); SetRepeatDeltaLabel( (int) aCfg->Read( repeatLibLabelIncEntry, DEFAULT_REPEAT_LABEL_INC ) );
SetRepeatPinStep( (int) aCfg->Read( pinRepeatStepEntry, DEFAULT_REPEAT_OFFSET_PIN ) ); SetRepeatPinStep( (int) aCfg->Read( pinRepeatStepEntry, DEFAULT_REPEAT_OFFSET_PIN ) );
wxPoint step; wxPoint step;
step.x = (int) aCfg->Read( repeatLibStepXEntry, (long) DEFAULT_REPEAT_OFFSET_X ); aCfg->Read( repeatLibStepXEntry, &step.x, DEFAULT_REPEAT_OFFSET_X );
step.y = (int) aCfg->Read( repeatLibStepYEntry, (long) DEFAULT_REPEAT_OFFSET_Y ); aCfg->Read( repeatLibStepYEntry, &step.y, DEFAULT_REPEAT_OFFSET_Y );
SetRepeatStep( step ); SetRepeatStep( step );
m_showPinElectricalTypeName = aCfg->ReadBool( showPinElectricalType, true ); m_showPinElectricalTypeName = aCfg->ReadBool( showPinElectricalType, true );
aCfg->Read( defaultLibWidthEntry, &m_defaultLibWidth, DEFAULTLIBWIDTH );
wxString templateFieldNames = aCfg->Read( FieldNamesEntry, wxEmptyString ); wxString templateFieldNames = aCfg->Read( FieldNamesEntry, wxEmptyString );
@ -563,14 +567,15 @@ void LIB_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg )
{ {
EDA_DRAW_FRAME::SaveSettings( aCfg ); EDA_DRAW_FRAME::SaveSettings( aCfg );
aCfg->Write( DefaultPinLengthEntry, (long) GetDefaultPinLength() ); aCfg->Write( DefaultPinLengthEntry, GetDefaultPinLength() );
aCfg->Write( defaultPinNumSizeEntry, (long) GetPinNumDefaultSize() ); aCfg->Write( defaultPinNumSizeEntry, GetPinNumDefaultSize() );
aCfg->Write( defaultPinNameSizeEntry, (long) GetPinNameDefaultSize() ); aCfg->Write( defaultPinNameSizeEntry, GetPinNameDefaultSize() );
aCfg->Write( repeatLibLabelIncEntry, (long) GetRepeatDeltaLabel() ); aCfg->Write( repeatLibLabelIncEntry, GetRepeatDeltaLabel() );
aCfg->Write( pinRepeatStepEntry, (long) GetRepeatPinStep() ); aCfg->Write( pinRepeatStepEntry, GetRepeatPinStep() );
aCfg->Write( repeatLibStepXEntry, (long) GetRepeatStep().x ); aCfg->Write( repeatLibStepXEntry, GetRepeatStep().x );
aCfg->Write( repeatLibStepYEntry, (long) GetRepeatStep().y ); aCfg->Write( repeatLibStepYEntry, GetRepeatStep().y );
aCfg->Write( showPinElectricalType, GetShowElectricalType() ); aCfg->Write( showPinElectricalType, GetShowElectricalType() );
aCfg->Write( defaultLibWidthEntry, m_treePane->GetSize().x );
} }

View File

@ -67,6 +67,9 @@ class SCH_SHEET;
///< The default pin name size when creating pins(can be changed in preference menu) ///< The default pin name size when creating pins(can be changed in preference menu)
#define DEFAULTPINNAMESIZE 50 #define DEFAULTPINNAMESIZE 50
///< The default library pane width
#define DEFAULTLIBWIDTH 250
#define GR_DEFAULT_DRAWMODE GR_COPY #define GR_DEFAULT_DRAWMODE GR_COPY
/* Rotation, mirror of graphic items in components bodies are handled by a /* Rotation, mirror of graphic items in components bodies are handled by a

View File

@ -75,7 +75,6 @@ int LIB_EDIT_FRAME:: m_convert = 1;
LIB_ITEM* LIB_EDIT_FRAME::m_lastDrawItem = NULL; LIB_ITEM* LIB_EDIT_FRAME::m_lastDrawItem = NULL;
bool LIB_EDIT_FRAME:: m_showDeMorgan = false; bool LIB_EDIT_FRAME:: m_showDeMorgan = false;
wxSize LIB_EDIT_FRAME:: m_clientSize = wxSize( -1, -1 );
int LIB_EDIT_FRAME:: m_textSize = -1; int LIB_EDIT_FRAME:: m_textSize = -1;
double LIB_EDIT_FRAME:: m_current_text_angle = TEXT_ANGLE_HORIZ; double LIB_EDIT_FRAME:: m_current_text_angle = TEXT_ANGLE_HORIZ;
int LIB_EDIT_FRAME:: m_drawLineWidth = 0; 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_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "ComponentTree" ).Left().Layer(1) 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_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(1) );
m_auimgr.AddPane( m_canvas->GetWindow(), wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() ); m_auimgr.AddPane( m_canvas->GetWindow(), wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );

View File

@ -142,7 +142,7 @@ class LIB_EDIT_FRAME : public SCH_BASE_FRAME
/// Default repeat offset for pins in repeat place pin /// Default repeat offset for pins in repeat place pin
int m_repeatPinStep; int m_repeatPinStep;
static wxSize m_clientSize; int m_defaultLibWidth;
friend class DIALOG_LIB_EDIT_TEXT; friend class DIALOG_LIB_EDIT_TEXT;

View File

@ -742,7 +742,6 @@ void LIB_VIEW_FRAME::LoadSettings( wxConfigBase* aCfg )
aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 150 ); aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 150 );
aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 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 ); m_showPinElectricalTypeName = aCfg->Read( CMPVIEW_SHOW_PINELECTRICALTYPE_KEY, true );
// Set parameters to a reasonable value. // 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() ) ); return BOX2I( bbox.GetOrigin(), VECTOR2I( bbox.GetWidth(), bbox.GetHeight() ) );
} }
} }

View File

@ -209,6 +209,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
END_EVENT_TABLE() END_EVENT_TABLE()
static const wxChar defaultLibWidthEntry[] = wxT( "ModeditLibWidth" );
FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
EDA_DRAW_PANEL_GAL::GAL_TYPE aBackend ) : 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 // Vertical items; layers 1 - 3
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(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) 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_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(1) );
m_auimgr.AddPane( m_Layers, EDA_PANE().Palette().Name( "LayersManager" ).Right().Layer(3) 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 ) ) if( ( settings.m_ValueDefaultlayer != F_SilkS ) && ( settings.m_ValueDefaultlayer != F_Fab ) )
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 ); PCB_BASE_FRAME::SaveSettings( aCfg );
wxConfigSaveSetups( aCfg, GetConfigurationSettings() ); wxConfigSaveSetups( aCfg, GetConfigurationSettings() );
aCfg->Write( defaultLibWidthEntry, m_treePane->GetSize().x );
} }

View File

@ -51,6 +51,8 @@ class FOOTPRINT_EDIT_FRAME : public PCB_BASE_EDIT_FRAME
std::unique_ptr<MODULE> m_revertModule; std::unique_ptr<MODULE> m_revertModule;
wxString m_footprintNameWhenLoaded; wxString m_footprintNameWhenLoaded;
int m_defaultLibWidth;
public: public:
~FOOTPRINT_EDIT_FRAME(); ~FOOTPRINT_EDIT_FRAME();
@ -556,6 +558,7 @@ private:
* @param aIncrement increment the number of pad (if that is what is selected) * @param aIncrement increment the number of pad (if that is what is selected)
*/ */
void duplicateItems( bool aIncrement ) override; void duplicateItems( bool aIncrement ) override;
}; };
#endif // FOOTPRINT_EDIT_FRAME_H #endif // FOOTPRINT_EDIT_FRAME_H