View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0004703 | ardour | features | public | 2012-02-08 23:44 | 2015-09-18 15:27 |
| Reporter | colinf | Assigned To | paul | ||
| Priority | normal | Severity | tweak | Reproducibility | N/A |
| Status | closed | Resolution | fixed | ||
| Target Version | 3.0 | ||||
| Summary | 0004703: [PATCH] 'Select session file' dialog should default to configured session directory. | ||||
| Description | When browsing for existing session, the 'Select session file' dialog defaults to my home directory every time. I think it'd be better if it were to default to the configured session directory. | ||||
| Tags | No tags attached. | ||||
|
2012-02-09 12:14
|
open-session-default-directory.patch (1,521 bytes)
Index: gtk2_ardour/startup.cc
===================================================================
--- gtk2_ardour/startup.cc (revision 11476)
+++ gtk2_ardour/startup.cc (working copy)
@@ -1024,6 +1024,7 @@
existing_session_chooser.set_title (_("Select session file"));
existing_session_chooser.signal_file_set().connect (sigc::mem_fun (*this, &ArdourStartup::existing_session_selected));
+ existing_session_chooser.set_current_folder(poor_mans_glob (Config->get_default_session_parent_dir()));
#ifdef GTKOSX
existing_session_chooser.add_shortcut_folder ("/Volumes");
Index: gtk2_ardour/ardour_ui.cc
===================================================================
--- gtk2_ardour/ardour_ui.cc (revision 11476)
+++ gtk2_ardour/ardour_ui.cc (working copy)
@@ -1409,6 +1409,15 @@
open_session_selector->add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
open_session_selector->add_button (Gtk::Stock::OPEN, Gtk::RESPONSE_ACCEPT);
open_session_selector->set_default_response(Gtk::RESPONSE_ACCEPT);
+
+ if (_session) {
+ string session_parent_dir = Glib::path_get_dirname(_session->path());
+ string::size_type last_dir_sep = session_parent_dir.rfind(G_DIR_SEPARATOR);
+ session_parent_dir = session_parent_dir.substr(0, last_dir_sep);
+ open_session_selector->set_current_folder(session_parent_dir);
+ } else {
+ open_session_selector->set_current_folder(Config->get_default_session_parent_dir());
+ }
FileFilter session_filter;
session_filter.add_pattern ("*.ardour");
|
|
|
And here's a pretty simple patch that makes the 'Select session file' dialog start in the configured sessions directory, and also makes the 'Open Session' dialog from the Session menu start in the parent directory of the current session (if any). |
|
2012-02-14 17:56
|
open-session-default-directory-r11489.patch (1,525 bytes)
Index: gtk2_ardour/startup.cc
===================================================================
--- gtk2_ardour/startup.cc (revision 11489)
+++ gtk2_ardour/startup.cc (working copy)
@@ -582,6 +582,7 @@
existing_session_chooser.set_title (_("Select session file"));
existing_session_chooser.signal_file_set().connect (sigc::mem_fun (*this, &ArdourStartup::existing_session_selected));
+ existing_session_chooser.set_current_folder(poor_mans_glob (Config->get_default_session_parent_dir()));
#ifdef GTKOSX
existing_session_chooser.add_shortcut_folder ("/Volumes");
Index: gtk2_ardour/ardour_ui.cc
===================================================================
--- gtk2_ardour/ardour_ui.cc (revision 11489)
+++ gtk2_ardour/ardour_ui.cc (working copy)
@@ -1409,6 +1409,15 @@
open_session_selector->add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
open_session_selector->add_button (Gtk::Stock::OPEN, Gtk::RESPONSE_ACCEPT);
open_session_selector->set_default_response(Gtk::RESPONSE_ACCEPT);
+
+ if (_session) {
+ string session_parent_dir = Glib::path_get_dirname(_session->path());
+ string::size_type last_dir_sep = session_parent_dir.rfind(G_DIR_SEPARATOR);
+ session_parent_dir = session_parent_dir.substr(0, last_dir_sep);
+ open_session_selector->set_current_folder(session_parent_dir);
+ } else {
+ open_session_selector->set_current_folder(Config->get_default_session_parent_dir());
+ }
FileFilter session_filter;
session_filter.add_pattern ("*.ardour");
|
|
|
An updated version to fix the original patch's conflict with r11489. |
|
2012-03-08 23:17
|
open-new-session-default-directory.patch (3,887 bytes)
Index: gtk2_ardour/startup.cc
===================================================================
--- gtk2_ardour/startup.cc (revision 11623)
+++ gtk2_ardour/startup.cc (working copy)
@@ -39,6 +39,7 @@
#include "ardour/session_state_utils.h"
#include "ardour/template_utils.h"
+#include "ardour_ui.h"
#include "startup.h"
#include "opts.h"
#include "engine_dialog.h"
@@ -584,6 +585,7 @@
existing_session_chooser.set_title (_("Select session file"));
existing_session_chooser.signal_file_set().connect (sigc::mem_fun (*this, &ArdourStartup::existing_session_selected));
+ existing_session_chooser.set_current_folder(poor_mans_glob (Config->get_default_session_parent_dir()));
#ifdef GTKOSX
existing_session_chooser.add_shortcut_folder ("/Volumes");
@@ -786,9 +788,16 @@
if (!ARDOUR_COMMAND_LINE::session_name.empty()) {
new_folder_chooser.set_current_folder (poor_mans_glob (Glib::path_get_dirname (ARDOUR_COMMAND_LINE::session_name)));
+ } else if (ARDOUR_UI::instance()->session_loaded) {
+ // point the new session file chooser at the parent directory of the current session
+ string session_parent_dir = Glib::path_get_dirname(ARDOUR_UI::instance()->the_session()->path());
+ string::size_type last_dir_sep = session_parent_dir.rfind(G_DIR_SEPARATOR);
+ session_parent_dir = session_parent_dir.substr(0, last_dir_sep);
+ new_folder_chooser.set_current_folder (session_parent_dir);
} else {
new_folder_chooser.set_current_folder (poor_mans_glob (Config->get_default_session_parent_dir()));
}
+ new_folder_chooser.add_shortcut_folder (poor_mans_glob (Config->get_default_session_parent_dir()));
new_folder_chooser.set_title (_("Select folder for session"));
#ifdef GTKOSX
Index: gtk2_ardour/ardour_ui.cc
===================================================================
--- gtk2_ardour/ardour_ui.cc (revision 11623)
+++ gtk2_ardour/ardour_ui.cc (working copy)
@@ -1348,7 +1348,18 @@
open_session_selector->add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
open_session_selector->add_button (Gtk::Stock::OPEN, Gtk::RESPONSE_ACCEPT);
open_session_selector->set_default_response(Gtk::RESPONSE_ACCEPT);
+
+ if (_session) {
+ string session_parent_dir = Glib::path_get_dirname(_session->path());
+ string::size_type last_dir_sep = session_parent_dir.rfind(G_DIR_SEPARATOR);
+ session_parent_dir = session_parent_dir.substr(0, last_dir_sep);
+ open_session_selector->set_current_folder(session_parent_dir);
+ } else {
+ open_session_selector->set_current_folder(Config->get_default_session_parent_dir());
+ }
+ open_session_selector->add_shortcut_folder (Config->get_default_session_parent_dir());
+
FileFilter session_filter;
session_filter.add_pattern ("*.ardour");
session_filter.set_name (string_compose (_("%1 sessions"), PROGRAM_NAME));
@@ -2584,24 +2595,15 @@
continue;
}
- if (session_name.find ('/') != std::string::npos) {
- MessageDialog msg (*_startup,
- _("To ensure compatibility with various systems\n"
- "session names may not contain a '/' character"));
+ 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 (session_name.find ('\\') != std::string::npos) {
- MessageDialog msg (*_startup,
- _("To ensure compatibility with various systems\n"
- "session names may not contain a '\\' character"));
- msg.run ();
- ARDOUR_COMMAND_LINE::session_name = ""; // cancel that
- continue;
- }
-
_session_is_new = true;
}
|
|
|
Here's an updated version that makes the default location of a new session be the parent of the current session (if any), so 'New..' as well as 'Open...' from the Session menu uses the current session's location. It also uses Session::session_name_is_legal() to check new session names for consistency. |
|
|
Sorry, the last patch here crashes if ~/.config/ardour3 hasn't yet been created. Fixed version coming pronto... |
|
2012-03-09 18:41
|
open-new-session-default-directory-11630.patch (5,617 bytes)
Index: gtk2_ardour/startup.cc
===================================================================
--- gtk2_ardour/startup.cc (revision 11630)
+++ gtk2_ardour/startup.cc (working copy)
@@ -39,6 +39,7 @@
#include "ardour/session_state_utils.h"
#include "ardour/template_utils.h"
+#include "ardour_ui.h"
#include "startup.h"
#include "opts.h"
#include "engine_dialog.h"
@@ -360,7 +361,12 @@
void
ArdourStartup::default_dir_changed ()
{
+
+ cerr << "default_dir_changed() to " << default_dir_chooser->get_filename() << endl;
Config->set_default_session_parent_dir (default_dir_chooser->get_filename());
+
+ // make new session folder chooser point to the new default
+ new_folder_chooser.set_current_folder (Config->get_default_session_parent_dir());
config_changed ();
}
@@ -584,6 +590,7 @@
existing_session_chooser.set_title (_("Select session file"));
existing_session_chooser.signal_file_set().connect (sigc::mem_fun (*this, &ArdourStartup::existing_session_selected));
+ existing_session_chooser.set_current_folder(poor_mans_glob (Config->get_default_session_parent_dir()));
#ifdef GTKOSX
existing_session_chooser.add_shortcut_folder ("/Volumes");
@@ -786,6 +793,13 @@
if (!ARDOUR_COMMAND_LINE::session_name.empty()) {
new_folder_chooser.set_current_folder (poor_mans_glob (Glib::path_get_dirname (ARDOUR_COMMAND_LINE::session_name)));
+ } else if (ARDOUR_UI::instance()->session_loaded) {
+ // point the new session file chooser at the parent directory of the current session
+ string session_parent_dir = Glib::path_get_dirname(ARDOUR_UI::instance()->the_session()->path());
+ string::size_type last_dir_sep = session_parent_dir.rfind(G_DIR_SEPARATOR);
+ session_parent_dir = session_parent_dir.substr(0, last_dir_sep);
+ new_folder_chooser.set_current_folder (session_parent_dir);
+ new_folder_chooser.add_shortcut_folder (poor_mans_glob (Config->get_default_session_parent_dir()));
} else {
new_folder_chooser.set_current_folder (poor_mans_glob (Config->get_default_session_parent_dir()));
}
Index: gtk2_ardour/ardour_ui.cc
===================================================================
--- gtk2_ardour/ardour_ui.cc (revision 11630)
+++ gtk2_ardour/ardour_ui.cc (working copy)
@@ -1348,7 +1349,18 @@
open_session_selector->add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
open_session_selector->add_button (Gtk::Stock::OPEN, Gtk::RESPONSE_ACCEPT);
open_session_selector->set_default_response(Gtk::RESPONSE_ACCEPT);
+
+ if (_session) {
+ string session_parent_dir = Glib::path_get_dirname(_session->path());
+ string::size_type last_dir_sep = session_parent_dir.rfind(G_DIR_SEPARATOR);
+ session_parent_dir = session_parent_dir.substr(0, last_dir_sep);
+ open_session_selector->set_current_folder(session_parent_dir);
+ } else {
+ open_session_selector->set_current_folder(Config->get_default_session_parent_dir());
+ }
+ open_session_selector->add_shortcut_folder (Config->get_default_session_parent_dir());
+
FileFilter session_filter;
session_filter.add_pattern ("*.ardour");
session_filter.set_name (string_compose (_("%1 sessions"), PROGRAM_NAME));
@@ -2584,24 +2596,15 @@
continue;
}
- if (session_name.find ('/') != std::string::npos) {
- MessageDialog msg (*_startup,
- _("To ensure compatibility with various systems\n"
- "session names may not contain a '/' character"));
+ 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 (session_name.find ('\\') != std::string::npos) {
- MessageDialog msg (*_startup,
- _("To ensure compatibility with various systems\n"
- "session names may not contain a '\\' character"));
- msg.run ();
- ARDOUR_COMMAND_LINE::session_name = ""; // cancel that
- continue;
- }
-
_session_is_new = true;
}
@@ -3265,7 +3268,23 @@
void
ARDOUR_UI::create_xrun_marker (framepos_t where)
{
- editor->mouse_add_new_marker (where, false, true);
+ if (_session) {
+ /* adding xrun markers doesn't need to be undoable:
+ * just add it, and don't make_current either.
+ *
+ * XXX doesn't do the right thing yet, since the xrun
+ * markers are created during capture,
+ * but begin_reversible_command (Operations::capture);
+ * doesn't happen until the transport is stopped after
+ * the capture.
+ */
+
+ string markername;
+
+ _session->locations()->next_available_name(markername, _("xrun"));
+ Location *location = new Location (*_session, where, where, markername, Location::IsMark);
+ _session->locations()->add (location, false);
+ }
}
void
@@ -3626,10 +3645,23 @@
void
ARDOUR_UI::setup_profile ()
{
+#ifndef GTKOSX
if (gdk_screen_width() < 1200) {
+ cerr << "gdk_screen_width() = " << gdk_screen_width() << ", font_scale = " << (Config->get_font_scale() / 1024) << endl;
+ if (Config->get_font_scale() / 1024 > 72) {
+ Config->set_font_scale(1024 * 72);
+ cerr << "font_scale now set to " << (Config->get_font_scale() / 1024) << endl;
+ }
+ if (gdk_screen_width() < 1024) {
+ Profile->set_small_screen ();
+ }
+ }
+#else
+ if (gdk_screen_width() < 1200) {
Profile->set_small_screen ();
}
+#endif
if (getenv ("ARDOUR_SAE")) {
Profile->set_sae ();
|
|
|
Fixed crash with open-new-session-default-directory-11630.patch, which also makes the new session directory chooser point to the right place on 'first run', when ~/.config/ardour3 doesn't exist. There are still some oddities with the first run of A3, but I don't know whether they are anything to do what I've done in this patch. I'll test with a virgin svn checkout later. |
|
|
Looks like the oddnesses in startup with no ~/.config/ardour3 are also present without any of my messing about: I'll make a separate report now. |
|
|
http://tracker.ardour.org/view.php?id=4765 describes the oddness on first startup and has a one-liner that fixes it for me, so I'm fairly happy that open-new-session-default-directory-11630.patch isn't doing anything too dreadfully wrong now, if anyone's interested... |
|
|
the final patch also contains some unrelated stuff affecting font scaling on small screens. i'm ignoring that for now. there is also stuff in there relating to marker creation, also ignored. applied 11694. thanks. |
|
|
Paul: thanks for applying, and sorry about the extraneous bits in the last patch. I should probably be using git :). |
|
|
Closing old issues reported by me: these have long since been fixed. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2012-02-08 23:44 | colinf | New Issue | |
| 2012-02-09 12:14 | colinf | File Added: open-session-default-directory.patch | |
| 2012-02-09 12:17 | colinf | Note Added: 0012770 | |
| 2012-02-09 20:22 | cth103 | cost | => 0.00 |
| 2012-02-09 20:22 | cth103 | Target Version | => 3.0-beta3 |
| 2012-02-09 20:22 | cth103 | Summary | 'Select session file' dialog should default to configured session directory. => [PATCH] 'Select session file' dialog should default to configured session directory. |
| 2012-02-14 17:20 | paul | Target Version | 3.0-beta3 => 3.0 beta4 |
| 2012-02-14 17:56 | colinf | File Added: open-session-default-directory-r11489.patch | |
| 2012-02-14 17:57 | colinf | Note Added: 0012804 | |
| 2012-03-08 23:17 | colinf | File Added: open-new-session-default-directory.patch | |
| 2012-03-08 23:23 | colinf | Note Added: 0012882 | |
| 2012-03-09 18:13 | colinf | Note Added: 0012889 | |
| 2012-03-09 18:41 | colinf | File Added: open-new-session-default-directory-11630.patch | |
| 2012-03-09 18:45 | colinf | Note Added: 0012891 | |
| 2012-03-12 23:55 | colinf | Note Added: 0012906 | |
| 2012-03-13 22:06 | colinf | Note Added: 0012916 | |
| 2012-03-15 12:04 | paul | Note Added: 0012932 | |
| 2012-03-15 12:04 | paul | Status | new => resolved |
| 2012-03-15 12:04 | paul | Resolution | open => fixed |
| 2012-03-15 12:04 | paul | Assigned To | => paul |
| 2012-03-15 12:14 | colinf | Note Added: 0012936 | |
| 2012-05-23 15:08 | cth103 | Target Version | 3.0 beta4 => 3.0 |
| 2015-09-18 15:27 | colinf | Note Added: 0017310 | |
| 2015-09-18 15:27 | colinf | Status | resolved => closed |