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(); }
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_Window* make_about_panel(const char *copyright) { Fl_Window* w; {Fl_Window* o = about_panel = new Fl_Window(330, 276, _("About eFluid")); w = o; o->type(240); o->selection_color((Fl_Color)47); o->shortcut(0xff1b); {Fl_Group* o = display_group = new Fl_Group(0, 0, 330, 240); {Fl_Group* o = new Fl_Group(5, 5, 320, 55, _("eFluid")); o->box(FL_ENGRAVED_BOX); o->label_font(fl_fonts+1); o->label_type(FL_EMBOSSED_LABEL); o->color((Fl_Color)0xb3b3be00); o->label_color((Fl_Color)32); o->selection_color((Fl_Color)47); o->label_size(40); o->align(FL_ALIGN_INSIDE); o->end(); } {Fl_Button* o = new Fl_Button(5, 165, 320, 70, _("\302\251""2002-2003\nClick here for more information")); o->box(FL_ENGRAVED_BOX); o->label_font(fl_fonts+1); o->color((Fl_Color)0xb3b3be00); o->label_color((Fl_Color)32); o->highlight_color((Fl_Color)0x9d9da700); o->highlight_label_color((Fl_Color)55); o->label_size(14); o->callback((Fl_Callback*)cb_2002); o->align(FL_ALIGN_WRAP); } {Fl_Box* o = new Fl_Box(5, 60, 320, 105, _("EFLTK User Interface Designer\nVersion 2.0.3")); o->box(FL_ENGRAVED_BOX); o->label_font(fl_fonts+1); o->label_type(FL_EMBOSSED_LABEL); o->color((Fl_Color)0xb3b3be00); o->label_color((Fl_Color)32); o->selection_color((Fl_Color)47); o->label_size(18); } o->end(); } {Fl_Box* o = copyright_box = new Fl_Box(0, 0, 330, 240); o->label_size(10); o->align(FL_ALIGN_TOP|FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP|FL_ALIGN_WRAP); o->hide(); o->label(copyright); } {Fl_Return_Button* o = new Fl_Return_Button(5, 245, 320, 25, _("OK")); o->label_size(10); o->shortcut(0xff0d); o->callback((Fl_Callback*)cb_OK); } o->end(); } return w; }
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 Splash::run(void) { E_ASSERT(slist != NULL); if(!show_splash) { while(next_client_nosplash()) ; return; } fl_register_images(); String path, splash_theme_path; #ifdef USE_LOCAL_CONFIG splash_theme_path = "splash-themes/"; #else splash_theme_path = Resource::find_data("themes/splash-themes", RES_SYS_ONLY); if(splash_theme_path.empty()) { E_WARNING(E_STRLOC ": Unable to locate splash themes in $XDG_DATA_DIRS directories\n"); return; } #endif splash_theme_path += E_DIR_SEPARATOR; splash_theme_path += *splash_theme; if(!file_test(splash_theme_path.c_str(), FILE_TEST_IS_DIR)) { E_WARNING(E_STRLOC ": Unable to locate '%s' in '%s' theme directory\n", splash_theme->c_str(), splash_theme_path.c_str()); return; } /* setup widgets */ begin(); Fl_Box* bimg = new Fl_Box(0, 0, w(), h()); Fl_Image* splash_img = 0; path = build_filename(splash_theme_path.c_str(), "background.png"); splash_img = Fl_Shared_Image::get(path.c_str()); if(splash_img) { int W = splash_img->w(); int H = splash_img->h(); /* update window and Box sizes */ size(W, H); bimg->size(W, H); bimg->image(splash_img); } /* * place message box at the bottom with * nice offset (10 px) from window borders */ msgbox = new Fl_Box(10, h() - 25 - 10, w() - 20, 25); /* * Setup icons positions, based on position of msgbox assuming someone * will not abuse splash to start hundrets of programs, since icons will * be placed only in horizontal order, one line, so in case their large * number, some of them will go out of window borders. * * Icon box will be 64x64 so larger icons can fit too. * * This code will use Fl_Group (moving group, later, will move all icons * saving me from code mess), but will not update it's w() for two reasons: * icons does not use it, and will be drawn correctly, and second, setting * width will initiate fltk layout engine which will mess everything up. */ Fl_Group* icon_group = new Fl_Group(10, msgbox->y() - 10 - 64, 0, 64); int X = icon_group->x(); int Y = icon_group->y(); /* offset between icons */ int ioffset = 5; /* FIXME: use malloc/something instead this */ icons = new Fl_Box*[slist->size()]; icon_group->begin(); int i = 0; const char* imgpath; Fl_Image* iconimg = 0; for(StartupItemListIter it = slist->begin(); it != slist->end(); ++it, ++i) { Fl_Box* bb = new Fl_Box(X, Y, 64, 64); path = build_filename(splash_theme_path.c_str(), (*it)->icon.c_str()); imgpath = path.c_str(); iconimg = Fl_Shared_Image::get(imgpath); if(!iconimg) { bb->label(_("No image")); bb->align(FL_ALIGN_INSIDE | FL_ALIGN_WRAP); } else bb->image(iconimg); bb->hide(); X += bb->w() + ioffset; icons[i] = bb; } icon_group->end(); /* see X as width of all icons */ int gx = w()/2 - X/2; /* gx can be negative */ gx = (gx > 10) ? gx : 10; icon_group->position(gx, Y); end(); clear_border(); /* * If set_override() is used, message boxes will be * popped behind splash. Using it or not ??? */ set_override(); // make sure window is centered int sw = DisplayWidth(fl_display, fl_screen); int sh = DisplayHeight(fl_display, fl_screen); position(sw/2 - w()/2, sh/2 - h()/2); show(); Fl::add_timeout(TIMEOUT_START, runner_cb, this); // to keep splash at the top #ifndef EDEWM_HAVE_NET_SPLASH global_splash = this; XSelectInput(fl_display, RootWindow(fl_display, fl_screen), SubstructureNotifyMask); Fl::add_handler(splash_xmessage_handler); #endif while(shown()) Fl::wait(); #ifndef EDEWM_HAVE_NET_SPLASH Fl::remove_handler(splash_xmessage_handler); #endif }
JACK_Module::JACK_Module ( bool log ) : Module ( 25, 25, name() ) { _prefix = 0; _connection_handle_outputs[0][0] = 0; _connection_handle_outputs[0][1] = 0; _connection_handle_outputs[1][0] = 0; _connection_handle_outputs[1][1] = 0; align( FL_ALIGN_TOP | FL_ALIGN_INSIDE ); if ( log ) { /* FIXME: how do Controls find out that a connected value has changed? How does this work in ladspa? */ { Port p( this, Port::INPUT, Port::CONTROL, "Inputs" ); p.hints.type = Port::Hints::INTEGER; p.hints.minimum = 0; p.hints.maximum = 16; p.hints.ranged = true; p.hints.visible = false; p.connect_to( new float ); p.control_value_no_callback( 0 ); add_port( p ); } { Port p( this, Port::INPUT, Port::CONTROL, "Outputs" ); p.hints.type = Port::Hints::INTEGER; p.hints.minimum = 0; p.hints.maximum = 16; p.hints.ranged = true; p.hints.visible = false; p.connect_to( new float ); p.control_value_no_callback( 0 ); add_port( p ); } color( FL_DARK1 ); log_create(); } { Fl_Scalepack *o = new Fl_Scalepack( x() + Fl::box_dx(box()), y() + Fl::box_dy(box()), w() - Fl::box_dw(box()), h() - Fl::box_dh(box()) ); o->type( Fl_Pack::VERTICAL ); o->spacing(0); { Fl_Scalepack *o = new Fl_Scalepack( x() + Fl::box_dx(box()), y() + Fl::box_dy(box()), w(), 24 - Fl::box_dh(box()) ); o->type( Fl_Pack::HORIZONTAL ); o->spacing( 0 ); { Fl_Box *o = input_connection_handle = new Fl_Box( x(), y(), 18, 18 ); o->tooltip( "Drag and drop to make and break JACK connections."); o->hide(); o->image( input_connector_image ? input_connector_image : input_connector_image = new Fl_PNG_Image( "input_connector", img_io_input_connector_10x10_png, img_io_input_connector_10x10_png_len ) ); } { Fl_Box *o = new Fl_Box( x() + 10, y(), w() - 20, h() ); Fl_Group::current()->resizable(o); } { Fl_Button *o = dec_button = new Fl_Button( 0, 0, 12, h(), "-" ); o->callback( cb_button, this ); o->labelsize(10); o->labelfont( FL_HELVETICA_BOLD ); o->hide(); } { Fl_Button *o = inc_button = new Fl_Button( 0,0, 12, h(), "+" ); o->labelsize(10); o->labelfont( FL_HELVETICA_BOLD ); o->callback( cb_button, this ); o->hide(); } { Fl_Box *o = output_connection_handle = new Fl_Box( x(), y(), 12, 12 ); o->tooltip( "Drag and drop to make and break JACK connections."); o->image( output_connector_image ? output_connector_image : output_connector_image = new Fl_PNG_Image( "output_connector", img_io_output_connector_10x10_png, img_io_output_connector_10x10_png_len ) ); o->hide(); } { Fl_Box *o = output_connection2_handle = new Fl_Box( x(), y(), 12, 12 ); o->tooltip( "Drag and drop to make and break JACK connections."); o->image( output_connector_image ? output_connector_image : output_connector_image = new Fl_PNG_Image( "output_connector", img_io_output_connector_10x10_png, img_io_output_connector_10x10_png_len ) ); o->hide(); } o->end(); } { Fl_Browser *o = connection_display = new Fl_Browser( 0, 0, w(), h() ); o->has_scrollbar(Fl_Browser_::VERTICAL); o->textsize( 10 ); o->textcolor( FL_LIGHT3 ); o->textfont( FL_COURIER ); o->box( FL_FLAT_BOX ); o->color( FL_DARK1 ); // o->color( fl_color_add_alpha( fl_rgb_color( 10, 10, 10 ), 100 )); Fl_Group::current()->resizable(o); } o->end(); resizable(o); } end(); }