diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2019-01-02 21:51:00 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2019-01-02 21:51:00 (GMT) |
commit | 339f12645fb818a8850d188d595ffa394184c3b4 (patch) | |
tree | 98443c6883c7837c1f8f3d8f8b5463e805d585d4 /tkblt/generic/tkbltGrPostscript.C | |
parent | 4b458dac3f0ea680db57779eb3684e2136680306 (diff) | |
parent | ae91bd578b070f043b6b1b2576836c52935a5e1e (diff) | |
download | blt-339f12645fb818a8850d188d595ffa394184c3b4.zip blt-339f12645fb818a8850d188d595ffa394184c3b4.tar.gz blt-339f12645fb818a8850d188d595ffa394184c3b4.tar.bz2 |
Merge commit 'ae91bd578b070f043b6b1b2576836c52935a5e1e' as 'tkblt'
Diffstat (limited to 'tkblt/generic/tkbltGrPostscript.C')
-rw-r--r-- | tkblt/generic/tkbltGrPostscript.C | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/tkblt/generic/tkbltGrPostscript.C b/tkblt/generic/tkbltGrPostscript.C new file mode 100644 index 0000000..4bbf504 --- /dev/null +++ b/tkblt/generic/tkbltGrPostscript.C @@ -0,0 +1,84 @@ +/* + * Smithsonian Astrophysical Observatory, Cambridge, MA, USA + * This code has been modified under the terms listed below and is made + * available under the same terms. + */ + +/* + * Copyright 1991-2004 George A Howlett. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include <stdlib.h> + +#include "tkbltGraph.h" +#include "tkbltGrPostscript.h" +#include "tkbltConfig.h" + +using namespace Blt; + +static Tk_OptionSpec optionSpecs[] = { + {TK_OPTION_BOOLEAN, "-center", "center", "Center", + "yes", -1, Tk_Offset(PostscriptOptions, center), 0, NULL, 0}, + {TK_OPTION_CUSTOM, "-comments", "comments", "Comments", + NULL, -1, Tk_Offset(PostscriptOptions, comments), + TK_OPTION_NULL_OK, &listObjOption, 0}, + {TK_OPTION_BOOLEAN, "-decorations", "decorations", "Decorations", + "yes", -1, Tk_Offset(PostscriptOptions, decorations), 0, NULL, 0}, + {TK_OPTION_BOOLEAN, "-footer", "footer", "Footer", + "no", -1, Tk_Offset(PostscriptOptions, footer), 0, NULL, 0}, + {TK_OPTION_BOOLEAN, "-greyscale", "greyscale", "Greyscale", + "no", -1, Tk_Offset(PostscriptOptions, greyscale), 0, NULL, 0}, + {TK_OPTION_PIXELS, "-height", "height", "Height", + "0", -1, Tk_Offset(PostscriptOptions, reqHeight), 0, NULL, 0}, + {TK_OPTION_BOOLEAN, "-landscape", "landscape", "Landscape", + "no", -1, Tk_Offset(PostscriptOptions, landscape), 0, NULL, 0}, + {TK_OPTION_INT, "-level", "level", "Level", + "2", -1, Tk_Offset(PostscriptOptions, level), 0, NULL, 0}, + {TK_OPTION_PIXELS, "-padx", "padX", "PadX", + "1.0i", -1, Tk_Offset(PostscriptOptions, xPad), 0, NULL, 0}, + {TK_OPTION_PIXELS, "-pady", "padY", "PadY", + "1.0i", -1, Tk_Offset(PostscriptOptions, yPad), 0, NULL, 0}, + {TK_OPTION_PIXELS, "-paperheight", "paperHeight", "PaperHeight", + "11.0i", -1, Tk_Offset(PostscriptOptions, reqPaperHeight), 0, NULL, 0}, + {TK_OPTION_PIXELS, "-paperwidth", "paperWidth", "PaperWidth", + "8.5i", -1, Tk_Offset(PostscriptOptions, reqPaperWidth), 0, NULL, 0}, + {TK_OPTION_PIXELS, "-width", "width", "Width", + "0", -1, Tk_Offset(PostscriptOptions, reqWidth), 0, NULL, 0}, + {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} +}; + +Postscript::Postscript(Graph* graphPtr) +{ + ops_ = (PostscriptOptions*)calloc(1, sizeof(PostscriptOptions)); + graphPtr_ = graphPtr; + + optionTable_ =Tk_CreateOptionTable(graphPtr_->interp_, optionSpecs); + Tk_InitOptions(graphPtr_->interp_, (char*)ops_, optionTable_, + graphPtr_->tkwin_); +} + +Postscript::~Postscript() +{ + Tk_FreeConfigOptions((char*)ops_, optionTable_, graphPtr_->tkwin_); + free(ops_); +} + |