edit_items.push_back (SeparatorElem());
edit_items.push_back (MenuElem (_("Separate"), mem_fun(*this, &Editor::separate_region_from_selection)));
- edit_items.push_back (MenuElem (_("Convert to Region in Region List"), sigc::mem_fun(*this, &Editor::new_region_from_selection)));
+// edit_items.push_back (MenuElem (_("Convert to Region in Region List"), sigc::mem_fun(*this, &Editor::new_region_from_selection)));
edit_items.push_back (SeparatorElem());
edit_items.push_back (MenuElem (_("Select All in Range"), sigc::mem_fun(*this, &Editor::select_all_selectables_using_time_selection)));
edit_items.push_back (SeparatorElem());
edit_items.push_back (MenuElem (_("Consolidate Range"), sigc::bind (sigc::mem_fun(*this, &Editor::bounce_range_selection), true, false)));
edit_items.push_back (MenuElem (_("Consolidate Range with Processing"), sigc::bind (sigc::mem_fun(*this, &Editor::bounce_range_selection), true, true)));
- edit_items.push_back (MenuElem (_("Bounce Range to Region List"), sigc::bind (sigc::mem_fun(*this, &Editor::bounce_range_selection), false, false)));
- edit_items.push_back (MenuElem (_("Bounce Range to Region List with Processing"), sigc::bind (sigc::mem_fun(*this, &Editor::bounce_range_selection), false, true)));
+ edit_items.push_back (MenuElem (_("Bounce Range to Source List"), sigc::bind (sigc::mem_fun(*this, &Editor::bounce_range_selection), false, false)));
+ edit_items.push_back (MenuElem (_("Bounce Range to Source List with Processing"), sigc::bind (sigc::mem_fun(*this, &Editor::bounce_range_selection), false, true)));
edit_items.push_back (MenuElem (_("Export Range..."), sigc::mem_fun(*this, &Editor::export_selection)));
if (ARDOUR_UI::instance()->video_timeline->get_duration() > 0) {
edit_items.push_back (MenuElem (_("Export Video Range..."), sigc::bind (sigc::mem_fun(*(ARDOUR_UI::instance()), &ARDOUR_UI::export_video), true)));
return false;
}
+void
+Editor::cleanup_regions ()
+{
+ _regions->remove_unused_regions();
+}
+
+
void
Editor::prepare_for_cleanup ()
{
const char* tooltip;
};
+//#define SHOW_REGION_EXTRAS
+
EditorRegions::EditorRegions (Editor* e)
: EditorComponent (e)
, old_focus (0)
_display.append_column (*col_name);
_display.append_column (*col_tags);
_display.append_column (*col_start);
+ _display.append_column (*col_length);
_display.append_column (*col_locked);
_display.append_column (*col_glued);
_display.append_column (*col_muted);
_display.append_column (*col_opaque);
+
+#ifdef SHOW_REGION_EXTRAS
_display.append_column (*col_end);
- _display.append_column (*col_length);
- _display.append_column (*col_sync);
+ _display.append_column (*col_sync);
_display.append_column (*col_fadein);
_display.append_column (*col_fadeout);
+#endif
TreeViewColumn* col;
Gtk::Label* l;
{ 0, 0, ALIGN_LEFT, _("Region"), _("Region name, with number of channels in []'s") },
{ 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?") },
- { 5, -1, ALIGN_CENTER, S_("Mute|M"), _("Region muted?") },
- { 6, -1, ALIGN_CENTER, S_("Opaque|O"), _("Region opaque (blocks regions below it from being heard)?") },
- { 7, -1, ALIGN_RIGHT, _("End"), _("Position of end of region") },
- { 8, -1, ALIGN_RIGHT, _("Length"), _("Length of the region") },
+ { 3, -1, ALIGN_RIGHT, _("Length"), _("Length of the region") },
+ { 4, -1, ALIGN_CENTER, S_("Lock|L"), _("Region position locked?") },
+ { 5, -1, ALIGN_CENTER, S_("Gain|G"), _("Region position glued to Bars|Beats time?") },
+ { 6, -1, ALIGN_CENTER, S_("Mute|M"), _("Region muted?") },
+ { 7, -1, ALIGN_CENTER, S_("Opaque|O"), _("Region opaque (blocks regions below it from being heard)?") },
+#ifdef SHOW_REGION_EXTRAS
+ { 8, -1, ALIGN_RIGHT, _("End"), _("Position of end of region") },
{ 9, -1, ALIGN_RIGHT, _("Sync"), _("Position of region sync point, relative to start of the region") },
{ 10,-1, ALIGN_RIGHT, _("Fade In"), _("Length of region fade-in (units: secondary clock), () if disabled") },
{ 11,-1, ALIGN_RIGHT, _("Fade Out"), _("Length of region fade-out (units: secondary clock), () if disabled") },
+#endif
{ -1,-1, ALIGN_CENTER, 0, 0 }
};
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));
+ /* checkbox cells */
+ int check_start_col = 4;
+
+ CellRendererToggle* locked_cell = dynamic_cast<CellRendererToggle*> (_display.get_column_cell_renderer (check_start_col++));
locked_cell->property_activatable() = true;
locked_cell->signal_toggled().connect (sigc::mem_fun (*this, &EditorRegions::locked_changed));
- CellRendererToggle* glued_cell = dynamic_cast<CellRendererToggle*> (_display.get_column_cell_renderer (4));
+ CellRendererToggle* glued_cell = dynamic_cast<CellRendererToggle*> (_display.get_column_cell_renderer (check_start_col++));
glued_cell->property_activatable() = true;
glued_cell->signal_toggled().connect (sigc::mem_fun (*this, &EditorRegions::glued_changed));
- CellRendererToggle* muted_cell = dynamic_cast<CellRendererToggle*> (_display.get_column_cell_renderer (5));
+ CellRendererToggle* muted_cell = dynamic_cast<CellRendererToggle*> (_display.get_column_cell_renderer (check_start_col++));
muted_cell->property_activatable() = true;
muted_cell->signal_toggled().connect (sigc::mem_fun (*this, &EditorRegions::muted_changed));
- CellRendererToggle* opaque_cell = dynamic_cast<CellRendererToggle*> (_display.get_column_cell_renderer (6));
+ CellRendererToggle* opaque_cell = dynamic_cast<CellRendererToggle*> (_display.get_column_cell_renderer (check_start_col));
opaque_cell->property_activatable() = true;
opaque_cell->signal_toggled().connect (sigc::mem_fun (*this, &EditorRegions::opaque_changed));
void
EditorRegions::populate_row_end (boost::shared_ptr<Region> region, TreeModel::Row const &row)
{
+#ifndef SHOW_REGION_EXTRAS
+ return;
+#endif
+
if (region->last_sample() >= region->first_sample()) {
char buf[16];
format_position (region->last_sample(), buf, sizeof (buf));
void
EditorRegions::populate_row_sync (boost::shared_ptr<Region> region, TreeModel::Row const &row)
{
+#ifndef SHOW_REGION_EXTRAS
+ return;
+#endif
if (region->sync_position() == region->position()) {
row[_columns.sync] = _("Start");
} else if (region->sync_position() == (region->last_sample())) {
void
EditorRegions::populate_row_fade_in (boost::shared_ptr<Region> region, TreeModel::Row const &row, boost::shared_ptr<AudioRegion> audioregion)
{
+#ifndef SHOW_REGION_EXTRAS
+ return;
+#endif
if (!audioregion) {
row[_columns.fadein] = "";
} else {
void
EditorRegions::populate_row_fade_out (boost::shared_ptr<Region> region, TreeModel::Row const &row, boost::shared_ptr<AudioRegion> audioregion)
{
+#ifndef SHOW_REGION_EXTRAS
+ return;
+#endif
if (!audioregion) {
row[_columns.fadeout] = "";
} else {
void
EditorRegions::show_context_menu (int button, int time)
{
- if (_menu == 0) {
- _menu = dynamic_cast<Menu*> (ActionManager::get_widget ("/RegionListMenu"));
- }
-
- if (_display.get_selection()->count_selected_rows() > 0) {
- ActionManager::set_sensitive (ActionManager::region_list_selection_sensitive_actions, true);
- } else {
- ActionManager::set_sensitive (ActionManager::region_list_selection_sensitive_actions, false);
- }
-
- _menu->popup (button, time);
+ using namespace Gtk::Menu_Helpers;
+ Gtk::Menu* menu = dynamic_cast<Menu*> (ActionManager::get_widget (X_("/PopupRegionMenu")));
+ menu->popup (button, time);
}
bool
nat_col->set_alignment (ALIGN_RIGHT);
renderer = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (2));
if (renderer) {
- renderer->property_xalign() = ( ALIGN_RIGHT );
+ renderer->property_xalign() = ( 1.0 );
}
//the PATH field should expand when the pane is opened wider
void
EditorSources::selection_changed ()
{
-// _editor->_region_selection_change_updates_region_list = false;
if (_display.get_selection()->count_selected_rows() > 0) {
_editor->get_selection().clear_regions ();
}
-// _editor->_region_selection_change_updates_region_list = true;
}
void
}
+void
+EditorSources::remove_selected_sources ()
+{
+ vector<string> choices;
+ string prompt;
+
+ prompt = _("Do you really want to destroy the selected source files?"
+ "\nAll regions using the files will be deleted.");
+
+ choices.push_back (_("No, do nothing."));
+ choices.push_back (_("Only destroy the regions, not the sources. (may be undone)"));
+ choices.push_back (_("Yes, destroy them. (cannot be undone!"));
+
+ Choice prompter (_("Destroy selected Sources"), prompt, choices);
+
+ int opt = prompter.run ();
+
+ if ( opt >= 1) {
+ if (_display.get_selection()->count_selected_rows() > 0) {
+
+ TreeIter iter;
+ TreeView::Selection::ListHandle_Path rows = _display.get_selection()->get_selected_rows ();
+
+ _editor->get_selection().clear_regions ();
+
+ for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); i != rows.end(); ++i) {
+
+ if ((iter = _model->get_iter (*i))) {
+
+ boost::shared_ptr<ARDOUR::Source> source = (*iter)[_columns.source];
+ if (source) {
+
+ set<boost::shared_ptr<Region> > regions;
+ RegionFactory::get_regions_using_source ( source, regions );
+
+ for (set<boost::shared_ptr<Region> >::iterator region = regions.begin(); region != regions.end(); region++ ) {
+ _change_connection.block (true);
+ _editor->set_selected_regionview_from_region_list (*region, Selection::Add);
+ _change_connection.block (false);
+
+ }
+ }
+ }
+
+ }
+ }
+ _editor->remove_selected_regions();
+
+ if ( opt == 2 ) { //TODO: actually delete some sources?
+ }
+ }
+
+}
+
+
bool
EditorSources::key_press (GdkEventKey* ev)
{
+ switch (ev->keyval) {
+ case GDK_Delete:
+ case GDK_BackSpace:
+ /* remove_selected_sources(); */
+ return true; //for now, just "eat" this, so Delete doesn't get propogated into the canvas, based on Source selections
+ }
+
return false;
}