Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

animp.cpp File Reference

#include "gl_box.h"
#include "movie.h"
#include "sphere.cpp"
#include "cylinder.cpp"
#include "gl_box.cpp"
#include "drawable.cpp"
#include "fat_slider.h"
#include <string>
#include <map>

Namespaces

namespace  std

Defines

#define BAR_HEIGHT   30
#define GLWIDTH   640
#define GLHEIGHT   480
#define WIDTH   (GLWIDTH+110)
#define MIN_WIDTH   400
#define HEIGHT   (GLHEIGHT+BAR_HEIGHT+20)
#define MIN_HEIGHT   300

Functions

void name_cb (const char *s)
 This is the callback function for the fltk file chooser widget which is used in 2 functions.

void timer_cb (void *x)
 This is the callback routine for the fltk timer.

void rate_cb (Fl_Widget *w, void *x)
 This is the fltk callback function for the rate_slider widget.

void size_cb (Fl_Widget *w, void *x)
 This callback adjusts the gl_size variable to control the sizes of spheres and cylinders.

void near_cb (Fl_Widget *w, void *x)
 This callback sets the value of the near_counter when its adjustment buttons are clicked.

void clip_cb (Fl_Widget *w, void *x)
void far_cb (Fl_Widget *w, void *x)
 This callback sets the value of the far_counter when its adjustment buttons are clicked.

void frame_counter_cb (Fl_Widget *w, void *x)
 This is the callback function for the frame_counter widget.

void zoom_cb (Fl_Widget *w, void *x)
 This is the callback function for the zoom_slider.

void stop_cb (Fl_Widget *w, void *x)
void reset_cb (Fl_Widget *w, void *x)
 This is the callback function for the reset_button.

void save_movie_cb (Fl_Widget *w, void *xxx)
 This is the function invoked by the File--Save Movie menu item.

void save_frame_cb (Fl_Widget *w, void *xxx)
 This is the function invoked by the File--Save Frame menu item.

void detail_cb (Fl_Widget *w, void *xxx)
 This is function invoked by the level of detail radio buttons under the Options menu.

void turn_cb (Fl_Widget *w, void *xxx)
 This callback sets the spin rate for automatic rotation of the image.

void stereo_cb (Fl_Widget *w, void *xxx)
 This callback calls set_stereo with the proper value to change the stereo mode to normal, fullscreen, stereo or cross-eyed stereo.

void lights_cb (Fl_Widget *w, void *xxx)
 This is the callback function for the lights option from the Options menu.

void wobble_cb (Fl_Widget *w, void *xxx)
 This callback function turns the wobble mode of the gl_box to either on or off.

void transparency_cb (Fl_Widget *w, void *xxx)
 This is the callback function for the transparency option from the Options menu.

void axes_cb (Fl_Widget *w, void *xxx)
 This is the axes callback function from the Options menu.

void box_cb (Fl_Widget *w, void *xxx)
 This is the box callback function from the Options menu.

void trans_cb (Fl_Widget *w, void *x)
 This is the callback routine for the trans_button widget.

void trans_slider_cb (Fl_Widget *w, void *x)
 This is the callback function for the trans_slider widget.

void color_cb (Fl_Widget *w, void *x)
 This is the callback function for the color_button.

void set_color_button_menu ()
 This function is called after opening a movie file to set the menu items for the color_button and trans_button.

void open_cb (Fl_Widget *w, void *xxx)
 This callback uses the fl_file_chooser function to select either an animp movie file (.an) or a molecule file (.pdb).

void menu_cb (Fl_Widget *w, void *)
 Function to handle unassigned menu options.

void quit_cb (Fl_Widget *, void *)
 This callback writes ".animprc" and exits.

void read_animprc ()
 This function reads ".animprc" and sets values stored there.

int main (int argc, char **argv)

Variables

bool in_open = false
 When opening a file, the data normally used for drawing the GL display is being modified.

moviem
 Animp uses one movie structure to hold the data for displaying either a movie or a molecule.

map< int, string > rev_color_table
 rev_color_table is used to get the element string like "He" for a color index when building the color button menu.

Fl_Double_Window * window
 The window variable is used only within animp.cpp to refer to the fltk window.

Fl_Group * controls
 The animp controls are placed in an Fl_Group to facilitate diplaying/not displaying the controls.

gl_boxgl
 The gl pointer is a pointer to the gl_box which is used to display the animation.

Fl_Slider * rate_slider
 The rate_slider widget controls the length of time for the timer callback.

Fl_Slider * size_slider
 The size_slider controls a scaling factor for spheres and cylinders.

fat_sliderclip_slider
Fl_Counter * near_counter
 The near_counter is used to specify the front clipping plane for software clipping.

Fl_Counter * far_counter
 The near_counter is used to specify the far clipping plane for software clipping.

Fl_Slider * zoom_slider
 The zoom_slider controls the distance of the view point from the middle of the displayed data.

Fl_Slider * trans_slider
 The trans_slider controls the alpha value for the currently selected color.

Fl_Button * stop_button
 The stop_button is used to pause the animation.

