summaryrefslogtreecommitdiff
path: root/app/bin/dcmpnd.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2024-07-03 10:19:30 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2024-07-03 10:19:30 +0200
commita14a7a0ccc9de76aeab0b2e4bbf58f1a79deedc2 (patch)
treee469179df67a0e0db49161a43cbf8076a189f6f4 /app/bin/dcmpnd.c
parent5d2c2b27a6323e2666378b986129b2a7c2c39e5c (diff)
New upstream version 5.3.0GAupstream/5.3.0GAupstream
Diffstat (limited to 'app/bin/dcmpnd.c')
-rw-r--r--app/bin/dcmpnd.c294
1 files changed, 173 insertions, 121 deletions
diff --git a/app/bin/dcmpnd.c b/app/bin/dcmpnd.c
index b86ab7b..9b7dfcc 100644
--- a/app/bin/dcmpnd.c
+++ b/app/bin/dcmpnd.c
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "compound.h"
@@ -28,6 +28,7 @@
#include "include/paramfile.h"
#include "shrtpath.h"
#include "track.h"
+#include "trkendpt.h"
#include "common-ui.h"
/*****************************************************************************
@@ -42,11 +43,11 @@ static updateType_e updateListType;
static BOOL_T updateWVisible;
static BOOL_T updateWStale;
typedef struct {
- updateType_e type;
- SCALEINX_T scale;
- char * old;
- char * new;
- } updateTitleElement;
+ updateType_e type;
+ SCALEINX_T scale;
+ char * old;
+ char * new;
+} updateTitleElement;
static dynArr_t updateTitles_da;
#define updateTitles(N) DYNARR_N( updateTitleElement, updateTitles_da, N )
@@ -69,24 +70,29 @@ static paramData_t updateTitlePLs[] = {
{ PD_DROPLIST, NULL, "sel", PDO_NOPREF, I2VP(400) },
{ PD_BUTTON, UpdateTitleIgnore, "ignore", PDO_DLGCMDBUTTON, NULL, N_("Ignore") },
#define I_UPDATELOAD (12)
- { PD_BUTTON, NULL, "load", 0, NULL, N_("Load") } };
+ { PD_BUTTON, NULL, "load", 0, NULL, N_("Load") }
+};
static paramGroup_t updateTitlePG = { "updatetitle", 0, updateTitlePLs, COUNT( updateTitlePLs ) };
static void UpdateTitleChange( long changes )
{
- if ( (changes & (CHANGE_SCALE|CHANGE_PARAMS)) == 0 )
+ if ( (changes & (CHANGE_SCALE|CHANGE_PARAMS)) == 0 ) {
return;
+ }
if (!updateWVisible) {
updateWStale = TRUE;
return;
}
wControlShow( (wControl_p)updateTitleL, FALSE );
wListClear( updateTitleL );
- if (updateTitles(updateTitleInx).type == updateTurnout)
- TurnoutAdd( listLabels, updateTitles(updateTitleInx).scale, updateTitleL, NULL, -1 );
- else
- StructAdd( listLabels, updateTitles(updateTitleInx).scale, updateTitleL, NULL );
+ if (updateTitles(updateTitleInx).type == updateTurnout) {
+ TurnoutAdd( listLabels, updateTitles(updateTitleInx).scale, updateTitleL, NULL,
+ -1 );
+ } else {
+ StructAdd( listLabels, updateTitles(updateTitleInx).scale, updateTitleL,
+ NULL );
+ }
wControlShow( (wControl_p)updateTitleL, TRUE );
updateListType = updateTitles(updateTitleInx).type;
}
@@ -112,7 +118,7 @@ static void UpdateTitleNext( void )
xx = GET_EXTRA_DATA(trk, trkType, extraDataCompound_t);
for (inx=0; inx<updateTitles_da.cnt; inx++) {
if ( updateTitles(inx).old &&
- strcmp( xx->title, updateTitles(inx).old ) == 0 ) {
+ strcmp( xx->title, updateTitles(inx).old ) == 0 ) {
xx->title = MyStrdup( updateTitles(inx).new );
break;
}
@@ -126,9 +132,11 @@ static void UpdateTitleNext( void )
DoChangeNotification( CHANGE_MAIN );
return;
}
- ParamLoadMessage( &updateTitlePG, I_UPDATESTR, updateTitles(updateTitleInx).old );
- if (updateWStale || updateTitles(updateTitleInx).type != updateListType)
+ ParamLoadMessage( &updateTitlePG, I_UPDATESTR,
+ updateTitles(updateTitleInx).old );
+ if (updateWStale || updateTitles(updateTitleInx).type != updateListType) {
UpdateTitleChange( CHANGE_SCALE|CHANGE_PARAMS );
+ }
}
@@ -160,12 +168,15 @@ static void UpdateTitleCancel( wWin_p junk )
void DoUpdateTitles( void )
{
- if (updateTitles_da.cnt <= 0)
+ if (updateTitles_da.cnt <= 0) {
return;
+ }
if (updateTitleW == NULL) {
ParamRegister( &updateTitlePG );
updateTitlePLs[I_UPDATELOAD].valueP = ParamFilesInit();
- updateTitleW = ParamCreateDialog( &updateTitlePG, MakeWindowTitle(_("Update Title")), _("Update"), UpdateTitleUpdate, UpdateTitleCancel, TRUE, NULL, 0, NULL );
+ updateTitleW = ParamCreateDialog( &updateTitlePG,
+ MakeWindowTitle(_("Update Title")), _("Update"), UpdateTitleUpdate,
+ UpdateTitleCancel, TRUE, NULL, 0, NULL );
RegisterChangeNotification( UpdateTitleChange );
}
updateTitleInx = -1;
@@ -176,13 +187,14 @@ void DoUpdateTitles( void )
}
EXPORT void UpdateTitleMark(
- char * title,
- SCALEINX_T scale )
+ char * title,
+ SCALEINX_T scale )
{
int inx;
updateTitleElement * ut;
- if ( inPlayback )
+ if ( inPlayback ) {
return;
+ }
for (inx=0; inx<updateTitles_da.cnt; inx++) {
if (strcmp(title,updateTitles(inx).old) == 0) {
return;
@@ -190,10 +202,11 @@ EXPORT void UpdateTitleMark(
}
DYNARR_APPEND( updateTitleElement, updateTitles_da, 10 );
ut = &updateTitles(updateTitles_da.cnt-1);
- if ( tempEndPts_da.cnt > 0)
+ if ( TempEndPtsCount() > 0) {
ut->type = updateTurnout;
- else
+ } else {
ut->type = updateStructure;
+ }
ut->scale = scale;
ut->old = MyStrdup(title);
ut->new = NULL;
@@ -206,14 +219,15 @@ EXPORT void UpdateTitleMark(
*/
static BOOL_T CheckCompoundEndPoint(
- track_p trk,
- EPINX_T trkEp,
- turnoutInfo_t * to,
- EPINX_T toEp,
- BOOL_T flip )
+ track_p trk,
+ EPINX_T trkEp,
+ turnoutInfo_t * to,
+ EPINX_T toEp,
+ BOOL_T flip )
{
-
- struct extraDataCompound_t *xx = GET_EXTRA_DATA(trk, T_TURNOUT, extraDataCompound_t);
+
+ struct extraDataCompound_t *xx = GET_EXTRA_DATA(trk, T_TURNOUT,
+ extraDataCompound_t);
coOrd pos;
DIST_T d;
ANGLE_T a, a2;
@@ -221,20 +235,24 @@ static BOOL_T CheckCompoundEndPoint(
Rotate( &pos, xx->orig, -xx->angle );
pos.x -= xx->orig.x;
pos.y -= xx->orig.y;
- if ( flip )
+ if ( flip ) {
pos.y = - pos.y;
- d = FindDistance( pos, to->endPt[toEp].pos );
+ }
+ d = FindDistance( pos, GetEndPtPos(EndPtIndex(to->endPt,toEp)));
if ( d > connectDistance ) {
- sprintf( message, _("End-Point #%d of the selected and actual turnouts are not close"), toEp );
+ sprintf( message,
+ _("End-Point #%d of the selected and actual turnouts are not close"), toEp );
return FALSE;
}
a = GetTrkEndAngle( trk, trkEp );
- a2 = to->endPt[toEp].angle;
- if ( flip )
+ a2 = GetEndPtAngle(EndPtIndex(to->endPt,toEp));
+ if ( flip ) {
a2 = 180.0 - a2;
+ }
a = NormalizeAngle( a - xx->angle - a2 + connectAngle/2.0 );
if ( a > connectAngle ) {
- sprintf( message, _("End-Point #%d of the selected and actual turnouts are not aligned"), toEp );
+ sprintf( message,
+ _("End-Point #%d of the selected and actual turnouts are not aligned"), toEp );
return FALSE;
}
return TRUE;
@@ -243,8 +261,8 @@ static BOOL_T CheckCompoundEndPoint(
int refreshCompoundCnt;
static BOOL_T RefreshCompound1(
- track_p trk,
- turnoutInfo_t * to )
+ track_p trk,
+ turnoutInfo_t * to )
{
EPINX_T ep, epCnt;
BOOL_T ok;
@@ -252,7 +270,8 @@ static BOOL_T RefreshCompound1(
epCnt = GetTrkEndPtCnt(trk);
if ( epCnt != to->endCnt ) {
- strcpy( message, _("The selected Turnout had a differing number of End-Points") );
+ strcpy( message,
+ _("The selected Turnout had a differing number of End-Points") );
return FALSE;
}
ok = TRUE;
@@ -263,24 +282,25 @@ static BOOL_T RefreshCompound1(
}
if ( !ok ) {
if ( ep > 0 && epCnt == 2 &&
- CheckCompoundEndPoint( trk, 1, to, 1, TRUE ) ) {
+ CheckCompoundEndPoint( trk, 1, to, 1, TRUE ) ) {
flip = TRUE;
ok = TRUE;
} else if ( ep > 0 && epCnt == 3 &&
- CheckCompoundEndPoint( trk, 1, to, 2, FALSE ) &&
- CheckCompoundEndPoint( trk, 2, to, 1, FALSE ) ) {
+ CheckCompoundEndPoint( trk, 1, to, 2, FALSE ) &&
+ CheckCompoundEndPoint( trk, 2, to, 1, FALSE ) ) {
ok = TRUE;
} else if ( ep > 0 && epCnt == 4 &&
- CheckCompoundEndPoint( trk, 1, to, 3, FALSE ) &&
- CheckCompoundEndPoint( trk, 2, to, 2, FALSE ) &&
- CheckCompoundEndPoint( trk, 3, to, 1, FALSE ) ) {
+ CheckCompoundEndPoint( trk, 1, to, 3, FALSE ) &&
+ CheckCompoundEndPoint( trk, 2, to, 2, FALSE ) &&
+ CheckCompoundEndPoint( trk, 3, to, 1, FALSE ) ) {
ok = TRUE;
} else {
return FALSE;
}
}
UndoModify( trk );
- struct extraDataCompound_t *xx = GET_EXTRA_DATA(trk, T_NOTRACK, extraDataCompound_t);
+ struct extraDataCompound_t *xx = GET_EXTRA_DATA(trk, T_NOTRACK,
+ extraDataCompound_t);
FreeFilledDraw( xx->segCnt, xx->segs );
MyFree( xx->segs );
xx->segCnt = to->segCnt;
@@ -289,8 +309,9 @@ static BOOL_T RefreshCompound1(
xx->pathOverRide = to->pathOverRide;
xx->pathNoCombine = to->pathNoCombine;
SetPaths( trk, GetParamPaths(to) );
- if ( flip )
+ if ( flip ) {
FlipSegs( xx->segCnt, xx->segs, zero, 90.0 );
+ }
ClrTrkBits( trk, TB_SELECTED );
refreshCompoundCnt++;
CloneFilledDraw( xx->segCnt, xx->segs, FALSE );
@@ -299,9 +320,9 @@ static BOOL_T RefreshCompound1(
typedef struct {
- char * name;
- turnoutInfo_t * to;
- } refreshSpecial_t;
+ char * name;
+ turnoutInfo_t * to;
+} refreshSpecial_t;
static dynArr_t refreshSpecial_da;
#define refreshSpecial(N) DYNARR_N( refreshSpecial_t, refreshSpecial_da, N )
static wIndex_t refreshSpecialInx;
@@ -310,37 +331,38 @@ static void RefreshSkip( void * junk );
static paramListData_t refreshSpecialListData = { 30, 600, 0, NULL, NULL };
static paramData_t refreshSpecialPLs[] = {
#define REFRESH_M1 (0)
- { PD_MESSAGE, NULL, NULL, 0/*PDO_DLGRESIZEW*/, I2VP(380) },
+ { PD_MESSAGE, NULL, NULL, 0/*PDO_DLGRESIZEW*/, I2VP(380) },
#define REFRESH_M2 (1)
- { PD_MESSAGE, NULL, NULL, 0/*PDO_DLGRESIZEW*/, I2VP(380) },
+ { PD_MESSAGE, NULL, NULL, 0/*PDO_DLGRESIZEW*/, I2VP(380) },
#define REFRESH_S (2)
- { PD_MESSAGE, NULL, NULL, 0/*PDO_DLGRESIZEW*/, I2VP(380) },
+ { PD_MESSAGE, NULL, NULL, 0/*PDO_DLGRESIZEW*/, I2VP(380) },
#define REFRESH_L (3)
- { PD_LIST, &refreshSpecialInx, "list", PDO_LISTINDEX|PDO_NOPREF|PDO_DLGRESIZE, &refreshSpecialListData, NULL, BO_READONLY },
- { PD_BUTTON, RefreshSkip, "skip", PDO_DLGCMDBUTTON, NULL, N_("Skip") } };
+ { PD_LIST, &refreshSpecialInx, "list", PDO_LISTINDEX|PDO_NOPREF|PDO_DLGRESIZE, &refreshSpecialListData, NULL, BO_READONLY },
+ { PD_BUTTON, RefreshSkip, "skip", PDO_DLGCMDBUTTON, NULL, N_("Skip") }
+};
static paramGroup_t refreshSpecialPG = { "refreshSpecial", 0, refreshSpecialPLs, COUNT( refreshSpecialPLs ) };
static void RefreshSpecialOk(
- void * junk )
+ void * junk )
{
wHide( refreshSpecialPG.win );
}
static void RefreshSpecialCancel(
- wWin_p win )
+ wWin_p win )
{
refreshSpecialInx = -1;
refreshReturnVal = FALSE;
wHide( refreshSpecialPG.win );
}
static void RefreshSkip(
- void * junk )
+ void * junk )
{
refreshSpecialInx = -1;
wHide( refreshSpecialPG.win );
}
EXPORT BOOL_T RefreshCompound(
- track_p trk,
- BOOL_T junk )
+ track_p trk,
+ BOOL_T junk )
{
TRKTYP_T trkType;
struct extraDataCompound_t *xx;
@@ -353,8 +375,9 @@ EXPORT BOOL_T RefreshCompound(
refreshCompoundCnt = 0;
for ( inx=0; inx<refreshSpecial_da.cnt; inx++ )
if ( refreshSpecial(inx).name != NULL &&
- refreshSpecial(inx).to == NULL )
+ refreshSpecial(inx).to == NULL ) {
refreshSpecial(inx).name = NULL;
+ }
return FALSE;
}
trkType = GetTrkType(trk);
@@ -367,13 +390,14 @@ EXPORT BOOL_T RefreshCompound(
refreshReturnVal = TRUE;
for ( inx=0; inx<refreshSpecial_da.cnt; inx++ ) {
if ( refreshSpecial(inx).name != NULL &&
- strcasecmp( xx->title, refreshSpecial(inx).name ) == 0 ) {
+ strcasecmp( xx->title, refreshSpecial(inx).name ) == 0 ) {
to = refreshSpecial(inx).to;
- if ( to == NULL )
+ if ( to == NULL ) {
return TRUE;
+ }
if ( IsParamValid(to->paramFileIndex) &&
- to->segCnt > 0 &&
- (FIT_NONE != CompatibleScale( GetTrkEndPtCnt(trk)>0, to->scaleInx, scale ) )) {
+ to->segCnt > 0 &&
+ (FIT_NONE != CompatibleScale( GetTrkEndPtCnt(trk)>0, to->scaleInx, scale ) )) {
if ( RefreshCompound1( trk, refreshSpecial(inx).to ) ) {
if ( strcasecmp( xx->title, to->title ) != 0 ) {
MyFree( xx->title );
@@ -384,24 +408,32 @@ EXPORT BOOL_T RefreshCompound(
}
}
}
- if ( ( to = FindCompound( FIND_TURNOUT|FIND_STRUCT, NULL, xx->title ) ) != NULL &&
- RefreshCompound1( trk, to ) )
+ if ( ( to = FindCompound( FIND_TURNOUT|FIND_STRUCT, NULL, xx->title ) ) != NULL
+ &&
+ RefreshCompound1( trk, to ) ) {
return TRUE;
+ }
if ( refreshSpecialPG.win == NULL ) {
ParamRegister( &refreshSpecialPG );
- ParamCreateDialog( &refreshSpecialPG, MakeWindowTitle(_("Refresh Turnout/Structure")), _("Ok"), RefreshSpecialOk, RefreshSpecialCancel, TRUE, NULL, F_BLOCK|F_RESIZE|F_RECALLSIZE, NULL );
+ ParamCreateDialog( &refreshSpecialPG,
+ MakeWindowTitle(_("Refresh Turnout/Structure")), _("Ok"), RefreshSpecialOk,
+ RefreshSpecialCancel, TRUE, NULL, F_BLOCK|F_RESIZE|F_RECALLSIZE, NULL );
}
- ParamLoadMessage( &refreshSpecialPG, REFRESH_M1, _("Choose a Turnout/Structure to replace:") );
+ ParamLoadMessage( &refreshSpecialPG, REFRESH_M1,
+ _("Choose a Turnout/Structure to replace:") );
ParamLoadMessage( &refreshSpecialPG, REFRESH_M2, "" );
refreshSpecialInx = -1;
wListClear( (wList_p)refreshSpecialPLs[REFRESH_L].control );
- if ( GetTrkEndPtCnt(trk) > 0 )
- to = TurnoutAdd( listLabels, scale, (wList_p)refreshSpecialPLs[REFRESH_L].control, NULL, GetTrkEndPtCnt(trk) );
- else
- to = StructAdd( listLabels, scale, (wList_p)refreshSpecialPLs[REFRESH_L].control, NULL );
+ if ( GetTrkEndPtCnt(trk) > 0 ) {
+ to = TurnoutAdd( listLabels, scale,
+ (wList_p)refreshSpecialPLs[REFRESH_L].control, NULL, GetTrkEndPtCnt(trk) );
+ } else {
+ to = StructAdd( listLabels, scale,
+ (wList_p)refreshSpecialPLs[REFRESH_L].control, NULL );
+ }
if ( to == NULL ) {
NoticeMessage( MSG_NO_TURNOUTS_AVAILABLE, _("Ok"), NULL,
- GetTrkEndPtCnt(trk)>0 ? _("Turnouts") : _("Structures") );
+ GetTrkEndPtCnt(trk)>0 ? _("Turnouts") : _("Structures") );
return FALSE;
}
FormatCompoundTitle( listLabels, xx->title );
@@ -417,9 +449,10 @@ EXPORT BOOL_T RefreshCompound(
}
return refreshReturnVal;
}
- to = (turnoutInfo_t*)wListGetItemContext( (wList_p)refreshSpecialPLs[REFRESH_L].control, refreshSpecialInx );
+ to = (turnoutInfo_t*)wListGetItemContext( (wList_p)
+ refreshSpecialPLs[REFRESH_L].control, refreshSpecialInx );
if ( to != NULL &&
- RefreshCompound1( trk, to ) ) {
+ RefreshCompound1( trk, to ) ) {
DYNARR_APPEND( refreshSpecial_t, refreshSpecial_da, 10 );
refreshSpecial(refreshSpecial_da.cnt-1).to = to;
refreshSpecial(refreshSpecial_da.cnt-1).name = MyStrdup( xx->title );
@@ -430,7 +463,8 @@ EXPORT BOOL_T RefreshCompound(
return TRUE;
}
ParamLoadMessage( &refreshSpecialPG, REFRESH_M1, message );
- ParamLoadMessage( &refreshSpecialPG, REFRESH_M2, _("Choose another Turnout/Structure to replace:") );
+ ParamLoadMessage( &refreshSpecialPG, REFRESH_M2,
+ _("Choose another Turnout/Structure to replace:") );
}
}
@@ -446,14 +480,15 @@ static char renamePartno[STR_SIZE];
static turnoutInfo_t * renameTo;
static paramData_t renamePLs[] = {
-/*0*/ { PD_STRING, renameManuf, "manuf", PDO_NOPREF | PDO_NOTBLANK, I2VP(350), N_("Manufacturer"), 0, 0, sizeof(renameManuf)},
-/*1*/ { PD_STRING, renameDesc, "desc", PDO_NOPREF | PDO_NOTBLANK, I2VP(230), N_("Description"), 0, 0, sizeof(renameDesc)},
-/*2*/ { PD_STRING, renamePartno, "partno", PDO_NOPREF|PDO_DLGHORZ|PDO_DLGIGNORELABELWIDTH | PDO_NOTBLANK, I2VP(100), N_("#"), 0, 0, sizeof(renamePartno)} };
+ /*0*/ { PD_STRING, renameManuf, "manuf", PDO_NOPREF | PDO_NOTBLANK, I2VP(350), N_("Manufacturer"), 0, 0, sizeof(renameManuf)},
+ /*1*/ { PD_STRING, renameDesc, "desc", PDO_NOPREF | PDO_NOTBLANK, I2VP(230), N_("Description"), 0, 0, sizeof(renameDesc)},
+ /*2*/ { PD_STRING, renamePartno, "partno", PDO_NOPREF|PDO_DLGHORZ|PDO_DLGIGNORELABELWIDTH | PDO_NOTBLANK, I2VP(100), N_("#"), 0, 0, sizeof(renamePartno)}
+};
static paramGroup_t renamePG = { "rename", 0, renamePLs, COUNT( renamePLs ) };
EXPORT BOOL_T CompoundCustomSave(
- FILE * f )
+ FILE * f )
{
int inx;
turnoutInfo_t * to;
@@ -462,19 +497,24 @@ EXPORT BOOL_T CompoundCustomSave(
for ( inx=0; inx<turnoutInfo_da.cnt; inx++ ) {
to = turnoutInfo(inx);
if (to->paramFileIndex == PARAM_CUSTOM && to->segCnt > 0) {
- rc &= fprintf( f, "TURNOUT %s \"%s\"\n", GetScaleName(to->scaleInx), PutTitle(to->title) )>0;
- if ( to->customInfo )
+ rc &= fprintf( f, "TURNOUT %s \"%s\"\n", GetScaleName(to->scaleInx),
+ PutTitle(to->title) )>0;
+ if ( to->customInfo ) {
rc &= fprintf( f, "\tU %s\n",to->customInfo )>0;
- rc &= WriteCompoundPathsEndPtsSegs( f, GetParamPaths( to ), to->segCnt, to->segs,
- to->endCnt, to->endPt );
+ }
+ rc &= WriteCompoundPathsEndPtsSegs( f, GetParamPaths( to ), to->segCnt,
+ to->segs,
+ to->endCnt, to->endPt );
}
}
for ( inx=0; inx<structureInfo_da.cnt; inx++ ) {
to = structureInfo(inx);
if (to->paramFileIndex == PARAM_CUSTOM && to->segCnt > 0) {
- rc &= fprintf( f, "STRUCTURE %s \"%s\"\n", GetScaleName(to->scaleInx), PutTitle(to->title) )>0;
- if ( to->customInfo )
+ rc &= fprintf( f, "STRUCTURE %s \"%s\"\n", GetScaleName(to->scaleInx),
+ PutTitle(to->title) )>0;
+ if ( to->customInfo ) {
rc &= fprintf( f, "\tU %s\n",to->customInfo )>0;
+ }
rc &= WriteSegs( f, to->segCnt, to->segs );
}
}
@@ -485,8 +525,9 @@ EXPORT BOOL_T CompoundCustomSave(
static void RenameOk( void * junk )
{
sprintf( message, "%s\t%s\t%s", renameManuf, renameDesc, renamePartno );
- if ( renameTo->title )
+ if ( renameTo->title ) {
MyFree( renameTo->title );
+ }
renameTo->title = MyStrdup( message );
wHide( renamePG.win );
DoChangeNotification( CHANGE_PARAMS );
@@ -494,8 +535,8 @@ static void RenameOk( void * junk )
static int CompoundCustMgmProc(
- int cmd,
- void * data )
+ int cmd,
+ void * data )
{
turnoutInfo_t * to = (turnoutInfo_t*)data;
turnoutInfo_t * to2=NULL;
@@ -506,19 +547,24 @@ static int CompoundCustMgmProc(
switch ( cmd ) {
case CUSTMGM_DO_COPYTO:
- if ( to->segCnt <= 0 )
+ if ( to->segCnt <= 0 ) {
return TRUE;
+ }
if ( to->endCnt ) {
- rc &= fprintf( customMgmF, "TURNOUT %s \"%s\"\n", GetScaleName(to->scaleInx), PutTitle(to->title) )>0;
- if ( to->customInfo )
+ rc &= fprintf( customMgmF, "TURNOUT %s \"%s\"\n", GetScaleName(to->scaleInx),
+ PutTitle(to->title) )>0;
+ if ( to->customInfo ) {
rc &= fprintf( customMgmF, "\tU %s\n",to->customInfo )>0;
- rc &= WriteCompoundPathsEndPtsSegs( customMgmF,
- GetParamPaths( to ), to->segCnt, to->segs,
- to->endCnt, to->endPt );
+ }
+ rc &= WriteCompoundPathsEndPtsSegs( customMgmF,
+ GetParamPaths( to ), to->segCnt, to->segs,
+ to->endCnt, to->endPt );
} else {
- rc &= fprintf( customMgmF, "STRUCTURE %s \"%s\"\n", GetScaleName(to->scaleInx), PutTitle(to->title) )>0;
- if ( to->customInfo )
+ rc &= fprintf( customMgmF, "STRUCTURE %s \"%s\"\n", GetScaleName(to->scaleInx),
+ PutTitle(to->title) )>0;
+ if ( to->customInfo ) {
rc &= fprintf( customMgmF, "\tU %s\n",to->customInfo )>0;
+ }
rc &= WriteSegs( customMgmF, to->segCnt, to->segs );
}
return rc;
@@ -533,23 +579,24 @@ static int CompoundCustMgmProc(
strncpy( renamePartno, nP, nL ); renamePartno[nL] = 0;
if ( !renamePG.win ) {
ParamRegister( &renamePG );
- ParamCreateDialog( &renamePG, MakeWindowTitle(_("Rename Object")), _("Ok"), RenameOk, wHide, TRUE, NULL, F_BLOCK, NULL );
+ ParamCreateDialog( &renamePG, MakeWindowTitle(_("Rename Object")), _("Ok"),
+ RenameOk, wHide, TRUE, NULL, F_BLOCK, NULL );
}
ParamLoadControls( &renamePG );
wShow( renamePG.win );
} else {
- for (inx=0; inx<turnoutInfo_da.cnt && to!=turnoutInfo(inx); inx++);
- if ( inx > 0 &&
- turnoutInfo(inx-1)->customInfo &&
- strcmp( to->customInfo, turnoutInfo(inx-1)->customInfo ) == 0 ) {
- to2 = to;
- to = turnoutInfo(inx-1);
- } else if ( inx < turnoutInfo_da.cnt-1 &&
- turnoutInfo(inx+1)->customInfo &&
- strcmp( to->customInfo, turnoutInfo(inx+1)->customInfo ) == 0 ) {
- to2 = turnoutInfo(inx+1);
- }
- EditCustomTurnout( to, to2 );
+ for (inx=0; inx<turnoutInfo_da.cnt && to!=turnoutInfo(inx); inx++);
+ if ( inx > 0 &&
+ turnoutInfo(inx-1)->customInfo &&
+ strcmp( to->customInfo, turnoutInfo(inx-1)->customInfo ) == 0 ) {
+ to2 = to;
+ to = turnoutInfo(inx-1);
+ } else if ( inx < turnoutInfo_da.cnt-1 &&
+ turnoutInfo(inx+1)->customInfo &&
+ strcmp( to->customInfo, turnoutInfo(inx+1)->customInfo ) == 0 ) {
+ to2 = turnoutInfo(inx+1);
+ }
+ EditCustomTurnout( to, to2 );
}
return TRUE;
case CUSTMGM_CAN_DELETE:
@@ -559,15 +606,16 @@ static int CompoundCustMgmProc(
return TRUE;
case CUSTMGM_GET_TITLE:
ParseCompoundTitle( to->title, &mP, &mL, &pP, &pL, &nP, &nL );
- sprintf( message, "\t%.*s\t%s\t%.*s\t%.*s", mL, mP, GetScaleName(to->scaleInx), nL, nP, pL, pP );
+ sprintf( message, "\t%.*s\t%s\t%.*s\t%.*s", mL, mP, GetScaleName(to->scaleInx),
+ nL, nP, pL, pP );
return TRUE;
}
return FALSE;
}
-#include "bitmaps/turnout.xpm"
-#include "bitmaps/building.xpm"
+#include "bitmaps/turnout.xpm3"
+#include "bitmaps/building.xpm3"
EXPORT void CompoundCustMgmLoad( void )
{
@@ -576,10 +624,12 @@ EXPORT void CompoundCustMgmLoad( void )
static wIcon_p turnoutI = NULL;
static wIcon_p structI = NULL;
- if ( turnoutI == NULL )
- turnoutI = wIconCreatePixMap( turnout_xpm[0] );
- if ( structI == NULL )
- structI = wIconCreatePixMap( building_xpm[0] );
+ if ( turnoutI == NULL ) {
+ turnoutI = wIconCreatePixMap( turnout_xpm3[0] );
+ }
+ if ( structI == NULL ) {
+ structI = wIconCreatePixMap( building_xpm3[0] );
+ }
for ( inx=0; inx<turnoutInfo_da.cnt; inx++ ) {
to = turnoutInfo(inx);
@@ -602,13 +652,15 @@ EXPORT void CompoundCustMgmLoad( void )
*/
wIndex_t FindListItemByContext(
- wList_p listP,
- void * context )
+ wList_p listP,
+ void * context )
{
- if ( listP == NULL )
+ if ( listP == NULL ) {
return -1;
- if ( context == NULL )
+ }
+ if ( context == NULL ) {
return -1;
+ }
for ( wIndex_t inx = 0; inx < wListGetCount( listP ); ++inx ) {
void * itemContext = wListGetItemContext( listP, inx );
if ( itemContext != NULL ) {