//constructeur Fl_Progress_Window() : Fl_Window(238,105,"Progression...") { // Progress 1 Label Fl_Box *label = new Fl_Box(10,10,215,15,"Pourcentage Général:"); label->labelsize(12); label->labelfont(1); label->labelcolor((Fl_Color)136); label->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); //Progress1 progress1 = new Fl_Progress(10,28,215,20,"0%"); progress1->selection_color((Fl_Color)175); progress1->maximum(100); progress1->minimum(0); progress1->labelsize(12); // Progress filename (label progress 2) progress_filename = new Fl_Box(10,52,215,15, "Fichier:"); progress_filename->labelsize(12); progress_filename->labelfont(1); progress_filename->labelcolor((Fl_Color)136); progress_filename->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); // Progress 2 progress2 = new Fl_Progress(10,70,215,20,"0%"); progress2->maximum(100); progress2->minimum(0); progress2->labelsize(12); progress2->selection_color((Fl_Color)175); //fin du window... this->set_modal(); this->end(); }
Fl_Group* SUBnoteharmonic::make_window() { { harmonic = new Fl_Group(0, 0, 90, 225); harmonic->box(FL_FLAT_BOX); harmonic->color(FL_BACKGROUND_COLOR); harmonic->selection_color(FL_BACKGROUND_COLOR); harmonic->labeltype(FL_NO_LABEL); harmonic->labelfont(0); harmonic->labelsize(14); harmonic->labelcolor(FL_FOREGROUND_COLOR); harmonic->user_data((void*)(this)); harmonic->align(FL_ALIGN_TOP); harmonic->when(FL_WHEN_RELEASE); { Fl_Slider* o = mag = new Fl_Slider(0, 15, 10, 115); mag->tooltip("harmonic\'s magnitude"); mag->type(4); mag->box(FL_FLAT_BOX); mag->selection_color((Fl_Color)222); mag->maximum(127); mag->step(1); mag->value(127); mag->callback((Fl_Callback*)cb_mag); o->value(127-pars->Phmag[n]); if (pars->Phmag[n]==0) o->selection_color(0); } // Fl_Slider* mag { Fl_Slider* o = bw = new Fl_Slider(0, 135, 10, 75); bw->tooltip("harmonic\'s bandwidth"); bw->type(4); bw->box(FL_FLAT_BOX); bw->selection_color((Fl_Color)222); bw->maximum(127); bw->step(1); bw->value(64); bw->callback((Fl_Callback*)cb_bw); o->value(127-pars->Phrelbw[n]); } // Fl_Slider* bw { Fl_Box* o = new Fl_Box(10, 170, 5, 5); o->box(FL_FLAT_BOX); o->color(FL_DARK2); if (n+1==MAX_SUB_HARMONICS) o->hide(); } // Fl_Box* o { Fl_Box* o = new Fl_Box(0, 210, 10, 15, "01"); o->labelfont(1); o->labelsize(9); o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp)); } // Fl_Box* o { Fl_Box* o = new Fl_Box(0, 0, 10, 15, "01"); o->labelfont(1); o->labelsize(9); o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp)); } // Fl_Box* o harmonic->end(); } // Fl_Group* harmonic return harmonic; }
Fl_new_adjuster(int X, int Y, int W, int H, const char* L=0) :Fl_Adjuster(X,Y,W/2,H, L) ,b(FL_DOWN_BOX, X+W/2,Y, W/2,H,buf2) { if(b.h()<=20 && b.labelsize()>11) b.labelsize(11); align(FL_ALIGN_LEFT); step(1); value_damage(); }
void ModelerApplication::Init(ModelerViewCreator_f createView, const ModelerControl controls[], unsigned numControls) { int i; m_animating = false; m_numControls = numControls; // ******************************************************** // Create the FLTK user interface // ******************************************************** m_ui = new ModelerUserInterface(); // Store pointers to the controls for manipulation m_controlLabelBoxes = new Fl_Box*[numControls]; m_controlValueSliders = new Fl_Value_Slider*[numControls]; // Constants for user interface setup const int textHeight = 20; const int sliderHeight = 20; const int packWidth = m_ui->m_controlsPack->w(); m_ui->m_controlsPack->begin(); // For each control, add appropriate objects to the user interface for (i=0; i<m_numControls; i++) { // Add the entry to the selection box m_ui->m_controlsBrowser->add(controls[i].m_name); // Add the label (but make it invisible for now) Fl_Box *box = new Fl_Box(0, 0, packWidth, textHeight, controls[i].m_name); box->labelsize(10); box->hide(); box->box(FL_FLAT_BOX); // otherwise, Fl_Scroll messes up (ehsu) m_controlLabelBoxes[i] = box; // Add the slider (but make it invisible for now) Fl_Value_Slider *slider = new Fl_Value_Slider(0, 0, packWidth, sliderHeight,0); slider->type(1); slider->range(controls[i].m_minimum, controls[i].m_maximum); slider->step(controls[i].m_stepsize); slider->value(controls[i].m_value); slider->hide(); m_controlValueSliders[i] = slider; slider->callback((Fl_Callback*)ModelerApplication::SliderCallback); } m_ui->m_controlsPack->end(); // Make sure that we remove the view from the // Fl_Group, otherwise, it'll blow up // THIS BUG FIXED 04-18-01 ehsu m_ui->m_modelerWindow->remove(*(m_ui->m_modelerView)); delete m_ui->m_modelerView; m_ui->m_modelerWindow->begin(); m_ui->m_modelerView = createView(0, 0, m_ui->m_modelerWindow->w(), m_ui->m_modelerWindow->h() ,NULL); Fl_Group::current()->resizable(m_ui->m_modelerView); m_ui->m_modelerWindow->end(); }
int main(int argc, char **argv) { Fl_Window *window = new Fl_Window(300,180); Fl_Box *box = new Fl_Box(FL_UP_BOX,20,40,260,100,"Hello, World!"); box->labelfont(FL_BOLD+FL_ITALIC); box->labelsize(36); box->labeltype(FL_SHADOW_LABEL); window->end(); window->show(argc, argv); return Fl::run(); }
int main(int argc, char *argv[]) { Fl_Window *window = new Fl_Window (800,700,"TETRIS"); window->color(56); Board *b = new Board(); Fl_Box *scorebox = new Fl_Box(tilesize*xmaxtiles+10,50,300,200,"Score: 0\0"); scorebox->box(FL_UP_BOX); scorebox->labelfont(FL_BOLD+FL_ITALIC); scorebox->labelsize(36); scorebox->labeltype(FL_ENGRAVED_LABEL); b->setScoreBox(&scorebox); Fl_Box *exi = new Fl_Box(tilesize*2,ymaxtiles*15,300,200,"Press Escape to Exit"); exi->box(FL_UP_BOX); exi->labelfont(FL_BOLD+FL_ITALIC); exi->labelsize(36); exi->labeltype(FL_ENGRAVED_LABEL); window->end(); window->show(); Fl::add_timeout(0.1, timeractions,b); return(Fl::run()); }
int main(int argc, char **argv) { Fl_Window *window = new Fl_Window(340,180,"世界へようこそ!"); Fl_Box *box = new Fl_Box(20,40,300,100,"ようこそ、世界!"); Fl::set_font(FL_HELVETICA, "Kochi Mincho"); window->begin(); // Fl_Widget(x, y, width, height, label) //box->box(FL_UP_BOX); box->box(FL_NO_BOX); box->labelsize(36); box->labeltype(FL_SHADOW_LABEL); window->end(); window->show(argc, argv); return Fl::run(); }
void ModelerUI::addControl(const char* szName, float fMin, float fMax, float fStepSize, float fInitVal) { Fl_Group* pgrpCurrBak = Fl_Group::current(); Fl_Group::current(m_ppckPack); const int k_iTextHeight = 20; const int k_iSliderHeight = 20; // Setup the label box Fl_Box* box = new Fl_Box(0, 0, m_ppckPack->w(), k_iTextHeight, szName); box->labelsize(10); box->hide(); box->box(FL_FLAT_BOX); // otherwise, Fl_Scroll messes up (ehsu) // Setup the slider Fl_Value_Slider *slider = new Fl_Value_Slider(0, 0, m_ppckPack->w(), k_iSliderHeight, 0); slider->type(1); slider->hide(); slider->user_data(this); slider->callback(cb_sliders); slider->range(fMin, fMax); slider->step(fStepSize); slider->value(fInitVal); Fl_Group::current(pgrpCurrBak); // Add this entry to the browser string strName = "@C0"; // FLTK color encoding, we'll use @C0~@C6 strName += szName; m_pbrsBrowser->add(strName.c_str()); // Setup the curve m_pwndGraphWidget->addCurve(fInitVal, fMin, fMax); ++m_iCurrControlCount; }
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(); }
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 MainWindow::createComponents() { Fl_Group* grpSequence = new Fl_Group(10,20,150,120, "Sequence :"); if ( grpSequence != NULL ) { grpSequence->box(FL_DOWN_BOX); grpSequence->align(Fl_Align(FL_ALIGN_TOP_LEFT)); grpSequence->labelsize(DEFAULT_FONT_SIZE); grpSequence->begin(); seqPreparing = new Fl_Box(20,30,130,20,"1. Preparing update ..."); if ( seqPreparing != NULL ) { seqPreparing->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE ); seqPreparing->labelsize(DEFAULT_FONT_SIZE); seqPreparing->deactivate(); } seqRetrieving = new Fl_Box(20,50,130,20,"2. Retrieving data ..."); if ( seqRetrieving != NULL ) { seqRetrieving->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE ); seqRetrieving->labelsize(DEFAULT_FONT_SIZE); seqRetrieving->deactivate(); } seqProcessing = new Fl_Box(20,70,130,20,"3. Processing data ..."); if ( seqProcessing != NULL ) { seqProcessing->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE ); seqProcessing->labelsize(DEFAULT_FONT_SIZE); seqProcessing->deactivate(); } seqUpdating = new Fl_Box(20,90,130,20,"4. Updating ..."); if ( seqUpdating != NULL ) { seqUpdating->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE ); seqUpdating->labelsize(DEFAULT_FONT_SIZE); seqUpdating->deactivate(); } seqFinalizing = new Fl_Box(20,110,130,20,"5. Finalizing ..."); if ( seqFinalizing != NULL ) { seqFinalizing->align( FL_ALIGN_LEFT | FL_ALIGN_INSIDE ); seqFinalizing->labelsize(DEFAULT_FONT_SIZE); seqFinalizing->deactivate(); } grpSequence->end(); progBar = new Fl_Progress(10,150,150,10); if ( progBar != NULL ) { progBar->color2(FL_BLUE); progBar->maximum(5); progBar->minimum(0); progBar->value(0); } mli_info = new Fl_Box(170,20,220,140,""); if ( mli_info != NULL ) { mli_info->box( FL_DOWN_BOX ); mli_info->align( FL_ALIGN_TOP_LEFT | FL_ALIGN_INSIDE ); mli_info->labelsize(DEFAULT_FONT_SIZE); } Fl_Box* boxCopyright = new Fl_Box(10,165,380,35); if ( boxCopyright != NULL ) { boxCopyright->box(FL_DOWN_BOX); boxCopyright->align( FL_ALIGN_TOP_LEFT | FL_ALIGN_INSIDE ); boxCopyright->labelsize(COPYRIGHT_FONT_SIZE); boxCopyright->label("Automatic Updater, (C)Copyright 2013 Rageworx freeware.\n" "All rights reserved, [email protected]"); } } }
MatrixPluginGUI::MatrixPluginGUI(int w, int h,MatrixPlugin *o,ChannelHandler *ch,const HostInfo *Info) : SpiralPluginGUI(w,h,o,ch), m_LastLight(0), m_LastPatSeqLight(0) { //size_range(10,10); m_Pattern = new Fl_Counter (5, 20, 40, 20, "View"); m_Pattern->labelsize (10); m_Pattern->type (FL_SIMPLE_COUNTER); m_Pattern->box (FL_PLASTIC_UP_BOX); m_Pattern->color (Info->GUI_COLOUR); m_Pattern->step (1); m_Pattern->minimum (0); m_Pattern->maximum (NUM_PATTERNS-1); m_Pattern->value (0); m_Pattern->callback ((Fl_Callback*)cb_Pattern); add (m_Pattern); m_PlayPattern = new Fl_Counter (50, 20, 40, 20, "Play"); m_PlayPattern->labelsize (10); m_PlayPattern->type (FL_SIMPLE_COUNTER); m_PlayPattern->box (FL_PLASTIC_UP_BOX); m_PlayPattern->color (Info->GUI_COLOUR); m_PlayPattern->step (1); m_PlayPattern->minimum (0); m_PlayPattern->maximum (NUM_PATTERNS-1); m_PlayPattern->value (0); m_PlayPattern->callback ((Fl_Callback*)cb_PlayPattern); add (m_PlayPattern); m_Length = new Fl_Counter (5, 55, 40, 20, "Length"); m_Length->labelsize (10); m_Length->type (FL_SIMPLE_COUNTER); m_Length->box (FL_PLASTIC_UP_BOX); m_Length->color (Info->GUI_COLOUR); m_Length->step (1); m_Length->value (64); m_Length->minimum (1); m_Length->maximum (64); m_Length->callback ((Fl_Callback*)cb_Length); add (m_Length); m_Octave = new Fl_Counter(5, 90, 40, 20, "Octave"); m_Octave->labelsize(10); m_Octave->type (FL_SIMPLE_COUNTER); m_Octave->box (FL_PLASTIC_UP_BOX); m_Octave->color (Info->GUI_COLOUR); m_Octave->minimum (0); m_Octave->maximum (6); m_Octave->step (1); m_Octave->value (0); m_Octave->callback((Fl_Callback*)cb_Octave); add (m_Octave); m_Speed = new Fl_Knob (50, 60, 40, 40, "Speed"); m_Speed->color (Info->GUI_COLOUR); m_Speed->type (Fl_Knob::DOTLIN); m_Speed->labelsize (10); m_Speed->minimum (0); m_Speed->maximum (400); m_Speed->step (0.01); m_Speed->value (8); m_Speed->callback ((Fl_Callback*)cb_Speed); add (m_Speed); m_SpeedVal = new Fl_Counter (5, 125, 85, 20, ""); m_SpeedVal->labelsize (10); m_SpeedVal->value (10); m_SpeedVal->type (FL_SIMPLE_COUNTER); m_SpeedVal->box (FL_PLASTIC_UP_BOX); m_SpeedVal->color (Info->GUI_COLOUR); m_SpeedVal->step (1); m_SpeedVal->maximum (400); m_SpeedVal->minimum (0); m_SpeedVal->value (8); m_SpeedVal->callback ((Fl_Callback*)cb_SpeedVal); add (m_SpeedVal); m_CopyBtn = new Fl_Button (5, 150, 40, 20, "Copy"); m_CopyBtn->labelsize (10); m_CopyBtn->box (FL_PLASTIC_UP_BOX); m_CopyBtn->color (Info->GUI_COLOUR); m_CopyBtn->selection_color (Info->GUI_COLOUR); m_CopyBtn->callback ((Fl_Callback*)cb_CopyBtn); add (m_CopyBtn); m_PasteBtn = new Fl_Button (50, 150, 40, 20, "Paste"); m_PasteBtn->labelsize (10); m_PasteBtn->box (FL_PLASTIC_UP_BOX); m_PasteBtn->color (Info->GUI_COLOUR); m_PasteBtn->selection_color (Info->GUI_COLOUR); m_PasteBtn->deactivate(); m_PasteBtn->callback ((Fl_Callback*)cb_PasteBtn); add (m_PasteBtn); m_ClearBtn = new Fl_Button (5, 175, 85, 20, "Clear"); m_ClearBtn->labelsize (10); m_ClearBtn->box (FL_PLASTIC_UP_BOX); m_ClearBtn->color (Info->GUI_COLOUR); m_ClearBtn->selection_color (Info->GUI_COLOUR); m_ClearBtn->callback ((Fl_Callback*)cb_ClearBtn); add (m_ClearBtn); m_TransUpBtn = new Fl_Button (5, 200, 40, 20, "Up"); m_TransUpBtn->labelsize (10); m_TransUpBtn->box (FL_PLASTIC_UP_BOX); m_TransUpBtn->color (Info->GUI_COLOUR); m_TransUpBtn->selection_color (Info->GUI_COLOUR); m_TransUpBtn->callback ((Fl_Callback*)cb_TransUpBtn); add (m_TransUpBtn); m_TransDnBtn = new Fl_Button (50, 200, 40, 20, "Down"); m_TransDnBtn->labelsize (10); m_TransDnBtn->box (FL_PLASTIC_UP_BOX); m_TransDnBtn->color (Info->GUI_COLOUR); m_TransDnBtn->selection_color (Info->GUI_COLOUR); m_TransDnBtn->callback ((Fl_Callback*)cb_TransDnBtn); add (m_TransDnBtn); m_TransLbl = new Fl_Box (5, 216, 85, 20, "Transpose"); m_TransLbl->labelsize(10); add (m_TransLbl); m_NoteCut = new Fl_Button (5, h-30, 85, 20, "NoteCut"); m_NoteCut->type (FL_TOGGLE_BUTTON); m_NoteCut->box (FL_PLASTIC_UP_BOX); m_NoteCut->color (Info->GUI_COLOUR); m_NoteCut->selection_color (Info->GUI_COLOUR); m_NoteCut->labelsize (10); m_NoteCut->value (0); m_NoteCut->callback ((Fl_Callback*)cb_NoteCut); add (m_NoteCut); int xoff=105; int yoff=40; int butsize=7; int n=0; fl_color(150,150,150); int markercol=fl_color(); fl_color(170,170,170); int blcolour=fl_color(); for(int x=0; x<MATX; x++) for(int y=0; y<MATY; y++) { Numbers[n]=n; m_Matrix[x][y] = new Fl_MatrixButton(xoff+x*butsize,yoff+((MATY-1)*butsize)-(y*butsize),butsize+1,butsize+1,""); m_Matrix[x][y]->type(1); m_Matrix[x][y]->box(FL_BORDER_BOX); m_Matrix[x][y]->SetSelColour (Info->GUI_COLOUR); if ((x%8)==0) m_Matrix[x][y]->color(markercol); else if ((y%12)==1 || (y%12)==3 || (y%12)==6 || (y%12)==8 || (y%12)==10) m_Matrix[x][y]->color(blcolour); else m_Matrix[x][y]->color(FL_GRAY); m_Matrix[x][y]->selection_color(FL_WHITE); m_Matrix[x][y]->callback((Fl_Callback*)cb_Matrix,(void*)&Numbers[n]); m_Matrix[x][y]->SetVolCallback((Fl_Callback*)cb_MatVol,(void*)&Numbers[n]); add(m_Matrix[x][y]); n++; } yoff=37; for(int y=0; y<MATY; y++) { Fl_Box *box = new Fl_Box(90,yoff+((MATY-1)*butsize)-(y*butsize),15,15,NoteText[y%12]); box->align(FL_ALIGN_INSIDE|FL_ALIGN_LEFT); box->labelsize(8); } xoff=103; for(int x=0; x<MATX; x++) { m_Flash[x] = new Fl_LED_Button(xoff+x*butsize,20,15,15,""); m_Flash[x]->selection_color(FL_WHITE); add(m_Flash[x]); } xoff=560; yoff=40; int height=12,gap=2; Fl_Box *patseqlabel = new Fl_Box(xoff,yoff-15,30,10,"Pat Seq"); patseqlabel->labelsize(10); add(patseqlabel); for(int y=0; y<NUM_PATSEQ; y++) { m_PatSeq[y]= new Fl_Counter(xoff,yoff+y*(height+gap),25,height); m_PatSeq[y]->type(FL_SIMPLE_COUNTER); m_PatSeq[y]->step(1); m_PatSeq[y]->textsize(8); if (y==0) m_PatSeq[y]->minimum (0); else m_PatSeq[y]->minimum (-1); m_PatSeq[y]->value (m_PatSeq[y]->minimum ()); m_PatSeq[y]->maximum (NUM_PATTERNS-1); m_PatSeq[y]->callback((Fl_Callback*)cb_PatSeq,(void*)&Numbers[y]); add(m_PatSeq[y]); m_PatSeqFlash[y] = new Fl_LED_Button(xoff+25,yoff+y*(height+gap),15,15,""); m_PatSeqFlash[y]->selection_color(FL_WHITE); add(m_PatSeqFlash[y]); } end(); }
void SynthModular::LoadPlugins (string pluginPath) { int Width = 35; int Height = 35; int SWidth = 256; int SHeight = 256; Fl_Pixmap pic (SSM_xpm); Fl_Double_Window* Splash = new Fl_Double_Window ((Fl::w()/2) - (SWidth/2), (Fl::h()/2) - (SHeight/2), SWidth, SHeight, "SSM"); Splash->border(0); Fl_Box* pbut = new Fl_Box (0, 8, SWidth, SHeight, ""); pbut->box (FL_NO_BOX); pic.label (pbut); Fl_Box *splashtext = new Fl_Box (5, SHeight-20, 200, 20, "Loading..."); splashtext->labelsize (10); splashtext->box (FL_NO_BOX); splashtext->align (FL_ALIGN_INSIDE | FL_ALIGN_LEFT); Splash->add (pbut); Splash->add (splashtext); Splash->show(); int ID=-1; vector<string> PluginVector; if (SpiralInfo::USEPLUGINLIST) PluginVector = SpiralInfo::PLUGINVEC; else { if (pluginPath.empty()) PluginVector = BuildPluginList (SpiralInfo::PLUGIN_PATH); else { string::iterator i = pluginPath.end() - 1; if (*i != '/') pluginPath += '/'; PluginVector = BuildPluginList (pluginPath); } } for (vector<string>::iterator i=PluginVector.begin(); i!=PluginVector.end(); i++) { string Fullpath; if (pluginPath=="") Fullpath=SpiralInfo::PLUGIN_PATH+*i; else Fullpath = pluginPath + *"/" + *i; ID = PluginManager::Get()->LoadPlugin (Fullpath.c_str()); if (ID!=PluginError) { #ifdef DEBUG_PLUGINS cerr << ID << " = Plugin [" << *i << "]" << endl; #endif Fl_ToolButton *NewButton = new Fl_ToolButton (0, 0, Width, Height, ""); // we can't set user data, because the callback uses it // NewButton->user_data ((void*)(this)); NewButton->labelsize (1); Fl_Pixmap *tPix = new Fl_Pixmap (PluginManager::Get()->GetPlugin(ID)->GetIcon()); NewButton->image(tPix->copy(tPix->w(),tPix->h())); delete tPix; const char * gName = PluginManager::Get()->GetPlugin(ID)->GetGroupName(); string GroupName(gName); Fl_Pack* the_group=NULL; // find or create this group, and add an icon map<string,Fl_Pack*>::iterator gi = m_PluginGroupMap.find (GroupName); if (gi == m_PluginGroupMap.end()) { the_group = new Fl_Pack (m_GroupTab->x(), 16, m_GroupTab->w(), m_GroupTab->h() - 15, gName); the_group->type(FL_HORIZONTAL); the_group->labelsize(8); the_group->color(SpiralInfo::GUICOL_Button); the_group->user_data((void*)(this)); //m_GroupTab->add(the_group); m_GroupTab->value(the_group); m_PluginGroupMap[GroupName]=the_group; } else the_group = gi->second; NewButton->type (0); NewButton->box (FL_NO_BOX); NewButton->down_box (FL_NO_BOX); //NewButton->color(SpiralInfo::GUICOL_Button); //NewButton->selection_color(SpiralInfo::GUICOL_Button); the_group->add (NewButton); // we need to keep tooltips stored outside their widgets - widgets just have a pointer // I haven't done anything about cleaning up these strings - which may cause memory leaks? // But m_DeviceVec - which, I assume, would be used to keep track of / clean up the dynamicly // created NewButton widgets isn't cleaned up either, so we might have 2 memory leaks // involved? - but then again, they might be automatically deallocated because they're // in another widget, in which case there's just one memory leak to deal with. (andy) string* PluginName = new string (*i); // find the first slash, if there is one, and get rid of everything before and including it unsigned int p = PluginName->find ('/'); if (p < PluginName->length()) PluginName->erase (0, p); // find last . and get rid of everything after and including it p = PluginName->rfind ('.'); unsigned int l = PluginName->length (); if (p < l) PluginName->erase (p, l); NewButton->tooltip (PluginName->c_str()); // Slashes have significance to the menu widgets, remove them from the GroupName while ((p = GroupName.find ('/')) < PluginName->length()) GroupName = GroupName.replace (p, 1, " and "); string MenuEntry = "Plugins/" + GroupName + "/" + *PluginName; m_MainMenu->add (MenuEntry.c_str(), 0, cb_NewDeviceFromMenu, &Numbers[ID], 0); // when help is working better - this will put the plugins into the help menu // MenuEntry = "Help/" + MenuEntry; // m_MainMenu->add (MenuEntry.c_str(), 0, NULL, &Numbers[ID], 0); // Add the plugins to the canvas menu m_Canvas->AddPluginName (MenuEntry, PluginManager::Get()->GetPlugin(ID)->ID); // this overwrites the widget's user_data with that specified for the callback // so we can't use it for other purposes NewButton->callback ((Fl_Callback*)cb_NewDevice, &Numbers[ID]); NewButton->show(); // Nothing else ever touches m_DeviceVec - is this right??? (andy) m_DeviceVec.push_back (NewButton); the_group->redraw(); // m_NextPluginButton++; Fl::check(); splashtext->label (PluginName->c_str()); Splash->redraw(); } } map<string,Fl_Pack*>::iterator PlugGrp; for (PlugGrp = m_PluginGroupMap.begin(); PlugGrp!= m_PluginGroupMap.end(); ++PlugGrp) { m_GroupTab->add (PlugGrp->second); PlugGrp->second->add (new Fl_Box (0, 0, 600, 100, "")); } // try to show the SpiralSound group PlugGrp = m_PluginGroupMap.find("SpiralSound"); // can't find it - show the first plugin group if (PlugGrp==m_PluginGroupMap.end()) PlugGrp=m_PluginGroupMap.begin(); m_GroupTab->value(PlugGrp->second); bool found_dummy; int i; do { found_dummy = false; for (i=0; i<m_MainMenu->size(); i++) { if (m_MainMenu->text (i) != NULL) { found_dummy = (strcmp ("dummy", m_MainMenu->text (i)) == 0); if (found_dummy) break; } } if (found_dummy) m_MainMenu->remove (i); } while (found_dummy); Splash->hide(); delete Splash; }
Fl_Font_Browser::Fl_Font_Browser():Fl_Window(100,100,550-60,332-5,"Font Browser") { lst_Font = new Fl_Browser(15, 55-5, 195, 159); lst_Font->labelsize(12); lst_Font->textsize(12); lst_Font->callback((Fl_Callback*)cb_FontName_Selected, (void*)(lst_Font->parent())); lst_Font->type(FL_HOLD_BROWSER); txt_InputFont = new Fl_Input(15, 31-5, 195, 24, "Font:"); txt_InputFont->labelsize(12); txt_InputFont->textsize(12); txt_InputFont->align(FL_ALIGN_TOP_LEFT); txt_InputFont->when(FL_WHEN_ENTER_KEY); txt_InputFont->callback((Fl_Callback*)cb_txtInputFontName, (void*)(txt_InputFont->parent())); lst_Style = new Fl_Browser(215, 56-5, 155-60, 159); lst_Style->labelsize(12); lst_Style->type(FL_HOLD_BROWSER); lst_Style->textsize(12); lst_Style->callback((Fl_Callback*)cb_StyleSelected, (void*)(lst_Style->parent())); txt_InputStyle = new Fl_Input(215, 32-5, 155-60, 24, "Syle:"); txt_InputStyle->labelsize(12); txt_InputStyle->align(FL_ALIGN_TOP_LEFT); txt_InputStyle->textsize(12); txt_InputStyle->callback((Fl_Callback*)cb_txtInputFontStyle, (void*)(txt_InputStyle->parent())); lst_Size = new Fl_Browser(375-60, 56-5, 75, 159); lst_Size->labelsize(12); lst_Size->type(FL_HOLD_BROWSER); lst_Size->textsize(12); lst_Size->callback((Fl_Callback*)cb_FontSize_Selected, (void*)(lst_Size->parent())); txt_InputSize = new Fl_Input(375-60, 32-5, 75, 24, "Size:"); txt_InputSize->labelsize(12); txt_InputSize->align(FL_ALIGN_TOP_LEFT); txt_InputSize->textsize(12); txt_InputSize->callback((Fl_Callback*)cb_txtInputFontSize, (void*)(txt_InputSize->parent())); btn_OK =new Fl_Button(475-60, 35-5, 64, 20, "&OK"); btn_OK->shortcut(0x8006f); btn_OK->labelfont(1); btn_OK->labelsize(12); btn_OK->callback((Fl_Callback*)cb_okBtn_Red ); btn_Cancel =new Fl_Button(475-60, 60-5, 64, 20, "Cancel"); btn_Cancel->labelsize(12); btn_Cancel->callback((Fl_Callback*)cb_Cancel, (void *)(btn_Cancel->parent())); Fl_Box* o = new Fl_Box(15, 220-5, 20, 10, "Properties"); o->box(FL_BORDER_FRAME); o->labelsize(12); o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE); btn_Check1= new Fl_Check_Button(40-20, 250-5-5, 100, 15, "Strikethrough"); btn_Check1->down_box(FL_DOWN_BOX); btn_Check1->labelsize(12); btn_Check1->callback((Fl_Callback*)cb_Strikethrough, (void *)(btn_Check1->parent())); btn_Check2 = new Fl_Check_Button(40-20, 270-5-5, 100, 15, "Underline"); btn_Check2->down_box(FL_DOWN_BOX); btn_Check2->labelsize(12); btn_Check2->callback((Fl_Callback*)cb_UnderLine, (void *)(btn_Check2->parent())); btn_Color = new Fl_Button(40-20, 307-10-5, 90, 23, "Color:"); btn_Color->down_box(FL_BORDER_BOX); btn_Color->labelsize(12); btn_Color->align(FL_ALIGN_TOP_LEFT); btn_Color->color(FL_BLACK); btn_Color->callback((Fl_Callback*)cb_Color_Select, (void *)(lst_Size->parent())); { Fl_Group* o = new Fl_Group(130, 220-5, 256+180, 82, "Example"); o->box(FL_BORDER_FRAME); o->labelsize(12); o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE); { box_Example = new Fl_Font_Preview_Box(132-10, 241-5, 227+50+35+10, 48, "AaBbCcDdEeFfGgHhIi"); box_Example->box(FL_DOWN_BOX); box_Example->labelsize(12); box_Example->align(FL_ALIGN_WRAP|FL_ALIGN_CLIP|FL_ALIGN_CENTER|FL_ALIGN_INSIDE); } o->end(); } set_modal(); end(); // Initializations pickedsize = 14; // Font Size to be used // int k = Fl::set_fonts(0); // Nr of fonts available on the server for(int i= 0; i < k; i++) { int t; const char *name = Fl::get_font_name((Fl_Font)i,&t); char buffer[128]; // Load the font list .. Ignore the bold and italic types of the font if(!((t & FL_BOLD) ||(t & FL_ITALIC))) { sprintf(buffer, "%s",name); lst_Font->add(buffer); } } /* FL_Browser uses the symbol "@" as a formating char. There are some fonts that there names starts with char "@". We need to disable this */ lst_Font->format_char(0); // Sort the font Alphabetically ForwardSort(lst_Font); lst_Font->value(1); // Select the first font in the list lst_Style->value(1); lst_Font->do_callback(); // Do font selected callback .. to draw the preview lst_Style->do_callback(); this->callback_ = 0; // Initialize Widgets callback this->data_ = 0; // And the data }
Fl_Double_Window* make_window() { Fl_Double_Window* w; { Fl_Double_Window* o = new Fl_Double_Window(400, 605); w = o; { undobutton = new Fl_Button(6, 25, 40, 25, "Undo"); undobutton->down_box(FL_DOWN_BOX); undobutton->callback((Fl_Callback*)undo_cb); } // Fl_Button* undobutton { forceslider = new Fl_Slider(206, 25, 75, 25, "Force"); forceslider->type(5); forceslider->selection_color((Fl_Color)1); forceslider->minimum(0.05); forceslider->value(0.5); forceslider->callback((Fl_Callback*)lerp_cb); forceslider->align(Fl_Align(FL_ALIGN_RIGHT)); } // Fl_Slider* forceslider { rgbmode = new Fl_Button(331, 25, 35, 25, "HSB"); rgbmode->labelsize(12); rgbmode->callback((Fl_Callback*)rgbmode_cb); rgbmode->align(Fl_Align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE)); } // Fl_Button* rgbmode { fnamebox = new Fl_Input(31, 60, 355, 25, "File:"); fnamebox->labeltype(FL_ENGRAVED_LABEL); fnamebox->labelsize(12); fnamebox->callback((Fl_Callback*)input_cb); fnamebox->when(FL_WHEN_ENTER_KEY_ALWAYS); } // Fl_Input* fnamebox { cshow.hsblbls[0] = new Fl_Box(30, 219, 80, 20, "Hue (L)"); cshow.hsblbls[0]->box(FL_FLAT_BOX); cshow.hsblbls[0]->color((Fl_Color)34); cshow.hsblbls[0]->labelfont(1); cshow.hsblbls[0]->labelsize(12); cshow.hsblbls[0]->labelcolor((Fl_Color)3); } // Fl_Box* cshow.hsblbls[0] { cshow.hsblbls[1] = new Fl_Box(115, 219, 75, 20, "Sat(M)"); cshow.hsblbls[1]->box(FL_FLAT_BOX); cshow.hsblbls[1]->color((Fl_Color)34); cshow.hsblbls[1]->labelfont(1); cshow.hsblbls[1]->labelsize(12); cshow.hsblbls[1]->labelcolor((Fl_Color)2); } // Fl_Box* cshow.hsblbls[1] { cshow.hsblbls[2] = new Fl_Box(195, 219, 75, 20, "Bright(R)"); cshow.hsblbls[2]->box(FL_FLAT_BOX); cshow.hsblbls[2]->color((Fl_Color)34); cshow.hsblbls[2]->labelfont(1); cshow.hsblbls[2]->labelsize(12); cshow.hsblbls[2]->labelcolor((Fl_Color)235); } // Fl_Box* cshow.hsblbls[2] { Fl_Box* o = new Fl_Box(275, 219, 80, 20, "Alpha(shift)"); o->box(FL_FLAT_BOX); o->color((Fl_Color)34); o->labelfont(1); o->labelsize(12); o->labelcolor(FL_BACKGROUND2_COLOR); } // Fl_Box* o { cmedit = new class CMedit(5, 239, 380, 270); cmedit->box(FL_FLAT_BOX); cmedit->color(FL_BACKGROUND_COLOR); cmedit->selection_color(FL_BACKGROUND_COLOR); cmedit->labeltype(FL_NORMAL_LABEL); cmedit->labelfont(0); cmedit->labelsize(14); cmedit->labelcolor(FL_FOREGROUND_COLOR); cmedit->align(Fl_Align(FL_ALIGN_CENTER)); cmedit->when(FL_WHEN_RELEASE); Fl_Group::current()->resizable(cmedit); } // class CMedit* cmedit { cshow.color = new colorpatch(62, 515, 50, 40); cshow.color->box(FL_DOWN_BOX); cshow.color->color(FL_BACKGROUND_COLOR); cshow.color->selection_color(FL_BACKGROUND_COLOR); cshow.color->labeltype(FL_NO_LABEL); cshow.color->labelfont(0); cshow.color->labelsize(14); cshow.color->labelcolor(FL_FOREGROUND_COLOR); cshow.color->align(Fl_Align(FL_ALIGN_CENTER)); cshow.color->when(FL_WHEN_RELEASE); } // colorpatch* cshow.color { cshow.cindex = new Fl_Value_Input(7, 530, 50, 25, " (index"); cshow.cindex->box(FL_FLAT_BOX); cshow.cindex->color((Fl_Color)16); cshow.cindex->maximum(0); cshow.cindex->step(1); cshow.cindex->textsize(12); cshow.cindex->callback((Fl_Callback*)report_cb); cshow.cindex->align(Fl_Align(FL_ALIGN_TOP)); } // Fl_Value_Input* cshow.cindex { cshow.hsba = new Fl_Output(117, 530, 120, 25, "HSBA"); cshow.hsba->box(FL_FLAT_BOX); cshow.hsba->color((Fl_Color)16); cshow.hsba->textsize(11); cshow.hsba->align(Fl_Align(FL_ALIGN_TOP)); } // Fl_Output* cshow.hsba { cshow.rgba = new Fl_Output(247, 530, 125, 25, "rgb"); cshow.rgba->box(FL_FLAT_BOX); cshow.rgba->color((Fl_Color)16); cshow.rgba->textsize(11); cshow.rgba->align(Fl_Align(FL_ALIGN_TOP)); } // Fl_Output* cshow.rgba { cshow.postscalein = new Fl_Value_Input(317, 570, 65, 25, "* Amax"); cshow.postscalein->callback((Fl_Callback*)ascale_cb); cshow.postscalein->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* cshow.postscalein { cshow.postexponin = new Fl_Value_Input(237, 570, 75, 25, "** expon )"); cshow.postexponin->callback((Fl_Callback*)ascale_cb); cshow.postexponin->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Value_Input* cshow.postexponin { cshow.cmentin = new Fl_Value_Input(7, 570, 55, 25, "cmapsize"); cshow.cmentin->box(FL_ENGRAVED_BOX); cshow.cmentin->color((Fl_Color)25); cshow.cmentin->callback((Fl_Callback*)ncment_cb); cshow.cmentin->align(Fl_Align(FL_ALIGN_TOP_LEFT)); cshow.cmentin->when(FL_WHEN_RELEASE); } // Fl_Value_Input* cshow.cmentin { cshow.scaleout = new Fl_Output(137, 570, 95, 25, " Aout = ( Ain"); cshow.scaleout->box(FL_FLAT_BOX); cshow.scaleout->color((Fl_Color)16); cshow.scaleout->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Output* cshow.scaleout { Fl_Menu_Bar* o = new Fl_Menu_Bar(0, 0, 400, 20); o->color((Fl_Color)46); o->menu(menu_); } // Fl_Menu_Bar* o o->end(); } // Fl_Double_Window* o return w; }