#include <iostream>
#include <gtkmm/messagedialog.h>
+#include <gtkmm/accelmap.h>
#include <pbd/error.h>
#include <pbd/compose.h>
#include <pbd/pathscanner.h>
#include <pbd/failed_constructor.h>
#include <gtkmm2ext/gtk_ui.h>
-#include <gtkmm2ext/pix.h>
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/click_box.h>
#include <gtkmm2ext/fastmeter.h>
#include "about.h"
#include "utils.h"
#include "gui_thread.h"
-#include "meter_xpms.h"
#include "color_manager.h"
#include "i18n.h"
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);
shuttle_grabbed = false;
shuttle_fract = 0.0;
+ shuttle_max_speed = 8.0f;
set_shuttle_units (Percentage);
set_shuttle_behaviour (Sprung);
_tooltips.enable();
keyboard = new Keyboard;
- install_keybindings ();
- FastMeter::set_vertical_xpm (v_meter_strip_xpm);
- FastMeter::set_horizontal_xpm (h_meter_strip_xpm);
+ string meter_path;
+
+ meter_path = ARDOUR::find_data_file("v_meter_strip.xpm", "pixmaps");
+ if (meter_path.empty()) {
+ error << _("no vertical meter strip image found") << endmsg;
+ exit (1);
+ }
+ FastMeter::set_vertical_xpm (meter_path);
+
+ meter_path = ARDOUR::find_data_file("h_meter_strip.xpm", "pixmaps");
+ if (meter_path.empty()) {
+ error << _("no horizontal meter strip image found") << endmsg;
+ exit (1);
+ }
+ FastMeter::set_horizontal_xpm (meter_path);
if (setup_windows ()) {
throw failed_constructor ();
blink_timeout_tag = -1;
+ /* the global configuration object is now valid */
+
+ use_config ();
+
/* this being a GUI and all, we want peakfiles */
FileSource::set_build_peakfiles (true);
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());
}
+
+ /* keybindings */
+
+ AccelMap::save ("ardour.saved_bindings");
}
void
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_SINGLE);
+
+ recent_session_display.signal_row_activated().connect (mem_fun (*this, &ARDOUR_UI::recent_session_row_activated));
scroller->add (recent_session_display);
scroller->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
session_selector_window->show_all_children();
}
+void
+ARDOUR_UI::recent_session_row_activated (const TreePath& path, TreeViewColumn* col)
+{
+ session_selector_window->response (RESPONSE_ACCEPT);
+}
+
void
ARDOUR_UI::open_recent_session ()
{
}
}
-void
-ARDOUR_UI::send_all_midi_feedback ()
-{
- if (session) {
- session->send_all_midi_feedback();
- }
-}
-
void
ARDOUR_UI::allow_local_only ()
{
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) {
switch (dialog.run ()) {
case RESPONSE_ACCEPT:
- break;
- default:
return 1;
+ default:
+ return 0;
}
-
- return 0;
}
-
void
ARDOUR_UI::disconnect_from_jack ()
{
_will_create_new_session_automatically = false; /* done it */
return FALSE; /* don't call it again */
}
+
+void
+ARDOUR_UI::set_native_file_header_format (HeaderFormat hf)
+{
+ Glib::RefPtr<Action> act;
+
+ switch (hf) {
+ case BWF:
+ act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatBWF"));
+ break;
+ case WAVE:
+ act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatWAVE"));
+ break;
+ case WAVE64:
+ act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatWAVE64"));
+ break;
+ case iXML:
+ act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatiXML"));
+ break;
+ case RF64:
+ act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatRF64"));
+ break;
+ }
+
+ if (act) {
+ Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
+ if (ract && ract->get_active() && Config->get_native_file_header_format() != hf) {
+ Config->set_native_file_header_format (hf);
+ if (session) {
+ session->reset_native_file_format ();
+ }
+ }
+ }
+}
+
+void
+ARDOUR_UI::set_native_file_data_format (SampleFormat sf)
+{
+ Glib::RefPtr<Action> act;
+
+ switch (sf) {
+ case FormatFloat:
+ act = ActionManager::get_action (X_("options"), X_("FileDataFormatFloat"));
+ break;
+ case FormatInt24:
+ act = ActionManager::get_action (X_("options"), X_("FileDataFormat24bit"));
+ break;
+ }
+
+ if (act) {
+ Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
+
+ if (ract && ract->get_active() && Config->get_native_file_data_format() != sf) {
+ Config->set_native_file_data_format (sf);
+ if (session) {
+ session->reset_native_file_format ();
+ }
+ }
+ }
+}
+
+void
+ARDOUR_UI::use_config ()
+{
+ Glib::RefPtr<Action> act;
+
+ switch (Config->get_native_file_data_format ()) {
+ case FormatFloat:
+ act = ActionManager::get_action (X_("options"), X_("FileDataFormatFloat"));
+ break;
+ case FormatInt24:
+ act = ActionManager::get_action (X_("options"), X_("FileDataFormat24bit"));
+ break;
+ }
+
+ if (act) {
+ Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
+ ract->set_active ();
+ }
+
+ switch (Config->get_native_file_header_format ()) {
+ case BWF:
+ act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatBWF"));
+ break;
+ case WAVE:
+ act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatWAVE"));
+ break;
+ case WAVE64:
+ act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatWAVE64"));
+ break;
+ case iXML:
+ act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatiXML"));
+ break;
+ case RF64:
+ act = ActionManager::get_action (X_("options"), X_("FileHeaderFormatRF64"));
+ break;
+ }
+
+ if (act) {
+ Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic(act);
+ ract->set_active ();
+ }
+}