// generated by Fast Light User Interface Designer (fluid) version 1.0303

#include "ContourLevel.H"

void ContourLevelUserInterface::cb_Reset_i(Fl_Button*, void*) {
  glviewer_->FindSolutionMinMax();
SetMinimumSetting->value(glviewer_->GetSolutionMin());
SetMinimumSetting->redraw();
SetMaximumSetting->value(glviewer_->GetSolutionMax());
SetMaximumSetting->redraw();
glviewer_->redraw();
}
void ContourLevelUserInterface::cb_Reset(Fl_Button* o, void* v) {
  ((ContourLevelUserInterface*)(o->parent()->user_data()))->cb_Reset_i(o,v);
}

void ContourLevelUserInterface::cb_SetMaximumSetting_i(Fl_Value_Input* o, void*) {
  glviewer_->SetSolutionMax( ((Fl_Value_Input *)o)->value() );
glviewer_->redraw();
}
void ContourLevelUserInterface::cb_SetMaximumSetting(Fl_Value_Input* o, void* v) {
  ((ContourLevelUserInterface*)(o->parent()->user_data()))->cb_SetMaximumSetting_i(o,v);
}

void ContourLevelUserInterface::cb_SetMinimumSetting_i(Fl_Value_Input* o, void*) {
  glviewer_->SetSolutionMin( ((Fl_Value_Input *)o)->value() );
glviewer_->redraw();
}
void ContourLevelUserInterface::cb_SetMinimumSetting(Fl_Value_Input* o, void* v) {
  ((ContourLevelUserInterface*)(o->parent()->user_data()))->cb_SetMinimumSetting_i(o,v);
}

void ContourLevelUserInterface::cb_SetNumberLineContours_i(Fl_Value_Input* o, void*) {
  glviewer_->SetNumberOfLineContourLevels( ((Fl_Value_Input *)o)->value() );
glviewer_->redraw();
}
void ContourLevelUserInterface::cb_SetNumberLineContours(Fl_Value_Input* o, void* v) {
  ((ContourLevelUserInterface*)(o->parent()->user_data()))->cb_SetNumberLineContours_i(o,v);
}

ContourLevelUserInterface::ContourLevelUserInterface() {
  { MainWindow = new Fl_Double_Window(305, 210, "Set Contour Levels");
    MainWindow->user_data((void*)(this));
    MainWindow->align(Fl_Align(129));
    { Reset = new Fl_Button(5, 104, 180, 30, "Auto Determine Levels");
      Reset->callback((Fl_Callback*)cb_Reset);
    } // Fl_Button* Reset
    { SetMaximumSetting = new Fl_Value_Input(197, 14, 100, 35, "Set Contour Maximum To:");
      SetMaximumSetting->callback((Fl_Callback*)cb_SetMaximumSetting);
    } // Fl_Value_Input* SetMaximumSetting
    { SetMinimumSetting = new Fl_Value_Input(197, 60, 100, 35, "Set Contour Minimum To:");
      SetMinimumSetting->callback((Fl_Callback*)cb_SetMinimumSetting);
    } // Fl_Value_Input* SetMinimumSetting
    { SetNumberLineContours = new Fl_Value_Input(197, 158, 100, 35, "Number Of Line Contours:");
      SetNumberLineContours->callback((Fl_Callback*)cb_SetNumberLineContours);
    } // Fl_Value_Input* SetNumberLineContours
    MainWindow->end();
  } // Fl_Double_Window* MainWindow
}

void ContourLevelUserInterface::show(GL_VIEWER *glviewer) {
  glviewer_ = glviewer;
  SetMinimumSetting->value(glviewer_->GetSolutionMin());
  SetMaximumSetting->value(glviewer_->GetSolutionMax());
  SetNumberLineContours->value(glviewer_->GetNumberOfLineContourLevels());
  
  MainWindow->show();
}
