next up previous contents
Next: Workarea Modules Up: GUI Implementation Previous: Pull-Down Menu Modules

Toolbar Modules

All the procedures which construct and manipulate the toolbar are contained in one module, as shown in Table 3.2.

 

 
Module Name Purpose
toolbar.tcl This module contains procedures for the creation and manipulation of the toolbar. Procedures to establish appropriate workarea canvas bindings upon button activation are also included in this module.
Table 3.2: Toolbar Module Responsibilities

The toolbar, which is created by toolbar_create, is comprised of one large frame which encompasses all the buttons and labels contained within the toolbar. The buttons themselves are packed horizontally in smaller subframes. The organization of buttons on the toolbar is controlled indirectly by the associative array tb_buttons which determines how the buttons are grouped. Each element of the tb_buttons array contains a grouping of buttons which are represented by a list of sublists of bitmaps which are displayed in the buttons. For example, the organization of the Components buttons in the toolbar presented in Figure 2.1 was achieved by the list grouping shown in Figure 3.3.

   figure1486
Figure 3.3: The tb_buttons Associative Array

As with the pull-down menu, new buttons can be easily added to the toolbar by modifying the tb_buttons array; the bitmaps which appear on the buttons can be drawn using the X client bitmap. The location of the toolbar is controlled by the procedure tb_move which positions the toolbar either to the left or right of the workarea canvas.

In most cases, several procedures are invoked when a button is pressed. These procedures have two major responsibilities. First, they keep the button depressed until the user has either completed or aborted the chosen operation. Second, they establish appropriate canvas bindings on the workarea which carry out the operation selected from the toolbar when the leftmost mouse button is pressed on a circuit element which will be affected by the operation.

In accomplishing this second task, the procedure tb_set_bindings is called for each circuit element which is affected by the selected toolbar operation. An abbreviated version of that procedure is presented in Figure 3.4.

   figure1499
Figure 3.4: Establishing Canvas Bindings in tb_set_bindings

The procedure will invoke the appropriate attrib_ procedure, described later, as the mouse pointer enters and leaves affected circuit elements. Pressing the leftmost mouse button, indicated by <1> in the code fragment, will dispatch the appropriate procedure to perform the operation on the circuit element currently under the mouse pointer.

The actual tb_set_bindings procedure contains some special cases which handle the rotation of components (which use both the leftmost and middle mouse buttons) and multiboxes.


next up previous contents
Next: Workarea Modules Up: GUI Implementation Previous: Pull-Down Menu Modules

Donald Craig
Mon Jul 8 12:05:35 NDT 1996