#include "gtkmm2ext/choice.h"
#include "gtkmm2ext/cell_renderer_pixbuf_toggle.h"
-#include "ardour/audio_diskstream.h"
#include "ardour/audio_track.h"
#include "ardour/audioplaylist.h"
#include "ardour/audioregion.h"
#include "marker.h"
#include "midi_time_axis.h"
#include "mixer_strip.h"
+#include "mixer_ui.h"
#include "mouse_cursors.h"
#include "playlist_selector.h"
#include "public_editor.h"
/* tool bar related */
- , zoom_range_clock (new AudioClock (X_("zoomrange"), false, X_("ZoomRangeClock"), true, false, true))
+ , zoom_range_clock (new AudioClock (X_("zoomrange"), false, X_("zoom range"), true, false, true))
, toolbar_selection_clock_table (2,3)
, automation_mode_button (_("mode"))
, _toolbar_viewport (*manage (new Gtk::Adjustment (0, 0, 1e10)), *manage (new Gtk::Adjustment (0, 0, 1e10)))
- , midi_panic_button (_("Panic"))
#ifdef WITH_CMT
, image_socket_listener(0)
/* nudge */
- , nudge_clock (new AudioClock (X_("nudge"), false, X_("NudgeClock"), true, false, true))
+ , nudge_clock (new AudioClock (X_("nudge"), false, X_("nudge"), true, false, true))
, meters_running(false)
, _pending_locate_request (false)
, _pending_initial_locate (false)
, _last_cut_copy_source_track (0)
, _region_selection_change_updates_region_list (true)
+ , _following_mixer_selection (false)
{
constructed = false;
pre_press_cursor = 0;
_drags = new DragManager (this);
current_mixer_strip = 0;
- current_bbt_points = 0;
tempo_lines = 0;
snap_type_strings = I18N (_snap_type_strings);
current_interthread_info = 0;
_show_measures = true;
show_gain_after_trim = false;
- last_item_entered = 0;
have_pending_keyboard_selection = false;
_follow_playhead = true;
/* register actions now so that set_state() can find them and set toggles/checks etc */
register_actions ();
+ /* when we start using our own keybinding system for the editor, this
+ * will be uncommented
+ */
+ // load_bindings ();
setup_toolbar ();
- setup_midi_toolbar ();
_snap_type = SnapToBeat;
set_snap_to (_snap_type);
if (current_mixer_strip) {
current_mixer_strip->hide_things ();
+ current_mixer_strip->parameter_changed ("mixer-strip-visibility");
}
}
compute_fixed_ruler_scale ();
+ /* Make sure we have auto loop and auto punch ranges */
+
+ Location* loc = _session->locations()->auto_loop_location();
+ if (loc == 0) {
+ loc = new Location (*_session, 0, _session->current_end_frame(), _("Loop"),(Location::Flags) (Location::IsAutoLoop | Location::IsHidden));
+
+ if (loc->start() == loc->end()) {
+ loc->set_end (loc->start() + 1);
+ }
+
+ _session->locations()->add (loc, false);
+ _session->set_auto_loop_location (loc);
+ } else {
+ // force name
+ loc->set_name (_("Loop"));
+ }
+
+ loc = _session->locations()->auto_punch_location();
+
+ if (loc == 0) {
+ loc = new Location (*_session, 0, _session->current_end_frame(), _("Punch"), (Location::Flags) (Location::IsAutoPunch | Location::IsHidden));
+
+ if (loc->start() == loc->end()) {
+ loc->set_end (loc->start() + 1);
+ }
+
+ _session->locations()->add (loc, false);
+ _session->set_auto_punch_location (loc);
+ } else {
+ // force name
+ loc->set_name (_("Punch"));
+ }
+
+ refresh_location_display ();
+
+ /* This must happen after refresh_location_display(), as (amongst other things) we restore
+ the selected Marker; this needs the LocationMarker list to be available.
+ */
XMLNode* node = ARDOUR_UI::instance()->editor_settings();
set_state (*node, Stateful::loading_state_version);
bbt.ticks = 120;
framepos_t pos = _session->tempo_map().bbt_duration_at (0, bbt, 1);
nudge_clock->set_mode(AudioClock::BBT);
- nudge_clock->set (pos, true, 0, AudioClock::BBT);
+ nudge_clock->set (pos, true);
} else {
- nudge_clock->set (_session->frame_rate() * 5, true, 0, AudioClock::Timecode); // default of 5 seconds
+ nudge_clock->set_mode (AudioClock::Timecode);
+ nudge_clock->set (_session->frame_rate() * 5, true);
}
playhead_cursor->canvas_item.show ();
- Location* loc = _session->locations()->auto_loop_location();
- if (loc == 0) {
- loc = new Location (*_session, 0, _session->current_end_frame(), _("Loop"),(Location::Flags) (Location::IsAutoLoop | Location::IsHidden));
-
- if (loc->start() == loc->end()) {
- loc->set_end (loc->start() + 1);
- }
-
- _session->locations()->add (loc, false);
- _session->set_auto_loop_location (loc);
- } else {
- // force name
- loc->set_name (_("Loop"));
- }
-
- loc = _session->locations()->auto_punch_location();
-
- if (loc == 0) {
- loc = new Location (*_session, 0, _session->current_end_frame(), _("Punch"), (Location::Flags) (Location::IsAutoPunch | Location::IsHidden));
-
- if (loc->start() == loc->end()) {
- loc->set_end (loc->start() + 1);
- }
-
- _session->locations()->add (loc, false);
- _session->set_auto_punch_location (loc);
- } else {
- // force name
- loc->set_name (_("Punch"));
- }
-
boost::function<void (string)> pc (boost::bind (&Editor::parameter_changed, this, _1));
Config->map_parameters (pc);
_session->config.map_parameters (pc);
- refresh_location_display ();
-
restore_ruler_visibility ();
//tempo_map_changed (PropertyChange (0));
_session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
edit_items.push_back (*_popup_region_menu_item);
if (track->playlist()->count_regions_at (mouse) > 1 && (layering_order_editor == 0 || !layering_order_editor->is_visible ())) {
- edit_items.push_back (*manage (_region_actions->get_action ("choose-top-region")->create_menu_item ()));
+ edit_items.push_back (*manage (_region_actions->get_action ("choose-top-region-context-menu")->create_menu_item ()));
}
edit_items.push_back (SeparatorElem());
}
cutnpaste_items.push_back (MenuElem (_("Cut"), sigc::mem_fun(*this, &Editor::cut)));
cutnpaste_items.push_back (MenuElem (_("Copy"), sigc::mem_fun(*this, &Editor::copy)));
- cutnpaste_items.push_back (MenuElem (_("Paste"), sigc::bind (sigc::mem_fun(*this, &Editor::paste), 1.0f)));
+ cutnpaste_items.push_back (MenuElem (_("Paste"), sigc::bind (sigc::mem_fun(*this, &Editor::paste), 1.0f, true)));
cutnpaste_items.push_back (SeparatorElem());
cutnpaste_items.push_back (MenuElem (_("Cut"), sigc::mem_fun(*this, &Editor::cut)));
cutnpaste_items.push_back (MenuElem (_("Copy"), sigc::mem_fun(*this, &Editor::copy)));
- cutnpaste_items.push_back (MenuElem (_("Paste"), sigc::bind (sigc::mem_fun(*this, &Editor::paste), 1.0f)));
+ cutnpaste_items.push_back (MenuElem (_("Paste"), sigc::bind (sigc::mem_fun(*this, &Editor::paste), 1.0f, true)));
Menu *nudge_menu = manage (new Menu());
MenuList& nudge_items = nudge_menu->items();
/** @param y y offset from the top of all trackviews.
* @return pair: TimeAxisView that y is over, layer index.
* TimeAxisView may be 0. Layer index is the layer number if the TimeAxisView is valid and is
- * in stacked region display mode, otherwise 0.
+ * in stacked or expanded region display mode, otherwise 0.
*/
-std::pair<TimeAxisView *, layer_t>
+std::pair<TimeAxisView *, double>
Editor::trackview_by_y_position (double y)
{
for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
- std::pair<TimeAxisView*, int> const r = (*iter)->covers_y_position (y);
+ std::pair<TimeAxisView*, double> const r = (*iter)->covers_y_position (y);
if (r.first) {
return r;
}
/* table containing mode buttons */
HBox* mouse_mode_button_box = manage (new HBox ());
+ mouse_mode_button_box->set_spacing (2);
if (Profile->get_sae()) {
mouse_mode_button_box->pack_start (mouse_move_button);
mouse_mode_button_box->pack_start (mouse_timefx_button);
mouse_mode_button_box->pack_start (mouse_audition_button);
+ mouse_mode_button_box->pack_start (mouse_draw_button);
mouse_mode_button_box->pack_start (internal_edit_button);
edit_mode_strings.push_back (edit_mode_to_string (Slide));
edit_mode_strings.push_back (edit_mode_to_string (Lock));
edit_mode_selector.set_name ("EditModeSelector");
- set_popdown_strings (edit_mode_selector, edit_mode_strings, true);
+ set_popdown_strings (edit_mode_selector, edit_mode_strings);
edit_mode_selector.signal_changed().connect (sigc::mem_fun(*this, &Editor::edit_mode_selection_done));
- mode_box->pack_start (edit_mode_selector);
- mode_box->pack_start (*mouse_mode_button_box);
+ mode_box->pack_start (edit_mode_selector, false, false);
+ mode_box->pack_start (*mouse_mode_button_box, false, false);
_mouse_mode_tearoff = manage (new TearOff (*mode_box));
_mouse_mode_tearoff->set_name ("MouseModeBase");
_mouse_mode_tearoff->Visible.connect (sigc::bind (sigc::mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox),
&_mouse_mode_tearoff->tearoff_window(), 1));
- mouse_move_button.set_mode (false);
- mouse_select_button.set_mode (false);
- mouse_gain_button.set_mode (false);
- mouse_zoom_button.set_mode (false);
- mouse_timefx_button.set_mode (false);
- mouse_audition_button.set_mode (false);
- join_object_range_button.set_mode (false);
-
- mouse_move_button.set_name ("MouseModeButton");
- mouse_select_button.set_name ("MouseModeButton");
- mouse_gain_button.set_name ("MouseModeButton");
- mouse_zoom_button.set_name ("MouseModeButton");
- mouse_timefx_button.set_name ("MouseModeButton");
- mouse_audition_button.set_name ("MouseModeButton");
- internal_edit_button.set_name ("MouseModeButton");
- join_object_range_button.set_name ("MouseModeButton");
-
- mouse_move_button.unset_flags (CAN_FOCUS);
- mouse_select_button.unset_flags (CAN_FOCUS);
- mouse_gain_button.unset_flags (CAN_FOCUS);
- mouse_zoom_button.unset_flags (CAN_FOCUS);
- mouse_timefx_button.unset_flags (CAN_FOCUS);
- mouse_audition_button.unset_flags (CAN_FOCUS);
- internal_edit_button.unset_flags (CAN_FOCUS);
- join_object_range_button.unset_flags (CAN_FOCUS);
-
/* Zoom */
- _zoom_box.set_spacing (1);
- _zoom_box.set_border_width (0);
+ _zoom_box.set_spacing (2);
+ _zoom_box.set_border_width (2);
+
+ RefPtr<Action> act;
- zoom_in_button.set_name ("EditorTimeButton");
- zoom_in_button.set_image (*(manage (new Image (::get_icon ("zoom_in")))));
- zoom_in_button.signal_clicked().connect (sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_step), false));
+ zoom_in_button.set_name ("zoom button");
+ zoom_in_button.set_image (::get_icon ("zoom_in"));
+ zoom_in_button.set_tweaks (ArdourButton::ShowClick);
+ act = ActionManager::get_action (X_("Editor"), X_("temporal-zoom-in"));
+ zoom_in_button.set_related_action (act);
- zoom_out_button.set_name ("EditorTimeButton");
- zoom_out_button.set_image (*(manage (new Image (::get_icon ("zoom_out")))));
- zoom_out_button.signal_clicked().connect (sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_step), true));
+ zoom_out_button.set_name ("zoom button");
+ zoom_out_button.set_image (::get_icon ("zoom_out"));
+ zoom_out_button.set_tweaks (ArdourButton::ShowClick);
+ act = ActionManager::get_action (X_("Editor"), X_("temporal-zoom-out"));
+ zoom_out_button.set_related_action (act);
- zoom_out_full_button.set_name ("EditorTimeButton");
- zoom_out_full_button.set_image (*(manage (new Image (::get_icon ("zoom_full")))));
- zoom_out_full_button.signal_clicked().connect (sigc::mem_fun(*this, &Editor::temporal_zoom_session));
+ zoom_out_full_button.set_name ("zoom button");
+ zoom_out_full_button.set_image (::get_icon ("zoom_full"));
+ zoom_out_full_button.set_tweaks (ArdourButton::ShowClick);
+ act = ActionManager::get_action (X_("Editor"), X_("zoom-to-session"));
+ zoom_out_full_button.set_related_action (act);
zoom_focus_selector.set_name ("ZoomFocusSelector");
- set_popdown_strings (zoom_focus_selector, zoom_focus_strings, true);
+ set_popdown_strings (zoom_focus_selector, zoom_focus_strings);
zoom_focus_selector.signal_changed().connect (sigc::mem_fun(*this, &Editor::zoom_focus_selection_done));
_zoom_box.pack_start (zoom_out_button, false, false);
_zoom_box.pack_start (zoom_in_button, false, false);
_zoom_box.pack_start (zoom_out_full_button, false, false);
- _zoom_box.pack_start (zoom_focus_selector);
+ _zoom_box.pack_start (zoom_focus_selector, false, false);
/* Track zoom buttons */
tav_expand_button.set_name ("TrackHeightButton");
tav_expand_button.set_size_request (-1, 20);
tav_expand_button.add (*(manage (new Image (::get_icon ("tav_exp")))));
- RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("expand-tracks"));
+ act = ActionManager::get_action (X_("Editor"), X_("expand-tracks"));
act->connect_proxy (tav_expand_button);
tav_shrink_button.set_name ("TrackHeightButton");
snap_box.set_border_width (2);
snap_type_selector.set_name ("SnapTypeSelector");
- set_popdown_strings (snap_type_selector, snap_type_strings, true);
+ set_popdown_strings (snap_type_selector, snap_type_strings);
snap_type_selector.signal_changed().connect (sigc::mem_fun(*this, &Editor::snap_type_selection_done));
snap_mode_selector.set_name ("SnapModeSelector");
- set_popdown_strings (snap_mode_selector, snap_mode_strings, true);
+ set_popdown_strings (snap_mode_selector, snap_mode_strings);
snap_mode_selector.signal_changed().connect (sigc::mem_fun(*this, &Editor::snap_mode_selection_done));
edit_point_selector.set_name ("EditPointSelector");
- set_popdown_strings (edit_point_selector, edit_point_strings, true);
+ set_popdown_strings (edit_point_selector, edit_point_strings);
edit_point_selector.signal_changed().connect (sigc::mem_fun(*this, &Editor::edit_point_selection_done));
snap_box.pack_start (snap_mode_selector, false, false);
/* Nudge */
HBox *nudge_box = manage (new HBox);
- nudge_box->set_spacing(1);
+ nudge_box->set_spacing (2);
nudge_box->set_border_width (2);
nudge_forward_button.signal_button_release_event().connect (sigc::mem_fun(*this, &Editor::nudge_forward_release), false);
toolbar_frame.set_shadow_type (SHADOW_OUT);
toolbar_frame.set_name ("BaseFrame");
toolbar_frame.add (_toolbar_viewport);
-
- DPIReset.connect (sigc::mem_fun (*this, &Editor::resize_text_widgets));
}
void
Editor::setup_tooltips ()
{
ARDOUR_UI::instance()->set_tip (mouse_move_button, _("Select/Move Objects"));
+ ARDOUR_UI::instance()->set_tip (mouse_select_button, _("Select/Move Ranges"));
+ ARDOUR_UI::instance()->set_tip (mouse_draw_button, _("Draw/Edit MIDI Notes"));
ARDOUR_UI::instance()->set_tip (mouse_gain_button, _("Draw Region Gain"));
ARDOUR_UI::instance()->set_tip (mouse_zoom_button, _("Select Zoom Range"));
ARDOUR_UI::instance()->set_tip (mouse_timefx_button, _("Stretch/Shrink Regions and MIDI Notes"));
ARDOUR_UI::instance()->set_tip (snap_type_selector, _("Snap/Grid Units"));
ARDOUR_UI::instance()->set_tip (snap_mode_selector, _("Snap/Grid Mode"));
ARDOUR_UI::instance()->set_tip (edit_point_selector, _("Edit point"));
- ARDOUR_UI::instance()->set_tip (midi_sound_notes, _("Sound Notes"));
- ARDOUR_UI::instance()->set_tip (midi_panic_button, _("Send note off and reset controller messages on all MIDI channels"));
ARDOUR_UI::instance()->set_tip (edit_mode_selector, _("Edit Mode"));
}
-void
-Editor::midi_panic ()
-{
- cerr << "MIDI panic\n";
-
- if (_session) {
- _session->midi_panic();
- }
-}
-
-void
-Editor::setup_midi_toolbar ()
-{
- RefPtr<Action> act;
-
- /* Midi sound notes */
- midi_sound_notes.add (*(manage (new Image (::get_icon("midi_sound_notes")))));
- midi_sound_notes.unset_flags (CAN_FOCUS);
- midi_sound_notes.set_name (X_("MidiSoundNotesButton"));
-
- /* Panic */
-
- act = ActionManager::get_action (X_("MIDI"), X_("panic"));
- midi_panic_button.set_name("MidiPanicButton");
- act->connect_proxy (midi_panic_button);
-
- panic_box.pack_start (midi_sound_notes , true, true);
- panic_box.pack_start (midi_panic_button, true, true);
-}
-
int
Editor::convert_drop_to_paths (
vector<string>& paths,
if (undo_action && _session) {
if (_session->undo_depth() == 0) {
- label = _("Undo");
+ label = S_("Command|Undo");
} else {
- label = string_compose(_("Undo (%1)"), _session->next_undo());
+ label = string_compose(S_("Command|Undo (%1)"), _session->next_undo());
}
undo_action->property_label() = label;
}
void
Editor::detach_tearoff (Box* /*b*/, Window* /*w*/)
{
- if (_tools_tearoff->torn_off() && _mouse_mode_tearoff->torn_off()) {
+ if ((_tools_tearoff->torn_off() || !_tools_tearoff->visible()) &&
+ (_mouse_mode_tearoff->torn_off() || !_mouse_mode_tearoff->visible()) &&
+ (_zoom_tearoff->torn_off() || !_zoom_tearoff->visible())) {
top_hbox.remove (toolbar_frame);
}
}
case SnapToBar:
if (_session) {
- return _session->tempo_map().meter_at (position).beats_per_bar();
+ return _session->tempo_map().meter_at (position).divisions_per_bar();
}
break;
void
Editor::maximise_editing_space ()
{
+ /* these calls will leave each tearoff visible *if* it is torn off
+ */
+
_mouse_mode_tearoff->set_visible (false);
_tools_tearoff->set_visible (false);
_zoom_tearoff->set_visible (false);
};
void
-Editor::sort_track_selection (TrackViewList* sel)
+Editor::sort_track_selection (TrackViewList& sel)
{
EditorOrderTimeAxisSorter cmp;
-
- if (sel) {
- sel->sort (cmp);
- } else {
- selection->tracks.sort (cmp);
- }
+ sel.sort (cmp);
}
framepos_t
-Editor::get_preferred_edit_position (bool ignore_playhead)
+Editor::get_preferred_edit_position (bool ignore_playhead, bool from_context_menu)
{
bool ignored;
framepos_t where = 0;
EditPoint ep = _edit_point;
+ if (from_context_menu && (ep == EditAtMouse)) {
+ return event_frame (&context_click_event, 0, 0);
+ }
+
if (entered_marker) {
DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("GPEP: use entered marker @ %1\n", entered_marker->position()));
return entered_marker->position();
if ((tr = rtv->track()) && ((pl = tr->playlist()))) {
- Playlist::RegionList* regions = pl->regions_at (
+ boost::shared_ptr<Playlist::RegionList> regions = pl->regions_at (
(framepos_t) floor ( (double) where * tr->speed()));
for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) {
rs.add (rv);
}
}
-
- delete regions;
}
}
}
if ((tr = rtv->track()) && ((pl = tr->playlist()))) {
- Playlist::RegionList* regions = pl->regions_touched (
+ boost::shared_ptr<Playlist::RegionList> regions = pl->regions_touched (
(framepos_t) floor ( (double)where * tr->speed()), max_framepos);
for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) {
rs.push_back (rv);
}
}
-
- delete regions;
}
}
}
Editor::first_idle ()
{
MessageDialog* dialog = 0;
-
+
if (track_views.size() > 1) {
- dialog = new MessageDialog (*this,
- string_compose (_("Please wait while %1 loads visual data"), PROGRAM_NAME),
- true,
- Gtk::MESSAGE_INFO,
- Gtk::BUTTONS_NONE);
+ dialog = new MessageDialog (
+ *this,
+ string_compose (_("Please wait while %1 loads visual data."), PROGRAM_NAME),
+ true
+ );
dialog->present ();
ARDOUR_UI::instance()->flush_pending ();
}
_routes->redisplay ();
delete dialog;
-
_have_idled = true;
}
/** Find a RouteTimeAxisView by the ID of its route */
RouteTimeAxisView*
-Editor::get_route_view_by_route_id (PBD::ID& id) const
+Editor::get_route_view_by_route_id (const PBD::ID& id) const
{
RouteTimeAxisView* v;
hide_measures ();
clear_marker_display ();
- delete current_bbt_points;
- current_bbt_points = 0;
+ current_bbt_points_begin = current_bbt_points_end;
/* get rid of any existing editor mixer strip */
}
void
-Editor::change_region_layering_order ()
+Editor::change_region_layering_order (bool from_context_menu)
{
- framepos_t const position = get_preferred_edit_position ();
+ const framepos_t position = get_preferred_edit_position (false, from_context_menu);
if (!clicked_routeview) {
if (layering_order_editor) {
}
if (layering_order_editor == 0) {
- layering_order_editor = new RegionLayeringOrderEditor(*this);
+ layering_order_editor = new RegionLayeringOrderEditor (*this);
+ layering_order_editor->set_position (WIN_POS_MOUSE);
}
layering_order_editor->set_context (clicked_routeview->name(), _session, pl, position);
Editor::update_region_layering_order_editor ()
{
if (layering_order_editor && layering_order_editor->is_visible ()) {
- change_region_layering_order ();
+ change_region_layering_order (true);
}
}
return *manage (a->create_menu_item ());
}
-void
-Editor::resize_text_widgets ()
-{
- set_size_request_to_display_given_text (edit_mode_selector, edit_mode_strings, COMBO_FUDGE+10, 15);
- set_size_request_to_display_given_text (zoom_focus_selector, zoom_focus_strings, COMBO_FUDGE+10, 15);
- set_size_request_to_display_given_text (snap_type_selector, snap_type_strings, COMBO_FUDGE+10, 15);
- set_size_request_to_display_given_text (snap_mode_selector, snap_mode_strings, COMBO_FUDGE+10, 15);
- set_size_request_to_display_given_text (edit_point_selector, edit_point_strings, COMBO_FUDGE+10, 15);
-}
-
void
Editor::add_notebook_page (string const & name, Gtk::Widget& widget)
{
_control_point_context_menu.popup (event->button.button, event->button.time);
}
+