Add option for magnetic snapping.

This commit is contained in:
Jonathan Moore Liles 2008-04-27 13:56:20 -05:00
parent 96051065db
commit 193c24bd37
4 changed files with 31 additions and 20 deletions

View File

@ -299,6 +299,9 @@ Sequence::snap ( Sequence_Widget *r )
{
const int snap_pixels = 10;
if ( Timeline::snap_magnetic )
{
const int rx1 = r->x();
const int rx2 = r->x() + r->w();
@ -331,6 +334,7 @@ Sequence::snap ( Sequence_Widget *r )
goto done;
}
}
}
{
int nx = timeline->nearest_line( r->abs_x() );

View File

@ -244,7 +244,7 @@ exit( 0 );}
xywh {0 0 74 25}
} {
Submenu {} {
label {&Snap} open
label {&Snap to} open
xywh {0 0 74 25}
} {
MenuItem {} {
@ -263,6 +263,11 @@ exit( 0 );}
xywh {20 20 40 25} type Radio
}
}
MenuItem {} {
label {Magnetic snap}
callback {Timeline::snap_magnetic = menu_picked_value( o );} selected
xywh {10 10 40 25} type Toggle value 1
}
Submenu {} {
label {Capture Format} open
xywh {0 0 74 25}
@ -411,7 +416,7 @@ Fl::scheme( Fl::scheme() );}
Fl::background( 220, 220, 220 );
Fl::foreground( 0, 0, 0 );
Fl::scheme( Fl::scheme() );} selected
Fl::scheme( Fl::scheme() );}
xywh {20 20 40 25} type Radio
}
}

View File

@ -33,6 +33,7 @@
bool Timeline::draw_with_measure_lines = true;
Timeline::snap_e Timeline::snap_to = Bars;
bool Timeline::snap_magnetic = true;
const float UPDATE_FREQ = 0.02f;

View File

@ -115,6 +115,7 @@ public:
static bool draw_with_measure_lines;
static snap_e snap_to;
static bool snap_magnetic;
Tempo_Sequence *tempo_track;
Time_Sequence *time_track;