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>
|
2024-10-19 09:54:24 -04:00
|
|
|
#include <gtkmm/menu.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
|
|
|
|
2022-07-07 20:23:51 -04:00
|
|
|
class CueEntry : public ArdourCanvas::Rectangle, public sigc::trackable
|
2021-12-07 16:47:00 -05:00
|
|
|
{
|
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;
|
2022-08-04 14:40:06 -04:00
|
|
|
ArdourCanvas::Text* jump_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
|
|
|
|
2022-01-23 20:33:16 -05:00
|
|
|
void rec_state_changed ();
|
|
|
|
|
|
|
|
PBD::ScopedConnectionList _session_connections;
|
|
|
|
|
2021-12-17 10:32:52 -05:00
|
|
|
uint64_t _cue_idx;
|
|
|
|
double _poly_size;
|
|
|
|
double _poly_margin;
|
2022-01-26 10:22:15 -05:00
|
|
|
bool _grabbed;
|
2021-12-17 10:32:52 -05:00
|
|
|
};
|
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 ();
|
|
|
|
|
2022-09-26 16:48:30 -04:00
|
|
|
void trigger_cue_row (uint64_t n);
|
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);
|
2022-01-19 17:50:47 -05:00
|
|
|
void set_all_follow_action (ARDOUR::FollowAction const &, uint64_t idx);
|
2021-12-23 23:14:48 -05:00
|
|
|
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-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
|