Fl_Button * reset_button
 The reset_button is used to reset the rotation of the displayed data and the rotation of the light source.

Fl_Counter * frame_counter
 The frame_counter widget is used to advance (or reverse) the movie 1 or 10 frames at a time.

Fl_Menu_Button * color_button
 The color_button is used to bring up a list of colors to adjust.

Fl_Choice * trans_button
 The trans_button is used to display a list of colors to select.

char name [200]
 The name array is used to hold the file name selected using the fltk file chooser widget.

double gl_delay = 0.2
 This is the time for the fltk timer used to control the animation speed.

double gl_size = 1.0
 This is the scale factor for increasing or decreasing the size of spheres and cylinders.

int color_select = 0
 The color_select variable is used to determine which color is to be adjusted by the trans_slider widget.

Fl_Menu_Item trans_menu [256]
 This is an array of menu items for easy construction of the transparency menu.

Fl_Menu_Item color_menu [256]
 This is an array of menu items for easy construction of the color menu.

Fl_Menu_Item menutable []
 FLTK menu for the menubar at the top of the screen.


Define Documentation

#define BAR_HEIGHT   30
 

#define GLWIDTH   640
 

#define GLHEIGHT   480
 

#define WIDTH   (GLWIDTH+110)
 

#define MIN_WIDTH   400
 

#define HEIGHT   (GLHEIGHT+BAR_HEIGHT+20)
 

#define MIN_HEIGHT   300
 


Function Documentation

void name_cb const char *  s  ) 
 

This is the callback function for the fltk file chooser widget which is used in 2 functions.

void timer_cb void *  x  ) 
 

This is the callback routine for the fltk timer.

Its purpose is to tell the gl_box to redraw its data, which normally causes the frame number to advance. It also sets the timer to fire again.

void rate_cb Fl_Widget *  w,
void *  x
 

This is the fltk callback function for the rate_slider widget.

It sets the delay value to the square of the value obtained from the slider widget. This is done to give more control for small time values.

void size_cb Fl_Widget *  w,
void *  x
 

This callback adjusts the gl_size variable to control the sizes of spheres and cylinders.

void near_cb Fl_Widget *  w,
void *  x
 

This callback sets the value of the near_counter when its adjustment buttons are clicked.

void clip_cb Fl_Widget *  w,
void *  x
 

void far_cb Fl_Widget *  w,
void *  x
 

This callback sets the value of the far_counter when its adjustment buttons are clicked.

void frame_counter_cb Fl_Widget *  w,
void *  x
 

This is the callback function for the frame_counter widget.

It allows moving forward or backward 1 or 10 frames at a time.

void zoom_cb Fl_Widget *  w,
void *  x
 

This is the callback function for the zoom_slider.

It sets the distance from the view point to the center of the displayed animation.

void stop_cb Fl_Widget *  w,
void *  x
 

void reset_cb Fl_Widget *  w,
void *  x
 

This is the callback function for the reset_button.

It sets the object and light rotations to their default values.

void save_movie_cb Fl_Widget *  w,
void *  xxx
 

This is the function invoked by the File--Save Movie menu item.

It sets the portable pixmap prefix in the gl_box based on the user's choice. It also sets the gl_box's save_movie variable so that the gl_box can write each frame to a ppm file after drawing the frame.

void save_frame_cb Fl_Widget *  w,
void *  xxx
 

This is the function invoked by the File--Save Frame menu item.

It sets the portable pixmap filename in the gl_box based on the user's choice. It also sets the gl_box's save_frame variable so that the gl_box can write the current frame to a ppm file after drawing it.

void detail_cb Fl_Widget *  w,
void *  xxx
 

This is function invoked by the level of detail radio buttons under the Options menu.

The second parameter (user data) is the level of detail (0-9).

void turn_cb Fl_Widget *  w,
void *  xxx
 

This callback sets the spin rate for automatic rotation of the image.

Bigger values mean faster rotation. Positive values turn left and negative values turn right.

void stereo_cb Fl_Widget *  w,
void *  xxx
 

This callback calls set_stereo with the proper value to change the stereo mode to normal, fullscreen, stereo or cross-eyed stereo.

void lights_cb Fl_Widget *  w,
void *  xxx
 

This is the callback function for the lights option from the Options menu.

It will either turn OpenGL lighting on or off.

void wobble_cb Fl_Widget *  w,
void *  xxx
 

This callback function turns the wobble mode of the gl_box to either on or off.

Wobble mode is useful for molecules to assist in visualizing the 3D structure.

void transparency_cb Fl_Widget *  w,
void *  xxx
 

This is the callback function for the transparency option from the Options menu.

It will either turn OpenGL pixel blending on or off.

void axes_cb Fl_Widget *  w,
void *  xxx
 

This is the axes callback function from the Options menu.

It sets the gl_box's axes variable to enable or disable drawing axes.

void box_cb Fl_Widget *  w,
void *  xxx
 

This is the box callback function from the Options menu.

It sets the gl_box's box variable to enable or disable drawing a box around the displayed data.

void trans_cb Fl_Widget *  w,
void *  x
 

