/*
- Copyright (C) 2009 Paul Davis
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
+ * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
+ * Copyright (C) 2009-2015 David Robillard <d@drobilla.net>
+ * Copyright (C) 2009-2019 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2012-2013 Colin Fletcher <colin.m.fletcher@googlemail.com>
+ * Copyright (C) 2012-2019 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2014-2016 Nick Mainsbridge <mainsbridge@gmail.com>
+ * Copyright (C) 2015-2016 Tim Mayberry <mojofunk@gmail.com>
+ * Copyright (C) 2017-2019 Ben Loftis <ben@harrisonconsoles.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
#include "ardour/session.h"
#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"
_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;
}
/* calculate x scale */
if (_end != _start) {
_x_scale = static_cast<double> (get_width()) / (_end - _start);
- } else {
+ } else {
_x_scale = 1;
}
/* 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);
}
+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.
void
EditorSummary::render_region (RegionView* r, cairo_t* cr, double y) const
{
+ /*NOTE: you can optimize this operation by coalescing adjacent regions into a single line stroke.
+ * In a session with a single track ~1,000 regions, this reduced render time from 14ms to 11 ms.
+ * However, you lose a lot of visual information. The current method preserves a sense of separation between regions.
+ * The current method shows the current selection (red regions), which needs to be preserved if this is optimized.
+ * I think it's not worth it for now, but we might choose to revisit this someday.
+ */
+
uint32_t const c = r->get_fill_color ();
cairo_set_source_rgb (cr, UINT_RGBA_R (c) / 255.0, UINT_RGBA_G (c) / 255.0, UINT_RGBA_B (c) / 255.0);
{
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) {
{
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;
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)));