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 Transport::update_record_state ( void ) { Fl_Button *w = _record_button; /* handle display */ if ( w->value() ) w->labelcolor( FL_RED ); else w->labelcolor( fl_color_average( FL_RED, FL_WHITE, 0.25f ) ); w->redraw(); /* this covers the case where the record toggle button is * pressed while the transport is already rolling. Recording * should begin or end on the next frame */ if ( rolling ) { if ( ! recording && w->value() ) { timeline->record(); recording = true; } else if ( recording ) { timeline->stop(); recording = false; } } }
void Fl_Arc_Dial::draw ( void ) { int X = x(); int Y = y(); int W = w(); int H = h(); draw_box(); draw_label(); X += Fl::box_dx(box()); Y += Fl::box_dy(box()); W -= Fl::box_dw(box()); H -= Fl::box_dh(box()); double angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1(); fl_line_style( FL_SOLID, W / 6 ); X += W / 8; Y += H / 8; W -= W / 4; H -= H / 4; if ( box() == FL_NO_BOX ) { /* draw backgrond arc */ fl_color( fl_color_average( FL_BLACK, selection_color(), 0.80f ) ); fl_arc( X, Y, W, H, 270 - angle1(), 270 - angle2() ); } fl_color( selection_color() ); // fl_color( fl_color_average( FL_RED, selection_color(), ( value() - minimum() ) / ( maximum() - minimum() ) ) ); if ( type() == FL_FILL_DIAL ) fl_arc( X, Y, W, H, 270 - angle1(), 270 - angle ); else { const int d = 6; /* account for edge conditions */ angle = angle < angle1() + d ? angle1() + d : angle; angle = angle > angle2() - d ? angle2() - d : angle; fl_arc( X, Y, W, H, 270 - (angle - d), 270 - (angle + d) ); } fl_line_style( FL_SOLID, 0 ); fl_color( labelcolor() ); char s[10]; fl_font( FL_HELVETICA, 8 ); snprintf( s, sizeof( s ), "%.1f", value() ); fl_draw( s, X, Y, W, H, FL_ALIGN_BOTTOM ); }
void init_colors ( void ) { unsigned int i; /* velocity colors */ for ( i = 128; i--; ) { velocity_colors[i] = fl_color_average( FL_GRAY, fl_rgb_color( i * 2, 255 - i * 2, 32 ), 0.4 ); velocity2_colors[i] = fl_color_average( FL_WHITE, velocity_colors[i], 0.5 ); } state_colors = (Fl_Color*)malloc(sizeof( Fl_Color ) * MAX_STATE ); for ( i = elementsof( color_defs ); i--; ) { state_colors[ color_defs[i].state ] = fl_rgb_color( color_defs[i].r, color_defs[i].g, color_defs[i].b ); } }
void star::draw() { int border = r/40; fl_color(color+20); fl_pie(x-border, y-border, r+(border*2), r+(border*2), 0.0, 360.0); if((darkness < 0.5 && fade > 0) || (darkness > 0.95 && fade < 0)) fade *= -1; darkness -= 0.02*fade; fl_color(fl_color_average(color,FL_WHITE, darkness)); fl_pie(x, y, r, r, 0.0, 360.0); }
void Track::add ( Audio_Sequence * t ) { t->track( this ); takes->insert( *t, 0 ); /* show the take header */ t->child(0)->show(); t->color( fl_color_average( FL_BLACK, FL_GRAY, 0.25f ) ); t->labeltype( FL_ENGRAVED_LABEL ); }
Transport::Transport ( int X, int Y, int W, int H, const char *L ) : Fl_Pack( X, Y, W, H, L ) { recording = false; rolling = false; _stop_disables_record = true; const int bw = W / 3; type( HORIZONTAL ); Fl_Button *o; _home_button = o = new Fl_Button( 0, 0, bw, 0, "@|<" ); o->labeltype( FL_EMBOSSED_LABEL ); o->callback( cb_button, this ); o->shortcut( FL_Home ); o->box( FL_UP_BOX ); _end_button = o = new Fl_Button( 0, 0, bw, 0, "@>|" ); o->labeltype( FL_EMBOSSED_LABEL ); o->callback( cb_button, this ); o->shortcut( FL_End ); _play_button = o = new Fl_Button( 0, 0, bw, 0, "@>" ); o->labeltype( FL_EMBOSSED_LABEL ); o->callback( cb_button, this ); o->shortcut( ' ' ); o->box( FL_UP_BOX ); _record_button = o = new Fl_Button( 0, 0, bw, 0, "@circle" ); o->type( FL_TOGGLE_BUTTON ); o->labeltype( FL_EMBOSSED_LABEL ); o->labelcolor( fl_color_average( FL_RED, FL_WHITE, 0.25f ) ); o->shortcut( 'R' ); o->callback( cb_button, this ); o->when( FL_WHEN_CHANGED ); o->box( FL_UP_BOX ); end(); }
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(); }
static inline Fl_Color shade_color(uchar gc, Fl_Color bc) { return fl_color_average(gc+(FL_GRAY_RAMP-'A'), bc, 0.75f); }
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 ); } }
FL_EXPORT_C(Fl_Color, fl_color_averageC)(Fl_Color c1, Fl_Color c2, float weight){ return fl_color_average(c1,c2,weight);}
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(); } }
/* ============================================================================ Class constructor ============================================================================ */ VTTpddServerLog::VTTpddServerLog(int w, int h, const char* title) : Fl_Double_Window(w, h, title) { Fl_Box* o; Fl_Button* b; Fl_Group* g; // Initialize everything m_pServer = NULL; m_enabled = TRUE; m_lastWasRx = FALSE; m_rxCount = m_txCount = 0; m_maxLogEntries = 8192; m_nextRef = 1; m_callbackActive = FALSE; m_autoScroll = TRUE; // Define our default colors m_colors.background = FL_BLACK; m_colors.ref = FL_WHITE; m_colors.rxLabel = FL_YELLOW; m_colors.txLabel = (Fl_Color) 221; m_colors.rxHex = fl_color_average(FL_DARK_GREEN, FL_WHITE, (float) 0.8); m_colors.txHex = fl_color_average((Fl_Color) 221, FL_WHITE, (float) 0.5); m_colors.rxAscii = FL_GREEN; m_colors.txAscii = (Fl_Color) 221; m_fontSize = 14; fl_font(FL_COURIER, m_fontSize); m_height = fl_height(); m_width = (int) fl_width("W"); // =============================== // Now create the controls we need // =============================== // Create a menu m_pMenu = new Fl_Menu_Bar(0, 0, w, MENU_HEIGHT-2); m_pMenu->menu(gServerLog_menuitems); // Create a window for the log m_pLog = new Fl_Double_Window(10, MENU_HEIGHT+10, w-20-15, h-MENU_HEIGHT-50, ""); //m_pLog->color(FL_BLACK); m_pLog->end(); m_pLog->hide(); // Create a scrollbar m_pScroll = new Fl_Scrollbar(w-10-15, MENU_HEIGHT+10, 15, h-MENU_HEIGHT-50, ""); m_pScroll->callback(cb_scroll_log, this); // Create a resizing group g = new Fl_Group(0, h-35, w, 35, ""); // Create an auto scroll checkbox m_pAutoScroll = new Fl_Check_Button(20, h-37, 110, 20, "Auto scroll"); m_pAutoScroll->callback(cb_autoscroll, this); // Create a disable log checkbox m_pDisable = new Fl_Check_Button(20, h-21, 110, 20, "Disable log"); m_pDisable->callback(cb_disable_log, this); // Create a Save button b = new Fl_Button(150, h-30, 80, 20, "Save"); b->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE); b->callback(cb_save_log, this); // Create a Load button b = new Fl_Button(250, h-30, 80, 20, "Load"); b->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE); b->callback(cb_load_log, this); // Create a clear button b = new Fl_Button(350, h-30, 80, 20, "Clear"); b->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE); b->callback(cb_clear_log, this); // Make the group resizable o = new Fl_Box(440, 350, 5, 5, ""); g->resizable(o); g->end(); // Make the window resizable o = new Fl_Box(20, MENU_HEIGHT + 30, 5, 5, ""); resizable(o); // Set the scrollbar size SetScrollSizes(); }
void EDE_Calendar::update_calendar() { unsigned int i; // Find first day of week edelib::Date d=active_date_; d.set(d.year(), d.month(), 1); int day_of_week = d.day_of_week()-1; // Show/hide first filler if (day_of_week>0) m_filler[0]->show(); else m_filler[0]->hide(); // Days int row=2; for (i=0; i<d.days_in_month(); i++) { Fl_Box* btn = m_dayButtons[i]; // shortcut btn->show(); // Set button color Fl_Color daycolor = color(); // base color is the color of calendar if (day_of_week==0) // Special color for sunday daycolor = fl_color_average(daycolor, FL_BLUE, 0.8); if (i==(uint)today_date_.day()-1 && d.month()==today_date_.month() && d.year()==today_date_.year()) btn->color(fl_color_average(daycolor, FL_RED, 0.5)); // today else if (i==(uint)active_date_.day()-1) btn->color(fl_lighter(daycolor)); else btn->color(daycolor); // Set downbox for active day if (i==(uint)active_date_.day()-1) btn->box(FL_DOWN_BOX); else btn->box(FL_FLAT_BOX); day_of_week++; if (day_of_week==7) { day_of_week=0; row++; } } // Hide remaining buttons for (i=d.days_in_month(); i<31; i++) m_dayButtons[i]->hide(); // Show/hide second filler if (day_of_week<6) m_filler[1]->show(); else m_filler[1]->hide(); // Show/hide third filler if (row<7) m_filler[2]->show(); else m_filler[2]->hide(); // Set title static char title[30]; // No month name should be larger than 24 chars, even when localized // and we can't show it anyway cause the box is too small snprintf (title, 30, "%s, %d", d.month_name(), d.year()); m_monthNameBox->copy_label(title); // Calculate tooltip (distance between today and active date) static char tooltip_str[1024]; tooltip_str[0] = '\0'; if (today_date_ != active_date_) { long dist = date_distance(today_date_, active_date_); long weeks = dist/7; int wdays = dist%7; int months=0; int mdays=0; int years=0; int ymonths=0; // Find lower date, first part of tooltip edelib::Date d1,d2; if (today_date_ < active_date_) { d1=today_date_; d2=active_date_; snprintf(tooltip_str, 1023, _("In %ld days"), dist); } else { d2=today_date_; d1=active_date_; snprintf(tooltip_str, 1023, _("%ld days ago"), dist); } // If necessary, calculate distance in m/d and y/m/d format if (dist>30) { months = d2.month() - d1.month() + (d2.year() - d1.year())*12; mdays = d2.day() - d1.day(); if (mdays<1) { mdays += d2.days_in_month(); months--; } } if (months>11) { years = months/12; ymonths = months%12; } // Append those strings using snprintf if (weeks) { char* tmp = strdup(tooltip_str); snprintf(tooltip_str, 1023, _("%s\n%ld weeks and %d days"), tmp, weeks, wdays); free(tmp); } if (months) { char* tmp = strdup(tooltip_str); snprintf(tooltip_str, 1023, _("%s\n%d months and %d days"), tmp, months, mdays); free(tmp); } if (years) { char* tmp = strdup(tooltip_str); snprintf(tooltip_str, 1023, _("%s\n%d years, %d months and %d days"), tmp, years, ymonths, mdays); free(tmp); } } tooltip(tooltip_str); layout(x(),y(),w(),h()); // relayout buttons if neccessary redraw(); }
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_Button *o = new Fl_Button( 0, 0, 40, 40, p->name() ); w = o; o->type( FL_TOGGLE_BUTTON ); o->value( p->control_value() ); o->selection_color( fl_color_average( FL_GRAY, FL_CYAN, 0.5 ) ); _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 ) else { Fl_Value_SliderX *o = new Fl_Value_SliderX(0, 0, 30, 250, p->name() ); control = o; w = o; if ( ! _horizontal ) { o->size( 30, 250 ); o->type(FL_VERT_NICE_SLIDER); } else { o->size(250,20); o->type(FL_HOR_NICE_SLIDER); } // o->type(4); o->color( FL_BACKGROUND2_COLOR ); 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 ) { if ( ! _horizontal ) { o->minimum( p->hints.maximum ); o->maximum( p->hints.minimum ); } else { o->minimum( p->hints.minimum ); o->maximum( p->hints.maximum ); } } o->precision(2); 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->clear_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 ); resizable(flg); // init_sizes(); } else { /* HACK: hide label */ if ( _type == TOGGLE ) { w->align( FL_ALIGN_INSIDE ); } else { w->labeltype( FL_NO_LABEL ); } w->resize( x(), y(), this->w(), h() ); add( w ); resizable( w ); init_sizes(); } }
Transport::Transport ( int X, int Y, int W, int H, const char *L ) : Fl_Pack( X, Y, W, H, L ) { recording = false; rolling = false; _stop_disables_record = true; bar = 0; beat = 0; tick = 0; beats_per_minute = 120; ticks_per_beat = 1920; beat_type = 4; beats_per_bar = 4; next_time = 0; frame_time =0; frame_rate = 48000; frame = 0; const int bw = W / 5; type( HORIZONTAL ); Fl_Button *o; _home_button = o = new Fl_Button( 0, 0, bw, 0, "@|<" ); o->labeltype( FL_EMBOSSED_LABEL ); o->callback( cb_button, this ); o->shortcut( FL_Home ); o->box( FL_UP_BOX ); _end_button = o = new Fl_Button( 0, 0, bw, 0, "@>|" ); o->labeltype( FL_EMBOSSED_LABEL ); o->callback( cb_button, this ); o->shortcut( FL_End ); _play_button = o = new Fl_Button( 0, 0, bw, 0, "@>" ); o->labeltype( FL_EMBOSSED_LABEL ); o->callback( cb_button, this ); o->shortcut( ' ' ); o->box( FL_UP_BOX ); _record_button = o = new Fl_Button( 0, 0, bw, 0, "@circle" ); o->type( FL_TOGGLE_BUTTON ); o->labeltype( FL_EMBOSSED_LABEL ); o->labelcolor( fl_color_average( FL_RED, FL_WHITE, 0.25f ) ); o->shortcut( 'R' ); o->callback( cb_button, this ); o->when( FL_WHEN_CHANGED ); o->box( FL_UP_BOX ); _punch_button = o = new Fl_Button( 0, 0, bw, 0, "Punch" ); o->type( FL_TOGGLE_BUTTON ); o->labelsize( 9 ); o->labeltype( FL_NORMAL_LABEL ); o->shortcut( 'P' ); o->callback( cb_button, this ); o->when( FL_WHEN_CHANGED ); o->color2( FL_RED ); o->box( FL_UP_BOX ); end(); }
Transport::Transport ( int X, int Y, int W, int H, const char *L ) : Fl_Flowpack( X, Y, W, H, L ) { recording = false; rolling = false; _stop_disables_record = true; bar = 0; beat = 0; tick = 0; beats_per_minute = 120; ticks_per_beat = 1920; beat_type = 4; beats_per_bar = 4; next_time = 0; frame_time =0; frame_rate = 48000; frame = 0; { _home_button = new Fl_Button(5, 5, 40, 44, "@|<"); } // Fl_Button* _home_button { _end_button = new Fl_Button(45, 5, 40, 44, "@>|"); } // Fl_Button* _end_button { _play_button = new Fl_Button(85, 5, 40, 44, "@>"); } // Fl_Button* _play_button { _record_button = new Fl_Button(130, 5, 40, 44, "@circle"); } // Fl_Button* _record_button { _punch_button = new Fl_Button(175, 5, 38, 21, "Punch"); _punch_button->type(1); _punch_button->labelsize(10); } // Fl_Button* _punch_button { _loop_button = new Fl_Button(175, 20, 38, 21, "Loop"); _loop_button->type(1); _loop_button->labelsize(10); } // Fl_Button* _loop_button { _new_take_button = new Fl_Button(225, 5, 60, 21, "New Take"); _new_take_button->type(1); _new_take_button->labelsize(10); } // Fl_Button* _new_take_button end(); Fl_Button *o; o = _home_button; o->callback( cb_button, this ); o->shortcut( FL_Home ); o = _end_button; o->callback( cb_button, this ); o->shortcut( FL_End ); o = _play_button; o->callback( cb_button, this ); o->shortcut( ' ' ); o = _record_button; o->type( FL_TOGGLE_BUTTON ); o->shortcut( 'R' ); o->callback( cb_button, this ); o->color2( FL_RED ); o->when( FL_WHEN_CHANGED ); o = _punch_button; o->type( FL_TOGGLE_BUTTON ); o->shortcut( 'P' ); o->callback( cb_button, this ); o->when( FL_WHEN_CHANGED ); o->color2( fl_color_average( FL_GRAY, FL_RED, 0.50 )); o->tooltip( "Toggle punch in/out recording mode" ); o = _loop_button; o->type( FL_TOGGLE_BUTTON ); o->shortcut( 'L' ); o->callback( cb_button, this ); o->when( FL_WHEN_CHANGED ); o->color2( fl_color_average( FL_GRAY, FL_GREEN, 0.50 )); o->tooltip( "Toggle looped playback" ); o = _new_take_button; o->type( FL_TOGGLE_BUTTON ); o->shortcut( 'T' ); o->callback( cb_button, this ); o->when( FL_WHEN_CHANGED ); o->color2( fl_color_average( FL_GRAY, FL_YELLOW, 0.50 ) ); o->tooltip( "Toggle automatic creation of new takes for armed tracks" ); flowdown( true ); }
void Panner::draw ( void ) { int tw, th, tx, ty; bbox( tx, ty, tw, th ); fl_push_clip( x(),y(),w(),h() ); draw_the_box( tx, ty, tw, th ); // draw_box(); draw_label(); /* if ( _bypassed ) */ /* { */ /* draw_box(); */ /* fl_color( 0 ); */ /* fl_font( FL_HELVETICA, 12 ); */ /* fl_draw( "(bypass)", x(), y(), w(), h(), FL_ALIGN_CENTER ); */ /* goto done; */ /* } */ /* tx += b; */ /* ty += b; */ /* tw -= b * 2; */ /* th -= b * 2; */ fl_line_style( FL_SOLID, 1 ); fl_color( FL_WHITE ); for ( unsigned int i = 0; i < _points.size(); i++ ) { Point *p = &_points[i]; if ( ! p->visible ) continue; Fl_Color c = fl_color_add_alpha( p->color, 100 ); fl_color(c); int px, py, pw, ph; point_bbox( p, &px, &py, &pw, &ph ); { float po = 5; fl_push_clip( px - ( po * 12 ), py - ( po * 12 ), pw + ( po * 24 ), ph + (po * 24 )); fl_pie( px + 5, py + 5, pw - 10, ph - 10, 0, 360 ); fl_pie( px, py, pw, ph, 0, 360 ); fl_pop_clip(); if ( projection() == POLAR ) { fl_color( fl_color_average( fl_rgb_color( 127,127,127 ), p->color, 0.50 ) ); fl_begin_loop(); fl_circle( tx + tw/2, ty + th/2, tw/2.0f * ( ( p->radius() / range() ))); fl_end_loop(); } } const char *s = p->label; fl_color( fl_color_add_alpha( fl_rgb_color( 220,255,255 ), 127 ) ); fl_font( FL_HELVETICA_BOLD_ITALIC, 10 ); fl_draw( s, px + 20, py + 1, 50, ph - 1, FL_ALIGN_LEFT ); if ( tw > 100 ) { char pat[50]; snprintf( pat, sizeof(pat), "%.1f°:%.1f° %.1fm", p->azimuth(), p->elevation(), p->radius() ); // fl_color( fl_color_add_alpha( fl_rgb_color( 220,255,255 ), 127 ) ); fl_font( FL_COURIER, 9 ); fl_draw( pat, px + 20, py + 15, 50, ph - 1, FL_ALIGN_LEFT | FL_ALIGN_WRAP ); /* fl_font( FL_HELVETICA_ITALIC, 9 ); */ /* snprintf(pat, sizeof(pat), "range: %.1f meters", range() ); */ /* fl_draw( pat, tx, ty, tw, th, FL_ALIGN_LEFT | FL_ALIGN_BOTTOM | FL_ALIGN_INSIDE ); */ /* if ( _projection == POLAR ) */ /* { */ /* fl_draw( "Polar perspective; azimuth, elevation and radius input. Right click controls radius.", tx, ty, tw, th, FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT | FL_ALIGN_INSIDE ); */ /* } */ /* else */ /* { */ /* fl_draw( "Polar orthographic; angle and distance input.", tx, ty, tw, th, FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT | FL_ALIGN_INSIDE ); */ /* } */ } } if ( tw > 200 ) draw_children(); fl_line_style( FL_SOLID, 0 ); fl_pop_clip(); }
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(); }