Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

DisplayFltkMenu.C

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr
00003  *cr            (C) Copyright 1995-2008 The Board of Trustees of the
00004  *cr                        University of Illinois
00005  *cr                         All Rights Reserved
00006  *cr
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: DisplayFltkMenu.C,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.16 $       $Date: 2008/03/27 19:36:37 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  *   generated by Fast Light User Interface Designer (fluid) version 1.0011
00019  ***************************************************************************/
00020 
00021 #include "DisplayFltkMenu.h"
00022 #include "Command.h"
00023 #include "VMDApp.h"
00024 #include "DisplayDevice.h"
00025 #include "FL/forms.H"
00026 
00027 DisplayFltkMenu::DisplayFltkMenu(VMDApp *anApp)
00028 : VMDFltkMenu("display", "Display Settings", anApp) {
00029   make_window();
00030   update_settings();
00031   command_wanted(Command::DISP_EYESEP);
00032   command_wanted(Command::DISP_FOCALLEN);
00033   command_wanted(Command::DISP_CLIP);
00034   command_wanted(Command::DISP_SCRHEIGHT);
00035   command_wanted(Command::DISP_SCRDIST);
00036   command_wanted(Command::DISP_CUEMODE);
00037   command_wanted(Command::DISP_CUESTART);
00038   command_wanted(Command::DISP_CUEEND);
00039   command_wanted(Command::DISP_CUEDENSITY);
00040 }
00041 
00042 static void nearclip_cb(Fl_Widget *w, void *v) {
00043   float value = (float)((Fl_Valuator *)w)->value();
00044   VMDApp *app = (VMDApp *)v;
00045   app->display_set_nearclip(value, 0);
00046 }
00047 static void farclip_cb(Fl_Widget *w, void *v) {
00048   float value = (float)((Fl_Valuator *)w)->value();
00049   VMDApp *app = (VMDApp *)v;
00050   app->display_set_farclip(value, 0);
00051 }
00052 static void eyesep_cb(Fl_Widget *w, void *v) {
00053   float value = (float)((Fl_Valuator *)w)->value();
00054   VMDApp *app = (VMDApp *)v;
00055   app->display_set_eyesep(value);
00056 }
00057 static void focal_cb(Fl_Widget *w, void *v) {
00058   float value = (float)((Fl_Valuator *)w)->value();
00059   VMDApp *app = (VMDApp *)v;
00060   app->display_set_focallen(value);
00061 }
00062 static void screenh_cb(Fl_Widget *w, void *v) {
00063   float value = (float)((Fl_Valuator *)w)->value();
00064   VMDApp *app = (VMDApp *)v;
00065   app->display_set_screen_height(value);
00066 }
00067 static void screend_cb(Fl_Widget *w, void *v) {
00068   float value = (float)((Fl_Valuator *)w)->value();
00069   VMDApp *app = (VMDApp *)v;
00070   app->display_set_screen_distance(value);
00071 }
00072 
00073 static void cuemode_cb(Fl_Widget *w, void *v) {
00074   const char *mode = ((Fl_Choice *)w)->text();
00075   VMDApp *app = (VMDApp *)v;
00076   app->depthcue_set_mode(mode);
00077 }
00078 static void cuestart_cb(Fl_Widget *w, void *v) {
00079   float value = (float)((Fl_Valuator *)w)->value();
00080   VMDApp *app = (VMDApp *)v;
00081   app->depthcue_set_start(value);
00082 }
00083 static void cueend_cb(Fl_Widget *w, void *v) {
00084   float value = (float)((Fl_Valuator *)w)->value();
00085   VMDApp *app = (VMDApp *)v;
00086   app->depthcue_set_end(value);
00087 }
00088 static void cuedensity_cb(Fl_Widget *w, void *v) {
00089   float value = (float)((Fl_Valuator *)w)->value();
00090   VMDApp *app = (VMDApp *)v;
00091   app->depthcue_set_density(value);
00092 }
00093 
00094 
00095 void DisplayFltkMenu::make_window() {
00096   size(230, 305);
00097   { 
00098     { Fl_Counter* o = nearclip = new Fl_Counter(105, 25, 110, 25, "Near Clip");
00099       o->align(FL_ALIGN_LEFT);
00100       o->range(0.01, 1000.0);
00101       o->step(0.05);
00102       o->lstep(0.5);
00103       o->precision(2);
00104       o->callback(nearclip_cb, app);
00105     }
00106     { Fl_Counter* o = farclip = new Fl_Counter(105, 50, 110, 25, "Far Clip");
00107       o->align(FL_ALIGN_LEFT);
00108       o->range(0.01, 1000.0);
00109       o->step(0.05);
00110       o->lstep(0.5);
00111       o->precision(2);
00112       o->callback(farclip_cb, app);
00113     }
00114     { Fl_Counter* o = eyesep = new Fl_Counter(105, 75, 110, 25, "Eye Sep");
00115       o->align(FL_ALIGN_LEFT);
00116       o->range(0.0, 100.0);
00117       o->step(0.01);
00118       o->lstep(0.1);
00119       o->precision(2);
00120       o->callback(eyesep_cb, app);
00121     }
00122     { Fl_Counter* o = focal = new Fl_Counter(105, 100, 110, 25, "Focal Length");
00123       o->align(FL_ALIGN_LEFT);
00124       o->range(0.01, 1000.0);
00125       o->step(0.05);
00126       o->lstep(0.5);
00127       o->precision(2);
00128       o->callback(focal_cb, app);
00129     }
00130     { Fl_Counter* o = screenh = new Fl_Counter(105, 135, 110, 25, "Screen Hgt");
00131       o->align(FL_ALIGN_LEFT);
00132       o->range(0.0, 100000.0);
00133       o->step(0.1);
00134       o->lstep(1.0);
00135       o->precision(1);
00136       o->callback(screenh_cb, app);
00137     }
00138     { Fl_Counter* o = screend = new Fl_Counter(105, 160, 110, 25, "Screen Dist");
00139       o->align(FL_ALIGN_LEFT);
00140       o->range(-100000.0, 100000.0);
00141       o->step(0.1);
00142       o->lstep(1.0);
00143       o->precision(1);
00144       o->callback(screend_cb, app);
00145     }
00146 
00147     { Fl_Choice* o = cuemode = new Fl_Choice(105, 195, 110, 25, "Cue Mode");
00148       o->color(FL_PALEGREEN);
00149       o->selection_color(FL_BLACK);
00150       o->box(FL_THIN_UP_BOX);
00151       o->align(FL_ALIGN_LEFT);
00152       o->callback(cuemode_cb, app);
00153       for (int m=0; m<app->display->num_cue_modes(); m++)
00154         cuemode->add(app->display->cue_mode_name(m));
00155     }
00156     { Fl_Counter* o = cuestart = new Fl_Counter(105, 220, 110, 25, "Cue Start");
00157       o->align(FL_ALIGN_LEFT);
00158       o->range(0.001, 1000.0);
00159       o->step(0.05);
00160       o->lstep(0.25);
00161       o->precision(2);
00162       o->callback(cuestart_cb, app);
00163     }
00164     { Fl_Counter* o = cueend = new Fl_Counter(105, 245, 110, 25, "Cue End");
00165       o->align(FL_ALIGN_LEFT);
00166       o->range(0.001, 1000.0);
00167       o->step(0.05);
00168       o->lstep(0.25);
00169       o->precision(2);
00170       o->callback(cueend_cb, app);
00171     }
00172     { Fl_Counter* o = cuedensity = new Fl_Counter(105, 270, 110, 25, "Cue Density");
00173       o->align(FL_ALIGN_LEFT);
00174       o->range(0.001, 1000.0);
00175       o->step(0.05);
00176       o->lstep(0.1);
00177       o->precision(2);
00178       o->callback(cuedensity_cb, app);
00179     }
00180 
00181     Fl_Box *box1 = new Fl_Box(10, 10, 215, 120);
00182     box1->box(FL_ENGRAVED_FRAME);
00183     Fl_Box *box2 = new Fl_Box(10, 130, 215, 65);
00184     box2->box(FL_ENGRAVED_FRAME);
00185     Fl_Box *box3 = new Fl_Box(10, 190, 215, 135);
00186     box3->box(FL_ENGRAVED_FRAME);
00187     end();
00188   }
00189 }
00190 
00191 int DisplayFltkMenu::act_on_command(int, Command *) {
00192   update_settings();
00193   return 0;
00194 }
00195 
00196 void DisplayFltkMenu::update_settings() {
00197   nearclip->value(app->display->near_clip());
00198   farclip->value(app->display->far_clip());
00199   eyesep->value(app->display->eyesep());
00200   focal->value(app->display->eye_dist());
00201   screenh->value(app->display->screen_height());
00202   screend->value(app->display->distance_to_screen());
00203   const char *curmode = app->display->get_cue_mode();
00204   for (int m=0; m<cuemode->size(); m++) {
00205     if (!strcmp(curmode, cuemode->text(m))) {
00206       cuemode->value(m);
00207       if (m==0) { // Linear
00208         cuestart->activate();
00209         cueend->activate();
00210         cuedensity->deactivate();
00211       } else {  // Exp or Exp2
00212         cuestart->deactivate();
00213         cueend->deactivate();
00214         cuedensity->activate();
00215       }
00216       break;
00217     }
00218   }
00219   cuestart->value(app->display->get_cue_start());
00220   cueend->value(app->display->get_cue_end());
00221   cuedensity->value(app->display->get_cue_density());
00222 }
00223 
00224 

Generated on Mon Sep 8 01:25:55 2008 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002