plugin work, accessors

This commit is contained in:
Dick Hollenbeck 2011-12-12 02:37:05 -06:00
parent dc982a2824
commit b979d1e0b9
61 changed files with 820 additions and 636 deletions

View File

@ -68,7 +68,7 @@ EDA_ITEM::EDA_ITEM( const EDA_ITEM& base )
m_Parent = base.m_Parent; m_Parent = base.m_Parent;
m_Son = base.m_Son; m_Son = base.m_Son;
m_Flags = base.m_Flags; m_Flags = base.m_Flags;
m_TimeStamp = base.m_TimeStamp; SetTimeStamp( base.m_TimeStamp );
m_Status = base.m_Status; m_Status = base.m_Status;
m_Selected = base.m_Selected; m_Selected = base.m_Selected;
} }
@ -84,7 +84,7 @@ void EDA_ITEM::InitVars()
m_List = NULL; // I am not on any list yet m_List = NULL; // I am not on any list yet
m_Image = NULL; // Link to an image copy for undelete or abort command m_Image = NULL; // Link to an image copy for undelete or abort command
m_Flags = 0; // flags for editions and other m_Flags = 0; // flags for editions and other
m_TimeStamp = 0; // Time stamp used for logical links SetTimeStamp( 0 ); // Time stamp used for logical links
m_Status = 0; m_Status = 0;
m_Selected = 0; // Used by block commands, and selective editing m_Selected = 0; // Used by block commands, and selective editing
} }
@ -107,6 +107,13 @@ EDA_ITEM* EDA_ITEM::doClone() const
} }
EDA_ITEM* EDA_ITEM::Clone() const
{
// save about 6 bytes per call by hiding the virtual function in this non-inline function.
return doClone();
}
SEARCH_RESULT EDA_ITEM::IterateForward( EDA_ITEM* listStart, SEARCH_RESULT EDA_ITEM::IterateForward( EDA_ITEM* listStart,
INSPECTOR* inspector, INSPECTOR* inspector,
const void* testData, const void* testData,

View File

@ -182,7 +182,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
while( Line[idx] != ' ' && Line[idx] ) while( Line[idx] != ' ' && Line[idx] )
cbuffer[jj++] = Line[idx++]; cbuffer[jj++] = Line[idx++];
cbuffer[jj] = 0; cbuffer[jj] = 0;
Cmp->m_TimeStamp = FROM_UTF8(cbuffer); Cmp->m_TimeStamp = FROM_UTF8( cbuffer );
/* search val/ref.lib */ /* search val/ref.lib */
while( Line[idx] == ' ' ) while( Line[idx] == ' ' )

View File

@ -554,7 +554,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
// Clear annotation and init new time stamp for the new components: // Clear annotation and init new time stamp for the new components:
if( Struct->Type() == SCH_COMPONENT_T ) if( Struct->Type() == SCH_COMPONENT_T )
{ {
( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetNewTimeStamp(); ( (SCH_COMPONENT*) Struct )->SetTimeStamp( GetNewTimeStamp() );
( (SCH_COMPONENT*) Struct )->ClearAnnotation( NULL ); ( (SCH_COMPONENT*) Struct )->ClearAnnotation( NULL );
} }

View File

@ -526,7 +526,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
wxPoint pos = GetScreen()->GetCrossHairPosition() - wxPoint pos = GetScreen()->GetCrossHairPosition() -
( (SCH_COMPONENT*) m_itemToRepeat )->GetPosition(); ( (SCH_COMPONENT*) m_itemToRepeat )->GetPosition();
m_itemToRepeat->SetFlags( IS_NEW ); m_itemToRepeat->SetFlags( IS_NEW );
( (SCH_COMPONENT*) m_itemToRepeat )->m_TimeStamp = GetNewTimeStamp(); ( (SCH_COMPONENT*) m_itemToRepeat )->SetTimeStamp( GetNewTimeStamp() );
m_itemToRepeat->Move( pos ); m_itemToRepeat->Move( pos );
m_itemToRepeat->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode ); m_itemToRepeat->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
MoveItem( m_itemToRepeat, DC ); MoveItem( m_itemToRepeat, DC );

View File

@ -668,7 +668,7 @@ SCH_REFERENCE::SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_COMPONENT* aLibComp
m_SheetPath = aSheetPath; m_SheetPath = aSheetPath;
m_IsNew = false; m_IsNew = false;
m_Flag = 0; m_Flag = 0;
m_TimeStamp = aComponent->m_TimeStamp; m_TimeStamp = aComponent->GetTimeStamp();
m_CmpPos = aComponent->GetPosition(); m_CmpPos = aComponent->GetPosition();
m_SheetNum = 0; m_SheetNum = 0;

View File

@ -204,7 +204,7 @@ int TestDuplicateSheetNames( bool aCreateMarker )
{ {
/* Create a new marker type ERC error*/ /* Create a new marker type ERC error*/
SCH_MARKER* marker = new SCH_MARKER(); SCH_MARKER* marker = new SCH_MARKER();
marker->m_TimeStamp = GetNewTimeStamp(); marker->SetTimeStamp( GetNewTimeStamp() );
marker->SetData( ERCE_DUPLICATE_SHEET_NAME, marker->SetData( ERCE_DUPLICATE_SHEET_NAME,
( (SCH_SHEET*) test_item )->GetPosition(), ( (SCH_SHEET*) test_item )->GetPosition(),
_( "Duplicate sheet name" ), _( "Duplicate sheet name" ),
@ -237,7 +237,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
/* Create new marker for ERC error. */ /* Create new marker for ERC error. */
marker = new SCH_MARKER(); marker = new SCH_MARKER();
marker->m_TimeStamp = GetNewTimeStamp(); marker->SetTimeStamp( GetNewTimeStamp() );
marker->SetMarkerType( MARK_ERC ); marker->SetMarkerType( MARK_ERC );
marker->SetErrorLevel( WAR ); marker->SetErrorLevel( WAR );

View File

@ -29,7 +29,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
{ {
SCH_COMPONENT* newitem; SCH_COMPONENT* newitem;
newitem = new SCH_COMPONENT( *( (SCH_COMPONENT*) curr_item ) ); newitem = new SCH_COMPONENT( *( (SCH_COMPONENT*) curr_item ) );
newitem->m_TimeStamp = GetNewTimeStamp(); newitem->SetTimeStamp( GetNewTimeStamp() );
newitem->ClearAnnotation( NULL ); newitem->ClearAnnotation( NULL );
newitem->m_Flags = IS_NEW; newitem->m_Flags = IS_NEW;
MoveItem( (SCH_ITEM*) newitem, &dc ); MoveItem( (SCH_ITEM*) newitem, &dc );

View File

@ -1035,7 +1035,7 @@ XNODE* EXPORT_HELP::makeGenericComponents()
xsheetpath->AddAttribute( sNames, path->PathHumanReadable() ); xsheetpath->AddAttribute( sNames, path->PathHumanReadable() );
xsheetpath->AddAttribute( sTStamps, path->Path() ); xsheetpath->AddAttribute( sTStamps, path->Path() );
timeStamp.Printf( sTSFmt, comp->m_TimeStamp ); timeStamp.Printf( sTSFmt, comp->GetTimeStamp() );
xcomp->AddChild( node( sTStamp, timeStamp ) ); xcomp->AddChild( node( sTStamp, timeStamp ) );
} }
} }

View File

@ -207,13 +207,13 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
case SCH_SHEET_T: case SCH_SHEET_T:
{ {
SCH_SHEET* sheet = (SCH_SHEET*) newitem; SCH_SHEET* sheet = (SCH_SHEET*) newitem;
sheet->m_TimeStamp = GetNewTimeStamp(); sheet->SetTimeStamp( GetNewTimeStamp() );
sheet->SetSon( NULL ); sheet->SetSon( NULL );
break; break;
} }
case SCH_COMPONENT_T: case SCH_COMPONENT_T:
( (SCH_COMPONENT*) newitem )->m_TimeStamp = GetNewTimeStamp(); ( (SCH_COMPONENT*) newitem )->SetTimeStamp( GetNewTimeStamp() );
( (SCH_COMPONENT*) newitem )->ClearAnnotation( NULL ); ( (SCH_COMPONENT*) newitem )->ClearAnnotation( NULL );
break; break;
} }
@ -246,7 +246,7 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* aDrawStruct, bool aClone )
SCH_ITEM* NewDrawStruct = aDrawStruct->Clone(); SCH_ITEM* NewDrawStruct = aDrawStruct->Clone();
if( aClone ) if( aClone )
NewDrawStruct->m_TimeStamp = aDrawStruct->m_TimeStamp; NewDrawStruct->SetTimeStamp( aDrawStruct->GetTimeStamp() );
NewDrawStruct->m_Image = aDrawStruct; NewDrawStruct->m_Image = aDrawStruct;

View File

@ -130,7 +130,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, SCH_SHEET_PATH* sheet
m_unit = unit; m_unit = unit;
m_convert = convert; m_convert = convert;
m_ChipName = libComponent.GetName(); m_ChipName = libComponent.GetName();
m_TimeStamp = GetNewTimeStamp(); SetTimeStamp( GetNewTimeStamp() );
if( setNewItemFlag ) if( setNewItemFlag )
m_Flags = IS_NEW | IS_MOVED; m_Flags = IS_NEW | IS_MOVED;
@ -189,7 +189,7 @@ SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aComponent ) :
m_unit = aComponent.m_unit; m_unit = aComponent.m_unit;
m_convert = aComponent.m_convert; m_convert = aComponent.m_convert;
m_ChipName = aComponent.m_ChipName; m_ChipName = aComponent.m_ChipName;
m_TimeStamp = aComponent.m_TimeStamp; SetTimeStamp( aComponent.m_TimeStamp );
m_transform = aComponent.m_transform; m_transform = aComponent.m_transform;
m_prefix = aComponent.m_prefix; m_prefix = aComponent.m_prefix;
m_PathsAndReferences = aComponent.m_PathsAndReferences; m_PathsAndReferences = aComponent.m_PathsAndReferences;
@ -524,7 +524,7 @@ void SCH_COMPONENT::SetTimeStamp( long aNewTimeStamp )
string_timestamp.Printf( wxT( "%8.8X" ), aNewTimeStamp ); string_timestamp.Printf( wxT( "%8.8X" ), aNewTimeStamp );
string_oldtimestamp.Printf( wxT( "%8.8X" ), m_TimeStamp ); string_oldtimestamp.Printf( wxT( "%8.8X" ), m_TimeStamp );
m_TimeStamp = aNewTimeStamp; SetTimeStamp( aNewTimeStamp );
for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ ) for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
{ {

View File

@ -1327,7 +1327,7 @@ int SCH_SCREEN::GetConnection( const wxPoint& aPosition, PICKED_ITEMS_LIST& aLis
*/ */
static bool SortByTimeStamp( const EDA_ITEM* item1, const EDA_ITEM* item2 ) static bool SortByTimeStamp( const EDA_ITEM* item1, const EDA_ITEM* item2 )
{ {
int ii = item1->m_TimeStamp - item2->m_TimeStamp; int ii = item1->GetTimeStamp() - item2->GetTimeStamp();
/* If the time stamps are the same, compare type in order to have component objects /* If the time stamps are the same, compare type in order to have component objects
* before sheet object. This is done because changing the sheet time stamp * before sheet object. This is done because changing the sheet time stamp
@ -1463,7 +1463,7 @@ int SCH_SCREENS::ReplaceDuplicateTimeStamps()
SCH_ITEM* nextItem = (SCH_ITEM*)items[ii + 1]; SCH_ITEM* nextItem = (SCH_ITEM*)items[ii + 1];
if( item->m_TimeStamp == nextItem->m_TimeStamp ) if( item->GetTimeStamp() == nextItem->GetTimeStamp() )
{ {
count++; count++;
@ -1477,7 +1477,7 @@ int SCH_SCREENS::ReplaceDuplicateTimeStamps()
// @todo: see how to change sheet paths for its cmp list (can // @todo: see how to change sheet paths for its cmp list (can
// be possible in most cases) // be possible in most cases)
else else
item->m_TimeStamp = GetNewTimeStamp(); item->SetTimeStamp( GetNewTimeStamp() );
} }
} }

View File

@ -53,7 +53,7 @@ SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
m_Layer = LAYER_SHEET; m_Layer = LAYER_SHEET;
m_pos = pos; m_pos = pos;
m_size = wxSize( MIN_SHEET_WIDTH, MIN_SHEET_HEIGHT ); m_size = wxSize( MIN_SHEET_WIDTH, MIN_SHEET_HEIGHT );
m_TimeStamp = GetNewTimeStamp(); SetTimeStamp( GetNewTimeStamp() );
m_sheetNameSize = m_fileNameSize = 60; m_sheetNameSize = m_fileNameSize = 60;
m_screen = NULL; m_screen = NULL;
m_name.Printf( wxT( "Sheet%8.8lX" ), m_TimeStamp ); m_name.Printf( wxT( "Sheet%8.8lX" ), m_TimeStamp );
@ -67,7 +67,7 @@ SCH_SHEET::SCH_SHEET( const SCH_SHEET& aSheet ) :
m_pos = aSheet.m_pos; m_pos = aSheet.m_pos;
m_size = aSheet.m_size; m_size = aSheet.m_size;
m_Layer = aSheet.m_Layer; m_Layer = aSheet.m_Layer;
m_TimeStamp = aSheet.m_TimeStamp; SetTimeStamp( aSheet.m_TimeStamp );
m_sheetNameSize = aSheet.m_sheetNameSize; m_sheetNameSize = aSheet.m_sheetNameSize;
m_fileNameSize = aSheet.m_fileNameSize; m_fileNameSize = aSheet.m_fileNameSize;
m_screen = aSheet.m_screen; m_screen = aSheet.m_screen;
@ -184,7 +184,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
SCH_SHEET_PIN* sheetPin; SCH_SHEET_PIN* sheetPin;
char* ptcar; char* ptcar;
m_TimeStamp = GetNewTimeStamp(); SetTimeStamp( GetNewTimeStamp() );
// sheets are added to the GetDrawItems() like other schematic components. // sheets are added to the GetDrawItems() like other schematic components.
// however, in order to preserve the hierarchy (through m_Parent pointers), // however, in order to preserve the hierarchy (through m_Parent pointers),
@ -224,7 +224,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
{ {
sscanf( ((char*)aLine) + 1, "%lX", &m_TimeStamp ); sscanf( ((char*)aLine) + 1, "%lX", &m_TimeStamp );
if( m_TimeStamp == 0 ) // zero is not unique! if( m_TimeStamp == 0 ) // zero is not unique!
m_TimeStamp = GetNewTimeStamp(); SetTimeStamp( GetNewTimeStamp() );
continue; continue;
} }

View File

@ -101,10 +101,10 @@ int SCH_SHEET_PATH::Cmp( const SCH_SHEET_PATH& aSheetPathToTest ) const
//otherwise, same number of sheets. //otherwise, same number of sheets.
for( unsigned i = 0; i<m_numSheets; i++ ) for( unsigned i = 0; i<m_numSheets; i++ )
{ {
if( m_sheets[i]->m_TimeStamp > aSheetPathToTest.m_sheets[i]->m_TimeStamp ) if( m_sheets[i]->GetTimeStamp() > aSheetPathToTest.m_sheets[i]->GetTimeStamp() )
return 1; return 1;
if( m_sheets[i]->m_TimeStamp < aSheetPathToTest.m_sheets[i]->m_TimeStamp ) if( m_sheets[i]->GetTimeStamp() < aSheetPathToTest.m_sheets[i]->GetTimeStamp() )
return -1; return -1;
} }
@ -200,7 +200,7 @@ wxString SCH_SHEET_PATH::Path() const
// it's timestamp changes anyway. // it's timestamp changes anyway.
for( unsigned i = 1; i < m_numSheets; i++ ) for( unsigned i = 1; i < m_numSheets; i++ )
{ {
t.Printf( _( "%8.8lX/" ), m_sheets[i]->m_TimeStamp ); t.Printf( _( "%8.8lX/" ), m_sheets[i]->GetTimeStamp() );
s = s + t; s = s + t;
} }

View File

@ -312,7 +312,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
SCH_SHEET* sheet = new SCH_SHEET( GetScreen()->GetCrossHairPosition() ); SCH_SHEET* sheet = new SCH_SHEET( GetScreen()->GetCrossHairPosition() );
sheet->SetFlags( IS_NEW | IS_RESIZED ); sheet->SetFlags( IS_NEW | IS_RESIZED );
sheet->m_TimeStamp = GetNewTimeStamp(); sheet->SetTimeStamp( GetNewTimeStamp() );
sheet->SetParent( GetScreen() ); sheet->SetParent( GetScreen() );
sheet->SetScreen( NULL ); sheet->SetScreen( NULL );

View File

@ -70,7 +70,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource ) :
m_Shape = aSource.m_Shape; m_Shape = aSource.m_Shape;
m_Flags = aSource.m_Flags; m_Flags = aSource.m_Flags;
m_TimeStamp = aSource.m_TimeStamp; SetTimeStamp( aSource.m_TimeStamp );
SetStatus( aSource.ReturnStatus() ); SetStatus( aSource.ReturnStatus() );
m_Start = aSource.m_Start; m_Start = aSource.m_Start;

View File

@ -366,16 +366,17 @@ private:
int m_Status; int m_Status;
protected: protected:
EDA_ITEM* Pnext; /* Linked list: Link (next struct) */ EDA_ITEM* Pnext; ///< next in linked list
EDA_ITEM* Pback; /* Linked list: Link (previous struct) */ EDA_ITEM* Pback; ///< previous in linked list
DHEAD* m_List; ///< which DLIST I am on.
EDA_ITEM* m_Parent; /* Linked list: Link (parent struct) */ EDA_ITEM* m_Parent; /* Linked list: Link (parent struct) */
EDA_ITEM* m_Son; /* Linked list: Link (son struct) */ EDA_ITEM* m_Son; /* Linked list: Link (son struct) */
DHEAD* m_List; ///< which DLIST I am on. unsigned long m_TimeStamp; ///< Time stamp used for logical links
public: public:
int m_Flags; // flags for editing and other uses. int m_Flags; // flags for editing and other uses.
unsigned long m_TimeStamp; // Time stamp used for logical links
int m_Selected; /* Used by block commands, and selective editing */ int m_Selected; /* Used by block commands, and selective editing */
// member used in undo/redo function // member used in undo/redo function
@ -385,7 +386,7 @@ private:
void InitVars(); void InitVars();
/** /**
* @brief Function doClone * Function doClone
* is used by the derived class to actually implement the cloning. * is used by the derived class to actually implement the cloning.
* *
* The default version will return NULL in release builds and likely crash the * The default version will return NULL in release builds and likely crash the
@ -520,15 +521,17 @@ public:
} }
/** /**
* @brief Function Clone * Function Clone
* creates a duplicate of this item with linked list members set to NULL. * creates a duplicate of this item with linked list members set to NULL.
* *
* The Clone() function only calls the private virtual doClone() which actually * The Clone() function only calls the private virtual doClone() which actually
* does the cloning for the derived object. * does the cloning for the derived object.
* *
* @todo: use this instead of Copy() everywhere, then kill Copy().
*
* @return A clone of the item. * @return A clone of the item.
*/ */
EDA_ITEM* Clone() const { return doClone(); } EDA_ITEM* Clone() const; // should not be inline, to save the ~ 6 bytes per call site.
/** /**
* Function IterateForward * Function IterateForward
@ -755,20 +758,19 @@ enum FILL_T {
class EDA_TEXT class EDA_TEXT
{ {
public: public:
int m_Thickness; /* pen size used to draw this text */ wxString m_Text;
int m_Orient; /* Orient in 0.1 degrees */ int m_Thickness; ///< pen size used to draw this text
int m_Orient; ///< Orient in 0.1 degrees
wxString m_Text; /* text! */ wxPoint m_Pos; ///< XY position of anchor text.
wxPoint m_Pos; /* XY position of anchor text. */ wxSize m_Size; ///< XY size of text
wxSize m_Size; /* XY size of text */
bool m_Mirror; ///< true iff mirrored bool m_Mirror; ///< true iff mirrored
int m_Attributs; /* flags (visible...) */ int m_Attributs; ///< bit flags such as visible, etc.
bool m_Italic; /* true to simulate (or use if exists) bool m_Italic; ///< should be italic font (if available)
* an italic font... */ bool m_Bold; ///< should be bold font (if available)
bool m_Bold; /* true to simulate a bold font ... */ GRTextHorizJustifyType m_HJustify; ///< horizontal justification
GRTextHorizJustifyType m_HJustify; /* Horiz justification */ GRTextVertJustifyType m_VJustify; ///< vertical justification
GRTextVertJustifyType m_VJustify; /* Vertical justification */
bool m_MultilineAllowed; /* true to use multiline option, false bool m_MultilineAllowed; /**< true to use multiline option, false
* to use only single line text * to use only single line text
* Single line is faster in * Single line is faster in
* calculations than multiline */ * calculations than multiline */
@ -798,7 +800,7 @@ public:
void SetItalic( bool isItalic ) { m_Italic = isItalic; } void SetItalic( bool isItalic ) { m_Italic = isItalic; }
bool IsItalic() const { return m_Italic; } bool IsItalic() const { return m_Italic; }
void SetMirrored( bool doMirror ) { m_Mirror = doMirror; } void SetMirrored( bool isMirrored ) { m_Mirror = isMirrored; }
bool IsMirrored() const { return m_Mirror; } bool IsMirrored() const { return m_Mirror; }
/** /**

View File

@ -854,7 +854,7 @@ void PCB_EDIT_FRAME::Block_Duplicate()
module->m_Flags = 0; module->m_Flags = 0;
newitem = new_module = new MODULE( m_Pcb ); newitem = new_module = new MODULE( m_Pcb );
new_module->Copy( module ); new_module->Copy( module );
new_module->m_TimeStamp = GetNewTimeStamp(); new_module->SetTimeStamp( GetNewTimeStamp() );
m_Pcb->m_Modules.PushFront( new_module ); m_Pcb->m_Modules.PushFront( new_module );
} }
break; break;
@ -877,7 +877,7 @@ void PCB_EDIT_FRAME::Block_Duplicate()
{ {
ZONE_CONTAINER* new_zone = new ZONE_CONTAINER( (BOARD*) item->GetParent() ); ZONE_CONTAINER* new_zone = new ZONE_CONTAINER( (BOARD*) item->GetParent() );
new_zone->Copy( (ZONE_CONTAINER*) item ); new_zone->Copy( (ZONE_CONTAINER*) item );
new_zone->m_TimeStamp = GetNewTimeStamp(); new_zone->SetTimeStamp( GetNewTimeStamp() );
newitem = new_zone; newitem = new_zone;
m_Pcb->Add( new_zone ); m_Pcb->Add( new_zone );
} }

View File

@ -408,7 +408,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
module->m_Pads.PushFront( NewPad ); module->m_Pads.PushFront( NewPad );
} }
for( BOARD_ITEM* item = module->m_Drawings; item; item = item->Next() ) for( BOARD_ITEM* item = module->m_Drawings; item; item = item->Next() )
{ {
if( item->m_Selected == 0 ) if( item->m_Selected == 0 )
continue; continue;
@ -473,16 +473,21 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
( (TEXTE_MODULE*) item )->m_Pos += offset; {
( (TEXTE_MODULE*) item )->m_Pos0 += offset; TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
tm->m_Pos += offset;
tm->SetPos0( tm->GetPos0() + offset );
}
break; break;
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
( (EDGE_MODULE*) item )->m_Start += offset; {
( (EDGE_MODULE*) item )->m_End += offset; EDGE_MODULE* em = (EDGE_MODULE*) item;
em->m_Start += offset;
( (EDGE_MODULE*) item )->m_Start0 += offset; em->m_End += offset;
( (EDGE_MODULE*) item )->m_End0 += offset; em->m_Start0 += offset;
em->m_End0 += offset;
}
break; break;
default: default:
@ -571,20 +576,25 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
EDGE_MODULE * edge; {
edge = (EDGE_MODULE*) item; EDGE_MODULE* em = (EDGE_MODULE*) item;
SETMIRROR( edge->m_Start.x ); SETMIRROR( em->m_Start.x );
edge->m_Start0.x = edge->m_Start.x; em->m_Start0.x = em->m_Start.x;
SETMIRROR( edge->m_End.x ); SETMIRROR( em->m_End.x );
edge->m_End0.x = edge->m_End.x; em->m_End0.x = em->m_End.x;
NEGATE( edge->m_Angle ); NEGATE( em->m_Angle );
}
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
tmp = ( (TEXTE_MODULE*) item )->GetPosition(); {
SETMIRROR( tmp.x ); TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
( (TEXTE_MODULE*) item )->SetPosition( tmp ); tmp = tm->GetPosition();
( (TEXTE_MODULE*) item )->m_Pos0.x = ( (TEXTE_MODULE*) item )->GetPosition().x; SETMIRROR( tmp.x );
tm->SetPosition( tmp );
tmp.y = tm->GetPos0().y;
tm->SetPos0( tmp );
}
break; break;
default: default:
@ -633,20 +643,24 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
ROTATE( ( (EDGE_MODULE*) item )->m_Start ); {
( (EDGE_MODULE*) item )->m_Start0 = ( (EDGE_MODULE*) item )->m_Start; EDGE_MODULE* em = (EDGE_MODULE*) item;
ROTATE( ( (EDGE_MODULE*) item )->m_End ); ROTATE( em->m_Start );
( (EDGE_MODULE*) item )->m_End0 = ( (EDGE_MODULE*) item )->m_End; em->m_Start0 = em->m_Start;
ROTATE( em->m_End );
em->m_End0 = em->m_End;
}
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
{ {
wxPoint pos = ( (TEXTE_MODULE*) item )->GetPosition(); TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
wxPoint pos = tm->GetPosition();
ROTATE( pos ); ROTATE( pos );
( (TEXTE_MODULE*) item )->SetPosition( pos ); tm->SetPosition( pos );
tm->SetPos0( tm->GetPosition() );
tm->SetOrientation( tm->GetOrientation() + 900 );
} }
( (TEXTE_MODULE*) item )->m_Pos0 = ( (TEXTE_MODULE*) item )->GetPosition();
( (TEXTE_MODULE*) item )->m_Orient += 900;
break; break;
default: default:

View File

@ -71,7 +71,7 @@ void DIMENSION::Copy( DIMENSION* source )
m_Pos = source->m_Pos; m_Pos = source->m_Pos;
m_Shape = source->m_Shape; m_Shape = source->m_Shape;
m_Unit = source->m_Unit; m_Unit = source->m_Unit;
m_TimeStamp = GetNewTimeStamp(); SetTimeStamp( GetNewTimeStamp() );
m_Text->Copy( source->m_Text ); m_Text->Copy( source->m_Text );
m_crossBarOx = source->m_crossBarOx; m_crossBarOx = source->m_crossBarOx;

View File

@ -48,7 +48,7 @@ void DRAWSEGMENT::Copy( DRAWSEGMENT* source )
m_End = source->m_End; m_End = source->m_End;
m_Shape = source->m_Shape; m_Shape = source->m_Shape;
m_Angle = source->m_Angle; m_Angle = source->m_Angle;
m_TimeStamp = source->m_TimeStamp; SetTimeStamp( source->m_TimeStamp );
m_BezierC1 = source->m_BezierC1; m_BezierC1 = source->m_BezierC1;
m_BezierC2 = source->m_BezierC1; m_BezierC2 = source->m_BezierC1;
m_BezierPoints = source->m_BezierPoints; m_BezierPoints = source->m_BezierPoints;

View File

@ -41,6 +41,7 @@ public:
DRAWSEGMENT* Back() const { return (DRAWSEGMENT*) Pback; } DRAWSEGMENT* Back() const { return (DRAWSEGMENT*) Pback; }
void SetWidth( int aWidth ) { m_Width = aWidth; } void SetWidth( int aWidth ) { m_Width = aWidth; }
int GetWidth() const { return m_Width; }
void SetStart( const wxPoint& aStart ) { m_Start = aStart; } void SetStart( const wxPoint& aStart ) { m_Start = aStart; }
@ -52,10 +53,12 @@ public:
* @param aAngle is tenths of degrees, but will soon be degrees. * @param aAngle is tenths of degrees, but will soon be degrees.
*/ */
void SetAngle( double aAngle ); // encapsulates the transition to degrees void SetAngle( double aAngle ); // encapsulates the transition to degrees
double GetAngle() const { return m_Angle; }
void SetType( int aType ) { m_Type = aType; } void SetType( int aType ) { m_Type = aType; }
void SetShape( int aShape ) { m_Shape = aShape; } void SetShape( int aShape ) { m_Shape = aShape; }
int GetShape() const { return m_Shape; }
void SetBezControl1( const wxPoint& aPoint ) { m_BezierC1 = aPoint; } void SetBezControl1( const wxPoint& aPoint ) { m_BezierC1 = aPoint; }
void SetBezControl2( const wxPoint& aPoint ) { m_BezierC2 = aPoint; } void SetBezControl2( const wxPoint& aPoint ) { m_BezierC2 = aPoint; }
@ -104,8 +107,8 @@ public:
*/ */
MODULE* GetParentModule() const; MODULE* GetParentModule() const;
std::vector<wxPoint>& GetBezierPoints() { return m_BezierPoints; }; const std::vector<wxPoint>& GetBezierPoints() const { return m_BezierPoints; };
std::vector<wxPoint>& GetPolyPoints() { return m_PolyPoints; }; const std::vector<wxPoint>& GetPolyPoints() const { return m_PolyPoints; };
void SetBezierPoints( std::vector<wxPoint>& aPoints ) void SetBezierPoints( std::vector<wxPoint>& aPoints )
{ {

View File

@ -223,7 +223,7 @@ void EDGE_MODULE::DisplayInfo( EDA_DRAW_FRAME* frame )
frame->AppendMsgPanel( _( "Module" ), module->m_Reference->m_Text, DARKCYAN ); frame->AppendMsgPanel( _( "Module" ), module->m_Reference->m_Text, DARKCYAN );
frame->AppendMsgPanel( _( "Value" ), module->m_Value->m_Text, BLUE ); frame->AppendMsgPanel( _( "Value" ), module->m_Value->m_Text, BLUE );
msg.Printf( wxT( "%8.8lX" ), module->m_TimeStamp ); msg.Printf( wxT( "%8.8lX" ), module->GetTimeStamp() );
frame->AppendMsgPanel( _( "TimeStamp" ), msg, BROWN ); frame->AppendMsgPanel( _( "TimeStamp" ), msg, BROWN );
frame->AppendMsgPanel( _( "Mod Layer" ), board->GetLayerName( module->GetLayer() ), RED ); frame->AppendMsgPanel( _( "Mod Layer" ), board->GetLayerName( module->GetLayer() ), RED );
frame->AppendMsgPanel( _( "Seg Layer" ), board->GetLayerName( GetLayer() ), RED ); frame->AppendMsgPanel( _( "Seg Layer" ), board->GetLayerName( GetLayer() ), RED );

View File

@ -50,7 +50,7 @@ void PCB_TARGET::Copy( PCB_TARGET* source )
m_Pos = source->m_Pos; m_Pos = source->m_Pos;
m_Shape = source->m_Shape; m_Shape = source->m_Shape;
m_Size = source->m_Size; m_Size = source->m_Size;
m_TimeStamp = GetNewTimeStamp(); SetTimeStamp( GetNewTimeStamp() );
} }

View File

@ -125,7 +125,7 @@ void MODULE::Copy( MODULE* aModule )
m_LastEdit_Time = aModule->m_LastEdit_Time; m_LastEdit_Time = aModule->m_LastEdit_Time;
m_Link = aModule->m_Link; m_Link = aModule->m_Link;
m_Path = aModule->m_Path; //is this correct behavior? m_Path = aModule->m_Path; //is this correct behavior?
m_TimeStamp = GetNewTimeStamp(); SetTimeStamp( GetNewTimeStamp() );
m_LocalClearance = aModule->m_LocalClearance; m_LocalClearance = aModule->m_LocalClearance;
m_LocalSolderMaskMargin = aModule->m_LocalSolderMaskMargin; m_LocalSolderMaskMargin = aModule->m_LocalSolderMaskMargin;

View File

@ -23,22 +23,22 @@ class D_PAD;
class BOARD; class BOARD;
enum Mod_Attribut /* Attributes used for modules */ /**
* Enum MODULE_ATTR_T
* is the set of attributes allowed within a MODULE, using MODULE::SetAttributes()
* and MODULE::GetAttributes(). These are to be ORed together when calling
* MODULE::SetAttrbute()
*/
enum MODULE_ATTR_T
{ {
MOD_DEFAULT = 0, /* Type default */ MOD_DEFAULT = 0, ///< default
MOD_CMS = 1, /* Set for modules listed in the automatic insertion list MOD_CMS = 1, ///< Set for modules listed in the automatic insertion list
* (usually SMD footprints) */ ///< (usually SMD footprints)
MOD_VIRTUAL = 2 /* Virtual component: when created by copper shapes on MOD_VIRTUAL = 2 ///< Virtual component: when created by copper shapes on
* board (Like edge card connectors, mounting hole...) */ ///< board (Like edge card connectors, mounting hole...)
}; };
/* flags for autoplace and autoroute (.m_ModuleStatus member) */
#define MODULE_is_LOCKED 0x01 /* module LOCKED: no autoplace allowed */
#define MODULE_is_PLACED 0x02 /* In autoplace: module automatically placed */
#define MODULE_to_PLACE 0x04 /* In autoplace: module waiting for autoplace */
class MODULE : public BOARD_ITEM class MODULE : public BOARD_ITEM
{ {
@ -53,22 +53,33 @@ public:
wxString m_LibRef; /* Name of the module in library (and wxString m_LibRef; /* Name of the module in library (and
* the default value when loading a * the default value when loading a
* module from the library) */ * module from the library) */
wxString m_AlternateReference; /* Used when m_Reference cannot wxString m_AlternateReference; /* Used when m_Reference cannot
* be used to identify the * be used to identify the
* footprint ( after a full * footprint ( after a full
* reannotation of the schematic */ * reannotation of the schematic */
int m_Attributs; /* Flag bits ( see Mod_Attribut ) */ int m_Attributs; ///< Flag bits ( see Mod_Attribut )
int flag; /* Use to trace ratsnest and auto routing. */ int flag; /* Use to trace ratsnest and auto routing. */
int m_ModuleStatus; /* For autoplace: flags (LOCKED, AUTOPLACED) */
int m_ModuleStatus; ///< For autoplace: flags (LOCKED, AUTOPLACED)
// m_ModuleStatus bits:
#define MODULE_is_LOCKED 0x01 ///< module LOCKED: no autoplace allowed
#define MODULE_is_PLACED 0x02 ///< In autoplace: module automatically placed
#define MODULE_to_PLACE 0x04 ///< In autoplace: module waiting for autoplace
EDA_RECT m_BoundaryBox; // Bounding box : coordinates on board, real orientation. EDA_RECT m_BoundaryBox; // Bounding box : coordinates on board, real orientation.
int m_PadNum; // Pad count int m_PadNum; // Pad count
int m_AltPadNum; /* Pad with netcode > 0 (active pads) count */ int m_AltPadNum; /* Pad with netcode > 0 (active pads) count */
int m_CntRot90; /* Automatic placement : cost ( 0..10 ) int m_CntRot90; ///< Automatic placement : cost ( 0..10 )
* for 90 degrees rotation (Horiz<->Vertical) */ ///< for 90 degrees rotation (Horiz<->Vertical)
int m_CntRot180; /* Automatic placement : cost ( 0..10 )
* for 180 degrees rotation (UP <->Down) */ int m_CntRot180; ///< Automatic placement : cost ( 0..10 )
///< for 180 degrees rotation (UP <->Down)
wxSize m_Ext; /* Automatic placement margin around the module */ wxSize m_Ext; /* Automatic placement margin around the module */
double m_Surface; // Bounding box area double m_Surface; // Bounding box area
@ -79,16 +90,16 @@ public:
wxString m_Doc; // Module Description (info for users) wxString m_Doc; // Module Description (info for users)
wxString m_KeyWord; // Keywords to select the module in lib wxString m_KeyWord; // Keywords to select the module in lib
// Local clearance. When null, the netclasses values are used. Usually // Local tolerances. When zero, this means the corresponding netclass value
// the local clearance is null // is used. Usually theses local tolerances zero, in deference to the
// corresponding netclass values.
int m_LocalClearance; int m_LocalClearance;
int m_LocalSolderMaskMargin; ///< Solder mask margin
int m_LocalSolderPasteMargin; ///< Solder paste margin
///< absolute value
// Local mask margins: when NULL, the global design values are used double m_LocalSolderPasteMarginRatio; ///< Solder mask margin ratio
int m_LocalSolderMaskMargin; // Solder mask margin ///< value of pad size
int m_LocalSolderPasteMargin; /* Solder paste margin
* absolute value */
double m_LocalSolderPasteMarginRatio; /* Solder mask margin ratio
* value of pad size */
// The final margin is the sum of these 2 values // The final margin is the sum of these 2 values
public: public:
@ -139,9 +150,35 @@ public:
void SetPosition( const wxPoint& aPos ); // overload void SetPosition( const wxPoint& aPos ); // overload
void SetOrientation( int newangle ); void SetOrientation( int newangle );
int GetOrientation() const { return m_Orient; } int GetOrientation() const { return m_Orient; }
const wxString& GetLibRef() const { return m_LibRef; }
void SetLibRef( const wxString& aLibRef ) { m_LibRef = aLibRef; }
const wxString& GetDescription() const { return m_Doc; }
void SetDescription( const wxString& aDoc ) { m_Doc = aDoc; }
const wxString& GetKeywords() const { return m_KeyWord; }
void SetKeywords( const wxString& aKeywords ) { m_KeyWord = aKeywords; }
const wxString& GetPath() const { return m_Path; }
void SetPath( const wxString& aPath ) { m_Path = aPath; }
int GetLocalSolderMaskMargin() const { return m_LocalSolderMaskMargin; }
void SetLocalSolderMaskMargin( int aMargin ) { m_LocalSolderMaskMargin = aMargin; }
int GetLocalClearance() const { return m_LocalClearance; }
void SetLocalClearance( int aClearance ) { m_LocalClearance = aClearance; }
int GetLocalSolderPasteMargin() const { return m_LocalSolderPasteMargin; }
void SetLocalSolderPasteMargin( int aMargin ) { m_LocalSolderPasteMargin = aMargin; }
double GetLocalSolderPasteMarginRatio() const { return m_LocalSolderPasteMarginRatio; }
void SetLocalSolderPasteMarginRatio( double aRatio ) { m_LocalSolderPasteMarginRatio = aRatio; }
int GetAttributes() const { return m_Attributs; }
void SetAttributes( int aAttributes ) { m_Attributs = aAttributes; }
/** /**
* Function Move * Function Move
* move this object. * move this object.
@ -177,11 +214,11 @@ public:
/** /**
* Function SetLocked * Function SetLocked
* sets the MODULE_is_LOCKED bit in the m_ModuleStatus * sets the MODULE_is_LOCKED bit in the m_ModuleStatus
* @param setLocked When true means turn on locked status, else unlock * @param isLocked When true means turn on locked status, else unlock
*/ */
void SetLocked( bool setLocked ) void SetLocked( bool isLocked )
{ {
if( setLocked ) if( isLocked )
m_ModuleStatus |= MODULE_is_LOCKED; m_ModuleStatus |= MODULE_is_LOCKED;
else else
m_ModuleStatus &= ~MODULE_is_LOCKED; m_ModuleStatus &= ~MODULE_is_LOCKED;
@ -197,6 +234,7 @@ public:
} }
void SetLastEditTime( long aTime ) { m_LastEdit_Time = aTime; } void SetLastEditTime( long aTime ) { m_LastEdit_Time = aTime; }
long GetLastEditTime() const { return m_LastEdit_Time; }
/* Reading and writing data on files */ /* Reading and writing data on files */
@ -340,7 +378,7 @@ public:
virtual BITMAP_DEF GetMenuImage() const { return module_xpm; } virtual BITMAP_DEF GetMenuImage() const { return module_xpm; }
#if defined(DEBUG) #if defined(DEBUG)
/** /**
* Function Show * Function Show

View File

@ -150,7 +150,7 @@ void MODULE::Rotate(const wxPoint& aRotCentre, int aAngle)
wxPoint newpos = m_Pos; wxPoint newpos = m_Pos;
RotatePoint( &newpos, aRotCentre, aAngle ); RotatePoint( &newpos, aRotCentre, aAngle );
SetPosition( newpos ); SetPosition( newpos );
SetOrientation( m_Orient + aAngle ); SetOrientation( GetOrientation() + aAngle );
} }

View File

@ -139,32 +139,33 @@ const wxPoint D_PAD::ReturnShapePos()
} }
/* Return pad name as string in a wxString const wxString D_PAD::GetPadName() const
*/
wxString D_PAD::ReturnStringPadName() const
{ {
wxString name; // Return pad name as wxString, assume it starts as a non-terminated
// utf8 character sequence
ReturnStringPadName( name ); char temp[sizeof(m_Padname)+1]; // a place to terminate with '\0'
return name;
strncpy( temp, m_Padname, sizeof(m_Padname) );
temp[sizeof(m_Padname)] = 0;
return FROM_UTF8( temp );
} }
/* Return pad name as string in a buffer
*/
void D_PAD::ReturnStringPadName( wxString& text ) const void D_PAD::ReturnStringPadName( wxString& text ) const
{ {
int ii; // Return pad name as wxString, assume it starts as a non-terminated
// utf8 character sequence
text.Empty(); char temp[sizeof(m_Padname)+1]; // a place to terminate with '\0'
for( ii = 0; ii < 4; ii++ ) strncpy( temp, m_Padname, sizeof(m_Padname) );
{
if( m_Padname[ii] == 0 )
break;
text.Append( m_Padname[ii] ); temp[sizeof(m_Padname)] = 0;
}
text = FROM_UTF8( temp );
} }
@ -712,7 +713,7 @@ wxString D_PAD::GetSelectMenuText() const
padlayers = _( "???" ); padlayers = _( "???" );
text.Printf( _( "Pad [%s] (%s) of %s" ), text.Printf( _( "Pad [%s] (%s) of %s" ),
GetChars(ReturnStringPadName() ), GetChars( padlayers ), GetChars(GetPadName() ), GetChars( padlayers ),
GetChars(( (MODULE*) GetParent() )->GetReference() ) ); GetChars(( (MODULE*) GetParent() )->GetReference() ) );
return text; return text;

View File

@ -117,8 +117,9 @@ public:
int m_ShapeMaxRadius; // radius of the circle containing the pad shape int m_ShapeMaxRadius; // radius of the circle containing the pad shape
int m_Attribut; // NORMAL, PAD_SMD, PAD_CONN, PAD_HOLE_NOT_PLATED int m_Attribut; // NORMAL, PAD_SMD, PAD_CONN, PAD_HOLE_NOT_PLATED
int m_Orient; // in 1/10 degrees int m_Orient; // in 1/10 degrees
static int m_PadSketchModePenSize; // Pen size used to draw pads in sketch mode
// (mode used to print pads on silkscreen layer) static int m_PadSketchModePenSize; // Pen size used to draw pads in sketch mode
// (mode used to print pads on silkscreen layer)
int m_LengthDie; // Length net from pad to die on chip int m_LengthDie; // Length net from pad to die on chip
@ -146,43 +147,51 @@ public:
D_PAD* Next() { return (D_PAD*) Pnext; } D_PAD* Next() { return (D_PAD*) Pnext; }
/**
* Function GetNetname
* @return const wxString * , a pointer to the full netname
*/
wxString GetNetname() const { return m_Netname; }
/**
* Function GetShortNetname
* @return const wxString * , a pointer to the short netname
*/
wxString GetShortNetname() const { return m_ShortNetname; }
/** /**
* Function SetNetname * Function SetNetname
* @param aNetname: the new netname * @param aNetname: the new netname
*/ */
void SetNetname( const wxString& aNetname ); void SetNetname( const wxString& aNetname );
/**
* Function GetNetname
* @return const wxString& - the full netname
*/
const wxString& GetNetname() const { return m_Netname; }
/**
* Function GetShortNetname
* @return const wxString& - the short netname
*/
const wxString& GetShortNetname() const { return m_ShortNetname; }
/** /**
* Function GetShape * Function GetShape
* @return the shape of this pad. * @return the shape of this pad.
*/ */
int GetShape() const { return m_PadShape & 0xFF; } int GetShape() const { return m_PadShape & 0xFF; }
void SetShape( int aShape ) { m_PadShape = aShape; } void SetShape( int aShape ) { m_PadShape = aShape; }
void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; } // overload
const wxPoint GetPosition() const // overload const wxPoint GetPosition() const // overload
{ {
return m_Pos; return m_Pos;
} }
void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; } // overload
void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; } void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; }
const wxPoint& GetPos0() const { return m_Pos0; }
void SetSize( const wxSize& aSize ) { m_Size = aSize; } void SetSize( const wxSize& aSize ) { m_Size = aSize; }
const wxSize& GetSize() const { return m_Size; }
void SetDelta( const wxSize& aSize ) { m_DeltaSize = aSize; } void SetDelta( const wxSize& aSize ) { m_DeltaSize = aSize; }
const wxSize& GetDelta() const { return m_DeltaSize; }
void SetDrillSize( const wxSize& aSize ) { m_Drill = aSize; } void SetDrillSize( const wxSize& aSize ) { m_Drill = aSize; }
const wxSize& GetDrillSize() const { return m_Drill; }
void SetOffset( const wxSize& aOffset ) { m_Offset = aOffset; } void SetOffset( const wxSize& aOffset ) { m_Offset = aOffset; }
const wxSize& GetOffset() const { return m_Offset; }
/** /**
* Function SetOrientation * Function SetOrientation
@ -198,15 +207,29 @@ public:
double GetOrientation() const { return m_Orient; } double GetOrientation() const { return m_Orient; }
void SetDrillShape( int aDrillShape ) { m_DrillShape = aDrillShape; } void SetDrillShape( int aDrillShape ) { m_DrillShape = aDrillShape; }
void SetLayerMask( int aLayerMask ) { m_layerMask = aLayerMask; } int GetDrillShape() const { return m_DrillShape; }
void SetAttribute( int aAttribute ) { m_Attribut = aAttribute; }
void SetDieLength( int aLength ) { m_LengthDie = aLength; } void SetLayerMask( int aLayerMask ) { m_layerMask = aLayerMask; }
void SetSolderMaskMargin( int aLength ) { m_LocalSolderMaskMargin = aLength; } int GetLayerMask() const { return m_layerMask; }
void SetSolderPasteMargin( int aLength ) { m_LocalSolderPasteMargin = aLength; }
void SetSolderPasteRatio( double aRatio ) { m_LocalSolderPasteMarginRatio = aRatio; } void SetAttribute( int aAttribute ) { m_Attribut = aAttribute; }
int GetAttribute() const { return m_Attribut; }
void SetDieLength( int aLength ) { m_LengthDie = aLength; }
int GetDieLength() const { return m_LengthDie; }
int GetLocalSolderMaskMargin() const { return m_LocalSolderMaskMargin; }
void SetLocalSolderMaskMargin( int aMargin ) { m_LocalSolderMaskMargin = aMargin; }
int GetLocalClearance() const { return m_LocalClearance; }
void SetLocalClearance( int aClearance ) { m_LocalClearance = aClearance; }
int GetLocalSolderPasteMargin() const { return m_LocalSolderPasteMargin; }
void SetLocalSolderPasteMargin( int aMargin ) { m_LocalSolderPasteMargin = aMargin; }
double GetLocalSolderPasteMarginRatio() const { return m_LocalSolderPasteMarginRatio; }
void SetLocalSolderPasteMarginRatio( double aRatio ) { m_LocalSolderPasteMarginRatio = aRatio; }
/// A local override of the Module's clearance
void SetPadClearance( int aLength ) { m_LocalClearance = aLength; }
/** /**
* Function TransformShapeWithClearanceToPolygon * Function TransformShapeWithClearanceToPolygon
@ -324,11 +347,9 @@ public:
*/ */
int BuildSegmentFromOvalShape( wxPoint& aSegStart, wxPoint& aSegEnd, int aRotation ) const; int BuildSegmentFromOvalShape( wxPoint& aSegStart, wxPoint& aSegEnd, int aRotation ) const;
// others
void SetPadName( const wxString& name ); // Change pad name void SetPadName( const wxString& name ); // Change pad name
void SetPadName( const char* aName ); void SetPadName( const char* aName );
const wxString GetPadName() const;
wxString ReturnStringPadName() const; // Return pad name as string in a wxString
void ReturnStringPadName( wxString& text ) const; // Return pad name as string in a buffer void ReturnStringPadName( wxString& text ) const; // Return pad name as string in a buffer

View File

@ -27,14 +27,19 @@ class MODULE;
class TEXTE_MODULE : public BOARD_ITEM, public EDA_TEXT class TEXTE_MODULE : public BOARD_ITEM, public EDA_TEXT
{ {
/* Note: orientation in 1/10 deg relative to the footprint // @todo eliminate these friends, make them use accessors
* Physical orient is m_Orient + m_Parent->m_Orient friend class MODULE;
*/ friend class FOOTPRINT_EDIT_FRAME;
public:
wxPoint m_Pos0; // text coordinates relatives to the footprint anchor, orient 0 /* Note: orientation in 1/10 deg relative to the footprint
// Text coordinate ref point is the text centre * Physical orient is m_Orient + m_Parent->m_Orient
char m_Type; // 0: ref,1: val, others = 2..255 */
bool m_NoShow; // true = invisible
int m_Type; ///< 0=ref, 1=val, etc.
bool m_NoShow; ///< true = invisible
wxPoint m_Pos0; ///< text coordinates relatives to the footprint anchor, orient 0.
///< text coordinate ref point is the text centre
public: public:
TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS ); TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS );
@ -45,6 +50,11 @@ public:
TEXTE_MODULE* Back() const { return (TEXTE_MODULE*) Pback; } TEXTE_MODULE* Back() const { return (TEXTE_MODULE*) Pback; }
void SetPosition( const wxPoint& aPos ) // overload a base
{
m_Pos = aPos; // in EDA_TEXT
}
const wxPoint GetPosition() const // overload a base const wxPoint GetPosition() const // overload a base
{ {
return m_Pos; // from EDA_TEXT return m_Pos; // from EDA_TEXT
@ -52,16 +62,13 @@ public:
/// @deprecated it seems /// @deprecated it seems
void SetType( int aType ) { m_Type = aType; } void SetType( int aType ) { m_Type = aType; }
int GetType() const { return m_Type; }
void SetPosition( const wxPoint& aPos ) // overload a base
{
m_Pos = aPos; // in EDA_TEXT
}
void SetVisible( bool isVisible ) { m_NoShow = !isVisible; } void SetVisible( bool isVisible ) { m_NoShow = !isVisible; }
bool IsVisible() const { return !m_NoShow; } bool IsVisible() const { return !m_NoShow; }
void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; } void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; }
const wxPoint& GetPos0() const { return m_Pos0; }
void Copy( TEXTE_MODULE* source ); // copy structure void Copy( TEXTE_MODULE* source ); // copy structure

View File

@ -230,7 +230,7 @@ TRACK::TRACK( const TRACK& Source ) :
SetNet( Source.GetNet() ); SetNet( Source.GetNet() );
m_Flags = Source.m_Flags; m_Flags = Source.m_Flags;
m_TimeStamp = Source.m_TimeStamp; SetTimeStamp( Source.m_TimeStamp );
SetStatus( Source.ReturnStatus() ); SetStatus( Source.ReturnStatus() );
m_Start = Source.m_Start; m_Start = Source.m_Start;
m_End = Source.m_End; m_End = Source.m_End;

View File

@ -815,7 +815,7 @@ void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src )
m_Parent = src->m_Parent; m_Parent = src->m_Parent;
m_Layer = src->m_Layer; m_Layer = src->m_Layer;
SetNet( src->GetNet() ); SetNet( src->GetNet() );
m_TimeStamp = src->m_TimeStamp; SetTimeStamp( src->m_TimeStamp );
m_Poly->RemoveAllContours(); m_Poly->RemoveAllContours();
m_Poly->Copy( src->m_Poly ); // copy outlines m_Poly->Copy( src->m_Poly ); // copy outlines
m_CornerSelection = -1; // For corner moving, corner index to drag, or -1 if no selection m_CornerSelection = -1; // For corner moving, corner index to drag, or -1 if no selection

View File

@ -270,7 +270,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
module = (MODULE*) item->GetParent(); module = (MODULE*) item->GetParent();
if( m_Guide->IgnoreMTextsMarkedNoShow() && ( (TEXTE_MODULE*) item )->m_NoShow ) if( m_Guide->IgnoreMTextsMarkedNoShow() && !( (TEXTE_MODULE*) item )->IsVisible() )
goto exit; goto exit;
if( module ) if( module )

View File

@ -168,14 +168,14 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
continue; continue;
/* Found a TYPE ZONE */ /* Found a TYPE ZONE */
if( item->m_TimeStamp == timestampzone ) // Remove it, redundant, zone already found if( item->GetTimeStamp() == timestampzone ) // Remove it, redundant, zone already found
{ {
m_Collector->Remove( ii ); m_Collector->Remove( ii );
ii--; ii--;
} }
else else
{ {
timestampzone = item->m_TimeStamp; timestampzone = item->GetTimeStamp();
} }
} }

