#include "gui_object.h"
#include "gui_thread.h"
#include "keyboard.h"
-#include "keyeditor.h"
#include "luainstance.h"
#include "marker.h"
#include "midi_region_view.h"
, _all_region_actions_sensitized (false)
, _ignore_region_action (false)
, _last_region_menu_was_main (false)
+ , _track_selection_change_without_scroll (false)
, cd_marker_bar_drag_rect (0)
, range_bar_drag_rect (0)
, transport_bar_drag_rect (0)
BasicUI::AccessAction.connect (*this, invalidator (*this), boost::bind (&Editor::access_action, this, _1, _2), gui_context());
- PresentationInfo::Change.connect (*this, invalidator (*this), boost::bind (&Editor::presentation_info_changed, this, _1), gui_context());
-
/* handle escape */
ARDOUR_UI::instance()->Escape.connect (*this, invalidator (*this), boost::bind (&Editor::escape, this), gui_context());
setup_fade_images ();
- LuaInstance::instance(); // instantiate
- LuaInstance::instance()->ActionChanged.connect (sigc::mem_fun (*this, &Editor::set_script_action_name));
-
instant_save ();
}
}
}
-void
-Editor::presentation_info_changed (PropertyChange const & what_changed)
-{
- if (what_changed.contains (Properties::selected)) {
- track_selection_changed ();
- }
-}
-
XMLNode*
Editor::button_settings () const
{
_session->register_with_memento_command_factory(id(), this);
_session->register_with_memento_command_factory(_selection_memento->id(), _selection_memento);
- ActionManager::ui_manager->signal_pre_activate().connect (sigc::mem_fun (*this, &Editor::action_pre_activated));
-
LuaInstance::instance()->set_session(_session);
start_updating_meters ();
}
-void
-Editor::action_pre_activated (Glib::RefPtr<Action> const & a)
-{
- if (a->get_name() == "RegionMenu") {
- /* When the main menu's region menu is opened, we setup the actions so that they look right
- in the menu. I can't find a way of getting a signal when this menu is subsequently closed,
- so we resensitize all region actions when the entered regionview or the region selection
- changes. HOWEVER we can't always resensitize on entered_regionview change because that
- happens after the region context menu is opened. So we set a flag here, too.
-
- What a carry on :(
- */
- sensitize_the_right_region_actions (false, !within_track_canvas);
- _last_region_menu_was_main = true;
- }
-}
-
void
Editor::fill_xfade_menu (Menu_Helpers::MenuList& items, bool start)
{
/* When the region menu is opened, we setup the actions so that they look right
in the menu.
*/
- sensitize_the_right_region_actions (true, false);
+ sensitize_the_right_region_actions (false);
_last_region_menu_was_main = false;
menu->signal_hide().connect (sigc::bind (sigc::mem_fun (*this, &Editor::sensitize_all_region_actions), true));
_popup_region_menu_item->set_label (menu_item_name);
}
- /* No latering allowed in later is higher layering model */
+ /* No layering allowed in later is higher layering model */
RefPtr<Action> act = ActionManager::get_action (X_("EditorMenu"), X_("RegionMenuLayering"));
if (act && Config->get_layer_model() == LaterHigher) {
act->set_sensitive (false);
}
reset_canvas_action_sensitivity (in_track_canvas);
+ sensitize_the_right_region_actions (false);
instant_save ();
}
framepos_t where = 0;
EditPoint ep = _edit_point;
- cerr << "ig " << ignore << " fcm " << from_context_menu << " foc " << from_outside_canvas << endl;
-
if (Profile->get_mixbus()) {
if (ep == EditAtSelectedMarker) {
ep = EditAtPlayhead;
if (from_outside_canvas && (ep == EditAtMouse)) {
ep = EditAtPlayhead;
} else if (from_context_menu && (ep == EditAtMouse)) {
- return canvas_event_sample (&context_click_event, 0, 0);
+ return canvas_event_sample (&context_click_event, 0, 0);
}
if (entered_marker) {
MusicFrame snap_mf (0, 0);
- cerr << "Using EP " << enum_2_string (ep) << endl;
-
switch (ep) {
case EditAtPlayhead:
if (_dragging_playhead) {
/* no region selected or entered, but some selected tracks:
* act on all regions on the selected tracks at the edit point
*/
- framepos_t const where = get_preferred_edit_position (ignore, from_outside_canvas, from_outside_canvas);
+ framepos_t const where = get_preferred_edit_position (ignore, from_context_menu, from_outside_canvas);
get_regions_at(regions, where, tracks);
}
}
}
}
+RegionView*
+Editor::regionview_from_region (boost::shared_ptr<Region> region) const
+{
+ for (TrackViewList::const_iterator i = track_views.begin(); i != track_views.end(); ++i) {
+ RouteTimeAxisView* tatv;
+ if ((tatv = dynamic_cast<RouteTimeAxisView*> (*i)) != 0) {
+ if (!tatv->track()) {
+ continue;
+ }
+ RegionView* marv = tatv->view()->find_view (region);
+ if (marv) {
+ return marv;
+ }
+ }
+ }
+ return NULL;
+}
+
+RouteTimeAxisView*
+Editor::rtav_from_route (boost::shared_ptr<Route> route) const
+{
+ for (TrackViewList::const_iterator i = track_views.begin(); i != track_views.end(); ++i) {
+ RouteTimeAxisView* rtav;
+ if ((rtav = dynamic_cast<RouteTimeAxisView*> (*i)) != 0) {
+ if (rtav->route() == route) {
+ return rtav;
+ }
+ }
+ }
+ return NULL;
+}
+
void
Editor::show_rhythm_ferret ()
{
void
Editor::hide_track_in_display (TimeAxisView* tv, bool apply_to_selection)
{
+ if (!tv) {
+ return;
+ }
if (apply_to_selection) {
for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ) {
}
}
+void
+Editor::show_track_in_display (TimeAxisView* tv, bool move_into_view)
+{
+ if (!tv) {
+ return;
+ }
+ _routes->show_track_in_display (*tv);
+ if (move_into_view) {
+ ensure_time_axis_view_is_visible (*tv, false);
+ }
+}
+
bool
Editor::sync_track_view_list_and_routes ()
{
LuaInstance::instance()-> call_action (i);
}
-void
-Editor::set_script_action_name (int i, const std::string& n)
-{
- string const a = string_compose (X_("script-action-%1"), i + 1);
- Glib::RefPtr<Action> act = ActionManager::get_action(X_("Editor"), a.c_str());
- assert (act);
- if (n.empty ()) {
- act->set_label (string_compose (_("Unset #%1"), i + 1));
- act->set_tooltip (_("no action bound"));
- act->set_sensitive (false);
- } else {
- act->set_label (n);
- act->set_tooltip (n);
- act->set_sensitive (true);
- }
- KeyEditor::UpdateBindings ();
-}
-
void
Editor::show_editor_list (bool yn)
{