void Desktop::update_bg() { Fl_Renderer::system_init(); if (wpaper) { delete wpaper; wpaper=0; } Fl_Config globalConfig(fl_find_config_file("ede.conf", 0), true, false); globalConfig.set_section("Desktop"); globalConfig.read("Color", bg_color, (Fl_Color)fl_darker(FL_BLUE)); globalConfig.read("Opacity", bg_opacity, 255); globalConfig.read("Mode", bg_mode, 0); globalConfig.read("Use", bg_use, 1); Fl_Image *im=0; if(!globalConfig.read("Wallpaper", bg_filename, 0)) { if(bg_use) { im = Fl_Image::read(bg_filename, 0); if (im) im->system_convert(); } } else { bg_filename.clear(); } if(im) { wpaper = make_image(bg_color, im, Fl::w(), Fl::h(), bg_mode, bg_opacity); delete im; } redraw(); }
void Spatializer_Module::draw ( void ) { int W = 5; child(0)->size( w() - W, h() ); Module::draw_box(x(),y(),w() - W,h()); Module::draw_label(x() + 4,y(),w() - W,h()); Module *m = this; fl_color( fl_darker( FL_FOREGROUND_COLOR ) ); int spacing, offset; int ni = aux_audio_output.size(); spacing = h() / ni; offset = spacing / 2; for ( int i = ni; i--; ) { int xi = offset + ( spacing * i ); fl_rectf( m->x() + m->w() - W, m->y() + xi, W, 2 ); } }
static void draw_speaker ( Fl_Color col ) { fl_color(col); BP; vv(0.2,0.4); vv(0.6,0.4); vv(0.6,-0.4); vv(0.2,-0.4); EP; BP; vv(-0.6,0.8); vv(0.2,0.0); vv(-0.6,-0.8); EP; fl_color( fl_darker( col ) ); BC; vv(0.2,0.4); vv(0.6,0.4); vv(0.6,-0.4); vv(0.2,-0.4); EC; BC; vv(-0.6,0.8); vv(0.2,0.0); vv(-0.6,-0.8); EC; }
EDE_Calendar::EDE_Calendar(int x,int y,int w,int h,const char *lbl) : Fl_Group(x,y,w,h,lbl) { unsigned int i; // Calendar contents, correct size and position is set by layout() // Header box m_monthNameBox = new Fl_Box(x,y,w,16); m_monthNameBox->box(FL_NO_BOX); // Weekday headers for (i = 0; i < 7; i++) { m_dayNameBoxes[i] = new Fl_Box(x+i*16,y+16,16,16); m_dayNameBoxes[i]->box(FL_FLAT_BOX); m_dayNameBoxes[i]->color(fl_color_average(color(), FL_GREEN, 0.8)); // get first two letters of day name edelib::Date d; d.set(1900,1,7+i); // 1.1.1900 was Monday char tmp[3]; snprintf(tmp,3,"%s", d.day_name()); m_dayNameBoxes[i]->copy_label(tmp); } // Fillers (parts of calendar without day buttons) for (int i=0; i<3; i++) { m_filler[i] = new Fl_Box(x,y,16,16); m_filler[i]->box(FL_FLAT_BOX); m_filler[i]->color(fl_color_average(color(), FL_BLACK, 0.95)); // very mild grayish } // Day buttons for (i = 0; i < 31; i++) { m_dayButtons[i] = new Fl_Box(0,0,16,16); char tmp[3]; snprintf(tmp,3, "%d", (i+1)); m_dayButtons[i]->copy_label(tmp); } // Switch buttons for (i = 0; i < 4; i++) { Fl_Repeat_Button* o; m_switchButtons[i] = o = new Fl_Repeat_Button(x,y,16,16,switchLabels[i]); o->callback(EDE_Calendar::cbSwitchButtonClicked, (long)monthChanges[i]); o->labelcolor(fl_darker(FL_BACKGROUND_COLOR)); o->selection_color(fl_lighter(FL_BACKGROUND_COLOR)); } end(); reset(); // this will eventually call layout() }
void presetFLTKenv() { Fl::set_font( FL_FREE_FONT, reffntshape ); Fl_Double_Window::default_xclass( DEF_APP_CLSNAME ); fl_message_font_ = FL_FREE_FONT; fl_message_size_ = 11; Fl_Tooltip::color( fl_darker( FL_DARK3 ) ); Fl_Tooltip::textcolor( FL_WHITE ); Fl_Tooltip::size( 11 ); Fl_Tooltip::font( FL_FREE_FONT ); Fl::scheme( "flat" ); }
void AUX_Module::draw ( void ) { int W = 5; child(0)->size( w() - W, h() ); Module::draw_box(x(),y(),w() - W,h()); Module::draw_label(x(),y(),w() - W,h()); Module *m = this; fl_color( fl_darker( FL_FOREGROUND_COLOR ) ); int spacing, offset; spacing = h() / m->ninputs(); offset = spacing / 2; for ( int i = m->ninputs(); i--; ) { int xi = offset + ( spacing * i ); fl_rectf( m->x() + m->w() - W, m->y() + xi, W, 2 ); } }
void Chain::draw_connections ( Module *m ) { int spacing; int offset; int X, Y, W, H; ((Fl_Packscroller*)chain_tab->child( 0 ))->bbox( X, Y, W, H ); fl_push_clip( X, Y, W, H ); Fl_Color c = FL_FOREGROUND_COLOR; fl_color( c ); if ( m->ninputs() ) { spacing = w() / m->ninputs(); offset = spacing / 2; for ( int i = m->ninputs(); i--; ) fl_rectf( m->x() + offset + ( spacing * i ), m->y() - 3, 2, 3 ); } fl_color( fl_darker( c ) ); if ( m->noutputs() ) { spacing = w() / m->noutputs(); offset = spacing / 2; for ( int i = m->noutputs(); i--; ) fl_rectf( m->x() + offset + ( spacing * i ), m->y() + m->h(), 2, 3 ); } fl_pop_clip(); }
void Chain::draw_connections ( Module *m ) { int spacing; int offset; int X, Y, W, H; ((Fl_Packscroller*)chain_tab->child( 0 ))->bbox( X, Y, W, H ); fl_push_clip( X, Y, W, H ); Fl_Color c =fl_color_average( FL_WHITE, FL_YELLOW, 0.50 ); fl_color( c ); if ( m->ninputs() ) { spacing = w() / m->ninputs(); offset = spacing / 2; for ( int i = m->ninputs(); i--; ) fl_rectf( m->x() + offset + ( spacing * i ), m->y() - 5, 2, 5 ); } fl_color( fl_darker( c ) ); if ( m->noutputs() ) { spacing = w() / m->noutputs(); offset = spacing / 2; for ( int i = m->noutputs(); i--; ) fl_rectf( m->x() + offset + ( spacing * i ), m->y() + m->h(), 2, 5 ); } fl_pop_clip(); }
void gui_draw_shape ( int x, int y, int w, int h, int shape, int state, int flags, int color ) { /* take advantage of FLTK's clipping */ if ( ! fl_not_clipped( x, y, w, h ) ) return; if ( flags & F_PLAYHEAD ) { state = state == FULL ? HIT : PLAYHEAD; flags &= ~ F_SELECTION; } Fl_Color c1, c2; if ( state == FULL && color ) { c1 = velocity_colors[ color ]; c2 = velocity2_colors[ color ]; } else { c1 = state_colors[ state ]; c2 = fl_color_average( FL_WHITE, c1, 0.1 ); } if ( flags & F_SELECTION ) fl_color( fl_darker( fl_color() ) ); int bw = 1; switch ( shape ) { case SQUARE: // fl_rectf( x, y, w, h, FL_BLACK ); fl_color( c1 ); fl_rectf( x + bw, y + bw, w - bw * 2, h - bw * 2 ); if ( draw_borders ) { fl_color( c2 ); fl_line_style( FL_SOLID, 2 ); fl_rect( x + bw + 1, y + bw + 1, w - (bw+1) * 2, h - (bw+1) * 2 ); fl_line_style( FL_SOLID, 0 ); } break; case BOX: fl_draw_box( FL_THIN_UP_BOX, x + bw, y + bw, w - bw * 2, h - bw * 2, c1 ); break; default: ASSERTION( "unknown shape" ); break; } if ( flags & F_P1 || flags & F_P2 ) { if ( flags & F_P1 ) fl_color( FL_GREEN ); else fl_color( FL_RED ); int rw = w / 4; int rh = h / 4; fl_rectf( x + (w / 2) - (rw / 2), y + (h / 2) - (rh / 2), rw, rh ); } }
void Fl_Led_Window::deactivate_led(int n) { Leds[n]->color(fl_darker(fl_darker(color_index))); Leds[n]->selection_color(fl_darker(fl_darker(color_index))); }
FL_EXPORT_C(Fl_Color, fl_darkerC)(Fl_Color c){return fl_darker(c);}
void Controller_Module::connect_to ( Port *p ) { control_output[0].connect_to( p ); clear(); Fl_Widget *w; if ( p->hints.type == Module::Port::Hints::BOOLEAN ) { Fl_Light_Button *o = new Fl_Light_Button( 0, 0, 40, 40, p->name() ); w = o; o->value( p->control_value() ); _type = TOGGLE; /* FIXME: hack */ control = (Fl_Valuator*)o; } else if ( p->hints.type == Module::Port::Hints::INTEGER ) { Fl_Counter *o = new Fl_Counter(0, 0, 58, 24, p->name() ); control = o; w = o; o->type(1); o->step(1); if ( p->hints.ranged ) { o->minimum( p->hints.minimum ); o->maximum( p->hints.maximum ); } _type = SPINNER; o->value( p->control_value() ); } else if ( p->hints.type == Module::Port::Hints::LOGARITHMIC ) { Fl_Value_SliderX *o = new Fl_Value_SliderX(0, 0, 30, 250, p->name() ); control = o; w = o; o->type(4); o->color( FL_DARK1 ); o->selection_color( fl_color_average( FL_GRAY, FL_CYAN, 0.5 ) ); o->minimum(1.5); o->maximum(0); o->value(1); o->textsize(9); if ( p->hints.ranged ) { o->minimum( p->hints.maximum ); o->maximum( p->hints.minimum ); } o->value( p->control_value() ); _type = SLIDER; } else { { Fl_DialX *o = new Fl_DialX( 0, 0, 50, 50, p->name() ); w = o; control = o; if ( p->hints.ranged ) { DMESSAGE( "Min: %f, max: %f", p->hints.minimum, p->hints.maximum ); o->minimum( p->hints.minimum ); o->maximum( p->hints.maximum ); } o->color( fl_darker( FL_GRAY ) ); o->selection_color( FL_WHITE ); o->value( p->control_value() ); } _type = KNOB; } control_value = p->control_value(); w->set_visible_focus(); w->align(FL_ALIGN_TOP); w->labelsize( 10 ); w->callback( cb_handle, this ); if ( _pad ) { Fl_Labelpad_Group *flg = new Fl_Labelpad_Group( w ); flg->set_visible_focus(); size( flg->w(), flg->h() ); flg->position( x(), y() ); add( flg ); } else { /* HACK: hide label */ w->labeltype( FL_NO_LABEL ); w->resize( x(), y(), this->w(), h() ); add( w ); resizable( w ); // init_sizes(); } }
extern "C" bool fltk_theme() { Fl_Boxtype vertup = new Fl_Shaded_Box(FL_THIN_UP_BOX, true); Fl_Boxtype vertdown = new Fl_Shaded_Box(FL_THIN_DOWN_BOX, true); Fl_Boxtype vertfr = new Fl_Shaded_Box(FL_BORDER_BOX, true); Fl_Boxtype vertflat = new Fl_Shaded_Box(FL_FLAT_BOX, true); Fl_Boxtype verthl = new Fl_Shaded_Box(FL_HIGHLIGHT_BOX, true); Fl_Boxtype horup = new Fl_Shaded_Box(FL_THIN_UP_BOX, false); Fl_Boxtype hordown = new Fl_Shaded_Box(FL_THIN_DOWN_BOX, false); //Fl_Boxtype horfr = new Fl_Shaded_Box(FL_BORDER_BOX, false); Fl_Boxtype horflat = new Fl_Shaded_Box(FL_FLAT_BOX, false); Fl_Color bc = fl_rgb(180,210,230); Fl_Style::scrollbar_width = 15; Fl_Widget::default_style->box = vertdown; //Fl_Widget::default_style->button_box = vertup; Fl_Widget::default_style->color = bc; //Fl_Widget::default_style->highlight_color = FL_LIGHT2; Fl_Style* s; if ((s = Fl_Style::find("window"))) { s->box = FL_FLAT_BOX;//vertflat; s->color = fl_rgb(180,200,215); } if ((s = Fl_Style::find("group"))) { s->box = FL_NO_BOX; s->color = bc; s->button_color = bc; } if ((s = Fl_Style::find("menu"))) { s->selection_text_color = fl_darker(FL_BLUE); s->selection_color = bc; s->box = vertfr; s->color = fl_lighter(FL_BLUE); s->button_box = vertfr; } if ((s = Fl_Style::find("menu bar"))) { s->color = bc; s->highlight_label_color = fl_darker(FL_BLUE); s->selection_text_color = fl_darker(FL_BLUE); s->highlight_color = FL_GRAY; s->box = vertflat; s->button_box = FL_NO_BOX; } if ((s = Fl_Style::find("choice"))) { s->box = FL_THIN_DOWN_BOX; s->button_color = bc; } if ((s = Fl_Style::find("button"))) { s->selection_color = fl_darker(bc); s->color = bc; s->box = vertup; } if ((s = Fl_Style::find("scrollbar"))) { s->color = bc; s->button_color = bc; s->button_box = vertup; } if ((s = Fl_Style::find("menu button"))) { s->color = bc; s->box = vertup; } if((s = Fl_Style::find("browser"))) { s->box = FL_THIN_DOWN_BOX; s->color = fl_rgb(235,245,255); } if((s = Fl_Style::find("input browser"))) { s->box = FL_THIN_DOWN_BOX; s->button_color = bc; s->color = fl_rgb(235,245,255); } if((s = Fl_Style::find("input"))) { s->box = hordown; } if ((s = Fl_Style::find("listview header"))) { s->button_box = vertup; s->button_color = bc; } if ((s = Fl_Style::find("listview"))) { s->button_color = fl_lighter(bc); } if ((s = Fl_Style::find("slider"))) { s->box = hordown; s->button_box = horup; s->color = bc; s->button_color = fl_darker(bc); s->focus_box = FL_NO_BOX; } if ((s = Fl_Style::find("value slider"))) { s->box = hordown; s->button_box = horup; s->color = bc; s->button_color = fl_darker(bc); s->focus_box = FL_NO_BOX; } if ((s = Fl_Style::find("highlight button"))) { s->box = verthl; s->color = bc; s->highlight_color = fl_lighter(bc); } if ((s = Fl_Style::find("tool bar"))) { //s->highlight_color = FL_GRAY; s->box = vertup; } if ((s = Fl_Style::find("tabs"))) { s->box = FL_THIN_UP_BOX; s->color = fl_rgb(180,200,215); s->button_color = fl_rgb(180,200,215); } if ((s = Fl_Style::find("pack"))) { s->box = horflat; } if ((s = Fl_Style::find("workspace"))) { s->box = FL_THIN_DOWN_BOX;; } if ((s = Fl_Style::find("mdi viewport"))) { s->box = FL_FLAT_BOX;//vertflat; s->color = fl_rgb(180,200,215); } if ((s = Fl_Style::find("panel"))) { s->box = horup; s->color = bc; } if ((s = Fl_Style::find("light button"))) { s->selection_color = fl_lighter(FL_BLUE); } if ((s = Fl_Style::find("calendar"))) { s->box = FL_NO_BOX; s->button_box = vertup; s->button_color = fl_rgb(60,120,200); } return true; }
Fl_Led_Window::Fl_Led_Window(int x, int y, int width, int height, Fl_MDI_Viewport *s, const char *name, int n_leds) { int N_Columns = 7; int N_Rows; int W, H; int xpos, ypos; num_leds = n_leds; color_index = FL_GREEN; Led_Mask = 0; if (num_leds <= N_Columns) { W = 10 + num_leds*(LED_WIDTH + 10) + 10; H = 5 + 10 + LED_HEIGHT + 20 + 5; } else { num_leds % N_Columns ? N_Rows = (int)(num_leds / N_Columns) + 1 : N_Rows = (int)(num_leds / N_Columns); W = 10 + N_Columns*(LED_WIDTH + 10) + 10; H = 5 + 10 + N_Rows*(LED_HEIGHT + 20) + 5; } Fl::lock(); s->begin(); Fl_MDI_Window *w = LWin = new Fl_MDI_Window(0, 0, W, H, name); w->view()->begin(); Leds = new Fl_Led*[num_leds]; { Fl_Group *g = Led_Group = new Fl_Group(5, 5, W - 10, H - 10); g->box(FL_ENGRAVED_BOX); xpos = 0; ypos = 0; for (int i = 1; i <= num_leds; i++) { char led_label[10]; sprintf(led_label, "%d\n", i); { Fl_Led *o = Leds[i-1] = new Fl_Led(10 + (LED_WIDTH + 10)*xpos, 10 + (LED_HEIGHT + 20)*ypos, LED_WIDTH, LED_HEIGHT, strdup(led_label)); o->number(i-1); o->color(fl_darker(fl_darker(color_index))); o->selection_color(fl_darker(fl_darker(color_index))); xpos++; if (i >= N_Columns) { if ((N_Columns*(ypos + 1) % i) == 0) { xpos = 0; ypos++; } } } } g->end(); } w->view()->end(); s->end(); w->titlebar()->h(15); w->titlebar()->color(FL_BLACK); w->position(x, y); Fl::unlock(); }
void Fl_DialX::draw ( void ) { int X,Y,S; { int ox, oy, ww, hh, side; ox = x(); oy = y(); ww = w(); hh = h(); if (ww > hh) { side = hh; ox = ox + (ww - side) / 2; } else { side = ww; oy = oy + (hh - side) / 2; } side = w() > h() ? hh : ww; X = ox; Y = oy; S = side; } draw_box(); draw_label(); double angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1(); fl_draw_box( box(), X, Y, S, S, color() ); /* shrink a bit */ int OX = x(); int OY = y(); X += S / 8; Y += S / 8; int OS = S; S -= S / 4; fl_line_style( FL_SOLID, S / 12 ); /* background arc */ fl_color( fl_darker( color() ) ); fl_arc( X, Y, S, S, 270 - angle1(), 270 - angle2() ); /* foreground arc */ fl_color( selection_color() ); fl_arc( X, Y, S, S, 270 - angle1(), 270 - angle ); fl_line_style( FL_SOLID, 0 ); if ( active_r() ) { int W = OS; int H = OS; fl_push_matrix(); fl_translate(OX+W/2, OY+H/2); fl_scale(W, H); fl_rotate(310+angle); fl_color( fl_color_add_alpha( FL_WHITE, 127 )); fl_begin_polygon(); fl_circle(-0.26, 0.26, 0.12); fl_end_polygon(); fl_color( FL_WHITE ); fl_begin_polygon(); fl_circle(-0.26, 0.26, 0.06); fl_end_polygon(); fl_pop_matrix(); } fl_color( fl_contrast( labelcolor(), color() ) ); if ( Fl::belowmouse() == this ) { char s[10]; fl_font( FL_HELVETICA, 10 ); snprintf( s, sizeof( s ), "%.1f", value() ); fl_color( FL_FOREGROUND_COLOR ); fl_draw( s, X, Y, S, S, FL_ALIGN_CENTER ); } }
/* called when we are inserted */ void Plotter2DObj::_inserted(pnot cb, RangeManager * rm, void * data, void * data2, int hintWidth) { MTOOLS_ASSERT(isFltkThread()); // the owner should be calling from the fltk thread ! if (((pnot)_ownercb) != nullptr) // we are already inserted, detach before going further { MTOOLS_DEBUG("Plotter2DObj::_inserted, already inserted, we detach before going any further"); MTOOLS_ASSERT(((pnot)_ownercb) != cb); // make sure it is a different owner. detach(); // ok, we detach from the previous owner. } _ownercb = cb; //save the callback _data = data; //save the data _data2 = data2;// and the additional data _rm = rm; //save the range manager Fl_Group::current(0); // prevent adding to option window to some other window. _extOptionWin = nullptr; _di = inserted(_optionWin, hintWidth); // get the drawable object and the option window MTOOLS_ASSERT((Drawable2DInterface*)_di != nullptr); // the drawable object should exist. Fl_Group::current(0); // close the FL_group if needed. /* we create the window */ int ow = (_optionWin == nullptr) ? hintWidth : _optionWin->w(); // extended option window _extOptionWin = new Fl_Group(0, 0, ow,40); // create the extended group _extOptionWin->box(FL_UP_BOX); _titleBox = new Fl_Box(0, 0, ow, 40); _titleBox->color(fl_lighter(FL_BACKGROUND_COLOR)); _titleBox->box(FL_UP_BOX); _nameBox = new Fl_Button(55, 0, ow - 55, 20, _name.c_str()); _nameBox->color(fl_lighter(FL_BACKGROUND_COLOR)); _nameBox->labelcolor(FL_BLACK); _nameBox->box(FL_UP_BOX); _nameBox->labelfont(0); _nameBox->labelsize(16); _nameBox->callback(_nameColorCB_static, this); setNameWidgetColor(); _upButton = new Fl_Button(0, 0, 20, 20, "@#8->"); _upButton->labelcolor(FL_BLACK); _upButton->box(FL_UP_BOX); _upButton->callback(_upButtonCB_static, this); _downButton = new Fl_Button(20, 0, 20, 20, "@#2->"); _downButton->labelcolor(FL_BLACK); _downButton->box(FL_UP_BOX); _downButton->callback(_downButtonCB_static, this); _onOffButton = new Fl_Light_Button(40, 0, 15, 20); _onOffButton->color2(FL_RED); _onOffButton->box(FL_UP_BOX); _onOffButton->value(1); _onOffButton->callback(_onOffButtonCB_static, this); _useRangeX = new Fl_Button(2, 22, 15, 16, "X"); _useRangeX->color(fl_lighter(FL_BACKGROUND_COLOR)); _useRangeX->labelcolor(FL_BLACK); _useRangeX->box(FL_UP_BOX); _useRangeX->labelfont(10); _useRangeX->labelsize(10); _useRangeX->callback(_useRangeXCB_static, this); if (!hasFavouriteRangeX()) { _useRangeX->deactivate(); } _useRangeY = new Fl_Button(2 + 15, 22, 15, 16, "Y"); _useRangeY->color(fl_lighter(FL_BACKGROUND_COLOR)); _useRangeY->labelcolor(FL_BLACK); _useRangeY->box(FL_UP_BOX); _useRangeY->labelfont(10); _useRangeY->labelsize(10); _useRangeY->callback(_useRangeYCB_static, this); if (!hasFavouriteRangeY()) { _useRangeY->deactivate(); } _useRangeXY = new Fl_Button(2 + 30, 22, 23, 16, "X/Y"); _useRangeXY->color(fl_lighter(FL_BACKGROUND_COLOR)); _useRangeXY->labelcolor(FL_BLACK); _useRangeXY->box(FL_UP_BOX); _useRangeXY->labelfont(10); _useRangeXY->labelsize(10); _useRangeXY->callback(_useRangeXYCB_static, this); if (!(hasFavouriteRangeX() && hasFavouriteRangeY())) { _useRangeXY->deactivate(); } _opacitySlider = new Fl_Value_Slider(60, 23, ow - 105 - 80, 14); _opacitySlider->labelfont(0); _opacitySlider->labelsize(11); _opacitySlider->color(fl_lighter(FL_BACKGROUND_COLOR)); _opacitySlider->align(Fl_Align(FL_ALIGN_LEFT)); _opacitySlider->box(FL_FLAT_BOX); _opacitySlider->type(FL_HOR_NICE_SLIDER); _opacitySlider->range(0, 1.0); _opacitySlider->step(0.01); _opacitySlider->value(_opacity); _opacitySlider->color2(FL_RED); _opacitySlider->callback(_opacitySliderCB_static, this); _progBar = nullptr; _nbthl = nullptr; if (((Drawable2DInterface*)_di)->nbThreads()>0) // check if the object uses threads { _nbth = ((Drawable2DInterface*)_di)->nbThreads(); _nbthl = new Fl_Box(ow - 105 - 15, 23, 14, 14); _nbthl->labelsize(10); _nbthl->box(FL_FLAT_BOX); _nbthl->color(fl_darker(FL_GRAY)); _nbthl->copy_label(mtools::toString(_nbth).c_str()); _progBar = new Fl_Progress(ow - 105, 22, 84, 16); _progBar->minimum(0.0); _progBar->maximum(100.0); _progBar->value(100.0); _progBar->color(fl_darker(FL_GRAY)); _progBar->labelcolor(FL_WHITE); _progBar->selection_color(FL_RED); _progBar->labelsize(11); _progVal = -1; _progBar->copy_label("stopped"); // and add the timer Fl::add_timeout(0.1, _timerCB_static, this); } _unrollButton = new Fl_Button(ow - 20, 22, 16, 16, "@-42>>"); _unrollButton->labelcolor(fl_lighter(FL_BLACK)); _unrollButton->box(FL_UP_BOX); _unrollButton->callback(_unrollButtonCB_static, this); if (_optionWin == nullptr) { _unrollButton->deactivate(); } _extOptionWin->end(); _extOptionWin->resizable(0); if (!_drawOn) // deactivate widget if object not enabled { _nameBox->deactivate(); _useRangeX->deactivate(); _useRangeY->deactivate(); _useRangeXY->deactivate(); _opacitySlider->deactivate(); if (_progBar != nullptr) _progBar->deactivate(); if (_optionWin != nullptr) _optionWin->deactivate(); } setParam(rm->getRange(), rm->getWinSize()); // save the parameters for the range of the drawing which will be applied when we enable the object enable(_drawOn); // so maybe right now, or later on... return; }
void Panner::draw ( void ) { draw_box(); // draw_box( FL_FLAT_BOX, x(), y(), w(), h(), FL_BLACK ); draw_label(); if ( _bypassed ) { fl_color( 0 ); fl_font( FL_HELVETICA, 12 ); fl_draw( "(bypass)", x(), y(), w(), h(), FL_ALIGN_CENTER ); return; } int tw, th, tx, ty; bbox( tx, ty, tw, th ); fl_push_clip( tx, ty, tw, th ); fl_color( FL_RED ); const int b = 10; tx += b; ty += b; tw -= b * 2; th -= b * 2; /* draw perimeter */ { Fl_Color c1, c2; int iter; if ( Fl::belowmouse() == this ) { iter = 12; c1 = fl_darker( FL_RED ); c2 = FL_GRAY; } else { iter = 6; c1 = FL_GRAY; c2 = FL_BLACK; } Fl_Color c = c1; for ( int i = iter; i--; ) { fl_color( c ); fl_arc( tx + (i * (tw / iter)) / 2, ty + (i * (th / iter)) / 2, tw - (i * (tw / iter)), th - (i * ( th / iter )), 0, 360 ); c = fl_color_average( c1, c2, (float)i / iter); } } /* fl_color( FL_WHITE ); */ /* fl_arc( tx, ty, tw, th, 0, 360 ); */ if ( _configs[ _outs ][0] >= 0 ) { for ( int i = _outs; i--; ) { int a = _configs[ _outs ][ i ]; Point p( 1.2f, (float)a ); float px, py; p.axes( &px, &py ); fl_push_matrix(); const int bx = tx + ((tw / 2) * px + (tw / 2)); const int by = ty + ((th / 2) * py + (th / 2)); fl_translate( bx, by ); fl_scale( 5, 5 ); a = 90 - a; fl_rotate( a ); draw_speaker( FL_WHITE ); fl_rotate( -a ); fl_pop_matrix(); } } /* ensure that points are drawn *inside* the circle */ for ( int i = _ins; i--; ) { Point *p = &_points[ i ]; Fl_Color c = (Fl_Color)(10 + i); int px, py, pw, ph; point_bbox( p, &px, &py, &pw, &ph ); /* draw point */ if ( p != drag ) fl_color( c ); else fl_color( FL_WHITE ); fl_pie( px, py, pw, ph, 0, 360 ); /* draw echo */ fl_color( c = fl_darker( c ) ); fl_arc( px - 5, py - 5, pw + 10, ph + 10, 0, 360 ); if ( Fl::belowmouse() == this ) { fl_color( c = fl_darker( c ) ); fl_arc( px - 10, py - 10, pw + 20, ph + 20, 0, 360 ); fl_color( c = fl_darker( c ) ); fl_arc( px - 30, py - 30, pw + 60, ph + 60, 0, 360 ); } /* draw number */ char pat[4]; snprintf( pat, 4, "%d", i + 1 ); fl_color( FL_BLACK ); fl_font( FL_HELVETICA, ph + 2 ); fl_draw( pat, px + 1, py + 1, pw - 1, ph - 1, FL_ALIGN_CENTER ); /* draw line */ /* fl_color( FL_WHITE ); */ /* fl_line( bx + pw() / 2, by + ph() / 2, tx + (tw / 2), ty + (th / 2) ); */ } fl_pop_clip(); }