diff options
author | scuri <scuri> | 2009-11-30 19:27:33 +0000 |
---|---|---|
committer | scuri <scuri> | 2009-11-30 19:27:33 +0000 |
commit | efe09af4eef72f46dcaf50ced776ef7667a04087 (patch) | |
tree | 2355a4754590e0362a1ba8cf1e069662873c5375 /test/cdtest/drivers.c | |
parent | 4c4866d151bbf664273b74e1cee817633881d38f (diff) |
*** empty log message ***
Diffstat (limited to 'test/cdtest/drivers.c')
-rw-r--r-- | test/cdtest/drivers.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/test/cdtest/drivers.c b/test/cdtest/drivers.c index 93918d5..62e92aa 100644 --- a/test/cdtest/drivers.c +++ b/test/cdtest/drivers.c @@ -32,6 +32,7 @@ extern tCTC ctgc; #define DXF #define DGN #define PDF +#define CDDBG static int LoadCanvas(char* ctx_name, cdContext* ctx, char *filename) { @@ -69,7 +70,7 @@ static int SaveCanvas(char* ctx_name, cdContext* ctx, char *data) canvas = cdCreateCanvas(ctx, data); if (!canvas) { - IupMessage("Error!", "Can not create canvas."); + IupMessagef("Error!", "Could not create canvas of driver %s.", ctx_name); return IUP_DEFAULT; } @@ -327,6 +328,26 @@ static int fPlayMF(void) } #endif +#ifdef CDDBG +#include <cddebug.h> +/*-------------------------------------------------------------------------*/ +/* Copia o conteudo do canvas para um arquivo metafile do CD. */ +/*-------------------------------------------------------------------------*/ +static int fDebug(void) +{ + char filename[1024]="*.mf"; + char data[1000]; + + if (IupGetFile(filename)>=0) + { + sprintf(data, "%s %gx%g %g", filename, ((double)ctgc.w)/ctgc.res, ((double)ctgc.h)/ctgc.res, ctgc.res); + return SaveCanvas("CD_DEBUG", CD_DEBUG, data); + } + + return IUP_DEFAULT; +} +#endif + /*-------------------------------------------------------------------------*/ /* Copia o conteudo do canvas para um arquivo WMF. */ /*-------------------------------------------------------------------------*/ @@ -389,7 +410,6 @@ static int fPrint(void) { char *data = "CDTEST.PRN -d"; return SaveCanvas("CD_PRINTER", CD_PRINTER, data); - return IUP_DEFAULT; } #endif @@ -432,6 +452,9 @@ void DriversInit(void) IupSetAttribute(IupGetHandle("itDGN"), IUP_ACTIVE, IUP_YES); IupSetFunction("cmdDGN", (Icallback) fDGN); #endif +#ifdef CDDBG + IupSetFunction("cmdDebug", (Icallback) fDebug); +#endif #ifdef CGM IupSetAttribute(IupGetHandle("itCGMb"), IUP_ACTIVE, IUP_YES); IupSetFunction("cmdCGMb", (Icallback) fCGMb); |