along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id$
*/
#include <pbd/whitespace.h>
-#include <ardour/audio_library.h>
#include <ardour/session.h>
#include <ardour/audioengine.h>
#include <ardour/configuration.h>
#include <ardour/auditioner.h>
-#include <ardour/destructive_filesource.h>
+#include <ardour/sndfilesource.h>
#include <ardour/crossfade.h>
#include <midi++/manager.h>
#include <gtkmm2ext/stop_signal.h>
#include <gtkmm2ext/utils.h>
+#include <gtkmm2ext/window_title.h>
#include "public_editor.h"
+#include "keyboard.h"
#include "mixer_ui.h"
#include "ardour_ui.h"
#include "io_selector.h"
static vector<string> positional_sync_strings;
OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
- : Dialog ("option editor"),
+ : Dialog ("options editor"),
ui (uip),
editor (ed),
mixer (mixui),
/* Paths */
path_table (11, 2),
- sfdb_path_view(),
/* Fades */
/* Sync */
- smpte_offset_clock (X_("SMPTEOffsetClock"), true, true),
+ smpte_offset_clock (X_("smpteoffset"), false, X_("SMPTEOffsetClock"), true, true),
smpte_offset_negative_button (_("SMPTE offset is negative")),
/* MIDI */
+ mmc_device_id_adjustment (0.0, 0.0, (double) 0x7f, 1.0, 16.0),
+ mmc_device_id_spinner (mmc_device_id_adjustment),
+
/* Click */
click_table (2, 3),
click_io_selector = 0;
auditioner_io_selector = 0;
session = 0;
+
+ WindowTitle title(Glib::get_application_name());
+ title += _("Options Editor");
+ set_title(title.get_string());
set_default_size (300, 300);
- set_title (_("ardour: options editor"));
- set_wmclass (_("ardour_option_editor"), "Ardour");
+ set_wmclass (X_("ardour_option_editor"), "Ardour");
set_name ("OptionsWindow");
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
path_table.attach (*label, 0, 1, 0, 1, FILL|EXPAND, FILL);
path_table.attach (session_raid_entry, 1, 3, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
- label = manage(new Label(_("Soundfile Search Paths")));
- label->set_name("OptionsLabel");
- path_table.attach(*label, 0, 1, 2, 3, FILL|EXPAND, FILL);
- path_table.attach(sfdb_path_view, 1, 3, 2, 3, Gtk::FILL|Gtk::EXPAND, FILL);
-
- sfdb_path_view.set_paths(Library->get_paths());
- sfdb_path_view.PathsUpdated.connect (mem_fun(*this, &OptionEditor::sfdb_paths_changed));
-
path_table.show_all();
}
-void
-OptionEditor::sfdb_paths_changed ()
-{
- Library->set_paths (sfdb_path_view.get_paths());
-}
-
void
OptionEditor::add_session_paths ()
{
click_emphasis_path_entry.set_sensitive (true);
session_raid_entry.set_sensitive (true);
- if (session->click_sound.length() == 0) {
+ if (Config->get_click_sound().empty()) {
click_path_entry.set_text (_("internal"));
} else {
- click_path_entry.set_text (session->click_sound);
+ click_path_entry.set_text (Config->get_click_sound());
}
- if (session->click_emphasis_sound.length() == 0) {
+ if (Config->get_click_emphasis_sound().empty()) {
click_emphasis_path_entry.set_text (_("internal"));
} else {
- click_emphasis_path_entry.set_text (session->click_emphasis_sound);
+ click_emphasis_path_entry.set_text (Config->get_click_emphasis_sound());
}
session_raid_entry.set_text(session->raid_path());
/* val is in msecs */
- Crossfade::set_short_xfade_length ((jack_nframes_t) floor (session->frame_rate() * (val / 1000.0)));
+ Crossfade::set_short_xfade_length ((nframes_t) floor (session->frame_rate() * (val / 1000.0)));
}
}
float val = destructo_xfade_adjustment.get_value();
/* val is in msecs */
+
Config->set_destructive_xfade_msecs ((uint32_t) floor (val));
if (session) {
- DestructiveFileSource::setup_standard_crossfades (session->frame_rate());
+ SndFileSource::setup_standard_crossfades (session->frame_rate());
}
}
OptionEditor::smpte_offset_chosen()
{
if (session) {
- jack_nframes_t frames = smpte_offset_clock.current_duration();
+ nframes_t frames = smpte_offset_clock.current_duration();
session->set_smpte_offset (frames);
}
}
ToggleButton* tb;
RadioButton* rb;
- Gtk::Table* table = manage (new Table (ports.size() + 4, 9));
+ Gtk::Table* table = manage (new Table (ports.size() + 4, 10));
table->set_row_spacings (6);
table->set_col_spacings (10);
- table->attach (*(manage (new Label (X_("Port")))), 0, 1, 0, 1);
- table->attach (*(manage (new Label (X_("Offline")))), 1, 2, 0, 1);
- table->attach (*(manage (new Label (X_("Trace\nInput")))), 2, 3, 0, 1);
- table->attach (*(manage (new Label (X_("Trace\nOutput")))), 3, 4, 0, 1);
- table->attach (*(manage (new Label (X_("MTC")))), 4, 5, 0, 1);
- table->attach (*(manage (new Label (X_("MMC")))), 6, 7, 0, 1);
- table->attach (*(manage (new Label (X_("MIDI Parameter\nControl")))), 8, 9, 0, 1);
+ table->attach (*(manage (new Label (_("Port")))), 0, 1, 0, 1);
+ table->attach (*(manage (new Label (_("Offline")))), 1, 2, 0, 1);
+ table->attach (*(manage (new Label (_("Trace\nInput")))), 2, 3, 0, 1);
+ table->attach (*(manage (new Label (_("Trace\nOutput")))), 3, 4, 0, 1);
+ table->attach (*(manage (new Label (_("MTC")))), 4, 5, 0, 1);
+ table->attach (*(manage (new Label (_("MMC")))), 6, 7, 0, 1);
+ table->attach (*(manage (new Label (_("MIDI Parameter\nControl")))), 8, 9, 0, 1);
table->attach (*(manage (new HSeparator())), 0, 9, 1, 2);
table->attach (*(manage (new VSeparator())), 5, 6, 0, 8);
table->attach (*(manage (new VSeparator())), 7, 8, 0, 8);
+ table->attach (*(manage (new Label (_("MMC Device ID")))), 9, 10, 0, 1);
+ table->attach (mmc_device_id_spinner, 9, 10, 1, 2);
+
+ mmc_device_id_adjustment.signal_value_changed().connect (mem_fun (*this, &OptionEditor::mmc_device_id_adjusted));
+
for (n = 0, i = ports.begin(); i != ports.end(); ++n, ++i) {
pair<MIDI::Port*,vector<RadioButton*> > newpair;
}
tb->set_active (!(*i).second->input()->offline());
- tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_online_toggled), (*i).second, tb));
+ tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_online_toggled), (*i).second, tb));
(*i).second->input()->OfflineStatusChanged.connect (bind (mem_fun(*this, &OptionEditor::map_port_online), (*i).second, tb));
table->attach (*tb, 1, 2, n+2, n+3, FILL|EXPAND, FILL);
tb = manage (new ToggleButton ());
tb->set_name ("OptionEditorToggleButton");
- tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_trace_in_toggled), (*i).second, tb));
+ tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_trace_in_toggled), (*i).second, tb));
tb->set_size_request (10, 10);
table->attach (*tb, 2, 3, n+2, n+3, FILL|EXPAND, FILL);
tb = manage (new ToggleButton ());
tb->set_name ("OptionEditorToggleButton");
- tb->signal_button_press_event().connect (bind (mem_fun(*this, &OptionEditor::port_trace_out_toggled), (*i).second, tb));
+ tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_trace_out_toggled), (*i).second, tb));
tb->set_size_request (10, 10);
table->attach (*tb, 3, 4, n+2, n+3, FILL|EXPAND, FILL);
{
if (session) {
if (rb->get_active()) {
- cerr << "Activating MTC port " << port->name() << endl;
if (port) {
session->set_mtc_port (port->name());
Config->set_mtc_port_name (port->name());
{
if (session) {
if (rb->get_active()) {
- cerr << "Activating MMC port " << port->name() << endl;
if (port) {
session->set_mmc_port (port->name());
Config->set_mtc_port_name (port->name());
{
if (session) {
if (rb->get_active()) {
- cerr << "Activating MIDI port " << port->name() << endl;
if (port) {
session->set_midi_port (port->name());
Config->set_midi_port_name (port->name());
}
}
-gint
-OptionEditor::port_online_toggled (GdkEventButton* ev, MIDI::Port* port, ToggleButton* tb)
+void
+OptionEditor::port_online_toggled (MIDI::Port* port, ToggleButton* tb)
{
- bool wanted = tb->get_active(); /* it hasn't changed at this point */
+ bool wanted = tb->get_active();
if (wanted != port->input()->offline()) {
port->input()->set_offline (wanted);
}
- return stop_signal (*tb, "button_press_event");
}
void
OptionEditor::map_port_online (MIDI::Port* port, ToggleButton* tb)
{
- if (port->input()->offline()) {
- tb->set_label (_("offline"));
- tb->set_active (false);
- } else {
- tb->set_label (_("online"));
- tb->set_active (true);
+ bool bstate = tb->get_active ();
+
+ if (bstate != port->input()->offline()) {
+ if (port->input()->offline()) {
+ tb->set_label (_("offline"));
+ tb->set_active (false);
+ } else {
+ tb->set_label (_("online"));
+ tb->set_active (true);
+ }
}
}
-gint
-OptionEditor::port_trace_in_toggled (GdkEventButton* ev, MIDI::Port* port, ToggleButton* tb)
+void
+OptionEditor::mmc_device_id_adjusted ()
{
- /* XXX not very good MVC style here */
+ uint8_t id = (uint8_t) mmc_device_id_spinner.get_value();
- port->input()->trace (!tb->get_active(), &cerr, string (port->name()) + string (" input: "));
- tb->set_active (!tb->get_active());
- return stop_signal (*tb, "button_press_event");
+ if (id != Config->get_mmc_device_id()) {
+ Config->set_mmc_device_id (id);
+ }
}
-gint
-OptionEditor::port_trace_out_toggled (GdkEventButton* ev,MIDI::Port* port, ToggleButton* tb)
+void
+OptionEditor::port_trace_in_toggled (MIDI::Port* port, ToggleButton* tb)
+{
+ bool trace = tb->get_active();
+
+ if (port->input()->tracing() != trace) {
+ port->input()->trace (trace, &cerr, string (port->name()) + string (" input: "));
+ }
+}
+
+void
+OptionEditor::port_trace_out_toggled (MIDI::Port* port, ToggleButton* tb)
{
- /* XXX not very good MVC style here */
+ bool trace = tb->get_active();
- port->output()->trace (!tb->get_active(), &cerr, string (port->name()) + string (" output: "));
- tb->set_active (!tb->get_active());
- return stop_signal (*tb, "button_press_event");
+ if (port->output()->tracing() != trace) {
+ port->output()->trace (trace, &cerr, string (port->name()) + string (" output: "));
+ }
}
void
OptionEditor::raid_path_changed ()
{
if (session) {
- session->set_raid_path (session_raid_entry.get_text());
+ Config->set_raid_path (session_raid_entry.get_text());
}
}
if (session) {
string path = click_path_entry.get_text();
- if (path == session->click_sound) {
+ if (path == Config->get_click_sound()) {
return;
}
- if (path.length() == 0) {
-
- session->set_click_sound ("");
+ strip_whitespace_edges (path);
+ if (path == _("internal")) {
+ Config->set_click_sound ("");
} else {
-
- strip_whitespace_edges (path);
-
- if (path == _("internal")) {
- session->set_click_sound ("");
- } else {
- session->set_click_sound (path);
- }
+ Config->set_click_sound (path);
}
}
}
if (session) {
string path = click_emphasis_path_entry.get_text();
- if (path == session->click_emphasis_sound) {
+ if (path == Config->get_click_emphasis_sound()) {
return;
}
- if (path.length() == 0) {
-
- session->set_click_emphasis_sound ("");
+ strip_whitespace_edges (path);
+ if (path == _("internal")) {
+ Config->set_click_emphasis_sound ("");
} else {
-
- strip_whitespace_edges (path);
-
- if (path == _("internal")) {
- session->set_click_emphasis_sound ("");
- } else {
- session->set_click_emphasis_sound (path);
- }
+ Config->set_click_emphasis_sound (path);
}
}
}