LibEdit -> SymbolEditor

This commit is contained in:
Jeff Young 2020-10-31 01:27:16 +00:00
parent 0d8789935d
commit bddc97df30
72 changed files with 771 additions and 800 deletions

View File

@ -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 ) )

View File

@ -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:

View File

@ -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, "",

View File

@ -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;
}

View File

@ -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

View File

@ -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 );

View File

@ -28,10 +28,10 @@
#include <lib_item.h>
#include <class_libentry.h>
#include <dialog_lib_edit_draw_item.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
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 ),

View File

@ -27,7 +27,7 @@
class LIB_ITEM;
class LIB_EDIT_FRAME;
class SYMBOL_EDIT_FRAME;
#include <dialog_lib_edit_draw_item_base.h>
@ -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,7 +50,7 @@ public:
int GetFillStyle();
private:
LIB_EDIT_FRAME* m_frame;
SYMBOL_EDIT_FRAME* m_frame;
LIB_ITEM* m_item;
UNIT_BINDER m_lineWidth;
};

View File

@ -27,8 +27,8 @@
#include "pin_number.h"
#include <bitmaps.h>
#include <confirm.h>
#include <lib_edit_frame.h>
#include <libedit_settings.h>
#include <symbol_edit_frame.h>
#include <symbol_editor_settings.h>
#include <widgets/grid_icon_text_helpers.h>
#include <widgets/wx_grid.h>
#include <pgm_base.h>
@ -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<LIBEDIT_SETTINGS>();
auto* cfg = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
if( last->GetOrientation() == PIN_LEFT || last->GetOrientation() == PIN_RIGHT )
pos.y -= Mils2iu(cfg->m_Repeat.pin_step);

View File

@ -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;

View File

@ -22,16 +22,16 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <lib_text.h>
#include <settings/settings_manager.h>
#include <dialog_lib_edit_text.h>
#include <libedit/libedit_settings.h>
#include <symbol_editor/symbol_editor_settings.h>
#include <pgm_base.h>
#include <tools/lib_drawing_tools.h>
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<LIBEDIT_SETTINGS>();
auto* cfg = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
LIB_DRAWING_TOOLS* tools = m_parent->GetToolManager()->GetTool<LIB_DRAWING_TOOLS>();
m_textSize.SetValue( Mils2iu( cfg->m_Defaults.text_size ) );

View File

@ -29,14 +29,14 @@
#include <dialog_lib_edit_text_base.h>
#include <widgets/unit_binder.h>
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;
SYMBOL_EDIT_FRAME* m_parent;
LIB_TEXT* m_graphicText;
UNIT_BINDER m_posX;
@ -44,7 +44,7 @@ private:
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:

View File

@ -26,8 +26,8 @@
#include <confirm.h>
#include <dialog_text_entry.h>
#include <kiway.h>
#include <lib_edit_frame.h>
#include <lib_manager.h>
#include <symbol_edit_frame.h>
#include <symbol_library_manager.h>
#include <math/util.h> // for KiROUND
#include <pgm_base.h>
#include <sch_component.h>
@ -40,7 +40,7 @@
#include <dialog_lib_symbol_properties.h>
#include <settings/settings_manager.h>
#include <libedit_settings.h>
#include <symbol_editor_settings.h>
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<LIBEDIT_SETTINGS>();
auto cfg = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
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<LIBEDIT_SETTINGS>();
auto cfg = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
cfg->m_EditComponentVisibleColumns = m_grid->GetShownColumns();
// Prevents crash bug in wxGrid's d'tor
@ -452,7 +452,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnAddField( wxCommandEvent& event )
if( !m_grid->CommitPendingChanges() )
return;
LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
auto* settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
int fieldID = m_fields->size();
LIB_FIELD newField( m_libEntry, fieldID );

View File

@ -30,7 +30,7 @@
#include <dialog_lib_symbol_properties_base.h>
class LIB_EDIT_FRAME;
class SYMBOL_EDIT_FRAME;
class LIB_PART;
class WX_GRID;
@ -48,7 +48,7 @@ class DIALOG_LIB_SYMBOL_PROPERTIES: public DIALOG_LIB_SYMBOL_PROPERTIES_BASE
static LAST_LAYOUT m_lastLayout;
public:
LIB_EDIT_FRAME* m_Parent;
SYMBOL_EDIT_FRAME* m_Parent;
LIB_PART* m_libEntry;
FIELDS_GRID_TABLE<LIB_FIELD>* m_fields;
@ -67,7 +67,7 @@ public:
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:

View File

@ -24,7 +24,7 @@
#include <bitmaps.h>
#include <sch_painter.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <class_libentry.h>
#include <lib_pin.h>
#include <dialog_pin_properties.h>
@ -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 );

