SFA Project On-line Documentation: SFAInterface

The SFAInterface class is used primary to provide an interface to the TwoHand library's Sundial functions to SFA. All main Sundial structures (excluding those dealing with Subsets and Contours) are found here. TwoHand's button press functionality is also managed here.
//
//  Interface.H
//
//  This file defines the interface (TwoHand implementation).
//
//  James Hall  May 1998
//

# ifndef SFA_INTERFACE_H
# define SFA_INTERFACE_H 1

# include 
# include 
# include 
# include 
# include 

// X-Includes
#include 
#include 
#include 
#include 

// OpenGL Includes
#include 
#include 
#include 

// SFA Includes
// #include "sfa_ui.H"
#include "Defines.H"
#include "DataSet.H"
#include "DataSetList.H"
#include "PackedGlyph.H"
#include "Subset.H"

// MR Includes
#include "MR/dbg.h"
#include "TwoHand.h"
#include "THsundial.h"
#include "THbutton.h"

class SFAInterface {
	int adj;

	// The DataSetList
	DataSetList *the_DSL;

	// The menu
	Sundial     *LeftButton2Menu; 

	// The menu hierarchy
	static SundialItem LeftButton2CtrlItems[];
	static SundialItem LeftButton2GlyphItems[];
	static SundialItem LeftButton2Items[];
	static SundialItem LB2XStepItems[];
	static SundialItem LB2YStepItems[];
	static SundialItem LB2ZStepItems[];
	
	// True callbacks
	void popupSundial(void);
	void popdownSundial(void);
	void grab(void);
	void ScaleUpSCB(Sundial *, SundialItem *);
	void ScaleDownSCB(Sundial *, SundialItem *);
	void BoresightSCB(Sundial *, SundialItem *);
	void OriginSCB(Sundial *, SundialItem *);
	void XStepSCB(Sundial *, SundialItem *);
	void YStepSCB(Sundial *, SundialItem *);
	void ZStepSCB(Sundial *, SundialItem *);
	void GlyphSCB(Sundial *, SundialItem *);
public:
	int SundialPopped;
	// Constructor & Destructor
	SFAInterface(void);
	~SFAInterface(void);

	// Accessors

	// Mutators
 	void setDSL(DataSetList *);
	void setWidgetSize(GLfloat, GLfloat);

	// Other functions (Interface Management)
	void init_buttons(void);
	void Initialize(void);
	int echoLeftMenu(void);
	void evalLeftMenu(void);
	int echoRightMenu(void);
	void evalRightMenu(void);

	// Static callback management functions
	static void popupSundialCallback(void *);
	static void popdownSundialCallback(void *);
	static void grabCallback(void *);
	static void ScaleUpSCBCallback(Sundial *, SundialItem *, void *);
	static void ScaleDownSCBCallback(Sundial *, SundialItem *, void *);
	static void BoresightSCBCallback(Sundial *, SundialItem *, void *);
	static void OriginSCBCallback(Sundial *, SundialItem *, void *);
	static void XStepSCBCallback(Sundial *, SundialItem *, void *);
	static void YStepSCBCallback(Sundial *, SundialItem *, void *);
	static void ZStepSCBCallback(Sundial *, SundialItem *, void *);
	static void GlyphSCBCallback(Sundial *, SundialItem *, void *);
};

# endif // SFA_INTERFACE_H
    

Constructors

SFAInterface(void);

The SFAInterface constructor initializes state variables required for the class.

~SFAInterface(void);

THe SFAInterface destructor calls the MR Toolkit's TS_end() functionality to dump timing information to the MR_dbgfile.

Mutators

void setDSL(DataSetList *);

This function sets the DataSetList class pointer used within the Sundial menu initializations for callsbacks dealing with Subsets and Contours (button press callbacks).

Accessors


Other Functions

void init_buttons(void);

This function uses the TwoHand THButtonAddCallback function call to initialize all the button press callback functions for both the left and right bats.

void Initialize(void);

This function initializes the top level sundial menus within SFA.

int echoLeftMenu(void);

If the sundial menu is currently in a state to be displayed, calls the THSundialEcho function to display the menu on the screen at the Left cursor's location.

void evalLeftMenu(void);

Archaic (not used).

int echoRightMenu(void);

If the sundial menu is currently in a state to be displayed, calls the THSundialEcho function to display the menu on the screen at the Right cursor's location.

Not currently used in SFA.

void evalRightMenu(void);

Archaic (not used).

Callback Functions

void popupSundial(void);

Sets the SundialPopped state flag indicating the sundial should be drawn each frame.

void popdownSundial(void);

Sets the SundialPopped state flag indicating the sundial should no longer be drawn each frame. Calls the THSundialEvalSelect function to evaluate the current Sundial menu to decide if a menu option has been selected.

void grab(void);

Starts/stops grab mode. When mode is active, movement with the left bat is used to move the entire scene.

void ScaleUpSCB(Sundial *, SundialItem *);

Calls THJumpZoom to globally scale up the entire scene.

void ScaleDownSCB(Sundial *, SundialItem *);

Calls THJumpZoom to globally scale down the entire scene.

void BoresightSCB(Sundial *, SundialItem *);

Calls THCursorBoresight to adjust cursor parameters.

void OriginSCB(Sundial *, SundialItem *);

Calls THCursorOrigin to remap both the left and right cursor to the current location (enabling the user to position the cursors in a comfortable position).

void XStepSCB(Sundial *, SundialItem *);

Throwback from old SFA versions. Used originally to adjust Xsize stepsize for cache buildup. Not currently used.

void YStepSCB(Sundial *, SundialItem *);

Throwback from old SFA versions. Used originally to adjust Ysize stepsize for cache buildup. Not currently used.

void ZStepSCB(Sundial *, SundialItem *);

Throwback from old SFA versions. Used originally to adjust Zsize stepsize for cache buildup. Not currently used.

void GlyphSCB(Sundial *, SundialItem *);

Throwback from old SFA versions. Used originally to adjust shape for cache buildup. Not currently used.

Static Callback Wrapper Functions

(All Static Callback Wrappers call the functions named the same without the word 'Callback' at the end of the function).

static void popupSundialCallback(void *);

static void popdownSundialCallback(void *);

static void grabCallback(void *);

static void ScaleUpSCBCallback(Sundial *, SundialItem *, void *);

static void ScaleDownSCBCallback(Sundial *, SundialItem *, void *);

static void BoresightSCBCallback(Sundial *, SundialItem *, void *);

static void OriginSCBCallback(Sundial *, SundialItem *, void *);

static void XStepSCBCallback(Sundial *, SundialItem *, void *);

static void YStepSCBCallback(Sundial *, SundialItem *, void *);

static void ZStepSCBCallback(Sundial *, SundialItem *, void *);

static void GlyphSCBCallback(Sundial *, SundialItem *, void *);


James Hall