#include "ardour/audioregion.h"
#include "ardour/audiofilesource.h"
+#include "ardour/silentfilesource.h"
#include "ardour/region_factory.h"
#include "ardour/session.h"
-#include "ardour/session_playlists.h"
-#include "ardour/silentfilesource.h"
#include "ardour/profile.h"
#include "gtkmm2ext/choice.h"
#include "utils.h"
#include "editor_regions.h"
#include "editor_drag.h"
+#include "main_clock.h"
#include "i18n.h"
using namespace Editing;
using Gtkmm2ext::Keyboard;
+struct ColumnInfo {
+ int index;
+ const char* label;
+ const char* tooltip;
+};
+
EditorRegions::EditorRegions (Editor* e)
: EditorComponent (e)
, old_focus (0)
, expanded (false)
{
_display.set_size_request (100, -1);
- _display.set_name ("RegionListDisplay");
_display.set_rules_hint (true);
/* Try to prevent single mouse presses from initiating edits.
_display.set_model (_model);
- _display.append_column (_("Regions"), _columns.name);
- _display.append_column (_("Position"), _columns.position);
- _display.append_column (_("End"), _columns.end);
- _display.append_column (_("Length"), _columns.length);
- _display.append_column (_("Sync"), _columns.sync);
- _display.append_column (_("Fade In"), _columns.fadein);
- _display.append_column (_("Fade Out"), _columns.fadeout);
- _display.append_column (_("L"), _columns.locked);
- _display.append_column (_("G"), _columns.glued);
- _display.append_column (_("M"), _columns.muted);
- _display.append_column (_("O"), _columns.opaque);
- // _display.append_column (_("Used"), _columns.used);
- // _display.append_column (_("Path"), _columns.path);
+ _display.append_column ("", _columns.name);
+ _display.append_column ("", _columns.position);
+ _display.append_column ("", _columns.end);
+ _display.append_column ("", _columns.length);
+ _display.append_column ("", _columns.sync);
+ _display.append_column ("", _columns.fadein);
+ _display.append_column ("", _columns.fadeout);
+ _display.append_column ("", _columns.locked);
+ _display.append_column ("", _columns.glued);
+ _display.append_column ("", _columns.muted);
+ _display.append_column ("", _columns.opaque);
+
+ TreeViewColumn* col;
+ Gtk::Label* l;
+
+ ColumnInfo ci[] = {
+ { 0, _("Region"), _("Region name, with number of channels in []'s") },
+ { 1, _("Position"), _("Position of start of region") },
+ { 2, _("End"), _("Position of end of region") },
+ { 3, _("Length"), _("Length of the region") },
+ { 4, _("Sync"), _("Position of region sync point, relative to start of the region") },
+ { 5, _("Fade In"), _("Length of region fade-in (units: secondary clock), () if disabled") },
+ { 6, _("Fade Out"), _("Length of region fade-out (units: secondary clock), () if dsisabled") },
+ { 7, _("L"), _("Region position locked?") },
+ { 8, _("G"), _("Region position glued to Bars|Beats time?") },
+ { 9, _("M"), _("Region muted?") },
+ { 10, _("O"), _("Region opaque (blocks regions below it from being heard)?") },
+ { -1, 0, 0 }
+ };
+
+ for (int i = 0; ci[i].index >= 0; ++i) {
+ col = _display.get_column (ci[i].index);
+ l = manage (new Label (ci[i].label));
+ ARDOUR_UI::instance()->set_tip (*l, ci[i].tooltip);
+ col->set_widget (*l);
+ l->show ();
+
+ if (ci[i].index > 6) {
+ col->set_expand (false);
+ col->set_alignment (ALIGN_CENTER);
+ }
+ }
+
_display.set_headers_visible (true);
- //_display.set_grid_lines (TREE_VIEW_GRID_LINES_BOTH);
+ _display.set_rules_hint ();
/* show path as the row tooltip */
- _display.set_tooltip_column (15); /* path */
+ _display.set_tooltip_column (14); /* path */
CellRendererText* region_name_cell = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (0));
region_name_cell->property_editable() = true;
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);
CellRendererToggle* locked_cell = dynamic_cast<CellRendererToggle*> (_display.get_column_cell_renderer (7));
locked_cell->property_activatable() = true;
//ARDOUR_UI::instance()->secondary_clock.mode_changed.connect (sigc::mem_fun(*this, &Editor::redisplay_regions));
ARDOUR_UI::instance()->secondary_clock->mode_changed.connect (sigc::mem_fun(*this, &EditorRegions::update_all_rows));
- ARDOUR::Region::RegionPropertyChanged.connect (region_property_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::region_changed, this, _1, _2), gui_context());
- ARDOUR::RegionFactory::CheckNewRegion.connect (check_new_region_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::add_region, this, _1), gui_context());
+ ARDOUR::Region::RegionPropertyChanged.connect (region_property_connection, MISSING_INVALIDATOR, boost::bind (&EditorRegions::region_changed, this, _1, _2), gui_context());
+ ARDOUR::RegionFactory::CheckNewRegion.connect (check_new_region_connection, MISSING_INVALIDATOR, boost::bind (&EditorRegions::add_region, this, _1), gui_context());
- e->EditorFreeze.connect (editor_freeze_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::freeze_tree_model, this), gui_context());
- e->EditorThaw.connect (editor_thaw_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::thaw_tree_model, this), gui_context());
+ e->EditorFreeze.connect (editor_freeze_connection, MISSING_INVALIDATOR, boost::bind (&EditorRegions::freeze_tree_model, this), gui_context());
+ e->EditorThaw.connect (editor_thaw_connection, MISSING_INVALIDATOR, boost::bind (&EditorRegions::thaw_tree_model, this), gui_context());
}
bool
}
bool
-EditorRegions::enter_notify (GdkEventCrossing* ev)
+EditorRegions::enter_notify (GdkEventCrossing*)
{
if (name_editable) {
return true;
TreeModel::iterator iter = _model->get_iter ("0");
TreeModel::Row parent;
- TreeModel::Row child;
if (!iter) {
parent = *(_model->append());
} else {
// find parent node, add as new child
TreeModel::iterator i;
- TreeModel::Children rows = _model->children();
boost::unordered_map<string, Gtk::TreeModel::RowReference>::iterator it;
*/
row = *(_model->insert (subrows.end()));
- }
- else {
- row = *(_model->append());
+
+ } else {
+ row = *(_model->append());
}
row[_columns.property_toggles_visible] = true;
}
void
-EditorRegions::delete_unused_regions ()
+EditorRegions::remove_unused_regions ()
{
vector<string> choices;
string prompt;
our_interests.add (ARDOUR::Properties::opaque);
our_interests.add (ARDOUR::Properties::fade_in);
our_interests.add (ARDOUR::Properties::fade_out);
+ our_interests.add (ARDOUR::Properties::fade_in_active);
+ our_interests.add (ARDOUR::Properties::fade_out_active);
if (what_changed.contains (our_interests)) {
return;
}
}
-
- /* find the region in our model and update its row */
- TreeModel::Children rows = _model->children ();
- TreeModel::iterator i = rows.begin ();
-
}
if (what_changed.contains (ARDOUR::Properties::hidden)) {
for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); i != rows.end(); ++i) {
- if (iter = _model->get_iter (*i)) {
+ if ((iter = _model->get_iter (*i))) {
boost::shared_ptr<Region> region = (*iter)[_columns.region];
// they could have clicked on a row that is just a placeholder, like "Hidden"
}
void
-EditorRegions::format_position (framepos_t pos, char* buf, size_t bufsize)
+EditorRegions::format_position (framepos_t pos, char* buf, size_t bufsize, bool onoff)
{
Timecode::BBT_Time bbt;
Timecode::Time timecode;
switch (ARDOUR_UI::instance()->secondary_clock->mode ()) {
case AudioClock::BBT:
_session->tempo_map().bbt_time (pos, bbt);
- snprintf (buf, bufsize, "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks);
+ if (onoff) {
+ snprintf (buf, bufsize, "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks);
+ } else {
+ snprintf (buf, bufsize, "(%03d|%02d|%04d)" , bbt.bars, bbt.beats, bbt.ticks);
+ }
break;
case AudioClock::MinSec:
mins = (int) floor (left / (_session->frame_rate() * 60.0f));
left -= (framecnt_t) floor (mins * _session->frame_rate() * 60.0f);
secs = left / (float) _session->frame_rate();
- snprintf (buf, bufsize, "%02d:%02d:%06.3f", hrs, mins, secs);
+ if (onoff) {
+ snprintf (buf, bufsize, "%02d:%02d:%06.3f", hrs, mins, secs);
+ } else {
+ snprintf (buf, bufsize, "(%02d:%02d:%06.3f)", hrs, mins, secs);
+ }
break;
case AudioClock::Frames:
- snprintf (buf, bufsize, "%" PRId64, pos);
+ if (onoff) {
+ snprintf (buf, bufsize, "%" PRId64, pos);
+ } else {
+ snprintf (buf, bufsize, "(%" PRId64 ")", pos);
+ }
break;
case AudioClock::Timecode:
default:
_session->timecode_time (pos, timecode);
- snprintf (buf, bufsize, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
+ if (onoff) {
+ snprintf (buf, bufsize, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
+ } else {
+ snprintf (buf, bufsize, "(%02d:%02d:%02d:%02d)", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
+ }
break;
}
}
#endif
void
-EditorRegions::populate_row_used (boost::shared_ptr<Region> region, TreeModel::Row const& row, uint32_t used)
+EditorRegions::populate_row_used (boost::shared_ptr<Region>, TreeModel::Row const& row, uint32_t used)
{
char buf[8];
snprintf (buf, sizeof (buf), "%4d" , used);
if (used > 1) {
row[_columns.fadein] = _("Multiple");
} else {
-
- char buf[16];
- format_position (audioregion->fade_in()->back()->when, buf, sizeof (buf));
+ char buf[32];
+ format_position (audioregion->fade_in()->back()->when, buf, sizeof (buf), audioregion->fade_in_active());
row[_columns.fadein] = buf;
-
- if (audioregion->fade_in_active()) {
- row[_columns.fadein] = string_compose("%1%2%3", " ", buf, " ");
- } else {
- row[_columns.fadein] = string_compose("%1%2%3", "(", buf, ")");
- }
}
}
}
if (used > 1) {
row[_columns.fadeout] = _("Multiple");
} else {
- char buf[16];
- format_position (audioregion->fade_out()->back()->when, buf, sizeof (buf));
-
- if (audioregion->fade_out_active()) {
- row[_columns.fadeout] = string_compose("%1%2%3", " ", buf, " ");
- } else {
- row[_columns.fadeout] = string_compose("%1%2%3", "(", buf, ")");
- }
+ char buf[32];
+ format_position (audioregion->fade_out()->back()->when, buf, sizeof (buf), audioregion->fade_out_active());
+ row[_columns.fadeout] = buf;
}
}
}
}
RefPtr<Action>
-EditorRegions::delete_unused_regions_action () const
+EditorRegions::remove_unused_regions_action () const
{
return ActionManager::get_action (X_("RegionList"), X_("removeUnusedRegions"));
}