Add more flare to drawing. Also, default to square shape for notes.

pull/3/head
Jonathan Moore Liles 2012-03-03 17:49:00 -08:00
parent 8e01aec002
commit 46bb1bf702
5 changed files with 69 additions and 14 deletions

View File

@ -509,7 +509,6 @@ Canvas::draw_playhead ( void )
}
}
copy();
for ( uint x = m.vp->w; x-- ; )

View File

@ -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" );

View File

@ -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() ] );

View File

@ -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 );
}

View File

@ -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*> pattern::_patterns;