From a14a7a0ccc9de76aeab0b2e4bbf58f1a79deedc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 3 Jul 2024 10:19:30 +0200 Subject: New upstream version 5.3.0GA --- app/bin/dxfoutput.c | 264 +++++++++++++++++++++++++++------------------------- 1 file changed, 139 insertions(+), 125 deletions(-) (limited to 'app/bin/dxfoutput.c') diff --git a/app/bin/dxfoutput.c b/app/bin/dxfoutput.c index 957110e..3988696 100644 --- a/app/bin/dxfoutput.c +++ b/app/bin/dxfoutput.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 @@ -36,114 +36,128 @@ static struct wFilSel_t * exportDXFFile_fs; static void DxfLine( - drawCmd_p d, - coOrd p0, - coOrd p1, - wDrawWidth width, - wDrawColor color) + drawCmd_p d, + coOrd p0, + coOrd p1, + wDrawWidth width, + wDrawColor color) { - DynString command = NaS; - DynStringMalloc(&command, 100); - DxfLineCommand(&command, - curTrackLayer + 1, - p0.x, p0.y, - p1.x, p1.y, - ((d->options&DC_DASH) != 0)); - fputs(DynStringToCStr(&command), (FILE *)d->d); - DynStringFree(&command); + long c = wDrawGetRGB( color ); + long s = d->options & DC_DASH ? 1 : (d->options & DC_DOT ? 2 : 0); + + DynString command = NaS; + DynStringMalloc(&command, 100); + DxfLineCommand(&command, + curTrackLayer + 1, + p0.x, p0.y, + p1.x, p1.y, + s, + c); + fputs(DynStringToCStr(&command), (FILE *)d->d); + DynStringFree(&command); } static void DxfArc( - drawCmd_p d, - coOrd p, - DIST_T r, - ANGLE_T angle0, - ANGLE_T angle1, - BOOL_T drawCenter, - wDrawWidth width, - wDrawColor color) + drawCmd_p d, + coOrd p, + DIST_T r, + ANGLE_T angle0, + ANGLE_T angle1, + BOOL_T drawCenter, + wDrawWidth width, + wDrawColor color) { - DynString command = NaS; - DynStringMalloc(&command, 100); - angle0 = NormalizeAngle(90.0-(angle0+angle1)); - - if (angle1 >= 360.0) { - DxfCircleCommand(&command, - curTrackLayer + 1, - p.x, - p.y, - r, - ((d->options&DC_DASH) != 0)); - } else { - DxfArcCommand(&command, - curTrackLayer + 1, - p.x, - p.y, - r, - angle0, - angle1, - ((d->options&DC_DASH) != 0)); - } - - fputs(DynStringToCStr(&command), (FILE *)d->d); - DynStringFree(&command); + long c = wDrawGetRGB( color ); + long s = d->options & DC_DASH ? 1 : (d->options & DC_DOT ? 2 : 0); + + DynString command = NaS; + DynStringMalloc(&command, 100); + angle0 = NormalizeAngle(90.0-(angle0+angle1)); + + if (angle1 >= 360.0) { + DxfCircleCommand(&command, + curTrackLayer + 1, + p.x, + p.y, + r, + s, + c); + } else { + DxfArcCommand(&command, + curTrackLayer + 1, + p.x, + p.y, + r, + angle0, + angle1, + s, + c); + } + + fputs(DynStringToCStr(&command), (FILE *)d->d); + DynStringFree(&command); } static void DxfString( - drawCmd_p d, - coOrd p, - ANGLE_T a, - char * s, - wFont_p fp, - FONTSIZE_T fontSize, - wDrawColor color) + drawCmd_p d, + coOrd p, + ANGLE_T a, + char * s, + wFont_p fp, + FONTSIZE_T fontSize, + wDrawColor color) { - DynString command = NaS; - DynStringMalloc(&command, 100); - DxfTextCommand(&command, - curTrackLayer + 1, - p.x, - p.y, - fontSize, - s); - fputs(DynStringToCStr(&command), (FILE *)d->d); - DynStringFree(&command); + long c = wDrawGetRGB( color ); + + DynString command = NaS; + DynStringMalloc(&command, 100); + DxfTextCommand(&command, + curTrackLayer + 1, + p.x, + p.y, + fontSize, + s, + c); + fputs(DynStringToCStr(&command), (FILE *)d->d); + DynStringFree(&command); } static void DxfBitMap( - drawCmd_p d, - coOrd p, - wDrawBitMap_p bm, - wDrawColor color) + drawCmd_p d, + coOrd p, + wDrawBitMap_p bm, + wDrawColor color) { } static void DxfPoly( - drawCmd_p d, - int cnt, - coOrd * pts, - int * types, - wDrawColor color, - wDrawWidth width, - drawFill_e eOpts ) + drawCmd_p d, + int cnt, + coOrd * pts, + int * types, + wDrawColor color, + wDrawWidth width, + drawFill_e eOpts ) { - int inx; - - for (inx=1; inx 0); + //if (selectedTrackCount <= 0) { + // ErrorMessage(MSG_NO_SELECTED_TRK); + // return; + //} + CHECK(selectedTrackCount > 0); - if (exportDXFFile_fs == NULL) - exportDXFFile_fs = wFilSelCreate(mainW, FS_SAVE, 0, _("Export to DXF"), - sDXFFilePattern, DoExportDXFTracks, NULL); + if (exportDXFFile_fs == NULL) + exportDXFFile_fs = wFilSelCreate(mainW, FS_SAVE, 0, _("Export to DXF"), + sDXFFilePattern, DoExportDXFTracks, NULL); - wFilSelect(exportDXFFile_fs, GetCurrentPath(DXFPATHKEY)); + wFilSelect(exportDXFFile_fs, GetCurrentPath(DXFPATHKEY)); } -- cgit v1.2.3