More schematic component object encapsulation and Doxygen comment warning fixes.

This commit is contained in:
Wayne Stambaugh 2010-12-14 16:39:31 -05:00
parent 7cb34aece7
commit 8d567953d6
19 changed files with 201 additions and 300 deletions

View File

@ -5,6 +5,7 @@ eeschema/cmp_library_lexer.h
eeschema/cmp_library_keywords.* eeschema/cmp_library_keywords.*
eeschema/template_fieldnames_keywords.* eeschema/template_fieldnames_keywords.*
eeschema/template_fieldnames_lexer.h eeschema/template_fieldnames_lexer.h
new/html
pcbnew/dialogs/dialog_freeroute_exchange_help_html.h pcbnew/dialogs/dialog_freeroute_exchange_help_html.h
Makefile Makefile
CMakeFiles CMakeFiles

View File

@ -4,6 +4,15 @@ 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-dec-13 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
* Remove deprecated options and quoted project name option in Doxygen file.
* Make Bazaar ignore the files generated by Doxygen in the new folder.
++EESchema
* More schematic component encapsulation work.
* Doxygen comment fixes.
2010-Dec-13 UPDATE Dick Hollenbeck <dick@softplc.com> 2010-Dec-13 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
++eeschema: ++eeschema:

View File

@ -4,7 +4,7 @@
# Project related configuration options # Project related configuration options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8 DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = KiCad PCB EDA Suite PROJECT_NAME = "KiCad PCB EDA Suite"
PROJECT_NUMBER = PROJECT_NUMBER =
OUTPUT_DIRECTORY = Documentation/doxygen OUTPUT_DIRECTORY = Documentation/doxygen
CREATE_SUBDIRS = NO CREATE_SUBDIRS = NO
@ -21,13 +21,11 @@ SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES JAVADOC_AUTOBRIEF = YES
QT_AUTOBRIEF = NO QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = YES
INHERIT_DOCS = YES INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4 TAB_SIZE = 4
ALIASES = ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_FOR_CPP = YES
OPTIMIZE_OUTPUT_JAVA = NO OPTIMIZE_OUTPUT_JAVA = NO
BUILTIN_STL_SUPPORT = NO BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO CPP_CLI_SUPPORT = NO

View File

@ -883,7 +883,7 @@ static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
Multi = aDrawLibItem->GetUnit(); Multi = aDrawLibItem->GetUnit();
convert = aDrawLibItem->GetConvert(); convert = aDrawLibItem->GetConvert();
CmpPosition = aDrawLibItem->m_Pos; CmpPosition = aDrawLibItem->m_Pos;
transform = aDrawLibItem->m_Transform; transform = aDrawLibItem->GetTransform();
} }
else else
Pin = Entry->GetNextPin( Pin ); Pin = Entry->GetNextPin( Pin );

View File

@ -76,7 +76,7 @@ LIB_PIN* SCH_EDIT_FRAME::LocatePinEnd( SCH_ITEM* DrawList, const wxPoint& pos )
// and in schematic Y axis is top to bottom // and in schematic Y axis is top to bottom
else // calculate the pin position in schematic else // calculate the pin position in schematic
pinpos = DrawLibItem->m_Transform.TransformCoordinate( pinpos ) + DrawLibItem->m_Pos; pinpos = DrawLibItem->GetTransform().TransformCoordinate( pinpos ) + DrawLibItem->m_Pos;
if( pos == pinpos ) if( pos == pinpos )
return Pin; return Pin;

View File

@ -53,10 +53,10 @@ void SCH_EDIT_FRAME::StartMoveCmpField( SCH_FIELD* aField, wxDC* DC )
// under some circumstances, but that inversion is not preserved by all // under some circumstances, but that inversion is not preserved by all
// combinations of mirroring and rotation. The following clause is true // combinations of mirroring and rotation. The following clause is true
// when the number of rotations and the number of mirrorings are both odd. // when the number of rotations and the number of mirrorings are both odd.
if( comp->m_Transform.x2 * comp->m_Transform.y1 < 0 ) if( comp->GetTransform().x2 * comp->GetTransform().y1 < 0 )
NEGATE( newpos.y ); NEGATE( newpos.y );
newpos = comp->m_Transform.TransformCoordinate( newpos ) + pos; newpos = comp->GetTransform().TransformCoordinate( newpos ) + pos;
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
GetScreen()->m_Curseur = newpos; GetScreen()->m_Curseur = newpos;
@ -209,7 +209,7 @@ static void MoveCmpField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/* Positions are calculated by the transpose matrix, Rotating mirror. */ /* Positions are calculated by the transpose matrix, Rotating mirror. */
wxPoint pt( panel->GetScreen()->m_Curseur - pos ); wxPoint pt( panel->GetScreen()->m_Curseur - pos );
currentField->m_Pos = pos + component->m_Transform.TransformCoordinate( pt ); currentField->m_Pos = pos + component->GetTransform().TransformCoordinate( pt );
currentField->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode ); currentField->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode );
} }

View File

@ -190,7 +190,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere
} }
wxPoint delta; wxPoint delta;
pos -= Component->m_Pos; pos -= Component->m_Pos;
delta = Component->m_Transform.TransformCoordinate( pos ); delta = Component->GetTransform().TransformCoordinate( pos );
pos = delta + Component->m_Pos; pos = delta + Component->m_Pos;
wxPoint old_cursor_position = sheet->LastScreen()->m_Curseur; wxPoint old_cursor_position = sheet->LastScreen()->m_Curseur;

View File

@ -300,7 +300,7 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
wxPoint move_vector = OldPos - Component->m_Pos; wxPoint move_vector = OldPos - Component->m_Pos;
Component->Move( move_vector ); Component->Move( move_vector );
Component->m_Transform = OldTransform; Component->SetTransform( OldTransform );
Component->m_Flags = 0; Component->m_Flags = 0;
} }
@ -431,7 +431,7 @@ void SCH_EDIT_FRAME::StartMovePart( SCH_COMPONENT* Component, wxDC* DC )
DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp; DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp;
GetScreen()->SetCurItem( Component ); GetScreen()->SetCurItem( Component );
OldPos = Component->m_Pos; OldPos = Component->m_Pos;
OldTransform = Component->m_Transform; OldTransform = Component->GetTransform();
#if 1 #if 1

