summaryrefslogtreecommitdiff
path: root/gtk2_ardour/ardour_ui.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-11-08 15:54:16 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-11-08 15:54:16 +0000
commit44e88a2d54e04d29e462246d1988280e03ce7304 (patch)
tree5a4c5d3a50c81bf943c820332513937637613d03 /gtk2_ardour/ardour_ui.cc
parenta532845e7fce0d218384203be1884d933843aebf (diff)
notably modify the design and logic of the startup dialog, so that we can handle the requirements in the 3.0-SG branch reasonably. the two major changes concern the idea that we may need to run the audio setup tab at all times, and that the startup dialog could potentially be "ready" without actually needing to be displayed on-screen. this allows us to ALWAYS use a startup dialog, even if we don't actually need any information from the user. as usual with this kind of change, expect a few logic/workflow glitches
git-svn-id: svn://localhost/ardour2/branches/3.0@13397 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/ardour_ui.cc')
-rw-r--r--gtk2_ardour/ardour_ui.cc157
1 files changed, 67 insertions, 90 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 37343c1e18..143d621987 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -329,37 +329,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
DPIReset.connect (sigc::mem_fun (*this, &ARDOUR_UI::resize_text_widgets));
}
-/** @return true if a session was chosen and `apply' clicked, otherwise false if `cancel' was clicked */
-bool
-ARDOUR_UI::run_startup (bool should_be_new, std::string load_template)
-{
- delete _startup;
- _startup = new ArdourStartup ();
-
- XMLNode* audio_setup = Config->extra_xml ("AudioSetup");
-
- if (audio_setup && _startup->engine_control()) {
- _startup->engine_control()->set_state (*audio_setup);
- }
-
- _startup->set_new_only (should_be_new);
- if (!load_template.empty()) {
- _startup->set_load_template (load_template);
- }
- _startup->present ();
-
- main().run();
-
- _startup->hide ();
-
- switch (_startup->response()) {
- case RESPONSE_OK:
- return true;
- default:
- return false;
- }
-}
-
int
ARDOUR_UI::create_engine ()
{
@@ -2458,7 +2427,7 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
while (ret != 0) {
- if (!should_be_new && !ARDOUR_COMMAND_LINE::session_name.empty()) {
+ if (!ARDOUR_COMMAND_LINE::session_name.empty()) {
/* if they named a specific statefile, use it, otherwise they are
just giving a session folder, and we want to use it as is
@@ -2475,71 +2444,79 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
session_path = ARDOUR_COMMAND_LINE::session_name;
session_name = Glib::path_get_basename (ARDOUR_COMMAND_LINE::session_name);
}
+ }
- } else {
-
- bool const apply = run_startup (should_be_new, load_template);
-
- if (!apply) {
- if (quit_on_cancel) {
- exit (1);
- } else {
- return ret;
- }
- }
-
- /* if we run the startup dialog again, offer more than just "new session" */
-
- should_be_new = false;
-
- session_name = _startup->session_name (likely_new);
-
- string::size_type suffix = session_name.find (statefile_suffix);
-
- if (suffix != string::npos) {
- session_name = session_name.substr (0, suffix);
+ delete _startup;
+ _startup = new ArdourStartup (should_be_new, session_name, session_path, load_template);
+
+ if (!_startup->ready_without_display()) {
+ _startup->present ();
+ main().run();
+ _startup->hide ();
+ }
+
+ switch (_startup->response()) {
+ case RESPONSE_OK:
+ break;
+ default:
+ if (quit_on_cancel) {
+ exit (1);
+ } else {
+ return ret;
}
+ }
- /* this shouldn't happen, but we catch it just in case it does */
+ /* if we run the startup dialog again, offer more than just "new session" */
+
+ should_be_new = false;
+
+ session_name = _startup->session_name (likely_new);
+
+ string::size_type suffix = session_name.find (statefile_suffix);
+
+ if (suffix != string::npos) {
+ session_name = session_name.substr (0, suffix);
+ }
+
+ /* this shouldn't happen, but we catch it just in case it does */
+
+ if (session_name.empty()) {
+ continue;
+ }
+
+ if (_startup->use_session_template()) {
+ template_name = _startup->session_template_name();
+ _session_is_new = true;
+ }
+
+ if (session_name[0] == G_DIR_SEPARATOR ||
+ (session_name.length() > 2 && session_name[0] == '.' && session_name[1] == G_DIR_SEPARATOR) ||
+ (session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == G_DIR_SEPARATOR)) {
+
+ /* absolute path or cwd-relative path specified for session name: infer session folder
+ from what was given.
+ */
+
+ session_path = Glib::path_get_dirname (session_name);
+ session_name = Glib::path_get_basename (session_name);
+
+ } else {
- if (session_name.empty()) {
+ session_path = _startup->session_folder();
+
+ char illegal = Session::session_name_is_legal (session_name);
+
+ if (illegal) {
+ MessageDialog msg (*_startup,
+ string_compose (_("To ensure compatibility with various systems\n"
+ "session names may not contain a '%1' character"),
+ illegal));
+ msg.run ();
+ ARDOUR_COMMAND_LINE::session_name = ""; // cancel that
continue;
}
-
- if (_startup->use_session_template()) {
- template_name = _startup->session_template_name();
- _session_is_new = true;
- }
-
- if (session_name[0] == G_DIR_SEPARATOR ||
- (session_name.length() > 2 && session_name[0] == '.' && session_name[1] == G_DIR_SEPARATOR) ||
- (session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == G_DIR_SEPARATOR)) {
-
- /* absolute path or cwd-relative path specified for session name: infer session folder
- from what was given.
- */
-
- session_path = Glib::path_get_dirname (session_name);
- session_name = Glib::path_get_basename (session_name);
-
- } else {
-
- session_path = _startup->session_folder();
-
- char illegal = Session::session_name_is_legal (session_name);
-
- if (illegal) {
- MessageDialog msg (*_startup,
- string_compose (_("To ensure compatibility with various systems\n"
- "session names may not contain a '%1' character"),
- illegal));
- msg.run ();
- ARDOUR_COMMAND_LINE::session_name = ""; // cancel that
- continue;
- }
- }
}
-
+
if (create_engine ()) {
break;
}