From ad191fda52f508fa41e1338ab618400ad6674fbc Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Tue, 13 Oct 2020 21:33:15 -0400 Subject: [PATCH] Unwrap eda_base_frame from base_screen --- common/eda_item.cpp | 1 + eeschema/class_library.cpp | 4 ++-- eeschema/class_library.h | 9 +++++++-- eeschema/libarch.cpp | 2 +- eeschema/project_rescue.cpp | 3 ++- eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp | 4 ++-- eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp | 10 +++++----- include/base_screen.h | 1 - include/eda_base_frame.h | 7 ------- 9 files changed, 20 insertions(+), 21 deletions(-) diff --git a/common/eda_item.cpp b/common/eda_item.cpp index f88716c6aa..3d09021083 100644 --- a/common/eda_item.cpp +++ b/common/eda_item.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include diff --git a/eeschema/class_library.cpp b/eeschema/class_library.cpp index 5e0b11c55e..370326c664 100644 --- a/eeschema/class_library.cpp +++ b/eeschema/class_library.cpp @@ -54,7 +54,7 @@ "This may cause some unexpected behavior when loading components into a schematic." ) -PART_LIB::PART_LIB( int aType, const wxString& aFileName, SCH_IO_MGR::SCH_FILE_T aPluginType ) : +PART_LIB::PART_LIB( SCH_LIB_TYPE aType, const wxString& aFileName, SCH_IO_MGR::SCH_FILE_T aPluginType ) : // start @ != 0 so each additional library added // is immediately detectable, zero would not be. m_mod_hash( PART_LIBS::s_modify_generation ), @@ -237,7 +237,7 @@ LIB_PART* PART_LIB::ReplacePart( LIB_PART* aOldPart, LIB_PART* aNewPart ) PART_LIB* PART_LIB::LoadLibrary( const wxString& aFileName ) { - std::unique_ptr lib( new PART_LIB( LIBRARY_TYPE_EESCHEMA, aFileName ) ); + std::unique_ptr lib( new PART_LIB( SCH_LIB_TYPE::LT_EESCHEMA, aFileName ) ); std::vector parts; // This loads the library. diff --git a/eeschema/class_library.h b/eeschema/class_library.h index 58029c353b..715d0fd4bb 100644 --- a/eeschema/class_library.h +++ b/eeschema/class_library.h @@ -74,6 +74,11 @@ class SCH_PLUGIN; #define USE_OLD_DOC_FILE_FORMAT( major, minor ) \ ( LIB_VERSION( major, minor ) <= LIB_VERSION( 2, 4 ) ) +enum class SCH_LIB_TYPE +{ + LT_EESCHEMA, + LT_SYMBOL +}; // Helper class to filter a list of libraries, and/or a list of PART_LIB // in dialogs class SCHLIB_FILTER @@ -302,7 +307,7 @@ public: */ class PART_LIB { - int type; ///< Library type indicator. + SCH_LIB_TYPE type; ///< Library type indicator. wxFileName fileName; ///< Library file name. wxDateTime timeStamp; ///< Library save time and date. int versionMajor; ///< Library major version number. @@ -316,7 +321,7 @@ class PART_LIB std::unique_ptr< PROPERTIES > m_properties; ///< Library properties public: - PART_LIB( int aType, const wxString& aFileName, + PART_LIB( SCH_LIB_TYPE aType, const wxString& aFileName, SCH_IO_MGR::SCH_FILE_T aPluginType = SCH_IO_MGR::SCH_LEGACY ); ~PART_LIB(); diff --git a/eeschema/libarch.cpp b/eeschema/libarch.cpp index 28601be57c..33d526ea9a 100644 --- a/eeschema/libarch.cpp +++ b/eeschema/libarch.cpp @@ -69,7 +69,7 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName ) SCH_SCREENS screens( Schematic().Root() ); // Create a new empty library to archive components: - std::unique_ptr archLib( new PART_LIB( LIBRARY_TYPE_EESCHEMA, aFileName ) ); + std::unique_ptr archLib( new PART_LIB( SCH_LIB_TYPE::LT_EESCHEMA, aFileName ) ); // Save symbols to file only when the library will be fully filled archLib->EnableBuffering(); diff --git a/eeschema/project_rescue.cpp b/eeschema/project_rescue.cpp index 29f9795471..da470ff9ae 100644 --- a/eeschema/project_rescue.cpp +++ b/eeschema/project_rescue.cpp @@ -643,7 +643,8 @@ void LEGACY_RESCUER::OpenRescueLibrary() { wxFileName fn = GetRescueLibraryFileName( m_schematic ); - std::unique_ptr rescue_lib( new PART_LIB( LIBRARY_TYPE_EESCHEMA, fn.GetFullPath() ) ); + std::unique_ptr rescue_lib( + new PART_LIB( SCH_LIB_TYPE::LT_EESCHEMA, fn.GetFullPath() ) ); m_rescue_lib = std::move( rescue_lib ); m_rescue_lib->EnableBuffering(); diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp index bd2bc24512..9945a67446 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp @@ -296,7 +296,7 @@ class SCH_SEXPR_PLUGIN_CACHE bool m_isModified; int m_versionMajor; int m_versionMinor; - int m_libType; // Is this cache a component or symbol library. + SCH_LIB_TYPE m_libType; // Is this cache a component or symbol library. static FILL_T parseFillMode( LINE_READER& aReader, const char* aLine, const char** aOutput ); @@ -1247,7 +1247,7 @@ SCH_SEXPR_PLUGIN_CACHE::SCH_SEXPR_PLUGIN_CACHE( const wxString& aFullPathAndFile { m_versionMajor = -1; m_versionMinor = -1; - m_libType = LIBRARY_TYPE_EESCHEMA; + m_libType = SCH_LIB_TYPE::LT_EESCHEMA; } diff --git a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp index 64d5368c44..96a1a0295a 100644 --- a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp +++ b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp @@ -484,7 +484,7 @@ class SCH_LEGACY_PLUGIN_CACHE bool m_isModified; int m_versionMajor; int m_versionMinor; - int m_libType; // Is this cache a component or symbol library. + SCH_LIB_TYPE m_libType; // Is this cache a component or symbol library. void loadHeader( FILE_LINE_READER& aReader ); static void loadAliases( std::unique_ptr& aPart, LINE_READER& aReader, @@ -2406,7 +2406,7 @@ SCH_LEGACY_PLUGIN_CACHE::SCH_LEGACY_PLUGIN_CACHE( const wxString& aFullPathAndFi { m_versionMajor = -1; m_versionMinor = -1; - m_libType = LIBRARY_TYPE_EESCHEMA; + m_libType = SCH_LIB_TYPE::LT_EESCHEMA; } @@ -2604,13 +2604,13 @@ void SCH_LEGACY_PLUGIN_CACHE::Load() if( strCompare( "SYMBOL", line, &line ) ) { // Symbol files add date and time stamp info to the header. - m_libType = LIBRARY_TYPE_SYMBOL; + m_libType = SCH_LIB_TYPE::LT_SYMBOL; /// @todo Probably should check for a valid date and time stamp even though it's not used. } else { - m_libType = LIBRARY_TYPE_EESCHEMA; + m_libType = SCH_LIB_TYPE::LT_EESCHEMA; } while( reader.ReadLine() ) @@ -2621,7 +2621,7 @@ void SCH_LEGACY_PLUGIN_CACHE::Load() continue; // Headers where only supported in older library file formats. - if( m_libType == LIBRARY_TYPE_EESCHEMA && strCompare( "$HEADER", line ) ) + if( m_libType == SCH_LIB_TYPE::LT_EESCHEMA && strCompare( "$HEADER", line ) ) loadHeader( reader ); if( strCompare( "DEF", line ) ) diff --git a/include/base_screen.h b/include/base_screen.h index 67dd10df90..4c494418d8 100644 --- a/include/base_screen.h +++ b/include/base_screen.h @@ -31,7 +31,6 @@ #ifndef BASE_SCREEN_H #define BASE_SCREEN_H -#include #include #include diff --git a/include/eda_base_frame.h b/include/eda_base_frame.h index 669012c67e..0185dc38ca 100644 --- a/include/eda_base_frame.h +++ b/include/eda_base_frame.h @@ -79,13 +79,6 @@ class WX_INFOBAR; struct WINDOW_SETTINGS; struct WINDOW_STATE; -enum id_librarytype { - LIBRARY_TYPE_EESCHEMA, - LIBRARY_TYPE_PCBNEW, - LIBRARY_TYPE_DOC, - LIBRARY_TYPE_SYMBOL -}; - #define DEFAULT_MAX_UNDO_ITEMS 0 #define ABS_MAX_UNDO_ITEMS (INT_MAX / 2)