mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
Re-do source-code cleanup and formatting
Some of this was lost in 26df9ccdf8
This also removes some excess code
This commit is contained in:
parent
49b1eb401d
commit
422ad6656d
5 changed files with 575 additions and 592 deletions
|
|
@ -30,8 +30,8 @@
|
||||||
#include "gtkmm2ext/utils.h"
|
#include "gtkmm2ext/utils.h"
|
||||||
|
|
||||||
#include "ardour_ui.h"
|
#include "ardour_ui.h"
|
||||||
#include "gui_thread.h"
|
|
||||||
#include "cuebox_ui.h"
|
#include "cuebox_ui.h"
|
||||||
|
#include "gui_thread.h"
|
||||||
#include "public_editor.h"
|
#include "public_editor.h"
|
||||||
#include "region_view.h"
|
#include "region_view.h"
|
||||||
#include "selection.h"
|
#include "selection.h"
|
||||||
|
|
@ -50,39 +50,39 @@ CueEntry::CueEntry (Item* item, uint64_t cue_index)
|
||||||
: ArdourCanvas::Rectangle (item)
|
: ArdourCanvas::Rectangle (item)
|
||||||
, _cue_idx (cue_index)
|
, _cue_idx (cue_index)
|
||||||
{
|
{
|
||||||
set_layout_sensitive(true); //why???
|
set_layout_sensitive (true); // why???
|
||||||
|
|
||||||
name = string_compose ("cue %1", _cue_idx);
|
name = string_compose ("cue %1", _cue_idx);
|
||||||
|
|
||||||
Event.connect (sigc::mem_fun (*this, &CueEntry::event_handler));
|
Event.connect (sigc::mem_fun (*this, &CueEntry::event_handler));
|
||||||
|
|
||||||
set_outline (false);
|
set_outline (false);
|
||||||
set_fill_color (UIConfiguration::instance().color ("theme:bg"));
|
set_fill_color (UIConfiguration::instance ().color ("theme:bg"));
|
||||||
|
|
||||||
play_button = new ArdourCanvas::Rectangle (this);
|
play_button = new ArdourCanvas::Rectangle (this);
|
||||||
play_button->set_outline (false);
|
play_button->set_outline (false);
|
||||||
play_button->set_fill(true);
|
play_button->set_fill (true);
|
||||||
play_button->name = string_compose ("playbutton %1", _cue_idx);
|
play_button->name = string_compose ("playbutton %1", _cue_idx);
|
||||||
play_button->show ();
|
play_button->show ();
|
||||||
|
|
||||||
play_shape = new ArdourCanvas::Polygon (play_button);
|
play_shape = new ArdourCanvas::Polygon (play_button);
|
||||||
play_shape->name = string_compose ("playshape %1", _cue_idx);
|
play_shape->name = string_compose ("playshape %1", _cue_idx);
|
||||||
play_shape->show ();
|
play_shape->show ();
|
||||||
|
|
||||||
name_button = new ArdourCanvas::Rectangle (this);
|
name_button = new ArdourCanvas::Rectangle (this);
|
||||||
name_button->set_outline (true);
|
name_button->set_outline (true);
|
||||||
name_button->set_fill(false);
|
name_button->set_fill (false);
|
||||||
name_button->name = ("slot_selector_button");
|
name_button->name = ("slot_selector_button");
|
||||||
name_button->show ();
|
name_button->show ();
|
||||||
|
|
||||||
name_text = new Text (name_button);
|
name_text = new Text (name_button);
|
||||||
name_text->set (string_compose ("%1", (char) ('A'+ _cue_idx) ));
|
name_text->set (string_compose ("%1", (char)('A' + _cue_idx)));
|
||||||
name_text->set_ignore_events (false);
|
name_text->set_ignore_events (false);
|
||||||
name_text->show();
|
name_text->show ();
|
||||||
|
|
||||||
/* watch for change in theme */
|
/* watch for change in theme */
|
||||||
UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &CueEntry::ui_parameter_changed));
|
UIConfiguration::instance ().ParameterChanged.connect (sigc::mem_fun (*this, &CueEntry::ui_parameter_changed));
|
||||||
set_default_colors();
|
set_default_colors ();
|
||||||
}
|
}
|
||||||
|
|
||||||
CueEntry::~CueEntry ()
|
CueEntry::~CueEntry ()
|
||||||
|
|
@ -93,98 +93,98 @@ bool
|
||||||
CueEntry::event_handler (GdkEvent* ev)
|
CueEntry::event_handler (GdkEvent* ev)
|
||||||
{
|
{
|
||||||
switch (ev->type) {
|
switch (ev->type) {
|
||||||
case GDK_BUTTON_PRESS:
|
case GDK_BUTTON_PRESS:
|
||||||
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"));
|
||||||
play_shape->set_outline_color (UIConfiguration::instance().color("neutral:foregroundest"));
|
play_shape->set_outline_color (UIConfiguration::instance ().color ("neutral:foregroundest"));
|
||||||
play_button->set_fill_color (HSV (fill_color()).lighter(0.15).color ());
|
play_button->set_fill_color (HSV (fill_color ()).lighter (0.15).color ());
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CueEntry::_size_allocate (ArdourCanvas::Rect const & alloc)
|
CueEntry::_size_allocate (ArdourCanvas::Rect const& alloc)
|
||||||
{
|
{
|
||||||
ArdourCanvas::Rectangle::_size_allocate (alloc);
|
ArdourCanvas::Rectangle::_size_allocate (alloc);
|
||||||
|
|
||||||
const Distance width = _rect.width();
|
const Distance width = _rect.width ();
|
||||||
const Distance height = _rect.height();
|
const Distance height = _rect.height ();
|
||||||
|
|
||||||
play_button->set (ArdourCanvas::Rect (0, 0, height, height));
|
play_button->set (ArdourCanvas::Rect (0, 0, height, height));
|
||||||
name_button->set (ArdourCanvas::Rect (height, 0, width, height));
|
name_button->set (ArdourCanvas::Rect (height, 0, width, height));
|
||||||
|
|
||||||
const double scale = UIConfiguration::instance().get_ui_scale();
|
const double scale = UIConfiguration::instance ().get_ui_scale ();
|
||||||
poly_margin = 2. * scale;
|
_poly_margin = 2. * scale;
|
||||||
poly_size = height - 2*poly_margin;
|
_poly_size = height - 2 * _poly_margin;
|
||||||
shape_play_button ();
|
shape_play_button ();
|
||||||
|
|
||||||
float tleft = height; //make room for the play button
|
float tleft = height; // make room for the play button
|
||||||
float twidth = name_button->width() - poly_margin*2;
|
float twidth = name_button->width () - _poly_margin * 2;
|
||||||
|
|
||||||
name_text->size_allocate (ArdourCanvas::Rect (0, 0, width, height));
|
name_text->size_allocate (ArdourCanvas::Rect (0, 0, width, height));
|
||||||
name_text->set_position (Duple (tleft + poly_margin, poly_margin -0.5));
|
name_text->set_position (Duple (tleft + _poly_margin, _poly_margin - 0.5));
|
||||||
name_text->clamp_width ( width - height );
|
name_text->clamp_width (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
|
||||||
CueEntry::render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
|
CueEntry::render (ArdourCanvas::Rect const& area, Cairo::RefPtr<Cairo::Context> context) const
|
||||||
{
|
{
|
||||||
ArdourCanvas::Rectangle::render(area, context);
|
ArdourCanvas::Rectangle::render (area, context);
|
||||||
|
|
||||||
/* 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()
|
||||||
*/
|
*/
|
||||||
ArdourCanvas::Rect self (item_to_window (_rect));
|
ArdourCanvas::Rect self (item_to_window (_rect));
|
||||||
const ArdourCanvas::Rect draw = self.intersection (area);
|
const ArdourCanvas::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);
|
||||||
|
|
||||||
if (_cue_idx==0) {
|
if (_cue_idx == 0) {
|
||||||
Cairo::RefPtr<Cairo::LinearGradient> drop_shadow_pattern = Cairo::LinearGradient::create (0.0, 0.0, 0.0, 6*scale);
|
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 (0, 0, 0, 0, 0.7);
|
||||||
drop_shadow_pattern->add_color_stop_rgba (1, 0, 0, 0, 0.0);
|
drop_shadow_pattern->add_color_stop_rgba (1, 0, 0, 0, 0.0);
|
||||||
context->set_source (drop_shadow_pattern);
|
context->set_source (drop_shadow_pattern);
|
||||||
context->rectangle(0, 0, width, 6*scale );
|
context->rectangle (0, 0, width, 6 * scale);
|
||||||
context->fill ();
|
context->fill ();
|
||||||
} else if (_cue_idx%2==0) {
|
} else if (_cue_idx % 2 == 0) {
|
||||||
//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 ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,13 +193,13 @@ CueEntry::shape_play_button ()
|
||||||
{
|
{
|
||||||
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, 0.5+poly_size / 2.));
|
p.push_back (Duple (_poly_size, 0.5 + _poly_size / 2.));
|
||||||
|
|
||||||
play_shape->set (p);
|
play_shape->set (p);
|
||||||
|
|
||||||
if (false /*ToDo*/) {
|
if (false /*TODO*/) {
|
||||||
play_shape->set_outline (false);
|
play_shape->set_outline (false);
|
||||||
play_shape->set_fill (true);
|
play_shape->set_fill (true);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -211,25 +211,26 @@ CueEntry::shape_play_button ()
|
||||||
void
|
void
|
||||||
CueEntry::set_default_colors ()
|
CueEntry::set_default_colors ()
|
||||||
{
|
{
|
||||||
set_fill_color (UIConfiguration::instance().color ("theme:bg"));
|
set_fill_color (UIConfiguration::instance ().color ("theme:bg"));
|
||||||
play_button->set_fill_color (UIConfiguration::instance().color("theme:bg"));
|
play_button->set_fill_color (UIConfiguration::instance ().color ("theme:bg"));
|
||||||
play_button->set_outline_color (UIConfiguration::instance().color("theme:bg"));
|
play_button->set_outline_color (UIConfiguration::instance ().color ("theme:bg"));
|
||||||
name_button->set_fill_color (UIConfiguration::instance().color("theme:bg"));
|
name_button->set_fill_color (UIConfiguration::instance ().color ("theme:bg"));
|
||||||
name_text->set_fill_color (UIConfiguration::instance().color("theme:bg"));
|
name_text->set_fill_color (UIConfiguration::instance ().color ("theme:bg"));
|
||||||
name_button->set_outline_color (UIConfiguration::instance().color("theme:bg"));
|
name_button->set_outline_color (UIConfiguration::instance ().color ("theme:bg"));
|
||||||
if ((_cue_idx/2)%2==0) {
|
|
||||||
set_fill_color (HSV (fill_color()).darker(0.15).color ());
|
if ((_cue_idx / 2) % 2 == 0) {
|
||||||
play_button->set_fill_color (HSV (fill_color()).darker(0.15).color ());
|
set_fill_color (HSV (fill_color ()).darker (0.15).color ());
|
||||||
play_button->set_outline_color (HSV (fill_color()).darker(0.15).color ());
|
play_button->set_fill_color (HSV (fill_color ()).darker (0.15).color ());
|
||||||
name_button->set_fill_color (HSV (fill_color()).darker(0.15).color ());
|
play_button->set_outline_color (HSV (fill_color ()).darker (0.15).color ());
|
||||||
name_text->set_fill_color (HSV (fill_color()).darker(0.15).color ());
|
name_button->set_fill_color (HSV (fill_color ()).darker (0.15).color ());
|
||||||
name_button->set_outline_color (HSV (fill_color()).darker(0.15).color ());
|
name_text->set_fill_color (HSV (fill_color ()).darker (0.15).color ());
|
||||||
|
name_button->set_outline_color (HSV (fill_color ()).darker (0.15).color ());
|
||||||
}
|
}
|
||||||
|
|
||||||
name_text->set_color (UIConfiguration::instance().color("neutral:foreground"));
|
name_text->set_color (UIConfiguration::instance ().color ("neutral:foreground"));
|
||||||
|
|
||||||
play_shape->set_outline_color (UIConfiguration::instance().color("neutral:foreground"));
|
play_shape->set_outline_color (UIConfiguration::instance ().color ("neutral:foreground"));
|
||||||
play_shape->set_fill_color (UIConfiguration::instance().color("neutral:foreground"));
|
play_shape->set_fill_color (UIConfiguration::instance ().color ("neutral:foreground"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -240,19 +241,15 @@ CueEntry::ui_parameter_changed (std::string const& p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Gtkmm2ext::Bindings* CueBoxUI::bindings = 0;
|
||||||
|
|
||||||
/* ---------------------------- */
|
|
||||||
|
|
||||||
Gtkmm2ext::Bindings* CueBoxUI::bindings = 0;
|
|
||||||
Glib::RefPtr<Gtk::ActionGroup> CueBoxUI::trigger_actions;
|
Glib::RefPtr<Gtk::ActionGroup> CueBoxUI::trigger_actions;
|
||||||
|
|
||||||
CueBoxUI::CueBoxUI (ArdourCanvas::Item* parent)
|
CueBoxUI::CueBoxUI (ArdourCanvas::Item* parent)
|
||||||
: ArdourCanvas::Rectangle (parent)
|
: ArdourCanvas::Rectangle (parent)
|
||||||
{
|
{
|
||||||
set_layout_sensitive(true); //why???
|
set_layout_sensitive (true); // why???
|
||||||
|
|
||||||
set_fill_color (UIConfiguration::instance().color(X_("theme:bg")));
|
set_fill_color (UIConfiguration::instance ().color (X_("theme:bg")));
|
||||||
set_fill (true);
|
set_fill (true);
|
||||||
|
|
||||||
build ();
|
build ();
|
||||||
|
|
@ -303,39 +300,40 @@ CueBoxUI::build ()
|
||||||
|
|
||||||
_slots.clear ();
|
_slots.clear ();
|
||||||
|
|
||||||
for (int32_t n = 0; n < TriggerBox::default_triggers_per_box; ++n) { //ToDo
|
for (int32_t n = 0; n < TriggerBox::default_triggers_per_box; ++n) { // TODO
|
||||||
CueEntry* te = new CueEntry (this, n);
|
CueEntry* te = new CueEntry (this, n);
|
||||||
|
|
||||||
_slots.push_back (te);
|
_slots.push_back (te);
|
||||||
|
|
||||||
// te->play_button->Event.connect (sigc::bind (sigc::mem_fun (*this, &CueBoxUI::trigger_scene), n));
|
#if 0
|
||||||
// te->name_text->Event.connect (sigc::bind (sigc::mem_fun (*this, &CueBoxUI::text_event), n));
|
te->play_button->Event.connect (sigc::bind (sigc::mem_fun (*this, &CueBoxUI::trigger_scene), n));
|
||||||
|
te->name_text->Event.connect (sigc::bind (sigc::mem_fun (*this, &CueBoxUI::text_event), n));
|
||||||
|
#endif
|
||||||
te->Event.connect (sigc::bind (sigc::mem_fun (*this, &CueBoxUI::event), n));
|
te->Event.connect (sigc::bind (sigc::mem_fun (*this, &CueBoxUI::event), n));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CueBoxUI::_size_allocate (ArdourCanvas::Rect const & alloc)
|
CueBoxUI::_size_allocate (ArdourCanvas::Rect const& alloc)
|
||||||
{
|
{
|
||||||
ArdourCanvas::Rectangle::_size_allocate (alloc);
|
ArdourCanvas::Rectangle::_size_allocate (alloc);
|
||||||
|
|
||||||
const float width = alloc.width();
|
const float width = alloc.width ();
|
||||||
const float height = alloc.height();
|
const float height = alloc.height ();
|
||||||
|
|
||||||
const float slot_h = height / TriggerBox::default_triggers_per_box; //ToDo
|
const float slot_h = height / TriggerBox::default_triggers_per_box; // TODO
|
||||||
|
|
||||||
float ypos = 0;
|
float ypos = 0;
|
||||||
for (auto & slot : _slots) {
|
for (auto& slot : _slots) {
|
||||||
slot->size_allocate (ArdourCanvas::Rect (0, 0, width, slot_h));
|
slot->size_allocate (ArdourCanvas::Rect (0, 0, width, slot_h));
|
||||||
slot->set_position (Duple (0, ypos));
|
slot->set_position (Duple (0, ypos));
|
||||||
ypos += slot_h;
|
ypos += slot_h;
|
||||||
slot->show();
|
slot->show ();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CueBoxUI::text_event (GdkEvent *ev, uint64_t n)
|
CueBoxUI::text_event (GdkEvent* ev, uint64_t n)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -344,27 +342,25 @@ bool
|
||||||
CueBoxUI::event (GdkEvent* ev, uint64_t n)
|
CueBoxUI::event (GdkEvent* ev, uint64_t n)
|
||||||
{
|
{
|
||||||
switch (ev->type) {
|
switch (ev->type) {
|
||||||
case GDK_BUTTON_PRESS:
|
case GDK_BUTTON_PRESS:
|
||||||
trigger_scene(n);
|
trigger_scene (n);
|
||||||
break;
|
break;
|
||||||
case GDK_2BUTTON_PRESS:
|
case GDK_2BUTTON_PRESS:
|
||||||
break;
|
break;
|
||||||
case GDK_BUTTON_RELEASE:
|
case GDK_BUTTON_RELEASE:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CueBoxWidget::CueBoxWidget (float w, float h)
|
||||||
/* ------------ */
|
: FittedCanvasWidget (w, h)
|
||||||
|
|
||||||
CueBoxWidget::CueBoxWidget (float w, float h) : FittedCanvasWidget(w,h)
|
|
||||||
{
|
{
|
||||||
ui = new CueBoxUI (root());
|
ui = new CueBoxUI (root ());
|
||||||
set_background_color (UIConfiguration::instance().color (X_("theme:bg")));
|
set_background_color (UIConfiguration::instance ().color (X_("theme:bg")));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -379,15 +375,12 @@ CueBoxWidget::on_unmap ()
|
||||||
FittedCanvasWidget::on_unmap ();
|
FittedCanvasWidget::on_unmap ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ------------ */
|
|
||||||
|
|
||||||
CueBoxWindow::CueBoxWindow ()
|
CueBoxWindow::CueBoxWindow ()
|
||||||
{
|
{
|
||||||
CueBoxWidget* tbw = manage (new CueBoxWidget (-1., TriggerBox::default_triggers_per_box*16.));
|
CueBoxWidget* tbw = manage (new CueBoxWidget (-1., TriggerBox::default_triggers_per_box * 16.));
|
||||||
set_title (_("CueBox for XXXX"));
|
set_title (_("CueBox for XXXX"));
|
||||||
|
|
||||||
set_default_size (-1., TriggerBox::default_triggers_per_box*16.);
|
set_default_size (-1., TriggerBox::default_triggers_per_box * 16.);
|
||||||
add (*tbw);
|
add (*tbw);
|
||||||
tbw->show ();
|
tbw->show ();
|
||||||
}
|
}
|
||||||
|
|
@ -395,13 +388,13 @@ CueBoxWindow::CueBoxWindow ()
|
||||||
bool
|
bool
|
||||||
CueBoxWindow::on_key_press_event (GdkEventKey* ev)
|
CueBoxWindow::on_key_press_event (GdkEventKey* ev)
|
||||||
{
|
{
|
||||||
Gtk::Window& main_window (ARDOUR_UI::instance()->main_window());
|
Gtk::Window& main_window (ARDOUR_UI::instance ()->main_window ());
|
||||||
return ARDOUR_UI_UTILS::relay_key_press (ev, &main_window);
|
return ARDOUR_UI_UTILS::relay_key_press (ev, &main_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CueBoxWindow::on_key_release_event (GdkEventKey* ev)
|
CueBoxWindow::on_key_release_event (GdkEventKey* ev)
|
||||||
{
|
{
|
||||||
Gtk::Window& main_window (ARDOUR_UI::instance()->main_window());
|
Gtk::Window& main_window (ARDOUR_UI::instance ()->main_window ());
|
||||||
return ARDOUR_UI_UTILS::relay_key_press (ev, &main_window);
|
return ARDOUR_UI_UTILS::relay_key_press (ev, &main_window);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,8 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __cuebox_ui_h__
|
#ifndef _gtk_ardour_cuebox_ui_h_
|
||||||
#define __cuebox_ui_h__
|
#define _gtk_ardour_cuebox_ui_h_
|
||||||
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
#include <gtkmm/window.h>
|
#include <gtkmm/window.h>
|
||||||
|
|
||||||
|
|
@ -28,93 +26,81 @@
|
||||||
|
|
||||||
#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 "fitted_canvas_widget.h"
|
#include "fitted_canvas_widget.h"
|
||||||
|
|
||||||
namespace Gtk {
|
namespace ArdourCanvas
|
||||||
class FileChooserDialog;
|
{
|
||||||
class Menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Temporal {
|
|
||||||
struct BBT_Offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace ArdourCanvas {
|
|
||||||
class Text;
|
class Text;
|
||||||
class Polygon;
|
class Polygon;
|
||||||
};
|
}
|
||||||
|
|
||||||
class CueEntry : public ArdourCanvas::Rectangle
|
class CueEntry : public ArdourCanvas::Rectangle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CueEntry (ArdourCanvas::Item* item, uint64_t cue_index );
|
CueEntry (ArdourCanvas::Item* item, uint64_t cue_index);
|
||||||
~CueEntry ();
|
~CueEntry ();
|
||||||
|
|
||||||
ArdourCanvas::Rectangle* play_button;
|
ArdourCanvas::Rectangle* play_button;
|
||||||
ArdourCanvas::Polygon* play_shape;
|
ArdourCanvas::Polygon* play_shape;
|
||||||
|
|
||||||
ArdourCanvas::Rectangle* name_button;
|
ArdourCanvas::Rectangle* name_button;
|
||||||
ArdourCanvas::Text* name_text;
|
ArdourCanvas::Text* name_text;
|
||||||
|
|
||||||
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 &);
|
void _size_allocate (ArdourCanvas::Rect const&);
|
||||||
bool event_handler (GdkEvent*);
|
bool event_handler (GdkEvent*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint64_t _cue_idx;
|
|
||||||
|
|
||||||
double poly_size;
|
|
||||||
double poly_margin;
|
|
||||||
|
|
||||||
void shape_play_button ();
|
void shape_play_button ();
|
||||||
|
|
||||||
void ui_parameter_changed (std::string const& p);
|
void ui_parameter_changed (std::string const& p);
|
||||||
void set_default_colors ();
|
void set_default_colors ();
|
||||||
};
|
|
||||||
|
|
||||||
|
uint64_t _cue_idx;
|
||||||
|
double _poly_size;
|
||||||
|
double _poly_margin;
|
||||||
|
};
|
||||||
|
|
||||||
class CueBoxUI : public ArdourCanvas::Rectangle
|
class CueBoxUI : public ArdourCanvas::Rectangle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CueBoxUI (ArdourCanvas::Item* parent);
|
CueBoxUI (ArdourCanvas::Item* parent);
|
||||||
~CueBoxUI ();
|
~CueBoxUI ();
|
||||||
|
|
||||||
void trigger_scene (uint64_t n);
|
void trigger_scene (uint64_t n);
|
||||||
|
|
||||||
static Glib::RefPtr<Gtk::ActionGroup> trigger_actions;
|
static Glib::RefPtr<Gtk::ActionGroup> trigger_actions;
|
||||||
static void setup_actions_and_bindings ();
|
static void setup_actions_and_bindings ();
|
||||||
|
|
||||||
void _size_allocate (ArdourCanvas::Rect const &);
|
void _size_allocate (ArdourCanvas::Rect const&);
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
|
private:
|
||||||
bool event (GdkEvent*, uint64_t);
|
bool event (GdkEvent*, uint64_t);
|
||||||
bool text_event (GdkEvent*, uint64_t);
|
bool text_event (GdkEvent*, uint64_t);
|
||||||
|
void build ();
|
||||||
typedef std::vector<ArdourCanvas::Rectangle*> Slots;
|
|
||||||
Slots _slots;
|
|
||||||
|
|
||||||
static Gtkmm2ext::Bindings* bindings;
|
static Gtkmm2ext::Bindings* bindings;
|
||||||
|
|
||||||
static void load_bindings ();
|
static void load_bindings ();
|
||||||
static void register_actions ();
|
static void register_actions ();
|
||||||
|
|
||||||
void build ();
|
typedef std::vector<ArdourCanvas::Rectangle*> Slots;
|
||||||
|
|
||||||
|
Slots _slots;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CueBoxWidget : public FittedCanvasWidget
|
class CueBoxWidget : public FittedCanvasWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CueBoxWidget (float w, float h);
|
CueBoxWidget (float w, float h);
|
||||||
|
|
||||||
void on_map ();
|
void on_map ();
|
||||||
void on_unmap ();
|
void on_unmap ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CueBoxUI* ui;
|
CueBoxUI* ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -122,11 +108,11 @@ class CueBoxWidget : public FittedCanvasWidget
|
||||||
|
|
||||||
class CueBoxWindow : public Gtk::Window
|
class CueBoxWindow : public Gtk::Window
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CueBoxWindow ();
|
CueBoxWindow ();
|
||||||
|
|
||||||
bool on_key_press_event (GdkEventKey*);
|
bool on_key_press_event (GdkEventKey*);
|
||||||
bool on_key_release_event (GdkEventKey*);
|
bool on_key_release_event (GdkEventKey*);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __cuebox_ui_h__ */
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -161,23 +161,23 @@ PassThru::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context) const
|
||||||
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 ();
|
||||||
}
|
}
|
||||||
|
|
||||||
context->set_identity_matrix();
|
context->set_identity_matrix ();
|
||||||
}
|
}
|
||||||
|
|
||||||
TriggerMaster::TriggerMaster (Item* parent)
|
TriggerMaster::TriggerMaster (Item* parent)
|
||||||
|
|
@ -259,22 +259,22 @@ TriggerMaster::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context)
|
||||||
|
|
||||||
render_children (area, context);
|
render_children (area, context);
|
||||||
|
|
||||||
//drop-shadow at top
|
|
||||||
if (true) {
|
if (true) {
|
||||||
Cairo::RefPtr<Cairo::LinearGradient> drop_shadow_pattern = Cairo::LinearGradient::create (0.0, 0.0, 0.0, 6*scale);
|
/* drop-shadow at top */
|
||||||
drop_shadow_pattern->add_color_stop_rgba (0, 0, 0, 0, 0.7);
|
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 (1, 0, 0, 0, 0.0);
|
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);
|
||||||
context->set_source (drop_shadow_pattern);
|
context->set_source (drop_shadow_pattern);
|
||||||
context->rectangle(0, 0, width, 6*scale );
|
context->rectangle (0, 0, width, 6 * scale);
|
||||||
context->fill ();
|
context->fill ();
|
||||||
} else {
|
} else {
|
||||||
//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 ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -306,23 +306,23 @@ TriggerMaster::event_handler (GdkEvent* ev)
|
||||||
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_outline_color (UIConfiguration::instance().color("neutral:foreground"));
|
stop_shape->set_outline_color (UIConfiguration::instance ().color ("neutral:foreground"));
|
||||||
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:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -460,7 +460,7 @@ TriggerMaster::_size_allocate (ArdourCanvas::Rect const& alloc)
|
||||||
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);
|
||||||
|
|
@ -486,8 +486,8 @@ TriggerMaster::prop_change (PropertyChange const& change)
|
||||||
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 ();
|
||||||
stop_shape->show();
|
stop_shape->show ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -501,21 +501,21 @@ TriggerMaster::prop_change (PropertyChange const& change)
|
||||||
|
|
||||||
if (trigger->active ()) {
|
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 ();
|
||||||
stop_shape->hide();
|
stop_shape->hide ();
|
||||||
} else {
|
} else {
|
||||||
_loopster->hide();
|
_loopster->hide ();
|
||||||
stop_shape->show();
|
stop_shape->show ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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"));
|
||||||
stop_shape->set_outline_color (UIConfiguration::instance().color("neutral:midground"));
|
stop_shape->set_outline_color (UIConfiguration::instance ().color ("neutral:midground"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -529,7 +529,7 @@ TriggerMaster::ui_parameter_changed (std::string const& p)
|
||||||
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");
|
||||||
|
|
||||||
|
|
@ -581,20 +581,20 @@ CueMaster::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context) cons
|
||||||
|
|
||||||
render_children (area, context);
|
render_children (area, context);
|
||||||
|
|
||||||
//drop-shadow at top
|
|
||||||
if (true) {
|
if (true) {
|
||||||
Cairo::RefPtr<Cairo::LinearGradient> drop_shadow_pattern = Cairo::LinearGradient::create (0.0, 0.0, 0.0, 6*scale);
|
/* drop-shadow at top */
|
||||||
drop_shadow_pattern->add_color_stop_rgba (0, 0, 0, 0, 0.7);
|
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 (1, 0, 0, 0, 0.0);
|
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);
|
||||||
context->set_source (drop_shadow_pattern);
|
context->set_source (drop_shadow_pattern);
|
||||||
context->rectangle(0, 0, width, 6*scale );
|
context->rectangle (0, 0, width, 6 * scale);
|
||||||
context->fill ();
|
context->fill ();
|
||||||
} else {
|
} else {
|
||||||
//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 ();
|
||||||
}
|
}
|
||||||
|
|
@ -606,20 +606,20 @@ 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_outline_color (UIConfiguration::instance().color("neutral:foreground"));
|
stop_shape->set_outline_color (UIConfiguration::instance ().color ("neutral:foreground"));
|
||||||
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:
|
||||||
|
|
@ -647,19 +647,19 @@ CueMaster::_size_allocate (ArdourCanvas::Rect const& alloc)
|
||||||
|
|
||||||
_poly_size = height - (_poly_margin * 2);
|
_poly_size = height - (_poly_margin * 2);
|
||||||
|
|
||||||
float centering_offset = (width/2)-_poly_margin-_poly_size/2;
|
float centering_offset = (width / 2) - _poly_margin - _poly_size / 2;
|
||||||
|
|
||||||
Points p;
|
Points p;
|
||||||
p.push_back (Duple (centering_offset+ _poly_margin, _poly_margin));
|
p.push_back (Duple (centering_offset + _poly_margin, _poly_margin));
|
||||||
p.push_back (Duple (centering_offset+ _poly_margin, _poly_size));
|
p.push_back (Duple (centering_offset + _poly_margin, _poly_size));
|
||||||
p.push_back (Duple (centering_offset+ _poly_size, _poly_size));
|
p.push_back (Duple (centering_offset + _poly_size, _poly_size));
|
||||||
p.push_back (Duple (centering_offset+ _poly_size, _poly_margin));
|
p.push_back (Duple (centering_offset + _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);
|
||||||
|
|
@ -671,9 +671,9 @@ CueMaster::_size_allocate (ArdourCanvas::Rect const& alloc)
|
||||||
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_outline_color (UIConfiguration::instance().color("neutral:midground"));
|
stop_shape->set_outline_color (UIConfiguration::instance ().color ("neutral:midground"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -16,79 +16,80 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __ardour_gtk_triggerbox_ui_h__
|
#ifndef _gtk_ardour_triggerbox_ui_h_
|
||||||
#define __ardour_gtk_triggerbox_ui_h__
|
#define _gtk_ardour_triggerbox_ui_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 "fitted_canvas_widget.h"
|
#include "fitted_canvas_widget.h"
|
||||||
|
|
||||||
namespace Gtk {
|
namespace Gtk
|
||||||
class FileChooserDialog;
|
{
|
||||||
class Menu;
|
class FileChooserDialog;
|
||||||
|
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 TriggerEntry : public ArdourCanvas::Rectangle
|
class TriggerEntry : public ArdourCanvas::Rectangle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TriggerEntry (ArdourCanvas::Item* item, ARDOUR::Trigger&);
|
TriggerEntry (ArdourCanvas::Item* item, ARDOUR::Trigger&);
|
||||||
~TriggerEntry ();
|
~TriggerEntry ();
|
||||||
|
|
||||||
ARDOUR::Trigger& trigger() const { return _trigger; }
|
ARDOUR::Trigger& trigger () const
|
||||||
|
{
|
||||||
|
return _trigger;
|
||||||
|
}
|
||||||
|
|
||||||
ArdourCanvas::Rectangle* play_button;
|
ArdourCanvas::Rectangle* play_button;
|
||||||
ArdourCanvas::Polygon* play_shape;
|
ArdourCanvas::Polygon* play_shape;
|
||||||
|
|
||||||
ArdourCanvas::Rectangle* name_button;
|
ArdourCanvas::Rectangle* name_button;
|
||||||
ArdourCanvas::Text* name_text;
|
ArdourCanvas::Text* name_text;
|
||||||
|
|
||||||
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 &);
|
void _size_allocate (ArdourCanvas::Rect const&);
|
||||||
void maybe_update ();
|
void maybe_update ();
|
||||||
|
|
||||||
void selection_change ();
|
void selection_change ();
|
||||||
|
|
||||||
void set_default_colors();
|
void set_default_colors ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ARDOUR::Trigger& _trigger;
|
ARDOUR::Trigger& _trigger;
|
||||||
double poly_size;
|
double _poly_size;
|
||||||
double poly_margin;
|
double _poly_margin;
|
||||||
|
|
||||||
PBD::ScopedConnection trigger_prop_connection;
|
PBD::ScopedConnection trigger_prop_connection;
|
||||||
void prop_change (PBD::PropertyChange const & change);
|
void prop_change (PBD::PropertyChange const& change);
|
||||||
void shape_play_button ();
|
void shape_play_button ();
|
||||||
|
|
||||||
PBD::ScopedConnection owner_prop_connection;
|
PBD::ScopedConnection owner_prop_connection;
|
||||||
void owner_prop_change (PBD::PropertyChange const &);
|
void owner_prop_change (PBD::PropertyChange const&);
|
||||||
void owner_color_changed ();
|
void owner_color_changed ();
|
||||||
|
|
||||||
void ui_parameter_changed (std::string const& p);
|
void ui_parameter_changed (std::string const& p);
|
||||||
};
|
};
|
||||||
|
|
||||||
class TriggerBoxUI : public ArdourCanvas::Rectangle
|
class TriggerBoxUI : public ArdourCanvas::Rectangle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TriggerBoxUI (ArdourCanvas::Item* parent, ARDOUR::TriggerBox&);
|
TriggerBoxUI (ArdourCanvas::Item* parent, ARDOUR::TriggerBox&);
|
||||||
~TriggerBoxUI ();
|
~TriggerBoxUI ();
|
||||||
|
|
||||||
|
|
@ -97,23 +98,24 @@ class TriggerBoxUI : public ArdourCanvas::Rectangle
|
||||||
void stop_updating ();
|
void stop_updating ();
|
||||||
|
|
||||||
static Glib::RefPtr<Gtk::ActionGroup> trigger_actions;
|
static Glib::RefPtr<Gtk::ActionGroup> trigger_actions;
|
||||||
static void setup_actions_and_bindings ();
|
static void setup_actions_and_bindings ();
|
||||||
|
|
||||||
static void trigger_scene (int32_t);
|
static void trigger_scene (int32_t);
|
||||||
|
|
||||||
void _size_allocate (ArdourCanvas::Rect const &);
|
void _size_allocate (ArdourCanvas::Rect const&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ARDOUR::TriggerBox& _triggerbox;
|
|
||||||
typedef std::vector<TriggerEntry*> Slots;
|
typedef std::vector<TriggerEntry*> Slots;
|
||||||
Slots _slots;
|
|
||||||
Gtk::FileChooserDialog* file_chooser;
|
ARDOUR::TriggerBox& _triggerbox;
|
||||||
sigc::connection file_chooser_connection;
|
Slots _slots;
|
||||||
Gtk::Menu* _context_menu;
|
Gtk::FileChooserDialog* _file_chooser;
|
||||||
|
sigc::connection _file_chooser_connection;
|
||||||
|
Gtk::Menu* _context_menu;
|
||||||
|
|
||||||
static Gtkmm2ext::Bindings* bindings;
|
static Gtkmm2ext::Bindings* bindings;
|
||||||
static void load_bindings ();
|
static void load_bindings ();
|
||||||
static void register_actions ();
|
static void register_actions ();
|
||||||
|
|
||||||
bool play_button_event (GdkEvent*, uint64_t);
|
bool play_button_event (GdkEvent*, uint64_t);
|
||||||
bool text_button_event (GdkEvent*, uint64_t);
|
bool text_button_event (GdkEvent*, uint64_t);
|
||||||
|
|
@ -123,7 +125,7 @@ private:
|
||||||
void context_menu (uint64_t n);
|
void context_menu (uint64_t n);
|
||||||
void set_follow_action (uint64_t slot, ARDOUR::Trigger::FollowAction);
|
void set_follow_action (uint64_t slot, ARDOUR::Trigger::FollowAction);
|
||||||
void set_launch_style (uint64_t slot, ARDOUR::Trigger::LaunchStyle);
|
void set_launch_style (uint64_t slot, ARDOUR::Trigger::LaunchStyle);
|
||||||
void set_quantization (uint64_t slot, Temporal::BBT_Offset const &);
|
void set_quantization (uint64_t slot, Temporal::BBT_Offset const&);
|
||||||
void set_from_selection (uint64_t slot);
|
void set_from_selection (uint64_t slot);
|
||||||
|
|
||||||
void build ();
|
void build ();
|
||||||
|
|
@ -131,19 +133,19 @@ private:
|
||||||
|
|
||||||
void selection_changed ();
|
void selection_changed ();
|
||||||
|
|
||||||
bool drag_motion (Glib::RefPtr<Gdk::DragContext>const&, int, int, guint);
|
bool drag_motion (Glib::RefPtr<Gdk::DragContext> const&, int, int, guint);
|
||||||
void drag_leave (Glib::RefPtr<Gdk::DragContext>const&, guint);
|
void drag_leave (Glib::RefPtr<Gdk::DragContext> const&, guint);
|
||||||
void drag_data_received (Glib::RefPtr<Gdk::DragContext> const&, int, int, Gtk::SelectionData const&, guint, guint);
|
void drag_data_received (Glib::RefPtr<Gdk::DragContext> const&, int, int, Gtk::SelectionData const&, guint, guint);
|
||||||
|
|
||||||
uint64_t slot_at_y (int) const;
|
uint64_t slot_at_y (int) const;
|
||||||
|
|
||||||
sigc::connection update_connection;
|
sigc::connection _update_connection;
|
||||||
sigc::connection selection_connection;
|
sigc::connection _selection_connection;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TriggerBoxWidget : public FittedCanvasWidget
|
class TriggerBoxWidget : public FittedCanvasWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TriggerBoxWidget (float w, float h);
|
TriggerBoxWidget (float w, float h);
|
||||||
|
|
||||||
void set_triggerbox (ARDOUR::TriggerBox* tb);
|
void set_triggerbox (ARDOUR::TriggerBox* tb);
|
||||||
|
|
@ -151,8 +153,8 @@ class TriggerBoxWidget : public FittedCanvasWidget
|
||||||
void on_map ();
|
void on_map ();
|
||||||
void on_unmap ();
|
void on_unmap ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TriggerBoxUI* ui;
|
TriggerBoxUI* ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __ardour_gtk_triggerbox_ui_h__ */
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue