Unwrap eda_base_frame from base_screen

This commit is contained in:
Marek Roszko 2020-10-13 21:33:15 -04:00
parent a0c0bda1db
commit ad191fda52
9 changed files with 20 additions and 21 deletions

View File

@ -31,6 +31,7 @@
#include <base_screen.h> #include <base_screen.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <eda_item.h> #include <eda_item.h>
#include <eda_rect.h>
#include <trace_helpers.h> #include <trace_helpers.h>
#include <trigo.h> #include <trigo.h>

View File

@ -54,7 +54,7 @@
"This may cause some unexpected behavior when loading components into a schematic." ) "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 // start @ != 0 so each additional library added
// is immediately detectable, zero would not be. // is immediately detectable, zero would not be.
m_mod_hash( PART_LIBS::s_modify_generation ), 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 ) PART_LIB* PART_LIB::LoadLibrary( const wxString& aFileName )
{ {
std::unique_ptr<PART_LIB> lib( new PART_LIB( LIBRARY_TYPE_EESCHEMA, aFileName ) ); std::unique_ptr<PART_LIB> lib( new PART_LIB( SCH_LIB_TYPE::LT_EESCHEMA, aFileName ) );
std::vector<LIB_PART*> parts; std::vector<LIB_PART*> parts;
// This loads the library. // This loads the library.

View File

@ -74,6 +74,11 @@ class SCH_PLUGIN;
#define USE_OLD_DOC_FILE_FORMAT( major, minor ) \ #define USE_OLD_DOC_FILE_FORMAT( major, minor ) \
( LIB_VERSION( major, minor ) <= LIB_VERSION( 2, 4 ) ) ( 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 // Helper class to filter a list of libraries, and/or a list of PART_LIB
// in dialogs // in dialogs
class SCHLIB_FILTER class SCHLIB_FILTER
@ -302,7 +307,7 @@ public:
*/ */
class PART_LIB class PART_LIB
{ {
int type; ///< Library type indicator. SCH_LIB_TYPE type; ///< Library type indicator.
wxFileName fileName; ///< Library file name. wxFileName fileName; ///< Library file name.
wxDateTime timeStamp; ///< Library save time and date. wxDateTime timeStamp; ///< Library save time and date.
int versionMajor; ///< Library major version number. int versionMajor; ///< Library major version number.
@ -316,7 +321,7 @@ class PART_LIB
std::unique_ptr< PROPERTIES > m_properties; ///< Library properties std::unique_ptr< PROPERTIES > m_properties; ///< Library properties
public: 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 ); SCH_IO_MGR::SCH_FILE_T aPluginType = SCH_IO_MGR::SCH_LEGACY );
~PART_LIB(); ~PART_LIB();

View File

@ -69,7 +69,7 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
SCH_SCREENS screens( Schematic().Root() ); SCH_SCREENS screens( Schematic().Root() );
// Create a new empty library to archive components: // Create a new empty library to archive components:
std::unique_ptr<PART_LIB> archLib( new PART_LIB( LIBRARY_TYPE_EESCHEMA, aFileName ) ); std::unique_ptr<PART_LIB> archLib( new PART_LIB( SCH_LIB_TYPE::LT_EESCHEMA, aFileName ) );
// Save symbols to file only when the library will be fully filled // Save symbols to file only when the library will be fully filled
archLib->EnableBuffering(); archLib->EnableBuffering();

View File

@ -643,7 +643,8 @@ void LEGACY_RESCUER::OpenRescueLibrary()
{ {
wxFileName fn = GetRescueLibraryFileName( m_schematic ); wxFileName fn = GetRescueLibraryFileName( m_schematic );
std::unique_ptr<PART_LIB> rescue_lib( new PART_LIB( LIBRARY_TYPE_EESCHEMA, fn.GetFullPath() ) ); std::unique_ptr<PART_LIB> rescue_lib(
new PART_LIB( SCH_LIB_TYPE::LT_EESCHEMA, fn.GetFullPath() ) );
m_rescue_lib = std::move( rescue_lib ); m_rescue_lib = std::move( rescue_lib );
m_rescue_lib->EnableBuffering(); m_rescue_lib->EnableBuffering();

View File

@ -296,7 +296,7 @@ class SCH_SEXPR_PLUGIN_CACHE
bool m_isModified; bool m_isModified;
int m_versionMajor; int m_versionMajor;
int m_versionMinor; 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, static FILL_T parseFillMode( LINE_READER& aReader, const char* aLine,
const char** aOutput ); const char** aOutput );
@ -1247,7 +1247,7 @@ SCH_SEXPR_PLUGIN_CACHE::SCH_SEXPR_PLUGIN_CACHE( const wxString& aFullPathAndFile
{ {
m_versionMajor = -1; m_versionMajor = -1;
m_versionMinor = -1; m_versionMinor = -1;
m_libType = LIBRARY_TYPE_EESCHEMA; m_libType = SCH_LIB_TYPE::LT_EESCHEMA;
} }

View File

@ -484,7 +484,7 @@ class SCH_LEGACY_PLUGIN_CACHE
bool m_isModified; bool m_isModified;
int m_versionMajor; int m_versionMajor;
int m_versionMinor; 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 ); void loadHeader( FILE_LINE_READER& aReader );
static void loadAliases( std::unique_ptr<LIB_PART>& aPart, LINE_READER& aReader, static void loadAliases( std::unique_ptr<LIB_PART>& aPart, LINE_READER& aReader,
@ -2406,7 +2406,7 @@ SCH_LEGACY_PLUGIN_CACHE::SCH_LEGACY_PLUGIN_CACHE( const wxString& aFullPathAndFi
{ {
m_versionMajor = -1; m_versionMajor = -1;
m_versionMinor = -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 ) ) if( strCompare( "SYMBOL", line, &line ) )
{ {
// Symbol files add date and time stamp info to the header. // 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. /// @todo Probably should check for a valid date and time stamp even though it's not used.
} }
else else
{ {
m_libType = LIBRARY_TYPE_EESCHEMA; m_libType = SCH_LIB_TYPE::LT_EESCHEMA;
} }
while( reader.ReadLine() ) while( reader.ReadLine() )
@ -2621,7 +2621,7 @@ void SCH_LEGACY_PLUGIN_CACHE::Load()
continue; continue;
// Headers where only supported in older library file formats. // 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 ); loadHeader( reader );
if( strCompare( "DEF", line ) ) if( strCompare( "DEF", line ) )

View File

@ -31,7 +31,6 @@
#ifndef BASE_SCREEN_H #ifndef BASE_SCREEN_H
#define BASE_SCREEN_H #define BASE_SCREEN_H
#include <eda_draw_frame.h>
#include <eda_item.h> #include <eda_item.h>
#include <common.h> #include <common.h>

View File

@ -79,13 +79,6 @@ class WX_INFOBAR;
struct WINDOW_SETTINGS; struct WINDOW_SETTINGS;
struct WINDOW_STATE; 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 DEFAULT_MAX_UNDO_ITEMS 0
#define ABS_MAX_UNDO_ITEMS (INT_MAX / 2) #define ABS_MAX_UNDO_ITEMS (INT_MAX / 2)