next up previous contents index
Next: File menu Up: Customizing tnimage Previous: Non-Motif Resources   Contents   Index


User-Defined Custom Buttons

The buttons at the left of the screen, above the information area, are completely user-configurable. The existing buttons can be removed, or any additional number of other buttons can be added. To add a new button, edit the configuration file tnimage.ini in the directory $HOME/.tnimage . Change the entry ``nbuttons'' to the total number of buttons. Then add a separate line for each button containing the word ``button'', the button label (which can be anything up to 6 characters, with no spaces or control characters), and the command. The command can be any valid macro command (See Sec.13), including parameters.

Examples:
button Tran. transparency
adds a button labeled ``Tran.'' which will set the transparency level for the current image.

button Math math
adds a button labeled ``Math'' which will activate the Image algebra dialog box.

button FFT fft
adds a button labeled ``FFT'' which will activate the Fourier transform dialog box.

button Junk load my_junk.tif 100 100 0.75 0.666
adds a button labeled ``Junk'' which will read the image file ``my_junk.tif'' at coordinates 100,100 and shrink it to 75% of its normal width and 66% of its normal height.

button Gray colorgrayscale

adds a button labeled ``Gray'' which will convert the current immage to grayscale.

button Other macro my-macro
adds a button labeled ``Other'' which automatically loads and runs the macro from the file ``my-macro''.

If two commands are placed on the same line, the button automatically becomes a toggle button. Clicking it once causes the button to appear ``pushed in'', and the first command is executed. Clicking it a second time causes the button to return to its ``out'' position, and the second command is executed. The commands are separated by a colon (:), for example:

button Open open gold.tif 100 100:close

This creates a button named ``Open'' which reads the image ``gold.tif'' and places it at position 100,100 when clicked. Clicking it a second time causes the image to be closed.

Setting the second command to ``null'', or omitting it, prevents toggle mode. The button will be automatically unpressed. For commands like ``slew'', which toggles a state on or off, the same command should be entered for both the ``on'' and ``off'' commands. Setting the command to ``cancel'' causes the main Cancel button (if present) or the command ``cancel'' in a macro to reset the button,

Here is a sample tnimage.ini file for the author's system:

          version 3.2.1
          area_selection_mode 1
          auto_undo 1
          background_color 9474192
          background_image_color 9474192
          background_palette 1
          background_red 144
          background_green 144
          background_blue 144
          camera 
          camera_id 0
          copy 1
          compression /bin/gzip -f
          compression_ext .gz
          decimal_point .
          decompression /bin/gunzip -c
          default_font *helvetica-bold-r-normal--12*
          double_click_msec 400
          image_font *adobe-times-bold-r-normal--24-240-75-75*
          information_width 120
          foreground_color 0
          foreground_red 0
          foreground_green 0
          foreground_blue 0
          format_path /home/tjnelson/.tnimage/formats
          help_directory /usr/local/lib/tnimage
          jpeg_q_factor 80
          luminosity_red 0.299
          luminosity_green 0.587
          luminosity_blue 0.114
          object_threshold_red 50
          object_threshold_green 50
          object_threshold_blue 50
          print_paper_xsize 8.5
          print_paper_ysize 11
          print_blue_factor 1
          print_depletion 0
          print_dither 8
          print_graybalance 0
          print_green_factor 1
          print_intensity_factor 1
          print_palette 2
          print_paper 0
          print_language 0
          print_positive 1
          print_quality 0
          print_red_factor 1
          print_resolution 300
          print_device 3
          print_vertical 1
          print_hsize 4
          print_ratio 1
          print_rotation 0
          print_interpolate 0
          print_command lpr -P
          print_devicename /dev/lp2
          print_hpos 0
          print_vpos 0
          read_cmyk 1
          save_cmyk 0
          scanner /dev/scanner
          scannerid 0
          signif_digits 4
          spacing 4
          split_frame_cols 4
          text_spacing 0
          total_xsize 1190
          total_ysize 862
          use_custom_header 1
          want_colormaps 0
          want_crosshairs 0
          want_messages 2
          want_quantize 1
          want_raise 1
          want_shell 0
          want_slew 0
          want_byte_order -1
          want_title 0
          wavelet_path /usr/local/lib/wavelets
          window_border 1
          window_handle_size 2
          xlib_cursor 34
          nbuttons 20
          button Cancel cancel:null
          button Slew slew:slew
          button Open open:null
          button Close close:null
          button New new:null
          button Save save:null
          button Sketch sketch:cancel
          button Line line:cancel
          button Move move:move
          button Erase erase:null
          button Scan scan:null
          button Print print:null
          button Label label:null
          button Zoom zoom:repair
          button Fcolor foregroundcolor:null
          button Bcolor backgroundcolor:null
          button Prop attributes:null
          button Config configure:null
          button Undo undo:null
          button Quit quit:null


next up previous contents index
Next: File menu Up: Customizing tnimage Previous: Non-Motif Resources   Contents   Index
root 2006-11-13