Cleanup and clang-format source

This commit is contained in:
Robin Gareus 2021-12-17 15:30:14 +01:00
parent 6e3ed7f822
commit 27ba2c7ea6
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
6 changed files with 338 additions and 371 deletions

View file

@ -33,8 +33,8 @@
#include "actions.h" #include "actions.h"
#include "gui_thread.h" #include "gui_thread.h"
#include "utils.h"
#include "timers.h" #include "timers.h"
#include "utils.h"
#include "fitted_canvas_widget.h" #include "fitted_canvas_widget.h"
@ -44,48 +44,48 @@ using namespace Gtk;
using namespace Gtkmm2ext; using namespace Gtkmm2ext;
using namespace ARDOUR_UI_UTILS; using namespace ARDOUR_UI_UTILS;
/** a gtk widget with fixed-size semantics */
//a gtk widget with fixed-size semantics
FittedCanvasWidget::FittedCanvasWidget (float w, float h, bool follow_scale) FittedCanvasWidget::FittedCanvasWidget (float w, float h, bool follow_scale)
{ {
_nominal_width = w; _nominal_width = w;
_nominal_height = h; _nominal_height = h;
_follow_scale = follow_scale; _follow_scale = follow_scale;
//our rendering speed suffers if we re-render knobs simply because they are in-between 2 meters that got invalidated (for example) /* our rendering speed suffers if we re-render knobs simply because
// set_single_exposure(false); * they are in-between 2 meters that got invalidated (for example)
//#ifdef __APPLE__ */
// use_intermediate_surface (false); // set_single_exposure(false);
//#endif #ifdef __APPLE__
// use_intermediate_surface (false);
#endif
} }
void void
FittedCanvasWidget::on_size_request (Gtk::Requisition* req) FittedCanvasWidget::on_size_request (Gtk::Requisition* req)
{ {
const double scale = _follow_scale ? UIConfiguration::instance().get_ui_scale() : 1; const double scale = _follow_scale ? UIConfiguration::instance ().get_ui_scale () : 1;
if (_nominal_width>0) { if (_nominal_width > 0) {
req->width = _nominal_width*scale; req->width = _nominal_width * scale;
} }
if (_nominal_height>0) { if (_nominal_height > 0) {
req->height = _nominal_height*scale; req->height = _nominal_height * scale;
} }
} }
void void
FittedCanvasWidget::on_size_allocate (Gtk::Allocation& alloc) FittedCanvasWidget::on_size_allocate (Gtk::Allocation& alloc)
{ {
GtkCanvas::on_size_allocate(alloc); GtkCanvas::on_size_allocate (alloc);
repeat_size_allocation (); repeat_size_allocation ();
} }
void void
FittedCanvasWidget::repeat_size_allocation () FittedCanvasWidget::repeat_size_allocation ()
{ {
if (!_root.items().empty()) { if (_root.items ().empty ()) {
ArdourCanvas::Item *fitted = *_root.items().begin(); return;
Gtk::Allocation a = get_allocation ();
fitted->size_allocate (ArdourCanvas::Rect (0, 0, a.get_width(), a.get_height()));
} }
}
Gtk::Allocation a = get_allocation ();
_root.items ().front ()->size_allocate (ArdourCanvas::Rect (0, 0, a.get_width (), a.get_height ()));
}

View file

@ -17,55 +17,40 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef __fitted_canvas_widget__ #ifndef _gtk_ardour_fitted_canvas_widget_h_
#define __fitted_canvas_widget__ #define _gtk_ardour_fitted_canvas_widget_h_
#include <string>
#include <vector>
#include <pangomm/fontdescription.h>
#include <canvas/canvas.h> #include <canvas/canvas.h>
#include <canvas/container.h>
#include <canvas/item.h>
#include <canvas/fill.h>
#include <canvas/outline.h>
#include <canvas/rectangle.h>
#include <gtkmm/layout.h> #include <gtkmm/layout.h>
#include <ardour/route.h>
#include <ardour/plugin.h>
#include <ardour/plugin_insert.h>
#include <ardour/automation_control.h>
#include "route_ui.h"
/* FittedCanvasWidget has these properties: /* FittedCanvasWidget has these properties:
* it is provided a 'nominal size' on construction, which it will request of gtk * it is provided a 'nominal size' on construction, which it will request of gtk
* if asked, will resize itself when the user gui/font scale changes * if asked, will resize itself when the user gui/font scale changes
* it 'fits' the Item that was first attached to Root (presumably the top-level widget or container) * it 'fits' the Item that was first attached to Root (presumably the top-level widget or container)
* the fitted Item will be explicitly resized to fit when the canvas size is allocated * the fitted Item will be explicitly resized to fit when the canvas size is allocated
* the fitted Item may be a container; it should allocate child positions during size_allocate() * the fitted Item may be a container; it should allocate child positions during size_allocate()
* */ */
class FittedCanvasWidget : public ArdourCanvas::GtkCanvas class FittedCanvasWidget : public ArdourCanvas::GtkCanvas
{ {
public: public:
/* per gtk convention you may use -1 for width OR height if you don't care about that dimension */ /* per gtk convention you may use -1 for width OR height if you don't care about that dimension */
FittedCanvasWidget(float nominal_width, float nominal_height, bool follow_scale=true); FittedCanvasWidget (float nominal_width, float nominal_height, bool follow_scale = true);
/* call if the root item's first child is changed, to force a size-allocate on it */ /* call if the root item's first child is changed, to force a size-allocate on it */
void repeat_size_allocation (); void repeat_size_allocation ();
void on_size_request (Gtk::Requisition* req); //always returns the nominal size, regardless of children /* always returns the nominal size, regardless of children */
void on_size_allocate (Gtk::Allocation& alloc); void on_size_request (Gtk::Requisition*);
void on_size_allocate (Gtk::Allocation&);
private: private:
ArdourCanvas::Rect _allocation; ArdourCanvas::Rect _allocation;
float _nominal_width; float _nominal_width;
float _nominal_height; float _nominal_height;
bool _follow_scale; bool _follow_scale;
}; };
#endif //__fitted_canvas_widget__ #endif // _gtk_ardour_fitted_canvas_widget_h_

