mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 00:21:25 +00:00
Make sure symbol editor prefs go in symbol_editor file.
(And same for footprint editor.) Fixes https://gitlab.com/kicad/code/kicad/-/issues/18905
This commit is contained in:
parent
99b2a3cef9
commit
f7f86174a0
@ -126,9 +126,11 @@ LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ToNode( wxDataViewItem aItem )
|
||||
|
||||
|
||||
LIB_TREE_MODEL_ADAPTER::LIB_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent,
|
||||
const wxString& aPinnedKey ) :
|
||||
const wxString& aPinnedKey,
|
||||
APP_SETTINGS_BASE* aCfg ) :
|
||||
m_widget( nullptr ),
|
||||
m_parent( aParent ),
|
||||
m_cfg( aCfg ),
|
||||
m_sort_mode( BEST_MATCH ),
|
||||
m_show_units( true ),
|
||||
m_preselect_unit( 0 ),
|
||||
@ -141,12 +143,10 @@ LIB_TREE_MODEL_ADAPTER::LIB_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent,
|
||||
|
||||
m_availableColumns = { _HKI( "Item" ), _HKI( "Description" ) };
|
||||
|
||||
APP_SETTINGS_BASE* cfg = Kiface().KifaceSettings();
|
||||
|
||||
for( const std::pair<const wxString, int>& pair : cfg->m_LibTree.column_widths )
|
||||
for( const std::pair<const wxString, int>& pair : m_cfg->m_LibTree.column_widths )
|
||||
m_colWidths[pair.first] = pair.second;
|
||||
|
||||
m_shownColumns = cfg->m_LibTree.columns;
|
||||
m_shownColumns = m_cfg->m_LibTree.columns;
|
||||
|
||||
if( m_shownColumns.empty() )
|
||||
m_shownColumns = { _HKI( "Item" ), _HKI( "Description" ) };
|
||||
@ -196,15 +196,13 @@ void LIB_TREE_MODEL_ADAPTER::SaveSettings()
|
||||
{
|
||||
if( m_widget )
|
||||
{
|
||||
APP_SETTINGS_BASE* cfg = Kiface().KifaceSettings();
|
||||
|
||||
cfg->m_LibTree.columns = GetShownColumns();
|
||||
cfg->m_LibTree.column_widths.clear();
|
||||
m_cfg->m_LibTree.columns = GetShownColumns();
|
||||
m_cfg->m_LibTree.column_widths.clear();
|
||||
|
||||
for( const std::pair<const wxString, wxDataViewColumn*>& pair : m_colNameMap )
|
||||
cfg->m_LibTree.column_widths[pair.first] = pair.second->GetWidth();
|
||||
m_cfg->m_LibTree.column_widths[pair.first] = pair.second->GetWidth();
|
||||
|
||||
cfg->m_LibTree.open_libs = GetOpenLibs();
|
||||
m_cfg->m_LibTree.open_libs = GetOpenLibs();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <pgm_base.h>
|
||||
#include <kiface_base.h>
|
||||
#include <eda_base_frame.h>
|
||||
#include <core/kicad_algo.h>
|
||||
#include <settings/common_settings.h>
|
||||
@ -29,9 +30,6 @@
|
||||
#include <design_block.h>
|
||||
#include <design_block_lib_table.h>
|
||||
#include <design_block_info.h>
|
||||
#include <footprint_info.h>
|
||||
#include <wx/settings.h>
|
||||
|
||||
#include <design_block_tree_model_adapter.h>
|
||||
#include <tools/sch_design_block_control.h>
|
||||
|
||||
@ -46,7 +44,8 @@ DESIGN_BLOCK_TREE_MODEL_ADAPTER::Create( EDA_BASE_FRAME* aParent, LIB_TABLE* aLi
|
||||
|
||||
DESIGN_BLOCK_TREE_MODEL_ADAPTER::DESIGN_BLOCK_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent,
|
||||
LIB_TABLE* aLibs ) :
|
||||
LIB_TREE_MODEL_ADAPTER( aParent, wxT( "pinned_design_block_libs" ) ),
|
||||
LIB_TREE_MODEL_ADAPTER( aParent, wxT( "pinned_design_block_libs" ),
|
||||
Kiface().KifaceSettings() ),
|
||||
m_libs( (DESIGN_BLOCK_LIB_TABLE*) aLibs )
|
||||
{
|
||||
}
|
||||
|
@ -147,6 +147,22 @@ SYMBOL_EDITOR_SETTINGS* SCH_BASE_FRAME::libeditconfig() const
|
||||
}
|
||||
|
||||
|
||||
APP_SETTINGS_BASE* SCH_BASE_FRAME::GetViewerSettingsBase() const
|
||||
{
|
||||
switch( GetFrameType() )
|
||||
{
|
||||
case FRAME_SCH:
|
||||
default:
|
||||
return Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
|
||||
|
||||
case FRAME_SCH_SYMBOL_EDITOR:
|
||||
case FRAME_SCH_VIEWER:
|
||||
case FRAME_SYMBOL_CHOOSER:
|
||||
return Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
|
||||
{
|
||||
GetScreen()->SetPageSettings( aPageSettings );
|
||||
|
@ -118,6 +118,8 @@ public:
|
||||
|
||||
SYMBOL_EDITOR_SETTINGS* libeditconfig() const;
|
||||
|
||||
APP_SETTINGS_BASE* GetViewerSettingsBase() const;
|
||||
|
||||
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
|
||||
|
@ -1060,6 +1060,7 @@ void SYMBOL_EDIT_FRAME::saveSymbolCopyAs( bool aOpenCopy )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
case wxID_OK: // No conflicts
|
||||
case ID_OVERWRITE_CONFLICTS:
|
||||
case ID_RENAME_CONFLICTS:
|
||||
@ -1073,12 +1074,16 @@ void SYMBOL_EDIT_FRAME::saveSymbolCopyAs( bool aOpenCopy )
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case ID_MAKE_NEW_LIBRARY:
|
||||
{
|
||||
wxFileName newLibrary( AddLibraryFile( true ) );
|
||||
libraryName = newLibrary.GetName();
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,15 +42,15 @@ bool SYMBOL_TREE_MODEL_ADAPTER::m_show_progress = true;
|
||||
|
||||
|
||||
wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>
|
||||
SYMBOL_TREE_MODEL_ADAPTER::Create( EDA_BASE_FRAME* aParent, LIB_TABLE* aLibs )
|
||||
SYMBOL_TREE_MODEL_ADAPTER::Create( SCH_BASE_FRAME* aParent, LIB_TABLE* aLibs )
|
||||
{
|
||||
auto* adapter = new SYMBOL_TREE_MODEL_ADAPTER( aParent, aLibs );
|
||||
return wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>( adapter );
|
||||
}
|
||||
|
||||
|
||||
SYMBOL_TREE_MODEL_ADAPTER::SYMBOL_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent, LIB_TABLE* aLibs ) :
|
||||
LIB_TREE_MODEL_ADAPTER( aParent, "pinned_symbol_libs" ),
|
||||
SYMBOL_TREE_MODEL_ADAPTER::SYMBOL_TREE_MODEL_ADAPTER( SCH_BASE_FRAME* aParent, LIB_TABLE* aLibs ) :
|
||||
LIB_TREE_MODEL_ADAPTER( aParent, "pinned_symbol_libs", aParent->GetViewerSettingsBase() ),
|
||||
m_libs( (SYMBOL_LIB_TABLE*) aLibs )
|
||||
{
|
||||
// Symbols may have different value from name
|
||||
|
@ -46,7 +46,7 @@ SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Create( SYMBOL_EDIT_FRAME* aParent,
|
||||
|
||||
SYMBOL_TREE_SYNCHRONIZING_ADAPTER::SYMBOL_TREE_SYNCHRONIZING_ADAPTER( SYMBOL_EDIT_FRAME* aParent,
|
||||
SYMBOL_LIBRARY_MANAGER* aLibMgr ) :
|
||||
LIB_TREE_MODEL_ADAPTER( aParent, "pinned_symbol_libs" ),
|
||||
LIB_TREE_MODEL_ADAPTER( aParent, "pinned_symbol_libs", aParent->GetViewerSettingsBase() ),
|
||||
m_frame( aParent ),
|
||||
m_libMgr( aLibMgr ),
|
||||
m_lastSyncHash( -1 )
|
||||
|
@ -338,8 +338,10 @@ protected:
|
||||
*
|
||||
* @param aParent is the parent frame
|
||||
* @param aPinnedKey is the key to load the pinned libraries list from the project file
|
||||
* @param aCfg app settings for the specific editor
|
||||
*/
|
||||
LIB_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent, const wxString& aPinnedKey );
|
||||
LIB_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent, const wxString& aPinnedKey,
|
||||
APP_SETTINGS_BASE* aCfg );
|
||||
|
||||
LIB_TREE_NODE_LIBRARY& DoAddLibraryNode( const wxString& aNodeName, const wxString& aDesc,
|
||||
bool pinned );
|
||||
@ -424,6 +426,7 @@ protected:
|
||||
|
||||
private:
|
||||
EDA_BASE_FRAME* m_parent;
|
||||
APP_SETTINGS_BASE* m_cfg;
|
||||
|
||||
SORT_MODE m_sort_mode;
|
||||
bool m_show_units;
|
||||
|
@ -18,31 +18,31 @@
|
||||
*/
|
||||
|
||||
#include <pgm_base.h>
|
||||
#include <eda_base_frame.h>
|
||||
#include <pcb_base_frame.h>
|
||||
#include <core/kicad_algo.h>
|
||||
#include <settings/common_settings.h>
|
||||
#include <pcbnew_settings.h>
|
||||
#include <project/project_file.h>
|
||||
#include <wx/tokenzr.h>
|
||||
#include <string_utils.h>
|
||||
#include <eda_pattern_match.h>
|
||||
#include <fp_lib_table.h>
|
||||
#include <footprint_info.h>
|
||||
#include <footprint_info_impl.h>
|
||||
#include <generate_footprint_info.h>
|
||||
#include <wx/settings.h>
|
||||
|
||||
#include "fp_tree_model_adapter.h"
|
||||
|
||||
wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>
|
||||
FP_TREE_MODEL_ADAPTER::Create( EDA_BASE_FRAME* aParent, LIB_TABLE* aLibs )
|
||||
FP_TREE_MODEL_ADAPTER::Create( PCB_BASE_FRAME* aParent, LIB_TABLE* aLibs )
|
||||
{
|
||||
auto* adapter = new FP_TREE_MODEL_ADAPTER( aParent, aLibs );
|
||||
return wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>( adapter );
|
||||
}
|
||||
|
||||
|
||||
FP_TREE_MODEL_ADAPTER::FP_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent, LIB_TABLE* aLibs ) :
|
||||
LIB_TREE_MODEL_ADAPTER( aParent, wxT( "pinned_footprint_libs" ) ),
|
||||
FP_TREE_MODEL_ADAPTER::FP_TREE_MODEL_ADAPTER( PCB_BASE_FRAME* aParent, LIB_TABLE* aLibs ) :
|
||||
LIB_TREE_MODEL_ADAPTER( aParent, wxT( "pinned_footprint_libs" ),
|
||||
aParent->GetViewerSettingsBase() ),
|
||||
m_libs( (FP_LIB_TABLE*) aLibs )
|
||||
{}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
class LIB_TABLE;
|
||||
class FP_LIB_TABLE;
|
||||
class PCB_BASE_FRAME;
|
||||
|
||||
class FP_TREE_MODEL_ADAPTER : public LIB_TREE_MODEL_ADAPTER
|
||||
{
|
||||
@ -36,7 +37,7 @@ public:
|
||||
*
|
||||
* @param aLibs library set from which parts will be loaded
|
||||
*/
|
||||
static wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> Create( EDA_BASE_FRAME* aParent,
|
||||
static wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> Create( PCB_BASE_FRAME* aParent,
|
||||
LIB_TABLE* aLibs );
|
||||
|
||||
void AddLibraries( EDA_BASE_FRAME* aParent );
|
||||
@ -47,7 +48,7 @@ protected:
|
||||
/**
|
||||
* Constructor; takes a set of libraries to be included in the search.
|
||||
*/
|
||||
FP_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent, LIB_TABLE* aLibs );
|
||||
FP_TREE_MODEL_ADAPTER( PCB_BASE_FRAME* aParent, LIB_TABLE* aLibs );
|
||||
|
||||
std::vector<LIB_TREE_ITEM*> getFootprints( const wxString& aLibName );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user