View File

@ -168,7 +168,7 @@ WinEDA_HierFrame::~WinEDA_HierFrame()
} }
void WinEDA_HierFrame::OnQuit( wxCommandEvent& WXUNUSED (event) ) void WinEDA_HierFrame::OnQuit( wxCommandEvent& event )
{ {
// true is to force the frame to close // true is to force the frame to close
Close( true ); Close( true );

View File

@ -114,7 +114,7 @@ public:
* <p> * <p>
* EVT_CLOSE( LIB_EDIT_FRAME::OnCloseWindow ) * EVT_CLOSE( LIB_EDIT_FRAME::OnCloseWindow )
*/ */
void CloseWindow( wxCommandEvent& WXUNUSED(event) ) void CloseWindow( wxCommandEvent& event )
{ {
// Generate a wxCloseEvent // Generate a wxCloseEvent
Close( false ); Close( false );

View File

@ -641,7 +641,9 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
if( pin->GetConvert() && ( pin->GetConvert() != DrawLibItem->GetConvert() ) ) if( pin->GetConvert() && ( pin->GetConvert() != DrawLibItem->GetConvert() ) )
continue; continue;
wxPoint pos2 = DrawLibItem->m_Transform.TransformCoordinate( pin->GetPosition() ) + wxPoint pos2;
pos2 = DrawLibItem->GetTransform().TransformCoordinate( pin->GetPosition() ) +
DrawLibItem->m_Pos; DrawLibItem->m_Pos;
new_item = new NETLIST_OBJECT(); new_item = new NETLIST_OBJECT();

View File

@ -51,7 +51,7 @@ static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem )
if( Entry == NULL ) if( Entry == NULL )
return;; return;;
temp = DrawLibItem->m_Transform; temp = DrawLibItem->GetTransform();
Entry->Plot( plotter, DrawLibItem->GetUnit(), DrawLibItem->GetConvert(), Entry->Plot( plotter, DrawLibItem->GetUnit(), DrawLibItem->GetConvert(),
DrawLibItem->m_Pos, temp ); DrawLibItem->m_Pos, temp );
@ -90,7 +90,7 @@ static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
/* Calculate the text orientation, according to the component /* Calculate the text orientation, according to the component
* orientation/mirror */ * orientation/mirror */
int orient = field->m_Orient; int orient = field->m_Orient;
if( DrawLibItem->m_Transform.y1 ) // Rotate component 90 deg. if( DrawLibItem->GetTransform().y1 ) // Rotate component 90 deg.
{ {
if( orient == TEXT_ORIENT_HORIZ ) if( orient == TEXT_ORIENT_HORIZ )
orient = TEXT_ORIENT_VERT; orient = TEXT_ORIENT_VERT;

View File

@ -70,9 +70,8 @@ SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
} }
SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, SCH_SHEET_PATH* sheet, int unit,
SCH_SHEET_PATH* sheet, int unit, int convert, int convert, const wxPoint& pos, bool setNewItemFlag ) :
const wxPoint& pos, bool setNewItemFlag ) :
SCH_ITEM( NULL, SCH_COMPONENT_T ) SCH_ITEM( NULL, SCH_COMPONENT_T )
{ {
Init( pos ); Init( pos );
@ -159,7 +158,7 @@ void SCH_COMPONENT::Init( const wxPoint& pos )
m_convert = 0; // De Morgan Handling m_convert = 0; // De Morgan Handling
// The rotation/mirror transformation matrix. pos normal // The rotation/mirror transformation matrix. pos normal
m_Transform = TRANSFORM(); m_transform = TRANSFORM();
// construct only the mandatory fields, which are the first 4 only. // construct only the mandatory fields, which are the first 4 only.
for( int i = 0; i < MANDATORY_FIELDS; ++i ) for( int i = 0; i < MANDATORY_FIELDS; ++i )
@ -211,10 +210,16 @@ void SCH_COMPONENT::SetConvert( int aConvert )
} }
/***************************************************************************** void SCH_COMPONENT::SetTransform( const TRANSFORM& aTransform )
* Routine to draw the given part at given position, transformed/mirror as * {
* specified, and in the given drawing mode. Only this one is visible... * if( m_transform != aTransform )
*****************************************************************************/ {
m_transform = aTransform;
SetModified();
}
}
void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color, bool DrawPinText ) int DrawMode, int Color, bool DrawPinText )
{ {
@ -234,7 +239,7 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs
} }
Entry->Draw( panel, DC, m_Pos + offset, dummy ? 0 : m_unit, dummy ? 0 : m_convert, Entry->Draw( panel, DC, m_Pos + offset, dummy ? 0 : m_unit, dummy ? 0 : m_convert,
DrawMode, Color, m_Transform, DrawPinText, false ); DrawMode, Color, m_transform, DrawPinText, false );
SCH_FIELD* field = GetField( REFERENCE ); SCH_FIELD* field = GetField( REFERENCE );
@ -287,15 +292,6 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offs
} }
/**
* Function AddHierarchicalReference
* adds a full hierarchical reference (path + local reference)
* @param aPath = hierarchical path (/<sheet timestamp>/component timestamp>
* like /05678E50/A23EF560)
* @param aRef = local reference like C45, R56
* @param aMulti = part selection, used in multi part per package (0 or 1 for
* non multi)
*/
void SCH_COMPONENT::AddHierarchicalReference( const wxString& aPath, void SCH_COMPONENT::AddHierarchicalReference( const wxString& aPath,
const wxString& aRef, const wxString& aRef,
int aMulti ) int aMulti )
@ -441,12 +437,6 @@ void SCH_COMPONENT::SetRef( SCH_SHEET_PATH* sheet, const wxString& ref )
} }
/**
* Function SetTimeStamp
* Change the old time stamp to the new time stamp.
* the time stamp is also modified in paths
* @param aNewTimeStamp = new time stamp
*/
void SCH_COMPONENT::SetTimeStamp( long aNewTimeStamp ) void SCH_COMPONENT::SetTimeStamp( long aNewTimeStamp )
{ {
wxString string_timestamp, string_oldtimestamp; wxString string_timestamp, string_oldtimestamp;
@ -463,10 +453,6 @@ void SCH_COMPONENT::SetTimeStamp( long aNewTimeStamp )
} }
/***********************************************************/
//returns the unit selection, for the given sheet path.
/***********************************************************/
int SCH_COMPONENT::GetUnitSelection( SCH_SHEET_PATH* aSheet ) int SCH_COMPONENT::GetUnitSelection( SCH_SHEET_PATH* aSheet )
{ {
wxString path = GetPath( aSheet ); wxString path = GetPath( aSheet );
@ -495,9 +481,6 @@ int SCH_COMPONENT::GetUnitSelection( SCH_SHEET_PATH* aSheet )
} }
/****************************************************************************/
//Set the unit selection, for the given sheet path.
/****************************************************************************/
void SCH_COMPONENT::SetUnitSelection( SCH_SHEET_PATH* aSheet, int aUnitSelection ) void SCH_COMPONENT::SetUnitSelection( SCH_SHEET_PATH* aSheet, int aUnitSelection )
{ {
wxString path = GetPath( aSheet ); wxString path = GetPath( aSheet );
@ -580,9 +563,6 @@ LIB_PIN* SCH_COMPONENT::GetPin( const wxString& number )
} }
/* Used in undo / redo command:
* swap data between this and copyitem
*/
void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem ) void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem )
{ {
EXCHG( m_ChipName, copyitem->m_ChipName ); EXCHG( m_ChipName, copyitem->m_ChipName );
@ -590,9 +570,9 @@ void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem )
EXCHG( m_unit, copyitem->m_unit ); EXCHG( m_unit, copyitem->m_unit );
EXCHG( m_convert, copyitem->m_convert ); EXCHG( m_convert, copyitem->m_convert );
TRANSFORM tmp = m_Transform; TRANSFORM tmp = m_transform;
m_Transform = copyitem->m_Transform; m_transform = copyitem->m_transform;
copyitem->m_Transform = tmp; copyitem->m_transform = tmp;
m_Fields.swap( copyitem->m_Fields ); // std::vector's swap() m_Fields.swap( copyitem->m_Fields ); // std::vector's swap()
@ -635,11 +615,6 @@ void SCH_COMPONENT::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
} }
/**
* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1)
* @param aSheet: SCH_SHEET_PATH value: if NULL remove all annotations,
* else remove annotation relative to this sheetpath
*/
void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheet ) void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheet )
{ {
wxString defRef = m_prefix; wxString defRef = m_prefix;
@ -701,13 +676,6 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheet )
} }
/******************************************************************/
/* Compute the new matrix transform for a schematic component
* in order to have the requested transform (type_rotate = rot, mirror..)
* which is applied to the initial transform.
*/
/*****************************************************************/
void SCH_COMPONENT::SetOrientation( int aOrientation ) void SCH_COMPONENT::SetOrientation( int aOrientation )
{ {
TRANSFORM temp = TRANSFORM(); TRANSFORM temp = TRANSFORM();
@ -717,9 +685,9 @@ void SCH_COMPONENT::SetOrientation( int aOrientation )
{ {
case CMP_ORIENT_0: case CMP_ORIENT_0:
case CMP_NORMAL: /* Position Initiale */ case CMP_NORMAL: /* Position Initiale */
m_Transform.x1 = 1; m_transform.x1 = 1;
m_Transform.y2 = -1; m_transform.y2 = -1;
m_Transform.x2 = m_Transform.y1 = 0; m_transform.x2 = m_transform.y1 = 0;
break; break;
case CMP_ROTATE_CLOCKWISE: /* Rotate + */ case CMP_ROTATE_CLOCKWISE: /* Rotate + */
@ -817,38 +785,24 @@ void SCH_COMPONENT::SetOrientation( int aOrientation )
/* The new matrix transform is the old matrix transform modified by the /* The new matrix transform is the old matrix transform modified by the
* requested transformation, which is the TempMat transform (rot, * requested transformation, which is the TempMat transform (rot,
* mirror ..) in order to have (in term of matrix transform): * mirror ..) in order to have (in term of matrix transform):
* transform coord = new_m_Transform * coord * transform coord = new_m_transform * coord
* where transform coord is the coord modified by new_m_Transform from * where transform coord is the coord modified by new_m_transform from
* the initial value coord. * the initial value coord.
* new_m_Transform is computed (from old_m_Transform and TempMat) to * new_m_transform is computed (from old_m_transform and TempMat) to
* have: * have:
* transform coord = old_m_Transform * coord * TempMat * transform coord = old_m_transform * coord * TempMat
*/ */
TRANSFORM newTransform; TRANSFORM newTransform;
newTransform.x1 = m_Transform.x1 * temp.x1 + m_Transform.x2 * temp.y1; newTransform.x1 = m_transform.x1 * temp.x1 + m_transform.x2 * temp.y1;
newTransform.y1 = m_Transform.y1 * temp.x1 + m_Transform.y2 * temp.y1; newTransform.y1 = m_transform.y1 * temp.x1 + m_transform.y2 * temp.y1;
newTransform.x2 = m_Transform.x1 * temp.x2 + m_Transform.x2 * temp.y2; newTransform.x2 = m_transform.x1 * temp.x2 + m_transform.x2 * temp.y2;
newTransform.y2 = m_Transform.y1 * temp.x2 + m_Transform.y2 * temp.y2; newTransform.y2 = m_transform.y1 * temp.x2 + m_transform.y2 * temp.y2;
m_Transform = newTransform; m_transform = newTransform;
} }
} }
/**
* Function GetOrientation
* Used to display component orientation (in dialog editor or info)
* @return the orientation and mirror
* Note: Because there are different ways to have a given orientation/mirror,
* the orientation/mirror is not necessary what the used does
* (example : a mirrorX then a mirrorY give no mirror but rotate the component).
* So this function find a rotation and a mirror value
* ( CMP_MIRROR_X because this is the first mirror option tested)
* but can differs from the orientation made by an user
* ( a CMP_MIRROR_Y is find as a CMP_MIRROR_X + orientation 180, because they
* are equivalent)
*
*/
int SCH_COMPONENT::GetOrientation() int SCH_COMPONENT::GetOrientation()
{ {
int type_rotate = CMP_ORIENT_0; int type_rotate = CMP_ORIENT_0;
@ -869,45 +823,33 @@ int SCH_COMPONENT::GetOrientation()
}; };
// Try to find the current transform option: // Try to find the current transform option:
transform = m_Transform; transform = m_transform;
for( ii = 0; ii < ROTATE_VALUES_COUNT; ii++ ) for( ii = 0; ii < ROTATE_VALUES_COUNT; ii++ )
{ {
type_rotate = rotate_value[ii]; type_rotate = rotate_value[ii];
SetOrientation( type_rotate ); SetOrientation( type_rotate );
if( transform == m_Transform ) if( transform == m_transform )
return type_rotate; return type_rotate;
} }
// Error: orientation not found in list (should not happen) // Error: orientation not found in list (should not happen)
wxMessageBox( wxT( "Component orientation matrix internal error" ) ); wxMessageBox( wxT( "Component orientation matrix internal error" ) );
m_Transform = transform; m_transform = transform;
return CMP_NORMAL; return CMP_NORMAL;
} }
/** wxPoint SCH_COMPONENT::GetScreenCoord( const wxPoint& aPoint )
* Returns the coordinated point, depending on the orientation of the
* component (rotation, mirror).
* The coordinates are always relative to the anchor position of the component.
*/
wxPoint SCH_COMPONENT::GetScreenCoord( const wxPoint& coord )
{ {
return m_Transform.TransformCoordinate( coord ); return m_transform.TransformCoordinate( aPoint );
} }
#if defined(DEBUG) #if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void SCH_COMPONENT::Show( int nestLevel, std::ostream& os ) void SCH_COMPONENT::Show( int nestLevel, std::ostream& os )
{ {
// for now, make it look like XML: // for now, make it look like XML:
@ -935,7 +877,6 @@ void SCH_COMPONENT::Show( int nestLevel, std::ostream& os )
NestedSpace( nestLevel, os ) << "</" << CONV_TO_UTF8( GetClass().Lower() ) << ">\n"; NestedSpace( nestLevel, os ) << "</" << CONV_TO_UTF8( GetClass().Lower() ) << ">\n";
} }
#endif #endif
@ -1070,7 +1011,7 @@ bool SCH_COMPONENT::Save( FILE* f ) const
return false; return false;
if( fprintf( f, "\t%-4d %-4d %-4d %-4d\n", if( fprintf( f, "\t%-4d %-4d %-4d %-4d\n",
m_Transform.x1, m_Transform.y1, m_Transform.x2, m_Transform.y2 ) == EOF ) m_transform.x1, m_transform.y1, m_transform.x2, m_transform.y2 ) == EOF )
return false; return false;
if( fprintf( f, "$EndComp\n" ) == EOF ) if( fprintf( f, "$EndComp\n" ) == EOF )
@ -1370,10 +1311,10 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
if( !aLine.ReadLine() || if( !aLine.ReadLine() ||
sscanf( ((char*)aLine), "%d %d %d %d", sscanf( ((char*)aLine), "%d %d %d %d",
&m_Transform.x1, &m_transform.x1,
&m_Transform.y1, &m_transform.y1,
&m_Transform.x2, &m_transform.x2,
&m_Transform.y2 ) != 4 ) &m_transform.y2 ) != 4 )
{ {
aErrorMsg.Printf( wxT( "Component orient error at line %d, aborted" ), aErrorMsg.Printf( wxT( "Component orient error at line %d, aborted" ),
aLine.LineNumber() ); aLine.LineNumber() );
@ -1413,15 +1354,15 @@ EDA_Rect SCH_COMPONENT::GetBodyBoundingBox() const
// We must reverse Y values, because matrix orientation // We must reverse Y values, because matrix orientation
// suppose Y axis normal for the library items coordinates, // suppose Y axis normal for the library items coordinates,
// m_Transform reverse Y values, but bBox is already reversed! // m_transform reverse Y values, but bBox is already reversed!
y0 = -bBox.GetY(); y0 = -bBox.GetY();
ym = -bBox.GetBottom(); ym = -bBox.GetBottom();
/* Compute the real Boundary box (rotated, mirrored ...)*/ /* Compute the real Boundary box (rotated, mirrored ...)*/
int x1 = m_Transform.x1 * x0 + m_Transform.y1 * y0; int x1 = m_transform.x1 * x0 + m_transform.y1 * y0;
int y1 = m_Transform.x2 * x0 + m_Transform.y2 * y0; int y1 = m_transform.x2 * x0 + m_transform.y2 * y0;
int x2 = m_Transform.x1 * xm + m_Transform.y1 * ym; int x2 = m_transform.x1 * xm + m_transform.y1 * ym;
int y2 = m_Transform.x2 * xm + m_Transform.y2 * ym; int y2 = m_transform.x2 * xm + m_transform.y2 * ym;
// H and W must be > 0: // H and W must be > 0:
if( x2 < x1 ) if( x2 < x1 )
@ -1439,13 +1380,6 @@ EDA_Rect SCH_COMPONENT::GetBodyBoundingBox() const
} }
/**
* Function GetBoundaryBox
* returns the orthogonal, bounding box of this object for display purposes.
* This box should be an enclosing perimeter for graphic items and pins.
* this include only fields defined in library
* use GetBoundingBox() to include fields in schematic
*/
EDA_Rect SCH_COMPONENT::GetBoundingBox() const EDA_Rect SCH_COMPONENT::GetBoundingBox() const
{ {
EDA_Rect bBox = GetBodyBoundingBox(); EDA_Rect bBox = GetBodyBoundingBox();
@ -1501,11 +1435,6 @@ void SCH_COMPONENT::DisplayInfo( WinEDA_DrawFrame* frame )
} }
/**
* Function Mirror_Y (virtual)
* mirror item relative to an Y axis
* @param aYaxis_position = the y axis position
*/
void SCH_COMPONENT::Mirror_Y( int aYaxis_position ) void SCH_COMPONENT::Mirror_Y( int aYaxis_position )
{ {
int dx = m_Pos.x; int dx = m_Pos.x;
@ -1525,11 +1454,6 @@ void SCH_COMPONENT::Mirror_Y( int aYaxis_position )
} }
/**
* Function Mirror_X (virtual)
* mirror item relative to an X axis
* @param aXaxis_position = the x axis position
*/
void SCH_COMPONENT::Mirror_X( int aXaxis_position ) void SCH_COMPONENT::Mirror_X( int aXaxis_position )
{ {
int dy = m_Pos.y; int dy = m_Pos.y;
@ -1622,7 +1546,7 @@ bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData, void* aAuxData,
if( aFindLocation ) if( aFindLocation )
{ {
wxPoint pinpos = pin->GetPosition(); wxPoint pinpos = pin->GetPosition();
pinpos = m_Transform.TransformCoordinate( pinpos ); pinpos = m_transform.TransformCoordinate( pinpos );
*aFindLocation = pinpos + m_Pos; *aFindLocation = pinpos + m_Pos;
} }
@ -1665,7 +1589,7 @@ wxPoint SCH_COMPONENT::GetPinPhysicalPosition( LIB_PIN* Pin )
wxCHECK_MSG( Pin != NULL && Pin->Type() == LIB_PIN_T, wxPoint( 0, 0 ), wxCHECK_MSG( Pin != NULL && Pin->Type() == LIB_PIN_T, wxPoint( 0, 0 ),
wxT( "Cannot get physical position of pin." ) ); wxT( "Cannot get physical position of pin." ) );
return m_Transform.TransformCoordinate( Pin->GetPosition() ) + m_Pos; return m_transform.TransformCoordinate( Pin->GetPosition() ) + m_Pos;
} }
@ -1706,7 +1630,7 @@ void SCH_COMPONENT::GetConnectionPoints( vector< wxPoint >& aPoints ) const
continue; continue;
// Calculate the pin position relative to the component position and orientation. // Calculate the pin position relative to the component position and orientation.
aPoints.push_back( m_Transform.TransformCoordinate( pin->GetPosition() ) + m_Pos ); aPoints.push_back( m_transform.TransformCoordinate( pin->GetPosition() ) + m_Pos );
} }
} }
@ -1721,7 +1645,7 @@ LIB_DRAW_ITEM* SCH_COMPONENT::GetDrawItem( const wxPoint& aPosition, KICAD_T aTy
// Calculate the position relative to the component. // Calculate the position relative to the component.
wxPoint libPosition = aPosition - m_Pos; wxPoint libPosition = aPosition - m_Pos;
return component->LocateDrawItem( m_unit, m_convert, aType, libPosition, m_Transform ); return component->LocateDrawItem( m_unit, m_convert, aType, libPosition, m_transform );
} }

