From 16e9630b79f0a7a90c6cedb6781175bb8b337dc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 29 Apr 2017 12:11:08 +0200 Subject: New upstream version 4.3.0 --- app/bin/fileio.c | 193 ++----------------------------------------------------- 1 file changed, 6 insertions(+), 187 deletions(-) (limited to 'app/bin/fileio.c') diff --git a/app/bin/fileio.c b/app/bin/fileio.c index 23216b8..da0de68 100644 --- a/app/bin/fileio.c +++ b/app/bin/fileio.c @@ -1,6 +1,6 @@ /** \file fileio.c - * Loading and saving files. Handles trackplans as well as DXF export. - */ + * Loading and saving files. Handles trackplans, XTrackCAD exports and cut/paste +*/ /* XTrkCad - Model Railroad CAD * Copyright (C) 2005 Dave Bullis @@ -1039,7 +1039,7 @@ static int SaveTracks( wMenuListAdd( fileList_ml, 0, nameOfFile, MyStrdup(fileName[ 0 ]) ); checkPtMark = changed = 0; - if (curPathName != fileName[ 0 ]) + if (strcmp(curPathName, fileName[ 0 ])) strcpy( curPathName, fileName[ 0 ] ); curFileName = FindName( curPathName ); @@ -1053,13 +1053,14 @@ static int SaveTracks( EXPORT void DoSave( doSaveCallBack_p after ) { doAfterSave = after; - if (curPathName[0] == 0) { + if (curPathName[0] == '\0') { if (saveFile_fs == NULL) saveFile_fs = wFilSelCreate( mainW, FS_SAVE, 0, _("Save Tracks"), sSourceFilePattern, SaveTracks, NULL ); wFilSelect( saveFile_fs, curDirName ); } else { - SaveTracks( 1, &curFileName, NULL ); + char *temp = curPathName; + SaveTracks( 1, &temp, NULL ); } SetWindowTitle(); } @@ -1224,7 +1225,6 @@ EXPORT int LoadCheckpoint( void ) static struct wFilSel_t * exportFile_fs; static struct wFilSel_t * importFile_fs; -static struct wFilSel_t * exportDXFFile_fs; static int ImportTracks( @@ -1330,187 +1330,6 @@ EXPORT void DoExport( void ) } -static FILE * dxfF; -static void DxfLine( - drawCmd_p d, - coOrd p0, - coOrd p1, - wDrawWidth width, - wDrawColor color ) -{ - fprintf(dxfF, " 0\nLINE\n" ); - fprintf(dxfF, " 8\n%s%d\n", sProdNameUpper, curTrackLayer+1 ); - fprintf(dxfF, " 10\n%0.6f\n 20\n%0.6f\n 11\n%0.6f\n 21\n%0.6f\n", - p0.x, p0.y, p1.x, p1.y ); - fprintf(dxfF, " 6\n%s\n", (d->options&DC_DASH)?"DASHED":"CONTINUOUS" ); -} - -static void DxfArc( - drawCmd_p d, - coOrd p, - DIST_T r, - ANGLE_T angle0, - ANGLE_T angle1, - BOOL_T drawCenter, - wDrawWidth width, - wDrawColor color ) -{ - angle0 = NormalizeAngle(90.0-(angle0+angle1)); - if (angle1 >= 360.0) { - fprintf(dxfF, " 0\nCIRCLE\n" ); - fprintf(dxfF, " 10\n%0.6f\n 20\n%0.6f\n 40\n%0.6f\n", - p.x, p.y, r ); - } else { - fprintf(dxfF, " 0\nARC\n" ); - fprintf(dxfF, " 10\n%0.6f\n 20\n%0.6f\n 40\n%0.6f\n 50\n%0.6f\n 51\n%0.6f\n", - p.x, p.y, r, angle0, angle0+angle1 ); - } - fprintf(dxfF, " 8\n%s%d\n", sProdNameUpper, curTrackLayer+1 ); - fprintf(dxfF, " 6\n%s\n", (d->options&DC_DASH)?"DASHED":"CONTINUOUS" ); -} - -static void DxfString( - drawCmd_p d, - coOrd p, - ANGLE_T a, - char * s, - wFont_p fp, - FONTSIZE_T fontSize, - wDrawColor color ) -{ - fprintf(dxfF, " 0\nTEXT\n" ); - fprintf(dxfF, " 1\n%s\n", s ); - fprintf(dxfF, " 8\n%s%d\n", sProdNameUpper, curTrackLayer+1 ); - fprintf(dxfF, " 10\n%0.6f\n 20\n%0.6f\n", p.x, p.y ); - fprintf(dxfF, " 40\n%0.6f\n", fontSize/72.0 ); -} - -static void DxfBitMap( - drawCmd_p d, - coOrd p, - wDrawBitMap_p bm, - wDrawColor color ) -{ -} - -static void DxfFillPoly( - drawCmd_p d, - int cnt, - coOrd * pts, - wDrawColor color ) -{ - int inx; - for (inx=1; inx