summaryrefslogtreecommitdiff
path: root/gtk2_ardour/startup.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-07-26 01:55:08 +0000
committerCarl Hetherington <carl@carlh.net>2010-07-26 01:55:08 +0000
commit035de2a367acd7ee27c3dbfba2f6c71f3c137eb8 (patch)
treebb24d5914e0e020ef99a7015e850769090736eeb /gtk2_ardour/startup.cc
parentecb52013324b1e20736280e06da3600cd6dc5a0f (diff)
Add browse button to recent session dialogue. Fixes #3357.
git-svn-id: svn://localhost/ardour2/branches/3.0@7498 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/startup.cc')
-rw-r--r--gtk2_ardour/startup.cc95
1 files changed, 75 insertions, 20 deletions
diff --git a/gtk2_ardour/startup.cc b/gtk2_ardour/startup.cc
index e7d0db005e..1e8276a4fc 100644
--- a/gtk2_ardour/startup.cc
+++ b/gtk2_ardour/startup.cc
@@ -1,3 +1,22 @@
+/*
+ Copyright (C) 2010 Paul Davis
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
#include <fstream>
#include <algorithm>
@@ -44,12 +63,13 @@ ArdourStartup::ArdourStartup ()
, monitor_via_hardware_button (_("Use an external mixer or the hardware mixer of your audio interface.\n\
Ardour will play NO role in monitoring"))
, monitor_via_ardour_button (string_compose (_("Ask %1 to playback material as it is being recorded"), PROGRAM_NAME))
+ , _have_setup_existing_session_page (false)
, new_folder_chooser (FILE_CHOOSER_ACTION_SELECT_FOLDER)
, more_new_session_options_button (_("I'd like more options for this session"))
, _output_limit_count_adj (1, 0, 100, 1, 10, 0)
, _input_limit_count_adj (1, 0, 100, 1, 10, 0)
, _master_bus_channel_count_adj (2, 0, 100, 1, 10, 0)
-
+ , _existing_session_chooser_used (false)
{
audio_page_index = -1;
initial_choice_index = -1;
@@ -189,7 +209,12 @@ ArdourStartup::session_name (bool& should_be_new)
if (ic_new_session_button.get_active()) {
should_be_new = true;
return new_name_entry.get_text ();
+ } else if (_existing_session_chooser_used) {
+ /* existing session chosen from file chooser */
+ should_be_new = false;
+ return existing_session_chooser.get_filename ();
} else {
+ /* existing session chosen from recent list */
should_be_new = false;
TreeIter iter = recent_session_display.get_selection()->get_selected();
@@ -208,7 +233,11 @@ ArdourStartup::session_folder ()
if (ic_new_session_button.get_active()) {
Glib::ustring legal_session_folder_name = legalize_for_path (new_name_entry.get_text());
return Glib::build_filename (new_folder_chooser.get_current_folder(), legal_session_folder_name);
+ } else if (_existing_session_chooser_used) {
+ /* existing session chosen from file chooser */
+ return existing_session_chooser.get_current_folder ();
} else {
+ /* existing session chosen from recent list */
TreeIter iter = recent_session_display.get_selection()->get_selected();
if (iter) {
@@ -866,26 +895,25 @@ ArdourStartup::recent_session_row_selected ()
void
ArdourStartup::setup_existing_session_page ()
{
- if (!session_hbox.get_children().empty()) {
- session_hbox.remove (**session_hbox.get_children().begin());
- }
-
- if (recent_scroller.get_children().empty()) {
-
- recent_session_model = TreeStore::create (recent_session_columns);
- recent_session_display.set_model (recent_session_model);
- recent_session_display.append_column (_("Recent Sessions"), recent_session_columns.visible_name);
- recent_session_display.set_headers_visible (false);
- recent_session_display.get_selection()->set_mode (SELECTION_BROWSE);
-
- recent_session_display.get_selection()->signal_changed().connect (sigc::mem_fun (*this, &ArdourStartup::recent_session_row_selected));
-
- recent_scroller.add (recent_session_display);
- recent_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
- recent_scroller.set_shadow_type (Gtk::SHADOW_IN);
+ recent_session_model = TreeStore::create (recent_session_columns);
+ redisplay_recent_sessions ();
- recent_session_display.show();
+ if (_have_setup_existing_session_page) {
+ return;
}
+
+ recent_session_display.set_model (recent_session_model);
+ recent_session_display.append_column (_("Recent Sessions"), recent_session_columns.visible_name);
+ recent_session_display.set_headers_visible (false);
+ recent_session_display.get_selection()->set_mode (SELECTION_BROWSE);
+
+ recent_session_display.get_selection()->signal_changed().connect (sigc::mem_fun (*this, &ArdourStartup::recent_session_row_selected));
+
+ recent_scroller.add (recent_session_display);
+ recent_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
+ recent_scroller.set_shadow_type (Gtk::SHADOW_IN);
+
+ recent_session_display.show();
recent_scroller.show();
int cnt = redisplay_recent_sessions ();
@@ -895,9 +923,27 @@ ArdourStartup::setup_existing_session_page ()
recent_scroller.set_size_request (-1, 300);
}
- session_hbox.pack_start (recent_scroller, true, true);
+ VBox* vbox = manage (new VBox);
+ vbox->set_spacing (8);
+ vbox->pack_start (recent_scroller, true, true);
+
+ existing_session_chooser.set_title (_("Select session file"));
+ existing_session_chooser.signal_file_set().connect (sigc::mem_fun (*this, &ArdourStartup::existing_session_selected));
+
+ HBox* hbox = manage (new HBox);
+ hbox->set_spacing (4);
+ hbox->pack_start (*manage (new Label (_("Browse:"))), PACK_SHRINK);
+ hbox->pack_start (existing_session_chooser);
+ vbox->pack_start (*hbox);
+ hbox->show_all ();
+
+ vbox->show_all ();
+ session_hbox.pack_start (*vbox, true, true);
+
set_page_title (session_vbox, _("Select a session"));
set_page_type (session_vbox, ASSISTANT_PAGE_CONFIRM);
+
+ _have_setup_existing_session_page = true;
}
void
@@ -1227,3 +1273,12 @@ ArdourStartup::recent_row_activated (const Gtk::TreePath&, Gtk::TreeViewColumn*)
set_page_complete (session_vbox, true);
move_along_now ();
}
+
+void
+ArdourStartup::existing_session_selected ()
+{
+ _existing_session_chooser_used = true;
+
+ set_page_complete (session_vbox, true);
+ move_along_now ();
+}