13
0

fix logic problems with startup assistant; make initial page buttons of startup activatable to save mousing; grow recent sessions scrolled window if there are more than 4 recent sessions to display

git-svn-id: svn://localhost/ardour2/branches/3.0@6244 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2009-12-01 13:23:27 +00:00
parent 23531b0fa5
commit ea08bbe621
4 changed files with 49 additions and 31 deletions

View File

@ -296,11 +296,14 @@ ARDOUR_UI::run_startup (bool should_be_new)
main().run();
/* we don't return here until the startup assistant is finished */
_startup->hide ();
return _startup->applying ();
switch (_startup->response()) {
case RESPONSE_OK:
return true;
default:
return false;
}
}
int

View File

@ -198,6 +198,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
void store_clock_modes ();
void restore_clock_modes ();
void reset_main_clocks ();
void add_route (Gtk::Window* float_window);

View File

@ -38,7 +38,7 @@ static string poor_mans_glob (string path)
ArdourStartup::ArdourStartup ()
: _applying (false)
: _response (RESPONSE_OK)
, ic_new_session_button (_("Open a new session"))
, ic_existing_session_button (_("Open an existing session"))
, monitor_via_hardware_button (_("Use an external mixer or the hardware mixer of your audio interface.\n\
@ -359,8 +359,12 @@ ArdourStartup::setup_initial_choice_page ()
centering_vbox->pack_start (ic_new_session_button, false, true);
centering_vbox->pack_start (ic_existing_session_button, false, true);
ic_new_session_button.signal_button_press_event().connect(mem_fun(*this, &ArdourStartup::initial_choice_activated), false);
ic_existing_session_button.signal_button_press_event().connect(mem_fun(*this, &ArdourStartup::initial_choice_activated), false);
ic_new_session_button.signal_button_press_event().connect(mem_fun(*this, &ArdourStartup::initial_button_press), false);
ic_new_session_button.signal_activate().connect(mem_fun(*this, &ArdourStartup::initial_button_activated), false);
ic_existing_session_button.signal_button_press_event().connect(mem_fun(*this, &ArdourStartup::initial_button_press), false);
ic_existing_session_button.signal_activate().connect(mem_fun(*this, &ArdourStartup::initial_button_activated), false);
centering_hbox->pack_start (*centering_vbox, true, true);
@ -380,15 +384,21 @@ ArdourStartup::setup_initial_choice_page ()
}
bool
ArdourStartup::initial_choice_activated(GdkEventButton *event)
ArdourStartup::initial_button_press (GdkEventButton *event)
{
if (event && event->type == GDK_2BUTTON_PRESS && session_page_index != -1)
{
set_current_page(session_page_index);
return true;
}
else
return false;
if (event && event->type == GDK_2BUTTON_PRESS && session_page_index != -1)
{
set_current_page(session_page_index);
return true;
} else {
return false;
}
}
void
ArdourStartup::initial_button_activated ()
{
set_current_page(session_page_index);
}
void
@ -418,24 +428,21 @@ ArdourStartup::setup_final_page ()
void
ArdourStartup::on_cancel ()
{
_applying = false;
_response = RESPONSE_CANCEL;
gtk_main_quit ();
}
void
ArdourStartup::on_close ()
bool
ArdourStartup::on_delete_event (GdkEventAny*)
{
_applying = false;
_response = RESPONSE_CLOSE;
gtk_main_quit ();
return true;
}
void
ArdourStartup::on_apply ()
{
_applying = true;
// XXX do stuff and then ....
if (engine_dialog) {
engine_dialog->setup_engine ();
}
@ -455,6 +462,7 @@ ArdourStartup::on_apply ()
Config->save_state ();
}
_response = RESPONSE_OK;
gtk_main_quit ();
}
@ -655,7 +663,7 @@ ArdourStartup::new_name_changed ()
}
}
void
int
ArdourStartup::redisplay_recent_sessions ()
{
std::vector<sys::path> session_directories;
@ -669,7 +677,7 @@ ArdourStartup::redisplay_recent_sessions ()
if (rs.empty()) {
recent_session_display.set_model (recent_session_model);
return;
return 0;
}
//
// sort them alphabetically
@ -734,6 +742,7 @@ ArdourStartup::redisplay_recent_sessions ()
}
recent_session_display.set_model (recent_session_model);
return rs.size();
}
void
@ -771,9 +780,13 @@ ArdourStartup::setup_existing_session_page ()
}
recent_scroller.show();
redisplay_recent_sessions ();
int cnt = redisplay_recent_sessions ();
recent_session_display.signal_row_activated().connect (mem_fun (*this, &ArdourStartup::recent_row_activated));
if (cnt > 4) {
recent_scroller.set_size_request (-1, 300);
}
session_hbox.pack_start (recent_scroller, true, true);
set_page_title (session_vbox, _("Select a session"));
set_page_type (session_vbox, ASSISTANT_PAGE_CONFIRM);

View File

@ -58,19 +58,19 @@ class ArdourStartup : public Gtk::Assistant {
bool connect_outs_to_master() const;
bool connect_outs_to_physical() const;
bool applying () const {
return _applying;
gint response () const {
return _response;
}
private:
bool _applying;
gint _response;
bool config_modified;
bool new_user;
bool new_only;
void on_apply ();
void on_cancel ();
void on_close ();
bool on_delete_event (GdkEventAny*);
void on_prepare (Gtk::Widget*);
static ArdourStartup *the_startup;
@ -95,7 +95,8 @@ class ArdourStartup : public Gtk::Assistant {
Gtk::VBox ic_vbox;
Gtk::RadioButton ic_new_session_button;
Gtk::RadioButton ic_existing_session_button;
bool initial_choice_activated(GdkEventButton *);
bool initial_button_press(GdkEventButton *);
void initial_button_activated();
/* monitoring choices */
@ -134,7 +135,7 @@ class ArdourStartup : public Gtk::Assistant {
Gtk::TreeView recent_session_display;
Glib::RefPtr<Gtk::TreeStore> recent_session_model;
Gtk::ScrolledWindow recent_scroller;
void redisplay_recent_sessions ();
int redisplay_recent_sessions ();
void recent_session_row_selected ();
void recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col);