View File

@ -35,7 +35,7 @@
#include <dialog_pin_properties_base.h>
#include <widgets/unit_binder.h>
#include <lib_pin.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
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;

View File

@ -22,8 +22,8 @@
*/
#include <eeschema_settings.h>
#include <lib_edit_frame.h>
#include <libedit_settings.h>
#include <symbol_edit_frame.h>
#include <symbol_editor_settings.h>
#include <pgm_base.h>
#include <sch_painter.h>
#include <settings/settings_manager.h>
@ -32,7 +32,7 @@
#include "panel_sym_color_settings.h"
PANEL_SYM_COLOR_SETTINGS::PANEL_SYM_COLOR_SETTINGS( LIB_EDIT_FRAME* aFrame,
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<LIBEDIT_SETTINGS>();
auto cfg = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
m_useEeschemaTheme->SetValue( cfg->m_UseEeschemaColorSettings );
@ -82,7 +82,7 @@ bool PANEL_SYM_COLOR_SETTINGS::TransferDataFromWindow()
auto selected = static_cast<COLOR_SETTINGS*>(
m_themeSelection->GetClientData( m_themeSelection->GetSelection() ) );
LIBEDIT_SETTINGS* cfg = mgr.GetAppSettings<LIBEDIT_SETTINGS>();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
cfg->m_UseEeschemaColorSettings = m_useEeschemaTheme->GetValue();

View File

@ -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;

View File

@ -22,16 +22,17 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <sch_painter.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <libedit/libedit_settings.h>
#include <symbol_editor/symbol_editor_settings.h>
#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<LIBEDIT_SETTINGS>();
auto* settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
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<LIBEDIT_SETTINGS>();
auto* settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
settings->m_Defaults.line_width = Iu2Mils( (int) m_lineWidth.GetValue() );
settings->m_Defaults.text_size = Iu2Mils( (int) m_textSize.GetValue() );

View File

@ -23,12 +23,12 @@
#include <widgets/unit_binder.h>
#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;
@ -41,7 +41,7 @@ class PANEL_SYM_EDITING_OPTIONS : public PANEL_SYM_EDITING_OPTIONS_BASE
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;

View File

@ -34,12 +34,11 @@
#include <wildcards_and_files_ext.h>
#include <env_paths.h>
#include <eeschema_id.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <lib_view_frame.h>
#include <sch_edit_frame.h>
#include <kiway.h>
#include <pgm_base.h>
#include <sch_screen.h>
#include <settings/settings_manager.h>
#include <widgets/grid_readonly_text_helpers.h>
@ -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();
}

View File

@ -30,10 +30,8 @@
#include <eda_dde.h>
#include <eeschema_settings.h>
#include <sch_edit_frame.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <lib_view_frame.h>
#include <general.h>
#include <class_libentry.h>
#include <transform.h>
#include <symbol_lib_table.h>
#include <dialogs/dialog_global_sym_lib_table_config.h>
@ -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;
}

View File

@ -33,7 +33,7 @@
#include <eeschema_config.h>
#include <erc_settings.h>
#include <kiway.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <panel_gal_display_options.h>
#include <panel_hotkeys_editor.h>
#include <pgm_base.h>
@ -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,7 +386,7 @@ void SCH_BASE_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
}
void LIB_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
void SYMBOL_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
{
wxTreebook* book = aParent->GetTreebook();

View File

@ -23,7 +23,7 @@
#include <eeschema_settings.h>
#include <layers_id_colors_and_visibility.h>
#include <libedit_settings.h>
#include <symbol_editor_settings.h>
#include <pgm_base.h>
#include <settings/common_settings.h>
#include <settings/parameters.h>
@ -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<LIBEDIT_SETTINGS>( false );
auto libedit = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>( false );
libedit->MigrateFromLegacy( aCfg );
libedit->Load();

View File

@ -53,13 +53,13 @@ FIELDS_GRID_TABLE<T>::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<T>::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<T>::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 );

View File

@ -29,7 +29,6 @@
#include <eeschema_id.h>
#include <general.h>
#include <kiway.h>
#include <lib_edit_frame.h>
#include <lib_view_frame.h>
#include <pgm_base.h>
#include <sch_component.h>

View File

@ -29,11 +29,11 @@
#include <base_units.h>
#include <widgets/msgpanel.h>
#include <general.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <class_libentry.h>
#include <lib_pin.h>
#include <settings/settings_manager.h>
#include <libedit/libedit_settings.h>
#include <symbol_editor/symbol_editor_settings.h>
#include <trigo.h>
#include "sch_painter.h"
@ -106,12 +106,12 @@ LIB_PIN::LIB_PIN( LIB_PART* aParent ) :
if( pgm )
{
LIBEDIT_SETTINGS* settings = pgm->GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
auto* settings = pgm->GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
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 );

