2 Copyright (C) 2000 Paul Davis
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
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <gtkmm2ext/utils.h>
24 #include <gtkmm2ext/stop_signal.h>
26 #include "ardour/utils.h"
27 #include "ardour/configuration.h"
28 #include "ardour/session.h"
29 #include "pbd/memento_command.h"
31 #include "ardour_ui.h"
33 #include "location_ui.h"
36 #include "gui_thread.h"
41 using namespace ARDOUR;
44 using namespace Gtkmm2ext;
46 LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num)
47 : location(0), session(0),
48 item_table (1, 6, false),
49 start_clock (X_("locationstart"), true, X_("LocationEditRowClock"), true),
50 end_clock (X_("locationend"), true, X_("LocationEditRowClock"), true),
51 length_clock (X_("locationlength"), true, X_("LocationEditRowClock"), true, true),
52 cd_check_button (_("CD")),
53 hide_check_button (_("Hide")),
54 scms_check_button (_("SCMS")),
55 preemph_check_button (_("Pre-Emphasis"))
58 i_am_the_modifier = 0;
60 start_go_button.set_image (*manage (new Image (Stock::JUMP_TO, Gtk::ICON_SIZE_SMALL_TOOLBAR)));
61 end_go_button.set_image (*manage (new Image (Stock::JUMP_TO, Gtk::ICON_SIZE_SMALL_TOOLBAR)));
62 remove_button.set_image (*manage (new Image (Stock::REMOVE, Gtk::ICON_SIZE_SMALL_TOOLBAR)));
64 number_label.set_name ("LocationEditNumberLabel");
65 name_label.set_name ("LocationEditNameLabel");
66 name_entry.set_name ("LocationEditNameEntry");
67 start_go_button.set_name ("LocationEditGoButton");
68 end_go_button.set_name ("LocationEditGoButton");
69 cd_check_button.set_name ("LocationEditCdButton");
70 hide_check_button.set_name ("LocationEditHideButton");
71 remove_button.set_name ("LocationEditRemoveButton");
72 isrc_label.set_name ("LocationEditNumberLabel");
73 isrc_entry.set_name ("LocationEditNameEntry");
74 scms_check_button.set_name ("LocationEditCdButton");
75 preemph_check_button.set_name ("LocationEditCdButton");
76 performer_label.set_name ("LocationEditNumberLabel");
77 performer_entry.set_name ("LocationEditNameEntry");
78 composer_label.set_name ("LocationEditNumberLabel");
79 composer_entry.set_name ("LocationEditNameEntry");
81 isrc_label.set_text ("ISRC: ");
82 isrc_label.set_size_request (30, -1);
83 performer_label.set_text ("Performer: ");
84 performer_label.set_size_request (60, -1);
85 composer_label.set_text ("Composer: ");
86 composer_label.set_size_request (60, -1);
88 isrc_entry.set_size_request (112, -1);
89 isrc_entry.set_max_length(12);
90 isrc_entry.set_editable (true);
92 performer_entry.set_size_request (100, -1);
93 performer_entry.set_editable (true);
95 composer_entry.set_size_request (100, -1);
96 composer_entry.set_editable (true);
98 cd_track_details_hbox.pack_start (isrc_label, false, false);
99 cd_track_details_hbox.pack_start (isrc_entry, false, false);
100 cd_track_details_hbox.pack_start (scms_check_button, false, false);
101 cd_track_details_hbox.pack_start (preemph_check_button, false, false);
102 cd_track_details_hbox.pack_start (performer_label, false, false);
103 cd_track_details_hbox.pack_start (performer_entry, true, true);
104 cd_track_details_hbox.pack_start (composer_label, false, false);
105 cd_track_details_hbox.pack_start (composer_entry, true, true);
107 isrc_entry.signal_changed().connect (mem_fun(*this, &LocationEditRow::isrc_entry_changed));
108 performer_entry.signal_changed().connect (mem_fun(*this, &LocationEditRow::performer_entry_changed));
109 composer_entry.signal_changed().connect (mem_fun(*this, &LocationEditRow::composer_entry_changed));
110 scms_check_button.signal_toggled().connect(mem_fun(*this, &LocationEditRow::scms_toggled));
111 preemph_check_button.signal_toggled().connect(mem_fun(*this, &LocationEditRow::preemph_toggled));
115 // start_hbox.pack_start (start_go_button, false, false);
116 start_hbox.pack_start (start_clock, false, false);
118 /* this is always in this location, no matter what the location is */
120 item_table.attach (start_hbox, 1, 2, 0, 1, FILL, FILL, 4, 0);
122 start_go_button.signal_clicked().connect(bind (mem_fun (*this, &LocationEditRow::go_button_pressed), LocStart));
123 start_clock.ValueChanged.connect (bind (mem_fun (*this, &LocationEditRow::clock_changed), LocStart));
124 start_clock.ChangeAborted.connect (bind (mem_fun (*this, &LocationEditRow::change_aborted), LocStart));
126 // end_hbox.pack_start (end_go_button, false, false);
127 end_hbox.pack_start (end_clock, false, false);
129 end_go_button.signal_clicked().connect(bind (mem_fun (*this, &LocationEditRow::go_button_pressed), LocEnd));
130 end_clock.ValueChanged.connect (bind (mem_fun (*this, &LocationEditRow::clock_changed), LocEnd));
131 end_clock.ChangeAborted.connect (bind (mem_fun (*this, &LocationEditRow::change_aborted), LocEnd));
133 length_clock.ValueChanged.connect (bind ( mem_fun(*this, &LocationEditRow::clock_changed), LocLength));
134 length_clock.ChangeAborted.connect (bind (mem_fun (*this, &LocationEditRow::change_aborted), LocLength));
136 cd_check_button.signal_toggled().connect(mem_fun(*this, &LocationEditRow::cd_toggled));
137 hide_check_button.signal_toggled().connect(mem_fun(*this, &LocationEditRow::hide_toggled));
139 remove_button.signal_clicked().connect(mem_fun(*this, &LocationEditRow::remove_button_pressed));
141 pack_start(item_table, true, true);
147 LocationEditRow::~LocationEditRow()
150 start_changed_connection.disconnect();
151 end_changed_connection.disconnect();
152 name_changed_connection.disconnect();
153 changed_connection.disconnect();
154 flags_changed_connection.disconnect();
159 LocationEditRow::set_session (Session *sess)
163 if (!session) return;
165 start_clock.set_session (session);
166 end_clock.set_session (session);
167 length_clock.set_session (session);
172 LocationEditRow::set_number (int num)
177 number_label.set_text (string_compose ("%1", number));
182 LocationEditRow::set_location (Location *loc)
185 start_changed_connection.disconnect();
186 end_changed_connection.disconnect();
187 name_changed_connection.disconnect();
188 changed_connection.disconnect();
189 flags_changed_connection.disconnect();
194 if (!location) return;
196 if (!hide_check_button.get_parent()) {
197 item_table.attach (hide_check_button, 5, 6, 0, 1, FILL, Gtk::FILL, 4, 0);
199 hide_check_button.set_active (location->is_hidden());
201 if (location->is_auto_loop() || location-> is_auto_punch()) {
202 // use label instead of entry
204 name_label.set_text (location->name());
205 name_label.set_size_request (80, -1);
207 if (!name_label.get_parent()) {
208 item_table.attach (name_label, 0, 1, 0, 1, FILL, FILL, 4, 0);
215 name_entry.set_text (location->name());
216 name_entry.set_size_request (100, -1);
217 name_entry.set_editable (true);
218 name_entry.signal_changed().connect (mem_fun(*this, &LocationEditRow::name_entry_changed));
220 if (!name_entry.get_parent()) {
221 item_table.attach (name_entry, 0, 1, 0, 1, FILL | EXPAND, FILL, 4, 0);
225 if (!cd_check_button.get_parent()) {
226 item_table.attach (cd_check_button, 4, 5, 0, 1, FILL, FILL, 4, 0);
228 if (!remove_button.get_parent()) {
229 item_table.attach (remove_button, 6, 7, 0, 1, FILL, FILL, 4, 0);
232 if (location->is_end() || location->is_start()) {
233 remove_button.set_sensitive (false);
236 cd_check_button.set_active (location->is_cd_marker());
237 cd_check_button.show();
239 if (location->start() == session->current_start_frame()) {
240 cd_check_button.set_sensitive (false);
242 cd_check_button.set_sensitive (true);
245 hide_check_button.show();
248 start_clock.set (location->start(), true);
251 if (!location->is_mark()) {
252 if (!end_hbox.get_parent()) {
253 item_table.attach (end_hbox, 2, 3, 0, 1, FILL, FILL, 4, 0);
255 if (!length_clock.get_parent()) {
256 item_table.attach (length_clock, 3, 4, 0, 1, FILL, FILL, 4, 0);
259 end_clock.set (location->end(), true);
260 length_clock.set (location->length(), true);
262 end_go_button.show();
266 ARDOUR_UI::instance()->tooltips().set_tip (end_go_button, _("Jump to the end of this range"));
267 ARDOUR_UI::instance()->tooltips().set_tip (start_go_button, _("Jump to the start of this range"));
268 ARDOUR_UI::instance()->tooltips().set_tip (remove_button, _("Forget this range"));
269 ARDOUR_UI::instance()->tooltips().set_tip (start_clock, _("Start time"));
270 ARDOUR_UI::instance()->tooltips().set_tip (end_clock, _("End time"));
271 ARDOUR_UI::instance()->tooltips().set_tip (length_clock, _("Length"));
275 ARDOUR_UI::instance()->tooltips().set_tip (start_go_button, _("Jump to this marker"));
276 ARDOUR_UI::instance()->tooltips().set_tip (remove_button, _("Forget this marker"));
277 ARDOUR_UI::instance()->tooltips().set_tip (start_clock, _("Position"));
279 end_go_button.hide();
284 start_clock.set_sensitive (!location->locked());
285 end_clock.set_sensitive (!location->locked());
286 length_clock.set_sensitive (!location->locked());
288 start_changed_connection = location->start_changed.connect (mem_fun(*this, &LocationEditRow::start_changed));
289 end_changed_connection = location->end_changed.connect (mem_fun(*this, &LocationEditRow::end_changed));
290 name_changed_connection = location->name_changed.connect (mem_fun(*this, &LocationEditRow::name_changed));
291 changed_connection = location->changed.connect (mem_fun(*this, &LocationEditRow::location_changed));
292 flags_changed_connection = location->FlagsChanged.connect (mem_fun(*this, &LocationEditRow::flags_changed));
296 LocationEditRow::name_entry_changed ()
298 ENSURE_GUI_THREAD(mem_fun(*this, &LocationEditRow::name_entry_changed));
299 if (i_am_the_modifier || !location) return;
301 location->set_name (name_entry.get_text());
306 LocationEditRow::isrc_entry_changed ()
308 ENSURE_GUI_THREAD(mem_fun(*this, &LocationEditRow::isrc_entry_changed));
310 if (i_am_the_modifier || !location) return;
312 if (isrc_entry.get_text() != "" ) {
314 location->cd_info["isrc"] = isrc_entry.get_text();
317 location->cd_info.erase("isrc");
322 LocationEditRow::performer_entry_changed ()
324 ENSURE_GUI_THREAD(mem_fun(*this, &LocationEditRow::performer_entry_changed));
326 if (i_am_the_modifier || !location) return;
328 if (performer_entry.get_text() != "") {
329 location->cd_info["performer"] = performer_entry.get_text();
331 location->cd_info.erase("performer");
336 LocationEditRow::composer_entry_changed ()
338 ENSURE_GUI_THREAD(mem_fun(*this, &LocationEditRow::composer_entry_changed));
340 if (i_am_the_modifier || !location) return;
342 if (composer_entry.get_text() != "") {
343 location->cd_info["composer"] = composer_entry.get_text();
345 location->cd_info.erase("composer");
351 LocationEditRow::go_button_pressed (LocationPart part)
353 if (!location) return;
357 ARDOUR_UI::instance()->do_transport_locate (location->start());
360 ARDOUR_UI::instance()->do_transport_locate (location->end());
368 LocationEditRow::clock_changed (LocationPart part)
370 if (i_am_the_modifier || !location) return;
374 location->set_start (start_clock.current_time());
377 location->set_end (end_clock.current_time());
380 location->set_end (location->start() + length_clock.current_duration());
388 LocationEditRow::change_aborted (LocationPart /*part*/)
390 if (i_am_the_modifier || !location) return;
392 set_location(location);
396 LocationEditRow::cd_toggled ()
398 if (i_am_the_modifier || !location) {
402 //if (cd_check_button.get_active() == location->is_cd_marker()) {
406 if (cd_check_button.get_active()) {
407 if (location->start() <= session->current_start_frame()) {
408 error << _("You cannot put a CD marker at the start of the session") << endmsg;
409 cd_check_button.set_active (false);
414 location->set_cd (cd_check_button.get_active(), this);
416 if (location->is_cd_marker() && !(location->is_mark())) {
418 if (location->cd_info.find("isrc") != location->cd_info.end()) {
419 isrc_entry.set_text(location->cd_info["isrc"]);
421 if (location->cd_info.find("performer") != location->cd_info.end()) {
422 performer_entry.set_text(location->cd_info["performer"]);
424 if (location->cd_info.find("composer") != location->cd_info.end()) {
425 composer_entry.set_text(location->cd_info["composer"]);
427 if (location->cd_info.find("scms") != location->cd_info.end()) {
428 scms_check_button.set_active(true);
430 if (location->cd_info.find("preemph") != location->cd_info.end()) {
431 preemph_check_button.set_active(true);
434 if (!cd_track_details_hbox.get_parent()) {
435 item_table.attach (cd_track_details_hbox, 0, 7, 1, 2, FILL | EXPAND, FILL, 4, 0);
437 // item_table.resize(2, 7);
438 cd_track_details_hbox.show_all();
440 } else if (cd_track_details_hbox.get_parent()){
442 item_table.remove (cd_track_details_hbox);
443 // item_table.resize(1, 7);
444 redraw_ranges(); /* EMIT_SIGNAL */
449 LocationEditRow::hide_toggled ()
451 if (i_am_the_modifier || !location) return;
453 location->set_hidden (hide_check_button.get_active(), this);
457 LocationEditRow::remove_button_pressed ()
459 if (!location) return;
461 remove_requested(location); /* EMIT_SIGNAL */
467 LocationEditRow::scms_toggled ()
469 if (i_am_the_modifier || !location) return;
471 if (scms_check_button.get_active()) {
472 location->cd_info["scms"] = "on";
474 location->cd_info.erase("scms");
480 LocationEditRow::preemph_toggled ()
482 if (i_am_the_modifier || !location) return;
484 if (preemph_check_button.get_active()) {
485 location->cd_info["preemph"] = "on";
487 location->cd_info.erase("preemph");
492 LocationEditRow::end_changed (ARDOUR::Location *loc)
494 ENSURE_GUI_THREAD(bind (mem_fun(*this, &LocationEditRow::end_changed), loc));
496 if (!location) return;
498 // update end and length
501 end_clock.set (location->end());
502 length_clock.set (location->length());
508 LocationEditRow::start_changed (ARDOUR::Location *loc)
510 ENSURE_GUI_THREAD(bind (mem_fun(*this, &LocationEditRow::start_changed), loc));
512 if (!location) return;
514 // update end and length
517 start_clock.set (location->start());
519 if (location->start() == session->current_start_frame()) {
520 cd_check_button.set_sensitive (false);
522 cd_check_button.set_sensitive (true);
529 LocationEditRow::name_changed (ARDOUR::Location *loc)
531 ENSURE_GUI_THREAD(bind (mem_fun(*this, &LocationEditRow::name_changed), loc));
533 if (!location) return;
535 // update end and length
538 name_entry.set_text(location->name());
539 name_label.set_text(location->name());
546 LocationEditRow::location_changed (ARDOUR::Location *loc)
548 ENSURE_GUI_THREAD(bind (mem_fun(*this, &LocationEditRow::location_changed), loc));
550 if (!location) return;
554 start_clock.set (location->start());
555 end_clock.set (location->end());
556 length_clock.set (location->length());
558 start_clock.set_sensitive (!location->locked());
559 end_clock.set_sensitive (!location->locked());
560 length_clock.set_sensitive (!location->locked());
567 LocationEditRow::flags_changed (ARDOUR::Location *loc, void *src)
569 ENSURE_GUI_THREAD(bind (mem_fun(*this, &LocationEditRow::flags_changed), loc, src));
571 if (!location) return;
575 cd_check_button.set_active (location->is_cd_marker());
576 hide_check_button.set_active (location->is_hidden());
582 LocationEditRow::focus_name() {
583 name_entry.grab_focus();
587 LocationUI::LocationUI ()
589 , add_location_button (_("New Location"))
590 , add_range_button (_("New Range"))
592 i_am_the_modifier = 0;
594 location_vpacker.set_spacing (5);
596 add_location_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::ADD, Gtk::ICON_SIZE_BUTTON)));
597 add_range_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::ADD, Gtk::ICON_SIZE_BUTTON)));
599 location_vpacker.pack_start (loop_edit_row, false, false);
600 location_vpacker.pack_start (punch_edit_row, false, false);
602 location_rows.set_name("LocationLocRows");
603 location_rows_scroller.add (location_rows);
604 location_rows_scroller.set_name ("LocationLocRowsScroller");
605 location_rows_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
606 location_rows_scroller.set_size_request (-1, 130);
610 loc_frame_box.set_spacing (5);
611 loc_frame_box.set_border_width (5);
612 loc_frame_box.set_name("LocationFrameBox");
614 loc_frame_box.pack_start (location_rows_scroller, true, true);
616 add_location_button.set_name ("LocationAddLocationButton");
618 HBox* add_button_box = manage (new HBox);
620 // loc_frame_box.pack_start (add_location_button, false, false);
621 add_button_box->pack_start (add_location_button, true, true);
623 loc_frame.set_name ("LocationLocEditorFrame");
624 loc_frame.set_label (_("Markers (including CD index)"));
625 loc_frame.add (loc_frame_box);
626 loc_range_panes.pack1(loc_frame, true, false);
629 range_rows.set_name("LocationRangeRows");
630 range_rows_scroller.add (range_rows);
631 range_rows_scroller.set_name ("LocationRangeRowsScroller");
632 range_rows_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
633 range_rows_scroller.set_size_request (-1, 130);
635 range_frame_box.set_spacing (5);
636 range_frame_box.set_name("LocationFrameBox");
637 range_frame_box.set_border_width (5);
638 range_frame_box.pack_start (range_rows_scroller, true, true);
640 add_range_button.set_name ("LocationAddRangeButton");
641 //range_frame_box.pack_start (add_range_button, false, false);
643 add_button_box->pack_start (add_range_button, true, true);
645 range_frame.set_name ("LocationRangeEditorFrame");
646 range_frame.set_label (_("Ranges (including CD track ranges)"));
647 range_frame.add (range_frame_box);
648 loc_range_panes.pack2(range_frame, true, false);
649 location_vpacker.pack_start (loc_range_panes, true, true);
650 location_vpacker.pack_start (*add_button_box, false, false);
652 pack_start (location_vpacker, true, true);
654 add_location_button.signal_clicked().connect (mem_fun(*this, &LocationUI::add_new_location));
655 add_range_button.signal_clicked().connect (mem_fun(*this, &LocationUI::add_new_range));
660 LocationUI::~LocationUI()
665 LocationUI::do_location_remove (ARDOUR::Location *loc)
667 /* this is handled internally by Locations, but there's
668 no point saving state etc. when we know the marker
676 session->begin_reversible_command (_("remove marker"));
677 XMLNode &before = session->locations()->get_state();
678 session->locations()->remove (loc);
679 XMLNode &after = session->locations()->get_state();
680 session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after));
681 session->commit_reversible_command ();
687 LocationUI::location_remove_requested (ARDOUR::Location *loc)
689 // must do this to prevent problems when destroying
690 // the effective sender of this event
692 Glib::signal_idle().connect (bind (mem_fun(*this, &LocationUI::do_location_remove), loc));
697 LocationUI::location_redraw_ranges ()
704 LocationUI::location_added (Location* location)
706 ENSURE_GUI_THREAD(bind (mem_fun(*this, &LocationUI::location_added), location));
708 if (location->is_auto_punch()) {
709 punch_edit_row.set_location(location);
711 else if (location->is_auto_loop()) {
712 loop_edit_row.set_location(location);
715 refresh_location_list ();
720 LocationUI::location_removed (Location* location)
722 ENSURE_GUI_THREAD(bind (mem_fun(*this, &LocationUI::location_removed), location));
724 if (location->is_auto_punch()) {
725 punch_edit_row.set_location(0);
727 else if (location->is_auto_loop()) {
728 loop_edit_row.set_location(0);
731 refresh_location_list ();
735 struct LocationSortByStart {
736 bool operator() (Location *a, Location *b) {
737 return a->start() < b->start();
742 LocationUI::map_locations (Locations::LocationList& locations)
744 Locations::LocationList::iterator i;
748 Locations::LocationList temp = locations;
749 LocationSortByStart cmp;
754 Box_Helpers::BoxList & loc_children = location_rows.children();
755 Box_Helpers::BoxList & range_children = range_rows.children();
756 LocationEditRow * erow;
758 for (n = 0, i = locations.begin(); i != locations.end(); ++n, ++i) {
762 if (location->is_mark()) {
764 erow = manage (new LocationEditRow(session, location, mark_n));
765 erow->remove_requested.connect (mem_fun(*this, &LocationUI::location_remove_requested));
766 erow->redraw_ranges.connect (mem_fun(*this, &LocationUI::location_redraw_ranges));
767 loc_children.push_back(Box_Helpers::Element(*erow, PACK_SHRINK, 1, PACK_START));
768 if (location == newest_location) {
773 else if (location->is_auto_punch()) {
774 punch_edit_row.set_session (session);
775 punch_edit_row.set_location (location);
776 punch_edit_row.show_all();
778 else if (location->is_auto_loop()) {
779 loop_edit_row.set_session (session);
780 loop_edit_row.set_location (location);
781 loop_edit_row.show_all();
784 erow = manage (new LocationEditRow(session, location));
785 erow->remove_requested.connect (mem_fun(*this, &LocationUI::location_remove_requested));
786 range_children.push_back(Box_Helpers::Element(*erow, PACK_SHRINK, 1, PACK_START));
790 range_rows.show_all();
791 location_rows.show_all();
795 LocationUI::add_new_location()
800 nframes_t where = session->audible_frame();
801 session->locations()->next_available_name(markername,"mark");
802 Location *location = new Location (where, where, markername, Location::IsMark);
803 if (Config->get_name_new_markers()) {
804 newest_location = location;
806 session->begin_reversible_command (_("add marker"));
807 XMLNode &before = session->locations()->get_state();
808 session->locations()->add (location, true);
809 XMLNode &after = session->locations()->get_state();
810 session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
811 session->commit_reversible_command ();
817 LocationUI::add_new_range()
822 nframes_t where = session->audible_frame();
823 session->locations()->next_available_name(rangename,"unnamed");
824 Location *location = new Location (where, where, rangename, Location::IsRangeMarker);
825 session->begin_reversible_command (_("add range marker"));
826 XMLNode &before = session->locations()->get_state();
827 session->locations()->add (location, true);
828 XMLNode &after = session->locations()->get_state();
829 session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
830 session->commit_reversible_command ();
836 LocationUI::refresh_location_list_s (Change ignored)
838 ENSURE_GUI_THREAD(bind (mem_fun(*this, &LocationUI::refresh_location_list_s), ignored));
840 refresh_location_list ();
844 LocationUI::refresh_location_list ()
846 ENSURE_GUI_THREAD(mem_fun(*this, &LocationUI::refresh_location_list));
847 using namespace Box_Helpers;
849 // this is just too expensive to do when window is not shown
850 if (!is_visible()) return;
852 BoxList & loc_children = location_rows.children();
853 BoxList & range_children = range_rows.children();
855 loc_children.clear();
856 range_children.clear();
859 session->locations()->apply (*this, &LocationUI::map_locations);
865 LocationUI::set_session(ARDOUR::Session* s)
870 session->locations()->changed.connect (mem_fun(*this, &LocationUI::refresh_location_list));
871 session->locations()->StateChanged.connect (mem_fun(*this, &LocationUI::refresh_location_list_s));
872 session->locations()->added.connect (mem_fun(*this, &LocationUI::location_added));
873 session->locations()->removed.connect (mem_fun(*this, &LocationUI::location_removed));
874 session->GoingAway.connect (mem_fun(*this, &LocationUI::session_gone));
876 refresh_location_list ();
880 LocationUI::session_gone()
882 ENSURE_GUI_THREAD(mem_fun(*this, &LocationUI::session_gone));
884 using namespace Box_Helpers;
885 BoxList & loc_children = location_rows.children();
886 BoxList & range_children = range_rows.children();
888 loc_children.clear();
889 range_children.clear();
891 loop_edit_row.set_session (0);
892 loop_edit_row.set_location (0);
894 punch_edit_row.set_session (0);
895 punch_edit_row.set_location (0);
898 /*------------------------*/
900 LocationUIWindow::LocationUIWindow ()
901 : ArdourDialog ("locations dialog")
903 set_title (_("Locations"));
904 set_wmclass(X_("ardour_locations"), "Ardour");
905 set_name ("LocationWindow");
907 get_vbox()->pack_start (_ui);
910 LocationUIWindow::~LocationUIWindow()
915 LocationUIWindow::on_show()
917 _ui.refresh_location_list();
918 ArdourDialog::on_show();
922 LocationUIWindow::on_delete_event (GdkEventAny*)
929 LocationUIWindow::set_session (Session *s)
931 ArdourDialog::set_session (s);
934 s->GoingAway.connect (mem_fun (*this, &LocationUIWindow::session_gone));
938 LocationUIWindow::session_gone ()
941 ArdourDialog::session_gone ();