diff --git a/common/dialogs/dialog_grid_settings.cpp b/common/dialogs/dialog_grid_settings.cpp index 3bc23da79e..efe47bafbf 100644 --- a/common/dialogs/dialog_grid_settings.cpp +++ b/common/dialogs/dialog_grid_settings.cpp @@ -50,7 +50,7 @@ DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS( EDA_DRAW_FRAME* aParent ): m_grid2Ctrl->Append( grids ); if( m_parent->IsType( FRAME_SCH ) - || m_parent->IsType( FRAME_SCH_LIB_EDITOR ) + || m_parent->IsType( FRAME_SCH_SYMBOL_EDITOR ) || m_parent->IsType( FRAME_SCH_VIEWER ) || m_parent->IsType( FRAME_SCH_VIEWER_MODAL ) || m_parent->IsType( FRAME_SIMULATOR ) ) diff --git a/common/kiway.cpp b/common/kiway.cpp index a0f06e7c44..fdaf174ba3 100644 --- a/common/kiway.cpp +++ b/common/kiway.cpp @@ -295,7 +295,7 @@ KIWAY::FACE_T KIWAY::KifaceType( FRAME_T aFrameType ) switch( aFrameType ) { case FRAME_SCH: - case FRAME_SCH_LIB_EDITOR: + case FRAME_SCH_SYMBOL_EDITOR: case FRAME_SCH_VIEWER: case FRAME_SCH_VIEWER_MODAL: case FRAME_SIMULATOR: diff --git a/common/tool/actions.cpp b/common/tool/actions.cpp index 468b86f186..ef15937e96 100644 --- a/common/tool/actions.cpp +++ b/common/tool/actions.cpp @@ -545,7 +545,7 @@ TOOL_ACTION ACTIONS::showSymbolBrowser( "common.Control.showSymbolBrowser", TOOL_ACTION ACTIONS::showSymbolEditor( "common.Control.showSymbolEditor", AS_GLOBAL, 0, "", _( "Symbol Editor" ), _( "Create, delete and edit symbols" ), - libedit_xpm, AF_NONE, (void*) FRAME_SCH_LIB_EDITOR ); + libedit_xpm, AF_NONE, (void*) FRAME_SCH_SYMBOL_EDITOR ); TOOL_ACTION ACTIONS::showFootprintBrowser( "common.Control.showFootprintBrowser", AS_GLOBAL, 0, "", diff --git a/common/tool/common_tools.cpp b/common/tool/common_tools.cpp index 1f1a856576..79cb2f58e9 100644 --- a/common/tool/common_tools.cpp +++ b/common/tool/common_tools.cpp @@ -336,7 +336,8 @@ int COMMON_TOOLS::doZoomFit( ZOOM_FIT_TYPE_T aFitType ) { margin_scale_factor = 1.4; } - else if( frame->IsType( FRAME_SCH_LIB_EDITOR ) || frame->IsType( FRAME_FOOTPRINT_EDITOR ) ) + else if( frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) + || frame->IsType( FRAME_FOOTPRINT_EDITOR ) ) { margin_scale_factor = 2; } diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index f0c07c60e3..168fef2bea 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -24,7 +24,7 @@ include_directories( ./dialogs ./netlist_exporters ./widgets - ./libedit + symbol_editor ./libview ./tools ${CMAKE_SOURCE_DIR}/common @@ -137,16 +137,15 @@ set( EESCHEMA_WIDGETS set ( EESCHEMA_LIBEDIT_SRCS - libedit/libedit.cpp - libedit/libedit_plot_component.cpp - libedit/libedit_settings.cpp - libedit/libedit_undo_redo.cpp - libedit/lib_edit_frame.cpp - libedit/menubar_libedit.cpp - libedit/symbedit.cpp - libedit/toolbars_libedit.cpp - libedit/lib_export.cpp - libedit/lib_manager.cpp + symbol_editor/symbol_editor.cpp + symbol_editor/symbol_editor_plotter.cpp + symbol_editor/symbol_editor_settings.cpp + symbol_editor/symbol_editor_undo_redo.cpp + symbol_editor/symbol_edit_frame.cpp + symbol_editor/menubar_symbol_editor.cpp + symbol_editor/toolbars_symbol_editor.cpp + symbol_editor/symbol_editor_import_export.cpp + symbol_editor/symbol_library_manager.cpp ) set( EESCHEMA_SRCS diff --git a/eeschema/dialogs/dialog_edit_one_field.cpp b/eeschema/dialogs/dialog_edit_one_field.cpp index 5b65dff09c..e8aac9a632 100644 --- a/eeschema/dialogs/dialog_edit_one_field.cpp +++ b/eeschema/dialogs/dialog_edit_one_field.cpp @@ -79,15 +79,15 @@ DIALOG_EDIT_ONE_FIELD::~DIALOG_EDIT_ONE_FIELD() void DIALOG_EDIT_ONE_FIELD::init() { SCH_BASE_FRAME* parent = GetParent(); - bool libedit = parent->IsType( FRAME_SCH_LIB_EDITOR ); + bool isSymbolEditor = parent->IsType( FRAME_SCH_SYMBOL_EDITOR ); - m_TextCtrl->SetValidator( SCH_FIELD_VALIDATOR( libedit, m_fieldId, &m_text ) ); + m_TextCtrl->SetValidator( SCH_FIELD_VALIDATOR( isSymbolEditor, m_fieldId, &m_text ) ); // Disable options for graphic text editing which are not needed for fields. m_CommonConvert->Show( false ); m_CommonUnit->Show( false ); - if( !libedit && ( m_fieldId == REFERENCE || m_fieldId == VALUE ) ) + if( !isSymbolEditor && ( m_fieldId == REFERENCE || m_fieldId == VALUE ) ) { m_StyledTextCtrl->Show( false ); SetInitialFocus( m_TextCtrl ); diff --git a/eeschema/dialogs/dialog_lib_edit_draw_item.cpp b/eeschema/dialogs/dialog_lib_edit_draw_item.cpp index 1f2dc7ade5..fe533c7f70 100644 --- a/eeschema/dialogs/dialog_lib_edit_draw_item.cpp +++ b/eeschema/dialogs/dialog_lib_edit_draw_item.cpp @@ -28,10 +28,10 @@ #include #include #include -#include +#include -DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM( LIB_EDIT_FRAME* aParent, LIB_ITEM* aItem ) : +DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM( SYMBOL_EDIT_FRAME* aParent, LIB_ITEM* aItem ) : DIALOG_LIB_EDIT_DRAW_ITEM_BASE( aParent ), m_frame( aParent ), m_item( aItem ), diff --git a/eeschema/dialogs/dialog_lib_edit_draw_item.h b/eeschema/dialogs/dialog_lib_edit_draw_item.h index df57a71f82..9ec106ba90 100644 --- a/eeschema/dialogs/dialog_lib_edit_draw_item.h +++ b/eeschema/dialogs/dialog_lib_edit_draw_item.h @@ -27,7 +27,7 @@ class LIB_ITEM; -class LIB_EDIT_FRAME; +class SYMBOL_EDIT_FRAME; #include @@ -40,7 +40,7 @@ class DIALOG_LIB_EDIT_DRAW_ITEM : public DIALOG_LIB_EDIT_DRAW_ITEM_BASE { public: /** Constructor */ - DIALOG_LIB_EDIT_DRAW_ITEM( LIB_EDIT_FRAME* parent, LIB_ITEM* aItem ); + DIALOG_LIB_EDIT_DRAW_ITEM( SYMBOL_EDIT_FRAME* parent, LIB_ITEM* aItem ); bool TransferDataToWindow() override; @@ -50,9 +50,9 @@ public: int GetFillStyle(); private: - LIB_EDIT_FRAME* m_frame; - LIB_ITEM* m_item; - UNIT_BINDER m_lineWidth; + SYMBOL_EDIT_FRAME* m_frame; + LIB_ITEM* m_item; + UNIT_BINDER m_lineWidth; }; #endif // __dialog_lib_edit_draw_item__ diff --git a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp index 113fa06504..a33e8438b5 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp +++ b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp @@ -27,8 +27,8 @@ #include "pin_number.h" #include #include -#include -#include +#include +#include #include #include #include @@ -383,7 +383,7 @@ public: }; -DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE( LIB_EDIT_FRAME* parent, LIB_PART* aPart ) : +DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE( SYMBOL_EDIT_FRAME* parent, LIB_PART* aPart ) : DIALOG_LIB_EDIT_PIN_TABLE_BASE( parent ), m_editFrame( parent ), m_part( aPart ) @@ -551,7 +551,7 @@ void DIALOG_LIB_EDIT_PIN_TABLE::OnAddRow( wxCommandEvent& event ) wxPoint pos = last->GetPosition(); - LIBEDIT_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings(); + auto* cfg = Pgm().GetSettingsManager().GetAppSettings(); if( last->GetOrientation() == PIN_LEFT || last->GetOrientation() == PIN_RIGHT ) pos.y -= Mils2iu(cfg->m_Repeat.pin_step); diff --git a/eeschema/dialogs/dialog_lib_edit_pin_table.h b/eeschema/dialogs/dialog_lib_edit_pin_table.h index f6e4c82365..eb20cd05b1 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin_table.h +++ b/eeschema/dialogs/dialog_lib_edit_pin_table.h @@ -44,13 +44,13 @@ enum COL_ORDER class PIN_TABLE_DATA_MODEL; -class LIB_EDIT_FRAME; +class SYMBOL_EDIT_FRAME; class DIALOG_LIB_EDIT_PIN_TABLE : public DIALOG_LIB_EDIT_PIN_TABLE_BASE { public: - DIALOG_LIB_EDIT_PIN_TABLE( LIB_EDIT_FRAME* parent, LIB_PART* aPart ); + DIALOG_LIB_EDIT_PIN_TABLE( SYMBOL_EDIT_FRAME* parent, LIB_PART* aPart ); ~DIALOG_LIB_EDIT_PIN_TABLE() override; bool TransferDataToWindow() override; @@ -71,7 +71,7 @@ protected: void updateSummary(); void adjustGridColumns( int aWidth ); - LIB_EDIT_FRAME* m_editFrame; + SYMBOL_EDIT_FRAME* m_editFrame; bool m_initialized = false; int m_originalColWidths[ COL_COUNT ]; wxString m_columnsShown; diff --git a/eeschema/dialogs/dialog_lib_edit_text.cpp b/eeschema/dialogs/dialog_lib_edit_text.cpp index 3b8f188e37..e78a8f7b06 100644 --- a/eeschema/dialogs/dialog_lib_edit_text.cpp +++ b/eeschema/dialogs/dialog_lib_edit_text.cpp @@ -22,16 +22,16 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include #include #include #include -#include +#include #include #include -DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT( LIB_EDIT_FRAME* aParent, LIB_TEXT* aText ) : +DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT( SYMBOL_EDIT_FRAME* aParent, LIB_TEXT* aText ) : DIALOG_LIB_EDIT_TEXT_BASE( aParent ), m_posX( aParent, m_xPosLabel, m_xPosCtrl, m_xPosUnits, true ), m_posY( aParent, m_yPosLabel, m_yPosCtrl, m_yPosUnits, true ), @@ -90,7 +90,7 @@ bool DIALOG_LIB_EDIT_TEXT::TransferDataToWindow() } else { - LIBEDIT_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings(); + auto* cfg = Pgm().GetSettingsManager().GetAppSettings(); LIB_DRAWING_TOOLS* tools = m_parent->GetToolManager()->GetTool(); m_textSize.SetValue( Mils2iu( cfg->m_Defaults.text_size ) ); diff --git a/eeschema/dialogs/dialog_lib_edit_text.h b/eeschema/dialogs/dialog_lib_edit_text.h index 0d6647d2c3..a6f81098cd 100644 --- a/eeschema/dialogs/dialog_lib_edit_text.h +++ b/eeschema/dialogs/dialog_lib_edit_text.h @@ -29,22 +29,22 @@ #include #include -class LIB_EDIT_FRAME; +class SYMBOL_EDIT_FRAME; class LIB_TEXT; class DIALOG_LIB_EDIT_TEXT : public DIALOG_LIB_EDIT_TEXT_BASE { private: - LIB_EDIT_FRAME* m_parent; - LIB_TEXT* m_graphicText; + SYMBOL_EDIT_FRAME* m_parent; + LIB_TEXT* m_graphicText; - UNIT_BINDER m_posX; - UNIT_BINDER m_posY; - UNIT_BINDER m_textSize; + UNIT_BINDER m_posX; + UNIT_BINDER m_posY; + UNIT_BINDER m_textSize; public: - DIALOG_LIB_EDIT_TEXT( LIB_EDIT_FRAME* aParent, LIB_TEXT* aText ); + DIALOG_LIB_EDIT_TEXT( SYMBOL_EDIT_FRAME* aParent, LIB_TEXT* aText ); ~DIALOG_LIB_EDIT_TEXT() override {}; private: diff --git a/eeschema/dialogs/dialog_lib_symbol_properties.cpp b/eeschema/dialogs/dialog_lib_symbol_properties.cpp index 74d7dfe6e8..58f01f1df4 100644 --- a/eeschema/dialogs/dialog_lib_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_lib_symbol_properties.cpp @@ -26,8 +26,8 @@ #include #include #include -#include -#include +#include +#include #include // for KiROUND #include #include @@ -40,7 +40,7 @@ #include #include -#include +#include int DIALOG_LIB_SYMBOL_PROPERTIES::m_lastOpenedPage = 0; @@ -48,7 +48,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES::LAST_LAYOUT DIALOG_LIB_SYMBOL_PROPERTIES::m_lastLayout = DIALOG_LIB_SYMBOL_PROPERTIES::NONE; -DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( LIB_EDIT_FRAME* aParent, +DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* aParent, LIB_PART* aLibEntry ) : DIALOG_LIB_SYMBOL_PROPERTIES_BASE( aParent ), m_Parent( aParent ), @@ -68,7 +68,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( LIB_EDIT_FRAME* aPar m_grid->PushEventHandler( new FIELDS_GRID_TRICKS( m_grid, this ) ); // Show/hide columns according to the user's preference - auto cfg = Pgm().GetSettingsManager().GetAppSettings(); + auto cfg = Pgm().GetSettingsManager().GetAppSettings(); m_grid->ShowHideColumns( cfg->m_EditComponentVisibleColumns ); wxGridCellAttr* attr = new wxGridCellAttr; @@ -121,7 +121,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES::~DIALOG_LIB_SYMBOL_PROPERTIES() { m_lastOpenedPage = m_NoteBook->GetSelection( ); - auto cfg = Pgm().GetSettingsManager().GetAppSettings(); + auto cfg = Pgm().GetSettingsManager().GetAppSettings(); cfg->m_EditComponentVisibleColumns = m_grid->GetShownColumns(); // Prevents crash bug in wxGrid's d'tor @@ -452,9 +452,9 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnAddField( wxCommandEvent& event ) if( !m_grid->CommitPendingChanges() ) return; - LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings(); - int fieldID = m_fields->size(); - LIB_FIELD newField( m_libEntry, fieldID ); + auto* settings = Pgm().GetSettingsManager().GetAppSettings(); + int fieldID = m_fields->size(); + LIB_FIELD newField( m_libEntry, fieldID ); newField.SetTextSize( wxSize( Mils2iu( settings->m_Defaults.text_size ), Mils2iu( settings->m_Defaults.text_size ) ) ); diff --git a/eeschema/dialogs/dialog_lib_symbol_properties.h b/eeschema/dialogs/dialog_lib_symbol_properties.h index 587e3f2607..cddd4e4359 100644 --- a/eeschema/dialogs/dialog_lib_symbol_properties.h +++ b/eeschema/dialogs/dialog_lib_symbol_properties.h @@ -30,7 +30,7 @@ #include -class LIB_EDIT_FRAME; +class SYMBOL_EDIT_FRAME; class LIB_PART; class WX_GRID; @@ -48,26 +48,26 @@ class DIALOG_LIB_SYMBOL_PROPERTIES: public DIALOG_LIB_SYMBOL_PROPERTIES_BASE static LAST_LAYOUT m_lastLayout; public: - LIB_EDIT_FRAME* m_Parent; - LIB_PART* m_libEntry; + SYMBOL_EDIT_FRAME* m_Parent; + LIB_PART* m_libEntry; FIELDS_GRID_TABLE* m_fields; - UNIT_BINDER m_pinNameOffset; + UNIT_BINDER m_pinNameOffset; - wxControl* m_delayedFocusCtrl; - WX_GRID* m_delayedFocusGrid; - int m_delayedFocusRow; - int m_delayedFocusColumn; - int m_delayedFocusPage; - wxString m_delayedErrorMessage; + wxControl* m_delayedFocusCtrl; + WX_GRID* m_delayedFocusGrid; + int m_delayedFocusRow; + int m_delayedFocusColumn; + int m_delayedFocusPage; + wxString m_delayedErrorMessage; - wxString m_shownColumns; - int m_width; + wxString m_shownColumns; + int m_width; public: /// Constructors - DIALOG_LIB_SYMBOL_PROPERTIES( LIB_EDIT_FRAME* parent, LIB_PART* aLibEntry ); + DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_PART* aLibEntry ); ~DIALOG_LIB_SYMBOL_PROPERTIES(); protected: diff --git a/eeschema/dialogs/dialog_pin_properties.cpp b/eeschema/dialogs/dialog_pin_properties.cpp index fce5a3105b..477c9a793d 100644 --- a/eeschema/dialogs/dialog_pin_properties.cpp +++ b/eeschema/dialogs/dialog_pin_properties.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include #include @@ -121,7 +121,7 @@ public: }; -DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( LIB_EDIT_FRAME* parent, LIB_PIN* aPin ) : +DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_PIN* aPin ) : DIALOG_PIN_PROPERTIES_BASE( parent ), m_frame( parent ), m_pin( aPin ), @@ -327,7 +327,7 @@ void DIALOG_PIN_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event ) // Give a parent to m_dummyPin only from draw purpose. // In fact m_dummyPin should not have a parent, but draw functions need a parent // to know some options, about pin texts - LIB_EDIT_FRAME* libframe = (LIB_EDIT_FRAME*) GetParent(); + SYMBOL_EDIT_FRAME* symbolEditor = (SYMBOL_EDIT_FRAME*) GetParent(); // Calculate a suitable scale to fit the available draw area EDA_RECT bBox = m_dummyPin->GetBoundingBox( true ); @@ -343,7 +343,7 @@ void DIALOG_PIN_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event ) PART_DRAW_OPTIONS opts; opts.draw_hidden_fields = true; - RENDER_SETTINGS* renderSettings = libframe->GetRenderSettings(); + RENDER_SETTINGS* renderSettings = symbolEditor->GetRenderSettings(); renderSettings->SetPrintDC( &dc ); m_dummyPin->Print( renderSettings, -bBox.Centre(), (void*) &opts, DefaultTransform ); diff --git a/eeschema/dialogs/dialog_pin_properties.h b/eeschema/dialogs/dialog_pin_properties.h index 6e4c3a8ab3..c03fbd4323 100644 --- a/eeschema/dialogs/dialog_pin_properties.h +++ b/eeschema/dialogs/dialog_pin_properties.h @@ -35,7 +35,7 @@ #include #include #include -#include +#include enum COL_ORDER @@ -54,7 +54,7 @@ class ALT_PIN_DATA_MODEL; /** Implementing DIALOG_LIB_EDIT_PIN_BASE */ class DIALOG_PIN_PROPERTIES : public DIALOG_PIN_PROPERTIES_BASE { - LIB_EDIT_FRAME* m_frame; + SYMBOL_EDIT_FRAME* m_frame; LIB_PIN* m_pin; LIB_PIN* m_dummyPin; // a working copy used to show changes @@ -77,7 +77,7 @@ class DIALOG_PIN_PROPERTIES : public DIALOG_PIN_PROPERTIES_BASE public: /** Constructor */ - DIALOG_PIN_PROPERTIES( LIB_EDIT_FRAME* parent, LIB_PIN* aPin ); + DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_PIN* aPin ); ~DIALOG_PIN_PROPERTIES() override; bool TransferDataToWindow() override; diff --git a/eeschema/dialogs/panel_sym_color_settings.cpp b/eeschema/dialogs/panel_sym_color_settings.cpp index 14d3c09482..e27e6c7866 100644 --- a/eeschema/dialogs/panel_sym_color_settings.cpp +++ b/eeschema/dialogs/panel_sym_color_settings.cpp @@ -22,8 +22,8 @@ */ #include -#include -#include +#include +#include #include #include #include @@ -32,8 +32,8 @@ #include "panel_sym_color_settings.h" -PANEL_SYM_COLOR_SETTINGS::PANEL_SYM_COLOR_SETTINGS( LIB_EDIT_FRAME* aFrame, - wxWindow* aWindow ) +PANEL_SYM_COLOR_SETTINGS::PANEL_SYM_COLOR_SETTINGS( SYMBOL_EDIT_FRAME* aFrame, + wxWindow* aWindow ) : PANEL_SYM_COLOR_SETTINGS_BASE( aWindow ), m_frame( aFrame ) { } @@ -41,7 +41,7 @@ PANEL_SYM_COLOR_SETTINGS::PANEL_SYM_COLOR_SETTINGS( LIB_EDIT_FRAME* aFrame, bool PANEL_SYM_COLOR_SETTINGS::TransferDataToWindow() { - auto cfg = Pgm().GetSettingsManager().GetAppSettings(); + auto cfg = Pgm().GetSettingsManager().GetAppSettings(); m_useEeschemaTheme->SetValue( cfg->m_UseEeschemaColorSettings ); @@ -82,7 +82,7 @@ bool PANEL_SYM_COLOR_SETTINGS::TransferDataFromWindow() auto selected = static_cast( m_themeSelection->GetClientData( m_themeSelection->GetSelection() ) ); - LIBEDIT_SETTINGS* cfg = mgr.GetAppSettings(); + SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings(); cfg->m_UseEeschemaColorSettings = m_useEeschemaTheme->GetValue(); diff --git a/eeschema/dialogs/panel_sym_color_settings.h b/eeschema/dialogs/panel_sym_color_settings.h index 019f080cf0..001ba7ba5a 100644 --- a/eeschema/dialogs/panel_sym_color_settings.h +++ b/eeschema/dialogs/panel_sym_color_settings.h @@ -26,15 +26,15 @@ #include "panel_sym_color_settings_base.h" -class LIB_EDIT_FRAME; +class SYMBOL_EDIT_FRAME; class PANEL_SYM_COLOR_SETTINGS : public PANEL_SYM_COLOR_SETTINGS_BASE { - LIB_EDIT_FRAME* m_frame; + SYMBOL_EDIT_FRAME* m_frame; public: - PANEL_SYM_COLOR_SETTINGS( LIB_EDIT_FRAME* aFrame, wxWindow* aWindow ); + PANEL_SYM_COLOR_SETTINGS( SYMBOL_EDIT_FRAME* aFrame, wxWindow* aWindow ); protected: void OnUseEeschemaThemeChanged( wxCommandEvent& event ) override; diff --git a/eeschema/dialogs/panel_sym_editing_options.cpp b/eeschema/dialogs/panel_sym_editing_options.cpp index 1aeceff7bf..f3b6480a3c 100644 --- a/eeschema/dialogs/panel_sym_editing_options.cpp +++ b/eeschema/dialogs/panel_sym_editing_options.cpp @@ -22,16 +22,17 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include #include #include #include -#include +#include #include "panel_sym_editing_options.h" -PANEL_SYM_EDITING_OPTIONS::PANEL_SYM_EDITING_OPTIONS( LIB_EDIT_FRAME* aFrame, wxWindow* aWindow ) : +PANEL_SYM_EDITING_OPTIONS::PANEL_SYM_EDITING_OPTIONS( SYMBOL_EDIT_FRAME* aFrame, + wxWindow* aWindow ) : PANEL_SYM_EDITING_OPTIONS_BASE( aWindow ), m_frame( aFrame ), m_lineWidth( aFrame, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits, true ), @@ -46,7 +47,7 @@ PANEL_SYM_EDITING_OPTIONS::PANEL_SYM_EDITING_OPTIONS( LIB_EDIT_FRAME* aFrame, wx bool PANEL_SYM_EDITING_OPTIONS::TransferDataToWindow() { - LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings(); + auto* settings = Pgm().GetSettingsManager().GetAppSettings(); m_lineWidth.SetValue( Mils2iu( settings->m_Defaults.line_width ) ); m_textSize.SetValue( Mils2iu( settings->m_Defaults.text_size ) ); @@ -66,7 +67,7 @@ bool PANEL_SYM_EDITING_OPTIONS::TransferDataToWindow() bool PANEL_SYM_EDITING_OPTIONS::TransferDataFromWindow() { - LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings(); + auto* settings = Pgm().GetSettingsManager().GetAppSettings(); settings->m_Defaults.line_width = Iu2Mils( (int) m_lineWidth.GetValue() ); settings->m_Defaults.text_size = Iu2Mils( (int) m_textSize.GetValue() ); diff --git a/eeschema/dialogs/panel_sym_editing_options.h b/eeschema/dialogs/panel_sym_editing_options.h index 912127e193..23b95ee3bd 100644 --- a/eeschema/dialogs/panel_sym_editing_options.h +++ b/eeschema/dialogs/panel_sym_editing_options.h @@ -23,25 +23,25 @@ #include #include "panel_sym_editing_options_base.h" -class LIB_EDIT_FRAME; +class SYMBOL_EDIT_FRAME; class PANEL_SYM_EDITING_OPTIONS : public PANEL_SYM_EDITING_OPTIONS_BASE { - LIB_EDIT_FRAME* m_frame; + SYMBOL_EDIT_FRAME* m_frame; - UNIT_BINDER m_lineWidth; - UNIT_BINDER m_textSize; + UNIT_BINDER m_lineWidth; + UNIT_BINDER m_textSize; - UNIT_BINDER m_pinLength; - UNIT_BINDER m_pinNameSize; - UNIT_BINDER m_pinNumberSize; + UNIT_BINDER m_pinLength; + UNIT_BINDER m_pinNameSize; + UNIT_BINDER m_pinNumberSize; - UNIT_BINDER m_hPitch; - UNIT_BINDER m_vPitch; + UNIT_BINDER m_hPitch; + UNIT_BINDER m_vPitch; public: - PANEL_SYM_EDITING_OPTIONS( LIB_EDIT_FRAME* aFrame, wxWindow* aWindow ); + PANEL_SYM_EDITING_OPTIONS( SYMBOL_EDIT_FRAME* aFrame, wxWindow* aWindow ); private: bool TransferDataToWindow() override; diff --git a/eeschema/dialogs/panel_sym_lib_table.cpp b/eeschema/dialogs/panel_sym_lib_table.cpp index 54c3aa2dda..953ff919f6 100644 --- a/eeschema/dialogs/panel_sym_lib_table.cpp +++ b/eeschema/dialogs/panel_sym_lib_table.cpp @@ -34,12 +34,11 @@ #include #include #include -#include +#include #include #include #include #include -#include #include #include @@ -834,9 +833,9 @@ size_t PANEL_SYM_LIB_TABLE::m_pageNdx = 0; void InvokeSchEditSymbolLibTable( KIWAY* aKiway, wxWindow *aParent ) { - SCH_EDIT_FRAME* schEditor = (SCH_EDIT_FRAME*) aKiway->Player( FRAME_SCH, false ); - LIB_EDIT_FRAME* libEditor = (LIB_EDIT_FRAME*) aKiway->Player( FRAME_SCH_LIB_EDITOR, false ); - LIB_VIEW_FRAME* libViewer = (LIB_VIEW_FRAME*) aKiway->Player( FRAME_SCH_VIEWER, false ); + auto* schEditor = (SCH_EDIT_FRAME*) aKiway->Player( FRAME_SCH, false ); + auto* symbolEditor = (SYMBOL_EDIT_FRAME*) aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false ); + auto* symbolViewer = (LIB_VIEW_FRAME*) aKiway->Player( FRAME_SCH_VIEWER, false ); SYMBOL_LIB_TABLE* globalTable = &SYMBOL_LIB_TABLE::GetGlobalLibTable(); wxString globalTablePath = SYMBOL_LIB_TABLE::GetGlobalTableFileName(); @@ -850,14 +849,14 @@ void InvokeSchEditSymbolLibTable( KIWAY* aKiway, wxWindow *aParent ) if( !aKiway->Prj().IsNullProject() ) projectTable = aKiway->Prj().SchSymbolLibTable(); - if( libEditor ) + if( symbolEditor ) { - currentLib = libEditor->GetCurLib(); + currentLib = symbolEditor->GetCurLib(); // This prevents an ugly crash on OSX (https://bugs.launchpad.net/kicad/+bug/1765286) - libEditor->FreezeSearchTree(); + symbolEditor->FreezeSearchTree(); - if( libEditor->HasLibModifications() ) + if( symbolEditor->HasLibModifications() ) { msg = _( "Modifications have been made to one or more symbol libraries.\n" "Changes must be saved or discarded before the symbol library " @@ -865,10 +864,10 @@ void InvokeSchEditSymbolLibTable( KIWAY* aKiway, wxWindow *aParent ) switch( UnsavedChangesDialog( aParent, msg ) ) { - case wxID_YES: libEditor->SaveAll(); break; - case wxID_NO: libEditor->RevertAll(); break; + case wxID_YES: symbolEditor->SaveAll(); break; + case wxID_NO: symbolEditor->RevertAll(); break; default: - case wxID_CANCEL: libEditor->ThawSearchTree(); return; + case wxID_CANCEL: symbolEditor->ThawSearchTree(); return; } } } @@ -881,8 +880,8 @@ void InvokeSchEditSymbolLibTable( KIWAY* aKiway, wxWindow *aParent ) if( dlg.ShowModal() == wxID_CANCEL ) { - if( libEditor ) - libEditor->ThawSearchTree(); + if( symbolEditor ) + symbolEditor->ThawSearchTree(); return; } @@ -916,19 +915,19 @@ void InvokeSchEditSymbolLibTable( KIWAY* aKiway, wxWindow *aParent ) if( schEditor ) schEditor->SyncView(); - if( libEditor ) + if( symbolEditor ) { // Check if the currently selected symbol library been removed or disabled. if( !currentLib.empty() && projectTable && !projectTable->HasLibrary( currentLib, true ) ) { - libEditor->SetCurLib( wxEmptyString ); - libEditor->emptyScreen(); + symbolEditor->SetCurLib( wxEmptyString ); + symbolEditor->emptyScreen(); } - libEditor->SyncLibraries( true ); - libEditor->ThawSearchTree(); + symbolEditor->SyncLibraries( true ); + symbolEditor->ThawSearchTree(); } - if( libViewer ) - libViewer->ReCreateListLib(); + if( symbolViewer ) + symbolViewer->ReCreateListLib(); } diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index 79c30af7d3..722c27a79e 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -30,10 +30,8 @@ #include #include #include -#include +#include #include -#include -#include #include #include #include @@ -140,9 +138,9 @@ static struct IFACE : public KIFACE_I return frame; } - case FRAME_SCH_LIB_EDITOR: + case FRAME_SCH_SYMBOL_EDITOR: { - LIB_EDIT_FRAME* frame = new LIB_EDIT_FRAME( aKiway, aParent ); + SYMBOL_EDIT_FRAME* frame = new SYMBOL_EDIT_FRAME( aKiway, aParent ); return frame; } diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 401106aa93..397bd1cfd7 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include @@ -208,7 +208,7 @@ COLOR4D GetLayerColor( SCH_LAYER_ID aLayer ) } -// Color to draw items flagged invisible, in libedit (they are invisible in Eeschema) +// Color to draw items flagged invisible, in symbol_editor (they are invisible in Eeschema) COLOR4D GetInvisibleItemColor() { return COLOR4D( DARKGRAY ); @@ -386,8 +386,8 @@ void SCH_BASE_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) } -void LIB_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent, - PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) +void SYMBOL_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent, + PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) { wxTreebook* book = aParent->GetTreebook(); diff --git a/eeschema/eeschema_settings.cpp b/eeschema/eeschema_settings.cpp index 880d225953..7daef5a86f 100644 --- a/eeschema/eeschema_settings.cpp +++ b/eeschema/eeschema_settings.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include @@ -564,7 +564,7 @@ bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) // LibEdit settings were stored with eeschema. If eeschema is the first app to run, // we need to migrate the LibEdit settings here - auto libedit = Pgm().GetSettingsManager().GetAppSettings( false ); + auto libedit = Pgm().GetSettingsManager().GetAppSettings( false ); libedit->MigrateFromLegacy( aCfg ); libedit->Load(); diff --git a/eeschema/fields_grid_table.cpp b/eeschema/fields_grid_table.cpp index 7c83865264..328997d91e 100644 --- a/eeschema/fields_grid_table.cpp +++ b/eeschema/fields_grid_table.cpp @@ -53,13 +53,13 @@ FIELDS_GRID_TABLE::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_BASE_FRAME* a m_parentType( SCH_COMPONENT_T ), m_mandatoryFieldCount( MANDATORY_FIELDS ), m_part( aPart ), - m_fieldNameValidator( aFrame->IsType( FRAME_SCH_LIB_EDITOR ), FIELD_NAME ), - m_referenceValidator( aFrame->IsType( FRAME_SCH_LIB_EDITOR ), REFERENCE ), - m_valueValidator( aFrame->IsType( FRAME_SCH_LIB_EDITOR ), VALUE ), + m_fieldNameValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_NAME ), + m_referenceValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), REFERENCE ), + m_valueValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), VALUE ), m_libIdValidator( LIB_ID::ID_PCB ), - m_urlValidator( aFrame->IsType( FRAME_SCH_LIB_EDITOR ), FIELD_VALUE ), - m_nonUrlValidator( aFrame->IsType( FRAME_SCH_LIB_EDITOR ), FIELD_VALUE ), - m_filepathValidator( aFrame->IsType( FRAME_SCH_LIB_EDITOR ), SHEETFILENAME ) + m_urlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ), + m_nonUrlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ), + m_filepathValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), SHEETFILENAME ) { initGrid( aDialog ); } @@ -73,13 +73,13 @@ FIELDS_GRID_TABLE::FIELDS_GRID_TABLE( DIALOG_SHIM* aDialog, SCH_BASE_FRAME* a m_parentType( SCH_SHEET_T ), m_mandatoryFieldCount( SHEET_MANDATORY_FIELDS ), m_part( nullptr ), - m_fieldNameValidator( aFrame->IsType( FRAME_SCH_LIB_EDITOR ), FIELD_NAME ), - m_referenceValidator( aFrame->IsType( FRAME_SCH_LIB_EDITOR ), SHEETNAME_V ), - m_valueValidator( aFrame->IsType( FRAME_SCH_LIB_EDITOR ), VALUE ), + m_fieldNameValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_NAME ), + m_referenceValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), SHEETNAME_V ), + m_valueValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), VALUE ), m_libIdValidator( LIB_ID::ID_PCB ), - m_urlValidator( aFrame->IsType( FRAME_SCH_LIB_EDITOR ), FIELD_VALUE ), - m_nonUrlValidator( aFrame->IsType( FRAME_SCH_LIB_EDITOR ), FIELD_VALUE ), - m_filepathValidator( aFrame->IsType( FRAME_SCH_LIB_EDITOR ), SHEETFILENAME_V ) + m_urlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ), + m_nonUrlValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), FIELD_VALUE ), + m_filepathValidator( aFrame->IsType( FRAME_SCH_SYMBOL_EDITOR ), SHEETFILENAME_V ) { initGrid( aDialog ); } @@ -271,7 +271,7 @@ wxGridCellAttr* FIELDS_GRID_TABLE::GetAttr( int aRow, int aCol, wxGridCellAtt { // For power symbols, the value is not editable, because value and pin name must // be the same and can be edited only in library editor. - if( ( m_part && m_part->IsPower() && !m_frame->IsType( FRAME_SCH_LIB_EDITOR ) ) ) + if( ( m_part && m_part->IsPower() && !m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) ) { tmp = m_readOnlyAttr->Clone(); tmp->SetReadOnly( true ); diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index 46e500c33b..2aa9dce844 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index e4c3a8bc7a..a1ad6af3da 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -29,11 +29,11 @@ #include #include #include -#include +#include #include #include #include -#include +#include #include #include "sch_painter.h" @@ -106,12 +106,12 @@ LIB_PIN::LIB_PIN( LIB_PART* aParent ) : if( pgm ) { - LIBEDIT_SETTINGS* settings = pgm->GetSettingsManager().GetAppSettings(); + auto* settings = pgm->GetSettingsManager().GetAppSettings(); m_length = Mils2iu( settings->m_Defaults.pin_length ); m_numTextSize = Mils2iu( settings->m_Defaults.pin_num_size ); m_nameTextSize = Mils2iu( settings->m_Defaults.pin_name_size ); } - else // Use hardcoded eeschema defaults: libedit settings are not existing. + else // Use hardcoded eeschema defaults: symbol_editor settings are not existing. { m_length = Mils2iu( DEFAULT_PIN_LENGTH ); m_numTextSize = Mils2iu( DEFAULT_PINNUM_SIZE ); diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index 778ff5dea9..66847e7570 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -268,7 +268,7 @@ void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill, wxASSERT( plotter != NULL ); EDA_RECT bBox = GetBoundingBox(); - // convert coordinates from draw Y axis to libedit Y axis + // convert coordinates from draw Y axis to symbol_editor Y axis bBox.RevertYAxis(); wxPoint txtpos = bBox.Centre(); @@ -334,7 +334,7 @@ void LIB_TEXT::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* */ EDA_RECT bBox = GetBoundingBox(); - // convert coordinates from draw Y axis to libedit Y axis: + // convert coordinates from draw Y axis to symbol_editor Y axis: bBox.RevertYAxis(); wxPoint txtpos = bBox.Centre(); diff --git a/eeschema/libedit/symbedit.cpp b/eeschema/libedit/symbedit.cpp deleted file mode 100644 index a6205c83f5..0000000000 --- a/eeschema/libedit/symbedit.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2008 Wayne Stambaugh - * Copyright (C) 2004-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 - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include -#include -#include -#include -#include -//#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -void LIB_EDIT_FRAME::LoadOneSymbol() -{ - EE_SELECTION_TOOL* selTool = m_toolManager->GetTool(); - - // Exit if no library entry is selected or a command is in progress. - if( !m_my_part || !EE_CONDITIONS::Idle( selTool->GetSelection() ) ) - return; - - PROJECT& prj = Prj(); - SEARCH_STACK* search = prj.SchSearchS(); - - wxString default_path = prj.GetRString( PROJECT::SCH_LIB_PATH ); - - if( !default_path ) - default_path = search->LastVisitedPath(); - - wxFileDialog dlg( this, _( "Import Symbol" ), default_path, - wxEmptyString, SchematicSymbolFileWildcard(), - wxFD_OPEN | wxFD_FILE_MUST_EXIST ); - - if( dlg.ShowModal() == wxID_CANCEL ) - return; - - wxString filename = dlg.GetPath(); - - prj.SetRString( PROJECT::SCH_LIB_PATH, filename ); - - wxArrayString symbols; - SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) ); - - wxString msg; - - try - { - pi->EnumerateSymbolLib( symbols, filename ); - } - catch( const IO_ERROR& ioe ) - { - msg.Printf( _( "Cannot import symbol library \"%s\"." ), filename ); - DisplayErrorMessage( this, msg, ioe.What() ); - return; - } - - if( symbols.empty() ) - { - msg.Printf( _( "Symbol library file \"%s\" is empty." ), filename ); - DisplayError( this, msg ); - return; - } - - if( symbols.GetCount() > 1 ) - { - msg.Printf( _( "More than one symbol found in symbol file \"%s\"." ), filename ); - wxMessageBox( msg, _( "Warning" ), wxOK | wxICON_EXCLAMATION, this ); - } - - LIB_PART* alias = nullptr; - - try - { - alias = pi->LoadSymbol( filename, symbols[0] ); - } - catch( const IO_ERROR& ) - { - return; - } - - wxCHECK_RET( alias, "Invalid symbol." ); - - SaveCopyInUndoList( m_my_part ); - - LIB_PART* first = alias; - LIB_ITEMS_CONTAINER& drawList = first->GetDrawItems(); - - for( LIB_ITEM& item : drawList ) - { - if( item.Type() == LIB_FIELD_T ) - continue; - - if( item.GetUnit() ) - item.SetUnit( m_unit ); - - if( item.GetConvert() ) - item.SetConvert( m_convert ); - - item.SetFlags( IS_NEW | SELECTED ); - - LIB_ITEM* newItem = (LIB_ITEM*) item.Clone(); - - newItem->SetParent( m_my_part ); - m_my_part->AddDrawItem( newItem ); - item.ClearSelected(); - } - - m_my_part->RemoveDuplicateDrawItems(); - - OnModify(); -} - - -void LIB_EDIT_FRAME::SaveOneSymbol() -{ - wxCHECK( m_my_part, /* void */ ); - - // Export the current part as a symbol (.sym file) - // this is the current part without its aliases and doc file - // because a .sym file is used to import graphics in a part being edited - if( m_my_part->GetDrawItems().empty() ) - return; - - PROJECT& prj = Prj(); - SEARCH_STACK* search = prj.SchSearchS(); - - wxString default_path = prj.GetRString( PROJECT::SCH_LIB_PATH ); - - if( !default_path ) - default_path = search->LastVisitedPath(); - - wxFileDialog dlg( this, _( "Export Symbol" ), default_path, - m_my_part->GetName() + "." + SchematicSymbolFileExtension, - SchematicSymbolFileWildcard(), - wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); - - if( dlg.ShowModal() == wxID_CANCEL ) - return; - - wxFileName fn = dlg.GetPath(); - - /* The GTK file chooser doesn't return the file extension added to - * file name so add it here. */ - if( fn.GetExt().IsEmpty() ) - fn.SetExt( SchematicSymbolFileExtension ); - - prj.SetRString( PROJECT::SCH_LIB_PATH, fn.GetPath() ); - - if( fn.FileExists() ) - wxRemove( fn.GetFullPath() ); - - SetStatusText( wxString::Format( _( "Saving symbol in \"%s\"" ), fn.GetPath() ) ); - - SCH_PLUGIN::SCH_PLUGIN_RELEASER plugin( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) ); - - try - { - PROPERTIES nodoc_props; // Doc file is useless for a .sym file - nodoc_props[ SCH_LEGACY_PLUGIN::PropNoDocFile ] = ""; - plugin->CreateSymbolLib( fn.GetFullPath(), &nodoc_props ); - - // The part gets flattened by the LIB_PART copy constructor. - LIB_PART* saved_part = new LIB_PART( *m_my_part ); - plugin->SaveSymbol( fn.GetFullPath(), saved_part, &nodoc_props ); - } - catch( const IO_ERROR& ioe ) - { - wxString msg = wxString::Format( _( "An error occurred saving symbol file \"%s\"" ), - fn.GetFullPath() ); - DisplayErrorMessage( this, msg, ioe.What() ); - } -} - - -void LIB_EDIT_FRAME::DisplayCmpDoc() -{ - EDA_DRAW_FRAME::ClearMsgPanel(); - - if( !m_my_part ) - return; - - wxString msg = m_my_part->GetName(); - - AppendMsgPanel( _( "Name" ), msg, BLUE, 8 ); - - if( m_my_part->IsAlias() ) - { - PART_SPTR parent = m_my_part->GetParent().lock(); - - msg = parent ? parent->GetName() : _( "Undefined!" ); - AppendMsgPanel( _( "Parent" ), msg, BROWN, 8 ); - } - - static wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" ); - msg = UnitLetter[m_unit]; - - AppendMsgPanel( _( "Unit" ), msg, BROWN, 8 ); - - if( m_convert > 1 ) - msg = _( "Convert" ); - else - msg = _( "Normal" ); - - AppendMsgPanel( _( "Body" ), msg, GREEN, 8 ); - - if( m_my_part->IsPower() ) - msg = _( "Power Symbol" ); - else - msg = _( "Symbol" ); - - AppendMsgPanel( _( "Type" ), msg, MAGENTA, 8 ); - AppendMsgPanel( _( "Description" ), m_my_part->GetDescription(), CYAN, 8 ); - AppendMsgPanel( _( "Keywords" ), m_my_part->GetKeyWords(), DARKDARKGRAY ); - AppendMsgPanel( _( "Datasheet" ), m_my_part->GetDatasheetField().GetText(), DARKDARKGRAY ); -} diff --git a/eeschema/plotters/plot_schematic_SVG.cpp b/eeschema/plotters/plot_schematic_SVG.cpp index a4e48688a7..6d4f7c8dcc 100644 --- a/eeschema/plotters/plot_schematic_SVG.cpp +++ b/eeschema/plotters/plot_schematic_SVG.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp index ba9b8dc8c9..124ee107a6 100644 --- a/eeschema/sch_base_frame.cpp +++ b/eeschema/sch_base_frame.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -108,9 +108,9 @@ EESCHEMA_SETTINGS* SCH_BASE_FRAME::eeconfig() const } -LIBEDIT_SETTINGS* SCH_BASE_FRAME::libeditconfig() const +SYMBOL_EDITOR_SETTINGS* SCH_BASE_FRAME::libeditconfig() const { - return dynamic_cast( config() ); + return dynamic_cast( config() ); } diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h index b9b7012a5d..8c10129090 100644 --- a/eeschema/sch_base_frame.h +++ b/eeschema/sch_base_frame.h @@ -51,14 +51,14 @@ namespace KIGFX class PAGE_INFO; class TITLE_BLOCK; class LIB_VIEW_FRAME; -class LIB_EDIT_FRAME; +class SYMBOL_EDIT_FRAME; class LIB_PART; class PART_LIB; class SCHLIB_FILTER; class LIB_ID; class SYMBOL_LIB_TABLE; class EESCHEMA_SETTINGS; -class LIBEDIT_SETTINGS; +class SYMBOL_EDITOR_SETTINGS; /** * Load symbol from symbol library table. @@ -80,7 +80,7 @@ LIB_PART* SchGetLibPart( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable, /** * A shim class between EDA_DRAW_FRAME and several derived classes: - * LIB_EDIT_FRAME, LIB_VIEW_FRAME, and SCH_EDIT_FRAME, and it brings in a + * SYMBOL_EDIT_FRAME, LIB_VIEW_FRAME, and SCH_EDIT_FRAME, and it brings in a * common way of handling the provided virtual functions for the derived classes. * * The motivation here is to switch onto GetScreen() for the underlying data model. @@ -90,7 +90,7 @@ LIB_PART* SchGetLibPart( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable, class SCH_BASE_FRAME : public EDA_DRAW_FRAME { protected: - /// These are only used by libedit. Eeschema should be using the one inside the SCHEMATIC. + /// These are only used by symbol_editor. Eeschema should be using the one inside the SCHEMATIC. SCHEMATIC_SETTINGS m_base_frame_defaults; SCHEMATIC_SETTINGS* m_defaults; @@ -111,7 +111,7 @@ public: EESCHEMA_SETTINGS* eeconfig() const; - LIBEDIT_SETTINGS* libeditconfig() const; + SYMBOL_EDITOR_SETTINGS* libeditconfig() const; void LoadSettings( APP_SETTINGS_BASE* aCfg ) override; void SaveSettings( APP_SETTINGS_BASE* aCfg ) override; @@ -152,7 +152,7 @@ public: * * aAllowFields chooses whether or not features that permit the user to edit * fields (e.g. footprint selection) should be enabled. This should be false - * when they would have no effect, for example loading a part into libedit. + * when they would have no effect, for example loading a part into symbol_editor. * * @param aFilter is a SCHLIB_FILTER filter to pass the allowed library names * and/or the library name to load the component from and/or some other filter diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index fd8c1a34f2..9b369ac96a 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include @@ -589,17 +589,19 @@ bool SCH_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent ) if( Kiface().IsSingle() ) { - LIB_EDIT_FRAME* libeditFrame = (LIB_EDIT_FRAME*) Kiway().Player( FRAME_SCH_LIB_EDITOR, false ); - if( libeditFrame && !libeditFrame->Close() ) // Can close component editor? + auto* symbolEditor = (SYMBOL_EDIT_FRAME*) Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false ); + + if( symbolEditor && !symbolEditor->Close() ) // Can close component editor? return false; - LIB_VIEW_FRAME* viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false ); - if( viewlibFrame && !viewlibFrame->Close() ) // Can close component viewer? + auto* symbolViewer = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, false ); + + if( symbolViewer && !symbolViewer->Close() ) // Can close component viewer? return false; - viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER_MODAL, false ); + symbolViewer = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER_MODAL, false ); - if( viewlibFrame && !viewlibFrame->Close() ) // Can close modal component viewer? + if( symbolViewer && !symbolViewer->Close() ) // Can close modal component viewer? return false; } diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 95d2fba83a..57f95ea451 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -72,7 +72,7 @@ SCH_SCREEN::SCH_SCREEN( EDA_ITEM* aParent ) : m_refCount = 0; - // Suitable for schematic only. For libedit and viewlib, must be set to true + // Suitable for schematic only. For symbol_editor and viewlib, must be set to true m_Center = false; InitDataPoints( m_paper.GetSizeIU() ); diff --git a/eeschema/libedit/menubar_libedit.cpp b/eeschema/symbol_editor/menubar_symbol_editor.cpp similarity index 98% rename from eeschema/libedit/menubar_libedit.cpp rename to eeschema/symbol_editor/menubar_symbol_editor.cpp index 528d52bd4f..2b8f651637 100644 --- a/eeschema/libedit/menubar_libedit.cpp +++ b/eeschema/symbol_editor/menubar_symbol_editor.cpp @@ -29,12 +29,12 @@ #include #include #include -#include -#include "lib_edit_frame.h" +#include +#include "symbol_edit_frame.h" #include -void LIB_EDIT_FRAME::ReCreateMenuBar() +void SYMBOL_EDIT_FRAME::ReCreateMenuBar() { EE_SELECTION_TOOL* selTool = m_toolManager->GetTool(); // wxWidgets handles the Mac Application menu behind the scenes, but that means diff --git a/eeschema/libedit/lib_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp similarity index 88% rename from eeschema/libedit/lib_edit_frame.cpp rename to eeschema/symbol_editor/symbol_edit_frame.cpp index b9d629b8b3..1fb4c6c9d4 100644 --- a/eeschema/libedit/lib_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -32,10 +32,10 @@ #include #include #include -#include -#include +#include +#include #include -#include +#include #include #include #include @@ -68,31 +68,31 @@ #include -bool LIB_EDIT_FRAME:: m_showDeMorgan = false; +bool SYMBOL_EDIT_FRAME:: m_showDeMorgan = false; -BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME ) - EVT_SIZE( LIB_EDIT_FRAME::OnSize ) +BEGIN_EVENT_TABLE( SYMBOL_EDIT_FRAME, EDA_DRAW_FRAME ) + EVT_SIZE( SYMBOL_EDIT_FRAME::OnSize ) - EVT_COMBOBOX( ID_LIBEDIT_SELECT_PART_NUMBER, LIB_EDIT_FRAME::OnSelectUnit ) + EVT_COMBOBOX( ID_LIBEDIT_SELECT_PART_NUMBER, SYMBOL_EDIT_FRAME::OnSelectUnit ) // Right vertical toolbar. - EVT_TOOL( ID_LIBEDIT_IMPORT_BODY_BUTT, LIB_EDIT_FRAME::OnImportBody ) - EVT_TOOL( ID_LIBEDIT_EXPORT_BODY_BUTT, LIB_EDIT_FRAME::OnExportBody ) + EVT_TOOL( ID_LIBEDIT_IMPORT_BODY_BUTT, SYMBOL_EDIT_FRAME::OnImportBody ) + EVT_TOOL( ID_LIBEDIT_EXPORT_BODY_BUTT, SYMBOL_EDIT_FRAME::OnExportBody ) // menubar commands - EVT_MENU( wxID_EXIT, LIB_EDIT_FRAME::OnExitKiCad ) - EVT_MENU( wxID_CLOSE, LIB_EDIT_FRAME::CloseWindow ) + EVT_MENU( wxID_EXIT, SYMBOL_EDIT_FRAME::OnExitKiCad ) + EVT_MENU( wxID_CLOSE, SYMBOL_EDIT_FRAME::CloseWindow ) EVT_MENU( ID_GRID_SETTINGS, SCH_BASE_FRAME::OnGridSettings ) // Update user interface elements. - EVT_UPDATE_UI( ID_LIBEDIT_SELECT_PART_NUMBER, LIB_EDIT_FRAME::OnUpdatePartNumber ) + EVT_UPDATE_UI( ID_LIBEDIT_SELECT_PART_NUMBER, SYMBOL_EDIT_FRAME::OnUpdatePartNumber ) END_EVENT_TABLE() -LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : - SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ), +SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : + SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_SYMBOL_EDITOR, _( "Library Editor" ), wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, LIB_EDIT_FRAME_NAME ), m_unitSelectBox( nullptr ), @@ -112,7 +112,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : icon.CopyFromBitmap( KiBitmap( icon_libedit_xpm ) ); SetIcon( icon ); - m_settings = Pgm().GetSettingsManager().GetAppSettings(); + m_settings = Pgm().GetSettingsManager().GetAppSettings(); LoadSettings( m_settings ); // Ensure axis are always drawn @@ -130,7 +130,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : setupTools(); setupUIConditions(); - m_libMgr = new LIB_MANAGER( *this ); + m_libMgr = new SYMBOL_LIBRARY_MANAGER( *this ); SyncLibraries( true ); m_treePane = new SYMBOL_TREE_PANE( this, m_libMgr ); @@ -215,7 +215,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : } -LIB_EDIT_FRAME::~LIB_EDIT_FRAME() +SYMBOL_EDIT_FRAME::~SYMBOL_EDIT_FRAME() { // Shutdown all running tools if( m_toolManager ) @@ -233,16 +233,16 @@ LIB_EDIT_FRAME::~LIB_EDIT_FRAME() // current screen is destroyed in EDA_DRAW_FRAME SetScreen( m_dummyScreen ); - auto libedit = Pgm().GetSettingsManager().GetAppSettings(); + auto libedit = Pgm().GetSettingsManager().GetAppSettings(); Pgm().GetSettingsManager().Save( libedit ); delete m_libMgr; } -void LIB_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg ) +void SYMBOL_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg ) { - wxCHECK_RET( m_settings, "Call to LIB_EDIT_FRAME::LoadSettings with null m_settings" ); + wxCHECK_RET( m_settings, "Call to SYMBOL_EDIT_FRAME::LoadSettings with null m_settings" ); SCH_BASE_FRAME::LoadSettings( GetSettings() ); @@ -255,9 +255,9 @@ void LIB_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg ) } -void LIB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) +void SYMBOL_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) { - wxCHECK_RET( m_settings, "Call to LIB_EDIT_FRAME::LoadSettings with null m_settings" ); + wxCHECK_RET( m_settings, "Call to SYMBOL_EDIT_FRAME::LoadSettings with null m_settings" ); SCH_BASE_FRAME::SaveSettings( GetSettings() ); @@ -266,7 +266,7 @@ void LIB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) } -COLOR_SETTINGS* LIB_EDIT_FRAME::GetColorSettings() +COLOR_SETTINGS* SYMBOL_EDIT_FRAME::GetColorSettings() { SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); @@ -277,7 +277,7 @@ COLOR_SETTINGS* LIB_EDIT_FRAME::GetColorSettings() } -void LIB_EDIT_FRAME::setupTools() +void SYMBOL_EDIT_FRAME::setupTools() { // Create the manager and dispatcher & route draw panel events to the dispatcher m_toolManager = new TOOL_MANAGER; @@ -308,7 +308,7 @@ void LIB_EDIT_FRAME::setupTools() } -void LIB_EDIT_FRAME::setupUIConditions() +void SYMBOL_EDIT_FRAME::setupUIConditions() { SCH_BASE_FRAME::setupUIConditions(); @@ -466,7 +466,7 @@ void LIB_EDIT_FRAME::setupUIConditions() } -bool LIB_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent ) +bool SYMBOL_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent ) { // Shutdown blocks must be determined and vetoed as early as possible if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION @@ -505,13 +505,13 @@ bool LIB_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent ) } -void LIB_EDIT_FRAME::doCloseWindow() +void SYMBOL_EDIT_FRAME::doCloseWindow() { Destroy(); } -void LIB_EDIT_FRAME::RebuildSymbolUnitsList() +void SYMBOL_EDIT_FRAME::RebuildSymbolUnitsList() { if( !m_unitSelectBox ) return; @@ -542,7 +542,7 @@ void LIB_EDIT_FRAME::RebuildSymbolUnitsList() } -void LIB_EDIT_FRAME::OnToggleSearchTree( wxCommandEvent& event ) +void SYMBOL_EDIT_FRAME::OnToggleSearchTree( wxCommandEvent& event ) { auto& treePane = m_auimgr.GetPane( m_treePane ); treePane.Show( !IsSearchTreeShown() ); @@ -550,33 +550,33 @@ void LIB_EDIT_FRAME::OnToggleSearchTree( wxCommandEvent& event ) } -bool LIB_EDIT_FRAME::IsSearchTreeShown() +bool SYMBOL_EDIT_FRAME::IsSearchTreeShown() { return m_auimgr.GetPane( m_treePane ).IsShown(); } -void LIB_EDIT_FRAME::FreezeSearchTree() +void SYMBOL_EDIT_FRAME::FreezeSearchTree() { m_treePane->Freeze(); m_libMgr->GetAdapter()->Freeze(); } -void LIB_EDIT_FRAME::ThawSearchTree() +void SYMBOL_EDIT_FRAME::ThawSearchTree() { m_libMgr->GetAdapter()->Thaw(); m_treePane->Thaw(); } -void LIB_EDIT_FRAME::OnExitKiCad( wxCommandEvent& event ) +void SYMBOL_EDIT_FRAME::OnExitKiCad( wxCommandEvent& event ) { Kiway().OnKiCadExit(); } -void LIB_EDIT_FRAME::OnUpdatePartNumber( wxUpdateUIEvent& event ) +void SYMBOL_EDIT_FRAME::OnUpdatePartNumber( wxUpdateUIEvent& event ) { if( !m_unitSelectBox ) return; @@ -587,7 +587,7 @@ void LIB_EDIT_FRAME::OnUpdatePartNumber( wxUpdateUIEvent& event ) } -void LIB_EDIT_FRAME::OnSelectUnit( wxCommandEvent& event ) +void SYMBOL_EDIT_FRAME::OnSelectUnit( wxCommandEvent& event ) { int i = event.GetSelection(); @@ -604,7 +604,7 @@ void LIB_EDIT_FRAME::OnSelectUnit( wxCommandEvent& event ) } -wxString LIB_EDIT_FRAME::GetCurLib() const +wxString SYMBOL_EDIT_FRAME::GetCurLib() const { wxString libNickname = Prj().GetRString( PROJECT::SCH_LIBEDIT_CUR_LIB ); @@ -621,7 +621,7 @@ wxString LIB_EDIT_FRAME::GetCurLib() const } -wxString LIB_EDIT_FRAME::SetCurLib( const wxString& aLibNickname ) +wxString SYMBOL_EDIT_FRAME::SetCurLib( const wxString& aLibNickname ) { wxString old = GetCurLib(); @@ -636,7 +636,7 @@ wxString LIB_EDIT_FRAME::SetCurLib( const wxString& aLibNickname ) } -void LIB_EDIT_FRAME::SetCurPart( LIB_PART* aPart ) +void SYMBOL_EDIT_FRAME::SetCurPart( LIB_PART* aPart ) { m_toolManager->RunAction( EE_ACTIONS::clearSelection, true ); @@ -678,14 +678,14 @@ void LIB_EDIT_FRAME::SetCurPart( LIB_PART* aPart ) } -LIB_MANAGER& LIB_EDIT_FRAME::GetLibManager() +SYMBOL_LIBRARY_MANAGER& SYMBOL_EDIT_FRAME::GetLibManager() { wxASSERT( m_libMgr ); return *m_libMgr; } -void LIB_EDIT_FRAME::OnImportBody( wxCommandEvent& aEvent ) +void SYMBOL_EDIT_FRAME::OnImportBody( wxCommandEvent& aEvent ) { m_toolManager->DeactivateTool(); LoadOneSymbol(); @@ -693,7 +693,7 @@ void LIB_EDIT_FRAME::OnImportBody( wxCommandEvent& aEvent ) } -void LIB_EDIT_FRAME::OnExportBody( wxCommandEvent& aEvent ) +void SYMBOL_EDIT_FRAME::OnExportBody( wxCommandEvent& aEvent ) { m_toolManager->DeactivateTool(); SaveOneSymbol(); @@ -701,7 +701,7 @@ void LIB_EDIT_FRAME::OnExportBody( wxCommandEvent& aEvent ) } -void LIB_EDIT_FRAME::OnModify() +void SYMBOL_EDIT_FRAME::OnModify() { GetScreen()->SetModify(); storeCurrentPart(); @@ -710,13 +710,13 @@ void LIB_EDIT_FRAME::OnModify() } -bool LIB_EDIT_FRAME::SynchronizePins() +bool SYMBOL_EDIT_FRAME::SynchronizePins() { return m_SyncPinEdit && m_my_part && m_my_part->IsMulti() && !m_my_part->UnitsLocked(); } -void LIB_EDIT_FRAME::refreshSchematic() +void SYMBOL_EDIT_FRAME::refreshSchematic() { // There may be no parent window so use KIWAY message to refresh the schematic editor // in case any symbols have changed. @@ -725,7 +725,7 @@ void LIB_EDIT_FRAME::refreshSchematic() } -bool LIB_EDIT_FRAME::AddLibraryFile( bool aCreateNew ) +bool SYMBOL_EDIT_FRAME::AddLibraryFile( bool aCreateNew ) { wxFileName fn = m_libMgr->GetUniqueLibraryName(); @@ -778,13 +778,13 @@ bool LIB_EDIT_FRAME::AddLibraryFile( bool aCreateNew ) } -LIB_ID LIB_EDIT_FRAME::GetTreeLIBID( int* aUnit ) const +LIB_ID SYMBOL_EDIT_FRAME::GetTreeLIBID( int* aUnit ) const { return m_treePane->GetLibTree()->GetSelectedLibId( aUnit ); } -LIB_PART* LIB_EDIT_FRAME::getTargetPart() const +LIB_PART* SYMBOL_EDIT_FRAME::getTargetPart() const { LIB_ID libId = GetTreeLIBID(); @@ -798,7 +798,7 @@ LIB_PART* LIB_EDIT_FRAME::getTargetPart() const } -LIB_ID LIB_EDIT_FRAME::getTargetLibId() const +LIB_ID SYMBOL_EDIT_FRAME::getTargetLibId() const { LIB_ID id = GetTreeLIBID(); @@ -809,19 +809,19 @@ LIB_ID LIB_EDIT_FRAME::getTargetLibId() const } -LIB_TREE_NODE* LIB_EDIT_FRAME::GetCurrentTreeNode() const +LIB_TREE_NODE* SYMBOL_EDIT_FRAME::GetCurrentTreeNode() const { return m_treePane->GetLibTree()->GetCurrentTreeNode(); } -wxString LIB_EDIT_FRAME::getTargetLib() const +wxString SYMBOL_EDIT_FRAME::getTargetLib() const { return getTargetLibId().GetLibNickname(); } -void LIB_EDIT_FRAME::SyncLibraries( bool aShowProgress ) +void SYMBOL_EDIT_FRAME::SyncLibraries( bool aShowProgress ) { LIB_ID selected; @@ -880,7 +880,7 @@ void LIB_EDIT_FRAME::SyncLibraries( bool aShowProgress ) } -void LIB_EDIT_FRAME::RegenerateLibraryTree() +void SYMBOL_EDIT_FRAME::RegenerateLibraryTree() { LIB_ID target = getTargetLibId(); @@ -891,7 +891,7 @@ void LIB_EDIT_FRAME::RegenerateLibraryTree() } -SYMBOL_LIB_TABLE* LIB_EDIT_FRAME::selectSymLibTable( bool aOptional ) +SYMBOL_LIB_TABLE* SYMBOL_EDIT_FRAME::selectSymLibTable( bool aOptional ) { // If no project is loaded, always work with the global table if( Prj().IsNullProject() ) @@ -935,7 +935,7 @@ SYMBOL_LIB_TABLE* LIB_EDIT_FRAME::selectSymLibTable( bool aOptional ) } -bool LIB_EDIT_FRAME::backupFile( const wxFileName& aOriginalFile, const wxString& aBackupExt ) +bool SYMBOL_EDIT_FRAME::backupFile( const wxFileName& aOriginalFile, const wxString& aBackupExt ) { if( aOriginalFile.FileExists() ) { @@ -957,14 +957,14 @@ bool LIB_EDIT_FRAME::backupFile( const wxFileName& aOriginalFile, const wxString } -void LIB_EDIT_FRAME::storeCurrentPart() +void SYMBOL_EDIT_FRAME::storeCurrentPart() { if( m_my_part && !GetCurLib().IsEmpty() && GetScreen()->IsModify() ) m_libMgr->UpdatePart( m_my_part, GetCurLib() ); // UpdatePart() makes a copy } -bool LIB_EDIT_FRAME::isCurrentPart( const LIB_ID& aLibId ) const +bool SYMBOL_EDIT_FRAME::isCurrentPart( const LIB_ID& aLibId ) const { // This will return the root part of any alias LIB_PART* part = m_libMgr->GetBufferedPart( aLibId.GetLibItemName(), aLibId.GetLibNickname() ); @@ -973,7 +973,7 @@ bool LIB_EDIT_FRAME::isCurrentPart( const LIB_ID& aLibId ) const } -void LIB_EDIT_FRAME::emptyScreen() +void SYMBOL_EDIT_FRAME::emptyScreen() { m_treePane->GetLibTree()->Unselect(); SetCurLib( wxEmptyString ); @@ -985,7 +985,7 @@ void LIB_EDIT_FRAME::emptyScreen() } -void LIB_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) +void SYMBOL_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) { SCH_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged ); @@ -1001,7 +1001,7 @@ void LIB_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars } -void LIB_EDIT_FRAME::ShowChangedLanguage() +void SYMBOL_EDIT_FRAME::ShowChangedLanguage() { // call my base class SCH_BASE_FRAME::ShowChangedLanguage(); @@ -1014,13 +1014,13 @@ void LIB_EDIT_FRAME::ShowChangedLanguage() } -void LIB_EDIT_FRAME::SetScreen( BASE_SCREEN* aScreen ) +void SYMBOL_EDIT_FRAME::SetScreen( BASE_SCREEN* aScreen ) { SCH_BASE_FRAME::SetScreen( aScreen ); } -void LIB_EDIT_FRAME::RebuildView() +void SYMBOL_EDIT_FRAME::RebuildView() { GetRenderSettings()->m_ShowUnit = m_unit; GetRenderSettings()->m_ShowConvert = m_convert; @@ -1033,7 +1033,7 @@ void LIB_EDIT_FRAME::RebuildView() } -void LIB_EDIT_FRAME::HardRedraw() +void SYMBOL_EDIT_FRAME::HardRedraw() { SyncLibraries( true ); @@ -1055,7 +1055,7 @@ void LIB_EDIT_FRAME::HardRedraw() } -const BOX2I LIB_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const +const BOX2I SYMBOL_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const { if( !m_my_part ) { @@ -1071,7 +1071,7 @@ const BOX2I LIB_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const } -void LIB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail ) +void SYMBOL_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail ) { const std::string& payload = mail.GetPayload(); @@ -1125,7 +1125,7 @@ void LIB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail ) } -void LIB_EDIT_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType ) +void SYMBOL_EDIT_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType ) { // switches currently used canvas ( Cairo / OpenGL): SCH_BASE_FRAME::SwitchCanvas( aCanvasType ); @@ -1136,7 +1136,7 @@ void LIB_EDIT_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType ) } -bool LIB_EDIT_FRAME::HasLibModifications() const +bool SYMBOL_EDIT_FRAME::HasLibModifications() const { wxCHECK( m_libMgr, false ); @@ -1144,7 +1144,7 @@ bool LIB_EDIT_FRAME::HasLibModifications() const } -bool LIB_EDIT_FRAME::IsContentModified() +bool SYMBOL_EDIT_FRAME::IsContentModified() { wxCHECK( m_libMgr, false ); @@ -1164,7 +1164,7 @@ bool LIB_EDIT_FRAME::IsContentModified() } -void LIB_EDIT_FRAME::ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItemCount ) +void SYMBOL_EDIT_FRAME::ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItemCount ) { if( aItemCount == 0 ) return; @@ -1181,14 +1181,15 @@ void LIB_EDIT_FRAME::ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItemCou } -SELECTION& LIB_EDIT_FRAME::GetCurrentSelection() +SELECTION& SYMBOL_EDIT_FRAME::GetCurrentSelection() { return m_toolManager->GetTool()->GetSelection(); } -void LIB_EDIT_FRAME::LoadSymbolFromSchematic( const std::unique_ptr& aSymbol, - const wxString& aReference, int aUnit, int aConvert ) +void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( const std::unique_ptr& aSymbol, + const wxString& aReference, int aUnit, + int aConvert ) { std::unique_ptr symbol = aSymbol->Flatten(); wxCHECK( symbol, /* void */ ); diff --git a/eeschema/libedit/lib_edit_frame.h b/eeschema/symbol_editor/symbol_edit_frame.h similarity index 93% rename from eeschema/libedit/lib_edit_frame.h rename to eeschema/symbol_editor/symbol_edit_frame.h index ca96eb89ef..f4073b1f76 100644 --- a/eeschema/libedit/lib_edit_frame.h +++ b/eeschema/symbol_editor/symbol_edit_frame.h @@ -25,8 +25,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef LIB_EDIT_FRAME_H -#define LIB_EDIT_FRAME_H +#ifndef SYMBOL_EDIT_FRAME_H +#define SYMBOL_EDIT_FRAME_H #include #include @@ -42,22 +42,22 @@ class DIALOG_LIB_EDIT_TEXT; class SYMBOL_TREE_PANE; class LIB_TREE_NODE; class LIB_ID; -class LIB_MANAGER; -class LIBEDIT_SETTINGS; +class SYMBOL_LIBRARY_MANAGER; +class SYMBOL_EDITOR_SETTINGS; /** * The symbol library editor main window. */ -class LIB_EDIT_FRAME : public SCH_BASE_FRAME +class SYMBOL_EDIT_FRAME : public SCH_BASE_FRAME { - LIB_PART* m_my_part; // a part I own, it is not in any library, but a copy - // could be. - wxComboBox* m_unitSelectBox; // a ComboBox to select a unit to edit (if the part - // has multiple units) - SYMBOL_TREE_PANE* m_treePane; // component search tree widget - LIB_MANAGER* m_libMgr; // manager taking care of temporary modifications - LIBEDIT_SETTINGS* m_settings; // Handle to the settings + LIB_PART* m_my_part; // a part I own, it is not in any library, but a + // copy could be. + wxComboBox* m_unitSelectBox; // a ComboBox to select a unit to edit (if the + // part has multiple units) + SYMBOL_TREE_PANE* m_treePane; // component search tree widget + SYMBOL_LIBRARY_MANAGER* m_libMgr; // manager taking care of temporary modifications + SYMBOL_EDITOR_SETTINGS* m_settings; // Handle to the settings // The unit number to edit and show int m_unit; @@ -102,9 +102,9 @@ public: bool m_SyncPinEdit; public: - LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ); + SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ); - ~LIB_EDIT_FRAME() override; + ~SYMBOL_EDIT_FRAME() override; /** * switches currently used canvas ( Cairo / OpenGL). @@ -153,7 +153,7 @@ public: */ void SetCurPart( LIB_PART* aPart ); - LIB_MANAGER& GetLibManager(); + SYMBOL_LIBRARY_MANAGER& GetLibManager(); SELECTION& GetCurrentSelection() override; @@ -233,7 +233,7 @@ public: void LoadSettings( APP_SETTINGS_BASE* aCfg ) override; void SaveSettings( APP_SETTINGS_BASE* aCfg ) override; - LIBEDIT_SETTINGS* GetSettings() + SYMBOL_EDITOR_SETTINGS* GetSettings() { return m_settings; } @@ -243,7 +243,7 @@ public: /** * Trigger the wxCloseEvent, which is handled by the function given to EVT_CLOSE() macro: *

- * EVT_CLOSE( LIB_EDIT_FRAME::OnCloseWindow ) + * EVT_CLOSE( SYMBOL_EDIT_FRAME::OnCloseWindow ) *

*/ void CloseWindow( wxCommandEvent& event ) @@ -352,7 +352,7 @@ public: * Because a component in library editor does not have a lot of primitives, * the full data is duplicated. It is not worth to try to optimize this save function. */ - void SaveCopyInUndoList( EDA_ITEM* ItemToCopy, UNDO_REDO undoType = UNDO_REDO::LIBEDIT, + void SaveCopyInUndoList( EDA_ITEM* aItem, UNDO_REDO aUndoType = UNDO_REDO::LIBEDIT, bool aAppend = false ); void GetComponentFromUndoList(); @@ -512,4 +512,4 @@ private: DECLARE_EVENT_TABLE() }; -#endif // LIB_EDIT_FRAME_H +#endif // SYMBOL_EDIT_FRAME_H diff --git a/eeschema/libedit/libedit.cpp b/eeschema/symbol_editor/symbol_editor.cpp similarity index 78% rename from eeschema/libedit/libedit.cpp rename to eeschema/symbol_editor/symbol_editor.cpp index 32f06c4e5a..7369dcebd7 100644 --- a/eeschema/libedit/libedit.cpp +++ b/eeschema/symbol_editor/symbol_editor.cpp @@ -28,13 +28,13 @@ #include #include #include -#include +#include #include #include #include #include #include -#include +#include #include #include #include @@ -44,7 +44,7 @@ #include -void LIB_EDIT_FRAME::updateTitle() +void SYMBOL_EDIT_FRAME::updateTitle() { wxString lib = GetCurLib(); wxString title; @@ -68,7 +68,7 @@ void LIB_EDIT_FRAME::updateTitle() } -void LIB_EDIT_FRAME::SelectActiveLibrary( const wxString& aLibrary ) +void SYMBOL_EDIT_FRAME::SelectActiveLibrary( const wxString& aLibrary ) { wxString selectedLib = aLibrary; @@ -82,7 +82,7 @@ void LIB_EDIT_FRAME::SelectActiveLibrary( const wxString& aLibrary ) } -wxString LIB_EDIT_FRAME::SelectLibraryFromList() +wxString SYMBOL_EDIT_FRAME::SelectLibraryFromList() { PROJECT& prj = Prj(); @@ -129,7 +129,7 @@ wxString LIB_EDIT_FRAME::SelectLibraryFromList() } -bool LIB_EDIT_FRAME::saveCurrentPart() +bool SYMBOL_EDIT_FRAME::saveCurrentPart() { if( GetCurPart() ) { @@ -148,7 +148,7 @@ bool LIB_EDIT_FRAME::saveCurrentPart() } -bool LIB_EDIT_FRAME::LoadComponentAndSelectLib( const LIB_ID& aLibId, int aUnit, int aConvert ) +bool SYMBOL_EDIT_FRAME::LoadComponentAndSelectLib( const LIB_ID& aLibId, int aUnit, int aConvert ) { if( GetCurPart() && GetCurPart()->GetLibId() == aLibId && GetUnit() == aUnit && GetConvert() == aConvert ) @@ -171,8 +171,8 @@ bool LIB_EDIT_FRAME::LoadComponentAndSelectLib( const LIB_ID& aLibId, int aUnit, } -bool LIB_EDIT_FRAME::LoadComponentFromCurrentLib( const wxString& aAliasName, int aUnit, - int aConvert ) +bool SYMBOL_EDIT_FRAME::LoadComponentFromCurrentLib( const wxString& aAliasName, int aUnit, + int aConvert ) { LIB_PART* alias = nullptr; @@ -207,8 +207,8 @@ bool LIB_EDIT_FRAME::LoadComponentFromCurrentLib( const wxString& aAliasName, in } -bool LIB_EDIT_FRAME::LoadOneLibraryPartAux( LIB_PART* aEntry, const wxString& aLibrary, - int aUnit, int aConvert ) +bool SYMBOL_EDIT_FRAME::LoadOneLibraryPartAux( LIB_PART* aEntry, const wxString& aLibrary, + int aUnit, int aConvert ) { wxString msg, rootName; bool rebuildMenuAndToolbar = false; @@ -269,7 +269,168 @@ bool LIB_EDIT_FRAME::LoadOneLibraryPartAux( LIB_PART* aEntry, const wxString& aL } -void LIB_EDIT_FRAME::SaveAll() +void SYMBOL_EDIT_FRAME::LoadOneSymbol() +{ + EE_SELECTION_TOOL* selTool = m_toolManager->GetTool(); + + // Exit if no library entry is selected or a command is in progress. + if( !m_my_part || !EE_CONDITIONS::Idle( selTool->GetSelection() ) ) + return; + + PROJECT& prj = Prj(); + SEARCH_STACK* search = prj.SchSearchS(); + + wxString default_path = prj.GetRString( PROJECT::SCH_LIB_PATH ); + + if( !default_path ) + default_path = search->LastVisitedPath(); + + wxFileDialog dlg( this, _( "Import Symbol" ), default_path, + wxEmptyString, SchematicSymbolFileWildcard(), + wxFD_OPEN | wxFD_FILE_MUST_EXIST ); + + if( dlg.ShowModal() == wxID_CANCEL ) + return; + + wxString filename = dlg.GetPath(); + + prj.SetRString( PROJECT::SCH_LIB_PATH, filename ); + + wxArrayString symbols; + SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) ); + + wxString msg; + + try + { + pi->EnumerateSymbolLib( symbols, filename ); + } + catch( const IO_ERROR& ioe ) + { + msg.Printf( _( "Cannot import symbol library \"%s\"." ), filename ); + DisplayErrorMessage( this, msg, ioe.What() ); + return; + } + + if( symbols.empty() ) + { + msg.Printf( _( "Symbol library file \"%s\" is empty." ), filename ); + DisplayError( this, msg ); + return; + } + + if( symbols.GetCount() > 1 ) + { + msg.Printf( _( "More than one symbol found in symbol file \"%s\"." ), filename ); + wxMessageBox( msg, _( "Warning" ), wxOK | wxICON_EXCLAMATION, this ); + } + + LIB_PART* alias = nullptr; + + try + { + alias = pi->LoadSymbol( filename, symbols[0] ); + } + catch( const IO_ERROR& ) + { + return; + } + + wxCHECK_RET( alias, "Invalid symbol." ); + + SaveCopyInUndoList( m_my_part ); + + LIB_PART* first = alias; + LIB_ITEMS_CONTAINER& drawList = first->GetDrawItems(); + + for( LIB_ITEM& item : drawList ) + { + if( item.Type() == LIB_FIELD_T ) + continue; + + if( item.GetUnit() ) + item.SetUnit( m_unit ); + + if( item.GetConvert() ) + item.SetConvert( m_convert ); + + item.SetFlags( IS_NEW | SELECTED ); + + LIB_ITEM* newItem = (LIB_ITEM*) item.Clone(); + + newItem->SetParent( m_my_part ); + m_my_part->AddDrawItem( newItem ); + item.ClearSelected(); + } + + m_my_part->RemoveDuplicateDrawItems(); + + OnModify(); +} + + +void SYMBOL_EDIT_FRAME::SaveOneSymbol() +{ + wxCHECK( m_my_part, /* void */ ); + + // Export the current part as a symbol (.sym file) + // this is the current part without its aliases and doc file + // because a .sym file is used to import graphics in a part being edited + if( m_my_part->GetDrawItems().empty() ) + return; + + PROJECT& prj = Prj(); + SEARCH_STACK* search = prj.SchSearchS(); + + wxString default_path = prj.GetRString( PROJECT::SCH_LIB_PATH ); + + if( !default_path ) + default_path = search->LastVisitedPath(); + + wxFileDialog dlg( this, _( "Export Symbol" ), default_path, + m_my_part->GetName() + "." + SchematicSymbolFileExtension, + SchematicSymbolFileWildcard(), + wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); + + if( dlg.ShowModal() == wxID_CANCEL ) + return; + + wxFileName fn = dlg.GetPath(); + + /* The GTK file chooser doesn't return the file extension added to + * file name so add it here. */ + if( fn.GetExt().IsEmpty() ) + fn.SetExt( SchematicSymbolFileExtension ); + + prj.SetRString( PROJECT::SCH_LIB_PATH, fn.GetPath() ); + + if( fn.FileExists() ) + wxRemove( fn.GetFullPath() ); + + SetStatusText( wxString::Format( _( "Saving symbol in \"%s\"" ), fn.GetPath() ) ); + + SCH_PLUGIN::SCH_PLUGIN_RELEASER plugin( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) ); + + try + { + PROPERTIES nodoc_props; // Doc file is useless for a .sym file + nodoc_props[ SCH_LEGACY_PLUGIN::PropNoDocFile ] = ""; + plugin->CreateSymbolLib( fn.GetFullPath(), &nodoc_props ); + + // The part gets flattened by the LIB_PART copy constructor. + LIB_PART* saved_part = new LIB_PART( *m_my_part ); + plugin->SaveSymbol( fn.GetFullPath(), saved_part, &nodoc_props ); + } + catch( const IO_ERROR& ioe ) + { + wxString msg = wxString::Format( _( "An error occurred saving symbol file \"%s\"" ), + fn.GetFullPath() ); + DisplayErrorMessage( this, msg, ioe.What() ); + } +} + + +void SYMBOL_EDIT_FRAME::SaveAll() { saveAllLibraries( false ); m_treePane->GetLibTree()->RefreshLibTree(); @@ -277,7 +438,7 @@ void LIB_EDIT_FRAME::SaveAll() } -void LIB_EDIT_FRAME::CreateNewPart() +void SYMBOL_EDIT_FRAME::CreateNewPart() { m_toolManager->RunAction( ACTIONS::cancelInteractive, true ); @@ -392,7 +553,7 @@ void LIB_EDIT_FRAME::CreateNewPart() } -void LIB_EDIT_FRAME::Save() +void SYMBOL_EDIT_FRAME::Save() { LIB_ID libId = getTargetLibId(); const wxString& libName = libId.GetLibNickname(); @@ -419,7 +580,7 @@ void LIB_EDIT_FRAME::Save() } -void LIB_EDIT_FRAME::SaveAs() +void SYMBOL_EDIT_FRAME::SaveAs() { LIB_ID libId = getTargetLibId(); const wxString& libName = libId.GetLibNickname(); @@ -435,7 +596,7 @@ void LIB_EDIT_FRAME::SaveAs() } -void LIB_EDIT_FRAME::savePartAs() +void SYMBOL_EDIT_FRAME::savePartAs() { LIB_ID old_lib_id = getTargetLibId(); wxString old_name = old_lib_id.GetLibItemName(); @@ -538,7 +699,7 @@ void LIB_EDIT_FRAME::savePartAs() } -void LIB_EDIT_FRAME::UpdateAfterSymbolProperties( wxString* aOldName ) +void SYMBOL_EDIT_FRAME::UpdateAfterSymbolProperties( wxString* aOldName ) { wxCHECK( m_my_part, /* void */ ); @@ -576,7 +737,7 @@ void LIB_EDIT_FRAME::UpdateAfterSymbolProperties( wxString* aOldName ) } -void LIB_EDIT_FRAME::DeletePartFromLibrary() +void SYMBOL_EDIT_FRAME::DeletePartFromLibrary() { LIB_ID libId = getTargetLibId(); @@ -618,7 +779,7 @@ void LIB_EDIT_FRAME::DeletePartFromLibrary() } -void LIB_EDIT_FRAME::CopyPartToClipboard() +void SYMBOL_EDIT_FRAME::CopyPartToClipboard() { int dummyUnit; LIB_ID libId = m_treePane->GetLibTree()->GetSelectedLibId( &dummyUnit ); @@ -644,7 +805,7 @@ void LIB_EDIT_FRAME::CopyPartToClipboard() } -void LIB_EDIT_FRAME::DuplicatePart( bool aFromClipboard ) +void SYMBOL_EDIT_FRAME::DuplicatePart( bool aFromClipboard ) { int dummyUnit; LIB_ID libId = m_treePane->GetLibTree()->GetSelectedLibId( &dummyUnit ); @@ -711,7 +872,7 @@ void LIB_EDIT_FRAME::DuplicatePart( bool aFromClipboard ) } -void LIB_EDIT_FRAME::ensureUniqueName( LIB_PART* aPart, const wxString& aLibrary ) +void SYMBOL_EDIT_FRAME::ensureUniqueName( LIB_PART* aPart, const wxString& aLibrary ) { wxCHECK( aPart, /* void */ ); @@ -726,7 +887,7 @@ void LIB_EDIT_FRAME::ensureUniqueName( LIB_PART* aPart, const wxString& aLibrary } -void LIB_EDIT_FRAME::Revert( bool aConfirm ) +void SYMBOL_EDIT_FRAME::Revert( bool aConfirm ) { LIB_ID libId = getTargetLibId(); const wxString& libName = libId.GetLibNickname(); @@ -786,7 +947,7 @@ void LIB_EDIT_FRAME::Revert( bool aConfirm ) } -void LIB_EDIT_FRAME::RevertAll() +void SYMBOL_EDIT_FRAME::RevertAll() { wxCHECK_RET( m_libMgr, "Library manager object not created." ); @@ -795,7 +956,7 @@ void LIB_EDIT_FRAME::RevertAll() } -void LIB_EDIT_FRAME::LoadPart( const wxString& aAlias, const wxString& aLibrary, int aUnit ) +void SYMBOL_EDIT_FRAME::LoadPart( const wxString& aAlias, const wxString& aLibrary, int aUnit ) { LIB_PART* part = m_libMgr->GetBufferedPart( aAlias, aLibrary ); @@ -818,7 +979,7 @@ void LIB_EDIT_FRAME::LoadPart( const wxString& aAlias, const wxString& aLibrary, } -bool LIB_EDIT_FRAME::saveLibrary( const wxString& aLibrary, bool aNewFile ) +bool SYMBOL_EDIT_FRAME::saveLibrary( const wxString& aLibrary, bool aNewFile ) { wxFileName fn; wxString msg; @@ -897,7 +1058,7 @@ bool LIB_EDIT_FRAME::saveLibrary( const wxString& aLibrary, bool aNewFile ) } -bool LIB_EDIT_FRAME::saveAllLibraries( bool aRequireConfirmation ) +bool SYMBOL_EDIT_FRAME::saveAllLibraries( bool aRequireConfirmation ) { wxString msg; bool doSave = true; @@ -953,3 +1114,48 @@ bool LIB_EDIT_FRAME::saveAllLibraries( bool aRequireConfirmation ) return retv; } + + +void SYMBOL_EDIT_FRAME::DisplayCmpDoc() +{ + EDA_DRAW_FRAME::ClearMsgPanel(); + + if( !m_my_part ) + return; + + wxString msg = m_my_part->GetName(); + + AppendMsgPanel( _( "Name" ), msg, BLUE, 8 ); + + if( m_my_part->IsAlias() ) + { + PART_SPTR parent = m_my_part->GetParent().lock(); + + msg = parent ? parent->GetName() : _( "Undefined!" ); + AppendMsgPanel( _( "Parent" ), msg, BROWN, 8 ); + } + + static wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" ); + msg = UnitLetter[m_unit]; + + AppendMsgPanel( _( "Unit" ), msg, BROWN, 8 ); + + if( m_convert > 1 ) + msg = _( "Convert" ); + else + msg = _( "Normal" ); + + AppendMsgPanel( _( "Body" ), msg, GREEN, 8 ); + + if( m_my_part->IsPower() ) + msg = _( "Power Symbol" ); + else + msg = _( "Symbol" ); + + AppendMsgPanel( _( "Type" ), msg, MAGENTA, 8 ); + AppendMsgPanel( _( "Description" ), m_my_part->GetDescription(), CYAN, 8 ); + AppendMsgPanel( _( "Keywords" ), m_my_part->GetKeyWords(), DARKDARKGRAY ); + AppendMsgPanel( _( "Datasheet" ), m_my_part->GetDatasheetField().GetText(), DARKDARKGRAY ); +} + + diff --git a/eeschema/libedit/lib_export.cpp b/eeschema/symbol_editor/symbol_editor_import_export.cpp similarity index 97% rename from eeschema/libedit/lib_export.cpp rename to eeschema/symbol_editor/symbol_editor_import_export.cpp index 812ebf299f..c432704fec 100644 --- a/eeschema/libedit/lib_export.cpp +++ b/eeschema/symbol_editor/symbol_editor_import_export.cpp @@ -25,15 +25,15 @@ #include #include -#include +#include #include #include #include -#include +#include #include -void LIB_EDIT_FRAME::ImportPart() +void SYMBOL_EDIT_FRAME::ImportPart() { wxString msg; wxString libName = getTargetLib(); @@ -103,7 +103,7 @@ void LIB_EDIT_FRAME::ImportPart() } -void LIB_EDIT_FRAME::ExportPart() +void SYMBOL_EDIT_FRAME::ExportPart() { wxString msg, title; LIB_PART* part = getTargetPart(); diff --git a/eeschema/libedit/libedit_plot_component.cpp b/eeschema/symbol_editor/symbol_editor_plotter.cpp similarity index 92% rename from eeschema/libedit/libedit_plot_component.cpp rename to eeschema/symbol_editor/symbol_editor_plotter.cpp index c8db3cb61d..eae7d38435 100644 --- a/eeschema/libedit/libedit_plot_component.cpp +++ b/eeschema/symbol_editor/symbol_editor_plotter.cpp @@ -23,13 +23,13 @@ #include -#include +#include #include #include #include #include -void LIB_EDIT_FRAME::SVG_PlotComponent( const wxString& aFullFileName ) +void SYMBOL_EDIT_FRAME::SVG_PlotComponent( const wxString& aFullFileName ) { KIGFX::SCH_RENDER_SETTINGS renderSettings; renderSettings.LoadColors( GetColorSettings() ); @@ -80,7 +80,7 @@ void LIB_EDIT_FRAME::SVG_PlotComponent( const wxString& aFullFileName ) } -void LIB_EDIT_FRAME::PrintPage( RENDER_SETTINGS* aSettings ) +void SYMBOL_EDIT_FRAME::PrintPage( RENDER_SETTINGS* aSettings ) { if( !m_my_part ) return; @@ -88,7 +88,7 @@ void LIB_EDIT_FRAME::PrintPage( RENDER_SETTINGS* aSettings ) wxSize pagesize = GetScreen()->GetPageSettings().GetSizeIU(); /* Plot item centered to the page - * In libedit, the component is centered at 0,0 coordinates. + * In symbol_editor, the component is centered at 0,0 coordinates. * So we must plot it with an offset = pagesize/2. */ wxPoint plot_offset; diff --git a/eeschema/libedit/libedit_settings.cpp b/eeschema/symbol_editor/symbol_editor_settings.cpp similarity index 92% rename from eeschema/libedit/libedit_settings.cpp rename to eeschema/symbol_editor/symbol_editor_settings.cpp index d202be2f7b..1169659bc6 100644 --- a/eeschema/libedit/libedit_settings.cpp +++ b/eeschema/symbol_editor/symbol_editor_settings.cpp @@ -24,7 +24,7 @@ #include #include #include -#include "libedit_settings.h" +#include "symbol_editor_settings.h" #include @@ -32,8 +32,12 @@ const int libeditSchemaVersion = 0; -LIBEDIT_SETTINGS::LIBEDIT_SETTINGS() : APP_SETTINGS_BASE( "libedit", libeditSchemaVersion ), - m_Defaults(), m_Repeat(), m_ShowPinElectricalType( true ), m_LibWidth(), +SYMBOL_EDITOR_SETTINGS::SYMBOL_EDITOR_SETTINGS() : + APP_SETTINGS_BASE( "symbol_editor", libeditSchemaVersion ), + m_Defaults(), + m_Repeat(), + m_ShowPinElectricalType( true ), + m_LibWidth(), m_EditComponentVisibleColumns() { // Make Coverity happy @@ -81,7 +85,7 @@ LIBEDIT_SETTINGS::LIBEDIT_SETTINGS() : APP_SETTINGS_BASE( "libedit", libeditSche } -bool LIBEDIT_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) +bool SYMBOL_EDITOR_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) { bool ret = APP_SETTINGS_BASE::MigrateFromLegacy( aCfg ); diff --git a/eeschema/libedit/libedit_settings.h b/eeschema/symbol_editor/symbol_editor_settings.h similarity index 90% rename from eeschema/libedit/libedit_settings.h rename to eeschema/symbol_editor/symbol_editor_settings.h index 4f292d4652..14856d9802 100644 --- a/eeschema/libedit/libedit_settings.h +++ b/eeschema/symbol_editor/symbol_editor_settings.h @@ -21,13 +21,13 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef _LIBEDIT_SETTINGS_H -#define _LIBEDIT_SETTINGS_H +#ifndef SYMBOL_EDITOR_SETTINGS_H +#define SYMBOL_EDITOR_SETTINGS_H #include -class LIBEDIT_SETTINGS : public APP_SETTINGS_BASE +class SYMBOL_EDITOR_SETTINGS : public APP_SETTINGS_BASE { public: @@ -48,9 +48,9 @@ public: int y_step; }; - LIBEDIT_SETTINGS(); + SYMBOL_EDITOR_SETTINGS(); - virtual ~LIBEDIT_SETTINGS() {} + virtual ~SYMBOL_EDITOR_SETTINGS() {} virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override; diff --git a/eeschema/libedit/libedit_undo_redo.cpp b/eeschema/symbol_editor/symbol_editor_undo_redo.cpp similarity index 91% rename from eeschema/libedit/libedit_undo_redo.cpp rename to eeschema/symbol_editor/symbol_editor_undo_redo.cpp index d7db5c7fc2..2211d3f013 100644 --- a/eeschema/libedit/libedit_undo_redo.cpp +++ b/eeschema/symbol_editor/symbol_editor_undo_redo.cpp @@ -22,35 +22,33 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include - -#include +#include #include -#include +#include #include #include #include #include #include -void LIB_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* ItemToCopy, UNDO_REDO undoType, bool aAppend ) +void SYMBOL_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* aItem, UNDO_REDO aUndoType, bool aAppend ) { - wxASSERT_MSG( !aAppend, "Append not needed/supported for LibEdit" ); + wxASSERT_MSG( !aAppend, "Append not needed/supported for symbol editor" ); - if( !ItemToCopy ) + if( !aItem ) return; LIB_PART* copyItem; PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST(); - copyItem = new LIB_PART( * (LIB_PART*) ItemToCopy ); + copyItem = new LIB_PART( * (LIB_PART*) aItem ); // Clear current flags (which can be temporary set by a current edit command). copyItem->ClearTempFlags(); copyItem->ClearEditFlags(); copyItem->SetFlags( UR_TRANSIENT ); - ITEM_PICKER wrapper( GetScreen(), copyItem, undoType ); + ITEM_PICKER wrapper( GetScreen(), copyItem, aUndoType ); lastcmd->PushItem( wrapper ); PushCommandToUndoList( lastcmd ); @@ -59,7 +57,7 @@ void LIB_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* ItemToCopy, UNDO_REDO undoTyp } -void LIB_EDIT_FRAME::GetComponentFromRedoList() +void SYMBOL_EDIT_FRAME::GetComponentFromRedoList() { if( GetRedoCommandCount() <= 0 ) return; @@ -107,7 +105,7 @@ void LIB_EDIT_FRAME::GetComponentFromRedoList() } -void LIB_EDIT_FRAME::GetComponentFromUndoList() +void SYMBOL_EDIT_FRAME::GetComponentFromUndoList() { if( GetUndoCommandCount() <= 0 ) return; @@ -155,7 +153,7 @@ void LIB_EDIT_FRAME::GetComponentFromUndoList() } -void LIB_EDIT_FRAME::RollbackPartFromUndo() +void SYMBOL_EDIT_FRAME::RollbackPartFromUndo() { m_toolManager->RunAction( EE_ACTIONS::clearSelection, true ); diff --git a/eeschema/libedit/lib_manager.cpp b/eeschema/symbol_editor/symbol_library_manager.cpp similarity index 83% rename from eeschema/libedit/lib_manager.cpp rename to eeschema/symbol_editor/symbol_library_manager.cpp index bc4b197552..535817fd89 100644 --- a/eeschema/libedit/lib_manager.cpp +++ b/eeschema/symbol_editor/symbol_library_manager.cpp @@ -23,10 +23,10 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include #include #include -#include +#include #include #include #include @@ -37,7 +37,7 @@ #include -LIB_MANAGER::LIB_MANAGER( LIB_EDIT_FRAME& aFrame ) : +SYMBOL_LIBRARY_MANAGER::SYMBOL_LIBRARY_MANAGER( SYMBOL_EDIT_FRAME& aFrame ) : m_frame( aFrame ), m_syncHash( 0 ) { @@ -46,8 +46,8 @@ LIB_MANAGER::LIB_MANAGER( LIB_EDIT_FRAME& aFrame ) : } -void LIB_MANAGER::Sync( bool aForce, - std::function aProgressCallback ) +void SYMBOL_LIBRARY_MANAGER::Sync( bool aForce, + std::function aProgressCallback ) { m_logger.Activate(); { @@ -63,7 +63,7 @@ void LIB_MANAGER::Sync( bool aForce, } -bool LIB_MANAGER::HasModifications() const +bool SYMBOL_LIBRARY_MANAGER::HasModifications() const { for( const auto& lib : m_libs ) { @@ -75,7 +75,7 @@ bool LIB_MANAGER::HasModifications() const } -int LIB_MANAGER::GetHash() const +int SYMBOL_LIBRARY_MANAGER::GetHash() const { int hash = symTable()->GetModifyHash(); @@ -86,7 +86,7 @@ int LIB_MANAGER::GetHash() const } -int LIB_MANAGER::GetLibraryHash( const wxString& aLibrary ) const +int SYMBOL_LIBRARY_MANAGER::GetLibraryHash( const wxString& aLibrary ) const { const auto libBufIt = m_libs.find( aLibrary ); @@ -101,7 +101,7 @@ int LIB_MANAGER::GetLibraryHash( const wxString& aLibrary ) const } -wxArrayString LIB_MANAGER::GetLibraryNames() const +wxArrayString SYMBOL_LIBRARY_MANAGER::GetLibraryNames() const { wxArrayString res; @@ -112,7 +112,7 @@ wxArrayString LIB_MANAGER::GetLibraryNames() const } -SYMBOL_LIB_TABLE_ROW* LIB_MANAGER::GetLibrary( const wxString& aLibrary ) const +SYMBOL_LIB_TABLE_ROW* SYMBOL_LIBRARY_MANAGER::GetLibrary( const wxString& aLibrary ) const { SYMBOL_LIB_TABLE_ROW* row = nullptr; @@ -130,8 +130,8 @@ SYMBOL_LIB_TABLE_ROW* LIB_MANAGER::GetLibrary( const wxString& aLibrary ) const } -bool LIB_MANAGER::SaveLibrary( const wxString& aLibrary, const wxString& aFileName, - SCH_IO_MGR::SCH_FILE_T aFileType ) +bool SYMBOL_LIBRARY_MANAGER::SaveLibrary( const wxString& aLibrary, const wxString& aFileName, + SCH_IO_MGR::SCH_FILE_T aFileType ) { wxCHECK( aFileType != SCH_IO_MGR::SCH_FILE_T::SCH_LEGACY && LibraryExists( aLibrary ), false ); wxFileName fn( aFileName ); @@ -224,14 +224,14 @@ bool LIB_MANAGER::SaveLibrary( const wxString& aLibrary, const wxString& aFileNa } -bool LIB_MANAGER::IsLibraryModified( const wxString& aLibrary ) const +bool SYMBOL_LIBRARY_MANAGER::IsLibraryModified( const wxString& aLibrary ) const { auto it = m_libs.find( aLibrary ); return it != m_libs.end() ? it->second.IsModified() : false; } -bool LIB_MANAGER::IsPartModified( const wxString& aAlias, const wxString& aLibrary ) const +bool SYMBOL_LIBRARY_MANAGER::IsPartModified( const wxString& aAlias, const wxString& aLibrary ) const { auto libIt = m_libs.find( aLibrary ); @@ -244,7 +244,7 @@ bool LIB_MANAGER::IsPartModified( const wxString& aAlias, const wxString& aLibra } -bool LIB_MANAGER::ClearLibraryModified( const wxString& aLibrary ) const +bool SYMBOL_LIBRARY_MANAGER::ClearLibraryModified( const wxString& aLibrary ) const { auto libIt = m_libs.find( aLibrary ); @@ -263,7 +263,7 @@ bool LIB_MANAGER::ClearLibraryModified( const wxString& aLibrary ) const } -bool LIB_MANAGER::ClearPartModified( const wxString& aAlias, const wxString& aLibrary ) const +bool SYMBOL_LIBRARY_MANAGER::ClearPartModified( const wxString& aAlias, const wxString& aLibrary ) const { auto libI = m_libs.find( aLibrary ); @@ -278,7 +278,7 @@ bool LIB_MANAGER::ClearPartModified( const wxString& aAlias, const wxString& aLi } -bool LIB_MANAGER::IsLibraryReadOnly( const wxString& aLibrary ) const +bool SYMBOL_LIBRARY_MANAGER::IsLibraryReadOnly( const wxString& aLibrary ) const { wxCHECK( LibraryExists( aLibrary ), true ); @@ -286,7 +286,7 @@ bool LIB_MANAGER::IsLibraryReadOnly( const wxString& aLibrary ) const } -bool LIB_MANAGER::IsLibraryLoaded( const wxString& aLibrary ) const +bool SYMBOL_LIBRARY_MANAGER::IsLibraryLoaded( const wxString& aLibrary ) const { wxCHECK( LibraryExists( aLibrary ), false ); @@ -294,7 +294,7 @@ bool LIB_MANAGER::IsLibraryLoaded( const wxString& aLibrary ) const } -std::list LIB_MANAGER::GetAliases( const wxString& aLibrary ) const +std::list SYMBOL_LIBRARY_MANAGER::GetAliases( const wxString& aLibrary ) const { std::list ret; wxCHECK( LibraryExists( aLibrary ), ret ); @@ -328,7 +328,8 @@ std::list LIB_MANAGER::GetAliases( const wxString& aLibrary ) const } -LIB_PART* LIB_MANAGER::GetBufferedPart( const wxString& aAlias, const wxString& aLibrary ) +LIB_PART* SYMBOL_LIBRARY_MANAGER::GetBufferedPart( const wxString& aAlias, + const wxString& aLibrary ) { wxCHECK( LibraryExists( aLibrary ), nullptr ); @@ -385,7 +386,7 @@ LIB_PART* LIB_MANAGER::GetBufferedPart( const wxString& aAlias, const wxString& } -SCH_SCREEN* LIB_MANAGER::GetScreen( const wxString& aAlias, const wxString& aLibrary ) +SCH_SCREEN* SYMBOL_LIBRARY_MANAGER::GetScreen( const wxString& aAlias, const wxString& aLibrary ) { wxCHECK( LibraryExists( aLibrary ), nullptr ); wxCHECK( !aAlias.IsEmpty(), nullptr ); @@ -398,7 +399,7 @@ SCH_SCREEN* LIB_MANAGER::GetScreen( const wxString& aAlias, const wxString& aLib } -bool LIB_MANAGER::UpdatePart( LIB_PART* aPart, const wxString& aLibrary ) +bool SYMBOL_LIBRARY_MANAGER::UpdatePart( LIB_PART* aPart, const wxString& aLibrary ) { wxCHECK( LibraryExists( aLibrary ), false ); wxCHECK( aPart, false ); @@ -429,8 +430,8 @@ bool LIB_MANAGER::UpdatePart( LIB_PART* aPart, const wxString& aLibrary ) } -bool LIB_MANAGER::UpdatePartAfterRename( LIB_PART* aPart, const wxString& aOldName, - const wxString& aLibrary ) +bool SYMBOL_LIBRARY_MANAGER::UpdatePartAfterRename( LIB_PART* aPart, const wxString& aOldName, + const wxString& aLibrary ) { LIB_BUFFER& libBuf = getLibraryBuffer( aLibrary ); auto partBuf = libBuf.GetBuffer( aOldName ); @@ -445,7 +446,7 @@ bool LIB_MANAGER::UpdatePartAfterRename( LIB_PART* aPart, const wxString& aOldNa } -bool LIB_MANAGER::FlushPart( const wxString& aAlias, const wxString& aLibrary ) +bool SYMBOL_LIBRARY_MANAGER::FlushPart( const wxString& aAlias, const wxString& aLibrary ) { auto it = m_libs.find( aLibrary ); @@ -459,7 +460,7 @@ bool LIB_MANAGER::FlushPart( const wxString& aAlias, const wxString& aLibrary ) } -LIB_ID LIB_MANAGER::RevertPart( const wxString& aAlias, const wxString& aLibrary ) +LIB_ID SYMBOL_LIBRARY_MANAGER::RevertPart( const wxString& aAlias, const wxString& aLibrary ) { auto it = m_libs.find( aLibrary ); @@ -484,7 +485,7 @@ LIB_ID LIB_MANAGER::RevertPart( const wxString& aAlias, const wxString& aLibrary } -bool LIB_MANAGER::RevertLibrary( const wxString& aLibrary ) +bool SYMBOL_LIBRARY_MANAGER::RevertLibrary( const wxString& aLibrary ) { auto it = m_libs.find( aLibrary ); @@ -498,7 +499,7 @@ bool LIB_MANAGER::RevertLibrary( const wxString& aLibrary ) } -bool LIB_MANAGER::RevertAll() +bool SYMBOL_LIBRARY_MANAGER::RevertAll() { bool retv = true; @@ -524,7 +525,7 @@ bool LIB_MANAGER::RevertAll() } -bool LIB_MANAGER::RemovePart( const wxString& aAlias, const wxString& aLibrary ) +bool SYMBOL_LIBRARY_MANAGER::RemovePart( const wxString& aAlias, const wxString& aLibrary ) { LIB_BUFFER& libBuf = getLibraryBuffer( aLibrary ); auto partBuf = libBuf.GetBuffer( aAlias ); @@ -539,7 +540,8 @@ bool LIB_MANAGER::RemovePart( const wxString& aAlias, const wxString& aLibrary ) } -LIB_PART* LIB_MANAGER::GetAlias( const wxString& aAlias, const wxString& aLibrary ) const +LIB_PART* SYMBOL_LIBRARY_MANAGER::GetAlias( const wxString& aAlias, + const wxString& aLibrary ) const { // Try the library buffers first auto libIt = m_libs.find( aLibrary ); @@ -569,7 +571,7 @@ LIB_PART* LIB_MANAGER::GetAlias( const wxString& aAlias, const wxString& aLibrar } -bool LIB_MANAGER::PartExists( const wxString& aAlias, const wxString& aLibrary ) const +bool SYMBOL_LIBRARY_MANAGER::PartExists( const wxString& aAlias, const wxString& aLibrary ) const { auto libBufIt = m_libs.find( aLibrary ); LIB_PART* alias = nullptr; @@ -590,7 +592,7 @@ bool LIB_MANAGER::PartExists( const wxString& aAlias, const wxString& aLibrary ) } -bool LIB_MANAGER::LibraryExists( const wxString& aLibrary, bool aCheckEnabled ) const +bool SYMBOL_LIBRARY_MANAGER::LibraryExists( const wxString& aLibrary, bool aCheckEnabled ) const { if( aLibrary.IsEmpty() ) return false; @@ -602,7 +604,7 @@ bool LIB_MANAGER::LibraryExists( const wxString& aLibrary, bool aCheckEnabled ) } -wxString LIB_MANAGER::GetUniqueLibraryName() const +wxString SYMBOL_LIBRARY_MANAGER::GetUniqueLibraryName() const { wxString name = "New_Library"; @@ -622,8 +624,8 @@ wxString LIB_MANAGER::GetUniqueLibraryName() const } -void LIB_MANAGER::GetRootSymbolNames( const wxString& aLibraryName, - wxArrayString& aRootSymbolNames ) +void SYMBOL_LIBRARY_MANAGER::GetRootSymbolNames( const wxString& aLibraryName, + wxArrayString& aRootSymbolNames ) { LIB_BUFFER& libBuf = getLibraryBuffer( aLibraryName ); @@ -631,8 +633,8 @@ void LIB_MANAGER::GetRootSymbolNames( const wxString& aLibraryName, } -bool LIB_MANAGER:: HasDerivedSymbols( const wxString& aSymbolName, - const wxString& aLibraryName ) +bool SYMBOL_LIBRARY_MANAGER:: HasDerivedSymbols( const wxString& aSymbolName, + const wxString& aLibraryName ) { LIB_BUFFER& libBuf = getLibraryBuffer( aLibraryName ); @@ -640,14 +642,15 @@ bool LIB_MANAGER:: HasDerivedSymbols( const wxString& aSymbolName, } -wxString LIB_MANAGER::getLibraryName( const wxString& aFilePath ) +wxString SYMBOL_LIBRARY_MANAGER::getLibraryName( const wxString& aFilePath ) { wxFileName fn( aFilePath ); return fn.GetName(); } -bool LIB_MANAGER::addLibrary( const wxString& aFilePath, bool aCreate, SYMBOL_LIB_TABLE* aTable ) +bool SYMBOL_LIBRARY_MANAGER::addLibrary( const wxString& aFilePath, bool aCreate, + SYMBOL_LIB_TABLE* aTable ) { wxCHECK( aTable, false ); wxString libName = getLibraryName( aFilePath ); @@ -685,13 +688,13 @@ bool LIB_MANAGER::addLibrary( const wxString& aFilePath, bool aCreate, SYMBOL_LI } -SYMBOL_LIB_TABLE* LIB_MANAGER::symTable() const +SYMBOL_LIB_TABLE* SYMBOL_LIBRARY_MANAGER::symTable() const { return m_frame.Prj().SchSymbolLibTable(); } -std::set LIB_MANAGER::getOriginalParts( const wxString& aLibrary ) +std::set SYMBOL_LIBRARY_MANAGER::getOriginalParts( const wxString& aLibrary ) { std::set parts; wxCHECK( LibraryExists( aLibrary ), parts ); @@ -716,7 +719,7 @@ std::set LIB_MANAGER::getOriginalParts( const wxString& aLibrary ) } -LIB_MANAGER::LIB_BUFFER& LIB_MANAGER::getLibraryBuffer( const wxString& aLibrary ) +SYMBOL_LIBRARY_MANAGER::LIB_BUFFER& SYMBOL_LIBRARY_MANAGER::getLibraryBuffer( const wxString& aLibrary ) { auto it = m_libs.find( aLibrary ); @@ -761,7 +764,8 @@ LIB_MANAGER::LIB_BUFFER& LIB_MANAGER::getLibraryBuffer( const wxString& aLibrary } -LIB_MANAGER::PART_BUFFER::PART_BUFFER( LIB_PART* aPart, std::unique_ptr aScreen ) : +SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PART_BUFFER( LIB_PART* aPart, + std::unique_ptr aScreen ) : m_screen( std::move( aScreen ) ), m_part( aPart ) { @@ -769,14 +773,14 @@ LIB_MANAGER::PART_BUFFER::PART_BUFFER( LIB_PART* aPart, std::unique_ptrIsModify(); } -LIB_PART* LIB_MANAGER::LIB_BUFFER::GetPart( const wxString& aAlias ) const +LIB_PART* SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::GetPart( const wxString& aAlias ) const { auto buf = GetBuffer( aAlias ); @@ -829,7 +833,7 @@ LIB_PART* LIB_MANAGER::LIB_BUFFER::GetPart( const wxString& aAlias ) const } -bool LIB_MANAGER::LIB_BUFFER::CreateBuffer( LIB_PART* aCopy, SCH_SCREEN* aScreen ) +bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::CreateBuffer( LIB_PART* aCopy, SCH_SCREEN* aScreen ) { wxASSERT( aCopy ); wxASSERT( aCopy->GetLib() == nullptr ); @@ -848,8 +852,8 @@ bool LIB_MANAGER::LIB_BUFFER::CreateBuffer( LIB_PART* aCopy, SCH_SCREEN* aScreen } -bool LIB_MANAGER::LIB_BUFFER::UpdateBuffer( LIB_MANAGER::PART_BUFFER::PTR aPartBuf, - LIB_PART* aCopy ) +bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::UpdateBuffer( SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aPartBuf, + LIB_PART* aCopy ) { wxCHECK( aCopy && aPartBuf, false ); @@ -864,7 +868,7 @@ bool LIB_MANAGER::LIB_BUFFER::UpdateBuffer( LIB_MANAGER::PART_BUFFER::PTR aPartB } -bool LIB_MANAGER::LIB_BUFFER::DeleteBuffer( LIB_MANAGER::PART_BUFFER::PTR aPartBuf ) +bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::DeleteBuffer( SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aPartBuf ) { auto partBufIt = std::find( m_parts.begin(), m_parts.end(), aPartBuf ); wxCHECK( partBufIt != m_parts.end(), false ); @@ -886,8 +890,8 @@ bool LIB_MANAGER::LIB_BUFFER::DeleteBuffer( LIB_MANAGER::PART_BUFFER::PTR aPartB } -bool LIB_MANAGER::LIB_BUFFER::SaveBuffer( LIB_MANAGER::PART_BUFFER::PTR aPartBuf, - SYMBOL_LIB_TABLE* aLibTable ) +bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer( SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aPartBuf, + SYMBOL_LIB_TABLE* aLibTable ) { wxCHECK( aPartBuf, false ); LIB_PART* part = aPartBuf->GetPart(); @@ -925,7 +929,7 @@ bool LIB_MANAGER::LIB_BUFFER::SaveBuffer( LIB_MANAGER::PART_BUFFER::PTR aPartBuf result = aLibTable->SaveSymbol( m_libName, newCachedPart ); wxCHECK( result == SYMBOL_LIB_TABLE::SAVE_OK, false ); - LIB_MANAGER::PART_BUFFER::PTR originalBufferedParent = + SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR originalBufferedParent = GetBuffer( bufferedParent->GetName() ); wxCHECK( originalBufferedParent, false ); originalPart = new LIB_PART( *part ); @@ -951,7 +955,7 @@ bool LIB_MANAGER::LIB_BUFFER::SaveBuffer( LIB_MANAGER::PART_BUFFER::PTR aPartBuf for( auto entry : derivedSymbols ) { - LIB_MANAGER::PART_BUFFER::PTR symbol = GetBuffer( entry ); + SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR symbol = GetBuffer( entry ); LIB_PART* derivedSymbol = new LIB_PART( *symbol->GetPart() ); derivedSymbol->SetParent( parentSymbol ); result = aLibTable->SaveSymbol( m_libName, derivedSymbol ); @@ -965,8 +969,8 @@ bool LIB_MANAGER::LIB_BUFFER::SaveBuffer( LIB_MANAGER::PART_BUFFER::PTR aPartBuf } -bool LIB_MANAGER::LIB_BUFFER::SaveBuffer( LIB_MANAGER::PART_BUFFER::PTR aPartBuf, - SCH_PLUGIN* aPlugin, bool aBuffer ) +bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer( SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aPartBuf, + SCH_PLUGIN* aPlugin, bool aBuffer ) { wxCHECK( aPartBuf, false ); LIB_PART* part = aPartBuf->GetPart(); @@ -1042,7 +1046,7 @@ bool LIB_MANAGER::LIB_BUFFER::SaveBuffer( LIB_MANAGER::PART_BUFFER::PTR aPartBuf return false; } - LIB_MANAGER::PART_BUFFER::PTR originalBufferedParent = + SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR originalBufferedParent = GetBuffer( bufferedParent->GetName() ); wxCHECK( originalBufferedParent, false ); originalPart = new LIB_PART( *part ); @@ -1089,7 +1093,7 @@ bool LIB_MANAGER::LIB_BUFFER::SaveBuffer( LIB_MANAGER::PART_BUFFER::PTR aPartBuf // Save the derived symbols. for( auto entry : derivedSymbols ) { - LIB_MANAGER::PART_BUFFER::PTR symbol = GetBuffer( entry ); + SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR symbol = GetBuffer( entry ); LIB_PART* derivedSymbol = new LIB_PART( *symbol->GetPart() ); derivedSymbol->SetParent( parentSymbol ); @@ -1112,7 +1116,8 @@ bool LIB_MANAGER::LIB_BUFFER::SaveBuffer( LIB_MANAGER::PART_BUFFER::PTR aPartBuf } -LIB_MANAGER::PART_BUFFER::PTR LIB_MANAGER::LIB_BUFFER::GetBuffer( const wxString& aAlias ) const +SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR +SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::GetBuffer( const wxString& aAlias ) const { for( auto entry : m_parts ) { @@ -1124,7 +1129,7 @@ LIB_MANAGER::PART_BUFFER::PTR LIB_MANAGER::LIB_BUFFER::GetBuffer( const wxString } -bool LIB_MANAGER::LIB_BUFFER::HasDerivedSymbols( const wxString& aParentName ) const +bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::HasDerivedSymbols( const wxString& aParentName ) const { for( auto entry : m_parts ) { @@ -1144,7 +1149,7 @@ bool LIB_MANAGER::LIB_BUFFER::HasDerivedSymbols( const wxString& aParentName ) c } -void LIB_MANAGER::LIB_BUFFER::GetRootSymbolNames( wxArrayString& aRootSymbolNames ) +void SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::GetRootSymbolNames( wxArrayString& aRootSymbolNames ) { for( auto entry : m_parts ) { @@ -1156,8 +1161,8 @@ void LIB_MANAGER::LIB_BUFFER::GetRootSymbolNames( wxArrayString& aRootSymbolName } -size_t LIB_MANAGER::LIB_BUFFER::GetDerivedSymbolNames( const wxString& aSymbolName, - wxArrayString& aList ) +size_t SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::GetDerivedSymbolNames( const wxString& aSymbolName, + wxArrayString& aList ) { wxCHECK( !aSymbolName.IsEmpty(), 0 ); @@ -1179,12 +1184,12 @@ size_t LIB_MANAGER::LIB_BUFFER::GetDerivedSymbolNames( const wxString& aSymbolNa } -int LIB_MANAGER::LIB_BUFFER::removeChildSymbols( LIB_MANAGER::PART_BUFFER::PTR aPartBuf ) +int SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::removeChildSymbols( SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aPartBuf ) { wxCHECK( aPartBuf && aPartBuf->GetPart()->IsRoot(), 0 ); int cnt = 0; - std::deque< LIB_MANAGER::PART_BUFFER::PTR >::iterator it = m_parts.begin(); + std::deque< SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR >::iterator it = m_parts.begin(); while( it != m_parts.end() ) { diff --git a/eeschema/libedit/lib_manager.h b/eeschema/symbol_editor/symbol_library_manager.h similarity index 96% rename from eeschema/libedit/lib_manager.h rename to eeschema/symbol_editor/symbol_library_manager.h index 17a8c5ecbe..5a68ed54c2 100644 --- a/eeschema/libedit/lib_manager.h +++ b/eeschema/symbol_editor/symbol_library_manager.h @@ -23,8 +23,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef LIB_MANAGER_H -#define LIB_MANAGER_H +#ifndef SYMBOL_LIBRARY_MANAGER_H +#define SYMBOL_LIBRARY_MANAGER_H #include #include @@ -39,7 +39,7 @@ class LIB_PART; class PART_LIB; class SCH_PLUGIN; -class LIB_EDIT_FRAME; +class SYMBOL_EDIT_FRAME; class SYMBOL_LIB_TABLE; class SYMBOL_LIB_TABLE_ROW; @@ -96,13 +96,13 @@ private: /** * Class to handle modifications to the symbol libraries. */ -class LIB_MANAGER +class SYMBOL_LIBRARY_MANAGER { public: - LIB_MANAGER( LIB_EDIT_FRAME& aFrame ); + SYMBOL_LIBRARY_MANAGER( SYMBOL_EDIT_FRAME& aFrame ); /** - * Updates the LIB_MANAGER data to synchronize with Symbol Library Table. + * Updates the SYMBOL_LIBRARY_MANAGER data to synchronize with Symbol Library Table. */ void Sync( bool aForce = false, std::function aProgressCallback = [](int, int, const wxString&){} ); @@ -176,12 +176,12 @@ public: /** * Returns the part copy from the buffer. In case it does not exist yet, the copy is created. - * LIB_MANAGER retains the ownership. + * SYMBOL_LIBRARY_MANAGER retains the ownership. */ LIB_PART* GetBufferedPart( const wxString& aAlias, const wxString& aLibrary ); /** - * Returns the screen used to edit a specific part. LIB_MANAGER retains the ownership. + * Returns the screen used to edit a specific part. SYMBOL_LIBRARY_MANAGER retains the ownership. */ SCH_SCREEN* GetScreen( const wxString& aAlias, const wxString& aLibrary ); @@ -464,7 +464,7 @@ private: ///> The library buffers std::map m_libs; - LIB_EDIT_FRAME& m_frame; // Parent frame + SYMBOL_EDIT_FRAME& m_frame; // Parent frame LIB_LOGGER m_logger; int m_syncHash; // Symbol Lib Table hash value from the last synchronization @@ -478,4 +478,4 @@ private: } }; -#endif /* LIB_MANAGER_H */ +#endif /* SYMBOL_LIBRARY_MANAGER_H */ diff --git a/eeschema/libedit/toolbars_libedit.cpp b/eeschema/symbol_editor/toolbars_symbol_editor.cpp similarity index 96% rename from eeschema/libedit/toolbars_libedit.cpp rename to eeschema/symbol_editor/toolbars_symbol_editor.cpp index 9ae093187e..a5ab2129ea 100644 --- a/eeschema/libedit/toolbars_libedit.cpp +++ b/eeschema/symbol_editor/toolbars_symbol_editor.cpp @@ -24,13 +24,11 @@ */ #include -//#include -#include +#include #include #include #include -#include -#include +#include #include #include #include @@ -43,7 +41,7 @@ #endif -void LIB_EDIT_FRAME::ReCreateVToolbar() +void SYMBOL_EDIT_FRAME::ReCreateVToolbar() { if( m_drawToolBar ) { @@ -82,7 +80,7 @@ void LIB_EDIT_FRAME::ReCreateVToolbar() } -void LIB_EDIT_FRAME::ReCreateHToolbar() +void SYMBOL_EDIT_FRAME::ReCreateHToolbar() { if( m_mainToolBar ) { @@ -145,7 +143,7 @@ void LIB_EDIT_FRAME::ReCreateHToolbar() } -void LIB_EDIT_FRAME::ReCreateOptToolbar() +void SYMBOL_EDIT_FRAME::ReCreateOptToolbar() { if( m_optionsToolBar ) { diff --git a/eeschema/symbol_tree_synchronizing_adapter.cpp b/eeschema/symbol_tree_synchronizing_adapter.cpp index b3db89e1da..1a0e7a8e6d 100644 --- a/eeschema/symbol_tree_synchronizing_adapter.cpp +++ b/eeschema/symbol_tree_synchronizing_adapter.cpp @@ -24,21 +24,21 @@ */ #include -#include +#include #include #include #include -LIB_TREE_MODEL_ADAPTER::PTR SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Create( LIB_EDIT_FRAME* aParent, - LIB_MANAGER* aLibMgr ) +LIB_TREE_MODEL_ADAPTER::PTR SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Create( SYMBOL_EDIT_FRAME* aParent, + SYMBOL_LIBRARY_MANAGER* aLibMgr ) { return PTR( new SYMBOL_TREE_SYNCHRONIZING_ADAPTER( aParent, aLibMgr ) ); } -SYMBOL_TREE_SYNCHRONIZING_ADAPTER::SYMBOL_TREE_SYNCHRONIZING_ADAPTER( LIB_EDIT_FRAME* aParent, - LIB_MANAGER* aLibMgr ) : +SYMBOL_TREE_SYNCHRONIZING_ADAPTER::SYMBOL_TREE_SYNCHRONIZING_ADAPTER( SYMBOL_EDIT_FRAME* aParent, + SYMBOL_LIBRARY_MANAGER* aLibMgr ) : LIB_TREE_MODEL_ADAPTER( aParent, "pinned_symbol_libs" ), m_frame( aParent ), m_libMgr( aLibMgr ), @@ -86,7 +86,7 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync( bool aForce, nextUpdate = wxGetUTCTimeMillis() + PROGRESS_INTERVAL_MILLIS; } - // There is a bug in LIB_MANAGER::LibraryExists() that uses the buffered modified + // There is a bug in SYMBOL_LIBRARY_MANAGER::LibraryExists() that uses the buffered modified // libraries before the symbol library table which prevents the library from being // removed from the tree control. if( !m_libMgr->LibraryExists( name, true ) diff --git a/eeschema/symbol_tree_synchronizing_adapter.h b/eeschema/symbol_tree_synchronizing_adapter.h index 6e0563f1a4..576e423140 100644 --- a/eeschema/symbol_tree_synchronizing_adapter.h +++ b/eeschema/symbol_tree_synchronizing_adapter.h @@ -28,13 +28,13 @@ #include #include -class LIB_EDIT_FRAME; -class LIB_MANAGER; +class SYMBOL_EDIT_FRAME; +class SYMBOL_LIBRARY_MANAGER; class SYMBOL_TREE_SYNCHRONIZING_ADAPTER : public LIB_TREE_MODEL_ADAPTER { public: - static PTR Create( LIB_EDIT_FRAME* aParent, LIB_MANAGER* aLibs ); + static PTR Create( SYMBOL_EDIT_FRAME* aParent, SYMBOL_LIBRARY_MANAGER* aLibs ); bool IsContainer( const wxDataViewItem& aItem ) const override; @@ -55,16 +55,16 @@ protected: bool GetAttr( wxDataViewItem const& aItem, unsigned int aCol, wxDataViewItemAttr& aAttr ) const override; - SYMBOL_TREE_SYNCHRONIZING_ADAPTER( LIB_EDIT_FRAME* aParent, LIB_MANAGER* aLibMgr ); + SYMBOL_TREE_SYNCHRONIZING_ADAPTER( SYMBOL_EDIT_FRAME* aParent, SYMBOL_LIBRARY_MANAGER* aLibMgr ); protected: - LIB_EDIT_FRAME* m_frame; - LIB_MANAGER* m_libMgr; + SYMBOL_EDIT_FRAME* m_frame; + SYMBOL_LIBRARY_MANAGER* m_libMgr; ///> Hashes to decide whether a library needs an update std::map m_libHashes; - ///> LIB_MANAGER hash value returned in the last synchronization + ///> SYMBOL_LIBRARY_MANAGER hash value returned in the last synchronization int m_lastSyncHash; }; diff --git a/eeschema/tools/ee_inspection_tool.cpp b/eeschema/tools/ee_inspection_tool.cpp index d578508eeb..1696604f12 100644 --- a/eeschema/tools/ee_inspection_tool.cpp +++ b/eeschema/tools/ee_inspection_tool.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include @@ -69,9 +69,9 @@ bool EE_INSPECTION_TOOL::Init() int EE_INSPECTION_TOOL::RunERC( const TOOL_EVENT& aEvent ) { - if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) ) + if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) { - checkPart( static_cast( m_frame )->GetCurPart() ); + checkPart( static_cast( m_frame )->GetCurPart() ); } else if( m_frame->IsType( FRAME_SCH ) ) { @@ -310,9 +310,9 @@ int EE_INSPECTION_TOOL::ShowDatasheet( const TOOL_EVENT& aEvent ) { wxString datasheet; - if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) ) + if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) { - LIB_PART* part = static_cast( m_frame )->GetCurPart(); + LIB_PART* part = static_cast( m_frame )->GetCurPart(); if( !part ) return 0; diff --git a/eeschema/tools/ee_point_editor.cpp b/eeschema/tools/ee_point_editor.cpp index 803db95267..4855313cbb 100644 --- a/eeschema/tools/ee_point_editor.cpp +++ b/eeschema/tools/ee_point_editor.cpp @@ -36,7 +36,7 @@ using namespace std::placeholders; #include #include #include -#include +#include #include #include #include @@ -866,7 +866,7 @@ int EE_POINT_EDITOR::modifiedSelection( const TOOL_EVENT& aEvent ) void EE_POINT_EDITOR::saveItemsToUndo() { - if( m_isLibEdit ) + if( m_isSymbolEditor ) { saveCopyInUndoList( m_editPoints->GetParent()->GetParent(), UNDO_REDO::LIBEDIT ); } @@ -892,8 +892,8 @@ void EE_POINT_EDITOR::saveItemsToUndo() void EE_POINT_EDITOR::rollbackFromUndo() { - if( m_isLibEdit ) - static_cast( m_frame )->RollbackPartFromUndo(); + if( m_isSymbolEditor ) + static_cast( m_frame )->RollbackPartFromUndo(); else static_cast( m_frame )->RollbackSchematicFromUndo(); } diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index f93b6d8fc5..fd56c09da9 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -29,7 +29,7 @@ #include #include #include // For MAX_SELECT_ITEM_IDS -#include +#include #include #include #include @@ -52,7 +52,6 @@ #include #include #include -#include SELECTION_CONDITION EE_CONDITIONS::SingleSymbol = [] (const SELECTION& aSel ) @@ -108,7 +107,7 @@ EE_SELECTION_TOOL::EE_SELECTION_TOOL() : m_exclusive_or( false ), m_multiple( false ), m_skip_heuristics( false ), - m_isLibEdit( false ), + m_isSymbolEditor( false ), m_isLibView( false ), m_unit( 0 ), m_convert( 0 ) @@ -130,18 +129,19 @@ bool EE_SELECTION_TOOL::Init() { m_frame = getEditFrame(); - LIB_VIEW_FRAME* libViewFrame = dynamic_cast( m_frame ); - LIB_EDIT_FRAME* libEditFrame = dynamic_cast( m_frame ); + LIB_VIEW_FRAME* libViewFrame = dynamic_cast( m_frame ); + SYMBOL_EDIT_FRAME* symbolEditorFrame = dynamic_cast( m_frame ); - if( libEditFrame ) + if( symbolEditorFrame ) { - m_isLibEdit = true; - m_unit = libEditFrame->GetUnit(); - m_convert = libEditFrame->GetConvert(); + m_isSymbolEditor = true; + m_unit = symbolEditorFrame->GetUnit(); + m_convert = symbolEditorFrame->GetConvert(); } else + { m_isLibView = libViewFrame != nullptr; - + } static KICAD_T wireOrBusTypes[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T, EOT }; static KICAD_T connectedTypes[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T, @@ -157,8 +157,7 @@ bool EE_SELECTION_TOOL::Init() auto schEditCondition = [this] ( const SELECTION& aSel ) { - - return !m_isLibEdit && !m_isLibView; + return !m_isSymbolEditor && !m_isLibView; }; auto belowRootSheetCondition = @@ -174,7 +173,7 @@ bool EE_SELECTION_TOOL::Init() auto havePartCondition = [&]( const SELECTION& sel ) { - return m_isLibEdit && static_cast( m_frame )->GetCurPart(); + return m_isSymbolEditor && static_cast( m_frame )->GetCurPart(); }; auto& menu = m_menu.GetMenu(); @@ -227,12 +226,12 @@ void EE_SELECTION_TOOL::Reset( RESET_REASON aReason ) m_selection.Clear(); getView()->GetPainter()->GetSettings()->SetHighlight( false ); - LIB_EDIT_FRAME* libEditFrame = dynamic_cast( m_frame ); - LIB_VIEW_FRAME* libViewFrame = dynamic_cast( m_frame ); + SYMBOL_EDIT_FRAME* libEditFrame = dynamic_cast( m_frame ); + LIB_VIEW_FRAME* libViewFrame = dynamic_cast( m_frame ); if( libEditFrame ) { - m_isLibEdit = true; + m_isSymbolEditor = true; m_unit = libEditFrame->GetUnit(); m_convert = libEditFrame->GetConvert(); } @@ -341,7 +340,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) { narrowSelection( collector, evt->Position(), false ); - if( collector.GetCount() == 1 && !m_isLibEdit && !modifier_enabled ) + if( collector.GetCount() == 1 && !m_isSymbolEditor && !modifier_enabled ) { // Check if we want to auto start wires VECTOR2I snappedCursorPos = grid.BestSnapAnchor( evt->Position(), nullptr ); @@ -441,7 +440,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) { // selection is empty? try to start dragging the item under the point where drag // started - if( m_isLibEdit && m_selection.Empty() ) + if( m_isSymbolEditor && m_selection.Empty() ) m_selection = RequestSelection( movableSymbolItems ); else if( m_selection.Empty() ) m_selection = RequestSelection( movableSchematicItems ); @@ -450,7 +449,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) if( selectionContains( evt->Position() ) ) { // Yes -> run the move tool and wait till it finishes - if( m_isLibEdit ) + if( m_isSymbolEditor ) m_toolMgr->InvokeTool( "eeschema.SymbolMoveTool" ); else m_toolMgr->InvokeTool( "eeschema.InteractiveMove" ); @@ -500,7 +499,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) ClearSelection(); } - else if( evt->IsMotion() && !m_isLibEdit && m_frame->ToolStackIsEmpty() ) + else if( evt->IsMotion() && !m_isSymbolEditor && m_frame->ToolStackIsEmpty() ) { EE_COLLECTOR collector; @@ -594,9 +593,9 @@ bool EE_SELECTION_TOOL::collectHits( EE_COLLECTOR& aCollector, const VECTOR2I& a { aCollector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) ); - if( m_isLibEdit ) + if( m_isSymbolEditor ) { - auto part = static_cast( m_frame )->GetCurPart(); + LIB_PART* part = static_cast( m_frame )->GetCurPart(); if( !part ) return false; @@ -845,11 +844,15 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const EE_GRID_HELPER grid( m_toolMgr ); wxPoint cursorPos = wxPoint( grid.BestSnapAnchor( aPos, nullptr ) ); - if( !m_isLibEdit && m_frame->eeconfig()->m_Selection.select_pin_selects_symbol - && !other->IsPointClickableAnchor( cursorPos ) ) + if( !m_isSymbolEditor && m_frame->eeconfig()->m_Selection.select_pin_selects_symbol + && !other->IsPointClickableAnchor( cursorPos ) ) + { collector.Transfer( other ); + } else + { collector.Transfer( item ); + } } } @@ -960,7 +963,7 @@ void EE_SELECTION_TOOL::updateReferencePoint() if( m_selection.Size() > 0 ) { - if( m_isLibEdit ) + if( m_isSymbolEditor ) refP = static_cast( m_selection.GetTopLeftItem() )->GetPosition(); else refP = static_cast( m_selection.GetTopLeftItem() )->GetPosition(); @@ -1287,9 +1290,9 @@ void EE_SELECTION_TOOL::RebuildSelection() { m_selection.Clear(); - if( m_isLibEdit ) + if( m_isSymbolEditor ) { - LIB_PART* start = static_cast( m_frame )->GetCurPart(); + LIB_PART* start = static_cast( m_frame )->GetCurPart(); for( LIB_ITEM& item : start->GetDrawItems() ) { @@ -1500,7 +1503,7 @@ bool EE_SELECTION_TOOL::doSelectionMenu( EE_COLLECTOR* aCollector ) bool EE_SELECTION_TOOL::Selectable( const EDA_ITEM* aItem, bool checkVisibilityOnly ) const { // NOTE: in the future this is where Eeschema layer/itemtype visibility will be handled - LIB_EDIT_FRAME* symbeditFrame = dynamic_cast< LIB_EDIT_FRAME* >( m_frame ); + SYMBOL_EDIT_FRAME* symbeditFrame = dynamic_cast< SYMBOL_EDIT_FRAME* >( m_frame ); switch( aItem->Type() ) { @@ -1509,7 +1512,7 @@ bool EE_SELECTION_TOOL::Selectable( const EDA_ITEM* aItem, bool checkVisibilityO return false; break; - case LIB_PART_T: // In libedit we do not want to select the symbol itself. + case LIB_PART_T: // In symbol_editor we do not want to select the symbol itself. return false; case LIB_FIELD_T: // LIB_FIELD object can always be edited. diff --git a/eeschema/tools/ee_selection_tool.h b/eeschema/tools/ee_selection_tool.h index ed4d627462..b063dda2b1 100644 --- a/eeschema/tools/ee_selection_tool.h +++ b/eeschema/tools/ee_selection_tool.h @@ -286,7 +286,7 @@ private: bool m_multiple; // Multiple selection mode is active bool m_skip_heuristics; // Heuristics are not allowed when choosing item under cursor - bool m_isLibEdit; // True when libedit is the parent frame + bool m_isSymbolEditor; // True when the symbol editor is the parent frame bool m_isLibView; // True when libview is the parent frame int m_unit; // Fixed unit filter (for symbol editor) int m_convert; // Fixed DeMorgan filter (for symbol editor) diff --git a/eeschema/tools/ee_tool_base.h b/eeschema/tools/ee_tool_base.h index 9b584aaefb..3892adeab9 100644 --- a/eeschema/tools/ee_tool_base.h +++ b/eeschema/tools/ee_tool_base.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include @@ -56,11 +56,11 @@ public: * Creates a tool with given name. The name must be unique. */ EE_TOOL_BASE( const std::string& aName ) : - TOOL_INTERACTIVE ( aName ), - m_frame( nullptr ), - m_view( nullptr ), - m_selectionTool( nullptr ), - m_isLibEdit( false ) + TOOL_INTERACTIVE ( aName ), + m_frame( nullptr ), + m_view( nullptr ), + m_selectionTool( nullptr ), + m_isSymbolEditor( false ) {}; ~EE_TOOL_BASE() override {}; @@ -70,7 +70,7 @@ public: { m_frame = getEditFrame(); m_selectionTool = m_toolMgr->GetTool(); - m_isLibEdit = m_frame->IsType( FRAME_SCH_LIB_EDITOR ); + m_isSymbolEditor = m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ); // A basic context manu. Many (but not all) tools will choose to override this. @@ -93,7 +93,7 @@ public: { // Init variables used by every drawing tool m_frame = getEditFrame(); - m_isLibEdit = dynamic_cast( m_frame ) != nullptr; + m_isSymbolEditor = dynamic_cast( m_frame ) != nullptr; } m_view = static_cast( getView() ); @@ -145,9 +145,9 @@ protected: if( selected && aItem->HasFlag( TEMP_SELECTED ) ) aItem->ClearSelected(); - if( m_isLibEdit ) + if( m_isSymbolEditor ) { - LIB_EDIT_FRAME* editFrame = dynamic_cast( m_frame ); + SYMBOL_EDIT_FRAME* editFrame = dynamic_cast( m_frame ); wxASSERT( editFrame ); editFrame->SaveCopyInUndoList( static_cast( aItem ), aType, aAppend ); @@ -179,7 +179,7 @@ protected: T* m_frame; KIGFX::SCH_VIEW* m_view; EE_SELECTION_TOOL* m_selectionTool; - bool m_isLibEdit; + bool m_isSymbolEditor; }; #endif diff --git a/eeschema/tools/lib_control.cpp b/eeschema/tools/lib_control.cpp index 4ccf371f68..1120462ebe 100644 --- a/eeschema/tools/lib_control.cpp +++ b/eeschema/tools/lib_control.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -39,12 +39,12 @@ bool LIB_CONTROL::Init() { m_frame = getEditFrame(); m_selectionTool = m_toolMgr->GetTool(); - m_isLibEdit = m_frame->IsType( FRAME_SCH_LIB_EDITOR ); + m_isSymbolEditor = m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ); - if( m_isLibEdit ) + if( m_isSymbolEditor ) { CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu(); - LIB_EDIT_FRAME* editFrame = getEditFrame(); + SYMBOL_EDIT_FRAME* editFrame = getEditFrame(); auto libSelectedCondition = [ editFrame ] ( const SELECTION& aSel ) { LIB_ID sel = editFrame->GetTreeLIBID(); @@ -100,8 +100,8 @@ int LIB_CONTROL::AddLibrary( const TOOL_EVENT& aEvent ) { bool createNew = aEvent.IsAction( &ACTIONS::newLibrary ); - if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) ) - static_cast( m_frame )->AddLibraryFile( createNew ); + if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) + static_cast( m_frame )->AddLibraryFile( createNew ); return 0; } @@ -109,11 +109,11 @@ int LIB_CONTROL::AddLibrary( const TOOL_EVENT& aEvent ) int LIB_CONTROL::EditSymbol( const TOOL_EVENT& aEvent ) { - if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) ) + if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) { - LIB_EDIT_FRAME* editFrame = static_cast( m_frame ); - int unit = 0; - LIB_ID partId = editFrame->GetTreeLIBID( &unit ); + SYMBOL_EDIT_FRAME* editFrame = static_cast( m_frame ); + int unit = 0; + LIB_ID partId = editFrame->GetTreeLIBID( &unit ); editFrame->LoadPart( partId.GetLibItemName(), partId.GetLibNickname(), unit ); } @@ -124,9 +124,9 @@ int LIB_CONTROL::EditSymbol( const TOOL_EVENT& aEvent ) int LIB_CONTROL::AddSymbol( const TOOL_EVENT& aEvent ) { - if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) ) + if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) { - LIB_EDIT_FRAME* editFrame = static_cast( m_frame ); + SYMBOL_EDIT_FRAME* editFrame = static_cast( m_frame ); if( aEvent.IsAction( &EE_ACTIONS::newSymbol ) ) editFrame->CreateNewPart(); @@ -140,9 +140,9 @@ int LIB_CONTROL::AddSymbol( const TOOL_EVENT& aEvent ) int LIB_CONTROL::Save( const TOOL_EVENT& aEvt ) { - if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) ) + if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) { - LIB_EDIT_FRAME* editFrame = static_cast( m_frame ); + SYMBOL_EDIT_FRAME* editFrame = static_cast( m_frame ); if( aEvt.IsAction( &EE_ACTIONS::save ) ) editFrame->Save(); @@ -158,8 +158,8 @@ int LIB_CONTROL::Save( const TOOL_EVENT& aEvt ) int LIB_CONTROL::Revert( const TOOL_EVENT& aEvent ) { - if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) ) - static_cast( m_frame )->Revert(); + if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) + static_cast( m_frame )->Revert(); return 0; } @@ -167,8 +167,8 @@ int LIB_CONTROL::Revert( const TOOL_EVENT& aEvent ) int LIB_CONTROL::ExportSymbol( const TOOL_EVENT& aEvent ) { - if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) ) - static_cast( m_frame )->ExportPart(); + if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) + static_cast( m_frame )->ExportPart(); return 0; } @@ -176,9 +176,9 @@ int LIB_CONTROL::ExportSymbol( const TOOL_EVENT& aEvent ) int LIB_CONTROL::CutCopyDelete( const TOOL_EVENT& aEvt ) { - if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) ) + if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) { - LIB_EDIT_FRAME* editFrame = static_cast( m_frame ); + SYMBOL_EDIT_FRAME* editFrame = static_cast( m_frame ); if( aEvt.IsAction( &EE_ACTIONS::cutSymbol ) || aEvt.IsAction( &EE_ACTIONS::copySymbol ) ) editFrame->CopyPartToClipboard(); @@ -193,9 +193,9 @@ int LIB_CONTROL::CutCopyDelete( const TOOL_EVENT& aEvt ) int LIB_CONTROL::DuplicateSymbol( const TOOL_EVENT& aEvent ) { - if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) ) + if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) { - LIB_EDIT_FRAME* editFrame = static_cast( m_frame ); + SYMBOL_EDIT_FRAME* editFrame = static_cast( m_frame ); editFrame->DuplicatePart( aEvent.IsAction( &EE_ACTIONS::pasteSymbol ) ); } @@ -208,12 +208,12 @@ int LIB_CONTROL::OnDeMorgan( const TOOL_EVENT& aEvent ) int convert = aEvent.IsAction( &EE_ACTIONS::showDeMorganStandard ) ? LIB_ITEM::LIB_CONVERT::BASE : LIB_ITEM::LIB_CONVERT::DEMORGAN; - if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) ) + if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) { m_toolMgr->RunAction( ACTIONS::cancelInteractive, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); - LIB_EDIT_FRAME* libEditFrame = static_cast( m_frame ); + SYMBOL_EDIT_FRAME* libEditFrame = static_cast( m_frame ); libEditFrame->SetConvert( convert ); m_toolMgr->ResetTools( TOOL_BASE::MODEL_RELOAD ); @@ -231,9 +231,9 @@ int LIB_CONTROL::OnDeMorgan( const TOOL_EVENT& aEvent ) int LIB_CONTROL::PinLibrary( const TOOL_EVENT& aEvent ) { - if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) ) + if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) { - LIB_EDIT_FRAME* editFrame = static_cast( m_frame ); + SYMBOL_EDIT_FRAME* editFrame = static_cast( m_frame ); LIB_TREE_NODE* currentNode = editFrame->GetCurrentTreeNode(); if( currentNode && !currentNode->m_Pinned ) @@ -249,9 +249,9 @@ int LIB_CONTROL::PinLibrary( const TOOL_EVENT& aEvent ) int LIB_CONTROL::UnpinLibrary( const TOOL_EVENT& aEvent ) { - if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) ) + if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) { - LIB_EDIT_FRAME* editFrame = static_cast( m_frame ); + SYMBOL_EDIT_FRAME* editFrame = static_cast( m_frame ); LIB_TREE_NODE* currentNode = editFrame->GetCurrentTreeNode(); if( currentNode && currentNode->m_Pinned ) @@ -267,10 +267,10 @@ int LIB_CONTROL::UnpinLibrary( const TOOL_EVENT& aEvent ) int LIB_CONTROL::ShowComponentTree( const TOOL_EVENT& aEvent ) { - if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) ) + if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) { wxCommandEvent dummy; - static_cast( m_frame )->OnToggleSearchTree( dummy ); + static_cast( m_frame )->OnToggleSearchTree( dummy ); } return 0; @@ -292,10 +292,10 @@ int LIB_CONTROL::ShowElectricalTypes( const TOOL_EVENT& aEvent ) int LIB_CONTROL::ToggleSyncedPinsMode( const TOOL_EVENT& aEvent ) { - if( !m_isLibEdit ) + if( !m_isSymbolEditor ) return 0; - LIB_EDIT_FRAME* editFrame = getEditFrame(); + SYMBOL_EDIT_FRAME* editFrame = getEditFrame(); editFrame->m_SyncPinEdit = !editFrame->m_SyncPinEdit; return 0; @@ -304,11 +304,11 @@ int LIB_CONTROL::ToggleSyncedPinsMode( const TOOL_EVENT& aEvent ) int LIB_CONTROL::ExportView( const TOOL_EVENT& aEvent ) { - if( !m_isLibEdit ) + if( !m_isSymbolEditor ) return 0; - LIB_EDIT_FRAME* editFrame = getEditFrame(); - LIB_PART* part = editFrame->GetCurPart(); + SYMBOL_EDIT_FRAME* editFrame = getEditFrame(); + LIB_PART* part = editFrame->GetCurPart(); if( !part ) { @@ -344,11 +344,11 @@ int LIB_CONTROL::ExportView( const TOOL_EVENT& aEvent ) int LIB_CONTROL::ExportSymbolAsSVG( const TOOL_EVENT& aEvent ) { - if( !m_isLibEdit ) + if( !m_isSymbolEditor ) return 0; - LIB_EDIT_FRAME* editFrame = getEditFrame(); - LIB_PART* part = editFrame->GetCurPart(); + SYMBOL_EDIT_FRAME* editFrame = getEditFrame(); + LIB_PART* part = editFrame->GetCurPart(); if( !part ) { @@ -393,9 +393,9 @@ int LIB_CONTROL::AddSymbolToSchematic( const TOOL_EVENT& aEvent ) LIB_ID libId; int unit, convert; - if( m_isLibEdit ) + if( m_isSymbolEditor ) { - LIB_EDIT_FRAME* editFrame = getEditFrame(); + SYMBOL_EDIT_FRAME* editFrame = getEditFrame(); part = editFrame->GetCurPart(); unit = editFrame->GetUnit(); @@ -456,9 +456,9 @@ int LIB_CONTROL::AddSymbolToSchematic( const TOOL_EVENT& aEvent ) int LIB_CONTROL::UpdateSymbolInSchematic( const TOOL_EVENT& aEvent ) { - wxCHECK( m_isLibEdit, 0 ); + wxCHECK( m_isSymbolEditor, 0 ); - LIB_EDIT_FRAME* editFrame = getEditFrame(); + SYMBOL_EDIT_FRAME* editFrame = getEditFrame(); wxCHECK( editFrame, 0 ); diff --git a/eeschema/tools/lib_control.h b/eeschema/tools/lib_control.h index dfcf576e0f..7118236934 100644 --- a/eeschema/tools/lib_control.h +++ b/eeschema/tools/lib_control.h @@ -29,7 +29,7 @@ #include #include -class LIB_EDIT_FRAME; +class SYMBOL_EDIT_FRAME; /** * Handle actions for the various symbol editor and viewers. diff --git a/eeschema/tools/lib_drawing_tools.cpp b/eeschema/tools/lib_drawing_tools.cpp index fccec4c008..543541e65b 100644 --- a/eeschema/tools/lib_drawing_tools.cpp +++ b/eeschema/tools/lib_drawing_tools.cpp @@ -23,7 +23,7 @@ */ #include -#include +#include #include #include #include @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include "ee_point_editor.h" @@ -46,7 +46,7 @@ static void* g_lastPinWeakPtr; LIB_DRAWING_TOOLS::LIB_DRAWING_TOOLS() : - EE_TOOL_BASE( "eeschema.SymbolDrawing" ), + EE_TOOL_BASE( "eeschema.SymbolDrawing" ), m_lastTextAngle( 0.0 ), m_lastFillStyle( FILL_TYPE::NO_FILL ), m_drawSpecificConvert( true ), @@ -72,12 +72,12 @@ bool LIB_DRAWING_TOOLS::Init() int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent ) { - KICAD_T type = aEvent.Parameter(); - LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings(); - LIB_PIN_TOOL* pinTool = type == LIB_PIN_T ? m_toolMgr->GetTool() : nullptr; - VECTOR2I cursorPos; - EDA_ITEM* item = nullptr; - bool isText = aEvent.IsAction( &EE_ACTIONS::placeSymbolText ); + KICAD_T type = aEvent.Parameter(); + auto* settings = Pgm().GetSettingsManager().GetAppSettings(); + LIB_PIN_TOOL* pinTool = type == LIB_PIN_T ? m_toolMgr->GetTool() : nullptr; + VECTOR2I cursorPos; + EDA_ITEM* item = nullptr; + bool isText = aEvent.IsAction( &EE_ACTIONS::placeSymbolText ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); getViewControls()->ShowCursor( true ); @@ -257,7 +257,7 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent ) int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) { - LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings(); + SYMBOL_EDITOR_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings(); KICAD_T type = aEvent.Parameter(); // We might be running as the same shape in another co-routine. Make sure that one diff --git a/eeschema/tools/lib_drawing_tools.h b/eeschema/tools/lib_drawing_tools.h index bd04f96509..ef94a729ae 100644 --- a/eeschema/tools/lib_drawing_tools.h +++ b/eeschema/tools/lib_drawing_tools.h @@ -28,7 +28,7 @@ #include -class LIB_EDIT_FRAME; +class SYMBOL_EDIT_FRAME; /** @@ -37,7 +37,7 @@ class LIB_EDIT_FRAME; * Tool responsible for drawing/placing items (body outlines, pins, etc.) */ -class LIB_DRAWING_TOOLS : public EE_TOOL_BASE +class LIB_DRAWING_TOOLS : public EE_TOOL_BASE { public: LIB_DRAWING_TOOLS(); diff --git a/eeschema/tools/lib_edit_tool.cpp b/eeschema/tools/lib_edit_tool.cpp index 7f16e2ff30..985f02d9c5 100644 --- a/eeschema/tools/lib_edit_tool.cpp +++ b/eeschema/tools/lib_edit_tool.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include @@ -63,7 +63,7 @@ bool LIB_EDIT_TOOL::Init() auto havePartCondition = [&]( const SELECTION& sel ) { - return m_isLibEdit && static_cast( m_frame )->GetCurPart(); + return m_isSymbolEditor && static_cast( m_frame )->GetCurPart(); }; // Add edit actions to the move tool menu diff --git a/eeschema/tools/lib_edit_tool.h b/eeschema/tools/lib_edit_tool.h index 91f571c378..ea3b626cab 100644 --- a/eeschema/tools/lib_edit_tool.h +++ b/eeschema/tools/lib_edit_tool.h @@ -28,10 +28,10 @@ #include -class LIB_EDIT_FRAME; +class SYMBOL_EDIT_FRAME; -class LIB_EDIT_TOOL : public EE_TOOL_BASE +class LIB_EDIT_TOOL : public EE_TOOL_BASE { public: LIB_EDIT_TOOL(); diff --git a/eeschema/tools/lib_move_tool.cpp b/eeschema/tools/lib_move_tool.cpp index ef06e6d079..49fa9cfa2d 100644 --- a/eeschema/tools/lib_move_tool.cpp +++ b/eeschema/tools/lib_move_tool.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include "lib_move_tool.h" #include "lib_pin_tool.h" diff --git a/eeschema/tools/lib_move_tool.h b/eeschema/tools/lib_move_tool.h index 1dbe4818c8..acf7969348 100644 --- a/eeschema/tools/lib_move_tool.h +++ b/eeschema/tools/lib_move_tool.h @@ -26,13 +26,13 @@ #define KICAD_LIB_MOVE_TOOL_H #include -#include +#include -class LIB_EDIT_FRAME; +class SYMBOL_EDIT_FRAME; class EE_SELECTION_TOOL; -class LIB_MOVE_TOOL : public EE_TOOL_BASE +class LIB_MOVE_TOOL : public EE_TOOL_BASE { public: LIB_MOVE_TOOL(); diff --git a/eeschema/tools/lib_pin_tool.cpp b/eeschema/tools/lib_pin_tool.cpp index 1b3ff2b23d..88dac8ec72 100644 --- a/eeschema/tools/lib_pin_tool.cpp +++ b/eeschema/tools/lib_pin_tool.cpp @@ -24,12 +24,12 @@ #include #include -#include +#include #include #include #include #include -#include +#include #include #include "lib_pin_tool.h" @@ -50,7 +50,7 @@ static int GetLastPinLength() { if( g_LastPinLength == -1 ) { - LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings(); + auto* settings = Pgm().GetSettingsManager().GetAppSettings(); g_LastPinLength = Mils2iu( settings->m_Defaults.pin_length ); } @@ -61,7 +61,7 @@ static int GetLastPinNameSize() { if( g_LastPinNameSize == -1 ) { - LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings(); + auto* settings = Pgm().GetSettingsManager().GetAppSettings(); g_LastPinNameSize = Mils2iu( settings->m_Defaults.pin_name_size ); } @@ -72,7 +72,7 @@ static int GetLastPinNumSize() { if( g_LastPinNumSize == -1 ) { - LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings(); + auto* settings = Pgm().GetSettingsManager().GetAppSettings(); g_LastPinNumSize = Mils2iu( settings->m_Defaults.pin_num_size ); } @@ -84,7 +84,7 @@ extern void IncrementLabelMember( wxString& name, int aIncrement ); LIB_PIN_TOOL::LIB_PIN_TOOL() : - EE_TOOL_BASE( "eeschema.PinEditing" ) + EE_TOOL_BASE( "eeschema.PinEditing" ) { } @@ -380,7 +380,7 @@ LIB_PIN* LIB_PIN_TOOL::RepeatPin( const LIB_PIN* aSourcePin ) pin->ClearFlags(); pin->SetFlags( IS_NEW ); - LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings(); + auto* settings = Pgm().GetSettingsManager().GetAppSettings(); switch( pin->GetOrientation() ) { diff --git a/eeschema/tools/lib_pin_tool.h b/eeschema/tools/lib_pin_tool.h index 4cbfc02aaa..0a94c3a226 100644 --- a/eeschema/tools/lib_pin_tool.h +++ b/eeschema/tools/lib_pin_tool.h @@ -29,10 +29,10 @@ #include -class LIB_EDIT_FRAME; +class SYMBOL_EDIT_FRAME; -class LIB_PIN_TOOL : public EE_TOOL_BASE +class LIB_PIN_TOOL : public EE_TOOL_BASE { public: LIB_PIN_TOOL(); diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 670bf4d029..968fd74265 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -63,7 +63,7 @@ #include // for KiROUND #include #include -#include +#include #include class SYMBOL_UNIT_MENU : public ACTION_MENU @@ -939,9 +939,9 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent ) } else { - if( m_isLibEdit ) + if( m_isSymbolEditor ) { - LIBEDIT_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings(); + auto* cfg = Pgm().GetSettingsManager().GetAppSettings(); if( dynamic_cast( newItem ) ) { @@ -1411,7 +1411,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent ) } else if( retval == SYMBOL_PROPS_EDIT_SCHEMATIC_SYMBOL ) { - auto editor = (LIB_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_LIB_EDITOR, true ); + auto editor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, true ); editor->LoadSymbolFromSchematic( component->GetPartRef(), component->GetRef( &m_frame->GetCurrentSheet() ), @@ -1422,7 +1422,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent ) } else if( retval == SYMBOL_PROPS_EDIT_LIBRARY_SYMBOL ) { - auto editor = (LIB_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_LIB_EDITOR, true ); + auto editor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, true ); editor->LoadComponentAndSelectLib( component->GetLibId(), component->GetUnit(), component->GetConvert() ); diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index b22f4bef93..70f9b4353b 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -1591,7 +1591,7 @@ int SCH_EDITOR_CONTROL::EditWithLibEdit( const TOOL_EVENT& aEvent ) EE_SELECTION& selection = selTool->RequestSelection( EE_COLLECTOR::ComponentsOnly ); SCH_SHEET_PATH& currentSheet = m_frame->GetCurrentSheet(); SCH_COMPONENT* sym = nullptr; - LIB_EDIT_FRAME* libEdit; + SYMBOL_EDIT_FRAME* symbolEditor; if( selection.GetSize() >= 1 ) sym = (SCH_COMPONENT*) selection.Front(); @@ -1600,11 +1600,13 @@ int SCH_EDITOR_CONTROL::EditWithLibEdit( const TOOL_EVENT& aEvent ) return 0; m_toolMgr->RunAction( ACTIONS::showSymbolEditor, true ); - libEdit = (LIB_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_LIB_EDITOR, false ); + symbolEditor = (SYMBOL_EDIT_FRAME*) m_frame->Kiway().Player( FRAME_SCH_SYMBOL_EDITOR, false ); - if( libEdit ) - libEdit->LoadSymbolFromSchematic( sym->GetPartRef(), sym->GetRef( ¤tSheet ), - sym->GetUnit(), sym->GetConvert() ); + if( symbolEditor ) + { + symbolEditor->LoadSymbolFromSchematic( sym->GetPartRef(), sym->GetRef( ¤tSheet ), + sym->GetUnit(), sym->GetConvert() ); + } return 0; } diff --git a/eeschema/widgets/symbol_tree_pane.cpp b/eeschema/widgets/symbol_tree_pane.cpp index 2b4c574ee4..31487dba2e 100644 --- a/eeschema/widgets/symbol_tree_pane.cpp +++ b/eeschema/widgets/symbol_tree_pane.cpp @@ -24,13 +24,13 @@ #include "symbol_tree_pane.h" #include -#include -#include +#include +#include #include #include #include -SYMBOL_TREE_PANE::SYMBOL_TREE_PANE( LIB_EDIT_FRAME* aParent, LIB_MANAGER* aLibMgr ) +SYMBOL_TREE_PANE::SYMBOL_TREE_PANE( SYMBOL_EDIT_FRAME* aParent, SYMBOL_LIBRARY_MANAGER* aLibMgr ) : wxPanel( aParent ), m_libEditFrame( aParent ), m_tree( nullptr ), diff --git a/eeschema/widgets/symbol_tree_pane.h b/eeschema/widgets/symbol_tree_pane.h index 806c408b2f..d66106e027 100644 --- a/eeschema/widgets/symbol_tree_pane.h +++ b/eeschema/widgets/symbol_tree_pane.h @@ -30,8 +30,8 @@ #include class LIB_TREE; -class LIB_EDIT_FRAME; -class LIB_MANAGER; +class SYMBOL_EDIT_FRAME; +class SYMBOL_LIBRARY_MANAGER; class wxBoxSizer; /** @@ -40,7 +40,7 @@ class wxBoxSizer; class SYMBOL_TREE_PANE : public wxPanel { public: - SYMBOL_TREE_PANE( LIB_EDIT_FRAME* aParent, LIB_MANAGER* aLibMgr ); + SYMBOL_TREE_PANE( SYMBOL_EDIT_FRAME* aParent, SYMBOL_LIBRARY_MANAGER* aLibMgr ); ~SYMBOL_TREE_PANE(); LIB_TREE* GetLibTree() const @@ -51,9 +51,9 @@ public: protected: void onComponentSelected( wxCommandEvent& aEvent ); - LIB_EDIT_FRAME* m_libEditFrame; - LIB_TREE* m_tree; ///< component search tree widget - LIB_MANAGER* m_libMgr; + SYMBOL_EDIT_FRAME* m_libEditFrame; + LIB_TREE* m_tree; ///< component search tree widget + SYMBOL_LIBRARY_MANAGER* m_libMgr; }; #endif /* CMP_TREE_PANE_H */ diff --git a/include/frame_type.h b/include/frame_type.h index d122b0f769..d488ec292a 100644 --- a/include/frame_type.h +++ b/include/frame_type.h @@ -34,7 +34,7 @@ enum FRAME_T { FRAME_SCH = 0, - FRAME_SCH_LIB_EDITOR, + FRAME_SCH_SYMBOL_EDITOR, FRAME_SCH_VIEWER, FRAME_SCH_VIEWER_MODAL, FRAME_SIMULATOR, diff --git a/include/undo_redo_container.h b/include/undo_redo_container.h index 2807f10280..34b1edac56 100644 --- a/include/undo_redo_container.h +++ b/include/undo_redo_container.h @@ -62,7 +62,7 @@ enum class UNDO_REDO { ROTATED, // Rotated item (counterclockwise), undo by rotating it ROTATED_CLOCKWISE, // Rotated item (clockwise), undo by rotating it FLIPPED, // flipped (board items only), undo by flipping it - LIBEDIT, // Specific to the component editor (libedit creates a full copy + LIBEDIT, // Specific to the component editor (symbol_editor creates a full copy // of the current component when changed) LIB_RENAME, // As LIBEDIT, but old copy should be removed from library EXCHANGE_T, // Use for changing the schematic text type where swapping diff --git a/kicad/tools/kicad_manager_actions.cpp b/kicad/tools/kicad_manager_actions.cpp index 96a5420c9a..0052665e14 100644 --- a/kicad/tools/kicad_manager_actions.cpp +++ b/kicad/tools/kicad_manager_actions.cpp @@ -69,7 +69,7 @@ TOOL_ACTION KICAD_MANAGER_ACTIONS::editSymbols( "kicad.Control.editSymbols", AS_GLOBAL, MD_CTRL + 'L', LEGACY_HK_NAME( "Run LibEdit" ), _( "Edit Schematic Symbols" ), _( "Edit Schematic Symbols" ), - libedit_xpm, AF_NONE, (void*) FRAME_SCH_LIB_EDITOR ); + libedit_xpm, AF_NONE, (void*) FRAME_SCH_SYMBOL_EDITOR ); TOOL_ACTION KICAD_MANAGER_ACTIONS::editPCB( "kicad.Control.editPCB", AS_GLOBAL, diff --git a/kicad/treeproject_item.cpp b/kicad/treeproject_item.cpp index 6f95bd6316..9b4eba643c 100644 --- a/kicad/treeproject_item.cpp +++ b/kicad/treeproject_item.cpp @@ -231,7 +231,7 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* aTreePrjFrame ) case TREE_FILE_TYPE::SEXPR_SYMBOL_LIB_FILE: toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editSymbols, true ); packet = fullFileName.ToStdString(); - kiway.ExpressMail( FRAME_SCH_LIB_EDITOR, MAIL_LIB_EDIT, packet ); + kiway.ExpressMail( FRAME_SCH_SYMBOL_EDITOR, MAIL_LIB_EDIT, packet ); break; default: diff --git a/pcbnew/footprint_edit_frame.h b/pcbnew/footprint_edit_frame.h index dde6c586de..53a5dc3b3e 100644 --- a/pcbnew/footprint_edit_frame.h +++ b/pcbnew/footprint_edit_frame.h @@ -29,7 +29,7 @@ class PCB_LAYER_BOX_SELECTOR; class FP_LIB_TABLE; class FOOTPRINT_TREE_PANE; -class LIB_MANAGER; +class SYMBOL_LIBRARY_MANAGER; class FOOTPRINT_EDITOR_SETTINGS; class PCBNEW_SELECTION;