NSM: Clean up session selection behavior.

This commit is contained in:
Jonathan Moore Liles 2013-04-05 19:06:50 -07:00
parent 271eb2d331
commit 4103cd016b
2 changed files with 28 additions and 15 deletions

View File

@ -1080,7 +1080,7 @@ close_session ( )
if ( gui_is_active )
{
osc_server->send( gui_addr, "/nsm/gui/session/name", "" );
osc_server->send( gui_addr, "/nsm/gui/session/name", "", "" );
}
}
@ -1239,7 +1239,7 @@ load_session_file ( const char * path )
if ( gui_is_active )
{
osc_server->send( gui_addr, "/nsm/gui/session/name", session_name );
osc_server->send( gui_addr, "/nsm/gui/session/name", session_name, session_path + strlen( session_root ));
}
return ERR_OK;
@ -1421,7 +1421,8 @@ OSC_HANDLER( new )
if ( gui_is_active )
{
osc_server->send( gui_addr, "/nsm/gui/session/session", &argv[0]->s );
osc_server->send( gui_addr, "/nsm/gui/session/name", &argv[0]->s );
osc_server->send( gui_addr, "/nsm/gui/session/name", &argv[0]->s, &argv[0]->s );
}
save_session_file();
@ -2045,7 +2046,7 @@ announce_gui( const char *url, bool is_reply )
}
osc_server->send( gui_addr, "/nsm/gui/session/name", session_name ? session_name : "" );
osc_server->send( gui_addr, "/nsm/gui/session/name", session_name ? session_name : "", session_path ? session_path : "" );
DMESSAGE( "Registered with GUI" );
}

View File

@ -566,13 +566,11 @@ public:
if ( ! name )
return;
Fl_Tree_Item *item = session_browser->find_item( name );
MESSAGE( "Sending open for: %s", name );
foreach_daemon ( d )
{
osc->send( (*d)->addr, "/nsm/server/open", name );
}
if ( item )
session_browser->select_only( item, 1 );
}
else if ( w == duplicate_button )
{
@ -603,7 +601,7 @@ public:
Fl_Tree_Item *item = session_browser->callback_item();
session_browser->deselect( item, 0 );
// session_browser->deselect( item, 0 );
if ( item->children() )
return;
@ -852,7 +850,7 @@ public:
o->type( Fl_Pack::HORIZONTAL );
o->box( FL_NO_BOX );
{ Fl_Button *o = refresh_button = new Fl_Button( 0, 0, 80, 50, "&Refresh" );
o->shortcut( FL_CTRL | 'r' );
o->shortcut( FL_CTRL | 'r' );
o->box( FL_UP_BOX );
o->callback( cb_handle, (void*)this );
}
@ -942,7 +940,7 @@ public:
o->end();
}
o->end();
Fl_Group::current()->resizable( o );
Fl_Group::current()->resizable( o );
} // Fl_Packscroller
o->end();
/* Fl_Group::current()->resizable( o ); */
@ -1014,7 +1012,7 @@ public:
osc->add_method( "/nsm/gui/server_announce", "s", osc_handler, osc, "msg" );
osc->add_method( "/nsm/gui/gui_announce", "s", osc_handler, osc, "msg" );
osc->add_method( "/nsm/gui/session/session", "s", osc_handler, osc, "path,display_name" );
osc->add_method( "/nsm/gui/session/name", "s", osc_handler, osc, "path,display_name" );
osc->add_method( "/nsm/gui/session/name", "ss", osc_handler, osc, "path,display_name" );
osc->add_method( "/nsm/gui/client/new", "ss", osc_handler, osc, "path,display_name" );
osc->add_method( "/nsm/gui/client/status", "ss", osc_handler, osc, "path,display_name" );
osc->add_method( "/nsm/gui/client/switch", "ss", osc_handler, osc, "path,display_name" );
@ -1109,9 +1107,23 @@ private:
osc->send( d->addr, "/nsm/server/list" );
}
else if ( !strcmp( path, "/nsm/gui/session/name" ) &&
!strcmp( types, "s" ))
!strcmp( types, "ss" ))
{
controller->session_name( &argv[0]->s );
if ( !strcmp( &argv[0]->s, "" ) )
{
controller->session_browser->deselect_all();
}
else
{
Fl_Tree_Item *o = controller->session_browser->find_item( &argv[1]->s );
if ( o )
{
controller->session_browser->select_only( o, 0 );
controller->session_browser->show_item( o, 0 );
}
}
}
else if (!strcmp( path, "/error" ) &&
!strcmp( types, "sis" ) )