2021-12-05 11:56:42 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2021 Paul Davis <paul@linuxaudiosystems.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 <gtkmm/filechooserdialog.h>
|
|
|
|
#include <gtkmm/menu.h>
|
|
|
|
#include <gtkmm/menuitem.h>
|
|
|
|
#include <gtkmm/stock.h>
|
|
|
|
|
|
|
|
#include "pbd/compose.h"
|
|
|
|
#include "pbd/convert.h"
|
|
|
|
|
|
|
|
#include "ardour/region.h"
|
|
|
|
|
|
|
|
#include "canvas/polygon.h"
|
|
|
|
#include "canvas/text.h"
|
|
|
|
|
|
|
|
#include "gtkmm2ext/actions.h"
|
|
|
|
#include "gtkmm2ext/colors.h"
|
|
|
|
#include "gtkmm2ext/utils.h"
|
|
|
|
|
|
|
|
#include "ardour_ui.h"
|
|
|
|
#include "gui_thread.h"
|
2021-12-22 19:27:19 -05:00
|
|
|
#include "keyboard.h"
|
2021-12-05 11:56:42 -05:00
|
|
|
#include "public_editor.h"
|
|
|
|
#include "region_view.h"
|
|
|
|
#include "selection.h"
|
|
|
|
#include "timers.h"
|
2021-12-17 09:30:14 -05:00
|
|
|
#include "trigger_master.h"
|
|
|
|
#include "trigger_ui.h"
|
2021-12-05 11:56:42 -05:00
|
|
|
#include "ui_config.h"
|
|
|
|
|
|
|
|
#include "pbd/i18n.h"
|
|
|
|
|
|
|
|
using namespace ARDOUR;
|
|
|
|
using namespace ArdourCanvas;
|
|
|
|
using namespace Gtkmm2ext;
|
|
|
|
using namespace PBD;
|
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
static const int nslices = 8; // in 8 pie slices .. TODO .. maybe make this meter-senstive ... triplets and such... ?
|
2021-12-15 08:07:54 -05:00
|
|
|
|
|
|
|
Loopster::Loopster (Item* parent)
|
|
|
|
: ArdourCanvas::Rectangle (parent)
|
2021-12-17 09:30:14 -05:00
|
|
|
, _fraction (0)
|
2021-12-15 08:07:54 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Loopster::set_fraction (float f)
|
|
|
|
{
|
2021-12-17 09:30:14 -05:00
|
|
|
f = std::max (0.f, f);
|
|
|
|
f = std::min (1.f, f);
|
2021-12-15 08:07:54 -05:00
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
float prior_slice = floor (_fraction * nslices);
|
|
|
|
float new_slice = floor (f * nslices);
|
2021-12-15 13:27:51 -05:00
|
|
|
|
|
|
|
if (new_slice != prior_slice) {
|
2021-12-15 08:07:54 -05:00
|
|
|
_fraction = f;
|
2021-12-17 09:30:14 -05:00
|
|
|
redraw ();
|
2021-12-15 08:07:54 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-18 17:18:47 -05:00
|
|
|
Loopster::render (ArdourCanvas::Rect const& area, Cairo::RefPtr<Cairo::Context> context) const
|
2021-12-15 08:07:54 -05:00
|
|
|
{
|
|
|
|
/* Note that item_to_window() already takes _position into account (as
|
2021-12-17 09:30:14 -05:00
|
|
|
* part of item_to_canvas()
|
|
|
|
*/
|
2021-12-18 17:18:47 -05:00
|
|
|
ArdourCanvas::Rect self (item_to_window (_rect));
|
|
|
|
ArdourCanvas::Rect const draw = self.intersection (area);
|
2021-12-15 08:07:54 -05:00
|
|
|
|
|
|
|
if (!draw) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
context->set_identity_matrix ();
|
2022-02-26 09:47:40 -05:00
|
|
|
context->translate (self.x0, self.y0);
|
2021-12-15 08:07:54 -05:00
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
float size = _rect.height ();
|
2021-12-15 08:07:54 -05:00
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
const double scale = UIConfiguration::instance ().get_ui_scale ();
|
2021-12-15 08:07:54 -05:00
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
/* white area */
|
|
|
|
set_source_rgba (context, rgba_to_color (1, 1, 1, 1));
|
|
|
|
context->arc (size / 2, size / 2, size / 2 - 4 * scale, 0, 2 * M_PI);
|
|
|
|
context->fill ();
|
2021-12-15 08:07:54 -05:00
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
/* arc fill */
|
|
|
|
context->set_line_width (5 * scale);
|
|
|
|
float slices = floor (_fraction * nslices);
|
|
|
|
float deg_per_slice = 360 / nslices;
|
|
|
|
float degrees = slices * deg_per_slice;
|
|
|
|
float radians = (degrees / 180) * M_PI;
|
|
|
|
set_source_rgba (context, rgba_to_color (0, 0, 0, 1));
|
|
|
|
context->arc (size / 2, size / 2, size / 2 - 5 * scale, 1.5 * M_PI + radians, 1.5 * M_PI + 2 * M_PI);
|
|
|
|
context->stroke ();
|
|
|
|
|
|
|
|
context->set_line_width (1);
|
|
|
|
context->set_identity_matrix ();
|
2021-12-15 08:07:54 -05:00
|
|
|
}
|
|
|
|
|
2021-12-16 10:13:37 -05:00
|
|
|
TriggerMaster::TriggerMaster (Item* parent)
|
2021-12-05 11:56:42 -05:00
|
|
|
: ArdourCanvas::Rectangle (parent)
|
2021-12-15 08:07:54 -05:00
|
|
|
, _context_menu (0)
|
2021-12-17 13:41:32 -05:00
|
|
|
, _ignore_menu_action (false)
|
2021-12-05 11:56:42 -05:00
|
|
|
{
|
2021-12-17 09:30:14 -05:00
|
|
|
set_layout_sensitive (true); // why???
|
2021-12-05 11:56:42 -05:00
|
|
|
|
|
|
|
name = X_("trigger stopper");
|
|
|
|
|
2021-12-07 16:47:42 -05:00
|
|
|
Event.connect (sigc::mem_fun (*this, &TriggerMaster::event_handler));
|
2021-12-05 11:56:42 -05:00
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
_loopster = new Loopster (this);
|
2021-12-05 11:56:42 -05:00
|
|
|
|
2022-02-19 13:12:43 -05:00
|
|
|
set_tooltip (_("Click to stop all clips in this track\nRight-click to select properties for all clips in this track"));
|
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
#if 0 /* XXX trigger changes */
|
|
|
|
_triggerbox->PropertyChanged.connect (_trigger_prop_connection, MISSING_INVALIDATOR, boost::bind (&TriggerMaster::prop_change, this, _1), gui_context());
|
2021-12-05 11:56:42 -05:00
|
|
|
PropertyChange changed;
|
|
|
|
changed.add (ARDOUR::Properties::name);
|
|
|
|
changed.add (ARDOUR::Properties::running);
|
|
|
|
prop_change (changed);
|
2021-12-17 09:30:14 -05:00
|
|
|
#endif
|
2021-12-15 08:07:54 -05:00
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
#if 0 /* XXX route changes */
|
|
|
|
dynamic_cast<Stripable*> (_triggerbox->owner())->presentation_info().Change.connect (_owner_prop_connection, MISSING_INVALIDATOR, boost::bind (&TriggerMaster::owner_prop_change, this, _1), gui_context());
|
|
|
|
#endif
|
2021-12-15 08:07:54 -05:00
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
_update_connection = Timers::rapid_connect (sigc::mem_fun (*this, &TriggerMaster::maybe_update));
|
2021-12-05 11:56:42 -05:00
|
|
|
|
2021-12-07 16:47:42 -05:00
|
|
|
/* prefs (theme colors) */
|
2021-12-17 09:30:14 -05:00
|
|
|
UIConfiguration::instance ().ParameterChanged.connect (sigc::mem_fun (*this, &TriggerMaster::ui_parameter_changed));
|
|
|
|
set_default_colors ();
|
2021-12-05 11:56:42 -05:00
|
|
|
}
|
|
|
|
|
2021-12-07 16:47:42 -05:00
|
|
|
TriggerMaster::~TriggerMaster ()
|
2021-12-05 11:56:42 -05:00
|
|
|
{
|
2021-12-17 11:48:27 -05:00
|
|
|
_update_connection.disconnect ();
|
2021-12-05 11:56:42 -05:00
|
|
|
}
|
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
void
|
2023-02-16 18:33:28 -05:00
|
|
|
TriggerMaster::set_triggerbox (std::shared_ptr<ARDOUR::TriggerBox> t)
|
2021-12-16 10:13:37 -05:00
|
|
|
{
|
|
|
|
_triggerbox = t;
|
|
|
|
}
|
|
|
|
|
2021-12-05 11:56:42 -05:00
|
|
|
void
|
2021-12-18 17:18:47 -05:00
|
|
|
TriggerMaster::render (ArdourCanvas::Rect const& area, Cairo::RefPtr<Cairo::Context> context) const
|
2021-12-05 11:56:42 -05:00
|
|
|
{
|
|
|
|
/* Note that item_to_window() already takes _position into account (as
|
2021-12-17 09:30:14 -05:00
|
|
|
* part of item_to_canvas()
|
|
|
|
*/
|
2021-12-18 17:18:47 -05:00
|
|
|
ArdourCanvas::Rect self (item_to_window (_rect));
|
|
|
|
ArdourCanvas::Rect const draw = self.intersection (area);
|
2021-12-05 11:56:42 -05:00
|
|
|
|
|
|
|
if (!draw) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
float width = _rect.width ();
|
2022-02-01 11:13:04 -05:00
|
|
|
float height = _rect.height ();
|
2021-12-05 11:56:42 -05:00
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
const double scale = UIConfiguration::instance ().get_ui_scale ();
|
2021-12-05 11:56:42 -05:00
|
|
|
|
|
|
|
if (_fill && !_transparent) {
|
|
|
|
setup_fill_context (context);
|
2021-12-17 09:30:14 -05:00
|
|
|
context->rectangle (draw.x0, draw.y0, draw.width (), draw.height ());
|
2021-12-05 11:56:42 -05:00
|
|
|
context->fill ();
|
|
|
|
}
|
|
|
|
|
2021-12-07 16:47:42 -05:00
|
|
|
render_children (area, context);
|
2021-12-12 12:20:11 -05:00
|
|
|
|
2022-02-09 11:39:19 -05:00
|
|
|
Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create (context);
|
|
|
|
|
2022-02-01 11:13:04 -05:00
|
|
|
/* MIDI triggers get a 'note' symbol */
|
|
|
|
if (_triggerbox && _triggerbox->data_type () == ARDOUR::DataType::MIDI) {
|
2022-02-26 09:47:40 -05:00
|
|
|
int font_size = 14 * scale;
|
|
|
|
char font_name[128];
|
|
|
|
snprintf (font_name, sizeof (font_name), "ArdourSans %d", font_size);
|
|
|
|
Pango::FontDescription pfd (font_name);
|
|
|
|
layout->set_font_description (pfd);
|
2023-01-16 15:41:22 -05:00
|
|
|
layout->set_text (u8"\u266b");
|
2022-02-01 11:13:04 -05:00
|
|
|
int tw, th;
|
|
|
|
layout->get_pixel_size (tw, th);
|
|
|
|
context->move_to (width / 2, height / 2);
|
2022-02-26 09:47:40 -05:00
|
|
|
context->rel_move_to (-tw / 2, -2*scale -th / 2);
|
2022-02-01 11:13:04 -05:00
|
|
|
Gtkmm2ext::set_source_rgba (context, UIConfiguration::instance ().color ("neutral:foreground"));
|
|
|
|
layout->show_in_cairo_context (context);
|
|
|
|
}
|
|
|
|
|
2022-02-26 09:47:40 -05:00
|
|
|
int font_size = 8 * scale;
|
|
|
|
char font_name[128];
|
|
|
|
snprintf (font_name, sizeof (font_name), "ArdourSans %d", font_size);
|
|
|
|
Pango::FontDescription pfd (font_name);
|
|
|
|
|
2022-02-09 11:39:19 -05:00
|
|
|
if (play_text != "") {
|
2022-02-26 09:47:40 -05:00
|
|
|
layout->set_font_description (pfd);
|
2022-02-09 11:39:19 -05:00
|
|
|
layout->set_text (play_text);
|
|
|
|
int tw, th;
|
|
|
|
layout->get_pixel_size (tw, th);
|
|
|
|
context->move_to ( height + 4*scale, height / 2); //left side, but make room for loopster
|
2022-02-26 09:47:40 -05:00
|
|
|
context->rel_move_to ( 0, -1*scale -th / 2); //vertically centered text
|
2022-02-09 11:39:19 -05:00
|
|
|
Gtkmm2ext::set_source_rgba (context, UIConfiguration::instance ().color ("neutral:foreground"));
|
|
|
|
layout->show_in_cairo_context (context);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (loop_text != "") {
|
2022-02-26 09:47:40 -05:00
|
|
|
layout->set_font_description (pfd);
|
2022-02-09 11:39:19 -05:00
|
|
|
layout->set_text (loop_text);
|
|
|
|
int tw, th;
|
|
|
|
layout->get_pixel_size (tw, th);
|
|
|
|
context->move_to ( width-4*scale, height / 2); //right side
|
2022-02-26 09:47:40 -05:00
|
|
|
context->rel_move_to ( -tw, -1*scale -th / 2); //right justified, vertically centered text
|
2022-02-09 11:39:19 -05:00
|
|
|
Gtkmm2ext::set_source_rgba (context, UIConfiguration::instance ().color ("neutral:foreground"));
|
|
|
|
layout->show_in_cairo_context (context);
|
|
|
|
}
|
|
|
|
|
2021-12-17 09:18:06 -05:00
|
|
|
if (true) {
|
2021-12-17 10:32:52 -05:00
|
|
|
/* drop-shadow at top */
|
|
|
|
Cairo::RefPtr<Cairo::LinearGradient> drop_shadow_pattern = Cairo::LinearGradient::create (0.0, 0.0, 0.0, 6 * scale);
|
|
|
|
drop_shadow_pattern->add_color_stop_rgba (0, 0, 0, 0, 0.7);
|
|
|
|
drop_shadow_pattern->add_color_stop_rgba (1, 0, 0, 0, 0.0);
|
2021-12-17 09:18:06 -05:00
|
|
|
context->set_source (drop_shadow_pattern);
|
2021-12-17 10:32:52 -05:00
|
|
|
context->rectangle (0, 0, width, 6 * scale);
|
2021-12-17 09:18:06 -05:00
|
|
|
context->fill ();
|
|
|
|
}
|
2021-12-05 11:56:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-17 09:30:14 -05:00
|
|
|
TriggerMaster::owner_prop_change (PropertyChange const& pc)
|
2021-12-05 11:56:42 -05:00
|
|
|
{
|
|
|
|
if (pc.contains (Properties::color)) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-07 16:47:42 -05:00
|
|
|
TriggerMaster::selection_change ()
|
2021-12-05 11:56:42 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2021-12-07 16:47:42 -05:00
|
|
|
TriggerMaster::event_handler (GdkEvent* ev)
|
2021-12-05 11:56:42 -05:00
|
|
|
{
|
2021-12-16 10:13:37 -05:00
|
|
|
if (!_triggerbox) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-12-05 11:56:42 -05:00
|
|
|
switch (ev->type) {
|
2021-12-17 09:30:14 -05:00
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
if (ev->button.button == 1) {
|
2021-12-22 19:27:19 -05:00
|
|
|
if (Keyboard::modifier_state_equals (ev->button.state, Keyboard::PrimaryModifier)) {
|
|
|
|
_triggerbox->stop_all_immediately ();
|
|
|
|
} else {
|
|
|
|
_triggerbox->stop_all_quantized ();
|
|
|
|
}
|
2021-12-17 09:30:14 -05:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
|
2021-12-17 10:32:52 -05:00
|
|
|
set_fill_color (HSV (fill_color ()).lighter (0.15).color ());
|
2021-12-17 09:30:14 -05:00
|
|
|
}
|
|
|
|
redraw ();
|
|
|
|
break;
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
|
2021-12-17 10:32:52 -05:00
|
|
|
set_default_colors ();
|
2021-12-17 09:30:14 -05:00
|
|
|
}
|
|
|
|
redraw ();
|
|
|
|
break;
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
switch (ev->button.button) {
|
2021-12-17 10:32:52 -05:00
|
|
|
case 3:
|
|
|
|
context_menu ();
|
2021-12-17 09:30:14 -05:00
|
|
|
}
|
2021-12-15 08:07:54 -05:00
|
|
|
default:
|
|
|
|
break;
|
2021-12-05 11:56:42 -05:00
|
|
|
}
|
|
|
|
|
2022-02-03 15:56:35 -05:00
|
|
|
return true;
|
2021-12-05 11:56:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-15 08:07:54 -05:00
|
|
|
TriggerMaster::context_menu ()
|
2021-12-05 11:56:42 -05:00
|
|
|
{
|
2021-12-15 08:07:54 -05:00
|
|
|
using namespace Gtk;
|
|
|
|
using namespace Gtk::Menu_Helpers;
|
|
|
|
using namespace Temporal;
|
|
|
|
|
|
|
|
delete _context_menu;
|
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
_context_menu = new Menu;
|
|
|
|
MenuList& items = _context_menu->items ();
|
2021-12-15 08:07:54 -05:00
|
|
|
_context_menu->set_name ("ArdourContextMenu");
|
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
Menu* follow_menu = manage (new Menu);
|
|
|
|
MenuList& fitems = follow_menu->items ();
|
2021-12-15 08:07:54 -05:00
|
|
|
|
2022-01-19 17:50:47 -05:00
|
|
|
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::None)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::None))));
|
|
|
|
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::Stop)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::Stop))));
|
|
|
|
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::Again)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::Again))));
|
|
|
|
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::ForwardTrigger)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::ForwardTrigger))));
|
|
|
|
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::ReverseTrigger)), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), FollowAction (FollowAction::ReverseTrigger))));
|
2021-12-15 08:07:54 -05:00
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
Menu* launch_menu = manage (new Menu);
|
|
|
|
MenuList& litems = launch_menu->items ();
|
2021-12-15 08:07:54 -05:00
|
|
|
|
2021-12-23 23:17:06 -05:00
|
|
|
litems.push_back (MenuElem (TriggerUI::launch_style_to_string(Trigger::OneShot), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::OneShot)));
|
2022-01-03 19:45:13 -05:00
|
|
|
litems.push_back (MenuElem (TriggerUI::launch_style_to_string(Trigger::ReTrigger), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::ReTrigger)));
|
2021-12-23 23:17:06 -05:00
|
|
|
litems.push_back (MenuElem (TriggerUI::launch_style_to_string(Trigger::Gate), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::Gate)));
|
|
|
|
litems.push_back (MenuElem (TriggerUI::launch_style_to_string(Trigger::Toggle), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::Toggle)));
|
|
|
|
litems.push_back (MenuElem (TriggerUI::launch_style_to_string(Trigger::Repeat), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::Repeat)));
|
2021-12-15 08:07:54 -05:00
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
Menu* quant_menu = manage (new Menu);
|
|
|
|
MenuList& qitems = quant_menu->items ();
|
2021-12-15 08:07:54 -05:00
|
|
|
|
|
|
|
BBT_Offset b;
|
|
|
|
|
2022-01-07 09:51:18 -05:00
|
|
|
b = BBT_Offset (4, 0, 0);
|
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
|
|
|
|
b = BBT_Offset (2, 0, 0);
|
2021-12-23 23:17:06 -05:00
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
|
2022-01-07 09:51:18 -05:00
|
|
|
b = BBT_Offset (1, 0, 0);
|
2021-12-23 23:17:06 -05:00
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
|
2021-12-15 08:07:54 -05:00
|
|
|
b = BBT_Offset (0, 2, 0);
|
2021-12-23 23:17:06 -05:00
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
|
2021-12-15 08:07:54 -05:00
|
|
|
b = BBT_Offset (0, 1, 0);
|
2021-12-23 23:17:06 -05:00
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
|
2021-12-17 09:30:14 -05:00
|
|
|
b = BBT_Offset (0, 0, ticks_per_beat / 2);
|
2021-12-23 23:17:06 -05:00
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
|
2021-12-17 09:30:14 -05:00
|
|
|
b = BBT_Offset (0, 0, ticks_per_beat / 4);
|
2021-12-23 23:17:06 -05:00
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
|
2021-12-17 09:30:14 -05:00
|
|
|
b = BBT_Offset (0, 0, ticks_per_beat / 8);
|
2021-12-23 23:17:06 -05:00
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
|
2021-12-17 09:30:14 -05:00
|
|
|
b = BBT_Offset (0, 0, ticks_per_beat / 16);
|
2021-12-23 23:17:06 -05:00
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
|
2022-01-07 19:06:31 -05:00
|
|
|
b = BBT_Offset (-1, 0, 0);
|
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
|
2021-12-15 08:07:54 -05:00
|
|
|
|
2021-12-22 13:29:16 -05:00
|
|
|
items.push_back (MenuElem (_("Set All Follow Actions..."), *follow_menu));
|
|
|
|
items.push_back (MenuElem (_("Set All Launch Styles..."), *launch_menu));
|
|
|
|
items.push_back (MenuElem (_("Set All Quantizations..."), *quant_menu));
|
2021-12-23 23:18:56 -05:00
|
|
|
items.push_back (SeparatorElem());
|
2021-12-27 18:35:24 -05:00
|
|
|
items.push_back (MenuElem (_("Set All Colors..."), sigc::mem_fun (*this, &TriggerMaster::set_all_colors)));
|
|
|
|
items.push_back (SeparatorElem());
|
2021-12-23 23:18:56 -05:00
|
|
|
items.push_back (MenuElem (_("Clear All..."), sigc::mem_fun (*this, &TriggerMaster::clear_all_triggers)));
|
2021-12-15 08:07:54 -05:00
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
_context_menu->popup (1, gtk_get_current_event_time ());
|
2021-12-15 08:07:54 -05:00
|
|
|
}
|
2021-12-05 11:56:42 -05:00
|
|
|
|
2021-12-23 23:18:56 -05:00
|
|
|
void
|
|
|
|
TriggerMaster::clear_all_triggers ()
|
|
|
|
{
|
|
|
|
_triggerbox->clear_all_triggers();
|
|
|
|
}
|
|
|
|
|
2021-12-27 18:35:24 -05:00
|
|
|
void
|
|
|
|
TriggerMaster::set_all_colors ()
|
|
|
|
{
|
2022-01-26 18:06:19 -05:00
|
|
|
_color_dialog.get_color_selection()->set_has_opacity_control (false);
|
|
|
|
_color_dialog.get_color_selection()->set_has_palette (true);
|
2021-12-27 18:35:24 -05:00
|
|
|
_color_dialog.get_ok_button()->signal_clicked().connect (sigc::bind (sigc::mem_fun (_color_dialog, &Gtk::Dialog::response), Gtk::RESPONSE_ACCEPT));
|
|
|
|
_color_dialog.get_cancel_button()->signal_clicked().connect (sigc::bind (sigc::mem_fun (_color_dialog, &Gtk::Dialog::response), Gtk::RESPONSE_CANCEL));
|
|
|
|
|
2022-08-10 23:11:52 -04:00
|
|
|
Gdk::Color c = Gtkmm2ext::gdk_color_from_rgba(0xBEBEBEFF);
|
2021-12-27 18:35:24 -05:00
|
|
|
|
2022-01-26 18:06:19 -05:00
|
|
|
_color_dialog.get_color_selection()->set_previous_color (c);
|
|
|
|
_color_dialog.get_color_selection()->set_current_color (c);
|
2021-12-27 18:35:24 -05:00
|
|
|
|
|
|
|
switch (_color_dialog.run()) {
|
|
|
|
case Gtk::RESPONSE_ACCEPT: {
|
2022-01-26 18:06:19 -05:00
|
|
|
c = _color_dialog.get_color_selection()->get_current_color();
|
2022-08-10 23:11:52 -04:00
|
|
|
color_t ct = Gtkmm2ext::gdk_color_to_rgba(c);
|
2022-10-04 21:55:15 -04:00
|
|
|
for (int n = 0; n < TriggerBox::default_triggers_per_box; n++) {
|
2021-12-27 18:35:24 -05:00
|
|
|
_triggerbox->trigger (n)->set_color(ct);
|
|
|
|
}
|
|
|
|
} break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
_color_dialog.hide ();
|
|
|
|
}
|
|
|
|
|
2021-12-15 08:07:54 -05:00
|
|
|
void
|
2022-01-19 17:50:47 -05:00
|
|
|
TriggerMaster::set_all_follow_action (FollowAction const & fa)
|
2021-12-15 08:07:54 -05:00
|
|
|
{
|
2022-01-19 17:50:47 -05:00
|
|
|
_triggerbox->set_all_follow_action (fa);
|
|
|
|
_triggerbox->set_all_probability (0);
|
2021-12-15 08:07:54 -05:00
|
|
|
}
|
2021-12-05 11:56:42 -05:00
|
|
|
|
2021-12-15 08:07:54 -05:00
|
|
|
void
|
|
|
|
TriggerMaster::set_all_launch_style (Trigger::LaunchStyle ls)
|
|
|
|
{
|
2021-12-22 13:29:16 -05:00
|
|
|
_triggerbox->set_all_launch_style(ls);
|
2021-12-15 08:07:54 -05:00
|
|
|
}
|
2021-12-05 11:56:42 -05:00
|
|
|
|
2021-12-15 08:07:54 -05:00
|
|
|
void
|
2021-12-17 09:30:14 -05:00
|
|
|
TriggerMaster::set_all_quantization (Temporal::BBT_Offset const& q)
|
2021-12-15 08:07:54 -05:00
|
|
|
{
|
2021-12-22 13:29:16 -05:00
|
|
|
_triggerbox->set_all_quantization(q);
|
2021-12-15 08:07:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TriggerMaster::maybe_update ()
|
|
|
|
{
|
|
|
|
PropertyChange changed;
|
|
|
|
changed.add (ARDOUR::Properties::name);
|
|
|
|
changed.add (ARDOUR::Properties::running);
|
2021-12-17 09:30:14 -05:00
|
|
|
prop_change (changed);
|
2021-12-05 11:56:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-17 09:30:14 -05:00
|
|
|
TriggerMaster::_size_allocate (ArdourCanvas::Rect const& alloc)
|
2021-12-05 11:56:42 -05:00
|
|
|
{
|
|
|
|
Rectangle::_size_allocate (alloc);
|
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
const double scale = UIConfiguration::instance ().get_ui_scale ();
|
2021-12-21 15:55:08 -05:00
|
|
|
_poly_margin = 3. * scale;
|
2021-12-05 11:56:42 -05:00
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
const Distance height = _rect.height ();
|
2021-12-05 11:56:42 -05:00
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
_loopster->set (ArdourCanvas::Rect (0, 0, height, height));
|
2021-12-05 11:56:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2022-02-09 11:39:19 -05:00
|
|
|
TriggerMaster::prop_change (PropertyChange const& what_changed)
|
2021-12-05 11:56:42 -05:00
|
|
|
{
|
2021-12-16 10:13:37 -05:00
|
|
|
if (!_triggerbox) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-02-09 11:39:19 -05:00
|
|
|
/* currently, TriggerBox generates a continuous stream of ::name and ::running messages
|
|
|
|
TODO: I'd prefer a discrete message when currently_playing, follow_count, or loop_count has changed
|
|
|
|
Until then, we will cache our prior settings and only redraw when something actually changes */
|
|
|
|
std::string old_play = play_text;
|
|
|
|
std::string old_loop = loop_text;
|
|
|
|
bool old_vis = _loopster->visible();
|
|
|
|
|
|
|
|
/* for debugging */
|
|
|
|
/* for (auto & c : what_changed) { std::cout << g_quark_to_string (c) << std::endl; } */
|
|
|
|
|
|
|
|
if (what_changed.contains (ARDOUR::Properties::running)) {
|
|
|
|
|
|
|
|
ARDOUR::TriggerPtr trigger = _triggerbox->currently_playing ();
|
|
|
|
if (!trigger) {
|
|
|
|
play_text = X_("");
|
|
|
|
loop_text = X_("");
|
|
|
|
_loopster->hide ();
|
|
|
|
} else {
|
|
|
|
|
2022-02-11 13:33:43 -05:00
|
|
|
play_text = cue_marker_name (trigger->index ());
|
2022-02-09 11:39:19 -05:00
|
|
|
|
|
|
|
int fc = trigger->follow_count ();
|
|
|
|
int lc = trigger->loop_count ();
|
|
|
|
std::string text;
|
|
|
|
if (fc > 1) {
|
|
|
|
text = string_compose (X_("%1/%2"), lc+1, fc);
|
|
|
|
} else if (lc > 1) {
|
|
|
|
text = string_compose (X_("%1"), lc+1); /* TODO: currently loop-count never updates unless follow_count is in use. */
|
|
|
|
}
|
|
|
|
loop_text = text;
|
|
|
|
|
|
|
|
if (trigger->active ()) {
|
|
|
|
double f = trigger->position_as_fraction ();
|
|
|
|
_loopster->set_fraction (f); /*this sometimes triggers a redraw of the loopster widget (only). */
|
|
|
|
_loopster->show ();
|
|
|
|
} else {
|
|
|
|
_loopster->hide ();
|
|
|
|
}
|
|
|
|
}
|
2021-12-15 08:07:54 -05:00
|
|
|
}
|
|
|
|
|
2022-02-09 11:39:19 -05:00
|
|
|
/* only trigger a redraw if a display value actually changes */
|
|
|
|
if((_loopster->visible() != old_vis)
|
|
|
|
|| (play_text != old_play)
|
|
|
|
|| (loop_text != old_loop))
|
|
|
|
{
|
|
|
|
redraw();
|
2021-12-15 08:07:54 -05:00
|
|
|
}
|
|
|
|
|
2021-12-05 11:56:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-07 16:47:42 -05:00
|
|
|
TriggerMaster::set_default_colors ()
|
|
|
|
{
|
2022-01-18 16:52:54 -05:00
|
|
|
set_fill_color (HSV (UIConfiguration::instance ().color ("theme:bg")).darker (0.5).color ());
|
2021-12-07 16:47:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TriggerMaster::ui_parameter_changed (std::string const& p)
|
2021-12-05 11:56:42 -05:00
|
|
|
{
|
|
|
|
if (p == "color-file") {
|
2021-12-17 09:30:14 -05:00
|
|
|
set_default_colors ();
|
2021-12-05 11:56:42 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-07 16:47:42 -05:00
|
|
|
CueMaster::CueMaster (Item* parent)
|
2021-12-05 11:56:42 -05:00
|
|
|
: ArdourCanvas::Rectangle (parent)
|
2022-01-04 17:00:39 -05:00
|
|
|
, _context_menu (0)
|
2021-12-05 11:56:42 -05:00
|
|
|
{
|
2021-12-17 10:32:52 -05:00
|
|
|
set_layout_sensitive (true); // why???
|
2021-12-05 11:56:42 -05:00
|
|
|
|
|
|
|
name = X_("trigger stopper");
|
|
|
|
|
2021-12-07 16:47:42 -05:00
|
|
|
Event.connect (sigc::mem_fun (*this, &CueMaster::event_handler));
|
2021-12-05 11:56:42 -05:00
|
|
|
|
2022-02-19 13:12:43 -05:00
|
|
|
set_tooltip (_("Click to stop all clips\nRight-click to select properties for all clips in the grid"));
|
|
|
|
|
2021-12-07 16:47:42 -05:00
|
|
|
stop_shape = new ArdourCanvas::Polygon (this);
|
2022-01-21 18:17:53 -05:00
|
|
|
stop_shape->set_outline (false);
|
2022-01-18 16:52:54 -05:00
|
|
|
stop_shape->set_fill (true);
|
2021-12-07 16:47:42 -05:00
|
|
|
stop_shape->name = X_("stopbutton");
|
|
|
|
stop_shape->set_ignore_events (true);
|
|
|
|
stop_shape->show ();
|
2021-12-05 11:56:42 -05:00
|
|
|
|
|
|
|
/* prefs (theme colors) */
|
2021-12-17 09:30:14 -05:00
|
|
|
UIConfiguration::instance ().ParameterChanged.connect (sigc::mem_fun (*this, &CueMaster::ui_parameter_changed));
|
|
|
|
set_default_colors ();
|
2021-12-05 11:56:42 -05:00
|
|
|
}
|
|
|
|
|
2021-12-07 16:47:42 -05:00
|
|
|
CueMaster::~CueMaster ()
|
2021-12-05 11:56:42 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-18 17:18:47 -05:00
|
|
|
CueMaster::render (ArdourCanvas::Rect const& area, Cairo::RefPtr<Cairo::Context> context) const
|
2021-12-05 11:56:42 -05:00
|
|
|
{
|
|
|
|
/* Note that item_to_window() already takes _position into account (as
|
|
|
|
part of item_to_canvas()
|
|
|
|
*/
|
2021-12-18 17:18:47 -05:00
|
|
|
ArdourCanvas::Rect self (item_to_window (_rect));
|
|
|
|
ArdourCanvas::Rect const draw = self.intersection (area);
|
2021-12-05 11:56:42 -05:00
|
|
|
|
|
|
|
if (!draw) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
float width = _rect.width ();
|
2021-12-05 11:56:42 -05:00
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
const double scale = UIConfiguration::instance ().get_ui_scale ();
|
2021-12-05 11:56:42 -05:00
|
|
|
|
|
|
|
if (_fill && !_transparent) {
|
|
|
|
setup_fill_context (context);
|
2021-12-17 09:30:14 -05:00
|
|
|
context->rectangle (draw.x0, draw.y0, draw.width (), draw.height ());
|
2021-12-05 11:56:42 -05:00
|
|
|
context->fill ();
|
|
|
|
}
|
|
|
|
|
2021-12-07 16:47:42 -05:00
|
|
|
render_children (area, context);
|
2021-12-12 12:20:11 -05:00
|
|
|
|
2021-12-17 09:18:06 -05:00
|
|
|
if (true) {
|
2021-12-17 10:32:52 -05:00
|
|
|
/* drop-shadow at top */
|
|
|
|
Cairo::RefPtr<Cairo::LinearGradient> drop_shadow_pattern = Cairo::LinearGradient::create (0.0, 0.0, 0.0, 6 * scale);
|
|
|
|
drop_shadow_pattern->add_color_stop_rgba (0, 0, 0, 0, 0.7);
|
|
|
|
drop_shadow_pattern->add_color_stop_rgba (1, 0, 0, 0, 0.0);
|
2021-12-17 09:18:06 -05:00
|
|
|
context->set_source (drop_shadow_pattern);
|
2021-12-17 10:32:52 -05:00
|
|
|
context->rectangle (0, 0, width, 6 * scale);
|
2021-12-17 09:18:06 -05:00
|
|
|
context->fill ();
|
2021-12-12 12:20:11 -05:00
|
|
|
}
|
2021-12-05 11:56:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2021-12-07 16:47:42 -05:00
|
|
|
CueMaster::event_handler (GdkEvent* ev)
|
2021-12-05 11:56:42 -05:00
|
|
|
{
|
|
|
|
switch (ev->type) {
|
2021-12-17 09:30:14 -05:00
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
if (ev->button.button == 1) {
|
2021-12-22 19:27:19 -05:00
|
|
|
if (Keyboard::modifier_state_equals (ev->button.state, Keyboard::PrimaryModifier)) {
|
2022-09-27 10:09:31 -04:00
|
|
|
_session->trigger_stop_all (true); //stop 'now'
|
2021-12-22 19:27:19 -05:00
|
|
|
} else {
|
2022-09-27 10:09:31 -04:00
|
|
|
_session->trigger_stop_all (false); //stop quantized (bar end)
|
2021-12-22 19:27:19 -05:00
|
|
|
}
|
2021-12-17 09:30:14 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
2022-01-04 17:00:39 -05:00
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
switch (ev->button.button) {
|
|
|
|
case 3:
|
|
|
|
context_menu ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
2021-12-17 09:30:14 -05:00
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
|
2022-01-18 16:52:54 -05:00
|
|
|
stop_shape->set_fill_color (UIConfiguration::instance ().color ("neutral:foreground"));
|
|
|
|
set_fill_color (HSV (fill_color ()).lighter (0.25).color ());
|
2021-12-17 09:30:14 -05:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
|
2021-12-17 10:32:52 -05:00
|
|
|
set_default_colors ();
|
2021-12-17 09:30:14 -05:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2021-12-05 11:56:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-07 16:47:42 -05:00
|
|
|
CueMaster::maybe_update ()
|
2021-12-05 11:56:42 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-17 09:30:14 -05:00
|
|
|
CueMaster::_size_allocate (ArdourCanvas::Rect const& alloc)
|
2021-12-05 11:56:42 -05:00
|
|
|
{
|
|
|
|
Rectangle::_size_allocate (alloc);
|
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
const double scale = UIConfiguration::instance ().get_ui_scale ();
|
2022-01-21 18:17:53 -05:00
|
|
|
_poly_margin = 2 * scale;
|
2021-12-05 11:56:42 -05:00
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
const Distance height = _rect.height ();
|
2021-12-05 11:56:42 -05:00
|
|
|
|
2021-12-17 09:30:14 -05:00
|
|
|
_poly_size = height - (_poly_margin * 2);
|
2021-12-05 11:56:42 -05:00
|
|
|
|
|
|
|
Points p;
|
2022-01-04 17:00:39 -05:00
|
|
|
p.push_back (Duple (_poly_margin, _poly_margin));
|
|
|
|
p.push_back (Duple (_poly_margin, _poly_size));
|
|
|
|
p.push_back (Duple (_poly_size, _poly_size));
|
|
|
|
p.push_back (Duple (_poly_size, _poly_margin));
|
2021-12-07 16:47:42 -05:00
|
|
|
stop_shape->set (p);
|
2021-12-05 11:56:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-07 16:47:42 -05:00
|
|
|
CueMaster::set_default_colors ()
|
2021-12-05 11:56:42 -05:00
|
|
|
{
|
2022-01-18 16:52:54 -05:00
|
|
|
set_fill_color (HSV (UIConfiguration::instance ().color ("theme:bg")).darker (0.5).color ());
|
2022-02-14 22:03:23 -05:00
|
|
|
stop_shape->set_fill_color (UIConfiguration::instance ().color ("location marker"));
|
2021-12-05 11:56:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2021-12-07 16:47:42 -05:00
|
|
|
CueMaster::ui_parameter_changed (std::string const& p)
|
2021-12-05 11:56:42 -05:00
|
|
|
{
|
|
|
|
if (p == "color-file") {
|
2021-12-17 09:30:14 -05:00
|
|
|
set_default_colors ();
|
2021-12-05 11:56:42 -05:00
|
|
|
}
|
|
|
|
}
|
2022-01-04 17:00:39 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
CueMaster::context_menu ()
|
|
|
|
{
|
|
|
|
using namespace Gtk;
|
|
|
|
using namespace Gtk::Menu_Helpers;
|
|
|
|
using namespace Temporal;
|
|
|
|
|
|
|
|
delete _context_menu;
|
|
|
|
|
|
|
|
_context_menu = new Menu;
|
|
|
|
MenuList& items = _context_menu->items ();
|
|
|
|
_context_menu->set_name ("ArdourContextMenu");
|
|
|
|
|
|
|
|
Menu* follow_menu = manage (new Menu);
|
|
|
|
MenuList& fitems = follow_menu->items ();
|
|
|
|
|
2022-01-19 17:50:47 -05:00
|
|
|
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::None)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::None))));
|
|
|
|
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::Stop)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::Stop))));
|
|
|
|
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::Again)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::Again))));
|
|
|
|
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::ForwardTrigger)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::ForwardTrigger))));
|
|
|
|
fitems.push_back (MenuElem (TriggerUI::follow_action_to_string(FollowAction (FollowAction::ReverseTrigger)), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_follow_action), FollowAction (FollowAction::ReverseTrigger))));
|
2022-01-04 17:00:39 -05:00
|
|
|
|
|
|
|
Menu* launch_menu = manage (new Menu);
|
|
|
|
MenuList& litems = launch_menu->items ();
|
|
|
|
|
|
|
|
litems.push_back (MenuElem (TriggerUI::launch_style_to_string(Trigger::OneShot), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_launch_style), Trigger::OneShot)));
|
|
|
|
litems.push_back (MenuElem (TriggerUI::launch_style_to_string(Trigger::ReTrigger), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_launch_style), Trigger::ReTrigger)));
|
|
|
|
litems.push_back (MenuElem (TriggerUI::launch_style_to_string(Trigger::Gate), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_launch_style), Trigger::Gate)));
|
|
|
|
litems.push_back (MenuElem (TriggerUI::launch_style_to_string(Trigger::Toggle), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_launch_style), Trigger::Toggle)));
|
|
|
|
litems.push_back (MenuElem (TriggerUI::launch_style_to_string(Trigger::Repeat), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_launch_style), Trigger::Repeat)));
|
|
|
|
|
|
|
|
Menu* quant_menu = manage (new Menu);
|
|
|
|
MenuList& qitems = quant_menu->items ();
|
|
|
|
|
|
|
|
BBT_Offset b;
|
|
|
|
|
2022-01-07 09:51:18 -05:00
|
|
|
b = BBT_Offset (4, 0, 0);
|
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_quantization), b)));
|
|
|
|
b = BBT_Offset (2, 0, 0);
|
2022-01-04 17:00:39 -05:00
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_quantization), b)));
|
2022-01-07 09:51:18 -05:00
|
|
|
b = BBT_Offset (1, 0, 0);
|
2022-01-04 17:00:39 -05:00
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_quantization), b)));
|
|
|
|
b = BBT_Offset (0, 2, 0);
|
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_quantization), b)));
|
|
|
|
b = BBT_Offset (0, 1, 0);
|
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_quantization), b)));
|
|
|
|
b = BBT_Offset (0, 0, ticks_per_beat / 2);
|
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_quantization), b)));
|
|
|
|
b = BBT_Offset (0, 0, ticks_per_beat / 4);
|
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_quantization), b)));
|
|
|
|
b = BBT_Offset (0, 0, ticks_per_beat / 8);
|
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_quantization), b)));
|
|
|
|
b = BBT_Offset (0, 0, ticks_per_beat / 16);
|
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_quantization), b)));
|
2022-01-07 19:06:31 -05:00
|
|
|
b = BBT_Offset (-1, 0, 0);
|
|
|
|
qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_quantization), b)));
|
2022-01-04 17:00:39 -05:00
|
|
|
|
|
|
|
// items.push_back (CheckMenuElem (_("Toggle Monitor Thru"), sigc::mem_fun (*this, &CueMaster::toggle_thru)));
|
|
|
|
// if (_triggerbox->pass_thru ()) {
|
|
|
|
// _ignore_menu_action = true;
|
|
|
|
// dynamic_cast<Gtk::CheckMenuItem*> (&items.back ())->set_active (true);
|
|
|
|
// _ignore_menu_action = false;
|
|
|
|
// }
|
|
|
|
|
|
|
|
items.push_back (MenuElem (_("Set All Follow Actions..."), *follow_menu));
|
|
|
|
items.push_back (MenuElem (_("Set All Launch Styles..."), *launch_menu));
|
|
|
|
items.push_back (MenuElem (_("Set All Quantizations..."), *quant_menu));
|
|
|
|
items.push_back (SeparatorElem());
|
|
|
|
items.push_back (MenuElem (_("Clear All..."), sigc::mem_fun (*this, &CueMaster::clear_all_triggers)));
|
|
|
|
|
|
|
|
_context_menu->popup (1, gtk_get_current_event_time ());
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CueMaster::get_boxen (TriggerBoxList &boxlist)
|
|
|
|
{
|
2023-04-07 17:33:13 -04:00
|
|
|
std::shared_ptr<RouteList const> rl = _session->get_routes();
|
|
|
|
for (auto const& route : *rl) {
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<TriggerBox> box = route->triggerbox();
|
2022-01-04 17:00:39 -05:00
|
|
|
#warning @Ben disambiguate processor *active* vs *visibility*
|
|
|
|
if (box /*&& box.active*/) {
|
|
|
|
boxlist.push_back(box);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//void
|
|
|
|
//CueMaster::toggle_thru ()
|
|
|
|
//{
|
|
|
|
// TriggerBoxList tl;
|
|
|
|
// get_boxen(tl);
|
|
|
|
// for (TriggerBoxList::iterator t = tl.begin(); t != tl.end(); ++t) {
|
|
|
|
// _triggerbox->set_pass_thru (!_triggerbox->pass_thru ());
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
CueMaster::clear_all_triggers ()
|
|
|
|
{
|
|
|
|
TriggerBoxList tl;
|
|
|
|
get_boxen(tl);
|
|
|
|
for (TriggerBoxList::iterator t = tl.begin(); t != tl.end(); ++t) {
|
|
|
|
(*t)->clear_all_triggers();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2022-01-19 17:50:47 -05:00
|
|
|
CueMaster::set_all_follow_action (FollowAction const & fa)
|
2022-01-04 17:00:39 -05:00
|
|
|
{
|
|
|
|
TriggerBoxList tl;
|
|
|
|
get_boxen(tl);
|
|
|
|
for (TriggerBoxList::iterator t = tl.begin(); t != tl.end(); ++t) {
|
|
|
|
(*t)->set_all_follow_action(fa, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CueMaster::set_all_launch_style (Trigger::LaunchStyle ls)
|
|
|
|
{
|
|
|
|
TriggerBoxList tl;
|
|
|
|
get_boxen(tl);
|
|
|
|
for (TriggerBoxList::iterator t = tl.begin(); t != tl.end(); ++t) {
|
|
|
|
(*t)->set_all_launch_style(ls);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CueMaster::set_all_quantization (Temporal::BBT_Offset const& q)
|
|
|
|
{
|
|
|
|
TriggerBoxList tl;
|
|
|
|
get_boxen(tl);
|
|
|
|
for (TriggerBoxList::iterator t = tl.begin(); t != tl.end(); ++t) {
|
|
|
|
(*t)->set_all_quantization(q);
|
|
|
|
}
|
|
|
|
}
|