View File

@ -57,17 +57,8 @@ class SCH_COMPONENT : public SCH_ITEM
///< what the component is. Determined, upon placement, from the ///< what the component is. Determined, upon placement, from the
///< library component. Created upon file load, by the first ///< library component. Created upon file load, by the first
///< non-digits in the reference fields. ///< non-digits in the reference fields.
TRANSFORM m_transform; ///< The rotation/mirror transformation matrix.
public: SCH_FIELDS m_Fields; ///< Variable length list of fields.
wxPoint m_Pos;
TRANSFORM m_Transform; /* The rotation/mirror transformation
* matrix. */
private:
SCH_FIELDS m_Fields; ///< variable length list of fields
/* Hierarchical references. /* Hierarchical references.
* format is * format is
@ -80,6 +71,11 @@ private:
*/ */
wxArrayString m_PathsAndReferences; wxArrayString m_PathsAndReferences;
public:
wxPoint m_Pos;
private:
void Init( const wxPoint& pos = wxPoint( 0, 0 ) ); void Init( const wxPoint& pos = wxPoint( 0, 0 ) );
EDA_Rect GetBodyBoundingBox() const; EDA_Rect GetBodyBoundingBox() const;
@ -135,12 +131,13 @@ public:
wxString GetPrefix() const { return m_prefix; } wxString GetPrefix() const { return m_prefix; }
TRANSFORM& GetTransform() const { return const_cast< TRANSFORM& >( m_Transform ); } TRANSFORM& GetTransform() const { return const_cast< TRANSFORM& >( m_transform ); }
void SetTransform( const TRANSFORM& aTransform );
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.brd" * writes the data structures for this object out to a FILE in "*.sch" format.
* format.
* @param aFile The FILE to write to. * @param aFile The FILE to write to.
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
@ -149,16 +146,15 @@ public:
/** /**
* Load schematic component from \a aLine in a .sch file. * Load schematic component from \a aLine in a .sch file.
* *
* @param aLine - Essentially this is file to read the component from. * @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. * @param aErrorMsg Description of the error if an error occurs while loading the component.
* @return True if the component loaded successfully. * @return True if the component loaded successfully.
*/ */
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/** /**
* Function GenCopy * Function GenCopy
* returns a copy of this object but with the linked list pointers * returns a copy of this object but with the linked list pointers set to NULL.
* set to NULL.
* @return SCH_COMPONENT* - a copy of me. * @return SCH_COMPONENT* - a copy of me.
*/ */
SCH_COMPONENT* GenCopy() const SCH_COMPONENT* GenCopy() const
@ -166,6 +162,12 @@ public:
return new SCH_COMPONENT( *this ); return new SCH_COMPONENT( *this );
} }
/**
* Function SetOrientation
* computes the new transform matrix based on \a aOrientation for the component which is
* applied to the current transform.
* @param aOrientation The orientation to apply to the transform.
*/
void SetOrientation( int aOrientation ); void SetOrientation( int aOrientation );
/** /**
@ -184,11 +186,20 @@ public:
*/ */
int GetOrientation(); int GetOrientation();
wxPoint GetScreenCoord( const wxPoint& coord ); /**
* Function GetScreenCoord
* Returns the coordinated point relative to the orientation of the component of \a aPoint.
* The coordinates are always relative to the anchor position of the component.
* @param aPoint The coordinates to transform.
* @return The transformed point.
*/
wxPoint GetScreenCoord( const wxPoint& aPoint );
void DisplayInfo( WinEDA_DrawFrame* frame ); void DisplayInfo( WinEDA_DrawFrame* frame );
/** /**
* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1) * Function ClearAnnotation
* clears exiting component annotation ( i.i IC23 changed to IC? and part reset to 1)
* @param aSheet: SCH_SHEET_PATH value: if NULL remove all annotations, * @param aSheet: SCH_SHEET_PATH value: if NULL remove all annotations,
* else remove annotation relative to this sheetpath * else remove annotation relative to this sheetpath
*/ */
@ -196,27 +207,19 @@ public:
/** /**
* Function SetTimeStamp * Function SetTimeStamp
* Change the old time stamp to the new time stamp. * changes the time stamp to \a aNewTimeStamp updates the reference path.
* the time stamp is also modified in paths * @see m_PathsAndReferences
* @param aNewTimeStamp = new time stamp * @param aNewTimeStamp = new time stamp
*/ */
void SetTimeStamp( long aNewTimeStamp ); void SetTimeStamp( long aNewTimeStamp );
/**
* Function GetBoundaryBox
* returns the orthogonal, bounding box of this object for display purposes.
* This box should be an enclosing perimeter for graphic items and pins.
* this include only fields defined in library
* use GetBoundingBox() to include fields in schematic
*/
EDA_Rect GetBoundaryBox() const;
/** /**
* Function GetBoundingBox * Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display purposes. * returns the bounding box of this object for display purposes. This box should be an
* This box should be an enclosing perimeter for visible components of this * enclosing perimeter for visible components of this object, and the units should be
* object, and the units should be in the pcb or schematic coordinate system. * in the pcb or schematic coordinate system. It is OK to overestimate the size by a
* It is OK to overestimate the size by a few counts. * few counts.
* @return The bounding rectangle of the component.
*/ */
EDA_Rect GetBoundingBox() const; EDA_Rect GetBoundingBox() const;
@ -267,7 +270,8 @@ public:
int GetFieldCount() const { return (int) m_Fields.size(); } int GetFieldCount() const { return (int) m_Fields.size(); }
/** /**
* Find a component pin by number. * Function GetPin
* finds a component pin by number.
* *
* @param number - The number of the pin to find. * @param number - The number of the pin to find.
* @return Pin object if found, otherwise NULL. * @return Pin object if found, otherwise NULL.
@ -326,34 +330,47 @@ public:
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** virtual function Move /**
* move item to a new position. * Function Move
* @param aMoveVector = the displacement vector * moves item to a new position by \a aMoveVector.
* @param aMoveVector The displacement to move the component
*/ */
virtual void Move( const wxPoint& aMoveVector ) virtual void Move( const wxPoint& aMoveVector )
{ {
if( aMoveVector == wxPoint( 0, 0 ) )
return;
m_Pos += aMoveVector; m_Pos += aMoveVector;
for( int ii = 0; ii < GetFieldCount(); ii++ ) for( int ii = 0; ii < GetFieldCount(); ii++ )
GetField( ii )->Move( aMoveVector ); GetField( ii )->Move( aMoveVector );
SetModified();
} }
/**
/** virtual function Mirror_Y * Function Mirror_Y
* mirror item relative to an Y axis * mirrors the component relative to an Y axis about the \a aYaxis_position.
* @param aYaxis_position = the y axis position * @param aYaxis_position The y axis position
*/ */
virtual void Mirror_Y( int aYaxis_position ); virtual void Mirror_Y( int aYaxis_position );
virtual void Mirror_X( int aXaxis_position );
virtual void Rotate( wxPoint rotationPoint );
/** /**
* Compare schematic component reference and value fields against search string. * Function Mirror_X (virtual)
* mirrors item relative to an X axis about the \a aXaxis_position.
* @param aXaxis_position The x axis position
*/
virtual void Mirror_X( int aXaxis_position );
virtual void Rotate( wxPoint rotationPoint );
/**
* Function Matches
* compares component reference and value fields against \a aSearchData.
* *
* @param aSearchData - Criteria to search against. * @param aSearchData Criteria to search against.
* @param aAuxData - a pointer on auxiliary data, if needed. * @param aAuxData Pointer to auxiliary data, if needed.
* When searching string in REFERENCE field we must know the sheet path * Used when searching string in REFERENCE field we must know the sheet path
* This param is used in this case
* @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL. * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
* @return True if this component reference or value field matches the search criteria. * @return True if this component reference or value field matches the search criteria.
*/ */