View File

@ -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();

View File

@ -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 <stambaughw@gmail.com>
* 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 <kiway.h>
#include <pgm_base.h>
#include <sch_draw_panel.h>
#include <confirm.h>
#include <kicad_string.h>
//#include <gestfich.h>
#include <lib_pin.h>
#include <lib_edit_frame.h>
#include <class_libentry.h>
#include <wildcards_and_files_ext.h>
#include <sch_plugins/legacy/sch_legacy_plugin.h>
#include <properties.h>
#include <view/view.h>
#include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h>
void LIB_EDIT_FRAME::LoadOneSymbol()
{
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
// 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 );
}

View File

@ -32,7 +32,6 @@
#include <sch_edit_frame.h>
#include <base_units.h>
#include <locale_io.h>
#include <lib_edit_frame.h>
#include <sch_sheet_path.h>
#include <schematic.h>
#include <project.h>

View File

@ -26,7 +26,7 @@
#include <kiway.h>
#include <pgm_base.h>
#include <eeschema_settings.h>
#include <libedit_settings.h>
#include <symbol_editor_settings.h>
#include <sch_draw_panel.h>
#include <sch_view.h>
#include <sch_painter.h>
@ -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<LIBEDIT_SETTINGS*>( config() );
return dynamic_cast<SYMBOL_EDITOR_SETTINGS*>( config() );
}

View File

@ -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

View File

@ -37,7 +37,7 @@
#include <kiface_i.h>
#include <kiplatform/app.h>
#include <kiway.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <lib_view_frame.h>
#include <pgm_base.h>
#include <profile.h>
@ -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;
}

View File

@ -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() );

View File

@ -29,12 +29,12 @@
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <tools/ee_selection_tool.h>
#include <lib_manager.h>
#include "lib_edit_frame.h"
#include <symbol_library_manager.h>
#include "symbol_edit_frame.h"
#include <widgets/wx_menubar.h>
void LIB_EDIT_FRAME::ReCreateMenuBar()
void SYMBOL_EDIT_FRAME::ReCreateMenuBar()
{
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
// wxWidgets handles the Mac Application menu behind the scenes, but that means

View File

@ -32,10 +32,10 @@
#include <kiface_i.h>
#include <kiplatform/app.h>
#include <kiway_express.h>
#include <lib_edit_frame.h>
#include <lib_manager.h>
#include <symbol_edit_frame.h>
#include <symbol_library_manager.h>
#include <lib_text.h>
#include <libedit_settings.h>
#include <symbol_editor_settings.h>
#include <pgm_base.h>
#include <sch_draw_panel.h>
#include <sch_painter.h>
@ -68,31 +68,31 @@
#include <wildcards_and_files_ext.h>
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<LIBEDIT_SETTINGS>();
m_settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
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<LIBEDIT_SETTINGS>();
auto libedit = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
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<EE_SELECTION_TOOL>()->GetSelection();
}
void LIB_EDIT_FRAME::LoadSymbolFromSchematic( const std::unique_ptr<LIB_PART>& aSymbol,
const wxString& aReference, int aUnit, int aConvert )
void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( const std::unique_ptr<LIB_PART>& aSymbol,
const wxString& aReference, int aUnit,
int aConvert )
{
std::unique_ptr<LIB_PART> symbol = aSymbol->Flatten();
wxCHECK( symbol, /* void */ );

View File

@ -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 <sch_base_frame.h>
#include <sch_screen.h>
@ -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)
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
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:
* <p>
* EVT_CLOSE( LIB_EDIT_FRAME::OnCloseWindow )
* EVT_CLOSE( SYMBOL_EDIT_FRAME::OnCloseWindow )
* </p>
*/
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

View File