View File

@ -164,7 +164,7 @@ void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
case PCB_PAD_T: case PCB_PAD_T:
module = (MODULE*) objectToSync->GetParent(); module = (MODULE*) objectToSync->GetParent();
pad = (D_PAD*) objectToSync; pad = (D_PAD*) objectToSync;
msg = pad->ReturnStringPadName(); msg = pad->GetPadName();
sprintf( cmd, "$PART: \"%s\" $PAD: \"%s\"", sprintf( cmd, "$PART: \"%s\" $PAD: \"%s\"",
TO_UTF8( module->m_Reference->m_Text ), TO_UTF8( module->m_Reference->m_Text ),
TO_UTF8( msg ) ); TO_UTF8( msg ) );
@ -176,9 +176,9 @@ void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
module = (MODULE*) objectToSync->GetParent(); module = (MODULE*) objectToSync->GetParent();
text_mod = (TEXTE_MODULE*) objectToSync; text_mod = (TEXTE_MODULE*) objectToSync;
if( text_mod->m_Type == REFERENCE ) if( text_mod->GetType() == REFERENCE )
text_key = "$REF:"; text_key = "$REF:";
else if( text_mod->m_Type == VALUE ) else if( text_mod->GetType() == VALUE )
text_key = "$VAL:"; text_key = "$VAL:";
else else
break; break;

