Source List: Add channel-count as a separate column
This commit is contained in:
parent
80a7d32e07
commit
d98d3f25d8
@ -96,7 +96,7 @@ EditorSources::EditorSources (Editor* e)
|
|||||||
_model->set_sort_column (0, SORT_ASCENDING);
|
_model->set_sort_column (0, SORT_ASCENDING);
|
||||||
|
|
||||||
/* column widths */
|
/* column widths */
|
||||||
int bbt_width, date_width, height;
|
int bbt_width, date_width, chan_width, height;
|
||||||
|
|
||||||
Glib::RefPtr<Pango::Layout> layout = _display.create_pango_layout (X_("000|000|000"));
|
Glib::RefPtr<Pango::Layout> layout = _display.create_pango_layout (X_("000|000|000"));
|
||||||
Gtkmm2ext::get_pixel_size (layout, bbt_width, height);
|
Gtkmm2ext::get_pixel_size (layout, bbt_width, height);
|
||||||
@ -104,31 +104,41 @@ EditorSources::EditorSources (Editor* e)
|
|||||||
Glib::RefPtr<Pango::Layout> layout2 = _display.create_pango_layout (X_("2018-10-14 12:12:30"));
|
Glib::RefPtr<Pango::Layout> layout2 = _display.create_pango_layout (X_("2018-10-14 12:12:30"));
|
||||||
Gtkmm2ext::get_pixel_size (layout2, date_width, height);
|
Gtkmm2ext::get_pixel_size (layout2, date_width, height);
|
||||||
|
|
||||||
|
Glib::RefPtr<Pango::Layout> layout3 = _display.create_pango_layout (X_("Chans "));
|
||||||
|
Gtkmm2ext::get_pixel_size (layout3, chan_width, height);
|
||||||
|
|
||||||
TreeViewColumn* col_name = manage (new TreeViewColumn ("", _columns.name));
|
TreeViewColumn* col_name = manage (new TreeViewColumn ("", _columns.name));
|
||||||
col_name->set_fixed_width (bbt_width*2);
|
col_name->set_fixed_width (bbt_width*2);
|
||||||
col_name->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
col_name->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
||||||
col_name->set_sort_column(0);
|
col_name->set_sort_column(0);
|
||||||
|
|
||||||
|
TreeViewColumn* col_chans = manage (new TreeViewColumn ("", _columns.channels));
|
||||||
|
col_chans->set_fixed_width (chan_width);
|
||||||
|
col_chans->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
||||||
|
col_chans->set_sort_column(1);
|
||||||
|
|
||||||
TreeViewColumn* col_tags = manage (new TreeViewColumn ("", _columns.tags));
|
TreeViewColumn* col_tags = manage (new TreeViewColumn ("", _columns.tags));
|
||||||
col_tags->set_fixed_width (bbt_width*2);
|
col_tags->set_fixed_width (bbt_width*2);
|
||||||
col_tags->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
col_tags->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
||||||
|
col_tags->set_sort_column(2);
|
||||||
|
|
||||||
TreeViewColumn* col_take_id = manage (new TreeViewColumn ("", _columns.take_id));
|
TreeViewColumn* col_take_id = manage (new TreeViewColumn ("", _columns.take_id));
|
||||||
col_take_id->set_fixed_width (date_width);
|
col_take_id->set_fixed_width (date_width);
|
||||||
col_take_id->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
col_take_id->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
||||||
col_take_id->set_sort_column(1);
|
col_take_id->set_sort_column(3);
|
||||||
|
|
||||||
TreeViewColumn* col_nat_pos = manage (new TreeViewColumn ("", _columns.natural_pos));
|
TreeViewColumn* col_nat_pos = manage (new TreeViewColumn ("", _columns.natural_pos));
|
||||||
col_nat_pos->set_fixed_width (bbt_width);
|
col_nat_pos->set_fixed_width (bbt_width);
|
||||||
col_nat_pos->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
col_nat_pos->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
||||||
col_nat_pos->set_sort_column(6);
|
col_nat_pos->set_sort_column(8);
|
||||||
|
|
||||||
TreeViewColumn* col_path = manage (new TreeViewColumn ("", _columns.path));
|
TreeViewColumn* col_path = manage (new TreeViewColumn ("", _columns.path));
|
||||||
col_path->set_fixed_width (bbt_width);
|
col_path->set_fixed_width (bbt_width);
|
||||||
col_path->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
col_path->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
||||||
col_path->set_sort_column(3);
|
col_path->set_sort_column(5);
|
||||||
|
|
||||||
_display.append_column (*col_name);
|
_display.append_column (*col_name);
|
||||||
|
_display.append_column (*col_chans);
|
||||||
_display.append_column (*col_tags);
|
_display.append_column (*col_tags);
|
||||||
_display.append_column (*col_take_id);
|
_display.append_column (*col_take_id);
|
||||||
_display.append_column (*col_nat_pos);
|
_display.append_column (*col_nat_pos);
|
||||||
@ -138,11 +148,12 @@ EditorSources::EditorSources (Editor* e)
|
|||||||
Gtk::Label* l;
|
Gtk::Label* l;
|
||||||
|
|
||||||
ColumnInfo ci[] = {
|
ColumnInfo ci[] = {
|
||||||
{ 0, _("Source"), _("Source name, with number of channels in []'s") },
|
{ 0, _("Name"), _("Region name") },
|
||||||
{ 1, _("Tags"), _("Tags") },
|
{ 1, _("Chans"), _("Channels") },
|
||||||
{ 2, _("Take ID"), _("Take ID") },
|
{ 2, _("Tags"), _("Tags") },
|
||||||
{ 3, _("Orig Pos"), _("Original Position of the file on timeline, when it was recorded") },
|
{ 3, _("Take ID"), _("Take ID") },
|
||||||
{ 4, _("Path"), _("Path (folder) of the file location") },
|
{ 4, _("Orig Pos"), _("Original Position of the file on timeline, when it was recorded") },
|
||||||
|
{ 5, _("Path"), _("Path (folder) of the file location") },
|
||||||
{ -1, 0, 0 }
|
{ -1, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -170,22 +181,22 @@ EditorSources::EditorSources (Editor* e)
|
|||||||
tv_col->add_attribute(renderer->property_foreground_gdk(), _columns.color_);
|
tv_col->add_attribute(renderer->property_foreground_gdk(), _columns.color_);
|
||||||
|
|
||||||
/* Tags cell: make editable */
|
/* Tags cell: make editable */
|
||||||
CellRendererText* region_tags_cell = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (1));
|
CellRendererText* region_tags_cell = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (2));
|
||||||
region_tags_cell->property_editable() = true;
|
region_tags_cell->property_editable() = true;
|
||||||
region_tags_cell->signal_edited().connect (sigc::mem_fun (*this, &EditorSources::tag_edit));
|
region_tags_cell->signal_edited().connect (sigc::mem_fun (*this, &EditorSources::tag_edit));
|
||||||
region_tags_cell->signal_editing_started().connect (sigc::mem_fun (*this, &EditorSources::tag_editing_started));
|
region_tags_cell->signal_editing_started().connect (sigc::mem_fun (*this, &EditorSources::tag_editing_started));
|
||||||
|
|
||||||
/* right-align the Natural Pos column */
|
/* right-align the Natural Pos column */
|
||||||
TreeViewColumn* nat_col = _display.get_column(3);
|
TreeViewColumn* nat_col = _display.get_column(4);
|
||||||
nat_col->set_alignment (ALIGN_RIGHT);
|
nat_col->set_alignment (ALIGN_RIGHT);
|
||||||
renderer = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (3));
|
renderer = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (4));
|
||||||
if (renderer) {
|
if (renderer) {
|
||||||
renderer->property_xalign() = ( 1.0 );
|
renderer->property_xalign() = ( 1.0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the PATH field should expand when the pane is opened wider */
|
/* the PATH field should expand when the pane is opened wider */
|
||||||
tv_col = _display.get_column(4);
|
tv_col = _display.get_column(4);
|
||||||
renderer = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (4));
|
renderer = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (5));
|
||||||
tv_col->add_attribute(renderer->property_text(), _columns.path);
|
tv_col->add_attribute(renderer->property_text(), _columns.path);
|
||||||
tv_col->set_expand (true);
|
tv_col->set_expand (true);
|
||||||
|
|
||||||
@ -357,14 +368,9 @@ EditorSources::populate_row (TreeModel::Row row, boost::shared_ptr<ARDOUR::Regio
|
|||||||
row[_columns.color_] = c;
|
row[_columns.color_] = c;
|
||||||
|
|
||||||
/* NAME */
|
/* NAME */
|
||||||
std::string str = region->name();
|
row[_columns.name] = region->name();
|
||||||
/* if a multichannel region, show the number of channels
|
|
||||||
* ToDo: make a sortable column for this?
|
row[_columns.channels] = region->n_channels();
|
||||||
*/
|
|
||||||
if ( region->n_channels() > 1 ) {
|
|
||||||
str += string_compose("[%1]", region->n_channels());
|
|
||||||
}
|
|
||||||
row[_columns.name] = str;
|
|
||||||
|
|
||||||
/* TAGS */
|
/* TAGS */
|
||||||
row[_columns.tags] = region->tags();
|
row[_columns.tags] = region->tags();
|
||||||
|
@ -61,6 +61,7 @@ private:
|
|||||||
struct Columns : public Gtk::TreeModel::ColumnRecord {
|
struct Columns : public Gtk::TreeModel::ColumnRecord {
|
||||||
Columns () {
|
Columns () {
|
||||||
add (name);
|
add (name);
|
||||||
|
add (channels);
|
||||||
add (tags);
|
add (tags);
|
||||||
add (take_id);
|
add (take_id);
|
||||||
add (natural_pos);
|
add (natural_pos);
|
||||||
@ -71,6 +72,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
Gtk::TreeModelColumn<std::string> name;
|
Gtk::TreeModelColumn<std::string> name;
|
||||||
|
Gtk::TreeModelColumn<int> channels;
|
||||||
Gtk::TreeModelColumn<std::string> tags;
|
Gtk::TreeModelColumn<std::string> tags;
|
||||||
Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
|
Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
|
||||||
Gtk::TreeModelColumn<Gdk::Color> color_;
|
Gtk::TreeModelColumn<Gdk::Color> color_;
|
||||||
|
Loading…
Reference in New Issue
Block a user