From a0473614b59a423ec679ab2c1a9a7a8fb4d8795a Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Sat, 18 Nov 2017 08:10:32 -0500 Subject: [PATCH] Remove all schematic object load and save code. All of the schematic object load and save code is implemented in the legacy schematic plugin so it is no longer required. Remove unused file with old schematic file loader. Doxygen comment cleaning. --- eeschema/CMakeLists.txt | 1 - eeschema/class_sch_screen.h | 8 - eeschema/load_one_schematic_file.cpp | 413 ------------------------- eeschema/sch_bitmap.cpp | 90 +----- eeschema/sch_bitmap.h | 16 +- eeschema/sch_bus_entry.cpp | 70 +---- eeschema/sch_bus_entry.h | 14 +- eeschema/sch_component.cpp | 436 --------------------------- eeschema/sch_component.h | 6 +- eeschema/sch_field.cpp | 48 --- eeschema/sch_field.h | 4 +- eeschema/sch_item_struct.h | 8 - eeschema/sch_junction.cpp | 34 +-- eeschema/sch_junction.h | 6 +- eeschema/sch_line.cpp | 74 +---- eeschema/sch_line.h | 11 +- eeschema/sch_marker.cpp | 25 +- eeschema/sch_marker.h | 5 +- eeschema/sch_no_connect.cpp | 33 -- eeschema/sch_no_connect.h | 6 +- eeschema/sch_screen.cpp | 71 +---- eeschema/sch_sheet.cpp | 235 --------------- eeschema/sch_sheet.h | 112 +++---- eeschema/sch_sheet_pin.cpp | 156 ---------- eeschema/sch_text.cpp | 394 +----------------------- eeschema/sch_text.h | 38 +-- eeschema/schframe.h | 13 - 27 files changed, 75 insertions(+), 2252 deletions(-) delete mode 100644 eeschema/load_one_schematic_file.cpp diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index 8bfcd78345..50e13f67f0 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -145,7 +145,6 @@ set( EESCHEMA_SRCS lib_rectangle.cpp lib_text.cpp libfield.cpp - load_one_schematic_file.cpp menubar.cpp menubar_libedit.cpp netform.cpp diff --git a/eeschema/class_sch_screen.h b/eeschema/class_sch_screen.h index f8d9db3e05..92c564d830 100644 --- a/eeschema/class_sch_screen.h +++ b/eeschema/class_sch_screen.h @@ -352,14 +352,6 @@ public: */ virtual void ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount = -1 ) override; - /** - * Writes the data structures for this object out to \a aFile in "*.sch" format. - * - * @param aFile The FILE to write to. - * @return bool - true if success writing else false. - */ - bool Save( FILE* aFile ) const; - /** * Clear the state flags of all the items in the screen. */ diff --git a/eeschema/load_one_schematic_file.cpp b/eeschema/load_one_schematic_file.cpp deleted file mode 100644 index ee11d59237..0000000000 --- a/eeschema/load_one_schematic_file.cpp +++ /dev/null @@ -1,413 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2004 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr - * Copyright (C) 2008 Wayne Stambaugh - * Copyright (C) 1992-2011 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 - */ - -/** - * @file load_one_schematic_file.cpp - * @brief Code to load and save Eeschema files. - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* Window ); - - -bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFileName, bool append ) -{ - char name1[256]; - bool itemLoaded = false; - SCH_ITEM* item; - wxString msgDiag; // Error and log messages - char* line; - wxFileName fn; - - if( aScreen == NULL ) - return false; - - if( aFullFileName.IsEmpty() ) - return false; - - // Place the undo limit into the screen - aScreen->SetMaxUndoItems( m_UndoRedoCountMax ); - - // If path is relative, this expands it from the project directory. - wxString fname = Prj().AbsolutePath( aFullFileName ); - -#ifdef __WINDOWS__ - fname.Replace( wxT("/"), wxT("\\") ); -#else - fname.Replace( wxT("\\"), wxT("/") ); -#endif - - fn = fname; - CheckForAutoSaveFile( fn, SchematicBackupFileExtension ); - - wxLogTrace( traceAutoSave, wxT( "Loading schematic file " ) + aFullFileName ); - - aScreen->SetCurItem( NULL ); - if( !append ) - aScreen->SetFileName( aFullFileName ); - - FILE* f = wxFopen( fname, wxT( "rt" ) ); - - if( !f ) - { - msgDiag.Printf( _( "Failed to open '%s'" ), GetChars( aFullFileName ) ); - DisplayError( this, msgDiag ); - return false; - } - - // reader now owns the open FILE. - FILE_LINE_READER reader( f, aFullFileName ); - - msgDiag.Printf( _( "Loading '%s'" ), GetChars( aScreen->GetFileName() ) ); - PrintMsg( msgDiag ); - - if( !reader.ReadLine() - || strncmp( (char*)reader + 9, SCHEMATIC_HEAD_STRING, - sizeof( SCHEMATIC_HEAD_STRING ) - 1 ) != 0 ) - { - msgDiag.Printf( _( "'%s' is NOT an Eeschema file!" ), GetChars( aFullFileName ) ); - DisplayError( this, msgDiag ); - return false; - } - - line = reader.Line(); - - // get the file version here. - char *strversion = line + 9 + sizeof( SCHEMATIC_HEAD_STRING ); - - // Skip blanks - while( *strversion && *strversion < '0' ) - strversion++; - - int version = atoi( strversion ); - - if( version > EESCHEMA_VERSION ) - { - msgDiag.Printf( _( - "'%s' was created by a more recent version of Eeschema and may not" - " load correctly. Please consider updating!" ), - GetChars( aFullFileName ) - ); - DisplayInfoMessage( this, msgDiag ); - } - -#if 0 - // Compile it if the new version is unreadable by previous Eeschema versions - else if( version < EESCHEMA_VERSION ) - { - MsgDiag = aFullFileName + _( " was created by an older version of \ -Eeschema. It will be stored in the new file format when you save this file \ -again." ); - - DisplayInfoMessage( this, MsgDiag ); - } -#endif - - // The next lines are the lib list section, and are mainly comments, like: - // LIBS:power - // the lib list is not used, but is in schematic file just in case. - // It is usually not empty, but we accept empty list. - // If empty, there is a legacy section, not used - // EELAYER i j - // and the last line is - // EELAYER END - // Skip all lines until the end of header "EELAYER END" is found - while( reader.ReadLine() ) - { - line = reader.Line(); - - while( *line == ' ' ) - line++; - - if( strncasecmp( line, "EELAYER END", 11 ) == 0 ) - break; // end of not used header found - } - - while( reader.ReadLine() ) - { - itemLoaded = false; - line = reader.Line(); - - item = NULL; - - char* sline = line; - - while( (*sline != ' ' ) && *sline ) - sline++; - - switch( line[0] ) - { - case '$': // identification block - if( line[1] == 'C' ) - item = new SCH_COMPONENT(); - else if( line[1] == 'S' ) - item = new SCH_SHEET(); - else if( line[1] == 'D' ) - itemLoaded = ReadSchemaDescr( &reader, msgDiag, aScreen ); - else if( line[1] == 'B' ) - item = new SCH_BITMAP(); - else if( line[1] == 'E' ) - itemLoaded = true; // The EOF marker - break; - - case 'L': // Its a library item. - item = new SCH_COMPONENT(); - break; - - case 'W': // Its a Segment (WIRE or BUS) item. - item = new SCH_LINE(); - break; - - case 'E': // Its a WIRE or BUS item. - /* The bus entry can be represented by two different - * classes, so we need a factory function */ - itemLoaded = SCH_BUS_ENTRY_BASE::Load( reader, msgDiag, &item ); - break; - - case 'C': // It is a connection item. - item = new SCH_JUNCTION(); - break; - - case 'K': // It is a Marker item. - // Markers are no more read from file. they are only created on - // demand in schematic - itemLoaded = true; // Just skip descr and disable err message - break; - - case 'N': // It is a NoConnect item. - item = new SCH_NO_CONNECT(); - break; - - case 'T': // It is a text item. - if( sscanf( sline, "%255s", name1 ) != 1 ) - { - msgDiag.Printf( _( "Eeschema file text load error at line %d" ), - reader.LineNumber() ); - itemLoaded = false; - } - else if( name1[0] == 'L' ) - item = new SCH_LABEL(); - else if( name1[0] == 'G' && version > 1 ) - item = new SCH_GLOBALLABEL(); - else if( (name1[0] == 'H') || (name1[0] == 'G' && version == 1) ) - item = new SCH_HIERLABEL(); - else - item = new SCH_TEXT(); - break; - - default: - itemLoaded = false; - msgDiag.Printf( _( "Eeschema file undefined object at line %d, aborted" ), - reader.LineNumber() ); - msgDiag << wxT( "\n" ) << FROM_UTF8( line ); - } - - if( item ) - { - // Load it if it wasn't by a factory - if( !itemLoaded ) - itemLoaded = item->Load( reader, msgDiag ); - - if( !itemLoaded ) - { - delete item; - } - else - { - aScreen->Append( item ); - } - } - - if( !itemLoaded ) - { - msgDiag.Printf( _( "Eeschema file object not loaded at line %d, aborted" ), - reader.LineNumber() ); - msgDiag << wxT( "\n" ) << FROM_UTF8( line ); - DisplayError( this, msgDiag ); - break; - } - } - -#if 0 && defined (DEBUG) - aScreen->Show( 0, std::cout ); -#endif - - // Build links between each components and its part lib LIB_PART - aScreen->UpdateSymbolLinks(); - - aScreen->TestDanglingEnds(); - - msgDiag.Printf( _( "Done Loading <%s>" ), GetChars( aScreen->GetFileName() ) ); - PrintMsg( msgDiag ); - - return true; // Although it may be that file is only partially loaded. -} - - -/// Get the length of a string constant, at compile time -#define SZ( x ) (sizeof(x)-1) - -static const char delims[] = " \t\r\n"; - -/* Read the schematic header. */ -bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* aScreen ) -{ - char* line = aLine->Line(); - - char* pageType = strtok( line + SZ( "$Descr" ), delims ); - char* width = strtok( NULL, delims ); - char* height = strtok( NULL, delims ); - char* orient = strtok( NULL, delims ); - - wxString pagename = FROM_UTF8( pageType ); - - PAGE_INFO pageInfo; - TITLE_BLOCK tb; - - if( !pageInfo.SetType( pagename ) ) - { - aMsgDiag.Printf( _( "Eeschema file dimension definition error line %d," - "\nAbort reading file.\n" ), - aLine->LineNumber() ); - aMsgDiag << FROM_UTF8( line ); - } - - if( pagename == PAGE_INFO::Custom ) - { - if( width && height ) - { - int w = atoi( width ); - int h = atoi( height ); - - pageInfo.SetWidthMils( w ); - pageInfo.SetHeightMils( h ); - } - } - - // non custom size, set portrait if its present - else if( orient && !strcmp( orient, "portrait" ) ) - { - pageInfo.SetPortrait( true ); - } - - aScreen->SetPageSettings( pageInfo ); - - for(;;) - { - char buf[1024]; - - if( !aLine->ReadLine() ) - return true; - - line = aLine->Line(); - - if( strncasecmp( line, "$End", 4 ) == 0 ) - { - aScreen->SetTitleBlock( tb ); - break; - } - - if( strncasecmp( line, "Sheet", 2 ) == 0 ) - sscanf( line + 5, " %d %d", - &aScreen->m_ScreenNumber, &aScreen->m_NumberOfScreens ); - - if( strncasecmp( line, "Title", 2 ) == 0 ) - { - ReadDelimitedText( buf, line, 256 ); - tb.SetTitle( FROM_UTF8( buf ) ); - continue; - } - - if( strncasecmp( line, "Date", 2 ) == 0 ) - { - ReadDelimitedText( buf, line, 256 ); - tb.SetDate( FROM_UTF8( buf ) ); - continue; - } - - if( strncasecmp( line, "Rev", 2 ) == 0 ) - { - ReadDelimitedText( buf, line, 256 ); - tb.SetRevision( FROM_UTF8( buf ) ); - continue; - } - - if( strncasecmp( line, "Comp", 4 ) == 0 ) - { - ReadDelimitedText( buf, line, 256 ); - tb.SetCompany( FROM_UTF8( buf ) ); - continue; - } - - if( strncasecmp( line, "Comment1", 8 ) == 0 ) - { - ReadDelimitedText( buf, line, 256 ); - tb.SetComment1( FROM_UTF8( buf ) ); - continue; - } - - if( strncasecmp( line, "Comment2", 8 ) == 0 ) - { - ReadDelimitedText( buf, line, 256 ); - tb.SetComment2( FROM_UTF8( buf ) ); - continue; - } - - if( strncasecmp( line, "Comment3", 8 ) == 0 ) - { - ReadDelimitedText( buf, line, 256 ); - tb.SetComment3( FROM_UTF8( buf ) ); - continue; - } - - if( strncasecmp( line, "Comment4", 8 ) == 0 ) - { - ReadDelimitedText( buf, line, 256 ); - tb.SetComment4( FROM_UTF8( buf ) ); - continue; - } - } - - return true; -} diff --git a/eeschema/sch_bitmap.cpp b/eeschema/sch_bitmap.cpp index 25da8498ad..73cef116f5 100644 --- a/eeschema/sch_bitmap.cpp +++ b/eeschema/sch_bitmap.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2011 jean-pierre.charras - * Copyright (C) 2011 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2011-2017 KiCad Developers, see change_log.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 @@ -37,11 +37,6 @@ #include -/* - * class SCH_BITMAP - * This class handle a bitmap image that can be inserted in a schematic. - */ - SCH_BITMAP::SCH_BITMAP( const wxPoint& pos ) : SCH_ITEM( NULL, SCH_BITMAP_T ) { @@ -88,34 +83,6 @@ bool SCH_BITMAP::ReadImageFile( const wxString& aFullFilename ) } -bool SCH_BITMAP::Save( FILE* aFile ) const -{ - if( fprintf( aFile, "$Bitmap\n" ) == EOF ) - return false; - - if( fprintf( aFile, "Pos %-4d %-4d\n", m_pos.x, m_pos.y ) == EOF ) - return false; - - if( fprintf( aFile, "Scale %f\n", m_image->GetScale() ) == EOF ) - return false; - - if( fprintf( aFile, "Data\n" ) == EOF ) - return false; - - if( !m_image->SaveData( aFile ) ) - return false; - - if( fprintf( aFile, "\nEndData\n" ) == EOF ) - return false; - - - if( fprintf( aFile, "$EndBitmap\n" ) == EOF ) - return false; - - return true; -} - - EDA_ITEM* SCH_BITMAP::Clone() const { return new SCH_BITMAP( *this ); @@ -134,52 +101,6 @@ void SCH_BITMAP::SwapData( SCH_ITEM* aItem ) } -bool SCH_BITMAP::Load( LINE_READER& aLine, wxString& aErrorMsg ) -{ - char* line = aLine.Line(); - - if( strncasecmp( line, "$Bitmap", 7 ) != 0 ) - { - aErrorMsg.Printf( wxT( "Eeschema file bitmap image load error at line %d, aborted" ), - aLine.LineNumber() ); - aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine ); - return false; - } - - for( ; ; ) - { - if( !aLine.ReadLine() ) - return false; - - line = aLine.Line(); - - if( strncasecmp( line, "Pos", 3 ) == 0 ) - { - sscanf( line + 3, "%d %d", &m_pos.x, &m_pos.y ); - continue; - } - - if( strncasecmp( line, "Scale", 5 ) == 0 ) - { - double scale = 1.0; - sscanf( line + 5, "%lf", &scale ); - m_image->SetScale( scale ); - continue; - } - - if( strncasecmp( line, "Data", 4 ) == 0 ) - { - m_image->LoadData( aLine, aErrorMsg ); - } - - if( strncasecmp( line, "$EndBitmap", 4 ) == 0 ) - break; - } - - return true; -} - - const EDA_RECT SCH_BITMAP::GetBoundingBox() const { EDA_RECT rect = m_image->GetBoundingBox(); @@ -222,18 +143,12 @@ void SCH_BITMAP::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset } -/* Function GetSize - * returns the actual size (in user units, not in pixels) of the image - */ wxSize SCH_BITMAP::GetSize() const { return m_image->GetSize(); } -/* - * Mirror image relative to a horizontal X axis ) - */ void SCH_BITMAP::MirrorX( int aXaxis_position ) { MIRROR( m_pos.y, aXaxis_position ); @@ -241,9 +156,6 @@ void SCH_BITMAP::MirrorX( int aXaxis_position ) } -/* - * Mirror image relative to a vertical Y axis - */ void SCH_BITMAP::MirrorY( int aYaxis_position ) { MIRROR( m_pos.x, aYaxis_position ); diff --git a/eeschema/sch_bitmap.h b/eeschema/sch_bitmap.h index a3eef7573c..2c9283ef2c 100644 --- a/eeschema/sch_bitmap.h +++ b/eeschema/sch_bitmap.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2011 jean-pierre.charras - * Copyright (C) 2011 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2011-2017 KiCad Developers, see change_log.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 @@ -35,6 +35,10 @@ #include +/** + * Object to handle a bitmap image that can be inserted in a schematic. + */ + class SCH_BITMAP : public SCH_ITEM { wxPoint m_pos; // XY coordinates of center of the bitmap @@ -66,7 +70,6 @@ public: } /** - * Function GetScalingFactor * @return the scaling factor from pixel size to actual draw size * this scaling factor depend on m_pixelScaleFactor and m_Scale * m_pixelScaleFactor gives the scaling factor between a pixel size and @@ -89,8 +92,7 @@ public: /** - * Function GetSize - * @returns the actual size (in user units, not in pixels) of the image + * @return the actual size (in user units, not in pixels) of the image */ wxSize GetSize() const; @@ -102,18 +104,14 @@ public: GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override; /** - * Function ReadImageFile * Reads and stores an image file. Init the bitmap used to draw this item * format. + * * @param aFullFilename The full filename of the image file to read. * @return bool - true if success reading else false. */ bool ReadImageFile( const wxString& aFullFilename ); - bool Save( FILE* aFile ) const override; - - bool Load( LINE_READER& aLine, wxString& aErrorMsg ) override; - void Move( const wxPoint& aMoveVector ) override { m_pos += aMoveVector; diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index ea9e0763c8..9291b3963d 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -94,67 +94,6 @@ void SCH_BUS_ENTRY_BASE::SwapData( SCH_ITEM* aItem ) } -bool SCH_BUS_WIRE_ENTRY::Save( FILE* aFile ) const -{ - if( fprintf( aFile, "Entry Wire Line\n\t%-4d %-4d %-4d %-4d\n", - m_pos.x, m_pos.y, m_End().x, m_End().y ) == EOF ) - return false; - return true; -} - - -bool SCH_BUS_BUS_ENTRY::Save( FILE* aFile ) const -{ - if( fprintf( aFile, "Entry Bus Bus\n\t%-4d %-4d %-4d %-4d\n", - m_pos.x, m_pos.y, m_End().x, m_End().y ) == EOF ) - return false; - return true; -} - - -bool SCH_BUS_ENTRY_BASE::Load( LINE_READER& aLine, wxString& aErrorMsg, - SCH_ITEM **out ) -{ - char Name1[256]; - char Name2[256]; - char* line = (char*) aLine; - *out = NULL; - - while( (*line != ' ' ) && *line ) - line++; - - if( sscanf( line, "%255s %255s", Name1, Name2 ) != 2 ) - { - aErrorMsg.Printf( wxT( "Eeschema file bus entry load error at line %d" ), - aLine.LineNumber() ); - aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine ); - return false; - } - - SCH_BUS_ENTRY_BASE *this_new; - if( Name1[0] == 'B' ) - this_new = new SCH_BUS_BUS_ENTRY; - else - this_new = new SCH_BUS_WIRE_ENTRY; - *out = this_new; - - if( !aLine.ReadLine() || sscanf( (char*) aLine, "%d %d %d %d ", - &this_new->m_pos.x, &this_new->m_pos.y, - &this_new->m_size.x, &this_new->m_size.y ) != 4 ) - { - aErrorMsg.Printf( wxT( "Eeschema file bus entry load error at line %d" ), - aLine.LineNumber() ); - aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine ); - return false; - } - - this_new->m_size.x -= this_new->m_pos.x; - this_new->m_size.y -= this_new->m_pos.y; - - return true; -} - - const EDA_RECT SCH_BUS_ENTRY_BASE::GetBoundingBox() const { EDA_RECT box; @@ -374,10 +313,7 @@ void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter ) aPlotter->FinishTo( m_End() ); } -/* SetBusEntryShape: - * Set the shape of the bus entry. - * aShape = ascii code '/' or '\' - */ + void SCH_BUS_ENTRY_BASE::SetBusEntryShape( char aShape ) { switch( aShape ) @@ -395,9 +331,6 @@ void SCH_BUS_ENTRY_BASE::SetBusEntryShape( char aShape ) } -/* GetBusEntryShape: - * return the shape of the bus entry, as an ascii code '/' or '\' - */ char SCH_BUS_ENTRY_BASE::GetBusEntryShape() const { if( GetSize().y < 0 ) @@ -405,4 +338,3 @@ char SCH_BUS_ENTRY_BASE::GetBusEntryShape() const else return '\\'; } - diff --git a/eeschema/sch_bus_entry.h b/eeschema/sch_bus_entry.h index df073d9f8b..d96dc97417 100644 --- a/eeschema/sch_bus_entry.h +++ b/eeschema/sch_bus_entry.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2004-2017 KiCad Developers, see change_log.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 @@ -36,8 +36,6 @@ /** - * Class SCH_BUS_ENTRY_BASE - * * Base class for a bus or wire entry. */ class SCH_BUS_ENTRY_BASE : public SCH_ITEM @@ -85,8 +83,6 @@ public: void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override; - static bool Load( LINE_READER& aLine, wxString& aErrorMsg, SCH_ITEM **out ); - const EDA_RECT GetBoundingBox() const override; void Move( const wxPoint& aMoveVector ) override @@ -131,8 +127,6 @@ public: }; /** - * Class SCH_BUS_WIRE_ENTRY - * * Class for a wire to bus entry. */ class SCH_BUS_WIRE_ENTRY : public SCH_BUS_ENTRY_BASE @@ -147,8 +141,6 @@ public: return wxT( "SCH_BUS_WIRE_ENTRY" ); } - bool Save( FILE* aFile ) const override; - int GetPenSize() const override; wxString GetSelectMenuText() const override; @@ -157,8 +149,6 @@ public: }; /** - * Class SCH_BUS_WIRE_ENTRY - * * Class for a bus to bus entry. */ class SCH_BUS_BUS_ENTRY : public SCH_BUS_ENTRY_BASE @@ -173,8 +163,6 @@ public: return wxT( "SCH_BUS_BUS_ENTRY" ); } - bool Save( FILE* aFile ) const override; - int GetPenSize() const override; wxString GetSelectMenuText() const override; diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index c293f06a1c..482c91f1ce 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -1255,442 +1255,6 @@ void SCH_COMPONENT::Show( int nestLevel, std::ostream& os ) const #endif -bool SCH_COMPONENT::Save( FILE* f ) const -{ - std::string name1; - std::string name2; - wxArrayString reference_fields; - - static wxString delimiters( wxT( " " ) ); - - // this is redundant with the AR entries below, but it makes the - // files backwards-compatible. - if( m_PathsAndReferences.GetCount() > 0 ) - { - reference_fields = wxStringTokenize( m_PathsAndReferences[0], delimiters ); - - name1 = toUTFTildaText( reference_fields[1] ); - } - else - { - if( GetField( REFERENCE )->GetText().IsEmpty() ) - name1 = toUTFTildaText( m_prefix ); - else - name1 = toUTFTildaText( GetField( REFERENCE )->GetText() ); - } - - wxString part_name = GetLibId().Format(); - - if( part_name.size() ) - { - name2 = toUTFTildaText( part_name ); - } - else - { - name2 = NULL_STRING; - } - - if( fprintf( f, "$Comp\n" ) == EOF ) - return false; - - if( fprintf( f, "L %s %s\n", name2.c_str(), name1.c_str() ) == EOF ) - return false; - - // Generate unit number, convert and time stamp - if( fprintf( f, "U %d %d %8.8lX\n", m_unit, m_convert, (unsigned long)m_TimeStamp ) == EOF ) - return false; - - // Save the position - if( fprintf( f, "P %d %d\n", m_Pos.x, m_Pos.y ) == EOF ) - return false; - - /* If this is a complex hierarchy; save hierarchical references. - * but for simple hierarchies it is not necessary. - * the reference inf is already saved - * this is useful for old Eeschema version compatibility - */ - if( m_PathsAndReferences.GetCount() > 1 ) - { - for( unsigned int ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ ) - { - /*format: - * AR Path="/140/2" Ref="C99" Part="1" - * where 140 is the uid of the containing sheet - * and 2 is the timestamp of this component. - * (timestamps are actually 8 hex chars) - * Ref is the conventional component reference for this 'path' - * Part is the conventional component part selection for this 'path' - */ - reference_fields = wxStringTokenize( m_PathsAndReferences[ii], delimiters ); - - if( fprintf( f, "AR Path=\"%s\" Ref=\"%s\" Part=\"%s\" \n", - TO_UTF8( reference_fields[0] ), - TO_UTF8( reference_fields[1] ), - TO_UTF8( reference_fields[2] ) ) == EOF ) - return false; - } - } - - // update the ugly field index, which I would like to see go away someday soon. - for( unsigned i = 0; iSetId( i ); // we don't need field Ids, please be gone. - } - - // Fixed fields: - // Save mandatory fields even if they are blank, - // because the visibility, size and orientation are set from libary editor. - for( unsigned i = 0; iSave( f ) ) - return false; - } - - // User defined fields: - // The *policy* about which user defined fields are part of a symbol is now - // only in the dialog editors. No policy should be enforced here, simply - // save all the user defined fields, they are present because a dialog editor - // thought they should be. If you disagree, go fix the dialog editors. - for( unsigned i = MANDATORY_FIELDS; iSave( f ) ) - return false; - } - - // Unit number, position, box ( old standard ) - if( fprintf( f, "\t%-4d %-4d %-4d\n", m_unit, m_Pos.x, m_Pos.y ) == EOF ) - return false; - - if( fprintf( f, "\t%-4d %-4d %-4d %-4d\n", - m_transform.x1, m_transform.y1, m_transform.x2, m_transform.y2 ) == EOF ) - return false; - - if( fprintf( f, "$EndComp\n" ) == EOF ) - return false; - - return true; -} - - -bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg ) -{ - // Remark: avoid using sscanf to read texts entered by user - // which are UTF8 encoded, because sscanf does not work well on Windows - // with some UTF8 values. - char name1[256], char1[256], char2[256], char3[256]; - int newfmt = 0; - char* ptcar; - wxString fieldName; - char* line = aLine.Line(); - unsigned long timeStamp; - - m_convert = 1; - - if( line[0] == '$' ) - { - newfmt = 1; - - if( !(line = aLine.ReadLine()) ) - return true; - } - - // Parse the first line of description: - // like "L partname ref" (for instance "L 74LS00 U4" - // They are UTF8 texts, so do not use sscanf - - line += 1; - - if( *line == ' ' ) - line++; - - // line points the first parameter - wxString buffer( FROM_UTF8( line ) ); - wxStringTokenizer tokenizer( buffer, wxT( " \r\n" ) ); - - if( tokenizer.CountTokens() < 2 ) - { - aErrorMsg.Printf( wxT( "Eeschema component description error at line %d, aborted" ), - aLine.LineNumber() ); - aErrorMsg << wxT( "\n" ) << FROM_UTF8( line ); - return false; - } - - wxString partname = tokenizer.NextToken(); - partname.Replace( wxT("~"), wxT(" ") ); // all spaces were replaced by ~ in files. - - if( partname != NULL_STRING ) - { - m_lib_id.SetLibItemName( partname, false ); - - if( !newfmt ) - GetField( VALUE )->SetText( partname ); - } - else - { - m_lib_id.clear(); - GetField( VALUE )->Empty(); - GetField( VALUE )->SetTextAngle( TEXT_ANGLE_HORIZ ); - GetField( VALUE )->SetVisible( false ); - } - - wxString reference = tokenizer.NextToken(); - reference.Replace( wxT("~"), wxT(" ") ); // all spaces were replaced by ~ in files. - reference.Trim( true ); - reference.Trim( false ); - - if( reference != NULL_STRING ) - { - wxString prefix = reference; - // Build reference prefix from the actual reference by removing trailing digits - // (Perhaps outdated code, only for very old schematic files) - while( prefix.Length() ) - { - if( ( prefix.Last() < '0' || prefix.Last() > '9') && prefix.Last() != '?' ) - break; - - prefix.RemoveLast(); - } - - // Avoid a prefix containing trailing/leading spaces - prefix.Trim( true ); - prefix.Trim( false ); - - if( prefix.IsEmpty() ) - m_prefix = wxT( "U" ); - else - m_prefix = prefix; - - if( !newfmt ) - GetField( REFERENCE )->SetText( reference ); - } - else - { - GetField( REFERENCE )->SetVisible( false ); - } - - /* Parse component description - * These lines begin with: - * "P" = Position - * U = Num Unit and Conversion - * "Fn" = Fields (0 .. n = = number of field) - * "Ar" = Alternate reference in the case of multiple sheets referring to - * one schematic file. - */ - for( ; ; ) - { - if( !(line = aLine.ReadLine()) ) - return false; - - if( line[0] == 'U' ) - { - sscanf( line + 1, "%d %d %lX", &m_unit, &m_convert, &timeStamp ); - m_TimeStamp = (time_t)timeStamp; - } - else if( line[0] == 'P' ) - { - sscanf( line + 1, "%d %d", &m_Pos.x, &m_Pos.y ); - - // Set fields position to a default position (that is the - // component position. For existing fields, the real position - // will be set later - for( int i = 0; iGetText().IsEmpty() ) - GetField( i )->SetTextPos( m_Pos ); - } - } - else if( line[0] == 'A' && line[1] == 'R' ) - { - /* format: - * AR Path="/9086AF6E/67452AA0" Ref="C99" Part="1" - * where 9086AF6E is the unique timestamp of the containing sheet - * and 67452AA0 is the timestamp of this component. - * C99 is the reference given this path. - */ - int ii; - ptcar = line + 2; - - //copy the path. - ii = ReadDelimitedText( name1, ptcar, 255 ); - ptcar += ii + 1; - wxString path = FROM_UTF8( name1 ); - - // copy the reference - ii = ReadDelimitedText( name1, ptcar, 255 ); - ptcar += ii + 1; - wxString ref = FROM_UTF8( name1 ); - - // copy the multi, if exists - ii = ReadDelimitedText( name1, ptcar, 255 ); - - if( name1[0] == 0 ) // Nothing read, put a default value - sprintf( name1, "%d", m_unit ); - - int multi = atoi( name1 ); - - // Avoid out of range multi id: - if( multi < 0 || multi > MAX_UNIT_COUNT_PER_PACKAGE ) - multi = 1; - - AddHierarchicalReference( path, ref, multi ); - GetField( REFERENCE )->SetText( ref ); - } - else if( line[0] == 'F' ) - { - int fieldNdx; - - wxString fieldText; - EDA_TEXT_HJUSTIFY_T hjustify = GR_TEXT_HJUSTIFY_CENTER; - EDA_TEXT_VJUSTIFY_T vjustify = GR_TEXT_VJUSTIFY_CENTER; - - ptcar = (char*) aLine; - - while( *ptcar && (*ptcar != '"') ) - ptcar++; - - if( *ptcar != '"' ) - { - aErrorMsg.Printf( wxT( "Eeschema file library field F at line %d, aborted" ), - aLine.LineNumber() ); - return false; - } - - ptcar += ReadDelimitedText( &fieldText, ptcar ); - - if( *ptcar == 0 ) - { - aErrorMsg.Printf( wxT( "Component field F at line %d, aborted" ), - aLine.LineNumber() ); - return false; - } - - fieldNdx = atoi( line + 2 ); - - ReadDelimitedText( &fieldName, ptcar ); - - if( fieldName.IsEmpty() ) - fieldName = TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldNdx ); - - if( fieldNdx >= GetFieldCount() ) - { - // The first MANDATOR_FIELDS _must_ be constructed within - // the SCH_COMPONENT constructor. This assert is simply here - // to guard against a change in that constructor. - wxASSERT( GetFieldCount() >= MANDATORY_FIELDS ); - - // Ignore the _supplied_ fieldNdx. It is not important anymore - // if within the user defined fields region (i.e. >= MANDATORY_FIELDS). - // We freely renumber the index to fit the next available field slot. - - fieldNdx = GetFieldCount(); // new has this index after insertion - - SCH_FIELD field( wxPoint( 0, 0 ), - -1, // field id is not relavant for user defined fields - this, fieldName ); - - AddField( field ); - } - else - { - GetField( fieldNdx )->SetName( fieldName ); - } - - GetField( fieldNdx )->SetText( fieldText ); - memset( char3, 0, sizeof(char3) ); - int ii, x, y, w, attr; - - if( ( ii = sscanf( ptcar, "%255s %d %d %d %X %255s %255s", char1, &x, &y, &w, &attr, - char2, char3 ) ) < 4 ) - { - aErrorMsg.Printf( wxT( "Component Field error line %d, aborted" ), - aLine.LineNumber() ); - continue; - } - - GetField( fieldNdx )->SetTextPos( wxPoint( x, y ) ); - GetField( fieldNdx )->SetVisible( !attr ); - - if( (w == 0 ) || (ii == 4) ) - w = GetDefaultTextSize(); - - GetField( fieldNdx )->SetTextSize( wxSize( w, w ) ); - GetField( fieldNdx )->SetTextAngle( TEXT_ANGLE_HORIZ ); - - if( char1[0] == 'V' ) - GetField( fieldNdx )->SetTextAngle( TEXT_ANGLE_VERT ); - - if( ii >= 7 ) - { - if( *char2 == 'L' ) - hjustify = GR_TEXT_HJUSTIFY_LEFT; - else if( *char2 == 'R' ) - hjustify = GR_TEXT_HJUSTIFY_RIGHT; - - if( char3[0] == 'B' ) - vjustify = GR_TEXT_VJUSTIFY_BOTTOM; - else if( char3[0] == 'T' ) - vjustify = GR_TEXT_VJUSTIFY_TOP; - - GetField( fieldNdx )->SetItalic( char3[1] == 'I' ); - GetField( fieldNdx )->SetBold( char3[2] == 'B' ); - GetField( fieldNdx )->SetHorizJustify( hjustify ); - GetField( fieldNdx )->SetVertJustify( vjustify ); - } - - if( fieldNdx == REFERENCE ) - if( GetField( fieldNdx )->GetText()[0] == '#' ) - GetField( fieldNdx )->SetVisible( false ); - } - else - { - break; - } - } - - if( sscanf( line, "%d %d %d", &m_unit, &m_Pos.x, &m_Pos.y ) != 3 ) - { - aErrorMsg.Printf( wxT( "Component unit & pos error at line %d, aborted" ), - aLine.LineNumber() ); - return false; - } - - if( !(line = aLine.ReadLine()) || - sscanf( line, "%d %d %d %d", - &m_transform.x1, - &m_transform.y1, - &m_transform.x2, - &m_transform.y2 ) != 4 ) - { - aErrorMsg.Printf( wxT( "Component orient error at line %d, aborted" ), - aLine.LineNumber() ); - return false; - } - - if( newfmt ) - { - if( !(line = aLine.ReadLine()) ) - return false; - - if( strncasecmp( "$End", line, 4 ) != 0 ) - { - aErrorMsg.Printf( wxT( "Component End expected at line %d, aborted" ), - aLine.LineNumber() ); - return false; - } - } - - // ensure flags (mainly used in edit) are cleared. - // some changes have set the modified flag - m_Flags = 0; - - return true; -} - - EDA_RECT SCH_COMPONENT::GetBodyBoundingBox() const { EDA_RECT bBox; diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h index 1034eec450..4962f48cf0 100644 --- a/eeschema/sch_component.h +++ b/eeschema/sch_component.h @@ -3,7 +3,7 @@ * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2014 Dick Hollenbeck, dick@softplc.com - * Copyright (C) 2015-2017 Wayne Stambaugh + * Copyright (C) 2015 Wayne Stambaugh * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -238,10 +238,6 @@ public: */ int GetUnitCount() const; - bool Save( FILE* aFile ) const override; - - bool Load( LINE_READER& aLine, wxString& aErrorMsg ) override; - /** * Compute the new transform matrix based on \a aOrientation for the symbol which is * applied to the current transform. diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index 83da6fdd1f..e05854cee7 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -311,54 +311,6 @@ bool SCH_FIELD::IsHorizJustifyFlipped() const } -bool SCH_FIELD::Save( FILE* aFile ) const -{ - char hjustify = 'C'; - - if( GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT ) - hjustify = 'L'; - else if( GetHorizJustify() == GR_TEXT_HJUSTIFY_RIGHT ) - hjustify = 'R'; - - char vjustify = 'C'; - - if( GetVertJustify() == GR_TEXT_VJUSTIFY_BOTTOM ) - vjustify = 'B'; - else if( GetVertJustify() == GR_TEXT_VJUSTIFY_TOP ) - vjustify = 'T'; - - if( fprintf( aFile, "F %d %s %c %-3d %-3d %-3d %4.4X %c %c%c%c", - m_id, - EscapedUTF8( m_Text ).c_str(), // wraps in quotes too - GetTextAngle() == TEXT_ANGLE_HORIZ ? 'H' : 'V', - GetTextPos().x, GetTextPos().y, - GetTextWidth(), - !IsVisible(), - hjustify, vjustify, - IsItalic() ? 'I' : 'N', - IsBold() ? 'B' : 'N' ) == EOF ) - { - return false; - } - - // Save field name, if the name is user definable - if( m_id >= FIELD1 ) - { - if( fprintf( aFile, " %s", EscapedUTF8( m_name ).c_str() ) == EOF ) - { - return false; - } - } - - if( fprintf( aFile, "\n" ) == EOF ) - { - return false; - } - - return true; -} - - void SCH_FIELD::Place( SCH_EDIT_FRAME* frame, wxDC* DC ) { frame->GetCanvas()->SetMouseCapture( NULL, NULL ); diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h index fc13b01d4f..7d48701035 100644 --- a/eeschema/sch_field.h +++ b/eeschema/sch_field.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2004-2017 KiCad Developers, see change_log.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 @@ -143,8 +143,6 @@ public: void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override; - bool Save( FILE* aFile ) const override; - // Geometric transforms (used in block operations): void Move( const wxPoint& aMoveVector ) override diff --git a/eeschema/sch_item_struct.h b/eeschema/sch_item_struct.h index 48409040ed..9d696e7bbc 100644 --- a/eeschema/sch_item_struct.h +++ b/eeschema/sch_item_struct.h @@ -222,14 +222,6 @@ public: */ virtual void Rotate( wxPoint aPosition ) = 0; - /** - * Function Save - * writes the data structures for this object out to a FILE in "*.sch" format. - * @param aFile The FILE to write to. - * @return bool - true if success writing else false. - */ - virtual bool Save( FILE* aFile ) const = 0; - /** * Function Load * reads a schematic item from \a aLine in a .sch file. diff --git a/eeschema/sch_junction.cpp b/eeschema/sch_junction.cpp index fb5f89760c..93e2067cb7 100644 --- a/eeschema/sch_junction.cpp +++ b/eeschema/sch_junction.cpp @@ -50,19 +50,6 @@ SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos ) : } -bool SCH_JUNCTION::Save( FILE* aFile ) const -{ - bool success = true; - - if( fprintf( aFile, "Connection ~ %-4d %-4d\n", m_pos.x, m_pos.y ) == EOF ) - { - success = false; - } - - return success; -} - - EDA_ITEM* SCH_JUNCTION::Clone() const { return new SCH_JUNCTION( *this ); @@ -79,26 +66,6 @@ void SCH_JUNCTION::SwapData( SCH_ITEM* aItem ) } -bool SCH_JUNCTION::Load( LINE_READER& aLine, wxString& aErrorMsg ) -{ - char name[256]; - char* line = (char*) aLine; - - while( (*line != ' ' ) && *line ) - line++; - - if( sscanf( line, "%255s %d %d", name, &m_pos.x, &m_pos.y ) != 3 ) - { - aErrorMsg.Printf( wxT( "Eeschema file connection load error at line %d, aborted" ), - aLine.LineNumber() ); - aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine ); - return false; - } - - return true; -} - - const EDA_RECT SCH_JUNCTION::GetBoundingBox() const { EDA_RECT rect; @@ -235,6 +202,7 @@ void SCH_JUNCTION::Plot( PLOTTER* aPlotter ) aPlotter->Circle( m_pos, GetSymbolSize(), FILLED_SHAPE ); } + BITMAP_DEF SCH_JUNCTION::GetMenuImage() const { return add_junction_xpm; diff --git a/eeschema/sch_junction.h b/eeschema/sch_junction.h index bd3133b6de..5e6ccbbb75 100644 --- a/eeschema/sch_junction.h +++ b/eeschema/sch_junction.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2017 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 @@ -60,10 +60,6 @@ public: void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override; - bool Save( FILE* aFile ) const override; - - bool Load( LINE_READER& aLine, wxString& aErrorMsg ) override; - void Move( const wxPoint& aMoveVector ) override { m_pos += aMoveVector; diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index ff49d67430..cac70ec01e 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -201,72 +201,6 @@ double SCH_LINE::GetLength() const } -bool SCH_LINE::Save( FILE* aFile ) const -{ - bool success = true; - - const char* layer = "Notes"; - const char* width = "Line"; - - if( GetLayer() == LAYER_WIRE ) - layer = "Wire"; - - if( GetLayer() == LAYER_BUS ) - layer = "Bus"; - - if( fprintf( aFile, "Wire %s %s\n", layer, width ) == EOF ) - { - success = false; - } - - if( fprintf( aFile, "\t%-4d %-4d %-4d %-4d\n", m_start.x, m_start.y, - m_end.x, m_end.y ) == EOF ) - { - success = false; - } - - return success; -} - - -bool SCH_LINE::Load( LINE_READER& aLine, wxString& aErrorMsg ) -{ - char Name1[256]; - char Name2[256]; - char* line = (char*) aLine; - - while( (*line != ' ' ) && *line ) - line++; - - if( sscanf( line, "%255s %255s", Name1, Name2 ) != 2 ) - { - aErrorMsg.Printf( wxT( "Eeschema file segment error at line %d, aborted" ), - aLine.LineNumber() ); - aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine ); - return false; - } - - m_Layer = LAYER_NOTES; - - if( Name1[0] == 'W' ) - m_Layer = LAYER_WIRE; - - if( Name1[0] == 'B' ) - m_Layer = LAYER_BUS; - - if( !aLine.ReadLine() || sscanf( (char*) aLine, "%d %d %d %d ", - &m_start.x, &m_start.y, &m_end.x, &m_end.y ) != 4 ) - { - aErrorMsg.Printf( wxT( "Eeschema file Segment struct error at line %d, aborted" ), - aLine.LineNumber() ); - aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine ); - return false; - } - - return true; -} - - COLOR4D SCH_LINE::GetDefaultColor() const { return GetLayerColor( m_Layer ); @@ -418,10 +352,6 @@ void SCH_LINE::Rotate( wxPoint aPosition ) } -/* - * MergeOverlap try to merge 2 lines that are colinear. - * this function expects these 2 lines have at least a common end - */ bool SCH_LINE::MergeOverlap( SCH_LINE* aLine ) { auto less = []( const wxPoint& lhs, const wxPoint& rhs ) -> bool @@ -618,9 +548,9 @@ wxString SCH_LINE::GetSelectMenuText() const wxString menuText, txtfmt, orient; if( m_start.x == m_end.x ) - orient = _("Vert."); + orient = _( "Vert." ); else if( m_start.y == m_end.y ) - orient = _("Horiz."); + orient = _( "Horiz." ); switch( m_Layer ) { diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h index 7381c11f15..ac84a2a6c8 100644 --- a/eeschema/sch_line.h +++ b/eeschema/sch_line.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2017 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 @@ -35,9 +35,8 @@ class NETLIST_OBJECT_LIST; /** - * Class SCH_LINE - * is a segment description base class to describe items which have 2 end - * points (track, wire, draw line ...) + * Segment description base class to describe items which have 2 end points (track, wire, + * draw line ...) */ class SCH_LINE : public SCH_ITEM { @@ -121,10 +120,6 @@ public: void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override; - bool Save( FILE* aFile ) const override; - - bool Load( LINE_READER& aLine, wxString& aErrorMsg ) override; - int GetPenSize() const override; void Move( const wxPoint& aMoveVector ) override; diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp index ff817df5f3..e2234bd2f8 100644 --- a/eeschema/sch_marker.cpp +++ b/eeschema/sch_marker.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2017 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 @@ -39,10 +39,6 @@ #include -/********************/ -/* class SCH_MARKER */ -/********************/ - SCH_MARKER::SCH_MARKER() : SCH_ITEM( NULL, SCH_MARKER_T ), MARKER_BASE() { } @@ -72,17 +68,6 @@ void SCH_MARKER::Show( int nestLevel, std::ostream& os ) const #endif -/** - * Function Save (do nothing : markers are no more saved in files ) - * writes the data structures for this object out to a FILE in "*.brd" format. - * @param aFile The FILE to write to. - * @return bool - true if success writing else false. - */ -bool SCH_MARKER::Save( FILE* aFile ) const -{ - return true; -} - void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor ) @@ -123,13 +108,6 @@ bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData, void* aAuxData, } -/** - * Function GetBoundingBox - * returns the orthogonal, bounding box of this object for display purposes. - * This box should be an enclosing perimeter for visible components of this - * object, and the units should be in the pcb or schematic coordinate system. - * It is OK to overestimate the size by a few counts. - */ const EDA_RECT SCH_MARKER::GetBoundingBox() const { return GetBoundingBoxMarker(); @@ -190,4 +168,3 @@ bool SCH_MARKER::HitTest( const wxPoint& aPosition, int aAccuracy ) const { return HitTestMarker( aPosition ); } - diff --git a/eeschema/sch_marker.h b/eeschema/sch_marker.h index 24c9fcccda..468cc79430 100644 --- a/eeschema/sch_marker.h +++ b/eeschema/sch_marker.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2004-2017 KiCad Developers, see change_log.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 @@ -63,8 +63,6 @@ public: (void) aPlotter; } - bool Save( FILE* aFile ) const override; - EDA_RECT const GetBoundingBox() const override; // Geometric transforms (used in block operations): @@ -82,7 +80,6 @@ public: void Rotate( wxPoint aPosition ) override; /** - * Function Matches, virtual from the base class EDA_ITEM * Compare DRC marker main and auxiliary text against search string. * * @param aSearchData - Criteria to search against. diff --git a/eeschema/sch_no_connect.cpp b/eeschema/sch_no_connect.cpp index 338a737cdb..30abc53bf4 100644 --- a/eeschema/sch_no_connect.cpp +++ b/eeschema/sch_no_connect.cpp @@ -81,39 +81,6 @@ const EDA_RECT SCH_NO_CONNECT::GetBoundingBox() const } -bool SCH_NO_CONNECT::Save( FILE* aFile ) const -{ - bool success = true; - - if( fprintf( aFile, "NoConn ~ %-4d %-4d\n", m_pos.x, m_pos.y ) == EOF ) - { - success = false; - } - - return success; -} - - -bool SCH_NO_CONNECT::Load( LINE_READER& aLine, wxString& aErrorMsg ) -{ - char name[256]; - char* line = (char*) aLine; - - while( (*line != ' ' ) && *line ) - line++; - - if( sscanf( line, "%255s %d %d", name, &m_pos.x, &m_pos.y ) != 3 ) - { - aErrorMsg.Printf( wxT( "Eeschema file No Connect load error at line %d" ), - aLine.LineNumber() ); - aErrorMsg << wxT( "\n" ) << FROM_UTF8( ((char*)aLine) ); - return false; - } - - return true; -} - - void SCH_NO_CONNECT::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) { DANGLING_END_ITEM item( NO_CONNECT_END, this, m_pos ); diff --git a/eeschema/sch_no_connect.h b/eeschema/sch_no_connect.h index 321eedbcae..ef16af485d 100644 --- a/eeschema/sch_no_connect.h +++ b/eeschema/sch_no_connect.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2017 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 @@ -58,10 +58,6 @@ public: void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override; - bool Save( FILE* aFile ) const override; - - bool Load( LINE_READER& aLine, wxString& aErrorMsg ) override; - void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override; const EDA_RECT GetBoundingBox() const override; diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index f7ed67f007..375b91243f 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2008-2016 Wayne Stambaugh + * Copyright (C) 2008 Wayne Stambaugh * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -484,63 +484,6 @@ bool SCH_SCREEN::SchematicCleanUp() } -bool SCH_SCREEN::Save( FILE* aFile ) const -{ - // Creates header - if( fprintf( aFile, "%s %s %d\n", EESCHEMA_FILE_STAMP, - SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION ) < 0 ) - return false; - - for( const PART_LIB& lib : *Prj().SchLibs() ) - { - if( fprintf( aFile, "LIBS:%s\n", TO_UTF8( lib.GetName() ) ) < 0 ) - return false; - } - - // This section is not used, but written for file compatibility - if( fprintf( aFile, "EELAYER %d %d\n", SCH_LAYER_ID_COUNT, 0 ) < 0 - || fprintf( aFile, "EELAYER END\n" ) < 0 ) - return false; - - /* Write page info, ScreenNumber and NumberOfScreen; not very meaningful for - * SheetNumber and Sheet Count in a complex hierarchy, but useful in - * simple hierarchy and flat hierarchy. Used also to search the root - * sheet ( ScreenNumber = 1 ) within the files - */ - const TITLE_BLOCK& tb = GetTitleBlock(); - - if( fprintf( aFile, "$Descr %s %d %d%s\n", TO_UTF8( m_paper.GetType() ), - m_paper.GetWidthMils(), - m_paper.GetHeightMils(), - !m_paper.IsCustom() && m_paper.IsPortrait() ? - " portrait" : "" - ) < 0 - || fprintf( aFile, "encoding utf-8\n") < 0 - || fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreens ) < 0 - || fprintf( aFile, "Title %s\n", EscapedUTF8( tb.GetTitle() ).c_str() ) < 0 - || fprintf( aFile, "Date %s\n", EscapedUTF8( tb.GetDate() ).c_str() ) < 0 - || fprintf( aFile, "Rev %s\n", EscapedUTF8( tb.GetRevision() ).c_str() ) < 0 - || fprintf( aFile, "Comp %s\n", EscapedUTF8( tb.GetCompany() ).c_str() ) < 0 - || fprintf( aFile, "Comment1 %s\n", EscapedUTF8( tb.GetComment1() ).c_str() ) < 0 - || fprintf( aFile, "Comment2 %s\n", EscapedUTF8( tb.GetComment2() ).c_str() ) < 0 - || fprintf( aFile, "Comment3 %s\n", EscapedUTF8( tb.GetComment3() ).c_str() ) < 0 - || fprintf( aFile, "Comment4 %s\n", EscapedUTF8( tb.GetComment4() ).c_str() ) < 0 - || fprintf( aFile, "$EndDescr\n" ) < 0 ) - return false; - - for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() ) - { - if( !item->Save( aFile ) ) - return false; - } - - if( fprintf( aFile, "$EndSCHEMATC\n" ) < 0 ) - return false; - - return true; -} - - void SCH_SCREEN::UpdateSymbolLinks( bool aForce ) { // Initialize or reinitialize the pointer to the LIB_PART for each component @@ -596,10 +539,6 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode } -/* note: SCH_SCREEN::Plot is useful only for schematic. - * library editor and library viewer do not use a draw list, and therefore - * SCH_SCREEN::Plot plots nothing - */ void SCH_SCREEN::Plot( PLOTTER* aPlotter ) { // Ensure links are up to date, even if a library was reloaded for some reason: @@ -1321,13 +1260,8 @@ void SCH_SCREEN::Show( int nestLevel, std::ostream& os ) const #endif -/******************************************************************/ -/* Class SCH_SCREENS to handle the list of screens in a hierarchy */ -/******************************************************************/ - /** - * Function SortByTimeStamp - * sorts a list of schematic items by time stamp and type. + * Sort a list of schematic items by time stamp and type. */ static bool SortByTimeStamp( const EDA_ITEM* item1, const EDA_ITEM* item2 ) { @@ -1647,4 +1581,3 @@ int SCH_SCREENS::ChangeSymbolLibNickname( const wxString& aFrom, const wxString& return cnt; } - diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 8d15918b8d..1276964898 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -144,188 +144,6 @@ SCH_SHEET* SCH_SHEET::GetRootSheet() } -bool SCH_SHEET::Save( FILE* aFile ) const -{ - if( fprintf( aFile, "$Sheet\n" ) == EOF - || fprintf( aFile, "S %-4d %-4d %-4d %-4d\n", - m_pos.x, m_pos.y, m_size.x, m_size.y ) == EOF ) - return false; - - //save the unique timestamp, like other schematic parts. - if( fprintf( aFile, "U %8.8lX\n", (unsigned long) m_TimeStamp ) == EOF ) - return false; - - /* Save schematic sheetname and filename. */ - if( !m_name.IsEmpty() ) - { - if( fprintf( aFile, "F0 %s %d\n", EscapedUTF8( m_name ).c_str(), - m_sheetNameSize ) == EOF ) - return false; - } - - if( !m_fileName.IsEmpty() ) - { - if( fprintf( aFile, "F1 %s %d\n", EscapedUTF8( m_fileName ).c_str(), - m_fileNameSize ) == EOF ) - return false; - } - - /* Save the list of labels in the sheet. */ - - for( const SCH_SHEET_PIN& label : m_pins ) - { - if( !label.Save( aFile ) ) - return false; - } - - if( fprintf( aFile, "$EndSheet\n" ) == EOF ) - return false; - - return true; -} - - -bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg ) -{ - int fieldNdx, size; - SCH_SHEET_PIN* sheetPin; - char* ptcar; - unsigned long timeStamp = 0UL; - - SetTimeStamp( GetNewTimeStamp() ); - - // sheets are added to the GetDrawItems() like other schematic components. - // however, in order to preserve the hierarchy (through m_Parent pointers), - // a duplicate of the sheet is added to m_SubSheet array. - // must be a duplicate, references just work for a two-layer structure. - // this is accomplished through the Sync() function. - - if( ((char*)aLine)[0] == '$' ) // line should be "$Sheet" - { - if( !aLine.ReadLine() ) - { - aErrorMsg.Printf( wxT( "Read File Error" ) ); - return false; - } - } - - /* Next line: must be "S xx yy nn mm" with xx, yy = sheet position - * ( upper left corner ) et nn,mm = sheet size */ - if( ( sscanf( &((char*)aLine)[1], "%d %d %d %d", - &m_pos.x, &m_pos.y, &m_size.x, &m_size.y ) != 4 ) - || ( ((char*)aLine)[0] != 'S' ) ) - { - aErrorMsg.Printf( wxT( " ** Eeschema file sheet struct error at line %d, aborted\n" ), - aLine.LineNumber() ); - - aErrorMsg << FROM_UTF8( ((char*)aLine) ); - return false; - } - - /* Read fields */ - for( ; ; ) /* Analysis of lines "Fn" text. */ - { - if( !aLine.ReadLine() ) - return false; - - if( ((char*)aLine)[0] == 'U' ) - { - sscanf( ((char*)aLine) + 1, "%lX", &timeStamp ); - - m_TimeStamp = (time_t) timeStamp; - - if( m_TimeStamp == 0 ) // zero is not unique! - SetTimeStamp( GetNewTimeStamp() ); - - continue; - } - - if( ((char*)aLine)[0] != 'F' ) - break; - - sscanf( ((char*)aLine) + 1, "%d", &fieldNdx ); - - /* Read the field: - * If fieldNdx> = 2: Fn "text" t s posx posy - * If F0 "text" for SheetName - * F1 and "text" for filename - */ - ptcar = ((char*)aLine); - - while( *ptcar && ( *ptcar != '"' ) ) - ptcar++; - - if( *ptcar != '"' ) - { - aErrorMsg.Printf( wxT( "Eeschema file sheet label F%d at line %d, aborted\n" ), - fieldNdx, aLine.LineNumber() ); - aErrorMsg << FROM_UTF8( (char*) aLine ); - return false; - } - - wxString sheetName; - ptcar += ReadDelimitedText( &sheetName, ptcar ); - - if( *ptcar == 0 ) - { - aErrorMsg.Printf( wxT( "Eeschema file sheet field F at line %d, aborted\n" ), - aLine.LineNumber() ); - aErrorMsg << FROM_UTF8( (char*) aLine ); - return false; - } - - if( ( fieldNdx == 0 ) || ( fieldNdx == 1 ) ) - { - if( sscanf( ptcar, "%d", &size ) != 1 ) - { - aErrorMsg.Printf( wxT( "Eeschema file sheet Label error line %d, aborted\n" ), - aLine.LineNumber() ); - - aErrorMsg << FROM_UTF8( (char*) aLine ); - } - - if( size == 0 ) - size = GetDefaultTextSize(); - - if( fieldNdx == 0 ) - { - m_name = sheetName; - m_sheetNameSize = size; - } - else - { - SetFileName( sheetName ); - m_fileNameSize = size; - } - } - - if( fieldNdx > 1 ) - { - sheetPin = new SCH_SHEET_PIN( this ); - - if( !sheetPin->Load( aLine, aErrorMsg ) ) - { - delete sheetPin; - sheetPin = NULL; - return false; - } - - AddPin( sheetPin ); - } - } - - if( strncasecmp( "$End", ((char*)aLine), 4 ) != 0 ) - { - aErrorMsg.Printf( wxT( "**Eeschema file end_sheet struct error at line %d, aborted\n" ), - aLine.LineNumber() ); - aErrorMsg << FROM_UTF8( ((char*)aLine) ); - return false; - } - - return true; -} - - void SCH_SHEET::SwapData( SCH_ITEM* aItem ) { wxCHECK_RET( aItem->Type() == SCH_SHEET_T, @@ -803,59 +621,6 @@ bool SCH_SHEET::LocatePathOfScreen( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aList ) } -bool SCH_SHEET::Load( SCH_EDIT_FRAME* aFrame ) -{ - bool success = true; - - SCH_SCREEN* screen = NULL; - - if( !m_screen ) - { - g_RootSheet->SearchHierarchy( m_fileName, &screen ); - - if( screen ) - { - SetScreen( screen ); - - //do not need to load the sub-sheets - this has already been done. - } - else - { - SetScreen( new SCH_SCREEN( &aFrame->Kiway() ) ); - - success = aFrame->LoadOneEEFile( m_screen, m_fileName ); - - if( success ) - { - EDA_ITEM* bs = m_screen->GetDrawItems(); - - while( bs ) - { - if( bs->Type() == SCH_SHEET_T ) - { - SCH_SHEET* sheet = (SCH_SHEET*) bs; - - // Set the parent to this sheet. This effectively creates a method - // to find the root sheet from any sheet so a pointer to the root - // sheet does not need to be stored globally. Note: this is not the - // same as a hierarchy. Complex hierarchies can have multiple copies - // of a sheet. This only provides a simple tree to find the root sheet. - sheet->SetParent( this ); - - if( !sheet->Load( aFrame ) ) - success = false; - } - - bs = bs->Next(); - } - } - } - } - - return success; -} - - int SCH_SHEET::CountSheets() { int count = 1; //1 = this!! diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h index d02fa948c7..be98a9360d 100644 --- a/eeschema/sch_sheet.h +++ b/eeschema/sch_sheet.h @@ -49,8 +49,7 @@ class NETLIST_OBJECT_LIST; /** - * Class SCH_SHEET_PIN - * defines a sheet pin (label) used in sheets to create hierarchical schematics. + * Define a sheet pin (label) used in sheets to create hierarchical schematics. * * A SCH_SHEET_PIN is used to create a hierarchical sheet in the same way a * pin is used in a component. It connects the objects in the sheet object @@ -105,9 +104,9 @@ public: bool operator ==( const SCH_SHEET_PIN* aPin ) const; /** - * Virtual function IsMovableFromAnchorPoint * Return true for items which are moved with the anchor point at mouse cursor * and false for items moved with no reference to anchor (usually large items) + * * @return true for a hierarchical sheet pin */ bool IsMovableFromAnchorPoint() override { return true; } @@ -116,8 +115,8 @@ public: GR_DRAWMODE aDrawMode, COLOR4D aColor = COLOR4D::UNSPECIFIED ) override; /** - * Function CreateGraphicShape (virtual) - * Calculates the graphic shape (a polygon) associated to the text + * Calculate the graphic shape (a polygon) associated to the text. + * * @param aPoints = a buffer to fill with polygon corners coordinates * @param aPos = Position of the shape */ @@ -146,8 +145,7 @@ public: SHEET_SIDE GetEdge() const; /** - * Function ConstrainOnEdge - * is used to adjust label position to edge based on proximity to vertical / horizontal edge + * Adjust label position to edge based on proximity to vertical or horizontal edge * of the parent sheet. */ void ConstrainOnEdge( wxPoint Pos ); @@ -160,10 +158,6 @@ public: */ SCH_SHEET* GetParent() const { return (SCH_SHEET*) m_Parent; } - bool Save( FILE* aFile ) const override; - - bool Load( LINE_READER& aLine, wxString& aErrorMsg ) override; - #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override; #endif @@ -210,8 +204,7 @@ typedef boost::ptr_vector SCH_SHEET_PINS; /** - * Class SCH_SHEET - * is the sheet symbol placed in a schematic, and is the entry point for a sub schematic. + * Sheet symbol placed in a schematic, and is the entry point for a sub schematic. */ class SCH_SHEET : public SCH_ITEM { @@ -248,8 +241,7 @@ public: SCH_SHEET( const wxPoint& pos = wxPoint( 0, 0 ) ); /** - * Copy Constructor - * clones \a aSheet into a new object. All sheet pins are copied as is except and + * Copy \a aSheet into a new object. All sheet pins are copied as is except and * the SCH_SHEET_PIN's #m_Parent pointers are set to the new copied parent object. */ SCH_SHEET( const SCH_SHEET& aSheet ); @@ -262,11 +254,12 @@ public: } /** - * Virtual function IsMovableFromAnchorPoint * Return true for items which are moved with the anchor point at mouse cursor - * and false for items moved with no reference to anchor + * and false for items moved with no reference to anchor. + * * Usually return true for small items (labels, junctions) and false for * items which can be large (hierarchical sheets, compoments) + * * @return false for a hierarchical sheet */ bool IsMovableFromAnchorPoint() override { return false; } @@ -290,9 +283,7 @@ public: void SetSize( const wxSize& aSize ) { m_size = aSize; } /** - * Function GetRootSheet - * - * returns the root sheet of this SCH_SHEET object. + * Return the root sheet of this SCH_SHEET object. * * The root (top level) sheet can be found by walking up the parent links until the only * sheet that has no parent is found. The root sheet can be found from any sheet without @@ -303,30 +294,25 @@ public: SCH_SHEET* GetRootSheet(); /** - * Function SetScreen - * sets the screen associated with this sheet to \a aScreen. - *