View File

@ -143,10 +143,9 @@ void DIALOG_MODULE_BOARD_EDITOR::OnCancelClick( wxCommandEvent& event )
void DIALOG_MODULE_BOARD_EDITOR::GotoModuleEditor( wxCommandEvent& event ) void DIALOG_MODULE_BOARD_EDITOR::GotoModuleEditor( wxCommandEvent& event )
{ {
if( m_CurrentModule->m_TimeStamp == 0 ) // Module Editor needs a non if( m_CurrentModule->GetTimeStamp() == 0 ) // Module Editor needs a non null timestamp
// null timestamp
{ {
m_CurrentModule->m_TimeStamp = GetNewTimeStamp(); m_CurrentModule->SetTimeStamp( GetNewTimeStamp() );
m_Parent->OnModify(); m_Parent->OnModify();
} }

View File

@ -108,11 +108,11 @@ void DialogEditModuleText::initDlg( )
m_ModuleInfoText->SetLabel( msg ); m_ModuleInfoText->SetLabel( msg );
if( m_currentText->m_Type == TEXT_is_VALUE ) if( m_currentText->GetType() == TEXT_is_VALUE )
m_TextDataTitle->SetLabel( _( "Value:" ) ); m_TextDataTitle->SetLabel( _( "Value:" ) );
else if( m_currentText->m_Type == TEXT_is_DIVERS ) else if( m_currentText->GetType() == TEXT_is_DIVERS )
m_TextDataTitle->SetLabel( _( "Text:" ) ); m_TextDataTitle->SetLabel( _( "Text:" ) );
else if( m_currentText->m_Type != TEXT_is_REFERENCE ) else if( m_currentText->GetType() != TEXT_is_REFERENCE )
m_TextDataTitle->SetLabel( wxT( "???" ) ); m_TextDataTitle->SetLabel( wxT( "???" ) );
m_Name->SetValue( m_currentText->m_Text ); m_Name->SetValue( m_currentText->m_Text );
@ -128,11 +128,11 @@ void DialogEditModuleText::initDlg( )
m_parent->m_InternalUnits ); m_parent->m_InternalUnits );
AddUnitSymbol( *m_PosXTitle ); AddUnitSymbol( *m_PosXTitle );
PutValueInLocalUnits( *m_TxtPosCtrlX, m_currentText->m_Pos0.x, PutValueInLocalUnits( *m_TxtPosCtrlX, m_currentText->GetPos0().x,
m_parent->m_InternalUnits ); m_parent->m_InternalUnits );
AddUnitSymbol( *m_PosYTitle ); AddUnitSymbol( *m_PosYTitle );
PutValueInLocalUnits( *m_TxtPosCtrlY, m_currentText->m_Pos0.y, PutValueInLocalUnits( *m_TxtPosCtrlY, m_currentText->GetPos0().y,
m_parent->m_InternalUnits ); m_parent->m_InternalUnits );
AddUnitSymbol( *m_WidthTitle ); AddUnitSymbol( *m_WidthTitle );
@ -144,9 +144,8 @@ void DialogEditModuleText::initDlg( )
if( (text_orient != 0) ) if( (text_orient != 0) )
m_Orient->SetSelection( 1 ); m_Orient->SetSelection( 1 );
if( m_currentText->m_NoShow ) if( !m_currentText->IsVisible() )
m_Show->SetSelection( 1 );; m_Show->SetSelection( 1 );;
} }
@ -167,13 +166,15 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
m_currentText->m_Italic = m_Style->GetSelection() == 1 ? true : false; m_currentText->m_Italic = m_Style->GetSelection() == 1 ? true : false;
wxPoint tmp;
msg = m_TxtPosCtrlX->GetValue(); msg = m_TxtPosCtrlX->GetValue();
m_currentText->m_Pos0.x = ReturnValueFromString( g_UserUnit, msg, tmp.x = ReturnValueFromString( g_UserUnit, msg, m_parent->m_InternalUnits );
m_parent->m_InternalUnits );
msg = m_TxtPosCtrlY->GetValue(); msg = m_TxtPosCtrlY->GetValue();
m_currentText->m_Pos0.y = ReturnValueFromString( g_UserUnit, msg, tmp.y = ReturnValueFromString( g_UserUnit, msg, m_parent->m_InternalUnits );
m_parent->m_InternalUnits );
m_currentText->SetPos0( tmp );
msg = m_TxtSizeCtrlX->GetValue(); msg = m_TxtSizeCtrlX->GetValue();
m_currentText->m_Size.x = ReturnValueFromString( g_UserUnit, msg, m_currentText->m_Size.x = ReturnValueFromString( g_UserUnit, msg,
@ -202,7 +203,8 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
} }
m_currentText->SetThickness( width ); m_currentText->SetThickness( width );
m_currentText->m_NoShow = (m_Show->GetSelection() == 0) ? 0 : 1; m_currentText->SetVisible( m_Show->GetSelection() == 0 );
int text_orient = (m_Orient->GetSelection() == 0) ? 0 : 900; int text_orient = (m_Orient->GetSelection() == 0) ? 0 : 900;
m_currentText->m_Orient = text_orient; m_currentText->m_Orient = text_orient;

