2 * Copyright (C) 2018-2019 Ben Loftis <ben@harrisonconsoles.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #include "pbd/basename.h"
26 #include "pbd/enumwriter.h"
27 #include "pbd/file_utils.h"
29 #include "ardour/audioregion.h"
30 #include "ardour/source.h"
31 #include "ardour/audiofilesource.h"
32 #include "ardour/silentfilesource.h"
33 #include "ardour/smf_source.h"
34 #include "ardour/region_factory.h"
35 #include "ardour/session.h"
36 #include "ardour/session_directory.h"
37 #include "ardour/profile.h"
39 #include "gtkmm2ext/treeutils.h"
40 #include "gtkmm2ext/utils.h"
42 #include "widgets/choice.h"
43 #include "widgets/tooltips.h"
45 #include "audio_clock.h"
46 #include "context_menu_helper.h"
49 #include "editing_convert.h"
51 #include "ardour_ui.h"
52 #include "gui_thread.h"
54 #include "region_view.h"
56 #include "editor_drag.h"
57 #include "main_clock.h"
58 #include "ui_config.h"
62 #include "editor_sources.h"
65 using namespace ARDOUR;
66 using namespace ArdourWidgets;
67 using namespace ARDOUR_UI_UTILS;
71 using namespace Editing;
72 using Gtkmm2ext::Keyboard;
80 EditorSources::EditorSources (Editor* e)
86 , _no_redisplay (false)
88 _display.set_size_request (100, -1);
89 _display.set_rules_hint (true);
90 _display.set_name ("SourcesList");
91 _display.set_fixed_height_mode (true);
93 /* Try to prevent single mouse presses from initiating edits.
94 This relies on a hack in gtktreeview.c:gtk_treeview_button_press()
96 _display.set_data ("mouse-edits-require-mod1", (gpointer) 0x1);
98 _model = TreeStore::create (_columns);
99 _model->set_sort_column (0, SORT_ASCENDING);
102 int bbt_width, date_width, height;
104 Glib::RefPtr<Pango::Layout> layout = _display.create_pango_layout (X_("000|000|000"));
105 Gtkmm2ext::get_pixel_size (layout, bbt_width, height);
107 Glib::RefPtr<Pango::Layout> layout2 = _display.create_pango_layout (X_("2018-10-14 12:12:30"));
108 Gtkmm2ext::get_pixel_size (layout2, date_width, height);
110 TreeViewColumn* col_name = manage (new TreeViewColumn ("", _columns.name));
111 col_name->set_fixed_width (bbt_width*2);
112 col_name->set_sizing (TREE_VIEW_COLUMN_FIXED);
113 col_name->set_sort_column(0);
115 TreeViewColumn* col_tags = manage (new TreeViewColumn ("", _columns.tags));
116 col_tags->set_fixed_width (bbt_width*2);
117 col_tags->set_sizing (TREE_VIEW_COLUMN_FIXED);
119 TreeViewColumn* col_take_id = manage (new TreeViewColumn ("", _columns.take_id));
120 col_take_id->set_fixed_width (date_width);
121 col_take_id->set_sizing (TREE_VIEW_COLUMN_FIXED);
122 col_take_id->set_sort_column(1);
124 TreeViewColumn* col_nat_pos = manage (new TreeViewColumn ("", _columns.natural_pos));
125 col_nat_pos->set_fixed_width (bbt_width);
126 col_nat_pos->set_sizing (TREE_VIEW_COLUMN_FIXED);
127 col_nat_pos->set_sort_column(6);
129 TreeViewColumn* col_path = manage (new TreeViewColumn ("", _columns.path));
130 col_path->set_fixed_width (bbt_width);
131 col_path->set_sizing (TREE_VIEW_COLUMN_FIXED);
132 col_path->set_sort_column(3);
134 _display.append_column (*col_name);
135 _display.append_column (*col_tags);
136 _display.append_column (*col_take_id);
137 _display.append_column (*col_nat_pos);
138 _display.append_column (*col_path);
144 { 0, _("Source"), _("Source name, with number of channels in []'s") },
145 { 1, _("Tags"), _("Tags") },
146 { 2, _("Take ID"), _("Take ID") },
147 { 3, _("Orig Pos"), _("Original Position of the file on timeline, when it was recorded") },
148 { 4, _("Path"), _("Path (folder) of the file locationlosition of end of region") },
152 for (int i = 0; ci[i].index >= 0; ++i) {
153 col = _display.get_column (ci[i].index);
154 l = manage (new Label (ci[i].label));
155 set_tooltip (*l, ci[i].tooltip);
156 col->set_widget (*l);
159 _display.set_model (_model);
161 _display.set_headers_visible (true);
162 _display.set_rules_hint ();
164 //set the color of the name field
165 TreeViewColumn* tv_col = _display.get_column(0);
166 CellRendererText* renderer = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (0));
167 tv_col->add_attribute(renderer->property_text(), _columns.name);
168 tv_col->add_attribute(renderer->property_foreground_gdk(), _columns.color_);
170 //Tags cell: make editable
171 CellRendererText* region_tags_cell = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (1));
172 region_tags_cell->property_editable() = true;
173 region_tags_cell->signal_edited().connect (sigc::mem_fun (*this, &EditorSources::tag_edit));
174 region_tags_cell->signal_editing_started().connect (sigc::mem_fun (*this, &EditorSources::tag_editing_started));
176 //right-align the Natural Pos column
177 TreeViewColumn* nat_col = _display.get_column(3);
178 nat_col->set_alignment (ALIGN_RIGHT);
179 renderer = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (3));
181 renderer->property_xalign() = ( 1.0 );
184 //the PATH field should expand when the pane is opened wider
185 tv_col = _display.get_column(4);
186 renderer = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (4));
187 tv_col->add_attribute(renderer->property_text(), _columns.path);
188 tv_col->set_expand (true);
190 _display.get_selection()->set_mode (SELECTION_MULTIPLE);
191 _display.add_object_drag (_columns.region.index(), "regions");
192 _display.set_drag_column (_columns.name.index());
194 /* setup DnD handling */
196 list<TargetEntry> source_list_target_table;
198 source_list_target_table.push_back (TargetEntry ("text/plain"));
199 source_list_target_table.push_back (TargetEntry ("text/uri-list"));
200 source_list_target_table.push_back (TargetEntry ("application/x-rootwin-drop"));
202 _display.add_drop_targets (source_list_target_table);
203 _display.signal_drag_data_received().connect (sigc::mem_fun(*this, &EditorSources::drag_data_received));
205 _scroller.add (_display);
206 _scroller.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC);
208 _display.signal_button_press_event().connect (sigc::mem_fun(*this, &EditorSources::button_press), false);
209 _change_connection = _display.get_selection()->signal_changed().connect (sigc::mem_fun(*this, &EditorSources::selection_changed));
211 _scroller.signal_key_press_event().connect (sigc::mem_fun(*this, &EditorSources::key_press), false);
212 _scroller.signal_focus_in_event().connect (sigc::mem_fun (*this, &EditorSources::focus_in), false);
213 _scroller.signal_focus_out_event().connect (sigc::mem_fun (*this, &EditorSources::focus_out));
215 _display.signal_enter_notify_event().connect (sigc::mem_fun (*this, &EditorSources::enter_notify), false);
216 _display.signal_leave_notify_event().connect (sigc::mem_fun (*this, &EditorSources::leave_notify), false);
218 ARDOUR_UI::instance()->primary_clock->mode_changed.connect (sigc::mem_fun(*this, &EditorSources::clock_format_changed));
220 e->EditorFreeze.connect (editor_freeze_connection, MISSING_INVALIDATOR, boost::bind (&EditorSources::freeze_tree_model, this), gui_context());
221 e->EditorThaw.connect (editor_thaw_connection, MISSING_INVALIDATOR, boost::bind (&EditorSources::thaw_tree_model, this), gui_context());
225 EditorSources::focus_in (GdkEventFocus*)
227 Window* win = dynamic_cast<Window*> (_scroller.get_toplevel ());
230 old_focus = win->get_focus ();
237 /* try to do nothing on focus in (doesn't work, hence selection_count nonsense) */
242 EditorSources::focus_out (GdkEventFocus*)
245 old_focus->grab_focus ();
255 EditorSources::enter_notify (GdkEventCrossing*)
261 Keyboard::magic_widget_grab_focus ();
266 EditorSources::leave_notify (GdkEventCrossing*)
269 old_focus->grab_focus ();
273 Keyboard::magic_widget_drop_focus ();
278 EditorSources::set_session (ARDOUR::Session* s)
280 SessionHandlePtr::set_session (s);
284 /* Currently, none of the displayed properties are mutable, so there is no reason to register for changes
285 * ARDOUR::Region::RegionPropertyChanged.connect (source_property_connection, MISSING_INVALIDATOR, boost::bind (&EditorSources::source_changed, this, _1, _2), gui_context());
288 ARDOUR::RegionFactory::CheckNewRegion.connect (add_source_connection, MISSING_INVALIDATOR, boost::bind (&EditorSources::add_source, this, _1), gui_context());
290 s->SourceRemoved.connect (remove_source_connection, MISSING_INVALIDATOR, boost::bind (&EditorSources::remove_weak_source, this, _1), gui_context());
300 EditorSources::remove_weak_source (boost::weak_ptr<ARDOUR::Source> src)
302 boost::shared_ptr<ARDOUR::Source> source = src.lock();
304 remove_source (source);
309 EditorSources::remove_source (boost::shared_ptr<ARDOUR::Source> source)
311 TreeModel::iterator i;
312 TreeModel::Children rows = _model->children();
313 for (i = rows.begin(); i != rows.end(); ++i) {
314 boost::shared_ptr<ARDOUR::Region> rr = (*i)[_columns.region];
315 if (rr->source() == source) {
323 EditorSources::populate_row (TreeModel::Row row, boost::shared_ptr<ARDOUR::Region> region)
325 ENSURE_GUI_THREAD (*this, &ARDOUR_UI::record_state_changed, row, region);
331 boost::shared_ptr<ARDOUR::Source> source = region->source(); //ToDo: is it OK to use only the first source?
333 //COLOR (for missing files)
335 bool missing_source = boost::dynamic_pointer_cast<SilentFileSource>(source) != NULL;
336 if (missing_source) {
337 set_color_from_rgba (c, UIConfiguration::instance().color ("region list missing source"));
339 set_color_from_rgba (c, UIConfiguration::instance().color ("region list whole file"));
341 row[_columns.color_] = c;
344 std::string str = region->name();
345 //if a multichannel region, show the number of channels ToDo: make a sortable column for this?
346 if ( region->n_channels() > 1 ) {
347 str += string_compose("[%1]", region->n_channels());
349 row[_columns.name] = str;
352 row[_columns.tags] = region->tags();
354 row[_columns.region] = region;
355 row[_columns.take_id] = source->take_id();
358 string pathstr = source->name();
359 if (missing_source) {
360 pathstr = _("(MISSING) ") + Gtkmm2ext::markup_escape_text (source->name());
364 boost::shared_ptr<FileSource> fs = boost::dynamic_pointer_cast<FileSource>(source);
366 pathstr = Gtkmm2ext::markup_escape_text (source->name()); //someday: sequence region(?)
370 boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource>(source);
372 const string audio_directory = _session->session_directory().sound_path();
373 if ( !PBD::path_is_within(audio_directory, fs->path())) {
374 pathstr = Gtkmm2ext::markup_escape_text (fs->path());
379 boost::shared_ptr<SMFSource> mfs = boost::dynamic_pointer_cast<SMFSource>(source);
381 const string midi_directory = _session->session_directory().midi_path();
382 if ( !PBD::path_is_within(midi_directory, fs->path())) {
383 pathstr = Gtkmm2ext::markup_escape_text (fs->path());
390 row[_columns.path] = pathstr;
392 //Natural Position (samples, an invisible column for sorting)
393 row[_columns.natural_s] = source->natural_position();
395 //Natural Position (text representation)
396 if (source->have_natural_position()) {
398 format_position (source->natural_position(), buf, sizeof (buf));
399 row[_columns.natural_pos] = buf;
401 row[_columns.natural_pos] = X_("--");
406 EditorSources::redisplay ()
408 if (_no_redisplay || !_session) {
412 _display.set_model (Glib::RefPtr<Gtk::TreeStore>(0));
414 _model->set_sort_column (-2, SORT_ASCENDING); //Disable sorting to gain performance
416 //Ask the region factory to fill our list of whole-file regions
417 RegionFactory::foreach_region (sigc::mem_fun (*this, &EditorSources::add_source));
419 _model->set_sort_column (0, SORT_ASCENDING); // re-enable sorting
420 _display.set_model (_model);
424 EditorSources::add_source (boost::shared_ptr<ARDOUR::Region> region)
426 if (!region || !_session ) {
430 //by definition, the Source List only shows whole-file regions
431 //this roughly equates to Source objects, but preserves the stereo-ness (or multichannel-ness) of a stereo source file.
432 if ( !region->whole_file() ) {
436 //we only show files-on-disk. if there's some other kind of source, we ignore it (for now)
437 boost::shared_ptr<FileSource> fs = boost::dynamic_pointer_cast<FileSource> (region->source());
438 if (!fs || fs->empty()) {
442 TreeModel::Row row = *(_model->append());
443 populate_row (row, region);
447 EditorSources::source_changed (boost::shared_ptr<ARDOUR::Region> region)
449 /* Currently never reached .. we have no mutable properties shown in the list*/
451 TreeModel::iterator i;
452 TreeModel::Children rows = _model->children();
454 for (i = rows.begin(); i != rows.end(); ++i) {
455 boost::shared_ptr<ARDOUR::Region> rr = (*i)[_columns.region];
457 populate_row(*i, region);
464 EditorSources::selection_changed ()
467 if (_display.get_selection()->count_selected_rows() > 0) {
470 TreeView::Selection::ListHandle_Path rows = _display.get_selection()->get_selected_rows ();
472 _editor->get_selection().clear_regions ();
474 for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); i != rows.end(); ++i) {
476 if ((iter = _model->get_iter (*i))) {
478 //highlight any regions in the editor that use this region's source
479 boost::shared_ptr<ARDOUR::Region> region = (*iter)[_columns.region];
480 if (!region) continue;
482 boost::shared_ptr<ARDOUR::Source> source = region->source();
485 set<boost::shared_ptr<Region> > regions;
486 RegionFactory::get_regions_using_source ( source, regions );
488 for (set<boost::shared_ptr<Region> >::iterator region = regions.begin(); region != regions.end(); region++ ) {
489 _change_connection.block (true);
490 _editor->set_selected_regionview_from_region_list (*region, Selection::Add);
491 _change_connection.block (false);
498 _editor->get_selection().clear_regions ();
504 EditorSources::clock_format_changed ()
506 TreeModel::iterator i;
507 TreeModel::Children rows = _model->children();
508 for (i = rows.begin(); i != rows.end(); ++i) {
509 boost::shared_ptr<ARDOUR::Region> rr = (*i)[_columns.region];
510 populate_row(*i, rr);
515 EditorSources::format_position (samplepos_t pos, char* buf, size_t bufsize, bool onoff)
517 Timecode::BBT_Time bbt;
518 Timecode::Time timecode;
521 error << string_compose (_("EditorSources::format_position: negative timecode position: %1"), pos) << endmsg;
522 snprintf (buf, bufsize, "invalid");
526 switch (ARDOUR_UI::instance()->primary_clock->mode ()) {
527 case AudioClock::BBT:
528 bbt = _session->tempo_map().bbt_at_sample (pos);
530 snprintf (buf, bufsize, "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks);
532 snprintf (buf, bufsize, "(%03d|%02d|%04d)" , bbt.bars, bbt.beats, bbt.ticks);
536 case AudioClock::MinSec:
543 hrs = (int) floor (left / (_session->sample_rate() * 60.0f * 60.0f));
544 left -= (samplecnt_t) floor (hrs * _session->sample_rate() * 60.0f * 60.0f);
545 mins = (int) floor (left / (_session->sample_rate() * 60.0f));
546 left -= (samplecnt_t) floor (mins * _session->sample_rate() * 60.0f);
547 secs = left / (float) _session->sample_rate();
549 snprintf (buf, bufsize, "%02d:%02d:%06.3f", hrs, mins, secs);
551 snprintf (buf, bufsize, "(%02d:%02d:%06.3f)", hrs, mins, secs);
555 case AudioClock::Seconds:
557 snprintf (buf, bufsize, "%.1f", pos / (float)_session->sample_rate());
559 snprintf (buf, bufsize, "(%.1f)", pos / (float)_session->sample_rate());
563 case AudioClock::Samples:
565 snprintf (buf, bufsize, "%" PRId64, pos);
567 snprintf (buf, bufsize, "(%" PRId64 ")", pos);
571 case AudioClock::Timecode:
573 _session->timecode_time (pos, timecode);
575 snprintf (buf, bufsize, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
577 snprintf (buf, bufsize, "(%02d:%02d:%02d:%02d)", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
584 EditorSources::show_context_menu (int button, int time)
586 using namespace Gtk::Menu_Helpers;
587 Gtk::Menu* menu = ARDOUR_UI_UTILS::shared_popup_menu ();
588 MenuList& items = menu->items();
589 #ifdef RECOVER_REGIONS_IS_WORKING
590 items.push_back(MenuElem(_("Recover the selected Sources to their original Track & Position"),
591 sigc::mem_fun(*this, &EditorSources::recover_selected_sources)));
593 items.push_back(MenuElem(_("Remove the selected Sources"),
594 sigc::mem_fun(*this, &EditorSources::remove_selected_sources)));
595 menu->popup(1, time);
599 EditorSources::recover_selected_sources ()
601 ARDOUR::RegionList to_be_recovered;
603 if (_display.get_selection()->count_selected_rows() > 0) {
606 TreeView::Selection::ListHandle_Path rows = _display.get_selection()->get_selected_rows ();
607 for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); i != rows.end(); ++i) {
608 if ((iter = _model->get_iter (*i))) {
609 boost::shared_ptr<ARDOUR::Region> region = (*iter)[_columns.region];
611 to_be_recovered.push_back(region);
619 _editor->recover_regions(to_be_recovered); //this operation should be undo-able
624 EditorSources::remove_selected_sources ()
626 vector<string> choices;
629 prompt = _("Do you want to remove the selected Sources?"
630 "\nThis operation cannot be undone."
631 "\nThe source files will not actually be deleted until you execute Session->Cleanup.");
633 choices.push_back (_("No, do nothing."));
634 choices.push_back (_("Only remove the Regions that use these Sources."));
635 choices.push_back (_("Yes, remove the Regions and Sources (cannot be undone!"));
637 Choice prompter (_("Remove selected Sources"), prompt, choices);
639 int opt = prompter.run ();
643 std::list<boost::weak_ptr<ARDOUR::Source> > to_be_removed;
645 if (_display.get_selection()->count_selected_rows() > 0) {
648 TreeView::Selection::ListHandle_Path rows = _display.get_selection()->get_selected_rows ();
650 _editor->get_selection().clear_regions ();
652 for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin(); i != rows.end(); ++i) {
654 if ((iter = _model->get_iter (*i))) {
656 boost::shared_ptr<ARDOUR::Region> region = (*iter)[_columns.region];
658 if (!region) continue;
660 boost::shared_ptr<ARDOUR::Source> source = region->source();
662 set<boost::shared_ptr<Region> > regions;
663 RegionFactory::get_regions_using_source ( source, regions );
665 for (set<boost::shared_ptr<Region> >::iterator region = regions.begin(); region != regions.end(); region++ ) {
666 _change_connection.block (true);
667 _editor->set_selected_regionview_from_region_list (*region, Selection::Add);
668 _change_connection.block (false);
671 to_be_removed.push_back(source);
677 _editor->remove_selected_regions(); //this operation is undo-able
680 for (std::list<boost::weak_ptr<ARDOUR::Source> >::iterator i = to_be_removed.begin(); i != to_be_removed.end(); ++i) {
681 _session->remove_source(*i); //this operation is (currently) not undo-able
691 EditorSources::key_press (GdkEventKey* ev)
695 switch (ev->keyval) {
697 case GDK_ISO_Left_Tab:
700 tags_editable->editing_done ();
704 col = _display.get_column (1); // select&focus on tags column
706 if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
707 treeview_select_previous (_display, _model, col);
709 treeview_select_next (_display, _model, col);
716 remove_selected_sources();
727 EditorSources::button_press (GdkEventButton *ev)
729 boost::shared_ptr<ARDOUR::Region> region;
731 TreeModel::Path path;
732 TreeViewColumn* column;
736 if (_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
737 if ((iter = _model->get_iter (path))) {
738 region = (*iter)[_columns.region];
742 if (Keyboard::is_context_menu_event (ev)) {
743 show_context_menu (ev->button, ev->time);
751 EditorSources::tag_editing_started (CellEditable* ce, const Glib::ustring& path)
755 /* give it a special name */
757 Gtk::Entry *e = dynamic_cast<Gtk::Entry*> (ce);
760 e->set_name (X_("SourceTagEditorEntry"));
763 if ((iter = _model->get_iter (path))) {
764 boost::shared_ptr<Region> region = (*iter)[_columns.region];
767 e->set_text(region->tags());
774 EditorSources::tag_edit (const std::string& path, const std::string& new_text)
778 boost::shared_ptr<Region> region;
781 if ((row_iter = _model->get_iter (path))) {
782 region = (*row_iter)[_columns.region];
783 (*row_iter)[_columns.tags] = new_text;
787 region->set_tags (new_text);
789 _session->set_dirty(); //whole-file regions aren't in a playlist to catch property changes, so we need to explicitly set the session dirty
791 populate_row ((*row_iter), region);
797 EditorSources::selection_mapover (sigc::slot<void,boost::shared_ptr<Region> > sl)
804 EditorSources::drag_data_received (const RefPtr<Gdk::DragContext>& context,
806 const SelectionData& data,
807 guint info, guint time)
809 /* ToDo: allow dropping files/loops into the source list? */
812 /** @return Region that has been dragged out of the list, or 0 */
813 boost::shared_ptr<ARDOUR::Region>
814 EditorSources::get_dragged_region ()
816 list<boost::shared_ptr<ARDOUR::Region> > regions;
818 _display.get_object_drag_data (regions, ®ion);
820 if (regions.empty()) {
821 return boost::shared_ptr<ARDOUR::Region> ();
824 assert (regions.size() == 1);
825 return regions.front ();
829 EditorSources::clear ()
831 _display.set_model (Glib::RefPtr<Gtk::TreeStore> (0));
833 _display.set_model (_model);
836 boost::shared_ptr<ARDOUR::Region>
837 EditorSources::get_single_selection ()
839 Glib::RefPtr<TreeSelection> selected = _display.get_selection();
841 if (selected->count_selected_rows() != 1) {
842 return boost::shared_ptr<ARDOUR::Region> ();
845 TreeView::Selection::ListHandle_Path rows = selected->get_selected_rows ();
847 /* only one row selected, so rows.begin() is it */
849 TreeIter iter = _model->get_iter (*rows.begin());
852 return boost::shared_ptr<ARDOUR::Region> ();
855 return (*iter)[_columns.region];
859 EditorSources::freeze_tree_model ()
861 _display.set_model (Glib::RefPtr<Gtk::TreeStore>(0));
862 _model->set_sort_column (-2, SORT_ASCENDING); //Disable sorting to gain performance
866 EditorSources::thaw_tree_model (){
868 _model->set_sort_column (0, SORT_ASCENDING); // renabale sorting
869 _display.set_model (_model);
873 EditorSources::get_state () const
875 XMLNode* node = new XMLNode (X_("SourcesList"));
877 //TODO: save sort state?
883 EditorSources::set_state (const XMLNode & node)