View file

@ -25,7 +25,6 @@
#include "pbd/convert.h" #include "pbd/convert.h"
#include "ardour/region.h" #include "ardour/region.h"
#include "ardour/triggerbox.h"
#include "canvas/polygon.h" #include "canvas/polygon.h"
#include "canvas/text.h" #include "canvas/text.h"
@ -36,12 +35,12 @@
#include "ardour_ui.h" #include "ardour_ui.h"
#include "gui_thread.h" #include "gui_thread.h"
#include "trigger_master.h"
#include "trigger_ui.h"
#include "public_editor.h" #include "public_editor.h"
#include "region_view.h" #include "region_view.h"
#include "selection.h" #include "selection.h"
#include "timers.h" #include "timers.h"
#include "trigger_master.h"
#include "trigger_ui.h"
#include "ui_config.h" #include "ui_config.h"
#include "utils.h" #include "utils.h"
@ -52,85 +51,84 @@ using namespace ArdourCanvas;
using namespace Gtkmm2ext; using namespace Gtkmm2ext;
using namespace PBD; using namespace PBD;
static const int nslices = 8; //in 8 pie slices .. ToDo .. maybe make this meter-senstive ... triplets and such... ? static const int nslices = 8; // in 8 pie slices .. TODO .. maybe make this meter-senstive ... triplets and such... ?
Loopster::Loopster (Item* parent) Loopster::Loopster (Item* parent)
: ArdourCanvas::Rectangle (parent) : ArdourCanvas::Rectangle (parent)
, _fraction(0) , _fraction (0)
{ {
} }
void void
Loopster::set_fraction (float f) Loopster::set_fraction (float f)
{ {
f = std::max(0.f, f); f = std::max (0.f, f);
f = std::min(1.f, f); f = std::min (1.f, f);
float prior_slice = floor(_fraction * nslices); float prior_slice = floor (_fraction * nslices);
float new_slice = floor(f*nslices); float new_slice = floor (f * nslices);
if (new_slice != prior_slice) { if (new_slice != prior_slice) {
_fraction = f; _fraction = f;
redraw(); redraw ();
} }
} }
void void
Loopster::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const Loopster::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context) const
{ {
/* Note that item_to_window() already takes _position into account (as /* Note that item_to_window() already takes _position into account (as
part of item_to_canvas() * part of item_to_canvas()
*/ */
Rect self (item_to_window (_rect)); Rect self (item_to_window (_rect));
const Rect draw = self.intersection (area); const Rect draw = self.intersection (area);
if (!draw) { if (!draw) {
return; return;
} }
context->set_identity_matrix(); context->set_identity_matrix ();
context->translate (self.x0, self.y0-0.5); context->translate (self.x0, self.y0 - 0.5);
float size = _rect.height(); float size = _rect.height ();
const double scale = UIConfiguration::instance().get_ui_scale(); const double scale = UIConfiguration::instance ().get_ui_scale ();
//white area /* white area */
set_source_rgba (context, rgba_to_color (1,1,1,1)); 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->arc (size / 2, size / 2, size / 2 - 4 * scale, 0, 2 * M_PI);
context->fill(); context->fill ();
//arc fill /* arc fill */
context->set_line_width(5*scale); context->set_line_width (5 * scale);
float slices = floor(_fraction * nslices); float slices = floor (_fraction * nslices);
float deg_per_slice = 360/nslices; float deg_per_slice = 360 / nslices;
float degrees = slices * deg_per_slice; float degrees = slices * deg_per_slice;
float radians = (degrees/180)*M_PI; float radians = (degrees / 180) * M_PI;
set_source_rgba (context, rgba_to_color (0,0,0,1)); 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->arc (size / 2, size / 2, size / 2 - 5 * scale, 1.5 * M_PI + radians, 1.5 * M_PI + 2 * M_PI);
context->stroke(); context->stroke ();
context->set_line_width(1); context->set_line_width (1);
context->set_identity_matrix(); context->set_identity_matrix ();
} }
/* ======================== */
class PassThru : public ArdourCanvas::Rectangle class PassThru : public ArdourCanvas::Rectangle
{ {
public: public:
PassThru (ArdourCanvas::Item* canvas); PassThru (ArdourCanvas::Item* canvas);
void render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context> context) const; void render (ArdourCanvas::Rect const& area, Cairo::RefPtr<Cairo::Context> context) const;
void set_enabled (bool e); void set_enabled (bool e);
private:
private:
bool _enabled; bool _enabled;
}; };
PassThru::PassThru (Item* parent) PassThru::PassThru (Item* parent)
: ArdourCanvas::Rectangle (parent) : ArdourCanvas::Rectangle (parent)
{ {
set_enabled(false); set_enabled (false);
} }
void void
@ -138,144 +136,139 @@ PassThru::set_enabled (bool e)
{ {
if (e != _enabled) { if (e != _enabled) {
_enabled = e; _enabled = e;
redraw(); redraw ();
} }
} }
void void
PassThru::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const PassThru::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context) const
{ {
/* Note that item_to_window() already takes _position into account (as /* Note that item_to_window() already takes _position into account (as
part of item_to_canvas() * part of item_to_canvas()
*/ */
Rect self (item_to_window (_rect)); Rect self (item_to_window (_rect));
const Rect draw = self.intersection (area); const Rect draw = self.intersection (area);
if (!draw) { if (!draw) {
return; return;
} }
context->set_identity_matrix(); context->set_identity_matrix ();
context->translate (self.x0, self.y0-0.5); context->translate (self.x0, self.y0 - 0.5);
float size = _rect.height(); float size = _rect.height ();
const double scale = UIConfiguration::instance().get_ui_scale(); const double scale = UIConfiguration::instance ().get_ui_scale ();
if (_enabled) { if (_enabled) {
//outer white circle /* outer white circle */
set_source_rgba (context, rgba_to_color (1,1,1,1)); set_source_rgba (context, rgba_to_color (1, 1, 1, 1));
context->arc ( size/2, size/2, size/2 - 3*scale, 0, 2*M_PI ); context->arc (size / 2, size / 2, size / 2 - 3 * scale, 0, 2 * M_PI);
context->fill(); context->fill ();
//black circle /* black circle */
set_source_rgba (context, rgba_to_color (0,0,0,1)); set_source_rgba (context, rgba_to_color (0, 0, 0, 1));
context->arc ( size/2, size/2, size/2 - 5*scale, 0, 2*M_PI ); context->arc (size / 2, size / 2, size / 2 - 5 * scale, 0, 2 * M_PI);
context->fill(); context->fill ();
//inner white circle /* inner white circle */
set_source_rgba (context, rgba_to_color (1,1,1,1)); set_source_rgba (context, rgba_to_color (1, 1, 1, 1));
context->arc ( size/2, size/2, size/2 - 7*scale, 0, 2*M_PI ); context->arc (size / 2, size / 2, size / 2 - 7 * scale, 0, 2 * M_PI);
context->fill(); context->fill ();
} }
} }
/* ======================== */
TriggerMaster::TriggerMaster (Item* parent) TriggerMaster::TriggerMaster (Item* parent)
: ArdourCanvas::Rectangle (parent) : ArdourCanvas::Rectangle (parent)
, _context_menu (0) , _context_menu (0)
{ {
set_layout_sensitive(true); //why??? set_layout_sensitive (true); // why???
name = X_("trigger stopper"); name = X_("trigger stopper");
Event.connect (sigc::mem_fun (*this, &TriggerMaster::event_handler)); Event.connect (sigc::mem_fun (*this, &TriggerMaster::event_handler));
name_text = new Text (this); name_text = new Text (this);
name_text->set(""); name_text->set ("");
name_text->set_ignore_events (false); name_text->set_ignore_events (false);
_loopster = new Loopster(this); _loopster = new Loopster (this);
_passthru = new PassThru(this); _passthru = new PassThru (this);
/* trigger changes #if 0 /* XXX trigger changes */
_triggerbox->PropertyChanged.connect (trigger_prop_connection, MISSING_INVALIDATOR, boost::bind (&TriggerMaster::prop_change, this, _1), gui_context()); _triggerbox->PropertyChanged.connect (_trigger_prop_connection, MISSING_INVALIDATOR, boost::bind (&TriggerMaster::prop_change, this, _1), gui_context());
PropertyChange changed; PropertyChange changed;
changed.add (ARDOUR::Properties::name); changed.add (ARDOUR::Properties::name);
changed.add (ARDOUR::Properties::running); changed.add (ARDOUR::Properties::running);
prop_change (changed); prop_change (changed);
*/ #endif
/* route changes #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()); 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
update_connection = Timers::rapid_connect (sigc::mem_fun (*this, &TriggerMaster::maybe_update)); _update_connection = Timers::rapid_connect (sigc::mem_fun (*this, &TriggerMaster::maybe_update));
/* prefs (theme colors) */ /* prefs (theme colors) */
UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &TriggerMaster::ui_parameter_changed)); UIConfiguration::instance ().ParameterChanged.connect (sigc::mem_fun (*this, &TriggerMaster::ui_parameter_changed));
set_default_colors(); set_default_colors ();
} }
TriggerMaster::~TriggerMaster () TriggerMaster::~TriggerMaster ()
{ {
update_connection.disconnect();
} }
void TriggerMaster::set_trigger (boost::shared_ptr<ARDOUR::TriggerBox> t) void
TriggerMaster::set_trigger (boost::shared_ptr<ARDOUR::TriggerBox> t)
{ {
_triggerbox = t; _triggerbox = t;
} }
void void
TriggerMaster::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const TriggerMaster::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context) const
{ {
/* Note that item_to_window() already takes _position into account (as /* Note that item_to_window() already takes _position into account (as
part of item_to_canvas() * part of item_to_canvas()
*/ */
Rect self (item_to_window (_rect)); Rect self (item_to_window (_rect));
const Rect draw = self.intersection (area); const Rect draw = self.intersection (area);
if (!draw) { if (!draw) {
return; return;
} }
float width = _rect.width(); float width = _rect.width ();
float height = _rect.height(); float height = _rect.height ();
const double scale = UIConfiguration::instance().get_ui_scale(); const double scale = UIConfiguration::instance ().get_ui_scale ();
if (_fill && !_transparent) { if (_fill && !_transparent) {
setup_fill_context (context); setup_fill_context (context);
context->rectangle (draw.x0, draw.y0, draw.width(), draw.height()); context->rectangle (draw.x0, draw.y0, draw.width (), draw.height ());
context->fill (); context->fill ();
} }
render_children (area, context); render_children (area, context);
{ /* line at right */
//line at right context->set_identity_matrix ();
context->set_identity_matrix(); context->translate (self.x0, self.y0 - 0.5);
context->translate (self.x0, self.y0-0.5); set_source_rgba (context, rgba_to_color (0, 0, 0, 1));
set_source_rgba (context, rgba_to_color (0,0,0,1)); context->rectangle (width - 1, 0, width, height);
context->rectangle(width-1, 0, width, height);
context->fill ();
context->set_identity_matrix();
}
//line at top
context->set_identity_matrix();
context->translate (self.x0, self.y0-0.5);
set_source_rgba (context, rgba_to_color (0,0,0,1));
context->rectangle(0, 0, width, 1.);
context->fill (); context->fill ();
context->set_identity_matrix(); context->set_identity_matrix ();
/* line at top */
context->set_identity_matrix ();
context->translate (self.x0, self.y0 - 0.5);
set_source_rgba (context, rgba_to_color (0, 0, 0, 1));
context->rectangle (0, 0, width, 1.);
context->fill ();
context->set_identity_matrix ();
} }
void void
TriggerMaster::owner_prop_change (PropertyChange const & pc) TriggerMaster::owner_prop_change (PropertyChange const& pc)
{ {
if (pc.contains (Properties::color)) { if (pc.contains (Properties::color)) {
} }
@ -294,36 +287,36 @@ TriggerMaster::event_handler (GdkEvent* ev)
} }
switch (ev->type) { switch (ev->type) {
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
if (ev->button.button == 1) { if (ev->button.button == 1) {
_triggerbox->request_stop_all (); _triggerbox->request_stop_all ();
return true; return true;
} }
break; break;
case GDK_ENTER_NOTIFY: case GDK_ENTER_NOTIFY:
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) { if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
name_text->set_color (UIConfiguration::instance().color("neutral:foregroundest")); name_text->set_color (UIConfiguration::instance ().color ("neutral:foregroundest"));
set_fill_color (HSV (fill_color()).lighter(0.15).color ()); set_fill_color (HSV (fill_color ()).lighter (0.15).color ());
} }
redraw (); redraw ();
break; break;
case GDK_LEAVE_NOTIFY: case GDK_LEAVE_NOTIFY:
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) { if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
set_default_colors(); set_default_colors ();
} }
redraw (); redraw ();
break; break;
case GDK_BUTTON_RELEASE: case GDK_BUTTON_RELEASE:
switch (ev->button.button) { switch (ev->button.button) {
case 3: case 3:
context_menu (); context_menu ();
return true; return true;
default:
break;
}
break;
default: default:
break; break;
}
break;
default:
break;
} }
return false; return false;
@ -338,12 +331,12 @@ TriggerMaster::context_menu ()
delete _context_menu; delete _context_menu;
_context_menu = new Menu; _context_menu = new Menu;
MenuList& items = _context_menu->items(); MenuList& items = _context_menu->items ();
_context_menu->set_name ("ArdourContextMenu"); _context_menu->set_name ("ArdourContextMenu");
Menu* follow_menu = manage (new Menu); Menu* follow_menu = manage (new Menu);
MenuList& fitems = follow_menu->items(); MenuList& fitems = follow_menu->items ();
fitems.push_back (MenuElem (_("Stop"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::Stop))); fitems.push_back (MenuElem (_("Stop"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::Stop)));
fitems.push_back (MenuElem (_("Again"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::Again))); fitems.push_back (MenuElem (_("Again"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::Again)));
@ -352,21 +345,21 @@ TriggerMaster::context_menu ()
fitems.push_back (MenuElem (_("Any"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::AnyTrigger))); fitems.push_back (MenuElem (_("Any"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::AnyTrigger)));
fitems.push_back (MenuElem (_("Other"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::OtherTrigger))); fitems.push_back (MenuElem (_("Other"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_follow_action), Trigger::OtherTrigger)));
Menu* launch_menu = manage (new Menu); Menu* launch_menu = manage (new Menu);
MenuList& litems = launch_menu->items(); MenuList& litems = launch_menu->items ();
litems.push_back (MenuElem (_("One Shot"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::OneShot))); litems.push_back (MenuElem (_("One Shot"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::OneShot)));
litems.push_back (MenuElem (_("Gate"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::Gate))); litems.push_back (MenuElem (_("Gate"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::Gate)));
litems.push_back (MenuElem (_("Toggle"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::Toggle))); litems.push_back (MenuElem (_("Toggle"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::Toggle)));
litems.push_back (MenuElem (_("Repeat"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::Repeat))); litems.push_back (MenuElem (_("Repeat"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_launch_style), Trigger::Repeat)));
Menu* quant_menu = manage (new Menu); Menu* quant_menu = manage (new Menu);
MenuList& qitems = quant_menu->items(); MenuList& qitems = quant_menu->items ();
BBT_Offset b; BBT_Offset b;
b = BBT_Offset (1, 0, 0); b = BBT_Offset (1, 0, 0);
qitems.push_back (MenuElem (_("Global"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); //ToDo qitems.push_back (MenuElem (_("Global"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); // TODO
b = BBT_Offset (1, 0, 0); b = BBT_Offset (1, 0, 0);
qitems.push_back (MenuElem (_("Bars"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); qitems.push_back (MenuElem (_("Bars"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
@ -376,54 +369,54 @@ TriggerMaster::context_menu ()
qitems.push_back (MenuElem (_("Half"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); qitems.push_back (MenuElem (_("Half"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
b = BBT_Offset (0, 1, 0); b = BBT_Offset (0, 1, 0);
qitems.push_back (MenuElem (_("Quarters"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); qitems.push_back (MenuElem (_("Quarters"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
b = BBT_Offset (0, 0, ticks_per_beat/2); b = BBT_Offset (0, 0, ticks_per_beat / 2);
qitems.push_back (MenuElem (_("Eighths"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); qitems.push_back (MenuElem (_("Eighths"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
b = BBT_Offset (0, 0, ticks_per_beat/4); b = BBT_Offset (0, 0, ticks_per_beat / 4);
qitems.push_back (MenuElem ( _("Sixteenths"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); qitems.push_back (MenuElem (_("Sixteenths"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
b = BBT_Offset (0, 0, ticks_per_beat/8); b = BBT_Offset (0, 0, ticks_per_beat / 8);
qitems.push_back (MenuElem (_("Thirty-Seconds"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); qitems.push_back (MenuElem (_("Thirty-Seconds"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
b = BBT_Offset (0, 0, ticks_per_beat/16); b = BBT_Offset (0, 0, ticks_per_beat / 16);
qitems.push_back (MenuElem (_("Sixty-Fourths"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); qitems.push_back (MenuElem (_("Sixty-Fourths"), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b)));
Menu* load_menu = manage (new Menu); Menu* load_menu = manage (new Menu);
MenuList& loitems (load_menu->items()); MenuList& loitems (load_menu->items ());
items.push_back (CheckMenuElem (_("Toggle Monitor Thru"), sigc::mem_fun (*this, &TriggerMaster::toggle_thru))); items.push_back (CheckMenuElem (_("Toggle Monitor Thru"), sigc::mem_fun (*this, &TriggerMaster::toggle_thru)));
if (_triggerbox->pass_thru()) { if (_triggerbox->pass_thru ()) {
dynamic_cast<Gtk::CheckMenuItem*> (&items.back ())->set_active (true); dynamic_cast<Gtk::CheckMenuItem*> (&items.back ())->set_active (true);
} }
items.push_back (MenuElem (_("Enable/Disable..."), sigc::mem_fun (*this, &TriggerMaster::maybe_update))); //ToDo items.push_back (MenuElem (_("Enable/Disable..."), sigc::mem_fun (*this, &TriggerMaster::maybe_update))); // TODO
items.push_back (MenuElem (_("Follow Action..."), *follow_menu)); items.push_back (MenuElem (_("Follow Action..."), *follow_menu));
items.push_back (MenuElem (_("Launch Style..."), *launch_menu)); items.push_back (MenuElem (_("Launch Style..."), *launch_menu));
items.push_back (MenuElem (_("Quantization..."), *quant_menu)); items.push_back (MenuElem (_("Quantization..."), *quant_menu));
items.push_back (MenuElem (_("Clear All..."), sigc::mem_fun (*this, &TriggerMaster::maybe_update))); //ToDo items.push_back (MenuElem (_("Clear All..."), sigc::mem_fun (*this, &TriggerMaster::maybe_update))); // TODO
_context_menu->popup (1, gtk_get_current_event_time()); _context_menu->popup (1, gtk_get_current_event_time ());
} }
void void
TriggerMaster::toggle_thru () TriggerMaster::toggle_thru ()
{ {
_triggerbox->set_pass_thru(!_triggerbox->pass_thru()); _triggerbox->set_pass_thru (!_triggerbox->pass_thru ());
} }
void void
TriggerMaster::set_all_follow_action (Trigger::FollowAction fa) TriggerMaster::set_all_follow_action (Trigger::FollowAction fa)
{ {
//ToDo // TODO
} }
void void
TriggerMaster::set_all_launch_style (Trigger::LaunchStyle ls) TriggerMaster::set_all_launch_style (Trigger::LaunchStyle ls)
{ {
//ToDo // TODO
} }
void void
TriggerMaster::set_all_quantization (Temporal::BBT_Offset const & q) TriggerMaster::set_all_quantization (Temporal::BBT_Offset const& q)
{ {
//ToDo // TODO
} }
void void
@ -432,96 +425,91 @@ TriggerMaster::maybe_update ()
PropertyChange changed; PropertyChange changed;
changed.add (ARDOUR::Properties::name); changed.add (ARDOUR::Properties::name);
changed.add (ARDOUR::Properties::running); changed.add (ARDOUR::Properties::running);
prop_change(changed); prop_change (changed);
} }
void void
TriggerMaster::_size_allocate (ArdourCanvas::Rect const & alloc) TriggerMaster::_size_allocate (ArdourCanvas::Rect const& alloc)
{ {
Rectangle::_size_allocate (alloc); Rectangle::_size_allocate (alloc);
const double scale = UIConfiguration::instance().get_ui_scale(); const double scale = UIConfiguration::instance ().get_ui_scale ();
poly_margin = 2. * scale; _poly_margin = 2. * scale;
const Distance width = _rect.width(); const Distance width = _rect.width ();
const Distance height = _rect.height(); const Distance height = _rect.height ();
poly_size = height - (poly_margin*2); _poly_size = height - (_poly_margin * 2);
float tleft = poly_size + (poly_margin*3); float tleft = _poly_size + (_poly_margin * 3);
float twidth = width-poly_size-(poly_margin*3); float twidth = width - _poly_size - (_poly_margin * 3);
ArdourCanvas::Rect text_alloc (tleft, 0, twidth, height); //testing ArdourCanvas::Rect text_alloc (tleft, 0, twidth, height); //testing
name_text->size_allocate (text_alloc); name_text->size_allocate (text_alloc);
name_text->set_position (Duple (tleft, 1.*scale)); name_text->set_position (Duple (tleft, 1. * scale));
name_text->clamp_width (twidth); name_text->clamp_width (twidth);
_loopster->set(ArdourCanvas::Rect(0, 0, height, height)); _loopster->set (ArdourCanvas::Rect (0, 0, height, height));
_passthru->set(ArdourCanvas::Rect(width-height, 0, width, height)); _passthru->set (ArdourCanvas::Rect (width - height, 0, width, height));
//font scale may have changed. uiconfig 'embeds' the ui-scale in the font /* font scale may have changed. uiconfig 'embeds' the ui-scale in the font */
name_text->set_font_description (UIConfiguration::instance().get_NormalFont()); name_text->set_font_description (UIConfiguration::instance ().get_NormalFont ());
} }
void void
TriggerMaster::prop_change (PropertyChange const & change) TriggerMaster::prop_change (PropertyChange const& change)
{ {
if (!_triggerbox) { if (!_triggerbox) {
return; return;
} }
_passthru->set_enabled(_triggerbox->pass_thru ()); _passthru->set_enabled (_triggerbox->pass_thru ());
std::string text; std::string text;
ARDOUR::Trigger *trigger = _triggerbox->currently_playing(); ARDOUR::Trigger* trigger = _triggerbox->currently_playing ();
if (!trigger) { if (!trigger) {
name_text->set(text); name_text->set (text);
_loopster->hide(); _loopster->hide ();
return; return;
} }
text = string_compose ("%1", (char) ('A'+ trigger->index())); text = string_compose ("%1", (char)('A' + trigger->index ()));
if (trigger->follow_count() > 1) { if (trigger->follow_count () > 1) {
text.append(string_compose(X_(" %1/%2"), trigger->loop_count(), trigger->follow_count())); text.append (string_compose (X_(" %1/%2"), trigger->loop_count (), trigger->follow_count ()));
} }
name_text->set(text);
if (trigger->active()) { name_text->set (text);
if (trigger->active ()) {
double f = trigger->position_as_fraction (); double f = trigger->position_as_fraction ();
_loopster->set_fraction(f); _loopster->set_fraction (f);
_loopster->show(); _loopster->show ();
} else { } else {
_loopster->hide(); _loopster->hide ();
} }
} }
void void
TriggerMaster::set_default_colors () TriggerMaster::set_default_colors ()
{ {
set_fill_color (HSV (UIConfiguration::instance().color("theme:bg")).darker(0.25).color ()); set_fill_color (HSV (UIConfiguration::instance ().color ("theme:bg")).darker (0.25).color ());
name_text->set_color (UIConfiguration::instance().color("neutral:foreground")); name_text->set_color (UIConfiguration::instance ().color ("neutral:foreground"));
} }
void void
TriggerMaster::ui_parameter_changed (std::string const& p) TriggerMaster::ui_parameter_changed (std::string const& p)
{ {
if (p == "color-file") { if (p == "color-file") {
set_default_colors(); set_default_colors ();
} }
} }
//====================================
CueMaster::CueMaster (Item* parent) CueMaster::CueMaster (Item* parent)
: ArdourCanvas::Rectangle (parent) : ArdourCanvas::Rectangle (parent)
{ {
set_layout_sensitive(true); //why??? set_layout_sensitive (true); //why???
name = X_("trigger stopper"); name = X_("trigger stopper");
@ -535,12 +523,12 @@ CueMaster::CueMaster (Item* parent)
stop_shape->show (); stop_shape->show ();
name_text = new Text (this); name_text = new Text (this);
name_text->set(""); name_text->set ("");
name_text->set_ignore_events (false); name_text->set_ignore_events (false);
/* prefs (theme colors) */ /* prefs (theme colors) */
UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &CueMaster::ui_parameter_changed)); UIConfiguration::instance ().ParameterChanged.connect (sigc::mem_fun (*this, &CueMaster::ui_parameter_changed));
set_default_colors(); set_default_colors ();
} }
CueMaster::~CueMaster () CueMaster::~CueMaster ()
@ -548,26 +536,26 @@ CueMaster::~CueMaster ()
} }
void void
CueMaster::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const CueMaster::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context) const
{ {
/* Note that item_to_window() already takes _position into account (as /* Note that item_to_window() already takes _position into account (as
part of item_to_canvas() part of item_to_canvas()
*/ */
Rect self (item_to_window (_rect)); Rect self (item_to_window (_rect));
const Rect draw = self.intersection (area); const Rect draw = self.intersection (area);
if (!draw) { if (!draw) {
return; return;
} }
float width = _rect.width(); float width = _rect.width ();
float height = _rect.height(); float height = _rect.height ();
const double scale = UIConfiguration::instance().get_ui_scale(); const double scale = UIConfiguration::instance ().get_ui_scale ();
if (_fill && !_transparent) { if (_fill && !_transparent) {
setup_fill_context (context); setup_fill_context (context);
context->rectangle (draw.x0, draw.y0, draw.width(), draw.height()); context->rectangle (draw.x0, draw.y0, draw.width (), draw.height ());
context->fill (); context->fill ();
} }
@ -575,47 +563,47 @@ CueMaster::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) con
{ {
//line at right //line at right
context->set_identity_matrix(); context->set_identity_matrix ();
context->translate (self.x0, self.y0-0.5); context->translate (self.x0, self.y0 - 0.5);
set_source_rgba (context, rgba_to_color (0,0,0,1)); set_source_rgba (context, rgba_to_color (0, 0, 0, 1));
context->rectangle(width-1, 0, width, height); context->rectangle (width - 1, 0, width, height);
context->fill (); context->fill ();
context->set_identity_matrix(); context->set_identity_matrix ();
} }
//line at top //line at top
context->set_identity_matrix(); context->set_identity_matrix ();
context->translate (self.x0, self.y0-0.5); context->translate (self.x0, self.y0 - 0.5);
set_source_rgba (context, rgba_to_color (0,0,0,1)); set_source_rgba (context, rgba_to_color (0, 0, 0, 1));
context->rectangle(0, 0, width, 1.); context->rectangle (0, 0, width, 1.);
context->fill (); context->fill ();
context->set_identity_matrix(); context->set_identity_matrix ();
} }
bool bool
CueMaster::event_handler (GdkEvent* ev) CueMaster::event_handler (GdkEvent* ev)
{ {
switch (ev->type) { switch (ev->type) {
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
if (ev->button.button == 1) { if (ev->button.button == 1) {
_session->stop_all_triggers(); _session->stop_all_triggers ();
return true; return true;
} }
break; break;
case GDK_ENTER_NOTIFY: case GDK_ENTER_NOTIFY:
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) { if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
name_text->set_color (UIConfiguration::instance().color("neutral:foregroundest")); name_text->set_color (UIConfiguration::instance ().color ("neutral:foregroundest"));
stop_shape->set_fill_color (UIConfiguration::instance().color("neutral:foregroundest")); stop_shape->set_fill_color (UIConfiguration::instance ().color ("neutral:foregroundest"));
set_fill_color (HSV (fill_color()).lighter(0.15).color ()); set_fill_color (HSV (fill_color ()).lighter (0.15).color ());
} }
break; break;
case GDK_LEAVE_NOTIFY: case GDK_LEAVE_NOTIFY:
if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) { if (ev->crossing.detail != GDK_NOTIFY_INFERIOR) {
set_default_colors(); set_default_colors ();
} }
break; break;
default: default:
break; break;
} }
return false; return false;
@ -624,54 +612,52 @@ CueMaster::event_handler (GdkEvent* ev)
void void
CueMaster::maybe_update () CueMaster::maybe_update ()
{ {
} }
void void
CueMaster::_size_allocate (ArdourCanvas::Rect const & alloc) CueMaster::_size_allocate (ArdourCanvas::Rect const& alloc)
{ {
Rectangle::_size_allocate (alloc); Rectangle::_size_allocate (alloc);
const double scale = UIConfiguration::instance().get_ui_scale(); const double scale = UIConfiguration::instance ().get_ui_scale ();
poly_margin = 2. * scale; _poly_margin = 2. * scale;
const Distance width = _rect.width(); const Distance width = _rect.width ();
const Distance height = _rect.height(); const Distance height = _rect.height ();
poly_size = height - (poly_margin*2); _poly_size = height - (_poly_margin * 2);
Points p; Points p;
p.push_back (Duple (poly_margin, poly_margin)); p.push_back (Duple (_poly_margin, _poly_margin));
p.push_back (Duple (poly_margin, poly_size)); p.push_back (Duple (_poly_margin, _poly_size));
p.push_back (Duple (poly_size, poly_size)); p.push_back (Duple (_poly_size, _poly_size));
p.push_back (Duple (poly_size, poly_margin)); p.push_back (Duple (_poly_size, _poly_margin));
stop_shape->set (p); stop_shape->set (p);
float tleft = poly_size + (poly_margin*3); float tleft = _poly_size + (_poly_margin * 3);
float twidth = width-poly_size-(poly_margin*3); float twidth = width - _poly_size - (_poly_margin * 3);
ArdourCanvas::Rect text_alloc (tleft, 0, twidth, height); //testing ArdourCanvas::Rect text_alloc (tleft, 0, twidth, height); //testing
name_text->size_allocate (text_alloc); name_text->size_allocate (text_alloc);
name_text->set_position (Duple (tleft, 1.*scale)); name_text->set_position (Duple (tleft, 1. * scale));
name_text->clamp_width (twidth); name_text->clamp_width (twidth);
//font scale may have changed. uiconfig 'embeds' the ui-scale in the font /* font scale may have changed. uiconfig 'embeds' the ui-scale in the font */
name_text->set_font_description (UIConfiguration::instance().get_NormalFont()); name_text->set_font_description (UIConfiguration::instance ().get_NormalFont ());
} }
void void
CueMaster::set_default_colors () CueMaster::set_default_colors ()
{ {
set_fill_color (HSV (UIConfiguration::instance().color("theme:bg")).darker(0.25).color ()); set_fill_color (HSV (UIConfiguration::instance ().color ("theme:bg")).darker (0.25).color ());
name_text->set_color (UIConfiguration::instance().color("neutral:foreground")); name_text->set_color (UIConfiguration::instance ().color ("neutral:foreground"));
stop_shape->set_fill_color (UIConfiguration::instance().color("neutral:foreground")); stop_shape->set_fill_color (UIConfiguration::instance ().color ("neutral:foreground"));
} }
void void
CueMaster::ui_parameter_changed (std::string const& p) CueMaster::ui_parameter_changed (std::string const& p)
{ {
if (p == "color-file") { if (p == "color-file") {
set_default_colors(); set_default_colors ();
} }
} }

View file

@ -17,107 +17,103 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#ifndef __ardour_trigger_master_h__ #ifndef _gtk_ardour_trigger_master_h_
#define __ardour_trigger_master_h__ #define _gtk_ardour_ardour_trigger_master_h_
#include <map>
#include <gtkmm/window.h>
#include "pbd/properties.h" #include "pbd/properties.h"
#include "ardour/triggerbox.h" #include "ardour/triggerbox.h"
#include "canvas/table.h"
#include "canvas/canvas.h" #include "canvas/canvas.h"
#include "canvas/rectangle.h" #include "canvas/rectangle.h"
#include "canvas/table.h"
#include "fitted_canvas_widget.h" namespace Gtk
{
namespace Gtk { class FileChooserDialog;
class FileChooserDialog; class Menu;
class Menu;
} }
namespace Temporal { namespace Temporal
{
struct BBT_Offset; struct BBT_Offset;
} }
namespace ArdourCanvas { namespace ArdourCanvas
{
class Text; class Text;
class Polygon; class Polygon;
}; }
class Loopster : public ArdourCanvas::Rectangle
{
public:
Loopster (ArdourCanvas::Item* canvas);
void render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context> context) const;
void set_fraction (float);
private:
float _fraction;
};
class PassThru; class PassThru;
class Loopster : public ArdourCanvas::Rectangle
{
public:
Loopster (ArdourCanvas::Item* canvas);
void render (ArdourCanvas::Rect const& area, Cairo::RefPtr<Cairo::Context> context) const;
void set_fraction (float);
private:
float _fraction;
};
class TriggerMaster : public ArdourCanvas::Rectangle class TriggerMaster : public ArdourCanvas::Rectangle
{ {
public: public:
TriggerMaster (ArdourCanvas::Item* canvas); TriggerMaster (ArdourCanvas::Item* canvas);
~TriggerMaster (); ~TriggerMaster ();
void set_trigger(boost::shared_ptr<ARDOUR::TriggerBox>); void set_trigger (boost::shared_ptr<ARDOUR::TriggerBox>);
void render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context> context) const; void render (ArdourCanvas::Rect const&, Cairo::RefPtr<Cairo::Context>) const;
void _size_allocate (ArdourCanvas::Rect const & alloc); void _size_allocate (ArdourCanvas::Rect const&);
ArdourCanvas::Text* name_text; ArdourCanvas::Text* name_text;
void toggle_thru (); void toggle_thru ();
void maybe_update (); void maybe_update ();
bool event_handler (GdkEvent*); bool event_handler (GdkEvent*);
void selection_change (); void selection_change ();
private: private:
void context_menu ();
void set_all_follow_action (ARDOUR::Trigger::FollowAction);
void set_all_launch_style (ARDOUR::Trigger::LaunchStyle);
void set_all_quantization (Temporal::BBT_Offset const&);
void prop_change (PBD::PropertyChange const& change);
void owner_prop_change (PBD::PropertyChange const&);
void ui_parameter_changed (std::string const& p);
void set_default_colors ();
void shape_stop_button ();
boost::shared_ptr<ARDOUR::TriggerBox> _triggerbox;
Loopster* _loopster; Loopster* _loopster;
PassThru* _passthru; PassThru* _passthru;
Gtk::Menu* _context_menu; Gtk::Menu* _context_menu;
void context_menu ();
void set_all_follow_action (ARDOUR::Trigger::FollowAction); double _poly_size;
void set_all_launch_style (ARDOUR::Trigger::LaunchStyle); double _poly_margin;
void set_all_quantization (Temporal::BBT_Offset const &);
boost::shared_ptr<ARDOUR::TriggerBox> _triggerbox; PBD::ScopedConnection _trigger_prop_connection;
double poly_size; PBD::ScopedConnection _owner_prop_connection;
double poly_margin; sigc::connection _update_connection;
PBD::ScopedConnection trigger_prop_connection;
void prop_change (PBD::PropertyChange const & change);
void shape_stop_button ();
PBD::ScopedConnection owner_prop_connection;
void owner_prop_change (PBD::PropertyChange const &);
void ui_parameter_changed (std::string const& p);
void set_default_colors();
sigc::connection update_connection;
}; };
class CueMaster : public ArdourCanvas::Rectangle, public ARDOUR::SessionHandlePtr class CueMaster : public ArdourCanvas::Rectangle, public ARDOUR::SessionHandlePtr
{ {
public: public:
CueMaster (ArdourCanvas::Item* canvas); CueMaster (ArdourCanvas::Item* canvas);
~CueMaster (); ~CueMaster ();
void render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context> context) const; void render (ArdourCanvas::Rect const& area, Cairo::RefPtr<Cairo::Context> context) const;
void _size_allocate (ArdourCanvas::Rect const & alloc); void _size_allocate (ArdourCanvas::Rect const& alloc);
ArdourCanvas::Polygon* stop_shape; ArdourCanvas::Polygon* stop_shape;
ArdourCanvas::Text* name_text; ArdourCanvas::Text* name_text;
@ -125,13 +121,13 @@ class CueMaster : public ArdourCanvas::Rectangle, public ARDOUR::SessionHandlePt
void maybe_update (); void maybe_update ();
bool event_handler (GdkEvent*); bool event_handler (GdkEvent*);
private: private:
double poly_size; void ui_parameter_changed (std::string const& p);
double poly_margin; void set_default_colors ();
void shape_stop_button (); void shape_stop_button ();
void ui_parameter_changed (std::string const& p); double _poly_size;
void set_default_colors(); double _poly_margin;
}; };
#endif /* __ardour_trigger_master_h__ */
#endif

View file

@ -87,11 +87,11 @@ TriggerPage::TriggerPage ()
/* Last item of strip packer, "+" background */ /* Last item of strip packer, "+" background */
_strip_packer.pack_end (_no_strips, true, true); _strip_packer.pack_end (_no_strips, true, true);
_no_strips.set_flags (Gtk::CAN_FOCUS); _no_strips.set_flags (Gtk::CAN_FOCUS);
_no_strips.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK); _no_strips.add_events (Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK);
_no_strips.set_size_request (PX_SCALE (20), -1); _no_strips.set_size_request (PX_SCALE (20), -1);
_no_strips.signal_expose_event ().connect (sigc::bind (sigc::ptr_fun (&ArdourWidgets::ArdourIcon::expose), &_no_strips, ArdourWidgets::ArdourIcon::ShadedPlusSign)); _no_strips.signal_expose_event ().connect (sigc::bind (sigc::ptr_fun (&ArdourWidgets::ArdourIcon::expose), &_no_strips, ArdourWidgets::ArdourIcon::ShadedPlusSign));
_no_strips.signal_button_press_event().connect (sigc::mem_fun(*this, &TriggerPage::no_strip_button_event)); _no_strips.signal_button_press_event ().connect (sigc::mem_fun (*this, &TriggerPage::no_strip_button_event));
_no_strips.signal_button_release_event().connect (sigc::mem_fun(*this, &TriggerPage::no_strip_button_event)); _no_strips.signal_button_release_event ().connect (sigc::mem_fun (*this, &TriggerPage::no_strip_button_event));
_strip_group_box.pack_start (_cue_area_frame, false, false); _strip_group_box.pack_start (_cue_area_frame, false, false);
_strip_group_box.pack_start (_strip_scroller, true, true); _strip_group_box.pack_start (_strip_scroller, true, true);
@ -231,7 +231,7 @@ TriggerPage::set_session (Session* s)
SessionHandlePtr::set_session (s); SessionHandlePtr::set_session (s);
_trigger_clip_picker.set_session (s); _trigger_clip_picker.set_session (s);
_master.set_session(s); _master.set_session (s);
if (!_session) { if (!_session) {
return; return;
@ -482,7 +482,7 @@ bool
TriggerPage::no_strip_button_event (GdkEventButton* ev) TriggerPage::no_strip_button_event (GdkEventButton* ev)
{ {
if ((ev->type == GDK_2BUTTON_PRESS && ev->button == 1) || (ev->type == GDK_BUTTON_RELEASE && Keyboard::is_context_menu_event (ev))) { if ((ev->type == GDK_2BUTTON_PRESS && ev->button == 1) || (ev->type == GDK_BUTTON_RELEASE && Keyboard::is_context_menu_event (ev))) {
ARDOUR_UI::instance()->add_route (); ARDOUR_UI::instance ()->add_route ();
return true; return true;
} }
return false; return false;

View file

@ -103,12 +103,12 @@ private:
SlotPropertiesBox _slot_prop_box; SlotPropertiesBox _slot_prop_box;
AudioTriggerPropertiesBox _audio_trig_box; AudioTriggerPropertiesBox _audio_trig_box;
AudioRegionOperationsBox _audio_ops_box; AudioRegionOperationsBox _audio_ops_box;
AudioClipEditorBox _audio_trim_box; AudioClipEditorBox _audio_trim_box;
MidiTriggerPropertiesBox _midi_trig_box; MidiTriggerPropertiesBox _midi_trig_box;
MidiRegionOperationsBox _midi_ops_box; MidiRegionOperationsBox _midi_ops_box;
MidiClipEditorBox _midi_trim_box; MidiClipEditorBox _midi_trim_box;
std::list<TriggerStrip*> _strips; std::list<TriggerStrip*> _strips;
sigc::connection _fast_screen_update_connection; sigc::connection _fast_screen_update_connection;