+ * Set the #SCH_SCREEN associated with this sheet to \a aScreen. + * * The screen reference counting is performed by SetScreen. If \a aScreen is not * the same as the current screen, the current screen reference count is decremented * and \a aScreen becomes the screen for the sheet. If the current screen reference * count reaches zero, the current screen is deleted. NULL is a valid value for * \a aScreen. - *

+ * * @param aScreen The new screen to associate with the sheet. */ void SetScreen( SCH_SCREEN* aScreen ); /** - * Function GetScreenCount - * returns the number of times the associated screen for the sheet is being used. If - * no screen is associated with the sheet, then zero is returned. + * Return the number of times the associated screen for the sheet is being used. + * + * If no screen is associated with the sheet, then zero is returned. */ int GetScreenCount() const; - bool Save( FILE* aFile ) const override; - - bool Load( LINE_READER& aLine, wxString& aErrorMsg ) override; - void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) override; /* there is no member for orientation in sch_sheet, to preserve file @@ -395,32 +381,25 @@ public: bool HasUndefinedPins(); /** - * Function GetMinWidth - * returns the minimum width of the sheet based on the widths of the sheet pin text. + * Return the minimum width of the sheet based on the widths of the sheet pin text. * - *

* The minimum sheet width is determined by the width of the bounding box of each * hierarchical sheet pin. If two pins are horizontally adjacent ( same Y position ) * to each other, the sum of the bounding box widths is used. If at some point in * the future sheet objects can be rotated or pins can be placed in the vertical * orientation, this function will need to be changed. - *

* * @return The minimum width the sheet can be resized. */ int GetMinWidth() const; /** - * Function GetMinHeight - * returns the minimum height that the sheet can be resized based on the sheet pin - * positions. + * Return the minimum height that the sheet can be resized based on the sheet pin positions. * - *

* The minimum width of a sheet is determined by the Y axis location of the bottom * most sheet pin. If at some point in the future sheet objects can be rotated or * pins can be placed in the vertical orientation, this function will need to be * changed. - *

* * @return The minimum height the sheet can be resized. */ @@ -434,8 +413,7 @@ public: EDA_RECT const GetBoundingBox() const override; /** - * Function GetResizePos - * returns the position of the lower right corner of the sheet in drawing units. + * Return the position of the lower right corner of the sheet in drawing units. * * @return A wxPoint containing lower right corner of the sheet in drawing units. */ @@ -444,39 +422,38 @@ public: void SwapData( SCH_ITEM* aItem ) override; /** - * Function ComponentCount - * count our own components, without the power components. + * Count our own components, without the power components. + * * @return the component count. */ int ComponentCount(); /** - * Function Load. - * for the sheet: load the file m_fileName - * if a screen already exists, the file is already read. - * m_screen point on the screen, and its m_RefCount is - * incremented - * else creates a new associated screen and load the data file. + * Load sheet from file #m_fileName + * + * If a screen already exists, the file is already read and #m_screen points to the screen + * and its m_RefCount is incremented. Otherwise creates a new associated screen and load + * the schematic file into this sheet. + * * @param aFrame = a SCH_EDIT_FRAME pointer to the maim schematic frame * @return true if OK */ bool Load( SCH_EDIT_FRAME* aFrame ); /** - * Function SearchHierarchy - * search the existing hierarchy for an instance of screen "FileName". - * @param aFilename = the filename to find - * @param aScreen = a location to return a pointer to the screen (if found) - * @return bool if found, and a pointer to the screen + * Search the existing hierarchy for an instance of screen loaded from \a aFileName. + * + * @param aFilename = the filename to find + * @param aScreen = a location to return a pointer to the screen (if found) + * @return bool if found, and a pointer to the screen */ bool SearchHierarchy( const wxString& aFilename, SCH_SCREEN** aScreen ); /** - * Function LocatePathOfScreen - * search the existing hierarchy for an instance of screen "FileName". - * don't bother looking at the root sheet - it must be unique, - * no other references to its m_screen otherwise there would be - * loops in the hierarchy. + * Search the existing hierarchy for an instance of screen loaded from \a aFileName. + * + * Don't bother looking at the root sheet, it must be unique. No other references to + * its m_screen otherwise there would be loops in the hierarchy. * * @param aScreen = the SCH_SCREEN* screen that we search for * @param aList = the SCH_SHEET_PATH* that must be used @@ -485,16 +462,15 @@ public: bool LocatePathOfScreen( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aList ); /** - * Function CountSheets - * calculates the number of sheets found in "this" - * this number includes the full subsheets count + * Count the number of sheets found in "this" sheet includeing all of the subsheets. + * * @return the full count of sheets+subsheets contained by "this" */ int CountSheets(); /** - * Function GetFileName - * return the filename corresponding to this sheet + * Return the filename corresponding to this sheet. + * * @return a wxString containing the filename */ wxString GetFileName( void ) const; @@ -509,10 +485,6 @@ public: bool ChangeFileName( SCH_EDIT_FRAME* aFrame, const wxString& aFileName ); - //void RemoveSheet(SCH_SHEET* sheet); - //to remove a sheet, just delete it - //-- the destructor should take care of everything else. - // Geometric transforms (used in block operations): void Move( const wxPoint& aMoveVector ) override @@ -545,13 +517,11 @@ public: void Resize( const wxSize& aSize ); /** - * Function GetSheetNamePosition * @return the position of the anchor of sheet name text */ wxPoint GetSheetNamePosition(); /** - * Function GetFileNamePosition * @return the position of the anchor of filename text */ wxPoint GetFileNamePosition(); diff --git a/eeschema/sch_sheet_pin.cpp b/eeschema/sch_sheet_pin.cpp index b1dacbc231..8db3d3d6bb 100644 --- a/eeschema/sch_sheet_pin.cpp +++ b/eeschema/sch_sheet_pin.cpp @@ -211,162 +211,6 @@ void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos ) } -bool SCH_SHEET_PIN::Save( FILE* aFile ) const -{ - int type = 'U', side = 'L'; - - if( m_Text.IsEmpty() ) - return true; - - switch( m_edge ) - { - default: - case SHEET_LEFT_SIDE: //pin on left side - side = 'L'; - break; - - case SHEET_RIGHT_SIDE: //pin on right side - side = 'R'; - break; - - case SHEET_TOP_SIDE: //pin on top side - side = 'T'; - break; - - case SHEET_BOTTOM_SIDE: //pin on bottom side - side = 'B'; - break; - } - - switch( m_shape ) - { - case NET_INPUT: - type = 'I'; break; - - case NET_OUTPUT: - type = 'O'; break; - - case NET_BIDI: - type = 'B'; break; - - case NET_TRISTATE: - type = 'T'; break; - - case NET_UNSPECIFIED: - type = 'U'; break; - } - - if( fprintf( aFile, "F%d %s %c %c %-3d %-3d %-3d\n", m_number, - EscapedUTF8( m_Text ).c_str(), // supplies wrapping quotes - type, side, GetTextPos().x, GetTextPos().y, - GetTextWidth() ) == EOF ) - { - return false; - } - - return true; -} - - -bool SCH_SHEET_PIN::Load( LINE_READER& aLine, wxString& aErrorMsg ) -{ - int x, y, size; - char number[256]; - char name[256]; - char connectType[256]; - char sheetSide[256]; - char* line = aLine.Line(); - char* cp; - - static const char delims[] = " \t"; - - // Read coordinates. - // D( printf( "line: \"%s\"\n", line );) - - cp = strtok( line, delims ); - - strncpy( number, cp, sizeof(number) ); - number[sizeof(number)-1] = 0; - - cp += strlen( number ) + 1; - - cp += ReadDelimitedText( name, cp, sizeof(name) ); - - cp = strtok( cp, delims ); - strncpy( connectType, cp, sizeof(connectType) ); - connectType[sizeof(connectType)-1] = 0; - - cp = strtok( NULL, delims ); - strncpy( sheetSide, cp, sizeof(sheetSide) ); - sheetSide[sizeof(sheetSide)-1] = 0; - - cp += strlen( sheetSide ) + 1; - - int r = sscanf( cp, "%d %d %d", &x, &y, &size ); - if( r != 3 ) - { - aErrorMsg.Printf( wxT( "Eeschema file sheet hierarchical label error at line %d.\n" ), - aLine.LineNumber() ); - - aErrorMsg << FROM_UTF8( line ); - return false; - } - - m_Text = FROM_UTF8( name ); - - if( size == 0 ) - size = GetDefaultTextSize(); - - SetTextSize( wxSize( size, size ) ); - SetTextPos( wxPoint( x, y ) ); - - switch( connectType[0] ) - { - case 'I': - m_shape = NET_INPUT; - break; - - case 'O': - m_shape = NET_OUTPUT; - break; - - case 'B': - m_shape = NET_BIDI; - break; - - case 'T': - m_shape = NET_TRISTATE; - break; - - case 'U': - m_shape = NET_UNSPECIFIED; - break; - } - - switch( sheetSide[0] ) - { - case 'R' : // pin on right side - SetEdge( SHEET_RIGHT_SIDE ); - break; - - case 'T' : // pin on top side - SetEdge( SHEET_TOP_SIDE ); - break; - - case 'B' : // pin on bottom side - SetEdge( SHEET_BOTTOM_SIDE ); - break; - - case 'L' : // pin on left side - default : - SetEdge( SHEET_LEFT_SIDE ); - break; - } - - return true; -} - - bool SCH_SHEET_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ) { diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 19f77fe004..b38400fa68 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Wayne Stambaugh - * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2017 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 @@ -379,124 +379,6 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset, } -bool SCH_TEXT::Save( FILE* aFile ) const -{ - bool success = true; - const char* shape = "~"; - - if( IsItalic() ) - shape = "Italic"; - - // For compatibility reason, the text must be saved in only one text line - // so we replace all E.O.L. by \\n - wxString text = m_Text; - - text.Replace( wxT("\n"), wxT( "\\n" ) ); - - // Here we should have no CR or LF character in line - // This is not always the case if a multiline text was copied (using a copy/paste function) - // from a text that uses E.O.L characters that differs from the current EOL format - // This is mainly the case under Linux using LF symbol when copying a text from - // Windows (using CRLF symbol) - // So we must just remove the extra CR left (or LF left under MacOSX) - for( unsigned ii = 0; ii < text.Len(); ) - { - if( text[ii] == 0x0A || text[ii] == 0x0D ) - text.erase( ii, 1 ); - else - ii++; - } - - if( fprintf( aFile, "Text Notes %-4d %-4d %-4d %-4d %s %d\n%s\n", - GetTextPos().x, GetTextPos().y, GetLabelSpinStyle(), GetTextWidth(), - shape, GetThickness(), TO_UTF8( text ) ) == EOF ) - { - success = false; - } - - return success; -} - - -bool SCH_TEXT::Load( LINE_READER& aLine, wxString& aErrorMsg ) -{ - char Name1[256]; - char Name2[256]; - char Name3[256]; - int thickness = 0, orient = 0; - int x, y, size = 0; - - Name1[0] = 0; Name2[0] = 0; Name3[0] = 0; - - char* sline = (char*) aLine; - - while( ( *sline != ' ' ) && *sline ) - sline++; - - // sline points the start of parameters - int ii = sscanf( sline, "%255s %d %d %d %d %255s %255s %d", Name1, &x, &y, - &orient, &size, Name2, Name3, &thickness ); - - if( ii < 4 ) - { - aErrorMsg.Printf( wxT( "Eeschema file text load error at line %d" ), - aLine.LineNumber() ); - return false; - } - - if( !aLine.ReadLine() ) - { - aErrorMsg.Printf( wxT( "Eeschema file text load error at line %d" ), - aLine.LineNumber() ); - return false; - } - - if( size == 0 ) - size = GetDefaultTextSize(); - - char* text = strtok( (char*) aLine, "\n\r" ); - - if( text == NULL ) - { - aErrorMsg.Printf( wxT( "Eeschema file text load error at line %d" ), - aLine.LineNumber() ); - return false; - } - - wxString val = FROM_UTF8( text ); - - for( ; ; ) - { - int i = val.find( wxT( "\\n" ) ); - - if( i == wxNOT_FOUND ) - break; - - val.erase( i, 2 ); - val.insert( i, wxT( "\n" ) ); - } - - m_Text = val; - - SetTextSize( wxSize( size, size ) ); - SetTextPos( wxPoint( x, y ) ); - - SetLabelSpinStyle( orient ); - - if( isdigit( Name3[0] ) ) - { - thickness = atol( Name3 ); - SetBold( thickness != 0 ); - SetThickness( IsBold() ? GetPenSizeForBold( size ) : 0 ); - } - - if( strncasecmp( Name2, "Italic", 6 ) == 0 ) - SetItalic( true ); - - return true; -} - - void SCH_TEXT::GetEndPoints( std::vector & aItemList ) { // Normal text labels cannot be tested for dangling ends. @@ -893,91 +775,6 @@ void SCH_LABEL::Rotate( wxPoint aPosition ) } -bool SCH_LABEL::Save( FILE* aFile ) const -{ - bool success = true; - const char* shape = "~"; - - if( IsItalic() ) - shape = "Italic"; - - if( fprintf( aFile, "Text Label %-4d %-4d %-4d %-4d %s %d\n%s\n", - GetTextPos().x, GetTextPos().y, GetLabelSpinStyle(), GetTextWidth(), shape, - GetThickness(), TO_UTF8( m_Text ) ) == EOF ) - { - success = false; - } - - return success; -} - - -bool SCH_LABEL::Load( LINE_READER& aLine, wxString& aErrorMsg ) -{ - char Name1[256]; - char Name2[256]; - char Name3[256]; - int thickness = 0, size = 0, orient = 0; - int x, y; - - Name1[0] = 0; Name2[0] = 0; Name3[0] = 0; - - char* sline = (char*) aLine; - - while( ( *sline != ' ' ) && *sline ) - sline++; - - // sline points the start of parameters - int ii = sscanf( sline, "%255s %d %d %d %d %255s %255s %d", Name1, &x, &y, - &orient, &size, Name2, Name3, &thickness ); - - if( ii < 4 ) - { - aErrorMsg.Printf( wxT( "Eeschema file label load error at line %d" ), - aLine.LineNumber() ); - return false; - } - - if( !aLine.ReadLine() ) - { - aErrorMsg.Printf( wxT( "Eeschema file label load error atline %d" ), - aLine.LineNumber() ); - return false; - } - - if( size == 0 ) - size = GetDefaultTextSize(); - - char* text = strtok( (char*) aLine, "\n\r" ); - - if( text == NULL ) - { - aErrorMsg.Printf( wxT( "Eeschema file label load error at line %d" ), - aLine.LineNumber() ); - return false; - } - - m_Text = FROM_UTF8( text ); - - SetTextSize( wxSize( size, size ) ); - SetTextPos( wxPoint( x, y ) ); - - SetLabelSpinStyle( orient ); - - if( isdigit( Name3[0] ) ) - { - thickness = atol( Name3 ); - SetBold( thickness != 0 ); - SetThickness( IsBold() ? GetPenSizeForBold( size ) : 0 ); - } - - if( strcasecmp( Name2, "Italic" ) == 0 ) - SetItalic( true ); - - return true; -} - - void SCH_LABEL::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset, GR_DRAWMODE DrawMode, COLOR4D Color ) { @@ -1039,100 +836,6 @@ EDA_ITEM* SCH_GLOBALLABEL::Clone() const } -bool SCH_GLOBALLABEL::Save( FILE* aFile ) const -{ - bool success = true; - const char* shape = "~"; - - if( IsItalic() ) - shape = "Italic"; - - if( fprintf( aFile, "Text GLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n", - GetTextPos().x, GetTextPos().y, GetLabelSpinStyle(), GetTextWidth(), - SheetLabelType[m_shape], shape, GetThickness(), TO_UTF8( m_Text ) ) == EOF ) - { - success = false; - } - - return success; -} - - -bool SCH_GLOBALLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg ) -{ - char Name1[256]; - char Name2[256]; - char Name3[256]; - int thickness = 0, size = 0, orient = 0; - int x, y; - - Name1[0] = 0; Name2[0] = 0; Name3[0] = 0; - - char* sline = (char*) aLine; - - while( (*sline != ' ' ) && *sline ) - sline++; - - // sline points the start of parameters - int ii = sscanf( sline, "%255s %d %d %d %d %255s %255s %d", Name1, &x, &y, - &orient, &size, Name2, Name3, &thickness ); - - if( ii < 4 ) - { - aErrorMsg.Printf( wxT( "Eeschema file global label load error at line %d" ), - aLine.LineNumber() ); - return false; - } - - if( !aLine.ReadLine() ) - { - aErrorMsg.Printf( wxT( "Eeschema file global label load error at line %d" ), - aLine.LineNumber() ); - return false; - } - - if( size == 0 ) - size = GetDefaultTextSize(); - - char* text = strtok( (char*) aLine, "\n\r" ); - - if( text == NULL ) - { - aErrorMsg.Printf( wxT( "Eeschema file global label load error at line %d" ), - aLine.LineNumber() ); - return false; - } - - m_Text = FROM_UTF8( text ); - - SetTextSize( wxSize( size, size ) ); - SetTextPos( wxPoint( x, y ) ); - - SetLabelSpinStyle( orient ); - - m_shape = NET_INPUT; - SetBold( thickness != 0 ); - SetThickness( IsBold() ? GetPenSizeForBold( size ) : 0 ); - - if( strcasecmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 ) - m_shape = NET_OUTPUT; - - if( strcasecmp( Name2, SheetLabelType[NET_BIDI] ) == 0 ) - m_shape = NET_BIDI; - - if( strcasecmp( Name2, SheetLabelType[NET_TRISTATE] ) == 0 ) - m_shape = NET_TRISTATE; - - if( strcasecmp( Name2, SheetLabelType[NET_UNSPECIFIED] ) == 0 ) - m_shape = NET_UNSPECIFIED; - - if( strcasecmp( Name3, "Italic" ) == 0 ) - SetItalic( true ); - - return true; -} - - void SCH_GLOBALLABEL::MirrorY( int aYaxis_position ) { /* The global label is NOT really mirrored. @@ -1503,101 +1206,6 @@ EDA_ITEM* SCH_HIERLABEL::Clone() const } -bool SCH_HIERLABEL::Save( FILE* aFile ) const -{ - bool success = true; - const char* shape = "~"; - - if( IsItalic() ) - shape = "Italic"; - - if( fprintf( aFile, "Text HLabel %-4d %-4d %-4d %-4d %s %s %d\n%s\n", - GetTextPos().x, GetTextPos().y, GetLabelSpinStyle(), GetTextWidth(), - SheetLabelType[m_shape], shape, GetThickness(), TO_UTF8( m_Text ) ) == EOF ) - { - success = false; - } - - return success; -} - - -bool SCH_HIERLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg ) -{ - char Name1[256]; - char Name2[256]; - char Name3[256]; - int thickness = 0, size = 0, orient = 0; - int x, y; - - Name1[0] = 0; Name2[0] = 0; Name3[0] = 0; - - char* sline = (char*) aLine; - - while( (*sline != ' ' ) && *sline ) - sline++; - - // sline points the start of parameters - int ii = sscanf( sline, "%255s %d %d %d %d %255s %255s %d", Name1, - &x, &y, - &orient, &size, Name2, Name3, &thickness ); - - if( ii < 4 ) - { - aErrorMsg.Printf( wxT( "Eeschema file hierarchical label load error at line %d" ), - aLine.LineNumber() ); - return false; - } - - if( !aLine.ReadLine() ) - { - aErrorMsg.Printf( wxT( "Eeschema file hierarchical label load error at line %d" ), - aLine.LineNumber() ); - return false; - } - - if( size == 0 ) - size = GetDefaultTextSize(); - - char* text = strtok( (char*) aLine, "\n\r" ); - - if( text == NULL ) - { - aErrorMsg.Printf( wxT( "Eeschema file hierarchical label load error at line %d" ), - aLine.LineNumber() ); - return false; - } - - m_Text = FROM_UTF8( text ); - - SetTextSize( wxSize( size, size ) ); - SetTextPos( wxPoint( x, y ) ); - - SetLabelSpinStyle( orient ); - m_shape = NET_INPUT; - SetBold( thickness != 0 ); - - SetThickness( IsBold() ? GetPenSizeForBold( size ) : 0 ); - - if( strcasecmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 ) - m_shape = NET_OUTPUT; - - if( strcasecmp( Name2, SheetLabelType[NET_BIDI] ) == 0 ) - m_shape = NET_BIDI; - - if( strcasecmp( Name2, SheetLabelType[NET_TRISTATE] ) == 0 ) - m_shape = NET_TRISTATE; - - if( strcasecmp( Name2, SheetLabelType[NET_UNSPECIFIED] ) == 0 ) - m_shape = NET_UNSPECIFIED; - - if( strcasecmp( Name3, "Italic" ) == 0 ) - SetItalic( true ); - - return true; -} - - void SCH_HIERLABEL::SetLabelSpinStyle( int aSpinStyle ) { m_spin_style = aSpinStyle; diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h index 529ccce377..f62fcb6e83 100644 --- a/eeschema/sch_text.h +++ b/eeschema/sch_text.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2017 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 @@ -81,8 +81,7 @@ public: KICAD_T aType = SCH_TEXT_T ); /** - * Copy Constructor - * clones \a aText into a new object. All members are copied as is except + * Clones \a aText into a new object. All members are copied as is except * for the #m_isDangling member which is set to false. This prevents newly * copied objects derived from #SCH_TEXT from having their connection state * improperly set. @@ -97,17 +96,15 @@ public: } /** - * Function IncrementLabel - * increments the label text, if it ends with a number. - * @param aIncrement = the increment value to add to the number - * ending the text + * Increment the label text, if it ends with a number. + * + * @param aIncrement = the increment value to add to the number ending the text. */ void IncrementLabel( int aIncrement ); /** - * Function SetLabelSpinStyle - * sets a spin or rotation angle, along with specific horizontal and vertical - * justification styles with each angle. + * Set a spin or rotation angle, along with specific horizontal and vertical justification + * styles with each angle. * * @param aSpinStyle = * 0 = normal (horizontal, left justified). @@ -123,7 +120,6 @@ public: void SetShape( PINSHEETLABEL_SHAPE aShape ) { m_shape = aShape; } /** - * Function GetSchematicTextOffset (virtual) * @return the offset between the SCH_TEXT position and the text itself position * * This offset depends on the orientation, the type of text, and the area required to @@ -135,8 +131,8 @@ public: GR_DRAWMODE draw_mode, COLOR4D Color = COLOR4D::UNSPECIFIED ) override; /** - * Function CreateGraphicShape - * Calculates the graphic shape (a polygon) associated to the text + * Calculate the graphic shape (a polygon) associated to the text. + * * @param aPoints A buffer to fill with polygon corners coordinates * @param Pos Position of the shape, for texts and labels: do nothing * Mainly for derived classes (SCH_SHEET_PIN and Hierarchical labels) @@ -150,10 +146,6 @@ public: virtual const EDA_RECT GetBoundingBox() const override; - virtual bool Save( FILE* aFile ) const override; - - virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ) override; - virtual int GetPenSize() const override; // Geometric transforms (used in block operations): @@ -245,10 +237,6 @@ public: const EDA_RECT GetBoundingBox() const override; - bool Save( FILE* aFile ) const override; - - bool Load( LINE_READER& aLine, wxString& aErrorMsg ) override; - bool IsConnectable() const override { return true; } wxString GetSelectMenuText() const override; @@ -285,10 +273,6 @@ public: wxPoint GetSchematicTextOffset() const override; - bool Save( FILE* aFile ) const override; - - bool Load( LINE_READER& aLine, wxString& aErrorMsg ) override; - const EDA_RECT GetBoundingBox() const override; void CreateGraphicShape( std::vector & aPoints, const wxPoint& aPos ) override; @@ -337,10 +321,6 @@ public: void CreateGraphicShape( std::vector & aPoints, const wxPoint& Pos ) override; - bool Save( FILE* aFile ) const override; - - bool Load( LINE_READER& aLine, wxString& aErrorMsg ) override; - const EDA_RECT GetBoundingBox() const override; void MirrorY( int aYaxis_position ) override; diff --git a/eeschema/schframe.h b/eeschema/schframe.h index 9328f1f720..d9655c88b9 100644 --- a/eeschema/schframe.h +++ b/eeschema/schframe.h @@ -703,19 +703,6 @@ public: */ bool AppendSchematic(); - /** - * Load the schematic (.sch) file \a aFullFileName into \a aScreen. - * - * @param aScreen Pointer to the associated SCH_SCREEN object in which to load - * \a aFullFileName. - * @param aFullFileName A reference to a wxString object containing the absolute path - * and file name to load. - * @param append True if loaded file is being appended to the currently open file instead - * of replacing it. - * @return True if \a aFullFileName has been loaded (at least partially.) - */ - bool LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFileName, bool append = false ); - /** * Loads a .cmp file from CvPcb and update the footprint field of components. *