2021-12-07 16:47:00 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2021 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Author: Ben Loftis 2021 <ben@harrisonconsoles.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2021-12-17 10:32:52 -05:00
|
|
|
#ifndef _gtk_ardour_cuebox_ui_h_
|
|
|
|
#define _gtk_ardour_cuebox_ui_h_
|
2021-12-07 16:47:00 -05:00
|
|
|
|
|
|
|
#include <gtkmm/window.h>
|
2021-12-27 18:35:24 -05:00
|
|
|
#include <gtkmm/colorselection.h>
|
2021-12-07 16:47:00 -05:00
|
|
|
|
|
|
|
#include "pbd/properties.h"
|
|
|
|
|
|
|
|
#include "ardour/triggerbox.h"
|
|
|
|
|
|
|
|
#include "canvas/canvas.h"
|
|
|
|
#include "canvas/rectangle.h"
|
|
|
|
|
|
|
|
#include "fitted_canvas_widget.h"
|
|
|
|
|
2021-12-23 23:14:48 -05:00
|
|
|
typedef std::list<ARDOUR::TriggerPtr > TriggerList;
|
|
|
|
|
2021-12-17 10:32:52 -05:00
|
|
|
namespace ArdourCanvas
|
|
|
|
{
|
2021-12-07 16:47:00 -05:00
|
|
|
class Text;
|
|
|
|
class Polygon;
|
2022-01-18 16:52:54 -05:00
|
|
|
class Circle;
|
2021-12-17 10:32:52 -05:00
|
|
|
}
|
2021-12-07 16:47:00 -05:00
|
|
|
|
|
|
|
class CueEntry : public ArdourCanvas::Rectangle
|
|
|
|
{
|
2021-12-17 10:32:52 -05:00
|
|
|
public:
|
|
|
|
CueEntry (ArdourCanvas::Item* item, uint64_t cue_index);
|
2021-12-07 16:47:00 -05:00
|
|
|
~CueEntry ();
|
|
|
|
|
2022-01-18 16:52:54 -05:00
|
|
|
ArdourCanvas::Circle* name_button;
|
2021-12-17 10:32:52 -05:00
|
|
|
ArdourCanvas::Text* name_text;
|
2021-12-07 16:47:00 -05:00
|
|
|
|
2021-12-17 10:32:52 -05:00
|
|
|
void render (ArdourCanvas::Rect const& area, Cairo::RefPtr<Cairo::Context> context) const;
|
2021-12-07 16:47:00 -05:00
|
|
|
|
2021-12-17 10:32:52 -05:00
|
|
|
void _size_allocate (ArdourCanvas::Rect const&);
|
2021-12-07 16:47:00 -05:00
|
|
|
bool event_handler (GdkEvent*);
|
|
|
|
|
2021-12-17 10:32:52 -05:00
|
|
|
private:
|
2021-12-07 16:47:00 -05:00
|
|
|
void shape_play_button ();
|
|
|
|
void ui_parameter_changed (std::string const& p);
|
2021-12-07 16:47:42 -05:00
|
|
|
void set_default_colors ();
|
2021-12-07 16:47:00 -05:00
|
|
|
|
2021-12-17 10:32:52 -05:00
|
|
|
uint64_t _cue_idx;
|
|
|
|
double _poly_size;
|
|
|
|
double _poly_margin;
|
|
|
|
};
|
2021-12-07 16:47:00 -05:00
|
|
|
|
2021-12-23 23:14:48 -05:00
|
|
|
class CueBoxUI : public ArdourCanvas::Rectangle, public ARDOUR::SessionHandlePtr
|
2021-12-07 16:47:00 -05:00
|
|
|
{
|
2021-12-17 10:32:52 -05:00
|
|
|
public:
|
2021-12-07 16:47:00 -05:00
|
|
|
CueBoxUI (ArdourCanvas::Item* parent);
|
|
|
|
~CueBoxUI ();
|
|
|
|
|
|
|
|
void trigger_scene (uint64_t n);
|
|
|
|
|
|
|
|
static Glib::RefPtr<Gtk::ActionGroup> trigger_actions;
|
2021-12-17 10:32:52 -05:00
|
|
|
static void setup_actions_and_bindings ();
|
2021-12-07 16:47:00 -05:00
|
|
|
|
2021-12-17 10:32:52 -05:00
|
|
|
void _size_allocate (ArdourCanvas::Rect const&);
|
2021-12-07 16:47:00 -05:00
|
|
|
|
2021-12-17 10:32:52 -05:00
|
|
|
private:
|
2021-12-07 16:47:00 -05:00
|
|
|
bool event (GdkEvent*, uint64_t);
|
|
|
|
bool text_event (GdkEvent*, uint64_t);
|
2021-12-17 10:32:52 -05:00
|
|
|
void build ();
|
2021-12-07 16:47:00 -05:00
|
|
|
|
2021-12-23 23:14:48 -05:00
|
|
|
void context_menu (uint64_t idx);
|
|
|
|
void get_slots (TriggerList &triggerlist, uint64_t idx);
|
|
|
|
|
|
|
|
void clear_all_triggers(uint64_t idx);
|
2021-12-27 18:35:24 -05:00
|
|
|
void set_all_colors (uint64_t idx);
|
2021-12-23 23:14:48 -05:00
|
|
|
void set_all_follow_action (ARDOUR::Trigger::FollowAction, uint64_t idx);
|
|
|
|
void set_all_launch_style (ARDOUR::Trigger::LaunchStyle, uint64_t idx);
|
|
|
|
void set_all_quantization (Temporal::BBT_Offset const&, uint64_t idx);
|
|
|
|
|
|
|
|
Gtk::Menu* _context_menu;
|
2021-12-27 18:35:24 -05:00
|
|
|
Gtk::ColorSelectionDialog _color_dialog;
|
2021-12-23 23:14:48 -05:00
|
|
|
|
2021-12-07 16:47:00 -05:00
|
|
|
static Gtkmm2ext::Bindings* bindings;
|
2021-12-17 10:32:52 -05:00
|
|
|
|
2021-12-07 16:47:00 -05:00
|
|
|
static void load_bindings ();
|
|
|
|
static void register_actions ();
|
|
|
|
|
2021-12-17 10:32:52 -05:00
|
|
|
typedef std::vector<ArdourCanvas::Rectangle*> Slots;
|
|
|
|
|
|
|
|
Slots _slots;
|
2021-12-07 16:47:00 -05:00
|
|
|
};
|
|
|
|
|
2021-12-23 23:14:48 -05:00
|
|
|
class CueBoxWidget : public FittedCanvasWidget, public ARDOUR::SessionHandlePtr
|
2021-12-07 16:47:00 -05:00
|
|
|
{
|
2021-12-17 10:32:52 -05:00
|
|
|
public:
|
2021-12-07 16:47:00 -05:00
|
|
|
CueBoxWidget (float w, float h);
|
|
|
|
|
2021-12-23 23:14:48 -05:00
|
|
|
void set_session (ARDOUR::Session* s) {ui->set_session(s); SessionHandlePtr::set_session(s);}
|
|
|
|
|
2021-12-07 16:47:00 -05:00
|
|
|
void on_map ();
|
|
|
|
void on_unmap ();
|
|
|
|
|
2021-12-17 10:32:52 -05:00
|
|
|
private:
|
2021-12-07 16:47:00 -05:00
|
|
|
CueBoxUI* ui;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* XXX probably for testing only */
|
|
|
|
|
|
|
|
class CueBoxWindow : public Gtk::Window
|
|
|
|
{
|
2021-12-17 10:32:52 -05:00
|
|
|
public:
|
2021-12-07 16:47:00 -05:00
|
|
|
CueBoxWindow ();
|
|
|
|
|
|
|
|
bool on_key_press_event (GdkEventKey*);
|
|
|
|
bool on_key_release_event (GdkEventKey*);
|
|
|
|
};
|
|
|
|
|
2021-12-17 10:32:52 -05:00
|
|
|
#endif
|