next up previous contents
Next: Start-up file Up: Customising FEMGV Previous: Environment Variables

Subsections


FEMGV Resource Management

  The use of environment variables provide a convenient method of communicating user preferences to the program, but they do have some limitations:

The FEMGV supports a form of Resource Management which offers an alternative way of customising the appearance and behaviour of the program.

Resource/Value pairs can be specified either on the command line used to invoke FEMGV or in resource files.

Resource Files

A resource file is a text file which has the following basic format:

   <ID>.<program>.<class>.<resource><separator><string>

where

<ID>is the string Femsys
<program> is the program or module name - femview, femgen, femgv
<class> is the class name for class dependent resources
<resource> is the resource name
<separator> is <whitespace>:<whitespace>
<whitespace> is <spaces>|<tabs>

Wildcards, *, are allowed where sensible, and any lines beginning with # are treated as comments.

For example, consider the following resource file:

   #
   # This is the Global Resource File for FEMGEN/FEMVIEW
   #
   # Produce Monochrome output for the LaserJets
   Femsys.*.HPGL2.Monochrome      :       true
   # Use Courier Oblique font for
   # Large Characters on Postscript Printers
   Femsys.*.Postscript.LargeFont   :       Courier-Oblique
   # End of File

Note the use of comments and that the <program> field is a wildcard.

An example resource file, femsys.ini, is included in the software distribution.

When FEMGV needs to find a value for a resource it will look in several locations, as detailed below:

1.
On the command line. For example, you might invoke FEMGV via
   femgv -Geometry 700x500

indicating that you require an initial window size of 700x500.

2.
In the User Resource File.
The User Resource File can reside in a number of locations. These are searched in the following order:

(a)
In the file named by the environment variable FEMSYS_INIT, if specified.
(b)
In femsys.ini in the current working directory.
(c)
In femsys.ini in the user's home or login directory.
3.
In the Global Resource File.
The Global Resource File can reside in a number of locations. These are searched in the following order:

(a)
In the file named by the environment variable FEMSYS_GLOBAL_INIT, if specified.
(b)
If FEMSYS_GLOBAL_INIT has not been set then look for femsys.ini in the directory named by the environment variable FGVKEY, if specified. If running under Windows95/NT and FGVKEY has not been set look for femsys.ini in a directory ..
..
Custom
relative to where the executable is stored.
4.
If the resource is not specified in any of the above, and there is no corresponding environment variable set, then some hard-coded default is taken.

Since resource files will be re-read each time a DRAWING SAVE PLOTFILE is issued, it is possible to change the contents whilst FEMGV is executing.

Users of the X Windows system will no doubt recognise the similarity between the FEMGV resource manager and that provided by X Windows; indeed the system has been designed so that you can simply insert the FEMGV resource specifiers into your existing .Xdefaults file.

At first glance, this may seem unnecessarily complex! However, it is really quite straightforward and does allow for site-wide defaults which may be overridden at either a user or project level. For example, the System Administrator may decide that a sensible default for the HPGL/2 plotter driver is monochrome output since most of the HPGL/2 capable printers on site are LaserJet IV. So, he creates a Global Resource file, femsys.ini

   #
   # This is the Global Resource File for FEMGEN/FEMVIEW
   #
   # Produce Monochrome output for the LaserJets
   Femsys.*.HPGL2.Monochrome      :       true
   Femsys.*.HPGL2.Colour          :       false
   # End of File

which he puts into the keyfile directory. However, User A has a Paintjet plotter with an HPGL/2 cartridge in his office, and so colour would be a more sensible default for him. So, he simply creates a file femsys.ini in his login directory which looks like this:

   #
   # This is the User Resource File for User A
   #
   # Give me Colour!
   Femsys.*.HPGL2.Colour : true

Full details of the currently available resources are given in Appendix B.

Command Line Resources

It is possible to specify resource names and values on the command line when the program is invoked. Only the resource name and value can appear, not the <ID>, <program> or <class> fields. Since several resource names are duplicated across various classes, Colour and Monochrome for example, this facility should be used only in situations where there is no possibility of ambiguity.

Also, please note that some operating systems, notably VAX/VMS and OpenVMS, will convert all command line arguments to uppercase unless they are enclosed within double quotes. For example,

   femgv -Orientation Landscape

will return the command line arguments as -ORIENTATION and LANDSCAPE, whereas

   femgv "-Orientation" "Landscape"

will return the expected -Orientation and Landscape

An Example

The following Postscript plot was produced twice, once using all of the default settings, and then using the following User Resource File:

Femsys.*.Postscript.SmallFont	:	Helvetica-Oblique
Femsys.*.Postscript.LargeFont	:	Palatino-Bold
Femsys.*.Postscript.TitleFont	:	ZapfChancery-MediumItalic
Femsys.*.Postscript.TitleFontSize	:	16
Femsys.*.Postscript.FontSize	:	12
Femsys.*.Postscript.SymbolScale	:	2.0
Femsys.*.Postscript.PageSize	:	210x297
Femsys.*.Postscript.PageMargins	:	19.05+19.05
Femsys.*.Postscript.PageSizeUnits :	mm
Femsys.*.Postscript.Orientation	:	Landscape


 
Figure 6.1: Default Settings
\begin{figure}
\centerline{
\psfig {figure=default.eps,height=9.0in}
}\end{figure}


 
Figure 6.2: User Resource File Settings
\begin{figure}
\centerline{
\psfig {figure=resource.eps,height=9.0in}
}\end{figure}

Supported Resources

Please see Appendix B for details of the currently supported resources.


next up previous contents
Next: Start-up file Up: Customising FEMGV Previous: Environment Variables

Femsys Limited
9/10/1999