View File

@ -214,7 +214,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
} }
m_staticTextWarningPadFlipped->Show(m_isFlipped); m_staticTextWarningPadFlipped->Show(m_isFlipped);
m_PadNumCtrl->SetValue( m_dummyPad->ReturnStringPadName() ); m_PadNumCtrl->SetValue( m_dummyPad->GetPadName() );
m_PadNetNameCtrl->SetValue( m_dummyPad->GetNetname() ); m_PadNetNameCtrl->SetValue( m_dummyPad->GetNetname() );
// Display current unit name in dialog: // Display current unit name in dialog:
@ -637,7 +637,7 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
if( m_isFlipped ) if( m_isFlipped )
m_CurrentPad->m_layerMask = ChangeSideMaskLayer( m_CurrentPad->m_layerMask ); m_CurrentPad->m_layerMask = ChangeSideMaskLayer( m_CurrentPad->m_layerMask );
m_CurrentPad->SetPadName( g_Pad_Master.ReturnStringPadName() ); m_CurrentPad->SetPadName( g_Pad_Master.GetPadName() );
if( m_CurrentPad->GetNetname() != g_Pad_Master.GetNetname() ) if( m_CurrentPad->GetNetname() != g_Pad_Master.GetNetname() )
{ {

View File

@ -102,7 +102,7 @@ void FOOTPRINT_EDIT_FRAME::Place_Ancre( MODULE* pt_mod )
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
#undef STRUCT #undef STRUCT
#define STRUCT ( (TEXTE_MODULE*) PtStruct ) #define STRUCT ( (TEXTE_MODULE*) PtStruct )
STRUCT->m_Pos0 += moveVector; STRUCT->SetPos0( STRUCT->GetPos0() + moveVector );
break; break;
default: default:
@ -129,13 +129,13 @@ void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item )
{ {
TEXTE_MODULE* text = (TEXTE_MODULE*) Item; TEXTE_MODULE* text = (TEXTE_MODULE*) Item;
if( text->m_Type == TEXT_is_REFERENCE ) if( text->GetType() == TEXT_is_REFERENCE )
{ {
DisplayError( this, _( "Text is REFERENCE!" ) ); DisplayError( this, _( "Text is REFERENCE!" ) );
break; break;
} }
if( text->m_Type == TEXT_is_VALUE ) if( text->GetType() == TEXT_is_VALUE )
{ {
DisplayError( this, _( "Text is VALUE!" ) ); DisplayError( this, _( "Text is VALUE!" ) );
break; break;

View File

@ -36,7 +36,7 @@ static int TextInitialOrientation; // module text initial orientation for
/* Add a new graphical text to the active module (footprint) /* Add a new graphical text to the active module (footprint)
* Note there always are 2 texts: reference and value. * Note there always are 2 texts: reference and value.
* New texts have the member TEXTE_MODULE.m_Type set to TEXT_is_DIVERS * New texts have the member TEXTE_MODULE.GetType() set to TEXT_is_DIVERS
*/ */
TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC ) TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC )
{ {
@ -118,7 +118,7 @@ void PCB_BASE_FRAME::DeleteTextModule( TEXTE_MODULE* Text )
Module = (MODULE*) Text->GetParent(); Module = (MODULE*) Text->GetParent();
if( Text->m_Type == TEXT_is_DIVERS ) if( Text->GetType() == TEXT_is_DIVERS )
{ {
DrawPanel->RefreshDrawingRect( Text->GetBoundingBox() ); DrawPanel->RefreshDrawingRect( Text->GetBoundingBox() );
Text->DeleteStructure(); Text->DeleteStructure();
@ -226,7 +226,7 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
Text->m_Pos = GetScreen()->GetCrossHairPosition(); Text->m_Pos = GetScreen()->GetCrossHairPosition();
wxPoint textRelPos = Text->m_Pos - Module->m_Pos; wxPoint textRelPos = Text->m_Pos - Module->m_Pos;
RotatePoint( &textRelPos, -Module->m_Orient ); RotatePoint( &textRelPos, -Module->m_Orient );
Text->m_Pos0 = textRelPos; Text->SetPos0( textRelPos );
Text->m_Flags = 0; Text->m_Flags = 0;
Module->m_Flags = 0; Module->m_Flags = 0;
Module->m_LastEdit_Time = time( NULL ); Module->m_LastEdit_Time = time( NULL );

View File

@ -602,8 +602,8 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
SILKSCREEN_N_BACK : SILKSCREEN_N_FRONT]; SILKSCREEN_N_BACK : SILKSCREEN_N_FRONT];
fprintf( aFile, "TEXT %g %g %g %g %s %s \"%s\"", fprintf( aFile, "TEXT %g %g %g %g %s %s \"%s\"",
textmod->m_Pos0.x / SCALE_FACTOR, textmod->GetPos0().x / SCALE_FACTOR,
-textmod->m_Pos0.y / SCALE_FACTOR, -textmod->GetPos0().y / SCALE_FACTOR,
textmod->m_Size.x / SCALE_FACTOR, textmod->m_Size.x / SCALE_FACTOR,
orient / 10.0, orient / 10.0,
mirror, mirror,

View File

@ -834,7 +834,7 @@ static void export_vrml_zones( BOARD* pcb )
static void export_vrml_text_module( TEXTE_MODULE* module ) /*{{{*/ static void export_vrml_text_module( TEXTE_MODULE* module ) /*{{{*/
{ {
if( !module->m_NoShow ) if( module->IsVisible() )
{ {
wxSize size = module->m_Size; wxSize size = module->m_Size;

View File

@ -165,7 +165,7 @@ int PCB_BASE_FRAME::ReadListeSegmentDescr( LINE_READER* aReader,
break; break;
} }
newTrack->m_TimeStamp = timeStamp; newTrack->SetTimeStamp( timeStamp );
newTrack->m_Start.x = tempStartX; newTrack->m_Start.x = tempStartX;
newTrack->m_Start.y = tempStartY; newTrack->m_Start.y = tempStartY;

View File

@ -1737,7 +1737,7 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
} }
else else
{ {
m_TimeStamp = ts; SetTimeStamp( ts );
SetNet( netcode ); SetNet( netcode );
ReadDelimitedText( netname_buffer, netname_buffer, 1024 ); ReadDelimitedText( netname_buffer, netname_buffer, 1024 );
m_Netname = FROM_UTF8( netname_buffer ); m_Netname = FROM_UTF8( netname_buffer );

View File

@ -90,7 +90,10 @@
#include <wx/ffile.h> #include <wx/ffile.h>
#define VERSION_ERROR_FORMAT _( "File '%s' is format version %d.\nI only support format version <= %d.\nPlease upgrade PCBNew to load this file." ) #define VERSION_ERROR_FORMAT _( "File '%s' is format version: %d.\nI only support format version <= %d.\nPlease upgrade PCBNew to load this file." )
#define UNKNOWN_GRAPHIC_FORMAT _( "unknown graphic type: %d")
#define UNKNOWN_PAD_FORMAT _( "unknown pad type: %d")
#define UNKNOWN_PAD_ATTRIBUTE _( "unknown pad attribute: %d" )
/* /*
#include <pcbnew.h> #include <pcbnew.h>
@ -389,7 +392,7 @@ void KICAD_PLUGIN::loadGENERAL()
else if( TESTLINE( "NoConn" ) ) else if( TESTLINE( "NoConn" ) )
{ {
int tmp = atoi( line + SZ( "NoConn" ) ); int tmp = intParse( line + SZ( "NoConn" ) );
m_board->m_NbNoconnect = tmp; m_board->m_NbNoconnect = tmp;
} }
@ -467,12 +470,12 @@ void KICAD_PLUGIN::loadSHEET()
text = strtok( NULL, delims ); text = strtok( NULL, delims );
if( text ) if( text )
sheet->m_Size.x = atoi( text ); sheet->m_Size.x = intParse( text );
text = strtok( NULL, delims ); text = strtok( NULL, delims );
if( text ) if( text )
sheet->m_Size.y = atoi( text ); sheet->m_Size.y = intParse( text );
} }
break; break;
@ -569,7 +572,7 @@ void KICAD_PLUGIN::loadSETUP()
else if( TESTLINE( "Layers" ) ) else if( TESTLINE( "Layers" ) )
{ {
int tmp = atoi( line + SZ( "Layers" ) ); int tmp = intParse( line + SZ( "Layers" ) );
m_board->SetCopperLayerCount( tmp ); m_board->SetCopperLayerCount( tmp );
} }
@ -694,7 +697,7 @@ void KICAD_PLUGIN::loadSETUP()
else if( TESTLINE( "MicroViasAllowed" ) ) else if( TESTLINE( "MicroViasAllowed" ) )
{ {
int tmp = atoi( line + SZ( "MicroViasAllowed" ) ); int tmp = intParse( line + SZ( "MicroViasAllowed" ) );
m_board->GetDesignSettings().m_MicroViasAllowed = tmp; m_board->GetDesignSettings().m_MicroViasAllowed = tmp;
} }
@ -946,20 +949,24 @@ void KICAD_PLUGIN::loadMODULE()
else if( TESTLINE( "At" ) ) // (At)tributes of module else if( TESTLINE( "At" ) ) // (At)tributes of module
{ {
int attrs = MOD_DEFAULT;
data = line + SZ( "At" ); data = line + SZ( "At" );
if( strstr( data, "SMD" ) ) if( strstr( data, "SMD" ) )
module->m_Attributs |= MOD_CMS; attrs |= MOD_CMS;
if( strstr( data, "VIRTUAL" ) ) if( strstr( data, "VIRTUAL" ) )
module->m_Attributs |= MOD_VIRTUAL; attrs |= MOD_VIRTUAL;
module->SetAttributes( attrs );
} }
else if( TESTLINE( "AR" ) ) // Alternate Reference else if( TESTLINE( "AR" ) ) // Alternate Reference
{ {
// e.g. "AR /47BA2624/45525076" // e.g. "AR /47BA2624/45525076"
data = strtok( line + SZ( "AR" ), delims ); data = strtok( line + SZ( "AR" ), delims );
module->m_Path = FROM_UTF8( data ); module->SetPath( FROM_UTF8( data ) );
} }
else if( TESTLINE( "$SHAPE3D" ) ) else if( TESTLINE( "$SHAPE3D" ) )
@ -978,6 +985,31 @@ void KICAD_PLUGIN::loadMODULE()
module->m_KeyWord = FROM_UTF8( StrPurge( line + SZ( "Kw" ) ) ); module->m_KeyWord = FROM_UTF8( StrPurge( line + SZ( "Kw" ) ) );
} }
// test this longer similar string before the shorter ".SolderPaste"
else if( TESTLINE( ".SolderPasteRatio" ) )
{
double tmp = atof( line + SZ( ".SolderPasteRatio" ) );
module->SetLocalSolderPasteMarginRatio( tmp );
}
else if( TESTLINE( ".SolderPaste" ) )
{
BIU tmp = biuParse( line + SZ( ".SolderPaste" ) );
module->SetLocalSolderPasteMargin( tmp );
}
else if( TESTLINE( ".SolderMask" ) )
{
BIU tmp = biuParse( line + SZ( ".SolderMask" ) );
module->SetLocalSolderMaskMargin( tmp );
}
else if( TESTLINE( ".LocalClearance" ) )
{
BIU tmp = biuParse( line + SZ( ".LocalClearance" ) );
module->SetLocalClearance( tmp );
}
else if( TESTLINE( "$EndMODULE" ) ) else if( TESTLINE( "$EndMODULE" ) )
{ {
module->CalculateBoundingBox(); module->CalculateBoundingBox();
@ -1135,25 +1167,26 @@ void KICAD_PLUGIN::loadPAD( MODULE* aModule )
else if( TESTLINE( ".SolderMask" ) ) else if( TESTLINE( ".SolderMask" ) )
{ {
BIU tmp = biuParse( line + SZ( ".SolderMask" ) ); BIU tmp = biuParse( line + SZ( ".SolderMask" ) );
pad->SetSolderMaskMargin( tmp ); pad->SetLocalSolderMaskMargin( tmp );
}
// test this before the similar but shorter ".SolderPaste"
else if( TESTLINE( ".SolderPasteRatio" ) )
{
double tmp = atof( line + SZ( ".SolderPasteRatio" ) );
pad->SetLocalSolderPasteMarginRatio( tmp );
} }
else if( TESTLINE( ".SolderPaste" ) ) else if( TESTLINE( ".SolderPaste" ) )
{ {
BIU tmp = biuParse( line + SZ( ".SolderPaste" ) ); BIU tmp = biuParse( line + SZ( ".SolderPaste" ) );
pad->SetSolderPasteMargin( tmp ); pad->SetLocalSolderPasteMargin( tmp );
}
else if( TESTLINE( ".SolderPasteRatio" ) )
{
double tmp = atof( line + SZ( ".SolderPasteRatio" ) );
pad->SetSolderPasteRatio( tmp );
} }
else if( TESTLINE( ".LocalClearance" ) ) else if( TESTLINE( ".LocalClearance" ) )
{ {
BIU tmp = biuParse( line + SZ( ".LocalClearance" ) ); BIU tmp = biuParse( line + SZ( ".LocalClearance" ) );
pad->SetPadClearance( tmp ); pad->SetLocalClearance( tmp );
} }
else if( TESTLINE( "$EndPAD" ) ) else if( TESTLINE( "$EndPAD" ) )
@ -1251,7 +1284,7 @@ void KICAD_PLUGIN::loadEDGE_MODULE( MODULE* aModule )
dwg->m_Start0 = wxPoint( start0_x, start0_y ); dwg->m_Start0 = wxPoint( start0_x, start0_y );
dwg->m_End0 = wxPoint( end0_x, end0_y ); dwg->m_End0 = wxPoint( end0_x, end0_y );
std::vector<wxPoint>& pts = dwg->GetPolyPoints(); std::vector<wxPoint> pts;
pts.reserve( ptCount ); pts.reserve( ptCount );
for( int ii = 0; ii<ptCount; ++ii ) for( int ii = 0; ii<ptCount; ++ii )
@ -1275,6 +1308,8 @@ void KICAD_PLUGIN::loadEDGE_MODULE( MODULE* aModule )
pts.push_back( wxPoint( x, y ) ); pts.push_back( wxPoint( x, y ) );
} }
dwg->SetPolyPoints( pts );
} }
break; break;
@ -1958,7 +1993,7 @@ void KICAD_PLUGIN::loadZONE_CONTAINER()
// e.g. "ZCorner 25650 49500 0" // e.g. "ZCorner 25650 49500 0"
BIU x = biuParse( line + SZ( "ZCorner" ), &data ); BIU x = biuParse( line + SZ( "ZCorner" ), &data );
BIU y = biuParse( data, &data ); BIU y = biuParse( data, &data );
int flag = atoi( data ); int flag = intParse( data );
if( !sawCorner ) if( !sawCorner )
zc->m_Poly->Start( zc->GetLayer(), x, y, outline_hatch ); zc->m_Poly->Start( zc->GetLayer(), x, y, outline_hatch );
@ -2399,26 +2434,52 @@ void KICAD_PLUGIN::loadPCB_TARGET()
} }
std::string KICAD_PLUGIN::biuFmt( BIU aValue ) int KICAD_PLUGIN::biuSprintf( char* buf, BIU aValue ) const
{ {
double engUnits = biuToDisk * aValue; double engUnits = biuToDisk * aValue;
char temp[48]; int len;
if( engUnits != 0.0 && fabs( engUnits ) <= 0.0001 ) if( engUnits != 0.0 && fabs( engUnits ) <= 0.0001 )
{ {
// printf( "f: " ); // printf( "f: " );
int len = sprintf( temp, "%.10f", engUnits ); len = sprintf( buf, "%.10f", engUnits );
while( --len > 0 && temp[len] == '0' ) while( --len > 0 && buf[len] == '0' )
temp[len] = '\0'; buf[len] = '\0';
++len;
} }
else else
{ {
// printf( "g: " ); // printf( "g: " );
sprintf( temp, "%.10g", engUnits ); len = sprintf( buf, "%.10g", engUnits );
} }
return len;
}
return temp;
std::string KICAD_PLUGIN::fmtBIU( BIU aValue ) const
{
char temp[50];
int len = biuSprintf( temp, aValue );
return std::string( temp, len );
}
std::string KICAD_PLUGIN::fmtBIUPair( BIU first, BIU second ) const
{
char temp[100];
char* cp = temp;
cp += biuSprintf( cp, first );
*cp++ = ' ';
cp += biuSprintf( cp, second );
return std::string( temp, cp - temp );
} }
@ -2538,15 +2599,19 @@ void KICAD_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* a
} }
void KICAD_PLUGIN::checkWriteError( const char* aCaller ) const wxString KICAD_PLUGIN::writeError() const
{ {
if( ferror( m_fp ) ) return wxString::Format( _( "error writing to file '%s'" ), m_filename.GetData() );
{
THROW_IO_ERROR( wxString::Format( _( "error writing to file '%s' from function %s" ),
m_filename.GetData(), FROM_UTF8( aCaller ).GetData() ) );
}
} }
#define CHECK_WRITE_ERROR() \
do { \
if( ferror( m_fp ) ) \
{ \
THROW_IO_ERROR( writeError() ); \
} \
} while(0)
void KICAD_PLUGIN::saveAllSections() const void KICAD_PLUGIN::saveAllSections() const
{ {
@ -2579,7 +2644,7 @@ void KICAD_PLUGIN::saveSETUP() const
void KICAD_PLUGIN::saveBOARD() const void KICAD_PLUGIN::saveBOARD() const
{ {
#if 0 #if 1
// save the nets // save the nets
int netcount = m_board->GetNetCount(); int netcount = m_board->GetNetCount();
for( int i = 0; i < netcount; ++i ) for( int i = 0; i < netcount; ++i )
@ -2610,7 +2675,7 @@ void KICAD_PLUGIN::saveBOARD() const
saveDIMENTION( (DIMENSION*) gr ); saveDIMENTION( (DIMENSION*) gr );
break; break;
default: default:
THROW_IO_ERROR( wxString::Format( _( "unknown graphic type %d"), gr->Type() ) ); THROW_IO_ERROR( wxString::Format( UNKNOWN_GRAPHIC_FORMAT, gr->Type() ) );
} }
} }
@ -2644,7 +2709,7 @@ void KICAD_PLUGIN::saveNETINFO_ITEM( const NETINFO_ITEM* aNet ) const
fprintf( m_fp, "St %s\n", "~" ); fprintf( m_fp, "St %s\n", "~" );
fprintf( m_fp, "$EndEQUIPOT\n" ); fprintf( m_fp, "$EndEQUIPOT\n" );
checkWriteError( __FUNCTION__ ); CHECK_WRITE_ERROR();
} }
@ -2660,38 +2725,358 @@ void KICAD_PLUGIN::saveNETCLASSES() const
for( NETCLASSES::const_iterator it = nc.begin(); it != nc.end(); ++it ) for( NETCLASSES::const_iterator it = nc.begin(); it != nc.end(); ++it )
{ {
NETCLASS* netclass = it->second; NETCLASS* netclass = it->second;
saveNETCLASS( netclass ); saveNETCLASS( netclass );
} }
checkWriteError( __FUNCTION__ ); CHECK_WRITE_ERROR();
} }
void KICAD_PLUGIN::saveNETCLASS( const NETCLASS* nc ) const void KICAD_PLUGIN::saveNETCLASS( const NETCLASS* nc ) const
{ {
fprintf( m_fp, "$NCLASS\n" ); fprintf( m_fp, "$NCLASS\n" );
fprintf( m_fp, "Name %s\n", EscapedUTF8( nc->GetName() ).c_str() ); fprintf( m_fp, "Name %s\n", EscapedUTF8( nc->GetName() ).c_str() );
fprintf( m_fp, "Desc %s\n", EscapedUTF8( nc->GetDescription() ).c_str() ); fprintf( m_fp, "Desc %s\n", EscapedUTF8( nc->GetDescription() ).c_str() );
// Write parameters fprintf( m_fp, "Clearance %d\n", nc->GetClearance() );
fprintf( m_fp, "TrackWidth %d\n", nc->GetTrackWidth() );
fprintf( m_fp, "Clearance %d\n", nc->GetClearance() ); fprintf( m_fp, "ViaDia %d\n", nc->GetViaDiameter() );
fprintf( m_fp, "TrackWidth %d\n", nc->GetTrackWidth() ); fprintf( m_fp, "ViaDrill %d\n", nc->GetViaDrill() );
fprintf( m_fp, "ViaDia %d\n", nc->GetViaDiameter() ); fprintf( m_fp, "uViaDia %d\n", nc->GetuViaDiameter() );
fprintf( m_fp, "ViaDrill %d\n", nc->GetViaDrill() ); fprintf( m_fp, "uViaDrill %d\n", nc->GetuViaDrill() );
fprintf( m_fp, "uViaDia %d\n", nc->GetuViaDiameter() );
fprintf( m_fp, "uViaDrill %d\n", nc->GetuViaDrill() );
// Write members:
for( NETCLASS::const_iterator it = nc->begin(); it!=nc->end(); ++it ) for( NETCLASS::const_iterator it = nc->begin(); it!=nc->end(); ++it )
fprintf( m_fp, "AddNet %s\n", EscapedUTF8( *it ).c_str() ); fprintf( m_fp, "AddNet %s\n", EscapedUTF8( *it ).c_str() );
fprintf( m_fp, "$EndNCLASS\n" ); fprintf( m_fp, "$EndNCLASS\n" );
checkWriteError( __FUNCTION__ ); CHECK_WRITE_ERROR();
}
void KICAD_PLUGIN::saveMODULE_TEXT( const TEXTE_MODULE* me ) const
{
MODULE* parent = (MODULE*) me->GetParent();
double orient = me->GetOrientation();
// Due to the Pcbnew history, m_Orient is saved in screen value
// but it is handled as relative to its parent footprint
if( parent )
orient += parent->GetOrientation();
fprintf( m_fp, "T%d %s %s %g %s %c %c %d %c %s\n",
me->GetType(),
fmtBIUPoint( me->GetPos0() ).c_str(), // m_Pos0.x, m_Pos0.y,
fmtBIUSize( me->GetSize() ).c_str(), // m_Size.y, m_Size.x,
orient,
fmtBIU( me->GetThickness() ).c_str(), // m_Thickness,
me->IsMirrored() ? 'M' : 'N',
me->IsVisible() ? 'V' : 'I',
me->GetLayer(),
me->IsItalic() ? 'I' : 'N',
EscapedUTF8( me->GetText() ).c_str()
);
CHECK_WRITE_ERROR();
}
void KICAD_PLUGIN::saveMODULE_EDGE( const EDGE_MODULE* me ) const
{
switch( me->GetShape() )
{
case S_SEGMENT:
fprintf( m_fp, "DS %s %s %s %d\n",
fmtBIUPoint( me->m_Start0 ).c_str(),
fmtBIUPoint( me->m_End0 ).c_str(),
fmtBIU( me->GetWidth() ).c_str(),
me->GetLayer() );
break;
case S_CIRCLE:
fprintf( m_fp, "DC %s %s %s %d\n",
fmtBIUPoint( me->m_Start0 ).c_str(),
fmtBIUPoint( me->m_End0 ).c_str(),
fmtBIU( me->GetWidth() ).c_str(),
me->GetLayer() );
break;
case S_ARC:
{
double angle = me->GetAngle();
fprintf( m_fp, "DA %s %s %g %s %d\n",
fmtBIUPoint( me->m_Start0 ).c_str(),
fmtBIUPoint( me->m_End0 ).c_str(),
angle,
fmtBIU( me->GetWidth() ).c_str(),
me->GetLayer() );
}
break;
case S_POLYGON:
{
const std::vector<wxPoint>& polyPoints = me->GetPolyPoints();
fprintf( m_fp, "DP %s %s %d %s %d\n",
fmtBIUPoint( me->m_Start0 ).c_str(),
fmtBIUPoint( me->m_End0 ).c_str(),
(int) polyPoints.size(),
fmtBIU( me->GetWidth() ).c_str(),
me->GetLayer() );
for( unsigned i = 0; i<polyPoints.size(); ++i )
fprintf( m_fp, "Dl %s\n", fmtBIUPoint( polyPoints[i] ).c_str() );
}
break;
default:
THROW_IO_ERROR( wxString::Format( UNKNOWN_GRAPHIC_FORMAT, me->GetShape() ) );
}
CHECK_WRITE_ERROR();
}
void KICAD_PLUGIN::savePAD( const D_PAD* me ) const
{
fprintf( m_fp, "$PAD\n" );
int cshape;
switch( me->GetShape() )
{
case PAD_CIRCLE: cshape = 'C'; break;
case PAD_RECT: cshape = 'R'; break;
case PAD_OVAL: cshape = 'O'; break;
case PAD_TRAPEZOID: cshape = 'T'; break;
default:
THROW_IO_ERROR( wxString::Format( UNKNOWN_PAD_FORMAT, me->GetShape() ) );
}
fprintf( m_fp, "Sh %s %c %s %s %g\n",
EscapedUTF8( me->GetPadName() ).c_str(),
cshape,
fmtBIUSize( me->GetSize() ).c_str(),
fmtBIUSize( me->GetDelta() ).c_str(),
me->GetOrientation() );
fprintf( m_fp, "Dr %s %s",
fmtBIU( me->GetDrillSize().x ).c_str(),
fmtBIUSize( me->GetOffset() ).c_str()
);
if( me->GetDrillShape() == PAD_OVAL )
{
fprintf( m_fp, " %c %s", 'O', fmtBIUSize( me->GetDrillSize() ).c_str() );
}
fprintf( m_fp, "\n" );
const char* texttype;
switch( me->GetAttribute() )
{
case PAD_STANDARD: texttype = "STD"; break;
case PAD_SMD: texttype = "SMD"; break;
case PAD_CONN: texttype = "CONN"; break;
case PAD_HOLE_NOT_PLATED: texttype = "HOLE"; break;
default:
THROW_IO_ERROR( wxString::Format( UNKNOWN_PAD_ATTRIBUTE, me->GetAttribute() ) );
}
fprintf( m_fp, "At %s N %8.8X\n", texttype, me->GetLayerMask() );
fprintf( m_fp, "Ne %d %s\n", me->GetNet(), EscapedUTF8( me->GetNetname() ).c_str() );
fprintf( m_fp, "Po %s\n", fmtBIUPoint( me->GetPos0() ).c_str() );
if( me->GetDieLength() != 0 )
fprintf( m_fp, "Le %s\n", fmtBIU( me->GetDieLength() ).c_str() );
if( me->GetLocalSolderMaskMargin() != 0 )
fprintf( m_fp, ".SolderMask %s\n", fmtBIU( me->GetLocalSolderMaskMargin() ).c_str() );
if( me->GetLocalSolderPasteMargin() != 0 )
fprintf( m_fp, ".SolderPaste %s\n", fmtBIU( me->GetLocalSolderPasteMargin() ).c_str() );
if( me->GetLocalSolderPasteMarginRatio() != 0 )
fprintf( m_fp, ".SolderPasteRatio %g\n", me->GetLocalSolderPasteMarginRatio() );
if( me->GetLocalClearance() != 0 )
fprintf( m_fp, ".LocalClearance %s\n", fmtBIU( me->GetLocalClearance( ) ).c_str() );
fprintf( m_fp, "$EndPAD\n" );
CHECK_WRITE_ERROR();
}
void KICAD_PLUGIN::saveMODULE( const MODULE* me ) const
{
char statusTxt[3];
double orient = me->GetOrientation();
fprintf( m_fp, "$MODULE %s\n", TO_UTF8( me->GetLibRef() ) );
if( me->IsLocked() )
statusTxt[0] = 'F';
else
statusTxt[0] = '~';
if( me->IsPlaced() )
statusTxt[1] = 'P';
else
statusTxt[1] = '~';
statusTxt[2] = '\0';
fprintf( m_fp, "Po %s %g %d %8.8lX %8.8lX %s\n",
fmtBIUPoint( me->GetPosition() ).c_str(), // m_Pos.x, m_Pos.y,
orient,
me->GetLayer(),
me->GetLastEditTime(),
me->GetTimeStamp(),
statusTxt );
fprintf( m_fp, "Li %s\n", TO_UTF8( me->GetLibRef() ) );
if( !me->GetDescription().IsEmpty() )
{
fprintf( m_fp, "Cd %s\n", TO_UTF8( me->GetDescription() ) );
}
if( !me->GetKeywords().IsEmpty() )
{
fprintf( m_fp, "Kw %s\n", TO_UTF8( me->GetKeywords() ) );
}
fprintf( m_fp, "Sc %8.8lX\n", me->GetTimeStamp() );
fprintf( m_fp, "AR %s\n", TO_UTF8( me->GetPath() ) );
fprintf( m_fp, "Op %X %X 0\n", me->m_CntRot90, me->m_CntRot180 );
if( me->GetLocalSolderMaskMargin() != 0 )
fprintf( m_fp, ".SolderMask %s\n", fmtBIU( me->GetLocalSolderMaskMargin() ).c_str() );
if( me->GetLocalSolderPasteMargin() != 0 )
fprintf( m_fp, ".SolderPaste %s\n", fmtBIU( me->GetLocalSolderPasteMargin() ).c_str() );
if( me->GetLocalSolderPasteMarginRatio() != 0 )
fprintf( m_fp, ".SolderPasteRatio %g\n", me->GetLocalSolderPasteMarginRatio() );
if( me->GetLocalClearance() != 0 )
fprintf( m_fp, ".LocalClearance %s\n", fmtBIU( me->GetLocalClearance( ) ).c_str() );
// attributes
if( me->GetAttributes() != MOD_DEFAULT )
{
fprintf( m_fp, "At" );
if( me->GetAttributes() & MOD_CMS )
fprintf( m_fp, " SMD" );
if( me->GetAttributes() & MOD_VIRTUAL )
fprintf( m_fp, " VIRTUAL" );
fprintf( m_fp, "\n" );
}
saveMODULE_TEXT( (TEXTE_MODULE*) &me->m_Reference );
saveMODULE_TEXT( (TEXTE_MODULE*) &me->m_Value );
// save drawing elements
for( BOARD_ITEM* item = me->m_Drawings; item; item = item->Next() )
{
switch( item->Type() )
{
case PCB_MODULE_TEXT_T:
saveMODULE_TEXT( (TEXTE_MODULE*) item );
break;
case PCB_MODULE_EDGE_T:
saveMODULE_EDGE( (EDGE_MODULE*) item );
break;
default:
THROW_IO_ERROR( wxString::Format( UNKNOWN_GRAPHIC_FORMAT, item->Type() ) );
}
}
for( D_PAD* pad = me->m_Pads; pad; pad = pad->Next() )
savePAD( pad );
save3D( me );
fprintf( m_fp, "$EndMODULE %s\n", TO_UTF8( me->GetLibRef() ) );
}
void KICAD_PLUGIN::save3D( const MODULE* me ) const
{
for( S3D_MASTER* t3D = me->m_3D_Drawings; t3D; t3D = t3D->Next() )
{
if( !t3D->m_Shape3DName.IsEmpty() )
{
fprintf( m_fp, "$SHAPE3D\n" );
fprintf( m_fp, "Na %s\n", EscapedUTF8( t3D->m_Shape3DName ).c_str() );
fprintf( m_fp, "Sc %.16g %.16g %.16g\n",
t3D->m_MatScale.x,
t3D->m_MatScale.y,
t3D->m_MatScale.z );
fprintf( m_fp, "Of %.16g %.16g %.16g\n",
t3D->m_MatPosition.x,
t3D->m_MatPosition.y,
t3D->m_MatPosition.z );
fprintf( m_fp, "Ro %.16g %.16g %.16g\n",
t3D->m_MatRotation.x,
t3D->m_MatRotation.y,
t3D->m_MatRotation.z );
fprintf( m_fp, "$EndSHAPE3D\n" );
}
}
}
void KICAD_PLUGIN::saveTARGET(PCB_TARGET const*) const
{
}
void KICAD_PLUGIN::saveTRACK(TRACK const*) const
{
}
void KICAD_PLUGIN::saveSEGZONE(SEGZONE const*) const
{
}
void KICAD_PLUGIN::saveZONE_CONTAINER(ZONE_CONTAINER const*) const
{
}
void KICAD_PLUGIN::saveDIMENTION(DIMENSION const*) const
{
}
void KICAD_PLUGIN::savePCB_TEXT(TEXTE_PCB const*) const
{
}
void KICAD_PLUGIN::saveEDGE_MODULE(EDGE_MODULE const*) const
{
} }
@ -2954,91 +3339,6 @@ bool TEXTE_PCB::Save( FILE* m_fp ) const
} }
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param m_fp The FILE to write to.
* @return bool - true if success writing else false.
*/
bool TEXTE_MODULE::Save( FILE* m_fp ) const
{
MODULE* parent = (MODULE*) GetParent();
int orient = m_Orient;
// Due to the Pcbnew history, m_Orient is saved in screen value
// but it is handled as relative to its parent footprint
if( parent )
orient += parent->m_Orient;
int ret = fprintf( m_fp, "T%d %d %d %d %d %d %d %c %c %d %c %s\n",
m_Type,
m_Pos0.x, m_Pos0.y,
m_Size.y, m_Size.x,
orient,
m_Thickness,
m_Mirror ? 'M' : 'N', m_NoShow ? 'I' : 'V',
GetLayer(),
m_Italic ? 'I' : 'N',
EscapedUTF8( m_Text ).c_str()
);
return ret > 20;
}
bool EDGE_MODULE::Save( FILE* m_fp ) const
{
int ret = -1;
switch( m_Shape )
{
case S_SEGMENT:
ret = fprintf( m_fp, "DS %d %d %d %d %d %d\n",
m_Start0.x, m_Start0.y,
m_End0.x, m_End0.y,
m_Width, m_Layer );
break;
case S_CIRCLE:
ret = fprintf( m_fp, "DC %d %d %d %d %d %d\n",
m_Start0.x, m_Start0.y,
m_End0.x, m_End0.y,
m_Width, m_Layer );
break;
case S_ARC:
ret = fprintf( m_fp, "DA %d %d %d %d %d %d %d\n",
m_Start0.x, m_Start0.y,
m_End0.x, m_End0.y,
m_Angle,
m_Width, m_Layer );
break;
case S_POLYGON:
ret = fprintf( m_fp, "DP %d %d %d %d %d %d %d\n",
m_Start0.x, m_Start0.y,
m_End0.x, m_End0.y,
(int) m_PolyPoints.size(),
m_Width, m_Layer );
for( unsigned i = 0; i<m_PolyPoints.size(); ++i )
fprintf( m_fp, "Dl %d %d\n", m_PolyPoints[i].x, m_PolyPoints[i].y );
break;
default:
// future: throw an exception here
#if defined(DEBUG)
printf( "EDGE_MODULE::Save(): unexpected m_Shape: %d\n", m_Shape );
#endif
break;
}
return ret > 5;
}
bool TRACK::Save( FILE* m_fp ) const bool TRACK::Save( FILE* m_fp ) const
{ {
int type = 0; int type = 0;
@ -3122,244 +3422,4 @@ out:
return rc; return rc;
} }
bool D_PAD::Save( FILE* m_fp ) const
{
int cshape;
const char* texttype;
// check the return values for first and last fprints() in this function
if( fprintf( m_fp, "$PAD\n" ) != sizeof("$PAD\n") - 1 )
return false;
switch( m_PadShape )
{
case PAD_CIRCLE:
cshape = 'C'; break;
case PAD_RECT:
cshape = 'R'; break;
case PAD_OVAL:
cshape = 'O'; break;
case PAD_TRAPEZOID:
cshape = 'T'; break;
default:
cshape = 'C';
DisplayError( NULL, _( "Unknown pad shape" ) );
break;
}
fprintf( m_fp, "Sh \"%.4s\" %c %d %d %d %d %d\n",
m_Padname, cshape, m_Size.x, m_Size.y,
m_DeltaSize.x, m_DeltaSize.y, m_Orient );
fprintf( m_fp, "Dr %d %d %d", m_Drill.x, m_Offset.x, m_Offset.y );
if( m_DrillShape == PAD_OVAL )
{
fprintf( m_fp, " %c %d %d", 'O', m_Drill.x, m_Drill.y );
}
fprintf( m_fp, "\n" );
switch( m_Attribut )
{
case PAD_STANDARD:
texttype = "STD"; break;
case PAD_SMD:
texttype = "SMD"; break;
case PAD_CONN:
texttype = "CONN"; break;
case PAD_HOLE_NOT_PLATED:
texttype = "HOLE"; break;
default:
texttype = "STD";
DisplayError( NULL, wxT( "Invalid Pad attribute" ) );
break;
}
fprintf( m_fp, "At %s N %8.8X\n", texttype, m_layerMask );
fprintf( m_fp, "Ne %d %s\n", GetNet(), EscapedUTF8( m_Netname ).c_str() );
fprintf( m_fp, "Po %d %d\n", m_Pos0.x, m_Pos0.y );
if( m_LengthDie != 0 )
fprintf( m_fp, "Le %d\n", m_LengthDie );
if( m_LocalSolderMaskMargin != 0 )
fprintf( m_fp, ".SolderMask %d\n", m_LocalSolderMaskMargin );
if( m_LocalSolderPasteMargin != 0 )
fprintf( m_fp, ".SolderPaste %d\n", m_LocalSolderPasteMargin );
if( m_LocalSolderPasteMarginRatio != 0 )
fprintf( m_fp, ".SolderPasteRatio %g\n", m_LocalSolderPasteMarginRatio );
if( m_LocalClearance != 0 )
fprintf( m_fp, ".LocalClearance %d\n", m_LocalClearance );
if( fprintf( m_fp, "$EndPAD\n" ) != sizeof("$EndPAD\n") - 1 )
return false;
return true;
}
bool MODULE::Save( FILE* m_fp ) const
{
char statusTxt[8];
BOARD_ITEM* item;
bool rc = false;
fprintf( m_fp, "$MODULE %s\n", TO_UTF8( m_LibRef ) );
memset( statusTxt, 0, sizeof(statusTxt) );
if( IsLocked() )
statusTxt[0] = 'F';
else
statusTxt[0] = '~';
if( m_ModuleStatus & MODULE_is_PLACED )
statusTxt[1] = 'P';
else
statusTxt[1] = '~';
fprintf( m_fp, "Po %d %d %d %d %8.8lX %8.8lX %s\n",
m_Pos.x, m_Pos.y,
m_Orient, m_Layer, m_LastEdit_Time,
m_TimeStamp, statusTxt );
fprintf( m_fp, "Li %s\n", TO_UTF8( m_LibRef ) );
if( !m_Doc.IsEmpty() )
{
fprintf( m_fp, "Cd %s\n", TO_UTF8( m_Doc ) );
}
if( !m_KeyWord.IsEmpty() )
{
fprintf( m_fp, "Kw %s\n", TO_UTF8( m_KeyWord ) );
}
fprintf( m_fp, "Sc %8.8lX\n", m_TimeStamp );
fprintf( m_fp, "AR %s\n", TO_UTF8( m_Path ) );
fprintf( m_fp, "Op %X %X 0\n", m_CntRot90, m_CntRot180 );
if( m_LocalSolderMaskMargin != 0 )
fprintf( m_fp, ".SolderMask %d\n", m_LocalSolderMaskMargin );
if( m_LocalSolderPasteMargin != 0 )
fprintf( m_fp, ".SolderPaste %d\n", m_LocalSolderPasteMargin );
if( m_LocalSolderPasteMarginRatio != 0 )
fprintf( m_fp, ".SolderPasteRatio %g\n", m_LocalSolderPasteMarginRatio );
if( m_LocalClearance != 0 )
fprintf( m_fp, ".LocalClearance %d\n", m_LocalClearance );
// attributes
if( m_Attributs != MOD_DEFAULT )
{
fprintf( m_fp, "At " );
if( m_Attributs & MOD_CMS )
fprintf( m_fp, "SMD " );
if( m_Attributs & MOD_VIRTUAL )
fprintf( m_fp, "VIRTUAL " );
fprintf( m_fp, "\n" );
}
// save reference
if( !m_Reference->Save( m_fp ) )
goto out;
// save value
if( !m_Value->Save( m_fp ) )
goto out;
// save drawing elements
for( item = m_Drawings; item; item = item->Next() )
{
switch( item->Type() )
{
case PCB_MODULE_TEXT_T:
case PCB_MODULE_EDGE_T:
if( !item->Save( m_fp ) )
goto out;
break;
default:
#if defined(DEBUG)
printf( "MODULE::Save() ignoring type %d\n", item->Type() );
#endif #endif
break;
}
}
// save the pads
for( item = m_Pads; item; item = item->Next() )
if( !item->Save( m_fp ) )
goto out;
Write_3D_Descr( m_fp );
fprintf( m_fp, "$EndMODULE %s\n", TO_UTF8( m_LibRef ) );
rc = true;
out:
return rc;
}
/* Save the description of 3D MODULE
*/
int MODULE::Write_3D_Descr( FILE* File ) const
{
char buf[512];
for( S3D_MASTER* t3D = m_3D_Drawings; t3D; t3D = t3D->Next() )
{
if( !t3D->m_Shape3DName.IsEmpty() )
{
fprintf( File, "$SHAPE3D\n" );
fprintf( File, "Na %s\n", EscapedUTF8( t3D->m_Shape3DName ).c_str() );
sprintf( buf, "Sc %lf %lf %lf\n",
t3D->m_MatScale.x,
t3D->m_MatScale.y,
t3D->m_MatScale.z );
fprintf( File, "%s", to_point( buf ) );
sprintf( buf, "Of %lf %lf %lf\n",
t3D->m_MatPosition.x,
t3D->m_MatPosition.y,
t3D->m_MatPosition.z );
fprintf( File, "%s", to_point( buf ) );
sprintf( buf, "Ro %lf %lf %lf\n",
t3D->m_MatRotation.x,
t3D->m_MatRotation.y,
t3D->m_MatRotation.z );
fprintf( File, "%s", to_point( buf ) );
fprintf( File, "$EndSHAPE3D\n" );
}
}
return 0;
}
#endif

View File

@ -43,7 +43,7 @@ class TEXTE_MODULE;
class EDGE_MODULE; class EDGE_MODULE;
class TRACK; class TRACK;
class SEGZONE; class SEGZONE;
class D_PAD;
/** /**
* Class KICAD_PLUGIN * Class KICAD_PLUGIN
@ -164,21 +164,43 @@ protected:
//-----<save functions>----------------------------------------------------- //-----<save functions>-----------------------------------------------------
/** /**
* Function checkWriteError * Function writeError
* checks to see if there is an error on the output FILE, and its ability to * returns an error message wxString containing the filename being
* continue saving to disk. * currently written.
*/ */
void checkWriteError( const char* aCaller ) const; wxString writeError() const;
int biuSprintf( char* buf, BIU aValue ) const;
/// convert a BIU to engineering units by scaling and formatting to ASCII. /// convert a BIU to engineering units by scaling and formatting to ASCII.
std::string biuFmt( BIU aValue ); std::string fmtBIU( BIU aValue ) const;
std::string fmtBIUPair( BIU first, BIU second ) const;
std::string fmtBIUPoint( const wxPoint& aPoint ) const
{
return fmtBIUPair( aPoint.x, aPoint.y );
}
std::string fmtBIUSize( const wxSize& aSize ) const
{
// unfortunately there is inconsistency in the order of saving wxSize,
// so sometimes we use fmtBIUPair() directly in the saveXXX() functions.
return fmtBIUPair( aSize.x, aSize.y );
}
void saveAllSections() const; void saveAllSections() const;
void saveGENERAL() const; void saveGENERAL() const;
void saveSHEET() const; void saveSHEET() const;
void saveSETUP() const; void saveSETUP() const;
void saveBOARD() const; void saveBOARD() const;
void saveMODULE( const MODULE* aModule ) const; void saveMODULE( const MODULE* aModule ) const;
void saveMODULE_TEXT( const TEXTE_MODULE* aText ) const;
void saveMODULE_EDGE( const EDGE_MODULE* aGraphic ) const;
void savePAD( const D_PAD* aPad ) const;
void save3D( const MODULE* aModule ) const;
void saveNETINFO_ITEM( const NETINFO_ITEM* aNet ) const; void saveNETINFO_ITEM( const NETINFO_ITEM* aNet ) const;
void saveNETCLASSES() const; void saveNETCLASSES() const;
void saveNETCLASS( const NETCLASS* aNetclass ) const; void saveNETCLASS( const NETCLASS* aNetclass ) const;

View File

@ -604,9 +604,9 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibName,
} }
/* Write the new footprint ( append it to the list of footprint ) */ /* Write the new footprint ( append it to the list of footprint ) */
tmp = aModule->m_TimeStamp; aModule->m_TimeStamp = 0; tmp = aModule->GetTimeStamp(); aModule->SetTimeStamp( 0 );
aModule->Save( dest ); aModule->Save( dest );
aModule->m_TimeStamp = tmp; aModule->SetTimeStamp( tmp );
output_lib.WriteEndOfFile(); output_lib.WriteEndOfFile();

View File

@ -78,7 +78,7 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
GetBoard()->m_Status_Pcb = 0; GetBoard()->m_Status_Pcb = 0;
newModule = new MODULE( GetBoard() ); newModule = new MODULE( GetBoard() );
newModule->Copy( aModule ); newModule->Copy( aModule );
newModule->m_Link = aModule->m_TimeStamp; newModule->m_Link = aModule->GetTimeStamp();
aModule = newModule; aModule = newModule;
@ -185,7 +185,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC*
module->m_Flags = IS_NEW; module->m_Flags = IS_NEW;
module->m_Link = 0; module->m_Link = 0;
module->m_TimeStamp = GetNewTimeStamp(); module->SetTimeStamp( GetNewTimeStamp() );
GetBoard()->m_Status_Pcb = 0; GetBoard()->m_Status_Pcb = 0;
module->SetPosition( curspos ); module->SetPosition( curspos );

View File

@ -284,7 +284,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
for( ; source_module != NULL; source_module = (MODULE*) source_module->Next() ) for( ; source_module != NULL; source_module = (MODULE*) source_module->Next() )
{ {
if( module_in_edit->m_Link == source_module->m_TimeStamp ) if( module_in_edit->m_Link == source_module->GetTimeStamp() )
break; break;
} }
} }
@ -325,7 +325,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
// and the source_module (old module) is deleted // and the source_module (old module) is deleted
PICKED_ITEMS_LIST pickList; PICKED_ITEMS_LIST pickList;
pcbframe->Exchange_Module( source_module, newmodule, &pickList ); pcbframe->Exchange_Module( source_module, newmodule, &pickList );
newmodule->m_TimeStamp = module_in_edit->m_Link; newmodule->SetTimeStamp( module_in_edit->m_Link );
if( pickList.GetCount() ) if( pickList.GetCount() )
pcbframe->SaveCopyInUndoList( pickList, UR_UNSPECIFIED ); pcbframe->SaveCopyInUndoList( pickList, UR_UNSPECIFIED );
@ -336,7 +336,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
pcbframe->GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) ); pcbframe->GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
pcbframe->PlaceModule( newmodule, NULL ); pcbframe->PlaceModule( newmodule, NULL );
pcbframe->GetScreen()->SetCrossHairPosition( cursor_pos ); pcbframe->GetScreen()->SetCrossHairPosition( cursor_pos );
newmodule->m_TimeStamp = GetNewTimeStamp(); newmodule->SetTimeStamp( GetNewTimeStamp() );
pcbframe->SaveCopyInUndoList( newmodule, UR_NEW ); pcbframe->SaveCopyInUndoList( newmodule, UR_NEW );
} }
@ -413,12 +413,12 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( val && ref ) if( val && ref )
{ {
ref->m_Type = TEXT_is_REFERENCE; // just in case ... ref->SetType( TEXT_is_REFERENCE ); // just in case ...
if( ref->m_Text.Length() == 0 ) if( ref->m_Text.Length() == 0 )
ref->m_Text = L"Ref**"; ref->m_Text = L"Ref**";
val->m_Type = TEXT_is_VALUE; // just in case ... val->SetType( TEXT_is_VALUE ); // just in case ...
if( val->m_Text.Length() == 0 ) if( val->m_Text.Length() == 0 )
val->m_Text = L"Val**"; val->m_Text = L"Val**";
@ -708,20 +708,20 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
for( ; pad != NULL; pad = (D_PAD*) pad->Next() ) for( ; pad != NULL; pad = (D_PAD*) pad->Next() )
{ {
pad->m_Pos0 = pad->m_Pos; pad->SetPos0( pad->m_Pos );
pad->m_Orient -= angle; pad->m_Orient -= angle;
RotatePoint( &pad->m_Offset.x, &pad->m_Offset.y, angle ); RotatePoint( &pad->m_Offset.x, &pad->m_Offset.y, angle );
EXCHG( pad->m_Size.x, pad->m_Size.y ); EXCHG( pad->m_Size.x, pad->m_Size.y );
RotatePoint( &pad->m_DeltaSize.x, &pad->m_DeltaSize.y, -angle ); RotatePoint( &pad->m_DeltaSize.x, &pad->m_DeltaSize.y, -angle );
} }
module->m_Reference->m_Pos0 = module->m_Reference->m_Pos; module->m_Reference->SetPos0( module->m_Reference->m_Pos );
module->m_Reference->m_Orient += angle; module->m_Reference->m_Orient += angle;
if( module->m_Reference->m_Orient >= 1800 ) if( module->m_Reference->m_Orient >= 1800 )
module->m_Reference->m_Orient -= 1800; module->m_Reference->m_Orient -= 1800;
module->m_Value->m_Pos0 = module->m_Value->m_Pos; module->m_Value->SetPos0( module->m_Value->m_Pos );
module->m_Value->m_Orient += angle; module->m_Value->m_Orient += angle;
if( module->m_Value->m_Orient >= 1800 ) if( module->m_Value->m_Orient >= 1800 )
@ -739,7 +739,7 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
if( PtStruct->Type() == PCB_MODULE_TEXT_T ) if( PtStruct->Type() == PCB_MODULE_TEXT_T )
{ {
textmod = (TEXTE_MODULE*) PtStruct; textmod = (TEXTE_MODULE*) PtStruct;
textmod->m_Pos0 = textmod->m_Pos; textmod->SetPos0( textmod->m_Pos );
} }
} }
@ -747,7 +747,7 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
break; break;
case ID_MODEDIT_MODULE_MIRROR: case ID_MODEDIT_MODULE_MIRROR:
for( ; pad != NULL; pad = (D_PAD*) pad->Next() ) for( ; pad; pad = pad->Next() )
{ {
NEGATE( pad->m_Pos.y ); NEGATE( pad->m_Pos.y );
NEGATE( pad->m_Pos0.y ); NEGATE( pad->m_Pos0.y );

View File

@ -307,7 +307,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
HK_EDIT_ITEM ); HK_EDIT_ITEM );
AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE, msg, KiBitmap( edit_text_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE, msg, KiBitmap( edit_text_xpm ) );
if( ( (TEXTE_MODULE*) item )->m_Type == TEXT_is_DIVERS ) if( ( (TEXTE_MODULE*) item )->GetType() == TEXT_is_DIVERS )
{ {
msg = AddHotkeyName( _("Delete Text Mod." ), g_Module_Editor_Hokeys_Descr, msg = AddHotkeyName( _("Delete Text Mod." ), g_Module_Editor_Hokeys_Descr,
HK_DELETE ); HK_DELETE );

View File

@ -300,7 +300,7 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard( wxUpdateUIEvent& aEvent
// search if the source module was not deleted: // search if the source module was not deleted:
for( ; source_module != NULL; source_module = source_module->Next() ) for( ; source_module != NULL; source_module = source_module->Next() )
{ {
if( module_in_edit->m_Link == source_module->m_TimeStamp ) if( module_in_edit->m_Link == source_module->GetTimeStamp() )
break; break;
} }
@ -326,7 +326,7 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard( wxUpdateUIEvent& aEvent
// search if the source module was not deleted: // search if the source module was not deleted:
for( ; source_module != NULL; source_module = source_module->Next() ) for( ; source_module != NULL; source_module = source_module->Next() )
{ {
if( module_in_edit->m_Link == source_module->m_TimeStamp ) if( module_in_edit->m_Link == source_module->GetTimeStamp() )
break; break;
} }

View File

@ -187,7 +187,7 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
void PCB_BASE_FRAME::AddPad( MODULE* Module, bool draw ) void PCB_BASE_FRAME::AddPad( MODULE* Module, bool draw )
{ {
wxString lastPadName; // Last used pad name (pad num) wxString lastPadName; // Last used pad name (pad num)
lastPadName = g_Pad_Master.ReturnStringPadName(); lastPadName = g_Pad_Master.GetPadName();
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
Module->m_LastEdit_Time = time( NULL ); Module->m_LastEdit_Time = time( NULL );

View File

@ -287,8 +287,8 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
Module->m_Reference->m_Pos.y -= Module->m_Reference->m_Size.y; Module->m_Reference->m_Pos.y -= Module->m_Reference->m_Size.y;
Module->m_Value->m_Pos.y += Module->m_Value->m_Size.y; Module->m_Value->m_Pos.y += Module->m_Value->m_Size.y;
Module->m_Reference->m_Pos0 = Module->m_Reference->m_Pos - Module->m_Pos; Module->m_Reference->SetPos0( Module->m_Reference->m_Pos - Module->m_Pos );
Module->m_Value->m_Pos0 = Module->m_Value->m_Pos - Module->m_Pos; Module->m_Value->SetPos0( Module->m_Value->m_Pos - Module->m_Pos );
Module->CalculateBoundingBox(); Module->CalculateBoundingBox();
Module->Draw( DrawPanel, DC, GR_OR ); Module->Draw( DrawPanel, DC, GR_OR );
@ -532,14 +532,22 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_c
return NULL; return NULL;
#define DEFAULT_SIZE 30 #define DEFAULT_SIZE 30
Module->m_TimeStamp = GetNewTimeStamp(); Module->SetTimeStamp( GetNewTimeStamp() );
Module->m_Value->m_Size = wxSize( DEFAULT_SIZE, DEFAULT_SIZE ); Module->m_Value->m_Size = wxSize( DEFAULT_SIZE, DEFAULT_SIZE );
Module->m_Value->m_Pos0.y = -DEFAULT_SIZE;
Module->m_Value->m_Pos.y += Module->m_Value->m_Pos0.y; Module->m_Value->SetPos0( wxPoint( 0, -DEFAULT_SIZE ) );
Module->m_Value->m_Thickness = DEFAULT_SIZE / 4;
Module->m_Value->m_Pos.y += Module->m_Value->GetPos0().y;
Module->m_Value->m_Thickness = DEFAULT_SIZE / 4;
Module->m_Reference->m_Size = wxSize( DEFAULT_SIZE, DEFAULT_SIZE ); Module->m_Reference->m_Size = wxSize( DEFAULT_SIZE, DEFAULT_SIZE );
Module->m_Reference->m_Pos0.y = DEFAULT_SIZE;
Module->m_Reference->m_Pos.y += Module->m_Reference->m_Pos0.y; Module->m_Reference->SetPos0( wxPoint( 0, DEFAULT_SIZE ) );
Module->m_Reference->m_Pos.y += Module->m_Reference->GetPos0().y;
Module->m_Reference->m_Thickness = DEFAULT_SIZE / 4; Module->m_Reference->m_Thickness = DEFAULT_SIZE / 4;
/* Create 2 pads used in gaps and stubs. /* Create 2 pads used in gaps and stubs.

View File

@ -1160,7 +1160,7 @@ bool NETLIST_READER::loadNewModules()
/* Update schematic links : reference "Time Stamp" and schematic /* Update schematic links : reference "Time Stamp" and schematic
* hierarchical path */ * hierarchical path */
Module->m_Reference->m_Text = cmp->m_CmpName; Module->m_Reference->m_Text = cmp->m_CmpName;
Module->m_TimeStamp = GetNewTimeStamp(); Module->SetTimeStamp( GetNewTimeStamp() );
Module->m_Path = cmp->m_TimeStampPath; Module->m_Path = cmp->m_TimeStampPath;
} }
else else
@ -1176,7 +1176,7 @@ bool NETLIST_READER::loadNewModules()
Module = newmodule; Module = newmodule;
Module->m_Reference->m_Text = cmp->m_CmpName; Module->m_Reference->m_Text = cmp->m_CmpName;
Module->m_TimeStamp = GetNewTimeStamp(); Module->SetTimeStamp( GetNewTimeStamp() );
Module->m_Path = cmp->m_TimeStampPath; Module->m_Path = cmp->m_TimeStampPath;
} }
} }

View File

@ -699,7 +699,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* me
} }
// Graphic texts can be deleted only if are not currently edited. // Graphic texts can be deleted only if are not currently edited.
if( !flags && FpText->m_Type == TEXT_is_DIVERS ) if( !flags && FpText->GetType() == TEXT_is_DIVERS )
{ {
AddMenuItem( sub_menu_Fp_text, ID_POPUP_PCB_DELETE_TEXTMODULE, AddMenuItem( sub_menu_Fp_text, ID_POPUP_PCB_DELETE_TEXTMODULE,
_( "Delete" ), KiBitmap( delete_xpm ) ); _( "Delete" ), KiBitmap( delete_xpm ) );

View File

@ -145,7 +145,7 @@ module\n %s's \"reference\" text." ),
if( ( ( 1 << textLayer ) & aLayerMask ) == 0 ) if( ( ( 1 << textLayer ) & aLayerMask ) == 0 )
trace_ref = false; trace_ref = false;
if( text->m_NoShow && !g_PcbPlotOptions.m_PlotInvisibleTexts ) if( !text->IsVisible() && !g_PcbPlotOptions.m_PlotInvisibleTexts )
trace_ref = false; trace_ref = false;
text = Module->m_Value; text = Module->m_Value;
@ -165,7 +165,7 @@ module\n %s's \"value\" text." ),
if( ( (1 << textLayer) & aLayerMask ) == 0 ) if( ( (1 << textLayer) & aLayerMask ) == 0 )
trace_val = false; trace_val = false;
if( text->m_NoShow && !g_PcbPlotOptions.m_PlotInvisibleTexts ) if( !text->IsVisible() && !g_PcbPlotOptions.m_PlotInvisibleTexts )
trace_val = false; trace_val = false;
/* Plot text fields, if allowed */ /* Plot text fields, if allowed */
@ -185,7 +185,7 @@ module\n %s's \"value\" text." ),
if( !g_PcbPlotOptions.m_PlotTextOther ) if( !g_PcbPlotOptions.m_PlotTextOther )
continue; continue;
if( (pt_texte->m_NoShow) && !g_PcbPlotOptions.m_PlotInvisibleTexts ) if( !pt_texte->IsVisible() && !g_PcbPlotOptions.m_PlotInvisibleTexts )
continue; continue;
textLayer = pt_texte->GetLayer(); textLayer = pt_texte->GetLayer();

View File

@ -382,10 +382,10 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
if( mlayer & aMasklayer ) if( mlayer & aMasklayer )
{ {
if( !aModule->m_Reference->m_NoShow ) if( aModule->m_Reference->IsVisible() )
aModule->m_Reference->Draw( aPanel, aDC, aDraw_mode ); aModule->m_Reference->Draw( aPanel, aDC, aDraw_mode );
if( !aModule->m_Value->m_NoShow ) if( aModule->m_Value->IsVisible() )
aModule->m_Value->Draw( aPanel, aDC, aDraw_mode ); aModule->m_Value->Draw( aPanel, aDC, aDraw_mode );
} }

View File

@ -565,7 +565,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
PIN* pin = new PIN(image); PIN* pin = new PIN(image);
padName = pad->ReturnStringPadName(); padName = pad->GetPadName();
pin->pin_id = TO_UTF8( padName ); pin->pin_id = TO_UTF8( padName );
if( padName!=wxEmptyString && pinmap.find( padName )==pinmap.end() ) if( padName!=wxEmptyString && pinmap.find( padName )==pinmap.end() )

View File

@ -516,7 +516,7 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aOldModule,
aNewModule->m_Value->m_Text = aOldModule->m_Value->m_Text; aNewModule->m_Value->m_Text = aOldModule->m_Value->m_Text;
/* Updating other parameters */ /* Updating other parameters */
aNewModule->m_TimeStamp = aOldModule->m_TimeStamp; aNewModule->SetTimeStamp( aOldModule->GetTimeStamp() );
aNewModule->m_Path = aOldModule->m_Path; aNewModule->m_Path = aOldModule->m_Path;
/* Update pad netnames ( when possible) */ /* Update pad netnames ( when possible) */
@ -624,7 +624,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
for( ; Module != NULL; Module = Module->Next() ) for( ; Module != NULL; Module = Module->Next() )
{ {
fprintf( FichCmp, "\nBeginCmp\n" ); fprintf( FichCmp, "\nBeginCmp\n" );
fprintf( FichCmp, "TimeStamp = %8.8lX\n", Module->m_TimeStamp ); fprintf( FichCmp, "TimeStamp = %8.8lX\n", Module->GetTimeStamp() );
fprintf( FichCmp, "Path = %s\n", TO_UTF8( Module->m_Path ) ); fprintf( FichCmp, "Path = %s\n", TO_UTF8( Module->m_Path ) );
fprintf( FichCmp, "Reference = %s;\n", fprintf( FichCmp, "Reference = %s;\n",
!Module->m_Reference->m_Text.IsEmpty() ? !Module->m_Reference->m_Text.IsEmpty() ?

View File

@ -534,7 +534,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
if( zone->GetNumCorners() == 0 ) if( zone->GetNumCorners() == 0 )
{ {
zone->m_Flags = IS_NEW; zone->m_Flags = IS_NEW;
zone->m_TimeStamp = GetNewTimeStamp(); zone->SetTimeStamp( GetNewTimeStamp() );
g_Zone_Default_Setting.ExportSetting( *zone ); g_Zone_Default_Setting.ExportSetting( *zone );
zone->m_Poly->Start( g_Zone_Default_Setting.m_CurrentZone_Layer, zone->m_Poly->Start( g_Zone_Default_Setting.m_CurrentZone_Layer,
GetScreen()->GetCrossHairPosition().x, GetScreen()->GetCrossHairPosition().x,
@ -791,7 +791,7 @@ void PCB_EDIT_FRAME::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_contain
EDA_RECT dirty = zone_container->GetBoundingBox(); EDA_RECT dirty = zone_container->GetBoundingBox();
// For compatibility with old boards: remove old SEGZONE fill segments // For compatibility with old boards: remove old SEGZONE fill segments
Delete_OldZone_Fill( NULL, zone_container->m_TimeStamp ); Delete_OldZone_Fill( NULL, zone_container->GetTimeStamp() );
// Remove current filling: // Remove current filling:
zone_container->UnFill(); zone_container->UnFill();

View File

@ -59,7 +59,7 @@ void PCB_EDIT_FRAME::Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp )
if( aZone == NULL ) if( aZone == NULL )
TimeStamp = aTimestamp; TimeStamp = aTimestamp;
else else
TimeStamp = aZone->m_TimeStamp; // Save reference time stamp (aZone will be deleted) TimeStamp = aZone->GetTimeStamp(); // Save reference time stamp (aZone will be deleted)
SEGZONE* next; SEGZONE* next;
@ -67,7 +67,7 @@ void PCB_EDIT_FRAME::Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp )
{ {
next = zone->Next(); next = zone->Next();
if( zone->m_TimeStamp == TimeStamp ) if( zone->GetTimeStamp() == TimeStamp )
{ {
modify = true; modify = true;
/* remove item from linked list and free memory */ /* remove item from linked list and free memory */

View File

@ -88,7 +88,7 @@ ZONE_CONTAINER* BOARD::InsertArea( int netcode, int iarea, int layer, int x, int
new_area->SetNet( netcode ); new_area->SetNet( netcode );
new_area->SetLayer( layer ); new_area->SetLayer( layer );
new_area->m_TimeStamp = GetNewTimeStamp(); new_area->SetTimeStamp( GetNewTimeStamp() );
if( iarea < (int) ( m_ZoneDescriptorList.size() - 1 ) ) if( iarea < (int) ( m_ZoneDescriptorList.size() - 1 ) )
m_ZoneDescriptorList.insert( m_ZoneDescriptorList.begin() + iarea + 1, new_area ); m_ZoneDescriptorList.insert( m_ZoneDescriptorList.begin() + iarea + 1, new_area );
@ -284,7 +284,7 @@ int BOARD::ClipAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList,
{ {
wxString str; wxString str;
str.Printf( wxT( "Area %8.8X of net \"%s\" has arcs intersecting other sides.\n" ), str.Printf( wxT( "Area %8.8X of net \"%s\" has arcs intersecting other sides.\n" ),
aCurrArea->m_TimeStamp, GetChars( aCurrArea->m_Netname ) ); aCurrArea->GetTimeStamp(), GetChars( aCurrArea->m_Netname ) );
str += wxT( "This may cause problems with other editing operations,\n" ); str += wxT( "This may cause problems with other editing operations,\n" );
str += wxT( "such as adding cutouts. It can't be fixed automatically.\n" ); str += wxT( "such as adding cutouts. It can't be fixed automatically.\n" );
str += wxT( "Manual correction is recommended." ); str += wxT( "Manual correction is recommended." );
@ -307,7 +307,7 @@ int BOARD::ClipAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList,
{ {
wxString str; wxString str;
str.Printf( wxT( "Area %8.8X of net \"%s\" is self-intersecting and will be clipped.\n" ), str.Printf( wxT( "Area %8.8X of net \"%s\" is self-intersecting and will be clipped.\n" ),
aCurrArea->m_TimeStamp, GetChars( aCurrArea->m_Netname ) ); aCurrArea->GetTimeStamp(), GetChars( aCurrArea->m_Netname ) );
str += wxT( "This may result in splitting the area.\n" ); str += wxT( "This may result in splitting the area.\n" );
str += wxT( "If the area is complex, this may take a few seconds." ); str += wxT( "If the area is complex, this may take a few seconds." );
wxMessageBox( str ); wxMessageBox( str );