#include <gdkmm/color.h>
#include <gdkmm/bitmap.h>
-#include <gtkmm2ext/grouped_buttons.h>
-#include <gtkmm2ext/gtk_ui.h>
-#include <gtkmm2ext/tearoff.h>
-#include <gtkmm2ext/utils.h>
-#include <gtkmm2ext/window_title.h>
-#include <gtkmm2ext/choice.h>
-#include <gtkmm2ext/cell_renderer_pixbuf_toggle.h>
+#include "gtkmm2ext/bindings.h"
+#include "gtkmm2ext/grouped_buttons.h"
+#include "gtkmm2ext/gtk_ui.h"
+#include "gtkmm2ext/tearoff.h"
+#include "gtkmm2ext/utils.h"
+#include "gtkmm2ext/window_title.h"
+#include "gtkmm2ext/choice.h"
+#include "gtkmm2ext/cell_renderer_pixbuf_toggle.h"
#include "ardour/audio_diskstream.h"
#include "ardour/audio_track.h"
#include "control_protocol/control_protocol.h"
#include "editor.h"
+#include "debug.h"
#include "keyboard.h"
#include "marker.h"
#include "playlist_selector.h"
controls_layout.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
controls_layout.signal_button_release_event().connect (sigc::mem_fun(*this, &Editor::edit_controls_button_release));
- controls_layout_size_request_connection = controls_layout.signal_size_request().connect (sigc::mem_fun (*this, &Editor::controls_layout_size_request));
_cursors = new MouseCursors;
Button* summary_arrows_left_left = manage (new Button);
summary_arrows_left_left->add (*manage (new Arrow (ARROW_LEFT, SHADOW_NONE)));
- summary_arrows_left_left->signal_pressed().connect (sigc::hide_return (sigc::mem_fun (*this, &Editor::horizontal_scroll_left_press)));
- summary_arrows_left_left->signal_released().connect (sigc::mem_fun (*this, &Editor::horizontal_scroll_left_release));
+ summary_arrows_left_left->signal_pressed().connect (sigc::hide_return (sigc::bind (sigc::mem_fun (*this, &Editor::scroll_press), LEFT)));
+ summary_arrows_left_left->signal_released().connect (sigc::mem_fun (*this, &Editor::scroll_release));
Button* summary_arrows_left_right = manage (new Button);
summary_arrows_left_right->add (*manage (new Arrow (ARROW_RIGHT, SHADOW_NONE)));
- summary_arrows_left_right->signal_pressed().connect (sigc::hide_return (sigc::mem_fun (*this, &Editor::horizontal_scroll_right_press)));
- summary_arrows_left_right->signal_released().connect (sigc::mem_fun (*this, &Editor::horizontal_scroll_right_release));
+ summary_arrows_left_right->signal_pressed().connect (sigc::hide_return (sigc::bind (sigc::mem_fun (*this, &Editor::scroll_press), RIGHT)));
+ summary_arrows_left_right->signal_released().connect (sigc::mem_fun (*this, &Editor::scroll_release));
VBox* summary_arrows_left = manage (new VBox);
summary_arrows_left->pack_start (*summary_arrows_left_left);
summary_arrows_left->pack_start (*summary_arrows_left_right);
- Button* summary_arrows_right_left = manage (new Button);
- summary_arrows_right_left->add (*manage (new Arrow (ARROW_LEFT, SHADOW_NONE)));
- summary_arrows_right_left->signal_pressed().connect (sigc::hide_return (sigc::mem_fun (*this, &Editor::horizontal_scroll_left_press)));
- summary_arrows_right_left->signal_released().connect (sigc::mem_fun (*this, &Editor::horizontal_scroll_left_release));
+ Button* summary_arrows_right_up = manage (new Button);
+ summary_arrows_right_up->add (*manage (new Arrow (ARROW_UP, SHADOW_NONE)));
+ summary_arrows_right_up->signal_pressed().connect (sigc::hide_return (sigc::bind (sigc::mem_fun (*this, &Editor::scroll_press), UP)));
+ summary_arrows_right_up->signal_released().connect (sigc::mem_fun (*this, &Editor::scroll_release));
- Button* summary_arrows_right_right = manage (new Button);
- summary_arrows_right_right->add (*manage (new Arrow (ARROW_RIGHT, SHADOW_NONE)));
- summary_arrows_right_right->signal_pressed().connect (sigc::hide_return (sigc::mem_fun (*this, &Editor::horizontal_scroll_right_press)));
- summary_arrows_right_right->signal_released().connect (sigc::mem_fun (*this, &Editor::horizontal_scroll_right_release));
+ Button* summary_arrows_right_down = manage (new Button);
+ summary_arrows_right_down->add (*manage (new Arrow (ARROW_DOWN, SHADOW_NONE)));
+ summary_arrows_right_down->signal_pressed().connect (sigc::hide_return (sigc::bind (sigc::mem_fun (*this, &Editor::scroll_press), DOWN)));
+ summary_arrows_right_down->signal_released().connect (sigc::mem_fun (*this, &Editor::scroll_release));
VBox* summary_arrows_right = manage (new VBox);
- summary_arrows_right->pack_start (*summary_arrows_right_left);
- summary_arrows_right->pack_start (*summary_arrows_right_right);
+ summary_arrows_right->pack_start (*summary_arrows_right_up);
+ summary_arrows_right->pack_start (*summary_arrows_right_down);
Frame* summary_frame = manage (new Frame);
summary_frame->set_shadow_type (Gtk::SHADOW_ETCHED_IN);
_snap_mode = SnapOff;
set_snap_mode (_snap_mode);
set_mouse_mode (MouseObject, true);
+ pre_internal_mouse_mode = MouseObject;
set_edit_point_preference (EditAtMouse, true);
_playlist_selector = new PlaylistSelector();
window_icons.push_back (icon);
}
if (!window_icons.empty()) {
- set_icon_list (window_icons);
+ // set_icon_list (window_icons);
set_default_icon_list (window_icons);
}
_show_marker_lines = false;
_over_region_trim_target = false;
+ /* Button bindings */
+
+ button_bindings = new Bindings;
+
+ XMLNode* node = button_settings();
+ if (node) {
+ for (XMLNodeList::const_iterator i = node->children().begin(); i != node->children().end(); ++i) {
+ button_bindings->load (**i);
+ }
+ }
+
constructed = true;
instant_save ();
image_socket_listener = 0 ;
}
#endif
-
+
+ delete button_bindings;
delete _routes;
delete _route_groups;
delete track_canvas;
delete _drags;
}
+XMLNode*
+Editor::button_settings () const
+{
+ XMLNode* settings = ARDOUR_UI::instance()->editor_settings();
+ XMLNode* node = find_named_node (*settings, X_("Buttons"));
+
+ if (!node) {
+ cerr << "new empty Button node\n";
+ node = new XMLNode (X_("Buttons"));
+ }
+
+ return node;
+}
+
void
Editor::add_toplevel_controls (Container& cont)
{
if (!is_visible ()) {
show_all ();
+ /* XXX: this is a bit unfortunate; it would probably
+ be nicer if we could just call show () above rather
+ than needing the show_all ()
+ */
+
/* re-hide stuff if necessary */
editor_list_button_toggled ();
parameter_changed ("show-summary");
- parameter_changed ("show-edit-group-tabs");
+ parameter_changed ("show-group-tabs");
parameter_changed ("show-zoom-tools");
/* now reset all audio_time_axis heights, because widgets might need
tv = (static_cast<TimeAxisView*>(*i));
tv->reset_height ();
}
+
+ if (current_mixer_strip) {
+ current_mixer_strip->hide_things ();
+ }
}
present ();
region_edit_menu_split_item = 0;
region_edit_menu_split_multichannel_item = 0;
+ /* we might try to use items that are currently attached to a crossfade menu,
+ so clear that, too.
+ */
+ track_crossfade_context_menu.items().clear ();
+
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (clicked_axisview);
if (rtv) {
boost::shared_ptr<Track> tr;
boost::shared_ptr<Playlist> pl;
- /* Don't offer a region submenu if we are in internal edit mode, as we don't select regions in this
- mode and so offering region context is somewhat confusing.
- */
- if ((tr = rtv->track()) && ((pl = tr->playlist())) && !internal_editing()) {
- framepos_t const framepos = (framepos_t) floor ((double) get_preferred_edit_position() * tr->speed());
- uint32_t regions_at = pl->count_regions_at (framepos);
- add_region_context_items (edit_items, regions_at > 1);
+ if ((tr = rtv->track())) {
+ add_region_context_items (edit_items, tr);
}
}
MenuList& edit_items = track_crossfade_context_menu.items();
edit_items.clear ();
+ /* we might try to use items that are currently attached to a crossfade menu,
+ so clear that, too.
+ */
+ track_region_context_menu.items().clear ();
+
AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*> (clicked_axisview);
if (atv) {
if ((tr = atv->track()) && ((pl = tr->playlist()) != 0) && ((apl = boost::dynamic_pointer_cast<AudioPlaylist> (pl)) != 0)) {
AudioPlaylist::Crossfades xfades;
+ framepos_t where;
+ bool ignored;
- apl->crossfades_at (get_preferred_edit_position (), xfades);
+ /* The xfade menu is a bit of a special case, as we always use the mouse position
+ to decide whether or not to display it (rather than the edit point). No particularly
+ strong reasons for this, other than it is a bit surprising to right-click on a xfade
+ and not get a menu.
+ */
+ mouse_frame (where, ignored);
+ apl->crossfades_at (where, xfades);
- bool many = xfades.size() > 1;
+ bool const many = xfades.size() > 1;
for (AudioPlaylist::Crossfades::iterator i = xfades.begin(); i != xfades.end(); ++i) {
add_crossfade_context_items (atv->audio_view(), (*i), edit_items, many);
}
- framepos_t framepos = (framepos_t) floor ((double) get_preferred_edit_position() * tr->speed());
- uint32_t regions_at = pl->count_regions_at (framepos);
- add_region_context_items (edit_items, regions_at > 1);
+ add_region_context_items (edit_items, tr);
}
}
}
void
-Editor::add_region_context_items (Menu_Helpers::MenuList& edit_items, bool multiple_regions_at_position)
+Editor::add_region_context_items (Menu_Helpers::MenuList& edit_items, boost::shared_ptr<Track> track)
{
using namespace Menu_Helpers;
the standard items.
*/
- /* we have to hack up the region name because "_" has a special
- meaning for menu titles.
- */
-
RegionSelection rs = get_regions_from_selection_and_entered ();
string::size_type pos = 0;
string menu_item_name = (rs.size() == 1) ? rs.front()->region()->name() : _("Selected Regions");
+ /* we have to hack up the region name because "_" has a special
+ meaning for menu titles.
+ */
+
while ((pos = menu_item_name.find ("_", pos)) != string::npos) {
menu_item_name.replace (pos, 1, "__");
pos += 2;
_popup_region_menu_item->set_label (menu_item_name);
}
+ /* Use the mouse position rather than the edit point to decide whether to show the `choose top region'
+ dialogue. If we use the edit point it gets a bit messy because the user still has to click over
+ *some* region in order to get the region context menu stuff to be displayed at all.
+ */
+
+ framepos_t mouse;
+ bool ignored;
+ mouse_frame (mouse, ignored);
+
edit_items.push_back (*_popup_region_menu_item);
- if (multiple_regions_at_position && (layering_order_editor == 0 || !layering_order_editor->is_visible ())) {
+ 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 (SeparatorElem());
set_default_size (g.base_width, g.base_height);
move (x, y);
-
+
if (_session && (prop = node.property ("playhead"))) {
framepos_t pos;
sscanf (prop->value().c_str(), "%" PRIi64, &pos);
snprintf (buf, sizeof (buf), "%d", _the_notebook.get_current_page ());
node->add_property (X_("editor-list-page"), buf);
+ if (button_bindings) {
+ XMLNode* bb = new XMLNode (X_("Buttons"));
+ button_bindings->save (*bb);
+ node->add_child_nocopy (*bb);
+ }
+
node->add_property (X_("show-marker-lines"), _show_marker_lines ? "yes" : "no");
node->add_child_nocopy (selection->get_state ());
_zoom_box.set_border_width (0);
zoom_in_button.set_name ("EditorTimeButton");
- zoom_in_button.set_image (*(manage (new Image (Stock::ZOOM_IN, Gtk::ICON_SIZE_MENU))));
+ 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_out_button.set_name ("EditorTimeButton");
- zoom_out_button.set_image (*(manage (new Image (Stock::ZOOM_OUT, Gtk::ICON_SIZE_MENU))));
+ 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_full_button.set_name ("EditorTimeButton");
- zoom_out_full_button.set_image (*(manage (new Image (Stock::ZOOM_100, Gtk::ICON_SIZE_MENU))));
+ 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_focus_selector.set_name ("ZoomFocusSelector");
/* 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")))));
- tav_expand_button.signal_clicked().connect (sigc::bind (sigc::mem_fun(*this, &Editor::tav_zoom_step), true));
+ 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->connect_proxy (tav_expand_button);
tav_shrink_button.set_name ("TrackHeightButton");
- tav_shrink_button.set_size_request(-1,20);
- tav_shrink_button.add (*(manage (new Image (::get_icon("tav_shrink")))));
- tav_shrink_button.signal_clicked().connect (sigc::bind (sigc::mem_fun(*this, &Editor::tav_zoom_step), false));
+ tav_shrink_button.set_size_request (-1, 20);
+ tav_shrink_button.add (*(manage (new Image (::get_icon ("tav_shrink")))));
+ act = ActionManager::get_action (X_("Editor"), X_("shrink-tracks"));
+ act->connect_proxy (tav_shrink_button);
_zoom_box.pack_start (tav_shrink_button);
_zoom_box.pack_start (tav_expand_button);
toolbar_hbox.pack_start (*_tools_tearoff, false, false);
hbox->pack_start (snap_box, false, false);
- hbox->pack_start (*nudge_box, false, false);
+ if (!Profile->get_small_screen()) {
+ hbox->pack_start (*nudge_box, false, false);
+ } else {
+ ARDOUR_UI::instance()->editor_transport_box().pack_start (*nudge_box, false, false);
+ }
hbox->pack_start (panic_box, false, false);
hbox->show_all ();
EditPoint ep = _edit_point;
if (entered_marker) {
+ DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("GPEP: use entered marker @ %1\n", entered_marker->position()));
return entered_marker->position();
}
switch (ep) {
case EditAtPlayhead:
where = _session->audible_frame();
+ DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("GPEP: use playhead @ %1\n", where));
break;
case EditAtSelectedMarker:
} else {
where = loc->end();
}
+ DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("GPEP: use selected marker @ %1\n", where));
break;
}
}
return 0;
}
snap_to (where);
+ DEBUG_TRACE (DEBUG::CutNPaste, string_compose ("GPEP: use mouse @ %1\n", where));
break;
}
_summary->set_dirty ();
}
+void
+Editor::region_view_removed ()
+{
+ _summary->set_dirty ();
+}
+
TimeAxisView*
Editor::axis_view_from_route (boost::shared_ptr<Route> r) const
{
rtv->effective_gain_display ();
+ if (internal_editing()) {
+ rtv->enter_internal_edit_mode ();
+ } else {
+ rtv->leave_internal_edit_mode ();
+ }
+
rtv->view()->RegionViewAdded.connect (sigc::mem_fun (*this, &Editor::region_view_added));
+ rtv->view()->RegionViewRemoved.connect (sigc::mem_fun (*this, &Editor::region_view_removed));
}
_routes->routes_added (new_views);
}
void
-Editor::hide_track_in_display (TimeAxisView* tv, bool /*temponly*/)
+Editor::hide_track_in_display (TimeAxisView* tv, bool apply_to_selection)
{
- RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv);
+ if (apply_to_selection) {
+ for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ) {
- if (rtv && current_mixer_strip && (rtv->route() == current_mixer_strip->route())) {
- // this will hide the mixer strip
- set_selected_mixer_strip (*tv);
+ TrackSelection::iterator j = i;
+ ++j;
+
+ hide_track_in_display (*i, false);
+
+ i = j;
+ }
+ } else {
+ RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (tv);
+
+ if (rtv && current_mixer_strip && (rtv->route() == current_mixer_strip->route())) {
+ // this will hide the mixer strip
+ set_selected_mixer_strip (*tv);
+ }
+
+ _routes->hide_track_in_display (*tv);
}
-
- _routes->hide_track_in_display (*tv);
}
bool
}
bool
-Editor::horizontal_scroll_left_press ()
+Editor::scroll_press (Direction dir)
{
++_scroll_callbacks;
/* delay the first auto-repeat */
return true;
}
-
- double x = leftmost_position() - current_page_frames() / 5;
- if (x < 0) {
- x = 0;
- }
-
- reset_x_origin (x);
- /* do hacky auto-repeat */
- if (!_scroll_connection.connected ()) {
- _scroll_connection = Glib::signal_timeout().connect (sigc::mem_fun (*this, &Editor::horizontal_scroll_left_press), 100);
- _scroll_callbacks = 0;
- }
+ switch (dir) {
+ case LEFT:
+ scroll_backward (1);
+ break;
- return true;
-}
+ case RIGHT:
+ scroll_forward (1);
+ break;
-void
-Editor::horizontal_scroll_left_release ()
-{
- _scroll_connection.disconnect ();
-}
+ case UP:
+ scroll_tracks_up_line ();
+ break;
-bool
-Editor::horizontal_scroll_right_press ()
-{
- ++_scroll_callbacks;
-
- if (_scroll_connection.connected() && _scroll_callbacks < 5) {
- /* delay the first auto-repeat */
- return true;
+ case DOWN:
+ scroll_tracks_down_line ();
+ break;
}
- reset_x_origin (leftmost_position() + current_page_frames() / 5);
-
/* do hacky auto-repeat */
if (!_scroll_connection.connected ()) {
- _scroll_connection = Glib::signal_timeout().connect (sigc::mem_fun (*this, &Editor::horizontal_scroll_right_press), 100);
+
+ _scroll_connection = Glib::signal_timeout().connect (
+ sigc::bind (sigc::mem_fun (*this, &Editor::scroll_press), dir), 100
+ );
+
_scroll_callbacks = 0;
}
}
void
-Editor::horizontal_scroll_right_release ()
+Editor::scroll_release ()
{
_scroll_connection.disconnect ();
}
return true;
}
+