# coyote: FSC_PSCONFIG__DEFINE

- coyote/General Programming
- [Source code]

NAME

      FSC_PSCONFIG__DEFINE

PURPOSE

      The purpose of this program is to implement an object that
      can keep track of--and allow the user to change--the current
      configuration of the PostScript device.

AUTHOR

      FANNING SOFTWARE CONSULTING
      David Fanning, Ph.D.
      1645 Sheely Drive
      Fort Collins, CO 80526 USA
      Phone: 970-221-0438
      E-mail: david@idlcoyote.com
      Coyote's Guide to IDL Programming: http://www.idlcoyote.com/

CATEGORY

      General programming.

DOCUMENTATION

      Complete documentation for the FSC_PSCONFIG object, including
      keyword and method descriptions, and example programs using the object
      can be found on the Coyote's Guide to IDL Programming web page:
        http://www.idlcoyote.com/programs/docs/fsc_psconfig.html
      Or, if you would prefer, you can download a self-contained PDF file:
        http://www.idlcoyote.com/programs/docs/fsc_psconfig.pdf

KEYWORDS

      Any keyword accepted by the FSC_PSCONFIG object can be used with
      this program. Here are a few of the most popular keywords.
      Bits_per_Pixel - The number of image bits saved for each image pixel: 2, 4, or 8. The default is 8.
      Color - Set this keyword to select Color PostScript output. Turned on by default.
      Decomposed - Set this keyword to 0 to select indexed color and to 1 to select decomposed color.
      DefaultSetup - Set this keyword to the "name" of a default style. Current styles (you can easily
        create and add your own to the source code) are the following:
          "System (Portrait)" - The normal "default" system set-up. Also, "System".
          "System (Landscape)" - The normal "default" landscape system set-up.
          "Centered (Portrait)" - The window centered on the page. Also, "Center" or "Centered".
          "Centered (Landscape)" - The window centered on the landscape page. Also, "Landscape".
          "Square (Portrait)" - A square plot, centered on the page.
          "Square (Landscape)" - A square plot, centered on the landscape page.
          "Figure (Small)" - A small encapsulated figure size, centered on page. Also, "Encapsulated" or "Encapsulate".
          "Figure (Large)" - A larger encapsulated figure size, centered on page. Also, "Figure".
          "Color (Portrait)" - A "centered" plot, with color turned on. Also, "Color".
          "Color (Landscape)" - A "centered" landscape plot, with color turned on.
      Directory - Set this keyword to the name of the starting directory. The current directory is used by default.
      Encapsulated - Set this keyword to select Encapsulated PostScript output. Turned off by default.
      European - This keyword has been depreciated in favor of METRIC.
      Filename - Set thie keyword to the name of the PostScript file. The default is "idl.ps".
      Inches - Set this keyword to indicate sizes and offsets are in inches as opposed to centimeters. Set by Metric keyword by default.
      Landscape - Set this keyword to select Landscape page output. Portrait page output is the default.
      Language_Level - Set this keyword to select the Language Level interpreter. Default is 1.
      Metric - Set this keyword to indicate metric mode (i.e., A4 page and centimeter units). Turned off by default.
      PageType - Set this keyword to the "type" of page. Possible values are:
          "Letter" - 8.5 by 11 inches. (Default, unless the Metric keyword is set.)
          "Legal" - 8.5 by 14 inches.
          "Ledger" - 11 by 17 inches.
          "A4" - 21.0 by 29.7 centimeters. (Default, if the Metric keyword is set.)
      XOffset - Set this keyword to the X Offset. Uses "System (Portrait)" defaults. (Note: offset calculated from lower-left corner of page.)
      XSize - Set this keyword to the X size of the PostScript "window". Uses "System (Portrait)" defaults.
      YOffset - Set this keyword to the Y Offset. Uses "System (Portrait)" defaults. (Note: offset calculated from lower-left corner of page.)
      YSize - Set this keyword to the Y size of the PostScript "window". Uses "System (Portrait)" defaults.
      In addition, the following keywords can be used:
      CANCEL -- An output keyword that will be set to 1 if the user
      chooses the Cancel button on the form. It will be 0 otherwise.
      FONTINFO -- Set this keyword is you wish to have font information
      appear on the form. The default is to not include font information.
      FONTTYPE -- Set this keyword to a named variable that will indicate
      the user's preference for font type. Values will be -1 (Hershey fonts),
      0 (hardware fonts), and 1 (true-type fonts). This keyword will always
      return -1 unless the FONTINFO keyword has also been set.
      GROUP_LEADER -- Set this keyword to a widget identifier of the widget
      you wish to be a group leader for this program.

EXAMPLE

      A simple sequence of using the object would look something like this:
        psObject = Obj_New("FSC_PSCONFIG")
        psObject->GUI
        psKeywords = psObject->GetKeywords()
        thisDevice = !D.Name
        Set_Plot, 'PS'
        Device, _Extra=psKeywords
        cgImage, image
        Device, /Close_File
        Set_Plot, thisDevice
        Obj_Destroy, psObject
      ote that the object can also be called from the cgPS_Config interface:
        psKeywords = cgPS_Config()

OTHER PROGRAMS NEEDED

      The following programs are required to run this one:
        fsc_droplist.pro
        fsc_fileselect.pro
        fsc_field.pro
        fsc_plotwindow

MODIFICATIONS

      Written by David W. Fanning, 31 January 2000.
      Added capability to call GUI methods when the current graphics device
         doesn't support windows. Device is restored when the GUI exits. 11 May 2000. DWF.
      Changed the default value for the Color keyword to 1. 16 May 2000. DWF.
      Fixed a bug where filename changed when switching Setups. 8 AUG 2000. DWF.
      Fixed a bug when saving setup in Landscape mode. 8 AUG 2000. DWF.
      Added the ability to Get and Set the object's name via the SetProperty
         and a very abbreviated GetProperty method. Also added a GetName method. 26 SEP 2000. DWF.
      Fixed a problem in which the proper configuration was not restored if in Landscape mode. 20 Nov 2000. DWF.
      Made a number of modifications at the request of Martin Schultz. 4 Dec 2000. DWF.
      Fixed a bug when setting file  and directory names with the SetProperty method. 18 Dec 2000. DWF.
      Fixed a small problem in initializing the page size properly. 3 Jan 2001. DWF.
      Corrected a problem that resulted from a change to FSC_DROPLIST. 6 Jan 2001. DWF.
      Added the ability to restore the font type instead of always reverting to !P.Font. 7 Jan 2001. DWF.
      Increased the length of the file/directory name fields. 7 Jan 2001. DWF.
      Fixed another problem with Landscape mode interacting with A4 paper size. 7 Jan 2001. DWF.
      Seems I only half fixed the previous problem. :-( 26 April 2001. DWF.
      Forgot to update program to reflect change in FSC_FIELD. Fixed 26 April 2001. DWF.
      Changed BOOKMAN keyword to BKMAN to avoid conflict with BOOKSTYLE keyword. 26 April 2001. DWF.
      Modified the System Defaults to say "None" if none is used. Improved documentation. 10 September 2001. DWF.
      Added the ability to specify a filename at the same time as a Default Setup. 10 September 2001. DWF.
      Fixed a small problem in not setting new page sizes appropriately. 22 May 2002. DWF.
      Fixed a problem that occurred when the Accept button was not named "Accept". 6 May 2003.DWF.
      Whoops! I was a bit overly agressive on that last fix. :-( 17 July 2003. DWF.
      Fixed a problem with setting page types when using the DEFAULTSETUP keyword. 31 July 2003. DWF.
      Fixed a problem with turning encapsulation on in the GUI. Renamed ENCAPSULATE keyword ENCAPSULATED
         to avoid obvious errors. 31 July 2003. DWF.
      Removed obsolete STR_SEP and replaced with STRSPLIT. 27 Oct 2004. DWF.
      Now honoring EUROPEAN keyword when setting system default setups in the INIT method. 12 Nov 2004. DWF.
      Added CMYK output option 24 August 2007. Assumes LANGUAGE_LEVEL=2 printer. L. Anderson.
      Fixed a problem with the filename on WINDOWS computers coming back with forward slashes instead of
          backward slashes. 20 May 2008. DWF.
      Modified the program to return as the default, ISOLATIN1=1. 18 July 2008. DWF.
      Fixed a problem with filenames when a DEFAULTSETUP was used with it. 12 Nov 2008. DWF.
      Changed default window size when LANDSCAPE keyword is set. 10 April 2009. DWF.
      Changed the default window size for PORTRAIT mode to be a bit larger. 10 April 2009. DWF.
      Updated for IDL 7.1 and 24-bit color PostScript support. 24 May 2009. DWF.
      Added PAGETYPE field to returned structure to allow PostScript page type to be determined. 8 August 2009. DWF.
      Fixed a problem with 24-bit color support that allowed only IDL 7 versions to work correctly. 20 Sept 2009. DWF.
      Added a LANGUAGE_LEVEL keyword. 13 Dec 2010. DWF.
      Added the FONTYPE value to the keyword return structure. 14 Dec 2010. DWF.
      Modified the return structure to turn landscape mode off and set offsets to zero if in
           encapsulated mode. 19 Feb 2011. DWF.
      Changes to handle inability to create raster files from PS encapsulated files in
           landscape mode. Also removed changes of 19 Feb 2011 as no longer needed. 26 Aug 2011. DWF.
      The PAGETYPE was not getting set properly in the return keywords when the Metric
           option was selected on the GUI. 12 October 2011. DWF.
      The program now remembers the last directory you used and will start in that
          directory, unless told otherwise. 26 Oct 2011. DWF.
      Parsing of full filename failing. Fixed 27 Oct 2011. DWF.
      Modified the structure of keywords returned from the GetKeywords method to use the field ISOLATIN rather than
          ISOLATIN1. Did this so keyword structure can be passed directly to cgPS_Config. 11 April 2014, DWF.