2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2008-08-04 18:37:24 -04:00
|
|
|
Copyright (C) 2001-2006 Paul Davis
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
2008-03-17 16:54:03 -04:00
|
|
|
#include <pango/pangoft2.h> // for fontmap resolution control for GnomeCanvas
|
|
|
|
#include <pango/pangocairo.h> // for fontmap resolution control for GnomeCanvas
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-01-13 14:48:55 -05:00
|
|
|
#include <pbd/whitespace.h>
|
|
|
|
|
2008-02-16 17:43:18 -05:00
|
|
|
#include <ardour/ardour.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
#include <ardour/session.h>
|
|
|
|
#include <ardour/audioengine.h>
|
|
|
|
#include <ardour/configuration.h>
|
|
|
|
#include <ardour/auditioner.h>
|
2007-02-22 13:48:27 -05:00
|
|
|
#include <ardour/sndfilesource.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
#include <ardour/crossfade.h>
|
|
|
|
#include <midi++/manager.h>
|
2007-08-06 10:19:19 -04:00
|
|
|
#include <midi++/factory.h>
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <gtkmm2ext/stop_signal.h>
|
|
|
|
#include <gtkmm2ext/utils.h>
|
2007-03-18 12:45:43 -04:00
|
|
|
#include <gtkmm2ext/window_title.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include "public_editor.h"
|
2007-02-08 22:36:00 -05:00
|
|
|
#include "keyboard.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "mixer_ui.h"
|
|
|
|
#include "ardour_ui.h"
|
|
|
|
#include "io_selector.h"
|
|
|
|
#include "gain_meter.h"
|
2005-10-12 16:06:20 -04:00
|
|
|
#include "sfdb_ui.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "utils.h"
|
|
|
|
#include "editing.h"
|
|
|
|
#include "option_editor.h"
|
2007-08-06 10:19:19 -04:00
|
|
|
#include "midi_port_dialog.h"
|
2007-10-11 18:07:47 -04:00
|
|
|
#include "gui_thread.h"
|
2008-03-17 16:54:03 -04:00
|
|
|
#include "utils.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include "i18n.h"
|
|
|
|
|
|
|
|
using namespace ARDOUR;
|
2006-06-21 19:01:03 -04:00
|
|
|
using namespace PBD;
|
2005-09-25 14:42:24 -04:00
|
|
|
using namespace Gtk;
|
|
|
|
using namespace Editing;
|
2005-09-25 16:33:00 -04:00
|
|
|
using namespace Gtkmm2ext;
|
2005-10-12 16:06:20 -04:00
|
|
|
using namespace std;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
static vector<string> positional_sync_strings;
|
|
|
|
|
|
|
|
OptionEditor::OptionEditor (ARDOUR_UI& uip, PublicEditor& ed, Mixer_UI& mixui)
|
2007-10-11 18:07:47 -04:00
|
|
|
: ArdourDialog ("options editor", false),
|
2005-09-25 14:42:24 -04:00
|
|
|
ui (uip),
|
|
|
|
editor (ed),
|
|
|
|
mixer (mixui),
|
|
|
|
|
2005-12-09 09:16:02 -05:00
|
|
|
/* Paths */
|
|
|
|
path_table (11, 2),
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
/* misc */
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
short_xfade_adjustment (0, 1.0, 500.0, 5.0, 100.0),
|
|
|
|
short_xfade_slider (short_xfade_adjustment),
|
2006-03-21 11:59:48 -05:00
|
|
|
destructo_xfade_adjustment (1.0, 1.0, 500.0, 1.0, 100.0),
|
2006-03-21 10:27:57 -05:00
|
|
|
destructo_xfade_slider (destructo_xfade_adjustment),
|
2007-10-11 18:07:47 -04:00
|
|
|
history_depth (20, -1, 100, 1.0, 10.0),
|
|
|
|
saved_history_depth (20, 0, 100, 1.0, 10.0),
|
|
|
|
history_depth_spinner (history_depth),
|
|
|
|
saved_history_depth_spinner (saved_history_depth),
|
|
|
|
limit_history_button (_("Limit undo history")),
|
|
|
|
save_history_button (_("Save undo history")),
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
/* Sync */
|
|
|
|
|
2007-01-08 12:12:29 -05:00
|
|
|
smpte_offset_clock (X_("smpteoffset"), false, X_("SMPTEOffsetClock"), true, true),
|
2005-09-25 14:42:24 -04:00
|
|
|
smpte_offset_negative_button (_("SMPTE offset is negative")),
|
2007-10-11 18:07:47 -04:00
|
|
|
synced_timecode_button (_("Timecode source is sample-clock synced")),
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
/* MIDI */
|
|
|
|
|
2008-08-04 18:37:24 -04:00
|
|
|
midi_port_table (4, 12),
|
2007-08-06 10:19:19 -04:00
|
|
|
mmc_receive_device_id_adjustment (0.0, 0.0, (double) 0x7f, 1.0, 16.0),
|
|
|
|
mmc_receive_device_id_spinner (mmc_receive_device_id_adjustment),
|
|
|
|
mmc_send_device_id_adjustment (0.0, 0.0, (double) 0x7f, 1.0, 16.0),
|
|
|
|
mmc_send_device_id_spinner (mmc_send_device_id_adjustment),
|
2007-10-11 18:07:47 -04:00
|
|
|
add_midi_port_button (_("Add new MIDI port")),
|
2007-02-20 16:26:20 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
/* Click */
|
|
|
|
|
|
|
|
click_table (2, 3),
|
|
|
|
click_browse_button (_("Browse")),
|
|
|
|
click_emphasis_browse_button (_("Browse")),
|
|
|
|
|
|
|
|
/* kbd/mouse */
|
|
|
|
|
2008-02-16 17:43:18 -05:00
|
|
|
keyboard_mouse_table (4, 4),
|
2005-09-25 14:42:24 -04:00
|
|
|
delete_button_adjustment (3, 1, 5),
|
|
|
|
delete_button_spin (delete_button_adjustment),
|
|
|
|
edit_button_adjustment (3, 1, 5),
|
2006-01-07 21:56:49 -05:00
|
|
|
edit_button_spin (edit_button_adjustment)
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
using namespace Notebook_Helpers;
|
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
first_click_setup = true;
|
2005-09-25 14:42:24 -04:00
|
|
|
click_io_selector = 0;
|
|
|
|
auditioner_io_selector = 0;
|
2006-03-21 11:59:48 -05:00
|
|
|
session = 0;
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2007-03-18 12:45:43 -04:00
|
|
|
WindowTitle title(Glib::get_application_name());
|
2007-10-11 18:07:47 -04:00
|
|
|
title += _("Preferences");
|
2007-03-18 12:45:43 -04:00
|
|
|
set_title(title.get_string());
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
set_default_size (300, 300);
|
2007-10-11 18:07:47 -04:00
|
|
|
set_wmclass (X_("ardour_preferences"), "Ardour");
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
set_name ("Preferences");
|
2005-09-25 16:33:00 -04:00
|
|
|
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-11-29 12:27:58 -05:00
|
|
|
VBox *vbox = get_vbox();
|
2005-09-25 14:42:24 -04:00
|
|
|
set_border_width (3);
|
|
|
|
|
|
|
|
vbox->set_spacing (4);
|
|
|
|
vbox->pack_start(notebook);
|
|
|
|
|
2005-10-26 21:10:36 -04:00
|
|
|
signal_delete_event().connect (mem_fun(*this, &OptionEditor::wm_close));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
notebook.set_show_tabs (true);
|
|
|
|
notebook.set_show_border (true);
|
|
|
|
notebook.set_name ("OptionsNotebook");
|
|
|
|
|
|
|
|
setup_sync_options();
|
|
|
|
setup_path_options();
|
2007-10-11 18:07:47 -04:00
|
|
|
setup_misc_options ();
|
2005-09-25 14:42:24 -04:00
|
|
|
setup_keyboard_options ();
|
|
|
|
setup_auditioner_editor ();
|
|
|
|
|
|
|
|
notebook.pages().push_back (TabElem (sync_packer, _("Sync")));
|
|
|
|
notebook.pages().push_back (TabElem (path_table, _("Paths/Files")));
|
|
|
|
notebook.pages().push_back (TabElem (keyboard_mouse_table, _("Kbd/Mouse")));
|
|
|
|
notebook.pages().push_back (TabElem (click_packer, _("Click")));
|
|
|
|
notebook.pages().push_back (TabElem (audition_packer, _("Audition")));
|
2007-10-11 18:07:47 -04:00
|
|
|
notebook.pages().push_back (TabElem (misc_packer, _("Misc")));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
setup_midi_options ();
|
|
|
|
notebook.pages().push_back (TabElem (midi_packer, _("MIDI")));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
set_session (0);
|
2005-11-29 12:27:58 -05:00
|
|
|
show_all_children();
|
2007-10-11 18:07:47 -04:00
|
|
|
|
|
|
|
Config->map_parameters (mem_fun (*this, &OptionEditor::parameter_changed));
|
|
|
|
Config->ParameterChanged.connect (mem_fun (*this, &OptionEditor::parameter_changed));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::set_session (Session *s)
|
|
|
|
{
|
|
|
|
clear_click_editor ();
|
|
|
|
clear_auditioner_editor ();
|
|
|
|
|
|
|
|
click_path_entry.set_text ("");
|
|
|
|
click_emphasis_path_entry.set_text ("");
|
|
|
|
session_raid_entry.set_text ("");
|
|
|
|
|
|
|
|
click_path_entry.set_sensitive (false);
|
|
|
|
click_emphasis_path_entry.set_sensitive (false);
|
|
|
|
session_raid_entry.set_sensitive (false);
|
2006-01-07 21:56:49 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
short_xfade_slider.set_sensitive (false);
|
|
|
|
smpte_offset_negative_button.set_sensitive (false);
|
|
|
|
|
|
|
|
smpte_offset_clock.set_session (s);
|
|
|
|
|
|
|
|
if ((session = s) == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
click_path_entry.set_sensitive (true);
|
|
|
|
click_emphasis_path_entry.set_sensitive (true);
|
|
|
|
session_raid_entry.set_sensitive (true);
|
|
|
|
short_xfade_slider.set_sensitive (true);
|
|
|
|
smpte_offset_negative_button.set_sensitive (true);
|
|
|
|
|
|
|
|
smpte_offset_clock.set_session (s);
|
|
|
|
smpte_offset_clock.set (s->smpte_offset (), true);
|
|
|
|
|
|
|
|
smpte_offset_negative_button.set_active (session->smpte_offset_negative());
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
redisplay_midi_ports ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
setup_click_editor ();
|
|
|
|
connect_audition_editor ();
|
|
|
|
|
|
|
|
short_xfade_adjustment.set_value ((Crossfade::short_xfade_length() / (float) session->frame_rate()) * 1000.0);
|
|
|
|
|
|
|
|
add_session_paths ();
|
|
|
|
}
|
|
|
|
|
|
|
|
OptionEditor::~OptionEditor ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::setup_path_options()
|
|
|
|
{
|
|
|
|
Gtk::Label* label;
|
|
|
|
|
2006-01-04 00:53:51 -05:00
|
|
|
path_table.set_homogeneous (false);
|
2005-09-25 14:42:24 -04:00
|
|
|
path_table.set_border_width (12);
|
|
|
|
path_table.set_row_spacings (5);
|
|
|
|
|
|
|
|
session_raid_entry.set_name ("OptionsEntry");
|
|
|
|
|
2005-10-26 21:10:36 -04:00
|
|
|
session_raid_entry.signal_activate().connect (mem_fun(*this, &OptionEditor::raid_path_changed));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
label = manage(new Label(_("session RAID path")));
|
|
|
|
label->set_name ("OptionsLabel");
|
2005-10-26 21:10:36 -04:00
|
|
|
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);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
path_table.show_all();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::add_session_paths ()
|
|
|
|
{
|
|
|
|
click_path_entry.set_sensitive (true);
|
|
|
|
click_emphasis_path_entry.set_sensitive (true);
|
|
|
|
session_raid_entry.set_sensitive (true);
|
|
|
|
|
2006-09-25 17:24:00 -04:00
|
|
|
if (Config->get_click_sound().empty()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
click_path_entry.set_text (_("internal"));
|
|
|
|
} else {
|
2006-09-25 17:24:00 -04:00
|
|
|
click_path_entry.set_text (Config->get_click_sound());
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-09-25 17:24:00 -04:00
|
|
|
if (Config->get_click_emphasis_sound().empty()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
click_emphasis_path_entry.set_text (_("internal"));
|
|
|
|
} else {
|
2006-09-25 17:24:00 -04:00
|
|
|
click_emphasis_path_entry.set_text (Config->get_click_emphasis_sound());
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
session_raid_entry.set_text(session->raid_path());
|
|
|
|
}
|
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
static void
|
|
|
|
font_scale_changed (Gtk::Adjustment* adj)
|
|
|
|
{
|
|
|
|
Config->set_font_scale((long)floor (adj->get_value() * 1024));
|
|
|
|
reset_dpi();
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
2007-10-11 18:07:47 -04:00
|
|
|
OptionEditor::setup_misc_options ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
Gtk::HBox* hbox;
|
2008-03-17 16:54:03 -04:00
|
|
|
Label* label;
|
|
|
|
|
|
|
|
#ifndef GTKOSX
|
|
|
|
/* font scaling does nothing with GDK/Quartz */
|
|
|
|
|
|
|
|
Gtk::Adjustment* dpi_adj = new Gtk::Adjustment ((double)Config->get_font_scale() / 1024, 50, 250, 1, 10);
|
|
|
|
Gtk::HScale * dpi_range = new Gtk::HScale (*dpi_adj);
|
|
|
|
|
|
|
|
label = manage (new Label (_("Font Scaling")));
|
|
|
|
label->set_name ("OptionsLabel");
|
|
|
|
|
|
|
|
dpi_range->set_update_policy (Gtk::UPDATE_DISCONTINUOUS);
|
|
|
|
dpi_adj->signal_value_changed().connect (bind (sigc::ptr_fun (font_scale_changed), dpi_adj));
|
|
|
|
|
|
|
|
hbox = manage (new HBox);
|
|
|
|
hbox->set_border_width (5);
|
|
|
|
hbox->set_spacing (10);
|
|
|
|
hbox->pack_start (*label, false, false);
|
|
|
|
hbox->pack_start (*dpi_range, true, true);
|
|
|
|
misc_packer.pack_start (*hbox, false, false);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
label = manage (new Label (_("Short crossfade length (msecs)")));
|
2006-03-21 10:27:57 -05:00
|
|
|
label->set_name ("OptionsLabel");
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
hbox = manage (new HBox);
|
|
|
|
hbox->set_border_width (5);
|
|
|
|
hbox->set_spacing (10);
|
2006-03-21 10:27:57 -05:00
|
|
|
hbox->pack_start (*label, false, false);
|
|
|
|
hbox->pack_start (short_xfade_slider, true, true);
|
2007-10-11 18:07:47 -04:00
|
|
|
misc_packer.pack_start (*hbox, false, false);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-03-21 10:27:57 -05:00
|
|
|
short_xfade_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::short_xfade_adjustment_changed));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-03-21 10:27:57 -05:00
|
|
|
label = manage (new Label (_("Destructive crossfade length (msecs)")));
|
|
|
|
label->set_name ("OptionsLabel");
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
hbox = manage (new HBox);
|
|
|
|
hbox->set_border_width (5);
|
|
|
|
hbox->set_spacing (10);
|
2006-03-21 10:27:57 -05:00
|
|
|
hbox->pack_start (*label, false, false);
|
|
|
|
hbox->pack_start (destructo_xfade_slider, true, true);
|
2007-10-11 18:07:47 -04:00
|
|
|
misc_packer.pack_start (*hbox, false, false);
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2006-03-21 10:27:57 -05:00
|
|
|
destructo_xfade_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::destructo_xfade_adjustment_changed));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
hbox = manage (new HBox);
|
|
|
|
hbox->set_border_width (5);
|
|
|
|
hbox->set_spacing (10);
|
|
|
|
hbox->pack_start (limit_history_button, false, false);
|
|
|
|
misc_packer.pack_start (*hbox, false, false);
|
|
|
|
|
|
|
|
label = manage (new Label (_("History depth (commands)")));
|
|
|
|
label->set_name ("OptionsLabel");
|
|
|
|
|
|
|
|
hbox = manage (new HBox);
|
|
|
|
hbox->set_border_width (5);
|
|
|
|
hbox->set_spacing (10);
|
|
|
|
hbox->pack_start (*label, false, false);
|
|
|
|
hbox->pack_start (history_depth_spinner, false, false);
|
|
|
|
misc_packer.pack_start (*hbox, false, false);
|
|
|
|
|
|
|
|
history_depth.signal_value_changed().connect (mem_fun (*this, &OptionEditor::history_depth_changed));
|
|
|
|
saved_history_depth.signal_value_changed().connect (mem_fun (*this, &OptionEditor::saved_history_depth_changed));
|
|
|
|
save_history_button.signal_toggled().connect (mem_fun (*this, &OptionEditor::save_history_toggled));
|
|
|
|
limit_history_button.signal_toggled().connect (mem_fun (*this, &OptionEditor::limit_history_toggled));
|
|
|
|
|
|
|
|
hbox = manage (new HBox);
|
|
|
|
hbox->set_border_width (5);
|
|
|
|
hbox->set_spacing (10);
|
|
|
|
hbox->pack_start (save_history_button, false, false);
|
|
|
|
misc_packer.pack_start (*hbox, false, false);
|
|
|
|
|
|
|
|
label = manage (new Label (_("Saved history depth (commands)")));
|
|
|
|
label->set_name ("OptionsLabel");
|
|
|
|
|
|
|
|
hbox = manage (new HBox);
|
|
|
|
hbox->set_border_width (5);
|
|
|
|
hbox->set_spacing (10);
|
|
|
|
hbox->pack_start (*label, false, false);
|
|
|
|
hbox->pack_start (saved_history_depth_spinner, false, false);
|
|
|
|
misc_packer.pack_start (*hbox, false, false);
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2006-03-21 11:59:48 -05:00
|
|
|
short_xfade_slider.set_update_policy (UPDATE_DISCONTINUOUS);
|
|
|
|
destructo_xfade_slider.set_update_policy (UPDATE_DISCONTINUOUS);
|
|
|
|
|
|
|
|
destructo_xfade_adjustment.set_value (Config->get_destructive_xfade_msecs());
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
misc_packer.show_all ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::limit_history_toggled ()
|
|
|
|
{
|
|
|
|
bool x = limit_history_button.get_active();
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
if (!x) {
|
|
|
|
Config->set_history_depth (0);
|
|
|
|
history_depth_spinner.set_sensitive (false);
|
|
|
|
} else {
|
|
|
|
if (Config->get_history_depth() == 0) {
|
|
|
|
/* get back to a sane default */
|
|
|
|
Config->set_history_depth (20);
|
|
|
|
}
|
|
|
|
history_depth_spinner.set_sensitive (true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::save_history_toggled ()
|
|
|
|
{
|
|
|
|
bool x = save_history_button.get_active();
|
|
|
|
|
|
|
|
if (x != Config->get_save_history()) {
|
|
|
|
Config->set_save_history (x);
|
|
|
|
saved_history_depth_spinner.set_sensitive (x);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::history_depth_changed()
|
|
|
|
{
|
|
|
|
Config->set_history_depth ((int32_t) floor (history_depth.get_value()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::saved_history_depth_changed()
|
|
|
|
{
|
|
|
|
Config->set_saved_history_depth ((int32_t) floor (saved_history_depth.get_value()));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::short_xfade_adjustment_changed ()
|
|
|
|
{
|
|
|
|
if (session) {
|
|
|
|
float val = short_xfade_adjustment.get_value();
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
/* val is in msecs */
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2006-09-28 13:23:52 -04:00
|
|
|
Crossfade::set_short_xfade_length ((nframes_t) floor (session->frame_rate() * (val / 1000.0)));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-15 21:57:22 -05:00
|
|
|
void
|
2006-03-21 10:27:57 -05:00
|
|
|
OptionEditor::destructo_xfade_adjustment_changed ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-03-21 10:27:57 -05:00
|
|
|
float val = destructo_xfade_adjustment.get_value();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-03-21 10:27:57 -05:00
|
|
|
/* val is in msecs */
|
2006-11-02 21:41:56 -05:00
|
|
|
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2006-03-26 20:04:59 -05:00
|
|
|
Config->set_destructive_xfade_msecs ((uint32_t) floor (val));
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (session) {
|
2006-11-02 21:25:04 -05:00
|
|
|
SndFileSource::setup_standard_crossfades (session->frame_rate());
|
2008-08-04 18:37:24 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::setup_sync_options ()
|
|
|
|
{
|
|
|
|
HBox* hbox;
|
|
|
|
vector<string> dumb;
|
|
|
|
|
|
|
|
smpte_offset_clock.set_mode (AudioClock::SMPTE);
|
2005-09-25 17:19:23 -04:00
|
|
|
smpte_offset_clock.ValueChanged.connect (mem_fun(*this, &OptionEditor::smpte_offset_chosen));
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
smpte_offset_negative_button.set_name ("OptionEditorToggleButton");
|
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
smpte_offset_negative_button.unset_flags (Gtk::CAN_FOCUS);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
Label *smpte_offset_label = manage (new Label (_("SMPTE Offset")));
|
|
|
|
smpte_offset_label->set_name("OptionsLabel");
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
hbox = manage (new HBox);
|
|
|
|
hbox->set_border_width (5);
|
|
|
|
hbox->set_spacing (10);
|
|
|
|
hbox->pack_start (*smpte_offset_label, false, false);
|
|
|
|
hbox->pack_start (smpte_offset_clock, false, false);
|
|
|
|
hbox->pack_start (smpte_offset_negative_button, false, false);
|
|
|
|
|
|
|
|
sync_packer.pack_start (*hbox, false, false);
|
2007-10-11 18:07:47 -04:00
|
|
|
sync_packer.pack_start (synced_timecode_button, false, false);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-09-25 17:19:23 -04:00
|
|
|
smpte_offset_negative_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::smpte_offset_negative_clicked));
|
2007-10-11 18:07:47 -04:00
|
|
|
synced_timecode_button.signal_toggled().connect (mem_fun(*this, &OptionEditor::synced_timecode_toggled));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::smpte_offset_negative_clicked ()
|
|
|
|
{
|
|
|
|
if (session) {
|
|
|
|
session->set_smpte_offset_negative (smpte_offset_negative_button.get_active());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
void
|
|
|
|
OptionEditor::synced_timecode_toggled ()
|
|
|
|
{
|
|
|
|
bool x;
|
|
|
|
|
|
|
|
if ((x = synced_timecode_button.get_active()) != Config->get_timecode_source_is_synced()) {
|
|
|
|
Config->set_timecode_source_is_synced (x);
|
|
|
|
Config->save_state();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
|
|
|
OptionEditor::smpte_offset_chosen()
|
|
|
|
{
|
|
|
|
if (session) {
|
2006-09-28 13:23:52 -04:00
|
|
|
nframes_t frames = smpte_offset_clock.current_duration();
|
2005-09-25 14:42:24 -04:00
|
|
|
session->set_smpte_offset (frames);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
|
|
|
OptionEditor::setup_midi_options ()
|
|
|
|
{
|
|
|
|
HBox* hbox;
|
2007-08-06 10:19:19 -04:00
|
|
|
Label* label;
|
|
|
|
|
|
|
|
midi_port_table.set_row_spacings (6);
|
|
|
|
midi_port_table.set_col_spacings (10);
|
|
|
|
|
|
|
|
redisplay_midi_ports ();
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
mmc_receive_device_id_adjustment.set_value (Config->get_mmc_receive_device_id());
|
|
|
|
mmc_send_device_id_adjustment.set_value (Config->get_mmc_send_device_id());
|
|
|
|
|
2007-08-06 10:19:19 -04:00
|
|
|
mmc_receive_device_id_adjustment.signal_value_changed().connect (mem_fun (*this, &OptionEditor::mmc_receive_device_id_adjusted));
|
|
|
|
mmc_send_device_id_adjustment.signal_value_changed().connect (mem_fun (*this, &OptionEditor::mmc_send_device_id_adjusted));
|
|
|
|
|
|
|
|
hbox = manage (new HBox);
|
|
|
|
hbox->set_border_width (6);
|
|
|
|
hbox->pack_start (midi_port_table, true, false);
|
|
|
|
|
|
|
|
midi_packer.pack_start (*hbox, false, false);
|
2007-10-05 08:23:17 -04:00
|
|
|
add_midi_port_button.set_label ("Add MIDI port");
|
2007-08-06 10:19:19 -04:00
|
|
|
midi_packer.pack_start (add_midi_port_button, false, false);
|
|
|
|
|
|
|
|
hbox = manage (new HBox);
|
|
|
|
hbox->set_border_width (6);
|
|
|
|
hbox->set_spacing (6);
|
2008-08-04 18:37:24 -04:00
|
|
|
label = (manage (new Label (_("Inbound MMC Device ID"))));
|
2007-08-06 10:19:19 -04:00
|
|
|
hbox->pack_start (mmc_receive_device_id_spinner, false, false);
|
|
|
|
hbox->pack_start (*label, false, false);
|
2008-08-04 18:37:24 -04:00
|
|
|
midi_packer.pack_start (*hbox, false, false);
|
2007-10-11 18:07:47 -04:00
|
|
|
|
|
|
|
mmc_receive_device_id_spinner.set_value(Config->get_mmc_receive_device_id ());
|
2007-08-06 10:19:19 -04:00
|
|
|
|
|
|
|
hbox = manage (new HBox);
|
|
|
|
hbox->set_border_width (6);
|
|
|
|
hbox->set_spacing (6);
|
2008-08-04 18:37:24 -04:00
|
|
|
label = (manage (new Label (_("Outbound MMC Device ID"))));
|
2007-08-06 10:19:19 -04:00
|
|
|
hbox->pack_start (mmc_send_device_id_spinner, false, false);
|
|
|
|
hbox->pack_start (*label, false, false);
|
|
|
|
midi_packer.pack_start (*hbox, false, false);
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
mmc_send_device_id_spinner.set_value(Config->get_mmc_send_device_id ());
|
|
|
|
|
2007-08-06 10:19:19 -04:00
|
|
|
add_midi_port_button.signal_clicked().connect (mem_fun (*this, &OptionEditor::add_midi_port));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::redisplay_midi_ports ()
|
|
|
|
{
|
2005-09-25 14:42:24 -04:00
|
|
|
MIDI::Manager::PortMap::const_iterator i;
|
|
|
|
const MIDI::Manager::PortMap& ports = MIDI::Manager::instance()->get_midi_ports();
|
|
|
|
int n;
|
|
|
|
|
2007-08-06 10:19:19 -04:00
|
|
|
/* remove all existing widgets */
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-08-06 10:19:19 -04:00
|
|
|
// XXX broken in gtkmm 2.10
|
|
|
|
// midi_port_table.clear ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-08-06 10:19:19 -04:00
|
|
|
for (vector<Widget*>::iterator w = midi_port_table_widgets.begin(); w != midi_port_table_widgets.end(); ++w) {
|
|
|
|
midi_port_table.remove (**w);
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-08-06 10:19:19 -04:00
|
|
|
midi_port_table_widgets.clear ();
|
2007-02-20 16:26:20 -05:00
|
|
|
|
2008-08-04 18:37:24 -04:00
|
|
|
midi_port_table.resize (ports.size() + 4, 12);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-08-06 10:19:19 -04:00
|
|
|
Gtk::Label* label;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-08-04 18:37:24 -04:00
|
|
|
label = (manage (new Label (_("Port"))));
|
2007-08-06 10:19:19 -04:00
|
|
|
label->show ();
|
|
|
|
midi_port_table_widgets.push_back (label);
|
|
|
|
midi_port_table.attach (*label, 0, 1, 0, 1);
|
2008-08-04 18:37:24 -04:00
|
|
|
label = (manage (new Label (_("Offline"))));
|
2007-08-06 10:19:19 -04:00
|
|
|
label->show ();
|
|
|
|
midi_port_table_widgets.push_back (label);
|
|
|
|
midi_port_table.attach (*label, 1, 2, 0, 1);
|
2008-08-04 18:37:24 -04:00
|
|
|
label = (manage (new Label (_("Trace\nInput"))));
|
2007-08-06 10:19:19 -04:00
|
|
|
label->show ();
|
|
|
|
midi_port_table_widgets.push_back (label);
|
|
|
|
midi_port_table.attach (*label, 2, 3, 0, 1);
|
2008-08-04 18:37:24 -04:00
|
|
|
label = (manage (new Label (_("Trace\nOutput"))));
|
2007-08-06 10:19:19 -04:00
|
|
|
label->show ();
|
|
|
|
midi_port_table_widgets.push_back (label);
|
|
|
|
midi_port_table.attach (*label, 3, 4, 0, 1);
|
2008-08-04 18:37:24 -04:00
|
|
|
label = (manage (new Label (_("MTC"))));
|
2007-08-06 10:19:19 -04:00
|
|
|
label->show ();
|
|
|
|
midi_port_table_widgets.push_back (label);
|
|
|
|
midi_port_table.attach (*label, 4, 5, 0, 1);
|
2008-08-04 18:37:24 -04:00
|
|
|
label = (manage (new Label (_("MIDI\nClock"))));
|
2007-08-06 10:19:19 -04:00
|
|
|
label->show ();
|
|
|
|
midi_port_table_widgets.push_back (label);
|
|
|
|
midi_port_table.attach (*label, 6, 7, 0, 1);
|
2008-08-04 18:37:24 -04:00
|
|
|
label = (manage (new Label (_("MMC"))));
|
2007-08-06 10:19:19 -04:00
|
|
|
label->show ();
|
|
|
|
midi_port_table_widgets.push_back (label);
|
|
|
|
midi_port_table.attach (*label, 8, 9, 0, 1);
|
2008-08-04 18:37:24 -04:00
|
|
|
label = (manage (new Label (_("MIDI Parameter\nControl"))));
|
|
|
|
label->show ();
|
|
|
|
midi_port_table_widgets.push_back (label);
|
|
|
|
midi_port_table.attach (*label, 10, 11, 0, 1);
|
2007-08-06 10:19:19 -04:00
|
|
|
|
2008-08-04 18:37:24 -04:00
|
|
|
Gtk::HSeparator* hsep = (manage (new HSeparator()));
|
2007-08-06 10:19:19 -04:00
|
|
|
hsep->show ();
|
|
|
|
midi_port_table_widgets.push_back (hsep);
|
2008-08-04 18:37:24 -04:00
|
|
|
midi_port_table.attach (*hsep, 0, 11, 1, 2);
|
|
|
|
Gtk::VSeparator* vsep = (manage (new VSeparator()));
|
2007-08-06 10:19:19 -04:00
|
|
|
vsep->show ();
|
|
|
|
midi_port_table_widgets.push_back (vsep);
|
|
|
|
midi_port_table.attach (*vsep, 5, 6, 0, 8);
|
2008-08-04 18:37:24 -04:00
|
|
|
vsep = (manage (new VSeparator()));
|
2007-08-06 10:19:19 -04:00
|
|
|
vsep->show ();
|
|
|
|
midi_port_table_widgets.push_back (vsep);
|
|
|
|
midi_port_table.attach (*vsep, 7, 8, 0, 8);
|
2008-08-04 18:37:24 -04:00
|
|
|
vsep = (manage (new VSeparator()));
|
|
|
|
vsep->show ();
|
|
|
|
midi_port_table_widgets.push_back (vsep);
|
|
|
|
midi_port_table.attach (*vsep, 9, 10, 0, 8);
|
|
|
|
|
2007-08-06 10:19:19 -04:00
|
|
|
for (n = 0, i = ports.begin(); i != ports.end(); ++n, ++i) {
|
|
|
|
|
|
|
|
ToggleButton* tb;
|
|
|
|
RadioButton* rb;
|
|
|
|
Button* bb;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-08-06 10:19:19 -04:00
|
|
|
/* the remove button. create early so we can pass it to various callbacks */
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2007-08-06 10:19:19 -04:00
|
|
|
bb = manage (new Button (Stock::REMOVE));
|
|
|
|
bb->set_name ("OptionEditorToggleButton");
|
|
|
|
bb->show ();
|
|
|
|
midi_port_table_widgets.push_back (bb);
|
2008-08-04 18:37:24 -04:00
|
|
|
midi_port_table.attach (*bb, 11, 12, n+2, n+3, FILL|EXPAND, FILL);
|
2007-08-06 10:19:19 -04:00
|
|
|
bb->signal_clicked().connect (bind (mem_fun(*this, &OptionEditor::remove_midi_port), i->second));
|
|
|
|
bb->set_sensitive (port_removable (i->second));
|
|
|
|
|
2008-08-04 18:37:24 -04:00
|
|
|
label = (manage (new Label (i->first)));
|
2007-08-06 10:19:19 -04:00
|
|
|
label->show ();
|
|
|
|
midi_port_table_widgets.push_back (label);
|
|
|
|
midi_port_table.attach (*label, 0, 1, n+2, n+3,FILL|EXPAND, FILL );
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
tb = manage (new ToggleButton (_("online")));
|
|
|
|
tb->set_name ("OptionEditorToggleButton");
|
|
|
|
|
|
|
|
/* remember, we have to handle the i18n case where the relative
|
|
|
|
lengths of the strings in language N is different than in english.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (strlen (_("offline")) > strlen (_("online"))) {
|
2005-09-25 16:33:00 -04:00
|
|
|
set_size_request_to_display_given_text (*tb, _("offline"), 15, 12);
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
2005-09-25 16:33:00 -04:00
|
|
|
set_size_request_to_display_given_text (*tb, _("online"), 15, 12);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2007-08-06 10:19:19 -04:00
|
|
|
if (i->second->input()) {
|
|
|
|
tb->set_active (!i->second->input()->offline());
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
tb->show ();
|
|
|
|
midi_port_table_widgets.push_back (tb);
|
|
|
|
midi_port_table.attach (*tb, 1, 2, n+2, n+3, FILL|EXPAND, FILL);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-08-04 18:37:24 -04:00
|
|
|
// Trace MIDI Input
|
2005-09-25 14:42:24 -04:00
|
|
|
tb = manage (new ToggleButton ());
|
|
|
|
tb->set_name ("OptionEditorToggleButton");
|
2006-11-17 11:14:44 -05:00
|
|
|
tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_trace_in_toggled), (*i).second, tb));
|
2005-09-25 16:33:00 -04:00
|
|
|
tb->set_size_request (10, 10);
|
2007-08-06 10:19:19 -04:00
|
|
|
tb->show ();
|
|
|
|
midi_port_table_widgets.push_back (tb);
|
|
|
|
midi_port_table.attach (*tb, 2, 3, n+2, n+3, FILL|EXPAND, FILL);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-08-04 18:37:24 -04:00
|
|
|
// Trace MIDI Output
|
2005-09-25 14:42:24 -04:00
|
|
|
tb = manage (new ToggleButton ());
|
|
|
|
tb->set_name ("OptionEditorToggleButton");
|
2006-11-17 11:14:44 -05:00
|
|
|
tb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::port_trace_out_toggled), (*i).second, tb));
|
2005-09-25 16:33:00 -04:00
|
|
|
tb->set_size_request (10, 10);
|
2007-08-06 10:19:19 -04:00
|
|
|
tb->show ();
|
|
|
|
midi_port_table_widgets.push_back (tb);
|
|
|
|
midi_port_table.attach (*tb, 3, 4, n+2, n+3, FILL|EXPAND, FILL);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-08-04 18:37:24 -04:00
|
|
|
// MTC Radio Button
|
2005-09-25 14:42:24 -04:00
|
|
|
rb = manage (new RadioButton ());
|
|
|
|
rb->set_name ("OptionEditorToggleButton");
|
|
|
|
if (n == 0) {
|
2005-11-12 17:07:07 -05:00
|
|
|
mtc_button_group = rb->get_group();
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
2005-11-12 17:07:07 -05:00
|
|
|
rb->set_group (mtc_button_group);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2007-08-06 10:19:19 -04:00
|
|
|
rb->show ();
|
|
|
|
midi_port_table_widgets.push_back (rb);
|
|
|
|
midi_port_table.attach (*rb, 4, 5, n+2, n+3, FILL|EXPAND, FILL);
|
|
|
|
rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::mtc_port_chosen), (*i).second, rb, bb));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-08-06 10:19:19 -04:00
|
|
|
if (session && i->second == session->mtc_port()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
rb->set_active (true);
|
|
|
|
}
|
2008-08-04 18:37:24 -04:00
|
|
|
|
|
|
|
// MIDI Clock Radio Button
|
|
|
|
rb = manage (new RadioButton ());
|
|
|
|
rb->set_name ("OptionEditorToggleButton");
|
|
|
|
if (n == 0) {
|
|
|
|
midi_clock_button_group = rb->get_group();
|
|
|
|
} else {
|
|
|
|
rb->set_group (midi_clock_button_group);
|
|
|
|
}
|
|
|
|
rb->show ();
|
|
|
|
midi_port_table_widgets.push_back (rb);
|
|
|
|
midi_port_table.attach (*rb, 6, 7, n+2, n+3, FILL|EXPAND, FILL);
|
|
|
|
rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::midi_clock_port_chosen), (*i).second, rb, bb));
|
|
|
|
|
|
|
|
if (session && i->second == session->midi_clock_port()) {
|
|
|
|
rb->set_active (true);
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
rb = manage (new RadioButton ());
|
|
|
|
rb->set_name ("OptionEditorToggleButton");
|
|
|
|
if (n == 0) {
|
2005-11-12 17:07:07 -05:00
|
|
|
mmc_button_group = rb->get_group();
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
2005-11-12 17:07:07 -05:00
|
|
|
rb->set_group (mmc_button_group);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2007-08-06 10:19:19 -04:00
|
|
|
rb->show ();
|
|
|
|
midi_port_table_widgets.push_back (rb);
|
2008-08-04 18:37:24 -04:00
|
|
|
midi_port_table.attach (*rb, 8, 9, n+2, n+3, FILL|EXPAND, FILL);
|
2007-08-06 10:19:19 -04:00
|
|
|
rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::mmc_port_chosen), (*i).second, rb, bb));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-08-06 10:19:19 -04:00
|
|
|
if (session && i->second == session->mmc_port()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
rb->set_active (true);
|
|
|
|
}
|
|
|
|
|
|
|
|
rb = manage (new RadioButton ());
|
|
|
|
rb->set_name ("OptionEditorToggleButton");
|
|
|
|
if (n == 0) {
|
2005-11-12 17:07:07 -05:00
|
|
|
midi_button_group = rb->get_group();
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
2005-11-12 17:07:07 -05:00
|
|
|
rb->set_group (midi_button_group);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2007-08-06 10:19:19 -04:00
|
|
|
rb->show ();
|
|
|
|
midi_port_table_widgets.push_back (rb);
|
2008-08-04 18:37:24 -04:00
|
|
|
midi_port_table.attach (*rb, 10, 11, n+2, n+3, FILL|EXPAND, FILL);
|
2007-08-06 10:19:19 -04:00
|
|
|
rb->signal_toggled().connect (bind (mem_fun(*this, &OptionEditor::midi_port_chosen), (*i).second, rb, bb));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-08-06 10:19:19 -04:00
|
|
|
if (session && i->second == session->midi_port()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
rb->set_active (true);
|
|
|
|
}
|
2007-08-06 10:19:19 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2007-08-06 10:19:19 -04:00
|
|
|
midi_port_table.show();
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-08-06 10:19:19 -04:00
|
|
|
void
|
|
|
|
OptionEditor::remove_midi_port (MIDI::Port* port)
|
|
|
|
{
|
|
|
|
MIDI::Manager::instance()->remove_port (port);
|
|
|
|
redisplay_midi_ports ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-02-05 16:29:22 -05:00
|
|
|
void
|
2007-08-06 10:19:19 -04:00
|
|
|
OptionEditor::add_midi_port ()
|
|
|
|
{
|
|
|
|
MidiPortDialog dialog;
|
|
|
|
|
|
|
|
dialog.set_position (WIN_POS_MOUSE);
|
|
|
|
dialog.set_transient_for (*this);
|
|
|
|
|
|
|
|
dialog.show ();
|
|
|
|
|
|
|
|
int ret = dialog.run ();
|
|
|
|
|
|
|
|
switch (ret) {
|
|
|
|
case RESPONSE_ACCEPT:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
Glib::ustring mode = dialog.port_mode_combo.get_active_text();
|
|
|
|
std::string smod;
|
|
|
|
|
|
|
|
if (mode == _("input")) {
|
|
|
|
smod = X_("input");
|
|
|
|
} else if (mode == (_("output"))) {
|
|
|
|
smod = X_("output");
|
|
|
|
} else {
|
|
|
|
smod = "duplex";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
XMLNode node (X_("MIDI-port"));
|
|
|
|
|
|
|
|
node.add_property ("tag", dialog.port_name.get_text());
|
|
|
|
node.add_property ("device", X_("ardour")); // XXX this can't be right for all types
|
|
|
|
node.add_property ("type", MIDI::PortFactory::default_port_type());
|
|
|
|
node.add_property ("mode", smod);
|
|
|
|
|
|
|
|
if (MIDI::Manager::instance()->add_port (node) != 0) {
|
2007-08-06 10:19:19 -04:00
|
|
|
redisplay_midi_ports ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
OptionEditor::port_removable (MIDI::Port *port)
|
|
|
|
{
|
|
|
|
if (!session) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (port == session->mtc_port() ||
|
|
|
|
port == session->mmc_port() ||
|
|
|
|
port == session->midi_port()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2008-08-04 18:37:24 -04:00
|
|
|
OptionEditor::mtc_port_chosen (MIDI::Port *port, Gtk::RadioButton* rb, Gtk::Button* bb)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
if (session) {
|
2006-02-05 16:29:22 -05:00
|
|
|
if (rb->get_active()) {
|
2007-08-06 10:19:19 -04:00
|
|
|
session->set_mtc_port (port->name());
|
|
|
|
Config->set_mtc_port_name (port->name());
|
|
|
|
} else {
|
|
|
|
session->set_mtc_port ("");
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2007-08-06 10:19:19 -04:00
|
|
|
bb->set_sensitive (port_removable (port));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-05 16:29:22 -05:00
|
|
|
void
|
2007-08-06 10:19:19 -04:00
|
|
|
OptionEditor::mmc_port_chosen (MIDI::Port* port, Gtk::RadioButton* rb, Gtk::Button* bb)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
if (session) {
|
2006-02-05 16:29:22 -05:00
|
|
|
if (rb->get_active()) {
|
2007-08-06 10:19:19 -04:00
|
|
|
session->set_mmc_port (port->name());
|
|
|
|
Config->set_mtc_port_name (port->name());
|
|
|
|
} else {
|
|
|
|
session->set_mmc_port ("");
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2007-08-06 10:19:19 -04:00
|
|
|
bb->set_sensitive (port_removable (port));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-05 16:29:22 -05:00
|
|
|
void
|
2007-08-06 10:19:19 -04:00
|
|
|
OptionEditor::midi_port_chosen (MIDI::Port* port, Gtk::RadioButton* rb, Gtk::Button* bb)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
if (session) {
|
2006-02-05 16:29:22 -05:00
|
|
|
if (rb->get_active()) {
|
2007-08-06 10:19:19 -04:00
|
|
|
session->set_midi_port (port->name());
|
|
|
|
Config->set_midi_port_name (port->name());
|
|
|
|
} else {
|
|
|
|
session->set_midi_port ("");
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2007-08-06 10:19:19 -04:00
|
|
|
bb->set_sensitive (port_removable (port));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-04 18:37:24 -04:00
|
|
|
void
|
|
|
|
OptionEditor::midi_clock_port_chosen (MIDI::Port *port, Gtk::RadioButton* rb, Gtk::Button* bb)
|
|
|
|
{
|
|
|
|
if (session) {
|
|
|
|
if (rb->get_active()) {
|
|
|
|
session->set_midi_clock_port (port->name());
|
|
|
|
Config->set_midi_clock_port_name (port->name());
|
|
|
|
} else {
|
|
|
|
session->set_midi_clock_port ("");
|
|
|
|
}
|
|
|
|
bb->set_sensitive (port_removable (port));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-17 11:14:44 -05:00
|
|
|
void
|
|
|
|
OptionEditor::port_online_toggled (MIDI::Port* port, ToggleButton* tb)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-11-17 11:14:44 -05:00
|
|
|
bool wanted = tb->get_active();
|
2006-12-18 21:41:19 -05:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
if (port->input()) {
|
|
|
|
if (wanted != port->input()->offline()) {
|
|
|
|
port->input()->set_offline (wanted);
|
2008-08-04 18:37:24 -04:00
|
|
|
}
|
2007-10-11 18:07:47 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::map_port_online (MIDI::Port* port, ToggleButton* tb)
|
|
|
|
{
|
2006-12-18 21:41:19 -05:00
|
|
|
bool bstate = tb->get_active ();
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
if (port->input()) {
|
|
|
|
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);
|
|
|
|
}
|
2006-12-18 21:41:19 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-20 16:26:20 -05:00
|
|
|
void
|
2007-08-06 10:19:19 -04:00
|
|
|
OptionEditor::mmc_receive_device_id_adjusted ()
|
|
|
|
{
|
|
|
|
uint8_t id = (uint8_t) mmc_receive_device_id_spinner.get_value();
|
2007-10-11 18:07:47 -04:00
|
|
|
Config->set_mmc_receive_device_id (id);
|
2007-08-06 10:19:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::mmc_send_device_id_adjusted ()
|
2007-02-20 16:26:20 -05:00
|
|
|
{
|
2007-08-06 10:19:19 -04:00
|
|
|
uint8_t id = (uint8_t) mmc_send_device_id_spinner.get_value();
|
2007-10-11 18:07:47 -04:00
|
|
|
Config->set_mmc_send_device_id (id);
|
2007-02-20 16:26:20 -05:00
|
|
|
}
|
|
|
|
|
2006-11-17 11:14:44 -05:00
|
|
|
void
|
|
|
|
OptionEditor::port_trace_in_toggled (MIDI::Port* port, ToggleButton* tb)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-11-17 11:14:44 -05:00
|
|
|
bool trace = tb->get_active();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
if (port->input()) {
|
|
|
|
if (port->input()->tracing() != trace) {
|
|
|
|
port->input()->trace (trace, &cerr, string (port->name()) + string (" input: "));
|
|
|
|
}
|
2006-11-17 11:14:44 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2006-11-17 11:14:44 -05:00
|
|
|
void
|
|
|
|
OptionEditor::port_trace_out_toggled (MIDI::Port* port, ToggleButton* tb)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2006-11-17 11:14:44 -05:00
|
|
|
bool trace = tb->get_active();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
if (port->output()) {
|
|
|
|
if (port->output()->tracing() != trace) {
|
|
|
|
port->output()->trace (trace, &cerr, string (port->name()) + string (" output: "));
|
|
|
|
}
|
2006-11-17 11:14:44 -05:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::save ()
|
|
|
|
{
|
|
|
|
/* XXX a bit odd that we save the entire session state here */
|
|
|
|
|
|
|
|
ui.save_state ("");
|
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
|
|
|
OptionEditor::wm_close (GdkEventAny *ev)
|
|
|
|
{
|
|
|
|
save ();
|
2006-01-07 21:56:49 -05:00
|
|
|
hide ();
|
2005-09-25 14:42:24 -04:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::raid_path_changed ()
|
|
|
|
{
|
|
|
|
if (session) {
|
2006-09-25 17:24:00 -04:00
|
|
|
Config->set_raid_path (session_raid_entry.get_text());
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::click_browse_clicked ()
|
|
|
|
{
|
2007-10-11 18:07:47 -04:00
|
|
|
SoundFileChooser sfdb (*this, _("Choose Click"), session);
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
sfdb.show_all ();
|
|
|
|
sfdb.present ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
int result = sfdb.run ();
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-10-12 23:48:57 -04:00
|
|
|
if (result == Gtk::RESPONSE_OK) {
|
|
|
|
click_chosen(sfdb.get_filename());
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2005-10-12 16:06:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-12-22 07:23:54 -05:00
|
|
|
OptionEditor::click_chosen (const string & path)
|
2005-10-12 16:06:20 -04:00
|
|
|
{
|
2005-09-25 14:42:24 -04:00
|
|
|
click_path_entry.set_text (path);
|
|
|
|
click_sound_changed ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::click_emphasis_browse_clicked ()
|
|
|
|
{
|
2007-10-11 18:07:47 -04:00
|
|
|
SoundFileChooser sfdb (*this, _("Choose Click Emphasis"), session);
|
|
|
|
|
|
|
|
sfdb.show_all ();
|
|
|
|
sfdb.present ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-10-12 16:06:20 -04:00
|
|
|
int result = sfdb.run ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-10-12 23:48:57 -04:00
|
|
|
if (result == Gtk::RESPONSE_OK) {
|
|
|
|
click_emphasis_chosen (sfdb.get_filename());
|
2005-10-12 16:06:20 -04:00
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-12-22 07:23:54 -05:00
|
|
|
OptionEditor::click_emphasis_chosen (const string & path)
|
2008-08-04 18:37:24 -04:00
|
|
|
{
|
2005-09-25 14:42:24 -04:00
|
|
|
click_emphasis_path_entry.set_text (path);
|
|
|
|
click_emphasis_sound_changed ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::click_sound_changed ()
|
|
|
|
{
|
|
|
|
if (session) {
|
|
|
|
string path = click_path_entry.get_text();
|
|
|
|
|
2006-09-25 17:24:00 -04:00
|
|
|
if (path == Config->get_click_sound()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
strip_whitespace_edges (path);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
if (path == _("internal")) {
|
2006-09-25 17:24:00 -04:00
|
|
|
Config->set_click_sound ("");
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
2006-12-01 01:01:30 -05:00
|
|
|
Config->set_click_sound (path);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::click_emphasis_sound_changed ()
|
|
|
|
{
|
|
|
|
if (session) {
|
|
|
|
string path = click_emphasis_path_entry.get_text();
|
|
|
|
|
2006-09-25 17:24:00 -04:00
|
|
|
if (path == Config->get_click_emphasis_sound()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
strip_whitespace_edges (path);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
if (path == _("internal")) {
|
2006-09-25 17:24:00 -04:00
|
|
|
Config->set_click_emphasis_sound ("");
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
2006-12-01 01:01:30 -05:00
|
|
|
Config->set_click_emphasis_sound (path);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::clear_click_editor ()
|
|
|
|
{
|
|
|
|
if (click_io_selector) {
|
2008-09-10 11:03:30 -04:00
|
|
|
click_hpacker.remove (*click_io_selector);
|
|
|
|
click_hpacker.remove (*click_gpm);
|
2005-09-25 14:42:24 -04:00
|
|
|
delete click_io_selector;
|
|
|
|
delete click_gpm;
|
|
|
|
click_io_selector = 0;
|
|
|
|
click_gpm = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::setup_click_editor ()
|
|
|
|
{
|
|
|
|
Label* label;
|
2008-09-10 11:03:30 -04:00
|
|
|
|
|
|
|
if (first_click_setup) {
|
|
|
|
|
|
|
|
click_path_entry.set_name ("OptionsEntry");
|
|
|
|
click_emphasis_path_entry.set_name ("OptionsEntry");
|
|
|
|
|
|
|
|
click_path_entry.signal_activate().connect (mem_fun(*this, &OptionEditor::click_sound_changed));
|
|
|
|
click_emphasis_path_entry.signal_activate().connect (mem_fun(*this, &OptionEditor::click_emphasis_sound_changed));
|
|
|
|
|
|
|
|
click_path_entry.signal_focus_out_event().connect (bind (mem_fun(*this, &OptionEditor::focus_out_event_handler), &OptionEditor::click_sound_changed));
|
|
|
|
click_emphasis_path_entry.signal_focus_out_event().connect (bind (mem_fun(*this, &OptionEditor::focus_out_event_handler), &OptionEditor::click_emphasis_sound_changed));
|
|
|
|
|
|
|
|
click_browse_button.set_name ("EditorGTKButton");
|
|
|
|
click_emphasis_browse_button.set_name ("EditorGTKButton");
|
|
|
|
|
|
|
|
click_browse_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::click_browse_clicked));
|
|
|
|
click_emphasis_browse_button.signal_clicked().connect (mem_fun(*this, &OptionEditor::click_emphasis_browse_clicked));
|
|
|
|
|
|
|
|
click_packer.set_border_width (12);
|
|
|
|
click_packer.set_spacing (5);
|
|
|
|
|
|
|
|
click_table.set_col_spacings (10);
|
|
|
|
|
|
|
|
label = manage(new Label(_("Click audio file")));
|
|
|
|
label->set_name ("OptionsLabel");
|
|
|
|
click_table.attach (*label, 0, 1, 0, 1, FILL|EXPAND, FILL);
|
|
|
|
click_table.attach (click_path_entry, 1, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
|
|
|
|
click_table.attach (click_browse_button, 2, 3, 0, 1, FILL|EXPAND, FILL);
|
|
|
|
|
|
|
|
label = manage(new Label(_("Click emphasis audiofile")));
|
|
|
|
label->set_name ("OptionsLabel");
|
|
|
|
click_table.attach (*label, 0, 1, 1, 2, FILL|EXPAND, FILL);
|
|
|
|
click_table.attach (click_emphasis_path_entry, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
|
|
|
|
click_table.attach (click_emphasis_browse_button, 2, 3, 1, 2, FILL|EXPAND, FILL);
|
|
|
|
|
|
|
|
click_packer.pack_start (click_table, false, false);
|
|
|
|
click_packer.pack_start (click_hpacker, false, false);
|
|
|
|
|
|
|
|
|
|
|
|
click_hpacker.set_spacing (10);
|
|
|
|
|
|
|
|
first_click_setup = false;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
click_path_entry.set_sensitive (true);
|
|
|
|
click_emphasis_path_entry.set_sensitive (true);
|
|
|
|
|
|
|
|
click_io_selector = new IOSelector (*session, session->click_io(), false);
|
|
|
|
click_gpm = new GainMeter (session->click_io(), *session);
|
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
click_hpacker.pack_start (*click_io_selector, false, false);
|
|
|
|
click_hpacker.pack_start (*click_gpm, false, false);
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
click_table.set_col_spacings (10);
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
label = manage(new Label(_("Click audio file")));
|
|
|
|
label->set_name ("OptionsLabel");
|
2005-10-26 21:10:36 -04:00
|
|
|
click_table.attach (*label, 0, 1, 0, 1, FILL|EXPAND, FILL);
|
|
|
|
click_table.attach (click_path_entry, 1, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
|
|
|
|
click_table.attach (click_browse_button, 2, 3, 0, 1, FILL|EXPAND, FILL);
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
label = manage(new Label(_("Click emphasis audiofile")));
|
|
|
|
label->set_name ("OptionsLabel");
|
2005-10-26 21:10:36 -04:00
|
|
|
click_table.attach (*label, 0, 1, 1, 2, FILL|EXPAND, FILL);
|
|
|
|
click_table.attach (click_emphasis_path_entry, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
|
|
|
|
click_table.attach (click_emphasis_browse_button, 2, 3, 1, 2, FILL|EXPAND, FILL);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
click_packer.show_all ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::clear_auditioner_editor ()
|
|
|
|
{
|
|
|
|
if (auditioner_io_selector) {
|
|
|
|
audition_hpacker.remove (*auditioner_io_selector);
|
|
|
|
audition_hpacker.remove (*auditioner_gpm);
|
|
|
|
delete auditioner_io_selector;
|
|
|
|
delete auditioner_gpm;
|
|
|
|
auditioner_io_selector = 0;
|
|
|
|
auditioner_gpm = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::setup_auditioner_editor ()
|
|
|
|
{
|
|
|
|
audition_packer.set_border_width (12);
|
|
|
|
audition_packer.set_spacing (5);
|
|
|
|
audition_hpacker.set_spacing (10);
|
|
|
|
|
|
|
|
audition_label.set_name ("OptionEditorAuditionerLabel");
|
|
|
|
audition_label.set_text (_("The auditioner is a dedicated mixer strip used\n"
|
|
|
|
"for listening to specific regions outside the context\n"
|
|
|
|
"of the overall mix. It can be connected just like any\n"
|
|
|
|
"other mixer strip."));
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
audition_packer.pack_start (audition_label, false, false, 10);
|
|
|
|
audition_packer.pack_start (audition_hpacker, false, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::connect_audition_editor ()
|
|
|
|
{
|
|
|
|
auditioner_io_selector = new IOSelector (*session, session->the_auditioner(), false);
|
|
|
|
auditioner_gpm = new GainMeter (session->the_auditioner(), *session);
|
|
|
|
|
|
|
|
audition_hpacker.pack_start (*auditioner_io_selector, false, false);
|
|
|
|
audition_hpacker.pack_start (*auditioner_gpm, false, false);
|
|
|
|
|
|
|
|
auditioner_io_selector->show_all ();
|
|
|
|
auditioner_gpm->show_all ();
|
|
|
|
}
|
|
|
|
|
2005-11-22 23:13:32 -05:00
|
|
|
bool
|
2008-08-04 18:37:24 -04:00
|
|
|
OptionEditor::focus_out_event_handler (GdkEventFocus* ev, void (OptionEditor::*pmf)())
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
(this->*pmf)();
|
2005-11-22 23:13:32 -05:00
|
|
|
return false;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct {
|
|
|
|
const char *name;
|
|
|
|
guint modifier;
|
|
|
|
} modifiers[] = {
|
2008-01-10 16:20:59 -05:00
|
|
|
|
2008-08-04 18:37:24 -04:00
|
|
|
#ifdef GTKOSX
|
2008-01-10 16:20:59 -05:00
|
|
|
|
2008-02-16 17:43:18 -05:00
|
|
|
/* Command = Meta
|
|
|
|
Option/Alt = Mod1
|
2008-01-10 16:20:59 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
{ "Shift", GDK_SHIFT_MASK },
|
2008-02-16 17:43:18 -05:00
|
|
|
{ "Command", GDK_META_MASK },
|
2008-01-10 16:20:59 -05:00
|
|
|
{ "Control", GDK_CONTROL_MASK },
|
2008-02-16 17:43:18 -05:00
|
|
|
{ "Option", GDK_MOD1_MASK },
|
2008-01-10 16:20:59 -05:00
|
|
|
{ "Command-Shift", GDK_MOD1_MASK|GDK_SHIFT_MASK },
|
|
|
|
{ "Command-Option", GDK_MOD1_MASK|GDK_MOD5_MASK },
|
|
|
|
{ "Shift-Option", GDK_SHIFT_MASK|GDK_MOD5_MASK },
|
|
|
|
{ "Shift-Command-Option", GDK_MOD5_MASK|GDK_SHIFT_MASK|GDK_MOD1_MASK },
|
|
|
|
|
|
|
|
#else
|
2005-09-25 14:42:24 -04:00
|
|
|
{ "Shift", GDK_SHIFT_MASK },
|
|
|
|
{ "Control", GDK_CONTROL_MASK },
|
|
|
|
{ "Alt (Mod1)", GDK_MOD1_MASK },
|
|
|
|
{ "Control-Shift", GDK_CONTROL_MASK|GDK_SHIFT_MASK },
|
|
|
|
{ "Control-Alt", GDK_CONTROL_MASK|GDK_MOD1_MASK },
|
|
|
|
{ "Shift-Alt", GDK_SHIFT_MASK|GDK_MOD1_MASK },
|
|
|
|
{ "Control-Shift-Alt", GDK_CONTROL_MASK|GDK_SHIFT_MASK|GDK_MOD1_MASK },
|
|
|
|
{ "Mod2", GDK_MOD2_MASK },
|
|
|
|
{ "Mod3", GDK_MOD3_MASK },
|
|
|
|
{ "Mod4", GDK_MOD4_MASK },
|
|
|
|
{ "Mod5", GDK_MOD5_MASK },
|
2008-01-10 16:20:59 -05:00
|
|
|
#endif
|
2005-09-25 14:42:24 -04:00
|
|
|
{ 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::setup_keyboard_options ()
|
|
|
|
{
|
|
|
|
vector<string> dumb;
|
|
|
|
Label* label;
|
|
|
|
|
|
|
|
keyboard_mouse_table.set_border_width (12);
|
|
|
|
keyboard_mouse_table.set_row_spacings (5);
|
|
|
|
keyboard_mouse_table.set_col_spacings (5);
|
|
|
|
|
|
|
|
/* internationalize and prepare for use with combos */
|
|
|
|
|
|
|
|
for (int i = 0; modifiers[i].name; ++i) {
|
|
|
|
dumb.push_back (_(modifiers[i].name));
|
|
|
|
}
|
|
|
|
|
2005-09-26 10:33:53 -04:00
|
|
|
set_popdown_strings (edit_modifier_combo, dumb);
|
2005-11-15 21:57:22 -05:00
|
|
|
edit_modifier_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::edit_modifier_chosen));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
for (int x = 0; modifiers[x].name; ++x) {
|
|
|
|
if (modifiers[x].modifier == Keyboard::edit_modifier ()) {
|
2005-10-26 21:10:36 -04:00
|
|
|
edit_modifier_combo.set_active_text (_(modifiers[x].name));
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
label = manage (new Label (_("Edit using")));
|
|
|
|
label->set_name ("OptionsLabel");
|
|
|
|
label->set_alignment (1.0, 0.5);
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-10-26 21:10:36 -04:00
|
|
|
keyboard_mouse_table.attach (*label, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
|
|
|
|
keyboard_mouse_table.attach (edit_modifier_combo, 1, 2, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
label = manage (new Label (_("+ button")));
|
|
|
|
label->set_name ("OptionsLabel");
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-10-26 21:10:36 -04:00
|
|
|
keyboard_mouse_table.attach (*label, 3, 4, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
|
|
|
|
keyboard_mouse_table.attach (edit_button_spin, 4, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, FILL);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
edit_button_spin.set_name ("OptionsEntry");
|
|
|
|
edit_button_adjustment.set_value (Keyboard::edit_button());
|
2005-10-26 21:10:36 -04:00
|
|
|
edit_button_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::edit_button_changed));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-09-26 10:33:53 -04:00
|
|
|
set_popdown_strings (delete_modifier_combo, dumb);
|
2005-11-15 21:57:22 -05:00
|
|
|
delete_modifier_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::delete_modifier_chosen));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
for (int x = 0; modifiers[x].name; ++x) {
|
|
|
|
if (modifiers[x].modifier == Keyboard::delete_modifier ()) {
|
2005-10-26 21:10:36 -04:00
|
|
|
delete_modifier_combo.set_active_text (_(modifiers[x].name));
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
label = manage (new Label (_("Delete using")));
|
|
|
|
label->set_name ("OptionsLabel");
|
|
|
|
label->set_alignment (1.0, 0.5);
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-10-26 21:10:36 -04:00
|
|
|
keyboard_mouse_table.attach (*label, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
|
|
|
|
keyboard_mouse_table.attach (delete_modifier_combo, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
label = manage (new Label (_("+ button")));
|
|
|
|
label->set_name ("OptionsLabel");
|
|
|
|
|
2005-10-26 21:10:36 -04:00
|
|
|
keyboard_mouse_table.attach (*label, 3, 4, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
|
|
|
|
keyboard_mouse_table.attach (delete_button_spin, 4, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, FILL);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
delete_button_spin.set_name ("OptionsEntry");
|
|
|
|
delete_button_adjustment.set_value (Keyboard::delete_button());
|
2005-10-26 21:10:36 -04:00
|
|
|
delete_button_adjustment.signal_value_changed().connect (mem_fun(*this, &OptionEditor::delete_button_changed));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-09-26 10:33:53 -04:00
|
|
|
set_popdown_strings (snap_modifier_combo, dumb);
|
2005-11-15 21:57:22 -05:00
|
|
|
snap_modifier_combo.signal_changed().connect (mem_fun(*this, &OptionEditor::snap_modifier_chosen));
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
for (int x = 0; modifiers[x].name; ++x) {
|
|
|
|
if (modifiers[x].modifier == (guint) Keyboard::snap_modifier ()) {
|
2005-10-26 21:10:36 -04:00
|
|
|
snap_modifier_combo.set_active_text (_(modifiers[x].name));
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
label = manage (new Label (_("Ignore snap using")));
|
|
|
|
label->set_name ("OptionsLabel");
|
|
|
|
label->set_alignment (1.0, 0.5);
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-10-26 21:10:36 -04:00
|
|
|
keyboard_mouse_table.attach (*label, 0, 1, 2, 3, Gtk::FILL|Gtk::EXPAND, FILL);
|
|
|
|
keyboard_mouse_table.attach (snap_modifier_combo, 1, 2, 2, 3, Gtk::FILL|Gtk::EXPAND, FILL);
|
2008-02-16 17:43:18 -05:00
|
|
|
|
|
|
|
vector<string> strs;
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2008-02-16 17:43:18 -05:00
|
|
|
for (std::map<std::string,std::string>::iterator bf = Keyboard::binding_files.begin(); bf != Keyboard::binding_files.end(); ++bf) {
|
|
|
|
strs.push_back (bf->first);
|
|
|
|
}
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2008-02-16 17:43:18 -05:00
|
|
|
set_popdown_strings (keyboard_layout_selector, strs);
|
|
|
|
keyboard_layout_selector.set_active_text (Keyboard::current_binding_name());
|
|
|
|
keyboard_layout_selector.signal_changed().connect (mem_fun (*this, &OptionEditor::bindings_changed));
|
|
|
|
|
|
|
|
label = manage (new Label (_("Keyboard layout")));
|
|
|
|
label->set_name ("OptionsLabel");
|
|
|
|
label->set_alignment (1.0, 0.5);
|
|
|
|
|
|
|
|
keyboard_mouse_table.attach (*label, 0, 1, 3, 4, Gtk::FILL|Gtk::EXPAND, FILL);
|
|
|
|
keyboard_mouse_table.attach (keyboard_layout_selector, 1, 2, 3, 4, Gtk::FILL|Gtk::EXPAND, FILL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::bindings_changed ()
|
|
|
|
{
|
|
|
|
string txt;
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2008-02-16 17:43:18 -05:00
|
|
|
txt = keyboard_layout_selector.get_active_text();
|
|
|
|
|
|
|
|
for (std::map<string,string>::iterator i = Keyboard::binding_files.begin(); i != Keyboard::binding_files.end(); ++i) {
|
|
|
|
if (txt == i->first) {
|
|
|
|
if (Keyboard::load_keybindings (i->second)) {
|
|
|
|
Keyboard::save_keybindings ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2005-11-15 21:57:22 -05:00
|
|
|
void
|
|
|
|
OptionEditor::edit_modifier_chosen ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
string txt;
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-10-26 21:10:36 -04:00
|
|
|
txt = edit_modifier_combo.get_active_text();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
for (int i = 0; modifiers[i].name; ++i) {
|
|
|
|
if (txt == _(modifiers[i].name)) {
|
|
|
|
Keyboard::set_edit_modifier (modifiers[i].modifier);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-15 21:57:22 -05:00
|
|
|
void
|
|
|
|
OptionEditor::delete_modifier_chosen ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
string txt;
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-10-26 21:10:36 -04:00
|
|
|
txt = delete_modifier_combo.get_active_text();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
for (int i = 0; modifiers[i].name; ++i) {
|
|
|
|
if (txt == _(modifiers[i].name)) {
|
|
|
|
Keyboard::set_delete_modifier (modifiers[i].modifier);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-15 21:57:22 -05:00
|
|
|
void
|
|
|
|
OptionEditor::snap_modifier_chosen ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
string txt;
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2005-10-26 21:10:36 -04:00
|
|
|
txt = snap_modifier_combo.get_active_text();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
for (int i = 0; modifiers[i].name; ++i) {
|
|
|
|
if (txt == _(modifiers[i].name)) {
|
|
|
|
Keyboard::set_snap_modifier (modifiers[i].modifier);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::delete_button_changed ()
|
|
|
|
{
|
|
|
|
Keyboard::set_delete_button ((guint) delete_button_adjustment.get_value());
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
OptionEditor::edit_button_changed ()
|
|
|
|
{
|
|
|
|
Keyboard::set_edit_button ((guint) edit_button_adjustment.get_value());
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-11-12 22:53:51 -05:00
|
|
|
OptionEditor::fixup_combo_size (Gtk::ComboBoxText& combo, vector<string>& strings)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
/* find the widest string */
|
|
|
|
|
|
|
|
string::size_type maxlen = 0;
|
|
|
|
string maxstring;
|
|
|
|
|
|
|
|
for (vector<string>::iterator i = strings.begin(); i != strings.end(); ++i) {
|
|
|
|
string::size_type l;
|
|
|
|
|
|
|
|
if ((l = (*i).length()) > maxlen) {
|
|
|
|
maxlen = l;
|
|
|
|
maxstring = *i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* try to include ascenders and descenders */
|
|
|
|
|
|
|
|
if (maxstring.length() > 2) {
|
|
|
|
maxstring[0] = 'g';
|
|
|
|
maxstring[1] = 'l';
|
|
|
|
}
|
|
|
|
|
|
|
|
const guint32 FUDGE = 10; // Combo's are stupid - they steal space from the entry for the button
|
|
|
|
|
2005-11-12 17:07:07 -05:00
|
|
|
set_size_request_to_display_given_text (combo, maxstring.c_str(), 10 + FUDGE, 10);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
void
|
|
|
|
OptionEditor::parameter_changed (const char* parameter_name)
|
|
|
|
{
|
|
|
|
ENSURE_GUI_THREAD (bind (mem_fun (*this, &OptionEditor::parameter_changed), parameter_name));
|
|
|
|
|
|
|
|
#define PARAM_IS(x) (!strcmp (parameter_name, (x)))
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
if (PARAM_IS ("timecode-source-is-synced")) {
|
|
|
|
synced_timecode_button.set_active (Config->get_timecode_source_is_synced());
|
|
|
|
} else if (PARAM_IS ("history-depth")) {
|
|
|
|
int32_t depth = Config->get_history_depth();
|
2008-08-04 18:37:24 -04:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
history_depth.set_value (depth);
|
|
|
|
history_depth_spinner.set_sensitive (depth != 0);
|
|
|
|
limit_history_button.set_active (depth != 0);
|
|
|
|
|
|
|
|
} else if (PARAM_IS ("saved-history-depth")) {
|
|
|
|
|
|
|
|
saved_history_depth.set_value (Config->get_saved_history_depth());
|
|
|
|
|
|
|
|
} else if (PARAM_IS ("save-history")) {
|
|
|
|
|
|
|
|
bool x = Config->get_save_history();
|
|
|
|
|
|
|
|
save_history_button.set_active (x);
|
|
|
|
saved_history_depth_spinner.set_sensitive (x);
|
2008-03-17 16:54:03 -04:00
|
|
|
} else if (PARAM_IS ("font-scale")) {
|
|
|
|
reset_dpi();
|
2007-10-11 18:07:47 -04:00
|
|
|
}
|
|
|
|
}
|