@ -28,13 +28,13 @@
#include <widgets/infobar.h>
#include <tools/ee_actions.h>
#include <tools/lib_drawing_tools.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <class_libentry.h>
#include <class_library.h>
#include <template_fieldnames.h>
#include <wildcards_and_files_ext.h>
#include <symbol_lib_table.h>
#include <lib_manager.h>
#include <symbol_library_manager.h>
#include <symbol_tree_pane.h>
#include <widgets/lib_tree.h>
#include <sch_plugins/legacy/sch_legacy_plugin.h>
@ -44,7 +44,7 @@
#include <wx/clipbrd.h>
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,7 +171,7 @@ bool LIB_EDIT_FRAME::LoadComponentAndSelectLib( const LIB_ID& aLibId, int aUnit,
}
bool LIB_EDIT_FRAME::LoadComponentFromCurrentLib( const wxString& aAliasName, int aUnit,
bool SYMBOL_EDIT_FRAME::LoadComponentFromCurrentLib( const wxString& aAliasName, int aUnit,
int aConvert )
{
LIB_PART* alias = nullptr;
@ -207,7 +207,7 @@ bool LIB_EDIT_FRAME::LoadComponentFromCurrentLib( const wxString& aAliasName, in
}
bool LIB_EDIT_FRAME::LoadOneLibraryPartAux( LIB_PART* aEntry, const wxString& aLibrary,
bool SYMBOL_EDIT_FRAME::LoadOneLibraryPartAux( LIB_PART* aEntry, const wxString& aLibrary,
int aUnit, int aConvert )
{
wxString msg, rootName;
@ -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<EE_SELECTION_TOOL>();
// 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 );
}

View File

@ -25,15 +25,15 @@
#include <confirm.h>
#include <symbol_lib_table.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <class_libentry.h>
#include <class_library.h>
#include <wildcards_and_files_ext.h>
#include <lib_manager.h>
#include <symbol_library_manager.h>
#include <wx/filename.h>
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();

View File

@ -23,13 +23,13 @@
#include <sch_painter.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <locale_io.h>
#include <class_libentry.h>
#include <class_library.h>
#include <plotters_specific.h>
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;

View File

@ -24,7 +24,7 @@
#include <settings/common_settings.h>
#include <settings/parameters.h>
#include <settings/settings_manager.h>
#include "libedit_settings.h"
#include "symbol_editor_settings.h"
#include <default_values.h>
@ -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 );

View File

@ -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 <settings/app_settings.h>
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;

View File

@ -22,35 +22,33 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <sch_draw_panel.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <class_libentry.h>
#include <lib_manager.h>
#include <symbol_library_manager.h>
#include <widgets/lib_tree.h>
#include <symbol_tree_pane.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <tools/ee_selection_tool.h>
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 );

View File

@ -23,10 +23,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <lib_manager.h>
#include <symbol_library_manager.h>
#include <class_libentry.h>
#include <class_library.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <env_paths.h>
#include <pgm_base.h>
#include <kiway.h>
@ -37,7 +37,7 @@
#include <list>
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,7 +46,7 @@ LIB_MANAGER::LIB_MANAGER( LIB_EDIT_FRAME& aFrame ) :
}
void LIB_MANAGER::Sync( bool aForce,
void SYMBOL_LIBRARY_MANAGER::Sync( bool aForce,
std::function<void( int, int, const wxString& )> 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,7 +130,7 @@ SYMBOL_LIB_TABLE_ROW* LIB_MANAGER::GetLibrary( const wxString& aLibrary ) const
}
bool LIB_MANAGER::SaveLibrary( const wxString& aLibrary, const wxString& aFileName,
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 );
@ -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_PART*> LIB_MANAGER::GetAliases( const wxString& aLibrary ) const
std::list<LIB_PART*> SYMBOL_LIBRARY_MANAGER::GetAliases( const wxString& aLibrary ) const
{
std::list<LIB_PART*> ret;
wxCHECK( LibraryExists( aLibrary ), ret );
@ -328,7 +328,8 @@ std::list<LIB_PART*> 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,7 +430,7 @@ bool LIB_MANAGER::UpdatePart( LIB_PART* aPart, const wxString& aLibrary )
}
bool LIB_MANAGER::UpdatePartAfterRename( LIB_PART* aPart, const wxString& aOldName,
bool SYMBOL_LIBRARY_MANAGER::UpdatePartAfterRename( LIB_PART* aPart, const wxString& aOldName,
const wxString& aLibrary )
{
LIB_BUFFER& libBuf = getLibraryBuffer( aLibrary );
@ -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,7 +624,7 @@ wxString LIB_MANAGER::GetUniqueLibraryName() const
}
void LIB_MANAGER::GetRootSymbolNames( const wxString& aLibraryName,
void SYMBOL_LIBRARY_MANAGER::GetRootSymbolNames( const wxString& aLibraryName,
wxArrayString& aRootSymbolNames )
{
LIB_BUFFER& libBuf = getLibraryBuffer( aLibraryName );
@ -631,7 +633,7 @@ void LIB_MANAGER::GetRootSymbolNames( const wxString& aLibraryName,
}
bool LIB_MANAGER:: HasDerivedSymbols( const wxString& aSymbolName,
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_PART*> LIB_MANAGER::getOriginalParts( const wxString& aLibrary )
std::set<LIB_PART*> SYMBOL_LIBRARY_MANAGER::getOriginalParts( const wxString& aLibrary )
{
std::set<LIB_PART*> parts;
wxCHECK( LibraryExists( aLibrary ), parts );
@ -716,7 +719,7 @@ std::set<LIB_PART*> 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<SCH_SCREEN> aScreen ) :
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PART_BUFFER( LIB_PART* aPart,
std::unique_ptr<SCH_SCREEN> aScreen ) :
m_screen( std::move( aScreen ) ),
m_part( aPart )
{
@ -769,14 +773,14 @@ LIB_MANAGER::PART_BUFFER::PART_BUFFER( LIB_PART* aPart, std::unique_ptr<SCH_SCRE
}
LIB_MANAGER::PART_BUFFER::~PART_BUFFER()
SYMBOL_LIBRARY_MANAGER::PART_BUFFER::~PART_BUFFER()
{
delete m_part;
delete m_original;
}
void LIB_MANAGER::PART_BUFFER::SetPart( LIB_PART* aPart )
void SYMBOL_LIBRARY_MANAGER::PART_BUFFER::SetPart( LIB_PART* aPart )
{
wxCHECK( m_part != aPart, /* void */ );
wxASSERT( aPart );
@ -792,7 +796,7 @@ void LIB_MANAGER::PART_BUFFER::SetPart( LIB_PART* aPart )
}
void LIB_MANAGER::PART_BUFFER::SetOriginal( LIB_PART* aPart )
void SYMBOL_LIBRARY_MANAGER::PART_BUFFER::SetOriginal( LIB_PART* aPart )
{
wxCHECK( m_original != aPart, /* void */ );
wxASSERT( aPart );
@ -808,13 +812,13 @@ void LIB_MANAGER::PART_BUFFER::SetOriginal( LIB_PART* aPart )
}
bool LIB_MANAGER::PART_BUFFER::IsModified() const
bool SYMBOL_LIBRARY_MANAGER::PART_BUFFER::IsModified() const
{
return m_screen && m_screen->IsModify();
}
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,7 +852,7 @@ bool LIB_MANAGER::LIB_BUFFER::CreateBuffer( LIB_PART* aCopy, SCH_SCREEN* aScreen
}
bool LIB_MANAGER::LIB_BUFFER::UpdateBuffer( LIB_MANAGER::PART_BUFFER::PTR aPartBuf,
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,7 +890,7 @@ bool LIB_MANAGER::LIB_BUFFER::DeleteBuffer( LIB_MANAGER::PART_BUFFER::PTR aPartB
}
bool LIB_MANAGER::LIB_BUFFER::SaveBuffer( LIB_MANAGER::PART_BUFFER::PTR aPartBuf,
bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer( SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aPartBuf,
SYMBOL_LIB_TABLE* aLibTable )
{
wxCHECK( aPartBuf, false );
@ -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,7 +969,7 @@ bool LIB_MANAGER::LIB_BUFFER::SaveBuffer( LIB_MANAGER::PART_BUFFER::PTR aPartBuf
}
bool LIB_MANAGER::LIB_BUFFER::SaveBuffer( LIB_MANAGER::PART_BUFFER::PTR aPartBuf,
bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer( SYMBOL_LIBRARY_MANAGER::PART_BUFFER::PTR aPartBuf,
SCH_PLUGIN* aPlugin, bool aBuffer )
{
wxCHECK( aPartBuf, false );
@ -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,7 +1161,7 @@ void LIB_MANAGER::LIB_BUFFER::GetRootSymbolNames( wxArrayString& aRootSymbolName
}
size_t LIB_MANAGER::LIB_BUFFER::GetDerivedSymbolNames( const wxString& aSymbolName,
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() )
{

View File

@ -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 <map>
#include <list>
@ -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<void(int, int, const wxString&)> 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<wxString, LIB_BUFFER> 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 */

View File

@ -24,13 +24,11 @@
*/
#include <eeschema_id.h>
//#include <general.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <sch_painter.h>
#include <dialog_helpers.h>
#include <bitmaps.h>
#include <lib_manager.h>
#include <class_libentry.h>
#include <symbol_library_manager.h>
#include <tool/action_toolbar.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
@ -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 )
{

View File

@ -24,21 +24,21 @@
*/
#include <symbol_tree_synchronizing_adapter.h>
#include <lib_manager.h>
#include <symbol_library_manager.h>
#include <symbol_lib_table.h>
#include <class_libentry.h>
#include <tools/lib_control.h>
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 )

View File

@ -28,13 +28,13 @@
#include <lib_tree_model_adapter.h>
#include <map>
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<wxString, int> m_libHashes;
///> LIB_MANAGER hash value returned in the last synchronization
///> SYMBOL_LIBRARY_MANAGER hash value returned in the last synchronization
int m_lastSyncHash;
};

View File

@ -35,7 +35,7 @@
#include <search_stack.h>
#include <sim/sim_plot_frame.h>
#include <sch_edit_frame.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <lib_view_frame.h>
#include <eda_doc.h>
#include <invoke_sch_dialog.h>
@ -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<LIB_EDIT_FRAME*>( m_frame )->GetCurPart() );
checkPart( static_cast<SYMBOL_EDIT_FRAME*>( 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<LIB_EDIT_FRAME*>( m_frame )->GetCurPart();
LIB_PART* part = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurPart();
if( !part )
return 0;

View File

@ -36,7 +36,7 @@ using namespace std::placeholders;
#include <sch_line.h>
#include <sch_bitmap.h>
#include <sch_sheet.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <lib_arc.h>
#include <lib_circle.h>
#include <lib_rectangle.h>
@ -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<LIB_EDIT_FRAME*>( m_frame )->RollbackPartFromUndo();
if( m_isSymbolEditor )
static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->RollbackPartFromUndo();
else
static_cast<SCH_EDIT_FRAME*>( m_frame )->RollbackSchematicFromUndo();
}

View File

@ -29,7 +29,7 @@
#include <ee_collectors.h>
#include <ee_selection_tool.h>
#include <eeschema_id.h> // For MAX_SELECT_ITEM_IDS
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <lib_item.h>
#include <lib_view_frame.h>
#include <math/util.h>
@ -52,7 +52,6 @@
#include <trigo.h>
#include <view/view.h>
#include <view/view_controls.h>
#include <view/view_group.h>
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 )
@ -131,17 +130,18 @@ bool EE_SELECTION_TOOL::Init()
m_frame = getEditFrame<SCH_BASE_FRAME>();
LIB_VIEW_FRAME* libViewFrame = dynamic_cast<LIB_VIEW_FRAME*>( m_frame );
LIB_EDIT_FRAME* libEditFrame = dynamic_cast<LIB_EDIT_FRAME*>( m_frame );
SYMBOL_EDIT_FRAME* symbolEditorFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( 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<LIB_EDIT_FRAME*>( m_frame )->GetCurPart();
return m_isSymbolEditor && static_cast<SYMBOL_EDIT_FRAME*>( 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<LIB_EDIT_FRAME*>( m_frame );
SYMBOL_EDIT_FRAME* libEditFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
LIB_VIEW_FRAME* libViewFrame = dynamic_cast<LIB_VIEW_FRAME*>( 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<LIB_EDIT_FRAME*>( m_frame )->GetCurPart();
LIB_PART* part = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurPart();
if( !part )
return false;
@ -845,13 +844,17 @@ 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
if( !m_isSymbolEditor && m_frame->eeconfig()->m_Selection.select_pin_selects_symbol
&& !other->IsPointClickableAnchor( cursorPos ) )
{
collector.Transfer( other );
}
else
{
collector.Transfer( item );
}
}
}
// Prefer a field to a symbol
for( int i = 0; collector.GetCount() == 2 && i < 2; ++i )
@ -960,7 +963,7 @@ void EE_SELECTION_TOOL::updateReferencePoint()
if( m_selection.Size() > 0 )
{
if( m_isLibEdit )
if( m_isSymbolEditor )
refP = static_cast<LIB_ITEM*>( m_selection.GetTopLeftItem() )->GetPosition();
else
refP = static_cast<SCH_ITEM*>( 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<LIB_EDIT_FRAME*>( m_frame )->GetCurPart();
LIB_PART* start = static_cast<SYMBOL_EDIT_FRAME*>( 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.

View File

@ -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)

View File

@ -33,7 +33,7 @@
#include <tools/ee_selection_tool.h>
#include <sch_view.h>
#include <sch_edit_frame.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <undo_redo_container.h>
@ -60,7 +60,7 @@ public:
m_frame( nullptr ),
m_view( nullptr ),
m_selectionTool( nullptr ),
m_isLibEdit( false )
m_isSymbolEditor( false )
{};
~EE_TOOL_BASE() override {};
@ -70,7 +70,7 @@ public:
{
m_frame = getEditFrame<T>();
m_selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
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<T>();
m_isLibEdit = dynamic_cast<LIB_EDIT_FRAME*>( m_frame ) != nullptr;
m_isSymbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) != nullptr;
}
m_view = static_cast<KIGFX::SCH_VIEW*>( 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<LIB_EDIT_FRAME*>( m_frame );
SYMBOL_EDIT_FRAME* editFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
wxASSERT( editFrame );
editFrame->SaveCopyInUndoList( static_cast<LIB_ITEM*>( 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

View File

@ -27,7 +27,7 @@
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <tools/lib_control.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <lib_view_frame.h>
#include <symbol_tree_model_adapter.h>
#include <wildcards_and_files_ext.h>
@ -39,12 +39,12 @@ bool LIB_CONTROL::Init()
{
m_frame = getEditFrame<SCH_BASE_FRAME>();
m_selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
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<LIB_EDIT_FRAME>();
SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
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<LIB_EDIT_FRAME*>( m_frame )->AddLibraryFile( createNew );
if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) )
static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->AddLibraryFile( createNew );
return 0;
}
@ -109,9 +109,9 @@ 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<LIB_EDIT_FRAME*>( m_frame );
SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
int unit = 0;
LIB_ID partId = editFrame->GetTreeLIBID( &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<LIB_EDIT_FRAME*>( m_frame );
SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( 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<LIB_EDIT_FRAME*>( m_frame );
SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( 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<LIB_EDIT_FRAME*>( m_frame )->Revert();
if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) )
static_cast<SYMBOL_EDIT_FRAME*>( 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<LIB_EDIT_FRAME*>( m_frame )->ExportPart();
if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) )
static_cast<SYMBOL_EDIT_FRAME*>( 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<LIB_EDIT_FRAME*>( m_frame );
SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( 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<LIB_EDIT_FRAME*>( m_frame );
SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( 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<LIB_EDIT_FRAME*>( m_frame );
SYMBOL_EDIT_FRAME* libEditFrame = static_cast<SYMBOL_EDIT_FRAME*>( 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<LIB_EDIT_FRAME*>( m_frame );
SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( 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<LIB_EDIT_FRAME*>( m_frame );
SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( 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<LIB_EDIT_FRAME*>( m_frame )->OnToggleSearchTree( dummy );
static_cast<SYMBOL_EDIT_FRAME*>( 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<LIB_EDIT_FRAME>();
SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
editFrame->m_SyncPinEdit = !editFrame->m_SyncPinEdit;
return 0;
@ -304,10 +304,10 @@ 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_EDIT_FRAME>();
SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
LIB_PART* part = editFrame->GetCurPart();
if( !part )
@ -344,10 +344,10 @@ 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_EDIT_FRAME>();
SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
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<LIB_EDIT_FRAME>();
SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
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<LIB_EDIT_FRAME>();
SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
wxCHECK( editFrame, 0 );

View File

@ -29,7 +29,7 @@
#include <sch_base_frame.h>
#include <tools/ee_tool_base.h>
class LIB_EDIT_FRAME;
class SYMBOL_EDIT_FRAME;
/**
* Handle actions for the various symbol editor and viewers.

View File

@ -23,7 +23,7 @@
*/
#include <ee_actions.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <view/view_controls.h>
#include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h>
@ -38,7 +38,7 @@
#include <lib_polyline.h>
#include <lib_rectangle.h>
#include <pgm_base.h>
#include <libedit/libedit_settings.h>
#include <symbol_editor/symbol_editor_settings.h>
#include <settings/settings_manager.h>
#include "ee_point_editor.h"
@ -46,7 +46,7 @@ static void* g_lastPinWeakPtr;
LIB_DRAWING_TOOLS::LIB_DRAWING_TOOLS() :
EE_TOOL_BASE<LIB_EDIT_FRAME>( "eeschema.SymbolDrawing" ),
EE_TOOL_BASE<SYMBOL_EDIT_FRAME>( "eeschema.SymbolDrawing" ),
m_lastTextAngle( 0.0 ),
m_lastFillStyle( FILL_TYPE::NO_FILL ),
m_drawSpecificConvert( true ),
@ -73,7 +73,7 @@ bool LIB_DRAWING_TOOLS::Init()
int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
{
KICAD_T type = aEvent.Parameter<KICAD_T>();
LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
auto* settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
LIB_PIN_TOOL* pinTool = type == LIB_PIN_T ? m_toolMgr->GetTool<LIB_PIN_TOOL>() : nullptr;
VECTOR2I cursorPos;
EDA_ITEM* item = nullptr;
@ -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<LIBEDIT_SETTINGS>();
SYMBOL_EDITOR_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
KICAD_T type = aEvent.Parameter<KICAD_T>();
// We might be running as the same shape in another co-routine. Make sure that one

View File

@ -28,7 +28,7 @@
#include <tools/ee_tool_base.h>
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<LIB_EDIT_FRAME>
class LIB_DRAWING_TOOLS : public EE_TOOL_BASE<SYMBOL_EDIT_FRAME>
{
public:
LIB_DRAWING_TOOLS();

View File

@ -32,7 +32,7 @@
#include <bitmaps.h>
#include <confirm.h>
#include <sch_view.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <dialogs/dialog_lib_edit_draw_item.h>
#include <dialogs/dialog_lib_edit_text.h>
#include <dialogs/dialog_edit_one_field.h>
@ -63,7 +63,7 @@ bool LIB_EDIT_TOOL::Init()
auto havePartCondition =
[&]( const SELECTION& sel )
{
return m_isLibEdit && static_cast<LIB_EDIT_FRAME*>( m_frame )->GetCurPart();
return m_isSymbolEditor && static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurPart();
};
// Add edit actions to the move tool menu

View File

@ -28,10 +28,10 @@
#include <tools/ee_tool_base.h>
class LIB_EDIT_FRAME;
class SYMBOL_EDIT_FRAME;
class LIB_EDIT_TOOL : public EE_TOOL_BASE<LIB_EDIT_FRAME>
class LIB_EDIT_TOOL : public EE_TOOL_BASE<SYMBOL_EDIT_FRAME>
{
public:
LIB_EDIT_TOOL();

View File

@ -27,7 +27,6 @@
#include <ee_actions.h>
#include <bitmaps.h>
#include <eda_item.h>
#include <lib_edit_frame.h>
#include "lib_move_tool.h"
#include "lib_pin_tool.h"

View File

@ -26,13 +26,13 @@
#define KICAD_LIB_MOVE_TOOL_H
#include <tools/ee_tool_base.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
class LIB_EDIT_FRAME;
class SYMBOL_EDIT_FRAME;
class EE_SELECTION_TOOL;
class LIB_MOVE_TOOL : public EE_TOOL_BASE<LIB_EDIT_FRAME>
class LIB_MOVE_TOOL : public EE_TOOL_BASE<SYMBOL_EDIT_FRAME>
{
public:
LIB_MOVE_TOOL();

View File

@ -24,12 +24,12 @@
#include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h>
#include <lib_edit_frame.h>
#include <symbol_edit_frame.h>
#include <confirm.h>
#include <ee_actions.h>
#include <dialogs/dialog_pin_properties.h>
#include <settings/settings_manager.h>
#include <libedit/libedit_settings.h>
#include <symbol_editor/symbol_editor_settings.h>
#include <pgm_base.h>
#include "lib_pin_tool.h"
@ -50,7 +50,7 @@ static int GetLastPinLength()
{
if( g_LastPinLength == -1 )
{
LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
auto* settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
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<LIBEDIT_SETTINGS>();
auto* settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
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<LIBEDIT_SETTINGS>();
auto* settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
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<LIB_EDIT_FRAME>( "eeschema.PinEditing" )
EE_TOOL_BASE<SYMBOL_EDIT_FRAME>( "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<LIBEDIT_SETTINGS>();
auto* settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
switch( pin->GetOrientation() )
{

View File

@ -29,10 +29,10 @@
#include <sch_base_frame.h>
class LIB_EDIT_FRAME;
class SYMBOL_EDIT_FRAME;
class LIB_PIN_TOOL : public EE_TOOL_BASE<LIB_EDIT_FRAME>
class LIB_PIN_TOOL : public EE_TOOL_BASE<SYMBOL_EDIT_FRAME>
{
public:
LIB_PIN_TOOL();

View File

@ -63,7 +63,7 @@
#include <math/util.h> // for KiROUND
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <libedit_settings.h>
#include <symbol_editor_settings.h>
#include <dialogs/dialog_edit_label.h>
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<LIBEDIT_SETTINGS>();
auto* cfg = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
if( dynamic_cast<SCH_TEXT*>( 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() );

View File

@ -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( &currentSheet ),
if( symbolEditor )
{
symbolEditor->LoadSymbolFromSchematic( sym->GetPartRef(), sym->GetRef( &currentSheet ),
sym->GetUnit(), sym->GetConvert() );
}
return 0;
}

View File

@ -24,13 +24,13 @@
#include "symbol_tree_pane.h"
#include <widgets/lib_tree.h>
#include <lib_manager.h>
#include <lib_edit_frame.h>
#include <symbol_library_manager.h>
#include <symbol_edit_frame.h>
#include <symbol_lib_table.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
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 ),

View File

@ -30,8 +30,8 @@
#include <vector>
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;
SYMBOL_EDIT_FRAME* m_libEditFrame;
LIB_TREE* m_tree; ///< component search tree widget
LIB_MANAGER* m_libMgr;
SYMBOL_LIBRARY_MANAGER* m_libMgr;
};
#endif /* CMP_TREE_PANE_H */

View File

@ -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,

View File

@ -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

View File

@ -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,

View File

@ -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:

View File

@ -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;