summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bltGrLegd.C2
-rw-r--r--src/bltGrPSOutput.C103
-rw-r--r--src/bltGrPSOutput.h18
3 files changed, 12 insertions, 111 deletions
diff --git a/src/bltGrLegd.C b/src/bltGrLegd.C
index a162f63..08c00e8 100644
--- a/src/bltGrLegd.C
+++ b/src/bltGrLegd.C
@@ -1737,7 +1737,7 @@ void Blt_LegendToPostScript(Graph* graphPtr, Blt_Ps ps)
Blt_Ps_Append(ps, "% Legend\n");
graphPtr = legendPtr->graphPtr;
- if (graphPtr->pageSetup->flags & PS_DECORATIONS) {
+ if (graphPtr->pageSetup->decorations) {
if (legendPtr->normalBg)
Blt_Ps_Fill3DRectangle(ps, legendPtr->normalBg, x, y, width, height,
legendPtr->borderWidth, legendPtr->relief);
diff --git a/src/bltGrPSOutput.C b/src/bltGrPSOutput.C
index 2188827..58dcb52 100644
--- a/src/bltGrPSOutput.C
+++ b/src/bltGrPSOutput.C
@@ -48,50 +48,8 @@
#define PS_MAXPATH 1500 /* Maximum number of components in a
* PostScript (level 1) path. */
-#define PICA_MM 2.83464566929
-#define PICA_INCH 72.0
-#define PICA_CM 28.3464566929
-
static Tcl_Interp *psInterp = NULL;
-int Blt_Ps_GetPicaFromObj(Tcl_Interp* interp, Tcl_Obj *objPtr, int *picaPtr)
-{
- char *p;
- double pica;
- const char *string;
-
- string = Tcl_GetString(objPtr);
- pica = strtod((char *)string, &p);
- if (p == string) {
- goto error;
- }
- if (pica < 0.0) {
- goto error;
- }
- while ((*p != '\0') && isspace((unsigned char)(*p))) {
- p++;
- }
- switch (*p) {
- case '\0': break;
- case 'c': pica *= PICA_CM; p++; break;
- case 'i': pica *= PICA_INCH; p++; break;
- case 'm': pica *= PICA_MM; p++; break;
- case 'p': p++; break;
- default: goto error;
- }
- while ((*p != '\0') && isspace((unsigned char)(*p))) {
- p++;
- }
- if (*p == '\0') {
- *picaPtr = ROUND(pica);
- return TCL_OK;
- }
- error:
- Tcl_AppendResult(interp, "bad screen distance \"", string, "\"",
- (char *) NULL);
- return TCL_ERROR;
-}
-
int Blt_Ps_ComputeBoundingBox(PageSetup *setupPtr, int width, int height)
{
int paperWidth, paperHeight;
@@ -104,7 +62,7 @@ int Blt_Ps_ComputeBoundingBox(PageSetup *setupPtr, int width, int height)
hBorder = 2*setupPtr->xPad;
vBorder = 2*setupPtr->yPad;
- if (setupPtr->flags & PS_LANDSCAPE) {
+ if (setupPtr->landscape) {
hSize = height;
vSize = width;
} else {
@@ -137,7 +95,7 @@ int Blt_Ps_ComputeBoundingBox(PageSetup *setupPtr, int width, int height)
vSize = (int)((vSize * scale) + 0.5f);
}
setupPtr->scale = scale;
- if (setupPtr->flags & PS_CENTER) {
+ if (setupPtr->center) {
if (paperWidth > hSize) {
x = (paperWidth - hSize) / 2;
}
@@ -335,40 +293,18 @@ static void XColorToPostScript(Blt_Ps ps, XColor* colorPtr)
void Blt_Ps_XSetBackground(PostScript *psPtr, XColor* colorPtr)
{
- /* If the color name exists in TCL array variable, use that translation */
- if ((psPtr->setupPtr != NULL) && (psPtr->setupPtr->colorVarName != NULL)) {
- const char *psColor;
-
- psColor = Tcl_GetVar2(psPtr->interp, psPtr->setupPtr->colorVarName,
- Tk_NameOfColor(colorPtr), 0);
- if (psColor != NULL) {
- Blt_Ps_VarAppend(psPtr, " ", psColor, "\n", (char *)NULL);
- return;
- }
- }
XColorToPostScript(psPtr, colorPtr);
Blt_Ps_Append(psPtr, " setrgbcolor\n");
- if (psPtr->setupPtr->flags & PS_GREYSCALE) {
+ if (psPtr->setupPtr->greyscale) {
Blt_Ps_Append(psPtr, " currentgray setgray\n");
}
}
void Blt_Ps_XSetForeground(PostScript *psPtr, XColor* colorPtr)
{
- /* If the color name exists in TCL array variable, use that translation */
- if ((psPtr->setupPtr != NULL) && (psPtr->setupPtr->colorVarName != NULL)) {
- const char *psColor;
-
- psColor = Tcl_GetVar2(psPtr->interp, psPtr->setupPtr->colorVarName,
- Tk_NameOfColor(colorPtr), 0);
- if (psColor != NULL) {
- Blt_Ps_VarAppend(psPtr, " ", psColor, "\n", (char *)NULL);
- return;
- }
- }
XColorToPostScript(psPtr, colorPtr);
Blt_Ps_Append(psPtr, " setrgbcolor\n");
- if (psPtr->setupPtr->flags & PS_GREYSCALE) {
+ if (psPtr->setupPtr->greyscale) {
Blt_Ps_Append(psPtr, " currentgray setgray\n");
}
}
@@ -756,37 +692,6 @@ void Blt_Ps_XSetFont(PostScript *psPtr, Tk_Font font)
Tcl_Interp* interp = psPtr->interp;
const char *family;
- /* Use the font variable information if it exists. */
- if ((psPtr->setupPtr != NULL) && (psPtr->setupPtr->fontVarName != NULL)) {
- char *value;
-
- value = (char *)Tcl_GetVar2(interp, psPtr->setupPtr->fontVarName,
- Tk_NameOfFont(font), 0);
- if (value != NULL) {
- const char **argv = NULL;
- int argc;
- int newSize;
- double pointSize;
- const char *fontName;
-
- if (Tcl_SplitList(NULL, value, &argc, &argv) != TCL_OK) {
- return;
- }
- fontName = argv[0];
- if ((argc != 2) ||
- (Tcl_GetInt(interp, argv[1], &newSize) != TCL_OK)) {
- free(argv);
- return;
- }
- pointSize = (double)newSize;
- Blt_Ps_Format(psPtr, "%g /%s SetFont\n", pointSize,
- fontName);
- free(argv);
- return;
- }
- /*FallThru*/
- }
-
/*
* Check to see if it's a PostScript font. Tk_PostScriptFontName silently
* generates a bogus PostScript font name, so we have to check to see if
diff --git a/src/bltGrPSOutput.h b/src/bltGrPSOutput.h
index 88284d5..333651e 100644
--- a/src/bltGrPSOutput.h
+++ b/src/bltGrPSOutput.h
@@ -43,13 +43,16 @@ typedef struct {
int xPad, yPad; /* Requested padding on the exterior of the
* graph. This forms the bounding box for
* the page. */
- const char *colorVarName; /* If non-NULL, is the name of a TCL array
- * variable containing X to output device color
- * translations */
const char *fontVarName; /* If non-NULL, is the name of a TCL array
* variable containing X to output device font
* translations */
int level; /* PostScript Language level 1-3 */
+
+ int decorations;
+ int center;
+ int footer;
+ int greyscale;
+ int landscape;
unsigned int flags;
const char **comments; /* User supplied comments to be added. */
@@ -67,12 +70,8 @@ typedef struct {
} PageSetup;
-#define PS_GREYSCALE (1<<0)
-#define PS_LANDSCAPE (1<<2)
-#define PS_CENTER (1<<3)
#define PS_MAXPECT (1<<4)
-#define PS_DECORATIONS (1<<5)
-#define PS_FOOTER (1<<6)
+
#define PS_FMT_NONE 0
#define PS_FMT_MASK (PS_FMT_WMF|PS_FMT_EPSI|PS_FMT_TIFF)
#define PS_FMT_WMF (1<<8)
@@ -108,9 +107,6 @@ extern void Blt_Ps_SetClearBackground(Blt_Ps ps);
extern int Blt_Ps_IncludeFile(Tcl_Interp* interp, Blt_Ps ps,
const char *fileName);
-extern int Blt_Ps_GetPicaFromObj(Tcl_Interp* interp, Tcl_Obj *objPtr,
- int *picaPtr);
-
extern int Blt_Ps_ComputeBoundingBox(PageSetup *setupPtr, int w, int h);
extern void Blt_Ps_Rectangle(Blt_Ps ps, int x, int y, int w, int h);