This is the callback routine for the trans_button widget.

The user data (second parameter) is the index of the color for adjusting alpha values with the trans_slider widget.

void trans_slider_cb Fl_Widget *  w,
void *  x
 

This is the callback function for the trans_slider widget.

It changes the alpha value for the selected color. This change takes effect on the next draw cycle in the gl_box.

void color_cb Fl_Widget *  w,
void *  x
 

This is the callback function for the color_button.

The user data determines which color to adjust. If the user data is 0, then the OpenGL clear color (background) is adjusted. If it is positive, the color index value is set to 1 less than the user data value.

The fltk fl_color_chooser function is used to adjust the selected color.

void set_color_button_menu  ) 
 

This function is called after opening a movie file to set the menu items for the color_button and trans_button.

It sets the color menu to have options for the background and all the colors in the movie. Each menu item sets the user data to indicate which color to adjust.

It sets the transparency menu to have options for all the movie's colors. The background is opaque.

void open_cb Fl_Widget *  w,
void *  xxx
 

This callback uses the fl_file_chooser function to select either an animp movie file (.an) or a molecule file (.pdb).

Parameters:
xxx 0 means .an and 1 means .pdb

void menu_cb Fl_Widget *  w,
void * 
 

Function to handle unassigned menu options.

There should not be any of these.

void quit_cb Fl_Widget *  ,
void * 
 

This callback writes ".animprc" and exits.

void read_animprc  ) 
 

This function reads ".animprc" and sets values stored there.

Bug:
The values from ".animprc" are not reflected in the GUI controls.

Todo:
Coordinate GUI controls better with ".animprc".

Store more state variables in ".animprc".

int main int  argc,
char **  argv
 


Variable Documentation

bool in_open = false
 

When opening a file, the data normally used for drawing the GL display is being modified.

The in_open variable is used to avoid drawing the display while the data is being read.

movie* m [static]
 

Animp uses one movie structure to hold the data for displaying either a movie or a molecule.

This movie pointer (m) is passed into the gl_box structure using set_movie.

map<int,string> rev_color_table
 

rev_color_table is used to get the element string like "He" for a color index when building the color button menu.

Fl_Double_Window* window
 

The window variable is used only within animp.cpp to refer to the fltk window.

It is primarily used in main with 1 use in the quit callback to make the window disappear so Fl::run() can return.

Fl_Group* controls
 

The animp controls are placed in an Fl_Group to facilitate diplaying/not displaying the controls.

In full-screen mode the controls are not displayed.

gl_box* gl
 

The gl pointer is a pointer to the gl_box which is used to display the animation.

It is a global variable for convenient access by callback functions for the fltk widgets.

Fl_Slider* rate_slider
 

The rate_slider widget controls the length of time for the timer callback.

Sliding left shortens the time. A shorter time results in a faster animation.

Fl_Slider* size_slider
 

The size_slider controls a scaling factor for spheres and cylinders.

fat_slider* clip_slider
 

Fl_Counter* near_counter
 

The near_counter is used to specify the front clipping plane for software clipping.

It starts at 0.0 which clips nothing and can be as large as 1.0 which would clip everything.

Fl_Counter* far_counter
 

The near_counter is used to specify the far clipping plane for software clipping.

This is added to the near_counter value to determine the far clipping value. It starts at 1.0 which clips nothing. Once set to a small value it will work in concert with the near_counter to allow viewing slices of the data.

Fl_Slider* zoom_slider
 

The zoom_slider controls the distance of the view point from the middle of the displayed data.

Fl_Slider* trans_slider
 

The trans_slider controls the alpha value for the currently selected color.

Fl_Button* stop_button
 

The stop_button is used to pause the animation.

Fl_Button* reset_button
 

The reset_button is used to reset the rotation of the displayed data and the rotation of the light source.

Fl_Counter* frame_counter
 

The frame_counter widget is used to advance (or reverse) the movie 1 or 10 frames at a time.

Fl_Menu_Button* color_button
 

The color_button is used to bring up a list of colors to adjust.

Once a color is selected, the user is presented a color selection widget to adjust that color.

Fl_Choice* trans_button
 

The trans_button is used to display a list of colors to select.

The selected color's alpha value can then be adjusted using the trans_slider.

char name[200]
 

The name array is used to hold the file name selected using the fltk file chooser widget.

double gl_delay = 0.2
 

This is the time for the fltk timer used to control the animation speed.

double gl_size = 1.0
 

This is the scale factor for increasing or decreasing the size of spheres and cylinders.

int color_select = 0
 

The color_select variable is used to determine which color is to be adjusted by the trans_slider widget.

It is set in one function and used in another, so it is easier to make it global.

Fl_Menu_Item trans_menu[256]
 

This is an array of menu items for easy construction of the transparency menu.

Fl_Menu_Item color_menu[256]
 

This is an array of menu items for easy construction of the color menu.

Fl_Menu_Item menutable[]
 

FLTK menu for the menubar at the top of the screen.


Generated on Thu Nov 27 08:17:11 2003 for Animp - Animated Particles by doxygen 1.3.2