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 "ardour_ui.h"
|
||||
#include "gui_thread.h"
|
||||
#include "cuebox_ui.h"
|
||||
#include "gui_thread.h"
|
||||
#include "public_editor.h"
|
||||
#include "region_view.h"
|
||||
#include "selection.h"
|
||||
|
|
@ -127,18 +127,18 @@ CueEntry::_size_allocate (ArdourCanvas::Rect const & alloc)
|
|||
name_button->set (ArdourCanvas::Rect (height, 0, width, height));
|
||||
|
||||
const double scale = UIConfiguration::instance ().get_ui_scale ();
|
||||
poly_margin = 2. * scale;
|
||||
poly_size = height - 2*poly_margin;
|
||||
_poly_margin = 2. * scale;
|
||||
_poly_size = height - 2 * _poly_margin;
|
||||
shape_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->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);
|
||||
|
||||
//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 ());
|
||||
}
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ CueEntry::render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context>
|
|||
ArdourCanvas::Rectangle::render (area, context);
|
||||
|
||||
/* 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));
|
||||
const ArdourCanvas::Rect draw = self.intersection (area);
|
||||
|
|
@ -178,7 +178,7 @@ CueEntry::render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context>
|
|||
context->rectangle (0, 0, width, 6 * scale);
|
||||
context->fill ();
|
||||
} else if (_cue_idx % 2 == 0) {
|
||||
//line at top
|
||||
/* 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));
|
||||
|
|
@ -193,13 +193,13 @@ CueEntry::shape_play_button ()
|
|||
{
|
||||
Points p;
|
||||
|
||||
p.push_back (Duple (poly_margin, poly_margin));
|
||||
p.push_back (Duple (poly_margin, poly_size));
|
||||
p.push_back (Duple (poly_size, 0.5+poly_size / 2.));
|
||||
p.push_back (Duple (_poly_margin, _poly_margin));
|
||||
p.push_back (Duple (_poly_margin, _poly_size));
|
||||
p.push_back (Duple (_poly_size, 0.5 + _poly_size / 2.));
|
||||
|
||||
play_shape->set (p);
|
||||
|
||||
if (false /*ToDo*/) {
|
||||
if (false /*TODO*/) {
|
||||
play_shape->set_outline (false);
|
||||
play_shape->set_fill (true);
|
||||
} else {
|
||||
|
|
@ -217,6 +217,7 @@ CueEntry::set_default_colors ()
|
|||
name_button->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"));
|
||||
|
||||
if ((_cue_idx / 2) % 2 == 0) {
|
||||
set_fill_color (HSV (fill_color ()).darker (0.15).color ());
|
||||
play_button->set_fill_color (HSV (fill_color ()).darker (0.15).color ());
|
||||
|
|
@ -240,10 +241,6 @@ CueEntry::ui_parameter_changed (std::string const& p)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ---------------------------- */
|
||||
|
||||
Gtkmm2ext::Bindings* CueBoxUI::bindings = 0;
|
||||
Glib::RefPtr<Gtk::ActionGroup> CueBoxUI::trigger_actions;
|
||||
|
||||
|
|
@ -303,13 +300,15 @@ CueBoxUI::build ()
|
|||
|
||||
_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);
|
||||
|
||||
_slots.push_back (te);
|
||||
|
||||
// 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));
|
||||
#if 0
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
@ -322,7 +321,7 @@ CueBoxUI::_size_allocate (ArdourCanvas::Rect const & alloc)
|
|||
const float width = alloc.width ();
|
||||
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;
|
||||
for (auto& slot : _slots) {
|
||||
|
|
@ -331,7 +330,6 @@ CueBoxUI::_size_allocate (ArdourCanvas::Rect const & alloc)
|
|||
ypos += slot_h;
|
||||
slot->show ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -358,10 +356,8 @@ CueBoxUI::event (GdkEvent* ev, uint64_t n)
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* ------------ */
|
||||
|
||||
CueBoxWidget::CueBoxWidget (float w, float h) : FittedCanvasWidget(w,h)
|
||||
CueBoxWidget::CueBoxWidget (float w, float h)
|
||||
: FittedCanvasWidget (w, h)
|
||||
{
|
||||
ui = new CueBoxUI (root ());
|
||||
set_background_color (UIConfiguration::instance ().color (X_("theme:bg")));
|
||||
|
|
@ -379,9 +375,6 @@ CueBoxWidget::on_unmap ()
|
|||
FittedCanvasWidget::on_unmap ();
|
||||
}
|
||||
|
||||
|
||||
/* ------------ */
|
||||
|
||||
CueBoxWindow::CueBoxWindow ()
|
||||
{
|
||||
CueBoxWidget* tbw = manage (new CueBoxWidget (-1., TriggerBox::default_triggers_per_box * 16.));
|
||||
|
|
|
|||
|
|
@ -17,10 +17,8 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __cuebox_ui_h__
|
||||
#define __cuebox_ui_h__
|
||||
|
||||
#include <map>
|
||||
#ifndef _gtk_ardour_cuebox_ui_h_
|
||||
#define _gtk_ardour_cuebox_ui_h_
|
||||
|
||||
#include <gtkmm/window.h>
|
||||
|
||||
|
|
@ -28,25 +26,16 @@
|
|||
|
||||
#include "ardour/triggerbox.h"
|
||||
|
||||
#include "canvas/table.h"
|
||||
#include "canvas/canvas.h"
|
||||
#include "canvas/rectangle.h"
|
||||
|
||||
#include "fitted_canvas_widget.h"
|
||||
|
||||
namespace Gtk {
|
||||
class FileChooserDialog;
|
||||
class Menu;
|
||||
}
|
||||
|
||||
namespace Temporal {
|
||||
struct BBT_Offset;
|
||||
}
|
||||
|
||||
namespace ArdourCanvas {
|
||||
namespace ArdourCanvas
|
||||
{
|
||||
class Text;
|
||||
class Polygon;
|
||||
};
|
||||
}
|
||||
|
||||
class CueEntry : public ArdourCanvas::Rectangle
|
||||
{
|
||||
|
|
@ -66,17 +55,14 @@ class CueEntry : public ArdourCanvas::Rectangle
|
|||
bool event_handler (GdkEvent*);
|
||||
|
||||
private:
|
||||
uint64_t _cue_idx;
|
||||
|
||||
double poly_size;
|
||||
double poly_margin;
|
||||
|
||||
void shape_play_button ();
|
||||
|
||||
void ui_parameter_changed (std::string const& p);
|
||||
void set_default_colors ();
|
||||
};
|
||||
|
||||
uint64_t _cue_idx;
|
||||
double _poly_size;
|
||||
double _poly_margin;
|
||||
};
|
||||
|
||||
class CueBoxUI : public ArdourCanvas::Rectangle
|
||||
{
|
||||
|
|
@ -92,18 +78,18 @@ class CueBoxUI : public ArdourCanvas::Rectangle
|
|||
void _size_allocate (ArdourCanvas::Rect const&);
|
||||
|
||||
private:
|
||||
|
||||
bool event (GdkEvent*, uint64_t);
|
||||
bool text_event (GdkEvent*, uint64_t);
|
||||
|
||||
typedef std::vector<ArdourCanvas::Rectangle*> Slots;
|
||||
Slots _slots;
|
||||
void build ();
|
||||
|
||||
static Gtkmm2ext::Bindings* bindings;
|
||||
|
||||
static void load_bindings ();
|
||||
static void register_actions ();
|
||||
|
||||
void build ();
|
||||
typedef std::vector<ArdourCanvas::Rectangle*> Slots;
|
||||
|
||||
Slots _slots;
|
||||
};
|
||||
|
||||
class CueBoxWidget : public FittedCanvasWidget
|
||||
|
|
@ -129,4 +115,4 @@ class CueBoxWindow : public Gtk::Window
|
|||
bool on_key_release_event (GdkEventKey*);
|
||||
};
|
||||
|
||||
#endif /* __cuebox_ui_h__ */
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -161,17 +161,17 @@ PassThru::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context) const
|
|||
const double scale = UIConfiguration::instance ().get_ui_scale ();
|
||||
|
||||
if (_enabled) {
|
||||
//outer white circle
|
||||
/* outer white circle */
|
||||
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->fill ();
|
||||
|
||||
//black circle
|
||||
/* black circle */
|
||||
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->fill ();
|
||||
|
||||
//inner white circle
|
||||
/* inner white circle */
|
||||
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->fill ();
|
||||
|
|
@ -259,8 +259,8 @@ TriggerMaster::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context)
|
|||
|
||||
render_children (area, context);
|
||||
|
||||
//drop-shadow at top
|
||||
if (true) {
|
||||
/* drop-shadow at top */
|
||||
Cairo::RefPtr<Cairo::LinearGradient> drop_shadow_pattern = Cairo::LinearGradient::create (0.0, 0.0, 0.0, 6 * scale);
|
||||
drop_shadow_pattern->add_color_stop_rgba (0, 0, 0, 0, 0.7);
|
||||
drop_shadow_pattern->add_color_stop_rgba (1, 0, 0, 0, 0.0);
|
||||
|
|
@ -268,7 +268,7 @@ TriggerMaster::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context)
|
|||
context->rectangle (0, 0, width, 6 * scale);
|
||||
context->fill ();
|
||||
} else {
|
||||
//line at top
|
||||
/* 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));
|
||||
|
|
@ -581,8 +581,8 @@ CueMaster::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context) cons
|
|||
|
||||
render_children (area, context);
|
||||
|
||||
//drop-shadow at top
|
||||
if (true) {
|
||||
/* drop-shadow at top */
|
||||
Cairo::RefPtr<Cairo::LinearGradient> drop_shadow_pattern = Cairo::LinearGradient::create (0.0, 0.0, 0.0, 6 * scale);
|
||||
drop_shadow_pattern->add_color_stop_rgba (0, 0, 0, 0, 0.7);
|
||||
drop_shadow_pattern->add_color_stop_rgba (1, 0, 0, 0, 0.0);
|
||||
|
|
@ -590,7 +590,7 @@ CueMaster::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context) cons
|
|||
context->rectangle (0, 0, width, 6 * scale);
|
||||
context->fill ();
|
||||
} else {
|
||||
//line at top
|
||||
/* 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));
|
||||
|
|
|
|||
|
|
@ -38,12 +38,12 @@
|
|||
|
||||
#include "ardour_ui.h"
|
||||
#include "gui_thread.h"
|
||||
#include "triggerbox_ui.h"
|
||||
#include "trigger_ui.h"
|
||||
#include "public_editor.h"
|
||||
#include "region_view.h"
|
||||
#include "selection.h"
|
||||
#include "timers.h"
|
||||
#include "trigger_ui.h"
|
||||
#include "triggerbox_ui.h"
|
||||
#include "ui_config.h"
|
||||
#include "utils.h"
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ TriggerEntry::owner_prop_change (PropertyChange const & pc)
|
|||
void
|
||||
TriggerEntry::owner_color_changed ()
|
||||
{
|
||||
//ToDo
|
||||
// TODO
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -145,22 +145,23 @@ TriggerEntry::_size_allocate (ArdourCanvas::Rect const & alloc)
|
|||
name_button->set (ArdourCanvas::Rect (height, 0, width, height));
|
||||
|
||||
const double scale = UIConfiguration::instance ().get_ui_scale ();
|
||||
poly_margin = 2. * scale;
|
||||
poly_size = height - 2*poly_margin;
|
||||
_poly_margin = 2. * scale;
|
||||
_poly_size = height - 2 * _poly_margin;
|
||||
shape_play_button ();
|
||||
|
||||
float tleft = height; // make room for the play button
|
||||
|
||||
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 - 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 ());
|
||||
}
|
||||
|
||||
void draw_follow_icon( Cairo::RefPtr<Cairo::Context> context, Trigger::FollowAction icon, float size, float scale ) {
|
||||
|
||||
void
|
||||
draw_follow_icon (Cairo::RefPtr<Cairo::Context> context, Trigger::FollowAction icon, float size, float scale)
|
||||
{
|
||||
context->set_line_width (1 * scale);
|
||||
|
||||
switch (icon) {
|
||||
|
|
@ -192,7 +193,8 @@ void draw_follow_icon( Cairo::RefPtr<Cairo::Context> context, Trigger::FollowAct
|
|||
Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create (context);
|
||||
layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
|
||||
layout->set_text (icon == Trigger::AnyTrigger ? "&" : "@");
|
||||
int tw, th; layout->get_pixel_size (tw, th);
|
||||
int tw, th;
|
||||
layout->get_pixel_size (tw, th);
|
||||
context->move_to (size / 2, size / 2);
|
||||
context->rel_move_to (-tw / 2, -th / 2);
|
||||
layout->show_in_cairo_context (context);
|
||||
|
|
@ -255,7 +257,7 @@ TriggerEntry::render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Cont
|
|||
render_children (area, context);
|
||||
|
||||
if (_trigger.index () == 1) {
|
||||
//drop-shadow at top
|
||||
/* drop-shadow at top */
|
||||
Cairo::RefPtr<Cairo::LinearGradient> drop_shadow_pattern = Cairo::LinearGradient::create (0.0, 0.0, 0.0, 6 * scale);
|
||||
drop_shadow_pattern->add_color_stop_rgba (0, 0, 0, 0, 0.7);
|
||||
drop_shadow_pattern->add_color_stop_rgba (1, 0, 0, 0, 0.0);
|
||||
|
|
@ -263,7 +265,7 @@ TriggerEntry::render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Cont
|
|||
context->rectangle (0, 0, width, 6 * scale);
|
||||
context->fill ();
|
||||
} else if (_trigger.index () % 2 == 0) {
|
||||
//line at top
|
||||
/* 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));
|
||||
|
|
@ -272,7 +274,7 @@ TriggerEntry::render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Cont
|
|||
context->set_identity_matrix ();
|
||||
}
|
||||
|
||||
//follow-action icon
|
||||
/* follow-action icon */
|
||||
if (_trigger.region ()) {
|
||||
context->set_identity_matrix ();
|
||||
context->translate (self.x0, self.y0 - 0.5);
|
||||
|
|
@ -281,7 +283,6 @@ TriggerEntry::render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Cont
|
|||
draw_follow_icon (context, _trigger.follow_action (0), height, scale);
|
||||
context->set_identity_matrix ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -291,15 +292,15 @@ TriggerEntry::shape_play_button ()
|
|||
|
||||
if (!_trigger.region ()) {
|
||||
/* no region, so must be a stop button, drawn as a square */
|
||||
p.push_back (Duple (poly_margin, poly_margin));
|
||||
p.push_back (Duple (poly_margin, poly_size));
|
||||
p.push_back (Duple (poly_size, poly_size));
|
||||
p.push_back (Duple (poly_size, poly_margin));
|
||||
p.push_back (Duple (_poly_margin, _poly_margin));
|
||||
p.push_back (Duple (_poly_margin, _poly_size));
|
||||
p.push_back (Duple (_poly_size, _poly_size));
|
||||
p.push_back (Duple (_poly_size, _poly_margin));
|
||||
} else {
|
||||
/* region exists; draw triangle to show that we can trigger */
|
||||
p.push_back (Duple (poly_margin, poly_margin));
|
||||
p.push_back (Duple (poly_margin, poly_size));
|
||||
p.push_back (Duple (poly_size, 0.5+poly_size / 2.));
|
||||
p.push_back (Duple (_poly_margin, _poly_margin));
|
||||
p.push_back (Duple (_poly_margin, _poly_size));
|
||||
p.push_back (Duple (_poly_size, 0.5 + _poly_size / 2.));
|
||||
}
|
||||
|
||||
play_shape->set (p);
|
||||
|
|
@ -388,7 +389,7 @@ Glib::RefPtr<Gtk::ActionGroup> TriggerBoxUI::trigger_actions;
|
|||
TriggerBoxUI::TriggerBoxUI (ArdourCanvas::Item* parent, TriggerBox& tb)
|
||||
: Rectangle (parent)
|
||||
, _triggerbox (tb)
|
||||
, file_chooser (0)
|
||||
, _file_chooser (0)
|
||||
, _context_menu (0)
|
||||
{
|
||||
set_layout_sensitive (true); // why???
|
||||
|
|
@ -398,7 +399,7 @@ TriggerBoxUI::TriggerBoxUI (ArdourCanvas::Item* parent, TriggerBox& tb)
|
|||
|
||||
build ();
|
||||
|
||||
selection_connection = PublicEditor::instance().get_selection().TriggersChanged.connect (sigc::mem_fun (*this, &TriggerBoxUI::selection_changed));
|
||||
_selection_connection = PublicEditor::instance ().get_selection ().TriggersChanged.connect (sigc::mem_fun (*this, &TriggerBoxUI::selection_changed));
|
||||
|
||||
std::vector<Gtk::TargetEntry> target_table;
|
||||
target_table.push_back (Gtk::TargetEntry ("regions"));
|
||||
|
|
@ -416,8 +417,6 @@ TriggerBoxUI::TriggerBoxUI (ArdourCanvas::Item* parent, TriggerBox& tb)
|
|||
|
||||
TriggerBoxUI::~TriggerBoxUI ()
|
||||
{
|
||||
update_connection.disconnect ();
|
||||
selection_connection.disconnect ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -481,7 +480,9 @@ TriggerBoxUI::build ()
|
|||
|
||||
te->play_button->Event.connect (sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::play_button_event), n));
|
||||
te->name_button->Event.connect (sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::text_button_event), n));
|
||||
// te->Event.connect (sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::event), n));
|
||||
#if 0
|
||||
te->Event.connect (sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::event), n));
|
||||
#endif
|
||||
|
||||
++n;
|
||||
}
|
||||
|
|
@ -495,7 +496,7 @@ TriggerBoxUI::_size_allocate (ArdourCanvas::Rect const & alloc)
|
|||
const float width = alloc.width ();
|
||||
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;
|
||||
for (auto& slot : _slots) {
|
||||
|
|
@ -504,7 +505,6 @@ TriggerBoxUI::_size_allocate (ArdourCanvas::Rect const & alloc)
|
|||
ypos += slot_h;
|
||||
slot->show ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -525,7 +525,7 @@ TriggerBoxUI::text_button_event (GdkEvent* ev, uint64_t n)
|
|||
case GDK_BUTTON_PRESS:
|
||||
if (_slots[n]->trigger ().region ()) {
|
||||
PublicEditor::instance ().get_selection ().set (_slots[n]);
|
||||
//a side-effect of selection-change is that the slot's color is reset. retain the "entered-color" here:
|
||||
/* a side-effect of selection-change is that the slot's color is reset. retain the "entered-color" here: */
|
||||
_slots[n]->name_text->set_color (UIConfiguration::instance ().color ("neutral:foregroundest"));
|
||||
_slots[n]->name_button->set_fill_color (HSV (fill_color ()).lighter (0.15).color ());
|
||||
}
|
||||
|
|
@ -792,23 +792,23 @@ TriggerBoxUI::set_quantization (uint64_t n, Temporal::BBT_Offset const & q)
|
|||
void
|
||||
TriggerBoxUI::choose_sample (uint64_t n)
|
||||
{
|
||||
if (!file_chooser) {
|
||||
file_chooser = new Gtk::FileChooserDialog (_("Select sample"), Gtk::FILE_CHOOSER_ACTION_OPEN);
|
||||
file_chooser->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||
file_chooser->add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
|
||||
file_chooser->set_select_multiple (true);
|
||||
if (!_file_chooser) {
|
||||
_file_chooser = new Gtk::FileChooserDialog (_("Select sample"), Gtk::FILE_CHOOSER_ACTION_OPEN);
|
||||
_file_chooser->add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||
_file_chooser->add_button (Gtk::Stock::OK, Gtk::RESPONSE_OK);
|
||||
_file_chooser->set_select_multiple (true);
|
||||
}
|
||||
|
||||
file_chooser_connection.disconnect ();
|
||||
file_chooser_connection = file_chooser->signal_response().connect (sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::sample_chosen), n));
|
||||
_file_chooser_connection.disconnect ();
|
||||
_file_chooser_connection = _file_chooser->signal_response ().connect (sigc::bind (sigc::mem_fun (*this, &TriggerBoxUI::sample_chosen), n));
|
||||
|
||||
file_chooser->present ();
|
||||
_file_chooser->present ();
|
||||
}
|
||||
|
||||
void
|
||||
TriggerBoxUI::sample_chosen (int response, uint64_t n)
|
||||
{
|
||||
file_chooser->hide ();
|
||||
_file_chooser->hide ();
|
||||
|
||||
switch (response) {
|
||||
case Gtk::RESPONSE_OK:
|
||||
|
|
@ -817,7 +817,7 @@ TriggerBoxUI::sample_chosen (int response, uint64_t n)
|
|||
return;
|
||||
}
|
||||
|
||||
std::list<std::string> paths = file_chooser->get_filenames ();
|
||||
std::list<std::string> paths = _file_chooser->get_filenames ();
|
||||
|
||||
for (std::list<std::string>::iterator s = paths.begin (); s != paths.end (); ++s) {
|
||||
/* this will do nothing if n is too large */
|
||||
|
|
@ -926,13 +926,13 @@ TriggerBoxUI::set_from_selection (uint64_t n)
|
|||
void
|
||||
TriggerBoxUI::start_updating ()
|
||||
{
|
||||
update_connection = Timers::rapid_connect (sigc::mem_fun (*this, &TriggerBoxUI::rapid_update));
|
||||
_update_connection = Timers::rapid_connect (sigc::mem_fun (*this, &TriggerBoxUI::rapid_update));
|
||||
}
|
||||
|
||||
void
|
||||
TriggerBoxUI::stop_updating ()
|
||||
{
|
||||
update_connection.disconnect ();
|
||||
_update_connection.disconnect ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -943,7 +943,9 @@ TriggerBoxUI::rapid_update ()
|
|||
}
|
||||
}
|
||||
|
||||
TriggerBoxWidget::TriggerBoxWidget (float w, float h) : FittedCanvasWidget(w,h), ui (0)
|
||||
TriggerBoxWidget::TriggerBoxWidget (float w, float h)
|
||||
: FittedCanvasWidget (w, h)
|
||||
, ui (0)
|
||||
{
|
||||
set_background_color (UIConfiguration::instance ().color (X_("theme:bg")));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,36 +16,34 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __ardour_gtk_triggerbox_ui_h__
|
||||
#define __ardour_gtk_triggerbox_ui_h__
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <gtkmm/window.h>
|
||||
#ifndef _gtk_ardour_triggerbox_ui_h_
|
||||
#define _gtk_ardour_triggerbox_ui_h_
|
||||
|
||||
#include "pbd/properties.h"
|
||||
|
||||
#include "ardour/triggerbox.h"
|
||||
|
||||
#include "canvas/table.h"
|
||||
#include "canvas/canvas.h"
|
||||
#include "canvas/rectangle.h"
|
||||
|
||||
#include "fitted_canvas_widget.h"
|
||||
|
||||
namespace Gtk {
|
||||
namespace Gtk
|
||||
{
|
||||
class FileChooserDialog;
|
||||
class Menu;
|
||||
}
|
||||
|
||||
namespace Temporal {
|
||||
namespace Temporal
|
||||
{
|
||||
struct BBT_Offset;
|
||||
}
|
||||
|
||||
namespace ArdourCanvas {
|
||||
namespace ArdourCanvas
|
||||
{
|
||||
class Text;
|
||||
class Polygon;
|
||||
};
|
||||
}
|
||||
|
||||
class TriggerEntry : public ArdourCanvas::Rectangle
|
||||
{
|
||||
|
|
@ -53,7 +51,10 @@ class TriggerEntry : public ArdourCanvas::Rectangle
|
|||
TriggerEntry (ArdourCanvas::Item* item, ARDOUR::Trigger&);
|
||||
~TriggerEntry ();
|
||||
|
||||
ARDOUR::Trigger& trigger() const { return _trigger; }
|
||||
ARDOUR::Trigger& trigger () const
|
||||
{
|
||||
return _trigger;
|
||||
}
|
||||
|
||||
ArdourCanvas::Rectangle* play_button;
|
||||
ArdourCanvas::Polygon* play_shape;
|
||||
|
|
@ -72,8 +73,8 @@ class TriggerEntry : public ArdourCanvas::Rectangle
|
|||
|
||||
private:
|
||||
ARDOUR::Trigger& _trigger;
|
||||
double poly_size;
|
||||
double poly_margin;
|
||||
double _poly_size;
|
||||
double _poly_margin;
|
||||
|
||||
PBD::ScopedConnection trigger_prop_connection;
|
||||
void prop_change (PBD::PropertyChange const& change);
|
||||
|
|
@ -104,11 +105,12 @@ class TriggerBoxUI : public ArdourCanvas::Rectangle
|
|||
void _size_allocate (ArdourCanvas::Rect const&);
|
||||
|
||||
private:
|
||||
ARDOUR::TriggerBox& _triggerbox;
|
||||
typedef std::vector<TriggerEntry*> Slots;
|
||||
|
||||
ARDOUR::TriggerBox& _triggerbox;
|
||||
Slots _slots;
|
||||
Gtk::FileChooserDialog* file_chooser;
|
||||
sigc::connection file_chooser_connection;
|
||||
Gtk::FileChooserDialog* _file_chooser;
|
||||
sigc::connection _file_chooser_connection;
|
||||
Gtk::Menu* _context_menu;
|
||||
|
||||
static Gtkmm2ext::Bindings* bindings;
|
||||
|
|
@ -137,8 +139,8 @@ private:
|
|||
|
||||
uint64_t slot_at_y (int) const;
|
||||
|
||||
sigc::connection update_connection;
|
||||
sigc::connection selection_connection;
|
||||
sigc::connection _update_connection;
|
||||
sigc::connection _selection_connection;
|
||||
};
|
||||
|
||||
class TriggerBoxWidget : public FittedCanvasWidget
|
||||
|
|
@ -155,4 +157,4 @@ class TriggerBoxWidget : public FittedCanvasWidget
|
|||
TriggerBoxUI* ui;
|
||||
};
|
||||
|
||||
#endif /* __ardour_gtk_triggerbox_ui_h__ */
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue