diff --git a/src/canvas.C b/src/canvas.C index 7928f3b..c563cc8 100644 --- a/src/canvas.C +++ b/src/canvas.C @@ -50,7 +50,6 @@ Canvas::_alloc_array ( void ) { a[ x ][ y ].flags = 0; a[ x ][ y ].state = -1; - a[ x ][ y ].shape = SQUARE; a[ x ][ y ].color = 0; } } @@ -111,7 +110,7 @@ Canvas::grid ( Grid *g ) update_mapping(); - m.shape = m.grid->draw_shape(); +// m.shape = m.grid->draw_shape(); /* connect signals */ /* FIXME: what happens when we do this twice? */ @@ -283,7 +282,7 @@ Canvas::copy ( void ) void Canvas::_reset ( void ) { - cell_t empty = {0,0,0,0}; + cell_t empty = {0,0,0}; for ( uint y = m.vp->h; y-- ; ) for ( uint x = m.vp->w; x-- ; ) @@ -302,7 +301,6 @@ Canvas::clear ( void ) for ( uint x = m.vp->w; x--; ) { m.current[ x ][ y ].color = 0; - m.current[ x ][ y ].shape = m.shape; m.current[ x ][ y ].state = EMPTY; m.current[ x ][ y ].flags = 0; } @@ -339,6 +337,8 @@ Canvas::flip ( void ) if ( viewable_x( m.playhead ) ) draw_line( m.playhead - m.vp->x, F_PLAYHEAD ); + const int shape = m.grid->draw_shape(); + for ( uint y = m.vp->h; y--; ) for ( uint x = m.vp->w; x--; ) { @@ -353,7 +353,7 @@ Canvas::flip ( void ) 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, - c->shape, c->state, c->flags, c->color ); + shape, c->state, c->flags, c->color ); } cell_t **tmp = m.previous; @@ -451,7 +451,6 @@ Canvas::draw_shape ( int x, int y, int shape, int state, int color, bool selecte if ( x < 0 || y < 0 || x >= m.vp->w || y >= m.vp->h ) return; - m.current[ x ][ y ].shape = shape; m.current[ x ][ y ].color = color; m.current[ x ][ y ].state = (uint)m.vp->x + x > m.grid->ts_to_x( m.grid->length() ) ? PARTIAL : state; if ( selected ) @@ -553,18 +552,18 @@ Canvas::redraw ( void ) draw_mapping(); draw_ruler(); + const int shape = m.grid->draw_shape(); + for ( int y = m.vp->h; y--; ) for ( int x = m.vp->w; x--; ) { cell_t c = m.previous[ x ][ y ]; - if ( c.shape > HEXAGON ) return; - 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, - c.shape, c.state, c.flags, c.color ); + shape, c.state, c.flags, c.color ); } } diff --git a/src/canvas.H b/src/canvas.H index 9289a0f..36e3ced 100644 --- a/src/canvas.H +++ b/src/canvas.H @@ -28,15 +28,14 @@ using namespace sigc; class Mapping; struct cell_t { - unsigned char color; - unsigned char shape : 4; + unsigned char color : 8; unsigned char state : 4; unsigned char flags : 4; bool operator!= ( const cell_t &rhs ) { - return color != rhs.color || shape != rhs.shape || state != rhs.state || flags != rhs.flags; + return color != rhs.color || state != rhs.state || flags != rhs.flags; } }; diff --git a/src/grid.C b/src/grid.C index e4bcb95..a8d21c1 100644 --- a/src/grid.C +++ b/src/grid.C @@ -82,7 +82,6 @@ Grid::Grid ( const Grid &rhs ) : sigc::trackable() _notes = rhs._notes ? strdup( rhs._notes ) : NULL; _number = rhs._number; _height = rhs._height; - _draw_shape = rhs._draw_shape; _mode = 0; _locked = 0; @@ -674,7 +673,7 @@ Grid::draw ( Canvas *c, int bx, int by, int bw, int bh ) // if ( ts >= start && ts <= end ) if ( tse >= start && ts <= end ) c->draw_dash( ts_to_x( ts ), note_to_y( e->note() ), ts_to_x( tse - ts ), - _draw_shape, e->note_velocity(), e->selected() ); + draw_shape(), e->note_velocity(), e->selected() ); } c->flip(); @@ -834,11 +833,6 @@ Grid::mode ( void ) const return _mode; } -int -Grid::draw_shape ( void ) const -{ - return _draw_shape; -} /** return a pointer to a copy of grid's event list in raw form */ event_list * diff --git a/src/grid.H b/src/grid.H index cf9bf2f..2b27a65 100644 --- a/src/grid.H +++ b/src/grid.H @@ -109,8 +109,6 @@ protected: char *_name; int _number; - int _draw_shape; - bool _suspend_update; unsigned int _bpb; /* beats per bar */ @@ -201,7 +199,7 @@ public: char * notes ( void ) const; virtual void mode ( int m ); virtual int mode ( void ) const; - int draw_shape ( void ) const; + virtual int draw_shape ( void ) const = 0; int next_note_x ( int x ) const; int prev_note_x ( int x ) const; diff --git a/src/gui/ui.fl b/src/gui/ui.fl index 2642474..bf31f18 100644 --- a/src/gui/ui.fl +++ b/src/gui/ui.fl @@ -183,7 +183,7 @@ if ( Fl::event() == FL_SHORTCUT && Fl::event_key() == FL_Escape ) if ( maybe_save_song() ) quit();} open - xywh {856 305 865 800} type Double box PLASTIC_UP_BOX color 37 resizable xclass non size_range {600 420 0 0} visible + xywh {856 276 865 800} type Double box PLASTIC_UP_BOX color 37 resizable xclass non size_range {600 420 0 0} visible } { Fl_Menu_Bar menu_bar {open xywh {0 0 869 30} color 37 @@ -378,6 +378,25 @@ pattern_canvas_widget->redraw();} config.follow_playhead = val ? true : false;} xywh {10 10 40 25} type Toggle value 1 } + Submenu {} { + label {Note Shape} open + xywh {0 0 74 24} + } { + MenuItem {} { + label Circle + callback {pattern::note_shape = CIRCLE; + pattern_canvas_widget->redraw(); + } + xywh {0 0 40 24} type Radio + } + MenuItem {} { + label Square + callback {pattern::note_shape = SQUARE; + pattern_canvas_widget->redraw(); + } selected + xywh {0 0 40 24} type Radio + } + } } Submenu {} { label {&Help} open @@ -981,7 +1000,7 @@ else } { MenuItem {} { label Pattern - callback {song.play_mode = PATTERN;} selected + callback {song.play_mode = PATTERN;} xywh {5 5 40 25} } MenuItem {} { @@ -1048,7 +1067,7 @@ detach_button->value( 0 );} open Function {make_about_popup()} {open } { Fl_Window about_popup { - label About open selected + label About open xywh {697 224 535 685} type Double non_modal size_range {535 685 535 685} visible } { Fl_Box {} { @@ -1848,8 +1867,7 @@ for ( i = 0; i < MAX_PATTERN; i++ ) b->value( 0 ); } -}} {selected - } +}} {} } Function {resize( int X, int Y, int W, int H )} {open return_type void } { diff --git a/src/pattern.C b/src/pattern.C index a17026e..cb452ca 100644 --- a/src/pattern.C +++ b/src/pattern.C @@ -25,6 +25,8 @@ #include "jack.H" #include "transport.H" +int pattern::note_shape = CIRCLE; + event_list pattern::_recorded_events; vector pattern::_patterns; int pattern::_solo; @@ -37,7 +39,6 @@ pattern::pattern ( void ) viewport.h = 32; viewport.w = 32; - _draw_shape = CIRCLE; _channel = _port = 0; _ppqn = 4; diff --git a/src/pattern.H b/src/pattern.H index b10bd36..58f5f3a 100644 --- a/src/pattern.H +++ b/src/pattern.H @@ -36,6 +36,7 @@ class pattern : public Grid static int _solo; static int _pattern_recording; + static int solo ( void ); int _channel, _port; @@ -54,6 +55,10 @@ class pattern : public Grid public: + static int note_shape; + + int draw_shape ( void ) const { return pattern::note_shape; } + static signal signal_create_destroy; Mapping mapping; diff --git a/src/phrase.C b/src/phrase.C index 516f051..a38811a 100644 --- a/src/phrase.C +++ b/src/phrase.C @@ -31,8 +31,6 @@ phrase::phrase ( void ) viewport.h = 32; viewport.w = 32; - _draw_shape = SQUARE; - _add(); char *s; diff --git a/src/phrase.H b/src/phrase.H index c09b319..f9b6ca2 100644 --- a/src/phrase.H +++ b/src/phrase.H @@ -38,6 +38,8 @@ public: static signal signal_create_destroy; + int draw_shape ( void ) const { return SQUARE; } + phrase ( void ); ~phrase ( void ); phrase ( const phrase &rhs );