Main Page   Namespace List   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-2011 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.23 $       $Date: 2011/01/25 16:45:33 $
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   command_wanted(Command::DISP_AO);
00041   command_wanted(Command::DISP_AO_AMBIENT);
00042   command_wanted(Command::DISP_AO_DIRECT);
00043 }
00044 
00045 
00046 static void nearclip_cb(Fl_Widget *w, void *v) {
00047   float value = (float)((Fl_Valuator *)w)->value();
00048   VMDApp *app = (VMDApp *)v;
00049   app->display_set_nearclip(value, 0);
00050 }
00051 static void farclip_cb(Fl_Widget *w, void *v) {
00052   float value = (float)((Fl_Valuator *)w)->value();
00053   VMDApp *app = (VMDApp *)v;
00054   app->display_set_farclip(value, 0);
00055 }
00056 static void eyesep_cb(Fl_Widget *w, void *v) {
00057   float value = (float)((Fl_Valuator *)w)->value();
00058   VMDApp *app = (VMDApp *)v;
00059   app->display_set_eyesep(value);
00060 }
00061 static void focal_cb(Fl_Widget *w, void *v) {
00062   float value = (float)((Fl_Valuator *)w)->value();
00063   VMDApp *app = (VMDApp *)v;
00064   app->display_set_focallen(value);
00065 }
00066 static void screenh_cb(Fl_Widget *w, void *v) {
00067   float value = (float)((Fl_Valuator *)w)->value();
00068   VMDApp *app = (VMDApp *)v;
00069   app->display_set_screen_height(value);
00070 }
00071 static void screend_cb(Fl_Widget *w, void *v) {
00072   float value = (float)((Fl_Valuator *)w)->value();
00073   VMDApp *app = (VMDApp *)v;
00074   app->display_set_screen_distance(value);
00075 }
00076 
00077 
00078 static void cuemode_cb(Fl_Widget *w, void *v) {
00079   const char *mode = ((Fl_Choice *)w)->text();
00080   VMDApp *app = (VMDApp *)v;
00081   app->depthcue_set_mode(mode);
00082 }
00083 static void cuestart_cb(Fl_Widget *w, void *v) {
00084   float value = (float)((Fl_Valuator *)w)->value();
00085   VMDApp *app = (VMDApp *)v;
00086   app->depthcue_set_start(value);
00087 }
00088 static void cueend_cb(Fl_Widget *w, void *v) {
00089   float value = (float)((Fl_Valuator *)w)->value();
00090   VMDApp *app = (VMDApp *)v;
00091   app->depthcue_set_end(value);
00092 }
00093 static void cuedensity_cb(Fl_Widget *w, void *v) {
00094   float value = (float)((Fl_Valuator *)w)->value();
00095   VMDApp *app = (VMDApp *)v;
00096   app->depthcue_set_density(value);
00097 }
00098 
00099 
00100 static void shadowmode_cb(Fl_Widget *w, void *v) {
00101   const char *mode = ((Fl_Choice *)w)->text();
00102   VMDApp *app = (VMDApp *)v;
00103   if (!strcmp(mode, "On")) {
00104     app->display_set_shadows(1);
00105   } else {
00106     app->display_set_shadows(0);
00107   }
00108 }
00109 static void aomode_cb(Fl_Widget *w, void *v) {
00110   const char *mode = ((Fl_Choice *)w)->text();
00111   VMDApp *app = (VMDApp *)v;
00112   if (!strcmp(mode, "On")) {
00113     app->display_set_ao(1);
00114   } else {
00115     app->display_set_ao(0);
00116   }
00117 }
00118 static void aoambient_cb(Fl_Widget *w, void *v) {
00119   float value = (float)((Fl_Valuator *)w)->value();
00120   VMDApp *app = (VMDApp *)v;
00121   app->display_set_ao_ambient(value);
00122 }
00123 static void aodirect_cb(Fl_Widget *w, void *v) {
00124   float value = (float)((Fl_Valuator *)w)->value();
00125   VMDApp *app = (VMDApp *)v;
00126   app->display_set_ao_direct(value);
00127 }
00128 
00129 void DisplayFltkMenu::make_window() {
00130   size(235, 445);
00131   { 
00132     { Fl_Counter* o = nearclip = new Fl_Counter(105, 25, 110, 25, "Near Clip");
00133       o->align(FL_ALIGN_LEFT);
00134       o->range(0.01, 1000.0);
00135       o->step(0.05);
00136       o->lstep(0.5);
00137       o->precision(2);
00138       o->callback(nearclip_cb, app);
00139       VMDFLTKTOOLTIP(o, "Set near clipping plane (OpenGL display only)")
00140     }
00141     { Fl_Counter* o = farclip = new Fl_Counter(105, 50, 110, 25, "Far Clip");
00142       o->align(FL_ALIGN_LEFT);
00143       o->range(0.01, 1000.0);
00144       o->step(0.05);
00145       o->lstep(0.5);
00146       o->precision(2);
00147       o->callback(farclip_cb, app);
00148       VMDFLTKTOOLTIP(o, "Set far clipping plane (OpenGL display only)")
00149     }
00150     { Fl_Counter* o = eyesep = new Fl_Counter(105, 75, 110, 25, "Eye Sep");
00151       o->align(FL_ALIGN_LEFT);
00152       o->range(0.0, 100.0);
00153       o->step(0.01);
00154       o->lstep(0.1);
00155       o->precision(2);
00156       o->callback(eyesep_cb, app);
00157       VMDFLTKTOOLTIP(o, "Set stereo eye separation")
00158     }
00159     { Fl_Counter* o = focal = new Fl_Counter(105, 100, 110, 25, "Focal Length");
00160       o->align(FL_ALIGN_LEFT);
00161       o->range(0.01, 1000.0);
00162       o->step(0.05);
00163       o->lstep(0.5);
00164       o->precision(2);
00165       o->callback(focal_cb, app);
00166       VMDFLTKTOOLTIP(o, "Set stereo focal point")
00167     }
00168     { Fl_Counter* o = screenh = new Fl_Counter(105, 135, 110, 25, "Screen Hgt");
00169       o->align(FL_ALIGN_LEFT);
00170       o->range(0.0, 100000.0);
00171       o->step(0.1);
00172       o->lstep(1.0);
00173       o->precision(1);
00174       o->callback(screenh_cb, app);
00175       VMDFLTKTOOLTIP(o, "Set viewing frustum height")
00176     }
00177     { Fl_Counter* o = screend = new Fl_Counter(105, 160, 110, 25, "Screen Dist");
00178       o->align(FL_ALIGN_LEFT);
00179       o->range(-100000.0, 100000.0);
00180       o->step(0.1);
00181       o->lstep(1.0);
00182       o->precision(1);
00183       o->callback(screend_cb, app);
00184       VMDFLTKTOOLTIP(o, "Set viewing frustum distance")
00185     }
00186 
00187     { Fl_Choice* o = cuemode = new Fl_Choice(105, 195, 110, 25, "Cue Mode");
00188       o->color(VMDMENU_CHOOSER_BG);
00189       o->selection_color(VMDMENU_CHOOSER_SEL);
00190       o->box(FL_THIN_UP_BOX);
00191       o->align(FL_ALIGN_LEFT);
00192       o->callback(cuemode_cb, app);
00193       VMDFLTKTOOLTIP(o, "Set depth cueing mode")
00194       for (int m=0; m<app->display->num_cue_modes(); m++)
00195         cuemode->add(app->display->cue_mode_name(m));
00196     }
00197     { Fl_Counter* o = cuestart = new Fl_Counter(105, 220, 110, 25, "Cue Start");
00198       o->align(FL_ALIGN_LEFT);
00199       o->range(0.001, 1000.0);
00200       o->step(0.05);
00201       o->lstep(0.25);
00202       o->precision(2);
00203       o->callback(cuestart_cb, app);
00204       VMDFLTKTOOLTIP(o, "Set linear depth cueing starting distance")
00205     }
00206     { Fl_Counter* o = cueend = new Fl_Counter(105, 245, 110, 25, "Cue End");
00207       o->align(FL_ALIGN_LEFT);
00208       o->range(0.001, 1000.0);
00209       o->step(0.05);
00210       o->lstep(0.25);
00211       o->precision(2);
00212       o->callback(cueend_cb, app);
00213       VMDFLTKTOOLTIP(o, "Set linear depth cueing end distance")
00214     }
00215     { Fl_Counter* o = cuedensity = new Fl_Counter(105, 270, 110, 25, "Cue Density");
00216       o->align(FL_ALIGN_LEFT);
00217       o->range(0.001, 1000.0);
00218       o->step(0.05);
00219       o->lstep(0.1);
00220       o->precision(2);
00221       o->callback(cuedensity_cb, app);
00222       VMDFLTKTOOLTIP(o, "Set exponential depth cueing density")
00223     }
00224 
00225     new Fl_Box(35, 305, 170, 25, "External Renderer Options");
00226     { Fl_Choice* o = shadowmode = new Fl_Choice(105, 330, 110, 25, "Shadows");
00227       o->color(VMDMENU_CHOOSER_BG);
00228       o->selection_color(VMDMENU_CHOOSER_SEL);
00229       o->box(FL_THIN_UP_BOX);
00230       o->align(FL_ALIGN_LEFT);
00231       o->callback(shadowmode_cb, app);
00232       VMDFLTKTOOLTIP(o, "Enable shadows in external renderers")
00233       shadowmode->add("Off");
00234       shadowmode->add("On");
00235     }
00236     { Fl_Choice* o = aomode = new Fl_Choice(105, 355, 110, 25, "Amb. Occl.");
00237       o->color(VMDMENU_CHOOSER_BG);
00238       o->selection_color(VMDMENU_CHOOSER_SEL);
00239       o->box(FL_THIN_UP_BOX);
00240       o->align(FL_ALIGN_LEFT);
00241       o->callback(aomode_cb, app);
00242       VMDFLTKTOOLTIP(o, "Enable ambient occlusion lighting in external renderers")
00243       aomode->add("Off");
00244       aomode->add("On");
00245     }
00246     { Fl_Counter* o = aoambient = new Fl_Counter(105, 380, 110, 25, "AO Ambient");
00247       o->align(FL_ALIGN_LEFT);
00248       o->range(0.0, 1.0);
00249       o->step(0.01);
00250       o->lstep(0.10);
00251       o->precision(2);
00252       o->callback(aoambient_cb, app);
00253       VMDFLTKTOOLTIP(o, "Ambient occlusion lighting coefficient")
00254     }
00255     { Fl_Counter* o = aodirect = new Fl_Counter(105, 405, 110, 25, "AO Direct");
00256       o->align(FL_ALIGN_LEFT);
00257       o->range(0.0, 1.0);
00258       o->step(0.01);
00259       o->lstep(0.10);
00260       o->precision(2);
00261       o->callback(aodirect_cb, app);
00262       VMDFLTKTOOLTIP(o, "Direct lighting rescaling coefficient")
00263     }
00264 
00265     Fl_Box *box1 = new Fl_Box(10, 10, 215, 120);
00266     box1->box(FL_ENGRAVED_FRAME);
00267     Fl_Box *box2 = new Fl_Box(10, 130, 215, 65);
00268     box2->box(FL_ENGRAVED_FRAME);
00269     Fl_Box *box3 = new Fl_Box(10, 190, 215, 110);
00270     box3->box(FL_ENGRAVED_FRAME);
00271     Fl_Box *box4 = new Fl_Box(10, 300, 215, 135);
00272     box4->box(FL_ENGRAVED_FRAME);
00273     end();
00274     end();
00275   }
00276 }
00277 
00278 int DisplayFltkMenu::act_on_command(int, Command *) {
00279   update_settings();
00280   return 0;
00281 }
00282 
00283 void DisplayFltkMenu::update_settings() {
00284   nearclip->value(app->display->near_clip());
00285   farclip->value(app->display->far_clip());
00286   eyesep->value(app->display->eyesep());
00287   focal->value(app->display->eye_dist());
00288   screenh->value(app->display->screen_height());
00289   screend->value(app->display->distance_to_screen());
00290   const char *curmode = app->display->get_cue_mode();
00291   for (int m=0; m<cuemode->size(); m++) {
00292     if (!strcmp(curmode, cuemode->text(m))) {
00293       cuemode->value(m);
00294       if (m==0) { // Linear
00295         cuestart->activate();
00296         cueend->activate();
00297         cuedensity->deactivate();
00298       } else {  // Exp or Exp2
00299         cuestart->deactivate();
00300         cueend->deactivate();
00301         cuedensity->activate();
00302       }
00303       break;
00304     }
00305   }
00306   cuestart->value(app->display->get_cue_start());
00307   cueend->value(app->display->get_cue_end());
00308   cuedensity->value(app->display->get_cue_density());
00309 
00310   shadowmode->value(app->display->shadows_enabled());
00311   aomode->value(app->display->ao_enabled());
00312   aoambient->value(app->display->get_ao_ambient());
00313   aodirect->value(app->display->get_ao_direct());
00314   if (app->display->ao_enabled()) {
00315     aoambient->activate();
00316     aodirect->activate();
00317   } else {
00318     aoambient->deactivate();
00319     aodirect->deactivate();
00320   }
00321 }
00322 
00323 

Generated on Wed May 16 01:49:11 2012 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002