(Source List) Region Tags (gtk2 part)
This commit is contained in:
parent
6c052348b5
commit
c12a017728
|
@ -234,6 +234,7 @@
|
|||
<menuitem action='toggle-region-fade-out'/>
|
||||
</menu>
|
||||
<separator/>
|
||||
<menuitem action='tag-last-capture'/>
|
||||
<menuitem action='remove-last-capture'/>
|
||||
<separator/>
|
||||
<menu action="EditPointMenu">
|
||||
|
@ -293,6 +294,7 @@
|
|||
<menu name='RegionMenu' action='RegionMenu'>
|
||||
<menuitem action='insert-region-from-region-list'/>
|
||||
<menuitem action='play-selected-regions'/>
|
||||
<menuitem action='tag-selected-regions'/>
|
||||
<menuitem action='loop-region'/>
|
||||
<menuitem action='rename-region'/>
|
||||
<menuitem action='show-region-properties'/>
|
||||
|
@ -710,6 +712,7 @@
|
|||
|
||||
<popup name='PopupRegionMenu' action='PopupRegionMenu' accelerators='true'>
|
||||
<menuitem action='play-selected-regions'/>
|
||||
<menuitem action='tag-selected-regions'/>
|
||||
<menuitem action='loop-region'/>
|
||||
<menuitem action='rename-region'/>
|
||||
<menuitem action='show-region-properties'/>
|
||||
|
|
|
@ -1439,6 +1439,11 @@ private:
|
|||
void toggle_skip_playback ();
|
||||
|
||||
void remove_last_capture ();
|
||||
|
||||
void tag_last_capture ();
|
||||
void tag_selected_region ();
|
||||
void tag_regions (ARDOUR::RegionList);
|
||||
|
||||
void select_all_selectables_using_time_selection ();
|
||||
void select_all_selectables_using_loop();
|
||||
void select_all_selectables_using_punch();
|
||||
|
|
|
@ -330,6 +330,8 @@ Editor::register_actions ()
|
|||
|
||||
/* this is a duplicated action so that the main menu can use a different label */
|
||||
reg_sens (editor_actions, "main-menu-play-selected-regions", _("Play Selected Regions"), sigc::mem_fun (*this, &Editor::play_selected_region));
|
||||
reg_sens (editor_actions, "main-menu-tag-selected-regions", _("Tag Selected Regions"), sigc::mem_fun (*this, &Editor::tag_selected_region));
|
||||
|
||||
reg_sens (editor_actions, "play-from-edit-point", _("Play from Edit Point"), sigc::mem_fun(*this, &Editor::play_from_edit_point));
|
||||
reg_sens (editor_actions, "play-from-edit-point-and-return", _("Play from Edit Point and Return"), sigc::mem_fun(*this, &Editor::play_from_edit_point_and_return));
|
||||
|
||||
|
@ -422,6 +424,7 @@ Editor::register_actions ()
|
|||
|
||||
toggle_reg_sens (editor_actions, "toggle-follow-playhead", _("Follow Playhead"), (sigc::mem_fun(*this, &Editor::toggle_follow_playhead)));
|
||||
act = reg_sens (editor_actions, "remove-last-capture", _("Remove Last Capture"), (sigc::mem_fun(*this, &Editor::remove_last_capture)));
|
||||
act = reg_sens (editor_actions, "tag-last-capture", _("Tag Last Capture"), (sigc::mem_fun(*this, &Editor::tag_last_capture)));
|
||||
|
||||
ActionManager::register_toggle_action (editor_actions, "toggle-stationary-playhead", _("Stationary Playhead"), (mem_fun(*this, &Editor::toggle_stationary_playhead)));
|
||||
|
||||
|
@ -1512,6 +1515,7 @@ Editor::register_region_actions ()
|
|||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions), "show-region-properties", _("Properties..."), sigc::mem_fun (*this, &Editor::show_region_properties));
|
||||
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "play-selected-regions", _("Play selected Regions"), sigc::mem_fun(*this, &Editor::play_selected_region));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "tag-selected-regions", _("Tag selected Regions"), sigc::mem_fun(*this, &Editor::tag_selected_region));
|
||||
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions), "bounce-regions-processed", _("Bounce (with processing)"), (sigc::bind (sigc::mem_fun (*this, &Editor::bounce_region_selection), true)));
|
||||
register_region_action (_region_actions, RegionActionTarget (SelectedRegions), "bounce-regions-unprocessed", _("Bounce (without processing)"), (sigc::bind (sigc::mem_fun (*this, &Editor::bounce_region_selection), false)));
|
||||
|
|
|
@ -1169,7 +1169,7 @@ Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context,
|
|||
return false;
|
||||
}
|
||||
|
||||
printf("DRAGGING: track_canvas_drag_motion\n");
|
||||
printf("Paul: DRAGGING: track_canvas_drag_motion\n");
|
||||
|
||||
event.type = GDK_MOTION_NOTIFY;
|
||||
event.button.x = x;
|
||||
|
|
|
@ -5139,6 +5139,95 @@ Editor::remove_last_capture ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::tag_regions (RegionList regions)
|
||||
{
|
||||
ArdourDialog d (_("Tag Last Capture"), true, false);
|
||||
Entry entry;
|
||||
Label label (_("Tag:"));
|
||||
HBox hbox;
|
||||
|
||||
hbox.set_spacing (6);
|
||||
hbox.pack_start (label, false, false);
|
||||
hbox.pack_start (entry, true, true);
|
||||
|
||||
d.get_vbox()->set_border_width (12);
|
||||
d.get_vbox()->pack_start (hbox, false, false);
|
||||
|
||||
d.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||
d.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
|
||||
|
||||
d.set_size_request (300, -1);
|
||||
|
||||
entry.set_text (_("Good"));
|
||||
entry.select_region (0, -1);
|
||||
|
||||
entry.signal_activate().connect (sigc::bind (sigc::mem_fun (d, &Dialog::response), RESPONSE_OK));
|
||||
|
||||
d.show_all ();
|
||||
|
||||
entry.grab_focus();
|
||||
|
||||
int const ret = d.run();
|
||||
|
||||
d.hide ();
|
||||
|
||||
if (ret != RESPONSE_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string tagstr = entry.get_text();
|
||||
strip_whitespace_edges (tagstr);
|
||||
|
||||
if (!tagstr.empty()) {
|
||||
for (RegionList::iterator r = regions.begin(); r != regions.end(); r++) {
|
||||
(*r)->set_tags(tagstr);
|
||||
}
|
||||
|
||||
_regions->redisplay ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::tag_selected_region ()
|
||||
{
|
||||
std::list<boost::shared_ptr<Region> > rlist;
|
||||
|
||||
RegionSelection rs = get_regions_from_selection_and_entered ();
|
||||
for (RegionSelection::iterator r = rs.begin(); r != rs.end(); r++) {
|
||||
rlist.push_back((*r)->region());
|
||||
}
|
||||
|
||||
tag_regions(rlist);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::tag_last_capture ()
|
||||
{
|
||||
if (!_session) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::list<boost::shared_ptr<Region> > rlist;
|
||||
|
||||
std::list<boost::shared_ptr<Source> > srcs;
|
||||
_session->get_last_capture_sources (srcs);
|
||||
for (std::list<boost::shared_ptr<Source> >::iterator i = srcs.begin(); i != srcs.end(); ++i) {
|
||||
boost::shared_ptr<ARDOUR::Source> source = (*i);
|
||||
if (source) {
|
||||
|
||||
set<boost::shared_ptr<Region> > regions;
|
||||
RegionFactory::get_regions_using_source (source, regions);
|
||||
for (set<boost::shared_ptr<Region> >::iterator r = regions.begin(); r != regions.end(); r++) {
|
||||
rlist.push_back(*r);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
tag_regions(rlist);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::normalize_region ()
|
||||
{
|
||||
|
|
|
@ -79,6 +79,7 @@ EditorRegions::EditorRegions (Editor* e)
|
|||
: EditorComponent (e)
|
||||
, old_focus (0)
|
||||
, name_editable (0)
|
||||
, tags_editable (0)
|
||||
, _menu (0)
|
||||
, _no_redisplay (false)
|
||||
{
|
||||
|
@ -110,9 +111,9 @@ EditorRegions::EditorRegions (Editor* e)
|
|||
TreeViewColumn* col_name = manage (new TreeViewColumn ("", _columns.name));
|
||||
col_name->set_fixed_width (120);
|
||||
col_name->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
||||
TreeViewColumn* col_take = manage (new TreeViewColumn ("", _columns.take_id));
|
||||
col_take->set_fixed_width (date_width);
|
||||
col_take->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
||||
TreeViewColumn* col_tags = manage (new TreeViewColumn ("", _columns.tags));
|
||||
col_tags->set_fixed_width (date_width);
|
||||
col_tags->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
||||
TreeViewColumn* col_start = manage (new TreeViewColumn ("", _columns.start));
|
||||
col_start->set_fixed_width (bbt_width);
|
||||
col_start->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
||||
|
@ -145,7 +146,7 @@ EditorRegions::EditorRegions (Editor* e)
|
|||
col_opaque->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
||||
|
||||
_display.append_column (*col_name);
|
||||
_display.append_column (*col_take);
|
||||
_display.append_column (*col_tags);
|
||||
_display.append_column (*col_start);
|
||||
_display.append_column (*col_locked);
|
||||
_display.append_column (*col_glued);
|
||||
|
@ -162,7 +163,7 @@ EditorRegions::EditorRegions (Editor* e)
|
|||
|
||||
ColumnInfo ci[] = {
|
||||
{ 0, 0, ALIGN_LEFT, _("Region"), _("Region name, with number of channels in []'s") },
|
||||
{ 1, 1, ALIGN_LEFT, _("Take"), _("Take ID (or file creation time)") },
|
||||
{ 1, 1, ALIGN_LEFT, _("Tags"), _("Tags") },
|
||||
{ 2, 15, ALIGN_RIGHT, _("Start"), _("Position of start of region") },
|
||||
{ 3, -1, ALIGN_CENTER, S_("Lock|L"), _("Region position locked?") },
|
||||
{ 4, -1, ALIGN_CENTER, S_("Gain|G"), _("Region position glued to Bars|Beats time?") },
|
||||
|
@ -212,18 +213,25 @@ EditorRegions::EditorRegions (Editor* e)
|
|||
}
|
||||
_display.get_selection()->set_select_function (sigc::mem_fun (*this, &EditorRegions::selection_filter));
|
||||
|
||||
//Region Name: editable; and color turns red if source is missing.
|
||||
//Name cell: make editable
|
||||
CellRendererText* region_name_cell = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (0));
|
||||
region_name_cell->property_editable() = true;
|
||||
region_name_cell->signal_edited().connect (sigc::mem_fun (*this, &EditorRegions::name_edit));
|
||||
region_name_cell->signal_editing_started().connect (sigc::mem_fun (*this, &EditorRegions::name_editing_started));
|
||||
|
||||
//Region Name: color turns red if source is missing.
|
||||
TreeViewColumn* tv_col = _display.get_column(0);
|
||||
CellRendererText* renderer = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (0));
|
||||
tv_col->add_attribute(renderer->property_text(), _columns.name);
|
||||
tv_col->add_attribute(renderer->property_foreground_gdk(), _columns.color_);
|
||||
tv_col->set_expand (true);
|
||||
|
||||
//Tags cell: make editable
|
||||
CellRendererText* region_tags_cell = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (1));
|
||||
region_tags_cell->property_editable() = true;
|
||||
region_tags_cell->signal_edited().connect (sigc::mem_fun (*this, &EditorRegions::tag_edit));
|
||||
region_tags_cell->signal_editing_started().connect (sigc::mem_fun (*this, &EditorRegions::tag_editing_started));
|
||||
|
||||
CellRendererToggle* locked_cell = dynamic_cast<CellRendererToggle*> (_display.get_column_cell_renderer (3));
|
||||
locked_cell->property_activatable() = true;
|
||||
locked_cell->signal_toggled().connect (sigc::mem_fun (*this, &EditorRegions::locked_changed));
|
||||
|
@ -286,6 +294,7 @@ EditorRegions::focus_in (GdkEventFocus*)
|
|||
}
|
||||
|
||||
name_editable = 0;
|
||||
tags_editable = 0;
|
||||
|
||||
/* try to do nothing on focus in (doesn't work, hence selection_count nonsense) */
|
||||
return true;
|
||||
|
@ -300,6 +309,7 @@ EditorRegions::focus_out (GdkEventFocus*)
|
|||
}
|
||||
|
||||
name_editable = 0;
|
||||
tags_editable = 0;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -307,7 +317,7 @@ EditorRegions::focus_out (GdkEventFocus*)
|
|||
bool
|
||||
EditorRegions::enter_notify (GdkEventCrossing*)
|
||||
{
|
||||
if (name_editable) {
|
||||
if (name_editable || tags_editable) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -639,15 +649,17 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co
|
|||
_editor->mark_region_boundary_cache_dirty();
|
||||
}
|
||||
|
||||
Gdk::Color c;
|
||||
bool missing_source = boost::dynamic_pointer_cast<SilentFileSource>(region->source()) != NULL;
|
||||
if (missing_source) {
|
||||
set_color_from_rgba (c, UIConfiguration::instance().color ("region list missing source"));
|
||||
} else {
|
||||
set_color_from_rgba (c, UIConfiguration::instance().color ("region list whole file"));
|
||||
{
|
||||
Gdk::Color c;
|
||||
bool missing_source = boost::dynamic_pointer_cast<SilentFileSource>(region->source()) != NULL;
|
||||
if (missing_source) {
|
||||
set_color_from_rgba (c, UIConfiguration::instance().color ("region list missing source"));
|
||||
} else {
|
||||
set_color_from_rgba (c, UIConfiguration::instance().color ("region list whole file"));
|
||||
}
|
||||
row[_columns.color_] = c;
|
||||
}
|
||||
row[_columns.color_] = c;
|
||||
|
||||
|
||||
boost::shared_ptr<AudioRegion> audioregion = boost::dynamic_pointer_cast<AudioRegion>(region);
|
||||
|
||||
PropertyChange c;
|
||||
|
@ -684,7 +696,7 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co
|
|||
if (all) {
|
||||
populate_row_source (region, row);
|
||||
}
|
||||
if (all || what_changed.contains (Properties::name)) {
|
||||
if (all || what_changed.contains (Properties::name) || what_changed.contains (Properties::tags)) {
|
||||
populate_row_name (region, row);
|
||||
}
|
||||
}
|
||||
|
@ -832,6 +844,8 @@ EditorRegions::populate_row_name (boost::shared_ptr<Region> region, TreeModel::R
|
|||
} else {
|
||||
row[_columns.name] = Gtkmm2ext::markup_escape_text (region->name());
|
||||
}
|
||||
|
||||
row[_columns.tags] = region->tags();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -842,8 +856,6 @@ EditorRegions::populate_row_source (boost::shared_ptr<Region> region, TreeModel:
|
|||
} else {
|
||||
row[_columns.path] = Gtkmm2ext::markup_escape_text (region->source()->name());
|
||||
}
|
||||
|
||||
row[_columns.take_id] = region->source()->take_id(); //TODO: what if there is no take-id? anything else we can use?
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -876,6 +888,11 @@ EditorRegions::key_press (GdkEventKey* ev)
|
|||
name_editable = 0;
|
||||
}
|
||||
|
||||
if (tags_editable) {
|
||||
tags_editable->editing_done ();
|
||||
tags_editable = 0;
|
||||
}
|
||||
|
||||
col = _display.get_column (0); // select&focus on name column
|
||||
|
||||
if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
|
||||
|
@ -1043,17 +1060,53 @@ EditorRegions::name_edit (const std::string& path, const std::string& new_text)
|
|||
(*row_iter)[_columns.name] = new_text;
|
||||
}
|
||||
|
||||
/* now mapover everything */
|
||||
|
||||
if (region) {
|
||||
vector<RegionView*> equivalents;
|
||||
_editor->get_regions_corresponding_to (region, equivalents, false);
|
||||
|
||||
for (vector<RegionView*>::iterator i = equivalents.begin(); i != equivalents.end(); ++i) {
|
||||
if (new_text != (*i)->region()->name()) {
|
||||
(*i)->region()->set_name (new_text);
|
||||
region->set_name (new_text);
|
||||
|
||||
populate_row_name (region, (*row_iter));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
EditorRegions::tag_editing_started (CellEditable* ce, const Glib::ustring& path)
|
||||
{
|
||||
tags_editable = ce;
|
||||
|
||||
/* give it a special name */
|
||||
|
||||
Gtk::Entry *e = dynamic_cast<Gtk::Entry*> (ce);
|
||||
|
||||
if (e) {
|
||||
e->set_name (X_("RegionTagEditorEntry"));
|
||||
|
||||
TreeIter iter;
|
||||
if ((iter = _model->get_iter (path))) {
|
||||
boost::shared_ptr<Region> region = (*iter)[_columns.region];
|
||||
|
||||
if(region) {
|
||||
e->set_text(region->tags());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EditorRegions::tag_edit (const std::string& path, const std::string& new_text)
|
||||
{
|
||||
tags_editable = 0;
|
||||
|
||||
boost::shared_ptr<Region> region;
|
||||
TreeIter row_iter;
|
||||
|
||||
if ((row_iter = _model->get_iter (path))) {
|
||||
region = (*row_iter)[_columns.region];
|
||||
(*row_iter)[_columns.tags] = new_text;
|
||||
}
|
||||
|
||||
if (region) {
|
||||
region->set_tags (new_text);
|
||||
|
||||
populate_row_name (region, (*row_iter));
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ private:
|
|||
struct Columns : public Gtk::TreeModel::ColumnRecord {
|
||||
Columns () {
|
||||
add (name);
|
||||
add (take_id);
|
||||
add (tags);
|
||||
add (start);
|
||||
add (end);
|
||||
add (length);
|
||||
|
@ -94,7 +94,7 @@ private:
|
|||
}
|
||||
|
||||
Gtk::TreeModelColumn<std::string> name;
|
||||
Gtk::TreeModelColumn<std::string> take_id;
|
||||
Gtk::TreeModelColumn<std::string> tags;
|
||||
Gtk::TreeModelColumn<samplepos_t> position;
|
||||
Gtk::TreeModelColumn<std::string> start;
|
||||
Gtk::TreeModelColumn<std::string> end;
|
||||
|
@ -125,10 +125,17 @@ private:
|
|||
bool selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
|
||||
|
||||
Gtk::Widget* old_focus;
|
||||
|
||||
Gtk::CellEditable* name_editable;
|
||||
void name_editing_started (Gtk::CellEditable*, const Glib::ustring&);
|
||||
|
||||
void name_edit (const std::string&, const std::string&);
|
||||
|
||||
|
||||
Gtk::CellEditable* tags_editable;
|
||||
void tag_editing_started (Gtk::CellEditable*, const Glib::ustring&);
|
||||
void tag_edit (const std::string&, const std::string&);
|
||||
|
||||
|
||||
void locked_changed (std::string const &);
|
||||
void glued_changed (std::string const &);
|
||||
void muted_changed (std::string const &);
|
||||
|
|
Loading…
Reference in New Issue