Make note shape (circle, square) optional.
Also, get rid of the canvas's ability to display different shapes on the same canvas, since we never use that feature anyway.
This commit is contained in:
parent
9974e9bb47
commit
ca56b8c337
17
src/canvas.C
17
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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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 *
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
} {
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include "jack.H"
|
||||
#include "transport.H"
|
||||
|
||||
int pattern::note_shape = CIRCLE;
|
||||
|
||||
event_list pattern::_recorded_events;
|
||||
vector <pattern*> 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;
|
||||
|
|
|
@ -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 <void> signal_create_destroy;
|
||||
|
||||
Mapping mapping;
|
||||
|
|
|
@ -31,8 +31,6 @@ phrase::phrase ( void )
|
|||
viewport.h = 32;
|
||||
viewport.w = 32;
|
||||
|
||||
_draw_shape = SQUARE;
|
||||
|
||||
_add();
|
||||
|
||||
char *s;
|
||||
|
|
|
@ -38,6 +38,8 @@ public:
|
|||
|
||||
static signal <void> signal_create_destroy;
|
||||
|
||||
int draw_shape ( void ) const { return SQUARE; }
|
||||
|
||||
phrase ( void );
|
||||
~phrase ( void );
|
||||
phrase ( const phrase &rhs );
|
||||
|
|
Loading…
Reference in New Issue