{
ui_manager = UIManager::create ();
- std::string ui_file = Glib::getenv(X_("ARDOUR_UI"));
-
- if(!Glib::file_test(ui_file, Glib::FILE_TEST_EXISTS)) ui_file = ARDOUR::find_config_file("ardour.menus");
+ std::string ui_file = ARDOUR::find_config_file("ardour.menus");
- std::cout << "Loading UI definition file " << ui_file << std::endl;
-
bool loaded = false;
try {
#export G_DEBUG=fatal_criticals
-export ARDOUR_RC=../ardour.rc
-export ARDOUR_GLADE_PATH=./glade
-export ARDOUR_UI=./ardour.menus
-export ARDOUR_UI_RC=./ardour2_ui.rc
-export ARDOUR_BINDINGS=./ardour.bindings
-export ARDOUR_COLORS=./ardour.colors
+
+export ARDOUR_PATH=./glade:./pixmaps:.:..
+
export LD_LIBRARY_PATH=../libs/ardour:../libs/midi++2:../libs/pbd3:../libs/soundtouch:../libs/gtkmm2ext:$LD_LIBRARY_PATH
using namespace Gtk::Menu_Helpers;
Gtkmm2ext::init();
-
- /* actually, its already loaded, but ... */
-
- cerr << "Loading UI configuration file " << rcfile << endl;
-
+
about = 0;
if (theArdourUI == 0) {
color_manager = new ColorManager();
- std::string color_file = Glib::getenv(X_("ARDOUR_COLORS"));
- if(!Glib::file_test(color_file, Glib::FILE_TEST_EXISTS)) {
- color_file = ARDOUR::find_config_file("ardour.colors");
- }
-
- cerr << "Loading UI color configuration file " << color_file << endl;
+ std::string color_file = ARDOUR::find_config_file("ardour.colors");
color_manager->load (color_file);
session->add_instant_xml(enode, session->path());
session->add_instant_xml(mnode, session->path());
} else {
- Config->add_instant_xml(enode, Config->get_user_ardour_path());
- Config->add_instant_xml(mnode, Config->get_user_ardour_path());
+ Config->add_instant_xml(enode, get_user_ardour_path());
+ Config->add_instant_xml(mnode, get_user_ardour_path());
}
}
if (session) {
node = session->instant_xml(X_("Mixer"), session->path());
} else {
- node = Config->instant_xml(X_("Mixer"), Config->get_user_ardour_path());
+ node = Config->instant_xml(X_("Mixer"), get_user_ardour_path());
}
if (!node) {
if (session) {
node = session->instant_xml(X_("Editor"), session->path());
} else {
- node = Config->instant_xml(X_("Editor"), Config->get_user_ardour_path());
+ node = Config->instant_xml(X_("Editor"), get_user_ardour_path());
}
if (!node) {
install_actions ();
RedirectBox::register_actions ();
- std::string key_binding_file = Glib::getenv(X_("ARDOUR_BINDINGS"));
+ std::string key_binding_file = ARDOUR::find_config_file("ardour.bindings");
- if(!Glib::file_test(key_binding_file, Glib::FILE_TEST_EXISTS)) key_binding_file = ARDOUR::find_config_file("ardour.bindings");
-
- std::cout << "Loading key binding file " << key_binding_file << std::endl;
-
try {
AccelMap::load (key_binding_file);
} catch (...) {
if (session) {
session->add_instant_xml(get_state(), session->path());
} else {
- Config->add_instant_xml(get_state(), Config->get_user_ardour_path());
+ Config->add_instant_xml(get_state(), get_user_ardour_path());
}
}
break;
default:
- if (Keyboard::modifier_state_contains (event->button.state, Keyboard::ModifierMask(Keyboard::Alt))) {
+ if (Keyboard::modifier_state_equals (event->button.state, Keyboard::ModifierMask(Keyboard::Shift))) {
scroll_backward (0.6f);
+ return true;
}
else if (Keyboard::no_modifier_keys_pressed (&event->button)) {
scroll_tracks_up_line ();
break;
default:
- if (Keyboard::modifier_state_contains (event->button.state, Keyboard::ModifierMask(Keyboard::Alt))) {
+ if (Keyboard::modifier_state_equals (event->button.state, Keyboard::ModifierMask(Keyboard::Shift))) {
scroll_forward (0.6f);
+ return true;
}
else if (Keyboard::no_modifier_keys_pressed (&event->button)) {
scroll_tracks_down_line ();
std::string
GladePath::path(const std::string& glade_file)
{
- std::string user_glade_dir = Glib::getenv(X_("ARDOUR_GLADE_PATH"));
std::string full_path;
-
- if(!user_glade_dir.empty()) {
- full_path = Glib::build_filename(user_glade_dir, glade_file);
- if(Glib::file_test(full_path, Glib::FILE_TEST_EXISTS)) return full_path;
- }
-
- full_path = ARDOUR::find_data_file(Glib::build_filename("glade",
- glade_file));
+
+ full_path = ARDOUR::find_data_file(glade_file, "glade");
return full_path;
}
which_ui_rcfile ()
{
string rcfile;
- char* envvar;
-
- if ((envvar = getenv("ARDOUR_UI_RC")) == 0) {
- rcfile = find_config_file ("ardour2_ui.rc");
- if (rcfile.length() == 0) {
- warning << _("Without a UI style file, ardour will look strange.\n Please set ARDOUR_UI_RC to point to a valid UI style file") << endmsg;
- }
- } else {
- rcfile = envvar;
- }
+ rcfile = find_config_file ("ardour2_ui.rc");
+ if (rcfile.length() == 0) {
+ warning << _("Without a UI style file, ardour will look strange.\n Please set ARDOUR_UI_RC to point to a valid UI style file") << endmsg;
+ }
+
return rcfile;
}
int init (AudioEngine&, bool with_vst, bool try_optimization, void (*sighandler)(int,siginfo_t*,void*) = 0);
int cleanup ();
+
+
+ std::string get_user_ardour_path ();
+ std::string get_system_ardour_path ();
+
std::string find_config_file (std::string name);
std::string find_data_file (std::string name, std::string subdir = "" );
bool get_timecode_source_is_synced ();
void set_timecode_source_is_synced (bool);
- std::string get_user_ardour_path ();
- std::string get_system_ardour_path ();
-
gain_t get_quieten_at_speed ();
void set_quieten_at_speed (gain_t);
{
// sfdb_paths.push_back("/Users/taybin/sounds");
- src = "file:" + Config->get_user_ardour_path() + "sfdb";
+ src = "file:" + get_user_ardour_path() + "sfdb";
// workaround for possible bug in raptor that crashes when saving to a
// non-existant file.
- touch_file(Config->get_user_ardour_path() + "sfdb");
+ touch_file(get_user_ardour_path() + "sfdb");
lrdf_read_file(src.c_str());
string
Configuration::get_user_path()
{
- char *envvar;
-
- if ((envvar = getenv ("ARDOUR_RC")) != 0) {
- return envvar;
- }
-
return find_config_file ("ardour.rc");
}
string
Configuration::get_system_path()
{
- char* envvar;
-
- if ((envvar = getenv ("ARDOUR_SYSTEM_RC")) != 0) {
- return envvar;
- }
-
return find_config_file ("ardour_system.rc");
}
if (rcfile.length()) {
XMLTree tree;
-
- cerr << "Loading system configuration file " << rcfile << endl;
-
+
if (!tree.read (rcfile.c_str())) {
error << string_compose(_("Ardour: cannot read system configuration file \"%1\""), rcfile) << endmsg;
return -1;
if (rcfile.length()) {
XMLTree tree;
-
- cerr << "Loading user configuration file " << rcfile << endl;
-
+
if (!tree.read (rcfile)) {
error << string_compose(_("Ardour: cannot read configuration file \"%1\""), rcfile) << endmsg;
return -1;
{
XMLTree tree;
string rcfile;
- char *envvar;
/* Note: this only writes the per-user file, and therefore
only saves variables marked as user-set or modified
*/
- if ((envvar = getenv ("ARDOUR_RC")) != 0) {
- if (strlen (envvar) == 0) {
- return -1;
- }
- rcfile = envvar;
- } else {
-
- if ((envvar = getenv ("HOME")) == 0) {
- return -1;
- }
- if (strlen (envvar) == 0) {
- return -1;
- }
- rcfile = envvar;
- rcfile += "/.ardour/ardour.rc";
- }
+ rcfile = find_config_file("ardour.rc");
if (rcfile.length()) {
tree.set_root (&state (true));
}
}
-string
-Configuration::get_user_ardour_path ()
-{
- string path;
- char* envvar;
-
- if ((envvar = getenv ("HOME")) == 0 || strlen (envvar) == 0) {
- return "/";
- }
-
- path = envvar;
- path += "/.ardour/";
-
- return path;
-}
-
-string
-Configuration::get_system_ardour_path ()
-{
- string path;
- char* envvar;
-
- if ((envvar = getenv ("ARDOUR_DATA_PATH")) != 0) {
- path += envvar;
- if (path[path.length()-1] != ':') {
- path += ':';
- }
- }
-
- path += DATA_DIR;
- path += "/ardour/";
-
- return path;
-}
-
bool
Configuration::get_no_new_session_dialog()
{
#include <lrdf.h>
#include <pbd/error.h>
+#include <pbd/strsplit.h>
#include <midi++/port.h>
#include <midi++/port_request.h>
return c;
}
-static string
-find_file (string name, string dir, string subdir = "")
+string
+ARDOUR::get_user_ardour_path ()
{
string path;
+ char* envvar;
+
+ if ((envvar = getenv ("HOME")) == 0 || strlen (envvar) == 0) {
+ return "/";
+ }
+
+ path = envvar;
+ path += "/.ardour/";
+
+ return path;
+}
- /* stop A: ~/.ardour/... */
-
- path = getenv ("HOME");
+string
+ARDOUR::get_system_ardour_path ()
+{
+ string path;
- if (path.length()) {
-
- path += "/.ardour/";
+ path += DATA_DIR;
+ path += "/ardour/";
+
+ return path;
+}
- /* try to ensure that the directory exists.
- failure doesn't mean much here.
- */
+static string
+find_file (string name, string dir, string subdir = "")
+{
+ string path;
+ char* envvar = getenv("ARDOUR_PATH");
- mkdir (path.c_str(), 0755);
+ /* stop A: any directory in ARDOUR_PATH */
+
+ if (envvar != 0) {
- if (subdir.length()) {
- path += subdir + "/";
- }
+ vector<string> split_path;
+
+ split (envvar, split_path, ':');
- path += name;
- if (access (path.c_str(), R_OK) == 0) {
- return path;
+ for (vector<string>::iterator i = split_path.begin(); i != split_path.end(); ++i) {
+ path = *i;
+ path += "/" + name;
+ if (access (path.c_str(), R_OK) == 0) {
+ cerr << "Using file " << path << " found in ARDOUR_PATH." << endl;
+ return path;
+ }
}
}
- /* stop B: dir/... */
+ /* stop B: ~/.ardour/ */
+ path = get_user_ardour_path();
+
+ if (subdir.length()) {
+ path += subdir + "/";
+ }
+
+ path += name;
+ if (access (path.c_str(), R_OK) == 0) {
+ return path;
+ }
+
+ /* C: dir/... */
+
path = dir;
path += "/ardour/";
int
ARDOUR::read_recent_sessions (RecentSessions& rs)
{
- string path = Config->get_user_ardour_path();
+ string path = get_user_ardour_path();
path += "/recent";
ifstream recent (path.c_str());
int
ARDOUR::write_recent_sessions (RecentSessions& rs)
{
- string path = Config->get_user_ardour_path();
+ string path = get_user_ardour_path();
path += "/recent";
ofstream recent (path.c_str());
Session::add_instant_xml (XMLNode& node, const std::string& dir)
{
Stateful::add_instant_xml (node, dir);
- Config->add_instant_xml (node, Config->get_user_ardour_path());
+ Config->add_instant_xml (node, get_user_ardour_path());
}
int
string
Session::template_dir ()
{
- string path = Config->get_user_ardour_path();
+ string path = get_user_ardour_path();
path += "templates/";
return path;
{
string path;
- path += Config->get_user_ardour_path();
+ path += get_user_ardour_path();
if (path[path.length()-1] != ':') {
path += ':';
}
- path += Config->get_system_ardour_path();
+ path += get_system_ardour_path();
vector<string> split_path;
int
Session::read_favorite_dirs (FavoriteDirs & favs)
{
- string path = Config->get_user_ardour_path();
+ string path = get_user_ardour_path();
path += "/favorite_dirs";
ifstream fav (path.c_str());
int
Session::write_favorite_dirs (FavoriteDirs & favs)
{
- string path = Config->get_user_ardour_path();
+ string path = get_user_ardour_path();
path += "/favorite_dirs";
ofstream fav (path.c_str());