View File

@ -103,7 +103,7 @@ void SCH_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
/* Calculate the text orientation, according to the component /* Calculate the text orientation, according to the component
* orientation/mirror */ * orientation/mirror */
orient = m_Orient; orient = m_Orient;
if( parentComponent->m_Transform.y1 ) // Rotate component 90 degrees. if( parentComponent->GetTransform().y1 ) // Rotate component 90 degrees.
{ {
if( orient == TEXT_ORIENT_HORIZ ) if( orient == TEXT_ORIENT_HORIZ )
orient = TEXT_ORIENT_VERT; orient = TEXT_ORIENT_VERT;
@ -248,10 +248,10 @@ EDA_Rect SCH_FIELD::GetBoundingBox() const
hjustify = m_HJustify; hjustify = m_HJustify;
vjustify = m_VJustify; vjustify = m_VJustify;
pos2 = pos + parentComponent->m_Transform.TransformCoordinate( pos1 ); pos2 = pos + parentComponent->GetTransform().TransformCoordinate( pos1 );
// Calculate the text orientation, according to the component orientation/mirror. // Calculate the text orientation, according to the component orientation/mirror.
if( parentComponent->m_Transform.y1 ) if( parentComponent->GetTransform().y1 )
{ {
if( orient == TEXT_ORIENT_HORIZ ) if( orient == TEXT_ORIENT_HORIZ )
orient = TEXT_ORIENT_VERT; orient = TEXT_ORIENT_VERT;
@ -260,23 +260,23 @@ EDA_Rect SCH_FIELD::GetBoundingBox() const
} }
// Calculate the text justification, according to the component orientation/mirror. // Calculate the text justification, according to the component orientation/mirror.
if( parentComponent->m_Transform.y1 ) if( parentComponent->GetTransform().y1 )
{ {
/* is it mirrored (for text justify)*/ /* is it mirrored (for text justify)*/
EXCHG( hjustify, vjustify ); EXCHG( hjustify, vjustify );
if( parentComponent->m_Transform.x2 < 0 ) if( parentComponent->GetTransform().x2 < 0 )
NEGATE( vjustify ); NEGATE( vjustify );
if( parentComponent->m_Transform.y1 > 0 ) if( parentComponent->GetTransform().y1 > 0 )
NEGATE( hjustify ); NEGATE( hjustify );
} }
else /* component horizontal: is it mirrored (for text justify)*/ else /* component horizontal: is it mirrored (for text justify)*/
{ {
if( parentComponent->m_Transform.x1 < 0 ) if( parentComponent->GetTransform().x1 < 0 )
NEGATE( hjustify ); NEGATE( hjustify );
if( parentComponent->m_Transform.y2 > 0 ) if( parentComponent->GetTransform().y2 > 0 )
NEGATE( vjustify ); NEGATE( vjustify );
} }

View File

@ -183,30 +183,6 @@ void SwapData( EDA_ITEM* aItem, EDA_ITEM* aImage )
} }
/**
* Function SaveCopyInUndoList
* Create a copy of the current schematic item, and put it in the undo list.
*
* flag_type_command =
* UR_CHANGED
* UR_NEW
* UR_DELETED
* UR_WIRE_IMAGE
* UR_MOVED
*
* If it is a delete command, items are put on list with the .Flags member
* set to UR_DELETED. When it will be really deleted, the GetDrawItems() and the
* sub-hierarchy will be deleted. If it is only a copy, the GetDrawItems() and the
* sub-hierarchy must NOT be deleted.
*
* Note:
* Edit wires and buses is a bit complex.
* because when a new wire is added, modifications in wire list
* (wire concatenation) there are modified items, deleted items and new items
* so flag_type_command is UR_WIRE_IMAGE: the struct ItemToCopy is a list of
* wires saved in Undo List (for Undo or Redo commands, saved wires will be
* exchanged with current wire list
*/
void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_ITEM* aItem, void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_ITEM* aItem,
UndoRedoOpType aCommandType, UndoRedoOpType aCommandType,
const wxPoint& aTransformPoint ) const wxPoint& aTransformPoint )
@ -271,11 +247,6 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_ITEM* aItem,
} }
/**
* Function SaveCopyInUndoList
* @param aItemsList = a PICKED_ITEMS_LIST of items to save
* @param aTypeCommand = type of command ( UR_CHANGED, UR_NEW, UR_DELETED ...
*/
void SCH_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, void SCH_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
UndoRedoOpType aTypeCommand, UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint ) const wxPoint& aTransformPoint )
@ -344,14 +315,6 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
} }
/**
* Function PutDataInPreviousState
* Used in undo or redo command.
* Put data pointed by List in the previous state, i.e. the state memorized
* by List
* @param aList = a PICKED_ITEMS_LIST pointer to the list of items to undo/redo
* @param aRedoCommand = a bool: true for redo, false for undo
*/
void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand ) void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand )
{ {
SCH_ITEM* item; SCH_ITEM* item;
@ -442,13 +405,6 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
} }
/**
* Function GetSchematicFromUndoList
* Undo the last edition:
* - Save the current schematic in Redo list
* - Get the previous version of the schematic from undo list
* @return none
*/
void SCH_EDIT_FRAME::GetSchematicFromUndoList( wxCommandEvent& event ) void SCH_EDIT_FRAME::GetSchematicFromUndoList( wxCommandEvent& event )
{ {
if( GetScreen()->GetUndoCommandCount() <= 0 ) if( GetScreen()->GetUndoCommandCount() <= 0 )
@ -464,7 +420,6 @@ void SCH_EDIT_FRAME::GetSchematicFromUndoList( wxCommandEvent& event )
List->ReversePickersListOrder(); List->ReversePickersListOrder();
GetScreen()->PushCommandToRedoList( List ); GetScreen()->PushCommandToRedoList( List );
// m_drawItem = NULL;
OnModify(); OnModify();
SetSheetNumberAndCount(); SetSheetNumberAndCount();
ReCreateHToolbar(); ReCreateHToolbar();
@ -475,13 +430,6 @@ void SCH_EDIT_FRAME::GetSchematicFromUndoList( wxCommandEvent& event )
} }
/**
* Function GetSchematicFromRedoList
* Redo the last edition:
* - Save the current schematic in undo list
* - Get the previous version from Redo list
* @return none
*/
void SCH_EDIT_FRAME::GetSchematicFromRedoList( wxCommandEvent& event ) void SCH_EDIT_FRAME::GetSchematicFromRedoList( wxCommandEvent& event )
{ {
if( GetScreen()->GetRedoCommandCount() == 0 ) if( GetScreen()->GetRedoCommandCount() == 0 )
@ -498,7 +446,6 @@ void SCH_EDIT_FRAME::GetSchematicFromRedoList( wxCommandEvent& event )
List->ReversePickersListOrder(); List->ReversePickersListOrder();
GetScreen()->PushCommandToUndoList( List ); GetScreen()->PushCommandToUndoList( List );
// m_drawItem = NULL;
OnModify(); OnModify();
SetSheetNumberAndCount(); SetSheetNumberAndCount();
ReCreateHToolbar(); ReCreateHToolbar();

View File

@ -423,19 +423,6 @@ int SCH_EDIT_FRAME::BestZoom()
} }
/**
* Function GetUniqueFilenameForCurrentSheet
* @return a filename that can be used in plot and print functions
* for the current screen and sheet path.
* This filename is unique and must be used insteed of the screen filename
* (or sheet filename) when one must creates file for each sheet in the
* heierarchy.
* because in complex hierarchies a sheet and a SCH_SCREEN is used more than
* once
* Name is &ltroot sheet filename&gt-&ltsheet path&gt
* and has no extension.
* However if filename is too long name is &ltsheet filename&gt-&ltsheet number&gt
*/
wxString SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet() wxString SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet()
{ {
wxFileName fn = g_RootSheet->GetFileName(); wxFileName fn = g_RootSheet->GetFileName();

View File

@ -56,6 +56,8 @@ public:
bool operator==( const TRANSFORM& aTransform ) const; bool operator==( const TRANSFORM& aTransform ) const;
bool operator!=( const TRANSFORM& aTransform ) const { return !( *this == aTransform ); }
/** /**
* Calculate new coordinate according to the transform. * Calculate new coordinate according to the transform.
* *

View File

@ -290,9 +290,8 @@ public:
* (or screen filename) when one must creates file for each sheet in the * (or screen filename) when one must creates file for each sheet in the
* hierarchy. because in complex hierarchies a sheet and a SCH_SCREEN is * hierarchy. because in complex hierarchies a sheet and a SCH_SCREEN is
* used more than once * used more than once
* Name is <root sheet filename>-<sheet path> * Name is &ltroot sheet filename&gt-&ltsheet path&gt and has no extension.
* and has no extension. * However if filename is too long name is &ltsheet filename&gt-&ltsheet number&gt
* However if filename is too long name is <sheet filename>-<sheet number>
*/ */
wxString GetUniqueFilenameForCurrentSheet(); wxString GetUniqueFilenameForCurrentSheet();
@ -304,8 +303,9 @@ public:
*/ */
void SetSheetNumberAndCount(); void SetSheetNumberAndCount();
/** Virtual function PrintPage /**
* used to print a page * Function PrintPage
* is used to print a schematic page.
* Print the page pointed by ActiveScreen, set by the calling print function * Print the page pointed by ActiveScreen, set by the calling print function
* @param aDC = wxDC given by the calling print function * @param aDC = wxDC given by the calling print function
* @param aPrint_Sheet_Ref = true to print page references * @param aPrint_Sheet_Ref = true to print page references
@ -355,8 +355,7 @@ public:
void Save_File( wxCommandEvent& event ); void Save_File( wxCommandEvent& event );
void SaveProject(); void SaveProject();
bool LoadOneEEProject( const wxString& FileName, bool IsNew ); bool LoadOneEEProject( const wxString& FileName, bool IsNew );
bool LoadOneEEFile( SCH_SCREEN* screen, bool LoadOneEEFile( SCH_SCREEN* screen, const wxString& FullFileName );
const wxString& FullFileName );
bool ReadInputStuffFile(); bool ReadInputStuffFile();
/** /**
@ -375,8 +374,7 @@ public:
* @param aSetFieldsAttributeToVisible = true to set the footprint field flag to visible * @param aSetFieldsAttributeToVisible = true to set the footprint field flag to visible
* @return bool - true if success, else true. * @return bool - true if success, else true.
*/ */
bool ProcessStuffFile( FILE* aFilename, bool ProcessStuffFile( FILE* aFilename, bool aSetFieldsAttributeToVisible );
bool aSetFieldsAttributeToVisible );
bool SaveEEFile( SCH_SCREEN* screen, int FileSave ); bool SaveEEFile( SCH_SCREEN* screen, int FileSave );
@ -528,8 +526,27 @@ public:
/** /**
* Function SaveCopyInUndoList. * Function SaveCopyInUndoList.
* Creates a new entry in undo list of commands. * Create a copy of the current schematic item, and put it in the undo list.
* add a picker to handle aItemToCopy *
* flag_type_command =
* UR_CHANGED
* UR_NEW
* UR_DELETED
* UR_WIRE_IMAGE
* UR_MOVED
*
* If it is a delete command, items are put on list with the .Flags member
* set to UR_DELETED. When it will be really deleted, the GetDrawItems() and the
* sub-hierarchy will be deleted. If it is only a copy, the GetDrawItems() and the
* sub-hierarchy must NOT be deleted.
*
* @Note
* Edit wires and buses is a bit complex.
* because when a new wire is added, modifications in wire list
* (wire concatenation) there are modified items, deleted items and new items
* so flag_type_command is UR_WIRE_IMAGE: the struct ItemToCopy is a list of
* wires saved in Undo List (for Undo or Redo commands, saved wires will be
* exchanged with current wire list
* @param aItemToCopy = the schematic item modified by the command to undo * @param aItemToCopy = the schematic item modified by the command to undo
* @param aTypeCommand = command type (see enum UndoRedoOpType) * @param aTypeCommand = command type (see enum UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation, * @param aTransformPoint = the reference point of the transformation,
@ -556,12 +573,10 @@ private:
/** /**
* Function PutDataInPreviousState * Function PutDataInPreviousState
* Used in undo or redo command. * is used in undo or redo command to put data pointed by List in the previous state, i.e.
* Put data pointed by List in the previous state, i.e. the state * the state stored in \a aList
* memorized by List * @param aList a PICKED_ITEMS_LIST pointer to the list of items to undo/redo
* @param aList = a PICKED_ITEMS_LIST pointer to the list of items to * @param aRedoCommand a bool: true for redo, false for undo
* undo/redo
* @param aRedoCommand = a bool: true for redo, false for undo
*/ */
void PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand ); void PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand );
@ -576,10 +591,9 @@ private:
/** /**
* Function GetSchematicFromUndoList * Function GetSchematicFromUndoList
* Undo the last edition: * performs an undo the last edition:
* - Save the current schematic in Redo list * - Save the current schematic in Redo list
* - Get an old version of the schematic from Undo list * - Get an old version of the schematic from Undo list
* @return none
*/ */
void GetSchematicFromUndoList( wxCommandEvent& event ); void GetSchematicFromUndoList( wxCommandEvent& event );
@ -602,7 +616,7 @@ public:
virtual int ReturnBlockCommand( int aKey ); virtual int ReturnBlockCommand( int aKey );
/** /**
* Function HandleBlockPlace( ) * Function HandleBlockPlace
* Called after HandleBlockEnd, when a block command needs to be * Called after HandleBlockEnd, when a block command needs to be
* executed after the block is moved to its new place * executed after the block is moved to its new place
* (bloc move, drag, copy .. ) * (bloc move, drag, copy .. )
@ -611,7 +625,7 @@ public:
virtual void HandleBlockPlace( wxDC* DC ); virtual void HandleBlockPlace( wxDC* DC );
/** /**
* Function HandleBlockEnd( ) * Function HandleBlockEnd
* Handle the "end" of a block command, * Handle the "end" of a block command,
* i.e. is called at the end of the definition of the area of a block. * i.e. is called at the end of the definition of the area of a block.
* depending on the current block command, this command is executed * depending on the current block command, this command is executed