Rearrange menus. Keep timeline menu in timeline class and share it with popup menu.
This commit is contained in:
parent
3d40848e52
commit
06a0518463
322
Timeline/TLE.fl
322
Timeline/TLE.fl
|
@ -82,19 +82,8 @@ class TLE {open
|
||||||
|
|
||||||
char *path;
|
char *path;
|
||||||
asprintf( &path, "%s/%s", user_config_dir, options_filename );
|
asprintf( &path, "%s/%s", user_config_dir, options_filename );
|
||||||
((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Options" ), path );
|
((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Options/&Global" ), path );
|
||||||
free( path );
|
free( path );} {}
|
||||||
|
|
||||||
// save unjournaled state
|
|
||||||
|
|
||||||
// Loggable::save_unjournaled( state_filename );
|
|
||||||
|
|
||||||
|
|
||||||
if ( Project::open() )
|
|
||||||
{
|
|
||||||
// save project local options (Timeline menu)
|
|
||||||
((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Timeline" ), options_filename );
|
|
||||||
}} {}
|
|
||||||
}
|
}
|
||||||
Function {capture_format_cb( Fl_Widget *w, void *v )} {open private return_type {static void}
|
Function {capture_format_cb( Fl_Widget *w, void *v )} {open private return_type {static void}
|
||||||
} {
|
} {
|
||||||
|
@ -122,6 +111,13 @@ Fl::run();} {}
|
||||||
|
|
||||||
make_window();
|
make_window();
|
||||||
|
|
||||||
|
{
|
||||||
|
Fl_Menu_Item *tl = (Fl_Menu_Item*)menubar->find_item( "&Timeline" );
|
||||||
|
|
||||||
|
tl->user_data( timeline->menu );
|
||||||
|
tl->flags = FL_SUBMENU_POINTER;
|
||||||
|
}
|
||||||
|
|
||||||
Fl::visible_focus( 0 );
|
Fl::visible_focus( 0 );
|
||||||
|
|
||||||
Fl::get_system_colors();
|
Fl::get_system_colors();
|
||||||
|
@ -148,25 +144,25 @@ for ( std::list <const char *>::const_iterator f = formats.begin(); f != formats
|
||||||
// capture_format_menu->add( *f, FL_MENU_RADIO, 0, 0, 0 );
|
// capture_format_menu->add( *f, FL_MENU_RADIO, 0, 0, 0 );
|
||||||
//;
|
//;
|
||||||
char pat[256];
|
char pat[256];
|
||||||
snprintf( pat, sizeof( pat ), "&Timeline/Capture Format/%s", *f );
|
snprintf( pat, sizeof( pat ), "&Options/&Project/&Timeline/Capture Format/%s", *f );
|
||||||
|
|
||||||
menubar->add( pat, 0, &TLE::capture_format_cb, this, FL_MENU_RADIO );
|
menubar->add( pat, 0, &TLE::capture_format_cb, this, FL_MENU_RADIO );
|
||||||
}
|
}
|
||||||
|
|
||||||
menubar->picked( menubar->find_item( "&Timeline/Capture Format/Wav 24" ) );
|
menubar->picked( menubar->find_item( "&Options/&Project/&Timeline/Capture Format/Wav 24" ) );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char *path;
|
char *path;
|
||||||
asprintf( &path, "%s/options", user_config_dir );
|
asprintf( &path, "%s/options", user_config_dir );
|
||||||
((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Options" ), path );
|
((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Options/&Global" ), path );
|
||||||
free( path );} {}
|
free( path );} {}
|
||||||
}
|
}
|
||||||
Function {make_window()} {open
|
Function {make_window()} {open
|
||||||
} {
|
} {
|
||||||
Fl_Window main_window {
|
Fl_Window main_window {
|
||||||
label Timeline open
|
label Timeline open
|
||||||
xywh {254 185 1020 765} type Double resizable xclass Non_DAW visible
|
xywh {225 89 1020 765} type Double resizable xclass Non_DAW visible
|
||||||
} {
|
} {
|
||||||
Fl_Menu_Bar menubar {open selected
|
Fl_Menu_Bar menubar {open selected
|
||||||
xywh {0 0 1024 25}
|
xywh {0 0 1024 25}
|
||||||
|
@ -285,6 +281,10 @@ Loggable::compact();}
|
||||||
xywh {40 40 40 25} shortcut 0x10072
|
xywh {40 40 40 25} shortcut 0x10072
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MenuItem {} {
|
||||||
|
label {&Timeline}
|
||||||
|
xywh {5 5 40 25}
|
||||||
|
}
|
||||||
Submenu {} {
|
Submenu {} {
|
||||||
label {&View} open
|
label {&View} open
|
||||||
xywh {0 0 74 25}
|
xywh {0 0 74 25}
|
||||||
|
@ -325,160 +325,120 @@ Loggable::compact();}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Submenu timeline_menu {
|
|
||||||
label {&Timeline} open
|
|
||||||
xywh {0 0 74 25}
|
|
||||||
} {
|
|
||||||
MenuItem {} {
|
|
||||||
label {&Follow Playhead}
|
|
||||||
callback {Timeline::follow_playhead = menu_picked_value( o );}
|
|
||||||
xywh {20 20 40 25} type Toggle value 1
|
|
||||||
}
|
|
||||||
MenuItem {} {
|
|
||||||
label {&Center Playhead}
|
|
||||||
callback {Timeline::center_playhead = menu_picked_value( o );}
|
|
||||||
xywh {30 30 40 25} type Toggle value 1
|
|
||||||
}
|
|
||||||
Submenu {} {
|
|
||||||
label {&Snap to} open
|
|
||||||
xywh {0 0 74 25}
|
|
||||||
} {
|
|
||||||
MenuItem {} {
|
|
||||||
label Bars
|
|
||||||
callback {Timeline::snap_to = Timeline::Bars;}
|
|
||||||
xywh {0 0 40 25} type Radio value 1
|
|
||||||
}
|
|
||||||
MenuItem {} {
|
|
||||||
label Beats
|
|
||||||
callback {Timeline::snap_to = Timeline::Beats;}
|
|
||||||
xywh {10 10 40 25} type Radio
|
|
||||||
}
|
|
||||||
MenuItem {} {
|
|
||||||
label Off
|
|
||||||
callback {Timeline::snap_to = Timeline::None;}
|
|
||||||
xywh {20 20 40 25} type Radio
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MenuItem {} {
|
|
||||||
label {Magnetic snap}
|
|
||||||
callback {Timeline::snap_magnetic = menu_picked_value( o );}
|
|
||||||
xywh {10 10 40 25} type Toggle value 1
|
|
||||||
}
|
|
||||||
Submenu {} {
|
|
||||||
label {Capture Format} open
|
|
||||||
xywh {0 0 74 25}
|
|
||||||
} {}
|
|
||||||
}
|
|
||||||
Submenu {} {
|
Submenu {} {
|
||||||
label {&Options} open
|
label {&Options} open
|
||||||
xywh {0 0 74 25} divider
|
xywh {0 0 74 25} divider
|
||||||
} {
|
} {
|
||||||
Submenu {} {
|
Submenu {} {
|
||||||
label {&Display} open
|
label {&Global} open
|
||||||
xywh {0 0 74 25}
|
xywh {0 0 74 25}
|
||||||
} {
|
} {
|
||||||
Submenu {} {
|
Submenu {} {
|
||||||
label {&Timeline} open
|
label {&Display} open
|
||||||
xywh {0 0 74 25}
|
xywh {5 5 74 25}
|
||||||
} {
|
} {
|
||||||
MenuItem {} {
|
Submenu {} {
|
||||||
label {&Measure lines}
|
label {&Timeline} open
|
||||||
callback {Timeline::draw_with_measure_lines = menu_picked_value( o );
|
xywh {5 5 74 25}
|
||||||
|
} {
|
||||||
|
MenuItem {} {
|
||||||
|
label {&Measure lines}
|
||||||
|
callback {Timeline::draw_with_measure_lines = menu_picked_value( o );
|
||||||
|
|
||||||
timeline->redraw();}
|
timeline->redraw();}
|
||||||
xywh {0 0 40 25} type Toggle value 1
|
xywh {5 5 40 25} type Toggle value 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
Submenu {} {
|
||||||
Submenu {} {
|
label {&Waveform} open
|
||||||
label {&Waveform} open
|
xywh {5 5 74 25}
|
||||||
xywh {0 0 74 25}
|
} {
|
||||||
} {
|
MenuItem {} {
|
||||||
MenuItem {} {
|
label Fill
|
||||||
label Fill
|
callback {Waveform::fill = menu_picked_value( o );
|
||||||
callback {Waveform::fill = menu_picked_value( o );
|
|
||||||
|
|
||||||
timeline->redraw();}
|
timeline->redraw();}
|
||||||
xywh {10 10 40 25} type Toggle value 1
|
xywh {15 15 40 25} type Toggle value 1
|
||||||
}
|
}
|
||||||
MenuItem {} {
|
MenuItem {} {
|
||||||
label Outline
|
label Outline
|
||||||
callback {Waveform::outline = menu_picked_value( o );
|
callback {Waveform::outline = menu_picked_value( o );
|
||||||
|
|
||||||
timeline->redraw();}
|
timeline->redraw();}
|
||||||
xywh {30 30 40 25} type Toggle value 1
|
xywh {35 35 40 25} type Toggle value 1
|
||||||
}
|
}
|
||||||
MenuItem {} {
|
MenuItem {} {
|
||||||
label {Vary color}
|
label {Vary color}
|
||||||
callback {Waveform::vary_color = menu_picked_value( o );
|
callback {Waveform::vary_color = menu_picked_value( o );
|
||||||
|
|
||||||
timeline->redraw();}
|
timeline->redraw();}
|
||||||
xywh {20 20 40 25} type Toggle value 1
|
xywh {25 25 40 25} type Toggle value 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
Submenu {} {
|
||||||
Submenu {} {
|
label {&Region} open
|
||||||
label {&Region} open
|
xywh {5 5 74 25}
|
||||||
xywh {0 0 74 25}
|
} {
|
||||||
} {
|
MenuItem {} {
|
||||||
MenuItem {} {
|
label {Filled fades}
|
||||||
label {Filled fades}
|
xywh {35 35 40 25} type Toggle value 1
|
||||||
xywh {30 30 40 25} type Toggle value 1
|
}
|
||||||
}
|
MenuItem {} {
|
||||||
MenuItem {} {
|
label {Inherit track color}
|
||||||
label {Inherit track color}
|
callback {Audio_Region::inherit_track_color = menu_picked_value( o );
|
||||||
callback {Audio_Region::inherit_track_color = menu_picked_value( o );
|
|
||||||
|
|
||||||
timeline->redraw();}
|
timeline->redraw();}
|
||||||
xywh {40 40 40 25} type Toggle value 1
|
xywh {45 45 40 25} type Toggle value 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
Submenu {} {
|
||||||
Submenu {} {
|
label {&Control Sequence} open
|
||||||
label {&Control Sequence} open
|
xywh {5 5 74 25}
|
||||||
xywh {0 0 74 25}
|
} {
|
||||||
} {
|
MenuItem {} {
|
||||||
MenuItem {} {
|
label Polygon
|
||||||
label Polygon
|
callback {Control_Sequence::draw_with_polygon = menu_picked_value( o );
|
||||||
callback {Control_Sequence::draw_with_polygon = menu_picked_value( o );
|
|
||||||
|
|
||||||
timeline->redraw();}
|
timeline->redraw();}
|
||||||
xywh {20 20 40 25} type Toggle value 1
|
xywh {25 25 40 25} type Toggle value 1
|
||||||
}
|
}
|
||||||
MenuItem {} {
|
MenuItem {} {
|
||||||
label Graded
|
label Graded
|
||||||
callback {Control_Sequence::draw_with_gradient = menu_picked_value( o );
|
callback {Control_Sequence::draw_with_gradient = menu_picked_value( o );
|
||||||
|
|
||||||
timeline->redraw();}
|
timeline->redraw();}
|
||||||
xywh {30 30 40 25} type Toggle value 1
|
xywh {35 35 40 25} type Toggle value 1
|
||||||
}
|
}
|
||||||
MenuItem {} {
|
MenuItem {} {
|
||||||
label Ruled
|
label Ruled
|
||||||
callback {Control_Sequence::draw_with_grid = menu_picked_value( o );
|
callback {Control_Sequence::draw_with_grid = menu_picked_value( o );
|
||||||
|
|
||||||
timeline->redraw();}
|
timeline->redraw();}
|
||||||
xywh {40 40 40 25} type Toggle value 1
|
xywh {45 45 40 25} type Toggle value 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
Submenu {} {
|
||||||
Submenu {} {
|
label {&Style} open
|
||||||
label {&Style} open
|
xywh {5 5 74 25}
|
||||||
xywh {0 0 74 25}
|
} {
|
||||||
} {
|
MenuItem {} {
|
||||||
MenuItem {} {
|
label Default
|
||||||
label Default
|
callback {Fl::scheme( "plastic" );}
|
||||||
callback {Fl::scheme( "plastic" );}
|
xywh {5 5 40 25} type Radio value 1
|
||||||
xywh {0 0 40 25} type Radio value 1
|
}
|
||||||
|
MenuItem {} {
|
||||||
|
label Flat
|
||||||
|
callback {Fl::scheme( "gtk+" );}
|
||||||
|
xywh {15 15 40 25} type Radio
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MenuItem {} {
|
Submenu {} {
|
||||||
label Flat
|
label {C&olors} open
|
||||||
callback {Fl::scheme( "gtk+" );}
|
xywh {5 5 74 25}
|
||||||
xywh {10 10 40 25} type Radio
|
} {
|
||||||
}
|
MenuItem {} {
|
||||||
}
|
label System
|
||||||
Submenu {} {
|
callback {//Fl::get_system_colors();
|
||||||
label {C&olors} open
|
|
||||||
xywh {0 0 74 25}
|
|
||||||
} {
|
|
||||||
MenuItem {} {
|
|
||||||
label System
|
|
||||||
callback {//Fl::get_system_colors();
|
|
||||||
|
|
||||||
unsigned char r, g, b;
|
unsigned char r, g, b;
|
||||||
|
|
||||||
|
@ -495,28 +455,78 @@ Fl::get_color( system_colors[ 2 ], r, g, b );
|
||||||
Fl::background2( r, g, b );
|
Fl::background2( r, g, b );
|
||||||
|
|
||||||
Fl::scheme( Fl::scheme() );}
|
Fl::scheme( Fl::scheme() );}
|
||||||
xywh {0 0 40 25} type Radio
|
xywh {5 5 40 25} type Radio
|
||||||
}
|
}
|
||||||
MenuItem {} {
|
MenuItem {} {
|
||||||
label Dark
|
label Dark
|
||||||
callback {Fl::background2( 100, 100, 100 );
|
callback {Fl::background2( 100, 100, 100 );
|
||||||
Fl::background( 50, 50, 50 );
|
Fl::background( 50, 50, 50 );
|
||||||
Fl::foreground( 255, 255, 255 );
|
Fl::foreground( 255, 255, 255 );
|
||||||
|
|
||||||
Fl::scheme( Fl::scheme() );}
|
Fl::scheme( Fl::scheme() );}
|
||||||
xywh {10 10 40 25} type Radio value 1
|
xywh {15 15 40 25} type Radio value 1
|
||||||
}
|
}
|
||||||
MenuItem {} {
|
MenuItem {} {
|
||||||
label Light
|
label Light
|
||||||
callback {Fl::background2( 192, 192, 192 );
|
callback {Fl::background2( 192, 192, 192 );
|
||||||
Fl::background( 220, 220, 220 );
|
Fl::background( 220, 220, 220 );
|
||||||
Fl::foreground( 0, 0, 0 );
|
Fl::foreground( 0, 0, 0 );
|
||||||
|
|
||||||
Fl::scheme( Fl::scheme() );}
|
Fl::scheme( Fl::scheme() );}
|
||||||
xywh {20 20 40 25} type Radio
|
xywh {25 25 40 25} type Radio
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Submenu {} {
|
||||||
|
label {&Project} open
|
||||||
|
xywh {0 0 74 25}
|
||||||
|
} {
|
||||||
|
Submenu {} {
|
||||||
|
label {&Timeline} open
|
||||||
|
xywh {10 10 74 25}
|
||||||
|
} {
|
||||||
|
MenuItem {} {
|
||||||
|
label {&Follow Playhead}
|
||||||
|
callback {Timeline::follow_playhead = menu_picked_value( o );}
|
||||||
|
xywh {30 30 40 25} type Toggle value 1
|
||||||
|
}
|
||||||
|
MenuItem {} {
|
||||||
|
label {&Center Playhead}
|
||||||
|
callback {Timeline::center_playhead = menu_picked_value( o );}
|
||||||
|
xywh {40 40 40 25} type Toggle value 1
|
||||||
|
}
|
||||||
|
Submenu {} {
|
||||||
|
label {&Snap to} open
|
||||||
|
xywh {10 10 74 25}
|
||||||
|
} {
|
||||||
|
MenuItem {} {
|
||||||
|
label Bars
|
||||||
|
callback {Timeline::snap_to = Timeline::Bars;}
|
||||||
|
xywh {10 10 40 25} type Radio value 1
|
||||||
|
}
|
||||||
|
MenuItem {} {
|
||||||
|
label Beats
|
||||||
|
callback {Timeline::snap_to = Timeline::Beats;}
|
||||||
|
xywh {20 20 40 25} type Radio
|
||||||
|
}
|
||||||
|
MenuItem {} {
|
||||||
|
label Off
|
||||||
|
callback {Timeline::snap_to = Timeline::None;}
|
||||||
|
xywh {30 30 40 25} type Radio
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MenuItem {} {
|
||||||
|
label {Magnetic snap}
|
||||||
|
callback {Timeline::snap_magnetic = menu_picked_value( o );}
|
||||||
|
xywh {20 20 40 25} type Toggle value 1
|
||||||
|
}
|
||||||
|
Submenu {} {
|
||||||
|
label {Capture Format} open
|
||||||
|
xywh {10 10 74 25}
|
||||||
|
} {}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Submenu {} {
|
Submenu {} {
|
||||||
label {&Help} open
|
label {&Help} open
|
||||||
|
@ -635,7 +645,7 @@ if ( ! Project::open() )
|
||||||
find_item( m, "&Project/&Compact" )->deactivate();
|
find_item( m, "&Project/&Compact" )->deactivate();
|
||||||
find_item( m, "&Project/&Info" )->deactivate();
|
find_item( m, "&Project/&Info" )->deactivate();
|
||||||
|
|
||||||
find_item( m, "&Timeline" )->deactivate();
|
find_item( m, "&Options/&Project/&Timeline" )->deactivate();
|
||||||
|
|
||||||
timeline->deactivate();
|
timeline->deactivate();
|
||||||
transport->deactivate();
|
transport->deactivate();
|
||||||
|
@ -646,7 +656,7 @@ else
|
||||||
find_item( m, "&Project/&Compact" )->activate();
|
find_item( m, "&Project/&Compact" )->activate();
|
||||||
find_item( m, "&Project/&Info" )->activate();
|
find_item( m, "&Project/&Info" )->activate();
|
||||||
|
|
||||||
find_item( m, "&Timeline" )->activate();
|
find_item( m, "&Options/&Project/&Timeline" )->activate();
|
||||||
|
|
||||||
timeline->activate();
|
timeline->activate();
|
||||||
transport->activate();
|
transport->activate();
|
||||||
|
@ -758,14 +768,14 @@ You should have received a copy of the GNU General Public License along with thi
|
||||||
code {if ( Project::open() )
|
code {if ( Project::open() )
|
||||||
{
|
{
|
||||||
// save project local options (Timeline menu)
|
// save project local options (Timeline menu)
|
||||||
((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Timeline" ), "options" );
|
((Fl_Menu_Settings*)menubar)->dump( menubar->find_item( "&Options/&Project" ), "options" );
|
||||||
}} {}
|
}} {}
|
||||||
}
|
}
|
||||||
Function {load_timeline_settings()} {open
|
Function {load_timeline_settings()} {open
|
||||||
} {
|
} {
|
||||||
code {if ( Project::open() )
|
code {if ( Project::open() )
|
||||||
{
|
{
|
||||||
((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Timeline" ), "options" );
|
((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Options/&Project" ), "options" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -140,6 +140,64 @@ Timeline::cb_scroll ( Fl_Widget *w )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <FL/Fl_Menu.H>
|
||||||
|
|
||||||
|
void
|
||||||
|
Timeline::menu_cb ( Fl_Widget *w, void *v )
|
||||||
|
{
|
||||||
|
((Timeline*)v)->menu_cb( w );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Timeline::menu_cb ( Fl_Widget *w )
|
||||||
|
{
|
||||||
|
Fl_Menu_ *m = static_cast<Fl_Menu_*>(w);
|
||||||
|
|
||||||
|
const char *picked = m->mvalue()->label();
|
||||||
|
|
||||||
|
|
||||||
|
/* m->item_pathname( picked, sizeof( picked ) ); */
|
||||||
|
|
||||||
|
DMESSAGE( "%s", picked );
|
||||||
|
|
||||||
|
if ( ! strcmp( picked, "Add Audio Track" ) )
|
||||||
|
{
|
||||||
|
/* FIXME: prompt for I/O config? */
|
||||||
|
|
||||||
|
Loggable::block_start();
|
||||||
|
|
||||||
|
/* add audio track */
|
||||||
|
char *name = get_unique_track_name( "Audio" );
|
||||||
|
|
||||||
|
Track *t = new Track( name );
|
||||||
|
|
||||||
|
Audio_Sequence *o = new Audio_Sequence( t );
|
||||||
|
|
||||||
|
add_track( t );
|
||||||
|
|
||||||
|
t->sequence( o );
|
||||||
|
|
||||||
|
Loggable::block_end();
|
||||||
|
}
|
||||||
|
else if ( ! strcmp( picked, "Tempo from range" ) )
|
||||||
|
{
|
||||||
|
if ( p1 != p2 )
|
||||||
|
{
|
||||||
|
if ( p1 > p2 )
|
||||||
|
{
|
||||||
|
nframes_t t = p2;
|
||||||
|
p2 = p1;
|
||||||
|
p1 = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
beats_per_minute( p1, sample_rate() * 60 / (float)( p2 - p1 ) );
|
||||||
|
|
||||||
|
p2 = p1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
WARNING( "programming error: Unknown menu item" );
|
||||||
|
}
|
||||||
|
|
||||||
Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Window( X, Y, W, H, L )
|
Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Window( X, Y, W, H, L )
|
||||||
{
|
{
|
||||||
|
@ -155,6 +213,13 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi
|
||||||
|
|
||||||
p1 = p2 = 0;
|
p1 = p2 = 0;
|
||||||
|
|
||||||
|
menu = new Fl_Menu;
|
||||||
|
|
||||||
|
/* menu->add( "Add Track", 0, 0, 0 ); */
|
||||||
|
|
||||||
|
menu->add( "Add Audio Track", 'a', &Timeline::menu_cb, this );
|
||||||
|
menu->add( "Tempo from range", 't', &Timeline::menu_cb, this );
|
||||||
|
|
||||||
{
|
{
|
||||||
Scalebar *o = new Scalebar( X, Y + H - 18, W - 18, 18 );
|
Scalebar *o = new Scalebar( X, Y + H - 18, W - 18, 18 );
|
||||||
|
|
||||||
|
@ -324,8 +389,8 @@ nearest_line_cb ( nframes_t frame, const BBT &bbt, void *arg )
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set the value pointed to by /frame/ to the frame number of the of
|
/** Set the value pointed to by /frame/ to the frame number of the of
|
||||||
the nearest measure line to /when/. Returns true if the new value of
|
the nearest measure line to /when/. Returns true if the new value of
|
||||||
*frame is valid, false otherwise. */
|
*frame is valid, false otherwise. */
|
||||||
bool
|
bool
|
||||||
Timeline::nearest_line ( nframes_t when, nframes_t *frame ) const
|
Timeline::nearest_line ( nframes_t when, nframes_t *frame ) const
|
||||||
{
|
{
|
||||||
|
@ -388,7 +453,7 @@ Timeline::update_tempomap ( void )
|
||||||
_tempomap.push_back( *i );
|
_tempomap.push_back( *i );
|
||||||
|
|
||||||
/* FIXME: shouldn't we ensure that time points always precede
|
/* FIXME: shouldn't we ensure that time points always precede
|
||||||
tempo points at the same position? */
|
tempo points at the same position? */
|
||||||
_tempomap.sort( Sequence_Widget::sort_func );
|
_tempomap.sort( Sequence_Widget::sort_func );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -924,24 +989,6 @@ Timeline::handle ( int m )
|
||||||
redraw();
|
redraw();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
case 't':
|
|
||||||
{
|
|
||||||
if ( p1 != p2 )
|
|
||||||
{
|
|
||||||
if ( p1 > p2 )
|
|
||||||
{
|
|
||||||
nframes_t t = p2;
|
|
||||||
p2 = p1;
|
|
||||||
p1 = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
beats_per_minute( p1, sample_rate() * 60 / (float)( p2 - p1 ) );
|
|
||||||
|
|
||||||
p2 = p1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
return Fl_Overlay_Window::handle( m );
|
return Fl_Overlay_Window::handle( m );
|
||||||
}
|
}
|
||||||
|
@ -981,36 +1028,20 @@ Timeline::handle ( int m )
|
||||||
}
|
}
|
||||||
else if ( Fl::test_shortcut( FL_BUTTON3 ) && ! Fl::event_shift() )
|
else if ( Fl::test_shortcut( FL_BUTTON3 ) && ! Fl::event_shift() )
|
||||||
{
|
{
|
||||||
Fl_Menu_Item menu[] =
|
|
||||||
{
|
/* Fl_Menu_Item menu[] = */
|
||||||
{ "Add Track", 0, 0, 0, FL_SUBMENU },
|
/* { */
|
||||||
{ "Audio", 0, 0, 0 },
|
/* { "Add Track", 0, 0, 0, FL_SUBMENU }, */
|
||||||
{ 0 },
|
/* { "Audio", 0, 0, 0 }, */
|
||||||
{ 0 },
|
/* { 0 }, */
|
||||||
};
|
/* { 0 }, */
|
||||||
|
/* }; */
|
||||||
|
|
||||||
const Fl_Menu_Item *r = menu->popup( X, Y, "Timeline" );
|
const Fl_Menu_Item *r = menu->popup( X, Y, "Timeline" );
|
||||||
|
if ( r )
|
||||||
if ( r == &menu[1] )
|
|
||||||
{
|
{
|
||||||
/* FIXME: prompt for I/O config? */
|
((Fl_Menu_*)(menu))->value( r );
|
||||||
|
r->do_callback( (Fl_Widget*)menu );
|
||||||
Loggable::block_start();
|
|
||||||
|
|
||||||
/* add audio track */
|
|
||||||
char *name = get_unique_track_name( "Audio" );
|
|
||||||
|
|
||||||
Track *t = new Track( name );
|
|
||||||
|
|
||||||
Audio_Sequence *o = new Audio_Sequence( t );
|
|
||||||
|
|
||||||
// new Control_Sequence( t );
|
|
||||||
|
|
||||||
add_track( t );
|
|
||||||
|
|
||||||
t->sequence( o );
|
|
||||||
|
|
||||||
Loggable::block_end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,8 @@ class Fl_Pack;
|
||||||
class Fl_Scrollbar;
|
class Fl_Scrollbar;
|
||||||
class Fl_Widget;
|
class Fl_Widget;
|
||||||
|
|
||||||
|
#include <FL/Fl_Menu.H>
|
||||||
|
|
||||||
class Timeline;
|
class Timeline;
|
||||||
extern Timeline *timeline;
|
extern Timeline *timeline;
|
||||||
|
|
||||||
|
@ -92,10 +94,11 @@ class Timeline : public Fl_Overlay_Window, public RWLock
|
||||||
Scalebar *hscroll;
|
Scalebar *hscroll;
|
||||||
Fl_Scrollbar *vscroll;
|
Fl_Scrollbar *vscroll;
|
||||||
|
|
||||||
|
|
||||||
void adjust_vscroll ( void );
|
void adjust_vscroll ( void );
|
||||||
static void cb_scroll ( Fl_Widget *w, void *v );
|
static void cb_scroll ( Fl_Widget *w, void *v );
|
||||||
void cb_scroll ( Fl_Widget *w );
|
void cb_scroll ( Fl_Widget *w );
|
||||||
|
static void menu_cb ( Fl_Widget *w, void *v );
|
||||||
|
void menu_cb ( Fl_Widget *w );
|
||||||
|
|
||||||
int _fpp; /* frames per pixel, power of two */
|
int _fpp; /* frames per pixel, power of two */
|
||||||
nframes_t _length;
|
nframes_t _length;
|
||||||
|
@ -127,6 +130,7 @@ public:
|
||||||
Time_Sequence *time_track;
|
Time_Sequence *time_track;
|
||||||
Annotation_Sequence *ruler_track;
|
Annotation_Sequence *ruler_track;
|
||||||
|
|
||||||
|
Fl_Menu *menu;
|
||||||
|
|
||||||
nframes_t xoffset;
|
nframes_t xoffset;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue