Update menubar entires to reflect session state.
This commit is contained in:
parent
2881479cc2
commit
31e40639d2
|
@ -33,6 +33,7 @@ session state belongs to Timeline and other classes. */
|
|||
|
||||
#include "debug.h"
|
||||
char Session::_name[256];
|
||||
bool Session::_is_open = false;
|
||||
|
||||
void
|
||||
Session::set_name ( const char *name )
|
||||
|
@ -60,6 +61,8 @@ bool
|
|||
Session::close ( void )
|
||||
{
|
||||
Loggable::close();
|
||||
|
||||
_is_open = false;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -84,6 +87,8 @@ Session::open ( const char *name )
|
|||
|
||||
set_name( name );
|
||||
|
||||
_is_open = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ const char user_template_dir[] = "~/.non-daw/templates";
|
|||
class Session
|
||||
{
|
||||
|
||||
static bool _is_open;
|
||||
static char _name[256];
|
||||
|
||||
public:
|
||||
|
@ -32,6 +33,7 @@ public:
|
|||
static void set_name ( const char *name );
|
||||
static bool close ( void );
|
||||
static bool open ( const char *name );
|
||||
static bool open ( void ) { return _is_open; }
|
||||
static bool create ( const char *name, const char *template_name );
|
||||
|
||||
};
|
||||
|
|
|
@ -76,6 +76,14 @@ free( path );
|
|||
code {Fl_Menu_ *o = menubar;
|
||||
|
||||
Track::capture_format = o->menu()[ o->value() ].label();} {}
|
||||
}
|
||||
Function {run()} {open
|
||||
} {
|
||||
code {update_menu();
|
||||
|
||||
main_window->show();
|
||||
|
||||
Fl::run();} {}
|
||||
}
|
||||
Function {TLE()} {open
|
||||
} {
|
||||
|
@ -119,7 +127,7 @@ free( path );} {}
|
|||
} {
|
||||
Fl_Window main_window {
|
||||
label {Non-DAW - Timeline} open
|
||||
xywh {257 179 1020 765} type Double resizable xclass {Non-DAW} visible
|
||||
xywh {353 133 1020 765} type Double resizable xclass {Non-DAW} visible
|
||||
} {
|
||||
Fl_Menu_Bar menubar {open
|
||||
xywh {0 0 1024 25}
|
||||
|
@ -134,13 +142,11 @@ free( path );} {}
|
|||
}
|
||||
MenuItem {} {
|
||||
label {&New}
|
||||
callback {if ( new_session_chooser() )
|
||||
{
|
||||
transport->activate();
|
||||
timeline->activate();
|
||||
}
|
||||
callback {new_session_chooser();
|
||||
|
||||
main_window->redraw();} selected
|
||||
update_menu();
|
||||
|
||||
main_window->redraw();}
|
||||
xywh {0 0 40 25}
|
||||
}
|
||||
MenuItem {} {
|
||||
|
@ -148,20 +154,15 @@ main_window->redraw();} selected
|
|||
callback {const char *name = fl_dir_chooser( "Open Session", NULL, NULL );
|
||||
|
||||
Session::close();
|
||||
timeline->deactivate();
|
||||
transport->deactivate();
|
||||
|
||||
if ( ! Session::open( name ) )
|
||||
{
|
||||
fl_alert( "Could not open \\"%s\\" as a Non-DAW session!", name );
|
||||
|
||||
// we are in a somewhar ambiguous state now with no session open.
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
timeline->activate();
|
||||
transport->activate();}
|
||||
update_menu();}
|
||||
xywh {10 10 40 25}
|
||||
}
|
||||
MenuItem {} {
|
||||
|
@ -175,7 +176,7 @@ Loggable::compact();}
|
|||
xywh {20 20 40 25}
|
||||
}
|
||||
Submenu {} {
|
||||
label Export open
|
||||
label {&Export} open
|
||||
xywh {0 0 74 25} deactivate
|
||||
} {
|
||||
MenuItem {} {
|
||||
|
@ -578,6 +579,33 @@ delete win;}
|
|||
}
|
||||
}
|
||||
}
|
||||
Function {find_item( Fl_Menu_ *menu, const char *path )} {open selected return_type {static Fl_Menu_Item *}
|
||||
} {
|
||||
code {return const_cast<Fl_Menu_Item*>(menu->find_item( path ));} {}
|
||||
}
|
||||
Function {update_menu()} {open
|
||||
} {
|
||||
code {Fl_Menu_Bar *m = menubar;
|
||||
|
||||
if ( ! Session::open() )
|
||||
{
|
||||
find_item( m, "&Session/&Export" )->deactivate();
|
||||
find_item( m, "&Session/&Compact" )->deactivate();
|
||||
find_item( m, "&Session/&Info" )->deactivate();
|
||||
|
||||
timeline->deactivate();
|
||||
transport->deactivate();
|
||||
}
|
||||
else
|
||||
{
|
||||
find_item( m, "&Session/&Export" )->activate();
|
||||
find_item( m, "&Session/&Compact" )->activate();
|
||||
find_item( m, "&Session/&Info" )->activate();
|
||||
|
||||
timeline->activate();
|
||||
transport->activate();
|
||||
}} {}
|
||||
}
|
||||
Function {update_progress( Fl_Progress *p, char *s, float v )} {open private return_type {static void}
|
||||
} {
|
||||
code {p->value( v );
|
||||
|
@ -663,7 +691,7 @@ class New_Session_Dialog {open
|
|||
} {
|
||||
code {make_window();} {}
|
||||
}
|
||||
Function {run()} {open return_type {const char *}
|
||||
Function {run()} {open return_type void
|
||||
} {
|
||||
code {_window->show();
|
||||
|
||||
|
@ -736,9 +764,9 @@ while ( _window->shown() )
|
|||
}
|
||||
}
|
||||
|
||||
Function {new_session_chooser()} {open C return_type {const char *}
|
||||
Function {new_session_chooser()} {open C return_type void
|
||||
} {
|
||||
code {New_Session_Dialog nsd;
|
||||
|
||||
return nsd.run();} {}
|
||||
nsd.run();} {}
|
||||
}
|
||||
|
|
|
@ -86,16 +86,16 @@ int
|
|||
main ( int argc, char **argv )
|
||||
{
|
||||
/* welcome to C++ */
|
||||
LOG_REGISTER_CREATE( Audio_Region );
|
||||
LOG_REGISTER_CREATE( Time_Point );
|
||||
LOG_REGISTER_CREATE( Tempo_Point );
|
||||
LOG_REGISTER_CREATE( Annotation_Point );
|
||||
LOG_REGISTER_CREATE( Annotation_Region );
|
||||
LOG_REGISTER_CREATE( Control_Point );
|
||||
LOG_REGISTER_CREATE( Track );
|
||||
LOG_REGISTER_CREATE( Audio_Sequence );
|
||||
LOG_REGISTER_CREATE( Control_Sequence );
|
||||
LOG_REGISTER_CREATE( Annotation_Sequence );
|
||||
LOG_REGISTER_CREATE( Audio_Region );
|
||||
LOG_REGISTER_CREATE( Audio_Sequence );
|
||||
LOG_REGISTER_CREATE( Control_Point );
|
||||
LOG_REGISTER_CREATE( Control_Sequence );
|
||||
LOG_REGISTER_CREATE( Tempo_Point );
|
||||
LOG_REGISTER_CREATE( Time_Point );
|
||||
LOG_REGISTER_CREATE( Track );
|
||||
|
||||
init_boxtypes();
|
||||
|
||||
|
@ -124,7 +124,5 @@ main ( int argc, char **argv )
|
|||
|
||||
MESSAGE( "Starting GUI" );
|
||||
// tle.main_window->show( argc, argv );
|
||||
tle.main_window->show();
|
||||
|
||||
Fl::run();
|
||||
tle.run();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue