EESchema schematic object refactoring and header rationalization.

This commit is contained in:
Wayne Stambaugh 2010-11-10 10:30:12 -05:00
parent 12e6dca444
commit 76aa3f6e1c
127 changed files with 1710 additions and 1241 deletions

View File

@ -4,6 +4,13 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2010-nov-10 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++EESchema
* Header file rationalization.
* Move schematic object load code into the appropriate schematic object.
2010-nov-3 UPDATE Wayne Stambaugh <stambaughw@verizon.net> 2010-nov-3 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================ ================================================================================
++common ++common

View File

@ -12,13 +12,12 @@
#include "common.h" #include "common.h"
#include "base_struct.h" #include "base_struct.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "class_base_screen.h" #include "class_sch_screen.h"
#include "wxstruct.h" #include "wxstruct.h"
#include "wx/valgen.h" #include "wx/valgen.h"
#ifdef EESCHEMA #ifdef EESCHEMA
#include "program.h"
#include "general.h" #include "general.h"
#endif #endif

View File

@ -11,7 +11,6 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "wxEeschemaStruct.h" #include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
@ -29,10 +28,17 @@ SCH_ITEM::SCH_ITEM( EDA_BaseStruct* aParent, KICAD_T aType ) :
m_Layer = 0; m_Layer = 0;
} }
SCH_ITEM::~SCH_ITEM() SCH_ITEM::~SCH_ITEM()
{ {
// Do not let the connections container go out of scope with any ojbects or they
// will be deleted by the container will cause the EESchema to crash. These objects
// are owned by the sheet object container.
if( !m_connections.empty() )
m_connections.release();
} }
/** /**
* place the struct in EEDrawList. * place the struct in EEDrawList.
* if it is a new item, it it also put in undo list * if it is a new item, it it also put in undo list

View File

@ -122,7 +122,6 @@ set(EESCHEMA_SRCS
operations_on_items_lists.cpp operations_on_items_lists.cpp
pinedit.cpp pinedit.cpp
plot.cpp plot.cpp
read_from_file_schematic_items_descriptions.cpp
schedit.cpp schedit.cpp
schematic_undo_redo.cpp schematic_undo_redo.cpp
schframe.cpp schframe.cpp

View File

@ -10,10 +10,12 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "wxstruct.h" #include "wxstruct.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "class_library.h" #include "class_library.h"
#include "protos.h" #include "protos.h"
#include "class_sch_screen.h"
#include "class_sch_component.h"
#include "netlist.h" #include "netlist.h"
#include "lib_pin.h" #include "lib_pin.h"

View File

@ -8,7 +8,7 @@
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "common.h" #include "common.h"
#include "program.h" #include "wxEeschemaStruct.h"
#include "annotate_dialog.h" #include "annotate_dialog.h"

View File

@ -26,6 +26,11 @@
#include "dialog_annotate_base.h" #include "dialog_annotate_base.h"
class WinEDA_SchematicFrame;
class wxConfig;
/*! /*!
* DIALOG_ANNOTATE class declaration * DIALOG_ANNOTATE class declaration
*/ */

View File

@ -5,15 +5,16 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "program.h"
#include "confirm.h" #include "confirm.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "gestfich.h" #include "gestfich.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "wxEeschemaStruct.h"
#include "build_version.h"
#include "general.h" #include "general.h"
#include "class_drawsheetpath.h"
#include "build_version.h" #include "class_sch_component.h"
/** function FillFootprintFieldForAllInstancesofComponent /** function FillFootprintFieldForAllInstancesofComponent

View File

@ -9,13 +9,20 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "block_commande.h" #include "block_commande.h"
#include "wxEeschemaStruct.h"
#include "class_sch_screen.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
#include "class_library.h" #include "class_library.h"
#include "lib_pin.h" #include "lib_pin.h"
#include "protos.h" #include "protos.h"
#include "class_schematic_items.h"
#include "class_text-label.h"
#include "class_sch_component.h"
#include "class_drawsheet.h"
#include <boost/foreach.hpp>
// Imported functions: // Imported functions:

View File

@ -9,7 +9,6 @@
#include "confirm.h" #include "confirm.h"
#include "block_commande.h" #include "block_commande.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "class_library.h" #include "class_library.h"
#include "protos.h" #include "protos.h"

View File

@ -15,12 +15,15 @@
#include "kicad_string.h" #include "kicad_string.h"
#include "gestfich.h" #include "gestfich.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "class_sch_screen.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "class_library.h" #include "class_library.h"
#include "netlist.h" #include "netlist.h"
#include "protos.h" #include "protos.h"
#include "class_drawsheet.h"
#include "template_fieldnames.h"
#include "class_sch_component.h"
#include "build_version.h" #include "build_version.h"

View File

@ -7,12 +7,17 @@
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "wxEeschemaStruct.h"
#include "class_sch_screen.h"
#include "program.h"
#include "lib_draw_item.h" #include "lib_draw_item.h"
#include "lib_pin.h" #include "lib_pin.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_schematic_items.h"
#include "class_text-label.h"
#include "class_sch_component.h"
#include "class_drawsheet.h"
/* Routines Locales */ /* Routines Locales */

View File

@ -8,10 +8,13 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "eeschema_id.h" #include "eeschema_id.h"
#include "confirm.h" #include "confirm.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_schematic_items.h"
static int s_LastShape = '\\'; static int s_LastShape = '\\';
static wxPoint ItemInitialPosition; static wxPoint ItemInitialPosition;
@ -20,8 +23,7 @@ static wxPoint ItemInitialPosition;
static void ExitBusEntry( WinEDA_DrawPanel* Panel, wxDC* DC ) static void ExitBusEntry( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
/* Exit bus entry mode. */ /* Exit bus entry mode. */
SCH_BUS_ENTRY* BusEntry = SCH_BUS_ENTRY* BusEntry = (SCH_BUS_ENTRY*) Panel->GetScreen()->GetCurItem();
(SCH_BUS_ENTRY*) Panel->GetScreen()->GetCurItem();
if( BusEntry ) if( BusEntry )
{ {

View File

@ -13,18 +13,23 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "macros.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "drawtxt.h" #include "drawtxt.h"
#include "confirm.h" #include "confirm.h"
#include "trigo.h" #include "trigo.h"
#include "richio.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_drawsheet.h"
#include "class_drawsheetpath.h"
#include "class_sch_component.h"
SCH_SHEET::SCH_SHEET( const wxPoint& pos ) : SCH_SHEET::SCH_SHEET( const wxPoint& pos ) : SCH_ITEM( NULL, DRAW_SHEET_STRUCT_TYPE )
SCH_ITEM( NULL, DRAW_SHEET_STRUCT_TYPE )
{ {
m_Layer = LAYER_SHEET; m_Layer = LAYER_SHEET;
m_Pos = pos; m_Pos = pos;
@ -96,6 +101,152 @@ bool SCH_SHEET::Save( FILE* aFile ) const
} }
bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
{
int ii, fieldNdx, size;
char Name1[256];
SCH_SHEET_PIN* SheetLabel;
char* ptcar;
m_TimeStamp = GetTimeStamp();
// sheets are added to the EEDrawList 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 Errror" ) );
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 << CONV_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", &m_TimeStamp );
if( m_TimeStamp == 0 ) // zero is not unique!
m_TimeStamp = GetTimeStamp();
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 << CONV_FROM_UTF8( (char*) aLine );
return false;
}
for( ptcar++, ii = 0; ; ii++, ptcar++ )
{
Name1[ii] = *ptcar;
if( *ptcar == 0 )
{
aErrorMsg.Printf( wxT( "EESchema file sheet field F at line %d, aborted\n" ),
aLine.LineNumber() );
aErrorMsg << CONV_FROM_UTF8( (char*) aLine );
return false;
}
if( *ptcar == '"' )
{
Name1[ii] = 0;
ptcar++;
break;
}
}
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 << CONV_FROM_UTF8( (char*) aLine );
}
if( size == 0 )
size = DEFAULT_SIZE_TEXT;
if( fieldNdx == 0 )
{
m_SheetName = CONV_FROM_UTF8( Name1 );
m_SheetNameSize = size;
}
else
{
SetFileName( CONV_FROM_UTF8( Name1 ) );
//printf( "in ReadSheetDescr : m_FileName = %s \n", Name1 );
m_FileNameSize = size;
}
}
if( fieldNdx > 1 )
{
SheetLabel = new SCH_SHEET_PIN( this );
if( !SheetLabel->Load( aLine, aErrorMsg ) )
{
delete SheetLabel;
SheetLabel = NULL;
return false;
}
AddLabel( SheetLabel );
}
}
if( strnicmp( "$End", ((char*)aLine), 4 ) != 0 )
{
aErrorMsg.Printf( wxT( "**EESchema file end_sheet struct error at line %d, aborted\n" ),
aLine.LineNumber() );
aErrorMsg << CONV_FROM_UTF8( ((char*)aLine) );
return false;
}
return true;
}
/* creates a copy of a sheet /* creates a copy of a sheet
* The linked data itself (EEDrawList) is not duplicated * The linked data itself (EEDrawList) is not duplicated
*/ */

View File

