Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoXtPrintDialog.h
Go to the documentation of this file.
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Dave Immel (MMM yyyy)
25**=======================================================================*/
26/*=======================================================================
27 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
28 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
29 *** ***
30 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
31 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
32 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
33 *** ***
34 *** RESTRICTED RIGHTS LEGEND ***
35 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
36 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
37 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
38 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
39 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
40 *** ***
41 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
42 *** BORDEAUX, FRANCE ***
43 *** ALL RIGHTS RESERVED ***
44**=======================================================================*/
45/*=======================================================================
46** Modified by : VSG (MMM YYYY)
47**=======================================================================*/
48
49
50#ifdef _WIN32
52#else // _WIN32
53
54#ifndef SO_XT_PRINT_DIALOG_
55#define SO_XT_PRINT_DIALOG_
56
57#include <X11/Intrinsic.h>
58#include <Xm/Xm.h>
59
60#include <Inventor/SbBasic.h>
63
64class SbPList;
65class SoNode;
66class SoPath;
68class SoXtPrintDialog;
69
70
71// callback function prototypes
72typedef void SoXtPrintDialogCB(void *userData, SoXtPrintDialog *dialog);
73
75//
76// class: SoXtPrintDialog
77//
79
140 public:
145 SoWidget parent = NULL,
146 const char *name = NULL,
147 SbBool buildInsideParent = TRUE);
152 SoGLRenderAction *act,
153 SoWidget parent = NULL,
154 const char *name = NULL,
155 SbBool buildInsideParent = TRUE);
160
164 void setSceneGraph( SoPath *path );
168 void setSceneGraph( SoNode *root );
169
173 SoNode *getSceneGraph() { return rootNode; }
177 SoPath *getSceneGraphPath() { return rootPath; }
178
187
192 void setPrintSize( const SbVec2f &inches );
197 void setPrintSize( const SbVec2s &pixels );
198
205 inline void setBeforePrintCallback(
207 void *userData = NULL);
214 inline void setAfterPrintCallback(
216 void *userData = NULL);
217
218 private:
219
220 // This constructor takes a boolean whether to build the widget now.
221 // Subclasses can pass FALSE, then call SoXtPrintDialog::buildWidget()
222 // when they are ready for it to be built.
224 SoWidget parent,
225 const char *name,
226 SbBool buildInsideParent,
227 SbBool buildNow);
228
229 // redefine these
230 virtual SbString getDefaultWidgetName() const;
231 virtual SbString getDefaultTitle() const;
232 virtual SbString getDefaultIconTitle() const;
233
234 SoNode *rootNode;
235 SoPath *rootPath;
236 SbBool printDone;
237 SbBool highQuality;
238 SbBool portraitFormat;
239 SbBool printerOutput, postScriptOutput;
240 SbBool nodeMostRecent;
241 SbBool WYSIWYGflag;
242 SoWidget messageWidget, printButton, quitButton;
243 SoWidget messageLabelWidget, fileFormatWidget;
244 SoWidget toPrinterWidget, toPostScriptFileWidget, toRGBFileWidget;
245 SoWidget printerHorizSize, printerVertSize;
246 SoWidget postScriptHorizSize, postScriptVertSize;
247 SoWidget rgbHorizSize, rgbVertSize;
248 SoWidget printerDPIField, postScriptDPIField;
249 SoWidget rgbFilenameWidget, postScriptFilenameWidget;
250 SbPList *printers;
251 char *defaultPrinter;
252 int whichPrinter; // index into printers list
253 SbVec2f printSize;
254 SbVec2s printRes;
255 SoCallbackList beforeList, afterList;
256 SbBool alreadyUpdated;
257
258 void print(); // called by printCallback
259 void getPrinterList();
260 void printToPostScript( SoNode *, char *, int, int );
261
262 // Methods used to build the print dialog.
263 void buildToPrinterWidget( SoWidget parent );
264 void buildToPostScriptFileWidget( SoWidget parent );
265 void buildToRGBFileWidget( SoWidget parent );
266 void placeBottomOfDialog( SoXtPrintDialog * );
267 void buildRadioButton( char *, char *, char *, int, int,
268 SoWidget, XtCallbackProc );
269 void buildSizeFields( char *, int, SoWidget, SoWidget &, SoWidget &,
270 XtCallbackProc, XtCallbackProc );
271 void buildDPIField( int, SoWidget, SoWidget &, XtCallbackProc );
272 void updateTextports();
273
274 //
275 // Callback routines.
276 //
277 static void qualityCB( SoWidget, SoXtPrintDialog *,
279 static void pageFormatCB( SoWidget, SoXtPrintDialog *,
281 static void fileFormatCB( SoWidget, SoXtPrintDialog *,
283 static void printerHorizSizeCB( SoWidget, SoXtPrintDialog *,
285 static void printerVertSizeCB( SoWidget, SoXtPrintDialog *,
287 static void postScriptHorizSizeCB( SoWidget, SoXtPrintDialog *,
289 static void postScriptVertSizeCB( SoWidget, SoXtPrintDialog *,
291 static void rgbHorizSizeCB( SoWidget, SoXtPrintDialog *,
293 static void rgbVertSizeCB( SoWidget, SoXtPrintDialog *,
295 static void printerDPICB( SoWidget, SoXtPrintDialog *,
297 static void postScriptDPICB( SoWidget, SoXtPrintDialog *,
299 static void outputCB( SoWidget, SoXtPrintDialog *,
301 static void printCB( SoWidget, SoXtPrintDialog *,
303 static void quitCB( SoWidget, SoXtPrintDialog *,
305 static void listPick( SoWidget, SoXtPrintDialog *ml,
307
308 // SoWidget for controlling the Print Style
309 SoWidget styleButton;
310 int currentStyle;
311
312 private:
313 // Builds the widget.
314 SoWidget buildWidget(SoWidget parent);
315
316 // this is called by both constructors
317 void constructorCommon(SbBool buildNow);
318
319
320};
321
322// Inline methods
323void
326 void *userData )
327{
328 beforeList.clearCallbacks();
329 beforeList.addCallback((SoCallbackListCB *) f, userData);
330}
331
332void
335 void *userData )
336{
337 afterList.clearCallbacks();
338 afterList.addCallback((SoCallbackListCB *) f, userData);
339}
340
341
342#endif /* SO_XT_PRINT_DIALOG_ */
343
344#endif // _WIN32
345
346
#define TRUE
Possible value of SbBool.
Definition SbBase.h:77
#define SoWidget
Definition SoQtDef.h:40
#define XmAnyCallbackStruct
Definition SoWinDef.h:127
void setAfterPrintCallback(SoWinPrintDialogCB *f, void *userData=NULL)
void setBeforePrintCallback(SoWinPrintDialogCB *f, void *userData=NULL)
#define SoXtPrintDialogCB
Definition SoXt2SoQt.h:123
#define SoXtPrintDialog
Definition SoXt2SoQt.h:122
void SoXtPrintDialogCB(void *userData, SoXtPrintDialog *dialog)
List of generic (void *) pointers.
Definition SbPList.h:77
Class for smart character strings.
Definition SbString.h:202
2D vector class.
Definition SbVec.h:76
2D vector class.
Definition SbVec.h:700
Manages a list of callbacks and associated data.
void addCallback(SoCallbackListCB *f, void *userData=NULL)
Adds a function to the list of callback functions.
void clearCallbacks()
Clears all callback functions from the list.
Renders a scene graph using Open Inventor's Render Engine.
Abstract base class for all database nodes.
Definition SoNode.h:145
Path that points to a list of hierarchical nodes.
Definition SoPath.h:187
Abstract base class for all Open Inventor components.
Dialog box for controlling printing.
SoGLRenderAction * getGLRenderAction()
Gets the render action to be used when printing.
void setAfterPrintCallback(SoXtPrintDialogCB *f, void *userData=NULL)
Two callbacks are maintained, one which gets called just before a print is executed,...
void setPrintSize(const SbVec2f &inches)
Sets the size of the printed image in inches.
SoPath * getSceneGraphPath()
Gets the path to nodes to be used for printing.
void setBeforePrintCallback(SoXtPrintDialogCB *f, void *userData=NULL)
Two callbacks are maintained, one which gets called just before a print is executed,...
SoXtPrintDialog(SoWidget parent=NULL, const char *name=NULL, SbBool buildInsideParent=TRUE)
Constructor.
void setGLRenderAction(const SoGLRenderAction *act)
Sets the render action to be used when printing.
void setPrintSize(const SbVec2s &pixels)
Sets the size of the printed image in pixels.
~SoXtPrintDialog()
Destructor.
SoXtPrintDialog(SoGLRenderAction *act, SoWidget parent=NULL, const char *name=NULL, SbBool buildInsideParent=TRUE)
Constructor that takes a render action.
SoNode * getSceneGraph()
Gets the root node to be used for printing.
void setSceneGraph(SoNode *root)
Sets the root node to be used for printing.
void setSceneGraph(SoPath *path)
Sets the path to nodes to be used for printing.
int SbBool
Boolean type.
Definition SbBase.h:87
void SoCallbackListCB(void *userData, void *callbackData)