improve sysex data display.
[ardour.git] / gtk2_ardour / editor_canvas.cc
index 2266904178eed68a3786fe2a2d5f578daecef93f..f847a3f70722f329a84027ea7801a570a45cbedc 100644 (file)
 #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;
@@ -98,18 +99,6 @@ Editor::initialize_canvas ()
 
        _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");
@@ -227,10 +216,6 @@ Editor::initialize_canvas ()
 
        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);
@@ -329,7 +314,7 @@ Editor::reset_controls_layout_width ()
        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;
         }
@@ -426,10 +411,11 @@ Editor::drop_paths_part_two (const vector<string>& paths, framepos_t frame, doub
 
                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);
                }
@@ -442,10 +428,12 @@ Editor::drop_paths_part_two (const vector<string>& paths, framepos_t frame, doub
                        /* 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);
                        }
@@ -461,7 +449,6 @@ Editor::drop_paths (const RefPtr<Gdk::DragContext>& context,
 {
        vector<string> paths;
        GdkEvent ev;
-       framepos_t frame;
        double cy;
 
        if (convert_drop_to_paths (paths, context, x, y, data, info, time) == 0) {
@@ -473,19 +460,18 @@ Editor::drop_paths (const RefPtr<Gdk::DragContext>& context,
                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
        }
 
@@ -654,6 +640,7 @@ Editor::autoscroll_canvas ()
                                scroll_up_one_track ();
                                vertical_motion = true;
                        }
+                       no_stop = true;
 
                } else if (y > autoscroll_boundary.y1) {
 
@@ -661,9 +648,9 @@ Editor::autoscroll_canvas ()
                                scroll_down_one_track ();
                                vertical_motion = true;
                        }
+                       no_stop = true;
                }
 
-               no_stop = true;
        }
 
        if (vc.pending || vertical_motion) {
@@ -773,7 +760,6 @@ Editor::start_canvas_autoscroll (bool allow_horiz, bool allow_vert, const Ardour
 
        stop_canvas_autoscroll ();
 
-       autoscroll_cnt = 0;
        autoscroll_horizontal_allowed = allow_horiz;
        autoscroll_vertical_allowed = allow_vert;
        autoscroll_boundary = boundary;
@@ -792,6 +778,7 @@ void
 Editor::stop_canvas_autoscroll ()
 {
        autoscroll_connection.disconnect ();
+       autoscroll_cnt = 0;
 }
 
 Editor::EnterContext*
@@ -958,6 +945,8 @@ Editor::color_handler()
 
        refresh_location_display ();
 
+       NoteBase::set_colors ();
+
        /* redraw the whole thing */
        _track_canvas->set_background_color (UIConfiguration::instance().color ("arrange base"));
        _track_canvas->queue_draw ();