From 09795a01ef859f072920de9df974d1b03b9ab9a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 28 Dec 2016 20:24:50 +0100 Subject: New upstream version 4.2.4a --- app/bin/macro.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'app/bin/macro.c') diff --git a/app/bin/macro.c b/app/bin/macro.c index 88ee928..2147eff 100644 --- a/app/bin/macro.c +++ b/app/bin/macro.c @@ -1,5 +1,5 @@ -/* - * $Header: /home/dmarkle/xtrkcad-fork-cvs/xtrkcad/app/bin/macro.c,v 1.7 2009-06-15 19:29:57 m_fischer Exp $ +/** \file macro.c + * Macros */ /* XTrkCad - Model Railroad CAD @@ -154,15 +154,17 @@ EXPORT void RecordMouse( char * name, wAction_t action, POS_T px, POS_T py ) } -static int StartRecord( const char * pathName, const char * fileName, void * context ) +static int StartRecord( int cnt, char ** pathName, void * context ) { time_t clock; - if (pathName == NULL) - return TRUE; - SetCurDir( pathName, fileName ); - recordF = fopen(pathName, "w"); + + assert( pathName != NULL ); + assert( cnt == 1 ); + + SetCurrentPath( MACROPATHKEY, pathName[0] ); + recordF = fopen(pathName[0], "w"); if (recordF==NULL) { - NoticeMessage( MSG_OPEN_FAIL, _("Continue"), NULL, _("Recording"), fileName, strerror(errno) ); + NoticeMessage( MSG_OPEN_FAIL, _("Continue"), NULL, _("Recording"), pathName[0], strerror(errno) ); return FALSE; } time(&clock); @@ -484,7 +486,7 @@ static void PlaybackCursor( case C_REDRAW: MacroDrawBitMap( playbackD, playbackBm, playbackX, playbackY, playbackColor ); break; - + default: ; } @@ -1027,7 +1029,7 @@ static void Playback( void ) continue; snapshot_d.dpi=snapshot_d.scale=snapshot_d.orig.x=snapshot_d.orig.y=snapshot_d.size.x=snapshot_d.size.y=-1; cp = paramLine+8; - while (*cp && isspace(*cp)) cp++; + while (*cp && isspace((unsigned char)*cp)) cp++; if (snapshot_d.dpi = strtod( cp, &cq ), cp == cq) snapshot_d.dpi = -1; else if (snapshot_d.scale = strtod( cq, &cp ), cp == cq) @@ -1141,19 +1143,19 @@ static void Playback( void ) } -static int StartPlayback( const char * pathName, const char * fileName, void * context ) +static int StartPlayback( int cnt, char **pathName, void * context ) { - if (pathName == NULL) - return TRUE; + assert( pathName != NULL ); + assert( cnt ==1 ); - SetCurDir( pathName, fileName ); - paramFile = fopen( pathName, "r" ); + SetCurrentPath( MACROPATHKEY, pathName[0] ); + paramFile = fopen( pathName[0], "r" ); if ( paramFile == NULL ) { - NoticeMessage( MSG_OPEN_FAIL, _("Continue"), NULL, _("Playback"), pathName, strerror(errno) ); + NoticeMessage( MSG_OPEN_FAIL, _("Continue"), NULL, _("Playback"), pathName[0], strerror(errno) ); return FALSE; } - strcpy( paramFileName, pathName ); + strcpy( paramFileName, pathName[0] ); PlaybackSetup(); curDemo = -1; @@ -1352,7 +1354,7 @@ static void DemoInitValues( void ) for ( cpp = demoInitParams; *cpp; cpp++ ) paramPlaybackProc( *cpp ); } - + static void DoDemo( void * demoNumber ) { -- cgit v1.2.3