13
0

change class names and heirarchy for the GUI elements that will be used to edit/trim clips

This commit is contained in:
Paul Davis 2021-12-09 19:45:25 -07:00
parent 7426c96812
commit 12dc428a60
9 changed files with 81 additions and 211 deletions

View File

@ -41,26 +41,24 @@
#include "region_view.h"
#include "ui_config.h"
#include "audio_region_trimmer_box.h"
#include "audio_clip_editor.h"
#include "pbd/i18n.h"
using namespace Gtk;
using namespace ARDOUR;
using namespace ArdourWidgets;
using namespace ArdourCanvas;
using std::min;
using std::max;
/* ------------ */
AudioTrimmerCanvas::AudioTrimmerCanvas (ArdourCanvas::Item* parent)
: Rectangle (parent)
AudioClipEditor::AudioClipEditor ()
{
// set_homogenous (true);
// set_row_spacing (4);
set_fill_color (UIConfiguration::instance().color (X_("theme:darkest")));
set_fill (true);
set_background_color (UIConfiguration::instance().color (X_("theme:darkest")));
const double scale = UIConfiguration::instance().get_ui_scale();
const double width = 600. * scale;
@ -68,42 +66,23 @@ AudioTrimmerCanvas::AudioTrimmerCanvas (ArdourCanvas::Item* parent)
// name = string_compose ("trigger %1", _trigger.index());
Event.connect (sigc::mem_fun (*this, &AudioTrimmerCanvas::event_handler));
frame = new Rectangle (this);
ArdourCanvas::Rect r (0, 0, width, height);
set (r);
set_outline_all ();
frame->set (r);
frame->set_outline_all ();
frame->Event.connect (sigc::mem_fun (*this, &AudioClipEditor::event_handler));
// selection_connection = PublicEditor::instance().get_selection().TriggersChanged.connect (sigc::mem_fun (*this, &TriggerBoxUI::selection_changed));
}
AudioTrimmerCanvas::~AudioTrimmerCanvas ()
AudioClipEditor::~AudioClipEditor ()
{
}
void
AudioTrimmerCanvas::render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context> cr) const
{
// ArdourCanvas::Rect self (item_to_window (_rect, NO_ROUND));
// boost::optional<ArdourCanvas::Rect> i = self.intersection (area);
// if (!i) {
// return;
// }
cr->set_identity_matrix();
cr->translate (area.x0, area.y0-0.5); //should be self
float height = area.height(); //should be self
float width = area.width();
//black border...this should be in draw_bg
Gtkmm2ext::set_source_rgba (cr, Gtkmm2ext::rgba_to_color (0,0,0,1));
cr->set_line_width(1);
cr->rectangle(0, 0, width, height);
cr->fill ();
}
bool
AudioTrimmerCanvas::event_handler (GdkEvent* ev)
AudioClipEditor::event_handler (GdkEvent* ev)
{
switch (ev->type) {
case GDK_BUTTON_PRESS:
@ -122,55 +101,27 @@ AudioTrimmerCanvas::event_handler (GdkEvent* ev)
return false;
}
/* ------------ */
AudioTrimmerBoxWidget::AudioTrimmerBoxWidget ()
{
trimmer = new AudioTrimmerCanvas (root());
set_background_color (UIConfiguration::instance().color (X_("theme:bg")));
}
void
AudioTrimmerBoxWidget::size_request (double& w, double& h) const
{
trimmer->size_request (w, h);
w=600;
h=210;
}
void
AudioTrimmerBoxWidget::on_map ()
{
GtkCanvas::on_map ();
}
void
AudioTrimmerBoxWidget::on_unmap ()
{
GtkCanvas::on_unmap ();
}
/* ====================================================== */
AudioRegionTrimmerBox::AudioRegionTrimmerBox ()
AudioClipEditorBox::AudioClipEditorBox ()
{
_header_label.set_text(_("AUDIO Region Trimmer:"));
_header_label.set_alignment(0.0, 0.5);
pack_start(_header_label, false, false, 6);
trimmer_widget = manage (new AudioTrimmerBoxWidget());
trimmer_widget->set_size_request(600,120);
editor = manage (new AudioClipEditor);
editor->set_size_request(600,120);
pack_start(*trimmer_widget, true, true);
trimmer_widget->show();
pack_start(*editor, true, true);
editor->show();
}
AudioRegionTrimmerBox::~AudioRegionTrimmerBox ()
AudioClipEditorBox::~AudioClipEditorBox ()
{
}
void
AudioRegionTrimmerBox::set_region (boost::shared_ptr<Region> r)
AudioClipEditorBox::set_region (boost::shared_ptr<Region> r)
{
set_session(&r->session());
@ -181,11 +132,11 @@ AudioRegionTrimmerBox::set_region (boost::shared_ptr<Region> r)
PBD::PropertyChange interesting_stuff;
region_changed(interesting_stuff);
_region->PropertyChanged.connect (state_connection, invalidator (*this), boost::bind (&AudioRegionTrimmerBox::region_changed, this, _1), gui_context());
_region->PropertyChanged.connect (state_connection, invalidator (*this), boost::bind (&AudioClipEditorBox::region_changed, this, _1), gui_context());
}
void
AudioRegionTrimmerBox::region_changed (const PBD::PropertyChange& what_changed)
AudioClipEditorBox::region_changed (const PBD::PropertyChange& what_changed)
{
//ToDo: refactor the region_editor.cc to cover this basic stuff
// if (what_changed.contains (ARDOUR::Properties::name)) {
@ -199,6 +150,3 @@ AudioRegionTrimmerBox::region_changed (const PBD::PropertyChange& what_changed)
{
}
}

View File

@ -47,46 +47,33 @@ namespace ArdourCanvas {
class Polygon;
};
class RegionTrimmerBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr
class ClipEditorBox : public Gtk::VBox, public ARDOUR::SessionHandlePtr
{
public:
RegionTrimmerBox () {}
~RegionTrimmerBox () {}
ClipEditorBox () {}
~ClipEditorBox () {}
virtual void set_region (boost::shared_ptr<ARDOUR::Region>) =0;
};
class AudioTrimmerCanvas : public ArdourCanvas::Rectangle
class AudioClipEditor : public ArdourCanvas::GtkCanvas
{
public:
AudioTrimmerCanvas (ArdourCanvas::Item* parent);
~AudioTrimmerCanvas ();
void render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
// void _size_allocate (ArdourCanvas::Rect const &);
bool event_handler (GdkEvent*);
};
class AudioTrimmerBoxWidget : public ArdourCanvas::GtkCanvas
{
public:
AudioTrimmerBoxWidget ();
void size_request (double& w, double& h) const;
void on_map ();
void on_unmap ();
AudioClipEditor ();
~AudioClipEditor ();
private:
AudioTrimmerCanvas* trimmer;
ArdourCanvas::Rectangle* frame;
bool event_handler (GdkEvent* ev);
};
class AudioRegionTrimmerBox : public RegionTrimmerBox
class AudioClipEditorBox : public ClipEditorBox
{
public:
AudioRegionTrimmerBox ();
~AudioRegionTrimmerBox ();
AudioClipEditorBox ();
~AudioClipEditorBox ();
void set_region (boost::shared_ptr<ARDOUR::Region>);
void region_changed (const PBD::PropertyChange& what_changed);
@ -95,7 +82,7 @@ private:
Gtk::Label _header_label;
Gtk::Table table;
AudioTrimmerBoxWidget *trimmer_widget;
AudioClipEditor *editor;
PBD::ScopedConnection state_connection;

View File

@ -41,26 +41,24 @@
#include "region_view.h"
#include "ui_config.h"
#include "midi_region_trimmer_box.h"
#include "midi_clip_editor.h"
#include "pbd/i18n.h"
using namespace Gtk;
using namespace ARDOUR;
using namespace ArdourWidgets;
using namespace ArdourCanvas;
using std::min;
using std::max;
/* ------------ */
MidiTrimmerCanvas::MidiTrimmerCanvas (ArdourCanvas::Item* parent)
: Rectangle (parent)
MidiClipEditor::MidiClipEditor ()
{
// set_homogenous (true);
// set_row_spacing (4);
set_fill_color (UIConfiguration::instance().color (X_("theme:darkest")));
set_fill (true);
set_background_color (UIConfiguration::instance().color (X_("theme:darkest")));
const double scale = UIConfiguration::instance().get_ui_scale();
const double width = 600. * scale;
@ -68,42 +66,23 @@ MidiTrimmerCanvas::MidiTrimmerCanvas (ArdourCanvas::Item* parent)
// name = string_compose ("trigger %1", _trigger.index());
Event.connect (sigc::mem_fun (*this, &MidiTrimmerCanvas::event_handler));
frame = new Rectangle (this);
ArdourCanvas::Rect r (0, 0, width, height);
set (r);
set_outline_all ();
frame->set (r);
frame->set_outline_all ();
frame->Event.connect (sigc::mem_fun (*this, &MidiClipEditor::event_handler));
// selection_connection = PublicEditor::instance().get_selection().TriggersChanged.connect (sigc::mem_fun (*this, &TriggerBoxUI::selection_changed));
}
MidiTrimmerCanvas::~MidiTrimmerCanvas ()
MidiClipEditor::~MidiClipEditor ()
{
}
void
MidiTrimmerCanvas::render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context> cr) const
{
// ArdourCanvas::Rect self (item_to_window (_rect, NO_ROUND));
// boost::optional<ArdourCanvas::Rect> i = self.intersection (area);
// if (!i) {
// return;
// }
cr->set_identity_matrix();
cr->translate (area.x0, area.y0-0.5); //should be self
float height = area.height(); //should be self
float width = area.width();
//black border...this should be in draw_bg
Gtkmm2ext::set_source_rgba (cr, Gtkmm2ext::rgba_to_color (0,0,0,1));
cr->set_line_width(1);
cr->rectangle(0, 0, width, height);
cr->fill ();
}
bool
MidiTrimmerCanvas::event_handler (GdkEvent* ev)
MidiClipEditor::event_handler (GdkEvent* ev)
{
switch (ev->type) {
case GDK_BUTTON_PRESS:
@ -122,61 +101,33 @@ MidiTrimmerCanvas::event_handler (GdkEvent* ev)
return false;
}
/* ------------ */
MidiTrimmerBoxWidget::MidiTrimmerBoxWidget ()
{
trimmer = new MidiTrimmerCanvas (root());
set_background_color (UIConfiguration::instance().color (X_("theme:bg")));
}
void
MidiTrimmerBoxWidget::size_request (double& w, double& h) const
{
trimmer->size_request (w, h);
w=600;
h=210;
}
void
MidiTrimmerBoxWidget::on_map ()
{
GtkCanvas::on_map ();
}
void
MidiTrimmerBoxWidget::on_unmap ()
{
GtkCanvas::on_unmap ();
}
/* ====================================================== */
MidiRegionTrimmerBox::MidiRegionTrimmerBox ()
MidiClipEditorBox::MidiClipEditorBox ()
{
_header_label.set_text(_("MIDI Region Trimmer:"));
_header_label.set_alignment(0.0, 0.5);
pack_start(_header_label, false, false, 6);
trimmer_widget = manage (new MidiTrimmerBoxWidget());
trimmer_widget->set_size_request(600,120);
editor = manage (new MidiClipEditor());
editor->set_size_request(600,120);
pack_start(*trimmer_widget, true, true);
trimmer_widget->show();
pack_start(*editor, true, true);
editor->show();
}
MidiRegionTrimmerBox::~MidiRegionTrimmerBox ()
MidiClipEditorBox::~MidiClipEditorBox ()
{
}
void
MidiRegionTrimmerBox::set_session (Session* s)
MidiClipEditorBox::set_session (Session* s)
{
SessionHandlePtr::set_session (s);
}
void
MidiRegionTrimmerBox::set_region (boost::shared_ptr<Region> r)
MidiClipEditorBox::set_region (boost::shared_ptr<Region> r)
{
set_session(&r->session());
@ -187,11 +138,11 @@ MidiRegionTrimmerBox::set_region (boost::shared_ptr<Region> r)
PBD::PropertyChange interesting_stuff;
region_changed(interesting_stuff);
_region->PropertyChanged.connect (state_connection, invalidator (*this), boost::bind (&MidiRegionTrimmerBox::region_changed, this, _1), gui_context());
_region->PropertyChanged.connect (state_connection, invalidator (*this), boost::bind (&MidiClipEditorBox::region_changed, this, _1), gui_context());
}
void
MidiRegionTrimmerBox::region_changed (const PBD::PropertyChange& what_changed)
MidiClipEditorBox::region_changed (const PBD::PropertyChange& what_changed)
{
//ToDo: refactor the region_editor.cc to cover this basic stuff
// if (what_changed.contains (ARDOUR::Properties::name)) {

View File

@ -31,11 +31,10 @@
#include "gtkmm2ext/cairo_packer.h"
#include "canvas/table.h"
#include "canvas/canvas.h"
#include "canvas/rectangle.h"
#include "audio_region_trimmer_box.h"
#include "audio_clip_editor.h"
#include "audio_clock.h"
@ -49,36 +48,22 @@ namespace ArdourCanvas {
class Polygon;
};
class MidiTrimmerCanvas : public ArdourCanvas::Rectangle
class MidiClipEditor : public ArdourCanvas::GtkCanvas
{
public:
MidiTrimmerCanvas (ArdourCanvas::Item* parent);
~MidiTrimmerCanvas ();
void render (ArdourCanvas::Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
// void _size_allocate (ArdourCanvas::Rect const &);
bool event_handler (GdkEvent*);
};
class MidiTrimmerBoxWidget : public ArdourCanvas::GtkCanvas
{
public:
MidiTrimmerBoxWidget ();
void size_request (double& w, double& h) const;
void on_map ();
void on_unmap ();
MidiClipEditor ();
~MidiClipEditor ();
private:
MidiTrimmerCanvas* trimmer;
ArdourCanvas::Rectangle* frame;
bool event_handler (GdkEvent* ev);
};
class MidiRegionTrimmerBox : public RegionTrimmerBox
class MidiClipEditorBox : public ClipEditorBox
{
public:
MidiRegionTrimmerBox ();
~MidiRegionTrimmerBox ();
MidiClipEditorBox ();
~MidiClipEditorBox ();
void set_session (ARDOUR::Session*);
@ -89,7 +74,7 @@ private:
Gtk::Label _header_label;
Gtk::Table table;
MidiTrimmerBoxWidget *trimmer_widget;
MidiClipEditor *editor;
PBD::ScopedConnection state_connection;

View File

@ -42,7 +42,7 @@
#include "audio_region_operations_box.h"
#include "midi_region_operations_box.h"
#include "slot_properties_box.h"
#include "midi_region_trimmer_box.h"
#include "midi_clip_editor.h"
#include "trigger_page.h"
#include "trigger_strip.h"
@ -88,8 +88,8 @@ TriggerPage::TriggerPage ()
_audio_ops_box = new AudioRegionOperationsBox ();
_midi_ops_box = new MidiRegionOperationsBox ();
_audio_trim_box = new AudioRegionTrimmerBox ();
_midi_trim_box = new MidiRegionTrimmerBox ();
_audio_trim_box = new AudioClipEditorBox ();
_midi_trim_box = new MidiClipEditorBox ();
Gtk::Table* table = manage (new Gtk::Table);
table->set_homogeneous (false);

View File

@ -38,8 +38,8 @@ class AudioRegionPropertiesBox;
class MidiRegionPropertiesBox;
class AudioRegionOperationsBox;
class MidiRegionOperationsBox;
class AudioRegionTrimmerBox;
class MidiRegionTrimmerBox;
class AudioClipEditorBox;
class MidiClipEditorBox;
class TriggerPage : public ArdourWidgets::Tabbable, public ARDOUR::SessionHandlePtr, public PBD::ScopedConnectionList
{
@ -96,11 +96,11 @@ private:
AudioRegionPropertiesBox* _audio_prop_box;
AudioRegionOperationsBox* _audio_ops_box;
AudioRegionTrimmerBox* _audio_trim_box;
AudioClipEditorBox* _audio_trim_box;
MidiRegionPropertiesBox* _midi_prop_box;
MidiRegionOperationsBox* _midi_ops_box;
MidiRegionTrimmerBox* _midi_trim_box;
MidiClipEditorBox* _midi_trim_box;
std::list<TriggerStrip*> _strips;
sigc::connection _fast_screen_update_connection;

View File

@ -37,7 +37,7 @@
#include "audio_region_operations_box.h"
#include "midi_region_operations_box.h"
#include "slot_properties_box.h"
#include "midi_region_trimmer_box.h"
#include "midi_clip_editor.h"
#include "ardour_ui.h"
#include "gui_thread.h"
@ -401,11 +401,11 @@ TriggerWindow::TriggerWindow (Trigger* slot)
if (slot->region()->data_type() == DataType::AUDIO) {
_prop_box = manage(new AudioRegionPropertiesBox ());
_ops_box = manage(new AudioRegionOperationsBox ());
_trim_box = manage(new AudioRegionTrimmerBox ());
_trim_box = manage(new AudioClipEditorBox ());
} else {
_prop_box = manage(new MidiRegionPropertiesBox ());
_ops_box = manage(new MidiRegionOperationsBox ());
_trim_box = manage(new MidiRegionTrimmerBox ());
_trim_box = manage(new MidiClipEditorBox ());
}
_prop_box->set_region(slot->region());

View File

@ -28,7 +28,7 @@ namespace ArdourWidgets {
class RegionPropertiesBox;
class RegionOperationsBox;
class RegionTrimmerBox;
class ClipEditorBox;
class TriggerUI : public Gtk::Table //, public sigc::trackable
{
@ -91,7 +91,7 @@ class TriggerWindow : public Gtk::Window
RegionPropertiesBox *_prop_box;
RegionOperationsBox *_ops_box;
RegionTrimmerBox *_trim_box;
ClipEditorBox *_trim_box;
};
#endif /* __ardour_gtk_trigger_ui_h__ */

View File

@ -49,13 +49,12 @@ gtk2_ardour_sources = [
'ardour_ui_startup.cc',
'ardour_ui_video.cc',
'ardour_window.cc',
'audio_clip_editor.cc',
'audio_clock.cc',
'audio_clip_editor.cc',
'audio_region_editor.cc',
'audio_region_view.cc',
'audio_region_operations_box.cc',
'audio_region_properties_box.cc',
'audio_region_trimmer_box.cc',
'audio_streamview.cc',
'audio_time_axis.cc',
'automation_controller.cc',
@ -163,13 +162,13 @@ gtk2_ardour_sources = [
'midi_automation_line.cc',
'midi_channel_dialog.cc',
'midi_channel_selector.cc',
'midi_clip_editor.cc',
'midi_cut_buffer.cc',
'midi_export_dialog.cc',
'midi_list_editor.cc',
'midi_region_view.cc',
'midi_region_operations_box.cc',
'midi_region_properties_box.cc',
'midi_region_trimmer_box.cc',
'midi_scroomer.cc',
'midi_selection.cc',
'midi_streamview.cc',