2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2005-2018 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
|
|
|
|
* Copyright (C) 2006 Hans Fugal <hans@fugal.net>
|
|
|
|
* Copyright (C) 2008-2012 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
* Copyright (C) 2013 Colin Fletcher <colin.m.fletcher@googlemail.com>
|
|
|
|
* Copyright (C) 2014-2016 Nick Mainsbridge <mainsbridge@gmail.com>
|
|
|
|
* Copyright (C) 2015-2016 Tim Mayberry <mojofunk@gmail.com>
|
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include <cmath>
|
|
|
|
#include <cstdlib>
|
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <gtkmm2ext/utils.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/session.h"
|
|
|
|
#include "pbd/memento_command.h"
|
2017-07-15 11:38:28 -04:00
|
|
|
#include "widgets/tooltips.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include "ardour_ui.h"
|
2011-03-02 17:43:19 -05:00
|
|
|
#include "clock_group.h"
|
2016-08-29 04:11:04 -04:00
|
|
|
#include "enums_convert.h"
|
2013-01-07 19:22:39 -05:00
|
|
|
#include "main_clock.h"
|
2011-03-02 17:43:19 -05:00
|
|
|
#include "gui_thread.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "keyboard.h"
|
2011-03-02 17:43:19 -05:00
|
|
|
#include "location_ui.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "utils.h"
|
2014-12-14 08:13:38 -05:00
|
|
|
#include "public_editor.h"
|
2015-01-02 09:44:54 -05:00
|
|
|
#include "ui_config.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-05-12 13:03:42 -04:00
|
|
|
using namespace std;
|
2005-09-25 14:42:24 -04:00
|
|
|
using namespace ARDOUR;
|
2017-07-15 11:38:28 -04:00
|
|
|
using namespace ArdourWidgets;
|
2006-06-22 19:40:55 -04:00
|
|
|
using namespace PBD;
|
2005-09-25 14:42:24 -04:00
|
|
|
using namespace Gtk;
|
2005-09-25 16:33:00 -04:00
|
|
|
using namespace Gtkmm2ext;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num)
|
2011-03-02 17:43:19 -05:00
|
|
|
: SessionHandlePtr (0) /* explicitly set below */
|
2016-04-25 12:17:35 -04:00
|
|
|
, location(0)
|
|
|
|
, item_table (1, 6, false)
|
|
|
|
, start_clock (X_("locationstart"), true, "", true, false)
|
2011-12-11 11:16:48 -05:00
|
|
|
, start_to_playhead_button (_("Use PH"))
|
2016-04-25 12:17:35 -04:00
|
|
|
, locate_to_start_button (_("Goto"))
|
|
|
|
, end_clock (X_("locationend"), true, "", true, false)
|
2011-12-11 11:16:48 -05:00
|
|
|
, end_to_playhead_button (_("Use PH"))
|
2016-04-25 12:17:35 -04:00
|
|
|
, locate_to_end_button (_("Goto"))
|
|
|
|
, length_clock (X_("locationlength"), true, "", true, false, true)
|
|
|
|
, cd_check_button (_("CD"))
|
2023-08-30 23:29:29 -04:00
|
|
|
, section_check_button (S_("Arrangement|Arr."))
|
2016-04-25 12:17:35 -04:00
|
|
|
, hide_check_button (_("Hide"))
|
|
|
|
, lock_check_button (_("Lock"))
|
|
|
|
, _clock_group (0)
|
2011-12-11 11:16:48 -05:00
|
|
|
{
|
2019-07-22 16:47:17 -04:00
|
|
|
|
2016-04-25 12:49:42 -04:00
|
|
|
i_am_the_modifier = 0;
|
|
|
|
|
2016-04-25 13:39:59 -04:00
|
|
|
remove_button.set_icon (ArdourIcon::CloseCross);
|
|
|
|
remove_button.set_events (remove_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
|
2016-04-25 12:49:42 -04:00
|
|
|
|
|
|
|
number_label.set_name ("LocationEditNumberLabel");
|
2019-07-22 16:47:17 -04:00
|
|
|
date_label.set_name ("LocationDateLabel");
|
2016-04-25 12:49:42 -04:00
|
|
|
name_label.set_name ("LocationEditNameLabel");
|
|
|
|
name_entry.set_name ("LocationEditNameEntry");
|
|
|
|
cd_check_button.set_name ("LocationEditCdButton");
|
2023-08-25 21:18:45 -04:00
|
|
|
section_check_button.set_name ("LocationEditSectionButton");
|
2016-04-25 12:49:42 -04:00
|
|
|
hide_check_button.set_name ("LocationEditHideButton");
|
|
|
|
lock_check_button.set_name ("LocationEditLockButton");
|
|
|
|
isrc_label.set_name ("LocationEditNumberLabel");
|
|
|
|
isrc_entry.set_name ("LocationEditNameEntry");
|
|
|
|
scms_check_button.set_name ("LocationEditCdButton");
|
|
|
|
preemph_check_button.set_name ("LocationEditCdButton");
|
|
|
|
performer_label.set_name ("LocationEditNumberLabel");
|
|
|
|
performer_entry.set_name ("LocationEditNameEntry");
|
|
|
|
composer_label.set_name ("LocationEditNumberLabel");
|
|
|
|
composer_entry.set_name ("LocationEditNameEntry");
|
|
|
|
|
|
|
|
isrc_label.set_text (X_("ISRC:"));
|
|
|
|
performer_label.set_text (_("Performer:"));
|
|
|
|
composer_label.set_text (_("Composer:"));
|
|
|
|
scms_label.set_text (X_("SCMS"));
|
|
|
|
preemph_label.set_text (_("Pre-Emphasis"));
|
|
|
|
|
|
|
|
isrc_entry.set_size_request (112, -1);
|
|
|
|
isrc_entry.set_max_length(12);
|
|
|
|
isrc_entry.set_editable (true);
|
|
|
|
|
|
|
|
performer_entry.set_size_request (100, -1);
|
|
|
|
performer_entry.set_editable (true);
|
|
|
|
|
|
|
|
composer_entry.set_size_request (100, -1);
|
|
|
|
composer_entry.set_editable (true);
|
|
|
|
|
|
|
|
name_label.set_alignment (0, 0.5);
|
|
|
|
|
|
|
|
Gtk::HBox* front_spacing = manage (new HBox);
|
|
|
|
front_spacing->set_size_request (20, -1);
|
|
|
|
Gtk::HBox* mid_spacing = manage (new HBox);
|
|
|
|
mid_spacing->set_size_request (20, -1);
|
|
|
|
|
|
|
|
cd_track_details_hbox.set_spacing (4);
|
|
|
|
cd_track_details_hbox.pack_start (*front_spacing, false, false);
|
|
|
|
cd_track_details_hbox.pack_start (isrc_label, false, false);
|
|
|
|
cd_track_details_hbox.pack_start (isrc_entry, false, false);
|
|
|
|
cd_track_details_hbox.pack_start (performer_label, false, false);
|
|
|
|
cd_track_details_hbox.pack_start (performer_entry, true, true);
|
|
|
|
cd_track_details_hbox.pack_start (composer_label, false, false);
|
|
|
|
cd_track_details_hbox.pack_start (composer_entry, true, true);
|
|
|
|
cd_track_details_hbox.pack_start (*mid_spacing, false, false);
|
|
|
|
cd_track_details_hbox.pack_start (scms_label, false, false);
|
|
|
|
cd_track_details_hbox.pack_start (scms_check_button, false, false);
|
|
|
|
cd_track_details_hbox.pack_start (preemph_label, false, false);
|
|
|
|
cd_track_details_hbox.pack_start (preemph_check_button, false, false);
|
|
|
|
|
|
|
|
isrc_entry.signal_changed().connect (sigc::mem_fun(*this, &LocationEditRow::isrc_entry_changed));
|
|
|
|
performer_entry.signal_changed().connect (sigc::mem_fun(*this, &LocationEditRow::performer_entry_changed));
|
|
|
|
composer_entry.signal_changed().connect (sigc::mem_fun(*this, &LocationEditRow::composer_entry_changed));
|
|
|
|
scms_check_button.signal_toggled().connect(sigc::mem_fun(*this, &LocationEditRow::scms_toggled));
|
|
|
|
preemph_check_button.signal_toggled().connect(sigc::mem_fun(*this, &LocationEditRow::preemph_toggled));
|
|
|
|
|
|
|
|
set_session (sess);
|
|
|
|
|
|
|
|
start_hbox.set_spacing (2);
|
2016-04-25 13:39:59 -04:00
|
|
|
start_hbox.pack_start (locate_to_start_button, false, false);
|
2016-04-25 12:49:42 -04:00
|
|
|
start_hbox.pack_start (start_clock, false, false);
|
|
|
|
start_hbox.pack_start (start_to_playhead_button, false, false);
|
|
|
|
|
|
|
|
/* this is always in this location, no matter what the location is */
|
|
|
|
|
2016-04-25 13:39:59 -04:00
|
|
|
item_table.attach (remove_button, 8, 9, 0, 1, SHRINK, SHRINK, 4, 1);
|
|
|
|
item_table.attach (start_hbox, 0, 1, 0, 1, FILL, Gtk::AttachOptions(0), 4, 0);
|
2016-04-25 12:49:42 -04:00
|
|
|
|
2016-04-25 13:39:59 -04:00
|
|
|
start_to_playhead_button.signal_clicked.connect (sigc::bind (sigc::mem_fun (*this, &LocationEditRow::to_playhead_button_pressed), LocStart));
|
|
|
|
locate_to_start_button.signal_clicked.connect (sigc::bind (sigc::mem_fun (*this, &LocationEditRow::locate_button_pressed), LocStart));
|
2016-04-25 12:49:42 -04:00
|
|
|
start_clock.ValueChanged.connect (sigc::bind (sigc::mem_fun (*this, &LocationEditRow::clock_changed), LocStart));
|
|
|
|
start_clock.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &LocationEditRow::locate_to_clock), &start_clock), false);
|
|
|
|
|
|
|
|
end_hbox.set_spacing (2);
|
2016-04-25 13:39:59 -04:00
|
|
|
end_hbox.pack_start (locate_to_end_button, false, false);
|
2016-04-25 12:49:42 -04:00
|
|
|
end_hbox.pack_start (end_clock, false, false);
|
|
|
|
end_hbox.pack_start (end_to_playhead_button, false, false);
|
|
|
|
|
2016-04-25 13:39:59 -04:00
|
|
|
end_to_playhead_button.signal_clicked.connect (sigc::bind (sigc::mem_fun (*this, &LocationEditRow::to_playhead_button_pressed), LocEnd));
|
|
|
|
locate_to_end_button.signal_clicked.connect (sigc::bind (sigc::mem_fun (*this, &LocationEditRow::locate_button_pressed), LocEnd));
|
2016-04-25 12:49:42 -04:00
|
|
|
end_clock.ValueChanged.connect (sigc::bind (sigc::mem_fun (*this, &LocationEditRow::clock_changed), LocEnd));
|
|
|
|
end_clock.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &LocationEditRow::locate_to_clock), &end_clock), false);
|
|
|
|
|
|
|
|
length_clock.ValueChanged.connect (sigc::bind ( sigc::mem_fun(*this, &LocationEditRow::clock_changed), LocLength));
|
|
|
|
|
|
|
|
cd_check_button.signal_toggled().connect(sigc::mem_fun(*this, &LocationEditRow::cd_toggled));
|
2023-08-25 21:18:45 -04:00
|
|
|
section_check_button.signal_toggled().connect(sigc::mem_fun(*this, &LocationEditRow::section_toggled));
|
2016-04-25 12:49:42 -04:00
|
|
|
hide_check_button.signal_toggled().connect(sigc::mem_fun(*this, &LocationEditRow::hide_toggled));
|
|
|
|
lock_check_button.signal_toggled().connect(sigc::mem_fun(*this, &LocationEditRow::lock_toggled));
|
|
|
|
|
2016-04-25 13:39:59 -04:00
|
|
|
remove_button.signal_clicked.connect(sigc::mem_fun(*this, &LocationEditRow::remove_button_pressed));
|
2016-04-25 12:49:42 -04:00
|
|
|
|
|
|
|
pack_start(item_table, true, true);
|
|
|
|
|
|
|
|
set_location (loc);
|
|
|
|
set_number (num);
|
|
|
|
cd_toggled(); // show/hide cd-track details
|
|
|
|
}
|
|
|
|
|
|
|
|
LocationEditRow::~LocationEditRow()
|
|
|
|
{
|
|
|
|
if (location) {
|
|
|
|
connections.drop_connections ();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_clock_group) {
|
|
|
|
_clock_group->remove (start_clock);
|
|
|
|
_clock_group->remove (end_clock);
|
|
|
|
_clock_group->remove (length_clock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LocationEditRow::set_clock_group (ClockGroup& cg)
|
|
|
|
{
|
|
|
|
if (_clock_group) {
|
|
|
|
_clock_group->remove (start_clock);
|
|
|
|
_clock_group->remove (end_clock);
|
|
|
|
_clock_group->remove (length_clock);
|
|
|
|
}
|
|
|
|
|
|
|
|
_clock_group = &cg;
|
|
|
|
|
|
|
|
_clock_group->add (start_clock);
|
|
|
|
_clock_group->add (end_clock);
|
|
|
|
_clock_group->add (length_clock);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LocationEditRow::set_session (Session *sess)
|
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
SessionHandlePtr::set_session (sess);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2011-06-01 13:00:29 -04:00
|
|
|
if (!_session) {
|
2009-12-17 13:24:23 -05:00
|
|
|
return;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
start_clock.set_session (_session);
|
|
|
|
end_clock.set_session (_session);
|
|
|
|
length_clock.set_session (_session);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LocationEditRow::set_number (int num)
|
|
|
|
{
|
|
|
|
number = num;
|
|
|
|
|
|
|
|
if (number >= 0 ) {
|
2005-10-06 15:10:57 -04:00
|
|
|
number_label.set_text (string_compose ("%1", number));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LocationEditRow::set_location (Location *loc)
|
|
|
|
{
|
|
|
|
if (location) {
|
2009-12-17 13:24:23 -05:00
|
|
|
connections.drop_connections ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
location = loc;
|
|
|
|
|
2010-08-09 18:23:32 -04:00
|
|
|
if (!location) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
++i_am_the_modifier;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
if (!hide_check_button.get_parent()) {
|
2016-04-25 13:39:59 -04:00
|
|
|
item_table.attach (hide_check_button, 5, 6, 0, 1, FILL, Gtk::FILL, 4, 0);
|
|
|
|
item_table.attach (lock_check_button, 6, 7, 0, 1, FILL, Gtk::FILL, 4, 0);
|
2019-07-22 16:47:17 -04:00
|
|
|
|
|
|
|
Glib::DateTime gdt(Glib::DateTime::create_now_local (location->timestamp()));
|
|
|
|
string date = gdt.format ("%F %H:%M");
|
|
|
|
date_label.set_text(date);
|
|
|
|
item_table.attach (date_label, 9, 10, 0, 1, FILL, Gtk::FILL, 4, 0);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
hide_check_button.set_active (location->is_hidden());
|
2010-08-09 14:22:10 -04:00
|
|
|
lock_check_button.set_active (location->locked());
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-01-08 12:12:29 -05:00
|
|
|
if (location->is_auto_loop() || location-> is_auto_punch()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
// use label instead of entry
|
|
|
|
|
|
|
|
name_label.set_text (location->name());
|
2005-09-25 16:33:00 -04:00
|
|
|
name_label.set_size_request (80, -1);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2011-12-11 12:26:48 -05:00
|
|
|
remove_button.hide ();
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (!name_label.get_parent()) {
|
2016-04-25 13:55:00 -04:00
|
|
|
item_table.attach (name_label, 2, 3, 0, 1, EXPAND|FILL, FILL, 4, 0);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
name_label.show();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
name_entry.set_text (location->name());
|
2005-09-25 16:33:00 -04:00
|
|
|
name_entry.set_size_request (100, -1);
|
2005-09-25 14:42:24 -04:00
|
|
|
name_entry.set_editable (true);
|
2009-12-11 18:29:48 -05:00
|
|
|
name_entry.signal_changed().connect (sigc::mem_fun(*this, &LocationEditRow::name_entry_changed));
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
if (!name_entry.get_parent()) {
|
2016-04-25 13:39:59 -04:00
|
|
|
item_table.attach (name_entry, 2, 3, 0, 1, FILL | EXPAND, FILL, 4, 0);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
name_entry.show();
|
|
|
|
|
|
|
|
if (!cd_check_button.get_parent()) {
|
2023-08-25 21:18:45 -04:00
|
|
|
item_table.attach (cd_check_button, 3, 4, 0, 1, FILL, Gtk::AttachOptions (0), 4, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!section_check_button.get_parent()) {
|
|
|
|
item_table.attach (section_check_button, 4, 5, 0, 1, FILL, Gtk::AttachOptions (0), 4, 0);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2010-04-18 17:29:48 -04:00
|
|
|
if (location->is_session_range()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
remove_button.set_sensitive (false);
|
|
|
|
}
|
|
|
|
|
2023-08-25 21:18:45 -04:00
|
|
|
flags_changed ();
|
2022-01-06 19:33:51 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
cd_check_button.show();
|
2023-08-25 21:18:45 -04:00
|
|
|
section_check_button.show();
|
2005-09-25 14:42:24 -04:00
|
|
|
hide_check_button.show();
|
2010-08-09 14:22:10 -04:00
|
|
|
lock_check_button.show();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
start_clock.set (location->start(), true);
|
2008-02-16 17:43:18 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
if (!location->is_mark()) {
|
|
|
|
if (!end_hbox.get_parent()) {
|
2016-04-25 13:39:59 -04:00
|
|
|
item_table.attach (end_hbox, 1, 2, 0, 1, FILL, Gtk::AttachOptions (0), 4, 0);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
if (!length_clock.get_parent()) {
|
2016-04-25 13:39:59 -04:00
|
|
|
end_hbox.pack_start (length_clock, false, false, 4);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
end_clock.set (location->end(), true);
|
2020-10-19 14:37:54 -04:00
|
|
|
length_clock.set_duration (location->length(), true);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
end_clock.show();
|
|
|
|
length_clock.show();
|
2007-11-06 21:42:27 -05:00
|
|
|
|
2013-07-01 13:56:10 -04:00
|
|
|
if (location->is_cd_marker()) {
|
|
|
|
show_cd_track_details ();
|
|
|
|
}
|
|
|
|
|
2016-04-25 13:39:59 -04:00
|
|
|
set_tooltip (&remove_button, _("Remove this range"));
|
2015-01-05 00:32:14 -05:00
|
|
|
set_tooltip (start_clock, _("Start time - middle click to locate here"));
|
|
|
|
set_tooltip (end_clock, _("End time - middle click to locate here"));
|
|
|
|
set_tooltip (length_clock, _("Length"));
|
2009-11-12 15:39:53 -05:00
|
|
|
|
2016-04-25 13:39:59 -04:00
|
|
|
set_tooltip (&start_to_playhead_button, _("Set range start from playhead location"));
|
|
|
|
set_tooltip (&end_to_playhead_button, _("Set range end from playhead location"));
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2007-11-06 21:42:27 -05:00
|
|
|
} else {
|
|
|
|
|
2016-04-25 13:39:59 -04:00
|
|
|
set_tooltip (&remove_button, _("Remove this marker"));
|
2015-01-05 00:32:14 -05:00
|
|
|
set_tooltip (start_clock, _("Position - middle click to locate here"));
|
2011-12-11 11:16:48 -05:00
|
|
|
|
2016-04-25 13:39:59 -04:00
|
|
|
set_tooltip (&start_to_playhead_button, _("Set marker time from playhead location"));
|
2009-11-12 15:39:53 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
end_clock.hide();
|
|
|
|
length_clock.hide();
|
|
|
|
}
|
|
|
|
|
2012-06-19 09:07:02 -04:00
|
|
|
set_clock_editable_status ();
|
2007-11-12 17:23:01 -05:00
|
|
|
|
2010-08-09 18:23:32 -04:00
|
|
|
--i_am_the_modifier;
|
|
|
|
|
2016-04-25 12:49:42 -04:00
|
|
|
/* connect to per-location signals, since this row only cares about this location */
|
2014-09-19 22:50:50 -04:00
|
|
|
|
|
|
|
location->NameChanged.connect (connections, invalidator (*this), boost::bind (&LocationEditRow::name_changed, this), gui_context());
|
2023-12-08 16:12:48 -05:00
|
|
|
location->StartChanged.connect (connections, invalidator (*this), boost::bind (&LocationEditRow::start_changed, this), gui_context());
|
2016-04-25 12:49:42 -04:00
|
|
|
location->EndChanged.connect (connections, invalidator (*this), boost::bind (&LocationEditRow::end_changed, this), gui_context());
|
|
|
|
location->Changed.connect (connections, invalidator (*this), boost::bind (&LocationEditRow::location_changed, this), gui_context());
|
|
|
|
location->FlagsChanged.connect (connections, invalidator (*this), boost::bind (&LocationEditRow::flags_changed, this), gui_context());
|
|
|
|
location->LockChanged.connect (connections, invalidator (*this), boost::bind (&LocationEditRow::lock_changed, this), gui_context());
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LocationEditRow::name_entry_changed ()
|
|
|
|
{
|
2016-04-25 12:49:42 -04:00
|
|
|
ENSURE_GUI_THREAD (*this, &LocationEditRow::name_entry_changed);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-11-12 13:53:15 -05:00
|
|
|
if (i_am_the_modifier || !location) {
|
|
|
|
return;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
location->set_name (name_entry.get_text());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
LocationEditRow::isrc_entry_changed ()
|
|
|
|
{
|
2016-04-25 12:49:42 -04:00
|
|
|
ENSURE_GUI_THREAD (*this, &LocationEditRow::isrc_entry_changed);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (i_am_the_modifier || !location) return;
|
|
|
|
|
|
|
|
if (isrc_entry.get_text() != "" ) {
|
|
|
|
|
2016-04-25 12:49:42 -04:00
|
|
|
location->cd_info["isrc"] = isrc_entry.get_text();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
2016-04-25 12:49:42 -04:00
|
|
|
location->cd_info.erase("isrc");
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LocationEditRow::performer_entry_changed ()
|
|
|
|
{
|
2016-04-25 12:49:42 -04:00
|
|
|
ENSURE_GUI_THREAD (*this, &LocationEditRow::performer_entry_changed);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (i_am_the_modifier || !location) return;
|
|
|
|
|
|
|
|
if (performer_entry.get_text() != "") {
|
2016-04-25 12:49:42 -04:00
|
|
|
location->cd_info["performer"] = performer_entry.get_text();
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
2016-04-25 12:49:42 -04:00
|
|
|
location->cd_info.erase("performer");
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LocationEditRow::composer_entry_changed ()
|
|
|
|
{
|
2016-04-25 12:49:42 -04:00
|
|
|
ENSURE_GUI_THREAD (*this, &LocationEditRow::composer_entry_changed);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (i_am_the_modifier || !location) return;
|
|
|
|
|
2005-10-10 16:38:53 -04:00
|
|
|
if (composer_entry.get_text() != "") {
|
2016-04-25 12:49:42 -04:00
|
|
|
location->cd_info["composer"] = composer_entry.get_text();
|
2005-09-25 14:42:24 -04:00
|
|
|
} else {
|
2016-04-25 12:49:42 -04:00
|
|
|
location->cd_info.erase("composer");
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-09 19:43:23 -05:00
|
|
|
void
|
|
|
|
LocationEditRow::to_playhead_button_pressed (LocationPart part)
|
|
|
|
{
|
|
|
|
if (!location) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (part) {
|
2016-04-25 12:49:42 -04:00
|
|
|
case LocStart:
|
2020-10-19 14:37:54 -04:00
|
|
|
location->set_start (timepos_t (_session->transport_sample ()), false);
|
2016-04-25 12:49:42 -04:00
|
|
|
break;
|
|
|
|
case LocEnd:
|
2020-10-19 14:37:54 -04:00
|
|
|
location->set_end (timepos_t (_session->transport_sample ()), false);
|
2016-07-12 11:19:34 -04:00
|
|
|
if (location->is_session_range()) {
|
2019-02-12 12:15:34 -05:00
|
|
|
_session->set_session_range_is_free (false);
|
2016-07-12 11:19:34 -04:00
|
|
|
}
|
2016-04-25 12:49:42 -04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2011-03-09 19:43:23 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-25 12:17:35 -04:00
|
|
|
void
|
|
|
|
LocationEditRow::locate_button_pressed (LocationPart part)
|
|
|
|
{
|
|
|
|
switch (part) {
|
|
|
|
case LocStart:
|
2022-11-14 09:52:15 -05:00
|
|
|
_session->request_locate (start_clock.last_when().samples());
|
2016-04-25 12:17:35 -04:00
|
|
|
break;
|
|
|
|
case LocEnd:
|
2022-11-14 09:52:15 -05:00
|
|
|
_session->request_locate (end_clock.last_when().samples());
|
2016-04-25 12:17:35 -04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-11 12:26:48 -05:00
|
|
|
bool
|
|
|
|
LocationEditRow::locate_to_clock (GdkEventButton* ev, AudioClock* clock)
|
|
|
|
{
|
|
|
|
if (Keyboard::is_button2_event (ev)) {
|
2022-11-14 09:52:15 -05:00
|
|
|
_session->request_locate (clock->last_when().samples());
|
2011-12-11 12:26:48 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
|
|
|
LocationEditRow::clock_changed (LocationPart part)
|
|
|
|
{
|
2010-08-09 20:28:20 -04:00
|
|
|
if (i_am_the_modifier || !location) {
|
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
switch (part) {
|
2016-04-25 12:49:42 -04:00
|
|
|
case LocStart:
|
2022-11-14 09:52:15 -05:00
|
|
|
location->set_start (start_clock.last_when(), false);
|
2016-04-25 12:49:42 -04:00
|
|
|
break;
|
|
|
|
case LocEnd:
|
2022-11-14 09:52:15 -05:00
|
|
|
location->set_end (end_clock.last_when(), false);
|
2016-07-12 11:19:34 -04:00
|
|
|
if (location->is_session_range()) {
|
2019-02-12 12:15:34 -05:00
|
|
|
_session->set_session_range_is_free (false);
|
2016-07-12 11:19:34 -04:00
|
|
|
}
|
2016-04-25 12:49:42 -04:00
|
|
|
break;
|
|
|
|
case LocLength:
|
2020-10-19 14:37:54 -04:00
|
|
|
location->set_end (location->start() + length_clock.current_duration(), false);
|
2016-07-12 11:19:34 -04:00
|
|
|
if (location->is_session_range()) {
|
2019-02-12 12:15:34 -05:00
|
|
|
_session->set_session_range_is_free (false);
|
2016-07-12 11:19:34 -04:00
|
|
|
}
|
2016-04-25 12:49:42 -04:00
|
|
|
default:
|
|
|
|
break;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-01 13:56:10 -04:00
|
|
|
void
|
|
|
|
LocationEditRow::show_cd_track_details ()
|
|
|
|
{
|
|
|
|
if (location->cd_info.find("isrc") != location->cd_info.end()) {
|
|
|
|
isrc_entry.set_text(location->cd_info["isrc"]);
|
|
|
|
}
|
|
|
|
if (location->cd_info.find("performer") != location->cd_info.end()) {
|
|
|
|
performer_entry.set_text(location->cd_info["performer"]);
|
|
|
|
}
|
|
|
|
if (location->cd_info.find("composer") != location->cd_info.end()) {
|
|
|
|
composer_entry.set_text(location->cd_info["composer"]);
|
|
|
|
}
|
|
|
|
if (location->cd_info.find("scms") != location->cd_info.end()) {
|
|
|
|
scms_check_button.set_active(true);
|
|
|
|
}
|
|
|
|
if (location->cd_info.find("preemph") != location->cd_info.end()) {
|
|
|
|
preemph_check_button.set_active(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!cd_track_details_hbox.get_parent()) {
|
|
|
|
item_table.attach (cd_track_details_hbox, 0, 7, 1, 2, FILL | EXPAND, FILL, 4, 0);
|
|
|
|
}
|
|
|
|
// item_table.resize(2, 7);
|
|
|
|
cd_track_details_hbox.show_all();
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
|
|
|
LocationEditRow::cd_toggled ()
|
|
|
|
{
|
2007-11-06 21:42:27 -05:00
|
|
|
if (i_am_the_modifier || !location) {
|
|
|
|
return;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
location->set_cd (cd_check_button.get_active(), this);
|
|
|
|
|
2014-06-01 13:48:21 -04:00
|
|
|
if (location->is_cd_marker()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2013-07-01 13:56:10 -04:00
|
|
|
show_cd_track_details ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
} else if (cd_track_details_hbox.get_parent()){
|
2009-10-14 12:10:01 -04:00
|
|
|
|
|
|
|
item_table.remove (cd_track_details_hbox);
|
2007-11-06 21:42:27 -05:00
|
|
|
// item_table.resize(1, 7);
|
2019-04-13 11:48:27 -04:00
|
|
|
redraw_ranges(); /* EMIT_SIGNAL */
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-25 21:18:45 -04:00
|
|
|
void
|
|
|
|
LocationEditRow::section_toggled ()
|
|
|
|
{
|
|
|
|
if (i_am_the_modifier || !location) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
location->set_section (section_check_button.get_active());
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
|
|
|
LocationEditRow::hide_toggled ()
|
|
|
|
{
|
2010-08-09 14:22:10 -04:00
|
|
|
if (i_am_the_modifier || !location) {
|
|
|
|
return;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
location->set_hidden (hide_check_button.get_active(), this);
|
|
|
|
}
|
|
|
|
|
2010-08-09 14:22:10 -04:00
|
|
|
void
|
|
|
|
LocationEditRow::lock_toggled ()
|
|
|
|
{
|
|
|
|
if (i_am_the_modifier || !location) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (location->locked()) {
|
|
|
|
location->unlock ();
|
|
|
|
} else {
|
|
|
|
location->lock ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
|
|
|
LocationEditRow::remove_button_pressed ()
|
|
|
|
{
|
2010-06-22 21:51:55 -04:00
|
|
|
if (!location) {
|
|
|
|
return;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2019-04-13 11:48:27 -04:00
|
|
|
remove_requested (location); /* EMIT_SIGNAL */
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
LocationEditRow::scms_toggled ()
|
|
|
|
{
|
|
|
|
if (i_am_the_modifier || !location) return;
|
|
|
|
|
|
|
|
if (scms_check_button.get_active()) {
|
|
|
|
location->cd_info["scms"] = "on";
|
|
|
|
} else {
|
|
|
|
location->cd_info.erase("scms");
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LocationEditRow::preemph_toggled ()
|
|
|
|
{
|
|
|
|
if (i_am_the_modifier || !location) return;
|
|
|
|
|
|
|
|
if (preemph_check_button.get_active()) {
|
|
|
|
location->cd_info["preemph"] = "on";
|
|
|
|
} else {
|
|
|
|
location->cd_info.erase("preemph");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-09-19 22:50:50 -04:00
|
|
|
LocationEditRow::end_changed ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &LocationEditRow::end_changed, loc)
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
if (!location) return;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// update end and length
|
|
|
|
i_am_the_modifier++;
|
|
|
|
|
|
|
|
end_clock.set (location->end());
|
2020-10-19 14:37:54 -04:00
|
|
|
length_clock.set_duration (location->length());
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
i_am_the_modifier--;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-09-19 22:50:50 -04:00
|
|
|
LocationEditRow::start_changed ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
if (!location) return;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
// update end and length
|
|
|
|
i_am_the_modifier++;
|
|
|
|
|
|
|
|
start_clock.set (location->start());
|
2007-11-06 21:42:27 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
i_am_the_modifier--;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-09-19 22:50:50 -04:00
|
|
|
LocationEditRow::name_changed ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
if (!location) return;
|
|
|
|
|
|
|
|
// update end and length
|
|
|
|
i_am_the_modifier++;
|
|
|
|
|
|
|
|
name_entry.set_text(location->name());
|
|
|
|
name_label.set_text(location->name());
|
|
|
|
|
|
|
|
i_am_the_modifier--;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-09-19 22:50:50 -04:00
|
|
|
LocationEditRow::location_changed ()
|
2009-10-14 12:10:01 -04:00
|
|
|
{
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (!location) return;
|
|
|
|
|
|
|
|
i_am_the_modifier++;
|
|
|
|
|
|
|
|
start_clock.set (location->start());
|
|
|
|
end_clock.set (location->end());
|
2020-10-19 14:37:54 -04:00
|
|
|
length_clock.set_duration (location->length());
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2012-06-19 09:07:02 -04:00
|
|
|
set_clock_editable_status ();
|
2007-11-12 17:23:01 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
i_am_the_modifier--;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-09-19 22:50:50 -04:00
|
|
|
LocationEditRow::flags_changed ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2010-08-09 14:22:10 -04:00
|
|
|
if (!location) {
|
|
|
|
return;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
i_am_the_modifier++;
|
|
|
|
|
|
|
|
cd_check_button.set_active (location->is_cd_marker());
|
2023-08-25 21:18:45 -04:00
|
|
|
section_check_button.set_active (location->is_section());
|
2005-09-25 14:42:24 -04:00
|
|
|
hide_check_button.set_active (location->is_hidden());
|
2010-08-09 14:22:10 -04:00
|
|
|
|
2023-08-25 21:18:45 -04:00
|
|
|
if (location->is_cue_marker()) {
|
|
|
|
cd_check_button.set_sensitive (false);
|
|
|
|
section_check_button.set_sensitive (false);
|
|
|
|
} else if (location->is_section()) {
|
|
|
|
cd_check_button.set_sensitive (false);
|
|
|
|
section_check_button.set_sensitive (true);
|
|
|
|
} else if (location->is_cd_marker()) {
|
|
|
|
cd_check_button.set_sensitive (true);
|
|
|
|
section_check_button.set_sensitive (false);
|
|
|
|
} else {
|
|
|
|
cd_check_button.set_sensitive (true);
|
|
|
|
section_check_button.set_sensitive (true);
|
|
|
|
}
|
|
|
|
|
2010-08-09 14:22:10 -04:00
|
|
|
i_am_the_modifier--;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-09-19 22:50:50 -04:00
|
|
|
LocationEditRow::lock_changed ()
|
2010-08-09 14:22:10 -04:00
|
|
|
{
|
|
|
|
if (!location) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
i_am_the_modifier++;
|
|
|
|
|
|
|
|
lock_check_button.set_active (location->locked());
|
|
|
|
|
2012-06-19 09:07:02 -04:00
|
|
|
set_clock_editable_status ();
|
2010-08-09 20:28:20 -04:00
|
|
|
|
2010-08-09 14:22:10 -04:00
|
|
|
i_am_the_modifier--;
|
|
|
|
}
|
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
void
|
2012-05-01 17:34:24 -04:00
|
|
|
LocationEditRow::focus_name()
|
|
|
|
{
|
|
|
|
name_entry.grab_focus ();
|
2008-09-10 11:03:30 -04:00
|
|
|
}
|
|
|
|
|
2011-03-02 17:43:19 -05:00
|
|
|
void
|
2012-06-19 09:07:02 -04:00
|
|
|
LocationEditRow::set_clock_editable_status ()
|
2011-03-02 17:43:19 -05:00
|
|
|
{
|
2012-06-19 09:07:02 -04:00
|
|
|
start_clock.set_editable (!location->locked());
|
|
|
|
end_clock.set_editable (!location->locked());
|
|
|
|
length_clock.set_editable (!location->locked());
|
2011-03-02 17:43:19 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------*/
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2017-02-14 11:15:16 -05:00
|
|
|
LocationUI::LocationUI (std::string state_node_name)
|
2009-12-17 13:24:23 -05:00
|
|
|
: add_location_button (_("New Marker"))
|
2009-11-12 15:39:53 -05:00
|
|
|
, add_range_button (_("New Range"))
|
2017-09-18 12:39:17 -04:00
|
|
|
, _mode (AudioClock::Samples)
|
2017-02-14 11:15:16 -05:00
|
|
|
, _mode_set (false)
|
|
|
|
, _state_node_name (state_node_name)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
i_am_the_modifier = 0;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2016-04-25 12:49:42 -04:00
|
|
|
_clock_group = new ClockGroup;
|
2011-03-02 17:43:19 -05:00
|
|
|
|
2010-11-08 11:42:41 -05:00
|
|
|
VBox* vbox = manage (new VBox);
|
|
|
|
|
|
|
|
Table* table = manage (new Table (2, 2));
|
2011-12-11 11:16:48 -05:00
|
|
|
table->set_spacings (2);
|
2010-11-08 11:42:41 -05:00
|
|
|
table->set_col_spacing (0, 32);
|
|
|
|
int table_row = 0;
|
|
|
|
|
|
|
|
Label* l = manage (new Label (_("<b>Loop/Punch Ranges</b>")));
|
|
|
|
l->set_alignment (0, 0.5);
|
|
|
|
l->set_use_markup (true);
|
|
|
|
table->attach (*l, 0, 2, table_row, table_row + 1);
|
|
|
|
++table_row;
|
2009-11-23 19:06:12 -05:00
|
|
|
|
2016-04-25 12:49:42 -04:00
|
|
|
loop_edit_row.set_clock_group (*_clock_group);
|
|
|
|
punch_edit_row.set_clock_group (*_clock_group);
|
2011-03-02 17:43:19 -05:00
|
|
|
|
2016-04-25 13:55:00 -04:00
|
|
|
loop_punch_box.set_border_width (6); // 5 + 1 px framebox-border
|
2009-11-23 19:06:12 -05:00
|
|
|
loop_punch_box.pack_start (loop_edit_row, false, false);
|
|
|
|
loop_punch_box.pack_start (punch_edit_row, false, false);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-11-08 11:42:41 -05:00
|
|
|
table->attach (loop_punch_box, 1, 2, table_row, table_row + 1);
|
|
|
|
++table_row;
|
|
|
|
|
2010-11-08 12:34:20 -05:00
|
|
|
vbox->pack_start (*table, false, false);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2016-04-25 12:49:42 -04:00
|
|
|
table = manage (new Table (3, 2));
|
2011-12-11 11:16:48 -05:00
|
|
|
table->set_spacings (2);
|
2010-11-08 11:42:41 -05:00
|
|
|
table->set_col_spacing (0, 32);
|
|
|
|
table_row = 0;
|
|
|
|
|
2010-11-08 12:34:20 -05:00
|
|
|
table->attach (*manage (new Label ("")), 0, 2, table_row, table_row + 1, Gtk::SHRINK, Gtk::SHRINK);
|
2010-11-08 11:42:41 -05:00
|
|
|
++table_row;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-11-08 11:42:41 -05:00
|
|
|
l = manage (new Label (_("<b>Markers (Including CD Index)</b>")));
|
|
|
|
l->set_alignment (0, 0.5);
|
|
|
|
l->set_use_markup (true);
|
2010-11-08 12:34:20 -05:00
|
|
|
table->attach (*l, 0, 2, table_row, table_row + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);
|
2010-11-08 11:42:41 -05:00
|
|
|
++table_row;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
location_rows.set_name("LocationLocRows");
|
2005-10-22 13:33:14 -04:00
|
|
|
location_rows_scroller.add (location_rows);
|
2005-09-25 14:42:24 -04:00
|
|
|
location_rows_scroller.set_name ("LocationLocRowsScroller");
|
2019-07-22 16:47:17 -04:00
|
|
|
location_rows_scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
|
2005-09-25 16:33:00 -04:00
|
|
|
location_rows_scroller.set_size_request (-1, 130);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
newest_location = 0;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2018-06-09 13:08:15 -04:00
|
|
|
loc_frame_box.set_spacing (5);
|
|
|
|
loc_frame_box.set_border_width (5);
|
|
|
|
loc_frame_box.set_name("LocationFrameBox");
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2018-06-09 13:08:15 -04:00
|
|
|
loc_frame_box.pack_start (location_rows_scroller, true, true);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
add_location_button.set_name ("LocationAddLocationButton");
|
2009-11-12 15:39:53 -05:00
|
|
|
|
2018-06-09 13:08:15 -04:00
|
|
|
table->attach (loc_frame_box, 0, 2, table_row, table_row + 1);
|
2010-11-08 11:42:41 -05:00
|
|
|
++table_row;
|
|
|
|
|
2016-05-26 10:46:28 -04:00
|
|
|
loc_range_panes.add (*table);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2016-04-25 12:49:42 -04:00
|
|
|
table = manage (new Table (3, 2));
|
2011-12-11 11:16:48 -05:00
|
|
|
table->set_spacings (2);
|
2010-11-08 11:42:41 -05:00
|
|
|
table->set_col_spacing (0, 32);
|
|
|
|
table_row = 0;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2010-11-08 12:34:20 -05:00
|
|
|
table->attach (*manage (new Label ("")), 0, 2, table_row, table_row + 1, Gtk::SHRINK, Gtk::SHRINK);
|
2010-11-08 11:42:41 -05:00
|
|
|
++table_row;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-11-08 11:42:41 -05:00
|
|
|
l = manage (new Label (_("<b>Ranges (Including CD Track Ranges)</b>")));
|
|
|
|
l->set_alignment (0, 0.5);
|
|
|
|
l->set_use_markup (true);
|
2010-11-08 12:34:20 -05:00
|
|
|
table->attach (*l, 0, 2, table_row, table_row + 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);
|
2010-11-08 11:42:41 -05:00
|
|
|
++table_row;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
range_rows.set_name("LocationRangeRows");
|
2005-10-22 13:33:14 -04:00
|
|
|
range_rows_scroller.add (range_rows);
|
2005-09-25 14:42:24 -04:00
|
|
|
range_rows_scroller.set_name ("LocationRangeRowsScroller");
|
2019-07-22 16:47:17 -04:00
|
|
|
range_rows_scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
|
2005-09-25 16:33:00 -04:00
|
|
|
range_rows_scroller.set_size_request (-1, 130);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2018-06-09 13:08:15 -04:00
|
|
|
range_frame_box.set_spacing (5);
|
|
|
|
range_frame_box.set_name("LocationFrameBox");
|
|
|
|
range_frame_box.set_border_width (5);
|
|
|
|
range_frame_box.pack_start (range_rows_scroller, true, true);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
add_range_button.set_name ("LocationAddRangeButton");
|
2009-11-12 15:39:53 -05:00
|
|
|
|
2018-06-09 13:08:15 -04:00
|
|
|
table->attach (range_frame_box, 0, 2, table_row, table_row + 1);
|
2010-11-08 11:42:41 -05:00
|
|
|
++table_row;
|
|
|
|
|
2016-05-26 10:46:28 -04:00
|
|
|
loc_range_panes.add (*table);
|
2010-11-08 11:42:41 -05:00
|
|
|
|
|
|
|
HBox* add_button_box = manage (new HBox);
|
|
|
|
add_button_box->pack_start (add_location_button, true, true);
|
2009-11-12 15:39:53 -05:00
|
|
|
add_button_box->pack_start (add_range_button, true, true);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2010-11-08 12:34:20 -05:00
|
|
|
vbox->pack_start (loc_range_panes, true, true);
|
2010-11-08 11:42:41 -05:00
|
|
|
vbox->pack_start (*add_button_box, false, false);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-11-08 11:42:41 -05:00
|
|
|
pack_start (*vbox);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
add_location_button.signal_clicked().connect (sigc::mem_fun(*this, &LocationUI::add_new_location));
|
|
|
|
add_range_button.signal_clicked().connect (sigc::mem_fun(*this, &LocationUI::add_new_range));
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2009-11-12 00:47:05 -05:00
|
|
|
show_all ();
|
2011-12-11 11:16:48 -05:00
|
|
|
|
|
|
|
signal_map().connect (sigc::mem_fun (*this, &LocationUI::refresh_location_list));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
LocationUI::~LocationUI()
|
|
|
|
{
|
2015-01-22 20:16:21 -05:00
|
|
|
loop_edit_row.unset_clock_group ();
|
|
|
|
punch_edit_row.unset_clock_group ();
|
|
|
|
delete _clock_group;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2011-06-01 13:00:29 -04:00
|
|
|
gint
|
2009-11-12 00:47:05 -05:00
|
|
|
LocationUI::do_location_remove (ARDOUR::Location *loc)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
/* this is handled internally by Locations, but there's
|
|
|
|
no point saving state etc. when we know the marker
|
|
|
|
cannot be removed.
|
|
|
|
*/
|
|
|
|
|
2010-04-18 17:29:48 -04:00
|
|
|
if (loc->is_session_range()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2014-12-14 08:13:38 -05:00
|
|
|
PublicEditor::instance().begin_reversible_command (_("remove marker"));
|
2009-12-17 13:24:23 -05:00
|
|
|
XMLNode &before = _session->locations()->get_state();
|
|
|
|
_session->locations()->remove (loc);
|
|
|
|
XMLNode &after = _session->locations()->get_state();
|
|
|
|
_session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
|
2014-12-14 08:13:38 -05:00
|
|
|
PublicEditor::instance().commit_reversible_command ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2011-06-01 13:00:29 -04:00
|
|
|
void
|
2009-11-12 00:47:05 -05:00
|
|
|
LocationUI::location_remove_requested (ARDOUR::Location *loc)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
// must do this to prevent problems when destroying
|
|
|
|
// the effective sender of this event
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-12-11 18:29:48 -05:00
|
|
|
Glib::signal_idle().connect (sigc::bind (sigc::mem_fun(*this, &LocationUI::do_location_remove), loc));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2011-06-01 13:00:29 -04:00
|
|
|
void
|
2009-11-12 00:47:05 -05:00
|
|
|
LocationUI::location_redraw_ranges ()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
range_rows.hide();
|
|
|
|
range_rows.show();
|
|
|
|
}
|
|
|
|
|
2010-07-14 17:18:25 -04:00
|
|
|
struct LocationSortByStart {
|
2012-05-01 17:34:24 -04:00
|
|
|
bool operator() (Location *a, Location *b) {
|
|
|
|
return a->start() < b->start();
|
|
|
|
}
|
2010-07-14 17:18:25 -04:00
|
|
|
};
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
|
|
|
LocationUI::location_added (Location* location)
|
|
|
|
{
|
|
|
|
if (location->is_auto_punch()) {
|
|
|
|
punch_edit_row.set_location(location);
|
2010-06-22 21:51:55 -04:00
|
|
|
} else if (location->is_auto_loop()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
loop_edit_row.set_location(location);
|
2020-04-01 11:30:37 -04:00
|
|
|
} else if (location->is_xrun()) {
|
|
|
|
/* we don't show xrun markers here */
|
|
|
|
return;
|
2010-07-14 17:18:25 -04:00
|
|
|
} else if (location->is_range_marker() || location->is_mark()) {
|
|
|
|
Locations::LocationList loc = _session->locations()->list ();
|
|
|
|
loc.sort (LocationSortByStart ());
|
|
|
|
|
|
|
|
LocationEditRow* erow = manage (new LocationEditRow (_session, location));
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2016-04-25 12:49:42 -04:00
|
|
|
erow->set_clock_group (*_clock_group);
|
2010-07-14 17:18:25 -04:00
|
|
|
erow->remove_requested.connect (sigc::mem_fun (*this, &LocationUI::location_remove_requested));
|
2011-03-02 17:43:19 -05:00
|
|
|
|
2010-07-14 17:18:25 -04:00
|
|
|
Box_Helpers::BoxList & children = location->is_range_marker() ? range_rows.children () : location_rows.children ();
|
|
|
|
|
|
|
|
/* Step through the location list and the GUI list to find the place to insert */
|
|
|
|
Locations::LocationList::iterator i = loc.begin ();
|
|
|
|
Box_Helpers::BoxList::iterator j = children.begin ();
|
|
|
|
while (i != loc.end()) {
|
|
|
|
|
2023-12-08 19:43:40 -05:00
|
|
|
if (location->is_range_marker() != (*i)->is_range_marker()) {
|
2010-07-14 17:18:25 -04:00
|
|
|
/* Skip locations in the session list that aren't of the right type */
|
|
|
|
++i;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*i == location) {
|
|
|
|
children.insert (j, Box_Helpers::Element (*erow, PACK_SHRINK, 1, PACK_START));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
++i;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-07-14 17:18:25 -04:00
|
|
|
if (j != children.end()) {
|
|
|
|
++j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
range_rows.show_all ();
|
|
|
|
location_rows.show_all ();
|
2012-05-01 17:34:24 -04:00
|
|
|
|
|
|
|
if (location == newest_location) {
|
|
|
|
newest_location = 0;
|
|
|
|
erow->focus_name();
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LocationUI::location_removed (Location* location)
|
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &LocationUI::location_removed, location)
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
if (location->is_auto_punch()) {
|
|
|
|
punch_edit_row.set_location(0);
|
2010-06-22 21:51:55 -04:00
|
|
|
} else if (location->is_auto_loop()) {
|
2005-09-25 14:42:24 -04:00
|
|
|
loop_edit_row.set_location(0);
|
2010-06-22 21:51:55 -04:00
|
|
|
} else if (location->is_range_marker() || location->is_mark()) {
|
|
|
|
Box_Helpers::BoxList& children = location->is_range_marker() ? range_rows.children () : location_rows.children ();
|
|
|
|
for (Box_Helpers::BoxList::iterator i = children.begin(); i != children.end(); ++i) {
|
|
|
|
LocationEditRow* r = dynamic_cast<LocationEditRow*> (i->get_widget());
|
|
|
|
if (r && r->get_location() == location) {
|
|
|
|
children.erase (i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-08 20:26:49 -05:00
|
|
|
void
|
|
|
|
LocationUI::start_changed (Location *location)
|
|
|
|
{
|
|
|
|
Gtk::VBox& box = location->is_range_marker() ? range_rows : location_rows;
|
|
|
|
LocationEditRow* r = NULL;
|
|
|
|
for (auto const& i : box.children ()) {
|
|
|
|
r = dynamic_cast<LocationEditRow*> (i.get_widget());
|
|
|
|
if (r && r->get_location() == location) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
assert (r);
|
|
|
|
|
|
|
|
int pos = 0;
|
|
|
|
Locations::LocationList loc = _session->locations()->list ();
|
|
|
|
loc.sort (LocationSortByStart ());
|
|
|
|
for (auto const& l : loc) {
|
|
|
|
if (location->is_range_marker() != l->is_range_marker()) {
|
|
|
|
/* Skip locations in the session list that aren't of the right type */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (l == location) {
|
|
|
|
box.reorder_child (*r, pos);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
++pos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void
|
2014-10-24 12:18:40 -04:00
|
|
|
LocationUI::map_locations (const Locations::LocationList& locations)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
Locations::LocationList::iterator i;
|
2009-10-14 12:10:01 -04:00
|
|
|
gint n;
|
2005-09-25 14:42:24 -04:00
|
|
|
int mark_n = 0;
|
|
|
|
Locations::LocationList temp = locations;
|
|
|
|
LocationSortByStart cmp;
|
|
|
|
|
|
|
|
temp.sort (cmp);
|
|
|
|
|
2014-10-24 12:18:40 -04:00
|
|
|
for (n = 0, i = temp.begin(); i != temp.end(); ++n, ++i) {
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2010-06-22 21:51:55 -04:00
|
|
|
Location* location = *i;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
if (location->is_mark()) {
|
2010-06-22 21:51:55 -04:00
|
|
|
LocationEditRow* erow = manage (new LocationEditRow (_session, location, mark_n));
|
2011-03-02 17:43:19 -05:00
|
|
|
|
2011-04-22 22:00:23 -04:00
|
|
|
erow->set_clock_group (*_clock_group);
|
2009-12-11 18:29:48 -05:00
|
|
|
erow->remove_requested.connect (sigc::mem_fun(*this, &LocationUI::location_remove_requested));
|
2010-06-22 21:51:55 -04:00
|
|
|
erow->redraw_ranges.connect (sigc::mem_fun(*this, &LocationUI::location_redraw_ranges));
|
2011-03-02 17:43:19 -05:00
|
|
|
|
2016-04-25 12:49:42 -04:00
|
|
|
Box_Helpers::BoxList & loc_children = location_rows.children();
|
2005-10-06 14:24:23 -04:00
|
|
|
loc_children.push_back(Box_Helpers::Element(*erow, PACK_SHRINK, 1, PACK_START));
|
2010-06-22 21:51:55 -04:00
|
|
|
} else if (location->is_auto_punch()) {
|
2009-12-17 13:24:23 -05:00
|
|
|
punch_edit_row.set_session (_session);
|
2005-09-25 14:42:24 -04:00
|
|
|
punch_edit_row.set_location (location);
|
2008-02-16 17:43:18 -05:00
|
|
|
punch_edit_row.show_all();
|
2010-06-22 21:51:55 -04:00
|
|
|
} else if (location->is_auto_loop()) {
|
2009-12-17 13:24:23 -05:00
|
|
|
loop_edit_row.set_session (_session);
|
2005-09-25 14:42:24 -04:00
|
|
|
loop_edit_row.set_location (location);
|
2008-02-16 17:43:18 -05:00
|
|
|
loop_edit_row.show_all();
|
2010-06-22 21:51:55 -04:00
|
|
|
} else {
|
|
|
|
LocationEditRow* erow = manage (new LocationEditRow(_session, location));
|
2011-03-02 17:43:19 -05:00
|
|
|
|
2016-04-25 12:49:42 -04:00
|
|
|
erow->set_clock_group (*_clock_group);
|
2009-12-11 18:29:48 -05:00
|
|
|
erow->remove_requested.connect (sigc::mem_fun(*this, &LocationUI::location_remove_requested));
|
2011-03-02 17:43:19 -05:00
|
|
|
|
2010-06-22 21:51:55 -04:00
|
|
|
Box_Helpers::BoxList & range_children = range_rows.children();
|
2005-10-06 14:24:23 -04:00
|
|
|
range_children.push_back(Box_Helpers::Element(*erow, PACK_SHRINK, 1, PACK_START));
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
range_rows.show_all();
|
|
|
|
location_rows.show_all();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LocationUI::add_new_location()
|
|
|
|
{
|
2007-01-08 12:12:29 -05:00
|
|
|
string markername;
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session) {
|
2020-10-19 14:37:54 -04:00
|
|
|
timepos_t where (_session->audible_sample());
|
2009-12-17 13:24:23 -05:00
|
|
|
_session->locations()->next_available_name(markername,"mark");
|
2010-08-09 12:40:31 -04:00
|
|
|
Location *location = new Location (*_session, where, where, markername, Location::IsMark);
|
2015-01-02 09:44:54 -05:00
|
|
|
if (UIConfiguration::instance().get_name_new_markers()) {
|
2009-10-14 12:10:01 -04:00
|
|
|
newest_location = location;
|
2008-09-10 11:03:30 -04:00
|
|
|
}
|
2014-12-14 08:13:38 -05:00
|
|
|
PublicEditor::instance().begin_reversible_command (_("add marker"));
|
2009-12-17 13:24:23 -05:00
|
|
|
XMLNode &before = _session->locations()->get_state();
|
|
|
|
_session->locations()->add (location, true);
|
|
|
|
XMLNode &after = _session->locations()->get_state();
|
|
|
|
_session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
|
2014-12-14 08:13:38 -05:00
|
|
|
PublicEditor::instance().commit_reversible_command ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LocationUI::add_new_range()
|
|
|
|
{
|
2007-01-08 12:12:29 -05:00
|
|
|
string rangename;
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session) {
|
2020-10-19 14:37:54 -04:00
|
|
|
timepos_t where (_session->audible_sample());
|
2009-12-17 13:24:23 -05:00
|
|
|
_session->locations()->next_available_name(rangename,"unnamed");
|
2010-08-09 12:40:31 -04:00
|
|
|
Location *location = new Location (*_session, where, where, rangename, Location::IsRangeMarker);
|
2014-12-14 08:13:38 -05:00
|
|
|
PublicEditor::instance().begin_reversible_command (_("add range marker"));
|
2009-12-17 13:24:23 -05:00
|
|
|
XMLNode &before = _session->locations()->get_state();
|
|
|
|
_session->locations()->add (location, true);
|
|
|
|
XMLNode &after = _session->locations()->get_state();
|
|
|
|
_session->add_command (new MementoCommand<Locations>(*(_session->locations()), &before, &after));
|
2014-12-14 08:13:38 -05:00
|
|
|
PublicEditor::instance().commit_reversible_command ();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LocationUI::refresh_location_list ()
|
|
|
|
{
|
2009-12-11 18:29:48 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &LocationUI::refresh_location_list)
|
2005-09-25 14:42:24 -04:00
|
|
|
using namespace Box_Helpers;
|
|
|
|
|
2008-01-10 16:20:59 -05:00
|
|
|
// this is just too expensive to do when window is not shown
|
2022-01-26 15:17:53 -05:00
|
|
|
if (!get_mapped ()) {
|
2011-04-22 22:00:23 -04:00
|
|
|
return;
|
|
|
|
}
|
2008-01-10 16:20:59 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
BoxList & loc_children = location_rows.children();
|
|
|
|
BoxList & range_children = range_rows.children();
|
|
|
|
|
|
|
|
loc_children.clear();
|
|
|
|
range_children.clear();
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session) {
|
|
|
|
_session->locations()->apply (*this, &LocationUI::map_locations);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-11-12 00:47:05 -05:00
|
|
|
LocationUI::set_session(ARDOUR::Session* s)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
SessionHandlePtr::set_session (s);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
if (_session) {
|
2012-04-25 08:58:19 -04:00
|
|
|
_session->locations()->added.connect (_session_connections, invalidator (*this), boost::bind (&LocationUI::location_added, this, _1), gui_context());
|
|
|
|
_session->locations()->removed.connect (_session_connections, invalidator (*this), boost::bind (&LocationUI::location_removed, this, _1), gui_context());
|
2014-10-24 12:18:40 -04:00
|
|
|
_session->locations()->changed.connect (_session_connections, invalidator (*this), boost::bind (&LocationUI::refresh_location_list, this), gui_context());
|
2023-12-08 20:26:49 -05:00
|
|
|
Location::start_changed.connect (_session_connections, invalidator (*this), boost::bind (&LocationUI::start_changed, this, _1), gui_context());
|
2014-10-24 12:18:40 -04:00
|
|
|
|
2011-11-23 16:22:02 -05:00
|
|
|
_clock_group->set_clock_mode (clock_mode_from_session_instant_xml ());
|
2017-02-14 11:15:16 -05:00
|
|
|
} else {
|
|
|
|
_mode_set = false;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2009-12-17 13:24:23 -05:00
|
|
|
|
2010-02-08 20:51:04 -05:00
|
|
|
loop_edit_row.set_session (s);
|
|
|
|
punch_edit_row.set_session (s);
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
refresh_location_list ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-12-17 13:24:23 -05:00
|
|
|
LocationUI::session_going_away()
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2009-12-17 13:24:23 -05:00
|
|
|
ENSURE_GUI_THREAD (*this, &LocationUI::session_going_away);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
using namespace Box_Helpers;
|
|
|
|
BoxList & loc_children = location_rows.children();
|
|
|
|
BoxList & range_children = range_rows.children();
|
|
|
|
|
|
|
|
loc_children.clear();
|
|
|
|
range_children.clear();
|
|
|
|
|
|
|
|
loop_edit_row.set_session (0);
|
|
|
|
loop_edit_row.set_location (0);
|
|
|
|
|
|
|
|
punch_edit_row.set_session (0);
|
|
|
|
punch_edit_row.set_location (0);
|
2009-12-17 13:24:23 -05:00
|
|
|
|
2017-02-14 11:15:16 -05:00
|
|
|
_mode_set = false;
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
SessionHandlePtr::session_going_away ();
|
2009-11-12 00:47:05 -05:00
|
|
|
}
|
2005-12-29 19:34:21 -05:00
|
|
|
|
2011-11-23 16:22:02 -05:00
|
|
|
XMLNode &
|
|
|
|
LocationUI::get_state () const
|
|
|
|
{
|
2017-02-14 11:15:16 -05:00
|
|
|
XMLNode* node = new XMLNode (_state_node_name);
|
2016-08-29 04:11:04 -04:00
|
|
|
node->set_property (X_("clock-mode"), _clock_group->clock_mode ());
|
2011-11-23 16:22:02 -05:00
|
|
|
return *node;
|
|
|
|
}
|
|
|
|
|
2017-02-14 11:15:16 -05:00
|
|
|
int
|
|
|
|
LocationUI::set_state (const XMLNode& node)
|
|
|
|
{
|
|
|
|
if (node.name() != _state_node_name) {
|
|
|
|
return -1;
|
|
|
|
}
|
2016-08-29 04:11:04 -04:00
|
|
|
|
|
|
|
if (!node.get_property (X_("clock-mode"), _mode)) {
|
2017-02-14 11:15:16 -05:00
|
|
|
return -1;
|
|
|
|
}
|
2016-08-29 04:11:04 -04:00
|
|
|
|
2017-02-14 11:15:16 -05:00
|
|
|
_mode_set = true;
|
2017-03-10 13:37:02 -05:00
|
|
|
_clock_group->set_clock_mode (_mode);
|
2017-02-14 11:15:16 -05:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-11-23 16:22:02 -05:00
|
|
|
AudioClock::Mode
|
2017-02-14 11:15:16 -05:00
|
|
|
LocationUI::clock_mode_from_session_instant_xml ()
|
2011-11-23 16:22:02 -05:00
|
|
|
{
|
2017-02-14 11:15:16 -05:00
|
|
|
if (_mode_set) {
|
|
|
|
return _mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
XMLNode* node = _session->instant_xml (_state_node_name);
|
2011-11-23 16:22:02 -05:00
|
|
|
if (!node) {
|
2018-10-10 11:47:05 -04:00
|
|
|
return ARDOUR_UI::instance()->primary_clock->mode();
|
2011-11-23 16:22:02 -05:00
|
|
|
}
|
|
|
|
|
2016-08-29 04:11:04 -04:00
|
|
|
if (!node->get_property (X_("clock-mode"), _mode)) {
|
2018-10-10 11:47:05 -04:00
|
|
|
return ARDOUR_UI::instance()->primary_clock->mode();
|
2011-11-23 16:22:02 -05:00
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2017-02-14 11:15:16 -05:00
|
|
|
_mode_set = true;
|
|
|
|
return _mode;
|
2011-11-23 16:22:02 -05:00
|
|
|
}
|
|
|
|
|
2010-08-09 20:28:20 -04:00
|
|
|
|
2009-11-12 00:47:05 -05:00
|
|
|
/*------------------------*/
|
|
|
|
|
|
|
|
LocationUIWindow::LocationUIWindow ()
|
2016-06-07 12:32:57 -04:00
|
|
|
: ArdourWindow (S_("Ranges|Locations"))
|
2009-11-12 00:47:05 -05:00
|
|
|
{
|
2010-08-16 20:28:20 -04:00
|
|
|
set_wmclass(X_("ardour_locations"), PROGRAM_NAME);
|
2009-11-12 00:47:05 -05:00
|
|
|
set_name ("LocationWindow");
|
|
|
|
|
2011-11-18 19:56:35 -05:00
|
|
|
add (_ui);
|
2009-11-12 00:47:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
LocationUIWindow::~LocationUIWindow()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-06-01 13:00:29 -04:00
|
|
|
void
|
2011-04-22 22:00:23 -04:00
|
|
|
LocationUIWindow::on_map ()
|
2009-11-12 00:47:05 -05:00
|
|
|
{
|
2011-11-18 19:56:35 -05:00
|
|
|
ArdourWindow::on_map ();
|
2009-11-12 00:47:05 -05:00
|
|
|
_ui.refresh_location_list();
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2005-12-29 19:34:21 -05:00
|
|
|
bool
|
2009-11-12 00:47:05 -05:00
|
|
|
LocationUIWindow::on_delete_event (GdkEventAny*)
|
2005-12-29 19:34:21 -05:00
|
|
|
{
|
2013-07-07 16:24:15 -04:00
|
|
|
return false;
|
2005-12-29 19:34:21 -05:00
|
|
|
}
|
2009-11-12 00:47:05 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
LocationUIWindow::set_session (Session *s)
|
|
|
|
{
|
2011-11-18 19:56:35 -05:00
|
|
|
ArdourWindow::set_session (s);
|
2009-11-12 00:47:05 -05:00
|
|
|
_ui.set_session (s);
|
2013-06-30 08:08:03 -04:00
|
|
|
_ui.show_all ();
|
2009-11-12 00:47:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-12-17 13:24:23 -05:00
|
|
|
LocationUIWindow::session_going_away ()
|
2009-11-12 00:47:05 -05:00
|
|
|
{
|
2011-11-18 19:56:35 -05:00
|
|
|
ArdourWindow::session_going_away ();
|
2009-11-12 00:47:05 -05:00
|
|
|
hide_all();
|
|
|
|
}
|