#include "keyboard.h"
#include "editor_cursors.h"
#include "mouse_cursors.h"
+#include "note_base.h"
#include "ui_config.h"
#include "verbose_cursor.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
using namespace std;
using namespace ARDOUR;
_track_canvas = _track_canvas_viewport->canvas ();
_track_canvas->set_background_color (UIConfiguration::instance().color ("arrange base"));
+ _track_canvas->use_nsglview ();
/* scroll group for items that should not automatically scroll
* (e.g verbose cursor). It shares the canvas coordinate space.
_verbose_cursor = new VerboseCursor (this);
- /* on the bottom, an image */
-
- if (Profile->get_sae()) {
- Image img (::get_icon (X_("saelogo")));
- // logo_item = new ArdourCanvas::Pixbuf (_track_canvas->root(), 0.0, 0.0, img.get_pixbuf());
- // logo_item->property_height_in_pixels() = true;
- // logo_item->property_width_in_pixels() = true;
- // logo_item->property_height_set() = true;
- // logo_item->property_width_set() = true;
- // logo_item->show ();
- }
-
/*a group to hold global rects like punch/loop indicators */
global_rect_group = new ArdourCanvas::Container (hv_scroll_group);
CANVAS_DEBUG_NAME (global_rect_group, "global rect group");
cd_marker_bar = new ArdourCanvas::Rectangle (cd_marker_group, ArdourCanvas::Rect (0.0, 0.0, ArdourCanvas::COORD_MAX, timebar_height));
CANVAS_DEBUG_NAME (cd_marker_bar, "CD Marker Bar");
- cd_marker_bar->set_outline_what (ArdourCanvas::Rectangle::BOTTOM);
+ cd_marker_bar->set_outline_what (ArdourCanvas::Rectangle::BOTTOM);
ARDOUR_UI::instance()->video_timeline = new VideoTimeLine(this, videotl_group, (timebar_height * videotl_bar_height));
playhead_cursor = new EditorCursor (*this, &Editor::canvas_playhead_cursor_event);
- if (logo_item) {
- logo_item->lower_to_bottom ();
- }
-
_canvas_drop_zone = new ArdourCanvas::Rectangle (hv_scroll_group, ArdourCanvas::Rect (0.0, 0.0, ArdourCanvas::COORD_MAX, 0.0));
/* this thing is transparent */
_canvas_drop_zone->set_fill (false);
edit_controls_vbox.size_request (req);
w = req.width;
- if (_group_tabs->is_mapped()) {
+ if (_group_tabs->is_visible()) {
_group_tabs->size_request (req);
w += req.width;
}
frame = 0;
InstrumentSelector is; // instantiation builds instrument-list and sets default.
- do_import (midi_paths, Editing::ImportDistinctFiles, ImportAsTrack, SrcBest, frame, is.selected_instrument());
+ do_import (midi_paths, Editing::ImportDistinctFiles, ImportAsTrack, SrcBest, SMFTrackName, SMFTempoIgnore, frame, is.selected_instrument());
- if (Profile->get_sae() || UIConfiguration::instance().get_only_copy_imported_files() || copy) {
- do_import (audio_paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack, SrcBest, frame);
+ if (UIConfiguration::instance().get_only_copy_imported_files() || copy) {
+ do_import (audio_paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack,
+ SrcBest, SMFTrackName, SMFTempoIgnore, frame);
} else {
do_embed (audio_paths, Editing::ImportDistinctFiles, ImportAsTrack, frame);
}
/* select the track, then embed/import */
selection->set (tv);
- do_import (midi_paths, Editing::ImportSerializeFiles, ImportToTrack, SrcBest, frame);
+ do_import (midi_paths, Editing::ImportSerializeFiles, ImportToTrack,
+ SrcBest, SMFTrackName, SMFTempoIgnore, frame);
- if (Profile->get_sae() || UIConfiguration::instance().get_only_copy_imported_files() || copy) {
- do_import (audio_paths, Editing::ImportSerializeFiles, Editing::ImportToTrack, SrcBest, frame);
+ if (UIConfiguration::instance().get_only_copy_imported_files() || copy) {
+ do_import (audio_paths, Editing::ImportSerializeFiles, Editing::ImportToTrack,
+ SrcBest, SMFTrackName, SMFTempoIgnore, frame);
} else {
do_embed (audio_paths, Editing::ImportSerializeFiles, ImportToTrack, frame);
}
{
vector<string> paths;
GdkEvent ev;
- framepos_t frame;
double cy;
if (convert_drop_to_paths (paths, context, x, y, data, info, time) == 0) {
ev.button.x = x;
ev.button.y = y;
- frame = window_event_sample (&ev, 0, &cy);
-
- snap_to (frame);
+ MusicFrame when (window_event_sample (&ev, 0, &cy), 0);
+ snap_to (when);
bool copy = ((context->get_actions() & (Gdk::ACTION_COPY | Gdk::ACTION_LINK | Gdk::ACTION_MOVE)) == Gdk::ACTION_COPY);
-#ifdef GTKOSX
+#ifdef __APPLE__
/* We are not allowed to call recursive main event loops from within
the main event loop with GTK/Quartz. Since import/embed wants
to push up a progress dialog, defer all this till we go idle.
*/
- Glib::signal_idle().connect (sigc::bind (sigc::mem_fun (*this, &Editor::idle_drop_paths), paths, frame, cy, copy));
+ Glib::signal_idle().connect (sigc::bind (sigc::mem_fun (*this, &Editor::idle_drop_paths), paths, when.frame, cy, copy));
#else
- drop_paths_part_two (paths, frame, cy, copy);
+ drop_paths_part_two (paths, when.frame, cy, copy);
#endif
}
void
Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert, bool from_headers)
{
+ Gtk::Window* toplevel = dynamic_cast<Gtk::Window*>(contents().get_toplevel());
+
+ if (!toplevel) {
+ return;
+ }
+
if (!UIConfiguration::instance().get_autoscroll_editor () || autoscroll_active ()) {
return;
}
if (from_headers) {
alloc = controls_layout.get_allocation ();
+
+ int wx, wy;
+
+ controls_layout.get_parent()->translate_coordinates (*toplevel,
+ alloc.get_x(), alloc.get_y(),
+ wx, wy);
+
+ scrolling_boundary = ArdourCanvas::Rect (wx, wy, wx + alloc.get_width(), wy + alloc.get_height());
+
+
} else {
alloc = _track_canvas_viewport->get_allocation ();
alloc.set_x (alloc.get_x() + 10);
}
- }
+ int wx, wy;
+
+ _track_canvas_viewport->get_parent()->translate_coordinates (*toplevel,
+ alloc.get_x(), alloc.get_y(),
+ wx, wy);
- scrolling_boundary = ArdourCanvas::Rect (alloc.get_x(), alloc.get_y(), alloc.get_x() + alloc.get_width(), alloc.get_y() + alloc.get_height());
+ scrolling_boundary = ArdourCanvas::Rect (wx, wy, wx + alloc.get_width(), wy + alloc.get_height());
+ }
int x, y;
Gdk::ModifierType mask;
- get_window()->get_pointer (x, y, mask);
+ toplevel->get_window()->get_pointer (x, y, mask);
if ((allow_horiz && ((x < scrolling_boundary.x0 && leftmost_frame > 0) || x >= scrolling_boundary.x1)) ||
(allow_vert && ((y < scrolling_boundary.y0 && vertical_adjustment.get_value() > 0)|| y >= scrolling_boundary.y1))) {
Gdk::ModifierType mask;
frameoffset_t dx = 0;
bool no_stop = false;
+ Gtk::Window* toplevel = dynamic_cast<Gtk::Window*>(contents().get_toplevel());
- get_window()->get_pointer (x, y, mask);
+ if (!toplevel) {
+ return false;
+ }
+
+ toplevel->get_window()->get_pointer (x, y, mask);
VisualChange vc;
bool vertical_motion = false;
scroll_up_one_track ();
vertical_motion = true;
}
+ no_stop = true;
} else if (y > autoscroll_boundary.y1) {
scroll_down_one_track ();
vertical_motion = true;
}
+ no_stop = true;
}
- no_stop = true;
}
if (vc.pending || vertical_motion) {
int cx;
int cy;
- translate_coordinates (*_track_canvas, x, y, cx, cy);
+ toplevel->translate_coordinates (*_track_canvas, x, y, cx, cy);
/* clamp x and y to remain within the autoscroll boundary,
* which is defined in window coordinates
}
y = min (max ((ArdourCanvas::Coord) y, autoscroll_boundary.y0), autoscroll_boundary.y1);
- translate_coordinates (*_track_canvas_viewport, x, y, cx, cy);
+ toplevel->translate_coordinates (*_track_canvas_viewport, x, y, cx, cy);
ArdourCanvas::Duple d = _track_canvas->window_to_canvas (ArdourCanvas::Duple (cx, cy));
ev.x = d.x;
stop_canvas_autoscroll ();
- autoscroll_cnt = 0;
autoscroll_horizontal_allowed = allow_horiz;
autoscroll_vertical_allowed = allow_vert;
autoscroll_boundary = boundary;
Editor::stop_canvas_autoscroll ()
{
autoscroll_connection.disconnect ();
+ autoscroll_cnt = 0;
}
Editor::EnterContext*
}
bool
-Editor::left_track_canvas (GdkEventCrossing */*ev*/)
+Editor::left_track_canvas (GdkEventCrossing* ev)
{
+ const bool was_within = within_track_canvas;
DropDownKeys ();
within_track_canvas = false;
set_entered_track (0);
set_entered_regionview (0);
reset_canvas_action_sensitivity (false);
+
+ if (was_within) {
+ if (ev->detail == GDK_NOTIFY_NONLINEAR ||
+ ev->detail == GDK_NOTIFY_NONLINEAR_VIRTUAL) {
+ /* context menu or something similar */
+ sensitize_the_right_region_actions (false);
+ } else {
+ sensitize_the_right_region_actions (true);
+ }
+ }
+
return false;
}
bool
-Editor::entered_track_canvas (GdkEventCrossing */*ev*/)
+Editor::entered_track_canvas (GdkEventCrossing* ev)
{
+ const bool was_within = within_track_canvas;
within_track_canvas = true;
reset_canvas_action_sensitivity (true);
- return FALSE;
+
+ if (!was_within) {
+ if (ev->detail == GDK_NOTIFY_NONLINEAR ||
+ ev->detail == GDK_NOTIFY_NONLINEAR_VIRTUAL) {
+ /* context menu or something similar */
+ sensitize_the_right_region_actions (false);
+ } else {
+ sensitize_the_right_region_actions (true);
+ }
+ }
+
+ return false;
}
void
refresh_location_display ();
+ NoteBase::set_colors ();
+
/* redraw the whole thing */
_track_canvas->set_background_color (UIConfiguration::instance().color ("arrange base"));
_track_canvas->queue_draw ();