3.8. Reading and writing files

Basic commands for reading and writing crafter models are provided in the File menu along with some short cuts for common file operations. If a menu item has a "..." at the end of its label (e.g. "Open"), then a file chooser like the following is popped for you to specify a filename.


By default, only files ending with a .cr suffix and directories are shown in the scrolling list. To change this filter, enter a name with wildcards (e.g. *.jpl or *) and click the Filter button.

To specify a file name, double-click on one in the list or enter the name directly into the text field at the bottom. A single-click on a file in the list puts the file name in the text field, where you may edit it if you like and press <ENTER> or press the Open or Save button when you're done.

The Delete and Make Dir buttons affect the files on the Unix file system. Delete removes the specified file and Make Dir makes a directory with the specified name. The toggle menus at the top let you go back to recent directories you've been browsing.

New
Delete everything in the current model; create an empty, unnamed model.
Open...
Replace the current model with the model in a specified file.
Save
Save the model in the current file.
Save As...
Save the model in a specified file.
Save Geometry...
Save the geometry of the model (in Geomview's OOGL format) to a specified file.
Revert
Replace the current model with the most recently saved version of the model.
Print...
Save the current camera view as a PostScript file.

3.9. Feeding commands to Crafter

Crafter is written in Tcl/Tk, which is an interpreted command language for controlling applications and developing graphical user interfaces. Since it is interpreted, any operation that can be done through the user interface, can also be done with a Tcl command.

There are two ways in which you can feed Tcl commands to Crafter: (1) by typing commands into a Tcl shell window, and (2) by sending commands through a pipe.

Each of these operations can be invoked from the File menu.

Tcl Shell...
Open a window for typing in Tcl commands. The window allows you to type commands to modify the model. Type a command at the prompt and the result of the command will be displayed in italics in the window.


Open Pipe...
Create a named pipe for receiving Tcl commands. By default the pipe is put in /tmp/geomview. Commands may then be sent to Crafter by sending them to the named pipe. The file browser is popped up for you to enter a pipe name.

3.10. Quitting Crafter

To quit Crafter and Geomview, select the Quit item from Crafter's File menu. Alternatively, you can quit both programs from Geomview by clicking the Quit button in the upper-right corner of Geomview's main window or by pressing the <ESC> button in Geomview's camera window.

If you don't want to quit Geomview, then kill Crafter by going to the list of external modules in Geomview's main window and clicking on Crafter's red instance entry. This entry begins with a number in brackets. For example, the middle of the three lines below is the instance entry:

Crafter
[1]Crafter "voyager.cr"
Crafter "voyager.cr"

You may restart Crafter by clicking on one of the entries in the list of modules. One or two entries are provided -- one with no arguments and with the arguments you specified on the command line if any.

3.11. Keyboard Shortcuts

Menu items and buttons can be invoked not only with the mouse, but also with keyboard shortcuts. Each menu in the Model Editor and many of the buttons in other panels have one letter in the label underlined. This is the called a mnemonic.

Menu items

To invoke a menu item with the keyboard, first post the menu by typing the <ALT> key plus the mnemonic character while the mouse is the Model Editor. Once a menu is posted, pressing the mnemonic of a menu item invokes that particular item. Alternatively, the up and down arrow keys may be used in a posted menu to select a menu item. Then press the <ENTER> key to invoke it.

For example, to post the File menu, type <ALT> + <f>. Then, to choose the Save menu item, either press the <s> key or press the <DOWN> arrow two times and then press <ENTER>.

Buttons

Invoking a button using the keyboard is much more straight forward than invoking menu items. With the cursor in the window containing the button you want to invoke, simply type the <ALT> key plus the mnemonic character. For example, to invoke the Dismiss button on any of the panels, type <ALT> + <d>.

Text fields

When typing into a text field, the following operations are allowed using special characters:
Control-a Moves insertion cursor to beginning of entry.
Control-e Moves insertion cursor to end of entry.
Control-/ Selects all the text in the entry.
Control-\ Clears any selection in the entry.
Control-d Deletes the character to the right of the insertion cursor.
Meta-d Deletes the word to the right of the insertion cursor.
Control-w Deletes the word to the left of the insertion cursor.
Control-k Deletes all characters to the right of the insertion cursor.
Control-t Reverses the order of the two characters to the right of the insertion cursor.
Control-r Resets the entry to its default value.