Commit 8d567953 authored by Wayne Stambaugh's avatar Wayne Stambaugh

More schematic component object encapsulation and Doxygen comment warning fixes.

parent 7cb34aec
......@@ -5,6 +5,7 @@ eeschema/cmp_library_lexer.h
eeschema/cmp_library_keywords.*
eeschema/template_fieldnames_keywords.*
eeschema/template_fieldnames_lexer.h
new/html
pcbnew/dialogs/dialog_freeroute_exchange_help_html.h
Makefile
CMakeFiles
......
......@@ -4,6 +4,15 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
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>
================================================================================
++eeschema:
......
......@@ -4,7 +4,7 @@
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = KiCad PCB EDA Suite
PROJECT_NAME = "KiCad PCB EDA Suite"
PROJECT_NUMBER =
OUTPUT_DIRECTORY = Documentation/doxygen
CREATE_SUBDIRS = NO
......@@ -21,13 +21,11 @@ SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = YES
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_FOR_CPP = YES
OPTIMIZE_OUTPUT_JAVA = NO
BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
......
......@@ -883,7 +883,7 @@ static LIB_PIN* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
Multi = aDrawLibItem->GetUnit();
convert = aDrawLibItem->GetConvert();
CmpPosition = aDrawLibItem->m_Pos;
transform = aDrawLibItem->m_Transform;
transform = aDrawLibItem->GetTransform();
}
else
Pin = Entry->GetNextPin( Pin );
......
......@@ -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
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 )
return Pin;
......
......@@ -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
// combinations of mirroring and rotation. The following clause is true
// 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 );
newpos = comp->m_Transform.TransformCoordinate( newpos ) + pos;
newpos = comp->GetTransform().TransformCoordinate( newpos ) + pos;
DrawPanel->CursorOff( DC );
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. */
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 );
}
......
......@@ -190,7 +190,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere
}
wxPoint delta;
pos -= Component->m_Pos;
delta = Component->m_Transform.TransformCoordinate( pos );
delta = Component->GetTransform().TransformCoordinate( pos );
pos = delta + Component->m_Pos;
wxPoint old_cursor_position = sheet->LastScreen()->m_Curseur;
......
......@@ -300,7 +300,7 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
{
wxPoint move_vector = OldPos - Component->m_Pos;
Component->Move( move_vector );
Component->m_Transform = OldTransform;
Component->SetTransform( OldTransform );
Component->m_Flags = 0;
}
......@@ -431,7 +431,7 @@ void SCH_EDIT_FRAME::StartMovePart( SCH_COMPONENT* Component, wxDC* DC )
DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp;
GetScreen()->SetCurItem( Component );
OldPos = Component->m_Pos;
OldTransform = Component->m_Transform;
OldTransform = Component->GetTransform();
#if 1
......
......@@ -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
Close( true );
......
......@@ -114,7 +114,7 @@ public:
* <p>
* EVT_CLOSE( LIB_EDIT_FRAME::OnCloseWindow )
*/
void CloseWindow( wxCommandEvent& WXUNUSED(event) )
void CloseWindow( wxCommandEvent& event )
{
// Generate a wxCloseEvent
Close( false );
......
......@@ -641,7 +641,9 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
if( pin->GetConvert() && ( pin->GetConvert() != DrawLibItem->GetConvert() ) )
continue;
wxPoint pos2 = DrawLibItem->m_Transform.TransformCoordinate( pin->GetPosition() ) +
wxPoint pos2;
pos2 = DrawLibItem->GetTransform().TransformCoordinate( pin->GetPosition() ) +
DrawLibItem->m_Pos;
new_item = new NETLIST_OBJECT();
......
......@@ -51,7 +51,7 @@ static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem )
if( Entry == NULL )
return;;
temp = DrawLibItem->m_Transform;
temp = DrawLibItem->GetTransform();
Entry->Plot( plotter, DrawLibItem->GetUnit(), DrawLibItem->GetConvert(),
DrawLibItem->m_Pos, temp );
......@@ -90,7 +90,7 @@ static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
/* Calculate the text orientation, according to the component
* orientation/mirror */
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 )
orient = TEXT_ORIENT_VERT;
......
......@@ -70,9 +70,8 @@ SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
}
SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent,
SCH_SHEET_PATH* sheet, int unit, int convert,
const wxPoint& pos, bool setNewItemFlag ) :
SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, SCH_SHEET_PATH* sheet, int unit,
int convert, const wxPoint& pos, bool setNewItemFlag ) :
SCH_ITEM( NULL, SCH_COMPONENT_T )
{
Init( pos );
......@@ -159,7 +158,7 @@ void SCH_COMPONENT::Init( const wxPoint& pos )
m_convert = 0; // De Morgan Handling
// The rotation/mirror transformation matrix. pos normal
m_Transform = TRANSFORM();
m_transform = TRANSFORM();
// construct only the mandatory fields, which are the first 4 only.
for( int i = 0; i < MANDATORY_FIELDS; ++i )
......@@ -211,10 +210,16 @@ void SCH_COMPONENT::SetConvert( int aConvert )
}
/*****************************************************************************
* Routine to draw the given part at given position, transformed/mirror as *
* specified, and in the given drawing mode. Only this one is visible... *
*****************************************************************************/
void SCH_COMPONENT::SetTransform( const TRANSFORM& aTransform )
{
if( m_transform != aTransform )
{
m_transform = aTransform;
SetModified();
}
}
void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
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,
DrawMode, Color, m_Transform, DrawPinText, false );
DrawMode, Color, m_transform, DrawPinText, false );
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,
const wxString& aRef,
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 )
{
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 )
{
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 )
{
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 )
{
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_convert, copyitem->m_convert );
TRANSFORM tmp = m_Transform;
m_Transform = copyitem->m_Transform;
copyitem->m_Transform = tmp;
TRANSFORM tmp = m_transform;
m_transform = copyitem->m_transform;
copyitem->m_transform = tmp;
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 )
{
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 )
{
TRANSFORM temp = TRANSFORM();
......@@ -717,9 +685,9 @@ void SCH_COMPONENT::SetOrientation( int aOrientation )
{
case CMP_ORIENT_0:
case CMP_NORMAL: /* Position Initiale */
m_Transform.x1 = 1;
m_Transform.y2 = -1;
m_Transform.x2 = m_Transform.y1 = 0;
m_transform.x1 = 1;
m_transform.y2 = -1;
m_transform.x2 = m_transform.y1 = 0;
break;
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
* requested transformation, which is the TempMat transform (rot,
* mirror ..) in order to have (in term of matrix transform):
* transform coord = new_m_Transform * coord
* where transform coord is the coord modified by new_m_Transform from
* transform coord = new_m_transform * coord
* where transform coord is the coord modified by new_m_transform from
* 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:
* transform coord = old_m_Transform * coord * TempMat
* transform coord = old_m_transform * coord * TempMat
*/
TRANSFORM newTransform;
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.x2 = m_Transform.x1 * temp.x2 + m_Transform.x2 * temp.y2;
newTransform.y2 = m_Transform.y1 * temp.x2 + m_Transform.y2 * temp.y2;
m_Transform = newTransform;
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.x2 = m_transform.x1 * temp.x2 + m_transform.x2 * temp.y2;
newTransform.y2 = m_transform.y1 * temp.x2 + m_transform.y2 * temp.y2;
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 type_rotate = CMP_ORIENT_0;
......@@ -869,45 +823,33 @@ int SCH_COMPONENT::GetOrientation()
};
// Try to find the current transform option:
transform = m_Transform;
transform = m_transform;
for( ii = 0; ii < ROTATE_VALUES_COUNT; ii++ )
{
type_rotate = rotate_value[ii];
SetOrientation( type_rotate );
if( transform == m_Transform )
if( transform == m_transform )
return type_rotate;
}
// Error: orientation not found in list (should not happen)
wxMessageBox( wxT( "Component orientation matrix internal error" ) );
m_Transform = transform;
m_transform = transform;
return CMP_NORMAL;
}
/**
* 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 )
wxPoint SCH_COMPONENT::GetScreenCoord( const wxPoint& aPoint )
{
return m_Transform.TransformCoordinate( coord );
return m_transform.TransformCoordinate( aPoint );
}
#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 )
{
// 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";
}
#endif
......@@ -1070,7 +1011,7 @@ bool SCH_COMPONENT::Save( FILE* f ) const
return false;
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;
if( fprintf( f, "$EndComp\n" ) == EOF )
......@@ -1370,10 +1311,10 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg )
if( !aLine.ReadLine() ||
sscanf( ((char*)aLine), "%d %d %d %d",
&m_Transform.x1,
&m_Transform.y1,
&m_Transform.x2,
&m_Transform.y2 ) != 4 )
&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() );
......@@ -1413,15 +1354,15 @@ EDA_Rect SCH_COMPONENT::GetBodyBoundingBox() const
// We must reverse Y values, because matrix orientation
// 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();
ym = -bBox.GetBottom();
/* Compute the real Boundary box (rotated, mirrored ...)*/
int x1 = m_Transform.x1 * x0 + m_Transform.y1 * y0;
int y1 = m_Transform.x2 * x0 + m_Transform.y2 * y0;
int x2 = m_Transform.x1 * xm + m_Transform.y1 * ym;
int y2 = m_Transform.x2 * xm + m_Transform.y2 * ym;
int x1 = m_transform.x1 * x0 + m_transform.y1 * y0;
int y1 = m_transform.x2 * x0 + m_transform.y2 * y0;
int x2 = m_transform.x1 * xm + m_transform.y1 * ym;
int y2 = m_transform.x2 * xm + m_transform.y2 * ym;
// H and W must be > 0:
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 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 )
{
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 )
{
int dy = m_Pos.y;
......@@ -1622,7 +1546,7 @@ bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData, void* aAuxData,
if( aFindLocation )
{
wxPoint pinpos = pin->GetPosition();
pinpos = m_Transform.TransformCoordinate( pinpos );
pinpos = m_transform.TransformCoordinate( pinpos );
*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 ),
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;
// 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.
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 );
}
......
......@@ -48,26 +48,17 @@ class SCH_COMPONENT : public SCH_ITEM
{
friend class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC;
wxString m_ChipName; ///< Name to look for in the library, i.e. "74LS00".
int m_unit; ///< The unit for multiple part per package components.
int m_convert; ///< The alternate body style for components that have more than
///< one body style defined. Primarily used for components that
///< have a De Morgan conversion.
wxString m_prefix; ///< C, R, U, Q etc - the first character which typically indicates
///< what the component is. Determined, upon placement, from the
///< library component. Created upon file load, by the first
///< non-digits in the reference fields.
public:
wxPoint m_Pos;
TRANSFORM m_Transform; /* The rotation/mirror transformation
* matrix. */
private:
SCH_FIELDS m_Fields; ///< variable length list of fields
wxString m_ChipName; ///< Name to look for in the library, i.e. "74LS00".
int m_unit; ///< The unit for multiple part per package components.
int m_convert; ///< The alternate body style for components that have more than
///< one body style defined. Primarily used for components that
///< have a De Morgan conversion.
wxString m_prefix; ///< C, R, U, Q etc - the first character which typically indicates
///< what the component is. Determined, upon placement, from the
///< library component. Created upon file load, by the first
///< non-digits in the reference fields.
TRANSFORM m_transform; ///< The rotation/mirror transformation matrix.
SCH_FIELDS m_Fields; ///< Variable length list of fields.
/* Hierarchical references.
* format is
......@@ -80,6 +71,11 @@ private:
*/
wxArrayString m_PathsAndReferences;
public:
wxPoint m_Pos;
private:
void Init( const wxPoint& pos = wxPoint( 0, 0 ) );
EDA_Rect GetBodyBoundingBox() const;
......@@ -135,12 +131,13 @@ public:
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
* writes the data structures for this object out to a FILE in "*.brd"
* format.
* writes the data structures for this object out to a FILE in "*.sch" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
......@@ -149,16 +146,15 @@ public:
/**
* 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.
* @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 GenCopy
* returns a copy of this object but with the linked list pointers
* set to NULL.
* returns a copy of this object but with the linked list pointers set to NULL.
* @return SCH_COMPONENT* - a copy of me.
*/
SCH_COMPONENT* GenCopy() const
......@@ -166,6 +162,12 @@ public:
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 );
/**
......@@ -184,11 +186,20 @@ public:
*/
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 );
/**
* 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,
* else remove annotation relative to this sheetpath
*/
......@@ -196,27 +207,19 @@ public:
/**
* Function SetTimeStamp
* Change the old time stamp to the new time stamp.
* the time stamp is also modified in paths
* changes the time stamp to \a aNewTimeStamp updates the reference path.
* @see m_PathsAndReferences
* @param aNewTimeStamp = new time stamp
*/
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
* returns the orthogonal, bounding box of this object for display purposes.
* This box should be an enclosing perimeter for visible components of this
* object, and the units should be in the pcb or schematic coordinate system.
* It is OK to overestimate the size by a few counts.
* returns the bounding box of this object for display purposes. This box should be an
* enclosing perimeter for visible components of this object, and the units should be
* in the pcb or schematic coordinate system. It is OK to overestimate the size by a
* few counts.
* @return The bounding rectangle of the component.
*/
EDA_Rect GetBoundingBox() const;
......@@ -267,7 +270,8 @@ public:
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.
* @return Pin object if found, otherwise NULL.
......@@ -326,34 +330,47 @@ public:
// Geometric transforms (used in block operations):
/** virtual function Move
* move item to a new position.
* @param aMoveVector = the displacement vector
/**
* Function Move
* moves item to a new position by \a aMoveVector.
* @param aMoveVector The displacement to move the component
*/
virtual void Move( const wxPoint& aMoveVector )
{
if( aMoveVector == wxPoint( 0, 0 ) )
return;
m_Pos += aMoveVector;
for( int ii = 0; ii < GetFieldCount(); ii++ )
GetField( ii )->Move( aMoveVector );
}
SetModified();
}
/** virtual function Mirror_Y
* mirror item relative to an Y axis
* @param aYaxis_position = the y axis position
/**
* Function Mirror_Y
* mirrors the component relative to an Y axis about the \a aYaxis_position.
* @param aYaxis_position The y axis position
*/
virtual void Mirror_Y( int aYaxis_position );
/**
* 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 );
virtual void Rotate( wxPoint rotationPoint );
/**
* Compare schematic component reference and value fields against search string.
* Function Matches
* compares component reference and value fields against \a aSearchData.
*
* @param aSearchData - Criteria to search against.
* @param aAuxData - a pointer on auxiliary data, if needed.
* When searching string in REFERENCE field we must know the sheet path
* This param is used in this case
* @param aSearchData Criteria to search against.
* @param aAuxData Pointer to auxiliary data, if needed.
* Used when searching string in REFERENCE field we must know the sheet path
* @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.
*/
......
......@@ -103,7 +103,7 @@ void SCH_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
/* Calculate the text orientation, according to the component
* orientation/mirror */
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 )
orient = TEXT_ORIENT_VERT;
......@@ -248,10 +248,10 @@ EDA_Rect SCH_FIELD::GetBoundingBox() const
hjustify = m_HJustify;
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.
if( parentComponent->m_Transform.y1 )
if( parentComponent->GetTransform().y1 )
{
if( orient == TEXT_ORIENT_HORIZ )
orient = TEXT_ORIENT_VERT;
......@@ -260,23 +260,23 @@ EDA_Rect SCH_FIELD::GetBoundingBox() const
}
// 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)*/
EXCHG( hjustify, vjustify );
if( parentComponent->m_Transform.x2 < 0 )
if( parentComponent->GetTransform().x2 < 0 )
NEGATE( vjustify );
if( parentComponent->m_Transform.y1 > 0 )
if( parentComponent->GetTransform().y1 > 0 )
NEGATE( hjustify );
}
else /* component horizontal: is it mirrored (for text justify)*/
{
if( parentComponent->m_Transform.x1 < 0 )
if( parentComponent->GetTransform().x1 < 0 )
NEGATE( hjustify );
if( parentComponent->m_Transform.y2 > 0 )
if( parentComponent->GetTransform().y2 > 0 )
NEGATE( vjustify );
}
......
......@@ -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,
UndoRedoOpType aCommandType,
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,
UndoRedoOpType aTypeCommand,
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 )
{
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 )
{
if( GetScreen()->GetUndoCommandCount() <= 0 )
......@@ -464,7 +420,6 @@ void SCH_EDIT_FRAME::GetSchematicFromUndoList( wxCommandEvent& event )
List->ReversePickersListOrder();
GetScreen()->PushCommandToRedoList( List );
// m_drawItem = NULL;
OnModify();
SetSheetNumberAndCount();
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 )
{
if( GetScreen()->GetRedoCommandCount() == 0 )
......@@ -498,7 +446,6 @@ void SCH_EDIT_FRAME::GetSchematicFromRedoList( wxCommandEvent& event )
List->ReversePickersListOrder();
GetScreen()->PushCommandToUndoList( List );
// m_drawItem = NULL;
OnModify();
SetSheetNumberAndCount();
ReCreateHToolbar();
......
......@@ -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()
{
wxFileName fn = g_RootSheet->GetFileName();
......
......@@ -56,6 +56,8 @@ public:
bool operator==( const TRANSFORM& aTransform ) const;
bool operator!=( const TRANSFORM& aTransform ) const { return !( *this == aTransform ); }
/**
* Calculate new coordinate according to the transform.
*
......
......@@ -290,9 +290,8 @@ public:
* (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
* used more than once
* Name is <root sheet filename>-<sheet path>
* and has no extension.
* However if filename is too long name is <sheet filename>-<sheet number>
* 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 GetUniqueFilenameForCurrentSheet();
......@@ -304,8 +303,9 @@ public:
*/
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
* @param aDC = wxDC given by the calling print function
* @param aPrint_Sheet_Ref = true to print page references
......@@ -355,8 +355,7 @@ public:
void Save_File( wxCommandEvent& event );
void SaveProject();
bool LoadOneEEProject( const wxString& FileName, bool IsNew );
bool LoadOneEEFile( SCH_SCREEN* screen,
const wxString& FullFileName );
bool LoadOneEEFile( SCH_SCREEN* screen, const wxString& FullFileName );
bool ReadInputStuffFile();
/**
......@@ -375,8 +374,7 @@ public:
* @param aSetFieldsAttributeToVisible = true to set the footprint field flag to visible
* @return bool - true if success, else true.
*/
bool ProcessStuffFile( FILE* aFilename,
bool aSetFieldsAttributeToVisible );
bool ProcessStuffFile( FILE* aFilename, bool aSetFieldsAttributeToVisible );
bool SaveEEFile( SCH_SCREEN* screen, int FileSave );
......@@ -528,16 +526,35 @@ public:
/**
* Function SaveCopyInUndoList.
* Creates a new entry in undo list of commands.
* add a picker to handle aItemToCopy
* 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
* @param aItemToCopy = the schematic item modified by the command to undo
* @param aTypeCommand = command type (see enum UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation,
* for commands like move
*/
void SaveCopyInUndoList( SCH_ITEM* aItemToCopy,
UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
/**
* Function SaveCopyInUndoList (overloaded).
......@@ -549,21 +566,19 @@ public:
* for commands like move
*/
void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
private:
/**
* 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
* is used in undo or redo command to put data pointed by List in the previous state, i.e.
* the state stored in \a aList
* @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 PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand );
void PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand );
/**
* Function GetSchematicFromRedoList
......@@ -576,10 +591,9 @@ private:
/**
* Function GetSchematicFromUndoList
* Undo the last edition:
* performs an undo the last edition:
* - Save the current schematic in Redo list
* - Get an old version of the schematic from Undo list
* @return none
*/
void GetSchematicFromUndoList( wxCommandEvent& event );
......@@ -602,7 +616,7 @@ public:
virtual int ReturnBlockCommand( int aKey );
/**
* Function HandleBlockPlace( )
* Function HandleBlockPlace
* Called after HandleBlockEnd, when a block command needs to be
* executed after the block is moved to its new place
* (bloc move, drag, copy .. )
......@@ -611,7 +625,7 @@ public:
virtual void HandleBlockPlace( wxDC* DC );
/**
* Function HandleBlockEnd( )
* Function HandleBlockEnd
* Handle the "end" of a block command,
* 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment