FFT analysis: use actual latency
[ardour.git] / gtk2_ardour / editor_summary.cc
index e7355b577c97d57b807bbb71ad5e8eac003ff3d7..8a9baa5585592204bbc1cef2f0790bfc71411cf3 100644 (file)
@@ -24,6 +24,7 @@
 #include <gtkmm/menu.h>
 #include <gtkmm/menuitem.h>
 
+#include "context_menu_helper.h"
 #include "time_axis_view.h"
 #include "streamview.h"
 #include "editor_summary.h"
@@ -118,6 +119,10 @@ EditorSummary::set_session (Session* s)
                _editor->selection->RegionsChanged.connect (sigc::mem_fun(*this, &EditorSummary::set_background_dirty));
        }
 
+       UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &EditorSummary::set_colors));
+
+       set_colors();
+
        _leftmost = max_samplepos;
        _rightmost = 0;
 }
@@ -155,7 +160,7 @@ EditorSummary::render_background_image ()
        /* calculate x scale */
        if (_end != _start) {
                _x_scale = static_cast<double> (get_width()) / (_end - _start);
-       } else {
+       } else {
                _x_scale = 1;
        }
 
@@ -286,8 +291,9 @@ EditorSummary::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle
        /* Playhead */
 
        cairo_set_line_width (cr, 1);
-       /* XXX: colour should be set from configuration file */
-       cairo_set_source_rgba (cr, 1, 0, 0, 1);
+
+       double r,g,b,a;  Gtkmm2ext::color_to_rgba(_phead_color, r,g,b,a);
+       cairo_set_source_rgb (cr, r,g,b); // playhead color
 
        const double ph= playhead_sample_to_position (_editor->playhead_cursor->current_sample());
        cairo_move_to (cr, ph, 0);
@@ -299,6 +305,14 @@ EditorSummary::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle
 
 }
 
+void
+EditorSummary::set_colors ()
+{
+       _phead_color = UIConfiguration::instance().color ("play head");
+}
+
+
+
 /** Render a region for the summary.
  *  @param r Region view.
  *  @param cr Cairo context.
@@ -410,6 +424,9 @@ EditorSummary::on_key_press_event (GdkEventKey* key)
 {
        gint x, y;
        GtkAccelKey set_playhead_accel;
+
+       /* XXXX this is really ugly and should be using our own action maps and bindings */
+
        if (gtk_accel_map_lookup_entry ("<Actions>/Editor/set-playhead", &set_playhead_accel)) {
                if (key->keyval == set_playhead_accel.accel_key && (int) key->state == set_playhead_accel.accel_mods) {
                        if (_session) {
@@ -428,6 +445,9 @@ EditorSummary::on_key_release_event (GdkEventKey* key)
 {
 
        GtkAccelKey set_playhead_accel;
+
+       /* XXXX this is really ugly and should be using our own action maps and bindings */
+
        if (gtk_accel_map_lookup_entry ("<Actions>/Editor/set-playhead", &set_playhead_accel)) {
                if (key->keyval == set_playhead_accel.accel_key && (int) key->state == set_playhead_accel.accel_mods) {
                        return true;
@@ -448,7 +468,7 @@ EditorSummary::on_button_press_event (GdkEventButton* ev)
 
        if (ev->button == 3) { // right-click:  show the reset menu action
                using namespace Gtk::Menu_Helpers;
-               Gtk::Menu* m = manage (new Gtk::Menu);
+               Gtk::Menu* m = ARDOUR_UI_UTILS::shared_popup_menu ();
                MenuList& items = m->items ();
                items.push_back(MenuElem(_("Reset Summary to Extents"),
                        sigc::mem_fun(*this, &EditorSummary::reset_to_extents)));