@ -5,12 +5,19 @@
#ifndef CLASS_DRAWSHEET_H #ifndef CLASS_DRAWSHEET_H
#define CLASS_DRAWSHEET_H #define CLASS_DRAWSHEET_H
#include "base_struct.h"
#include <boost/ptr_container/ptr_vector.hpp> #include <boost/ptr_container/ptr_vector.hpp>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include "class_text-label.h" #include "class_text-label.h"
extern SCH_SHEET* g_RootSheet;
class LINE_READER;
class SCH_SCREEN;
class SCH_SHEET;
class SCH_SHEET_PIN;
class SCH_SHEET_PATH;
class DANGLING_END_ITEM;
class WinEDA_SchematicFrame;
/** /**
* Pin (label) used in sheets to create hierarchical schematics. * Pin (label) used in sheets to create hierarchical schematics.
@ -117,6 +124,16 @@ public:
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/**
* Load schematic sheet hierarchical lable from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read the sheet hierarchical label from.
* @param aErrorMsg - Description of the error if an error occurs while loading the sheet
* hierarchical label.
* @return True if the sheet heirarchical label loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
#if defined(DEBUG) #if defined(DEBUG)
// comment inherited by Doxygen from Base_Struct // comment inherited by Doxygen from Base_Struct
@ -229,6 +246,15 @@ public:
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/**
* Load schematic sheet from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read the component from.
* @param aErrorMsg - Description of the error if an error occurs while loading the sheet.
* @return True if the sheet loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
SCH_SHEET* GenCopy(); SCH_SHEET* GenCopy();
void DisplayInfo( WinEDA_DrawFrame* frame ); void DisplayInfo( WinEDA_DrawFrame* frame );

View File

@ -10,9 +10,15 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "dlist.h" #include "dlist.h"
#include "class_sch_screen.h"
#include "sch_item_struct.h"
#include "class_drawsheet.h"
#include "class_drawsheetpath.h"
#include "class_sch_component.h"
#include "template_fieldnames.h"
#include "dialogs/dialog_schematic_find.h" #include "dialogs/dialog_schematic_find.h"

View File

@ -50,7 +50,11 @@
*/ */
class wxFindReplaceData;
class SCH_SCREEN;
class SCH_MARKER; class SCH_MARKER;
class SCH_SHEET;
class SCH_ITEM;
/** /**

View File

@ -18,10 +18,13 @@
#include "drawtxt.h" #include "drawtxt.h"
#include "plot_common.h" #include "plot_common.h"
#include "trigo.h" #include "trigo.h"
#include "richio.h"
#include "class_sch_screen.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_drawsheet.h"
/* m_Edge define on which edge the pin is positionned: /* m_Edge define on which edge the pin is positionned:
* *
@ -259,6 +262,74 @@ bool SCH_SHEET_PIN::Save( FILE* aFile ) const
} }
bool SCH_SHEET_PIN::Load( LINE_READER& aLine, wxString& aErrorMsg )
{
int size;
char number[256];
char name[256];
char connectType[256];
char sheetSide[256];
/* Read coordinates. */
if( sscanf( ((char*)aLine), "%s %s %s %s %d %d %d",
number, name, connectType, sheetSide, &m_Pos.x, &m_Pos.y, &size ) != 7 )
{
aErrorMsg.Printf( wxT( "EESchema file sheet hierarchical label error at line %d.\n" ),
aLine.LineNumber() );
aErrorMsg << CONV_FROM_UTF8( ((char*)aLine) );
return false;
}
m_Text = CONV_FROM_UTF8( name );
m_Text = m_Text.AfterFirst( wxChar( '"' ) );
m_Text = m_Text.BeforeLast( wxChar( '"' ) );
if( size == 0 )
size = DEFAULT_SIZE_TEXT;
m_Size.x = m_Size.y = size;
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( 1 );
break;
case 'T' : /* pin on top side */
SetEdge( 2 );
break;
case 'B' : /* pin on bottom side */
SetEdge( 3 );
break;
case 'L' : /* pin on left side */
default :
SetEdge( 0 );
break;
}
return true;
}
/** function Matches /** function Matches
* Compare hierarchical pin name against search string. * Compare hierarchical pin name against search string.
* @param aSearchData - Criteria to search against. * @param aSearchData - Criteria to search against.

View File

@ -4,14 +4,17 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "macros.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "plot_common.h" #include "plot_common.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "class_sch_screen.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "template_fieldnames.h"
#include "transform.h"
#include "class_library.h" #include "class_library.h"
#include "class_libentry.h" #include "class_libentry.h"
#include "lib_pin.h" #include "lib_pin.h"

View File

@ -5,6 +5,7 @@
#ifndef CLASS_LIBENTRY_H #ifndef CLASS_LIBENTRY_H
#define CLASS_LIBENTRY_H #define CLASS_LIBENTRY_H
#include "general.h"
#include "lib_draw_item.h" #include "lib_draw_item.h"
#include "lib_field.h" #include "lib_field.h"

View File

@ -5,12 +5,13 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "macros.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "confirm.h" #include "confirm.h"
#include "gestfich.h" #include "gestfich.h"
#include "eda_doc.h" #include "eda_doc.h"
#include "wxstruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h" #include "class_library.h"

View File

@ -6,8 +6,11 @@
#define CLASS_LIBRARY_H #define CLASS_LIBRARY_H
#include <wx/filename.h>
#include "class_libentry.h" #include "class_libentry.h"
/* /*
* Component Library version and file header macros. * Component Library version and file header macros.
*/ */

View File

