summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-08-09 18:22:10 +0000
committerCarl Hetherington <carl@carlh.net>2010-08-09 18:22:10 +0000
commit7c5f1b7a26df60417590340d4cfe367ed00e180a (patch)
tree52007e3a379a9bd0e93264d9e4411ca79857e8b1
parent2c90b4f36cd074428631eb94b4a95ea0844870bc (diff)
Add glue / lock buttons to the location window.
git-svn-id: svn://localhost/ardour2/branches/3.0@7577 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/location_ui.cc83
-rw-r--r--gtk2_ardour/location_ui.h6
-rw-r--r--libs/ardour/ardour/location.h9
-rw-r--r--libs/ardour/location.cc2
4 files changed, 91 insertions, 9 deletions
diff --git a/gtk2_ardour/location_ui.cc b/gtk2_ardour/location_ui.cc
index fb30450a54..ac7b227e5b 100644
--- a/gtk2_ardour/location_ui.cc
+++ b/gtk2_ardour/location_ui.cc
@@ -51,6 +51,8 @@ LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num)
length_clock (X_("locationlength"), true, X_("LocationEditRowClock"), true, false, true),
cd_check_button (_("CD")),
hide_check_button (_("Hide")),
+ lock_check_button (_("Lock")),
+ glue_check_button (_("Glue")),
scms_check_button (_("SCMS")),
preemph_check_button (_("Pre-Emphasis"))
@@ -68,6 +70,8 @@ LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num)
end_go_button.set_name ("LocationEditGoButton");
cd_check_button.set_name ("LocationEditCdButton");
hide_check_button.set_name ("LocationEditHideButton");
+ lock_check_button.set_name ("LocationEditLockButton");
+ glue_check_button.set_name ("LocationEditGlueButton");
remove_button.set_name ("LocationEditRemoveButton");
isrc_label.set_name ("LocationEditNumberLabel");
isrc_entry.set_name ("LocationEditNameEntry");
@@ -137,6 +141,8 @@ LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num)
cd_check_button.signal_toggled().connect(sigc::mem_fun(*this, &LocationEditRow::cd_toggled));
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));
+ glue_check_button.signal_toggled().connect(sigc::mem_fun(*this, &LocationEditRow::glue_toggled));
remove_button.signal_clicked().connect(sigc::mem_fun(*this, &LocationEditRow::remove_button_pressed));
@@ -191,8 +197,12 @@ LocationEditRow::set_location (Location *loc)
if (!hide_check_button.get_parent()) {
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);
+ item_table.attach (glue_check_button, 7, 8, 0, 1, FILL, Gtk::FILL, 4, 0);
}
hide_check_button.set_active (location->is_hidden());
+ lock_check_button.set_active (location->locked());
+ glue_check_button.set_active (location->position_lock_style() == MusicTime);
if (location->is_auto_loop() || location-> is_auto_punch()) {
// use label instead of entry
@@ -222,7 +232,7 @@ LocationEditRow::set_location (Location *loc)
item_table.attach (cd_check_button, 4, 5, 0, 1, FILL, FILL, 4, 0);
}
if (!remove_button.get_parent()) {
- item_table.attach (remove_button, 6, 7, 0, 1, FILL, FILL, 4, 0);
+ item_table.attach (remove_button, 8, 9, 0, 1, FILL, FILL, 4, 0);
}
if (location->is_session_range()) {
@@ -239,6 +249,8 @@ LocationEditRow::set_location (Location *loc)
}
hide_check_button.show();
+ lock_check_button.show();
+ glue_check_button.show();
}
start_clock.set (location->start(), true);
@@ -286,6 +298,8 @@ LocationEditRow::set_location (Location *loc)
location->name_changed.connect (connections, invalidator (*this), ui_bind (&LocationEditRow::name_changed, this, _1), gui_context());
location->changed.connect (connections, invalidator (*this), ui_bind (&LocationEditRow::location_changed, this, _1), gui_context());
location->FlagsChanged.connect (connections, invalidator (*this), ui_bind (&LocationEditRow::flags_changed, this, _1, _2), gui_context());
+ location->LockChanged.connect (connections, invalidator (*this), ui_bind (&LocationEditRow::lock_changed, this, _1), gui_context());
+ location->PositionLockStyleChanged.connect (connections, invalidator (*this), ui_bind (&LocationEditRow::position_lock_style_changed, this, _1), gui_context());
}
void
@@ -444,12 +458,42 @@ LocationEditRow::cd_toggled ()
void
LocationEditRow::hide_toggled ()
{
- if (i_am_the_modifier || !location) return;
+ if (i_am_the_modifier || !location) {
+ return;
+ }
location->set_hidden (hide_check_button.get_active(), this);
}
void
+LocationEditRow::lock_toggled ()
+{
+ if (i_am_the_modifier || !location) {
+ return;
+ }
+
+ if (location->locked()) {
+ location->unlock ();
+ } else {
+ location->lock ();
+ }
+}
+
+void
+LocationEditRow::glue_toggled ()
+{
+ if (i_am_the_modifier || !location) {
+ return;
+ }
+
+ if (location->position_lock_style() == AudioTime) {
+ location->set_position_lock_style (MusicTime);
+ } else {
+ location->set_position_lock_style (AudioTime);
+ }
+}
+
+void
LocationEditRow::remove_button_pressed ()
{
if (!location) {
@@ -564,14 +608,43 @@ LocationEditRow::location_changed (ARDOUR::Location *loc)
void
LocationEditRow::flags_changed (ARDOUR::Location *loc, void *src)
{
- ENSURE_GUI_THREAD (*this, &LocationEditRow::flags_changed, loc, src)
-
- if (!location) return;
+ if (!location) {
+ return;
+ }
i_am_the_modifier++;
cd_check_button.set_active (location->is_cd_marker());
hide_check_button.set_active (location->is_hidden());
+ glue_check_button.set_active (location->position_lock_style() == MusicTime);
+
+ i_am_the_modifier--;
+}
+
+void
+LocationEditRow::lock_changed (ARDOUR::Location *loc)
+{
+ if (!location) {
+ return;
+ }
+
+ i_am_the_modifier++;
+
+ lock_check_button.set_active (location->locked());
+
+ i_am_the_modifier--;
+}
+
+void
+LocationEditRow::position_lock_style_changed (ARDOUR::Location* loc)
+{
+ if (!location) {
+ return;
+ }
+
+ i_am_the_modifier++;
+
+ glue_check_button.set_active (location->position_lock_style() == MusicTime);
i_am_the_modifier--;
}
diff --git a/gtk2_ardour/location_ui.h b/gtk2_ardour/location_ui.h
index c3f07cc84d..b2b7174d8f 100644
--- a/gtk2_ardour/location_ui.h
+++ b/gtk2_ardour/location_ui.h
@@ -86,6 +86,8 @@ class LocationEditRow : public Gtk::HBox, public ARDOUR::SessionHandlePtr
AudioClock length_clock;
Gtk::CheckButton cd_check_button;
Gtk::CheckButton hide_check_button;
+ Gtk::CheckButton lock_check_button;
+ Gtk::CheckButton glue_check_button;
Gtk::Button remove_button;
@@ -117,6 +119,8 @@ class LocationEditRow : public Gtk::HBox, public ARDOUR::SessionHandlePtr
void cd_toggled ();
void hide_toggled ();
+ void lock_toggled ();
+ void glue_toggled ();
void remove_button_pressed ();
void scms_toggled ();
@@ -127,6 +131,8 @@ class LocationEditRow : public Gtk::HBox, public ARDOUR::SessionHandlePtr
void name_changed (ARDOUR::Location *);
void location_changed (ARDOUR::Location *);
void flags_changed (ARDOUR::Location *, void *src);
+ void lock_changed (ARDOUR::Location *);
+ void position_lock_style_changed (ARDOUR::Location *);
PBD::ScopedConnectionList connections;
};
diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h
index cafcf38494..429fac177c 100644
--- a/libs/ardour/ardour/location.h
+++ b/libs/ardour/ardour/location.h
@@ -58,8 +58,8 @@ class Location : public SessionHandleRef, public PBD::StatefulDestructible
Location* operator= (const Location& other);
bool locked() const { return _locked; }
- void lock() { _locked = true; changed (this); }
- void unlock() { _locked = false; changed (this); }
+ void lock() { _locked = true; LockChanged (this); }
+ void unlock() { _locked = false; LockChanged (this); }
nframes64_t start() const { return _start; }
nframes64_t end() const { return _end; }
@@ -95,10 +95,11 @@ class Location : public SessionHandleRef, public PBD::StatefulDestructible
PBD::Signal1<void,Location*> end_changed;
PBD::Signal1<void,Location*> start_changed;
+ PBD::Signal1<void,Location*> LockChanged;
PBD::Signal2<void,Location*,void*> FlagsChanged;
+ PBD::Signal1<void,Location*> PositionLockStyleChanged;
- /* this is sent only when both start&end change at the same time */
-
+ /* this is sent only when both start and end change at the same time */
PBD::Signal1<void,Location*> changed;
/* CD Track / CD-Text info */
diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc
index 5828c57f65..ea267db25e 100644
--- a/libs/ardour/location.cc
+++ b/libs/ardour/location.cc
@@ -464,6 +464,8 @@ Location::set_position_lock_style (PositionLockStyle ps)
_position_lock_style = ps;
recompute_bbt_from_frames ();
+
+ PositionLockStyleChanged (this); /* EMIT SIGNAL */
}
void