Refactor RegionEditor to be a Widget
This commit is contained in:
parent
3c5681b2c9
commit
c35fa54b3f
@ -130,8 +130,6 @@ AudioRegionEditor::AudioRegionEditor (Session* s, AudioRegionView* arv)
|
||||
snprintf (name, 64, "peak amplitude-%p", this);
|
||||
pthread_create_and_store (name, &_peak_amplitude_thread_handle, _peak_amplitude_thread, this);
|
||||
signal_peak_thread ();
|
||||
|
||||
|
||||
}
|
||||
|
||||
AudioRegionEditor::~AudioRegionEditor ()
|
||||
@ -357,5 +355,4 @@ void
|
||||
AudioRegionEditor::on_unmap ()
|
||||
{
|
||||
_show_on_touch.set_active (false);
|
||||
ArdourDialog::on_unmap ();
|
||||
}
|
||||
|
@ -104,4 +104,3 @@ private:
|
||||
PBD::ScopedConnection _peak_amplitude_connection;
|
||||
CrossThreadChannel _peak_channel;
|
||||
};
|
||||
|
||||
|
@ -1813,17 +1813,6 @@ AudioRegionView::update_coverage_frame (LayerDisplay d)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AudioRegionView::show_region_editor ()
|
||||
{
|
||||
if (editor == 0) {
|
||||
editor = new AudioRegionEditor (trackview.session(), this);
|
||||
}
|
||||
|
||||
editor->present ();
|
||||
editor->show_all();
|
||||
}
|
||||
|
||||
void
|
||||
AudioRegionView::transients_changed ()
|
||||
{
|
||||
|
@ -122,8 +122,6 @@ public:
|
||||
void update_transient(float old_pos, float new_pos);
|
||||
void remove_transient(float pos);
|
||||
|
||||
void show_region_editor ();
|
||||
|
||||
void set_frame_color ();
|
||||
uint32_t get_fill_color () const;
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2010-2012 Carl Hetherington <carl@carlh.net>
|
||||
* Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
|
||||
* Copyright (C) 2014-2015 Nick Mainsbridge <mainsbridge@gmail.com>
|
||||
* Copyright (C) 2024 Ben Loftis <ben.loftis@harrisonaudio.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
|
||||
@ -64,7 +65,7 @@ using namespace std;
|
||||
using namespace Gtkmm2ext;
|
||||
|
||||
RegionEditor::RegionEditor (Session* s, RegionView* rv)
|
||||
: ArdourDialog (_("Region"))
|
||||
: SessionHandlePtr (s)
|
||||
, _table (9, 3)
|
||||
, _table_row (0)
|
||||
, _region (rv->region ())
|
||||
@ -81,8 +82,6 @@ RegionEditor::RegionEditor (Session* s, RegionView* rv)
|
||||
, _region_fx_box (_region)
|
||||
, _sources (1)
|
||||
{
|
||||
set_session (s);
|
||||
|
||||
switch (_region->time_domain()) {
|
||||
case Temporal::AudioTime:
|
||||
/* XXX check length of region and choose samples or minsec */
|
||||
@ -190,16 +189,7 @@ RegionEditor::RegionEditor (Session* s, RegionView* rv)
|
||||
_table.attach (region_fx_label, 2, 3, 0, 1, Gtk::FILL, Gtk::FILL);
|
||||
_table.attach (_region_fx_box, 2, 3, 1, _table_row + 2, Gtk::FILL, Gtk::FILL);
|
||||
|
||||
get_vbox()->pack_start (_table, true, true);
|
||||
|
||||
add_button (Gtk::Stock::CLOSE, Gtk::RESPONSE_ACCEPT);
|
||||
|
||||
set_name ("RegionEditorWindow");
|
||||
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
|
||||
|
||||
signal_response().connect (sigc::mem_fun (*this, &RegionEditor::handle_response));
|
||||
|
||||
set_title (string_compose (_("Region '%1'"), _region->name()));
|
||||
add (_table);
|
||||
|
||||
for (uint32_t i = 0; i < _region->sources().size(); ++i) {
|
||||
_sources.append (_region->source(i)->name());
|
||||
@ -241,6 +231,7 @@ RegionEditor::RegionEditor (Session* s, RegionView* rv)
|
||||
|
||||
RegionEditor::~RegionEditor ()
|
||||
{
|
||||
remove (); /* unpack and unmap table */
|
||||
delete _clock_group;
|
||||
}
|
||||
|
||||
@ -500,12 +491,6 @@ RegionEditor::on_delete_event (GdkEventAny*)
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
RegionEditor::handle_response (int)
|
||||
{
|
||||
hide ();
|
||||
}
|
||||
|
||||
/* ****************************************************************************/
|
||||
|
||||
static std::list<Gtk::TargetEntry>
|
||||
|
@ -41,12 +41,12 @@
|
||||
#include "gtkmm2ext/dndtreeview.h"
|
||||
#include "gtkmm2ext/dndvbox.h"
|
||||
|
||||
#include "widgets/frame.h"
|
||||
|
||||
#include "pbd/signals.h"
|
||||
|
||||
#include "audio_clock.h"
|
||||
#include "ardour_dialog.h"
|
||||
#include "plugin_interest.h"
|
||||
#include "region_editor.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
class Region;
|
||||
@ -57,7 +57,7 @@ namespace ARDOUR {
|
||||
class RegionView;
|
||||
class ClockGroup;
|
||||
|
||||
class RegionEditor : public ArdourDialog
|
||||
class RegionEditor : public ArdourWidgets::Frame, public ARDOUR::SessionHandlePtr
|
||||
{
|
||||
public:
|
||||
RegionEditor (ARDOUR::Session*, RegionView*);
|
||||
@ -186,7 +186,6 @@ private:
|
||||
gint breleased (GdkEventButton* ev, Gtk::SpinButton* but, void (RegionEditor::*pmf)());
|
||||
|
||||
bool on_delete_event (GdkEventAny *);
|
||||
void handle_response (int);
|
||||
|
||||
bool spin_arrow_grab;
|
||||
|
||||
@ -195,4 +194,3 @@ private:
|
||||
|
||||
void set_clock_mode_from_primary ();
|
||||
};
|
||||
|
||||
|
59
gtk2_ardour/region_editor_window.cc
Normal file
59
gtk2_ardour/region_editor_window.cc
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Robin Gareus <robin@gareus.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "region_editor_window.h"
|
||||
#include "audio_region_editor.h"
|
||||
#include "audio_region_view.h"
|
||||
|
||||
#include "pbd/i18n.h"
|
||||
|
||||
using namespace ARDOUR;
|
||||
|
||||
RegionEditorWindow::RegionEditorWindow (Session* s, RegionView* rv)
|
||||
: ArdourWindow (_("Region"))
|
||||
{
|
||||
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (rv);
|
||||
if (arv) {
|
||||
_region_editor = new AudioRegionEditor (s, arv);
|
||||
} else {
|
||||
_region_editor = new RegionEditor (s, rv);
|
||||
}
|
||||
add (*_region_editor);
|
||||
set_name ("RegionEditorWindow");
|
||||
}
|
||||
|
||||
RegionEditorWindow::~RegionEditorWindow ()
|
||||
{
|
||||
delete _region_editor;
|
||||
}
|
||||
|
||||
void
|
||||
RegionEditorWindow::set_session (Session* s)
|
||||
{
|
||||
ArdourWindow::set_session (s);
|
||||
if (s) {
|
||||
_region_editor->set_session (s);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionEditorWindow::on_unmap ()
|
||||
{
|
||||
_region_editor->unmap ();
|
||||
ArdourWindow::on_unmap ();
|
||||
}
|
39
gtk2_ardour/region_editor_window.h
Normal file
39
gtk2_ardour/region_editor_window.h
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Robin Gareus <robin@gareus.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ardour_window.h"
|
||||
|
||||
class RegionEditor;
|
||||
class RegionView;
|
||||
|
||||
class RegionEditorWindow : public ArdourWindow
|
||||
{
|
||||
public:
|
||||
RegionEditorWindow (ARDOUR::Session*, RegionView*);
|
||||
~RegionEditorWindow ();
|
||||
|
||||
void set_session (ARDOUR::Session*);
|
||||
|
||||
protected:
|
||||
void on_unmap ();
|
||||
|
||||
private:
|
||||
RegionEditor* _region_editor;
|
||||
};
|
@ -48,7 +48,7 @@
|
||||
#include "region_view.h"
|
||||
#include "automation_region_view.h"
|
||||
#include "public_editor.h"
|
||||
#include "region_editor.h"
|
||||
#include "region_editor_window.h"
|
||||
#include "ghostregion.h"
|
||||
#include "ui_config.h"
|
||||
#include "utils.h"
|
||||
@ -82,7 +82,7 @@ RegionView::RegionView (ArdourCanvas::Container* parent,
|
||||
, _region (r)
|
||||
, sync_mark (nullptr)
|
||||
, sync_line (nullptr)
|
||||
, editor (nullptr)
|
||||
, _editor (nullptr)
|
||||
, current_visible_sync_position (0.0)
|
||||
, valid (false)
|
||||
, _disable_display (0)
|
||||
@ -162,7 +162,7 @@ RegionView::RegionView (ArdourCanvas::Container* parent,
|
||||
, _region (r)
|
||||
, sync_mark (nullptr)
|
||||
, sync_line (nullptr)
|
||||
, editor (nullptr)
|
||||
, _editor (nullptr)
|
||||
, current_visible_sync_position (0.0)
|
||||
, valid (false)
|
||||
, _disable_display (0)
|
||||
@ -181,7 +181,7 @@ RegionView::RegionView (ArdourCanvas::Container* parent,
|
||||
void
|
||||
RegionView::init (bool wfd)
|
||||
{
|
||||
editor = nullptr;
|
||||
_editor = nullptr;
|
||||
valid = true;
|
||||
in_destructor = false;
|
||||
wait_for_data = wfd;
|
||||
@ -268,7 +268,7 @@ RegionView::~RegionView ()
|
||||
|
||||
drop_silent_frames ();
|
||||
|
||||
delete editor;
|
||||
delete _editor;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -749,19 +749,19 @@ RegionView::set_sync_mark_color ()
|
||||
void
|
||||
RegionView::show_region_editor ()
|
||||
{
|
||||
if (!editor) {
|
||||
editor = new RegionEditor (trackview.session(), this);
|
||||
if (!_editor) {
|
||||
_editor = new RegionEditorWindow (trackview.session(), this);
|
||||
}
|
||||
|
||||
editor->present ();
|
||||
editor->show_all();
|
||||
_editor->present ();
|
||||
_editor->show_all();
|
||||
}
|
||||
|
||||
void
|
||||
RegionView::hide_region_editor()
|
||||
{
|
||||
if (editor) {
|
||||
editor->hide_all ();
|
||||
if (_editor) {
|
||||
_editor->hide_all ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "marker.h"
|
||||
|
||||
class TimeAxisView;
|
||||
class RegionEditor;
|
||||
class ArdourWindow;
|
||||
class GhostRegion;
|
||||
class AutomationTimeAxisView;
|
||||
class AutomationRegionView;
|
||||
@ -87,7 +87,7 @@ public:
|
||||
|
||||
bool set_position(Temporal::timepos_t const & pos, void* src, double* delta = 0);
|
||||
|
||||
virtual void show_region_editor ();
|
||||
void show_region_editor ();
|
||||
void hide_region_editor ();
|
||||
|
||||
virtual void region_changed (const PBD::PropertyChange&);
|
||||
@ -202,7 +202,7 @@ protected:
|
||||
ArdourCanvas::Polygon* sync_mark; ///< polygon for sync position
|
||||
ArdourCanvas::Line* sync_line; ///< polygon for sync position
|
||||
|
||||
RegionEditor* editor;
|
||||
ArdourWindow* _editor;
|
||||
|
||||
std::vector<ControlPoint *> control_points;
|
||||
double current_visible_sync_position;
|
||||
|
@ -253,6 +253,7 @@ gtk2_ardour_sources = [
|
||||
'recorder_group_tabs.cc',
|
||||
'recorder_ui.cc',
|
||||
'region_editor.cc',
|
||||
'region_editor_window.cc',
|
||||
'region_fx_line.cc',
|
||||
'region_gain_line.cc',
|
||||
'region_layering_order_editor.cc',
|
||||
|
Loading…
Reference in New Issue
Block a user