From 46bb1bf70241a9008f2561e2e0298d06171e58c0 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sat, 3 Mar 2012 17:49:00 -0800 Subject: [PATCH] Add more flare to drawing. Also, default to square shape for notes. --- src/canvas.C | 1 - src/gui/draw.C | 60 ++++++++++++++++++++++++++++++++++++++++++---- src/gui/ui.fl | 17 +++++++------ src/gui/widgets.fl | 3 ++- src/pattern.C | 2 +- 5 files changed, 69 insertions(+), 14 deletions(-) diff --git a/src/canvas.C b/src/canvas.C index e0069ad..2c24200 100644 --- a/src/canvas.C +++ b/src/canvas.C @@ -509,7 +509,6 @@ Canvas::draw_playhead ( void ) } } - copy(); for ( uint x = m.vp->w; x-- ; ) diff --git a/src/gui/draw.C b/src/gui/draw.C index 1a4c68f..aeebb24 100644 --- a/src/gui/draw.C +++ b/src/gui/draw.C @@ -34,7 +34,7 @@ struct color_table { }; struct color_table color_defs[] = { - { EMPTY, 27, 27, 27 }, + { EMPTY, 18, 18, 18 }, { FULL, 255, 69, 0 }, { PARTIAL, 0, 0, 0 }, { CONTINUED, 80, 80, 80 }, @@ -47,6 +47,9 @@ struct color_table color_defs[] = { Fl_Color *state_colors; Fl_Color velocity_colors[128]; +Fl_Color velocity2_colors[128]; + +bool draw_borders = 1; void init_colors ( void ) @@ -55,7 +58,10 @@ init_colors ( void ) /* velocity colors */ for ( i = 128; i--; ) - velocity_colors[i] = fl_rgb_color( i * 2, 255 - i * 2, 32 ); + { + 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 ); @@ -178,10 +184,24 @@ gui_draw_shape ( int x, int y, int w, int h, int bw, int shape, int state, int f flags &= ~ F_SELECTION; } + Fl_Color c1, c2; + if ( state == FULL && color ) - fl_color( velocity_colors[ color ] ); + { + c1 = velocity_colors[ color ]; + c2 = velocity2_colors[ color ]; + } else - fl_color( state_colors[ state ] ); + { + c1 = state_colors[ state ]; + c2 = fl_color_average( FL_WHITE, c1, 0.1 ); + } + + + int thickness = 2; + + /* if ( state == EMPTY && shape == SQUARE ) */ + /* shape = HOLLOW_SQUARE; */ if ( flags & F_SELECTION ) fl_color( fl_darker( fl_color() ) ); @@ -189,16 +209,48 @@ gui_draw_shape ( int x, int y, int w, int h, int bw, int shape, int state, int f switch ( shape ) { case CIRCLE: + fl_color( c1 ); fl_pie( x + bw / 2, y + bw / 2, w - bw, h - bw, 0, 360 ); + if ( draw_borders ) + { + fl_color( c2 ); + fl_line_style( FL_SOLID, thickness ); + fl_arc( x + bw / 2, y + bw / 2, w - bw, h - bw, 0, 360 ); + fl_line_style( FL_SOLID, 0 ); + } break; case SQUARE: + 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, thickness ); + fl_rect( x + bw, y + bw, w - bw * 2, h - bw * 2 ); + fl_line_style( FL_SOLID, 0 ); + } break; case HALF_CIRCLE: + fl_color( c1 ); fl_pie( x + bw / 2, y + bw / 2, w - bw, h - bw, 0, 360 / 2); + if ( draw_borders ) + { + fl_color( c2 ); + fl_line_style( FL_SOLID, thickness ); + fl_pie( x + bw / 2, y + bw / 2, w - bw, h - bw, 0, 360 / 2); + fl_line_style( FL_SOLID, 0 ); + } break; case DIAMOND: + fl_color( c1 ); fl_polygon( x + w / 2, y + bw / 2, x + w - bw / 2, y + h / 2, x + w / 2, y + h - bw / 2, x + bw / 2, y + h / 2 ); + if ( draw_borders ) + { + fl_color( c2 ); + fl_line_style( FL_SOLID, thickness ); + fl_loop( x + w / 2, y + bw / 2, x + w - bw / 2, y + h / 2, x + w / 2, y + h - bw / 2, x + bw / 2, y + h / 2 ); + fl_line_style( FL_SOLID, 0 ); + } break; default: ASSERTION( "unknown shape" ); diff --git a/src/gui/ui.fl b/src/gui/ui.fl index 5dadb73..6032c24 100644 --- a/src/gui/ui.fl +++ b/src/gui/ui.fl @@ -1871,7 +1871,8 @@ for ( int n = 0; n < 128 ; n += 16 ) b->maximum( 1 ); b->angles( 0, 360 ); b->type( FL_FILL_DIAL ); -// b->box( FL_ROUNDED_BOX ); + b->color2( FL_GRAY ); + b->box( FL_ROUNDED_BOX ); // b->down_box( FL_ROUNDED_BOX ); b->selection_color( FL_GREEN ); b->color( FL_BLACK ); @@ -1900,15 +1901,17 @@ redraw();} {} if ( ! takesevents() ) return; + Fl_Color mode_color[3]; + +// mode_color[PLAY] = fl_color_average( FL_GRAY, FL_GREEN, 0.5 ); + mode_color[PLAY] = FL_DARK2; + mode_color[MUTE] = FL_LIGHT2; + mode_color[SOLO] = fl_color_average( FL_GRAY, FL_RED, 0.5 ); + int i; for ( i = 0; i < MAX_PATTERN; i++ ) { - Fl_Color mode_color[3]; - - mode_color[PLAY] = FL_GREEN; - mode_color[MUTE] = FL_GRAY; - mode_color[SOLO] = FL_RED; Trigger *b = (Trigger*)(((Fl_Pack*)rows->child( i / 16 ))->child( i % 16 )); @@ -1923,7 +1926,7 @@ for ( i = 0; i < MAX_PATTERN; i++ ) if ( p->playing() ) { - b->color( fl_lighter( FL_GRAY ) ); + b->color( FL_GRAY ); b->selection_color( mode_color[ p->mode() ] ); diff --git a/src/gui/widgets.fl b/src/gui/widgets.fl index 2323ae2..6cf17cf 100644 --- a/src/gui/widgets.fl +++ b/src/gui/widgets.fl @@ -89,7 +89,7 @@ widget_class Visual_Metronome {open selected class Fl_Group visible } { Fl_Slider progress { - private xywh {119 95 1149 23} type Horizontal box ROUND_UP_BOX color 32 selection_color 71 + private xywh {119 95 1149 23} type Horizontal box ROUNDED_BOX color 32 selection_color 71 code0 {o->resize( x(), (y() + h()) - (h() / 3), w(), h() / 3 );} code1 {o->slider_size( 0.25 );} code2 {o->slider( FL_ROUNDED_BOX );} @@ -124,6 +124,7 @@ for ( int i = 1; i <= b; ++i ) box->label( pat ); box->color( fl_lighter( FL_GRAY ) ); + box->color2( FL_GRAY ); pack->add( box ); } diff --git a/src/pattern.C b/src/pattern.C index e25c041..01c538b 100644 --- a/src/pattern.C +++ b/src/pattern.C @@ -25,7 +25,7 @@ #include "jack.H" #include "transport.H" -int pattern::note_shape = CIRCLE; +int pattern::note_shape = SQUARE; event_list pattern::_recorded_events; vector pattern::_patterns;