int main(int argc, char **argv) { Fl_Window *w; {Fl_Window* o = new Fl_Window(365, 525); w = o; scroll = new Fl_Scroll(10,10,345,285); {Fl_Pack* o = new Fl_Pack(10, 10, 345, 285); pack = o; o->box(FL_DOWN_BOX); //o->box(FL_ENGRAVED_FRAME); (void) new Fl_Button(35, 35, 25, 25, "b1"); (void) new Fl_Button(45, 45, 25, 25, "b2"); (void) new Fl_Button(55, 55, 25, 25, "b3"); (void) new Fl_Button(65, 65, 25, 25, "b4"); (void) new Fl_Button(75, 75, 25, 25, "b5"); (void) new Fl_Button(85, 85, 25, 25, "b6"); (void) new Fl_Button(95, 95, 25, 25, "b7"); (void) new Fl_Button(105, 105, 25, 25, "b8"); (void) new Fl_Button(115, 115, 25, 25, "b9"); (void) new Fl_Button(125, 125, 25, 25, "b10"); (void) new Fl_Button(135, 135, 25, 25, "b11"); (void) new Fl_Button(145, 145, 25, 25, "b12"); (void) new Fl_Button(155, 155, 25, 25, "b13"); (void) new Fl_Button(165, 165, 25, 25, "b14"); (void) new Fl_Button(175, 175, 25, 25, "b15"); (void) new Fl_Button(185, 185, 25, 25, "b16"); (void) new Fl_Button(195, 195, 25, 25, "b17"); (void) new Fl_Button(205, 205, 25, 25, "b18"); (void) new Fl_Button(215, 215, 25, 25, "b19"); (void) new Fl_Button(225, 225, 25, 25, "b20"); (void) new Fl_Button(235, 235, 25, 25, "b21"); (void) new Fl_Button(245, 245, 25, 25, "b22"); (void) new Fl_Button(255, 255, 25, 25, "b23"); (void) new Fl_Button(265, 265, 25, 25, "b24"); o->end(); w->resizable(o); } scroll->end(); {Fl_Light_Button* o = new Fl_Light_Button(10, 325, 175, 25, "HORIZONTAL"); o->type(FL_RADIO_BUTTON); o->callback((Fl_Callback*)type_cb, (void*)(Fl_Pack::HORIZONTAL)); } {Fl_Light_Button* o = new Fl_Light_Button(10, 350, 175, 25, "VERTICAL"); o->type(FL_RADIO_BUTTON); o->value(1); o->callback((Fl_Callback*)type_cb, (void*)(Fl_Pack::VERTICAL)); } {Fl_Value_Slider* o = new Fl_Value_Slider(50,375, 295,25,"spacing:"); o->clear_flag(FL_ALIGN_MASK); o->set_flag(FL_ALIGN_LEFT); o->type(Fl_Slider::HORIZONTAL); o->range(0,30); o->step(1); o->callback((Fl_Callback*)spacing_cb); } w->end(); } w->show(argc, argv); return Fl::run(); }
int main ( int argc, char **argv ) { { Fl_Single_Window *w = new Fl_Single_Window( 800, 600 ); { Fl_Choice *o = new Fl_Choice( 0, 0, 200, 24, "Boxtype" ); o->align( FL_ALIGN_RIGHT ); o->callback( boxtype_cb, NULL ); o->add( "UP_BOX" ); o->add( "FLAT_BOX" ); o->add( "ROUNDED_BOX" ); o->add( "OVAL_BOX" ); } { Fl_Pack *o = new Fl_Pack( 0, 24, 800, 600 - 24 ); o->type( 0 ); { PerfTest *o = new PerfTest( 0,0, 800, 400, "Xlib" ); } { PerfTest *o = new PerfTest( 0,0, 800, 400, "Cairo" ); o->use_cairo = true; } o->end(); } w->end(); w->show(); } /* { */ /* Fl_Single_Window *w = new Fl_Single_Window( 800, 600 ); */ /* PerfTest *o = new PerfTest( 0,0, 800, 600 ); */ /* w->end(); */ /* w->show(); */ /* } */ Fl::run(); }
ModelerUserInterface::ModelerUserInterface() { Fl_Double_Window* w; { Fl_Double_Window* o = m_controlsWindow = new Fl_Double_Window(395, 325, "Final Project Controls"); w = o; o->callback((Fl_Callback*)cb_m_controlsWindow, (void*)(this)); o->when(FL_WHEN_NEVER); { Fl_Menu_Bar* o = m_controlsMenuBar = new Fl_Menu_Bar(0, 0, 395, 25); o->menu(menu_m_controlsMenuBar); } { Fl_Browser* o = m_controlsBrowser = new Fl_Browser(0, 25, 140, 300, "Controls"); o->type(3); o->textsize(10); o->callback((Fl_Callback*)cb_m_controlsBrowser); Fl_Group::current()->resizable(o); } { Fl_Scroll* o = m_controlsScroll = new Fl_Scroll(145, 25, 250, 300); o->type(6); o->when(FL_WHEN_CHANGED); { Fl_Pack* o = m_controlsPack = new Fl_Pack(145, 25, 225, 300); o->end(); } o->end(); } o->end(); } { Fl_Double_Window* o = m_modelerWindow = new Fl_Double_Window( 800, 800, "Assignment 2 Model"); w = o; o->callback((Fl_Callback*)cb_m_modelerWindow, (void*)(this)); o->when(FL_WHEN_NEVER); { ModelerView* o = m_modelerView = new ModelerView(0, 0, 800, 800, "ModelerView"); o->box(FL_NO_BOX); o->color(FL_BACKGROUND_COLOR); o->selection_color(FL_BACKGROUND_COLOR); o->labeltype(FL_NORMAL_LABEL); o->labelfont(0); o->labelsize(14); o->labelcolor(FL_BLACK); o->align(FL_ALIGN_CENTER); o->when(FL_WHEN_RELEASE); Fl_Group::current()->resizable(o); } o->end(); } }
void FolderWindow::RemoveCallback(Fl_Widget* widget, void* userData) { FolderWindow* fwindow = (FolderWindow*)(widget->parent()->parent()->parent()->parent()); Fl_Pack* pack = fwindow->folderPack; for(int i = 0; i < pack->children(); ++i) { Fl_Group* tempGroup = (Fl_Group*)pack->child(i); Fl_Button* childButton = (Fl_Button*)tempGroup->child(1); // <--- here if (childButton == widget) { RNAStructViz* appInstance = RNAStructViz::GetInstance(); const std::vector<DiagramWindow*>& diagrams = appInstance->GetDiagramWindows(); for (unsigned int ui = 0; ui < diagrams.size(); ++ui) { if(diagrams[ui]->GetFolderIndex() == fwindow->m_folderIndex) { diagrams[ui]->RemoveStructure((intptr_t)userData); break; } } const std::vector<StatsWindow*>& stats = appInstance->GetStatsWindows(); for (unsigned int ui = 0; ui < stats.size(); ++ui) { if(stats[ui]->GetFolderIndex() == fwindow->m_folderIndex) { stats[ui]->RemoveStructure((intptr_t)userData); break; } } Fl_Group* toRemove = (Fl_Group*)pack->child(i); // <--- here pack->remove(toRemove); fwindow->folderScroll->redraw(); Fl::delete_widget(toRemove); appInstance->GetStructureManager()->DecreaseStructCount( fwindow->m_folderIndex); appInstance->GetStructureManager()->RemoveStructure((intptr_t)userData); break; } } }
void FolderWindow::AddStructure(const char* filename, const int index) { Fl_Pack* pack = folderPack; pack->begin(); int vertPosn = pack->children() * NAVBUTTONS_BHEIGHT; //+ pack->y() + 15; Fl_Group* group = new Fl_Group(pack->x(), vertPosn, pack->w(), NAVBUTTONS_BHEIGHT); group->begin(); Fl_Button* label = new Fl_Button(pack->x() + 10, vertPosn, pack->w() - 40, 30, filename); label->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_LEFT); label->callback(FolderWindow::ShowFileCallback); label->user_data((void*)index); label->labelcolor(GUI_BTEXT_COLOR); char labelWithIcon[MAX_BUFFER_SIZE]; std::string spaceBuffer = string(" "); int curLabelLen = 0; char filePrefix[MAX_BUFFER_SIZE]; size_t fileNameBytes = strlen(filename); snprintf(filePrefix, MAX_BUFFER_SIZE, "%-.20s%s", filename, fileNameBytes > MAX_FOLDER_LABEL_CHARS ? "..." : ""); snprintf(labelWithIcon, MAX_BUFFER_SIZE - 1, "@filenew %s%s", filePrefix, spaceBuffer.substr(0, MAX(0, MAX_FOLDER_LABEL_CHARS - ((int ) strlen(filePrefix)))).c_str()); //strcat(labelWithIcon, " @|>"); label->copy_label(labelWithIcon); label->tooltip(filename); Fl_Button* removeButton = new Fl_Button(pack->x() + pack->w() - 20, vertPosn + 5, 20, 20); removeButton->callback(FolderWindow::RemoveCallback); removeButton->user_data((void*)index); removeButton->label("@1+"); removeButton->labelcolor(GUI_TEXT_COLOR); group->resizable(label); group->end(); pack->end(); folderScroll->redraw(); }
/* Fl_Group( X, Y, W, H, L) */ Chain::Chain ( ) : Fl_Group( 0, 0, 100, 100, "") { /* not really deleting here, but reusing this variable */ _deleting = true; int X = 0; int Y = 0; int W = 100; int H = 100; /* _outs = 1; */ /* _ins = 1; */ _configure_outputs_callback = NULL; _strip = NULL; _name = NULL; labelsize( 10 ); align( FL_ALIGN_TOP ); { Fl_Flip_Button* o = tab_button = new Fl_Flip_Button( X, Y, W, 16, "chain/controls"); o->type(1); o->labelsize( 12 ); o->callback( cb_handle, this ); } Y += 18; H -= 18; { Fl_Group *o = chain_tab = new Fl_Group( X, Y, W, H, "" ); o->labeltype( FL_NO_LABEL ); o->box( FL_FLAT_BOX ); // o->color( fl_darker( FL_BACKGROUND_COLOR ) ); // o->color( FL_BACKGROUND_COLOR ); // o->box( FL_NO_BOX ); { Fl_Packscroller *o = new Fl_Packscroller( X, Y, W, H ); o->color( FL_BACKGROUND_COLOR ); // o->box( FL_FLAT_BOX ); o->box( FL_THIN_UP_BOX ); o->type( Fl_Scroll::VERTICAL ); { Fl_Pack *o = modules_pack = new Fl_Pack( X, Y, W, H ); o->type( Fl_Pack::VERTICAL ); o->spacing( 6 ); o->end(); Fl_Group::current()->resizable( o ); } o->end(); } o->end(); } { Fl_Group *o = control_tab = new Fl_Group( X, Y, W, H, "" ); o->box( FL_FLAT_BOX ); o->color( FL_BACKGROUND_COLOR ); o->labeltype( FL_NO_LABEL ); o->hide(); { Fl_Scroll *o = new Fl_Scroll( X, Y, W, H ); o->color( FL_BACKGROUND_COLOR ); o->box( FL_NO_BOX ); o->type( Fl_Scroll::VERTICAL ); { Fl_Pack *o = controls_pack = new Fl_Pack( X, Y, W, H ); o->type( Fl_Pack::VERTICAL ); o->spacing( 5 ); // o->color( FL_RED ); o->end(); Fl_Group::current()->resizable( o ); } o->end(); Fl_Group::current()->resizable( o ); } o->end(); o->hide(); Fl_Group::current()->resizable( o ); } end(); log_create(); _deleting = false; }
void CInstaller::Init(int argc, char **argv) { const int buttonsy = WindowH()-ButtonHeight()-ButtonHSpacing(); m_pMainWindow = new Fl_Double_Window(WindowW(), WindowH(), "Nixstaller"); m_pMainWindow->callback(CancelCB, this); Fl_Group *maingroup = new Fl_Group(0, 0, WindowW(), WindowH()); maingroup->resizable(NULL); maingroup->box(FL_FLAT_BOX); maingroup->color(fl_lighter(FL_BACKGROUND_COLOR)); Fl_Pack *mainpack = new Fl_Pack(0, 0, WindowW(), WindowH()-90); mainpack->resizable(NULL); mainpack->type(Fl_Pack::VERTICAL); CreateHeader(); m_pWizard = new Fl_Wizard(0, m_pHeaderGroup->h(), WindowW(), (buttonsy-m_pHeaderGroup->h()-ButtonHSpacing())); m_pWizard->box(FL_ENGRAVED_BOX); m_pWizard->end(); mainpack->end(); m_pCancelButton = new Fl_Button(ButtonWOffset(), buttonsy, 0, ButtonHeight(), GetTranslation("Cancel")); SetButtonWidth(m_pCancelButton); m_pCancelButton->callback(CancelCB, this); m_pButtonPack = new Fl_Pack(0, buttonsy, 0, ButtonHeight()); m_pButtonPack->type(Fl_Pack::HORIZONTAL); m_pButtonPack->spacing(ButtonWSpacing()); m_pBackButton = new Fl_Button(0, buttonsy, 0, ButtonHeight(), CreateText("@<- %s", GetTranslation("Back"))); SetButtonWidth(m_pBackButton); m_pBackButton->callback(BackCB, this); m_pNextButton = new Fl_Button(0, buttonsy, 0, ButtonHeight(), CreateText("%s @->", GetTranslation("Next"))); SetButtonWidth(m_pNextButton); m_pNextButton->callback(NextCB, this); m_pButtonPack->end(); UpdateButtonPack(); maingroup->end(); CBaseInstall::Init(argc, argv); Fl_Shared_Image *img = Fl_Shared_Image::get(GetLogoFName()); if (img) { m_pLogoBox = new Fl_Box(HeaderSpacing(), HeaderSpacing(), img->w()+HeaderSpacing(), img->h()); m_pLogoBox->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE); m_pLogoBox->image(img); m_pHeaderGroup->add(m_pLogoBox); } int size = m_pWizard->children(); for (int i=0; i<size; i++) { CInstallScreen *screen = GetScreen(m_pWizard->child(i)); if (screen->CanActivate()) { ActivateScreen(screen); break; } } m_pMainWindow->end(); m_pMainWindow->show(argc, argv); }
void ModelerUserInterface::pickGroupProperty(GroupProperty* group) { // Remove the event listeners for old controls // TODO: we really need to have a PropertyEditor class that handles this // automatically... if (currentGroup) { PropertyList* props = currentGroup->getProperties(); for (PropertyList::iterator iter = props->begin(); iter != props->end(); iter++) { if (RangeProperty* prop = dynamic_cast<RangeProperty*>(*iter)) { prop->unlisten((SignalListener)updateRangeSlider); } else if (RGBProperty* prop = dynamic_cast<RGBProperty*>(*iter)) { prop->unlisten((SignalListener)updateColorChooser); } else if (BooleanProperty* prop = dynamic_cast<BooleanProperty*>(*iter)) { prop->unlisten((SignalListener)updateCheckbox); } else if (ChoiceProperty* prop = dynamic_cast<ChoiceProperty*>(*iter)) { prop->unlisten((SignalListener)updateChoice); } } // Clear out the old controls m_controlsPack->clear(); currentGroup = NULL; } // Reset the scrollbar m_controlsScroll->position(0, 0); // If there's no group, exit if (!group) { m_controlsScroll->redraw(); return; } // Constants for slider dimensions const int packWidth = m_controlsPack->w(); const int textHeight = 20; const int sliderHeight = 20; const int chooserHeight = 100; const int buttonHeight = 20; // Show them // For each control, add appropriate objects to the user interface currentGroup = group; PropertyList* props = group->getProperties(); for (PropertyList::iterator iter = props->begin(); iter != props->end(); iter++) { // Ignore it if it's a group property (those belong in the tree). if (dynamic_cast<GroupProperty*>(*iter)) continue; // And now we'll create a UI element for the property. // The big if-statement below uses dynamic_cast<PropertyType*>(ptr), // to see if a property has a given type. dynamic_cast will // return 0 if ptr is not of type PropertyType. // Add a slider if the property is a RangeProperty if (RangeProperty* prop = dynamic_cast<RangeProperty*>(*iter)) { // Add the label Fl_Box *box = new Fl_Box(0, 0, packWidth, textHeight, (*iter)->getName()); box->labelsize(14); box->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); box->box(FL_FLAT_BOX); // otherwise, Fl_Scroll messes up (ehsu) m_controlsPack->add(box); // Add the slider Fl_Value_Slider *slider = new Fl_Value_Slider(0, 0, packWidth, sliderHeight); slider->type(1); slider->range(prop->getMin(), prop->getMax()); slider->step(prop->getStep()); slider->value(prop->getValue()); m_controlsPack->add(slider); // Use the step size to determine the number of decimal places // shown in the slider's label. if (prop->getStep() > 0) { slider->precision((int)-log(prop->getStep())); } // Have the slider notify the program when it changes slider->callback((Fl_Callback*)SliderCallback, (void*) prop); // Have the property notify the slider when it changes prop->listen((SignalListener)updateRangeSlider, (void*) slider); // Add a color picker if the property is an RGB property } else if (RGBProperty* prop = dynamic_cast<RGBProperty*>(*iter)) { // Add the label Fl_Box *box = new Fl_Box(0, 0, packWidth, textHeight, (*iter)->getName()); box->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); box->labelsize(14); box->box(FL_FLAT_BOX); // otherwise, Fl_Scroll messes up (ehsu) m_controlsPack->add(box); // Add a color chooser Fl_Color_Chooser* chooser = new Fl_Color_Chooser(0, 0, packWidth, chooserHeight); chooser->rgb(prop->getRed(), prop->getGreen(), prop->getBlue()); m_controlsPack->add(chooser); // Have the chooser notify the program when it changes chooser->callback((Fl_Callback*)ColorPickerCallback, (void*) prop); // Remove any existing color chooser listeners on the property prop->unlisten((SignalListener)updateColorChooser); // Have the property notify the chooser when it changes prop->listen((SignalListener)updateColorChooser, (void*) chooser); // Add a checkbox if the property is a boolean property } else if (BooleanProperty* prop = dynamic_cast<BooleanProperty*>(*iter)) { // Add the checkbox -- no label needed! Fl_Check_Button* btn = new Fl_Check_Button(0, 0, packWidth, buttonHeight, prop->getName()); btn->labelsize(14); btn->type(FL_TOGGLE_BUTTON); btn->value(prop->getValue()); m_controlsPack->add(btn); // Have the button notify the program when it changes btn->callback((Fl_Callback*)ButtonCallback, (void*) prop); // Remove any existing color chooser listeners on the property prop->unlisten((SignalListener)updateCheckbox); // Have the property notify the chooser when it changes prop->listen((SignalListener)updateCheckbox, (void*) btn); // Add radio buttons if the property is a choice property } else if (ChoiceProperty* prop = dynamic_cast<ChoiceProperty*>(*iter)) { // Add the label Fl_Box *box = new Fl_Box(0, 0, packWidth, textHeight, (*iter)->getName()); box->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); box->labelsize(14); box->box(FL_FLAT_BOX); // otherwise, Fl_Scroll messes up (ehsu) m_controlsPack->add(box); // Add a group Fl_Pack* pack = new Fl_Pack(0, 0, packWidth, buttonHeight); pack->type(Fl_Pack::VERTICAL); pack->box(FL_THIN_DOWN_FRAME); pack->user_data((void*) prop); // Add the radio buttons const char* choices = prop->getLabels(); int start = 0, end = -1, index = 0; do { end++; if (choices[end] == 0 || choices[end] == '|') { string str(choices, start, end - start); Fl_Button* btn = new Fl_Round_Button(0, 0, packWidth, buttonHeight, prop->getName()); btn->type(FL_RADIO_BUTTON); btn->copy_label(str.c_str()); btn->value(prop->getValue() == index); // Have the button notify the program when it changes btn->callback((Fl_Callback*)ChoiceCallback, (void*)index); index++; start = end + 1; } } while (choices[end] != 0); pack->end(); m_controlsPack->add(pack); // Remove any existing choce listeners on the property prop->unlisten((SignalListener)updateChoice); // Have the property update the choices when it changes prop->listen((SignalListener)updateChoice, (void*) pack); } } m_controlsScroll->redraw(); }
ModelerUserInterface::ModelerUserInterface() { // Make this instance the current one instance = this; // Initialize pointers to NULL m_nativeChooser = NULL; model = NULL; currentGroup = NULL; // Set appearance to GTK+ for a nice look Fl::scheme("gtk+"); // Set the animation speed to 24 frames/second framesPerSecond = 24; // We're not animating yet. animating = false; // Set the color scheme Fl::set_color(FL_BACKGROUND_COLOR, 240, 240, 240); Fl::set_color(FL_BACKGROUND2_COLOR, 255, 255, 255); Fl::set_color(FL_FOREGROUND_COLOR, 0, 0, 0); Fl::set_color(FL_INACTIVE_COLOR, 128, 128, 128); Fl::set_color(FL_SELECTION_COLOR, 51, 153, 255); // Create all of the UI elements // (autogenerated by FLUID, the FLTK UI Designer) Fl_Double_Window* w; //const char* title = "CSEP457 Modeler"; const char* title = "CSEP557 Modeler"; { Fl_Double_Window* o = m_controlsWindow = new Fl_Double_Window(800, 625, title); w = o; o->callback((Fl_Callback*)cb_m_controlsWindow, (void*)(this)); o->when(FL_WHEN_NEVER); { Fl_Menu_Bar* o = m_controlsMenuBar = new Fl_Menu_Bar(0, 0, 800, 25); o->menu(menu_m_controlsMenuBar); } // Contains the controls on the left { leftPane = new Fl_Group(0, 25, 250, 600); int tabSpace = -25, controlSpace = 0; { Fl_Tile* o = m_controlSplitPane = new Fl_Tile(0, 50 + tabSpace, 250, 575 - tabSpace); o->box(FL_FLAT_BOX); { Fl_Tree* o = m_controlsTree = new Fl_Tree(0, 50 + tabSpace, 250, 100); o->when(FL_WHEN_CHANGED); o->callback((Fl_Callback*)TreeCallback); o->marginleft(-5); o->end(); } { Fl_Scroll* o = m_controlsScroll = new Fl_Scroll(0, 150 + tabSpace, 250, 475 - tabSpace - controlSpace); o->type(Fl_Scroll::VERTICAL); o->when(FL_WHEN_CHANGED); { Fl_Pack* o = m_controlsPack = new Fl_Pack(10, 150 + tabSpace, 215, 475 - tabSpace - controlSpace); Fl_Group::current()->resizable(o); o->spacing(2); o->end(); } o->end(); } o->end(); } // end Modeler group/tab leftPane->end(); } // left pane { // TODO: remove this extra brace! { Fl_Group* o = m_viewPane = new Fl_Group(250, 25, 550, 600); o->box(FL_NO_BOX); o->color(FL_BACKGROUND_COLOR); m_modelerView = new ModelerView(250, 25, 550, 600, ""); w->resizable(m_modelerView); o->end(); Fl_Group::current()->resizable(o); } } o->end(); } }
Fl_Double_Window* SUBnoteUI::make_window() { { SUBparameters = new Fl_Double_Window(735, 390, "SUBsynth Parameters"); SUBparameters->user_data((void*)(this)); { Fl_Scroll* o = new Fl_Scroll(5, 140, 435, 245); o->type(1); o->box(FL_THIN_UP_BOX); { Fl_Pack* o = harmonics = new Fl_Pack(10, 145, 425, 235); harmonics->type(1); for (int i=0;i<MAX_SUB_HARMONICS;i++){h[i]=new SUBnoteharmonic(0,0,15,o->h(),"");h[i]->init(pars,i);} harmonics->end(); } // Fl_Pack* harmonics o->end(); } // Fl_Scroll* o { Fl_Button* o = new Fl_Button(625, 365, 105, 20, "Close"); o->box(FL_THIN_UP_BOX); o->labelfont(1); o->labelsize(11); o->callback((Fl_Callback*)cb_Close); } // Fl_Button* o { Fl_Group* o = new Fl_Group(5, 5, 215, 135, "AMPLITUDE"); o->box(FL_THIN_UP_FRAME); o->labeltype(FL_EMBOSSED_LABEL); o->labelfont(1); o->align(FL_ALIGN_TOP|FL_ALIGN_INSIDE); { Fl_Value_Slider* o = vol = new Fl_Value_Slider(10, 25, 140, 15, "Vol"); vol->tooltip("Volume"); vol->type(5); vol->box(FL_FLAT_BOX); vol->labelsize(11); vol->maximum(127); vol->step(1); vol->callback((Fl_Callback*)cb_vol); vol->align(FL_ALIGN_RIGHT); o->value(pars->PVolume); } // Fl_Value_Slider* vol { Fl_Value_Slider* o = vsns = new Fl_Value_Slider(10, 45, 140, 15, "V.Sns"); vsns->tooltip("Velocity Sensing Function (rightmost to disable)"); vsns->type(5); vsns->box(FL_FLAT_BOX); vsns->labelsize(11); vsns->maximum(127); vsns->step(1); vsns->callback((Fl_Callback*)cb_vsns); vsns->align(FL_ALIGN_RIGHT); o->value(pars->PAmpVelocityScaleFunction); } // Fl_Value_Slider* vsns { WidgetPDial* o = pan = new WidgetPDial(185, 20, 30, 30, "Pan"); pan->tooltip("Panning (leftmost is Random)"); pan->box(FL_ROUND_UP_BOX); pan->color(FL_BACKGROUND_COLOR); pan->selection_color(FL_INACTIVE_COLOR); pan->labeltype(FL_NORMAL_LABEL); pan->labelfont(0); pan->labelsize(10); pan->labelcolor(FL_FOREGROUND_COLOR); pan->maximum(127); pan->step(1); pan->callback((Fl_Callback*)cb_pan); pan->align(FL_ALIGN_BOTTOM); pan->when(FL_WHEN_CHANGED); o->value(pars->PPanning); } // WidgetPDial* pan { EnvelopeUI* o = ampenv = new EnvelopeUI(10, 65, 205, 70, "SUBsynth - Amplitude Envelope"); ampenv->box(FL_FLAT_BOX); ampenv->color((Fl_Color)51); ampenv->selection_color(FL_BACKGROUND_COLOR); ampenv->labeltype(FL_NORMAL_LABEL); ampenv->labelfont(0); ampenv->labelsize(14); ampenv->labelcolor(FL_FOREGROUND_COLOR); ampenv->align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE); ampenv->when(FL_WHEN_RELEASE); o->init(pars->AmpEnvelope,master); ampenv->end(); } // EnvelopeUI* ampenv o->end(); } // Fl_Group* o { Fl_Group* o = new Fl_Group(495, 325, 235, 35); o->box(FL_THIN_UP_FRAME); { Fl_Counter* o = filterstages = new Fl_Counter(515, 340, 45, 15, "Filter Stages"); filterstages->tooltip("How many times the noise is filtered"); filterstages->type(1); filterstages->labelfont(1); filterstages->labelsize(10); filterstages->minimum(1); filterstages->maximum(5); filterstages->step(1); filterstages->textsize(10); filterstages->callback((Fl_Callback*)cb_filterstages); filterstages->align(FL_ALIGN_TOP); o->value(pars->Pnumstages); } // Fl_Counter* filterstages { Fl_Choice* o = magtype = new Fl_Choice(585, 340, 65, 15, "Mag.Type"); magtype->down_box(FL_BORDER_BOX); magtype->labelfont(1); magtype->labelsize(10); magtype->textsize(11); magtype->callback((Fl_Callback*)cb_magtype); magtype->align(FL_ALIGN_TOP); magtype->menu(menu_magtype); o->value(pars->Phmagtype); } // Fl_Choice* magtype { Fl_Choice* o = start = new Fl_Choice(670, 340, 50, 15, "Start"); start->down_box(FL_BORDER_BOX); start->labelfont(1); start->labelsize(10); start->textsize(11); start->callback((Fl_Callback*)cb_start); start->align(FL_ALIGN_TOP); start->menu(menu_start); o->value(pars->Pstart); } // Fl_Choice* start o->end(); } // Fl_Group* o { freqsettingsui = new Fl_Group(440, 5, 290, 135, "FREQUENCY"); freqsettingsui->box(FL_THIN_UP_FRAME); freqsettingsui->labeltype(FL_EMBOSSED_LABEL); freqsettingsui->labelfont(1); freqsettingsui->align(FL_ALIGN_TOP|FL_ALIGN_INSIDE); { EnvelopeUI* o = freqenvelopegroup = new EnvelopeUI(445, 65, 205, 70, "SUBsynth - Frequency Envelope"); freqenvelopegroup->box(FL_FLAT_BOX); freqenvelopegroup->color((Fl_Color)51); freqenvelopegroup->selection_color(FL_BACKGROUND_COLOR); freqenvelopegroup->labeltype(FL_NORMAL_LABEL); freqenvelopegroup->labelfont(0); freqenvelopegroup->labelsize(14); freqenvelopegroup->labelcolor(FL_FOREGROUND_COLOR); freqenvelopegroup->align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE); freqenvelopegroup->when(FL_WHEN_RELEASE); o->init(pars->FreqEnvelope,master); if (pars->PFreqEnvelopeEnabled==0) o->deactivate(); freqenvelopegroup->end(); } // EnvelopeUI* freqenvelopegroup { Fl_Check_Button* o = freqee = new Fl_Check_Button(445, 68, 55, 15, "Enabled"); freqee->down_box(FL_DOWN_BOX); freqee->labelfont(1); freqee->labelsize(10); freqee->callback((Fl_Callback*)cb_freqee); o->value(pars->PFreqEnvelopeEnabled); } // Fl_Check_Button* freqee { Fl_Counter* o = octave = new Fl_Counter(670, 50, 45, 15, "Octave"); octave->tooltip("Octave"); octave->type(1); octave->labelsize(10); octave->minimum(-8); octave->maximum(7); octave->step(1); octave->textfont(1); octave->textsize(11); octave->callback((Fl_Callback*)cb_octave); octave->align(FL_ALIGN_TOP); int k=pars->PCoarseDetune/1024;if (k>=8) k-=16; o->value(k); } // Fl_Counter* octave { Fl_Counter* o = coarsedet = new Fl_Counter(655, 115, 60, 20, "Coarse Det."); coarsedet->tooltip("Coarse Detune"); coarsedet->labelsize(10); coarsedet->minimum(-64); coarsedet->maximum(63); coarsedet->step(1); coarsedet->textfont(1); coarsedet->textsize(11); coarsedet->callback((Fl_Callback*)cb_coarsedet); coarsedet->align(FL_ALIGN_TOP); int k=pars->PCoarseDetune%1024;if (k>=512) k-=1024; o->value(k); o->lstep(10); } // Fl_Counter* coarsedet { Fl_Slider* o = detune = new Fl_Slider(495, 25, 230, 15); detune->tooltip("Fine Detune (cents)"); detune->type(5); detune->box(FL_FLAT_BOX); detune->minimum(-8192); detune->maximum(8191); detune->step(1); detune->callback((Fl_Callback*)cb_detune); o->value(pars->PDetune-8192); } // Fl_Slider* detune { Fl_Value_Output* o = detunevalueoutput = new Fl_Value_Output(448, 25, 45, 15, "Detune"); detunevalueoutput->labelsize(10); detunevalueoutput->minimum(-5000); detunevalueoutput->maximum(5000); detunevalueoutput->step(0.01); detunevalueoutput->textfont(1); detunevalueoutput->textsize(10); detunevalueoutput->callback((Fl_Callback*)cb_detunevalueoutput); detunevalueoutput->align(FL_ALIGN_TOP_LEFT); o->value(getdetune(pars->PDetuneType,0,pars->PDetune)); } // Fl_Value_Output* detunevalueoutput { Fl_Check_Button* o = hz440 = new Fl_Check_Button(555, 45, 50, 15, "440Hz"); hz440->tooltip("set the base frequency to 440Hz"); hz440->down_box(FL_DOWN_BOX); hz440->labelfont(1); hz440->labelsize(10); hz440->callback((Fl_Callback*)cb_hz440); o->value(pars->Pfixedfreq); } // Fl_Check_Button* hz440 { WidgetPDial* o = fixedfreqetdial = new WidgetPDial(610, 45, 15, 15, "Eq.T."); fixedfreqetdial->tooltip("How the frequency varies acording to the keyboard (leftmost for fixed frequen\ cy)"); fixedfreqetdial->box(FL_ROUND_UP_BOX); fixedfreqetdial->color(FL_BACKGROUND_COLOR); fixedfreqetdial->selection_color(FL_INACTIVE_COLOR); fixedfreqetdial->labeltype(FL_NORMAL_LABEL); fixedfreqetdial->labelfont(0); fixedfreqetdial->labelsize(10); fixedfreqetdial->labelcolor(FL_FOREGROUND_COLOR); fixedfreqetdial->maximum(127); fixedfreqetdial->step(1); fixedfreqetdial->callback((Fl_Callback*)cb_fixedfreqetdial); fixedfreqetdial->align(FL_ALIGN_RIGHT); fixedfreqetdial->when(FL_WHEN_CHANGED); o->value(pars->PfixedfreqET); if (pars->Pfixedfreq==0) o->deactivate(); } // WidgetPDial* fixedfreqetdial { Fl_Choice* o = detunetype = new Fl_Choice(655, 85, 70, 15, "Detune Type"); detunetype->down_box(FL_BORDER_BOX); detunetype->labelsize(10); detunetype->textfont(1); detunetype->textsize(10); detunetype->callback((Fl_Callback*)cb_detunetype); detunetype->align(FL_ALIGN_TOP_LEFT); o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents"); o->value(pars->PDetuneType-1); } // Fl_Choice* detunetype freqsettingsui->end(); } // Fl_Group* freqsettingsui { Fl_Check_Button* o = stereo = new Fl_Check_Button(440, 325, 55, 35, "Stereo"); stereo->box(FL_THIN_UP_BOX); stereo->down_box(FL_DOWN_BOX); stereo->labelfont(1); stereo->labelsize(10); stereo->callback((Fl_Callback*)cb_stereo); o->value(pars->Pstereo); } // Fl_Check_Button* stereo { Fl_Button* o = new Fl_Button(445, 365, 70, 20, "Clear"); o->tooltip("Clear the harmonics"); o->box(FL_THIN_UP_BOX); o->labelfont(1); o->labelsize(11); o->callback((Fl_Callback*)cb_Clear); } // Fl_Button* o { bandwidthsettingsui = new Fl_Group(220, 5, 220, 135, "BANDWIDTH"); bandwidthsettingsui->box(FL_THIN_UP_FRAME); bandwidthsettingsui->labeltype(FL_EMBOSSED_LABEL); bandwidthsettingsui->labelfont(1); bandwidthsettingsui->align(FL_ALIGN_TOP|FL_ALIGN_INSIDE); { EnvelopeUI* o = bandwidthenvelopegroup = new EnvelopeUI(225, 65, 205, 70, "SUBsynth - BandWidth Envelope"); bandwidthenvelopegroup->box(FL_FLAT_BOX); bandwidthenvelopegroup->color((Fl_Color)51); bandwidthenvelopegroup->selection_color(FL_BACKGROUND_COLOR); bandwidthenvelopegroup->labeltype(FL_NORMAL_LABEL); bandwidthenvelopegroup->labelfont(0); bandwidthenvelopegroup->labelsize(14); bandwidthenvelopegroup->labelcolor(FL_FOREGROUND_COLOR); bandwidthenvelopegroup->align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE); bandwidthenvelopegroup->when(FL_WHEN_RELEASE); o->init(pars->BandWidthEnvelope,master); if (pars->PBandWidthEnvelopeEnabled==0) o->deactivate(); bandwidthenvelopegroup->end(); } // EnvelopeUI* bandwidthenvelopegroup { Fl_Check_Button* o = bwee = new Fl_Check_Button(225, 67, 55, 15, "Enabled"); bwee->down_box(FL_DOWN_BOX); bwee->labelfont(1); bwee->labelsize(10); bwee->callback((Fl_Callback*)cb_bwee); o->value(pars->PBandWidthEnvelopeEnabled); } // Fl_Check_Button* bwee { Fl_Value_Slider* o = bandwidth = new Fl_Value_Slider(225, 40, 115, 15, "Band Width"); bandwidth->type(5); bandwidth->box(FL_FLAT_BOX); bandwidth->labelsize(10); bandwidth->maximum(127); bandwidth->step(1); bandwidth->callback((Fl_Callback*)cb_bandwidth); bandwidth->align(FL_ALIGN_TOP); o->value(pars->Pbandwidth); } // Fl_Value_Slider* bandwidth { Fl_Value_Slider* o = bwidthscale = new Fl_Value_Slider(345, 40, 90, 15, "B.Width Scale"); bwidthscale->tooltip("How much I increase the BandWidth according to lower/higher harmonics"); bwidthscale->type(5); bwidthscale->box(FL_FLAT_BOX); bwidthscale->labelsize(10); bwidthscale->minimum(-64); bwidthscale->maximum(63); bwidthscale->step(1); bwidthscale->callback((Fl_Callback*)cb_bwidthscale); bwidthscale->align(FL_ALIGN_TOP); o->value(pars->Pbwscale-64); } // Fl_Value_Slider* bwidthscale bandwidthsettingsui->end(); } // Fl_Group* bandwidthsettingsui { Fl_Group* o = globalfiltergroup = new Fl_Group(440, 140, 290, 185, "FILTER"); globalfiltergroup->box(FL_THIN_UP_FRAME); globalfiltergroup->labeltype(FL_EMBOSSED_LABEL); globalfiltergroup->labelfont(1); globalfiltergroup->labelsize(13); globalfiltergroup->align(FL_ALIGN_TOP|FL_ALIGN_INSIDE); { EnvelopeUI* o = filterenv = new EnvelopeUI(445, 250, 275, 70, "SUBsynth - Filter Envelope"); filterenv->box(FL_FLAT_BOX); filterenv->color((Fl_Color)51); filterenv->selection_color(FL_BACKGROUND_COLOR); filterenv->labeltype(FL_NORMAL_LABEL); filterenv->labelfont(0); filterenv->labelsize(14); filterenv->labelcolor(FL_FOREGROUND_COLOR); filterenv->align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE); filterenv->when(FL_WHEN_RELEASE); o->init(pars->GlobalFilterEnvelope,master); filterenv->end(); } // EnvelopeUI* filterenv { FilterUI* o = filterui = new FilterUI(445, 170, 275, 75, "SUBsynthl - Filter"); filterui->box(FL_FLAT_BOX); filterui->color(FL_LIGHT1); filterui->selection_color(FL_BACKGROUND_COLOR); filterui->labeltype(FL_NORMAL_LABEL); filterui->labelfont(0); filterui->labelsize(14); filterui->labelcolor(FL_FOREGROUND_COLOR); filterui->align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE); filterui->when(FL_WHEN_RELEASE); o->init(pars->GlobalFilter,&pars->PGlobalFilterVelocityScale,&pars->PGlobalFilterVelocityScaleFunction,master); filterui->end(); } // FilterUI* filterui if (pars->PGlobalFilterEnabled==0) o->deactivate(); globalfiltergroup->end(); } // Fl_Group* globalfiltergroup { Fl_Check_Button* o = filtere = new Fl_Check_Button(445, 145, 85, 20, "Enabled"); filtere->down_box(FL_DOWN_BOX); filtere->labelfont(1); filtere->labelsize(11); filtere->callback((Fl_Callback*)cb_filtere); o->value(pars->PGlobalFilterEnabled); } // Fl_Check_Button* filtere { Fl_Button* o = new Fl_Button(540, 370, 25, 15, "C"); o->box(FL_THIN_UP_BOX); o->color((Fl_Color)179); o->labelfont(1); o->labelsize(11); o->labelcolor(FL_BACKGROUND2_COLOR); o->callback((Fl_Callback*)cb_C); } // Fl_Button* o { Fl_Button* o = new Fl_Button(570, 370, 25, 15, "P"); o->box(FL_THIN_UP_BOX); o->color((Fl_Color)179); o->labelfont(1); o->labelsize(11); o->labelcolor(FL_BACKGROUND2_COLOR); o->callback((Fl_Callback*)cb_P); } // Fl_Button* o SUBparameters->end(); } // Fl_Double_Window* SUBparameters return SUBparameters; }
void Track::init ( void ) { _row = 0; _sequence = NULL; _name = NULL; _selected = false; _size = 1; record_ds = NULL; playback_ds = NULL; labeltype( FL_NO_LABEL ); // clear_visible_focus(); Fl_Group::size( timeline->w(), height() ); Track *o = this; o->box( FL_FLAT_BOX ); { Track_Header *o = new Track_Header( x(), y(), w(), h() ); name_field = o->name_input; record_button = o->rec_button; mute_button = o->mute_button; solo_button = o->solo_button; menu_button = o->menu_button; show_all_takes_button = o->show_all_takes_button; overlay_controls_button = o->overlay_controls_button; name_field->callback( cb_button, this ); record_button->callback( cb_button, this ); mute_button->callback( cb_button, this ); solo_button->callback( cb_button, this ); show_all_takes_button->callback( cb_button, this ); overlay_controls_button->callback( cb_button, this ); menu_button->callback( cb_button, this ); resizable( o ); // o->color( (Fl_Color)53 ); } { /* this pack holds the active sequence, annotation sequence, control sequences and takes */ Fl_Pack *o = pack = new Fl_Pack( x(), y(), w(), h() ); o->type( Fl_Pack::VERTICAL ); o->labeltype( FL_NO_LABEL ); /* o->resize( x() + width(), y(), w() - width(), h() ); */ /* resizable( o ); */ { Fl_Pack *o = annotation = new Fl_Pack( 0, 0, pack->w(), 1 ); o->type( Fl_Pack::VERTICAL ); o->end(); } { { Fl_Group *o = controls_heading = new Fl_Group( 0, 0, pack->w(), 10 ); o->box( FL_FLAT_BOX ); o->color( fl_color_add_alpha( fl_rgb_color( 1,1,1 ), 127 ) ); { Fl_Box *o = new Fl_Box( 0,0, Track::width(), 10 ); o->label( "Controls" ); o->align( FL_ALIGN_RIGHT | FL_ALIGN_INSIDE ); o->labelsize( 10 ); } o->hide(); o->end(); o->resizable( 0 ); } { Fl_Sometimes_Pack *o = control = new Fl_Sometimes_Pack( 0, 0, pack->w(), 1 ); o->spacing( 1 ); o->box( FL_NO_BOX ); o->color( FL_BACKGROUND_COLOR ); o->type( Fl_Pack::VERTICAL ); o->pack( true ); o->hide(); o->align( FL_ALIGN_TOP | FL_ALIGN_LEFT ); o->end(); } } { { Fl_Group *o = takes_heading = new Fl_Group( 0, 0, pack->w(), 10 ); o->box( FL_FLAT_BOX ); o->color( fl_color_add_alpha( fl_rgb_color( 1,1,1 ), 127 ) ); { Fl_Box *o = new Fl_Box( 0,0, Track::width(), 10 ); o->label( "Takes" ); o->align( FL_ALIGN_RIGHT | FL_ALIGN_INSIDE ); o->labelsize( 10 ); } o->hide(); o->end(); o->resizable( 0 ); } { Fl_Pack *o = takes = new Fl_Pack( 0, 0, pack->w(), 1 ); o->type( Fl_Pack::VERTICAL ); o->end(); o->hide(); o->align( FL_ALIGN_TOP | FL_ALIGN_LEFT ); } } o->end(); } end(); }
void FolderWindow::AddStructure(const char* filename, const int index) { Fl_Pack* pack = folderPack; pack->begin(); int vertPosn = pack->children() * 30 + pack->y(); Fl_Group* group = new Fl_Group(pack->x(), vertPosn, pack->w(), 30); group->begin(); Fl_Button* label = new Fl_Button(pack->x() + 10, vertPosn, pack->w() - 40, 30, filename); label->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_LEFT); label->callback(FolderWindow::ShowFileCallback); label->user_data((void*)index); Fl_Button* removeButton = new Fl_Button(pack->x() + pack->w() - 20, vertPosn + 5, 20, 20); removeButton->callback(FolderWindow::RemoveCallback); removeButton->user_data((void*)index); removeButton->label("@1+"); //printf("Added file: %s\n",label->label()); group->resizable(label); group->end(); pack->end(); folderScroll->redraw(); }
gdMidiInputMaster::gdMidiInputMaster() : gdMidiInputBase(0, 0, 300, 284, "MIDI Input Setup (global)") { set_modal(); Fl_Group* groupHeader = new Fl_Group(G_GUI_OUTER_MARGIN, G_GUI_OUTER_MARGIN, w(), 20); groupHeader->begin(); enable = new geCheck(G_GUI_OUTER_MARGIN, G_GUI_OUTER_MARGIN, 120, G_GUI_UNIT, "enable MIDI input"); channel = new geChoice(enable->x()+enable->w()+44, G_GUI_OUTER_MARGIN, 120, G_GUI_UNIT); groupHeader->resizable(nullptr); groupHeader->end(); Fl_Pack* pack = new Fl_Pack(G_GUI_OUTER_MARGIN, groupHeader->y()+groupHeader->h()+G_GUI_OUTER_MARGIN, LEARNER_WIDTH, 212); pack->spacing(G_GUI_INNER_MARGIN); pack->begin(); new geMidiLearner(0, 0, LEARNER_WIDTH, "rewind", &cb_learn, &conf::midiInRewind, nullptr); new geMidiLearner(0, 0, LEARNER_WIDTH, "play/stop", &cb_learn, &conf::midiInStartStop, nullptr); new geMidiLearner(0, 0, LEARNER_WIDTH, "action recording", &cb_learn, &conf::midiInActionRec, nullptr); new geMidiLearner(0, 0, LEARNER_WIDTH, "input recording", &cb_learn, &conf::midiInInputRec, nullptr); new geMidiLearner(0, 0, LEARNER_WIDTH, "metronome", &cb_learn, &conf::midiInMetronome, nullptr); new geMidiLearner(0, 0, LEARNER_WIDTH, "input volume", &cb_learn, &conf::midiInVolumeIn, nullptr); new geMidiLearner(0, 0, LEARNER_WIDTH, "output volume", &cb_learn, &conf::midiInVolumeOut, nullptr); new geMidiLearner(0, 0, LEARNER_WIDTH, "sequencer ×2", &cb_learn, &conf::midiInBeatDouble, nullptr); new geMidiLearner(0, 0, LEARNER_WIDTH, "sequencer ÷2", &cb_learn, &conf::midiInBeatHalf, nullptr); pack->end(); ok = new geButton(w()-88, pack->y()+pack->h()+G_GUI_OUTER_MARGIN, 80, G_GUI_UNIT, "Close"); end(); ok->callback(cb_close, (void*)this); enable->value(conf::midiIn); enable->callback(cb_enable, (void*)this); channel->add("Channel (any)"); channel->add("Channel 1"); channel->add("Channel 2"); channel->add("Channel 3"); channel->add("Channel 4"); channel->add("Channel 5"); channel->add("Channel 6"); channel->add("Channel 7"); channel->add("Channel 8"); channel->add("Channel 9"); channel->add("Channel 10"); channel->add("Channel 11"); channel->add("Channel 12"); channel->add("Channel 13"); channel->add("Channel 14"); channel->add("Channel 15"); channel->add("Channel 16"); channel->value(conf::midiInFilter -1 ? 0 : conf::midiInFilter + 1); channel->callback(cb_setChannel, (void*)this); u::gui::setFavicon(this); show(); }
ModelerUserInterface::ModelerUserInterface() { // Make this instance the current one instance = this; // Initialize pointers to NULL m_nativeChooser = NULL; model = NULL; currentGroup = NULL; renderGroup = NULL; defaultCam = NULL; ps = NULL; movieWidth = 720; movieHeight = 480; // Set appearance to GTK+ for a nice look Fl::scheme("gtk+"); // Set the animation speed to 24 frames/second framesPerSecond = 24; // We're not animating yet. animating = false; simulating = false; rendering = false; drawing = false; // Set the color scheme Fl::set_color(FL_BACKGROUND_COLOR, 240, 240, 240); Fl::set_color(FL_BACKGROUND2_COLOR, 255, 255, 255); Fl::set_color(FL_FOREGROUND_COLOR, 0, 0, 0); Fl::set_color(FL_INACTIVE_COLOR, 128, 128, 128); Fl::set_color(FL_SELECTION_COLOR, 51, 153, 255); // Create all of the UI elements // (autogenerated by FLUID, the FLTK UI Designer) Fl_Double_Window* w; const char* title = "Animator"; { Fl_Double_Window* o = m_controlsWindow = new Fl_Double_Window(800, 625, title); w = o; o->callback((Fl_Callback*)cb_m_controlsWindow, (void*)(this)); o->when(FL_WHEN_NEVER); { Fl_Menu_Bar* o = m_controlsMenuBar = new Fl_Menu_Bar(0, 0, 800, 25); o->menu(menu_m_controlsMenuBar); } // Contains the controls on the left { leftPane = new Fl_Group(0, 25, 250, 600); int tabSpace = 0, controlSpace = 0; int controlTop = 25 + 600 - controlSpace; // Modeler and Curves tabs { Fl_Tabs* t = new Fl_Tabs(0, 25, 250, 600 - controlSpace); // Make the tab area stretch. leftPane->resizable(t); t->when(FL_WHEN_CHANGED); t->callback((Fl_Callback*)TabsCallback, this); // Curves tab { Fl_Group* o = new Fl_Group(0, 50, 250, 575 - controlSpace, "Curves"); o->box(FL_FLAT_BOX); o->color(FL_BACKGROUND_COLOR); { Fl_Tree* o = curvesTree = new Fl_Tree(0, 50, 250, 575 - controlSpace); o->when(FL_WHEN_CHANGED); o->callback((Fl_Callback*)CurveTreeCallback); o->marginleft(-5); o->end(); } o->end(); } // Modeler tab { Fl_Tile* o = m_controlSplitPane = new Fl_Tile(0, 50 + tabSpace, 250, 575 + tabSpace - controlSpace, "Modeler"); // Make only the content area of the tabs resize. t->resizable(o); o->box(FL_FLAT_BOX); { Fl_Tree* o = m_controlsTree = new Fl_Tree(0, 50 + tabSpace, 250, 100); o->when(FL_WHEN_CHANGED); o->callback((Fl_Callback*)TreeCallback); o->marginleft(-5); o->end(); } { Fl_Scroll* o = m_controlsScroll = new Fl_Scroll(0, 150 + tabSpace, 250, 475 - tabSpace - controlSpace); o->type(Fl_Scroll::VERTICAL); o->when(FL_WHEN_CHANGED); { Fl_Pack* o = m_controlsPack = new Fl_Pack(10, 150 + tabSpace, 215, 475 - tabSpace - controlSpace); Fl_Group::current()->resizable(o); o->spacing(2); o->end(); } o->end(); } o->end(); } // end Modeler group/tab t->end(); } // end tabs leftPane->end(); } // left pane { // TODO: remove this extra brace! { Fl_Group* o = m_viewPane = new Special_Tile(250, 25, 550, 600); o->box(FL_NO_BOX); o->color(FL_BACKGROUND_COLOR); // show a smaller modeler view m_modelerView = new ModelerView(250, 25, 550, 350, ""); m_modelerView->resizable(); // show a curve window with animation controls underneath { curvePane = new Fl_Group(250, 375, 550, 250); // Row containing the curve options { Fl_Group* o = new Fl_Group(255, 380, 540, 20, "Curve Editor"); // Put particle system label inside o->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); o->labelfont(FL_HELVETICA_BOLD); // Curve type chooser chooserCurveType = new Fl_Choice(445, 380, 120, 20, "Curve Type: "); chooserCurveType->menu(curveTypeMenu); chooserCurveType->callback((Fl_Callback*)chooserCurveTypeCallback, this); chooserCurveType->deactivate(); // Wrap checkbox checkboxWrap = new Fl_Check_Button(570, 380, 60, 20, "Wrap"); checkboxWrap->callback((Fl_Callback*)checkboxWrapCallback, this); checkboxWrap->deactivate(); // Zoom All button buttonZoomAll = new Fl_Button(640, 380, 80, 20, "Zoom All"); buttonZoomAll->callback((Fl_Callback*)buttonZoomAllCallback, this); buttonZoomAll->deactivate(); // No resizing o->resizable(NULL); o->end(); } // The graph widget graph = new GraphWidget(255, 405, 540, 140); graph->callback((Fl_Callback*)graphCallback, this); curvePane->resizable(graph); // stretch the graph on resize // Camera buttons { cameraPane = new Fl_Group(255, 550, 540, 20, "Camera"); // Put camera label inside cameraPane->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); cameraPane->labelfont(FL_HELVETICA_BOLD); // Prevent internal widgets from resizing when the group is resized. cameraPane->resizable(NULL); // Use Camera button checkboxUseCamera = new Fl_Check_Button(315, 550, 165, 20, "Look Through Camera"); checkboxUseCamera->callback((Fl_Callback*)checkboxUseCameraCallback); // Plot Camera checkbox Fl_Button* buttonPlotCamera = new Fl_Button(485, 550, 120, 20, "Plot Keyframe"); buttonPlotCamera->callback((Fl_Callback*)buttonPlotCameraCallback); // Clear Plot button Fl_Button* buttonClearPlot = new Fl_Button(610, 550, 120, 20, "Clear Keyframe"); buttonClearPlot->callback((Fl_Callback*)buttonClearCameraCallback); // End this group cameraPane->end(); } // Particle system buttons { particlePane = new Fl_Group(255, 575, 540, 20, "Particle System"); // Put particle system label inside particlePane->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); particlePane->labelfont(FL_HELVETICA_BOLD); // Simulate button checkboxSimulate = new Fl_Check_Button(375, 575, 75, 20, "Simulate"); checkboxSimulate->callback((Fl_Callback*)checkboxSimulateCallback); // Clear Particles button buttonClearParticles = new Fl_Button(455, 575, 50, 20, "Clear"); buttonClearParticles->callback((Fl_Callback*)buttonClearParticlesCallback); // Particle "bake" indicator particleBakeIndicator = new IndicatorWindow(510, 575, 285, 20); // TODO: fix this: particleBakeIndicator->range(0, 20); particleBakeIndicator->deactivate(); particlePane->resizable(particleBakeIndicator); // End this group particlePane->end(); } // The playback controls { Fl_Group* o = new Fl_Group(255, 600, 540, 20, "Playback"); // Put particle system label inside o->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); o->labelfont(FL_HELVETICA_BOLD); // Rewind button Fl_Button* rewind = new Fl_Button(335, 600, 20, 20, "@|<"); rewind->labeltype(FL_SYMBOL_LABEL); rewind->callback((Fl_Callback*)buttonRewindCallback, this); // Play button buttonPlay = new Fl_Button(360, 600, 20, 20, "@>"); buttonPlay->labeltype(FL_SYMBOL_LABEL); buttonPlay->callback((Fl_Callback*)buttonPlayCallback, this); buttonPlay->labelcolor(FL_GREEN); // Fast Forward button Fl_Button* fastForward = new Fl_Button(385, 600, 20, 20, "@>|"); fastForward->labeltype(FL_SYMBOL_LABEL); fastForward->callback((Fl_Callback*)buttonFastForwardCallback, this); // Time slider sliderTime = new Fl_Value_Slider(455, 600, 340, 20, "Time:"); sliderTime->type(FL_HORIZONTAL); sliderTime->align(FL_ALIGN_LEFT); sliderTime->callback((Fl_Callback*)sliderTimeCallback, this); sliderTime->bounds(0, 20); // Stretch the time slider on resize o->resizable(sliderTime); o->end(); } curvePane->end(); } w->resizable(m_modelerView); o->end(); Fl_Group::current()->resizable(o); } } o->end(); } }
int main(int argc, char **argv) { window = new Fl_Window(400,300); Fl_Pack* pack = new Fl_Pack(100,0,200,300); pack->spacing(20); counter = new Fl_Simple_Counter(0,0,100,20,"Размер поля"); counter->step(1.0); counter->minimum(2); counter->maximum(10); counter->value(4); rtype1 = new Fl_Radio_Round_Button(0,60,300,20,"Внутренняя устойчивость"); rtype2 = new Fl_Radio_Round_Button(0,100,300,20,"Внешняя устойчивость"); rtype1->value(1); piece = new Fl_Choice(0,150,300,20); for(unsigned int i=0; i < mylib::pieces_n; i++) piece->add(mylib::pieces[i].name); piece->value(piece->menu()); progress = new Fl_Progress(0,0,300,30,"Прогресс"); progress->minimum(0); progress->maximum(100); progress->value(0); progress->hide(); start = new Fl_Button(0,40,300,30,"Считать"); start->callback(&on_start); full_dnf = new Fl_Check_Button(0,0,300,20,"Выводить промежуточные результаты"); pack->add(piece); pack->add(rtype1); pack->add(rtype2); pack->add(counter); pack->add(full_dnf); pack->add(start); pack->add(progress); txt_window = new Fl_Window(500,500,"Результат"); txt_pack = new Fl_Pack(0,0,500,500); txt_buttons = new Fl_Pack(0,0,500,30); txt_buttons->type(Fl_Pack::HORIZONTAL); txt_out = new Fl_Text_Display(0,0,500,470); txt_out->textfont(FL_COURIER); txt_close = new Fl_Button(0,0,100,30,"Закрыть"); txt_copy = new Fl_Button(0,0,100,30,"Копировать"); txt_save = new Fl_Button(0,0,100,30,"Сохранить"); txt_close->callback(&on_txt_close); txt_copy->callback(&on_txt_copy); txt_save->callback(&on_txt_save); txt_pack->add(txt_out); txt_buttons->add(txt_close); txt_buttons->add(txt_copy); txt_buttons->add(txt_save); txt_window->callback(&on_txt_close); txt_window->resizable(txt_pack); txt_pack->add_resizable(*txt_out); txt_pack->add(txt_buttons); txt_window->add(txt_pack); window->label("Дискретка"); window->add(pack); window->show(argc, argv); //Fl::scheme("windows"); Fl::lock(); while(Fl::wait() > 0) { std::stringstream* msg; if((msg = (std::stringstream*)Fl::thread_message())) { end_calc_thread(msg); } } return 0; }