2011-10-15 13:25:57 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2012-03-27 16:41:13 +00:00
|
|
|
* Copyright (C) 2004 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
|
2011-10-31 20:49:48 +00:00
|
|
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@verizon.net>
|
2011-10-15 13:25:57 +00:00
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
/**
|
|
|
|
* @file load_one_schematic_file.cpp
|
|
|
|
* @brief Code to load and save Eeschema files.
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <kicad_string.h>
|
|
|
|
#include <wxEeschemaStruct.h>
|
|
|
|
#include <richio.h>
|
2009-09-25 18:49:04 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <general.h>
|
|
|
|
#include <protos.h>
|
|
|
|
#include <sch_bus_entry.h>
|
|
|
|
#include <sch_marker.h>
|
|
|
|
#include <sch_junction.h>
|
|
|
|
#include <sch_line.h>
|
|
|
|
#include <sch_no_connect.h>
|
|
|
|
#include <sch_component.h>
|
|
|
|
#include <sch_polyline.h>
|
|
|
|
#include <sch_text.h>
|
|
|
|
#include <sch_sheet.h>
|
|
|
|
#include <sch_bitmap.h>
|
2009-04-05 20:49:15 +00:00
|
|
|
|
|
|
|
|
2012-01-05 08:07:11 +00:00
|
|
|
bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* Window );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2010-10-21 00:18:42 +00:00
|
|
|
static void LoadLayers( LINE_READER* aLine );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFileName )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-11-10 15:30:12 +00:00
|
|
|
char Name1[256];
|
2010-11-11 21:46:55 +00:00
|
|
|
bool itemLoaded = false;
|
2010-11-10 15:30:12 +00:00
|
|
|
SCH_ITEM* item;
|
2010-08-31 10:44:38 +00:00
|
|
|
wxString MsgDiag; // Error and log messages
|
2011-02-27 06:22:34 +00:00
|
|
|
char* line;
|
2011-10-15 13:25:57 +00:00
|
|
|
wxFileName fn;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
if( aScreen == NULL )
|
2011-10-15 13:25:57 +00:00
|
|
|
return false;
|
2010-08-31 10:44:38 +00:00
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
if( aFullFileName.IsEmpty() )
|
2011-10-15 13:25:57 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
fn = aFullFileName;
|
|
|
|
CheckForAutoSaveFile( fn, g_SchematicBackupFileExtension );
|
|
|
|
|
|
|
|
wxLogTrace( traceAutoSave, wxT( "Loading schematic file " ) + aFullFileName );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
aScreen->SetCurItem( NULL );
|
|
|
|
aScreen->SetFileName( aFullFileName );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-10-15 13:25:57 +00:00
|
|
|
FILE* f;
|
2010-08-31 10:44:38 +00:00
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
if( ( f = wxFopen( aFullFileName, wxT( "rt" ) ) ) == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-08-18 19:25:12 +00:00
|
|
|
MsgDiag = _( "Failed to open " ) + aFullFileName;
|
2007-08-20 01:20:48 +00:00
|
|
|
DisplayError( this, MsgDiag );
|
2011-10-15 13:25:57 +00:00
|
|
|
return false;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2010-10-21 00:18:42 +00:00
|
|
|
// reader now owns the open FILE.
|
2011-08-18 19:25:12 +00:00
|
|
|
FILE_LINE_READER reader( f, aFullFileName );
|
2010-10-21 00:18:42 +00:00
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
MsgDiag = _( "Loading " ) + aScreen->GetFileName();
|
2007-08-20 01:20:48 +00:00
|
|
|
PrintMsg( MsgDiag );
|
|
|
|
|
2010-10-21 00:18:42 +00:00
|
|
|
if( !reader.ReadLine()
|
2011-10-31 20:49:48 +00:00
|
|
|
|| strncmp( (char*)reader + 9, SCHEMATIC_HEAD_STRING,
|
|
|
|
sizeof( SCHEMATIC_HEAD_STRING ) - 1 ) != 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-09-30 18:15:37 +00:00
|
|
|
MsgDiag = aFullFileName + _( " is NOT an Eeschema file!" );
|
2007-08-20 01:20:48 +00:00
|
|
|
DisplayError( this, MsgDiag );
|
2011-10-15 13:25:57 +00:00
|
|
|
return false;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2008-10-06 05:44:29 +00:00
|
|
|
|
2011-02-27 06:22:34 +00:00
|
|
|
line = reader.Line();
|
|
|
|
|
2010-11-12 18:38:48 +00:00
|
|
|
// get the file version here.
|
2011-10-31 20:49:48 +00:00
|
|
|
char *strversion = line + 9 + sizeof( SCHEMATIC_HEAD_STRING );
|
2011-02-27 06:22:34 +00:00
|
|
|
|
2010-11-12 18:38:48 +00:00
|
|
|
// Skip blanks
|
|
|
|
while( *strversion && *strversion < '0' )
|
|
|
|
strversion++;
|
2011-02-27 06:22:34 +00:00
|
|
|
|
2011-10-31 20:49:48 +00:00
|
|
|
int version = atoi( strversion );
|
2010-11-12 18:38:48 +00:00
|
|
|
|
|
|
|
if( version > EESCHEMA_VERSION )
|
2008-04-06 15:12:24 +00:00
|
|
|
{
|
2011-08-18 19:25:12 +00:00
|
|
|
MsgDiag = aFullFileName + _( " was created by a more recent \
|
2011-09-30 18:15:37 +00:00
|
|
|
version of Eeschema and may not load correctly. Please consider updating!" );
|
2009-04-17 08:51:02 +00:00
|
|
|
DisplayInfoMessage( this, MsgDiag );
|
2008-04-06 15:12:24 +00:00
|
|
|
}
|
2008-12-19 20:40:08 +00:00
|
|
|
|
2008-04-15 19:38:19 +00:00
|
|
|
#if 0
|
2011-09-30 18:15:37 +00:00
|
|
|
// Compile it if the new version is unreadable by previous Eeschema versions
|
2010-11-12 18:38:48 +00:00
|
|
|
else if( version < EESCHEMA_VERSION )
|
2008-04-06 15:12:24 +00:00
|
|
|
{
|
2011-08-18 19:25:12 +00:00
|
|
|
MsgDiag = aFullFileName + _( " was created by an older version of \
|
2011-09-30 18:15:37 +00:00
|
|
|
Eeschema. It will be stored in the new file format when you save this file \
|
2009-05-21 17:42:42 +00:00
|
|
|
again." );
|
|
|
|
|
2009-04-17 08:51:02 +00:00
|
|
|
DisplayInfoMessage( this, MsgDiag );
|
2008-04-06 15:12:24 +00:00
|
|
|
}
|
2008-04-15 19:38:19 +00:00
|
|
|
#endif
|
2008-04-06 15:12:24 +00:00
|
|
|
|
2011-02-27 06:22:34 +00:00
|
|
|
if( !reader.ReadLine() || strncmp( reader, "LIBS:", 5 ) != 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-09-30 18:15:37 +00:00
|
|
|
MsgDiag = aFullFileName + _( " is NOT an Eeschema file!" );
|
2007-08-20 01:20:48 +00:00
|
|
|
DisplayError( this, MsgDiag );
|
2011-10-15 13:25:57 +00:00
|
|
|
return false;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2010-10-21 00:18:42 +00:00
|
|
|
LoadLayers( &reader );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-10-21 00:18:42 +00:00
|
|
|
while( reader.ReadLine() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-27 06:22:34 +00:00
|
|
|
line = reader.Line();
|
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
item = NULL;
|
|
|
|
|
2010-10-21 00:18:42 +00:00
|
|
|
char* sline = line;
|
2011-10-31 20:49:48 +00:00
|
|
|
|
2010-10-21 00:18:42 +00:00
|
|
|
while( (*sline != ' ' ) && *sline )
|
|
|
|
sline++;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-10-21 00:18:42 +00:00
|
|
|
switch( line[0] )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-08-31 10:44:38 +00:00
|
|
|
case '$': // identification block
|
2010-10-21 00:18:42 +00:00
|
|
|
if( line[1] == 'C' )
|
2010-11-10 15:30:12 +00:00
|
|
|
item = new SCH_COMPONENT();
|
2010-10-21 00:18:42 +00:00
|
|
|
else if( line[1] == 'S' )
|
2010-11-10 15:30:12 +00:00
|
|
|
item = new SCH_SHEET();
|
2010-10-21 00:18:42 +00:00
|
|
|
else if( line[1] == 'D' )
|
2011-08-18 19:25:12 +00:00
|
|
|
itemLoaded = ReadSchemaDescr( &reader, MsgDiag, aScreen );
|
2011-08-31 14:59:20 +00:00
|
|
|
else if( line[1] == 'B' )
|
|
|
|
item = new SCH_BITMAP();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-08-31 10:44:38 +00:00
|
|
|
case 'L': // Its a library item.
|
2010-11-10 15:30:12 +00:00
|
|
|
item = new SCH_COMPONENT();
|
2009-11-04 20:46:53 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-08-31 10:44:38 +00:00
|
|
|
case 'W': // Its a Segment (WIRE or BUS) item.
|
2010-11-10 15:30:12 +00:00
|
|
|
item = new SCH_LINE();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-08-31 10:44:38 +00:00
|
|
|
case 'E': // Its a WIRE or BUS item.
|
2010-11-10 15:30:12 +00:00
|
|
|
item = new SCH_BUS_ENTRY();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-08-31 10:44:38 +00:00
|
|
|
case 'P': // Its a polyline item.
|
2010-11-10 15:30:12 +00:00
|
|
|
item = new SCH_POLYLINE();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
case 'C': // It is a connection item.
|
|
|
|
item = new SCH_JUNCTION();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-08-31 10:44:38 +00:00
|
|
|
case 'K': // It is a Marker item.
|
2009-11-04 20:46:53 +00:00
|
|
|
// Markers are no more read from file. they are only created on
|
|
|
|
// demand in schematic
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
case 'N': // It is a NoConnect item.
|
|
|
|
item = new SCH_NO_CONNECT();
|
|
|
|
break;
|
|
|
|
|
2010-08-31 10:44:38 +00:00
|
|
|
case 'T': // It is a text item.
|
2010-11-10 15:30:12 +00:00
|
|
|
if( sscanf( sline, "%s", Name1 ) != 1 )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2012-03-26 21:45:05 +00:00
|
|
|
MsgDiag.Printf( _( "Eeschema file text load error at line %d" ),
|
2010-11-10 15:30:12 +00:00
|
|
|
reader.LineNumber() );
|
|
|
|
itemLoaded = false;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2010-11-10 15:30:12 +00:00
|
|
|
else if( Name1[0] == 'L' )
|
|
|
|
item = new SCH_LABEL();
|
2010-11-12 18:38:48 +00:00
|
|
|
else if( Name1[0] == 'G' && version > 1 )
|
2010-11-10 15:30:12 +00:00
|
|
|
item = new SCH_GLOBALLABEL();
|
2010-11-12 18:38:48 +00:00
|
|
|
else if( (Name1[0] == 'H') || (Name1[0] == 'G' && version == 1) )
|
2010-11-10 15:30:12 +00:00
|
|
|
item = new SCH_HIERLABEL();
|
|
|
|
else
|
|
|
|
item = new SCH_TEXT();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2010-11-10 15:30:12 +00:00
|
|
|
itemLoaded = false;
|
2012-03-26 21:45:05 +00:00
|
|
|
MsgDiag.Printf( _( "Eeschema file undefined object at line %d, aborted" ),
|
2010-10-21 00:18:42 +00:00
|
|
|
reader.LineNumber() );
|
2011-02-28 18:36:19 +00:00
|
|
|
MsgDiag << wxT( "\n" ) << FROM_UTF8( line );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
if( item )
|
|
|
|
{
|
|
|
|
itemLoaded = item->Load( reader, MsgDiag );
|
|
|
|
|
|
|
|
if( !itemLoaded )
|
|
|
|
{
|
|
|
|
SAFE_DELETE( item );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-02-26 18:39:39 +00:00
|
|
|
aScreen->Append( item );
|
2010-11-10 15:30:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !itemLoaded )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
DisplayError( this, MsgDiag );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-06 05:44:29 +00:00
|
|
|
#if 0 && defined (DEBUG)
|
2011-08-18 19:25:12 +00:00
|
|
|
aScreen->Show( 0, std::cout );
|
2007-09-20 21:06:49 +00:00
|
|
|
#endif
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
aScreen->TestDanglingEnds();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
MsgDiag = _( "Done Loading " ) + aScreen->GetFileName();
|
2008-03-20 01:50:21 +00:00
|
|
|
PrintMsg( MsgDiag );
|
|
|
|
|
2010-08-31 10:44:38 +00:00
|
|
|
return true; // Although it may be that file is only partially loaded.
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-10-21 00:18:42 +00:00
|
|
|
static void LoadLayers( LINE_READER* aLine )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-03-15 21:13:56 +00:00
|
|
|
int Number;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-03-15 21:13:56 +00:00
|
|
|
//int Mode,Color,Layer;
|
2007-08-20 01:20:48 +00:00
|
|
|
char Name[256];
|
|
|
|
|
2010-10-21 00:18:42 +00:00
|
|
|
aLine->ReadLine();
|
2009-03-15 21:13:56 +00:00
|
|
|
|
2010-10-21 00:18:42 +00:00
|
|
|
sscanf( *aLine, "%s %d %d", Name, &Number, &g_LayerDescr.CurrentLayer );
|
2011-10-31 20:49:48 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
if( strcmp( Name, "EELAYER" ) !=0 )
|
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
/* error : init par default */
|
2007-08-20 01:20:48 +00:00
|
|
|
Number = MAX_LAYER;
|
|
|
|
}
|
2009-03-15 21:13:56 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
if( Number <= 0 )
|
|
|
|
Number = MAX_LAYER;
|
2011-10-31 20:49:48 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
if( Number > MAX_LAYER )
|
|
|
|
Number = MAX_LAYER;
|
|
|
|
|
|
|
|
g_LayerDescr.NumberOfLayers = Number;
|
|
|
|
|
2010-10-21 00:18:42 +00:00
|
|
|
while( aLine->ReadLine() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-10-21 00:18:42 +00:00
|
|
|
if( strnicmp( *aLine, "EELAYER END", 11 ) == 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2012-01-16 04:11:43 +00:00
|
|
|
/// Get the length of a string constant, at compile time
|
|
|
|
#define SZ( x ) (sizeof(x)-1)
|
|
|
|
|
|
|
|
static const char delims[] = " \t\r\n";
|
2010-11-10 15:30:12 +00:00
|
|
|
|
|
|
|
/* Read the schematic header. */
|
2012-01-05 08:07:11 +00:00
|
|
|
bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* aScreen )
|
2010-11-10 15:30:12 +00:00
|
|
|
{
|
2012-01-16 04:11:43 +00:00
|
|
|
char* line = aLine->Line();
|
2011-02-27 06:22:34 +00:00
|
|
|
|
2012-01-16 04:11:43 +00:00
|
|
|
char* pageType = strtok( line + SZ( "$Descr" ), delims );
|
|
|
|
char* width = strtok( NULL, delims );
|
|
|
|
char* height = strtok( NULL, delims );
|
|
|
|
char* orient = strtok( NULL, delims );
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2012-01-16 04:11:43 +00:00
|
|
|
wxString pagename = FROM_UTF8( pageType );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2012-01-05 08:07:11 +00:00
|
|
|
PAGE_INFO pageInfo;
|
2012-01-09 08:35:06 +00:00
|
|
|
TITLE_BLOCK tb;
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2012-01-05 08:07:11 +00:00
|
|
|
if( !pageInfo.SetType( pagename ) )
|
2010-11-10 15:30:12 +00:00
|
|
|
{
|
2012-03-26 21:45:05 +00:00
|
|
|
aMsgDiag.Printf( _( "Eeschema file dimension definition error \
|
2012-03-27 16:41:13 +00:00
|
|
|
line %d,\nAbort reading file.\n" ),
|
2010-11-10 15:30:12 +00:00
|
|
|
aLine->LineNumber() );
|
2011-02-28 18:36:19 +00:00
|
|
|
aMsgDiag << FROM_UTF8( line );
|
2010-11-10 15:30:12 +00:00
|
|
|
}
|
|
|
|
|
2012-01-16 05:17:23 +00:00
|
|
|
if( pagename == PAGE_INFO::Custom )
|
2012-01-05 08:07:11 +00:00
|
|
|
{
|
2012-01-16 04:11:43 +00:00
|
|
|
if( width && height )
|
|
|
|
{
|
|
|
|
int w = atoi( width );
|
|
|
|
int h = atoi( height );
|
|
|
|
|
|
|
|
pageInfo.SetWidthMils( w );
|
|
|
|
pageInfo.SetHeightMils( h );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-26 21:45:05 +00:00
|
|
|
// non custom size, set portrait if its present
|
2012-01-16 04:11:43 +00:00
|
|
|
else if( orient && !strcmp( orient, "portrait" ) )
|
|
|
|
{
|
|
|
|
pageInfo.SetPortrait( true );
|
2012-01-05 08:07:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
aScreen->SetPageSettings( pageInfo );
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2012-01-16 04:11:43 +00:00
|
|
|
for(;;)
|
2010-11-10 15:30:12 +00:00
|
|
|
{
|
2012-01-16 04:11:43 +00:00
|
|
|
char buf[1024];
|
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
if( !aLine->ReadLine() )
|
2011-10-07 14:41:30 +00:00
|
|
|
return true;
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2011-02-27 06:22:34 +00:00
|
|
|
line = aLine->Line();
|
|
|
|
|
|
|
|
if( strnicmp( line, "$End", 4 ) == 0 )
|
2012-01-09 08:35:06 +00:00
|
|
|
{
|
|
|
|
aScreen->SetTitleBlock( tb );
|
2010-11-10 15:30:12 +00:00
|
|
|
break;
|
2012-01-09 08:35:06 +00:00
|
|
|
}
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2011-02-27 06:22:34 +00:00
|
|
|
if( strnicmp( line, "Sheet", 2 ) == 0 )
|
|
|
|
sscanf( line + 5, " %d %d",
|
2010-12-08 20:12:46 +00:00
|
|
|
&aScreen->m_ScreenNumber, &aScreen->m_NumberOfScreen );
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2011-02-27 06:22:34 +00:00
|
|
|
if( strnicmp( line, "Title", 2 ) == 0 )
|
2010-11-10 15:30:12 +00:00
|
|
|
{
|
2011-02-27 06:22:34 +00:00
|
|
|
ReadDelimitedText( buf, line, 256 );
|
2012-01-09 08:35:06 +00:00
|
|
|
tb.SetTitle( FROM_UTF8( buf ) );
|
2010-11-10 15:30:12 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2011-02-27 06:22:34 +00:00
|
|
|
if( strnicmp( line, "Date", 2 ) == 0 )
|
2010-11-10 15:30:12 +00:00
|
|
|
{
|
2011-02-27 06:22:34 +00:00
|
|
|
ReadDelimitedText( buf, line, 256 );
|
2012-01-09 08:35:06 +00:00
|
|
|
tb.SetDate( FROM_UTF8( buf ) );
|
2010-11-10 15:30:12 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2011-02-27 06:22:34 +00:00
|
|
|
if( strnicmp( line, "Rev", 2 ) == 0 )
|
2010-11-10 15:30:12 +00:00
|
|
|
{
|
2011-02-27 06:22:34 +00:00
|
|
|
ReadDelimitedText( buf, line, 256 );
|
2012-01-09 08:35:06 +00:00
|
|
|
tb.SetRevision( FROM_UTF8( buf ) );
|
2010-11-10 15:30:12 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2011-02-27 06:22:34 +00:00
|
|
|
if( strnicmp( line, "Comp", 4 ) == 0 )
|
2010-11-10 15:30:12 +00:00
|
|
|
{
|
2011-02-27 06:22:34 +00:00
|
|
|
ReadDelimitedText( buf, line, 256 );
|
2012-01-09 08:35:06 +00:00
|
|
|
tb.SetCompany( FROM_UTF8( buf ) );
|
2010-11-10 15:30:12 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2011-02-27 06:22:34 +00:00
|
|
|
if( strnicmp( line, "Comment1", 8 ) == 0 )
|
2010-11-10 15:30:12 +00:00
|
|
|
{
|
2011-02-27 06:22:34 +00:00
|
|
|
ReadDelimitedText( buf, line, 256 );
|
2012-01-09 08:35:06 +00:00
|
|
|
tb.SetComment1( FROM_UTF8( buf ) );
|
2010-11-10 15:30:12 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2011-02-27 06:22:34 +00:00
|
|
|
if( strnicmp( line, "Comment2", 8 ) == 0 )
|
2010-11-10 15:30:12 +00:00
|
|
|
{
|
2011-02-27 06:22:34 +00:00
|
|
|
ReadDelimitedText( buf, line, 256 );
|
2012-01-09 08:35:06 +00:00
|
|
|
tb.SetComment2( FROM_UTF8( buf ) );
|
2010-11-10 15:30:12 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2011-02-27 06:22:34 +00:00
|
|
|
if( strnicmp( line, "Comment3", 8 ) == 0 )
|
2010-11-10 15:30:12 +00:00
|
|
|
{
|
2011-02-27 06:22:34 +00:00
|
|
|
ReadDelimitedText( buf, line, 256 );
|
2012-01-09 08:35:06 +00:00
|
|
|
tb.SetComment3( FROM_UTF8( buf ) );
|
2010-11-10 15:30:12 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2011-02-27 06:22:34 +00:00
|
|
|
if( strnicmp( line, "Comment4", 8 ) == 0 )
|
2010-11-10 15:30:12 +00:00
|
|
|
{
|
2011-02-27 06:22:34 +00:00
|
|
|
ReadDelimitedText( buf, line, 256 );
|
2012-01-09 08:35:06 +00:00
|
|
|
tb.SetComment4( FROM_UTF8( buf ) );
|
2010-11-10 15:30:12 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|