@ -3,16 +3,16 @@
/*******************************************/ /*******************************************/
#include "fctsys.h" #include "fctsys.h"
#include "wxstruct.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "common.h" #include "common.h"
#include "program.h"
#include "general.h"
#include "trigo.h" #include "trigo.h"
#include "general.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
#include "erc.h" #include "erc.h"
/* Marker are mainly used to show an ERC error /* Marker are mainly used to show an ERC error
* but they could be used to give a specific info * but they could be used to give a specific info
*/ */
@ -51,8 +51,7 @@ SCH_MARKER::~SCH_MARKER()
SCH_MARKER* SCH_MARKER::GenCopy() SCH_MARKER* SCH_MARKER::GenCopy()
{ {
SCH_MARKER* newitem = new SCH_MARKER( GetPos(), SCH_MARKER* newitem = new SCH_MARKER( GetPos(), GetReporter().GetMainText() );
GetReporter().GetMainText() );
newitem->SetMarkerType( GetMarkerType() ); newitem->SetMarkerType( GetMarkerType() );
newitem->SetErrorLevel( GetErrorLevel() ); newitem->SetErrorLevel( GetErrorLevel() );

View File

@ -5,9 +5,11 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "program.h" #include "macros.h"
#include "general.h" #include "wxEeschemaStruct.h"
#include "general.h"
#include "class_sch_component.h"
#include "class_netlist_object.h" #include "class_netlist_object.h"
#if defined(DEBUG) #if defined(DEBUG)

View File

@ -6,6 +6,8 @@
#ifndef _CLASS_NETLIST_OBJECT_H_ #ifndef _CLASS_NETLIST_OBJECT_H_
#define _CLASS_NETLIST_OBJECT_H_ #define _CLASS_NETLIST_OBJECT_H_
#include "class_drawsheetpath.h"
#include "lib_pin.h" // LIB_PIN::ReturnPinStringNum( m_PinNum ) #include "lib_pin.h" // LIB_PIN::ReturnPinStringNum( m_PinNum )

View File

@ -18,11 +18,15 @@
#include "drawtxt.h" #include "drawtxt.h"
#include "macros.h" #include "macros.h"
#include "trigo.h" #include "trigo.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h" #include "class_library.h"
#include "class_sch_component.h"
#include "class_sch_cmp_field.h"
#include "template_fieldnames.h"
SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId,

View File

@ -14,6 +14,12 @@
*/ */
#include "sch_item_struct.h"
#include "general.h"
class WinEDA_SchematicFrame;
class SCH_COMPONENT; class SCH_COMPONENT;
class LIB_FIELD; class LIB_FIELD;

View File

@ -8,16 +8,23 @@
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "trigo.h" #include "trigo.h"
#include "kicad_string.h"
#include "richio.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "macros.h" #include "macros.h"
#include "protos.h" #include "protos.h"
#include "class_library.h" #include "class_library.h"
#include "dialogs/dialog_schematic_find.h"
#include "lib_rectangle.h" #include "lib_rectangle.h"
#include "lib_pin.h" #include "lib_pin.h"
#include "lib_text.h" #include "lib_text.h"
#include "class_sch_component.h"
#include "class_drawsheet.h"
#include "class_drawsheetpath.h"
#include "template_fieldnames.h"
#include "dialogs/dialog_schematic_find.h"
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
@ -1092,6 +1099,320 @@ bool SCH_COMPONENT::Save( FILE* f ) const
} }
bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
{
int ii;
char Name1[256], Name2[256],
Char1[256], Char2[256], Char3[256];
int newfmt = 0;
char* ptcar;
wxString fieldName;
m_Convert = 1;
if( ((char*)aLine)[0] == '$' )
{
newfmt = 1;
if( !aLine.ReadLine() )
return TRUE;
}
if( sscanf( &((char*)aLine)[1], "%s %s", Name1, Name2 ) != 2 )
{
aErrorMsg.Printf( wxT( "EESchema Component descr error at line %d, aborted" ),
aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( ((char*)aLine) );
return false;
}
if( strcmp( Name1, NULL_STRING ) != 0 )
{
for( ii = 0; ii < (int) strlen( Name1 ); ii++ )
if( Name1[ii] == '~' )
Name1[ii] = ' ';
m_ChipName = CONV_FROM_UTF8( Name1 );
if( !newfmt )
GetField( VALUE )->m_Text = CONV_FROM_UTF8( Name1 );
}
else
{
m_ChipName.Empty();
GetField( VALUE )->m_Text.Empty();
GetField( VALUE )->m_Orient = TEXT_ORIENT_HORIZ;
GetField( VALUE )->m_Attributs = TEXT_NO_VISIBLE;
}
if( strcmp( Name2, NULL_STRING ) != 0 )
{
bool isDigit = false;
for( ii = 0; ii < (int) strlen( Name2 ); ii++ )
{
if( Name2[ii] == '~' )
Name2[ii] = ' ';
// get RefBase from this, too. store in Name1.
if( Name2[ii] >= '0' && Name2[ii] <= '9' )
{
isDigit = true;
Name1[ii] = 0; //null-terminate.
}
if( !isDigit )
{
Name1[ii] = Name2[ii];
}
}
Name1[ii] = 0; //just in case
int jj;
for( jj = 0; jj<ii && Name1[jj] == ' '; jj++ )
;
if( jj == ii )
{
// blank string.
m_PrefixString = wxT( "U" );
}
else
{
m_PrefixString = CONV_FROM_UTF8( &Name1[jj] );
//printf("prefix: %s\n", CONV_TO_UTF8(component->m_PrefixString));
}
if( !newfmt )
GetField( REFERENCE )->m_Text = CONV_FROM_UTF8( Name2 );
}
else
{
GetField( REFERENCE )->m_Attributs = TEXT_NO_VISIBLE;
}
/* 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( !aLine.ReadLine() )
return false;
if( ((char*)aLine)[0] == 'U' )
{
sscanf( ((char*)aLine) + 1, "%d %d %lX", &m_Multi, &m_Convert, &m_TimeStamp );
}
else if( ((char*)aLine)[0] == 'P' )
{
sscanf( ((char*)aLine) + 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; i<GetFieldCount(); ++i )
{
if( GetField( i )->m_Text.IsEmpty() )
GetField( i )->m_Pos = m_Pos;
}
}
else if( ((char*)aLine)[0] == 'A' && ((char*)aLine)[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 = ((char*)aLine) + 2;
//copy the path.
ii = ReadDelimitedText( Name1, ptcar, 255 );
ptcar += ii + 1;
wxString path = CONV_FROM_UTF8( Name1 );
// copy the reference
ii = ReadDelimitedText( Name1, ptcar, 255 );
ptcar += ii + 1;
wxString ref = CONV_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_Multi );
int multi = atoi( Name1 );
if( multi < 0 || multi > 25 )
multi = 1;
AddHierarchicalReference( path, ref, multi );
GetField( REFERENCE )->m_Text = ref;
}
else if( ((char*)aLine)[0] == 'F' )
{
int fieldNdx;
char FieldUserName[1024];
GRTextHorizJustifyType hjustify = GR_TEXT_HJUSTIFY_CENTER;
GRTextVertJustifyType vjustify = GR_TEXT_VJUSTIFY_CENTER;
FieldUserName[0] = 0;
ptcar = (char*) aLine;
while( *ptcar && (*ptcar != '"') )
ptcar++;
if( *ptcar != '"' )
{
aErrorMsg.Printf( wxT( "EESchema file lib field F at line %d, aborted" ),
aLine.LineNumber() );
return false;
}
for( ptcar++, ii = 0; ; ii++, ptcar++ )
{
Name1[ii] = *ptcar;
if( *ptcar == 0 )
{
aErrorMsg.Printf( wxT( "Component field F at line %d, aborted" ),
aLine.LineNumber() );
return false;
}
if( *ptcar == '"' )
{
Name1[ii] = 0;
ptcar++;
break;
}
}
fieldNdx = atoi( ((char*)aLine) + 2 );
ReadDelimitedText( FieldUserName, ptcar, sizeof(FieldUserName) );
if( !FieldUserName[0] )
fieldName = TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldNdx );
else
fieldName = CONV_FROM_UTF8( FieldUserName );
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 )->m_Name = fieldName;
}
GetField( fieldNdx )->m_Text = CONV_FROM_UTF8( Name1 );
memset( Char3, 0, sizeof(Char3) );
if( ( ii = sscanf( ptcar, "%s %d %d %d %X %s %s", Char1,
&GetField( fieldNdx )->m_Pos.x,
&GetField( fieldNdx )->m_Pos.y,
&GetField( fieldNdx )->m_Size.x,
&GetField( fieldNdx )->m_Attributs,
Char2, Char3 ) ) < 4 )
{
aErrorMsg.Printf( wxT( "Component Field error line %d, aborted" ),
aLine.LineNumber() );
continue;
}
if( (GetField( fieldNdx )->m_Size.x == 0 ) || (ii == 4) )
GetField( fieldNdx )->m_Size.x = DEFAULT_SIZE_TEXT;
GetField( fieldNdx )->m_Orient = TEXT_ORIENT_HORIZ;
GetField( fieldNdx )->m_Size.y = GetField( fieldNdx )->m_Size.x;
if( Char1[0] == 'V' )
GetField( fieldNdx )->m_Orient = TEXT_ORIENT_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;
if( Char3[1] == 'I' )
GetField( fieldNdx )->m_Italic = true;
else
GetField( fieldNdx )->m_Italic = false;
if( Char3[2] == 'B' )
GetField( fieldNdx )->m_Bold = true;
else
GetField( fieldNdx )->m_Bold = false;
GetField( fieldNdx )->m_HJustify = hjustify;
GetField( fieldNdx )->m_VJustify = vjustify;
}
if( fieldNdx == REFERENCE )
if( GetField( fieldNdx )->m_Text[0] == '#' )
GetField( fieldNdx )->m_Attributs |= TEXT_NO_VISIBLE;
}
else
break;
}
if( sscanf( ((char*)aLine), "%d %d %d", &m_Multi, &m_Pos.x, &m_Pos.y ) != 3 )
{
aErrorMsg.Printf( wxT( "Component unit & pos error at line %d, aborted" ),
aLine.LineNumber() );
return false;
}
if( !aLine.ReadLine() ||
sscanf( ((char*)aLine), "%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( !aLine.ReadLine() )
return false;
if( strnicmp( "$End", ((char*)aLine), 4 ) != 0 )
{
aErrorMsg.Printf( wxT( "Component End expected at line %d, aborted" ),
aLine.LineNumber() );
return false;
}
}
return true;
}
/** /**
* Function GetBoundingBox * Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display purposes. * returns the orthogonal, bounding box of this object for display purposes.

View File

@ -6,12 +6,14 @@
#define COMPONENT_CLASS_H #define COMPONENT_CLASS_H
#include "class_sch_screen.h"
#include "class_sch_cmp_field.h" #include "class_sch_cmp_field.h"
#include "transform.h" #include "transform.h"
#include "general.h"
class SCH_SHEET_PATH; class SCH_SHEET_PATH;
class LIB_PIN;
class LIB_COMPONENT;
/** /**
@ -132,6 +134,14 @@ public:
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/**
* Load schematic component from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read the component from.
* @param aErrorMsg - Description of the error if an error occurs while loading the component.
* @return True if the component loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/** /**
* Function Load * Function Load

View File

@ -6,11 +6,17 @@
#include "eeschema_id.h" #include "eeschema_id.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "sch_item_struct.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h" #include "class_library.h"
#include "class_schematic_items.h"
#include "class_drawsheet.h"
#include <boost/foreach.hpp>
void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen ) void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )

View File

@ -4,12 +4,18 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "macros.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "trigo.h" #include "trigo.h"
#include "common.h" #include "common.h"
#include "program.h" #include "richio.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_schematic_items.h"
#include <boost/foreach.hpp>
/* used to calculate the pen size from default value /* used to calculate the pen size from default value
* the actual pen size is default value * BUS_WIDTH_EXPAND * the actual pen size is default value * BUS_WIDTH_EXPAND
@ -94,6 +100,44 @@ bool SCH_BUS_ENTRY::Save( FILE* aFile ) const
} }
bool SCH_BUS_ENTRY::Load( LINE_READER& aLine, wxString& aErrorMsg )
{
char Name1[256];
char Name2[256];
char* line = (char*) aLine;
while( (*line != ' ' ) && *line )
line++;
if( sscanf( line, "%s %s", Name1, Name2 ) != 2 )
{
aErrorMsg.Printf( wxT( "EESchema file bus entry load error at line %d" ),
aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine );
return false;
}
m_Layer = LAYER_WIRE;
if( Name1[0] == 'B' )
m_Layer = LAYER_BUS;
if( !aLine.ReadLine() || sscanf( (char*) aLine, "%d %d %d %d ", &m_Pos.x, &m_Pos.y,
&m_Size.x, &m_Size.y ) != 4 )
{
aErrorMsg.Printf( wxT( "EESchema file bus entry load error at line %d" ),
aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine );
return false;
}
m_Size.x -= m_Pos.x;
m_Size.y -= m_Pos.y;
return true;
}
EDA_Rect SCH_BUS_ENTRY::GetBoundingBox() EDA_Rect SCH_BUS_ENTRY::GetBoundingBox()
{ {
EDA_Rect box; EDA_Rect box;
@ -246,6 +290,26 @@ bool SCH_JUNCTION::Save( FILE* aFile ) const
} }
bool SCH_JUNCTION::Load( LINE_READER& aLine, wxString& aErrorMsg )
{
char name[256];
char* line = (char*) aLine;
while( (*line != ' ' ) && *line )
line++;
if( sscanf( line, "%s %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" ) << CONV_FROM_UTF8( (char*) aLine );
return false;
}
return true;
}
EDA_Rect SCH_JUNCTION::GetBoundingBox() EDA_Rect SCH_JUNCTION::GetBoundingBox()
{ {
EDA_Rect rect; EDA_Rect rect;
@ -435,6 +499,26 @@ bool SCH_NO_CONNECT::Save( FILE* aFile ) const
} }
bool SCH_NO_CONNECT::Load( LINE_READER& aLine, wxString& aErrorMsg )
{
char name[256];
char* line = (char*) aLine;
while( (*line != ' ' ) && *line )
line++;
if( sscanf( line, "%s %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" ) << CONV_FROM_UTF8( ((char*)aLine) );
return false;
}
return true;
}
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
@ -631,6 +715,43 @@ bool SCH_LINE::Save( FILE* aFile ) const
} }
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, "%s %s", Name1, Name2 ) != 2 )
{
aErrorMsg.Printf( wxT( "EESchema file segment error at line %d, aborted" ),
aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_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" ) << CONV_FROM_UTF8( (char*) aLine );
return false;
}
return true;
}
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
@ -917,6 +1038,50 @@ bool SCH_POLYLINE::Save( FILE* aFile ) const
} }
bool SCH_POLYLINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
{
char Name1[256];
char Name2[256];
wxPoint pt;
int ii;
char* line = (char*) aLine;
while( (*line != ' ' ) && *line )
line++;
if( sscanf( line, "%s %s %d", Name1, Name2, &ii ) != 3 )
{
aErrorMsg.Printf( wxT( "EESchema file polyline struct error at line %d, aborted" ),
aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine );
return false;
}
m_Layer = LAYER_NOTES;
if( Name2[0] == 'W' )
m_Layer = LAYER_WIRE;
if( Name2[0] == 'B' )
m_Layer = LAYER_BUS;
for( unsigned jj = 0; jj < (unsigned)ii; jj++ )
{
wxPoint point;
if( !aLine.ReadLine() || sscanf( ((char*) aLine), "%d %d", &pt.x, &pt.y ) != 2 )
{
aErrorMsg.Printf( wxT( "EESchema file polyline struct error at line %d, aborted" ),
aLine.LineNumber() );
aErrorMsg << wxT( "\n" ) << CONV_FROM_UTF8( (char*) aLine );
return false;
}
AddPoint( pt );
}
return true;
}
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */

View File

@ -5,6 +5,12 @@
#ifndef CLASS_SCHEMATIC_ITEMS_H #ifndef CLASS_SCHEMATIC_ITEMS_H
#define CLASS_SCHEMATIC_ITEMS_H #define CLASS_SCHEMATIC_ITEMS_H
#include "sch_item_struct.h"
#include "general.h"
/* Flags for BUS ENTRY (bus to bus or wire to bus */ /* Flags for BUS ENTRY (bus to bus or wire to bus */
#define WIRE_TO_BUS 0 #define WIRE_TO_BUS 0
#define BUS_TO_BUS 1 #define BUS_TO_BUS 1
@ -26,7 +32,7 @@ public:
bool m_EndIsDangling; // TRUE if not connected (wires, tracks...) bool m_EndIsDangling; // TRUE if not connected (wires, tracks...)
public: public:
SCH_LINE( const wxPoint& pos, int layer ); SCH_LINE( const wxPoint& pos = wxPoint( 0, 0 ), int layer = LAYER_NOTES );
~SCH_LINE() { } ~SCH_LINE() { }
SCH_LINE* Next() const { return (SCH_LINE*) Pnext; } SCH_LINE* Next() const { return (SCH_LINE*) Pnext; }
@ -68,6 +74,16 @@ public:
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/**
* Load schematic line from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic line from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic line.
* @return True if the schematic line loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
@ -132,7 +148,7 @@ public:
wxSize m_Size; // size of this symbol wxSize m_Size; // size of this symbol
public: public:
SCH_NO_CONNECT( const wxPoint& pos ); SCH_NO_CONNECT( const wxPoint& pos = wxPoint( 0, 0 ) );
~SCH_NO_CONNECT() { } ~SCH_NO_CONNECT() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
@ -160,6 +176,16 @@ public:
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/**
* Load schematic no connect entry from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic no connect from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic no connect.
* @return True if the schematic no connect loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/** Function HitTest /** Function HitTest
* @return true if the point aPosRef is within item area * @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test * @param aPosRef = a wxPoint to test
@ -215,7 +241,7 @@ public:
wxSize m_Size; wxSize m_Size;
public: public:
SCH_BUS_ENTRY( const wxPoint& pos, int shape, int id ); SCH_BUS_ENTRY( const wxPoint& pos = wxPoint( 0, 0 ), int shape = '\\', int id = WIRE_TO_BUS );
~SCH_BUS_ENTRY() { } ~SCH_BUS_ENTRY() { }
virtual wxString GetClass() const virtual wxString GetClass() const
@ -239,6 +265,16 @@ public:
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/**
* Load schematic bus entry from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic bus entry from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic bus entry.
* @return True if the schematic bus entry loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/** /**
* Function GetBoundingBox * Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display * returns the orthogonal, bounding box of this object for display
@ -288,7 +324,7 @@ public:
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2) std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
public: public:
SCH_POLYLINE( int layer ); SCH_POLYLINE( int layer = LAYER_NOTES );
~SCH_POLYLINE(); ~SCH_POLYLINE();
virtual wxString GetClass() const virtual wxString GetClass() const
@ -311,6 +347,16 @@ public:
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/**
* Load schematic poly line entry from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic poly line from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic poly line.
* @return True if the schematic poly line loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/** Function AddPoint /** Function AddPoint
* add a corner to m_PolyPoints * add a corner to m_PolyPoints
*/ */
@ -361,7 +407,7 @@ public:
wxSize m_Size; wxSize m_Size;
public: public:
SCH_JUNCTION( const wxPoint& pos ); SCH_JUNCTION( const wxPoint& pos = wxPoint( 0, 0 ) );
~SCH_JUNCTION() { } ~SCH_JUNCTION() { }
virtual wxString GetClass() const virtual wxString GetClass() const
@ -405,6 +451,16 @@ public:
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/**
* Load schematic junction entry from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic junction from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic junction.
* @return True if the schematic junction loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** virtual function Move /** virtual function Move

View File

@ -5,14 +5,16 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "macros.h"
#include "trigo.h" #include "trigo.h"
#include "eeschema_id.h" #include "eeschema_id.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "drawtxt.h" #include "drawtxt.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_text-label.h"
/************************/ /************************/
@ -490,6 +492,80 @@ bool SCH_TEXT::Save( FILE* aFile ) const
} }
bool SCH_TEXT::Load( LINE_READER& aLine, wxString& aErrorMsg )
{
char Name1[256];
char Name2[256];
char Name3[256];
int thickness = 0, size = 0, orient = 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, "%s %d %d %d %d %s %s %d", Name1, &m_Pos.x, &m_Pos.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 = DEFAULT_SIZE_TEXT;
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 = CONV_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;
m_Size.x = m_Size.y = size;
SetSchematicTextOrientation( orient );
if( isdigit( Name3[0] ) )
{
thickness = atol( Name3 );
m_Bold = ( thickness != 0 );
m_Width = m_Bold ? GetPenSizeForBold( size ) : 0;
}
if( strnicmp( Name2, "Italic", 6 ) == 0 )
m_Italic = 1;
return true;
}
void SCH_TEXT::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ) void SCH_TEXT::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
{ {
// Normal text labels cannot be tested for dangling ends. // Normal text labels cannot be tested for dangling ends.
@ -713,6 +789,68 @@ bool SCH_LABEL::Save( FILE* aFile ) const
} }
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;
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, "%s %d %d %d %d %s %s %d", Name1, &m_Pos.x, &m_Pos.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 = DEFAULT_SIZE_TEXT;
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 = CONV_FROM_UTF8( text );
m_Size.x = m_Size.y = size;
SetSchematicTextOrientation( orient );
if( isdigit( Name3[0] ) )
{
thickness = atol( Name3 );
m_Bold = ( thickness != 0 );
m_Width = m_Bold ? GetPenSizeForBold( size ) : 0;
}
if( stricmp( Name2, "Italic" ) == 0 )
m_Italic = 1;
return true;
}
/** Function SCH_LABEL::Draw /** Function SCH_LABEL::Draw
* a label is drawn like a text. So just call SCH_TEXT::Draw * a label is drawn like a text. So just call SCH_TEXT::Draw
*/ */
@ -805,6 +943,71 @@ bool SCH_GLOBALLABEL::Save( FILE* aFile ) const
} }
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;
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, "%s %d %d %d %d %s %s %d", Name1, &m_Pos.x, &m_Pos.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 = DEFAULT_SIZE_TEXT;
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 = CONV_FROM_UTF8( text );
m_Size.x = m_Size.y = size;
SetSchematicTextOrientation( orient );
m_Shape = NET_INPUT;
m_Bold = ( thickness != 0 );
m_Width = m_Bold ? GetPenSizeForBold( size ) : 0;
if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 )
m_Shape = NET_OUTPUT;
if( stricmp( Name2, SheetLabelType[NET_BIDI] ) == 0 )
m_Shape = NET_BIDI;
if( stricmp( Name2, SheetLabelType[NET_TRISTATE] ) == 0 )
m_Shape = NET_TRISTATE;
if( stricmp( Name2, SheetLabelType[NET_UNSPECIFIED] ) == 0 )
m_Shape = NET_UNSPECIFIED;
if( stricmp( Name3, "Italic" ) == 0 )
m_Italic = 1;
return true;
}
/** Function HitTest /** Function HitTest
* @return true if the point aPosRef is within item area * @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test * @param aPosRef = a wxPoint to test
@ -1193,6 +1396,70 @@ bool SCH_HIERLABEL::Save( FILE* aFile ) const
} }
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;
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, "%s %d %d %d %d %s %s %d", Name1, &m_Pos.x, &m_Pos.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 = DEFAULT_SIZE_TEXT;
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 = CONV_FROM_UTF8( text );
m_Size.x = m_Size.y = size;
SetSchematicTextOrientation( orient );
m_Shape = NET_INPUT;
m_Bold = ( thickness != 0 );
m_Width = m_Bold ? GetPenSizeForBold( size ) : 0;
if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 )
m_Shape = NET_OUTPUT;
if( stricmp( Name2, SheetLabelType[NET_BIDI] ) == 0 )
m_Shape = NET_BIDI;
if( stricmp( Name2, SheetLabelType[NET_TRISTATE] ) == 0 )
m_Shape = NET_TRISTATE;
if( stricmp( Name2, SheetLabelType[NET_UNSPECIFIED] ) == 0 )
m_Shape = NET_UNSPECIFIED;
if( stricmp( Name3, "Italic" ) == 0 )
m_Italic = 1;
return true;
}
/** Function HitTest /** Function HitTest
* @return true if the point aPosRef is within item area * @return true if the point aPosRef is within item area

View File

@ -5,8 +5,13 @@
#ifndef CLASS_TEXT_LABEL_H #ifndef CLASS_TEXT_LABEL_H
#define CLASS_TEXT_LABEL_H #define CLASS_TEXT_LABEL_H
#include "macros.h" #include "macros.h"
#include "base_struct.h" #include "sch_item_struct.h"
class LINE_READER;
/* Type of SCH_HIERLABEL and SCH_GLOBALLABEL /* Type of SCH_HIERLABEL and SCH_GLOBALLABEL
* mainly used to handle the graphic associated shape * mainly used to handle the graphic associated shape
@ -23,8 +28,7 @@ typedef enum {
extern const char* SheetLabelType[]; /* names of types of labels */ extern const char* SheetLabelType[]; /* names of types of labels */
class SCH_TEXT : public SCH_ITEM, class SCH_TEXT : public SCH_ITEM, public EDA_TextStruct
public EDA_TextStruct
{ {
public: public:
int m_Layer; int m_Layer;
@ -133,6 +137,16 @@ public:
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/**
* Load schematic text entry from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic text from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic text.
* @return True if the schematic text loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
@ -246,6 +260,16 @@ public:
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/**
* Load schematic label entry from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic label from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic label.
* @return True if the schematic label loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
}; };
@ -299,6 +323,16 @@ public:
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/**
* Load schematic global label entry from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic global label from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic global label.
* @return True if the schematic global label loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/** Function HitTest /** Function HitTest
* @return true if the point aPosRef is within item area * @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test * @param aPosRef = a wxPoint to test
@ -390,6 +424,16 @@ public:
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/**
* Load schematic hierarchical label entry from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic hierarchical label from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic hierarchical label.
* @return True if the schematic hierarchical label loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/** Function HitTest /** Function HitTest
* @return true if the point aPosRef is within item area * @return true if the point aPosRef is within item area
* @param aPosRef = a wxPoint to test * @param aPosRef = a wxPoint to test

View File

@ -7,11 +7,12 @@
#include "trigo.h" #include "trigo.h"
#include "confirm.h" #include "confirm.h"
#include "macros.h" #include "macros.h"
#include "class_sch_screen.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "netlist.h" #include "netlist.h"
#include "class_schematic_items.h"
/* Routine to start/end segment (BUS or wires) on junctions. /* Routine to start/end segment (BUS or wires) on junctions.

View File

@ -7,16 +7,19 @@
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "eda_dde.h" #include "eda_dde.h"
#include "eeschema_id.h" #include "wxEeschemaStruct.h"
#include "program.h" #include "eeschema_id.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditframe.h" #include "libeditframe.h"
#include "viewlib_frame.h" #include "viewlib_frame.h"
#include "lib_draw_item.h" #include "lib_draw_item.h"
#include "lib_pin.h" #include "lib_pin.h"
#include "class_drawsheet.h"
#include "class_drawsheetpath.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
#include "class_sch_component.h"
/** Function SchematicGeneralLocateAndDisplay /** Function SchematicGeneralLocateAndDisplay

View File

@ -5,14 +5,16 @@
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "macros.h"
#include "eda_dde.h" #include "eda_dde.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "eeschema_id.h" #include "eeschema_id.h"
#include "protos.h" #include "protos.h"
#include "lib_draw_item.h" #include "lib_draw_item.h"
#include "lib_pin.h" #include "lib_pin.h"
#include "class_sch_component.h"
/***************************************************************/ /***************************************************************/

View File

@ -4,12 +4,14 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "sch_item_struct.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_libentry.h" #include "class_libentry.h"
#include "lib_pin.h" #include "lib_pin.h"
#include "class_sch_component.h"
/* Returns true if the point P is on the segment S. */ /* Returns true if the point P is on the segment S. */

View File

@ -5,11 +5,12 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "macros.h"
#include "confirm.h" #include "confirm.h"
#include "eda_doc.h" #include "eda_doc.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "wxstruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h" #include "class_library.h"
@ -29,8 +30,7 @@
* Place the name of the component has loaded, select from a list in * Place the name of the component has loaded, select from a list in
* BufName * BufName
*/ */
wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys, wxString DataBaseGetName( WinEDA_DrawFrame* frame, wxString& Keys, wxString& BufName )
wxString& BufName )
{ {
wxArrayString nameList; wxArrayString nameList;
wxString msg; wxString msg;

View File

@ -5,15 +5,19 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
#include "class_schematic_items.h"
#include "class_drawsheet.h"
#include "class_text-label.h"
// Imported function: // Imported function:
void DeleteItemsInList( WinEDA_DrawPanel* panel, void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList );
PICKED_ITEMS_LIST& aItemsList );
/* /*

View File

@ -6,10 +6,12 @@
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "confirm.h" #include "confirm.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_drawsheet.h"
/**************************************************************************/ /**************************************************************************/

View File

@ -12,13 +12,16 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "gestfich.h" #include "gestfich.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "dialog_SVG_print_base.h" #include "dialog_SVG_print_base.h"
#include "dcsvg.h" #include "dcsvg.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "libeditframe.h" #include "libeditframe.h"
#include "class_drawsheetpath.h"
// Keys for configuration // Keys for configuration
#define PLOTSVGMODECOLOR_KEY wxT( "PlotSVGModeColor" ) #define PLOTSVGMODECOLOR_KEY wxT( "PlotSVGModeColor" )

View File

@ -10,8 +10,8 @@
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "wxstruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "netlist.h" #include "netlist.h"

View File

@ -10,6 +10,11 @@
#include "dialog_build_BOM_base.h" #include "dialog_build_BOM_base.h"
class WinEDA_DrawFrame;
class SCH_COMPONENT;
class wxConfig;
class DIALOG_BUILD_BOM : public DIALOG_BUILD_BOM_BASE class DIALOG_BUILD_BOM : public DIALOG_BUILD_BOM_BASE
{ {
private: private:

View File

@ -19,7 +19,6 @@
#include "common.h" #include "common.h"
#include "confirm.h" #include "confirm.h"
#include "program.h"
#include "class_libentry.h" #include "class_libentry.h"
#include "libeditframe.h" #include "libeditframe.h"

View File

@ -9,12 +9,10 @@
#include "confirm.h" #include "confirm.h"
#include "gestfich.h" #include "gestfich.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditframe.h" #include "libeditframe.h"
#include "class_library.h" #include "class_library.h"
//#include "class_libentry.h"
#include "dialog_edit_component_in_lib.h" #include "dialog_edit_component_in_lib.h"

View File

@ -8,11 +8,13 @@
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h" #include "class_library.h"
#include "class_sch_component.h"
#include "dialog_edit_component_in_schematic.h" #include "dialog_edit_component_in_schematic.h"

View File

@ -3,6 +3,9 @@
#define __dialog_edit_component_in_schematic__ #define __dialog_edit_component_in_schematic__
#include "class_sch_cmp_field.h"
#include "template_fieldnames.h"
#include "dialog_edit_component_in_schematic_fbp.h" #include "dialog_edit_component_in_schematic_fbp.h"
/** /**

View File

@ -8,13 +8,15 @@
#include "fctsys.h" #include "fctsys.h"
#include "wx/valgen.h" #include "wx/valgen.h"
#include "wxEeschemaStruct.h"
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "drawtxt.h" #include "drawtxt.h"
#include "confirm.h" #include "confirm.h"
#include "class_text-label.h"
#include "dialog_edit_label.h" #include "dialog_edit_label.h"

View File

@ -10,6 +10,11 @@
#include "dialog_edit_label_base.h" #include "dialog_edit_label_base.h"
class WinEDA_SchematicFrame;
class SCH_TEXT;
class DialogLabelEditor : public DialogLabelEditor_Base class DialogLabelEditor : public DialogLabelEditor_Base
{ {
private: private:

View File

@ -9,12 +9,14 @@
#include "common.h" #include "common.h"
#include "confirm.h" #include "confirm.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditframe.h" #include "libeditframe.h"
#include "class_library.h" #include "class_library.h"
#include "class_sch_cmp_field.h"
#include "template_fieldnames.h"
#include "dialog_edit_libentry_fields_in_lib_base.h" #include "dialog_edit_libentry_fields_in_lib_base.h"

View File

@ -12,8 +12,8 @@
#include "common.h" #include "common.h"
#include "confirm.h" #include "confirm.h"
#include "gestfich.h" #include "gestfich.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "netlist.h" #include "netlist.h"

View File

@ -10,8 +10,9 @@
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "netlist.h" #include "netlist.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"

View File

@ -12,7 +12,7 @@
#include "fctsys.h" #include "fctsys.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "program.h" //#include "general.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
/** /**

View File

@ -3,15 +3,12 @@
* Handles the dialog so set current texts and pins sizes in LibEdit * Handles the dialog so set current texts and pins sizes in LibEdit
*/ */
#include "fctsys.h" #include "fctsys.h"
//#include "appl_wxstruct.h"
#include "common.h" #include "common.h"
//#include "class_drawpanel.h" #include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "libeditframe.h" #include "libeditframe.h"
#include "dialog_libedit_dimensions_base.h" #include "dialog_libedit_dimensions_base.h"

View File

@ -8,10 +8,13 @@
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "eeschema_config.h" #include "eeschema_config.h"
#include "class_drawsheet.h"
#include "class_drawsheetpath.h"
#include "dialog_print_using_printer_base.h" #include "dialog_print_using_printer_base.h"

View File

@ -28,13 +28,16 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "macros.h"
#include "plot_common.h" #include "plot_common.h"
#include "confirm.h" #include "confirm.h"
#include "worksheet.h" #include "worksheet.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_drawsheetpath.h"
#include "dialog_plot_schematic_DXF_base.h" #include "dialog_plot_schematic_DXF_base.h"

View File

@ -31,10 +31,13 @@
#include "confirm.h" #include "confirm.h"
#include "plot_common.h" #include "plot_common.h"
#include "worksheet.h" #include "worksheet.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_drawsheetpath.h"
#include "dialog_plot_schematic_HPGL_base.h" #include "dialog_plot_schematic_HPGL_base.h"
enum PageFormatReq enum PageFormatReq

View File

@ -31,10 +31,13 @@
#include "confirm.h" #include "confirm.h"
#include "worksheet.h" #include "worksheet.h"
#include "plot_common.h" #include "plot_common.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_drawsheetpath.h"
enum PageFormatReq { enum PageFormatReq {
PAGE_SIZE_AUTO, PAGE_SIZE_AUTO,

View File

@ -5,11 +5,12 @@
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "macros.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "gestfich.h" #include "gestfich.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditframe.h" #include "libeditframe.h"

View File

@ -7,11 +7,13 @@
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h" #include "class_library.h"
#include "class_sch_component.h"
static void AbortMoveCmpField( WinEDA_DrawPanel* Panel, wxDC* DC ); static void AbortMoveCmpField( WinEDA_DrawPanel* Panel, wxDC* DC );

View File

@ -9,7 +9,6 @@
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditframe.h" #include "libeditframe.h"

View File

@ -10,10 +10,13 @@
#include "drawtxt.h" #include "drawtxt.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_text-label.h"
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void ExitMoveTexte( WinEDA_DrawPanel* panel, wxDC* DC ); static void ExitMoveTexte( WinEDA_DrawPanel* panel, wxDC* DC );

View File

@ -9,9 +9,9 @@
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "eeschema_id.h" #include "eeschema_id.h"
#include "wxstruct.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"

View File

@ -7,6 +7,9 @@
#include "wx/statline.h" #include "wx/statline.h"
#include "general.h"
class wxBoxSizer; class wxBoxSizer;
class wxStaticLine; class wxStaticLine;
class wxStdDialogButtonSizer; class wxStdDialogButtonSizer;

View File

@ -4,9 +4,10 @@
#include "fctsys.h" #include "fctsys.h"
#include "confirm.h" #include "confirm.h"
#include "macros.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "class_library.h" #include "class_library.h"

View File

@ -8,14 +8,20 @@
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h" #include "class_library.h"
#include "class_drawsheet.h"
#include "class_drawsheetpath.h"
#include "class_sch_component.h"
#include "class_schematic_items.h"
#include "build_version.h" #include "build_version.h"
static EDA_BaseStruct* HighLightStruct = NULL; static EDA_BaseStruct* HighLightStruct = NULL;

View File

@ -11,8 +11,9 @@
#include "bitmaps.h" #include "bitmaps.h"
#include "eda_dde.h" #include "eda_dde.h"
#include "id.h" #include "id.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "hotkeys.h" #include "hotkeys.h"

View File

@ -5,11 +5,12 @@
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "eeschema_id.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "gestfich.h" #include "gestfich.h"
#include "program.h" #include "wxEeschemaStruct.h"
#include "eeschema_id.h"
#include "general.h" #include "general.h"
#include "netlist.h" #include "netlist.h"
#include "protos.h" #include "protos.h"
@ -17,6 +18,8 @@
#include "eeschema_config.h" #include "eeschema_config.h"
#include "worksheet.h" #include "worksheet.h"
#include "hotkeys.h" #include "hotkeys.h"
#include "class_drawsheet.h"
#include "dialog_eeschema_options.h" #include "dialog_eeschema_options.h"
#include "dialog_hotkeys_editor.h" #include "dialog_hotkeys_editor.h"

View File

@ -8,8 +8,6 @@
#define GROUPCOMMON wxT( "/common" ) #define GROUPCOMMON wxT( "/common" )
#define GROUPLIB wxT( "libraries" ) #define GROUPLIB wxT( "libraries" )
#include "netlist.h"
extern int g_PenMinWidth; extern int g_PenMinWidth;
/* saving parameters option : */ /* saving parameters option : */

View File

@ -9,14 +9,17 @@
#include "gestfich.h" #include "gestfich.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "netlist.h" #include "netlist.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
#include "lib_pin.h" #include "lib_pin.h"
#include "protos.h" #include "protos.h"
#include "erc.h" #include "erc.h"
#include "class_sch_component.h"
#include "class_drawsheet.h"
#include "dialog_erc.h" #include "dialog_erc.h"

View File

@ -2,15 +2,20 @@
* events_called_functions.cpp * events_called_functions.cpp
* some events functions * some events functions
*/ */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "kicad_device_context.h" #include "kicad_device_context.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "protos.h" #include "protos.h"
#include "class_sch_component.h"
#include "class_text-label.h"
/** Event function WinEDA_SchematicFrame::OnCopySchematicItemRequest /** Event function WinEDA_SchematicFrame::OnCopySchematicItemRequest
* duplicate the current located item * duplicate the current located item

View File

@ -7,13 +7,14 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "gestfich.h" #include "gestfich.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "eeschema_id.h" #include "eeschema_id.h"
#include "class_library.h" #include "class_library.h"
#include "libeditframe.h" #include "libeditframe.h"
#include "class_drawsheet.h"

View File

@ -14,13 +14,17 @@
#include "confirm.h" #include "confirm.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "gestfich.h" #include "gestfich.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
#include "protos.h" #include "protos.h"
#include "class_library.h" #include "class_library.h"
#include "lib_pin.h" #include "lib_pin.h"
#include "class_sch_component.h"
#include "class_drawsheet.h"
#include "class_drawsheetpath.h"
#include "kicad_device_context.h" #include "kicad_device_context.h"

View File

@ -10,11 +10,11 @@
#include "block_commande.h" #include "block_commande.h"
#include "program.h"
class SCH_ITEM; class SCH_ITEM;
class SCH_SHEET; class SCH_SHEET;
class TRANSFORM;
#define EESCHEMA_VERSION 2 #define EESCHEMA_VERSION 2
@ -28,14 +28,14 @@ class SCH_SHEET;
#define MAX_PIN_INFO 10 #define MAX_PIN_INFO 10
#define TXTMARGE 10 /* Offset in mils for placement of labels #define TXTMARGE 10 // Offset in mils for placement of labels and pin numbers.
* and pin numbers. */
#define HIGHLIGHT_COLOR WHITE #define HIGHLIGHT_COLOR WHITE
/* Used for EDA_BaseStruct, .m_Select member */ /* Used for EDA_BaseStruct, .m_Select member */
#define IS_SELECTED 1 #define IS_SELECTED 1
#define TEXT_NO_VISIBLE 1
//#define GR_DEFAULT_DRAWMODE GR_COPY //#define GR_DEFAULT_DRAWMODE GR_COPY
#define GR_DEFAULT_DRAWMODE GR_COPY #define GR_DEFAULT_DRAWMODE GR_COPY
@ -105,6 +105,31 @@ typedef enum
} FileSaveType; } FileSaveType;
/* Rotation, mirror of graphic items in components bodies are handled by a
* transform matrix. The default matix is useful to draw lib entries with
* a defualt matix ( no rotation, no mirror but Y axis is bottom to top, and
* Y draw axis is to to bottom so we must have a default matix that reverses
* the Y coordinate and keeps the X coordiate
*/
extern TRANSFORM DefaultTransform;
#define MIN_BUSLINES_THICKNESS 12 // min bus lines and entries thickness
#define MAX_LAYERS 44
class LayerStruct
{
public:
char LayerNames[MAX_LAYERS + 1][8];
int LayerColor[MAX_LAYERS + 1];
char LayerStatus[MAX_LAYERS + 1];
int NumberOfLayers;
int CurrentLayer;
int CurrentWidth;
int CommonColor;
int Flags;
};
extern SCH_ITEM* g_ItemToRepeat; /* Pointer to the last structure used extern SCH_ITEM* g_ItemToRepeat; /* Pointer to the last structure used
* by the repeat command. NULL if no * by the repeat command. NULL if no
* item to repeat */ * item to repeat */

View File

@ -8,11 +8,13 @@
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h" #include "class_library.h"
#include "class_sch_component.h"
#include "viewlib_frame.h" #include "viewlib_frame.h"
#include "get_component_dialog.h" #include "get_component_dialog.h"

View File

@ -8,9 +8,12 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "class_drawsheet.h"
#include "class_drawsheetpath.h"
#include "wx/imaglist.h" #include "wx/imaglist.h"
#include "wx/treectrl.h" #include "wx/treectrl.h"

View File

@ -6,12 +6,15 @@
#include "common.h" #include "common.h"
#include "eeschema_id.h" #include "eeschema_id.h"
#include "hotkeys.h" #include "hotkeys.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditframe.h" #include "libeditframe.h"
#include "class_libentry.h" #include "class_libentry.h"
#include "class_schematic_items.h"
#include "class_sch_component.h"
#include "class_drawsheet.h"
#include "dialogs/dialog_schematic_find.h" #include "dialogs/dialog_schematic_find.h"

View File

@ -5,9 +5,11 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "macros.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "plot_common.h" #include "plot_common.h"
#include "trigo.h" #include "trigo.h"
#include "wxstruct.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"

View File

@ -5,9 +5,11 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "macros.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "plot_common.h" #include "plot_common.h"
#include "trigo.h" #include "trigo.h"
#include "wxstruct.h"
#include "bezier_curves.h" #include "bezier_curves.h"
#include "general.h" #include "general.h"

View File

@ -8,6 +8,7 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "plot_common.h" #include "plot_common.h"
#include "trigo.h" #include "trigo.h"
#include "wxstruct.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"

View File

@ -15,7 +15,6 @@
#include "gestfich.h" #include "gestfich.h"
#include "eeschema_id.h" #include "eeschema_id.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditframe.h" #include "libeditframe.h"

View File

@ -6,6 +6,7 @@
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "macros.h"
#include "base_struct.h" #include "base_struct.h"
#include "drawtxt.h" #include "drawtxt.h"
#include "kicad_string.h" #include "kicad_string.h"
@ -13,12 +14,12 @@
#include "plot_common.h" #include "plot_common.h"
#include "trigo.h" #include "trigo.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_libentry.h" #include "class_libentry.h"
#include "transform.h" #include "transform.h"
#include "lib_field.h" #include "lib_field.h"
#include "template_fieldnames.h"
/*******************/ /*******************/

View File

@ -5,7 +5,7 @@
#ifndef CLASS_LIBENTRY_FIELDS_H #ifndef CLASS_LIBENTRY_FIELDS_H
#define CLASS_LIBENTRY_FIELDS_H #define CLASS_LIBENTRY_FIELDS_H
#include "program.h" //#include "general.h"
#include "lib_draw_item.h" #include "lib_draw_item.h"

View File

@ -5,12 +5,13 @@
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "macros.h"
#include "trigo.h" #include "trigo.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "drawtxt.h" #include "drawtxt.h"
#include "plot_common.h" #include "plot_common.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditframe.h" #include "libeditframe.h"

View File

@ -5,15 +5,19 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "macros.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "plot_common.h" #include "plot_common.h"
#include "trigo.h" #include "trigo.h"
#include "wxstruct.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "lib_polyline.h" #include "lib_polyline.h"
#include "transform.h" #include "transform.h"
#include <boost/foreach.hpp>
LIB_POLYLINE::LIB_POLYLINE( LIB_COMPONENT* aParent ) : LIB_POLYLINE::LIB_POLYLINE( LIB_COMPONENT* aParent ) :
LIB_DRAW_ITEM( COMPONENT_POLYLINE_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( COMPONENT_POLYLINE_DRAW_TYPE, aParent )

View File

@ -8,6 +8,7 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "plot_common.h" #include "plot_common.h"
#include "trigo.h" #include "trigo.h"
#include "wxstruct.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"

View File

@ -10,12 +10,13 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "macros.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "plot_common.h" #include "plot_common.h"
#include "drawtxt.h" #include "drawtxt.h"
#include "trigo.h" #include "trigo.h"
#include "wxstruct.h"
#include "program.h"
#include "lib_draw_item.h" #include "lib_draw_item.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"

View File

@ -5,12 +5,15 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "confirm.h" #include "confirm.h"
#include "class_sch_screen.h"
#include "wxstruct.h"
#include "sch_item_struct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "netlist.h" #include "netlist.h"
#include "protos.h" #include "protos.h"
#include "class_library.h" #include "class_library.h"
#include "class_sch_component.h"
/* /*

View File

@ -5,17 +5,19 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "macros.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "gestfich.h" #include "gestfich.h"
#include "eeschema_id.h" #include "class_sch_screen.h"
#include "program.h" #include "eeschema_id.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditframe.h" #include "libeditframe.h"
#include "class_library.h" #include "class_library.h"
#include "template_fieldnames.h"
#include "dialog_lib_new_component.h" #include "dialog_lib_new_component.h"

View File

@ -12,7 +12,6 @@
#include "confirm.h" #include "confirm.h"
#include "eeschema_id.h" #include "eeschema_id.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditframe.h" #include "libeditframe.h"

View File

@ -8,12 +8,13 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "macros.h"
#include "confirm.h" #include "confirm.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "eeschema_id.h" #include "eeschema_id.h"
#include "hotkeys.h" #include "hotkeys.h"
#include "class_sch_screen.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditframe.h" #include "libeditframe.h"

View File

@ -11,14 +11,13 @@
#include "confirm.h" #include "confirm.h"
#include "gestfich.h" #include "gestfich.h"
#include "eeschema_id.h" #include "eeschema_id.h"
#include "class_sch_screen.h"
#include "program.h"
#include "general.h" #include "general.h"
//#include "protos.h"
#include "libeditframe.h" #include "libeditframe.h"
#include "class_library.h" #include "class_library.h"
/** function OnPlotCurrentComponent /** function OnPlotCurrentComponent
* plot in SVG or PNG format the curren component * plot in SVG or PNG format the curren component
*/ */

View File

@ -6,7 +6,6 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "common.h" #include "common.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditframe.h" #include "libeditframe.h"

View File

@ -7,13 +7,15 @@
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "macros.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "eda_doc.h" #include "eda_doc.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "class_sch_screen.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "eeschema_id.h" #include "eeschema_id.h"

View File

@ -6,14 +6,16 @@
#define __LIBEDITFRM_H__ #define __LIBEDITFRM_H__
#include "wxstruct.h" #include "wxstruct.h"
#include "class_sch_screen.h"
#include "lib_draw_item.h" #include "lib_draw_item.h"
class SCH_SCREEN; class WinEDA_SchematicFrame;
class CMP_LIBRARY; class CMP_LIBRARY;
class LIB_COMPONENT; class LIB_COMPONENT;
class LIB_ALIAS; class LIB_ALIAS;
class LIB_FIELD;
class WinEDA_bodygraphics_PropertiesFrame; class WinEDA_bodygraphics_PropertiesFrame;
class Dialog_BodyGraphicText_Properties; class Dialog_BodyGraphicText_Properties;

View File

@ -7,12 +7,13 @@
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "class_sch_screen.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditframe.h" #include "libeditframe.h"
#include "class_library.h" #include "class_library.h"
#include "template_fieldnames.h"
void WinEDA_LibeditFrame::EditField( wxDC* DC, LIB_FIELD* Field ) void WinEDA_LibeditFrame::EditField( wxDC* DC, LIB_FIELD* Field )

View File

@ -5,23 +5,21 @@
#include "fctsys.h" #include "fctsys.h"
#include "confirm.h" #include "confirm.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "wxEeschemaStruct.h"
#include "class_sch_screen.h"
#include "richio.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
#include "richio.h" #include "class_schematic_items.h"
#include "class_sch_component.h"
#include "class_text-label.h"
#include "class_drawsheet.h"
/* in read_from_file_schematic_items_description.cpp */
SCH_ITEM* ReadTextDescr( LINE_READER* aLine, wxString& aMsgDiag, int aSchematicFileVersion );
int ReadSheetDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* Window );
bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* Window ); bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* Window );
int ReadPartDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* Window );
static void LoadLayers( LINE_READER* aLine ); static void LoadLayers( LINE_READER* aLine );
@ -31,17 +29,11 @@ static void LoadLayers( LINE_READER* aLine );
*/ */
bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& FullFileName ) bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& FullFileName )
{ {
char Name1[256], char Name1[256];
Name2[256]; bool itemLoaded;
int ii, layer; SCH_ITEM* Phead;
wxPoint pos; SCH_ITEM* Pnext;
bool Failed = FALSE; SCH_ITEM* item;
SCH_ITEM* Phead, * Pnext;
SCH_JUNCTION* ConnectionStruct;
SCH_POLYLINE* PolylineStruct;
SCH_LINE* SegmentStruct;
SCH_BUS_ENTRY* busEntry;
SCH_NO_CONNECT* NoConnectStruct;
wxString MsgDiag; // Error and log messages wxString MsgDiag; // Error and log messages
#define line ((char*)reader) #define line ((char*)reader)
@ -72,8 +64,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
PrintMsg( MsgDiag ); PrintMsg( MsgDiag );
if( !reader.ReadLine() if( !reader.ReadLine()
|| strncmp( line + 9, SCHEMATIC_HEAD_STRING, || strncmp( line + 9, SCHEMATIC_HEAD_STRING, sizeof(SCHEMATIC_HEAD_STRING) - 1 ) != 0 )
sizeof(SCHEMATIC_HEAD_STRING) - 1 ) != 0 )
{ {
MsgDiag = FullFileName + _( " is NOT an EESchema file!" ); MsgDiag = FullFileName + _( " is NOT an EESchema file!" );
DisplayError( this, MsgDiag ); DisplayError( this, MsgDiag );
@ -113,6 +104,8 @@ again." );
while( reader.ReadLine() ) while( reader.ReadLine() )
{ {
item = NULL;
char* sline = line; char* sline = line;
while( (*sline != ' ' ) && *sline ) while( (*sline != ' ' ) && *sline )
sline++; sline++;
@ -121,186 +114,31 @@ again." );
{ {
case '$': // identification block case '$': // identification block
if( line[1] == 'C' ) if( line[1] == 'C' )
Failed = ReadPartDescr( &reader, MsgDiag, screen ); item = new SCH_COMPONENT();
else if( line[1] == 'S' ) else if( line[1] == 'S' )
Failed = ReadSheetDescr( &reader, MsgDiag, screen ); item = new SCH_SHEET();
else if( line[1] == 'D' ) else if( line[1] == 'D' )
Failed = ReadSchemaDescr( &reader, MsgDiag, screen ); itemLoaded = ReadSchemaDescr( &reader, MsgDiag, screen );
else if( line[1] == 'T' ) // text part
{
printf( "**** TEXT PART\n" );
SCH_ITEM* Struct = ReadTextDescr( &reader, MsgDiag, version );
if( Struct )
{
Struct->SetNext( screen->EEDrawList );
screen->EEDrawList = Struct;
}
else
{
Failed = true;
}
}
break; break;
case 'L': // Its a library item. case 'L': // Its a library item.
Failed = ReadPartDescr( &reader, MsgDiag, screen ); item = new SCH_COMPONENT();
break; break;
case 'W': // Its a Segment (WIRE or BUS) item. case 'W': // Its a Segment (WIRE or BUS) item.
if( sscanf( sline, "%s %s", Name1, Name2 ) != 2 ) item = new SCH_LINE();
{
MsgDiag.Printf( wxT( "EESchema file segment error at line %d, aborted" ),
reader.LineNumber() );
MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line );
Failed = true;
break;
}
layer = LAYER_NOTES;
if( Name1[0] == 'W' )
layer = LAYER_WIRE;
if( Name1[0] == 'B' )
layer = LAYER_BUS;
SegmentStruct = new SCH_LINE( wxPoint( 0, 0 ), layer );
if( !reader.ReadLine()
|| sscanf( line, "%d %d %d %d ", &SegmentStruct->m_Start.x,
&SegmentStruct->m_Start.y, &SegmentStruct->m_End.x,
&SegmentStruct->m_End.y ) != 4 )
{
MsgDiag.Printf( wxT( "EESchema file Segment struct error at line %d, aborted" ),
reader.LineNumber() );
MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line );
Failed = true;
SAFE_DELETE( SegmentStruct );
break;
}
if( !Failed )
{
SegmentStruct->SetNext( screen->EEDrawList );
screen->EEDrawList = SegmentStruct;
}
break; break;
case 'E': // Its a WIRE or BUS item. case 'E': // Its a WIRE or BUS item.
if( sscanf( sline, "%s %s", Name1, Name2 ) != 2 ) item = new SCH_BUS_ENTRY();
{
MsgDiag.Printf( wxT( "EESchema file record struct error at line %d, aborted" ),
reader.LineNumber() );
MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line );
Failed = true;
break;
}
ii = WIRE_TO_BUS;
if( Name1[0] == 'B' )
ii = BUS_TO_BUS;
busEntry = new SCH_BUS_ENTRY( wxPoint( 0, 0 ), '\\', ii );
if( !reader.ReadLine()
|| sscanf( line, "%d %d %d %d ", &busEntry->m_Pos.x, &busEntry->m_Pos.y,
&busEntry->m_Size.x, &busEntry->m_Size.y ) != 4 )
{
MsgDiag.Printf( wxT( "EESchema file Bus Entry struct error at line %d, aborted" ),
reader.LineNumber() );
MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line );
Failed = true;
SAFE_DELETE( busEntry );
break;
}
if( !Failed )
{
busEntry->m_Size.x -= busEntry->m_Pos.x;
busEntry->m_Size.y -= busEntry->m_Pos.y;
busEntry->SetNext( screen->EEDrawList );
screen->EEDrawList = busEntry;
}
break; break;
case 'P': // Its a polyline item. case 'P': // Its a polyline item.
if( sscanf( sline, "%s %s %d", Name1, Name2, &ii ) != 3 ) item = new SCH_POLYLINE();
{
MsgDiag.Printf( wxT( "EESchema file polyline struct error at line %d, aborted" ),
reader.LineNumber() );
MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line );
Failed = true;
break;
}
layer = LAYER_NOTES;
if( Name2[0] == 'W' )
layer = LAYER_WIRE;
if( Name2[0] == 'B' )
layer = LAYER_BUS;
PolylineStruct = new SCH_POLYLINE( layer );
for( unsigned jj = 0; jj < (unsigned)ii; jj++ )
{
wxPoint point;
if( !reader.ReadLine()
|| sscanf( line, "%d %d", &point.x, &point.y ) != 2 )
{
MsgDiag.Printf( wxT( "EESchema file polyline struct error at line %d, aborted" ),
reader.LineNumber() );
MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line );
Failed = true;
SAFE_DELETE( PolylineStruct );
break;
}
PolylineStruct->AddPoint( point );
}
if( !Failed )
{
PolylineStruct->SetNext( screen->EEDrawList );
screen->EEDrawList = PolylineStruct;
}
break; break;
case 'C': // It is a connection item. case 'C': // It is a connection item.
ConnectionStruct = new SCH_JUNCTION( wxPoint( 0, 0 ) ); item = new SCH_JUNCTION();
if( sscanf( sline, "%s %d %d", Name1, &ConnectionStruct->m_Pos.x,
&ConnectionStruct->m_Pos.y ) != 3 )
{
MsgDiag.Printf( wxT( "EESchema file connection struct error at line %d, aborted" ),
reader.LineNumber() );
MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line );
Failed = true;
SAFE_DELETE( ConnectionStruct );
}
else
{
ConnectionStruct->SetNext( screen->EEDrawList );
screen->EEDrawList = ConnectionStruct;
}
break;
case 'N': // It is a NoConnect item.
if( sscanf( sline, "%s %d %d", Name1, &pos.x, &pos.y ) != 3 )
{
MsgDiag.Printf( wxT( "EESchema file NoConnect struct error at line %d, aborted" ),
reader.LineNumber() );
MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line );
Failed = true;
}
else
{
NoConnectStruct = new SCH_NO_CONNECT( pos );
NoConnectStruct->SetNext( screen->EEDrawList );
screen->EEDrawList = NoConnectStruct;
}
break; break;
case 'K': // It is a Marker item. case 'K': // It is a Marker item.
@ -308,28 +146,50 @@ again." );
// demand in schematic // demand in schematic
break; break;
case 'N': // It is a NoConnect item.
item = new SCH_NO_CONNECT();
break;
case 'T': // It is a text item. case 'T': // It is a text item.
if( sscanf( sline, "%s", Name1 ) != 1 )
{ {
SCH_ITEM* Struct = ReadTextDescr( &reader, MsgDiag, version); MsgDiag.Printf( wxT( "EESchema file text load error at line %d" ),
if( Struct ) reader.LineNumber() );
{ itemLoaded = false;
Struct->SetNext( screen->EEDrawList );
screen->EEDrawList = Struct;
} }
else if( Name1[0] == 'L' )
item = new SCH_LABEL();
else if( Name1[0] == 'G' && ver > '1' )
item = new SCH_GLOBALLABEL();
else if( (Name1[0] == 'H') || (Name1[0] == 'G' && ver == '1') )
item = new SCH_HIERLABEL();
else else
Failed = true; item = new SCH_TEXT();
}
break; break;
default: default:
Failed = true; itemLoaded = false;
MsgDiag.Printf( wxT( "EESchema file undefined object at line %d, aborted" ), MsgDiag.Printf( wxT( "EESchema file undefined object at line %d, aborted" ),
reader.LineNumber() ); reader.LineNumber() );
MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line ); MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( line );
break;
} }
if( Failed ) if( item )
{
itemLoaded = item->Load( reader, MsgDiag );
if( !itemLoaded )
{
SAFE_DELETE( item );
}
else
{
item->SetNext( screen->EEDrawList );
screen->EEDrawList = item;
}
}
if( !itemLoaded )
{ {
DisplayError( this, MsgDiag ); DisplayError( this, MsgDiag );
break; break;
@ -390,3 +250,117 @@ static void LoadLayers( LINE_READER* aLine )
break; break;
} }
} }
/* Read the schematic header. */
bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, BASE_SCREEN* Window )
{
char Text[256], buf[1024];
int ii;
Ki_PageDescr* wsheet = &g_Sheet_A4;
static Ki_PageDescr* SheetFormatList[] =
{
&g_Sheet_A4, &g_Sheet_A3, &g_Sheet_A2, &g_Sheet_A1, &g_Sheet_A0,
&g_Sheet_A, &g_Sheet_B, &g_Sheet_C, &g_Sheet_D, &g_Sheet_E,
&g_Sheet_user, NULL
};
wxSize PageSize;
sscanf( ((char*)(*aLine)), "%s %s %d %d", Text, Text, &PageSize.x, &PageSize.y );
wxString pagename = CONV_FROM_UTF8( Text );
for( ii = 0; SheetFormatList[ii] != NULL; ii++ )
{
wsheet = SheetFormatList[ii];
if( wsheet->m_Name.CmpNoCase( pagename ) == 0 ) /* Descr found ! */
{
// Get the user page size and make it the default
if( wsheet == &g_Sheet_user )
{
g_Sheet_user.m_Size = PageSize;
}
break;
}
}
if( SheetFormatList[ii] == NULL )
{
aMsgDiag.Printf( wxT( "EESchema file dimension definition error \
line %d, \aAbort reading file.\n" ),
aLine->LineNumber() );
aMsgDiag << CONV_FROM_UTF8( ((char*)(*aLine)) );
}
Window->m_CurrentSheetDesc = wsheet;
for( ; ; )
{
if( !aLine->ReadLine() )
return TRUE;
if( strnicmp( ((char*)(*aLine)), "$End", 4 ) == 0 )
break;
if( strnicmp( ((char*)(*aLine)), "Sheet", 2 ) == 0 )
sscanf( ((char*)(*aLine)) + 5, " %d %d",
&Window->m_ScreenNumber, &Window->m_NumberOfScreen );
if( strnicmp( ((char*)(*aLine)), "Title", 2 ) == 0 )
{
ReadDelimitedText( buf, ((char*)(*aLine)), 256 );
Window->m_Title = CONV_FROM_UTF8( buf );
continue;
}
if( strnicmp( ((char*)(*aLine)), "Date", 2 ) == 0 )
{
ReadDelimitedText( buf, ((char*)(*aLine)), 256 );
Window->m_Date = CONV_FROM_UTF8( buf );
continue;
}
if( strnicmp( ((char*)(*aLine)), "Rev", 2 ) == 0 )
{
ReadDelimitedText( buf, ((char*)(*aLine)), 256 );
Window->m_Revision = CONV_FROM_UTF8( buf );
continue;
}
if( strnicmp( ((char*)(*aLine)), "Comp", 4 ) == 0 )
{
ReadDelimitedText( buf, ((char*)(*aLine)), 256 );
Window->m_Company = CONV_FROM_UTF8( buf );
continue;
}
if( strnicmp( ((char*)(*aLine)), "Comment1", 8 ) == 0 )
{
ReadDelimitedText( buf, ((char*)(*aLine)), 256 );
Window->m_Commentaire1 = CONV_FROM_UTF8( buf );
continue;
}
if( strnicmp( ((char*)(*aLine)), "Comment2", 8 ) == 0 )
{
ReadDelimitedText( buf, ((char*)(*aLine)), 256 );
Window->m_Commentaire2 = CONV_FROM_UTF8( buf );
continue;
}
if( strnicmp( ((char*)(*aLine)), "Comment3", 8 ) == 0 )
{
ReadDelimitedText( buf, ((char*)(*aLine)), 256 );
Window->m_Commentaire3 = CONV_FROM_UTF8( buf );
continue;
}
if( strnicmp( ((char*)(*aLine)), "Comment4", 8 ) == 0 )
{
ReadDelimitedText( buf, ((char*)(*aLine)), 256 );
Window->m_Commentaire4 = CONV_FROM_UTF8( buf );
continue;
}
}
return true;
}

View File

@ -4,14 +4,19 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "program.h"
#include "trigo.h" #include "trigo.h"
#include "macros.h" #include "macros.h"
#include "class_sch_screen.h"
#include "general.h" #include "general.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
#include "protos.h" #include "protos.h"
#include "class_library.h" #include "class_library.h"
#include "class_schematic_items.h"
#include "class_sch_component.h"
#include "class_drawsheet.h"
#include "lib_pin.h"
#include "template_fieldnames.h"
static bool IsItemInBox(EDA_Rect& aBox, SCH_ITEM* DrawStruct ); static bool IsItemInBox(EDA_Rect& aBox, SCH_ITEM* DrawStruct );

View File

@ -10,8 +10,8 @@
#include "common.h" #include "common.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "wxEeschemaStruct.h"
#include "program.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "eeschema_id.h" #include "eeschema_id.h"

Some files were not shown because too many files have changed in this diff Show More