Minor fixes related to timestamp_t. Move timestamp_t definition to base_struct.h

This commit is contained in:
jean-pierre charras 2017-12-07 11:11:24 +01:00
parent 3f57fa5d24
commit bfc3804115
5 changed files with 19 additions and 23 deletions

View File

@ -502,10 +502,10 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
// Duplicate sheet names and sheet time stamps are not valid. Use a time stamp
// based sheet name and update the time stamp for each sheet in the block.
unsigned long timeStamp = (unsigned long)GetNewTimeStamp();
timestamp_t timeStamp = GetNewTimeStamp();
sheet->SetName( wxString::Format( wxT( "sheet%8.8lX" ), timeStamp ) );
sheet->SetTimeStamp( (timestamp_t)timeStamp );
sheet->SetName( wxString::Format( wxT( "sheet%8.8lX" ), (unsigned long)timeStamp ) );
sheet->SetTimeStamp( timeStamp );
}
}

View File

@ -615,7 +615,7 @@ bool SCH_EDIT_FRAME::AppendSchematic()
timestamp_t newtimestamp = GetNewTimeStamp();
renamedSheet->SetTimeStamp( newtimestamp );
renamedSheet->SetName( wxString::Format( "Sheet%8.8lX", (long) newtimestamp ) );
renamedSheet->SetName( wxString::Format( "Sheet%8.8lX", (unsigned long) newtimestamp ) );
}
// Clear all annotation in the imported schematic to prevent clashes with existing annotation.

View File

@ -36,7 +36,6 @@
#include <bitmap_types.h>
#include <view/view_item.h>
#include <common.h>
#if defined(DEBUG)
#include <iostream> // needed for Show()
@ -158,6 +157,19 @@ typedef const INSPECTOR_FUNC& INSPECTOR; /// std::function passed to nested u
typedef unsigned STATUS_FLAGS;
/**
* timestamp_t is our type to represent unique IDs for all kinds of elements;
* historically simply the timestamp when they were created.
*
* Long term, this type might be renamed to something like unique_id_t
* (and then rename all the methods from {Get,Set}TimeStamp()
* to {Get,Set}Id()) ?
*
* The type should be at least 32 bit and simple to map via swig; swig does
* have issues with types such as 'int32_t', so we choose 'long'.
*/
typedef long timestamp_t;
/**
* Class EDA_ITEM
* is a base class for most all the KiCad significant classes, used in

View File

@ -38,6 +38,7 @@
#include <wx/confbase.h>
#include <wx/fileconf.h>
#include <base_struct.h> // For timestamp_t definition
#include <richio.h>
#include <gal/color4d.h>
@ -218,23 +219,6 @@ int ProcessExecute( const wxString& aCommandLine, int aFlags = wxEXEC_ASYNC,
wxProcess *callback = NULL );
/**************/
/* common.cpp */
/**************/
/**
* timestamp_t is our type to represent unique IDs for all kinds of elements;
* historically simply the timestamp when they were created.
*
* Long term, this type might be renamed to something like unique_id_t
* (and then rename all the methods from {Get,Set}TimeStamp()
* to {Get,Set}Id()) ?
*
* The type should be at least 32 bit and simple to map via swig; swig does
* have issues with types such as 'int32_t', so we choose 'long'.
*/
typedef long timestamp_t;
/**
* @return an unique time stamp that changes after each call
*/

View File

@ -91,7 +91,7 @@ int main( int argc, char* argv[] )
if( !brd )
return -1;
for( int net = 0; net < brd->GetNetCount(); net++ )
for( unsigned net = 0; net < brd->GetNetCount(); net++ )
{
printf( "net %d\n", net );