next up previous contents index
Next: Kernel File Interface Up: 3D-Display Implementation Previous: The 3D Display

Panels

   

The panels were implemented with the Intrinsics -- and Athena Toolkit for X11 Release 4. The structure of the panels is similar to those of the 2D--interface, to make the display as homogeneous as possible. Therefore, the routines in module ui_xWigets.c have been used.

The module d3_xUtils.c contains the two functions d3_xCreateButtonItem and d3_xCreateToggleItem. They create the buttons and import the ''xbm'' bitmaps for labeling the buttons.

Most of the panels are programmed in a similar fashion. Therefore, the implementation of the panel for the projection is described as an example. The panel looks like this:

 
Figure: Project panel

In module d3_panels.c five functions handle the project panel.

  d3_createProjectpanel: This routine is a callback function of the button in the control panel. As a parameter, the button itself is passed. From there, XtTranslateCoords computes the position at which the project panel is to be opened with XtCreatePopupShell. Since the panel is supposed to have an inner frame, a window of boxWidgetClass is created with XtCreateManagedWidget. There the actual window of class formWidgetClass is located. Now the two radio buttons and are created with d3_xCreateToggleItem. Then the labeling Viewpoint X with ui_xCreateLabelItem and the dialogue window follow. The next two lines are created similarly. Then the button is created with d3_xCreateButtonItem. In the next step the three callbacks for the three buttons are created by XtAddCallback. setParallelProjection and setCentralProjection are linked to the two radio buttons, d3_closeProjectpanel to the button. Now a temporary variable temp_state of type d3_state_type for the status of the display is generated. All changes to the status are stored there as long as the panel exists. Now one of the two radio buttons gets inverted by setProjectToggleState, corresponding with the current status. At last, the panel is made visible by XtPopup with XtGrabExclusive.

  setParallelProjection: If the button is clicked, this function sets the field temp_state.projection_mode to parallel. A call to setProjectToggleState updates the panel.

  setCentralProjection: like setParallelProjection

  setProjectToggleState: With this function, the status of the two radio buttons is updated. The variable temp_state.projection_mode is read, one of the buttons is set, the other reset.

  d3_closeProjectpanel: When the panel is closed, the values of the dialogue windows have to be written to the variable temp_state.viewpoint. Now temp_state is compared with the initial status variable d3_state. If they differ, a parameter has changed and the net has to be redrawn. This is done by copying temp_state to d3_state and calling d3_drawNet afterwards. The indirection with the temporary variable is necessary, since the panel may have been opened by mistake or for control reasons. In this case the net doesn't have to be redrawn.



next up previous contents index
Next: Kernel File Interface Up: 3D-Display Implementation Previous: The 3D Display



Niels Mache
Wed May 17 11:23:58 MET DST 1995