source: trunk/MESOSCALE_DEV/PLOT/MINIMAL/fsc/fsc_psconfig.html @ 937

Last change on this file since 937 was 85, checked in by aslmd, 14 years ago

LMD_MM_MARS et LMD_LES_MARS: ajout des routines IDL pour tracer les sorties --> voir mesoscale/PLOT

File size: 56.6 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
2
3<html>
4
5<!-- ************** HEADER INFORMATION ************-->
6
7<head>
8<META name="Description" content="FSC_PSConfig Program for Configuring the IDL PostScript Device">
9<META name="Author" content="David W. Fanning, Ph.D.">
10<META name="Keywords" content="IDL, PostScript, configure, configuring, PostScript Device">
11<title>Configuring the IDL PostScript Device</title>
12</head>
13
14
15
16<!-- ************** CONSULTING BANNER ************-->
17
18<BODY VLINK="#FF0000" BACKGROUND="http://www.dfanning.com/images/graymarble.gif">
19<CENTER><IMG SRC="http://www.dfanning.com/images/banner.gif" WIDTH=443
20HEIGHT=111 ALT="Fanning Consulting Services (25K)"></CENTER>
21
22
23
24<!-- ************** BODY ************-->
25
26<CENTER><h1>Configuring the PostScript Device</h1></CENTER>
27
28<p>The <B>FSC_PSConfig</B> program is a
29program for configuring the IDL PostScript device. The
30program is similar to (but much more powerful than) <B>PS_Form</B>, an older program offered
31by Fanning Software Consulting. The <B>FSC_PSConfig</B> program is written as an object.
32
33<p>In addition to configuring
34the PostScript device, the <B>FSC_PSConfig</B> program
35allows you to keep track of the current state of the PostScript device at all times.
36European users will be pleased to know that support for the A4 page and
37centimeter units are built into the program and can easily be set as program defaults.
38One of the most useful features of the <B>FSC_PSConfig</B> program
39is its ability to collect user input via a graphical user interface, which--on a Windows
40machine with a 24-bit graphics display--looks similar to the illustration below.
41
42<!-- ************** GRAPHIC EXAMPLE ************-->
43<P><CENTER><IMG SRC="http://www.dfanning.com/programs/docs/fsc_psconfig_pic1.jpg" 
44ALT="The FSC_PSConfig graphical user interface for gathering user input."></CENTER>
45
46<!-- ************** HORIZONTAL RULE IMAGE ************-->
47<P ALIGN=CENTER><IMG SRC="http://www.dfanning.com/images/hruler.gif" WIDTH=782 HEIGHT=3
48   ALT="-------"></P>
49
50<H2><A NAME="TOC">Table of Contents</A></H2>
51<UL>
52<LI><A HREF="#OVERVIEW">Program Overview</A>
53<LI><A HREF="#METHODS">Using the Program</A>
54        <UL>
55        <LI><A HREF="#INIT">Initializing the Program</A>
56      <LI><A HREF="#GUI">Description of the Graphical User Interface</A>
57      <LI><A HREF="#SETPROPERTY">Setting Program Properties</A>
58      <LI><A HREF="#KEYWORDS">Setting PostScript Configuration Keywords</A>
59      <LI><A HREF="#CLEANUP">Cleaning Up the Program</A>
60        </UL>
61<LI><A HREF="#EXAMPLE">Example Program Using <b>FSC_PSConfig</B></A>
62<LI><A HREF="#WRAPPER">A Wrapper Function for <b>FSC_PSConfig</B></A>
63<LI><A HREF="#CUSTOMIZING">Customizing Your Source Code</A>
64<LI><A HREF="#OTHERCODE">Other FSC Programs Needed to Run this Program</A>
65<LI><A HREF="#ORDERING">Disclaimer and Licensing Information</A>
66</UL>
67
68<!-- ************** HORIZONTAL RULE IMAGE ************-->
69<P ALIGN=CENTER><IMG SRC="http://www.dfanning.com/images/hruler.gif" WIDTH=782 HEIGHT=3
70   ALT="-------"></P>
71
72
73<H2><A NAME="OVERVIEW">Program Overview</A></H2>
74
75<p>How you use the <B>FSC_PSConfig</B> program is completely up to you.
76It has been designed to accommodate  different programming styles. For example, it can be
77called from the IDL command line or from within other IDL programs. Typically,
78the program is used by initializing the object (you can have as many of the objects as you
79like, so each program can have its own PostScript configuration setup),
80gathering user input via the built-in Graphical User Interface (GUI), configuring the PostScript device,
81and drawing your PostScript plot.
82Here is a typical sequence of commands. Each step will be explained in detail below,
83but this is a short overview of a typical session. (Users uninterested in the power
84of the <B>FSC_PSConfig</B> object can access most of the functionality through the
85<A HREF="#WRAPPER"><b>PSConfig</b></A> wrapper function described below.)
86
87<H3>Initializing the Object</H3>
88
89<P>The first step is to initialize the object. There are a number of keywords
90that can be used to set properties of the <B>FSC_PSConfig</B> object, but suppose you are going
91to leave it up to the user to determine exactly how the PostScript device should
92be configured. Then you might simply initialize the object like this:
93
94<PRE>
95   psObject = Obj_New("FSC_PSConfig")
96</PRE>
97
98<P>If you typically display PostScript output on an A4 page and prefer
99size and offset units to be displayed in centimeters rather than inches,
100then you can initialize the object with the <B>European</B> keyword set, like
101this.
102<PRE>
103   psObject = Obj_New("FSC_PSConfig", /European)
104</PRE>
105
106<P>The A4 page and centimeter units are now the default for this object.
107Selecting a European style can also be selected via a check box
108on the graphical user interface.
109
110<H3>Gathering User Input</H3>
111
112<P>Next, you might gather the user's input into how he or she would
113like the PostScript device to be configured. You can do this
114with a graphical user interface in either modal (blocking) or
115non-modal mode. Suppose you wish the program to wait for the user's input.
116You would invoke the graphical user interface in blocking mode with this command:
117
118<PRE>
119   psObject->GUI
120</PRE>
121
122<H3>Configuring the PostScript Device</H3>
123
124<P>The real purpose of the <B>FSC_PSConfig</B> object is to return
125keywords that are appropriate for the PostScript device. The way the
126PostScript device is configured is to make the PostScript device the
127current graphics device, and then pass these keywords to the PostScript
128device via the <B>Device</B> command using the "keyword inheritance"
129mechanism and the <B>_Extra</B> keyword. The keywords are obtained from the
130object by calling the <b>GetKeywords</b> method. A typical sequence of
131commands looks like this:
132
133<PRE>
134   thisDevice = !D.Name
135   Set_Plot, "PS"
136   Device, _Extra=psObject->GetKeywords()
137</PRE>
138
139<H3>Drawing the PostScript Graphics</H3>
140
141<p>The PostScript graphics are now written to the PostScript file in
142the normal way. (Here a simple <b>Plot</b> command is used, but the graphics command
143or commands can be as elaborate as you like.)
144
145<PRE>
146   Plot, data
147</PRE>
148
149<H3>Cleaning Up</H3>
150
151<P>The final step is to clean up. Note that you do not have to
152destroy the object, as shown here. In fact, you may want to keep
153the object around for the entire IDL session, so you always know
154the current configuration of the PostScript device. Repeated calls
155to invoke the graphical user interface will show the current
156state of the PostScript device. Typical clean-up commands will be
157similar to these:
158
159<PRE>
160   Device, /Close_File
161   Set_Plot, thisDevice
162   Obj_Destroy, psObject
163</PRE>
164
165<P><CENTER>[<A HREF="#TOC">Return to Contents</A>]</CENTER>
166<!-- ************** HORIZONTAL RULE IMAGE ************-->
167<P ALIGN=CENTER><IMG SRC="http://www.dfanning.com/images/hruler.gif" WIDTH=782 HEIGHT=3
168   ALT="-------"></P>
169
170<H2><A NAME="METHODS">Using the Program</A></H2>
171
172<p>The <B>FSC_PSConfig</B> program is used by calling the program's object methods. This section
173provides a detailed description of the object methods available to the user. (There are
174a number of other methods in the object that are used internally to run the program and
175should not normally be accessed by the user of the program. These are not described here,
176although they are extensively documented in the source code.)
177
178<H3><A NAME="INIT">Initializing the Program</A></H3>
179
180<P>The object is initialized by creating an object of the <B>FSC_PSCONFIG</B> object class:
181
182<PRE>
183   psObject = Obj_New("FSC_PSConfig")
184</PRE>
185
186<p>At the time the object is initialized, various keywords can be used to set
187properties of the object. These keywords are typically (but not exclusively) the same keywords that
188can be used to configure the PostScript device (i.e., the keywords appropriate
189for the <B>Device</B> command when the PostScript device is the current graphics
190device). Here is a complete description of the <B>INIT</B> method keywords you can use.
191
192<UL>
193<LI><B>AvantGarde</B> - Set this keyword to select the AvantGarde font. Turned off by default.
194<LI><B>Bits_per_Pixel</B> - The number of image bits saved for each image pixel: 2, 4, or 8. The default is 8.
195<LI><B>Bold</B> - Set this keyword to select the Bold font style. Turned off by default.
196<LI><B>BookStyle</B> - Set this keyword to select the Book font style. Turned off by default.
197<LI><B>Bookman</B> - Set this keyword to select the Bookman font. Turned off by default.
198<LI><B>Color</B> - Set this keyword to select Color PostScript output. Turned off by default.
199<LI><B>Courier</B> - Set this keyword to select the Courier font. Turned off by default.
200<LI><B>Debug</B> - Set this keyword to turn traceback information on for error messages.
201This is useful for debugging program code. Turned off by default.
202<LI><B>DefaultSetup</B> - Set this keyword to the "name" of a default style. Current styles (you
203can easily create and add your own to the source code) are the following:
204        <UL>
205      <LI><B>"System (Portrait)"</B> - The normal "default" system set-up. Also, <B>"System"</B>.
206      <LI><B>"System (Landcape)"</B> - The normal "default" landscape system set-up.
207      <LI><B>"Centered (Portrait)"</B> - The window centered on the page. Also, <B>"Center"</B> or "Centered".
208      <LI><B>"Centered (Landscape)"</B> - The window centered on the landscape page. Also, <B>"Landscape"</B>.
209      <LI><B>"Square (Portrait)"</B> - A square plot, centered on the page.
210      <LI><B>"Square (Landscape)"</B> - A square plot, centered on the landscape page.
211      <LI><B>"Figure (Small)"</B> - A small encapsulated figure size, centered on page. Also, <B>"Encapsulated"</B> or <B>"Encapsulate"</B>.
212      <LI><B>"Figure (Large)"</B> - A larger encapsulated figure size, centered on page. Also, <B>"Figure"</B>.
213      <LI><B>"Color (Portrait)"</B> - A "centered" plot, with color turned on. Also, <B>"Color"</B>.
214     <LI><B>"Color (Landscape)"</B> - A "centered" landscape plot, with color turned on.
215        </UL>
216<LI><B>Demi</B> - Set this keyword to select the Demi font style. Turned off by default.
217<LI><B>Directory</B> - Set thie keyword to the name of the starting directory. The current directory is used by default.
218<LI><B>Encapsulate</B> - Set this keyword to select Encapsulated PostScript output. Turned off by default.
219<LI><B>European</B> - Set this keyword to indicate "european" mode (i.e., A4 page and centimeter units). Turned off by default.
220<LI><B>Filename</B> - Set thie keyword to the name of the PostScript file. In the source code version the default is "idl.ps", but
221in the shareware version this keyword cannot be set and is always "coyote.ps".
222<LI><B>FontSize</B> - ; Set this keyword to the font size. Between 6 and 36. Default is 12.
223<LI><B>FontType</B> - ; Set this keyword to indicate the type of fon
224you want selected. Hershey Fonts: -1, Hardward Fonts: 0, and True-Type Fonts: 1.<LI><B>Helvetica</B> - Set this keyword to select the Helvetica font. This is the default selection.
225<LI><B>Inches</B> - Set this keyword to indicate sizes and offsets are in inches as opposed to centimeters. 
226Set by <B>European</B> keyword by default.
227<LI><B>Italic</B> - Set this keyword to select the Italic font style. Turned off by default.
228<LI><B>Isolatin</B> - Set this keyword to select ISOlatin1 encoding. Turned off by default.
229<LI><B>Landscape</B> - Set this keyword to select Landscape page output. Portrait page output is the default.
230<LI><B>Light</B> - Set this keyword to select the Light font style. Turned off by default.
231<LI><B>Medium</B> - Set this keyword to select the Medium font style. Turned off by default.
232<LI><B>Name</B> - Set this keyword to the "name" of the object. This can be anything you like.
233Objects that have different names can display their graphical user interfaces simultaneously. The
234object name appears on the title of the graphical user interface.
235<LI><B>Narrow</B> - Set this keyword to select the Narrow font style. Turned off by default.
236<LI><B>Oblique</B> - Set this keyword to select the Oblique font style. Turned off by default.
237<LI><B>PageType</B> - Set this keyword to the "type" of page. Possible values are:
238        <UL>
239        <LI><B>"Letter"</B> - 8.5 by 11 inches. (Default, unless the <B>European</B> keyword is set.)
240        <LI><B>"Legal"</B> - 8.5 by 14 inches.
241        <LI><B>"Ledger"</B> - 11 by 17 inches.
242        <LI><B>"A4"</B> - 21.0 by 29.7 centimeters. (Default, if the <B>European</B> keyword is set.)
243        </UL>
244<LI><B>Palatino</B> - Set this keyword to select the Palatino font.  Turned off by default.
245<LI><B>Preview</B> - Set this keyword to select Preview mode: 0 is "none", 1 is "EPSI", or 2 is "EPSF".
246<LI><B>Schoolbook</B> - Set this keyword to select the Schoolbook font. Turned off by default.
247<LI><B>Set_Font</B> - Set this keyword to the name of a font passed to PostScript with Set_Plot keyword.
248<LI><B>Symbol</B> - Set this keyword to select the Symbol font. Turned off by default.
249<LI><B>Times</B> - Set this keyword to select the Times font. Turned off by default.
250<LI><B>TrueType</B> - Set this keyword to select True-Type fonts. Turned off by default.
251<LI><B>XOffset</B> - Set this keyword to the X Offset.  Uses "System (Portrait)" defaults. (Note: offset calculated from lower-left corner of page.)
252<LI><B>XSize</B> - Set this keyword to the X size of the PostScript "window". Uses "System (Portrait)" defaults.
253<LI><B>YOffset</B> - Set this keyword to the Y Offset.  Uses "System (Portrait)" defaults. (Note: offset calculated from lower-left corner of page.)
254<LI><B>YSize</B> - Set this keyword to the Y size of the PostScript "window". Uses "System (Portrait)" defaults.
255<LI><B>ZapfChancery</B> - Set this keyword to select the ZapfChancery font. Turned off by default.
256<LI><B>ZapfDingbats</B> - Set this keyword to select the ZapfDingbats font. Turned off by default.
257</UL>
258
259<p>For example, to select a centered, color, encapsulated PostScript file, using the Times Bold PostScript
260font, and named <em>myplot.eps</em>, you can initialize the object like this:
261
262<PRE>
263   psObject = Obj_New("FSC_PSConfig", /Color, /Encapsulate, /Times, /Bold, Filename="myplot.eps")
264</PRE>
265
266<P><CENTER>[<A HREF="#TOC">Return to Contents</A>]</CENTER>
267<!-- ************** HORIZONTAL RULE IMAGE ************-->
268<P ALIGN=CENTER><IMG SRC="http://www.dfanning.com/images/hruler.gif" WIDTH=782 HEIGHT=3
269   ALT="-------"></P>
270
271
272<H3><A NAME="GUI">Description of the Graphical User Interface</A></H3>
273
274<P>The program's graphical user interface is invoked by calling the object's <B>GUI</B>
275method, like this:
276
277<PRE>
278   psObject->GUI
279</PRE>
280
281<p>Keywords are available with this method that control how the
282graphical user interfaces appears and what properties it has. Called as above,
283the interface is a blocking widget. This means the IDL command line will block
284and user will be unable to enter IDL commands at the command line until the widget
285is dismissed by clicking either the <em>Cancel</em> or the <em>Accept</em> button.
286Valid keywords for this method are these:
287
288<UL>
289<LI><B>Cancel</B> - Set this output keyword to a named variable that will be set to 1 if the user
290selected the <em>Cancel</em> button, and to 0 if the user selected the <em>Accept</Em> button. Note that
291this value only has meaning when the widget is is blocking (or modal) mode. In non-modal mode, the value
292is always set to 0.
293
294<PRE>
295      psObject->GUI, Group_Leader=event.top, Cancel=cancelled
296</PRE>
297
298<LI><B>FontInfo</B> - This keyword is set if you want the user to be able to
299configure the PostScript device with font information as well. Please see the
300description of how to use font information below, but the graphical interface will
301look similar to this.
302
303<PRE>
304      psObject->GUI, FontInfo=1
305</PRE>
306
307<P><CENTER><IMG SRC="http://www.dfanning.com/programs/docs/fsc_psconfig_pic3.jpg" 
308ALT="The FSC_PSConfig graphical user interface with the font information displayed."></CENTER>
309
310<p>Users have the ability to select Hershey, Hardware, or True-Type fonts, as well as many
311font "properties".
312
313
314<LI><B>Group_Leader</B> - Set this keyword to the identifier of a widget which is the group leader for
315the graphical user interface. This keyword <em>must</em> be set if you want modal (as opposed to just
316blocking) behavior from the program. In other words, you will probably <em>always</em> set this keyword
317if you are calling the GUI from within another widget program. For example, from within a widget program,
318the graphical user interface should be invoked like this:
319
320<PRE>
321      psObject->GUI, Group_Leader=event.top
322</PRE>
323
324
325<LI><B>NoBlock</B> - This keyword is set if you want non-modal, and non-blocking
326behavior from the program. This is the mode you would use, for example, if you want
327the graphical user interface to stay on the display so you can change the PostScript
328set-up at will. Notice that in this mode the <em>Cancel</em> button is named <em>Dismiss</em>
329and the <em>Accept</em> button is named <em>Apply</em>.
330
331<PRE>
332      psObject->GUI, /NoBlock
333</PRE>
334
335<!-- ************** GRAPHIC EXAMPLE ************-->
336<P><CENTER><IMG SRC="http://www.dfanning.com/programs/docs/fsc_psconfig_pic2.jpg" 
337ALT="The FSC_PSConfig graphical user interface in non-modal and non-saved mode."></CENTER>
338
339
340<p>In non-modal mode, selecting the <em>Apply</em> button will save the current PostScript
341configuration. Note that the PostScript graphics window changes background color if the
342current configuration shown on the form is not currently saved. (The program is shown in its
343 unsaved condition in the illustration
344above.) Upon saving the configuration,
345the background color will change back to its default color. The <em>Revert</em> button will
346revert to the last saved configuration.
347</UL>
348
349<H4>The Left Panel</H4>
350
351<p>The left panel of the graphical user interface contains eight droplist widgets
352and looks like this. A description of each droplist follows the illustration.
353
354<!-- ************** GRAPHIC EXAMPLE ************-->
355<P><CENTER><IMG SRC="http://www.dfanning.com/programs/docs/fsc_psconfig_pic4.jpg" 
356ALT="The left panel of the FSC_PSConfig graphical user interface."></CENTER>
357
358
359
360<UL>
361<LI><B>Page Size</B> - This droplist controls the page size. It should be set to the type of output
362you intend to print, since offsets and sizes will be based on the page size selected. This will be
363set to "Letter" by default, unless the <b>European</b> keyword has been set, in which case
364the "A4" option is the default.
365<LI><B>Orientation</B> - This droplist controls whether the page will be in portrait or landscape
366oreintation. The <b>Portrait</b> and <b>Landscape</b> Device keywords are set from this droplist.
367<LI><B>Units</B> - This droplist controls whether the size and offsets are measured in inches or centimeters.
368The <b>Inches</b> Device keyword is set from this droplist.
369<LI><B>Encapsulation</B> - This droplist controls whether <b>Encapsulated</b> Device keyword is set. If
370encapsulation is turned <em>Off</em>, then the <b>Preview Mode</b> droplist is insensitive.
371
372<LI><B>Preview Mode</B> - This droplist selects the value of the <b>Preview</b> Device keyword.
373It is sensitive to user input only if the <em>Encapsulation</em> droplist is turned <em>On</em>
374"None" sets the keyword to 0, "ESPI" sets the keyword to 1, and "ESPF" sets the
375keyword to 2. If you wish IDL to create a preview image for Macintoshs or PCs, then you should choose
376the "ESPF" option.
377
378<LI><B>Color Output</B> - This droplist controls whether <b>Color</b> Device keyword is set.
379<LI><B>Bits Per Image Pixel</B> - This droplist controls the value of the <b>Bits_Per_Pixel</b> 
380Device keyword.
381<LI><B>Default Setups</B> - This droplist selects the various default set-ups, which
382change multiple program settings at once. The choices in this droplist are easily modified by
383the user in the source code. Typically they would be choices in use at your facility.
384<LI><B>European Style</B> - This checkbox controls the Page Size and Units keywords. If checked,
385an A4 page size is used, and centimeters are used for Units.
386</UL>
387
388<H4>The Center Panel</H4>
389
390<P>The center panel of the graphical user interface contains the size and offset
391information, directions for operating the PostScript "plot", and fields to
392indicate the output directory and file names. It looks similar to the
393illustration below. An explanation of each item follows the illustration.
394
395
396<!-- ************** GRAPHIC EXAMPLE ************-->
397<P><CENTER><IMG SRC="http://www.dfanning.com/programs/docs/fsc_psconfig_pic5.jpg" 
398ALT="The center panel of the FSC_PSConfig graphical user interface."></CENTER>
399
400<UL>
401<LI><B>X Size</B> - This text field contains the X size of the PostScript "window". Its value is
402used to set the <B>XSize</B> Device keyword. After entering a value in this field you <em>must</em>
403enter a carriage return in the field for the new information to be transmitted to the plot window
404in the right panel.
405
406<LI><B>Y Size</B> - This text field contains the Y size of the PostScript "window". Its value is
407used to set the <B>YSize</B> Device keyword. After entering a value in this field you <em>must</em>
408enter a carriage return in the field for the new information to be transmitted to the plot window
409in the right panel.
410
411<LI><B>X Offset</B> - This text field contains the X offset of the PostScript "window". Its value is
412used to set the <B>XOffset</B> Device keyword. After entering a value in this field you <em>must</em>
413enter a carriage return in the field for the new information to be transmitted to the plot window
414in the right panel. Offsets are always calculated from the lower-left corner of the page regardless of
415the orientation, unlike the way you configure the PostScript device. The complexities of PostScript
416are handled behind the scenes and are not passed along to unsuspecting end-users.
417
418<LI><B>Y Offset</B> - This text field contains the Y offset of the PostScript "window". Its value is
419used to set the <B>YOffset</B> Device keyword. After entering a value in this field you <em>must</em>
420enter a carriage return in the field for the new information to be transmitted to the plot window
421in the right panel. Offsets are always calculated from the lower-left corner of the page regardless of
422the orientation, unlike the way you configure the PostScript device. The complexities of PostScript
423are handled behind the scenes and are not passed along to unsuspecting end-users.
424
425<LI><B>Directory</B> - The name of the directory where the PostScript file is to be
426written. The <em>Browse</em> button following the text field calls the IDL <b>Dialog_Pickfile</b>
427command with the <b>Directory</B> keyword set for directory selection.
428
429<LI><B>Filename</B> - The name of the output PostScript file. The <em>Browse</em> button
430following the text field calls the IDL <b>Dialog_Pickfile</b>
431command for file selection. The <em>Directory</em> and
432<em>Filename</em> values are put together to constuct the value of the Device <B>Filename</B>
433keyword.
434
435</UL>
436
437<p>If the <b>FontInfo</b> keyword is set when the graphical user interface is invoked, the
438center panel may also contain graphical elements allowing user input into font selections.
439These additional fields are described below the illustration.
440
441<!-- ************** GRAPHIC EXAMPLE ************-->
442<P><CENTER><IMG SRC="http://www.dfanning.com/programs/docs/fsc_psconfig_pic6.jpg" 
443ALT="The center panel of the FSC_PSConfig graphical user interface with font information turned on."></CENTER>
444
445<UL>
446<LI><B>Font Type</B> - This droplist sets the font type. The other font options
447are available only if the <em>Font Type</Em> droplist
448selection is set to something other than the "Vector (Hershey)".
449Note that the <em>Font Type</Em> droplist default selection depends upon the
450value of the <B>!P.Font</B> system variable when the graphical user interface
451is invoked, although it can be also be set via a <b>FontType</b> keyword when the grahical
452user interface is invoked. For example, the illustration above was produced with
453this syntax:
454<PRE>
455   IDL> psObject->GUI, /FontInfo, FontType=1
456</PRE>
457
458<LI><B>Font</B> - This droplist allows selection of one of the 10 font families
459available on most PostScript printers. A selection here sets the corresponding
460Device keyword.
461
462<LI><B>Font Style Box</B> - This non-exclusive base allows you to set the eight
463font styles that can be set for the PostScript device. These font styles are applied
464to the font selection described above to modify it with the selected style.
465Note that which font styles are available for
466which font family is not controlled by IDL, but is a function of the fonts installed
467on your computer or printer. Thus, you must use this information carefully. The corresponding
468Device keyword is set according to each style selection.
469
470<LI><B>Clear Font Styles</B> - This button clears all the font style attributes
471selections described above.
472
473<LI><B>Font Size</B> - This droplist allows you to select the font size in point
474sizes from 6 to 36. The default size is 12. The <b>FontSize</B> Device keyword is
475set to this value.
476
477<LI><B>True-Type</B> - This droplist sets the Device <b>True_Type</B> keyword. If it is
478turned on true-type fonts are used for output if they are available.
479
480<LI><B>ISOlatin1</B> - This droplist sets the Device <b>ISOlatin1</B> keyword. If it is
481turned on isolatin encoding is used for output. This allows output in many languages other
482than English.
483
484</UL>
485
486<H4>The Right Panel</H4>
487
488<P>The right panel of the graphical user interface contains the representation of
489the PostScript page. This window will change shape and size as different page sizes and orientations
490are selected. It looks similar to the illustration below. (Note that the colors you see here will only
491appear on 24-bit displays. On 8-bit displays the colors are less exciting.)
492
493
494<!-- ************** GRAPHIC EXAMPLE ************-->
495<P><CENTER><IMG SRC="http://www.dfanning.com/programs/docs/fsc_psconfig_pic7.jpg" 
496ALT="The righ panel of the FSC_PSConfig graphical user interface."></CENTER>
497
498<p>The "plot" in the window can be moved and resized by the user. It represents
499the "window" on the PostScript page where graphics will be drawn. As such, it controls
500the <B>XSize</B>, <B>YSize</B>, <B>XOffset</B>, and <B>YOffset</B> Device keywords.
501The plot window can be moved by clicking somewhere inside it and dragging. If you locate
502the cursor near an edge of the plot, you can click and drag to resize the window. Cursor changes
503will occur to indicate whether you are in drag or resize mode. Notice
504as you do that the size and offset fields in the right panel are updated with the new
505window sizes and offsets. Notice that the background color of the window changes if
506the current configuration shown on the form hasn't been saved and the program is in non-blocking
507mode. It will look similar to
508the illustration below. The backgound color does not change if the graphical user interface
509is in blocking mode. (Non-blocking mode is selected with the <b>NoBlock</B> keyword when the
510graphical user interface is invoked.)
511
512<!-- ************** GRAPHIC EXAMPLE ************-->
513<P><CENTER><IMG SRC="http://www.dfanning.com/programs/docs/fsc_psconfig_pic11.jpg" 
514ALT="The righ panel of the FSC_PSConfig graphical user interface."></CENTER>
515
516
517
518<p>The plot window can be centered in the page by clicking the middle mouse button
519anywhere inside the PostScript page representation. Note that the middle mouse button
520can be simulated if you don't have a three-button mouse. For example, on PCs a <em>Ctrl-Click</em>
521is interpreted as a middle mouse click. <em>Option-Click</em> on a Macintosh will do the same.
522
523<p>If the <em>Color Output</em> droplist is turned <em>On</em>, then the plot
524is shown in color as a visual clue to the color property.
525
526<!-- ************** GRAPHIC EXAMPLE ************-->
527<P><CENTER><IMG SRC="http://www.dfanning.com/programs/docs/fsc_psconfig_pic8.jpg" 
528ALT="The center panel of the FSC_PSConfig graphical user interface in color."></CENTER>
529
530<H4>The Action Button Panel</H4>
531
532<p>The action button panel looks different, depending upon whether the graphical user
533interface is is blocking (modal) mode or in  non-blocking mode. Here is what it looks
534like in non-blocking mode.
535
536<!-- ************** GRAPHIC EXAMPLE ************-->
537<P><CENTER><IMG SRC="http://www.dfanning.com/programs/docs/fsc_psconfig_pic9.jpg" 
538ALT="The button panel of the FSC_PSConfig graphical user interface in non-blocking mode."></CENTER>
539
540<P>Here is how it appears in blocking mode.
541
542<!-- ************** GRAPHIC EXAMPLE ************-->
543<P><CENTER><IMG SRC="http://www.dfanning.com/programs/docs/fsc_psconfig_pic10.jpg" 
544ALT="The button panel of the FSC_PSConfig graphical user interface in blocking mode."></CENTER>
545
546<p>Notice that in blocking mode the <em>Dismiss</em> button is named <em>Cancel</em> and
547the <em>Apply</em> button is named <em>Accept</em>, but they have similar functions. The only
548real difference is that the <em>Accept</em> button destroys the widget (as do the <em>Dismiss</em>
549and <em>Cancel</em> buttons), while the <em>Apply</em> button does not.
550
551<UL>
552<LI><B>Dismiss</B> or <B>Cancel</B> - This button destroys the graphical user interface.
553The last saved configuration of the graphical user interface is in effect.
554
555<LI><B>Revert</B> - This button restores the last saved configuration of the graphical
556user interface. A configuration is saved when the <em>Apply</em> or <em>Accept</em>
557button is selected.
558
559<LI><B>Help</B> - This button provides a Help message to the user and points the
560user to the program documentation. This action may have been customized for your facility.
561
562<LI><B>Apply</B> or <B>Accept</B> - This button saves the current configuration of the
563graphical user interface. If the button is the <em>Accept</em> button, the graphical user
564interface is also destroyed and the block released.
565
566<P> Note that the name of this button can be changed by using the <B>Accept_Button_Name</B>
567keyword when the graphical user interface is invoked. For example, you might want to name
568the button "Print". You would do it like this:
569
570<PRE>
571   IDL> psObject->GUI, Accept_Button_Name='Print'
572</PRE>
573</UL>
574
575<p>The buttons would now look like this:
576
577<P><CENTER><IMG SRC="http://www.dfanning.com/programs/docs/fsc_psconfig_pic12.jpg" 
578ALT="The button panel of the FSC_PSConfig graphical user interface in blocking mode."></CENTER>
579
580<P><CENTER>[<A HREF="#TOC">Return to Contents</A>]</CENTER>
581<!-- ************** HORIZONTAL RULE IMAGE ************-->
582<P ALIGN=CENTER><IMG SRC="http://www.dfanning.com/images/hruler.gif" WIDTH=782 HEIGHT=3
583   ALT="-------"></P>
584
585
586<H2><A NAME="SETPROPERTY">Setting Program Properties</A></H2>
587
588<p>The current configuration of the <b>FSC_PSConfig</B> object can be set at any time by
589using the <b>SetProperty</B> method of the object. The keywords that can be used to set
590properties are nearly identical to the keywords avaiable for the <b>INIT</b> method. Here is
591a list of the keywords and thier meaning.
592
593<UL>
594<LI><B>AvantGarde</B> - Set this keyword to select the AvantGarde font.
595<LI><B>Bits_per_Pixel</B> - The number of image bits saved for each image pixel: 2, 4, or 8.
596<LI><B>Bold</B> - Set this keyword to select the Bold font style.
597<LI><B>BookStyle</B> - Set this keyword to select the Book font style.
598<LI><B>Bookman</B> - Set this keyword to select the Bookman font. T
599<LI><B>Color</B> - Set this keyword to select Color PostScript output.
600<LI><B>Courier</B> - Set this keyword to select the Courier font.
601<LI><B>DefaultSetup</B> - Set this keyword to the "name" of a default style. Factory styles (you
602can easily create and add your own to the source code) are the following:
603        <UL>
604      <LI><B>"System (Portrait)"</B> - The normal "default" system set-up. Also, <B>"System"</B>.
605      <LI><B>"System (Landcape)"</B> - The normal "default" landscape system set-up.
606      <LI><B>"Centered (Portrait)"</B> - The window centered on the page. Also, <B>"Center"</B> or "Centered".
607      <LI><B>"Centered (Landscape)"</B> - The window centered on the landscape page. Also, <B>"Landscape"</B>.
608      <LI><B>"Square (Portrait)"</B> - A square plot, centered on the page.
609      <LI><B>"Square (Landscape)"</B> - A square plot, centered on the landscape page.
610      <LI><B>"Figure (Small)"</B> - A small encapsulated figure size, centered on page. Also, <B>"Encapsulated"</B> or <B>"Encapsulate"</B>.
611      <LI><B>"Figure (Large)"</B> - A larger encapsulated figure size, centered on page. Also, <B>"Figure"</B>.
612      <LI><B>"Color (Portrait)"</B> - A "centered" plot, with color turned on. Also, <B>"Color"</B>.
613     <LI><B>"Color (Landscape)"</B> - A "centered" landscape plot, with color turned on.
614        </UL>
615<LI><B>Demi</B> - Set this keyword to select the Demi font style.
616<LI><B>Directory</B> - Set thie keyword to the name of the starting directory.
617<LI><B>Encapsulate</B> - Set this keyword to select Encapsulated PostScript output.
618<LI><B>European</B> - Set this keyword to indicate "european" mode (i.e., A4 page and centimeter units).
619<LI><B>Filename</B> - Set thie keyword to the name of the PostScript file. In the source code version the default is "idl.ps", but
620in the shareware version this keyword cannot be set and is always "coyote.ps".
621<LI><B>FontSize</B> - ; Set this keyword to the font size. Between 6 and 36.
622<LI><B>FontType</B> - ; Set this keyword to indicate the type of fon
623you want selected. Hershey Fonts: -1, Hardward Fonts: 0, and True-Type Fonts: 1.<LI><B>Helvetica</B> - Set this keyword to select the Helvetica font. This is the default selection.
624<LI><B>Helvetica</B> - Set this keyword to select the Helvetica font.
625<LI><B>Inches</B> - Set this keyword to indicate sizes and offsets are in inches as opposed to centimeters. 
626<LI><B>Italic</B> - Set this keyword to select the Italic font style.
627<LI><B>Isolatin</B> - Set this keyword to select ISOlatin1 encoding.
628<LI><B>Landscape</B> - Set this keyword to select Landscape page output.
629<LI><B>Light</B> - Set this keyword to select the Light font style.
630<LI><B>Medium</B> - Set this keyword to select the Medium font style.
631<LI><B>Name</B> - Set this keyword to the "name" of the object. This can be anything you like.
632Objects that have different names can display their graphical user interfaces simultaneously. The
633object name appears on the title of the graphical user interface.
634<LI><B>Narrow</B> - Set this keyword to select the Narrow font style.
635<LI><B>Oblique</B> - Set this keyword to select the Oblique font style.
636<LI><B>PageType</B> - Set this keyword to the "type" of page. Possible values are:
637        <UL>
638        <LI><B>"Letter"</B> - 8.5 by 11 inches. (Default, unless the <B>European</B> keyword is set.)
639        <LI><B>"Legal"</B> - 8.5 by 14 inches.
640        <LI><B>"Ledger"</B> - 11 by 17 inches.
641        <LI><B>"A4"</B> - 21.0 by 29.7 centimeters. (Default, if the <B>European</B> keyword is set.)
642        </UL>
643<LI><B>Palatino</B> - Set this keyword to select the Palatino font. 
644<LI><B>Preview</B> - Set this keyword to select Preview mode: 0 is "none", 1 is "EPSI", or 2 is "EPSF".
645<LI><B>Schoolbook</B> - Set this keyword to select the Schoolbook font.
646<LI><B>Set_Font</B> - Set this keyword to the name of a font passed to PostScript with Set_Plot keyword.
647<LI><B>Symbol</B> - Set this keyword to select the Symbol font.
648<LI><B>Times</B> - Set this keyword to select the Times font.
649<LI><B>TrueType</B> - Set this keyword to select True-Type fonts.
650<LI><B>Update</B> - Set this keyword if you wish to immediately update the graphical user
651interface after setting a property. The default is to set the property without updating the
652display.
653<LI><B>XOffset</B> - Set this keyword to the X Offset.
654<LI><B>XSize</B> - Set this keyword to the X size of the PostScript "window".
655<LI><B>YOffset</B> - Set this keyword to the Y Offset.  Uses "System (Portrait)" defaults.
656<LI><B>YSize</B> - Set this keyword to the Y size of the PostScript "window".
657<LI><B>ZapfChancery</B> - Set this keyword to select the ZapfChancery font.
658<LI><B>ZapfDingbats</B> - Set this keyword to select the ZapfDingbats font.
659</UL>
660
661<p>For example, to create a 7 x 5 inch window on a PostScript
662landscape page, with color output turned on, and immediately update the display, you can type this:
663
664<PRE>
665  psObject->SetProperty, /Landscape, /Color, /Update, XSize=7, YSize=5, /Inches, XOffset=1, YOffset=1
666</PRE>
667
668<P><CENTER>[<A HREF="#TOC">Return to Contents</A>]</CENTER>
669<!-- ************** HORIZONTAL RULE IMAGE ************-->
670<P ALIGN=CENTER><IMG SRC="http://www.dfanning.com/images/hruler.gif" WIDTH=782 HEIGHT=3
671   ALT="-------"></P>
672
673<H3><A NAME="KEYWORDS">Setting PostScript Configuration Keywords</A></H3>
674
675<P>The whole purpose of the <B>FSC_PSConfig</B> program is to configure the PostScript device
676by setting the appropriate <b>Device</B> command keywords. This is done by obtaining a structure in which
677the fields of the structure are the names of the appropriate keywords, and the values of the fields are
678appropriate for configuring the device the way you want it configured. You pass this structure to the
679<b>Device</B> command  by means of <em>keyword inheritance</em>. In other words, you use the <b>_Extra</b>
680keyword to accept the structure.
681
682<p>The keyword structure is obtained from the object by calling the <b>GetKeywords</b> method, like
683this:
684
685<PRE>
686   keywordStructure = psObject->GetKeywords()
687</PRE>
688
689<p>To verify what this structure looks like, type this:
690
691<PRE>
692   IDL> Help, keywordStructure, /Structure
693</PRE>
694
695<P>Depending upon how your object is configured, you should see something like this:
696
697<PRE>
698   ** Structure <15037f8>, 24 tags, length=68, refs=1:
699      BITS_PER_PIXEL  INT              8
700      COLOR           INT              0
701      ENCAPSULATED    INT              0
702      FILENAME        STRING    'D:\RSI\IDL53\DAVID\coyote.ps'
703      FONT_SIZE       INT             12
704      INCHES          INT              1
705      ISOLATIN1       INT              0
706      PREVIEW         INT              0
707      TT_FONT         INT              0
708      XOFFSET         FLOAT           1.75000
709      XSIZE           FLOAT           5.00000
710      YOFFSET         FLOAT           3.50000
711      YSIZE           FLOAT           4.00000
712      PORTRAIT        INT              1
713      LANDSCAPE       INT              0
714      HELVETICA       INT              1
715      BOLD            INT              1
716      BOOK            INT              0
717      DEMI            INT              0
718      ITALIC          INT              1
719      LIGHT           INT              0
720      MEDIUM          INT              0
721      NARROW          INT              0
722      OBLIQUE         INT              0
723</PRE>
724
725<p>Note that your structure may have other keywords defined, depending upon
726how your object is configured. This is typical.
727
728<p>These keywords are passed to the PostScript device via the <b>_Extra</b> keyword
729to the <b>Device</B> command. Be sure to select the PostScript device first. The code
730will typically look something like this:
731
732<PRE>
733   thisDevice = !D.Name
734   Set_Plot, "PS"
735   Device, _Extra=psObject->GetKeywords()
736</PRE>
737
738<P>Once the PostScript device is configured, you issue your graphics
739command or commands as normal. They will go into the PostScript "window" you
740have described on the PostScript page. Then, be sure to close the file. The code might look
741something like this:
742
743<PRE>
744   Plot, data, Title='Experiment 5A'
745   Device, /Close_File
746   Set_Plot, thisDevice
747</PRE>
748
749<H4>A Note About Fonts</H4> 
750
751<p>Although the PostScript device allows you to set information about PostScript fonts
752(if you set the <b>FontInfo</B> keyword when you invoked the GUI),
753there is no guarantee that your graphics commands will be rendered in PostScript fonts.
754In fact, this is a function of the <b>!P.Font</b> system variable or the <b>Font</B> keyword
755on a graphics command, and has nothing to do with how the PostScript device
756is configured <em>per se</em>. This makes it a bit tricky to put font property widgets on a graphical
757user interface, since the unaware user may be surprised that the output doesn't look like
758the configuration he or she selected.
759
760<p>I've attempted to get around this problem by letting you know of the
761user's wishes for font type. But this information doesn't come back in the
762device keyword structure. Rather, it is returned in a <b>FontType</B> output keyword
763from the <b>GetKeywords</b> method. In fact, I recommend you always call the method
764like this when you have asked the user to specify font information in the GUI:
765
766<PRE>
767   thisDevice = !D.Name
768   Set_Plot, "PS"
769   Device, _Extra=psObject->GetKeywords(<B>FontType=fonttype</B>)
770</PRE>
771
772<p>This allows you to set the font type correctly on your graphics commands. For example,
773you could write code like this:
774
775<PRE>
776   currentFontType = !P.Font
777   <b>!P.Font = fonttype</b>
778   Plot, data, Title='Experiment 5A'
779   Device, /Close_File
780   Set_Plot, thisDevice
781   !P.Font = currentFontType
782</PRE>
783
784<p>Or, even more simply, you could write code like this:
785
786<PRE>
787   Plot, data, Title='Experiment 5A', <b>Font=fonttype</B>
788   Device, /Close_File
789   Set_Plot, thisDevice
790</PRE>
791
792<P><CENTER>[<A HREF="#TOC">Return to Contents</A>]</CENTER>
793<!-- ************** HORIZONTAL RULE IMAGE ************-->
794<P ALIGN=CENTER><IMG SRC="http://www.dfanning.com/images/hruler.gif" WIDTH=782 HEIGHT=3
795   ALT="-------"></P>
796
797<H3><A NAME="CLEANUP">Cleaning Up the Program</A></H3>
798
799<P>Since the <b>FSC_PSConfig</B> program is an object, it is persistent in
800the IDL session. This is one of the huge advantages of objects. For example,
801you can create an PostScript configuration object in a start-up file and
802always have it available in your IDL session. You will always have access
803to the current configuration of the PostScript device.
804
805<p>But as a persistent entity, you must destroy it when you are done with
806it or you will have heap memory leaking in your IDL session. This is especially
807true if you create these objects in other program modules. This is no different for
808other memory-leaking entities: pointers, pixmaps, etc. The way you clean up an object
809is to destroy it with the <b>Obj_Destroy</b> command, like this:
810
811<PRE>
812   Obj_Destroy, psObject
813</PRE>
814
815<P><CENTER>[<A HREF="#TOC">Return to Contents</A>]</CENTER>
816<!-- ************** HORIZONTAL RULE IMAGE ************-->
817<P ALIGN=CENTER><IMG SRC="http://www.dfanning.com/images/hruler.gif" WIDTH=782 HEIGHT=3
818   ALT="-------"></P>
819
820
821<H2><A NAME="EXAMPLE">Example Program using <b>FSC_PSConfig</B></A></H2>
822
823<P>Sometimes the best way to see how to use a new program is to see an example.
824Here is an example program, named <A HREF="http://www.dfanning.com/tip_examples/ps_plotter.pro">PS_Plotter</A>,
825that uses the <b>FSC_PSConfig</B> object to create a window on the PostScript page
826for two plots: an image plot
827and a histogram plot of the image data. You will need another useful program from
828my library to run the program: <A HREF="http://www.dfanning.com/programs/tvimage.pro">TVImage</A>.
829(<B>TVImage</b> is needed because the normal IDL <b>TV</B> command doesn't honor
830the <b>!P.Multi</b> system variable. Nor is the <b>TV</B> command written in the
831device-independent way required here.) Here is the compete code for the <b>PS_Plotter</b>
832program.
833
834<PRE>
835   PRO PS_Plotter, image, $
836      European=european, $   ; Set this keyword if you want European measurements.
837      Object=object          ; Output variable to return FSC_PSConfig object.
838
839      ; Get an image if one is not passed in.
840
841   IF N_Elements(image) EQ 0 THEN BEGIN
842      image = BytArr(360, 360)
843      file = Filepath(SubDirectory=['examples', 'data'], 'worldelv.dat')
844      OpenR, lun, file, /Get_Lun
845      ReadU, lun, image
846      Free_Lun, lun
847   ENDIF
848
849      ; Create the PostScript configuration object.
850
851   object = Obj_New('FSC_PSConfig', European=Keyword_Set(european))
852
853      ; We want hardware fonts.
854
855   thisFontType = !P.Font
856   !P.Font = 1
857
858      ; Get user input to PostScript configuration.
859
860   object->GUI
861
862      ; Configure the PostScript Device.
863
864   thisDevice = !D.Name
865   Set_Plot, 'PS'
866   keywords = object->GetKeywords(FontType=fonttype)
867   Device, _Extra=keywords
868
869      ; Draw the example plots.
870
871   !P.Multi = [ 0, 1, 2]
872   TVImage, image
873   Plot, Histogram(image), Title='Example Histogram Plot', XTitle='Pixel Value', $
874      YTitle='Number of Pixels', XStyle=1, Max_Value=5000
875
876      ; Clean up.
877
878   !P.Multi = 0
879   Device, /Close_File
880   Set_Plot, thisDevice
881   !P.Font = thisfontType
882
883      ; Return the PS_Configuration object or destroy it.
884
885   IF Arg_Present(object) EQ 0 THEN Obj_Destroy, object
886   END
887</PRE>
888
889<p>If you will be printing on letter-size paper, you want to run the program
890like this. You will see the graphical user interface of the object in the
891middle of your display. Fill out the form the way you would like the output
892file to be configured and click the <em>Accept</em> button.
893
894<PRE>
895   IDL> PS_Plotter
896</PRE>
897
898<P>If you are in a country that uses A4 paper, you might want to
899call the program like this:
900
901<PRE>
902   IDL> PS_Plotter, /European
903</PRE>
904
905<p>A PostScript file will be created in the specified directory. You
906can print it or use a PostScript file viewer (e.g., Ghostview) to view
907the file.
908
909<p>Called as above, the <b>FSC_PSConfig</b> object is created and destroyed
910when the program exits. However, you may wish to play around with some of the
911object's properties. You can return the object from the <b>PS_Plotter</b> program by
912using the optional <b>Object</b> keyword, like this:
913
914<PRE>
915   IDL> PS_Plotter, Object=psObject
916</PRE>
917
918<p>If you want to see how the PostScript file
919was just configured, you can examine the PostScript Device keywords
920that were used to create the file:
921
922<PRE>
923   IDL> Help, psObject->GetKeywords(), /Structure
924</PRE>
925
926<P>Be sure to destroy the object when you are finished with it.
927
928<PRE>
929   IDL> Obj_Destroy, psObject
930</PRE>
931
932<P><CENTER>[<A HREF="#TOC">Return to Contents</A>]</CENTER>
933<!-- ************** HORIZONTAL RULE IMAGE ************-->
934<P ALIGN=CENTER><IMG SRC="http://www.dfanning.com/images/hruler.gif" WIDTH=782 HEIGHT=3
935   ALT="-------"></P>
936
937
938<H2><A NAME="WRAPPER">A Wrapper Function for <b>FSC_PSConfig</b></A></H2>
939
940<P>A number of people are still uncomfortable using objects. So for those
941people, I have written a function named <A HREF="http://www.dfanning.com/programs/psconfig.pro">PSConfig</A>,
942which acts very much like (in fact, can probably be used as a replacement for)
943the old PostScript configuration program, <b>PS_Form</B>.
944
945<p>The <B>PSConfig</b> program creates the <b>FSC_PSConfig</b> object, calls
946the graphical user interface in blocking mode, and then returns the device
947keywords necessary to configure the PostScript device. The program can be used
948with commands similar to these:
949
950<PRE>
951   keywords = PSConfig(Cancel=cancelled)
952   IF NOT cancelled THEN BEGIN
953      thisDevice = !D.Name
954      Set_Plot, "PS"
955      Device, _Extra=keywords
956      Plot, Findgen(11)
957      Device, /Close_File
958      Set_Plot, thisDevice
959   ENDIF
960</PRE>
961
962<p> You can use the same keywords with <b>PSConfig</B> that
963you use for the <b>FSC_PSConfig</B> object.
964<P><CENTER>[<A HREF="#TOC">Return to Contents</A>]</CENTER>
965<!-- ************** HORIZONTAL RULE IMAGE ************-->
966<P ALIGN=CENTER><IMG SRC="http://www.dfanning.com/images/hruler.gif" WIDTH=782 HEIGHT=3
967   ALT="-------"></P>
968
969<H2><A NAME="CUSTOMIZING">Customizing Your Source Code</A></H2>
970
971<P>I've tried to write the <B>FSC_PSConfig</B> program in such a way that it can be
972easily customized and extended by you at your site. In particular, it will be easy to
973add new default set-ups and other page types to the program. The
974code itself is extensively documented to indicate how this can
975be done. But, to give you an example, here is how you would add another
976default set-up, named <em>Company Viewgraph</em> to the code.
977
978<h3>Step 1: Add the Name to the Set-Up List</H3>
979
980<P>Open the <em>fsc_psconfig__define.pro</em> file and find the
981<em>DefaultList</em> method. (For example, search for "::DefaultList".)
982Add your new default name to the list shown there. For example, you would find this code:
983
984<PRE>
985defaultlist = [ 'System (Portrait)', $
986                'System (Landscape)', $
987                'Centered (Portrait)', $
988                'Centered (Landscape)', $
989                'Square (Portrait)', $
990                'Square (Landscape)', $
991                'Figure (Small)', $
992                'Figure (Large)', $
993                'Color (Portrait)', $
994                'Color (Landscape)' ]
995</PRE>
996
997<p>and change it to this:
998
999<PRE>
1000defaultlist = [ 'System (Portrait)', $
1001                'System (Landscape)', $
1002                'Centered (Portrait)', $
1003                'Centered (Landscape)', $
1004                'Square (Portrait)', $
1005                'Square (Landscape)', $
1006                'Figure (Small)', $
1007                'Figure (Large)', $
1008                'Color (Portrait)', $
1009                'Color (Landscape)' <b>, $
1010                'Company Viewgraph'</b>]
1011</PRE>
1012
1013<H3>Step 2: Create the New Set-Up</H3>
1014
1015<p>Next, find the <em>SetDefault</em> method (it will be just below the
1016<em>DefaultList</em> method you just found) and copy one of the defualt
1017setups you find in the CASE statement in that code. For example, here
1018is the <em>System (Portrait)</em> method found there:
1019
1020<PRE>
1021CASE thisDefault OF
1022
1023   'System (Portrait)': BEGIN
1024         self.bitsSet = '8'
1025         self.colorSet = 0
1026         self.directorySet = directoryName
1027         self.encapsulationSet = 0
1028         self.filenameSet = defaultFilename + ".ps"
1029         self.fonttypeSet = !P.Font
1030         self.fontsizeSet = 12
1031         self.fontStyleSet = Replicate(0, 8)
1032         self.fontnameSet = "Helvetica"
1033         self.inchesSet = units
1034         self.landscapeSet = 0
1035         self.isolatinSet = 0
1036         self.pagetypeSet = pagetype
1037         self.previewSet = 0
1038         self.truetypeSet = 0
1039         IF self.european THEN self.xoffsetSet = 1.61 ELSE self.xoffsetSet = 0.75
1040         IF self.european THEN self.yoffsetSet = 14.65 ELSE self.yoffsetSet = 5.0
1041         IF self.european THEN self.xsizeSet = 17.80 ELSE self.xsizeSet = 7.0
1042         IF self.european THEN self.ysizeSet = 12.70 ELSE self.ysizeSet = 5.0
1043         self.defaultsSet = 'System (Portrait)'
1044      ENDCASE
1045</PRE>
1046
1047<p>Modify each of the fields you want to change there, and add your changed
1048values to the CASE statement. For example, your
1049<em>Company Viewgraph</em> set-up might be defined like this. Note that you
1050will have to provide both inches and centimeter units for the sizes and offsets.
1051
1052<PRE>
1053   'Company Viewgraph': BEGIN
1054         self.bitsSet = '8'
1055         self.colorSet = 1
1056         self.directorySet = "C:\Company\Viewgraphs"
1057         self.encapsulationSet = 0
1058         self.filenameSet = "viewgraph_1.view"
1059         self.fonttypeSet = 1
1060         self.fontsizeSet = 18
1061         self.fontStyleSet = Replicate(0, 8)
1062         self.fontnameSet = "Helvetica"
1063         self.inchesSet = units
1064         self.landscapeSet = 0
1065         self.isolatinSet = 0
1066         self.pagetypeSet = pagetype
1067         self.previewSet = 0
1068         self.truetypeSet = 0
1069         IF self.european THEN self.xoffsetSet = 0.75 * 2.54 ELSE self.xoffsetSet = 0.75
1070         IF self.european THEN self.yoffsetSet = 0.75 * 2.54ELSE self.yoffsetSet = 0.75
1071         IF self.european THEN self.xsizeSet = 7.0 * 2.54 ELSE self.xsizeSet = 7.0
1072         IF self.european THEN self.ysizeSet = 9.5 *2.54 ELSE self.ysizeSet = 9.5
1073         self.defaultsSet = 'Company Viewgraph'
1074      ENDCASE
1075</PRE>
1076
1077<P><CENTER>[<A HREF="#TOC">Return to Contents</A>]</CENTER>
1078<!-- ************** HORIZONTAL RULE IMAGE ************-->
1079<P ALIGN=CENTER><IMG SRC="http://www.dfanning.com/images/hruler.gif" WIDTH=782 HEIGHT=3
1080   ALT="-------"></P>
1081
1082<H2><A NAME="OTHERCODE">Other FSC Programs Needed to Run this Program</A></H2>
1083
1084<P>This <B>FSC_PSConfig</B> program uses a number of other programs from the Coyote library.
1085Here are the programs you will need.
1086
1087<UL>
1088<LI><A HREF="http://www.dfanning.com/programs/fsc_psconfig__define.pro">fsc_psconfig__define.pro</A> - The
1089main PostScript configuration object program. (What I call <b>FSC_PSConfig</B>.)
1090<LI><A HREF="http://www.dfanning.com/programs/fsc_field.pro">fsc_field.pro</A> - A CW_Field replacement compound widget, written as an object.
1091<LI><A HREF="http://www.dfanning.com/programs/fsc_fileselect.pro">fsc_fileselect.pro</A> - A file selection compound widget, written as an object.
1092<LI><A HREF="http://www.dfanning.com/programs/fsc_droplist.pro">fsc_droplist.pro</A> - A droplist compound widget, written as an object.
1093<LI><A HREF="http://www.dfanning.com/programs/fsc_plotwindow.pro">fsc_plotwindw.pro</A> - A
1094utility object program required by <b>FSC_PSConfig</B>.
1095</UL>
1096
1097<p>In addition, you may want the following wrapper and example programs, respectively:
1098
1099<UL>
1100<LI><A HREF="http://www.dfanning.com/programs/psconfig.pro">psconfig.pro</A> - A wrapper function for the
1101<B>FSC_PSConfig</B> object.
1102<LI><A HREF="http://www.dfanning.com/tip_examples/ps_plotter.pro">ps_plotter.pro</A> - An example
1103program that uses the <B>FSC_PSConfig</B> object.
1104<LI><A HREF="http://www.dfanning.com/programs/tvimage.pro">tvimage.pro</A> - A device-independent image display program, which
1105honors the !P.Multi system variable.</UL>
1106
1107<p>If you would like to download all these programs at once,
1108you can download this <A HREF="../fsc_psconfig.zip">zip file</A> (56KB).
1109
1110<P><CENTER>[<A HREF="#TOC">Return to Contents</A>]</CENTER>
1111<!-- ************** HORIZONTAL RULE IMAGE ************-->
1112<P ALIGN=CENTER><IMG SRC="http://www.dfanning.com/images/hruler.gif" WIDTH=782 HEIGHT=3
1113   ALT="-------"></P>
1114
1115<H2><A NAME="ORDERING">Disclaimer and Licensing Information</A></H2>
1116
1117<H3>Warranties</H3>
1118
1119<P>Fanning Software Consulting makes no warranties, either express or implied, as
1120to the condition of the software described here or its fitness for any particular purpose. All software
1121code is provided as is. IDL is a registered trademark of <A HREF="http://www.rsinc.com/">Research Systems, Inc.</A>
1122for the computer software used to created these programs. A licensed version of IDL is required to
1123run these programs.
1124
1125<H3>Licensing the Software</H3>
1126
1127<p>All programs written by Fanning Software Consulting and described
1128in this article are issued under a license certified and approved by the
1129Open Source Initiative. The following license is attached to the header of
1130each program. Please do not removed the license information if you distribute
1131this source code in any form.
1132
1133<PRE>
1134;###########################################################################
1135;
1136; LICENSE
1137;
1138; This software is OSI Certified Open Source Software.
1139; OSI Certified is a certification mark of the Open Source Initiative.
1140;
1141; Copyright © 2000 Fanning Software Consulting
1142;
1143; This software is provided "as-is", without any express or
1144; implied warranty. In no event will the authors be held liable
1145; for any damages arising from the use of this software.
1146;
1147; Permission is granted to anyone to use this software for any
1148; purpose, including commercial applications, and to alter it and
1149; redistribute it freely, subject to the following restrictions:
1150;
1151; 1. The origin of this software must not be misrepresented; you must
1152;    not claim you wrote the original software. If you use this software
1153;    in a product, an acknowledgment in the product documentation
1154;    would be appreciated, but is not required.
1155;
1156; 2. Altered source versions must be plainly marked as such, and must
1157;    not be misrepresented as being the original software.
1158;
1159; 3. This notice may not be removed or altered from any source distribution.
1160;
1161; For more information on Open Source Software, visit the Open Source
1162; web site: http://www.opensource.org.
1163;
1164;###########################################################################
1165</PRE>
1166
1167<H3>Reporting Program Bugs</H3>
1168
1169<P>Every attempt is made to keep these programs accurate and bug
1170free. If you find a bug, I will be happy to attempt to fix it. Please
1171report any bugs or feature requests to:
1172
1173<P>David Fanning<br>
1174Fanning Software Consulting <br>
11751645 Sheely Drive <br>
1176Fort Collins, CO 80526 USA <br>
1177Phone: 970-221-0438<br>
1178Fax: 970-221-4762<br>
1179E-Mail: david@dfanning.com
1180
1181<P><CENTER>[<A HREF="http://www.dfanning.com/documents/programs.html">Return to Programs Page</A>]</CENTER>
1182<!-- ************** HORIZONTAL RULE IMAGE ************-->
1183<P ALIGN=CENTER><IMG SRC="http://www.dfanning.com/images/hruler.gif" WIDTH=782 HEIGHT=3
1184   ALT="-------"></P>
1185
1186
1187<!-- ************** UPDATE NOTICE ************-->
1188
1189<P><CENTER>
1190Copyright &copy; 1997-2002 David W. Fanning<BR>
1191Last Updated 30 October 2002</CENTER>
1192
1193</body>
1194</html>
Note: See TracBrowser for help on using the repository browser.