2 Copyright (C) 2000-2007 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.
20 /* Note: public Editor methods are documented in public_editor.h */
22 #define __STDC_LIMIT_MACROS 1
31 #include <boost/none.hpp>
33 #include <sigc++/bind.h>
35 #include "pbd/convert.h"
36 #include "pbd/error.h"
37 #include "pbd/enumwriter.h"
38 #include "pbd/memento_command.h"
40 #include <glibmm/miscutils.h>
41 #include <gtkmm/image.h>
42 #include <gdkmm/color.h>
43 #include <gdkmm/bitmap.h>
45 #include <gtkmm2ext/grouped_buttons.h>
46 #include <gtkmm2ext/gtk_ui.h>
47 #include <gtkmm2ext/tearoff.h>
48 #include <gtkmm2ext/utils.h>
49 #include <gtkmm2ext/window_title.h>
50 #include <gtkmm2ext/choice.h>
51 #include <gtkmm2ext/cell_renderer_pixbuf_toggle.h>
53 #include "ardour/audio_diskstream.h"
54 #include "ardour/audio_track.h"
55 #include "ardour/audioplaylist.h"
56 #include "ardour/audioregion.h"
57 #include "ardour/location.h"
58 #include "ardour/midi_region.h"
59 #include "ardour/plugin_manager.h"
60 #include "ardour/profile.h"
61 #include "ardour/route_group.h"
62 #include "ardour/session_directory.h"
63 #include "ardour/session_route.h"
64 #include "ardour/session_state_utils.h"
65 #include "ardour/tempo.h"
66 #include "ardour/utils.h"
68 #include "control_protocol/control_protocol.h"
70 #include "ardour_ui.h"
74 #include "playlist_selector.h"
75 #include "audio_region_view.h"
76 #include "rgb_macros.h"
77 #include "selection.h"
78 #include "audio_streamview.h"
79 #include "time_axis_view.h"
80 #include "audio_time_axis.h"
82 #include "crossfade_view.h"
84 #include "public_editor.h"
85 #include "crossfade_edit.h"
86 #include "canvas_impl.h"
89 #include "gui_thread.h"
90 #include "simpleline.h"
91 #include "rhythm_ferret.h"
93 #include "tempo_lines.h"
94 #include "analysis_window.h"
95 #include "bundle_manager.h"
96 #include "global_port_matrix.h"
97 #include "editor_drag.h"
98 #include "editor_group_tabs.h"
103 #include "imageframe_socket_handler.h"
107 using namespace sigc;
108 using namespace ARDOUR;
111 using namespace Glib;
112 using namespace Gtkmm2ext;
113 using namespace Editing;
115 using PBD::internationalize;
118 const double Editor::timebar_height = 15.0;
120 #include "editor_xpms"
122 static const gchar *_snap_type_strings[] = {
144 static const gchar *_snap_mode_strings[] = {
151 static const gchar *_edit_point_strings[] = {
158 static const gchar *_zoom_focus_strings[] = {
168 #ifdef USE_RUBBERBAND
169 static const gchar *_rb_opt_strings[] = {
172 N_("Balanced multitimbral mixture"),
173 N_("Unpitched percussion with stable notes"),
174 N_("Crisp monophonic instrumental"),
175 N_("Unpitched solo percussion"),
180 /* Soundfile drag-n-drop */
182 Gdk::Cursor* Editor::cross_hair_cursor = 0;
183 Gdk::Cursor* Editor::selector_cursor = 0;
184 Gdk::Cursor* Editor::trimmer_cursor = 0;
185 Gdk::Cursor* Editor::grabber_cursor = 0;
186 Gdk::Cursor* Editor::grabber_edit_point_cursor = 0;
187 Gdk::Cursor* Editor::zoom_cursor = 0;
188 Gdk::Cursor* Editor::time_fx_cursor = 0;
189 Gdk::Cursor* Editor::fader_cursor = 0;
190 Gdk::Cursor* Editor::speaker_cursor = 0;
191 Gdk::Cursor* Editor::midi_pencil_cursor = 0;
192 Gdk::Cursor* Editor::midi_select_cursor = 0;
193 Gdk::Cursor* Editor::midi_resize_cursor = 0;
194 Gdk::Cursor* Editor::midi_erase_cursor = 0;
195 Gdk::Cursor* Editor::wait_cursor = 0;
196 Gdk::Cursor* Editor::timebar_cursor = 0;
197 Gdk::Cursor* Editor::transparent_cursor = 0;
200 show_me_the_size (Requisition* r, const char* what)
202 cerr << "size of " << what << " = " << r->width << " x " << r->height << endl;
207 /* time display buttons */
209 minsec_label (_("Mins:Secs")),
210 bbt_label (_("Bars:Beats")),
211 smpte_label (_("Timecode")),
212 frame_label (_("Samples")),
213 tempo_label (_("Tempo")),
214 meter_label (_("Meter")),
215 mark_label (_("Location Markers")),
216 range_mark_label (_("Range Markers")),
217 transport_mark_label (_("Loop/Punch Ranges")),
218 cd_mark_label (_("CD Markers")),
219 edit_packer (4, 4, true),
221 /* the values here don't matter: layout widgets
222 reset them as needed.
225 vertical_adjustment (0.0, 0.0, 10.0, 400.0),
226 horizontal_adjustment (0.0, 0.0, 20.0, 1200.0),
228 /* tool bar related */
230 edit_point_clock (X_("editpoint"), false, X_("EditPointClock"), true),
231 zoom_range_clock (X_("zoomrange"), false, X_("ZoomRangeClock"), true, true),
233 toolbar_selection_clock_table (2,3),
235 automation_mode_button (_("mode")),
236 global_automation_button (_("automation")),
238 midi_panic_button (_("Panic")),
239 midi_tools_tearoff (0),
242 image_socket_listener(0),
247 nudge_clock (X_("nudge"), false, X_("NudgeClock"), true, true),
248 meters_running(false),
249 _pending_locate_request (false)
254 /* we are a singleton */
256 PublicEditor::_instance = this;
261 selection = new Selection (this);
262 cut_buffer = new Selection (this);
264 clicked_regionview = 0;
265 clicked_axisview = 0;
266 clicked_routeview = 0;
267 clicked_crossfadeview = 0;
268 clicked_control_point = 0;
269 last_update_frame = 0;
271 current_mixer_strip = 0;
272 current_bbt_points = 0;
275 snap_type_strings = I18N (_snap_type_strings);
276 snap_mode_strings = I18N (_snap_mode_strings);
277 zoom_focus_strings = I18N (_zoom_focus_strings);
278 edit_point_strings = I18N (_edit_point_strings);
279 #ifdef USE_RUBBERBAND
280 rb_opt_strings = I18N (_rb_opt_strings);
283 snap_threshold = 5.0;
284 bbt_beat_subdivision = 4;
287 last_autoscroll_x = 0;
288 last_autoscroll_y = 0;
289 autoscroll_active = false;
290 autoscroll_timeout_tag = -1;
291 interthread_progress_window = 0;
296 current_interthread_info = 0;
297 _show_measures = true;
298 _show_waveforms_recording = true;
299 show_gain_after_trim = false;
300 route_redisplay_does_not_sync_order_keys = false;
301 route_redisplay_does_not_reset_order_keys = false;
302 no_route_list_redisplay = false;
303 verbose_cursor_on = true;
304 route_removal = false;
305 show_automatic_regions_in_region_list = true;
306 last_item_entered = 0;
307 last_item_entered_n = 0;
309 region_list_sort_type = (Editing::RegionListSortType) 0;
310 have_pending_keyboard_selection = false;
311 _follow_playhead = true;
312 _xfade_visibility = true;
313 editor_ruler_menu = 0;
314 no_ruler_shown_update = false;
315 edit_group_list_menu = 0;
317 region_list_menu = 0;
319 start_end_marker_menu = 0;
320 range_marker_menu = 0;
321 marker_menu_item = 0;
323 transport_marker_menu = 0;
324 new_transport_marker_menu = 0;
325 editor_mixer_strip_width = Wide;
326 show_editor_mixer_when_tracks_arrive = false;
327 region_edit_menu_split_multichannel_item = 0;
328 region_edit_menu_split_item = 0;
331 ignore_mouse_mode_toggle = false;
332 ignore_midi_edit_mode_toggle = false;
333 current_stepping_trackview = 0;
335 entered_regionview = 0;
337 clear_entered_track = false;
338 _new_regionviews_show_envelope = false;
340 in_edit_group_row_change = false;
342 button_release_can_deselect = true;
343 _dragging_playhead = false;
344 _dragging_edit_point = false;
345 _dragging_hscrollbar = false;
346 select_new_marker = false;
347 zoomed_to_region = false;
350 for (ARDOUR::DataType::iterator i = ARDOUR::DataType::begin(); i != ARDOUR::DataType::end(); ++i) {
351 _global_port_matrix[*i] = 0;
353 allow_vertical_scroll = false;
354 no_save_visual = false;
355 no_region_list_redisplay = false;
358 scrubbing_direction = 0;
362 location_marker_color = ARDOUR_UI::config()->canvasvar_LocationMarker.get();
363 location_range_color = ARDOUR_UI::config()->canvasvar_LocationRange.get();
364 location_cd_marker_color = ARDOUR_UI::config()->canvasvar_LocationCDMarker.get();
365 location_loop_color = ARDOUR_UI::config()->canvasvar_LocationLoop.get();
366 location_punch_color = ARDOUR_UI::config()->canvasvar_LocationPunch.get();
368 set_midi_edit_mode (MidiEditPencil, true);
369 _edit_point = EditAtMouse;
370 set_mouse_mode (MouseObject, true);
372 frames_per_unit = 2048; /* too early to use reset_zoom () */
373 reset_hscrollbar_stepping ();
375 zoom_focus = ZoomFocusLeft;
376 set_zoom_focus (ZoomFocusLeft);
377 zoom_range_clock.ValueChanged.connect (mem_fun(*this, &Editor::zoom_adjustment_changed));
379 bbt_label.set_name ("EditorTimeButton");
380 bbt_label.set_size_request (-1, (int)timebar_height);
381 bbt_label.set_alignment (1.0, 0.5);
382 bbt_label.set_padding (5,0);
384 bbt_label.set_no_show_all();
385 minsec_label.set_name ("EditorTimeButton");
386 minsec_label.set_size_request (-1, (int)timebar_height);
387 minsec_label.set_alignment (1.0, 0.5);
388 minsec_label.set_padding (5,0);
389 minsec_label.hide ();
390 minsec_label.set_no_show_all();
391 smpte_label.set_name ("EditorTimeButton");
392 smpte_label.set_size_request (-1, (int)timebar_height);
393 smpte_label.set_alignment (1.0, 0.5);
394 smpte_label.set_padding (5,0);
396 smpte_label.set_no_show_all();
397 frame_label.set_name ("EditorTimeButton");
398 frame_label.set_size_request (-1, (int)timebar_height);
399 frame_label.set_alignment (1.0, 0.5);
400 frame_label.set_padding (5,0);
402 frame_label.set_no_show_all();
404 tempo_label.set_name ("EditorTimeButton");
405 tempo_label.set_size_request (-1, (int)timebar_height);
406 tempo_label.set_alignment (1.0, 0.5);
407 tempo_label.set_padding (5,0);
409 tempo_label.set_no_show_all();
410 meter_label.set_name ("EditorTimeButton");
411 meter_label.set_size_request (-1, (int)timebar_height);
412 meter_label.set_alignment (1.0, 0.5);
413 meter_label.set_padding (5,0);
415 meter_label.set_no_show_all();
416 mark_label.set_name ("EditorTimeButton");
417 mark_label.set_size_request (-1, (int)timebar_height);
418 mark_label.set_alignment (1.0, 0.5);
419 mark_label.set_padding (5,0);
421 mark_label.set_no_show_all();
422 cd_mark_label.set_name ("EditorTimeButton");
423 cd_mark_label.set_size_request (-1, (int)timebar_height);
424 cd_mark_label.set_alignment (1.0, 0.5);
425 cd_mark_label.set_padding (5,0);
426 cd_mark_label.hide();
427 cd_mark_label.set_no_show_all();
428 range_mark_label.set_name ("EditorTimeButton");
429 range_mark_label.set_size_request (-1, (int)timebar_height);
430 range_mark_label.set_alignment (1.0, 0.5);
431 range_mark_label.set_padding (5,0);
432 range_mark_label.hide();
433 range_mark_label.set_no_show_all();
434 transport_mark_label.set_name ("EditorTimeButton");
435 transport_mark_label.set_size_request (-1, (int)timebar_height);
436 transport_mark_label.set_alignment (1.0, 0.5);
437 transport_mark_label.set_padding (5,0);
438 transport_mark_label.hide();
439 transport_mark_label.set_no_show_all();
441 initialize_rulers ();
442 _summary = new EditorSummary (this);
443 initialize_canvas ();
445 selection->TimeChanged.connect (mem_fun(*this, &Editor::time_selection_changed));
446 selection->TracksChanged.connect (mem_fun(*this, &Editor::track_selection_changed));
447 editor_regions_selection_changed_connection = selection->RegionsChanged.connect (mem_fun(*this, &Editor::region_selection_changed));
448 selection->PointsChanged.connect (mem_fun(*this, &Editor::point_selection_changed));
449 selection->MarkersChanged.connect (mem_fun(*this, &Editor::marker_selection_changed));
451 edit_controls_vbox.set_spacing (0);
452 horizontal_adjustment.signal_value_changed().connect (mem_fun(*this, &Editor::scroll_canvas_horizontally), false);
453 vertical_adjustment.signal_value_changed().connect (mem_fun(*this, &Editor::tie_vertical_scrolling), true);
454 track_canvas->signal_map_event().connect (mem_fun (*this, &Editor::track_canvas_map_handler));
456 HBox* h = manage (new HBox);
457 _group_tabs = new EditorGroupTabs (this);
458 h->pack_start (*_group_tabs, PACK_SHRINK);
459 h->pack_start (edit_controls_vbox);
460 controls_layout.add (*h);
462 controls_layout.set_name ("EditControlsBase");
463 controls_layout.add_events (Gdk::SCROLL_MASK);
464 controls_layout.signal_scroll_event().connect (mem_fun(*this, &Editor::control_layout_scroll), false);
466 controls_layout.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
467 controls_layout.signal_button_release_event().connect (mem_fun(*this, &Editor::edit_controls_button_release));
468 controls_layout_size_request_connection = controls_layout.signal_size_request().connect (mem_fun (*this, &Editor::controls_layout_size_request));
470 edit_vscrollbar.set_adjustment (vertical_adjustment);
471 edit_hscrollbar.set_adjustment (horizontal_adjustment);
473 edit_hscrollbar.signal_button_press_event().connect (mem_fun(*this, &Editor::hscrollbar_button_press), false);
474 edit_hscrollbar.signal_button_release_event().connect (mem_fun(*this, &Editor::hscrollbar_button_release), false);
475 edit_hscrollbar.signal_size_allocate().connect (mem_fun(*this, &Editor::hscrollbar_allocate));
477 edit_hscrollbar.set_name ("EditorHScrollbar");
481 setup_midi_toolbar ();
483 edit_point_clock.ValueChanged.connect (mem_fun(*this, &Editor::edit_point_clock_changed));
485 ArdourCanvas::Canvas* time_pad = manage(new ArdourCanvas::Canvas());
486 ArdourCanvas::SimpleLine* pad_line_1 = manage(new ArdourCanvas::SimpleLine(*time_pad->root(),
487 0.0, 1.0, 100.0, 1.0));
488 pad_line_1->property_color_rgba() = 0xFF0000FF;
492 time_canvas_vbox.set_size_request (-1, (int)(timebar_height * visible_timebars) + 2);
493 time_canvas_vbox.set_size_request (-1, -1);
495 ruler_label_event_box.add (ruler_label_vbox);
496 ruler_label_event_box.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
497 ruler_label_event_box.signal_button_release_event().connect (mem_fun(*this, &Editor::ruler_label_button_release));
499 time_button_event_box.add (time_button_vbox);
500 time_button_event_box.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
501 time_button_event_box.signal_button_release_event().connect (mem_fun(*this, &Editor::ruler_label_button_release));
503 /* these enable us to have a dedicated window (for cursor setting, etc.)
504 for the canvas areas.
507 track_canvas_event_box.add (*track_canvas);
509 time_canvas_event_box.add (time_canvas_vbox);
510 time_canvas_event_box.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::POINTER_MOTION_MASK);
512 edit_packer.set_col_spacings (0);
513 edit_packer.set_row_spacings (0);
514 edit_packer.set_homogeneous (false);
515 edit_packer.set_border_width (0);
516 edit_packer.set_name ("EditorWindow");
518 edit_packer.attach (zoom_vbox, 0, 1, 0, 2, SHRINK, FILL, 0, 0);
519 /* labels for the rulers */
520 edit_packer.attach (ruler_label_event_box, 1, 2, 0, 1, FILL, SHRINK, 0, 0);
521 /* labels for the marker "tracks" */
522 edit_packer.attach (time_button_event_box, 1, 2, 1, 2, FILL, SHRINK, 0, 0);
524 edit_packer.attach (time_canvas_event_box, 2, 3, 0, 1, FILL|EXPAND, FILL, 0, 0);
526 edit_packer.attach (controls_layout, 0, 2, 2, 3, FILL, FILL|EXPAND, 0, 0);
528 edit_packer.attach (track_canvas_event_box, 2, 3, 1, 3, FILL|EXPAND, FILL|EXPAND, 0, 0);
530 bottom_hbox.set_border_width (2);
531 bottom_hbox.set_spacing (3);
534 CellRendererPixbufToggle* rec_col_renderer = Gtk::manage( new CellRendererPixbufToggle() );
536 rec_col_renderer->set_active_pixbuf(::get_icon("record_normal_red"));
537 rec_col_renderer->set_inactive_pixbuf(::get_icon("record_disabled_grey"));
539 rec_col_renderer->signal_toggled().connect(mem_fun(*this, &Editor::on_tv_rec_enable_toggled));
541 Gtk::TreeViewColumn* rec_state_column = Gtk::manage(new Gtk::TreeViewColumn("Rec", *rec_col_renderer));
542 rec_state_column->add_attribute(rec_col_renderer->property_active(), route_display_columns.rec_enabled);
543 rec_state_column->add_attribute(rec_col_renderer->property_visible(), route_display_columns.is_track);
545 route_display_model = ListStore::create(route_display_columns);
546 route_list_display.set_model (route_display_model);
548 route_list_display.append_column (*rec_state_column);
549 route_list_display.append_column (_("Show"), route_display_columns.visible);
550 route_list_display.append_column (_("Name"), route_display_columns.text);
552 route_list_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0));
553 route_list_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
554 route_list_display.get_column (2)->set_data (X_("colnum"), GUINT_TO_POINTER(2));
556 route_list_display.set_headers_visible (true);
557 route_list_display.set_name ("TrackListDisplay");
558 route_list_display.get_selection()->set_mode (SELECTION_NONE);
559 route_list_display.set_reorderable (true);
560 route_list_display.set_size_request (100,-1);
561 route_list_display.add_object_drag (route_display_columns.route.index(), "routes");
563 CellRendererToggle* route_list_visible_cell = dynamic_cast<CellRendererToggle*>(route_list_display.get_column_cell_renderer (1));
565 route_list_visible_cell->property_activatable() = true;
566 route_list_visible_cell->property_radio() = false;
568 route_display_model->signal_row_deleted().connect (mem_fun (*this, &Editor::route_list_delete));
569 route_display_model->signal_row_changed().connect (mem_fun (*this, &Editor::route_list_change));
570 route_display_model->signal_rows_reordered().connect (mem_fun (*this, &Editor::route_list_reordered));
572 route_list_display.signal_button_press_event().connect (mem_fun (*this, &Editor::route_list_display_button_press), false);
574 route_list_scroller.add (route_list_display);
575 route_list_scroller.set_policy (POLICY_NEVER, POLICY_AUTOMATIC);
577 group_model = ListStore::create(group_columns);
578 edit_group_display.set_model (group_model);
579 edit_group_display.append_column (_("Name"), group_columns.text);
580 edit_group_display.append_column (_("Active"), group_columns.is_active);
581 edit_group_display.append_column (_("Show"), group_columns.is_visible);
582 edit_group_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0));
583 edit_group_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
584 edit_group_display.get_column (2)->set_data (X_("colnum"), GUINT_TO_POINTER(2));
585 edit_group_display.get_column (0)->set_expand (true);
586 edit_group_display.get_column (1)->set_expand (false);
587 edit_group_display.get_column (2)->set_expand (false);
588 edit_group_display.set_headers_visible (true);
590 /* name is directly editable */
592 CellRendererText* name_cell = dynamic_cast<CellRendererText*>(edit_group_display.get_column_cell_renderer (0));
593 name_cell->property_editable() = true;
594 name_cell->signal_edited().connect (mem_fun (*this, &Editor::edit_group_name_edit));
596 /* use checkbox for the active + visible columns */
598 CellRendererToggle* active_cell = dynamic_cast<CellRendererToggle*>(edit_group_display.get_column_cell_renderer (1));
599 active_cell->property_activatable() = true;
600 active_cell->property_radio() = false;
602 active_cell = dynamic_cast<CellRendererToggle*>(edit_group_display.get_column_cell_renderer (1));
603 active_cell->property_activatable() = true;
604 active_cell->property_radio() = false;
606 group_model->signal_row_changed().connect (mem_fun (*this, &Editor::edit_group_row_change));
608 edit_group_display.set_name ("EditGroupList");
609 edit_group_display.get_selection()->set_mode (SELECTION_SINGLE);
610 edit_group_display.set_headers_visible (true);
611 edit_group_display.set_reorderable (false);
612 edit_group_display.set_rules_hint (true);
613 edit_group_display.set_size_request (75, -1);
615 edit_group_display_scroller.add (edit_group_display);
616 edit_group_display_scroller.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC);
618 edit_group_display.signal_button_press_event().connect (mem_fun(*this, &Editor::edit_group_list_button_press_event), false);
620 VBox* edit_group_display_packer = manage (new VBox());
621 HBox* edit_group_display_button_box = manage (new HBox());
622 edit_group_display_button_box->set_homogeneous (true);
624 Button* edit_group_add_button = manage (new Button ());
625 Button* edit_group_remove_button = manage (new Button ());
629 w = manage (new Image (Stock::ADD, ICON_SIZE_BUTTON));
631 edit_group_add_button->add (*w);
633 w = manage (new Image (Stock::REMOVE, ICON_SIZE_BUTTON));
635 edit_group_remove_button->add (*w);
637 edit_group_add_button->signal_clicked().connect (mem_fun (*this, &Editor::new_edit_group));
638 edit_group_remove_button->signal_clicked().connect (mem_fun (*this, &Editor::remove_selected_edit_group));
640 edit_group_display_button_box->pack_start (*edit_group_add_button);
641 edit_group_display_button_box->pack_start (*edit_group_remove_button);
643 edit_group_display_packer->pack_start (edit_group_display_scroller, true, true);
644 edit_group_display_packer->pack_start (*edit_group_display_button_box, false, false);
646 region_list_display.set_size_request (100, -1);
647 region_list_display.set_name ("RegionListDisplay");
648 /* Try to prevent single mouse presses from initiating edits.
649 This relies on a hack in gtktreeview.c:gtk_treeview_button_press()
651 region_list_display.set_data ("mouse-edits-require-mod1", (gpointer) 0x1);
653 region_list_model = TreeStore::create (region_list_columns);
654 region_list_model->set_sort_func (0, mem_fun (*this, &Editor::region_list_sorter));
655 region_list_model->set_sort_column (0, SORT_ASCENDING);
657 region_list_display.set_model (region_list_model);
658 region_list_display.append_column (_("Regions"), region_list_columns.name);
659 region_list_display.append_column (_("Start"), region_list_columns.start);
660 region_list_display.append_column (_("End"), region_list_columns.end);
661 region_list_display.append_column (_("Length"), region_list_columns.length);
662 region_list_display.append_column (_("Sync"), region_list_columns.sync);
663 region_list_display.append_column (_("Fade In"), region_list_columns.fadein);
664 region_list_display.append_column (_("Fade Out"), region_list_columns.fadeout);
665 region_list_display.append_column (_("L"), region_list_columns.locked);
666 region_list_display.append_column (_("G"), region_list_columns.glued);
667 region_list_display.append_column (_("M"), region_list_columns.muted);
668 region_list_display.append_column (_("O"), region_list_columns.opaque);
669 region_list_display.append_column (_("Used"), region_list_columns.used);
670 region_list_display.append_column (_("Path"), region_list_columns.path);
671 region_list_display.set_headers_visible (true);
672 //region_list_display.set_grid_lines (TREE_VIEW_GRID_LINES_BOTH);
674 CellRendererText* region_name_cell = dynamic_cast<CellRendererText*>(region_list_display.get_column_cell_renderer (0));
675 region_name_cell->property_editable() = true;
676 region_name_cell->signal_edited().connect (mem_fun (*this, &Editor::region_name_edit));
678 region_list_display.get_selection()->set_select_function (mem_fun (*this, &Editor::region_list_selection_filter));
680 TreeViewColumn* tv_col = region_list_display.get_column(0);
681 CellRendererText* renderer = dynamic_cast<CellRendererText*>(region_list_display.get_column_cell_renderer (0));
682 tv_col->add_attribute(renderer->property_text(), region_list_columns.name);
683 tv_col->add_attribute(renderer->property_foreground_gdk(), region_list_columns.color_);
685 region_list_display.get_selection()->set_mode (SELECTION_MULTIPLE);
686 region_list_display.add_object_drag (region_list_columns.region.index(), "regions");
688 /* setup DnD handling */
690 list<TargetEntry> region_list_target_table;
692 region_list_target_table.push_back (TargetEntry ("text/plain"));
693 region_list_target_table.push_back (TargetEntry ("text/uri-list"));
694 region_list_target_table.push_back (TargetEntry ("application/x-rootwin-drop"));
696 region_list_display.add_drop_targets (region_list_target_table);
697 region_list_display.signal_drag_data_received().connect (mem_fun(*this, &Editor::region_list_display_drag_data_received));
699 region_list_scroller.add (region_list_display);
700 region_list_scroller.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC);
702 region_list_display.signal_key_press_event().connect (mem_fun(*this, &Editor::region_list_display_key_press));
703 region_list_display.signal_key_release_event().connect (mem_fun(*this, &Editor::region_list_display_key_release));
704 region_list_display.signal_button_press_event().connect (mem_fun(*this, &Editor::region_list_display_button_press), false);
705 region_list_display.signal_button_release_event().connect (mem_fun(*this, &Editor::region_list_display_button_release));
706 region_list_change_connection = region_list_display.get_selection()->signal_changed().connect (mem_fun(*this, &Editor::region_list_selection_changed));
707 // region_list_display.signal_popup_menu().connect (bind (mem_fun (*this, &Editor::show_region_list_display_context_menu), 1, 0));
709 //ARDOUR_UI::instance()->secondary_clock.mode_changed.connect (mem_fun(*this, &Editor::redisplay_regions));
710 ARDOUR_UI::instance()->secondary_clock.mode_changed.connect (mem_fun(*this, &Editor::update_all_region_rows));
711 ARDOUR::Region::RegionPropertyChanged.connect (mem_fun(*this, &Editor::update_region_row));
713 named_selection_scroller.add (named_selection_display);
714 named_selection_scroller.set_policy (POLICY_NEVER, POLICY_AUTOMATIC);
716 named_selection_model = TreeStore::create (named_selection_columns);
717 named_selection_display.set_model (named_selection_model);
718 named_selection_display.append_column (_("Chunks"), named_selection_columns.text);
719 named_selection_display.set_headers_visible (false);
720 named_selection_display.set_size_request (100, -1);
721 named_selection_display.set_name ("NamedSelectionDisplay");
723 named_selection_display.get_selection()->set_mode (SELECTION_SINGLE);
724 named_selection_display.set_size_request (100, -1);
725 named_selection_display.signal_button_release_event().connect (mem_fun(*this, &Editor::named_selection_display_button_release), false);
726 named_selection_display.signal_key_release_event().connect (mem_fun(*this, &Editor::named_selection_display_key_release), false);
727 named_selection_display.get_selection()->signal_changed().connect (mem_fun (*this, &Editor::named_selection_display_selection_changed));
731 snapshot_display_model = ListStore::create (snapshot_display_columns);
732 snapshot_display.set_model (snapshot_display_model);
733 snapshot_display.append_column (X_("snapshot"), snapshot_display_columns.visible_name);
734 snapshot_display.set_name ("SnapshotDisplay");
735 snapshot_display.set_size_request (75, -1);
736 snapshot_display.set_headers_visible (false);
737 snapshot_display.set_reorderable (false);
738 snapshot_display_scroller.add (snapshot_display);
739 snapshot_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
741 snapshot_display.get_selection()->signal_changed().connect (mem_fun(*this, &Editor::snapshot_display_selection_changed));
742 snapshot_display.signal_button_press_event().connect (mem_fun (*this, &Editor::snapshot_display_button_press), false);
746 nlabel = manage (new Label (_("Regions")));
747 nlabel->set_angle (-90);
748 the_notebook.append_page (region_list_scroller, *nlabel);
749 nlabel = manage (new Label (_("Tracks/Busses")));
750 nlabel->set_angle (-90);
751 the_notebook.append_page (route_list_scroller, *nlabel);
752 nlabel = manage (new Label (_("Snapshots")));
753 nlabel->set_angle (-90);
754 the_notebook.append_page (snapshot_display_scroller, *nlabel);
755 nlabel = manage (new Label (_("Edit Groups")));
756 nlabel->set_angle (-90);
757 the_notebook.append_page (*edit_group_display_packer, *nlabel);
759 if (!Profile->get_sae()) {
760 nlabel = manage (new Label (_("Chunks")));
761 nlabel->set_angle (-90);
762 the_notebook.append_page (named_selection_scroller, *nlabel);
765 the_notebook.set_show_tabs (true);
766 the_notebook.set_scrollable (true);
767 the_notebook.popup_enable ();
768 the_notebook.set_tab_pos (Gtk::POS_RIGHT);
769 the_notebook.show_all ();
771 post_maximal_editor_width = 0;
772 post_maximal_pane_position = 0;
774 VPaned *editor_summary_pane = manage(new VPaned());
775 editor_summary_pane->pack1(edit_packer);
776 editor_summary_pane->pack2(*_summary);
778 edit_pane.pack1 (*editor_summary_pane, true, true);
779 edit_pane.pack2 (the_notebook, false, true);
781 edit_pane.signal_size_allocate().connect (bind (mem_fun(*this, &Editor::pane_allocation_handler), static_cast<Paned*> (&edit_pane)));
783 top_hbox.pack_start (toolbar_frame, false, true);
784 top_hbox.pack_start (midi_toolbar_frame, false, true);
786 HBox *hbox = manage (new HBox);
787 hbox->pack_start (edit_pane, true, true);
789 global_vpacker.pack_start (top_hbox, false, false);
790 global_vpacker.pack_start (*hbox, true, true);
792 global_hpacker.pack_start (global_vpacker, true, true);
794 set_name ("EditorWindow");
795 add_accel_group (ActionManager::ui_manager->get_accel_group());
797 status_bar_hpacker.show ();
799 vpacker.pack_end (status_bar_hpacker, false, false);
800 vpacker.pack_end (global_hpacker, true, true);
802 /* register actions now so that set_state() can find them and set toggles/checks etc */
806 snap_type = SnapToBeat;
807 set_snap_to (snap_type);
809 set_snap_mode (snap_mode);
810 set_edit_point_preference (EditAtMouse, true);
812 XMLNode* node = ARDOUR_UI::instance()->editor_settings();
815 _playlist_selector = new PlaylistSelector();
816 _playlist_selector->signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), static_cast<Window *> (_playlist_selector)));
818 RegionView::RegionViewGoingAway.connect (mem_fun(*this, &Editor::catch_vanishing_regionview));
822 nudge_forward_button.add (*(manage (new Image (::get_icon("nudge_right")))));
823 nudge_backward_button.add (*(manage (new Image (::get_icon("nudge_left")))));
825 ARDOUR_UI::instance()->tooltips().set_tip (nudge_forward_button, _("Nudge Region/Selection Forwards"));
826 ARDOUR_UI::instance()->tooltips().set_tip (nudge_backward_button, _("Nudge Region/Selection Backwards"));
828 nudge_forward_button.set_name ("TransportButton");
829 nudge_backward_button.set_name ("TransportButton");
831 fade_context_menu.set_name ("ArdourContextMenu");
833 /* icons, titles, WM stuff */
835 list<Glib::RefPtr<Gdk::Pixbuf> > window_icons;
836 Glib::RefPtr<Gdk::Pixbuf> icon;
838 if ((icon = ::get_icon ("ardour_icon_16px")) != 0) {
839 window_icons.push_back (icon);
841 if ((icon = ::get_icon ("ardour_icon_22px")) != 0) {
842 window_icons.push_back (icon);
844 if ((icon = ::get_icon ("ardour_icon_32px")) != 0) {
845 window_icons.push_back (icon);
847 if ((icon = ::get_icon ("ardour_icon_48px")) != 0) {
848 window_icons.push_back (icon);
850 if (!window_icons.empty()) {
851 set_icon_list (window_icons);
852 set_default_icon_list (window_icons);
855 WindowTitle title(Glib::get_application_name());
856 title += _("Editor");
857 set_title (title.get_string());
858 set_wmclass (X_("ardour_editor"), "Ardour");
861 add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
863 signal_configure_event().connect (mem_fun (*ARDOUR_UI::instance(), &ARDOUR_UI::configure_handler));
864 signal_delete_event().connect (mem_fun (*ARDOUR_UI::instance(), &ARDOUR_UI::exit_on_main_window_close));
866 /* allow external control surfaces/protocols to do various things */
868 ControlProtocol::ZoomToSession.connect (mem_fun (*this, &Editor::temporal_zoom_session));
869 ControlProtocol::ZoomIn.connect (bind (mem_fun (*this, &Editor::temporal_zoom_step), false));
870 ControlProtocol::ZoomOut.connect (bind (mem_fun (*this, &Editor::temporal_zoom_step), true));
871 ControlProtocol::ScrollTimeline.connect (mem_fun (*this, &Editor::control_scroll));
872 BasicUI::AccessAction.connect (mem_fun (*this, &Editor::access_action));
874 Config->ParameterChanged.connect (mem_fun (*this, &Editor::parameter_changed));
875 Route::SyncOrderKeys.connect (mem_fun (*this, &Editor::sync_order_keys));
877 _last_normalization_value = 0;
886 if(image_socket_listener) {
887 if(image_socket_listener->is_connected())
889 image_socket_listener->close_connection() ;
892 delete image_socket_listener ;
893 image_socket_listener = 0 ;
902 Editor::on_tv_rec_enable_toggled(const Glib::ustring& path_string){
904 // Get the model row that has been toggled.
905 Gtk::TreeModel::Row row = *route_display_model->get_iter(Gtk::TreeModel::Path(path_string));
907 TimeAxisView *tv = row[route_display_columns.tv];
908 AudioTimeAxisView *atv = dynamic_cast<AudioTimeAxisView*> (tv);
910 if(atv != 0 && atv->is_audio_track()){
911 atv->get_diskstream()->set_record_enabled(!atv->get_diskstream()->record_enabled());
917 Editor::add_toplevel_controls (Container& cont)
919 vpacker.pack_start (cont, false, false);
924 Editor::catch_vanishing_regionview (RegionView *rv)
926 /* note: the selection will take care of the vanishing
927 audioregionview by itself.
930 if (_drag && rv->get_canvas_group() == _drag->item() && !_drag->ending()) {
936 if (clicked_regionview == rv) {
937 clicked_regionview = 0;
940 if (entered_regionview == rv) {
941 set_entered_regionview (0);
946 Editor::set_entered_regionview (RegionView* rv)
948 if (rv == entered_regionview) {
952 if (entered_regionview) {
953 entered_regionview->exited ();
956 if ((entered_regionview = rv) != 0) {
957 entered_regionview->entered ();
962 Editor::set_entered_track (TimeAxisView* tav)
965 entered_track->exited ();
968 if ((entered_track = tav) != 0) {
969 entered_track->entered ();
974 Editor::show_window ()
976 if (! is_visible ()) {
979 /* re-hide editor list if necessary */
980 editor_list_button_toggled ();
982 /* re-hide summary widget if necessary */
983 parameter_changed ("show-summary");
985 parameter_changed ("show-edit-group-tabs");
987 /* now reset all audio_time_axis heights, because widgets might need
993 for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
994 tv = (static_cast<TimeAxisView*>(*i));
1003 Editor::instant_save ()
1005 if (!constructed || !ARDOUR_UI::instance()->session_loaded) {
1010 session->add_instant_xml(get_state());
1012 Config->add_instant_xml(get_state());
1017 Editor::edit_point_clock_changed()
1019 if (_dragging_edit_point) {
1023 if (selection->markers.empty()) {
1028 Location* loc = find_location_from_marker (selection->markers.front(), ignored);
1034 loc->move_to (edit_point_clock.current_time());
1038 Editor::zoom_adjustment_changed ()
1044 double fpu = zoom_range_clock.current_duration() / _canvas_width;
1048 zoom_range_clock.set ((nframes64_t) floor (fpu * _canvas_width));
1049 } else if (fpu > session->current_end_frame() / _canvas_width) {
1050 fpu = session->current_end_frame() / _canvas_width;
1051 zoom_range_clock.set ((nframes64_t) floor (fpu * _canvas_width));
1054 temporal_zoom (fpu);
1058 Editor::control_scroll (float fraction)
1060 ENSURE_GUI_THREAD(bind (mem_fun (*this, &Editor::control_scroll), fraction));
1066 double step = fraction * current_page_frames();
1069 _control_scroll_target is an optional<T>
1071 it acts like a pointer to an nframes64_t, with
1072 a operator conversion to boolean to check
1073 that it has a value could possibly use
1074 playhead_cursor->current_frame to store the
1075 value and a boolean in the class to know
1076 when it's out of date
1079 if (!_control_scroll_target) {
1080 _control_scroll_target = session->transport_frame();
1081 _dragging_playhead = true;
1084 if ((fraction < 0.0f) && (*_control_scroll_target < (nframes64_t) fabs(step))) {
1085 *_control_scroll_target = 0;
1086 } else if ((fraction > 0.0f) && (max_frames - *_control_scroll_target < step)) {
1087 *_control_scroll_target = max_frames - (current_page_frames()*2); // allow room for slop in where the PH is on the screen
1089 *_control_scroll_target += (nframes64_t) floor (step);
1092 /* move visuals, we'll catch up with it later */
1094 playhead_cursor->set_position (*_control_scroll_target);
1095 UpdateAllTransportClocks (*_control_scroll_target);
1097 if (*_control_scroll_target > (current_page_frames() / 2)) {
1098 /* try to center PH in window */
1099 reset_x_origin (*_control_scroll_target - (current_page_frames()/2));
1105 Now we do a timeout to actually bring the session to the right place
1106 according to the playhead. This is to avoid reading disk buffers on every
1107 call to control_scroll, which is driven by ScrollTimeline and therefore
1108 probably by a control surface wheel which can generate lots of events.
1110 /* cancel the existing timeout */
1112 control_scroll_connection.disconnect ();
1114 /* add the next timeout */
1116 control_scroll_connection = Glib::signal_timeout().connect (bind (mem_fun (*this, &Editor::deferred_control_scroll), *_control_scroll_target), 250);
1120 Editor::deferred_control_scroll (nframes64_t target)
1122 session->request_locate (*_control_scroll_target, session->transport_rolling());
1123 // reset for next stream
1124 _control_scroll_target = boost::none;
1125 _dragging_playhead = false;
1130 Editor::access_action (std::string action_group, std::string action_item)
1136 ENSURE_GUI_THREAD (bind (mem_fun (*this, &Editor::access_action), action_group, action_item));
1139 act = ActionManager::get_action( action_group.c_str(), action_item.c_str() );
1149 Editor::on_realize ()
1151 Window::on_realize ();
1156 Editor::start_scrolling ()
1158 scroll_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect
1159 (mem_fun(*this, &Editor::update_current_screen));
1164 Editor::stop_scrolling ()
1166 scroll_connection.disconnect ();
1170 Editor::map_position_change (nframes64_t frame)
1172 ENSURE_GUI_THREAD (bind (mem_fun(*this, &Editor::map_position_change), frame));
1174 if (session == 0 || !_follow_playhead) {
1178 center_screen (frame);
1179 playhead_cursor->set_position (frame);
1183 Editor::center_screen (nframes64_t frame)
1185 double page = _canvas_width * frames_per_unit;
1187 /* if we're off the page, then scroll.
1190 if (frame < leftmost_frame || frame >= leftmost_frame + page) {
1191 center_screen_internal (frame, page);
1196 Editor::center_screen_internal (nframes64_t frame, float page)
1201 frame -= (nframes64_t) page;
1206 reset_x_origin (frame);
1210 Editor::handle_new_duration ()
1216 ENSURE_GUI_THREAD (mem_fun (*this, &Editor::handle_new_duration));
1217 nframes64_t new_end = session->current_end_frame() + (nframes64_t) floorf (current_page_frames() * 0.10f);
1219 horizontal_adjustment.set_upper (new_end / frames_per_unit);
1220 horizontal_adjustment.set_page_size (current_page_frames()/frames_per_unit);
1222 if (horizontal_adjustment.get_value() + _canvas_width > horizontal_adjustment.get_upper()) {
1223 horizontal_adjustment.set_value (horizontal_adjustment.get_upper() - _canvas_width);
1225 //cerr << "Editor::handle_new_duration () called ha v:l:u:ps:lcf = " << horizontal_adjustment.get_value() << ":" << horizontal_adjustment.get_lower() << ":" << horizontal_adjustment.get_upper() << ":" << horizontal_adjustment.get_page_size() << ":" << endl;//DEBUG
1229 Editor::update_title_s (const string & snap_name)
1231 ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::update_title_s), snap_name));
1237 Editor::update_title ()
1239 ENSURE_GUI_THREAD (mem_fun(*this, &Editor::update_title));
1242 bool dirty = session->dirty();
1244 string session_name;
1246 if (session->snap_name() != session->name()) {
1247 session_name = session->snap_name();
1249 session_name = session->name();
1253 session_name = "*" + session_name;
1256 WindowTitle title(session_name);
1257 title += Glib::get_application_name();
1258 set_title (title.get_string());
1263 Editor::connect_to_session (Session *t)
1267 compute_fixed_ruler_scale ();
1269 /* there are never any selected regions at startup */
1271 sensitize_the_right_region_actions (false);
1273 XMLNode* node = ARDOUR_UI::instance()->editor_settings();
1276 /* catch up with the playhead */
1278 session->request_locate (playhead_cursor->current_frame);
1282 session->GoingAway.connect (mem_fun(*this, &Editor::session_going_away));
1283 session->history().Changed.connect (mem_fun (*this, &Editor::history_changed));
1285 /* These signals can all be emitted by a non-GUI thread. Therefore the
1286 handlers for them must not attempt to directly interact with the GUI,
1287 but use Gtkmm2ext::UI::instance()->call_slot();
1290 session_connections.push_back (session->TransportStateChange.connect (mem_fun(*this, &Editor::map_transport_state)));
1291 session_connections.push_back (session->PositionChanged.connect (mem_fun(*this, &Editor::map_position_change)));
1292 session_connections.push_back (session->RouteAdded.connect (mem_fun(*this, &Editor::handle_new_route)));
1293 session_connections.push_back (session->RegionsAdded.connect (mem_fun(*this, &Editor::handle_new_regions)));
1294 session_connections.push_back (session->RegionRemoved.connect (mem_fun(*this, &Editor::handle_region_removed)));
1295 session_connections.push_back (session->DurationChanged.connect (mem_fun(*this, &Editor::handle_new_duration)));
1296 session_connections.push_back (session->edit_group_added.connect (mem_fun(*this, &Editor::add_edit_group)));
1297 session_connections.push_back (session->edit_group_removed.connect (mem_fun(*this, &Editor::edit_groups_changed)));
1298 session_connections.push_back (session->NamedSelectionAdded.connect (mem_fun(*this, &Editor::handle_new_named_selection)));
1299 session_connections.push_back (session->NamedSelectionRemoved.connect (mem_fun(*this, &Editor::handle_new_named_selection)));
1300 session_connections.push_back (session->DirtyChanged.connect (mem_fun(*this, &Editor::update_title)));
1301 session_connections.push_back (session->StateSaved.connect (mem_fun(*this, &Editor::update_title_s)));
1302 session_connections.push_back (session->AskAboutPlaylistDeletion.connect (mem_fun(*this, &Editor::playlist_deletion_dialog)));
1303 session_connections.push_back (session->RegionHiddenChange.connect (mem_fun(*this, &Editor::region_hidden)));
1305 session_connections.push_back (session->SMPTEOffsetChanged.connect (mem_fun(*this, &Editor::update_just_smpte)));
1307 session_connections.push_back (session->tempo_map().StateChanged.connect (mem_fun(*this, &Editor::tempo_map_changed)));
1309 session_connections.push_back (session->Located.connect (mem_fun (*this, &Editor::located)));
1310 session_connections.push_back (session->config.ParameterChanged.connect (mem_fun (*this, &Editor::parameter_changed)));
1312 edit_groups_changed ();
1314 edit_point_clock.set_mode(AudioClock::BBT);
1315 edit_point_clock.set_session (session);
1316 zoom_range_clock.set_session (session);
1317 _playlist_selector->set_session (session);
1318 nudge_clock.set_session (session);
1319 if (Profile->get_sae()) {
1324 nframes_t pos = session->tempo_map().bbt_duration_at (0, bbt, 1);
1325 nudge_clock.set_mode(AudioClock::BBT);
1326 nudge_clock.set (pos, true, 0, AudioClock::BBT);
1329 nudge_clock.set (session->frame_rate() * 5, true, 0, AudioClock::SMPTE); // default of 5 seconds
1332 playhead_cursor->canvas_item.show ();
1334 if (rhythm_ferret) {
1335 rhythm_ferret->set_session (session);
1338 if (analysis_window != 0)
1339 analysis_window->set_session (session);
1341 Location* loc = session->locations()->auto_loop_location();
1343 loc = new Location (0, session->current_end_frame(), _("Loop"),(Location::Flags) (Location::IsAutoLoop | Location::IsHidden));
1344 if (loc->start() == loc->end()) {
1345 loc->set_end (loc->start() + 1);
1347 session->locations()->add (loc, false);
1348 session->set_auto_loop_location (loc);
1351 loc->set_name (_("Loop"));
1354 loc = session->locations()->auto_punch_location();
1356 loc = new Location (0, session->current_end_frame(), _("Punch"), (Location::Flags) (Location::IsAutoPunch | Location::IsHidden));
1357 if (loc->start() == loc->end()) {
1358 loc->set_end (loc->start() + 1);
1360 session->locations()->add (loc, false);
1361 session->set_auto_punch_location (loc);
1364 loc->set_name (_("Punch"));
1367 Config->map_parameters (mem_fun (*this, &Editor::parameter_changed));
1368 session->config.map_parameters (mem_fun (*this, &Editor::parameter_changed));
1370 session->StateSaved.connect (mem_fun(*this, &Editor::session_state_saved));
1372 refresh_location_display ();
1373 session->locations()->added.connect (mem_fun(*this, &Editor::add_new_location));
1374 session->locations()->removed.connect (mem_fun(*this, &Editor::location_gone));
1375 session->locations()->changed.connect (mem_fun(*this, &Editor::refresh_location_display));
1376 session->locations()->StateChanged.connect (mem_fun(*this, &Editor::refresh_location_display_s));
1377 session->locations()->end_location()->changed.connect (mem_fun(*this, &Editor::end_location_changed));
1380 sfbrowser->set_session (session);
1383 handle_new_duration ();
1385 redisplay_regions ();
1386 redisplay_named_selections ();
1387 redisplay_snapshots ();
1389 restore_ruler_visibility ();
1390 //tempo_map_changed (Change (0));
1391 session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
1393 initial_route_list_display ();
1395 for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
1396 (static_cast<TimeAxisView*>(*i))->set_samples_per_unit (frames_per_unit);
1401 /* don't show master bus in a new session */
1403 if (ARDOUR_UI::instance()->session_is_new ()) {
1405 TreeModel::Children rows = route_display_model->children();
1406 TreeModel::Children::iterator i;
1408 no_route_list_redisplay = true;
1410 for (i = rows.begin(); i != rows.end(); ++i) {
1411 TimeAxisView *tv = (*i)[route_display_columns.tv];
1412 RouteTimeAxisView *rtv;
1414 if ((rtv = dynamic_cast<RouteTimeAxisView*>(tv)) != 0) {
1415 if (rtv->route()->is_master()) {
1416 route_list_display.get_selection()->unselect (i);
1421 no_route_list_redisplay = false;
1422 redisplay_route_list ();
1425 switch (snap_type) {
1426 case SnapToRegionStart:
1427 case SnapToRegionEnd:
1428 case SnapToRegionSync:
1429 case SnapToRegionBoundary:
1430 build_region_boundary_cache ();
1437 /* register for undo history */
1438 session->register_with_memento_command_factory(_id, this);
1440 _summary->set_session (session);
1441 _group_tabs->set_session (session);
1447 Editor::build_cursors ()
1449 using namespace Gdk;
1451 Gdk::Color mbg ("#000000" ); /* Black */
1452 Gdk::Color mfg ("#0000ff" ); /* Blue. */
1455 RefPtr<Bitmap> source, mask;
1456 source = Bitmap::create (mag_bits, mag_width, mag_height);
1457 mask = Bitmap::create (magmask_bits, mag_width, mag_height);
1458 zoom_cursor = new Gdk::Cursor (source, mask, mfg, mbg, mag_x_hot, mag_y_hot);
1461 Gdk::Color fbg ("#ffffff" );
1462 Gdk::Color ffg ("#000000" );
1465 RefPtr<Bitmap> source, mask;
1467 source = Bitmap::create (fader_cursor_bits, fader_cursor_width, fader_cursor_height);
1468 mask = Bitmap::create (fader_cursor_mask_bits, fader_cursor_width, fader_cursor_height);
1469 fader_cursor = new Gdk::Cursor (source, mask, ffg, fbg, fader_cursor_x_hot, fader_cursor_y_hot);
1473 RefPtr<Bitmap> source, mask;
1474 source = Bitmap::create (speaker_cursor_bits, speaker_cursor_width, speaker_cursor_height);
1475 mask = Bitmap::create (speaker_cursor_mask_bits, speaker_cursor_width, speaker_cursor_height);
1476 speaker_cursor = new Gdk::Cursor (source, mask, ffg, fbg, speaker_cursor_x_hot, speaker_cursor_y_hot);
1480 RefPtr<Bitmap> bits;
1481 char pix[4] = { 0, 0, 0, 0 };
1482 bits = Bitmap::create (pix, 2, 2);
1484 transparent_cursor = new Gdk::Cursor (bits, bits, c, c, 0, 0);
1488 RefPtr<Bitmap> bits;
1489 char pix[4] = { 0, 0, 0, 0 };
1490 bits = Bitmap::create (pix, 2, 2);
1492 transparent_cursor = new Gdk::Cursor (bits, bits, c, c, 0, 0);
1496 grabber_cursor = new Gdk::Cursor (HAND2);
1499 Glib::RefPtr<Gdk::Pixbuf> grabber_edit_point_pixbuf (::get_icon ("grabber_edit_point"));
1500 grabber_edit_point_cursor = new Gdk::Cursor (Gdk::Display::get_default(), grabber_edit_point_pixbuf, 5, 17);
1503 cross_hair_cursor = new Gdk::Cursor (CROSSHAIR);
1504 trimmer_cursor = new Gdk::Cursor (SB_H_DOUBLE_ARROW);
1505 selector_cursor = new Gdk::Cursor (XTERM);
1506 time_fx_cursor = new Gdk::Cursor (SIZING);
1507 wait_cursor = new Gdk::Cursor (WATCH);
1508 timebar_cursor = new Gdk::Cursor(LEFT_PTR);
1509 midi_pencil_cursor = new Gdk::Cursor (PENCIL);
1510 midi_select_cursor = new Gdk::Cursor (CENTER_PTR);
1511 midi_resize_cursor = new Gdk::Cursor (SIZING);
1512 midi_erase_cursor = new Gdk::Cursor (DRAPED_BOX);
1515 /** Pop up a context menu for when the user clicks on a fade in or fade out */
1517 Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* item, ItemType item_type)
1519 using namespace Menu_Helpers;
1520 AudioRegionView* arv = static_cast<AudioRegionView*> (item->get_data ("regionview"));
1523 fatal << _("programming error: fade in canvas item has no regionview data pointer!") << endmsg;
1527 MenuList& items (fade_context_menu.items());
1531 switch (item_type) {
1533 case FadeInHandleItem:
1534 if (arv->audio_region()->fade_in_active()) {
1535 items.push_back (MenuElem (_("Deactivate"), bind (mem_fun (*this, &Editor::set_fade_in_active), false)));
1537 items.push_back (MenuElem (_("Activate"), bind (mem_fun (*this, &Editor::set_fade_in_active), true)));
1540 items.push_back (SeparatorElem());
1542 if (Profile->get_sae()) {
1543 items.push_back (MenuElem (_("Linear"), bind (mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::Linear)));
1544 items.push_back (MenuElem (_("Slowest"), bind (mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::Fast)));
1546 items.push_back (MenuElem (_("Linear"), bind (mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::Linear)));
1547 items.push_back (MenuElem (_("Slowest"), bind (mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::Fast)));
1548 items.push_back (MenuElem (_("Slow"), bind (mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::LogB)));
1549 items.push_back (MenuElem (_("Fast"), bind (mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::LogA)));
1550 items.push_back (MenuElem (_("Fastest"), bind (mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::Slow)));
1556 case FadeOutHandleItem:
1557 if (arv->audio_region()->fade_out_active()) {
1558 items.push_back (MenuElem (_("Deactivate"), bind (mem_fun (*this, &Editor::set_fade_out_active), false)));
1560 items.push_back (MenuElem (_("Activate"), bind (mem_fun (*this, &Editor::set_fade_out_active), true)));
1563 items.push_back (SeparatorElem());
1565 if (Profile->get_sae()) {
1566 items.push_back (MenuElem (_("Linear"), bind (mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Linear)));
1567 items.push_back (MenuElem (_("Slowest"), bind (mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Slow)));
1569 items.push_back (MenuElem (_("Linear"), bind (mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Linear)));
1570 items.push_back (MenuElem (_("Slowest"), bind (mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Slow)));
1571 items.push_back (MenuElem (_("Slow"), bind (mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::LogA)));
1572 items.push_back (MenuElem (_("Fast"), bind (mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::LogB)));
1573 items.push_back (MenuElem (_("Fastest"), bind (mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Fast)));
1579 fatal << _("programming error: ")
1580 << X_("non-fade canvas item passed to popup_fade_context_menu()")
1585 fade_context_menu.popup (button, time);
1589 Editor::popup_track_context_menu (int button, int32_t time, ItemType item_type, bool with_selection, nframes64_t frame)
1591 using namespace Menu_Helpers;
1592 Menu* (Editor::*build_menu_function)(nframes64_t);
1595 switch (item_type) {
1597 case RegionViewName:
1598 case RegionViewNameHighlight:
1599 if (with_selection) {
1600 build_menu_function = &Editor::build_track_selection_context_menu;
1602 build_menu_function = &Editor::build_track_region_context_menu;
1607 if (with_selection) {
1608 build_menu_function = &Editor::build_track_selection_context_menu;
1610 build_menu_function = &Editor::build_track_context_menu;
1614 case CrossfadeViewItem:
1615 build_menu_function = &Editor::build_track_crossfade_context_menu;
1619 if (clicked_routeview->get_diskstream()) {
1620 build_menu_function = &Editor::build_track_context_menu;
1622 build_menu_function = &Editor::build_track_bus_context_menu;
1627 /* probably shouldn't happen but if it does, we don't care */
1631 menu = (this->*build_menu_function)(frame);
1632 menu->set_name ("ArdourContextMenu");
1634 /* now handle specific situations */
1636 switch (item_type) {
1638 case RegionViewName:
1639 case RegionViewNameHighlight:
1640 if (!with_selection) {
1641 if (region_edit_menu_split_item) {
1642 if (clicked_regionview && clicked_regionview->region()->covers (get_preferred_edit_position())) {
1643 ActionManager::set_sensitive (ActionManager::edit_point_in_region_sensitive_actions, true);
1645 ActionManager::set_sensitive (ActionManager::edit_point_in_region_sensitive_actions, false);
1649 if (region_edit_menu_split_multichannel_item) {
1650 if (clicked_regionview && clicked_regionview->region().n_channels() > 1) {
1651 // GTK2FIX find the action, change its sensitivity
1652 // region_edit_menu_split_multichannel_item->set_sensitive (true);
1654 // GTK2FIX see above
1655 // region_edit_menu_split_multichannel_item->set_sensitive (false);
1664 case CrossfadeViewItem:
1671 /* probably shouldn't happen but if it does, we don't care */
1675 if (item_type != SelectionItem && clicked_routeview && clicked_routeview->audio_track()) {
1677 /* Bounce to disk */
1679 using namespace Menu_Helpers;
1680 MenuList& edit_items = menu->items();
1682 edit_items.push_back (SeparatorElem());
1684 switch (clicked_routeview->audio_track()->freeze_state()) {
1685 case AudioTrack::NoFreeze:
1686 edit_items.push_back (MenuElem (_("Freeze"), mem_fun(*this, &Editor::freeze_route)));
1689 case AudioTrack::Frozen:
1690 edit_items.push_back (MenuElem (_("Unfreeze"), mem_fun(*this, &Editor::unfreeze_route)));
1693 case AudioTrack::UnFrozen:
1694 edit_items.push_back (MenuElem (_("Freeze"), mem_fun(*this, &Editor::freeze_route)));
1700 if (item_type == StreamItem && clicked_routeview) {
1701 clicked_routeview->build_underlay_menu(menu);
1704 menu->popup (button, time);
1708 Editor::build_track_context_menu (nframes64_t ignored)
1710 using namespace Menu_Helpers;
1712 MenuList& edit_items = track_context_menu.items();
1715 add_dstream_context_items (edit_items);
1716 return &track_context_menu;
1720 Editor::build_track_bus_context_menu (nframes64_t ignored)
1722 using namespace Menu_Helpers;
1724 MenuList& edit_items = track_context_menu.items();
1727 add_bus_context_items (edit_items);
1728 return &track_context_menu;
1732 Editor::build_track_region_context_menu (nframes64_t frame)
1734 using namespace Menu_Helpers;
1735 MenuList& edit_items = track_region_context_menu.items();
1738 RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (clicked_axisview);
1741 boost::shared_ptr<Diskstream> ds;
1742 boost::shared_ptr<Playlist> pl;
1744 if ((ds = rtv->get_diskstream()) && ((pl = ds->playlist()))) {
1745 Playlist::RegionList* regions = pl->regions_at ((nframes64_t) floor ( (double)frame * ds->speed()));
1747 if (selection->regions.size() > 1) {
1748 // there's already a multiple selection: just add a
1749 // single region context menu that will act on all
1751 boost::shared_ptr<Region> dummy_region; // = NULL
1752 add_region_context_items (rtv->view(), dummy_region, edit_items);
1754 for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) {
1755 add_region_context_items (rtv->view(), (*i), edit_items);
1763 add_dstream_context_items (edit_items);
1765 return &track_region_context_menu;
1769 Editor::build_track_crossfade_context_menu (nframes64_t frame)
1771 using namespace Menu_Helpers;
1772 MenuList& edit_items = track_crossfade_context_menu.items();
1773 edit_items.clear ();
1775 AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*> (clicked_axisview);
1778 boost::shared_ptr<Diskstream> ds;
1779 boost::shared_ptr<Playlist> pl;
1780 boost::shared_ptr<AudioPlaylist> apl;
1782 if ((ds = atv->get_diskstream()) && ((pl = ds->playlist()) != 0) && ((apl = boost::dynamic_pointer_cast<AudioPlaylist> (pl)) != 0)) {
1784 Playlist::RegionList* regions = pl->regions_at (frame);
1785 AudioPlaylist::Crossfades xfades;
1787 apl->crossfades_at (frame, xfades);
1789 bool many = xfades.size() > 1;
1791 for (AudioPlaylist::Crossfades::iterator i = xfades.begin(); i != xfades.end(); ++i) {
1792 add_crossfade_context_items (atv->audio_view(), (*i), edit_items, many);
1795 if (selection->regions.size() > 1) {
1796 // there's already a multiple selection: just add a
1797 // single region context menu that will act on all
1799 boost::shared_ptr<Region> dummy_region; // = NULL
1800 add_region_context_items (atv->audio_view(), dummy_region, edit_items);
1802 for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) {
1803 add_region_context_items (atv->audio_view(), (*i), edit_items);
1810 add_dstream_context_items (edit_items);
1812 return &track_crossfade_context_menu;
1816 Editor::analyze_region_selection()
1818 if (analysis_window == 0) {
1819 analysis_window = new AnalysisWindow();
1822 analysis_window->set_session(session);
1824 analysis_window->show_all();
1827 analysis_window->set_regionmode();
1828 analysis_window->analyze();
1830 analysis_window->present();
1834 Editor::analyze_range_selection()
1836 if (analysis_window == 0) {
1837 analysis_window = new AnalysisWindow();
1840 analysis_window->set_session(session);
1842 analysis_window->show_all();
1845 analysis_window->set_rangemode();
1846 analysis_window->analyze();
1848 analysis_window->present();
1852 Editor::build_track_selection_context_menu (nframes64_t ignored)
1854 using namespace Menu_Helpers;
1855 MenuList& edit_items = track_selection_context_menu.items();
1856 edit_items.clear ();
1858 add_selection_context_items (edit_items);
1859 // edit_items.push_back (SeparatorElem());
1860 // add_dstream_context_items (edit_items);
1862 return &track_selection_context_menu;
1865 /** Add context menu items relevant to crossfades.
1866 * @param edit_items List to add the items to.
1869 Editor::add_crossfade_context_items (AudioStreamView* view, boost::shared_ptr<Crossfade> xfade, Menu_Helpers::MenuList& edit_items, bool many)
1871 using namespace Menu_Helpers;
1872 Menu *xfade_menu = manage (new Menu);
1873 MenuList& items = xfade_menu->items();
1874 xfade_menu->set_name ("ArdourContextMenu");
1877 if (xfade->active()) {
1883 items.push_back (MenuElem (str, bind (mem_fun(*this, &Editor::toggle_xfade_active), boost::weak_ptr<Crossfade> (xfade))));
1884 items.push_back (MenuElem (_("Edit"), bind (mem_fun(*this, &Editor::edit_xfade), boost::weak_ptr<Crossfade> (xfade))));
1886 if (xfade->can_follow_overlap()) {
1888 if (xfade->following_overlap()) {
1889 str = _("Convert to short");
1891 str = _("Convert to full");
1894 items.push_back (MenuElem (str, bind (mem_fun(*this, &Editor::toggle_xfade_length), xfade)));
1898 str = xfade->out()->name();
1900 str += xfade->in()->name();
1902 str = _("Crossfade");
1905 edit_items.push_back (MenuElem (str, *xfade_menu));
1906 edit_items.push_back (SeparatorElem());
1910 Editor::xfade_edit_left_region ()
1912 if (clicked_crossfadeview) {
1913 clicked_crossfadeview->left_view.show_region_editor ();
1918 Editor::xfade_edit_right_region ()
1920 if (clicked_crossfadeview) {
1921 clicked_crossfadeview->right_view.show_region_editor ();
1925 /** Add an element to a menu, settings its sensitivity.
1926 * @param m Menu to add to.
1927 * @param e Element to add.
1928 * @param s true to make sensitive, false to make insensitive
1931 Editor::add_item_with_sensitivity (Menu_Helpers::MenuList& m, Menu_Helpers::MenuElem e, bool s) const
1935 m.back().set_sensitive (false);
1940 Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> region, Menu_Helpers::MenuList& edit_items)
1942 using namespace Menu_Helpers;
1943 Gtk::MenuItem* foo_item;
1944 Menu *region_menu = manage (new Menu);
1945 MenuList& items = region_menu->items();
1946 region_menu->set_name ("ArdourContextMenu");
1948 boost::shared_ptr<AudioRegion> ar;
1949 boost::shared_ptr<MidiRegion> mr;
1952 ar = boost::dynamic_pointer_cast<AudioRegion> (region);
1953 mr = boost::dynamic_pointer_cast<MidiRegion> (region);
1955 /* when this particular menu pops up, make the relevant region
1959 region_menu->signal_map_event().connect (
1960 bind (mem_fun(*this, &Editor::set_selected_regionview_from_map_event), sv, boost::weak_ptr<Region>(region)));
1962 items.push_back (MenuElem (_("Rename"), mem_fun(*this, &Editor::rename_region)));
1963 items.push_back (MenuElem (_("Popup region editor"), mem_fun(*this, &Editor::edit_region)));
1966 items.push_back (MenuElem (_("Raise to top layer"), mem_fun(*this, &Editor::raise_region_to_top)));
1967 items.push_back (MenuElem (_("Lower to bottom layer"), mem_fun (*this, &Editor::lower_region_to_bottom)));
1968 items.push_back (SeparatorElem());
1969 items.push_back (MenuElem (_("Define sync point"), mem_fun(*this, &Editor::set_region_sync_from_edit_point)));
1970 items.push_back (MenuElem (_("Remove sync point"), mem_fun(*this, &Editor::remove_region_sync)));
1971 items.push_back (SeparatorElem());
1973 items.push_back (MenuElem (_("Audition"), mem_fun(*this, &Editor::play_selected_region)));
1974 items.push_back (MenuElem (_("Export"), mem_fun(*this, &Editor::export_region)));
1975 items.push_back (MenuElem (_("Bounce"), mem_fun(*this, &Editor::bounce_region_selection)));
1978 items.push_back (MenuElem (_("Spectral Analysis"), mem_fun(*this, &Editor::analyze_region_selection)));
1981 items.push_back (SeparatorElem());
1983 sigc::connection fooc;
1984 boost::shared_ptr<Region> region_to_check;
1987 region_to_check = region;
1989 region_to_check = selection->regions.front()->region();
1992 items.push_back (CheckMenuElem (_("Lock")));
1993 CheckMenuItem* region_lock_item = static_cast<CheckMenuItem*>(&items.back());
1994 if (region_to_check->locked()) {
1995 region_lock_item->set_active();
1997 region_lock_item->signal_activate().connect (mem_fun(*this, &Editor::toggle_region_lock));
1999 items.push_back (CheckMenuElem (_("Glue to Bars&Beats")));
2000 CheckMenuItem* bbt_glue_item = static_cast<CheckMenuItem*>(&items.back());
2002 switch (region_to_check->positional_lock_style()) {
2003 case Region::MusicTime:
2004 bbt_glue_item->set_active (true);
2007 bbt_glue_item->set_active (false);
2011 bbt_glue_item->signal_activate().connect (bind (mem_fun (*this, &Editor::set_region_lock_style), Region::MusicTime));
2013 items.push_back (CheckMenuElem (_("Mute")));
2014 CheckMenuItem* region_mute_item = static_cast<CheckMenuItem*>(&items.back());
2015 fooc = region_mute_item->signal_activate().connect (mem_fun(*this, &Editor::toggle_region_mute));
2016 if (region_to_check->muted()) {
2018 region_mute_item->set_active();
2022 if (!Profile->get_sae()) {
2023 items.push_back (CheckMenuElem (_("Opaque")));
2024 CheckMenuItem* region_opaque_item = static_cast<CheckMenuItem*>(&items.back());
2025 fooc = region_opaque_item->signal_activate().connect (mem_fun(*this, &Editor::toggle_region_opaque));
2026 if (region_to_check->opaque()) {
2028 region_opaque_item->set_active();
2033 items.push_back (CheckMenuElem (_("Original position"), mem_fun(*this, &Editor::naturalize)));
2034 if (region_to_check->at_natural_position()) {
2035 items.back().set_sensitive (false);
2038 items.push_back (SeparatorElem());
2042 RegionView* rv = sv->find_view (ar);
2043 AudioRegionView* arv = dynamic_cast<AudioRegionView*>(rv);
2045 if (!Profile->get_sae()) {
2046 items.push_back (MenuElem (_("Reset Envelope"), mem_fun(*this, &Editor::reset_region_gain_envelopes)));
2048 items.push_back (CheckMenuElem (_("Envelope Visible")));
2049 CheckMenuItem* region_envelope_visible_item = static_cast<CheckMenuItem*> (&items.back());
2050 fooc = region_envelope_visible_item->signal_activate().connect (mem_fun(*this, &Editor::toggle_gain_envelope_visibility));
2051 if (arv->envelope_visible()) {
2053 region_envelope_visible_item->set_active (true);
2057 items.push_back (CheckMenuElem (_("Envelope Active")));
2058 CheckMenuItem* region_envelope_active_item = static_cast<CheckMenuItem*> (&items.back());
2059 fooc = region_envelope_active_item->signal_activate().connect (mem_fun(*this, &Editor::toggle_gain_envelope_active));
2061 if (ar->envelope_active()) {
2063 region_envelope_active_item->set_active (true);
2067 items.push_back (SeparatorElem());
2070 if (ar->scale_amplitude() != 1.0f) {
2071 items.push_back (MenuElem (_("DeNormalize"), mem_fun(*this, &Editor::denormalize_region)));
2073 items.push_back (MenuElem (_("Normalize"), mem_fun(*this, &Editor::normalize_region)));
2077 items.push_back (MenuElem (_("Quantize"), mem_fun(*this, &Editor::quantize_region)));
2078 items.push_back (SeparatorElem());
2081 items.push_back (MenuElem (_("Strip silence..."), mem_fun (*this, &Editor::strip_region_silence)));
2082 items.push_back (MenuElem (_("Reverse"), mem_fun(*this, &Editor::reverse_region)));
2083 items.push_back (SeparatorElem());
2085 /* range related stuff */
2087 items.push_back (MenuElem (_("Add Single Range"), mem_fun (*this, &Editor::add_location_from_audio_region)));
2088 items.push_back (MenuElem (_("Add Range Markers"), mem_fun (*this, &Editor::add_locations_from_audio_region)));
2089 if (selection->regions.size() < 2) {
2090 items.back().set_sensitive (false);
2093 items.push_back (MenuElem (_("Set Range Selection"), mem_fun (*this, &Editor::set_selection_from_region)));
2094 items.push_back (SeparatorElem());
2098 Menu *nudge_menu = manage (new Menu());
2099 MenuList& nudge_items = nudge_menu->items();
2100 nudge_menu->set_name ("ArdourContextMenu");
2102 nudge_items.push_back (MenuElem (_("Nudge fwd"), (bind (mem_fun(*this, &Editor::nudge_forward), false, false))));
2103 nudge_items.push_back (MenuElem (_("Nudge bwd"), (bind (mem_fun(*this, &Editor::nudge_backward), false, false))));
2104 nudge_items.push_back (MenuElem (_("Nudge fwd by capture offset"), (mem_fun(*this, &Editor::nudge_forward_capture_offset))));
2105 nudge_items.push_back (MenuElem (_("Nudge bwd by capture offset"), (mem_fun(*this, &Editor::nudge_backward_capture_offset))));
2107 items.push_back (MenuElem (_("Nudge"), *nudge_menu));
2108 items.push_back (SeparatorElem());
2110 Menu *trim_menu = manage (new Menu);
2111 MenuList& trim_items = trim_menu->items();
2112 trim_menu->set_name ("ArdourContextMenu");
2114 trim_items.push_back (MenuElem (_("Start to edit point"), mem_fun(*this, &Editor::trim_region_from_edit_point)));
2115 foo_item = &trim_items.back();
2116 if (_edit_point == EditAtMouse) {
2117 foo_item->set_sensitive (false);
2119 trim_items.push_back (MenuElem (_("Edit point to end"), mem_fun(*this, &Editor::trim_region_to_edit_point)));
2120 foo_item = &trim_items.back();
2121 if (_edit_point == EditAtMouse) {
2122 foo_item->set_sensitive (false);
2124 trim_items.push_back (MenuElem (_("Trim To Loop"), mem_fun(*this, &Editor::trim_region_to_loop)));
2125 trim_items.push_back (MenuElem (_("Trim To Punch"), mem_fun(*this, &Editor::trim_region_to_punch)));
2127 items.push_back (MenuElem (_("Trim"), *trim_menu));
2128 items.push_back (SeparatorElem());
2130 items.push_back (MenuElem (_("Split"), (mem_fun(*this, &Editor::split_region))));
2131 region_edit_menu_split_item = &items.back();
2133 if (_edit_point == EditAtMouse) {
2134 region_edit_menu_split_item->set_sensitive (false);
2137 items.push_back (MenuElem (_("Make mono regions"), (mem_fun(*this, &Editor::split_multichannel_region))));
2138 region_edit_menu_split_multichannel_item = &items.back();
2140 items.push_back (MenuElem (_("Duplicate"), (bind (mem_fun(*this, &Editor::duplicate_dialog), false))));
2141 items.push_back (MenuElem (_("Multi-Duplicate"), (bind (mem_fun(*this, &Editor::duplicate_dialog), true))));
2142 items.push_back (MenuElem (_("Fill Track"), (mem_fun(*this, &Editor::region_fill_track))));
2143 items.push_back (SeparatorElem());
2144 items.push_back (MenuElem (_("Remove"), mem_fun(*this, &Editor::remove_selected_regions)));
2146 /* OK, stick the region submenu at the top of the list, and then add
2150 /* we have to hack up the region name because "_" has a special
2151 meaning for menu titles.
2154 string::size_type pos = 0;
2155 string menu_item_name = (region) ? region->name() : _("Selected regions");
2157 while ((pos = menu_item_name.find ("_", pos)) != string::npos) {
2158 menu_item_name.replace (pos, 1, "__");
2162 edit_items.push_back (MenuElem (menu_item_name, *region_menu));
2163 edit_items.push_back (SeparatorElem());
2166 /** Add context menu items relevant to selection ranges.
2167 * @param edit_items List to add the items to.
2170 Editor::add_selection_context_items (Menu_Helpers::MenuList& edit_items)
2172 using namespace Menu_Helpers;
2174 edit_items.push_back (MenuElem (_("Play range"), mem_fun(*this, &Editor::play_selection)));
2175 edit_items.push_back (MenuElem (_("Loop range"), bind (mem_fun(*this, &Editor::set_loop_from_selection), true)));
2177 edit_items.push_back (SeparatorElem());
2178 edit_items.push_back (MenuElem (_("Spectral Analysis"), mem_fun(*this, &Editor::analyze_range_selection)));
2180 edit_items.push_back (SeparatorElem());
2181 edit_items.push_back (MenuElem (_("Extend Range to End of Region"), bind (mem_fun(*this, &Editor::extend_selection_to_end_of_region), false)));
2182 edit_items.push_back (MenuElem (_("Extend Range to Start of Region"), bind (mem_fun(*this, &Editor::extend_selection_to_start_of_region), false)));
2184 edit_items.push_back (SeparatorElem());
2185 edit_items.push_back (MenuElem (_("Convert to region in-place"), mem_fun(*this, &Editor::separate_region_from_selection)));
2186 edit_items.push_back (MenuElem (_("Convert to region in region list"), mem_fun(*this, &Editor::new_region_from_selection)));
2188 edit_items.push_back (SeparatorElem());
2189 edit_items.push_back (MenuElem (_("Select all in range"), mem_fun(*this, &Editor::select_all_selectables_using_time_selection)));
2191 edit_items.push_back (SeparatorElem());
2192 edit_items.push_back (MenuElem (_("Set loop from selection"), bind (mem_fun(*this, &Editor::set_loop_from_selection), false)));
2193 edit_items.push_back (MenuElem (_("Set punch from selection"), mem_fun(*this, &Editor::set_punch_from_selection)));
2195 edit_items.push_back (SeparatorElem());
2196 edit_items.push_back (MenuElem (_("Add Range Markers"), mem_fun (*this, &Editor::add_location_from_selection)));
2197 edit_items.push_back (SeparatorElem());
2198 edit_items.push_back (MenuElem (_("Crop region to range"), mem_fun(*this, &Editor::crop_region_to_selection)));
2199 edit_items.push_back (MenuElem (_("Fill range with region"), mem_fun(*this, &Editor::region_fill_selection)));
2200 edit_items.push_back (MenuElem (_("Duplicate range"), bind (mem_fun(*this, &Editor::duplicate_dialog), false)));
2201 edit_items.push_back (MenuElem (_("Create chunk from range"), mem_fun(*this, &Editor::create_named_selection)));
2202 edit_items.push_back (SeparatorElem());
2203 edit_items.push_back (MenuElem (_("Consolidate range"), bind (mem_fun(*this, &Editor::bounce_range_selection), true, false)));
2204 edit_items.push_back (MenuElem (_("Consolidate range with processing"), bind (mem_fun(*this, &Editor::bounce_range_selection), true, true)));
2205 edit_items.push_back (MenuElem (_("Bounce range to region list"), bind (mem_fun(*this, &Editor::bounce_range_selection), false, false)));
2206 edit_items.push_back (MenuElem (_("Bounce range to region list with processing"), bind (mem_fun(*this, &Editor::bounce_range_selection), false, true)));
2207 edit_items.push_back (MenuElem (_("Export range"), mem_fun(*this, &Editor::export_range)));
2212 Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items)
2214 using namespace Menu_Helpers;
2218 Menu *play_menu = manage (new Menu);
2219 MenuList& play_items = play_menu->items();
2220 play_menu->set_name ("ArdourContextMenu");
2222 play_items.push_back (MenuElem (_("Play from edit point"), mem_fun(*this, &Editor::play_from_edit_point)));
2223 play_items.push_back (MenuElem (_("Play from start"), mem_fun(*this, &Editor::play_from_start)));
2224 play_items.push_back (MenuElem (_("Play region"), mem_fun(*this, &Editor::play_selected_region)));
2225 play_items.push_back (SeparatorElem());
2226 play_items.push_back (MenuElem (_("Loop Region"), mem_fun(*this, &Editor::loop_selected_region)));
2228 edit_items.push_back (MenuElem (_("Play"), *play_menu));
2232 Menu *select_menu = manage (new Menu);
2233 MenuList& select_items = select_menu->items();
2234 select_menu->set_name ("ArdourContextMenu");
2236 select_items.push_back (MenuElem (_("Select All in track"), bind (mem_fun(*this, &Editor::select_all_in_track), Selection::Set)));
2237 select_items.push_back (MenuElem (_("Select All"), bind (mem_fun(*this, &Editor::select_all), Selection::Set)));
2238 select_items.push_back (MenuElem (_("Invert selection in track"), mem_fun(*this, &Editor::invert_selection_in_track)));
2239 select_items.push_back (MenuElem (_("Invert selection"), mem_fun(*this, &Editor::invert_selection)));
2240 select_items.push_back (SeparatorElem());
2241 select_items.push_back (MenuElem (_("Set range to loop range"), mem_fun(*this, &Editor::set_selection_from_loop)));
2242 select_items.push_back (MenuElem (_("Set range to punch range"), mem_fun(*this, &Editor::set_selection_from_punch)));
2243 select_items.push_back (SeparatorElem());
2244 select_items.push_back (MenuElem (_("Select All After Edit Point"), bind (mem_fun(*this, &Editor::select_all_selectables_using_edit), true)));
2245 select_items.push_back (MenuElem (_("Select All Before Edit Point"), bind (mem_fun(*this, &Editor::select_all_selectables_using_edit), false)));
2246 select_items.push_back (MenuElem (_("Select All After Playhead"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, true)));
2247 select_items.push_back (MenuElem (_("Select All Before Playhead"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, false)));
2248 select_items.push_back (MenuElem (_("Select All Between Playhead & Edit Point"), bind (mem_fun(*this, &Editor::select_all_selectables_between), false)));
2249 select_items.push_back (MenuElem (_("Select All Within Playhead & Edit Point"), bind (mem_fun(*this, &Editor::select_all_selectables_between), true)));
2250 select_items.push_back (MenuElem (_("Select Range Between Playhead & Edit Point"), mem_fun(*this, &Editor::select_range_between)));
2252 select_items.push_back (SeparatorElem());
2254 edit_items.push_back (MenuElem (_("Select"), *select_menu));
2258 Menu *cutnpaste_menu = manage (new Menu);
2259 MenuList& cutnpaste_items = cutnpaste_menu->items();
2260 cutnpaste_menu->set_name ("ArdourContextMenu");
2262 cutnpaste_items.push_back (MenuElem (_("Cut"), mem_fun(*this, &Editor::cut)));
2263 cutnpaste_items.push_back (MenuElem (_("Copy"), mem_fun(*this, &Editor::copy)));
2264 cutnpaste_items.push_back (MenuElem (_("Paste"), bind (mem_fun(*this, &Editor::paste), 1.0f)));
2266 cutnpaste_items.push_back (SeparatorElem());
2268 cutnpaste_items.push_back (MenuElem (_("Align"), bind (mem_fun(*this, &Editor::align), ARDOUR::SyncPoint)));
2269 cutnpaste_items.push_back (MenuElem (_("Align Relative"), bind (mem_fun(*this, &Editor::align_relative), ARDOUR::SyncPoint)));
2271 cutnpaste_items.push_back (SeparatorElem());
2273 cutnpaste_items.push_back (MenuElem (_("Insert chunk"), bind (mem_fun(*this, &Editor::paste_named_selection), 1.0f)));
2275 edit_items.push_back (MenuElem (_("Edit"), *cutnpaste_menu));
2277 /* Adding new material */
2279 edit_items.push_back (SeparatorElem());
2280 edit_items.push_back (MenuElem (_("Insert Selected Region"), bind (mem_fun(*this, &Editor::insert_region_list_selection), 1.0f)));
2281 edit_items.push_back (MenuElem (_("Insert Existing Media"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportToTrack)));
2285 Menu *nudge_menu = manage (new Menu());
2286 MenuList& nudge_items = nudge_menu->items();
2287 nudge_menu->set_name ("ArdourContextMenu");
2289 edit_items.push_back (SeparatorElem());
2290 nudge_items.push_back (MenuElem (_("Nudge entire track fwd"), (bind (mem_fun(*this, &Editor::nudge_track), false, true))));
2291 nudge_items.push_back (MenuElem (_("Nudge track after edit point fwd"), (bind (mem_fun(*this, &Editor::nudge_track), true, true))));
2292 nudge_items.push_back (MenuElem (_("Nudge entire track bwd"), (bind (mem_fun(*this, &Editor::nudge_track), false, false))));
2293 nudge_items.push_back (MenuElem (_("Nudge track after edit point bwd"), (bind (mem_fun(*this, &Editor::nudge_track), true, false))));
2295 edit_items.push_back (MenuElem (_("Nudge"), *nudge_menu));
2299 Editor::add_bus_context_items (Menu_Helpers::MenuList& edit_items)
2301 using namespace Menu_Helpers;
2305 Menu *play_menu = manage (new Menu);
2306 MenuList& play_items = play_menu->items();
2307 play_menu->set_name ("ArdourContextMenu");
2309 play_items.push_back (MenuElem (_("Play from edit point"), mem_fun(*this, &Editor::play_from_edit_point)));
2310 play_items.push_back (MenuElem (_("Play from start"), mem_fun(*this, &Editor::play_from_start)));
2311 edit_items.push_back (MenuElem (_("Play"), *play_menu));
2315 Menu *select_menu = manage (new Menu);
2316 MenuList& select_items = select_menu->items();
2317 select_menu->set_name ("ArdourContextMenu");
2319 select_items.push_back (MenuElem (_("Select All in track"), bind (mem_fun(*this, &Editor::select_all_in_track), Selection::Set)));
2320 select_items.push_back (MenuElem (_("Select All"), bind (mem_fun(*this, &Editor::select_all), Selection::Set)));
2321 select_items.push_back (MenuElem (_("Invert selection in track"), mem_fun(*this, &Editor::invert_selection_in_track)));
2322 select_items.push_back (MenuElem (_("Invert selection"), mem_fun(*this, &Editor::invert_selection)));
2323 select_items.push_back (SeparatorElem());
2324 select_items.push_back (MenuElem (_("Select all after edit point"), bind (mem_fun(*this, &Editor::select_all_selectables_using_edit), true)));
2325 select_items.push_back (MenuElem (_("Select all before edit point"), bind (mem_fun(*this, &Editor::select_all_selectables_using_edit), false)));
2326 select_items.push_back (MenuElem (_("Select all after playhead"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, true)));
2327 select_items.push_back (MenuElem (_("Select all before playhead"), bind (mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, false)));
2329 edit_items.push_back (MenuElem (_("Select"), *select_menu));
2333 Menu *cutnpaste_menu = manage (new Menu);
2334 MenuList& cutnpaste_items = cutnpaste_menu->items();
2335 cutnpaste_menu->set_name ("ArdourContextMenu");
2337 cutnpaste_items.push_back (MenuElem (_("Cut"), mem_fun(*this, &Editor::cut)));
2338 cutnpaste_items.push_back (MenuElem (_("Copy"), mem_fun(*this, &Editor::copy)));
2339 cutnpaste_items.push_back (MenuElem (_("Paste"), bind (mem_fun(*this, &Editor::paste), 1.0f)));
2341 Menu *nudge_menu = manage (new Menu());
2342 MenuList& nudge_items = nudge_menu->items();
2343 nudge_menu->set_name ("ArdourContextMenu");
2345 edit_items.push_back (SeparatorElem());
2346 nudge_items.push_back (MenuElem (_("Nudge entire track fwd"), (bind (mem_fun(*this, &Editor::nudge_track), false, true))));
2347 nudge_items.push_back (MenuElem (_("Nudge track after edit point fwd"), (bind (mem_fun(*this, &Editor::nudge_track), true, true))));
2348 nudge_items.push_back (MenuElem (_("Nudge entire track bwd"), (bind (mem_fun(*this, &Editor::nudge_track), false, false))));
2349 nudge_items.push_back (MenuElem (_("Nudge track after edit point bwd"), (bind (mem_fun(*this, &Editor::nudge_track), true, false))));
2351 edit_items.push_back (MenuElem (_("Nudge"), *nudge_menu));
2355 Editor::set_snap_to (SnapType st)
2357 unsigned int snap_ind = (unsigned int)st;
2361 if (snap_ind > snap_type_strings.size() - 1) {
2363 snap_type = (SnapType)snap_ind;
2366 string str = snap_type_strings[snap_ind];
2368 if (str != snap_type_selector.get_active_text()) {
2369 snap_type_selector.set_active_text (str);
2374 switch (snap_type) {
2375 case SnapToAThirtysecondBeat:
2376 case SnapToASixteenthBeat:
2377 case SnapToAEighthBeat:
2378 case SnapToAQuarterBeat:
2379 case SnapToAThirdBeat:
2380 compute_bbt_ruler_scale (leftmost_frame, leftmost_frame + current_page_frames());
2381 update_tempo_based_rulers ();
2384 case SnapToRegionStart:
2385 case SnapToRegionEnd:
2386 case SnapToRegionSync:
2387 case SnapToRegionBoundary:
2388 build_region_boundary_cache ();
2398 Editor::set_snap_mode (SnapMode mode)
2401 string str = snap_mode_strings[(int)mode];
2403 if (str != snap_mode_selector.get_active_text ()) {
2404 snap_mode_selector.set_active_text (str);
2410 Editor::set_edit_point_preference (EditPoint ep, bool force)
2412 bool changed = (_edit_point != ep);
2415 string str = edit_point_strings[(int)ep];
2417 if (str != edit_point_selector.get_active_text ()) {
2418 edit_point_selector.set_active_text (str);
2421 set_canvas_cursor ();
2423 if (!force && !changed) {
2427 switch (zoom_focus) {
2428 case ZoomFocusMouse:
2429 case ZoomFocusPlayhead:
2431 switch (_edit_point) {
2433 set_zoom_focus (ZoomFocusMouse);
2435 case EditAtPlayhead:
2436 set_zoom_focus (ZoomFocusPlayhead);
2438 case EditAtSelectedMarker:
2439 set_zoom_focus (ZoomFocusEdit);
2447 const char* action=NULL;
2449 switch (_edit_point) {
2450 case EditAtPlayhead:
2451 action = "edit-at-playhead";
2453 case EditAtSelectedMarker:
2454 action = "edit-at-marker";
2457 action = "edit-at-mouse";
2461 Glib::RefPtr<Action> act = ActionManager::get_action ("Editor", action);
2463 Glib::RefPtr<RadioAction>::cast_dynamic(act)->set_active (true);
2467 bool in_track_canvas;
2469 if (!mouse_frame (foo, in_track_canvas)) {
2470 in_track_canvas = false;
2473 reset_canvas_action_sensitivity (in_track_canvas);
2479 Editor::set_state (const XMLNode& node)
2481 const XMLProperty* prop;
2483 int x, y, xoff, yoff;
2486 if ((prop = node.property ("id")) != 0) {
2487 _id = prop->value ();
2490 g.base_width = default_width;
2491 g.base_height = default_height;
2497 if ((geometry = find_named_node (node, "geometry")) != 0) {
2501 if ((prop = geometry->property("x_size")) == 0) {
2502 prop = geometry->property ("x-size");
2505 g.base_width = atoi(prop->value());
2507 if ((prop = geometry->property("y_size")) == 0) {
2508 prop = geometry->property ("y-size");
2511 g.base_height = atoi(prop->value());
2514 if ((prop = geometry->property ("x_pos")) == 0) {
2515 prop = geometry->property ("x-pos");
2518 x = atoi (prop->value());
2521 if ((prop = geometry->property ("y_pos")) == 0) {
2522 prop = geometry->property ("y-pos");
2525 y = atoi (prop->value());
2528 if ((prop = geometry->property ("x_off")) == 0) {
2529 prop = geometry->property ("x-off");
2532 xoff = atoi (prop->value());
2534 if ((prop = geometry->property ("y_off")) == 0) {
2535 prop = geometry->property ("y-off");
2538 yoff = atoi (prop->value());
2542 set_default_size (g.base_width, g.base_height);
2545 if (session && (prop = node.property ("playhead"))) {
2546 nframes64_t pos = atol (prop->value().c_str());
2547 playhead_cursor->set_position (pos);
2549 playhead_cursor->set_position (0);
2551 /* reset_x_origin() doesn't work right here, since the old
2552 position may be zero already, and it does nothing in such
2557 horizontal_adjustment.set_value (0);
2560 if ((prop = node.property ("mixer-width"))) {
2561 editor_mixer_strip_width = Width (string_2_enum (prop->value(), editor_mixer_strip_width));
2564 if ((prop = node.property ("zoom-focus"))) {
2565 set_zoom_focus ((ZoomFocus) atoi (prop->value()));
2568 if ((prop = node.property ("zoom"))) {
2569 reset_zoom (PBD::atof (prop->value()));
2572 if ((prop = node.property ("snap-to"))) {
2573 set_snap_to ((SnapType) atoi (prop->value()));
2576 if ((prop = node.property ("snap-mode"))) {
2577 set_snap_mode ((SnapMode) atoi (prop->value()));
2580 if ((prop = node.property ("edit-point"))) {
2581 set_edit_point_preference ((EditPoint) string_2_enum (prop->value(), _edit_point), true);
2584 if ((prop = node.property ("mouse-mode"))) {
2585 MouseMode m = str2mousemode(prop->value());
2586 mouse_mode = MouseMode ((int) m + 1); /* lie, force mode switch */
2587 set_mouse_mode (m, true);
2589 mouse_mode = MouseGain; /* lie, to force the mode switch */
2590 set_mouse_mode (MouseObject, true);
2593 if ((prop = node.property ("show-waveforms-recording"))) {
2594 bool yn = (prop->value() == "yes");
2595 _show_waveforms_recording = !yn;
2596 RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformsWhileRecording"));
2598 RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
2599 /* do it twice to force the change */
2600 tact->set_active (!yn);
2601 tact->set_active (yn);
2605 if ((prop = node.property ("show-measures"))) {
2606 bool yn = (prop->value() == "yes");
2607 _show_measures = !yn;
2608 RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleMeasureVisibility"));
2610 RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
2611 /* do it twice to force the change */
2612 tact->set_active (!yn);
2613 tact->set_active (yn);
2617 if ((prop = node.property ("follow-playhead"))) {
2618 bool yn = (prop->value() == "yes");
2619 set_follow_playhead (yn);
2620 RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-follow-playhead"));
2622 RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
2623 if (tact->get_active() != yn) {
2624 tact->set_active (yn);
2629 if ((prop = node.property ("region-list-sort-type"))) {
2630 region_list_sort_type = (Editing::RegionListSortType) -1; // force change
2631 reset_region_list_sort_type(str2regionlistsorttype(prop->value()));
2634 if ((prop = node.property ("xfades-visible"))) {
2635 bool yn = (prop->value() == "yes");
2636 _xfade_visibility = !yn;
2637 // set_xfade_visibility (yn);
2640 if ((prop = node.property ("show-editor-mixer"))) {
2642 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer"));
2645 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2646 bool yn = (prop->value() == X_("yes"));
2648 /* do it twice to force the change */
2650 tact->set_active (!yn);
2651 tact->set_active (yn);
2655 if ((prop = node.property ("show-editor-list"))) {
2657 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-list"));
2661 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2662 bool yn = (prop->value() == X_("yes"));
2664 /* do it twice to force the change */
2666 tact->set_active (!yn);
2667 tact->set_active (yn);
2676 Editor::get_state ()
2678 XMLNode* node = new XMLNode ("Editor");
2681 _id.print (buf, sizeof (buf));
2682 node->add_property ("id", buf);
2684 if (is_realized()) {
2685 Glib::RefPtr<Gdk::Window> win = get_window();
2687 int x, y, xoff, yoff, width, height;
2688 win->get_root_origin(x, y);
2689 win->get_position(xoff, yoff);
2690 win->get_size(width, height);
2692 XMLNode* geometry = new XMLNode ("geometry");
2694 snprintf(buf, sizeof(buf), "%d", width);
2695 geometry->add_property("x-size", string(buf));
2696 snprintf(buf, sizeof(buf), "%d", height);
2697 geometry->add_property("y-size", string(buf));
2698 snprintf(buf, sizeof(buf), "%d", x);
2699 geometry->add_property("x-pos", string(buf));
2700 snprintf(buf, sizeof(buf), "%d", y);
2701 geometry->add_property("y-pos", string(buf));
2702 snprintf(buf, sizeof(buf), "%d", xoff);
2703 geometry->add_property("x-off", string(buf));
2704 snprintf(buf, sizeof(buf), "%d", yoff);
2705 geometry->add_property("y-off", string(buf));
2706 snprintf(buf,sizeof(buf), "%d",gtk_paned_get_position (static_cast<Paned*>(&edit_pane)->gobj()));
2707 geometry->add_property("edit_pane_pos", string(buf));
2709 node->add_child_nocopy (*geometry);
2712 maybe_add_mixer_strip_width (*node);
2714 snprintf (buf, sizeof(buf), "%d", (int) zoom_focus);
2715 node->add_property ("zoom-focus", buf);
2716 snprintf (buf, sizeof(buf), "%f", frames_per_unit);
2717 node->add_property ("zoom", buf);
2718 snprintf (buf, sizeof(buf), "%d", (int) snap_type);
2719 node->add_property ("snap-to", buf);
2720 snprintf (buf, sizeof(buf), "%d", (int) snap_mode);
2721 node->add_property ("snap-mode", buf);
2723 node->add_property ("edit-point", enum_2_string (_edit_point));
2725 snprintf (buf, sizeof (buf), "%" PRIi64, playhead_cursor->current_frame);
2726 node->add_property ("playhead", buf);
2728 node->add_property ("show-waveforms-recording", _show_waveforms_recording ? "yes" : "no");
2729 node->add_property ("show-measures", _show_measures ? "yes" : "no");
2730 node->add_property ("follow-playhead", _follow_playhead ? "yes" : "no");
2731 node->add_property ("xfades-visible", _xfade_visibility ? "yes" : "no");
2732 node->add_property ("region-list-sort-type", enum2str(region_list_sort_type));
2733 node->add_property ("mouse-mode", enum2str(mouse_mode));
2735 Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("show-editor-mixer"));
2737 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2738 node->add_property (X_("show-editor-mixer"), tact->get_active() ? "yes" : "no");
2741 act = ActionManager::get_action (X_("Editor"), X_("show-editor-list"));
2743 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
2744 node->add_property (X_("show-editor-list"), tact->get_active() ? "yes" : "no");
2752 /** @param y y offset from the top of all trackviews.
2753 * @return pair: TimeAxisView that y is over, layer index.
2754 * TimeAxisView may be 0. Layer index is the layer number if the TimeAxisView is valid and is
2755 * in stacked region display mode, otherwise 0.
2757 std::pair<TimeAxisView *, layer_t>
2758 Editor::trackview_by_y_position (double y)
2760 for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
2762 std::pair<TimeAxisView*, int> const r = (*iter)->covers_y_position (y);
2768 return std::make_pair ( (TimeAxisView *) 0, 0);
2772 Editor::snap_to (nframes64_t& start, int32_t direction, bool for_mark)
2774 if (!session || snap_mode == SnapOff) {
2778 snap_to_internal (start, direction, for_mark);
2782 Editor::snap_to_internal (nframes64_t& start, int32_t direction, bool for_mark)
2784 Location* before = 0;
2785 Location* after = 0;
2787 const nframes64_t one_second = session->frame_rate();
2788 const nframes64_t one_minute = session->frame_rate() * 60;
2789 const nframes64_t one_smpte_second = (nframes64_t)(rint(session->smpte_frames_per_second()) * session->frames_per_smpte_frame());
2790 nframes64_t one_smpte_minute = (nframes64_t)(rint(session->smpte_frames_per_second()) * session->frames_per_smpte_frame() * 60);
2791 nframes64_t presnap = start;
2793 switch (snap_type) {
2795 if (((direction == 0) && (start % (one_second/75) > (one_second/75) / 2)) || (direction > 0)) {
2796 start = (nframes64_t) ceil ((double) start / (one_second / 75)) * (one_second / 75);
2798 start = (nframes64_t) floor ((double) start / (one_second / 75)) * (one_second / 75);
2802 case SnapToSMPTEFrame:
2803 if (((direction == 0) && (fmod((double)start, (double)session->frames_per_smpte_frame()) > (session->frames_per_smpte_frame() / 2))) || (direction > 0)) {
2804 start = (nframes64_t) (ceil ((double) start / session->frames_per_smpte_frame()) * session->frames_per_smpte_frame());
2806 start = (nframes64_t) (floor ((double) start / session->frames_per_smpte_frame()) * session->frames_per_smpte_frame());
2810 case SnapToSMPTESeconds:
2811 if (session->smpte_offset_negative())
2813 start += session->smpte_offset ();
2815 start -= session->smpte_offset ();
2817 if (((direction == 0) && (start % one_smpte_second > one_smpte_second / 2)) || direction > 0) {
2818 start = (nframes64_t) ceil ((double) start / one_smpte_second) * one_smpte_second;
2820 start = (nframes64_t) floor ((double) start / one_smpte_second) * one_smpte_second;
2823 if (session->smpte_offset_negative())
2825 start -= session->smpte_offset ();
2827 start += session->smpte_offset ();
2831 case SnapToSMPTEMinutes:
2832 if (session->smpte_offset_negative())
2834 start += session->smpte_offset ();
2836 start -= session->smpte_offset ();
2838 if (((direction == 0) && (start % one_smpte_minute > one_smpte_minute / 2)) || direction > 0) {
2839 start = (nframes64_t) ceil ((double) start / one_smpte_minute) * one_smpte_minute;
2841 start = (nframes64_t) floor ((double) start / one_smpte_minute) * one_smpte_minute;
2843 if (session->smpte_offset_negative())
2845 start -= session->smpte_offset ();
2847 start += session->smpte_offset ();
2852 if (((direction == 0) && (start % one_second > one_second / 2)) || (direction > 0)) {
2853 start = (nframes64_t) ceil ((double) start / one_second) * one_second;
2855 start = (nframes64_t) floor ((double) start / one_second) * one_second;
2860 if (((direction == 0) && (start % one_minute > one_minute / 2)) || (direction > 0)) {
2861 start = (nframes64_t) ceil ((double) start / one_minute) * one_minute;
2863 start = (nframes64_t) floor ((double) start / one_minute) * one_minute;
2868 start = session->tempo_map().round_to_bar (start, direction);
2872 start = session->tempo_map().round_to_beat (start, direction);
2875 case SnapToAThirtysecondBeat:
2876 start = session->tempo_map().round_to_beat_subdivision (start, 32);
2879 case SnapToASixteenthBeat:
2880 start = session->tempo_map().round_to_beat_subdivision (start, 16);
2883 case SnapToAEighthBeat:
2884 start = session->tempo_map().round_to_beat_subdivision (start, 8);
2887 case SnapToAQuarterBeat:
2888 start = session->tempo_map().round_to_beat_subdivision (start, 4);
2891 case SnapToAThirdBeat:
2892 start = session->tempo_map().round_to_beat_subdivision (start, 3);
2900 before = session->locations()->first_location_before (start);
2901 after = session->locations()->first_location_after (start);
2903 if (direction < 0) {
2905 start = before->start();
2909 } else if (direction > 0) {
2911 start = after->start();
2913 start = session->current_end_frame();
2918 /* find nearest of the two */
2919 if ((start - before->start()) < (after->start() - start)) {
2920 start = before->start();
2922 start = after->start();
2925 start = before->start();
2928 start = after->start();
2935 case SnapToRegionStart:
2936 case SnapToRegionEnd:
2937 case SnapToRegionSync:
2938 case SnapToRegionBoundary:
2939 if (!region_boundary_cache.empty()) {
2940 vector<nframes64_t>::iterator i;
2942 if (direction > 0) {
2943 i = std::upper_bound (region_boundary_cache.begin(), region_boundary_cache.end(), start);
2945 i = std::lower_bound (region_boundary_cache.begin(), region_boundary_cache.end(), start);
2948 if (i != region_boundary_cache.end()) {
2950 /* lower bound doesn't quite to the right thing for our purposes */
2952 if (direction < 0 && i != region_boundary_cache.begin()) {
2959 start = region_boundary_cache.back();
2965 switch (snap_mode) {
2971 if (presnap > start) {
2972 if (presnap > (start + unit_to_frame(snap_threshold))) {
2976 } else if (presnap < start) {
2977 if (presnap < (start - unit_to_frame(snap_threshold))) {
2983 /* handled at entry */
2990 Editor::snap_length_beats (nframes64_t start)
2996 /* FIXME: This could/should also work with non-tempo based snap settings (ie seconds) */
2998 switch (snap_type) {
3000 return session->tempo_map().meter_at(start).beats_per_bar();
3005 case SnapToAThirtysecondBeat:
3006 return 1.0 / (double)32.0;
3009 case SnapToASixteenthBeat:
3010 return 1.0 / (double)16.0;
3013 case SnapToAEighthBeat:
3014 return 1.0 / (double)8.0;
3017 case SnapToAQuarterBeat:
3018 return 1.0 / (double)4.0;
3021 case SnapToAThirdBeat:
3022 return 1.0 / (double)3.0;
3030 Editor::setup_toolbar ()
3034 /* Mode Buttons (tool selection) */
3036 vector<ToggleButton *> mouse_mode_buttons;
3038 mouse_move_button.add (*(manage (new Image (::get_icon("tool_object")))));
3039 mouse_move_button.set_relief(Gtk::RELIEF_NONE);
3040 mouse_mode_buttons.push_back (&mouse_move_button);
3042 if (!Profile->get_sae()) {
3043 mouse_select_button.add (*(manage (new Image (get_xpm("tool_range.xpm")))));
3044 mouse_select_button.set_relief(Gtk::RELIEF_NONE);
3045 mouse_mode_buttons.push_back (&mouse_select_button);
3047 mouse_gain_button.add (*(manage (new Image (::get_icon("tool_gain")))));
3048 mouse_gain_button.set_relief(Gtk::RELIEF_NONE);
3049 mouse_mode_buttons.push_back (&mouse_gain_button);
3052 mouse_zoom_button.add (*(manage (new Image (::get_icon("tool_zoom")))));
3053 mouse_zoom_button.set_relief(Gtk::RELIEF_NONE);
3054 mouse_mode_buttons.push_back (&mouse_zoom_button);
3055 mouse_timefx_button.add (*(manage (new Image (::get_icon("tool_stretch")))));
3056 mouse_timefx_button.set_relief(Gtk::RELIEF_NONE);
3057 mouse_mode_buttons.push_back (&mouse_timefx_button);
3058 mouse_audition_button.add (*(manage (new Image (::get_icon("tool_audition")))));
3059 mouse_audition_button.set_relief(Gtk::RELIEF_NONE);
3060 mouse_note_button.add (*(manage (new Image (::get_icon("tool_note")))));
3061 mouse_note_button.set_relief(Gtk::RELIEF_NONE);
3062 mouse_mode_buttons.push_back (&mouse_note_button);
3063 mouse_mode_buttons.push_back (&mouse_audition_button);
3065 mouse_mode_button_set = new GroupedButtons (mouse_mode_buttons);
3067 HBox* mode_box = manage(new HBox);
3068 mode_box->set_border_width (2);
3069 mode_box->set_spacing(4);
3070 mouse_mode_button_box.set_spacing(1);
3071 mouse_mode_button_box.pack_start(mouse_move_button, true, true);
3072 if (!Profile->get_sae()) {
3073 mouse_mode_button_box.pack_start(mouse_select_button, true, true);
3075 mouse_mode_button_box.pack_start(mouse_zoom_button, true, true);
3076 if (!Profile->get_sae()) {
3077 mouse_mode_button_box.pack_start(mouse_gain_button, true, true);
3079 mouse_mode_button_box.pack_start(mouse_timefx_button, true, true);
3080 mouse_mode_button_box.pack_start(mouse_audition_button, true, true);
3081 mouse_mode_button_box.pack_start(mouse_note_button, true, true);
3082 mouse_mode_button_box.set_homogeneous(true);
3084 vector<string> edit_mode_strings;
3085 edit_mode_strings.push_back (edit_mode_to_string (Slide));
3086 if (!Profile->get_sae()) {
3087 edit_mode_strings.push_back (edit_mode_to_string (Splice));
3089 edit_mode_strings.push_back (edit_mode_to_string (Lock));
3091 edit_mode_selector.set_name ("EditModeSelector");
3092 set_popdown_strings (edit_mode_selector, edit_mode_strings, true);
3093 edit_mode_selector.signal_changed().connect (mem_fun(*this, &Editor::edit_mode_selection_done));
3095 mode_box->pack_start(edit_mode_selector);
3096 mode_box->pack_start(mouse_mode_button_box);
3098 mouse_mode_tearoff = manage (new TearOff (*mode_box));
3099 mouse_mode_tearoff->set_name ("MouseModeBase");
3101 if (Profile->get_sae()) {
3102 mouse_mode_tearoff->set_can_be_torn_off (false);
3105 mouse_mode_tearoff->Detach.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox),
3106 &mouse_mode_tearoff->tearoff_window()));
3107 mouse_mode_tearoff->Attach.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox),
3108 &mouse_mode_tearoff->tearoff_window(), 1));
3109 mouse_mode_tearoff->Hidden.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox),
3110 &mouse_mode_tearoff->tearoff_window()));
3111 mouse_mode_tearoff->Visible.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox),
3112 &mouse_mode_tearoff->tearoff_window(), 1));
3114 mouse_move_button.set_name ("MouseModeButton");
3115 mouse_select_button.set_name ("MouseModeButton");
3116 mouse_gain_button.set_name ("MouseModeButton");
3117 mouse_zoom_button.set_name ("MouseModeButton");
3118 mouse_timefx_button.set_name ("MouseModeButton");
3119 mouse_audition_button.set_name ("MouseModeButton");
3120 mouse_note_button.set_name ("MouseModeButton");
3122 ARDOUR_UI::instance()->tooltips().set_tip (mouse_move_button, _("Select/Move Objects"));
3123 ARDOUR_UI::instance()->tooltips().set_tip (mouse_select_button, _("Select/Move Ranges"));
3124 ARDOUR_UI::instance()->tooltips().set_tip (mouse_gain_button, _("Draw Gain Automation"));
3125 ARDOUR_UI::instance()->tooltips().set_tip (mouse_zoom_button, _("Select Zoom Range"));
3126 ARDOUR_UI::instance()->tooltips().set_tip (mouse_timefx_button, _("Stretch/Shrink Regions"));
3127 ARDOUR_UI::instance()->tooltips().set_tip (mouse_audition_button, _("Listen to Specific Regions"));
3128 ARDOUR_UI::instance()->tooltips().set_tip (mouse_note_button, _("Edit MIDI Notes"));
3130 mouse_move_button.unset_flags (CAN_FOCUS);
3131 mouse_select_button.unset_flags (CAN_FOCUS);
3132 mouse_gain_button.unset_flags (CAN_FOCUS);
3133 mouse_zoom_button.unset_flags (CAN_FOCUS);
3134 mouse_timefx_button.unset_flags (CAN_FOCUS);
3135 mouse_audition_button.unset_flags (CAN_FOCUS);
3136 mouse_note_button.unset_flags (CAN_FOCUS);
3138 mouse_select_button.signal_toggled().connect (bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseRange));
3139 mouse_select_button.signal_button_release_event().connect (mem_fun(*this, &Editor::mouse_select_button_release));
3141 mouse_move_button.signal_toggled().connect (bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseObject));
3142 mouse_gain_button.signal_toggled().connect (bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseGain));
3143 mouse_zoom_button.signal_toggled().connect (bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseZoom));
3144 mouse_timefx_button.signal_toggled().connect (bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseTimeFX));
3145 mouse_audition_button.signal_toggled().connect (bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseAudition));
3146 mouse_note_button.signal_toggled().connect (bind (mem_fun(*this, &Editor::mouse_mode_toggled), Editing::MouseNote));
3148 // mouse_move_button.set_active (true);
3153 zoom_box.set_spacing (1);
3154 zoom_box.set_border_width (0);
3156 zoom_in_button.set_name ("EditorTimeButton");
3157 zoom_in_button.set_size_request(-1,16);
3158 zoom_in_button.add (*(manage (new Image (::get_icon("zoom_in")))));
3159 zoom_in_button.signal_clicked().connect (bind (mem_fun(*this, &Editor::temporal_zoom_step), false));
3160 ARDOUR_UI::instance()->tooltips().set_tip (zoom_in_button, _("Zoom In"));
3162 zoom_out_button.set_name ("EditorTimeButton");
3163 zoom_out_button.set_size_request(-1,16);
3164 zoom_out_button.add (*(manage (new Image (::get_icon("zoom_out")))));
3165 zoom_out_button.signal_clicked().connect (bind (mem_fun(*this, &Editor::temporal_zoom_step), true));
3166 ARDOUR_UI::instance()->tooltips().set_tip (zoom_out_button, _("Zoom Out"));
3168 zoom_out_full_button.set_name ("EditorTimeButton");
3169 zoom_out_full_button.set_size_request(-1,16);
3170 zoom_out_full_button.add (*(manage (new Image (::get_icon("zoom_full")))));
3171 zoom_out_full_button.signal_clicked().connect (mem_fun(*this, &Editor::temporal_zoom_session));
3172 ARDOUR_UI::instance()->tooltips().set_tip (zoom_out_full_button, _("Zoom to Session"));
3174 zoom_focus_selector.set_name ("ZoomFocusSelector");
3175 set_popdown_strings (zoom_focus_selector, zoom_focus_strings, true);
3176 zoom_focus_selector.signal_changed().connect (mem_fun(*this, &Editor::zoom_focus_selection_done));
3177 ARDOUR_UI::instance()->tooltips().set_tip (zoom_focus_selector, _("Zoom focus"));
3179 zoom_box.pack_start (zoom_out_button, false, false);
3180 zoom_box.pack_start (zoom_in_button, false, false);
3181 zoom_box.pack_start (zoom_out_full_button, false, false);
3183 HBox* zbc = manage (new HBox);
3184 zbc->pack_start (zoom_focus_selector, PACK_SHRINK);
3185 zoom_vbox.pack_start (*zbc, PACK_SHRINK);
3186 zoom_vbox.pack_start (zoom_box, PACK_SHRINK);
3188 snap_box.set_spacing (1);
3189 snap_box.set_border_width (2);
3191 snap_type_selector.set_name ("SnapTypeSelector");
3192 set_popdown_strings (snap_type_selector, snap_type_strings, true);
3193 snap_type_selector.signal_changed().connect (mem_fun(*this, &Editor::snap_type_selection_done));
3194 ARDOUR_UI::instance()->tooltips().set_tip (snap_type_selector, _("Snap/Grid Units"));
3196 snap_mode_selector.set_name ("SnapModeSelector");
3197 set_popdown_strings (snap_mode_selector, snap_mode_strings, true);
3198 snap_mode_selector.signal_changed().connect (mem_fun(*this, &Editor::snap_mode_selection_done));
3199 ARDOUR_UI::instance()->tooltips().set_tip (snap_mode_selector, _("Snap/Grid Mode"));
3201 edit_point_selector.set_name ("EditPointSelector");
3202 set_popdown_strings (edit_point_selector, edit_point_strings, true);
3203 edit_point_selector.signal_changed().connect (mem_fun(*this, &Editor::edit_point_selection_done));
3204 ARDOUR_UI::instance()->tooltips().set_tip (edit_point_selector, _("Edit point"));
3206 snap_box.pack_start (edit_point_clock, false, false);
3207 snap_box.pack_start (snap_mode_selector, false, false);
3208 snap_box.pack_start (snap_type_selector, false, false);
3209 snap_box.pack_start (edit_point_selector, false, false);
3213 HBox *nudge_box = manage (new HBox);
3214 nudge_box->set_spacing(1);
3215 nudge_box->set_border_width (2);
3217 nudge_forward_button.signal_button_release_event().connect (mem_fun(*this, &Editor::nudge_forward_release), false);
3218 nudge_backward_button.signal_button_release_event().connect (mem_fun(*this, &Editor::nudge_backward_release), false);
3220 nudge_box->pack_start (nudge_backward_button, false, false);
3221 nudge_box->pack_start (nudge_forward_button, false, false);
3222 nudge_box->pack_start (nudge_clock, false, false);
3225 /* Pack everything in... */
3227 HBox* hbox = manage (new HBox);
3228 hbox->set_spacing(10);
3230 tools_tearoff = manage (new TearOff (*hbox));
3231 tools_tearoff->set_name ("MouseModeBase");
3233 if (Profile->get_sae()) {
3234 tools_tearoff->set_can_be_torn_off (false);
3237 tools_tearoff->Detach.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox),
3238 &tools_tearoff->tearoff_window()));
3239 tools_tearoff->Attach.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox),
3240 &tools_tearoff->tearoff_window(), 0));
3241 tools_tearoff->Hidden.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox),
3242 &tools_tearoff->tearoff_window()));
3243 tools_tearoff->Visible.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox),
3244 &tools_tearoff->tearoff_window(), 0));
3246 toolbar_hbox.set_spacing (10);
3247 toolbar_hbox.set_border_width (1);
3249 toolbar_hbox.pack_start (*mouse_mode_tearoff, false, false);
3250 toolbar_hbox.pack_start (*tools_tearoff, false, false);
3253 hbox->pack_start (snap_box, false, false);
3254 // hbox->pack_start (zoom_box, false, false);
3255 hbox->pack_start (*nudge_box, false, false);
3259 toolbar_base.set_name ("ToolBarBase");
3260 toolbar_base.add (toolbar_hbox);
3262 toolbar_frame.set_shadow_type (SHADOW_OUT);
3263 toolbar_frame.set_name ("BaseFrame");
3264 toolbar_frame.add (toolbar_base);
3268 Editor::midi_panic_button_pressed ()
3271 session->midi_panic();
3276 Editor::setup_midi_toolbar ()
3280 /* Mode Buttons (tool selection) */
3282 vector<ToggleButton *> midi_tool_buttons;
3284 midi_tool_pencil_button.add (*(manage (new Image (::get_icon("midi_tool_pencil")))));
3285 midi_tool_pencil_button.set_relief(Gtk::RELIEF_NONE);
3286 midi_tool_buttons.push_back (&midi_tool_pencil_button);
3287 midi_tool_select_button.add (*(manage (new Image (::get_icon("midi_tool_select")))));
3288 midi_tool_select_button.set_relief(Gtk::RELIEF_NONE);
3289 midi_tool_buttons.push_back (&midi_tool_select_button);
3290 midi_tool_resize_button.add (*(manage (new Image (::get_icon("strip_width")))));
3291 midi_tool_resize_button.set_relief(Gtk::RELIEF_NONE);
3292 midi_tool_buttons.push_back (&midi_tool_resize_button);
3293 midi_tool_erase_button.add (*(manage (new Image (::get_icon("midi_tool_erase")))));
3294 midi_tool_erase_button.set_relief(Gtk::RELIEF_NONE);
3295 midi_tool_buttons.push_back (&midi_tool_erase_button);
3297 midi_tool_pencil_button.set_active(true);
3299 midi_tool_button_set = new GroupedButtons (midi_tool_buttons);
3301 midi_tool_button_box.set_border_width (2);
3302 midi_tool_button_box.set_spacing(1);
3303 midi_tool_button_box.pack_start(midi_tool_pencil_button, true, true);
3304 midi_tool_button_box.pack_start(midi_tool_select_button, true, true);
3305 midi_tool_button_box.pack_start(midi_tool_resize_button, true, true);
3306 midi_tool_button_box.pack_start(midi_tool_erase_button , true, true);
3307 midi_tool_button_box.set_homogeneous(true);
3309 midi_tool_pencil_button.set_name ("MouseModeButton");
3310 midi_tool_select_button.set_name ("MouseModeButton");
3311 midi_tool_resize_button.set_name ("MouseModeButton");
3312 midi_tool_erase_button .set_name ("MouseModeButton");
3314 ARDOUR_UI::instance()->tooltips().set_tip (midi_tool_pencil_button, _("Add/Move/Stretch Notes"));
3315 ARDOUR_UI::instance()->tooltips().set_tip (midi_tool_select_button, _("Select/Move Notes"));
3316 ARDOUR_UI::instance()->tooltips().set_tip (midi_tool_resize_button, _("Resize Notes"));
3317 ARDOUR_UI::instance()->tooltips().set_tip (midi_tool_erase_button, _("Erase Notes"));
3319 midi_tool_pencil_button.unset_flags (CAN_FOCUS);
3320 midi_tool_select_button.unset_flags (CAN_FOCUS);
3321 midi_tool_resize_button.unset_flags (CAN_FOCUS);
3322 midi_tool_erase_button.unset_flags (CAN_FOCUS);
3324 midi_tool_pencil_button.signal_toggled().connect (bind (mem_fun(*this,
3325 &Editor::midi_edit_mode_toggled), Editing::MidiEditPencil));
3326 midi_tool_select_button.signal_toggled().connect (bind (mem_fun(*this,
3327 &Editor::midi_edit_mode_toggled), Editing::MidiEditSelect));
3328 midi_tool_resize_button.signal_toggled().connect (bind (mem_fun(*this,
3329 &Editor::midi_edit_mode_toggled), Editing::MidiEditResize));
3330 midi_tool_erase_button.signal_toggled().connect (bind (mem_fun(*this,
3331 &Editor::midi_edit_mode_toggled), Editing::MidiEditErase));
3334 /* Midi sound notes */
3335 midi_sound_notes.add (*(manage (new Image (::get_icon("midi_sound_notes")))));
3336 midi_sound_notes.set_relief(Gtk::RELIEF_NONE);
3337 ARDOUR_UI::instance()->tooltips().set_tip (midi_sound_notes, _("Sound Notes"));
3338 midi_sound_notes.unset_flags (CAN_FOCUS);
3342 HBox* panic_box = manage (new HBox);
3343 midi_panic_button.set_name("MidiPanicButton");
3344 midi_panic_button.signal_pressed().connect (
3345 mem_fun(this, &Editor::midi_panic_button_pressed));
3346 panic_box->pack_start (midi_sound_notes , true, true);
3347 panic_box->pack_start (midi_panic_button, true, true);
3349 /* Pack everything in... */
3351 midi_tools_tearoff = manage (new TearOff (midi_tool_button_box));
3352 midi_tools_tearoff->set_name ("MouseModeBase");
3355 midi_tools_tearoff->Detach.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&midi_toolbar_hbox),
3356 &midi_tools_tearoff->tearoff_window()));
3357 midi_tools_tearoff->Attach.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&midi_toolbar_hbox),
3358 &midi_tools_tearoff->tearoff_window(), 0));
3359 midi_tools_tearoff->Hidden.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&midi_toolbar_hbox),
3360 &midi_tools_tearoff->tearoff_window()));
3361 midi_tools_tearoff->Visible.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&midi_toolbar_hbox),
3362 &midi_tools_tearoff->tearoff_window(), 0));
3365 midi_toolbar_hbox.set_spacing (10);
3366 midi_toolbar_hbox.set_border_width (1);
3368 midi_toolbar_hbox.pack_start (*midi_tools_tearoff, false, true);
3370 midi_toolbar_hbox.pack_start(*panic_box, false, true, 4);
3372 midi_tool_button_box.show_all ();
3373 midi_toolbar_hbox.show_all();
3374 midi_tools_tearoff->show_all();
3376 midi_toolbar_base.set_name ("ToolBarBase");
3377 midi_toolbar_base.add (midi_toolbar_hbox);
3379 midi_toolbar_frame.set_shadow_type (SHADOW_OUT);
3380 midi_toolbar_frame.set_name ("BaseFrame");
3381 midi_toolbar_frame.add (midi_toolbar_base);
3385 Editor::convert_drop_to_paths (
3386 vector<ustring>& paths,
3387 const RefPtr<Gdk::DragContext>& context,
3390 const SelectionData& data,
3398 vector<ustring> uris = data.get_uris();
3402 /* This is seriously fucked up. Nautilus doesn't say that its URI lists
3403 are actually URI lists. So do it by hand.
3406 if (data.get_target() != "text/plain") {
3410 /* Parse the "uri-list" format that Nautilus provides,
3411 where each pathname is delimited by \r\n.
3413 THERE MAY BE NO NULL TERMINATING CHAR!!!
3416 ustring txt = data.get_text();
3420 p = (const char *) malloc (txt.length() + 1);
3421 txt.copy ((char *) p, txt.length(), 0);
3422 ((char*)p)[txt.length()] = '\0';
3428 while (g_ascii_isspace (*p))
3432 while (*q && (*q != '\n') && (*q != '\r')) {
3439 while (q > p && g_ascii_isspace (*q))
3444 uris.push_back (ustring (p, q - p + 1));
3448 p = strchr (p, '\n');
3460 for (vector<ustring>::iterator i = uris.begin(); i != uris.end(); ++i) {
3462 if ((*i).substr (0,7) == "file://") {
3465 PBD::url_decode (p);
3467 // scan forward past three slashes
3469 ustring::size_type slashcnt = 0;
3470 ustring::size_type n = 0;
3471 ustring::iterator x = p.begin();
3473 while (slashcnt < 3 && x != p.end()) {
3476 } else if (slashcnt == 3) {
3483 if (slashcnt != 3 || x == p.end()) {
3484 error << _("malformed URL passed to drag-n-drop code") << endmsg;
3488 paths.push_back (p.substr (n - 1));
3496 Editor::new_tempo_section ()
3502 Editor::map_transport_state ()
3504 ENSURE_GUI_THREAD (mem_fun(*this, &Editor::map_transport_state));
3506 if (session->transport_stopped()) {
3507 have_pending_keyboard_selection = false;
3510 update_loop_range_view (true);
3515 Editor::State::State (PublicEditor const * e)
3517 selection = new Selection (e);
3520 Editor::State::~State ()
3526 Editor::store_state (State& state) const
3528 *state.selection = *selection;
3532 Editor::restore_state (State *state)
3534 if (*selection == *state->selection) {
3538 *selection = *state->selection;
3539 time_selection_changed ();
3540 region_selection_changed ();
3542 /* XXX other selection change handlers? */
3546 Editor::begin_reversible_command (string name)
3549 before = &get_state();
3550 session->begin_reversible_command (name);
3555 Editor::commit_reversible_command ()
3558 session->commit_reversible_command (new MementoCommand<Editor>(*this, before, &get_state()));
3563 Editor::set_edit_group_solo (Route& route, bool yn)
3565 RouteGroup *edit_group;
3567 if ((edit_group = route.edit_group()) != 0) {
3568 edit_group->apply (&Route::set_solo, yn, this);
3570 route.set_solo (yn, this);
3575 Editor::set_edit_group_mute (Route& route, bool yn)
3577 RouteGroup *edit_group = 0;
3579 if ((edit_group == route.edit_group()) != 0) {
3580 edit_group->apply (&Route::set_mute, yn, this);
3582 route.set_mute (yn, this);
3587 Editor::history_changed ()
3591 if (undo_action && session) {
3592 if (session->undo_depth() == 0) {
3595 label = string_compose(_("Undo (%1)"), session->next_undo());
3597 undo_action->property_label() = label;
3600 if (redo_action && session) {
3601 if (session->redo_depth() == 0) {
3604 label = string_compose(_("Redo (%1)"), session->next_redo());
3606 redo_action->property_label() = label;
3611 Editor::duplicate_dialog (bool with_dialog)
3615 if (mouse_mode == MouseRange) {
3616 if (selection->time.length() == 0) {
3622 get_regions_for_action (rs);
3624 if (mouse_mode != MouseRange) {
3633 ArdourDialog win ("Duplication Dialog");
3634 Label label (_("Number of Duplications:"));
3635 Adjustment adjustment (1.0, 1.0, 1000000.0, 1.0, 5.0);
3636 SpinButton spinner (adjustment, 0.0, 1);
3639 win.get_vbox()->set_spacing (12);
3640 win.get_vbox()->pack_start (hbox);
3641 hbox.set_border_width (6);
3642 hbox.pack_start (label, PACK_EXPAND_PADDING, 12);
3644 /* dialogs have ::add_action_widget() but that puts the spinner in the wrong
3645 place, visually. so do this by hand.
3648 hbox.pack_start (spinner, PACK_EXPAND_PADDING, 12);
3649 spinner.signal_activate().connect (sigc::bind (mem_fun (win, &ArdourDialog::response), RESPONSE_ACCEPT));
3650 spinner.grab_focus();
3656 win.add_button (Stock::CANCEL, RESPONSE_CANCEL);
3657 win.add_button (_("Duplicate"), RESPONSE_ACCEPT);
3658 win.set_default_response (RESPONSE_ACCEPT);
3660 win.set_position (WIN_POS_MOUSE);
3662 spinner.grab_focus ();
3664 switch (win.run ()) {
3665 case RESPONSE_ACCEPT:
3671 times = adjustment.get_value();
3674 if (mouse_mode == MouseRange) {
3675 duplicate_selection (times);
3677 duplicate_some_regions (rs, times);
3682 Editor::show_verbose_canvas_cursor ()
3684 verbose_canvas_cursor->raise_to_top();
3685 verbose_canvas_cursor->show();
3686 verbose_cursor_visible = true;
3690 Editor::hide_verbose_canvas_cursor ()
3692 verbose_canvas_cursor->hide();
3693 verbose_cursor_visible = false;
3697 Editor::clamp_verbose_cursor_x (double x)
3702 x = min (_canvas_width - 200.0, x);
3708 Editor::clamp_verbose_cursor_y (double y)
3710 if (y < canvas_timebars_vsize) {
3711 y = canvas_timebars_vsize;
3713 y = min (_canvas_height - 50, y);
3719 Editor::set_verbose_canvas_cursor (const string & txt, double x, double y)
3721 verbose_canvas_cursor->property_text() = txt.c_str();
3722 /* don't get too close to the edge */
3723 verbose_canvas_cursor->property_x() = clamp_verbose_cursor_x (x);
3724 verbose_canvas_cursor->property_y() = clamp_verbose_cursor_y (y);
3728 Editor::set_verbose_canvas_cursor_text (const string & txt)
3730 verbose_canvas_cursor->property_text() = txt.c_str();
3734 Editor::set_edit_mode (EditMode m)
3736 Config->set_edit_mode (m);
3740 Editor::cycle_edit_mode ()
3742 switch (Config->get_edit_mode()) {
3744 if (Profile->get_sae()) {
3745 Config->set_edit_mode (Lock);
3747 Config->set_edit_mode (Splice);
3751 Config->set_edit_mode (Lock);
3754 Config->set_edit_mode (Slide);
3760 Editor::edit_mode_selection_done ()
3766 string choice = edit_mode_selector.get_active_text();
3767 EditMode mode = Slide;
3769 if (choice == _("Splice Edit")) {
3771 } else if (choice == _("Slide Edit")) {
3773 } else if (choice == _("Lock Edit")) {
3777 Config->set_edit_mode (mode);
3781 Editor::snap_type_selection_done ()
3783 string choice = snap_type_selector.get_active_text();
3784 SnapType snaptype = SnapToBeat;
3786 if (choice == _("Beats/3")) {
3787 snaptype = SnapToAThirdBeat;
3788 } else if (choice == _("Beats/4")) {
3789 snaptype = SnapToAQuarterBeat;
3790 } else if (choice == _("Beats/8")) {
3791 snaptype = SnapToAEighthBeat;
3792 } else if (choice == _("Beats/16")) {
3793 snaptype = SnapToASixteenthBeat;
3794 } else if (choice == _("Beats/32")) {
3795 snaptype = SnapToAThirtysecondBeat;
3796 } else if (choice == _("Beats")) {
3797 snaptype = SnapToBeat;
3798 } else if (choice == _("Bars")) {
3799 snaptype = SnapToBar;
3800 } else if (choice == _("Marks")) {
3801 snaptype = SnapToMark;
3802 } else if (choice == _("Region starts")) {
3803 snaptype = SnapToRegionStart;
3804 } else if (choice == _("Region ends")) {
3805 snaptype = SnapToRegionEnd;
3806 } else if (choice == _("Region bounds")) {
3807 snaptype = SnapToRegionBoundary;
3808 } else if (choice == _("Region syncs")) {
3809 snaptype = SnapToRegionSync;
3810 } else if (choice == _("CD Frames")) {
3811 snaptype = SnapToCDFrame;
3812 } else if (choice == _("SMPTE Frames")) {
3813 snaptype = SnapToSMPTEFrame;
3814 } else if (choice == _("SMPTE Seconds")) {
3815 snaptype = SnapToSMPTESeconds;
3816 } else if (choice == _("SMPTE Minutes")) {
3817 snaptype = SnapToSMPTEMinutes;
3818 } else if (choice == _("Seconds")) {
3819 snaptype = SnapToSeconds;
3820 } else if (choice == _("Minutes")) {
3821 snaptype = SnapToMinutes;
3824 RefPtr<RadioAction> ract = snap_type_action (snaptype);
3826 ract->set_active ();
3831 Editor::snap_mode_selection_done ()
3833 string choice = snap_mode_selector.get_active_text();
3834 SnapMode mode = SnapNormal;
3836 if (choice == _("No Grid")) {
3838 } else if (choice == _("Grid")) {
3840 } else if (choice == _("Magnetic")) {
3841 mode = SnapMagnetic;
3844 RefPtr<RadioAction> ract = snap_mode_action (mode);
3847 ract->set_active (true);
3852 Editor::cycle_edit_point (bool with_marker)
3854 switch (_edit_point) {
3856 set_edit_point_preference (EditAtPlayhead);
3858 case EditAtPlayhead:
3860 set_edit_point_preference (EditAtSelectedMarker);
3862 set_edit_point_preference (EditAtMouse);
3865 case EditAtSelectedMarker:
3866 set_edit_point_preference (EditAtMouse);
3872 Editor::edit_point_selection_done ()
3874 string choice = edit_point_selector.get_active_text();
3875 EditPoint ep = EditAtSelectedMarker;
3877 if (choice == _("Marker")) {
3878 set_edit_point_preference (EditAtSelectedMarker);
3879 } else if (choice == _("Playhead")) {
3880 set_edit_point_preference (EditAtPlayhead);
3882 set_edit_point_preference (EditAtMouse);
3885 RefPtr<RadioAction> ract = edit_point_action (ep);
3888 ract->set_active (true);
3893 Editor::zoom_focus_selection_done ()
3895 string choice = zoom_focus_selector.get_active_text();
3896 ZoomFocus focus_type = ZoomFocusLeft;
3898 if (choice == _("Left")) {
3899 focus_type = ZoomFocusLeft;
3900 } else if (choice == _("Right")) {
3901 focus_type = ZoomFocusRight;
3902 } else if (choice == _("Center")) {
3903 focus_type = ZoomFocusCenter;
3904 } else if (choice == _("Play")) {
3905 focus_type = ZoomFocusPlayhead;
3906 } else if (choice == _("Edit")) {
3907 focus_type = ZoomFocusEdit;
3908 } else if (choice == _("Active Mark")) {
3909 focus_type = ZoomFocusEdit;
3910 } else if (choice == _("Active Mark")) {
3911 focus_type = ZoomFocusEdit;
3913 focus_type = ZoomFocusMouse;
3916 RefPtr<RadioAction> ract = zoom_focus_action (focus_type);
3919 ract->set_active ();
3924 Editor::edit_controls_button_release (GdkEventButton* ev)
3926 if (Keyboard::is_context_menu_event (ev)) {
3927 ARDOUR_UI::instance()->add_route (this);
3933 Editor::mouse_select_button_release (GdkEventButton* ev)
3935 /* this handles just right-clicks */
3937 if (ev->button != 3) {
3944 Editor::TrackViewList *
3945 Editor::get_valid_views (TimeAxisView* track, RouteGroup* group)
3948 TrackViewList::iterator i;
3950 v = new TrackViewList;
3952 if (track == 0 && group == 0) {
3956 for (i = track_views.begin(); i != track_views.end (); ++i) {
3960 } else if ((track != 0 && group == 0) || (track != 0 && group != 0 && !group->is_active())) {
3962 /* just the view for this track
3965 v->push_back (track);
3969 /* views for all tracks in the edit group */
3971 for (i = track_views.begin(); i != track_views.end (); ++i) {
3973 if (group == 0 || (*i)->edit_group() == group) {
3983 Editor::set_zoom_focus (ZoomFocus f)
3985 string str = zoom_focus_strings[(int)f];
3987 if (str != zoom_focus_selector.get_active_text()) {
3988 zoom_focus_selector.set_active_text (str);
3991 if (zoom_focus != f) {
3994 ZoomFocusChanged (); /* EMIT_SIGNAL */
4001 Editor::ensure_float (Window& win)
4003 win.set_transient_for (*this);
4007 Editor::pane_allocation_handler (Allocation &alloc, Paned* which)
4009 /* recover or initialize pane positions. do this here rather than earlier because
4010 we don't want the positions to change the child allocations, which they seem to do.
4016 XMLNode* node = ARDOUR_UI::instance()->editor_settings();
4018 static int32_t done;
4021 width = default_width;
4022 height = default_height;
4024 if ((geometry = find_named_node (*node, "geometry")) != 0) {
4026 if ((prop = geometry->property ("x_size")) == 0) {
4027 prop = geometry->property ("x-size");
4030 width = atoi (prop->value());
4032 if ((prop = geometry->property ("y_size")) == 0) {
4033 prop = geometry->property ("y-size");
4036 height = atoi (prop->value());
4040 if (which == static_cast<Paned*> (&edit_pane)) {
4046 if (!geometry || (prop = geometry->property ("edit-pane-pos")) == 0) {
4047 /* initial allocation is 90% to canvas, 10% to notebook */
4048 pos = (int) floor (alloc.get_width() * 0.90f);
4049 snprintf (buf, sizeof(buf), "%d", pos);
4051 pos = atoi (prop->value());
4054 if ((done = GTK_WIDGET(edit_pane.gobj())->allocation.width > pos)) {
4055 edit_pane.set_position (pos);
4056 pre_maximal_pane_position = pos;
4062 Editor::detach_tearoff (Box* b, Window* w)
4064 if (tools_tearoff->torn_off() &&
4065 mouse_mode_tearoff->torn_off()) {
4066 top_hbox.remove (toolbar_frame);
4071 Editor::reattach_tearoff (Box* b, Window* w, int32_t n)
4073 if (toolbar_frame.get_parent() == 0) {
4074 top_hbox.pack_end (toolbar_frame);
4079 Editor::set_show_measures (bool yn)
4081 if (_show_measures != yn) {
4084 if ((_show_measures = yn) == true) {
4086 tempo_lines->show();
4094 Editor::toggle_follow_playhead ()
4096 RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-follow-playhead"));
4098 RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
4099 set_follow_playhead (tact->get_active());
4104 Editor::set_follow_playhead (bool yn)
4106 if (_follow_playhead != yn) {
4107 if ((_follow_playhead = yn) == true) {
4109 update_current_screen ();
4116 Editor::toggle_xfade_active (boost::weak_ptr<Crossfade> wxfade)
4118 boost::shared_ptr<Crossfade> xfade (wxfade.lock());
4120 xfade->set_active (!xfade->active());
4125 Editor::toggle_xfade_length (boost::weak_ptr<Crossfade> wxfade)
4127 boost::shared_ptr<Crossfade> xfade (wxfade.lock());
4129 xfade->set_follow_overlap (!xfade->following_overlap());
4134 Editor::edit_xfade (boost::weak_ptr<Crossfade> wxfade)
4136 boost::shared_ptr<Crossfade> xfade (wxfade.lock());
4142 CrossfadeEditor cew (*session, xfade, xfade->fade_in().get_min_y(), 1.0);
4146 switch (cew.run ()) {
4147 case RESPONSE_ACCEPT:
4154 xfade->StateChanged (Change (~0));
4158 Editor::playlist_selector () const
4160 return *_playlist_selector;
4164 Editor::get_nudge_distance (nframes64_t pos, nframes64_t& next)
4168 ret = nudge_clock.current_duration (pos);
4169 next = ret + 1; /* XXXX fix me */
4175 Editor::end_location_changed (Location* location)
4177 ENSURE_GUI_THREAD (bind (mem_fun(*this, &Editor::end_location_changed), location));
4178 //reset_scrolling_region ();
4179 nframes64_t session_span = location->start() + (nframes64_t) floorf (current_page_frames() * 0.10f);
4180 horizontal_adjustment.set_upper (session_span / frames_per_unit);
4184 Editor::playlist_deletion_dialog (boost::shared_ptr<Playlist> pl)
4186 ArdourDialog dialog ("playlist deletion dialog");
4187 Label label (string_compose (_("Playlist %1 is currently unused.\n"
4188 "If left alone, no audio files used by it will be cleaned.\n"
4189 "If deleted, audio files used by it alone by will cleaned."),
4192 dialog.set_position (WIN_POS_CENTER);
4193 dialog.get_vbox()->pack_start (label);
4197 dialog.add_button (_("Delete playlist"), RESPONSE_ACCEPT);
4198 dialog.add_button (_("Keep playlist"), RESPONSE_REJECT);
4199 dialog.add_button (_("Cancel"), RESPONSE_CANCEL);
4201 switch (dialog.run ()) {
4202 case RESPONSE_ACCEPT:
4203 /* delete the playlist */
4207 case RESPONSE_REJECT:
4208 /* keep the playlist */
4220 Editor::audio_region_selection_covers (nframes64_t where)
4222 for (RegionSelection::iterator a = selection->regions.begin(); a != selection->regions.end(); ++a) {
4223 if ((*a)->region()->covers (where)) {
4232 Editor::prepare_for_cleanup ()
4234 cut_buffer->clear_regions ();
4235 cut_buffer->clear_playlists ();
4237 selection->clear_regions ();
4238 selection->clear_playlists ();
4240 no_region_list_redisplay = true;
4244 Editor::finish_cleanup ()
4246 no_region_list_redisplay = false;
4247 redisplay_regions ();
4251 Editor::transport_loop_location()
4254 return session->locations()->auto_loop_location();
4261 Editor::transport_punch_location()
4264 return session->locations()->auto_punch_location();
4271 Editor::control_layout_scroll (GdkEventScroll* ev)
4273 switch (ev->direction) {
4275 scroll_tracks_up_line ();
4279 case GDK_SCROLL_DOWN:
4280 scroll_tracks_down_line ();
4284 /* no left/right handling yet */
4292 /** A new snapshot has been selected.
4295 Editor::snapshot_display_selection_changed ()
4297 if (snapshot_display.get_selection()->count_selected_rows() > 0) {
4299 TreeModel::iterator i = snapshot_display.get_selection()->get_selected();
4301 Glib::ustring snap_name = (*i)[snapshot_display_columns.real_name];
4303 if (snap_name.length() == 0) {
4307 if (session->snap_name() == snap_name) {
4311 ARDOUR_UI::instance()->load_session(session->path(), string (snap_name));
4316 Editor::snapshot_display_button_press (GdkEventButton* ev)
4318 if (ev->button == 3) {
4319 /* Right-click on the snapshot list. Work out which snapshot it
4321 Gtk::TreeModel::Path path;
4322 Gtk::TreeViewColumn* col;
4325 snapshot_display.get_path_at_pos ((int) ev->x, (int) ev->y, path, col, cx, cy);
4326 Gtk::TreeModel::iterator iter = snapshot_display_model->get_iter (path);
4328 Gtk::TreeModel::Row row = *iter;
4329 popup_snapshot_context_menu (ev->button, ev->time, row[snapshot_display_columns.real_name]);
4338 /** Pop up the snapshot display context menu.
4339 * @param button Button used to open the menu.
4340 * @param time Menu open time.
4341 * @snapshot_name Name of the snapshot that the menu click was over.
4345 Editor::popup_snapshot_context_menu (int button, int32_t time, Glib::ustring snapshot_name)
4347 using namespace Menu_Helpers;
4349 MenuList& items (snapshot_context_menu.items());
4352 const bool modification_allowed = (session->snap_name() != snapshot_name && session->name() != snapshot_name);
4354 add_item_with_sensitivity (items, MenuElem (_("Remove"), bind (mem_fun (*this, &Editor::remove_snapshot), snapshot_name)), modification_allowed);
4356 add_item_with_sensitivity (items, MenuElem (_("Rename"), bind (mem_fun (*this, &Editor::rename_snapshot), snapshot_name)), modification_allowed);
4358 snapshot_context_menu.popup (button, time);
4362 Editor::rename_snapshot (Glib::ustring old_name)
4364 ArdourPrompter prompter(true);
4368 prompter.set_name ("Prompter");
4369 prompter.add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
4370 prompter.set_prompt (_("New name of snapshot"));
4371 prompter.set_initial_text (old_name);
4373 if (prompter.run() == RESPONSE_ACCEPT) {
4374 prompter.get_result (new_name);
4375 if (new_name.length()) {
4376 session->rename_state (old_name, new_name);
4377 redisplay_snapshots ();
4384 Editor::remove_snapshot (Glib::ustring name)
4386 vector<string> choices;
4388 std::string prompt = string_compose (_("Do you really want to remove snapshot \"%1\" ?\n(cannot be undone)"), name);
4390 choices.push_back (_("No, do nothing."));
4391 choices.push_back (_("Yes, remove it."));
4393 Gtkmm2ext::Choice prompter (prompt, choices);
4395 if (prompter.run () == 1) {
4396 session->remove_state (name);
4397 redisplay_snapshots ();
4402 Editor::redisplay_snapshots ()
4408 vector<sys::path> state_file_paths;
4410 get_state_files_in_directory (session->session_directory().root_path(),
4413 if (state_file_paths.empty()) return;
4415 vector<string> state_file_names(get_file_names_no_extension(state_file_paths));
4417 snapshot_display_model->clear ();
4419 for (vector<string>::iterator i = state_file_names.begin();
4420 i != state_file_names.end(); ++i)
4422 string statename = (*i);
4423 TreeModel::Row row = *(snapshot_display_model->append());
4425 /* this lingers on in case we ever want to change the visible
4426 name of the snapshot.
4429 string display_name;
4430 display_name = statename;
4432 if (statename == session->snap_name()) {
4433 snapshot_display.get_selection()->select(row);
4436 row[snapshot_display_columns.visible_name] = display_name;
4437 row[snapshot_display_columns.real_name] = statename;
4442 Editor::session_state_saved (string snap_name)
4444 ENSURE_GUI_THREAD (bind (mem_fun(*this, &Editor::session_state_saved), snap_name));
4445 redisplay_snapshots ();
4449 Editor::maximise_editing_space ()
4451 mouse_mode_tearoff->set_visible (false);
4452 tools_tearoff->set_visible (false);
4454 pre_maximal_pane_position = edit_pane.get_position();
4455 pre_maximal_editor_width = this->get_width();
4457 if(post_maximal_pane_position == 0) {
4458 post_maximal_pane_position = edit_pane.get_width();
4463 if(post_maximal_editor_width) {
4464 edit_pane.set_position (post_maximal_pane_position -
4465 abs(post_maximal_editor_width - pre_maximal_editor_width));
4467 edit_pane.set_position (post_maximal_pane_position);
4472 Editor::restore_editing_space ()
4474 // user changed width of pane during fullscreen
4476 if(post_maximal_pane_position != edit_pane.get_position()) {
4477 post_maximal_pane_position = edit_pane.get_position();
4482 mouse_mode_tearoff->set_visible (true);
4483 tools_tearoff->set_visible (true);
4484 post_maximal_editor_width = this->get_width();
4486 edit_pane.set_position (pre_maximal_pane_position + abs(this->get_width() - pre_maximal_editor_width));
4490 * Make new playlists for a given track and also any others that belong
4491 * to the same active edit group.
4496 Editor::new_playlists (TimeAxisView* v)
4498 begin_reversible_command (_("new playlists"));
4499 vector<boost::shared_ptr<ARDOUR::Playlist> > playlists;
4500 session->get_playlists(playlists);
4501 mapover_tracks ( bind(mem_fun (*this, &Editor::mapped_use_new_playlist), playlists), v );
4502 commit_reversible_command ();
4506 * Use a copy of the current playlist for a given track and also any others that belong
4507 * to the same active edit group.
4512 Editor::copy_playlists (TimeAxisView* v)
4514 begin_reversible_command (_("copy playlists"));
4515 vector<boost::shared_ptr<ARDOUR::Playlist> > playlists;
4516 session->get_playlists(playlists);
4517 mapover_tracks ( bind(mem_fun (*this, &Editor::mapped_use_copy_playlist), playlists), v );
4518 commit_reversible_command ();
4522 * Clear the current playlist for a given track and also any others that belong
4523 * to the same active edit group.
4528 Editor::clear_playlists (TimeAxisView* v)
4530 begin_reversible_command (_("clear playlists"));
4531 vector<boost::shared_ptr<ARDOUR::Playlist> > playlists;
4532 session->get_playlists(playlists);
4533 mapover_tracks ( mem_fun (*this, &Editor::mapped_clear_playlist), v );
4534 commit_reversible_command ();
4538 Editor::mapped_use_new_playlist (RouteTimeAxisView& atv, uint32_t sz, vector<boost::shared_ptr<ARDOUR::Playlist> > const & playlists)
4540 atv.use_new_playlist (sz > 1 ? false : true, playlists);
4544 Editor::mapped_use_copy_playlist (RouteTimeAxisView& atv, uint32_t sz, vector<boost::shared_ptr<ARDOUR::Playlist> > const & playlists)
4546 atv.use_copy_playlist (sz > 1 ? false : true, playlists);
4550 Editor::mapped_clear_playlist (RouteTimeAxisView& atv, uint32_t sz)
4552 atv.clear_playlist ();
4556 Editor::on_key_press_event (GdkEventKey* ev)
4558 return key_press_focus_accelerator_handler (*this, ev);
4562 Editor::on_key_release_event (GdkEventKey* ev)
4564 return Gtk::Window::on_key_release_event (ev);
4565 // return key_press_focus_accelerator_handler (*this, ev);
4569 Editor::reset_x_origin (nframes64_t frame)
4571 //cerr << "resetting x origin" << endl;
4572 queue_visual_change (frame);
4576 Editor::reset_y_origin (double y)
4578 queue_visual_change_y (y);
4582 Editor::reset_zoom (double fpu)
4584 queue_visual_change (fpu);
4588 Editor::reposition_and_zoom (nframes64_t frame, double fpu)
4590 //cerr << "Editor::reposition_and_zoom () called ha v:l:u:ps:fpu = " << horizontal_adjustment.get_value() << ":" << horizontal_adjustment.get_lower() << ":" << horizontal_adjustment.get_upper() << ":" << horizontal_adjustment.get_page_size() << ":" << frames_per_unit << endl;//DEBUG
4591 reset_x_origin (frame);
4594 if (!no_save_visual) {
4595 undo_visual_stack.push_back (current_visual_state(false));
4599 Editor::VisualState*
4600 Editor::current_visual_state (bool with_tracks)
4602 VisualState* vs = new VisualState;
4603 vs->y_position = vertical_adjustment.get_value();
4604 vs->frames_per_unit = frames_per_unit;
4605 vs->leftmost_frame = leftmost_frame;
4606 vs->zoom_focus = zoom_focus;
4607 vs->zoomed_to_region = zoomed_to_region;
4610 for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
4611 vs->track_states.push_back (TAVState ((*i), &(*i)->get_state()));
4619 Editor::undo_visual_state ()
4621 if (undo_visual_stack.empty()) {
4625 VisualState* vs = undo_visual_stack.back();
4626 undo_visual_stack.pop_back();
4627 use_visual_state (*vs);
4628 redo_visual_stack.push_back (vs);
4632 Editor::redo_visual_state ()
4634 if (redo_visual_stack.empty()) {
4638 VisualState* vs = redo_visual_stack.back();
4639 redo_visual_stack.pop_back();
4640 use_visual_state (*vs);
4641 undo_visual_stack.push_back (vs);
4645 Editor::swap_visual_state ()
4647 if (undo_visual_stack.empty()) {
4648 redo_visual_state ();
4650 undo_visual_state ();
4655 Editor::use_visual_state (VisualState& vs)
4657 no_save_visual = true;
4658 no_route_list_redisplay = true;
4660 vertical_adjustment.set_value (vs.y_position);
4662 set_zoom_focus (vs.zoom_focus);
4663 reposition_and_zoom (vs.leftmost_frame, vs.frames_per_unit);
4664 zoomed_to_region = vs.zoomed_to_region;
4666 for (list<TAVState>::iterator i = vs.track_states.begin(); i != vs.track_states.end(); ++i) {
4667 TrackViewList::iterator t;
4669 /* check if the track still exists - it could have been deleted */
4671 if ((t = find (track_views.begin(), track_views.end(), i->first)) != track_views.end()) {
4672 (*t)->set_state (*(i->second));
4677 if (!vs.track_states.empty()) {
4678 update_route_visibility ();
4681 no_route_list_redisplay = false;
4682 redisplay_route_list ();
4684 no_save_visual = false;
4688 Editor::set_frames_per_unit (double fpu)
4690 /* this is the core function that controls the zoom level of the canvas. it is called
4691 whenever one or more calls are made to reset_zoom(). it executes in an idle handler.
4694 if (fpu == frames_per_unit) {
4703 /* don't allow zooms that fit more than the maximum number
4704 of frames into an 800 pixel wide space.
4707 if (max_frames / fpu < 800.0) {
4712 tempo_lines->tempo_map_changed();
4714 frames_per_unit = fpu;
4719 Editor::post_zoom ()
4721 nframes64_t cef = 0;
4723 // convert fpu to frame count
4725 nframes64_t frames = (nframes64_t) floor (frames_per_unit * _canvas_width);
4727 if (frames_per_unit != zoom_range_clock.current_duration()) {
4728 zoom_range_clock.set (frames);
4731 if (mouse_mode == MouseRange && selection->time.start () != selection->time.end_frame ()) {
4732 if (!selection->tracks.empty()) {
4733 for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
4734 (*i)->reshow_selection (selection->time);
4737 for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
4738 (*i)->reshow_selection (selection->time);
4743 leftmost_frame = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
4745 ZoomChanged (); /* EMIT_SIGNAL */
4747 reset_hscrollbar_stepping ();
4750 cef = session->current_end_frame() + (current_page_frames() / 10);// Add a little extra so we can see the end marker
4752 horizontal_adjustment.set_upper (cef / frames_per_unit);
4754 //reset_scrolling_region ();
4756 if (playhead_cursor) {
4757 playhead_cursor->set_position (playhead_cursor->current_frame);
4760 _summary->set_overlays_dirty ();
4766 Editor::queue_visual_change (nframes64_t where)
4768 pending_visual_change.add (VisualChange::TimeOrigin);
4770 /* if we're moving beyond the end, make sure the upper limit of the horizontal adjustment
4774 if (where > session->current_end_frame()) {
4775 horizontal_adjustment.set_upper ((where + current_page_frames()) / frames_per_unit);
4778 pending_visual_change.time_origin = where;
4780 ensure_visual_change_idle_handler ();
4784 Editor::queue_visual_change (double fpu)
4786 pending_visual_change.add (VisualChange::ZoomLevel);
4787 pending_visual_change.frames_per_unit = fpu;
4789 ensure_visual_change_idle_handler ();
4794 Editor::queue_visual_change_y (double y)
4796 pending_visual_change.add (VisualChange::YOrigin);
4797 pending_visual_change.y_origin = y;
4799 ensure_visual_change_idle_handler ();
4803 Editor::ensure_visual_change_idle_handler ()
4805 if (pending_visual_change.idle_handler_id < 0) {
4806 pending_visual_change.idle_handler_id = g_idle_add (_idle_visual_changer, this);
4811 Editor::_idle_visual_changer (void* arg)
4813 return static_cast<Editor*>(arg)->idle_visual_changer ();
4817 Editor::idle_visual_changer ()
4819 VisualChange::Type p = pending_visual_change.pending;
4820 pending_visual_change.pending = (VisualChange::Type) 0;
4822 #ifdef FIX_THIS_FOR_V3
4823 double last_time_origin = horizontal_adjustment.get_value();
4826 if (p & VisualChange::ZoomLevel) {
4827 set_frames_per_unit (pending_visual_change.frames_per_unit);
4829 compute_fixed_ruler_scale ();
4830 compute_current_bbt_points(pending_visual_change.time_origin, pending_visual_change.time_origin + current_page_frames());
4831 compute_bbt_ruler_scale (pending_visual_change.time_origin, pending_visual_change.time_origin + current_page_frames());
4832 update_tempo_based_rulers ();
4834 if (p & VisualChange::TimeOrigin) {
4835 horizontal_adjustment.set_value (pending_visual_change.time_origin / frames_per_unit);
4837 if (p & VisualChange::YOrigin) {
4838 vertical_adjustment.set_value (pending_visual_change.y_origin);
4841 nframes64_t csf=0, cef=0;
4842 nframes64_t current_time_origin = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
4845 csf = session->current_start_frame();
4846 cef = session->current_end_frame();
4849 /* if we seek beyond the current end of the canvas, move the end */
4851 #ifdef FIX_THIS_FOR_V3
4852 if (last_time_origin == horizontal_adjustment.get_value() ) {
4853 /* changed signal not emitted */
4854 update_fixed_rulers ();
4855 redisplay_tempo (true);
4859 if (current_time_origin != pending_visual_change.time_origin) {
4860 cef += current_page_frames() / 10; // Add a little extra so we can see the end marker
4861 horizontal_adjustment.set_upper (cef / frames_per_unit);
4862 horizontal_adjustment.set_value (pending_visual_change.time_origin / frames_per_unit);
4864 update_fixed_rulers();
4865 redisplay_tempo (true);
4868 _summary->set_overlays_dirty ();
4870 //cerr << "Editor::idle_visual_changer () called ha v:l:u:ps:fpu = " << horizontal_adjustment.get_value() << ":" << horizontal_adjustment.get_lower() << ":" << horizontal_adjustment.get_upper() << ":" << horizontal_adjustment.get_page_size() << ":" << frames_per_unit << endl;//DEBUG
4871 pending_visual_change.idle_handler_id = -1;
4872 return 0; /* this is always a one-shot call */
4875 struct EditorOrderTimeAxisSorter {
4876 bool operator() (const TimeAxisView* a, const TimeAxisView* b) const {
4877 return a->order () < b->order ();
4882 Editor::sort_track_selection (TrackSelection* sel)
4884 EditorOrderTimeAxisSorter cmp;
4889 selection->tracks.sort (cmp);
4894 Editor::get_preferred_edit_position (bool ignore_playhead)
4897 nframes64_t where = 0;
4898 EditPoint ep = _edit_point;
4900 if (entered_marker) {
4901 return entered_marker->position();
4904 if (ignore_playhead && ep == EditAtPlayhead) {
4905 ep = EditAtSelectedMarker;
4909 case EditAtPlayhead:
4910 where = session->audible_frame();
4913 case EditAtSelectedMarker:
4914 if (!selection->markers.empty()) {
4916 Location* loc = find_location_from_marker (selection->markers.front(), is_start);
4919 where = loc->start();
4930 if (!mouse_frame (where, ignored)) {
4931 /* XXX not right but what can we do ? */
4942 Editor::set_loop_range (nframes64_t start, nframes64_t end, string cmd)
4944 if (!session) return;
4946 begin_reversible_command (cmd);
4950 if ((tll = transport_loop_location()) == 0) {
4951 Location* loc = new Location (start, end, _("Loop"), Location::IsAutoLoop);
4952 XMLNode &before = session->locations()->get_state();
4953 session->locations()->add (loc, true);
4954 session->set_auto_loop_location (loc);
4955 XMLNode &after = session->locations()->get_state();
4956 session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
4958 XMLNode &before = tll->get_state();
4959 tll->set_hidden (false, this);
4960 tll->set (start, end);
4961 XMLNode &after = tll->get_state();
4962 session->add_command (new MementoCommand<Location>(*tll, &before, &after));
4965 commit_reversible_command ();
4969 Editor::set_punch_range (nframes64_t start, nframes64_t end, string cmd)
4971 if (!session) return;
4973 begin_reversible_command (cmd);
4977 if ((tpl = transport_punch_location()) == 0) {
4978 Location* loc = new Location (start, end, _("Loop"), Location::IsAutoPunch);
4979 XMLNode &before = session->locations()->get_state();
4980 session->locations()->add (loc, true);
4981 session->set_auto_loop_location (loc);
4982 XMLNode &after = session->locations()->get_state();
4983 session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
4986 XMLNode &before = tpl->get_state();
4987 tpl->set_hidden (false, this);
4988 tpl->set (start, end);
4989 XMLNode &after = tpl->get_state();
4990 session->add_command (new MementoCommand<Location>(*tpl, &before, &after));
4993 commit_reversible_command ();
4997 Editor::get_regions_at (RegionSelection& rs, nframes64_t where, const TrackSelection& ts) const
4999 const TrackSelection* tracks;
5002 tracks = &track_views;
5007 for (TrackSelection::const_iterator t = tracks->begin(); t != tracks->end(); ++t) {
5008 RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(*t);
5010 boost::shared_ptr<Diskstream> ds;
5011 boost::shared_ptr<Playlist> pl;
5013 if ((ds = rtv->get_diskstream()) && ((pl = ds->playlist()))) {
5015 Playlist::RegionList* regions = pl->regions_at (
5016 (nframes64_t) floor ( (double)where * ds->speed()));
5018 for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) {
5019 RegionView* rv = rtv->view()->find_view (*i);
5032 Editor::get_regions_after (RegionSelection& rs, nframes64_t where, const TrackSelection& ts) const
5034 const TrackSelection* tracks;
5037 tracks = &track_views;
5042 for (TrackSelection::const_iterator t = tracks->begin(); t != tracks->end(); ++t) {
5043 RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(*t);
5045 boost::shared_ptr<Diskstream> ds;
5046 boost::shared_ptr<Playlist> pl;
5048 if ((ds = rtv->get_diskstream()) && ((pl = ds->playlist()))) {
5050 Playlist::RegionList* regions = pl->regions_touched (
5051 (nframes64_t) floor ( (double)where * ds->speed()), max_frames);
5053 for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) {
5055 RegionView* rv = rtv->view()->find_view (*i);
5069 Editor::get_regions_for_action (RegionSelection& rs, bool allow_entered)
5071 if (selection->regions.empty()) {
5073 if (selection->tracks.empty()) {
5075 /* no regions or tracks selected
5078 if (entered_regionview && mouse_mode == Editing::MouseObject) {
5080 /* entered regionview is valid and we're in object mode -
5081 just use entered regionview
5084 rs.add (entered_regionview);
5091 /* no regions selected, so get all regions at the edit point across
5092 all selected tracks.
5095 nframes64_t where = get_preferred_edit_position();
5096 get_regions_at (rs, where, selection->tracks);
5098 /* if the entered regionview wasn't selected and neither was its track
5102 if (entered_regionview != 0 &&
5103 !selection->selected (entered_regionview) &&
5104 !selection->selected (&entered_regionview->get_time_axis_view())) {
5105 rs.add (entered_regionview);
5111 /* just use the selected regions */
5113 rs = selection->regions;
5115 /* if the entered regionview wasn't selected and we allow this sort of thing,
5119 if (allow_entered && entered_regionview && !selection->selected (entered_regionview)) {
5120 rs.add (entered_regionview);
5127 Editor::get_regions_corresponding_to (boost::shared_ptr<Region> region, vector<RegionView*>& regions)
5130 for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
5132 RouteTimeAxisView* tatv;
5134 if ((tatv = dynamic_cast<RouteTimeAxisView*> (*i)) != 0) {
5136 boost::shared_ptr<Playlist> pl;
5137 vector<boost::shared_ptr<Region> > results;
5139 boost::shared_ptr<Diskstream> ds;
5141 if ((ds = tatv->get_diskstream()) == 0) {
5146 if ((pl = (ds->playlist())) != 0) {
5147 pl->get_region_list_equivalent_regions (region, results);
5150 for (vector<boost::shared_ptr<Region> >::iterator ir = results.begin(); ir != results.end(); ++ir) {
5151 if ((marv = tatv->view()->find_view (*ir)) != 0) {
5152 regions.push_back (marv);
5161 Editor::show_rhythm_ferret ()
5163 if (rhythm_ferret == 0) {
5164 rhythm_ferret = new RhythmFerret(*this);
5167 rhythm_ferret->set_session (session);
5168 rhythm_ferret->show ();
5169 rhythm_ferret->present ();
5173 Editor::show_bundle_manager ()
5175 if (_bundle_manager == 0) {
5176 _bundle_manager = new BundleManager (*session);
5179 _bundle_manager->show ();
5183 Editor::show_global_port_matrix (ARDOUR::DataType t)
5185 if (_global_port_matrix[t] == 0) {
5186 _global_port_matrix[t] = new GlobalPortMatrixWindow (*session, t);
5189 _global_port_matrix[t]->show ();
5193 Editor::first_idle ()
5195 MessageDialog* dialog = 0;
5197 if (track_views.size() > 1) {
5198 dialog = new MessageDialog (*this,
5199 _("Please wait while Ardour loads visual data"),
5204 ARDOUR_UI::instance()->flush_pending ();
5207 for (TrackViewList::iterator t = track_views.begin(); t != track_views.end(); ++t) {
5211 // first idle adds route children (automation tracks), so we need to redisplay here
5212 redisplay_route_list();
5220 _idle_resizer (gpointer arg)
5222 return ((Editor*)arg)->idle_resize ();
5226 Editor::add_to_idle_resize (TimeAxisView* view, int32_t h)
5228 if (resize_idle_id < 0) {
5229 resize_idle_id = g_idle_add (_idle_resizer, this);
5230 _pending_resize_amount = 0;
5233 /* make a note of the smallest resulting height, so that we can clamp the
5234 lower limit at TimeAxisView::hSmall */
5236 int32_t min_resulting = INT32_MAX;
5238 _pending_resize_amount += h;
5239 _pending_resize_view = view;
5241 min_resulting = min (min_resulting, int32_t (_pending_resize_view->current_height()) + _pending_resize_amount);
5243 for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
5244 min_resulting = min (min_resulting, int32_t ((*i)->current_height()) + _pending_resize_amount);
5247 if (min_resulting < 0) {
5252 if (uint32_t (min_resulting) < TimeAxisView::hSmall) {
5253 _pending_resize_amount += TimeAxisView::hSmall - min_resulting;
5257 /** Handle pending resizing of tracks */
5259 Editor::idle_resize ()
5261 _pending_resize_view->idle_resize (_pending_resize_view->current_height() + _pending_resize_amount);
5262 for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
5263 if (*i != _pending_resize_view) {
5264 (*i)->idle_resize ((*i)->current_height() + _pending_resize_amount);
5269 resize_idle_id = -1;
5276 ENSURE_GUI_THREAD (mem_fun (*this, &Editor::located));
5278 _pending_locate_request = false;
5282 Editor::region_view_added (RegionView *)
5284 _summary->set_dirty ();
5288 Editor::streamview_height_changed ()
5290 _summary->set_dirty ();