Commit 0498f265 authored by Dick Hollenbeck's avatar Dick Hollenbeck

kicad_plugin work, and accessors along with making some fields protected or private

parents dc982a28 b979d1e0
......@@ -68,7 +68,7 @@ EDA_ITEM::EDA_ITEM( const EDA_ITEM& base )
m_Parent = base.m_Parent;
m_Son = base.m_Son;
m_Flags = base.m_Flags;
m_TimeStamp = base.m_TimeStamp;
SetTimeStamp( base.m_TimeStamp );
m_Status = base.m_Status;
m_Selected = base.m_Selected;
}
......@@ -84,7 +84,7 @@ void EDA_ITEM::InitVars()
m_List = NULL; // I am not on any list yet
m_Image = NULL; // Link to an image copy for undelete or abort command
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_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,
INSPECTOR* inspector,
const void* testData,
......
......@@ -182,7 +182,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
while( Line[idx] != ' ' && Line[idx] )
cbuffer[jj++] = Line[idx++];
cbuffer[jj] = 0;
Cmp->m_TimeStamp = FROM_UTF8(cbuffer);
Cmp->m_TimeStamp = FROM_UTF8( cbuffer );
/* search val/ref.lib */
while( Line[idx] == ' ' )
......
......@@ -554,7 +554,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
// Clear annotation and init new time stamp for the new components:
if( Struct->Type() == SCH_COMPONENT_T )
{
( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetNewTimeStamp();
( (SCH_COMPONENT*) Struct )->SetTimeStamp( GetNewTimeStamp() );
( (SCH_COMPONENT*) Struct )->ClearAnnotation( NULL );
}
......
......@@ -526,7 +526,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
wxPoint pos = GetScreen()->GetCrossHairPosition() -
( (SCH_COMPONENT*) m_itemToRepeat )->GetPosition();
m_itemToRepeat->SetFlags( IS_NEW );
( (SCH_COMPONENT*) m_itemToRepeat )->m_TimeStamp = GetNewTimeStamp();
( (SCH_COMPONENT*) m_itemToRepeat )->SetTimeStamp( GetNewTimeStamp() );
m_itemToRepeat->Move( pos );
m_itemToRepeat->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
MoveItem( m_itemToRepeat, DC );
......
......@@ -668,7 +668,7 @@ SCH_REFERENCE::SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_COMPONENT* aLibComp
m_SheetPath = aSheetPath;
m_IsNew = false;
m_Flag = 0;
m_TimeStamp = aComponent->m_TimeStamp;
m_TimeStamp = aComponent->GetTimeStamp();
m_CmpPos = aComponent->GetPosition();
m_SheetNum = 0;
......
......@@ -204,7 +204,7 @@ int TestDuplicateSheetNames( bool aCreateMarker )
{
/* Create a new marker type ERC error*/
SCH_MARKER* marker = new SCH_MARKER();
marker->m_TimeStamp = GetNewTimeStamp();
marker->SetTimeStamp( GetNewTimeStamp() );
marker->SetData( ERCE_DUPLICATE_SHEET_NAME,
( (SCH_SHEET*) test_item )->GetPosition(),
_( "Duplicate sheet name" ),
......@@ -237,7 +237,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
/* Create new marker for ERC error. */
marker = new SCH_MARKER();
marker->m_TimeStamp = GetNewTimeStamp();
marker->SetTimeStamp( GetNewTimeStamp() );
marker->SetMarkerType( MARK_ERC );
marker->SetErrorLevel( WAR );
......
......@@ -29,7 +29,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
{
SCH_COMPONENT* newitem;
newitem = new SCH_COMPONENT( *( (SCH_COMPONENT*) curr_item ) );
newitem->m_TimeStamp = GetNewTimeStamp();
newitem->SetTimeStamp( GetNewTimeStamp() );
newitem->ClearAnnotation( NULL );
newitem->m_Flags = IS_NEW;
MoveItem( (SCH_ITEM*) newitem, &dc );
......
......@@ -1035,7 +1035,7 @@ XNODE* EXPORT_HELP::makeGenericComponents()
xsheetpath->AddAttribute( sNames, path->PathHumanReadable() );
xsheetpath->AddAttribute( sTStamps, path->Path() );
timeStamp.Printf( sTSFmt, comp->m_TimeStamp );
timeStamp.Printf( sTSFmt, comp->GetTimeStamp() );
xcomp->AddChild( node( sTStamp, timeStamp ) );
}
}
......
......@@ -207,13 +207,13 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
case SCH_SHEET_T:
{
SCH_SHEET* sheet = (SCH_SHEET*) newitem;
sheet->m_TimeStamp = GetNewTimeStamp();
sheet->SetTimeStamp( GetNewTimeStamp() );
sheet->SetSon( NULL );
break;
}
case SCH_COMPONENT_T:
( (SCH_COMPONENT*) newitem )->m_TimeStamp = GetNewTimeStamp();
( (SCH_COMPONENT*) newitem )->SetTimeStamp( GetNewTimeStamp() );
( (SCH_COMPONENT*) newitem )->ClearAnnotation( NULL );
break;
}
......@@ -246,7 +246,7 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* aDrawStruct, bool aClone )
SCH_ITEM* NewDrawStruct = aDrawStruct->Clone();
if( aClone )
NewDrawStruct->m_TimeStamp = aDrawStruct->m_TimeStamp;
NewDrawStruct->SetTimeStamp( aDrawStruct->GetTimeStamp() );
NewDrawStruct->m_Image = aDrawStruct;
......
......@@ -130,7 +130,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, SCH_SHEET_PATH* sheet
m_unit = unit;
m_convert = convert;
m_ChipName = libComponent.GetName();
m_TimeStamp = GetNewTimeStamp();
SetTimeStamp( GetNewTimeStamp() );
if( setNewItemFlag )
m_Flags = IS_NEW | IS_MOVED;
......@@ -189,7 +189,7 @@ SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aComponent ) :
m_unit = aComponent.m_unit;
m_convert = aComponent.m_convert;
m_ChipName = aComponent.m_ChipName;
m_TimeStamp = aComponent.m_TimeStamp;
SetTimeStamp( aComponent.m_TimeStamp );
m_transform = aComponent.m_transform;
m_prefix = aComponent.m_prefix;
m_PathsAndReferences = aComponent.m_PathsAndReferences;
......@@ -524,7 +524,7 @@ void SCH_COMPONENT::SetTimeStamp( long aNewTimeStamp )
string_timestamp.Printf( wxT( "%8.8X" ), aNewTimeStamp );
string_oldtimestamp.Printf( wxT( "%8.8X" ), m_TimeStamp );
m_TimeStamp = aNewTimeStamp;
SetTimeStamp( aNewTimeStamp );
for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
{
......
......@@ -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 )
{
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
* 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];
if( item->m_TimeStamp == nextItem->m_TimeStamp )
if( item->GetTimeStamp() == nextItem->GetTimeStamp() )
{
count++;
......@@ -1477,7 +1477,7 @@ int SCH_SCREENS::ReplaceDuplicateTimeStamps()
// @todo: see how to change sheet paths for its cmp list (can
// be possible in most cases)
else
item->m_TimeStamp = GetNewTimeStamp();
item->SetTimeStamp( GetNewTimeStamp() );
}
}
......
......@@ -53,7 +53,7 @@ SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
m_Layer = LAYER_SHEET;
m_pos = pos;
m_size = wxSize( MIN_SHEET_WIDTH, MIN_SHEET_HEIGHT );
m_TimeStamp = GetNewTimeStamp();
SetTimeStamp( GetNewTimeStamp() );
m_sheetNameSize = m_fileNameSize = 60;
m_screen = NULL;
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_size = aSheet.m_size;
m_Layer = aSheet.m_Layer;
m_TimeStamp = aSheet.m_TimeStamp;
SetTimeStamp( aSheet.m_TimeStamp );
m_sheetNameSize = aSheet.m_sheetNameSize;
m_fileNameSize = aSheet.m_fileNameSize;
m_screen = aSheet.m_screen;
......@@ -184,7 +184,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
SCH_SHEET_PIN* sheetPin;
char* ptcar;
m_TimeStamp = GetNewTimeStamp();
SetTimeStamp( GetNewTimeStamp() );
// sheets are added to the GetDrawItems() like other schematic components.
// 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 );
if( m_TimeStamp == 0 ) // zero is not unique!
m_TimeStamp = GetNewTimeStamp();
SetTimeStamp( GetNewTimeStamp() );
continue;
}
......
......@@ -101,10 +101,10 @@ int SCH_SHEET_PATH::Cmp( const SCH_SHEET_PATH& aSheetPathToTest ) const
//otherwise, same number of sheets.
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;
if( m_sheets[i]->m_TimeStamp < aSheetPathToTest.m_sheets[i]->m_TimeStamp )
if( m_sheets[i]->GetTimeStamp() < aSheetPathToTest.m_sheets[i]->GetTimeStamp() )
return -1;
}
......@@ -200,7 +200,7 @@ wxString SCH_SHEET_PATH::Path() const
// it's timestamp changes anyway.
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;
}
......
......@@ -312,7 +312,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
SCH_SHEET* sheet = new SCH_SHEET( GetScreen()->GetCrossHairPosition() );
sheet->SetFlags( IS_NEW | IS_RESIZED );
sheet->m_TimeStamp = GetNewTimeStamp();
sheet->SetTimeStamp( GetNewTimeStamp() );
sheet->SetParent( GetScreen() );
sheet->SetScreen( NULL );
......
......@@ -70,7 +70,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource ) :
m_Shape = aSource.m_Shape;
m_Flags = aSource.m_Flags;
m_TimeStamp = aSource.m_TimeStamp;
SetTimeStamp( aSource.m_TimeStamp );
SetStatus( aSource.ReturnStatus() );
m_Start = aSource.m_Start;
......
......@@ -366,16 +366,17 @@ private:
int m_Status;
protected:
EDA_ITEM* Pnext; /* Linked list: Link (next struct) */
EDA_ITEM* Pback; /* Linked list: Link (previous struct) */
EDA_ITEM* Pnext; ///< next in linked list
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_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:
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 */
// member used in undo/redo function
......@@ -385,7 +386,7 @@ private:
void InitVars();
/**
* @brief Function doClone
* Function doClone
* is used by the derived class to actually implement the cloning.
*
* 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.
*
* The Clone() function only calls the private virtual doClone() which actually
* does the cloning for the derived object.
*
* @todo: use this instead of Copy() everywhere, then kill Copy().
*
* @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
......@@ -755,20 +758,19 @@ enum FILL_T {
class EDA_TEXT
{
public:
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. */
wxSize m_Size; /* XY size of text */
wxString m_Text;
int m_Thickness; ///< pen size used to draw this text
int m_Orient; ///< Orient in 0.1 degrees
wxPoint m_Pos; ///< XY position of anchor text.
wxSize m_Size; ///< XY size of text
bool m_Mirror; ///< true iff mirrored
int m_Attributs; /* flags (visible...) */
bool m_Italic; /* true to simulate (or use if exists)
* an italic font... */
bool m_Bold; /* true to simulate a bold font ... */
GRTextHorizJustifyType m_HJustify; /* Horiz justification */
GRTextVertJustifyType m_VJustify; /* Vertical justification */
bool m_MultilineAllowed; /* true to use multiline option, false
int m_Attributs; ///< bit flags such as visible, etc.
bool m_Italic; ///< should be italic font (if available)
bool m_Bold; ///< should be bold font (if available)
GRTextHorizJustifyType m_HJustify; ///< horizontal justification
GRTextVertJustifyType m_VJustify; ///< vertical justification
bool m_MultilineAllowed; /**< true to use multiline option, false
* to use only single line text
* Single line is faster in
* calculations than multiline */
......@@ -798,7 +800,7 @@ public:
void SetItalic( bool isItalic ) { m_Italic = isItalic; }
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; }
/**
......
......@@ -854,7 +854,7 @@ void PCB_EDIT_FRAME::Block_Duplicate()
module->m_Flags = 0;
newitem = new_module = new MODULE( m_Pcb );
new_module->Copy( module );
new_module->m_TimeStamp = GetNewTimeStamp();
new_module->SetTimeStamp( GetNewTimeStamp() );
m_Pcb->m_Modules.PushFront( new_module );
}
break;
......@@ -877,7 +877,7 @@ void PCB_EDIT_FRAME::Block_Duplicate()
{
ZONE_CONTAINER* new_zone = new ZONE_CONTAINER( (BOARD*) item->GetParent() );
new_zone->Copy( (ZONE_CONTAINER*) item );
new_zone->m_TimeStamp = GetNewTimeStamp();
new_zone->SetTimeStamp( GetNewTimeStamp() );
newitem = new_zone;
m_Pcb->Add( new_zone );
}
......
......@@ -408,7 +408,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
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 )
continue;
......@@ -473,16 +473,21 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
switch( item->Type() )
{
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;
case PCB_MODULE_EDGE_T:
( (EDGE_MODULE*) item )->m_Start += offset;
( (EDGE_MODULE*) item )->m_End += offset;
( (EDGE_MODULE*) item )->m_Start0 += offset;
( (EDGE_MODULE*) item )->m_End0 += offset;
{
EDGE_MODULE* em = (EDGE_MODULE*) item;
em->m_Start += offset;
em->m_End += offset;
em->m_Start0 += offset;
em->m_End0 += offset;
}
break;
default:
......@@ -571,20 +576,25 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
switch( item->Type() )
{
case PCB_MODULE_EDGE_T:
EDGE_MODULE * edge;
edge = (EDGE_MODULE*) item;
SETMIRROR( edge->m_Start.x );
edge->m_Start0.x = edge->m_Start.x;
SETMIRROR( edge->m_End.x );
edge->m_End0.x = edge->m_End.x;
NEGATE( edge->m_Angle );
{
EDGE_MODULE* em = (EDGE_MODULE*) item;
SETMIRROR( em->m_Start.x );
em->m_Start0.x = em->m_Start.x;
SETMIRROR( em->m_End.x );
em->m_End0.x = em->m_End.x;
NEGATE( em->m_Angle );
}
break;
case PCB_MODULE_TEXT_T:
tmp = ( (TEXTE_MODULE*) item )->GetPosition();
SETMIRROR( tmp.x );
( (TEXTE_MODULE*) item )->SetPosition( tmp );
( (TEXTE_MODULE*) item )->m_Pos0.x = ( (TEXTE_MODULE*) item )->GetPosition().x;
{
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
tmp = tm->GetPosition();
SETMIRROR( tmp.x );
tm->SetPosition( tmp );
tmp.y = tm->GetPos0().y;
tm->SetPos0( tmp );
}
break;
default:
......@@ -633,20 +643,24 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
switch( item->Type() )
{
case PCB_MODULE_EDGE_T:
ROTATE( ( (EDGE_MODULE*) item )->m_Start );
( (EDGE_MODULE*) item )->m_Start0 = ( (EDGE_MODULE*) item )->m_Start;
ROTATE( ( (EDGE_MODULE*) item )->m_End );
( (EDGE_MODULE*) item )->m_End0 = ( (EDGE_MODULE*) item )->m_End;
{
EDGE_MODULE* em = (EDGE_MODULE*) item;
ROTATE( em->m_Start );
em->m_Start0 = em->m_Start;
ROTATE( em->m_End );
em->m_End0 = em->m_End;
}
break;
case PCB_MODULE_TEXT_T:
{
wxPoint pos = ( (TEXTE_MODULE*) item )->GetPosition();
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
wxPoint pos = tm->GetPosition();
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;
default:
......
......@@ -71,7 +71,7 @@ void DIMENSION::Copy( DIMENSION* source )
m_Pos = source->m_Pos;
m_Shape = source->m_Shape;
m_Unit = source->m_Unit;
m_TimeStamp = GetNewTimeStamp();
SetTimeStamp( GetNewTimeStamp() );
m_Text->Copy( source->m_Text );
m_crossBarOx = source->m_crossBarOx;
......
......@@ -48,7 +48,7 @@ void DRAWSEGMENT::Copy( DRAWSEGMENT* source )
m_End = source->m_End;
m_Shape = source->m_Shape;
m_Angle = source->m_Angle;
m_TimeStamp = source->m_TimeStamp;
SetTimeStamp( source->m_TimeStamp );
m_BezierC1 = source->m_BezierC1;
m_BezierC2 = source->m_BezierC1;
m_BezierPoints = source->m_BezierPoints;
......
......@@ -41,6 +41,7 @@ public:
DRAWSEGMENT* Back() const { return (DRAWSEGMENT*) Pback; }
void SetWidth( int aWidth ) { m_Width = aWidth; }
int GetWidth() const { return m_Width; }
void SetStart( const wxPoint& aStart ) { m_Start = aStart; }
......@@ -52,10 +53,12 @@ public:
* @param aAngle is tenths of degrees, but will soon be degrees.
*/
void SetAngle( double aAngle ); // encapsulates the transition to degrees
double GetAngle() const { return m_Angle; }
void SetType( int aType ) { m_Type = aType; }
void SetShape( int aShape ) { m_Shape = aShape; }
int GetShape() const { return m_Shape; }
void SetBezControl1( const wxPoint& aPoint ) { m_BezierC1 = aPoint; }
void SetBezControl2( const wxPoint& aPoint ) { m_BezierC2 = aPoint; }
......@@ -104,8 +107,8 @@ public:
*/
MODULE* GetParentModule() const;
std::vector<wxPoint>& GetBezierPoints() { return m_BezierPoints; };
std::vector<wxPoint>& GetPolyPoints() { return m_PolyPoints; };
const std::vector<wxPoint>& GetBezierPoints() const { return m_BezierPoints; };
const std::vector<wxPoint>& GetPolyPoints() const { return m_PolyPoints; };
void SetBezierPoints( std::vector<wxPoint>& aPoints )
{
......
......@@ -223,7 +223,7 @@ void EDGE_MODULE::DisplayInfo( EDA_DRAW_FRAME* frame )
frame->AppendMsgPanel( _( "Module" ), module->m_Reference->m_Text, DARKCYAN );
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( _( "Mod Layer" ), board->GetLayerName( module->GetLayer() ), RED );
frame->AppendMsgPanel( _( "Seg Layer" ), board->GetLayerName( GetLayer() ), RED );
......
......@@ -50,7 +50,7 @@ void PCB_TARGET::Copy( PCB_TARGET* source )
m_Pos = source->m_Pos;
m_Shape = source->m_Shape;
m_Size = source->m_Size;
m_TimeStamp = GetNewTimeStamp();
SetTimeStamp( GetNewTimeStamp() );
}
......
......@@ -125,7 +125,7 @@ void MODULE::Copy( MODULE* aModule )
m_LastEdit_Time = aModule->m_LastEdit_Time;
m_Link = aModule->m_Link;
m_Path = aModule->m_Path; //is this correct behavior?
m_TimeStamp = GetNewTimeStamp();
SetTimeStamp( GetNewTimeStamp() );
m_LocalClearance = aModule->m_LocalClearance;
m_LocalSolderMaskMargin = aModule->m_LocalSolderMaskMargin;
......
......@@ -23,22 +23,22 @@ class D_PAD;
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_CMS = 1, /* Set for modules listed in the automatic insertion list
* (usually SMD footprints) */
MOD_VIRTUAL = 2 /* Virtual component: when created by copper shapes on
* board (Like edge card connectors, mounting hole...) */
MOD_DEFAULT = 0, ///< default
MOD_CMS = 1, ///< Set for modules listed in the automatic insertion list
///< (usually SMD footprints)
MOD_VIRTUAL = 2 ///< Virtual component: when created by copper shapes on
///< 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
{
......@@ -53,22 +53,33 @@ public:
wxString m_LibRef; /* Name of the module in library (and
* the default value when loading a
* module from the library) */
wxString m_AlternateReference; /* Used when m_Reference cannot
* be used to identify the
* footprint ( after a full
* 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 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.
int m_PadNum; // Pad count
int m_AltPadNum; /* Pad with netcode > 0 (active pads) count */
int m_CntRot90; /* Automatic placement : cost ( 0..10 )
* for 90 degrees rotation (Horiz<->Vertical) */
int m_CntRot180; /* Automatic placement : cost ( 0..10 )
* for 180 degrees rotation (UP <->Down) */
int m_CntRot90; ///< Automatic placement : cost ( 0..10 )
///< for 90 degrees rotation (Horiz<->Vertical)
int m_CntRot180; ///< Automatic placement : cost ( 0..10 )
///< for 180 degrees rotation (UP <->Down)
wxSize m_Ext; /* Automatic placement margin around the module */
double m_Surface; // Bounding box area
......@@ -79,16 +90,16 @@ public:
wxString m_Doc; // Module Description (info for users)
wxString m_KeyWord; // Keywords to select the module in lib
// Local clearance. When null, the netclasses values are used. Usually
// the local clearance is null
// Local tolerances. When zero, this means the corresponding netclass value
// is used. Usually theses local tolerances zero, in deference to the
// corresponding netclass values.
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
int m_LocalSolderMaskMargin; // Solder mask margin
int m_LocalSolderPasteMargin; /* Solder paste margin
* absolute value */
double m_LocalSolderPasteMarginRatio; /* Solder mask margin ratio
* value of pad size */
double m_LocalSolderPasteMarginRatio; ///< Solder mask margin ratio
///< value of pad size
// The final margin is the sum of these 2 values
public:
......@@ -139,9 +150,35 @@ public:
void SetPosition( const wxPoint& aPos ); // overload
void SetOrientation( int newangle );
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
* move this object.
......@@ -177,11 +214,11 @@ public:
/**
* Function SetLocked
* 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;
else
m_ModuleStatus &= ~MODULE_is_LOCKED;
......@@ -197,6 +234,7 @@ public:
}
void SetLastEditTime( long aTime ) { m_LastEdit_Time = aTime; }
long GetLastEditTime() const { return m_LastEdit_Time; }
/* Reading and writing data on files */
......@@ -340,7 +378,7 @@ public:
virtual BITMAP_DEF GetMenuImage() const { return module_xpm; }
#if defined(DEBUG)
#if defined(DEBUG)
/**
* Function Show
......
......@@ -150,7 +150,7 @@ void MODULE::Rotate(const wxPoint& aRotCentre, int aAngle)
wxPoint newpos = m_Pos;
RotatePoint( &newpos, aRotCentre, aAngle );
SetPosition( newpos );
SetOrientation( m_Orient + aAngle );
SetOrientation( GetOrientation() + aAngle );
}
......
......@@ -139,32 +139,33 @@ const wxPoint D_PAD::ReturnShapePos()
}
/* Return pad name as string in a wxString
*/
wxString D_PAD::ReturnStringPadName() const
const wxString D_PAD::GetPadName() const
{
wxString name;
// Return pad name as wxString, assume it starts as a non-terminated
// utf8 character sequence
char temp[sizeof(m_Padname)+1]; // a place to terminate with '\0'
strncpy( temp, m_Padname, sizeof(m_Padname) );
ReturnStringPadName( name );
return name;
temp[sizeof(m_Padname)] = 0;
return FROM_UTF8( temp );
}
/* Return pad name as string in a buffer
*/
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++ )
{
if( m_Padname[ii] == 0 )
break;
strncpy( temp, m_Padname, sizeof(m_Padname) );
text.Append( m_Padname[ii] );
}
temp[sizeof(m_Padname)] = 0;
text = FROM_UTF8( temp );
}
......@@ -712,7 +713,7 @@ wxString D_PAD::GetSelectMenuText() const
padlayers = _( "???" );
text.Printf( _( "Pad [%s] (%s) of %s" ),
GetChars(ReturnStringPadName() ), GetChars( padlayers ),
GetChars(GetPadName() ), GetChars( padlayers ),
GetChars(( (MODULE*) GetParent() )->GetReference() ) );
return text;
......
......@@ -117,8 +117,9 @@ public:
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_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
......@@ -147,42 +148,50 @@ public:
D_PAD* Next() { return (D_PAD*) Pnext; }
/**
* Function GetNetname
* @return const wxString * , a pointer to the full netname
* Function SetNetname
* @param aNetname: the new netname
*/
wxString GetNetname() const { return m_Netname; }
void SetNetname( const wxString& aNetname );
/**
* Function GetShortNetname
* @return const wxString * , a pointer to the short netname
* Function GetNetname
* @return const wxString& - the full netname
*/
wxString GetShortNetname() const { return m_ShortNetname; }
const wxString& GetNetname() const { return m_Netname; }
/**
* Function SetNetname
* @param aNetname: the new netname
* Function GetShortNetname
* @return const wxString& - the short netname
*/
void SetNetname( const wxString& aNetname );
const wxString& GetShortNetname() const { return m_ShortNetname; }
/**
* Function GetShape
* @return the shape of this pad.
*/
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
{
return m_Pos;
}
void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; } // overload
void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; }
const wxPoint& GetPos0() const { return m_Pos0; }
void SetSize( const wxSize& aSize ) { m_Size = aSize; }
const wxSize& GetSize() const { return m_Size; }
void SetDelta( const wxSize& aSize ) { m_DeltaSize = aSize; }
const wxSize& GetDelta() const { return m_DeltaSize; }
void SetDrillSize( const wxSize& aSize ) { m_Drill = aSize; }
const wxSize& GetDrillSize() const { return m_Drill; }
void SetOffset( const wxSize& aOffset ) { m_Offset = aOffset; }
const wxSize& GetOffset() const { return m_Offset; }
/**
* Function SetOrientation
......@@ -198,15 +207,29 @@ public:
double GetOrientation() const { return m_Orient; }
void SetDrillShape( int aDrillShape ) { m_DrillShape = aDrillShape; }
int GetDrillShape() const { return m_DrillShape; }
void SetLayerMask( int aLayerMask ) { m_layerMask = aLayerMask; }
int GetLayerMask() const { return m_layerMask; }
void SetAttribute( int aAttribute ) { m_Attribut = aAttribute; }
int GetAttribute() const { return m_Attribut; }
void SetDieLength( int aLength ) { m_LengthDie = aLength; }
void SetSolderMaskMargin( int aLength ) { m_LocalSolderMaskMargin = aLength; }
void SetSolderPasteMargin( int aLength ) { m_LocalSolderPasteMargin = aLength; }
void SetSolderPasteRatio( double aRatio ) { m_LocalSolderPasteMarginRatio = aRatio; }
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
......@@ -324,11 +347,9 @@ public:
*/
int BuildSegmentFromOvalShape( wxPoint& aSegStart, wxPoint& aSegEnd, int aRotation ) const;
// others
void SetPadName( const wxString& name ); // Change pad name
void SetPadName( const char* aName );
wxString ReturnStringPadName() const; // Return pad name as string in a wxString
const wxString GetPadName() const;
void ReturnStringPadName( wxString& text ) const; // Return pad name as string in a buffer
......
......@@ -27,14 +27,19 @@ class MODULE;
class TEXTE_MODULE : public BOARD_ITEM, public EDA_TEXT
{
/* Note: orientation in 1/10 deg relative to the footprint
* Physical orient is m_Orient + m_Parent->m_Orient
*/
public:
wxPoint m_Pos0; // text coordinates relatives to the footprint anchor, orient 0
// Text coordinate ref point is the text centre
char m_Type; // 0: ref,1: val, others = 2..255
bool m_NoShow; // true = invisible
// @todo eliminate these friends, make them use accessors
friend class MODULE;
friend class FOOTPRINT_EDIT_FRAME;
/* Note: orientation in 1/10 deg relative to the footprint
* Physical orient is m_Orient + m_Parent->m_Orient
*/
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:
TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS );
......@@ -45,6 +50,11 @@ public:
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
{
return m_Pos; // from EDA_TEXT
......@@ -52,16 +62,13 @@ public:
/// @deprecated it seems
void SetType( int aType ) { m_Type = aType; }
void SetPosition( const wxPoint& aPos ) // overload a base
{
m_Pos = aPos; // in EDA_TEXT
}
int GetType() const { return m_Type; }
void SetVisible( bool isVisible ) { m_NoShow = !isVisible; }
bool IsVisible() const { return !m_NoShow; }
void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; }
const wxPoint& GetPos0() const { return m_Pos0; }
void Copy( TEXTE_MODULE* source ); // copy structure
......
......@@ -230,7 +230,7 @@ TRACK::TRACK( const TRACK& Source ) :
SetNet( Source.GetNet() );
m_Flags = Source.m_Flags;
m_TimeStamp = Source.m_TimeStamp;
SetTimeStamp( Source.m_TimeStamp );
SetStatus( Source.ReturnStatus() );
m_Start = Source.m_Start;
m_End = Source.m_End;
......
......@@ -815,7 +815,7 @@ void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src )
m_Parent = src->m_Parent;
m_Layer = src->m_Layer;
SetNet( src->GetNet() );
m_TimeStamp = src->m_TimeStamp;
SetTimeStamp( src->m_TimeStamp );
m_Poly->RemoveAllContours();
m_Poly->Copy( src->m_Poly ); // copy outlines
m_CornerSelection = -1; // For corner moving, corner index to drag, or -1 if no selection
......
......@@ -270,7 +270,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
case PCB_MODULE_TEXT_T:
module = (MODULE*) item->GetParent();
if( m_Guide->IgnoreMTextsMarkedNoShow() && ( (TEXTE_MODULE*) item )->m_NoShow )
if( m_Guide->IgnoreMTextsMarkedNoShow() && !( (TEXTE_MODULE*) item )->IsVisible() )
goto exit;
if( module )
......
......@@ -168,14 +168,14 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
continue;
/* 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 );
ii--;
}
else
{
timestampzone = item->m_TimeStamp;
timestampzone = item->GetTimeStamp();
}
}
......
......@@ -164,7 +164,7 @@ void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
case PCB_PAD_T:
module = (MODULE*) objectToSync->GetParent();
pad = (D_PAD*) objectToSync;
msg = pad->ReturnStringPadName();
msg = pad->GetPadName();
sprintf( cmd, "$PART: \"%s\" $PAD: \"%s\"",
TO_UTF8( module->m_Reference->m_Text ),
TO_UTF8( msg ) );
......@@ -176,9 +176,9 @@ void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
module = (MODULE*) objectToSync->GetParent();
text_mod = (TEXTE_MODULE*) objectToSync;
if( text_mod->m_Type == REFERENCE )
if( text_mod->GetType() == REFERENCE )
text_key = "$REF:";
else if( text_mod->m_Type == VALUE )
else if( text_mod->GetType() == VALUE )
text_key = "$VAL:";
else
break;
......
......@@ -143,10 +143,9 @@ void DIALOG_MODULE_BOARD_EDITOR::OnCancelClick( wxCommandEvent& event )
void DIALOG_MODULE_BOARD_EDITOR::GotoModuleEditor( wxCommandEvent& event )
{
if( m_CurrentModule->m_TimeStamp == 0 ) // Module Editor needs a non
// null timestamp
if( m_CurrentModule->GetTimeStamp() == 0 ) // Module Editor needs a non null timestamp
{
m_CurrentModule->m_TimeStamp = GetNewTimeStamp();
m_CurrentModule->SetTimeStamp( GetNewTimeStamp() );
m_Parent->OnModify();
}
......
......@@ -108,11 +108,11 @@ void DialogEditModuleText::initDlg( )
m_ModuleInfoText->SetLabel( msg );
if( m_currentText->m_Type == TEXT_is_VALUE )
if( m_currentText->GetType() == TEXT_is_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:" ) );
else if( m_currentText->m_Type != TEXT_is_REFERENCE )
else if( m_currentText->GetType() != TEXT_is_REFERENCE )
m_TextDataTitle->SetLabel( wxT( "???" ) );
m_Name->SetValue( m_currentText->m_Text );
......@@ -128,11 +128,11 @@ void DialogEditModuleText::initDlg( )
m_parent->m_InternalUnits );
AddUnitSymbol( *m_PosXTitle );
PutValueInLocalUnits( *m_TxtPosCtrlX, m_currentText->m_Pos0.x,
PutValueInLocalUnits( *m_TxtPosCtrlX, m_currentText->GetPos0().x,
m_parent->m_InternalUnits );
AddUnitSymbol( *m_PosYTitle );
PutValueInLocalUnits( *m_TxtPosCtrlY, m_currentText->m_Pos0.y,
PutValueInLocalUnits( *m_TxtPosCtrlY, m_currentText->GetPos0().y,
m_parent->m_InternalUnits );
AddUnitSymbol( *m_WidthTitle );
......@@ -144,9 +144,8 @@ void DialogEditModuleText::initDlg( )
if( (text_orient != 0) )
m_Orient->SetSelection( 1 );
if( m_currentText->m_NoShow )
if( !m_currentText->IsVisible() )
m_Show->SetSelection( 1 );;
}
......@@ -167,13 +166,15 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
m_currentText->m_Italic = m_Style->GetSelection() == 1 ? true : false;
wxPoint tmp;
msg = m_TxtPosCtrlX->GetValue();
m_currentText->m_Pos0.x = ReturnValueFromString( g_UserUnit, msg,
m_parent->m_InternalUnits );
tmp.x = ReturnValueFromString( g_UserUnit, msg, m_parent->m_InternalUnits );
msg = m_TxtPosCtrlY->GetValue();
m_currentText->m_Pos0.y = ReturnValueFromString( g_UserUnit, msg,
m_parent->m_InternalUnits );
tmp.y = ReturnValueFromString( g_UserUnit, msg, m_parent->m_InternalUnits );
m_currentText->SetPos0( tmp );
msg = m_TxtSizeCtrlX->GetValue();
m_currentText->m_Size.x = ReturnValueFromString( g_UserUnit, msg,
......@@ -202,7 +203,8 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
}
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;
m_currentText->m_Orient = text_orient;
......
......@@ -214,7 +214,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
}
m_staticTextWarningPadFlipped->Show(m_isFlipped);
m_PadNumCtrl->SetValue( m_dummyPad->ReturnStringPadName() );
m_PadNumCtrl->SetValue( m_dummyPad->GetPadName() );
m_PadNetNameCtrl->SetValue( m_dummyPad->GetNetname() );
// Display current unit name in dialog:
......@@ -637,7 +637,7 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
if( m_isFlipped )
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() )
{
......
......@@ -102,7 +102,7 @@ void FOOTPRINT_EDIT_FRAME::Place_Ancre( MODULE* pt_mod )
case PCB_MODULE_TEXT_T:
#undef STRUCT
#define STRUCT ( (TEXTE_MODULE*) PtStruct )
STRUCT->m_Pos0 += moveVector;
STRUCT->SetPos0( STRUCT->GetPos0() + moveVector );
break;
default:
......@@ -129,13 +129,13 @@ void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* 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!" ) );
break;
}
if( text->m_Type == TEXT_is_VALUE )
if( text->GetType() == TEXT_is_VALUE )
{
DisplayError( this, _( "Text is VALUE!" ) );
break;
......
......@@ -36,7 +36,7 @@ static int TextInitialOrientation; // module text initial orientation for
/* Add a new graphical text to the active module (footprint)
* 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 )
{
......@@ -118,7 +118,7 @@ void PCB_BASE_FRAME::DeleteTextModule( TEXTE_MODULE* Text )
Module = (MODULE*) Text->GetParent();
if( Text->m_Type == TEXT_is_DIVERS )
if( Text->GetType() == TEXT_is_DIVERS )
{
DrawPanel->RefreshDrawingRect( Text->GetBoundingBox() );
Text->DeleteStructure();
......@@ -226,7 +226,7 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
Text->m_Pos = GetScreen()->GetCrossHairPosition();
wxPoint textRelPos = Text->m_Pos - Module->m_Pos;
RotatePoint( &textRelPos, -Module->m_Orient );
Text->m_Pos0 = textRelPos;
Text->SetPos0( textRelPos );
Text->m_Flags = 0;
Module->m_Flags = 0;
Module->m_LastEdit_Time = time( NULL );
......
......@@ -602,8 +602,8 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
SILKSCREEN_N_BACK : SILKSCREEN_N_FRONT];
fprintf( aFile, "TEXT %g %g %g %g %s %s \"%s\"",
textmod->m_Pos0.x / SCALE_FACTOR,
-textmod->m_Pos0.y / SCALE_FACTOR,
textmod->GetPos0().x / SCALE_FACTOR,
-textmod->GetPos0().y / SCALE_FACTOR,
textmod->m_Size.x / SCALE_FACTOR,
orient / 10.0,
mirror,
......
......@@ -834,7 +834,7 @@ static void export_vrml_zones( BOARD* pcb )
static void export_vrml_text_module( TEXTE_MODULE* module ) /*{{{*/
{
if( !module->m_NoShow )
if( module->IsVisible() )
{
wxSize size = module->m_Size;
......
......@@ -165,7 +165,7 @@ int PCB_BASE_FRAME::ReadListeSegmentDescr( LINE_READER* aReader,
break;
}
newTrack->m_TimeStamp = timeStamp;
newTrack->SetTimeStamp( timeStamp );
newTrack->m_Start.x = tempStartX;
newTrack->m_Start.y = tempStartY;
......
......@@ -1737,7 +1737,7 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
}
else
{
m_TimeStamp = ts;
SetTimeStamp( ts );
SetNet( netcode );
ReadDelimitedText( netname_buffer, netname_buffer, 1024 );
m_Netname = FROM_UTF8( netname_buffer );
......
This diff is collapsed.
......@@ -43,7 +43,7 @@ class TEXTE_MODULE;
class EDGE_MODULE;
class TRACK;
class SEGZONE;
class D_PAD;
/**
* Class KICAD_PLUGIN
......@@ -164,21 +164,43 @@ protected:
//-----<save functions>-----------------------------------------------------
/**
* Function checkWriteError
* checks to see if there is an error on the output FILE, and its ability to
* continue saving to disk.
* Function writeError
* returns an error message wxString containing the filename being
* 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.
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 saveGENERAL() const;
void saveSHEET() const;
void saveSETUP() const;
void saveBOARD() 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 saveNETCLASSES() const;
void saveNETCLASS( const NETCLASS* aNetclass ) const;
......
......@@ -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 ) */
tmp = aModule->m_TimeStamp; aModule->m_TimeStamp = 0;
tmp = aModule->GetTimeStamp(); aModule->SetTimeStamp( 0 );
aModule->Save( dest );
aModule->m_TimeStamp = tmp;
aModule->SetTimeStamp( tmp );
output_lib.WriteEndOfFile();
......
......@@ -78,7 +78,7 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
GetBoard()->m_Status_Pcb = 0;
newModule = new MODULE( GetBoard() );
newModule->Copy( aModule );
newModule->m_Link = aModule->m_TimeStamp;
newModule->m_Link = aModule->GetTimeStamp();
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_Link = 0;
module->m_TimeStamp = GetNewTimeStamp();
module->SetTimeStamp( GetNewTimeStamp() );
GetBoard()->m_Status_Pcb = 0;
module->SetPosition( curspos );
......
......@@ -284,7 +284,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
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;
}
}
......@@ -325,7 +325,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
// and the source_module (old module) is deleted
PICKED_ITEMS_LIST 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() )
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->PlaceModule( newmodule, NULL );
pcbframe->GetScreen()->SetCrossHairPosition( cursor_pos );
newmodule->m_TimeStamp = GetNewTimeStamp();
newmodule->SetTimeStamp( GetNewTimeStamp() );
pcbframe->SaveCopyInUndoList( newmodule, UR_NEW );
}
......@@ -413,12 +413,12 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
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 )
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 )
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() )
{
pad->m_Pos0 = pad->m_Pos;
pad->SetPos0( pad->m_Pos );
pad->m_Orient -= angle;
RotatePoint( &pad->m_Offset.x, &pad->m_Offset.y, angle );
EXCHG( pad->m_Size.x, pad->m_Size.y );
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;
if( 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;
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 )
{
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;
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_Pos0.y );
......
......@@ -307,7 +307,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
HK_EDIT_ITEM );
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,
HK_DELETE );
......
......@@ -300,7 +300,7 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard( wxUpdateUIEvent& aEvent
// search if the source module was not deleted:
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;
}
......@@ -326,7 +326,7 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard( wxUpdateUIEvent& aEvent
// search if the source module was not deleted:
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;
}
......
......@@ -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 )
{
wxString lastPadName; // Last used pad name (pad num)
lastPadName = g_Pad_Master.ReturnStringPadName();
lastPadName = g_Pad_Master.GetPadName();
m_Pcb->m_Status_Pcb = 0;
Module->m_LastEdit_Time = time( NULL );
......
......@@ -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_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_Value->m_Pos0 = Module->m_Value->m_Pos - Module->m_Pos;
Module->m_Reference->SetPos0( Module->m_Reference->m_Pos - Module->m_Pos );
Module->m_Value->SetPos0( Module->m_Value->m_Pos - Module->m_Pos );
Module->CalculateBoundingBox();
Module->Draw( DrawPanel, DC, GR_OR );
......@@ -532,14 +532,22 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_c
return NULL;
#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_Pos0.y = -DEFAULT_SIZE;
Module->m_Value->m_Pos.y += Module->m_Value->m_Pos0.y;
Module->m_Value->m_Thickness = DEFAULT_SIZE / 4;
Module->m_Value->SetPos0( wxPoint( 0, -DEFAULT_SIZE ) );
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_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;
/* Create 2 pads used in gaps and stubs.
......
......@@ -1160,7 +1160,7 @@ bool NETLIST_READER::loadNewModules()
/* Update schematic links : reference "Time Stamp" and schematic
* hierarchical path */
Module->m_Reference->m_Text = cmp->m_CmpName;
Module->m_TimeStamp = GetNewTimeStamp();
Module->SetTimeStamp( GetNewTimeStamp() );
Module->m_Path = cmp->m_TimeStampPath;
}
else
......@@ -1176,7 +1176,7 @@ bool NETLIST_READER::loadNewModules()
Module = newmodule;
Module->m_Reference->m_Text = cmp->m_CmpName;
Module->m_TimeStamp = GetNewTimeStamp();
Module->SetTimeStamp( GetNewTimeStamp() );
Module->m_Path = cmp->m_TimeStampPath;
}
}
......
......@@ -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.
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,
_( "Delete" ), KiBitmap( delete_xpm ) );
......
......@@ -145,7 +145,7 @@ module\n %s's \"reference\" text." ),
if( ( ( 1 << textLayer ) & aLayerMask ) == 0 )
trace_ref = false;
if( text->m_NoShow && !g_PcbPlotOptions.m_PlotInvisibleTexts )
if( !text->IsVisible() && !g_PcbPlotOptions.m_PlotInvisibleTexts )
trace_ref = false;
text = Module->m_Value;
......@@ -165,7 +165,7 @@ module\n %s's \"value\" text." ),
if( ( (1 << textLayer) & aLayerMask ) == 0 )
trace_val = false;
if( text->m_NoShow && !g_PcbPlotOptions.m_PlotInvisibleTexts )
if( !text->IsVisible() && !g_PcbPlotOptions.m_PlotInvisibleTexts )
trace_val = false;
/* Plot text fields, if allowed */
......@@ -185,7 +185,7 @@ module\n %s's \"value\" text." ),
if( !g_PcbPlotOptions.m_PlotTextOther )
continue;
if( (pt_texte->m_NoShow) && !g_PcbPlotOptions.m_PlotInvisibleTexts )
if( !pt_texte->IsVisible() && !g_PcbPlotOptions.m_PlotInvisibleTexts )
continue;
textLayer = pt_texte->GetLayer();
......
......@@ -382,10 +382,10 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
if( mlayer & aMasklayer )
{
if( !aModule->m_Reference->m_NoShow )
if( aModule->m_Reference->IsVisible() )
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 );
}
......
......@@ -565,7 +565,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
PIN* pin = new PIN(image);
padName = pad->ReturnStringPadName();
padName = pad->GetPadName();
pin->pin_id = TO_UTF8( padName );
if( padName!=wxEmptyString && pinmap.find( padName )==pinmap.end() )
......
......@@ -516,7 +516,7 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aOldModule,
aNewModule->m_Value->m_Text = aOldModule->m_Value->m_Text;
/* Updating other parameters */
aNewModule->m_TimeStamp = aOldModule->m_TimeStamp;
aNewModule->SetTimeStamp( aOldModule->GetTimeStamp() );
aNewModule->m_Path = aOldModule->m_Path;
/* Update pad netnames ( when possible) */
......@@ -624,7 +624,7 @@ void PCB_EDIT_FRAME::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
for( ; Module != NULL; Module = Module->Next() )
{
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, "Reference = %s;\n",
!Module->m_Reference->m_Text.IsEmpty() ?
......
......@@ -534,7 +534,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
if( zone->GetNumCorners() == 0 )
{
zone->m_Flags = IS_NEW;
zone->m_TimeStamp = GetNewTimeStamp();
zone->SetTimeStamp( GetNewTimeStamp() );
g_Zone_Default_Setting.ExportSetting( *zone );
zone->m_Poly->Start( g_Zone_Default_Setting.m_CurrentZone_Layer,
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();
// 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:
zone_container->UnFill();
......
......@@ -59,7 +59,7 @@ void PCB_EDIT_FRAME::Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp )
if( aZone == NULL )
TimeStamp = aTimestamp;
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;
......@@ -67,7 +67,7 @@ void PCB_EDIT_FRAME::Delete_OldZone_Fill( SEGZONE* aZone, long aTimestamp )
{
next = zone->Next();
if( zone->m_TimeStamp == TimeStamp )
if( zone->GetTimeStamp() == TimeStamp )
{
modify = true;
/* remove item from linked list and free memory */
......
......@@ -88,7 +88,7 @@ ZONE_CONTAINER* BOARD::InsertArea( int netcode, int iarea, int layer, int x, int
new_area->SetNet( netcode );
new_area->SetLayer( layer );
new_area->m_TimeStamp = GetNewTimeStamp();
new_area->SetTimeStamp( GetNewTimeStamp() );
if( iarea < (int) ( m_ZoneDescriptorList.size() - 1 ) )
m_ZoneDescriptorList.insert( m_ZoneDescriptorList.begin() + iarea + 1, new_area );
......@@ -284,7 +284,7 @@ int BOARD::ClipAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList,
{
wxString str;
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( "such as adding cutouts. It can't be fixed automatically.\n" );
str += wxT( "Manual correction is recommended." );
......@@ -307,7 +307,7 @@ int BOARD::ClipAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList,
{
wxString str;
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( "If the area is complex, this may take a few seconds." );
wxMessageBox( str );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment