Don't trash memory with timeline menu stuff.

This commit is contained in:
Jonathan Moore Liles 2008-05-25 15:48:37 -05:00
parent 9b38190211
commit d2afffbb7c
3 changed files with 17 additions and 27 deletions

View File

@ -111,13 +111,6 @@ 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();
@ -156,7 +149,11 @@ menubar->picked( menubar->find_item( "&Options/&Project/&Timeline/Capture Format
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/&Global" ), path ); ((Fl_Menu_Settings*)menubar)->load( menubar->find_item( "&Options/&Global" ), path );
free( path );} {} free( path );
menubar->add( "&Timeline", 0, 0, const_cast< Fl_Menu_Item *>( timeline->menu->menu() ), FL_SUBMENU_POINTER );} {selected
}
} }
Function {make_window()} {open Function {make_window()} {open
} { } {
@ -283,7 +280,7 @@ Loggable::compact();}
} }
MenuItem {} { MenuItem {} {
label {&Timeline} label {&Timeline}
xywh {5 5 40 25} xywh {0 0 40 25}
} }
Submenu {} { Submenu {} {
label {&View} open label {&View} open
@ -665,8 +662,7 @@ else
} }
m->redraw(); m->redraw();
project_name->redraw();} {selected project_name->redraw();} {}
}
} }
Function {update_progress( Fl_Progress *p, char *s, float v )} {open private return_type {static void} Function {update_progress( Fl_Progress *p, char *s, float v )} {open private return_type {static void}
} { } {

View File

@ -25,6 +25,9 @@
#include <FL/fl_draw.H> #include <FL/fl_draw.H>
#include <FL/Fl_Scrollbar.H> #include <FL/Fl_Scrollbar.H>
#include <FL/Fl_Menu_Button.H>
#include "Timeline.H" #include "Timeline.H"
#include "Tempo_Sequence.H" #include "Tempo_Sequence.H"
#include "Time_Sequence.H" #include "Time_Sequence.H"
@ -155,7 +158,6 @@ Timeline::menu_cb ( Fl_Widget *w )
const char *picked = m->mvalue()->label(); const char *picked = m->mvalue()->label();
/* m->item_pathname( picked, sizeof( picked ) ); */ /* m->item_pathname( picked, sizeof( picked ) ); */
DMESSAGE( "%s", picked ); DMESSAGE( "%s", picked );
@ -232,6 +234,7 @@ Timeline::menu_cb ( Fl_Widget *w )
WARNING( "programming error: Unknown menu item" ); 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 )
{ {
_sample_rate = 0; _sample_rate = 0;
@ -246,7 +249,7 @@ 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 = new Fl_Menu_Button( 0, 0, 0, 0, "Timeline" );
/* menu->add( "Add Track", 0, 0, 0 ); */ /* menu->add( "Add Track", 0, 0, 0 ); */
@ -1026,20 +1029,11 @@ Timeline::handle ( int m )
} }
else if ( Fl::test_shortcut( FL_BUTTON3 ) && ! Fl::event_shift() ) else if ( Fl::test_shortcut( FL_BUTTON3 ) && ! Fl::event_shift() )
{ {
const Fl_Menu_Item *r = menu->menu()->popup( X, Y, "Timeline" );
/* Fl_Menu_Item menu[] = */
/* { */
/* { "Add Track", 0, 0, 0, FL_SUBMENU }, */
/* { "Audio", 0, 0, 0 }, */
/* { 0 }, */
/* { 0 }, */
/* }; */
const Fl_Menu_Item *r = menu->popup( X, Y, "Timeline" );
if ( r ) if ( r )
{ {
((Fl_Menu_*)(menu))->value( r ); menu->value( r );
r->do_callback( (Fl_Widget*)menu ); r->do_callback( static_cast<Fl_Widget*>(menu) );
} }
} }

View File

@ -36,7 +36,7 @@ class Fl_Pack;
class Fl_Scrollbar; class Fl_Scrollbar;
class Fl_Widget; class Fl_Widget;
#include <FL/Fl_Menu.H> class Fl_Menu_Button;
class Timeline; class Timeline;
extern Timeline *timeline; extern Timeline *timeline;
@ -130,7 +130,7 @@ public:
Time_Sequence *time_track; Time_Sequence *time_track;
Annotation_Sequence *ruler_track; Annotation_Sequence *ruler_track;
Fl_Menu *menu; Fl_Menu_Button *menu;
nframes_t xoffset; nframes_t xoffset;