StageTools - Documentation (Customize) [Prev][Up][Skip][Next]

Customization using Initialization Files:

Whenever one of the StageTools modules starts up, it looks for a "dot file" in your home directory. The file has the same name as the module being started, but preceded by a dot. For example, CenterStage looks for .CenterStage in your home directory. If it exists, the file should contain TCL commands to execute at startup. Usually, this file will define procedures whose names are of the form _user(name) (or _user::name for CenterStage) where "name" is one of a set of predefined names that are called at specified times by the StageTool module. [A list of these names and when they are called needs to be given].

The most common name to define is _user(Ready), which is executed just before the module starts accepting user input. This routine can perform any customization that is required by the module. For example, it could load additional object definitions into CenterStage, or could redefine the image conversion commands within BackStage.

An example of the latter would be to create .BackStage in your home directory so that it contains:

    proc _user(Ready) {} {
      proc _cmd(Convert) {old new type w h colors dither} {
        set options "-geometry ${w}x${h} +comment"
        if {$colors != ""} {
          if {$dither} {append options " -dither"} else {append options " +dither"}
          append options " -colors $colors"
        }
        switch $type {
          jpg {append options " -quality $::_image(quality)"}
          tiff {return "convert $options $old PPM:$old 2>&1 && ppm2tiff $old $new"}
          gif {return \
            "convert $options -quality 100 $old jpg:- | djpeg -gif -outfile $new"}
        }
        return "convert $options $old $type:$new" 
      }
    }

In this example, the _cmd(Convert) routine is replaced by one that handles TIFF and GIF files using tools other than ImageMagick's convert command for their final processing.

The startup files can perform virtually any commands, but that means you have to be careful about what you have them do, as you can cause serious errors as well.

[More examples need to go here.]


[HOME] StageTools Documentation web pages
Created: 20 Aug 1997
Last modified: Aug 17, 2006 9:44:05 AM
Comments to: dpvc@union.edu
[Next] Customization using config files
[Skip] Getting Started with StageTools
[Up] Customization Instructions
[Prev] Customization using X Resources