www.pudn.com > fi_treegen10.zip > guiTreeGen.fl


# data file for the Fltk User Interface Designer (fluid) 
version 1.0010  
header_name {.h}  
code_name {.cxx}  
gridx 5  
gridy 5  
snap 3 
class UI {open 
} { 
  Function {UI()} {open 
  } { 
    Fl_Window mainWindow { 
      label TreeGen open 
      xywh {408 98 790 543} box DOWN_BOX labelcolor 92 hide resizable 
    } { 
      Fl_Box ogl_window { 
        label ogl_space 
        xywh {10 15 645 480} box EMBOSSED_BOX color 231 selection_color 252 labelcolor 175 resizable 
        code0 {\#include "graphics.h"} 
        class OGL_Window 
      } 
      Fl_Button quit { 
        label Quit 
        callback {ogl_window->quit();} 
        xywh {10 505 70 20} 
      } 
      Fl_Value_Slider zoom { 
        label zoom 
        callback {ogl_window->setGlobalScale( (float)((Fl_Value_Slider *)o)->value() ); 
ogl_window->draw();} 
        xywh {305 505 170 20} type {Horz Knob} selection_color 136 minimum 0.1 maximum 3 value 1 
      } 
      Fl_Value_Slider recursion { 
        label {Rec Depth} 
        callback {ogl_window->recDepth = (unsigned int)((Fl_Value_Slider *)o)->value(); 
ogl_window->tree.setMaxRecursionLevel( (unsigned int)((Fl_Value_Slider *)o)->value() ); 
ogl_window->draw();} 
        xywh {485 505 170 20} type {Horz Knob} selection_color 136 minimum 1 maximum 10 step 1 value 5 
      } 
      Fl_Repeat_Button toggleTreeBase { 
        label {Spiral Tree Base} 
        callback {static bool state = false; 
 
if( state == false ) 
{ 
  toggleTreeBase->label( "Normal Tree Base" ); 
  state = true; 
} 
else 
{ 
  toggleTreeBase->label( "Spiral Tree Base" ); 
  state = false; 
} 
ogl_window->tree.toggleTreeBase(); 
ogl_window->draw(); // show changes} 
        xywh {170 505 125 20} 
      } 
      Fl_Button reset { 
        label Reset 
        callback {resetUI(); // resets all the sliders, rollers, and dials 
ogl_window->draw(); // and show the changes} 
        xywh {665 15 115 20} down_box DOWN_BOX 
      } 
      Fl_Value_Slider levelOfDetail { 
        label Detail 
        callback {float sliderVal = (float)((Fl_Value_Slider *)o)->value(); 
float lod = (sliderVal+2.0f) / 12.0f; // scale LOD to range between [0,1] 
ogl_window->tree.setLevelOfDetail( lod ); 
ogl_window->draw();} 
        xywh {665 60 115 20} type {Horz Knob} selection_color 136 align 1 minimum 1 maximum 10 step 1 value 5 
      } 
      Fl_Group primitiveShape { 
        label {Tree Primitive} 
        xywh {665 105 115 95} box DOWN_FRAME 
      } { 
        Fl_Round_Button linePrim { 
          label Lines 
          callback {levelOfDetail->deactivate(); // grey it out because it doesn't apply 
ogl_window->tree.setPrimitiveType( LINE ); 
ogl_window->draw();} 
          xywh {675 110 60 25} type Radio down_box ROUND_DOWN_BOX selection_color 102 
        } 
        Fl_Round_Button planePrim { 
          label Planes 
          callback {levelOfDetail->deactivate(); // grey it out because it doesn't apply 
ogl_window->tree.setPrimitiveType( PLANE ); 
ogl_window->draw();} 
          xywh {675 130 60 25} type Radio down_box ROUND_DOWN_BOX selection_color 102 
        } 
        Fl_Round_Button cylPrim { 
          label Cylinders 
          callback {levelOfDetail->activate(); // the lev of detail slider affects this primitive 
ogl_window->tree.setPrimitiveType( CYLINDER ); 
ogl_window->draw();} 
          xywh {675 150 60 25} type Radio down_box ROUND_DOWN_BOX selection_color 102 
        } 
        Fl_Round_Button sphPrim { 
          label Spheres 
          callback {levelOfDetail->activate(); // the lev of detail slider affects this primitive 
ogl_window->tree.setPrimitiveType( SPHERE ); 
ogl_window->draw();} 
          xywh {675 170 60 25} type Radio down_box ROUND_DOWN_BOX selection_color 102 
        } 
      } 
      Fl_Value_Slider spread { 
        label Spread 
        callback {unsigned int spread = (unsigned int)((Fl_Value_Slider *)o)->value(); 
ogl_window->tree.setSpread( spread ); 
ogl_window->draw();} 
        xywh {665 220 115 20} type {Horz Knob} selection_color 136 align 1 maximum 90 step 1 value 25 
      } 
      Fl_Value_Slider twist { 
        label Twist 
        callback {unsigned int twist = (unsigned int)((Fl_Value_Slider *)o)->value(); 
ogl_window->tree.setTwist( twist ); 
ogl_window->draw();} 
        xywh {665 260 115 20} type {Horz Knob} selection_color 136 align 1 maximum 360 step 1 value 180 
      } 
      Fl_Value_Slider branchPerLev { 
        label {Branches Per Lev} 
        callback {unsigned int branchesPerLev = (unsigned int)((Fl_Value_Slider *)o)->value(); 
ogl_window->tree.setBranchesPerLevel( branchesPerLev ); 
ogl_window->draw();} 
        xywh {665 300 115 20} type {Horz Knob} selection_color 136 align 1 minimum 1 maximum 8 step 1 value 2 
      } 
      Fl_Repeat_Button randomizer { 
        label Randomize 
        callback {int randSpread = rand() % (int)spread->maximum(); 
spread->value( randSpread ); 
ogl_window->tree.setSpread( randSpread ); 
 
int randTwist = rand() % (int)twist->maximum(); 
twist->value( randTwist ); 
ogl_window->tree.setTwist( randTwist ); 
 
int randBranches = rand() % (int)branchPerLev->maximum(); 
if( randBranches == 0 ) randBranches = 1; 
branchPerLev->value( randBranches ); 
ogl_window->tree.setBranchesPerLevel( randBranches ); 
 
ogl_window->draw(); // show changes} 
        xywh {665 335 115 20} 
      } 
      Fl_Repeat_Button toggleColors { 
        label Pseudocolor 
        callback {static bool state = false; 
 
if( state == false ) 
{ 
  toggleColors->label( "Tree Color" ); 
  ogl_window->tree.setColorScheme( 1 ); 
  state = true; 
} 
else 
{ 
  toggleColors->label( "Pseudocolor" ); 
  ogl_window->tree.setColorScheme( 0 ); 
  state = false; 
} 
ogl_window->draw(); // show changes} 
        xywh {665 365 115 20} 
      } 
      Fl_Light_Button toggleLeaves { 
        label {Draw Leaves} 
        callback {ogl_window->tree.toggleLeaves(); 
ogl_window->draw();} 
        xywh {665 395 115 20} align 16 when 1 
      } 
      Fl_Light_Button toggleTex { 
        label {Use Textures  } 
        callback {ogl_window->toggleTextures();} 
        xywh {665 425 115 20} align 16 when 1 
      } 
      Fl_Light_Button polyDwgMode { 
        label Wireframe 
        callback {ogl_window->togglePolyMode();} 
        xywh {665 455 115 20} align 16 
      } 
      Fl_Light_Button projMode { 
        label Ortho 
        callback {ogl_window->toggleProjMode();} 
        xywh {665 485 115 20} align 16 
      } 
      Fl_Light_Button togDisplayList { 
        label {Display List} 
        callback {ogl_window->tree.toggleDisplayList(); 
//ogl_window->draw();} 
        xywh {665 515 115 20} align 16 
      } 
      Fl_Light_Button worldAxis { 
        label {Show Axis} 
        callback {ogl_window->toggleWorldAxis(); 
// While this button works, we've just run out of room 
// and this function is very non-essential} 
        xywh {665 515 115 20} align 16 hide deactivate 
      } 
      Fl_Button aboutButton { 
        label About 
        callback {aboutWindow->show()} 
        xywh {90 505 70 20} 
      } 
    } 
    Fl_Window aboutWindow { 
      label {About TreeGen} open 
      xywh {532 693 268 160} visible 
    } { 
      Fl_Return_Button okButton { 
        label OK 
        callback {((Fl_Window*)(o->parent()))->hide();} 
        xywh {155 123 100 25} 
      } 
      Fl_Box {} { 
        label {TreeGen v1.0 
} 
        xywh {15 13 240 25} box FLAT_BOX selection_color 47 labelsize 16 
      } 
      Fl_Box {} { 
        label {Released: June 26, 2001} 
        xywh {10 123 145 25} labelsize 12 
      } 
      Fl_Output alexEmail { 
        xywh {49 61 195 25} box FLAT_BOX color 49 
      } 
      Fl_Output fusionURL { 
        xywh {52 86 190 25} box FLAT_BOX color 49 
      } 
      Fl_Box {} { 
        label {by Alex 
} selected 
        xywh {15 38 240 20} box FLAT_BOX selection_color 47 
      } 
    } 
  } 
  Function {show()} {open 
  } { 
    code {toggleTex->set();     // select this button 
  polyDwgMode->clear(); // don't select this button 
  projMode->clear();    // don't select this button 
  worldAxis->clear();   // don't select this button 
  togDisplayList->clear(); // don't select this button 
  cylPrim->setonly(); // select only this button in the group 
  mainWindow->show(); // show gui 
  ogl_window->show(); // show ogl window 
 
  // init the about box 
  // (I wish I could make these into links) 
  alexEmail->value("alex@FusionIndustries.com"); 
  fusionURL->value("www.FusionIndustries.com");} {} 
  } 
  Function {resetUI()} {} { 
    code {if( fl_ask( "Are you sure you want to reset the scene?" ) ) 
{ 
  zoom->value(1); 
  recursion->value( 5 ); 
 
  //linePrim->clear(); 
  //planePrim->clear();  
  cylPrim->setonly(); // only select this button in the group 
  //sphPrim->clear(); 
 
  levelOfDetail->value( 5 ); 
  spread->value( 25 ); 
  twist->value( 180 ); 
  branchPerLev->value( 2 ); 
 
  toggleLeaves->clear(); 
 
  toggleTex->set(); 
  polyDwgMode->clear(); 
  projMode->clear(); 
  worldAxis->clear(); 
  togDisplayList->clear(); 
 
  ogl_window->resetScene(); 
}} {} 
  } 
}