@@ -213,8 +213,6 @@ Canvas::resize ( void ) | |||
m.div_w = (m.width - m.margin_left) / m.vp->w; | |||
m.div_h = (m.height - m.margin_top) / m.vp->h; | |||
m.border_w = min( m.div_w, m.div_h ) / 8; | |||
m.mapping_drawn = m.ruler_drawn = false; | |||
} | |||
@@ -358,7 +356,7 @@ Canvas::flip ( void ) | |||
c->flags |= F_SELECTION; | |||
if ( *c != *p ) | |||
gui_draw_shape( m.origin_x + m.margin_left + x * m.div_w, m.origin_y + m.margin_top + y * m.div_h, m.div_w, m.div_h, m.border_w, | |||
gui_draw_shape( m.origin_x + m.margin_left + x * m.div_w, m.origin_y + m.margin_top + y * m.div_h, m.div_w, m.div_h, | |||
shape, c->state, c->flags, c->color ); | |||
} | |||
@@ -574,7 +572,7 @@ Canvas::redraw ( void ) | |||
if ( m.vp->x + x == m.playhead ) | |||
c.flags |= F_PLAYHEAD; | |||
gui_draw_shape( m.origin_x + m.margin_left + x * m.div_w, m.origin_y + m.margin_top + y * m.div_h, m.div_w, m.div_h, m.border_w, | |||
gui_draw_shape( m.origin_x + m.margin_left + x * m.div_w, m.origin_y + m.margin_top + y * m.div_h, m.div_w, m.div_h, | |||
shape, c.state, c.flags, c.color ); | |||
} | |||
} | |||
@@ -51,8 +51,6 @@ class Canvas : public trackable | |||
int margin_left, margin_top; | |||
int div_w, div_h; | |||
int border_w; | |||
int old_div_w, old_div_h; | |||
@@ -172,7 +172,7 @@ gui_draw_string ( int x, int y, int w, int h, int color, const char *s, bool dra | |||
} | |||
void | |||
gui_draw_shape ( int x, int y, int w, int h, int bw, int shape, int state, int flags, int color ) | |||
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 ) ) | |||
@@ -196,61 +196,29 @@ gui_draw_shape ( int x, int y, int w, int h, int bw, int shape, int state, int f | |||
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() ) ); | |||
int bw = 1; | |||
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_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, 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, 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 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 ); | |||
} | |||
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" ); | |||
@@ -41,14 +41,10 @@ enum { | |||
F_SELECTION = 1 << 3 /* item is part of the selection box */ | |||
}; | |||
/* shapes */ | |||
enum { | |||
CIRCLE, | |||
HALF_CIRCLE, | |||
SQUARE, | |||
DIAMOND, | |||
HEXAGON | |||
BOX | |||
}; | |||
const int ruler_height = 14; | |||
@@ -56,6 +52,6 @@ const int ruler_height = 14; | |||
void init_colors ( void ); | |||
int gui_draw_ruler ( int x, int y, int w, int div_w, int div, int ofs, int p1, int p2 ); | |||
int gui_draw_string ( int x, int y, int w, int h, int color, const char *s, bool draw ); | |||
void gui_draw_shape ( int x, int y, int w, int h, int bw, int shape, int state, int flags, int color ); | |||
void gui_draw_shape ( int x, int y, int w, int h, int shape, int state, int flags, int color ); | |||
void gui_clear_area ( int x, int y, int w, int h ); | |||
void gui_status ( const char *fmt, ... ); |
@@ -1092,8 +1092,8 @@ config.follow_playhead = val ? true : false;} | |||
xywh {0 0 74 24} | |||
} { | |||
MenuItem {} { | |||
label Circle | |||
callback {pattern::note_shape = CIRCLE; | |||
label Box | |||
callback {pattern::note_shape = BOX; | |||
pattern_canvas_widget->redraw();} | |||
xywh {0 0 40 24} type Radio | |||
} | |||