mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
RecorderUI: Implement track renaming
This commit is contained in:
parent
3f6be2f249
commit
1699fd0927
4 changed files with 193 additions and 2 deletions
|
|
@ -311,6 +311,7 @@ RecorderUI::set_session (Session* s)
|
||||||
|
|
||||||
_session->RouteAdded.connect (_session_connections, invalidator (*this), boost::bind (&RecorderUI::add_routes, this, _1), gui_context ());
|
_session->RouteAdded.connect (_session_connections, invalidator (*this), boost::bind (&RecorderUI::add_routes, this, _1), gui_context ());
|
||||||
TrackRecordAxis::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&RecorderUI::remove_route, this, _1), gui_context ());
|
TrackRecordAxis::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&RecorderUI::remove_route, this, _1), gui_context ());
|
||||||
|
TrackRecordAxis::EditNextName.connect (*this, invalidator (*this), boost::bind (&RecorderUI::tra_name_edit, this, _1, _2), gui_context ());
|
||||||
|
|
||||||
_session->config.ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&RecorderUI::parameter_changed, this, _1), gui_context ());
|
_session->config.ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&RecorderUI::parameter_changed, this, _1), gui_context ());
|
||||||
|
|
||||||
|
|
@ -831,6 +832,20 @@ RecorderUI::remove_route (TrackRecordAxis* ra)
|
||||||
update_rec_table_layout ();
|
update_rec_table_layout ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
RecorderUI::tra_name_edit (TrackRecordAxis* tra, bool next)
|
||||||
|
{
|
||||||
|
list<TrackRecordAxis*>::iterator i = find (_visible_recorders.begin (), _visible_recorders.end (), tra);
|
||||||
|
if (i == _visible_recorders.end ()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (next && ++i != _visible_recorders.end ()) {
|
||||||
|
(*i)->start_rename ();
|
||||||
|
} else if (!next && i != _visible_recorders.begin ()) {
|
||||||
|
(*--i)->start_rename ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct TrackRecordAxisSorter {
|
struct TrackRecordAxisSorter {
|
||||||
bool operator() (const TrackRecordAxis* ca, const TrackRecordAxis* cb)
|
bool operator() (const TrackRecordAxis* ca, const TrackRecordAxis* cb)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ private:
|
||||||
void initial_track_display ();
|
void initial_track_display ();
|
||||||
void add_routes (ARDOUR::RouteList&);
|
void add_routes (ARDOUR::RouteList&);
|
||||||
void remove_route (TrackRecordAxis*);
|
void remove_route (TrackRecordAxis*);
|
||||||
|
void tra_name_edit (TrackRecordAxis*, bool);
|
||||||
void update_rec_table_layout ();
|
void update_rec_table_layout ();
|
||||||
void update_spacer_width (Gtk::Allocation&, TrackRecordAxis*);
|
void update_spacer_width (Gtk::Allocation&, TrackRecordAxis*);
|
||||||
void tabbed_changed (bool);
|
void tabbed_changed (bool);
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@
|
||||||
|
|
||||||
#include "widgets/tooltips.h"
|
#include "widgets/tooltips.h"
|
||||||
|
|
||||||
|
#include "ardour_message.h"
|
||||||
#include "ardour_window.h"
|
#include "ardour_window.h"
|
||||||
#include "context_menu_helper.h"
|
#include "context_menu_helper.h"
|
||||||
#include "editor_cursors.h"
|
#include "editor_cursors.h"
|
||||||
|
|
@ -69,6 +70,7 @@ using namespace Gtkmm2ext;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
PBD::Signal1<void, TrackRecordAxis*> TrackRecordAxis::CatchDeletion;
|
PBD::Signal1<void, TrackRecordAxis*> TrackRecordAxis::CatchDeletion;
|
||||||
|
PBD::Signal2<void, TrackRecordAxis*, bool> TrackRecordAxis::EditNextName;
|
||||||
|
|
||||||
#define PX_SCALE(pxmin, dflt) rint (std::max ((double)pxmin, (double)dflt* UIConfiguration::instance ().get_ui_scale ()))
|
#define PX_SCALE(pxmin, dflt) rint (std::max ((double)pxmin, (double)dflt* UIConfiguration::instance ().get_ui_scale ()))
|
||||||
|
|
||||||
|
|
@ -80,6 +82,7 @@ TrackRecordAxis::TrackRecordAxis (Session* s, boost::shared_ptr<ARDOUR::Route> r
|
||||||
, RouteUI (s)
|
, RouteUI (s)
|
||||||
, _clear_meters (true)
|
, _clear_meters (true)
|
||||||
, _route_ops_menu (0)
|
, _route_ops_menu (0)
|
||||||
|
, _renaming (false)
|
||||||
, _input_button (true)
|
, _input_button (true)
|
||||||
, _playlist_button (S_("RTAV|P"))
|
, _playlist_button (S_("RTAV|P"))
|
||||||
, _hseparator (1.0)
|
, _hseparator (1.0)
|
||||||
|
|
@ -133,6 +136,10 @@ TrackRecordAxis::TrackRecordAxis (Session* s, boost::shared_ptr<ARDOUR::Route> r
|
||||||
name_label.set_alignment (0.0, 0.5);
|
name_label.set_alignment (0.0, 0.5);
|
||||||
name_label.set_width_chars (12);
|
name_label.set_width_chars (12);
|
||||||
|
|
||||||
|
_namebox.add (name_label);
|
||||||
|
_namebox.add_events (Gdk::BUTTON_PRESS_MASK);
|
||||||
|
_namebox.signal_button_press_event ().connect (sigc::mem_fun (*this, &TrackRecordAxis::namebox_button_press));
|
||||||
|
|
||||||
_input_button.set_sizing_text ("Capture_8888");
|
_input_button.set_sizing_text ("Capture_8888");
|
||||||
_input_button.set_route (rt, this);
|
_input_button.set_route (rt, this);
|
||||||
|
|
||||||
|
|
@ -144,7 +151,7 @@ TrackRecordAxis::TrackRecordAxis (Session* s, boost::shared_ptr<ARDOUR::Route> r
|
||||||
_ctrls.attach (_input_button, 1, 2, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 0, 2);
|
_ctrls.attach (_input_button, 1, 2, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 0, 2);
|
||||||
_ctrls.attach (*rec_enable_button, 2, 3, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 2, 2);
|
_ctrls.attach (*rec_enable_button, 2, 3, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 2, 2);
|
||||||
_ctrls.attach (_playlist_button, 3, 4, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 2, 2);
|
_ctrls.attach (_playlist_button, 3, 4, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 2, 2);
|
||||||
_ctrls.attach (name_label, 4, 5, 1, 2, Gtk::FILL, Gtk::SHRINK, 4, 2);
|
_ctrls.attach (_namebox, 4, 5, 1, 2, Gtk::FILL, Gtk::SHRINK, 4, 2);
|
||||||
_ctrls.attach (*monitor_input_button, 5, 6, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 1, 2);
|
_ctrls.attach (*monitor_input_button, 5, 6, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 1, 2);
|
||||||
_ctrls.attach (*monitor_disk_button, 6, 7, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 1, 2);
|
_ctrls.attach (*monitor_disk_button, 6, 7, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 1, 2);
|
||||||
_ctrls.attach (*_level_meter, 7, 8, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 2, 2);
|
_ctrls.attach (*_level_meter, 7, 8, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 2, 2);
|
||||||
|
|
@ -174,6 +181,7 @@ TrackRecordAxis::TrackRecordAxis (Session* s, boost::shared_ptr<ARDOUR::Route> r
|
||||||
_level_meter->show ();
|
_level_meter->show ();
|
||||||
_playlist_button.show();
|
_playlist_button.show();
|
||||||
_number_label.show ();
|
_number_label.show ();
|
||||||
|
_namebox.show ();
|
||||||
name_label.show ();
|
name_label.show ();
|
||||||
_input_button.show ();
|
_input_button.show ();
|
||||||
_track_summary.show ();
|
_track_summary.show ();
|
||||||
|
|
@ -205,6 +213,17 @@ TrackRecordAxis::set_session (Session* s)
|
||||||
s->config.ParameterChanged.connect (*this, invalidator (*this), ui_bind (&TrackRecordAxis::parameter_changed, this, _1), gui_context ());
|
s->config.ParameterChanged.connect (*this, invalidator (*this), ui_bind (&TrackRecordAxis::parameter_changed, this, _1), gui_context ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TrackRecordAxis::route_rec_enable_changed ()
|
||||||
|
{
|
||||||
|
if (_route->rec_enable_control()->get_value()) {
|
||||||
|
/* end renaming when rec-arm engages
|
||||||
|
* (due to modal grab this can only be triggered by ctrl surfaces) */
|
||||||
|
end_rename (true);
|
||||||
|
}
|
||||||
|
RouteUI::route_rec_enable_changed ();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackRecordAxis::blink_rec_display (bool onoff)
|
TrackRecordAxis::blink_rec_display (bool onoff)
|
||||||
{
|
{
|
||||||
|
|
@ -312,6 +331,22 @@ TrackRecordAxis::set_name_label ()
|
||||||
_number_label.set_text (PBD::to_string (track_number));
|
_number_label.set_text (PBD::to_string (track_number));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
TrackRecordAxis::namebox_button_press (GdkEventButton* ev)
|
||||||
|
{
|
||||||
|
if (_renaming) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((ev->button == 1 && ev->type == GDK_2BUTTON_PRESS) || Keyboard::is_edit_event (ev)) {
|
||||||
|
if (!start_rename ()) {
|
||||||
|
ArdourMessageDialog msg (_("Inactive and record-armed tracks cannot be renamed"));
|
||||||
|
msg.run ();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TrackRecordAxis::route_active_changed ()
|
TrackRecordAxis::route_active_changed ()
|
||||||
{
|
{
|
||||||
|
|
@ -345,6 +380,10 @@ TrackRecordAxis::update_sensitivity ()
|
||||||
_input_button.set_sensitive (en);
|
_input_button.set_sensitive (en);
|
||||||
_ctrls.set_sensitive (en);
|
_ctrls.set_sensitive (en);
|
||||||
|
|
||||||
|
if (!en) {
|
||||||
|
end_rename (true);
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_track() || track()->mode() != ARDOUR::Normal) {
|
if (!is_track() || track()->mode() != ARDOUR::Normal) {
|
||||||
_playlist_button.set_sensitive (false);
|
_playlist_button.set_sensitive (false);
|
||||||
}
|
}
|
||||||
|
|
@ -459,6 +498,123 @@ TrackRecordAxis::build_route_ops_menu ()
|
||||||
items.back().set_sensitive (!is_track() || !track()->rec_enable_control()->get_value());
|
items.back().set_sensitive (!is_track() || !track()->rec_enable_control()->get_value());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ****************************************************************************/
|
||||||
|
|
||||||
|
bool
|
||||||
|
TrackRecordAxis::start_rename ()
|
||||||
|
{
|
||||||
|
if (_renaming || _route->rec_enable_control()->get_value() || !_route->active ()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
assert (_entry_connections.empty ());
|
||||||
|
|
||||||
|
GtkRequisition r (name_label.size_request ());
|
||||||
|
_nameentry.set_size_request (r.width, -1);
|
||||||
|
_nameentry.set_text (_route->name ());
|
||||||
|
_namebox.remove ();
|
||||||
|
_namebox.add (_nameentry);
|
||||||
|
_nameentry.show ();
|
||||||
|
_nameentry.grab_focus ();
|
||||||
|
_nameentry.add_modal_grab ();
|
||||||
|
_renaming = true;
|
||||||
|
|
||||||
|
_entry_connections.push_back (_nameentry.signal_changed().connect (sigc::mem_fun (*this, &TrackRecordAxis::entry_changed)));
|
||||||
|
_entry_connections.push_back (_nameentry.signal_activate().connect (sigc::mem_fun (*this, &TrackRecordAxis::entry_activated)));
|
||||||
|
_entry_connections.push_back (_nameentry.signal_key_press_event().connect (sigc::mem_fun (*this, &TrackRecordAxis::entry_key_press), false));
|
||||||
|
_entry_connections.push_back (_nameentry.signal_key_release_event().connect (sigc::mem_fun (*this, &TrackRecordAxis::entry_key_release), false));
|
||||||
|
_entry_connections.push_back (_nameentry.signal_focus_out_event ().connect (sigc::mem_fun (*this, &TrackRecordAxis::entry_focus_out)));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TrackRecordAxis::end_rename (bool ignore_change)
|
||||||
|
{
|
||||||
|
if (!_renaming) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
std::string result = _nameentry.get_text ();
|
||||||
|
disconnect_entry_signals ();
|
||||||
|
_nameentry.remove_modal_grab ();
|
||||||
|
_namebox.remove ();
|
||||||
|
_namebox.add (name_label);
|
||||||
|
name_label.show ();
|
||||||
|
_renaming = false;
|
||||||
|
|
||||||
|
if (ignore_change) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (verify_new_route_name (result)) {
|
||||||
|
_route->set_name (result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TrackRecordAxis::entry_changed ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TrackRecordAxis::entry_activated ()
|
||||||
|
{
|
||||||
|
end_rename (false);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
TrackRecordAxis::entry_focus_out (GdkEventFocus*)
|
||||||
|
{
|
||||||
|
end_rename (false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
TrackRecordAxis::entry_key_press (GdkEventKey* ev)
|
||||||
|
{
|
||||||
|
switch (ev->keyval) {
|
||||||
|
case GDK_Escape:
|
||||||
|
/* fallthrough */
|
||||||
|
case GDK_ISO_Left_Tab:
|
||||||
|
/* fallthrough */
|
||||||
|
case GDK_Tab:
|
||||||
|
/* fallthrough */
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
TrackRecordAxis::entry_key_release (GdkEventKey* ev)
|
||||||
|
{
|
||||||
|
switch (ev->keyval) {
|
||||||
|
case GDK_Escape:
|
||||||
|
end_rename (true);
|
||||||
|
return true;
|
||||||
|
case GDK_ISO_Left_Tab:
|
||||||
|
end_rename (false);
|
||||||
|
EditNextName (this, false); /* EMIT SIGNAL */
|
||||||
|
return true;
|
||||||
|
case GDK_Tab:
|
||||||
|
end_rename (false);
|
||||||
|
EditNextName (this, true); /* EMIT SIGNAL */
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TrackRecordAxis::disconnect_entry_signals ()
|
||||||
|
{
|
||||||
|
for (std::list<sigc::connection>::iterator i = _entry_connections.begin(); i != _entry_connections.end(); ++i) {
|
||||||
|
i->disconnect ();
|
||||||
|
}
|
||||||
|
_entry_connections.clear ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ****************************************************************************/
|
/* ****************************************************************************/
|
||||||
|
|
||||||
TrackRecordAxis::TrackSummary::TrackSummary (boost::shared_ptr<ARDOUR::Route> r)
|
TrackRecordAxis::TrackSummary::TrackSummary (boost::shared_ptr<ARDOUR::Route> r)
|
||||||
|
|
|
||||||
|
|
@ -70,12 +70,15 @@ public:
|
||||||
void set_session (ARDOUR::Session* s);
|
void set_session (ARDOUR::Session* s);
|
||||||
|
|
||||||
void fast_update ();
|
void fast_update ();
|
||||||
|
bool start_rename ();
|
||||||
void set_gui_extents (samplepos_t, samplepos_t);
|
void set_gui_extents (samplepos_t, samplepos_t);
|
||||||
|
|
||||||
bool rec_extent (samplepos_t&, samplepos_t&) const;
|
bool rec_extent (samplepos_t&, samplepos_t&) const;
|
||||||
int summary_xpos () const;
|
int summary_xpos () const;
|
||||||
int summary_width () const;
|
int summary_width () const;
|
||||||
|
|
||||||
static PBD::Signal1<void, TrackRecordAxis*> CatchDeletion;
|
static PBD::Signal1<void, TrackRecordAxis*> CatchDeletion;
|
||||||
|
static PBD::Signal2<void, TrackRecordAxis*, bool> EditNextName;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void self_delete ();
|
void self_delete ();
|
||||||
|
|
@ -88,6 +91,7 @@ protected:
|
||||||
|
|
||||||
/* route UI */
|
/* route UI */
|
||||||
void set_button_names ();
|
void set_button_names ();
|
||||||
|
void route_rec_enable_changed ();
|
||||||
void blink_rec_display (bool onoff);
|
void blink_rec_display (bool onoff);
|
||||||
void route_active_changed ();
|
void route_active_changed ();
|
||||||
void map_frozen ();
|
void map_frozen ();
|
||||||
|
|
@ -101,11 +105,21 @@ private:
|
||||||
void reset_peak_display ();
|
void reset_peak_display ();
|
||||||
void reset_route_peak_display (ARDOUR::Route*);
|
void reset_route_peak_display (ARDOUR::Route*);
|
||||||
void reset_group_peak_display (ARDOUR::RouteGroup*);
|
void reset_group_peak_display (ARDOUR::RouteGroup*);
|
||||||
|
bool namebox_button_press (GdkEventButton*);
|
||||||
|
|
||||||
bool playlist_click (GdkEventButton*);
|
bool playlist_click (GdkEventButton*);
|
||||||
bool route_ops_click (GdkEventButton*);
|
bool route_ops_click (GdkEventButton*);
|
||||||
void build_route_ops_menu ();
|
void build_route_ops_menu ();
|
||||||
|
|
||||||
|
/* name editing */
|
||||||
|
void end_rename (bool);
|
||||||
|
void entry_changed ();
|
||||||
|
void entry_activated ();
|
||||||
|
bool entry_focus_out (GdkEventFocus*);
|
||||||
|
bool entry_key_press (GdkEventKey*);
|
||||||
|
bool entry_key_release (GdkEventKey*);
|
||||||
|
void disconnect_entry_signals ();
|
||||||
|
|
||||||
/* RouteUI */
|
/* RouteUI */
|
||||||
void route_property_changed (const PBD::PropertyChange&);
|
void route_property_changed (const PBD::PropertyChange&);
|
||||||
void route_color_changed ();
|
void route_color_changed ();
|
||||||
|
|
@ -116,6 +130,10 @@ private:
|
||||||
Gtk::Table _ctrls;
|
Gtk::Table _ctrls;
|
||||||
Gtk::Menu* _route_ops_menu;
|
Gtk::Menu* _route_ops_menu;
|
||||||
|
|
||||||
|
bool _renaming;
|
||||||
|
Gtk::EventBox _namebox;
|
||||||
|
Gtk::Entry _nameentry;
|
||||||
|
|
||||||
LevelMeterVBox* _level_meter;
|
LevelMeterVBox* _level_meter;
|
||||||
IOButton _input_button;
|
IOButton _input_button;
|
||||||
ArdourWidgets::ArdourButton _number_label;
|
ArdourWidgets::ArdourButton _number_label;
|
||||||
|
|
@ -129,7 +147,8 @@ private:
|
||||||
static bool _size_group_initialized;
|
static bool _size_group_initialized;
|
||||||
static Glib::RefPtr<Gtk::SizeGroup> _track_number_size_group;
|
static Glib::RefPtr<Gtk::SizeGroup> _track_number_size_group;
|
||||||
|
|
||||||
PBD::ScopedConnectionList _route_connections;
|
PBD::ScopedConnectionList _route_connections;
|
||||||
|
std::list<sigc::connection> _entry_connections;
|
||||||
|
|
||||||
struct RecInfo {
|
struct RecInfo {
|
||||||
RecInfo (samplepos_t s, samplepos_t e)
|
RecInfo (samplepos_t s, samplepos_t e)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue