mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 06:44:57 +01:00
Compare commits
10 commits
c916d3d952
...
b51621a1ae
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b51621a1ae | ||
|
|
50bccb44d5 | ||
|
|
62a098811c | ||
|
|
d4b436b4c5 | ||
|
|
c0ac99003b | ||
|
|
37877fbdc2 | ||
|
|
0204ea1f24 | ||
|
|
5427cec821 | ||
|
|
9886d6c19e | ||
|
|
41ade3b024 |
27 changed files with 1722 additions and 2237 deletions
|
|
@ -2581,7 +2581,6 @@ Editor::set_state (const XMLNode& node, int version)
|
|||
XMLNodeList children = node.children ();
|
||||
for (XMLNodeList::const_iterator i = children.begin(); i != children.end(); ++i) {
|
||||
selection->set_state (**i, Stateful::current_state_version);
|
||||
_regions->set_state (**i);
|
||||
_locations->set_state (**i);
|
||||
}
|
||||
|
||||
|
|
@ -2683,7 +2682,6 @@ Editor::get_state ()
|
|||
node->set_property (X_("show-touched-automation"), _show_touched_automation);
|
||||
|
||||
node->add_child_nocopy (selection->get_state ());
|
||||
node->add_child_nocopy (_regions->get_state ());
|
||||
|
||||
node->set_property ("nudge-clock-value", nudge_clock->current_duration());
|
||||
|
||||
|
|
@ -5877,16 +5875,6 @@ Editor::consider_auditioning (boost::shared_ptr<Region> region)
|
|||
last_audition_region = r;
|
||||
}
|
||||
|
||||
boost::shared_ptr<ARDOUR::Region>
|
||||
Editor::get_dragged_region_from_sidebar ()
|
||||
{
|
||||
boost::shared_ptr<ARDOUR::Region> rv = _regions->get_dragged_region ();
|
||||
if (!rv) {
|
||||
rv = _sources->get_dragged_region ();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
Editor::hide_a_region (boost::shared_ptr<Region> r)
|
||||
{
|
||||
|
|
@ -6215,8 +6203,6 @@ Editor::session_going_away ()
|
|||
|
||||
/* rip everything out of the list displays */
|
||||
|
||||
_regions->clear ();
|
||||
_sources->clear ();
|
||||
_routes->clear ();
|
||||
_route_groups->clear ();
|
||||
|
||||
|
|
|
|||
|
|
@ -226,8 +226,6 @@ public:
|
|||
void hide_a_region (boost::shared_ptr<ARDOUR::Region>);
|
||||
void show_a_region (boost::shared_ptr<ARDOUR::Region>);
|
||||
|
||||
boost::shared_ptr<ARDOUR::Region> get_dragged_region_from_sidebar ();
|
||||
|
||||
#ifdef USE_RUBBERBAND
|
||||
std::vector<std::string> rb_opt_strings;
|
||||
int rb_current_opt;
|
||||
|
|
@ -2118,15 +2116,6 @@ private:
|
|||
guint time);
|
||||
|
||||
void drop_regions (
|
||||
const Glib::RefPtr<Gdk::DragContext>& context,
|
||||
gint x,
|
||||
gint y,
|
||||
const Gtk::SelectionData& data,
|
||||
guint info,
|
||||
guint time,
|
||||
bool from_region_list);
|
||||
|
||||
void drop_routes (
|
||||
const Glib::RefPtr<Gdk::DragContext>& context,
|
||||
gint x,
|
||||
gint y,
|
||||
|
|
|
|||
|
|
@ -268,8 +268,7 @@ Editor::initialize_canvas ()
|
|||
|
||||
vector<TargetEntry> target_table;
|
||||
|
||||
target_table.push_back (TargetEntry ("x-ardour/region.erl", TARGET_SAME_APP)); // DnD from the region list will generate this target
|
||||
target_table.push_back (TargetEntry ("x-ardour/region.esl", TARGET_SAME_APP)); // DnD from the source list will generate this target
|
||||
target_table.push_back (TargetEntry ("x-ardour/region.pbdid", TARGET_SAME_APP));
|
||||
target_table.push_back (TargetEntry ("text/uri-list"));
|
||||
target_table.push_back (TargetEntry ("text/plain"));
|
||||
target_table.push_back (TargetEntry ("application/x-rootwin-drop"));
|
||||
|
|
@ -391,10 +390,8 @@ Editor::track_canvas_drag_data_received (const RefPtr<Gdk::DragContext>& context
|
|||
if (!ARDOUR_UI_UTILS::engine_is_running ()) {
|
||||
return;
|
||||
}
|
||||
if (data.get_target() == "x-ardour/region.erl") {
|
||||
drop_regions (context, x, y, data, info, time, true);
|
||||
} else if (data.get_target() == "x-ardour/region.esl") {
|
||||
drop_regions (context, x, y, data, info, time, false);
|
||||
if (data.get_target() == "x-ardour/region.pbdid") {
|
||||
drop_regions (context, x, y, data, info, time);
|
||||
} else {
|
||||
drop_paths (context, x, y, data, info, time);
|
||||
}
|
||||
|
|
@ -435,7 +432,7 @@ Editor::drop_paths_part_two (const vector<string>& paths, timepos_t const & p, d
|
|||
/* drop onto canvas background: create new tracks */
|
||||
|
||||
InstrumentSelector is; // instantiation builds instrument-list and sets default.
|
||||
do_import (midi_paths, Editing::ImportDistinctFiles, ImportAsTrack, SrcBest, SMFTrackName, SMFTempoIgnore, pos, is.selected_instrument(), false);
|
||||
do_import (midi_paths, Editing::ImportDistinctFiles, ImportAsTrack, SrcBest, SMFTrackNumber, SMFTempoIgnore, pos, is.selected_instrument(), false);
|
||||
|
||||
if (UIConfiguration::instance().get_only_copy_imported_files() || copy) {
|
||||
do_import (audio_paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack,
|
||||
|
|
@ -453,7 +450,7 @@ Editor::drop_paths_part_two (const vector<string>& paths, timepos_t const & p, d
|
|||
selection->set (tv);
|
||||
|
||||
do_import (midi_paths, Editing::ImportSerializeFiles, ImportToTrack,
|
||||
SrcBest, SMFTrackName, SMFTempoIgnore, pos);
|
||||
SrcBest, SMFTrackNumber, SMFTempoIgnore, pos);
|
||||
|
||||
if (UIConfiguration::instance().get_only_copy_imported_files() || copy) {
|
||||
do_import (audio_paths, Editing::ImportSerializeFiles, Editing::ImportToTrack,
|
||||
|
|
|
|||
|
|
@ -1210,37 +1210,17 @@ Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context,
|
|||
|
||||
if (can_drop) {
|
||||
|
||||
if (target == "x-ardour/region.erl") {
|
||||
region = _regions->get_dragged_region ();
|
||||
} else if (target == "x-ardour/region.esl") {
|
||||
region = _sources->get_dragged_region ();
|
||||
}
|
||||
|
||||
if (region) {
|
||||
|
||||
if (tv.first == 0
|
||||
&& (
|
||||
boost::dynamic_pointer_cast<AudioRegion> (region) != 0 ||
|
||||
boost::dynamic_pointer_cast<MidiRegion> (region) != 0
|
||||
)
|
||||
)
|
||||
{
|
||||
if (target == "x-ardour/region.pbdid") {
|
||||
if (tv.first == 0 && pbdid_dragged_dt != DataType::NIL) {
|
||||
/* drop to drop-zone */
|
||||
context->drag_status (context->get_suggested_action(), time);
|
||||
context->drag_status (Gdk::ACTION_COPY, time);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((boost::dynamic_pointer_cast<AudioRegion> (region) != 0 &&
|
||||
dynamic_cast<AudioTimeAxisView*> (tv.first) != 0) ||
|
||||
(boost::dynamic_pointer_cast<MidiRegion> (region) != 0 &&
|
||||
dynamic_cast<MidiTimeAxisView*> (tv.first) != 0)) {
|
||||
|
||||
/* audio to audio
|
||||
OR
|
||||
midi to midi
|
||||
*/
|
||||
|
||||
context->drag_status (context->get_suggested_action(), time);
|
||||
if ((pbdid_dragged_dt == DataType::AUDIO && dynamic_cast<AudioTimeAxisView*> (tv.first) != 0) ||
|
||||
(pbdid_dragged_dt == DataType::MIDI && dynamic_cast<MidiTimeAxisView*> (tv.first) != 0)) {
|
||||
/* audio to audio OR MIDI to MIDI */
|
||||
context->drag_status (Gdk::ACTION_COPY, time);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1270,9 +1250,8 @@ Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context,
|
|||
void
|
||||
Editor::drop_regions (const Glib::RefPtr<Gdk::DragContext>& /*context*/,
|
||||
int x, int y,
|
||||
const SelectionData& /*data*/,
|
||||
guint /*info*/, guint /*time*/,
|
||||
bool from_region_list)
|
||||
const SelectionData& data,
|
||||
guint /*info*/, guint /*time*/)
|
||||
{
|
||||
GdkEvent event;
|
||||
double px;
|
||||
|
|
@ -1285,13 +1264,8 @@ Editor::drop_regions (const Glib::RefPtr<Gdk::DragContext>& /*context*/,
|
|||
event.motion.state = Gdk::BUTTON1_MASK;
|
||||
samplepos_t const pos = window_event_sample (&event, &px, &py);
|
||||
|
||||
boost::shared_ptr<Region> region;
|
||||
|
||||
if (from_region_list) {
|
||||
region = _regions->get_dragged_region ();
|
||||
} else {
|
||||
region = _sources->get_dragged_region ();
|
||||
}
|
||||
PBD::ID rid (data.get_data_as_string ());
|
||||
boost::shared_ptr<Region> region = RegionFactory::region_by_id (rid);
|
||||
|
||||
if (!region) { return; }
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ Editor::add_new_location_internal (Location* location)
|
|||
lam->start = new ArdourMarker (*this, *cd_marker_group, color, location->name(), ArdourMarker::Mark, location->start());
|
||||
group = cd_marker_group;
|
||||
} else if (location->is_cue_marker() && ruler_cue_marker_action->get_active()) {
|
||||
lam->start = new ArdourMarker (*this, *cue_marker_group, color, location->name(), ArdourMarker::Mark, location->start());
|
||||
lam->start = new ArdourMarker (*this, *cue_marker_group, color, location->name(), ArdourMarker::Cue, location->start());
|
||||
group = cue_marker_group;
|
||||
} else {
|
||||
lam->start = new ArdourMarker (*this, *marker_group, color, location->name(), ArdourMarker::Mark, location->start());
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -3,6 +3,7 @@
|
|||
* Copyright (C) 2009-2011 David Robillard <d@drobilla.net>
|
||||
* Copyright (C) 2009-2018 Paul Davis <paul@linuxaudiosystems.com>
|
||||
* Copyright (C) 2018 Ben Loftis <ben@harrisonconsoles.com>
|
||||
* Copyright (C) 2021 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
|
||||
|
|
@ -21,188 +22,34 @@
|
|||
#ifndef __gtk_ardour_editor_regions_h__
|
||||
#define __gtk_ardour_editor_regions_h__
|
||||
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
#include <gtkmm/scrolledwindow.h>
|
||||
#include <gtkmm/treemodel.h>
|
||||
#include <gtkmm/treerowreference.h>
|
||||
#include <gtkmm/treestore.h>
|
||||
|
||||
#include "editor_component.h"
|
||||
#include "region_list_base.h"
|
||||
#include "region_selection.h"
|
||||
|
||||
class EditorRegions : public EditorComponent, public ARDOUR::SessionHandlePtr
|
||||
class EditorRegions : public EditorComponent, public RegionListBase
|
||||
{
|
||||
public:
|
||||
EditorRegions (Editor*);
|
||||
|
||||
void set_session (ARDOUR::Session *);
|
||||
|
||||
Gtk::Widget& widget () {
|
||||
return _scroller;
|
||||
}
|
||||
|
||||
void clear ();
|
||||
|
||||
void set_selected (RegionSelection&);
|
||||
void selection_mapover (sigc::slot<void, boost::shared_ptr<ARDOUR::Region>>);
|
||||
void remove_unused_regions ();
|
||||
|
||||
boost::shared_ptr<ARDOUR::Region> get_dragged_region ();
|
||||
boost::shared_ptr<ARDOUR::Region> get_single_selection ();
|
||||
|
||||
void redisplay ();
|
||||
|
||||
void suspend_redisplay () {
|
||||
_no_redisplay = true;
|
||||
}
|
||||
|
||||
void resume_redisplay () {
|
||||
_no_redisplay = false;
|
||||
redisplay ();
|
||||
}
|
||||
|
||||
void block_change_connection (bool b) {
|
||||
_change_connection.block (b);
|
||||
}
|
||||
|
||||
void unselect_all () {
|
||||
void unselect_all ()
|
||||
{
|
||||
_display.get_selection ()->unselect_all ();
|
||||
}
|
||||
|
||||
void remove_unused_regions ();
|
||||
|
||||
XMLNode& get_state () const;
|
||||
void set_state (const XMLNode &);
|
||||
protected:
|
||||
void regions_changed (boost::shared_ptr<ARDOUR::RegionList>, PBD::PropertyChange const&);
|
||||
|
||||
private:
|
||||
|
||||
struct Columns : public Gtk::TreeModel::ColumnRecord {
|
||||
Columns () {
|
||||
add (name);
|
||||
add (channels);
|
||||
add (tags);
|
||||
add (start);
|
||||
add (length);
|
||||
add (end);
|
||||
add (sync);
|
||||
add (fadein);
|
||||
add (fadeout);
|
||||
add (locked);
|
||||
add (glued);
|
||||
add (muted);
|
||||
add (opaque);
|
||||
add (path);
|
||||
add (region);
|
||||
add (color_);
|
||||
add (position);
|
||||
}
|
||||
|
||||
Gtk::TreeModelColumn<std::string> name;
|
||||
Gtk::TreeModelColumn<int> channels;
|
||||
Gtk::TreeModelColumn<std::string> tags;
|
||||
Gtk::TreeModelColumn<Temporal::timepos_t> position;
|
||||
Gtk::TreeModelColumn<std::string> start;
|
||||
Gtk::TreeModelColumn<std::string> end;
|
||||
Gtk::TreeModelColumn<std::string> length;
|
||||
Gtk::TreeModelColumn<std::string> sync;
|
||||
Gtk::TreeModelColumn<std::string> fadein;
|
||||
Gtk::TreeModelColumn<std::string> fadeout;
|
||||
Gtk::TreeModelColumn<bool> locked;
|
||||
Gtk::TreeModelColumn<bool> glued;
|
||||
Gtk::TreeModelColumn<bool> muted;
|
||||
Gtk::TreeModelColumn<bool> opaque;
|
||||
Gtk::TreeModelColumn<std::string> path;
|
||||
Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
|
||||
Gtk::TreeModelColumn<Gdk::Color> color_;
|
||||
};
|
||||
|
||||
Columns _columns;
|
||||
|
||||
Gtk::TreeModel::RowReference last_row;
|
||||
|
||||
void freeze_tree_model ();
|
||||
void thaw_tree_model ();
|
||||
void regions_changed (boost::shared_ptr<ARDOUR::RegionList>, PBD::PropertyChange const &);
|
||||
void init ();
|
||||
void selection_changed ();
|
||||
|
||||
sigc::connection _change_connection;
|
||||
|
||||
int _sort_col_id;
|
||||
Gtk::SortType _sort_type;
|
||||
|
||||
bool selection_filter (const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool yn);
|
||||
|
||||
Gtk::Widget* old_focus;
|
||||
|
||||
Gtk::CellEditable* name_editable;
|
||||
void name_editing_started (Gtk::CellEditable*, const Glib::ustring&);
|
||||
void name_edit (const std::string&, const std::string&);
|
||||
|
||||
|
||||
Gtk::CellEditable* tags_editable;
|
||||
void tag_editing_started (Gtk::CellEditable*, const Glib::ustring&);
|
||||
void tag_edit (const std::string&, const std::string&);
|
||||
|
||||
|
||||
void locked_changed (std::string const &);
|
||||
void glued_changed (std::string const &);
|
||||
void muted_changed (std::string const &);
|
||||
void opaque_changed (std::string const &);
|
||||
|
||||
bool key_press (GdkEventKey *);
|
||||
bool button_press (GdkEventButton*);
|
||||
|
||||
bool focus_in (GdkEventFocus*);
|
||||
bool focus_out (GdkEventFocus*);
|
||||
bool enter_notify (GdkEventCrossing*);
|
||||
bool leave_notify (GdkEventCrossing*);
|
||||
|
||||
void show_context_menu (int button, int time);
|
||||
|
||||
void format_position (Temporal::timepos_t const & pos, char* buf, size_t bufsize, bool onoff = true);
|
||||
|
||||
void add_region (boost::shared_ptr<ARDOUR::Region>);
|
||||
void destroy_region (boost::shared_ptr<ARDOUR::Region>);
|
||||
|
||||
void populate_row (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const &, PBD::PropertyChange const &);
|
||||
void populate_row_used (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_position (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_end (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_sync (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_fade_in (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row, boost::shared_ptr<ARDOUR::AudioRegion>);
|
||||
void populate_row_fade_out (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row, boost::shared_ptr<ARDOUR::AudioRegion>);
|
||||
void populate_row_locked (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_muted (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_glued (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_opaque (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_length (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_name (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_source (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
|
||||
void update_row (boost::shared_ptr<ARDOUR::Region>);
|
||||
|
||||
void clock_format_changed ();
|
||||
|
||||
Glib::RefPtr<Gtk::Action> remove_unused_regions_action () const;
|
||||
|
||||
Gtk::Menu* _menu;
|
||||
Gtk::ScrolledWindow _scroller;
|
||||
Gtk::Frame _frame;
|
||||
|
||||
Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > _display;
|
||||
|
||||
Glib::RefPtr<Gtk::TreeStore> _model;
|
||||
|
||||
bool _no_redisplay;
|
||||
|
||||
typedef boost::unordered_map<boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::iterator> RegionRowMap;
|
||||
|
||||
RegionRowMap region_row_map;
|
||||
|
||||
PBD::ScopedConnection region_property_connection;
|
||||
PBD::ScopedConnection check_new_region_connection;
|
||||
|
||||
PBD::ScopedConnection editor_freeze_connection;
|
||||
PBD::ScopedConnection editor_thaw_connection;
|
||||
};
|
||||
|
||||
#endif /* __gtk_ardour_editor_regions_h__ */
|
||||
|
|
|
|||
|
|
@ -16,51 +16,32 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "pbd/basename.h"
|
||||
#include "pbd/enumwriter.h"
|
||||
#include "pbd/file_utils.h"
|
||||
|
||||
#include "ardour/audioregion.h"
|
||||
#include "ardour/source.h"
|
||||
#include "ardour/audiofilesource.h"
|
||||
#include "ardour/silentfilesource.h"
|
||||
#include "ardour/smf_source.h"
|
||||
#include "ardour/region_factory.h"
|
||||
#include "ardour/session.h"
|
||||
#include "ardour/session_directory.h"
|
||||
#include "ardour/profile.h"
|
||||
|
||||
#include "gtkmm2ext/treeutils.h"
|
||||
#include "gtkmm2ext/utils.h"
|
||||
#include "ardour/smf_source.h"
|
||||
#include "ardour/source.h"
|
||||
|
||||
#include "widgets/choice.h"
|
||||
#include "widgets/tooltips.h"
|
||||
|
||||
#include "audio_clock.h"
|
||||
#include "context_menu_helper.h"
|
||||
#include "editor.h"
|
||||
#include "editing.h"
|
||||
#include "editing_convert.h"
|
||||
#include "keyboard.h"
|
||||
#include "ardour_ui.h"
|
||||
#include "gui_thread.h"
|
||||
#include "actions.h"
|
||||
#include "region_view.h"
|
||||
#include "utils.h"
|
||||
#include "editor.h"
|
||||
#include "editor_drag.h"
|
||||
#include "main_clock.h"
|
||||
#include "editor_sources.h"
|
||||
#include "gui_thread.h"
|
||||
#include "keyboard.h"
|
||||
#include "region_view.h"
|
||||
#include "ui_config.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "pbd/i18n.h"
|
||||
|
||||
#include "editor_sources.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ARDOUR;
|
||||
using namespace ArdourWidgets;
|
||||
|
|
@ -68,170 +49,14 @@ using namespace ARDOUR_UI_UTILS;
|
|||
using namespace PBD;
|
||||
using namespace Gtk;
|
||||
using namespace Glib;
|
||||
using namespace Editing;
|
||||
using Gtkmm2ext::Keyboard;
|
||||
|
||||
struct ColumnInfo {
|
||||
int index;
|
||||
const char* label;
|
||||
const char* tooltip;
|
||||
};
|
||||
|
||||
EditorSources::EditorSources (Editor* e)
|
||||
: EditorComponent (e)
|
||||
, old_focus (0)
|
||||
, tags_editable (0)
|
||||
, name_editable (0)
|
||||
{
|
||||
_display.set_size_request (100, -1);
|
||||
_display.set_rules_hint (true);
|
||||
_display.set_name ("SourcesList");
|
||||
_display.set_fixed_height_mode (true);
|
||||
|
||||
/* Try to prevent single mouse presses from initiating edits.
|
||||
This relies on a hack in gtktreeview.c:gtk_treeview_button_press()
|
||||
*/
|
||||
_display.set_data ("mouse-edits-require-mod1", (gpointer) 0x1);
|
||||
|
||||
_model = TreeStore::create (_columns);
|
||||
_model->set_sort_column (0, SORT_ASCENDING);
|
||||
|
||||
/* column widths */
|
||||
int bbt_width, date_width, chan_width, height;
|
||||
|
||||
Glib::RefPtr<Pango::Layout> layout = _display.create_pango_layout (X_("000|000|000"));
|
||||
Gtkmm2ext::get_pixel_size (layout, bbt_width, height);
|
||||
|
||||
Glib::RefPtr<Pango::Layout> layout2 = _display.create_pango_layout (X_("2018-10-14 12:12:30"));
|
||||
Gtkmm2ext::get_pixel_size (layout2, date_width, height);
|
||||
|
||||
Glib::RefPtr<Pango::Layout> layout3 = _display.create_pango_layout (X_("Chans "));
|
||||
Gtkmm2ext::get_pixel_size (layout3, chan_width, height);
|
||||
|
||||
TreeViewColumn* col_name = manage (new TreeViewColumn ("", _columns.name));
|
||||
col_name->set_fixed_width (bbt_width*2);
|
||||
col_name->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
||||
col_name->set_sort_column(0);
|
||||
|
||||
TreeViewColumn* col_chans = manage (new TreeViewColumn ("", _columns.channels));
|
||||
col_chans->set_fixed_width (chan_width);
|
||||
col_chans->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
||||
col_chans->set_sort_column(1);
|
||||
|
||||
TreeViewColumn* captd_for = manage (new TreeViewColumn ("", _columns.captd_for));
|
||||
captd_for->set_fixed_width (date_width);
|
||||
captd_for->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
||||
captd_for->set_sort_column(2);
|
||||
|
||||
TreeViewColumn* col_tags = manage (new TreeViewColumn ("", _columns.tags));
|
||||
col_tags->set_fixed_width (date_width);
|
||||
col_tags->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
||||
col_tags->set_sort_column(3);
|
||||
|
||||
TreeViewColumn* col_take_id = manage (new TreeViewColumn ("", _columns.take_id));
|
||||
col_take_id->set_fixed_width (date_width);
|
||||
col_take_id->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
||||
col_take_id->set_sort_column(4);
|
||||
|
||||
TreeViewColumn* col_nat_pos = manage (new TreeViewColumn ("", _columns.natural_pos));
|
||||
col_nat_pos->set_fixed_width (bbt_width);
|
||||
col_nat_pos->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
||||
col_nat_pos->set_sort_column(9);
|
||||
|
||||
TreeViewColumn* col_path = manage (new TreeViewColumn ("", _columns.path));
|
||||
col_path->set_fixed_width (bbt_width);
|
||||
col_path->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
||||
col_path->set_sort_column(6);
|
||||
|
||||
TreeViewColumn* captd_xruns = manage (new TreeViewColumn ("", _columns.captd_xruns));
|
||||
captd_xruns->set_fixed_width (chan_width * 1.25);
|
||||
captd_xruns->set_sizing (TREE_VIEW_COLUMN_FIXED);
|
||||
captd_xruns->set_sort_column(10);
|
||||
|
||||
_display.append_column (*col_name);
|
||||
_display.append_column (*col_chans);
|
||||
_display.append_column (*captd_for);
|
||||
_display.append_column (*captd_xruns);
|
||||
_display.append_column (*col_tags);
|
||||
_display.append_column (*col_take_id);
|
||||
_display.append_column (*col_nat_pos);
|
||||
_display.append_column (*col_path);
|
||||
|
||||
TreeViewColumn* col;
|
||||
Gtk::Label* l;
|
||||
|
||||
ColumnInfo ci[] = {
|
||||
{ 0, _("Name"), _("Region name") },
|
||||
{ 1, _("# Ch"), _("# Channels") },
|
||||
{ 2, _("Captured For"), _("Original Track this was recorded on") },
|
||||
{ 3, _("# Xruns"), _("Number of dropouts that occured during recording") },
|
||||
{ 4, _("Tags"), _("Tags") },
|
||||
{ 5, _("Take ID"), _("Take ID") },
|
||||
{ 6, _("Orig Pos"), _("Original Position of the file on timeline, when it was recorded") },
|
||||
{ 7, _("Path"), _("Path (folder) of the file location") },
|
||||
{ -1, 0, 0 }
|
||||
};
|
||||
|
||||
/* make Name and Path columns manually resizable */
|
||||
|
||||
_display.get_column (0)->set_resizable (true);
|
||||
_display.get_column (5)->set_resizable (true);
|
||||
|
||||
for (int i = 0; ci[i].index >= 0; ++i) {
|
||||
col = _display.get_column (ci[i].index);
|
||||
l = manage (new Label (ci[i].label));
|
||||
set_tooltip (*l, ci[i].tooltip);
|
||||
col->set_widget (*l);
|
||||
l->show ();
|
||||
}
|
||||
_display.set_model (_model);
|
||||
|
||||
_display.set_headers_visible (true);
|
||||
_display.set_rules_hint ();
|
||||
|
||||
if (UIConfiguration::instance ().get_use_tooltips ()) {
|
||||
/* show path as the row tooltip */
|
||||
_display.set_tooltip_column (6); /* path */
|
||||
}
|
||||
|
||||
/* set the color of the name field */
|
||||
TreeViewColumn* tv_col = _display.get_column(0);
|
||||
CellRendererText* renderer = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (0));
|
||||
tv_col->add_attribute(renderer->property_text(), _columns.name);
|
||||
tv_col->add_attribute(renderer->property_foreground_gdk(), _columns.color_);
|
||||
|
||||
/* Name cell: make editable */
|
||||
CellRendererText* region_name_cell = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (0));
|
||||
region_name_cell->property_editable() = true;
|
||||
region_name_cell->signal_edited().connect (sigc::mem_fun (*this, &EditorSources::name_edit));
|
||||
region_name_cell->signal_editing_started().connect (sigc::mem_fun (*this, &EditorSources::name_editing_started));
|
||||
|
||||
/* Tags cell: make editable */
|
||||
CellRendererText* region_tags_cell = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (4));
|
||||
region_tags_cell->property_editable() = true;
|
||||
region_tags_cell->signal_edited().connect (sigc::mem_fun (*this, &EditorSources::tag_edit));
|
||||
region_tags_cell->signal_editing_started().connect (sigc::mem_fun (*this, &EditorSources::tag_editing_started));
|
||||
|
||||
/* right-align the Natural Pos column */
|
||||
TreeViewColumn* nat_col = _display.get_column(6);
|
||||
nat_col->set_alignment (ALIGN_RIGHT);
|
||||
renderer = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (6));
|
||||
if (renderer) {
|
||||
renderer->property_xalign() = 1.0;
|
||||
}
|
||||
|
||||
/* the PATH field should expand when the pane is opened wider */
|
||||
tv_col = _display.get_column(7);
|
||||
renderer = dynamic_cast<CellRendererText*>(_display.get_column_cell_renderer (7));
|
||||
tv_col->add_attribute(renderer->property_text(), _columns.path);
|
||||
tv_col->set_expand (true);
|
||||
|
||||
_display.get_selection()->set_mode (SELECTION_MULTIPLE);
|
||||
_display.add_object_drag (_columns.region.index (), "x-ardour/region.esl", TARGET_SAME_APP);
|
||||
_display.set_drag_column (_columns.name.index());
|
||||
|
||||
/* setup DnD handling */
|
||||
init ();
|
||||
|
||||
/* setup DnD Receive */
|
||||
list<TargetEntry> source_list_target_table;
|
||||
|
||||
source_list_target_table.push_back (TargetEntry ("text/plain"));
|
||||
|
|
@ -241,342 +66,60 @@ EditorSources::EditorSources (Editor* e)
|
|||
_display.add_drop_targets (source_list_target_table);
|
||||
_display.signal_drag_data_received ().connect (sigc::mem_fun (*this, &EditorSources::drag_data_received));
|
||||
|
||||
_scroller.add (_display);
|
||||
_scroller.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC);
|
||||
|
||||
_display.signal_button_press_event().connect (sigc::mem_fun(*this, &EditorSources::button_press), false);
|
||||
_change_connection = _display.get_selection ()->signal_changed ().connect (sigc::mem_fun (*this, &EditorSources::selection_changed));
|
||||
|
||||
_scroller.signal_key_press_event().connect (sigc::mem_fun(*this, &EditorSources::key_press), false);
|
||||
_scroller.signal_focus_in_event().connect (sigc::mem_fun (*this, &EditorSources::focus_in), false);
|
||||
_scroller.signal_focus_out_event().connect (sigc::mem_fun (*this, &EditorSources::focus_out));
|
||||
|
||||
_display.signal_enter_notify_event().connect (sigc::mem_fun (*this, &EditorSources::enter_notify), false);
|
||||
_display.signal_leave_notify_event().connect (sigc::mem_fun (*this, &EditorSources::leave_notify), false);
|
||||
|
||||
ARDOUR_UI::instance()->primary_clock->mode_changed.connect (sigc::mem_fun(*this, &EditorSources::clock_format_changed));
|
||||
|
||||
e->EditorFreeze.connect (editor_freeze_connection, MISSING_INVALIDATOR, boost::bind (&EditorSources::freeze_tree_model, this), gui_context());
|
||||
e->EditorThaw.connect (editor_thaw_connection, MISSING_INVALIDATOR, boost::bind (&EditorSources::thaw_tree_model, this), gui_context());
|
||||
}
|
||||
|
||||
bool
|
||||
EditorSources::focus_in (GdkEventFocus*)
|
||||
{
|
||||
Window* win = dynamic_cast<Window*> (_scroller.get_toplevel ());
|
||||
|
||||
if (win) {
|
||||
old_focus = win->get_focus ();
|
||||
} else {
|
||||
old_focus = 0;
|
||||
}
|
||||
|
||||
tags_editable = 0;
|
||||
name_editable = 0;
|
||||
|
||||
/* try to do nothing on focus in (doesn't work, hence selection_count nonsense) */
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
EditorSources::focus_out (GdkEventFocus*)
|
||||
{
|
||||
if (old_focus) {
|
||||
old_focus->grab_focus ();
|
||||
old_focus = 0;
|
||||
}
|
||||
|
||||
tags_editable = 0;
|
||||
name_editable = 0;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
EditorSources::enter_notify (GdkEventCrossing*)
|
||||
{
|
||||
if (tags_editable || name_editable) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Keyboard::magic_widget_grab_focus ();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
EditorSources::leave_notify (GdkEventCrossing*)
|
||||
{
|
||||
if (old_focus) {
|
||||
old_focus->grab_focus ();
|
||||
old_focus = 0;
|
||||
}
|
||||
|
||||
Keyboard::magic_widget_drop_focus ();
|
||||
return false;
|
||||
e->EditorFreeze.connect (_editor_freeze_connection, MISSING_INVALIDATOR, boost::bind (&EditorSources::freeze_tree_model, this), gui_context ());
|
||||
e->EditorThaw.connect (_editor_thaw_connection, MISSING_INVALIDATOR, boost::bind (&EditorSources::thaw_tree_model, this), gui_context ());
|
||||
}
|
||||
|
||||
void
|
||||
EditorSources::set_session (ARDOUR::Session* s)
|
||||
EditorSources::init ()
|
||||
{
|
||||
SessionHandlePtr::set_session (s);
|
||||
int bbt_width, date_width, height;
|
||||
|
||||
if (s) {
|
||||
ARDOUR::Region::RegionsPropertyChanged.connect (source_property_connection, MISSING_INVALIDATOR, boost::bind (&EditorSources::regions_changed, this, _1, _2), gui_context ());
|
||||
Glib::RefPtr<Pango::Layout> layout = _display.create_pango_layout (X_("000|000|000"));
|
||||
Gtkmm2ext::get_pixel_size (layout, bbt_width, height);
|
||||
Glib::RefPtr<Pango::Layout> layout2 = _display.create_pango_layout (X_("2018-10-14 12:12:30"));
|
||||
Gtkmm2ext::get_pixel_size (layout2, date_width, height);
|
||||
|
||||
ARDOUR::RegionFactory::CheckNewRegion.connect (add_source_connection, MISSING_INVALIDATOR, boost::bind (&EditorSources::add_source, this, _1), gui_context());
|
||||
add_name_column ();
|
||||
|
||||
s->SourceRemoved.connect (remove_source_connection, MISSING_INVALIDATOR, boost::bind (&EditorSources::remove_weak_source, this, _1), gui_context());
|
||||
setup_col (append_col (_columns.channels, "Chans "), 1, ALIGN_LEFT, _("# Ch"), _("# Channels in the region"));
|
||||
setup_col (append_col (_columns.captd_for, date_width), 17, ALIGN_LEFT, _("Captured For"), _("Original Track this was recorded on"));
|
||||
setup_col (append_col (_columns.captd_xruns, "1234567890"), 21, ALIGN_RIGHT, _("# Xruns"), _("Number of dropouts that occured during recording"));
|
||||
|
||||
redisplay();
|
||||
add_tag_column ();
|
||||
|
||||
} else {
|
||||
source_property_connection.disconnect ();
|
||||
add_source_connection.disconnect ();
|
||||
remove_source_connection.disconnect ();
|
||||
clear();
|
||||
}
|
||||
}
|
||||
setup_col (append_col (_columns.take_id, date_width), 18, ALIGN_LEFT, _("Take ID"), _("Take ID"));
|
||||
setup_col (append_col (_columns.natural_pos, bbt_width), 20, ALIGN_RIGHT, _("Orig Pos"), _("Original Position of the file on timeline, when it was recorded"));
|
||||
|
||||
void
|
||||
EditorSources::remove_weak_source (boost::weak_ptr<ARDOUR::Source> src)
|
||||
{
|
||||
boost::shared_ptr<ARDOUR::Source> source = src.lock();
|
||||
if (source) {
|
||||
remove_source (source);
|
||||
}
|
||||
}
|
||||
TreeViewColumn* tvc = append_col (_columns.path, bbt_width);
|
||||
setup_col (tvc, 13, ALIGN_LEFT, _("Path"), _("Path (folder) of the file location"));
|
||||
tvc->set_expand (true);
|
||||
|
||||
void
|
||||
EditorSources::remove_source (boost::shared_ptr<ARDOUR::Source> source)
|
||||
{
|
||||
TreeModel::iterator i;
|
||||
TreeModel::Children rows = _model->children();
|
||||
for (i = rows.begin(); i != rows.end(); ++i) {
|
||||
boost::shared_ptr<ARDOUR::Region> rr = (*i)[_columns.region];
|
||||
if (rr->source() == source) {
|
||||
_model->erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EditorSources::remove_weak_region (boost::weak_ptr<ARDOUR::Region> r)
|
||||
{
|
||||
boost::shared_ptr<ARDOUR::Region> region = r.lock();
|
||||
if (!region) {
|
||||
return;
|
||||
}
|
||||
TreeModel::Children rows = _model->children();
|
||||
for (TreeModel::iterator i = rows.begin(); i != rows.end(); ++i) {
|
||||
boost::shared_ptr<ARDOUR::Region> rr = (*i)[_columns.region];
|
||||
if (rr == region) {
|
||||
_model->erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EditorSources::populate_row (TreeModel::Row row, boost::shared_ptr<ARDOUR::Region> region)
|
||||
{
|
||||
ENSURE_GUI_THREAD (*this, &ARDOUR_UI::record_state_changed, row, region);
|
||||
|
||||
if (!region) {
|
||||
return;
|
||||
}
|
||||
|
||||
boost::shared_ptr<ARDOUR::Source> source = region->source(); // ToDo: is it OK to use only the first source?
|
||||
|
||||
/* COLOR (for missing files) */
|
||||
Gdk::Color c;
|
||||
bool missing_source = boost::dynamic_pointer_cast<SilentFileSource>(source) != NULL;
|
||||
if (missing_source) {
|
||||
set_color_from_rgba (c, UIConfiguration::instance().color ("region list missing source"));
|
||||
} else {
|
||||
set_color_from_rgba (c, UIConfiguration::instance().color ("region list whole file"));
|
||||
}
|
||||
row[_columns.color_] = c;
|
||||
|
||||
/* NAME */
|
||||
row[_columns.name] = region->name();
|
||||
|
||||
/* N CHANNELS */
|
||||
if (region->data_type() == DataType::MIDI) {
|
||||
row[_columns.channels] = 0; /*TODO: some better recognition of midi regions*/
|
||||
} else {
|
||||
row[_columns.channels] = region->sources().size();
|
||||
}
|
||||
|
||||
/* CAPTURED FOR */
|
||||
row[_columns.captd_for] = source->captured_for();
|
||||
|
||||
/* CAPTURED DROPOUTS */
|
||||
row[_columns.captd_xruns] = source->n_captured_xruns();
|
||||
|
||||
/* TAGS */
|
||||
row[_columns.tags] = region->tags();
|
||||
|
||||
row[_columns.region] = region;
|
||||
row[_columns.take_id] = source->take_id();
|
||||
|
||||
/* PATH */
|
||||
string pathstr = source->name();
|
||||
if (missing_source) {
|
||||
pathstr = _("(MISSING) ") + Gtkmm2ext::markup_escape_text (source->name());
|
||||
} else {
|
||||
/* is it a file? */
|
||||
boost::shared_ptr<FileSource> fs = boost::dynamic_pointer_cast<FileSource>(source);
|
||||
if (!fs) {
|
||||
pathstr = Gtkmm2ext::markup_escape_text (source->name()); // someday: sequence region(?)
|
||||
} else {
|
||||
/* audio file? */
|
||||
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource>(source);
|
||||
if (afs) {
|
||||
const string audio_directory = _session->session_directory().sound_path();
|
||||
if (!PBD::path_is_within(audio_directory, fs->path())) {
|
||||
pathstr = Gtkmm2ext::markup_escape_text (fs->path());
|
||||
}
|
||||
}
|
||||
/* midi file? */
|
||||
boost::shared_ptr<SMFSource> mfs = boost::dynamic_pointer_cast<SMFSource>(source);
|
||||
if (mfs) {
|
||||
const string midi_directory = _session->session_directory().midi_path();
|
||||
if (!PBD::path_is_within(midi_directory, fs->path())) {
|
||||
pathstr = Gtkmm2ext::markup_escape_text (fs->path());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
row[_columns.path] = pathstr;
|
||||
|
||||
/* Natural Position (samples, an invisible column for sorting) */
|
||||
row[_columns.natural_s] = source->natural_position();
|
||||
|
||||
/* Natural Position (text representation) */
|
||||
if (source->have_natural_position()) {
|
||||
char buf[64];
|
||||
format_position (source->natural_position(), buf, sizeof (buf));
|
||||
row[_columns.natural_pos] = buf;
|
||||
} else {
|
||||
row[_columns.natural_pos] = X_("--");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EditorSources::redisplay ()
|
||||
{
|
||||
remove_region_connections.drop_connections ();
|
||||
_display.set_model (Glib::RefPtr<Gtk::TreeStore>(0));
|
||||
_model->clear ();
|
||||
_model->set_sort_column (-2, SORT_ASCENDING); // Disable sorting to gain performance
|
||||
|
||||
/* Ask the region factory to fill our list of whole-file regions */
|
||||
RegionFactory::foreach_region (sigc::mem_fun (*this, &EditorSources::add_source));
|
||||
|
||||
_model->set_sort_column (0, SORT_ASCENDING); // re-enable sorting
|
||||
_display.set_model (_model);
|
||||
}
|
||||
|
||||
void
|
||||
EditorSources::add_source (boost::shared_ptr<ARDOUR::Region> region)
|
||||
{
|
||||
if (!region || !_session) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* by definition, the Source List only shows whole-file regions
|
||||
* this roughly equates to Source objects, but preserves the stereo-ness
|
||||
* (or multichannel-ness) of a stereo source file.
|
||||
*/
|
||||
if (!region->whole_file ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* we only show files-on-disk.
|
||||
* if there's some other kind of source, we ignore it (for now)
|
||||
*/
|
||||
boost::shared_ptr<FileSource> fs = boost::dynamic_pointer_cast<FileSource> (region->source());
|
||||
if (!fs) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fs->empty()) {
|
||||
/* MIDI sources are allowed to be empty */
|
||||
if (!boost::dynamic_pointer_cast<MidiSource> (region->source())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
region->DropReferences.connect (remove_region_connections, MISSING_INVALIDATOR, boost::bind (&EditorSources::remove_weak_region, this, boost::weak_ptr<Region> (region)), gui_context());
|
||||
|
||||
PropertyChange pc;
|
||||
boost::shared_ptr<RegionList> rl (new RegionList);
|
||||
rl->push_back (region);
|
||||
regions_changed (rl, pc);
|
||||
}
|
||||
|
||||
void
|
||||
EditorSources::regions_changed (boost::shared_ptr<ARDOUR::RegionList> rl, PBD::PropertyChange const &)
|
||||
{
|
||||
bool freeze = rl->size () > 2;
|
||||
if (freeze) {
|
||||
freeze_tree_model ();
|
||||
}
|
||||
|
||||
for (RegionList::const_iterator r = rl->begin (); r != rl->end(); ++r) {
|
||||
boost::shared_ptr<Region> region = *r;
|
||||
|
||||
if (!region->whole_file ()) {
|
||||
/*this isn't on our list anyway; we can ignore it*/
|
||||
break;
|
||||
}
|
||||
|
||||
TreeModel::iterator i;
|
||||
TreeModel::Children rows = _model->children();
|
||||
|
||||
for (i = rows.begin(); i != rows.end(); ++i) {
|
||||
boost::shared_ptr<ARDOUR::Region> rr = (*i)[_columns.region];
|
||||
if (region == rr) {
|
||||
populate_row(*i, region);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == rows.end()) {
|
||||
TreeModel::Row row = *(_model->append());
|
||||
populate_row (row, region);
|
||||
}
|
||||
}
|
||||
|
||||
if (freeze) {
|
||||
thaw_tree_model ();
|
||||
}
|
||||
/* make Name and Path columns manually resizable */
|
||||
_display.get_column (0)->set_resizable (true);
|
||||
_display.get_column (5)->set_resizable (true);
|
||||
}
|
||||
|
||||
void
|
||||
EditorSources::selection_changed ()
|
||||
{
|
||||
|
||||
if (_display.get_selection ()->count_selected_rows () > 0) {
|
||||
|
||||
TreeIter iter;
|
||||
TreeView::Selection::ListHandle_Path rows = _display.get_selection ()->get_selected_rows ();
|
||||
|
||||
_editor->get_selection ().clear_regions ();
|
||||
|
||||
for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin (); i != rows.end (); ++i) {
|
||||
|
||||
if ((iter = _model->get_iter (*i))) {
|
||||
|
||||
/* highlight any regions in the editor that use this region's source */
|
||||
boost::shared_ptr<ARDOUR::Region> region = (*iter)[_columns.region];
|
||||
if (!region) continue;
|
||||
if (!region)
|
||||
continue;
|
||||
|
||||
boost::shared_ptr<ARDOUR::Source> source = region->source ();
|
||||
if (source) {
|
||||
|
||||
set<boost::shared_ptr<Region>> regions;
|
||||
RegionFactory::get_regions_using_source (source, regions);
|
||||
|
||||
|
|
@ -584,7 +127,6 @@ EditorSources::selection_changed ()
|
|||
_change_connection.block (true);
|
||||
_editor->set_selected_regionview_from_region_list (*region, Selection::Add);
|
||||
_change_connection.block (false);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -592,87 +134,6 @@ EditorSources::selection_changed ()
|
|||
} else {
|
||||
_editor->get_selection ().clear_regions ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
EditorSources::clock_format_changed ()
|
||||
{
|
||||
TreeModel::iterator i;
|
||||
TreeModel::Children rows = _model->children();
|
||||
for (i = rows.begin(); i != rows.end(); ++i) {
|
||||
boost::shared_ptr<ARDOUR::Region> rr = (*i)[_columns.region];
|
||||
populate_row(*i, rr);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EditorSources::format_position (timepos_t const & pos, char* buf, size_t bufsize, bool onoff)
|
||||
{
|
||||
Temporal::BBT_Time bbt;
|
||||
Timecode::Time timecode;
|
||||
|
||||
if (pos.is_negative ()) {
|
||||
error << string_compose (_("EditorSources::format_position: negative timecode position: %1"), pos) << endmsg;
|
||||
snprintf (buf, bufsize, "invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (ARDOUR_UI::instance()->primary_clock->mode ()) {
|
||||
case AudioClock::BBT:
|
||||
bbt = Temporal::TempoMap::use()->bbt_at (pos);
|
||||
if (onoff) {
|
||||
snprintf (buf, bufsize, "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks);
|
||||
} else {
|
||||
snprintf (buf, bufsize, "(%03d|%02d|%04d)" , bbt.bars, bbt.beats, bbt.ticks);
|
||||
}
|
||||
break;
|
||||
|
||||
case AudioClock::MinSec:
|
||||
samplepos_t left;
|
||||
int hrs;
|
||||
int mins;
|
||||
float secs;
|
||||
|
||||
left = pos.samples();
|
||||
hrs = (int) floor (left / (_session->sample_rate() * 60.0f * 60.0f));
|
||||
left -= (samplecnt_t) floor (hrs * _session->sample_rate() * 60.0f * 60.0f);
|
||||
mins = (int) floor (left / (_session->sample_rate() * 60.0f));
|
||||
left -= (samplecnt_t) floor (mins * _session->sample_rate() * 60.0f);
|
||||
secs = left / (float) _session->sample_rate();
|
||||
if (onoff) {
|
||||
snprintf (buf, bufsize, "%02d:%02d:%06.3f", hrs, mins, secs);
|
||||
} else {
|
||||
snprintf (buf, bufsize, "(%02d:%02d:%06.3f)", hrs, mins, secs);
|
||||
}
|
||||
break;
|
||||
|
||||
case AudioClock::Seconds:
|
||||
if (onoff) {
|
||||
snprintf (buf, bufsize, "%.1f", pos.samples() / (float)_session->sample_rate());
|
||||
} else {
|
||||
snprintf (buf, bufsize, "(%.1f)", pos.samples() / (float)_session->sample_rate());
|
||||
}
|
||||
break;
|
||||
|
||||
case AudioClock::Samples:
|
||||
if (onoff) {
|
||||
snprintf (buf, bufsize, "%" PRId64, pos.samples());
|
||||
} else {
|
||||
snprintf (buf, bufsize, "(%" PRId64 ")", pos.samples());
|
||||
}
|
||||
break;
|
||||
|
||||
case AudioClock::Timecode:
|
||||
default:
|
||||
_session->timecode_time (pos.samples(), timecode);
|
||||
if (onoff) {
|
||||
snprintf (buf, bufsize, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
||||
} else {
|
||||
snprintf (buf, bufsize, "(%02d:%02d:%02d:%02d)", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -696,7 +157,6 @@ EditorSources::recover_selected_sources ()
|
|||
ARDOUR::RegionList to_be_recovered;
|
||||
|
||||
if (_display.get_selection ()->count_selected_rows () > 0) {
|
||||
|
||||
TreeIter iter;
|
||||
TreeView::Selection::ListHandle_Path rows = _display.get_selection ()->get_selected_rows ();
|
||||
for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin (); i != rows.end (); ++i) {
|
||||
|
|
@ -732,23 +192,20 @@ EditorSources::remove_selected_sources ()
|
|||
int opt = prompter.run ();
|
||||
|
||||
if (opt >= 1) {
|
||||
|
||||
std::list<boost::weak_ptr<ARDOUR::Source>> to_be_removed;
|
||||
|
||||
if (_display.get_selection ()->count_selected_rows () > 0) {
|
||||
|
||||
TreeIter iter;
|
||||
TreeView::Selection::ListHandle_Path rows = _display.get_selection ()->get_selected_rows ();
|
||||
|
||||
_editor->get_selection ().clear_regions ();
|
||||
|
||||
for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin (); i != rows.end (); ++i) {
|
||||
|
||||
if ((iter = _model->get_iter (*i))) {
|
||||
|
||||
boost::shared_ptr<ARDOUR::Region> region = (*iter)[_columns.region];
|
||||
|
||||
if (!region) continue;
|
||||
if (!region)
|
||||
continue;
|
||||
|
||||
boost::shared_ptr<ARDOUR::Source> source = region->source ();
|
||||
if (source) {
|
||||
|
|
@ -764,7 +221,6 @@ EditorSources::remove_selected_sources ()
|
|||
to_be_removed.push_back (source);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_editor->remove_regions (_editor->get_regions_from_selection_and_entered (), false /*can_ripple*/, false /*as_part_of_other_command*/); // this operation is undo-able
|
||||
|
|
@ -776,39 +232,12 @@ EditorSources::remove_selected_sources ()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool
|
||||
EditorSources::key_press (GdkEventKey* ev)
|
||||
{
|
||||
TreeViewColumn *col;
|
||||
|
||||
switch (ev->keyval) {
|
||||
case GDK_Tab:
|
||||
case GDK_ISO_Left_Tab:
|
||||
|
||||
if (tags_editable) {
|
||||
tags_editable->editing_done ();
|
||||
tags_editable = 0;
|
||||
}
|
||||
|
||||
if (name_editable) {
|
||||
name_editable->editing_done ();
|
||||
name_editable = 0;
|
||||
}
|
||||
|
||||
col = _display.get_column (1); // select&focus on tags column
|
||||
|
||||
if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
|
||||
treeview_select_previous (_display, _model, col);
|
||||
} else {
|
||||
treeview_select_next (_display, _model, col);
|
||||
}
|
||||
|
||||
return true;
|
||||
break;
|
||||
|
||||
case GDK_BackSpace:
|
||||
remove_selected_sources ();
|
||||
return true;
|
||||
|
|
@ -817,7 +246,7 @@ EditorSources::key_press (GdkEventKey* ev)
|
|||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
return RegionListBase::key_press (ev);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -830,96 +259,6 @@ EditorSources::button_press (GdkEventButton *ev)
|
|||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
EditorSources::tag_editing_started (CellEditable* ce, const Glib::ustring& path)
|
||||
{
|
||||
tags_editable = ce;
|
||||
|
||||
/* give it a special name */
|
||||
|
||||
Gtk::Entry *e = dynamic_cast<Gtk::Entry*> (ce);
|
||||
|
||||
if (e) {
|
||||
e->set_name (X_("SourceTagEditorEntry"));
|
||||
|
||||
TreeIter iter;
|
||||
if ((iter = _model->get_iter (path))) {
|
||||
boost::shared_ptr<Region> region = (*iter)[_columns.region];
|
||||
|
||||
if(region) {
|
||||
e->set_text(region->tags());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EditorSources::tag_edit (const std::string& path, const std::string& new_text)
|
||||
{
|
||||
tags_editable = 0;
|
||||
|
||||
boost::shared_ptr<Region> region;
|
||||
TreeIter row_iter;
|
||||
|
||||
if ((row_iter = _model->get_iter (path))) {
|
||||
region = (*row_iter)[_columns.region];
|
||||
(*row_iter)[_columns.tags] = new_text;
|
||||
}
|
||||
|
||||
if (region) {
|
||||
region->set_tags (new_text);
|
||||
|
||||
_session->set_dirty(); // whole-file regions aren't in a playlist to catch property changes, so we need to explicitly set the session dirty
|
||||
|
||||
populate_row ((*row_iter), region);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EditorSources::name_editing_started (CellEditable* ce, const Glib::ustring& path)
|
||||
{
|
||||
name_editable = ce;
|
||||
|
||||
/* give it a special name */
|
||||
|
||||
Gtk::Entry *e = dynamic_cast<Gtk::Entry*> (ce);
|
||||
|
||||
if (e) {
|
||||
e->set_name (X_("SourceNameEditorEntry"));
|
||||
|
||||
TreeIter iter;
|
||||
if ((iter = _model->get_iter (path))) {
|
||||
boost::shared_ptr<Region> region = (*iter)[_columns.region];
|
||||
|
||||
if(region) {
|
||||
e->set_text(region->name());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EditorSources::name_edit (const std::string& path, const std::string& new_text)
|
||||
{
|
||||
name_editable = 0;
|
||||
|
||||
boost::shared_ptr<Region> region;
|
||||
TreeIter row_iter;
|
||||
|
||||
if ((row_iter = _model->get_iter (path))) {
|
||||
region = (*row_iter)[_columns.region];
|
||||
(*row_iter)[_columns.name] = new_text;
|
||||
}
|
||||
|
||||
if (region) {
|
||||
region->set_name (new_text);
|
||||
|
||||
_session->set_dirty(); // whole-file regions aren't in a playlist to catch property changes, so we need to explicitly set the session dirty
|
||||
|
||||
populate_row ((*row_iter), region);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EditorSources::drag_data_received (const RefPtr<Gdk::DragContext>& context,
|
||||
int x, int y,
|
||||
|
|
@ -941,39 +280,14 @@ EditorSources::drag_data_received (const RefPtr<Gdk::DragContext>& context,
|
|||
|
||||
if (UIConfiguration::instance ().get_only_copy_imported_files () || copy) {
|
||||
_editor->do_import (paths, Editing::ImportDistinctFiles, Editing::ImportAsRegion,
|
||||
SrcBest, SMFTrackName, SMFTempoIgnore, pos);
|
||||
SrcBest, SMFTrackNumber, SMFTempoIgnore, pos);
|
||||
} else {
|
||||
_editor->do_embed (paths, Editing::ImportDistinctFiles, ImportAsRegion, pos);
|
||||
_editor->do_embed (paths, Editing::ImportDistinctFiles, Editing::ImportAsRegion, pos);
|
||||
}
|
||||
context->drag_finish (true, false, dtime);
|
||||
}
|
||||
}
|
||||
|
||||
/** @return Region that has been dragged out of the list, or 0 */
|
||||
boost::shared_ptr<ARDOUR::Region>
|
||||
EditorSources::get_dragged_region ()
|
||||
{
|
||||
list<boost::shared_ptr<ARDOUR::Region> > regions;
|
||||
TreeView* region;
|
||||
_display.get_object_drag_data (regions, ®ion);
|
||||
|
||||
if (regions.empty()) {
|
||||
return boost::shared_ptr<ARDOUR::Region> ();
|
||||
}
|
||||
|
||||
assert (regions.size() == 1);
|
||||
return regions.front ();
|
||||
}
|
||||
|
||||
void
|
||||
EditorSources::clear ()
|
||||
{
|
||||
remove_region_connections.drop_connections ();
|
||||
_display.set_model (Glib::RefPtr<Gtk::TreeStore> (0));
|
||||
_model->clear ();
|
||||
_display.set_model (_model);
|
||||
}
|
||||
|
||||
boost::shared_ptr<ARDOUR::Region>
|
||||
EditorSources::get_single_selection ()
|
||||
{
|
||||
|
|
@ -995,36 +309,3 @@ EditorSources::get_single_selection ()
|
|||
|
||||
return (*iter)[_columns.region];
|
||||
}
|
||||
|
||||
void
|
||||
EditorSources::freeze_tree_model ()
|
||||
{
|
||||
/* store sort column id and type for later */
|
||||
_model->get_sort_column_id (_sort_col_id, _sort_type);
|
||||
_change_connection.block (true);
|
||||
_display.set_model (Glib::RefPtr<Gtk::TreeStore>(0));
|
||||
_model->set_sort_column (-2, SORT_ASCENDING); // Disable sorting to gain performance
|
||||
}
|
||||
|
||||
void
|
||||
EditorSources::thaw_tree_model ()
|
||||
{
|
||||
_model->set_sort_column (_sort_col_id, _sort_type); // re-enabale sorting
|
||||
_display.set_model (_model);
|
||||
_change_connection.block (false);
|
||||
}
|
||||
|
||||
XMLNode &
|
||||
EditorSources::get_state () const
|
||||
{
|
||||
XMLNode* node = new XMLNode (X_("SourcesList"));
|
||||
|
||||
//TODO: save sort state?
|
||||
|
||||
return *node;
|
||||
}
|
||||
|
||||
void
|
||||
EditorSources::set_state (const XMLNode & node)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,137 +18,29 @@
|
|||
#ifndef __gtk_ardour_editor_sources_h__
|
||||
#define __gtk_ardour_editor_sources_h__
|
||||
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
#include <gtkmm/scrolledwindow.h>
|
||||
#include <gtkmm/treemodel.h>
|
||||
#include <gtkmm/treerowreference.h>
|
||||
#include <gtkmm/treestore.h>
|
||||
|
||||
#include "editor_component.h"
|
||||
#include "source_list_base.h"
|
||||
|
||||
#include "selection.h"
|
||||
|
||||
class EditorSources : public EditorComponent, public ARDOUR::SessionHandlePtr
|
||||
class EditorSources : public EditorComponent, public SourceListBase
|
||||
{
|
||||
public:
|
||||
EditorSources (Editor*);
|
||||
|
||||
void set_session (ARDOUR::Session *);
|
||||
|
||||
Gtk::Widget& widget () {
|
||||
return _scroller;
|
||||
}
|
||||
|
||||
void clear ();
|
||||
|
||||
boost::shared_ptr<ARDOUR::Region> get_dragged_region ();
|
||||
boost::shared_ptr<ARDOUR::Region> get_single_selection ();
|
||||
|
||||
void unselect_all () {
|
||||
_display.get_selection()->unselect_all ();
|
||||
}
|
||||
|
||||
/* user actions */
|
||||
void remove_selected_sources ();
|
||||
void recover_selected_sources ();
|
||||
|
||||
XMLNode& get_state () const;
|
||||
void set_state (const XMLNode &);
|
||||
|
||||
private:
|
||||
|
||||
struct Columns : public Gtk::TreeModel::ColumnRecord {
|
||||
Columns () {
|
||||
add (name);
|
||||
add (channels);
|
||||
add (captd_for);
|
||||
add (tags);
|
||||
add (take_id);
|
||||
add (natural_pos);
|
||||
add (path);
|
||||
add (color_);
|
||||
add (region);
|
||||
add (natural_s);
|
||||
add (captd_xruns);
|
||||
}
|
||||
|
||||
Gtk::TreeModelColumn<std::string> name;
|
||||
Gtk::TreeModelColumn<int> channels;
|
||||
Gtk::TreeModelColumn<std::string> captd_for;
|
||||
Gtk::TreeModelColumn<std::string> tags;
|
||||
Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region> > region;
|
||||
Gtk::TreeModelColumn<Gdk::Color> color_;
|
||||
Gtk::TreeModelColumn<std::string> natural_pos;
|
||||
Gtk::TreeModelColumn<std::string> path;
|
||||
Gtk::TreeModelColumn<std::string> take_id;
|
||||
Gtk::TreeModelColumn<Temporal::timepos_t> natural_s;
|
||||
Gtk::TreeModelColumn<size_t> captd_xruns;
|
||||
};
|
||||
|
||||
Columns _columns;
|
||||
|
||||
Gtk::TreeModel::RowReference last_row;
|
||||
|
||||
void freeze_tree_model ();
|
||||
void thaw_tree_model ();
|
||||
void regions_changed (boost::shared_ptr<ARDOUR::RegionList>, PBD::PropertyChange const&);
|
||||
void populate_row (Gtk::TreeModel::Row row, boost::shared_ptr<ARDOUR::Region> region);
|
||||
void selection_changed ();
|
||||
|
||||
sigc::connection _change_connection;
|
||||
|
||||
int _sort_col_id;
|
||||
Gtk::SortType _sort_type;
|
||||
|
||||
Gtk::Widget* old_focus;
|
||||
|
||||
Gtk::CellEditable* tags_editable;
|
||||
void tag_editing_started (Gtk::CellEditable*, const Glib::ustring&);
|
||||
void tag_edit (const std::string&, const std::string&);
|
||||
|
||||
Gtk::CellEditable* name_editable;
|
||||
void name_editing_started (Gtk::CellEditable*, const Glib::ustring&);
|
||||
void name_edit (const std::string&, const std::string&);
|
||||
|
||||
void init ();
|
||||
bool key_press (GdkEventKey*);
|
||||
bool button_press (GdkEventButton*);
|
||||
|
||||
bool focus_in (GdkEventFocus*);
|
||||
bool focus_out (GdkEventFocus*);
|
||||
bool enter_notify (GdkEventCrossing*);
|
||||
bool leave_notify (GdkEventCrossing*);
|
||||
|
||||
void show_context_menu (int button, int time);
|
||||
|
||||
void format_position (Temporal::timepos_t const & pos, char* buf, size_t bufsize, bool onoff = true);
|
||||
void selection_changed ();
|
||||
|
||||
void add_source (boost::shared_ptr<ARDOUR::Region>);
|
||||
void remove_source (boost::shared_ptr<ARDOUR::Source>);
|
||||
void remove_weak_region (boost::weak_ptr<ARDOUR::Region>);
|
||||
void remove_weak_source (boost::weak_ptr<ARDOUR::Source>);
|
||||
|
||||
void clock_format_changed ();
|
||||
|
||||
void redisplay ();
|
||||
|
||||
void drag_data_received (
|
||||
Glib::RefPtr<Gdk::DragContext> const &, gint, gint, Gtk::SelectionData const &, guint, guint
|
||||
);
|
||||
|
||||
Gtk::ScrolledWindow _scroller;
|
||||
|
||||
Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region> > _display;
|
||||
|
||||
Glib::RefPtr<Gtk::TreeStore> _model;
|
||||
|
||||
PBD::ScopedConnection source_property_connection;
|
||||
PBD::ScopedConnection add_source_connection;
|
||||
PBD::ScopedConnection remove_source_connection;
|
||||
PBD::ScopedConnectionList remove_region_connections;
|
||||
|
||||
PBD::ScopedConnection editor_freeze_connection;
|
||||
PBD::ScopedConnection editor_thaw_connection;
|
||||
void drag_data_received (Glib::RefPtr<Gdk::DragContext> const&, gint, gint, Gtk::SelectionData const&, guint, guint);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -167,6 +167,8 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Item& parent, guint3
|
|||
* \ |
|
||||
* MH,MH
|
||||
*
|
||||
* Cue:
|
||||
* ben: put your shape here :)
|
||||
*/
|
||||
|
||||
switch (type) {
|
||||
|
|
@ -268,6 +270,20 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Item& parent, guint3
|
|||
_label_offset = 0.0;
|
||||
break;
|
||||
|
||||
case Cue:
|
||||
/* ben: new shape needed here */
|
||||
points = new ArdourCanvas::Points ();
|
||||
|
||||
points->push_back (ArdourCanvas::Duple (0.0, 0.0));
|
||||
points->push_back (ArdourCanvas::Duple ( M6, 0.0));
|
||||
points->push_back (ArdourCanvas::Duple ( M6, MH * .4));
|
||||
points->push_back (ArdourCanvas::Duple ( M3, MH));
|
||||
points->push_back (ArdourCanvas::Duple (0.0, MH * .4));
|
||||
points->push_back (ArdourCanvas::Duple (0.0, 0.0));
|
||||
|
||||
_shift = 3;
|
||||
_label_offset = 10.0;
|
||||
break;
|
||||
}
|
||||
|
||||
_position = pos;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,8 @@ public:
|
|||
LoopEnd,
|
||||
PunchIn,
|
||||
PunchOut,
|
||||
RegionCue
|
||||
RegionCue,
|
||||
Cue
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ const int PublicEditor::horizontal_spacing = 6;
|
|||
|
||||
sigc::signal<void> PublicEditor::DropDownKeys;
|
||||
|
||||
ARDOUR::DataType PublicEditor::pbdid_dragged_dt = ARDOUR::DataType::NIL;
|
||||
|
||||
PublicEditor::PublicEditor (Gtk::Widget& content)
|
||||
: Tabbable (content, _("Editor"), X_("editor"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -203,9 +203,6 @@ public:
|
|||
*/
|
||||
virtual void consider_auditioning (boost::shared_ptr<ARDOUR::Region> r) = 0;
|
||||
|
||||
/* Editor::_regions DnD */
|
||||
virtual boost::shared_ptr<ARDOUR::Region> get_dragged_region_from_sidebar () = 0;
|
||||
|
||||
/* import dialogs -> ardour-ui ?! */
|
||||
virtual void external_audio_dialog () = 0;
|
||||
virtual void session_import_dialog () = 0;
|
||||
|
|
@ -428,6 +425,9 @@ public:
|
|||
: action (a), target (tgt) {}
|
||||
};
|
||||
|
||||
/* data-type of [region] object currently dragged with x-ardour/region.pbdid */
|
||||
static ARDOUR::DataType pbdid_dragged_dt;
|
||||
|
||||
std::map<std::string,RegionAction> region_action_map;
|
||||
|
||||
Glib::RefPtr<Gtk::ActionGroup> editor_actions;
|
||||
|
|
|
|||
937
gtk2_ardour/region_list_base.cc
Normal file
937
gtk2_ardour/region_list_base.cc
Normal file
|
|
@ -0,0 +1,937 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
|
||||
* Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
|
||||
* Copyright (C) 2009-2018 Paul Davis <paul@linuxaudiosystems.com>
|
||||
* Copyright (C) 2013-2021 Robin Gareus <robin@gareus.org>
|
||||
* Copyright (C) 2015-2016 Tim Mayberry <mojofunk@gmail.com>
|
||||
* Copyright (C) 2016 Nick Mainsbridge <mainsbridge@gmail.com>
|
||||
* Copyright (C) 2018-2019 Ben Loftis <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.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
#include "pbd/file_utils.h"
|
||||
|
||||
#include "ardour/audiofilesource.h"
|
||||
#include "ardour/audioregion.h"
|
||||
#include "ardour/midi_source.h"
|
||||
#include "ardour/region_factory.h"
|
||||
#include "ardour/session.h"
|
||||
#include "ardour/session_directory.h"
|
||||
#include "ardour/session_playlist.h"
|
||||
#include "ardour/silentfilesource.h"
|
||||
#include "ardour/smf_source.h"
|
||||
|
||||
#include "gtkmm2ext/treeutils.h"
|
||||
#include "gtkmm2ext/utils.h"
|
||||
|
||||
#include "widgets/tooltips.h"
|
||||
|
||||
#include "actions.h"
|
||||
#include "ardour_ui.h"
|
||||
#include "audio_clock.h"
|
||||
#include "gui_thread.h"
|
||||
#include "keyboard.h"
|
||||
#include "main_clock.h"
|
||||
#include "public_editor.h"
|
||||
#include "region_list_base.h"
|
||||
#include "ui_config.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "pbd/i18n.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace ARDOUR;
|
||||
using namespace ARDOUR_UI_UTILS;
|
||||
using namespace PBD;
|
||||
using namespace Gtk;
|
||||
using namespace Temporal;
|
||||
|
||||
using Gtkmm2ext::Keyboard;
|
||||
|
||||
RegionListBase::RegionListBase ()
|
||||
: _name_editable (0)
|
||||
, _tags_editable (0)
|
||||
, _old_focus (0)
|
||||
, _no_redisplay (false)
|
||||
{
|
||||
_display.set_size_request (100, -1);
|
||||
_display.set_rules_hint (true);
|
||||
_display.set_name ("RegionList");
|
||||
_display.set_fixed_height_mode (true);
|
||||
_display.set_reorderable (false);
|
||||
|
||||
/* Try to prevent single mouse presses from initiating edits.
|
||||
* This relies on a hack in gtktreeview.c:gtk_treeview_button_press() */
|
||||
_display.set_data ("mouse-edits-require-mod1", (gpointer)0x1);
|
||||
|
||||
_model = TreeStore::create (_columns);
|
||||
_model->set_sort_column (0, SORT_ASCENDING);
|
||||
|
||||
_display.add_object_drag (-1, "x-ardour/region.pbdid", Gtk::TARGET_SAME_APP);
|
||||
_display.set_drag_column (_columns.name.index ());
|
||||
_display.signal_drag_begin ().connect (sigc::mem_fun (*this, &RegionListBase::drag_begin));
|
||||
_display.signal_drag_end ().connect (sigc::mem_fun (*this, &RegionListBase::drag_end));
|
||||
_display.signal_drag_data_get ().connect (sigc::mem_fun (*this, &RegionListBase::drag_data_get));
|
||||
|
||||
_display.set_model (_model);
|
||||
|
||||
_display.set_headers_visible (true);
|
||||
_display.set_rules_hint ();
|
||||
|
||||
if (UIConfiguration::instance ().get_use_tooltips ()) {
|
||||
/* show path as the row tooltip */
|
||||
_display.set_tooltip_column (13); /* path */
|
||||
}
|
||||
|
||||
_display.get_selection ()->set_mode (SELECTION_MULTIPLE);
|
||||
|
||||
_scroller.add (_display);
|
||||
_scroller.set_policy (POLICY_AUTOMATIC, POLICY_AUTOMATIC);
|
||||
|
||||
_display.signal_button_press_event ().connect (sigc::mem_fun (*this, &RegionListBase::button_press), false);
|
||||
_display.signal_enter_notify_event ().connect (sigc::mem_fun (*this, &RegionListBase::enter_notify), false);
|
||||
_display.signal_leave_notify_event ().connect (sigc::mem_fun (*this, &RegionListBase::leave_notify), false);
|
||||
_scroller.signal_focus_in_event ().connect (sigc::mem_fun (*this, &RegionListBase::focus_in), false);
|
||||
_scroller.signal_focus_out_event ().connect (sigc::mem_fun (*this, &RegionListBase::focus_out));
|
||||
_scroller.signal_key_press_event ().connect (sigc::mem_fun (*this, &RegionListBase::key_press), false);
|
||||
|
||||
ARDOUR_UI::instance ()->primary_clock->mode_changed.connect (sigc::mem_fun (*this, &RegionListBase::clock_format_changed));
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::setup_col (TreeViewColumn* col, int sort_idx, Gtk::AlignmentEnum al, const char* label, const char* tooltip)
|
||||
{
|
||||
/* add the label */
|
||||
Gtk::Label* l = manage (new Label (label));
|
||||
l->set_alignment (al);
|
||||
ArdourWidgets::set_tooltip (*l, tooltip);
|
||||
col->set_widget (*l);
|
||||
l->show ();
|
||||
|
||||
col->set_sort_column (sort_idx);
|
||||
col->set_expand (false);
|
||||
|
||||
/* this sets the alignment of the column header... */
|
||||
col->set_alignment (al);
|
||||
|
||||
/* ...and this sets the alignment for the data cells */
|
||||
CellRendererText* renderer = dynamic_cast<CellRendererText*> (col->get_first_cell_renderer ());
|
||||
if (renderer) {
|
||||
renderer->property_xalign () = (al == ALIGN_RIGHT ? 1.0 : (al == ALIGN_LEFT ? 0.0 : 0.5));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::setup_toggle (Gtk::TreeViewColumn* tvc, sigc::slot<void, std::string> cb)
|
||||
{
|
||||
CellRendererToggle* tc = dynamic_cast<CellRendererToggle*> (tvc->get_first_cell_renderer ());
|
||||
tc->property_activatable () = true;
|
||||
tc->signal_toggled ().connect (cb);
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::add_name_column ()
|
||||
{
|
||||
TreeViewColumn* tvc = append_col (_columns.name, 120);
|
||||
setup_col (tvc, 0, ALIGN_LEFT, _("Name"), ("Region name"));
|
||||
|
||||
/* Region Name: make editable */
|
||||
CellRendererText* region_name_cell = dynamic_cast<CellRendererText*> (tvc->get_first_cell_renderer ());
|
||||
region_name_cell->property_editable () = true;
|
||||
region_name_cell->signal_edited ().connect (sigc::mem_fun (*this, &RegionListBase::name_edit));
|
||||
region_name_cell->signal_editing_started ().connect (sigc::mem_fun (*this, &RegionListBase::name_editing_started));
|
||||
/* Region Name: color turns red if source is missing. */
|
||||
tvc->add_attribute (region_name_cell->property_text (), _columns.name);
|
||||
tvc->add_attribute (region_name_cell->property_foreground_gdk (), _columns.color_);
|
||||
tvc->set_expand (true);
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::add_tag_column ()
|
||||
{
|
||||
TreeViewColumn* tvc = append_col (_columns.tags, "2099-10-10 10:10:30");
|
||||
setup_col (tvc, 2, ALIGN_LEFT, _("Tags"), _("Tags"));
|
||||
|
||||
/* Tags cell: make editable */
|
||||
CellRendererText* region_tags_cell = dynamic_cast<CellRendererText*> (tvc->get_first_cell_renderer ());
|
||||
region_tags_cell->property_editable () = true;
|
||||
region_tags_cell->signal_edited ().connect (sigc::mem_fun (*this, &RegionListBase::tag_edit));
|
||||
region_tags_cell->signal_editing_started ().connect (sigc::mem_fun (*this, &RegionListBase::tag_editing_started));
|
||||
}
|
||||
|
||||
bool
|
||||
RegionListBase::focus_in (GdkEventFocus*)
|
||||
{
|
||||
Window* win = dynamic_cast<Window*> (_scroller.get_toplevel ());
|
||||
|
||||
if (win) {
|
||||
_old_focus = win->get_focus ();
|
||||
} else {
|
||||
_old_focus = 0;
|
||||
}
|
||||
|
||||
_tags_editable = 0;
|
||||
_name_editable = 0;
|
||||
|
||||
/* try to do nothing on focus in (doesn't work, hence selection_count nonsense) */
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
RegionListBase::focus_out (GdkEventFocus*)
|
||||
{
|
||||
if (_old_focus) {
|
||||
_old_focus->grab_focus ();
|
||||
_old_focus = 0;
|
||||
}
|
||||
|
||||
_tags_editable = 0;
|
||||
_name_editable = 0;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
RegionListBase::enter_notify (GdkEventCrossing*)
|
||||
{
|
||||
if (_name_editable || _tags_editable) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Keyboard::magic_widget_grab_focus ();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
RegionListBase::leave_notify (GdkEventCrossing*)
|
||||
{
|
||||
if (_old_focus) {
|
||||
_old_focus->grab_focus ();
|
||||
_old_focus = 0;
|
||||
}
|
||||
Keyboard::magic_widget_drop_focus ();
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::drag_begin (Glib::RefPtr<Gdk::DragContext> const&)
|
||||
{
|
||||
if (_display.get_selection ()->count_selected_rows () == 0) {
|
||||
PublicEditor::instance ().pbdid_dragged_dt = DataType::NIL;
|
||||
}
|
||||
TreeView::Selection::ListHandle_Path rows = _display.get_selection ()->get_selected_rows ();
|
||||
for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin (); i != rows.end (); ++i) {
|
||||
boost::shared_ptr<Region> region = (*_model->get_iter (*i))[_columns.region];
|
||||
PublicEditor::instance ().pbdid_dragged_dt = region->data_type ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::drag_end (Glib::RefPtr<Gdk::DragContext> const&)
|
||||
{
|
||||
PublicEditor::instance ().pbdid_dragged_dt = DataType::NIL;
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::drag_data_get (Glib::RefPtr<Gdk::DragContext> const&, Gtk::SelectionData& data, guint, guint)
|
||||
{
|
||||
if (data.get_target () != "x-ardour/region.pbdid") {
|
||||
return;
|
||||
}
|
||||
TreeView::Selection::ListHandle_Path rows = _display.get_selection ()->get_selected_rows ();
|
||||
for (TreeView::Selection::ListHandle_Path::iterator i = rows.begin (); i != rows.end (); ++i) {
|
||||
boost::shared_ptr<Region> region = (*_model->get_iter (*i))[_columns.region];
|
||||
data.set (data.get_target (), region->id ().to_s ());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::set_session (ARDOUR::Session* s)
|
||||
{
|
||||
SessionHandlePtr::set_session (s);
|
||||
|
||||
if (!s) {
|
||||
clear ();
|
||||
return;
|
||||
}
|
||||
|
||||
ARDOUR::Region::RegionsPropertyChanged.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&RegionListBase::regions_changed, this, _1, _2), gui_context ());
|
||||
ARDOUR::RegionFactory::CheckNewRegion.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&RegionListBase::add_region, this, _1), gui_context ());
|
||||
|
||||
redisplay ();
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::remove_weak_region (boost::weak_ptr<ARDOUR::Region> r)
|
||||
{
|
||||
boost::shared_ptr<ARDOUR::Region> region = r.lock ();
|
||||
if (!region) {
|
||||
return;
|
||||
}
|
||||
|
||||
RegionRowMap::iterator map_it = region_row_map.find (region);
|
||||
if (map_it != region_row_map.end ()) {
|
||||
Gtk::TreeModel::iterator r_it = map_it->second;
|
||||
region_row_map.erase (map_it);
|
||||
_model->erase (r_it);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
RegionListBase::list_region (boost::shared_ptr<ARDOUR::Region> region) const
|
||||
{
|
||||
/* whole-file regions are shown in the Source List */
|
||||
return !region->whole_file ();
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::add_region (boost::shared_ptr<Region> region)
|
||||
{
|
||||
if (!region || !_session || !list_region (region)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* we only show files-on-disk.
|
||||
* if there's some other kind of region, we ignore it (for now)
|
||||
*/
|
||||
boost::shared_ptr<FileSource> fs = boost::dynamic_pointer_cast<FileSource> (region->source ());
|
||||
if (!fs) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (fs->empty ()) {
|
||||
/* MIDI sources are allowed to be empty */
|
||||
if (!boost::dynamic_pointer_cast<MidiSource> (region->source ())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (region->whole_file ()) {
|
||||
region->DropReferences.connect (_remove_region_connections, MISSING_INVALIDATOR, boost::bind (&RegionListBase::remove_weak_region, this, boost::weak_ptr<Region> (region)), gui_context ());
|
||||
}
|
||||
|
||||
PropertyChange pc;
|
||||
boost::shared_ptr<RegionList> rl (new RegionList);
|
||||
rl->push_back (region);
|
||||
regions_changed (rl, pc);
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::regions_changed (boost::shared_ptr<RegionList> rl, const PropertyChange& what_changed)
|
||||
{
|
||||
bool freeze = rl->size () > 2;
|
||||
if (freeze) {
|
||||
freeze_tree_model ();
|
||||
}
|
||||
for (RegionList::const_iterator i = rl->begin (); i != rl->end (); ++i) {
|
||||
boost::shared_ptr<Region> r = *i;
|
||||
|
||||
RegionRowMap::iterator map_it = region_row_map.find (r);
|
||||
boost::shared_ptr<ARDOUR::Playlist> pl = r->playlist ();
|
||||
|
||||
bool is_on_active_playlist = pl && _session && _session->playlist_is_active (pl);
|
||||
|
||||
if (!((is_on_active_playlist || r->whole_file ()) && list_region (r))) {
|
||||
/* this region is not on an active playlist
|
||||
* maybe it got deleted, or whatever */
|
||||
if (map_it != region_row_map.end ()) {
|
||||
Gtk::TreeModel::iterator r_it = map_it->second;
|
||||
region_row_map.erase (map_it);
|
||||
_model->erase (r_it);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (map_it != region_row_map.end ()) {
|
||||
/* found the region, update its row properties */
|
||||
TreeModel::Row row = *(map_it->second);
|
||||
populate_row (r, row, what_changed);
|
||||
} else {
|
||||
/* new region, add it to the list */
|
||||
TreeModel::iterator iter = _model->append ();
|
||||
TreeModel::Row row = *iter;
|
||||
region_row_map.insert (pair<boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::iterator> (r, iter));
|
||||
|
||||
/* set the properties that don't change */
|
||||
row[_columns.region] = r;
|
||||
|
||||
/* now populate the properties that might change... */
|
||||
populate_row (r, row, PropertyChange ());
|
||||
}
|
||||
}
|
||||
if (freeze) {
|
||||
thaw_tree_model ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::redisplay ()
|
||||
{
|
||||
if (_no_redisplay || !_session) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* store sort column id and type for later */
|
||||
_model->get_sort_column_id (_sort_col_id, _sort_type);
|
||||
|
||||
_remove_region_connections.drop_connections ();
|
||||
|
||||
_display.set_model (Glib::RefPtr<Gtk::TreeStore> (0));
|
||||
_model->clear ();
|
||||
/* Disable sorting to gain performance */
|
||||
_model->set_sort_column (-2, SORT_ASCENDING);
|
||||
|
||||
region_row_map.clear ();
|
||||
|
||||
RegionFactory::foreach_region (sigc::mem_fun (*this, &RegionListBase::add_region));
|
||||
|
||||
/* re-enabale sorting */
|
||||
_model->set_sort_column (_sort_col_id, _sort_type);
|
||||
_display.set_model (_model);
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::clock_format_changed ()
|
||||
{
|
||||
if (!_session) {
|
||||
return;
|
||||
}
|
||||
|
||||
PropertyChange change;
|
||||
change.add (ARDOUR::Properties::start);
|
||||
change.add (ARDOUR::Properties::length);
|
||||
change.add (ARDOUR::Properties::sync_position);
|
||||
change.add (ARDOUR::Properties::fade_in);
|
||||
change.add (ARDOUR::Properties::fade_out);
|
||||
|
||||
TreeModel::Children rows = _model->children ();
|
||||
for (TreeModel::iterator i = rows.begin (); i != rows.end (); ++i) {
|
||||
boost::shared_ptr<ARDOUR::Region> r = (*i)[_columns.region];
|
||||
populate_row (r, *i, change);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::format_position (timepos_t const& p, char* buf, size_t bufsize, bool onoff)
|
||||
{
|
||||
Temporal::BBT_Time bbt;
|
||||
Timecode::Time timecode;
|
||||
samplepos_t pos (p.samples ());
|
||||
|
||||
if (pos < 0) {
|
||||
error << string_compose (_("RegionListBase::format_position: negative timecode position: %1"), pos) << endmsg;
|
||||
snprintf (buf, bufsize, "invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (ARDOUR_UI::instance ()->primary_clock->mode ()) {
|
||||
case AudioClock::BBT:
|
||||
bbt = Temporal::TempoMap::use ()->bbt_at (p);
|
||||
if (onoff) {
|
||||
snprintf (buf, bufsize, "%03d|%02d|%04d", bbt.bars, bbt.beats, bbt.ticks);
|
||||
} else {
|
||||
snprintf (buf, bufsize, "(%03d|%02d|%04d)", bbt.bars, bbt.beats, bbt.ticks);
|
||||
}
|
||||
break;
|
||||
|
||||
case AudioClock::MinSec:
|
||||
samplepos_t left;
|
||||
int hrs;
|
||||
int mins;
|
||||
float secs;
|
||||
|
||||
left = pos;
|
||||
hrs = (int)floor (left / (_session->sample_rate () * 60.0f * 60.0f));
|
||||
left -= (samplecnt_t)floor (hrs * _session->sample_rate () * 60.0f * 60.0f);
|
||||
mins = (int)floor (left / (_session->sample_rate () * 60.0f));
|
||||
left -= (samplecnt_t)floor (mins * _session->sample_rate () * 60.0f);
|
||||
secs = left / (float)_session->sample_rate ();
|
||||
if (onoff) {
|
||||
snprintf (buf, bufsize, "%02d:%02d:%06.3f", hrs, mins, secs);
|
||||
} else {
|
||||
snprintf (buf, bufsize, "(%02d:%02d:%06.3f)", hrs, mins, secs);
|
||||
}
|
||||
break;
|
||||
|
||||
case AudioClock::Seconds:
|
||||
if (onoff) {
|
||||
snprintf (buf, bufsize, "%.1f", pos / (float)_session->sample_rate ());
|
||||
} else {
|
||||
snprintf (buf, bufsize, "(%.1f)", pos / (float)_session->sample_rate ());
|
||||
}
|
||||
break;
|
||||
|
||||
case AudioClock::Samples:
|
||||
if (onoff) {
|
||||
snprintf (buf, bufsize, "%" PRId64, pos);
|
||||
} else {
|
||||
snprintf (buf, bufsize, "(%" PRId64 ")", pos);
|
||||
}
|
||||
break;
|
||||
|
||||
case AudioClock::Timecode:
|
||||
default:
|
||||
_session->timecode_time (pos, timecode);
|
||||
if (onoff) {
|
||||
snprintf (buf, bufsize, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
||||
} else {
|
||||
snprintf (buf, bufsize, "(%02d:%02d:%02d:%02d)", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::populate_row (boost::shared_ptr<Region> region, TreeModel::Row const& row, PBD::PropertyChange const& what_changed)
|
||||
{
|
||||
assert (region);
|
||||
|
||||
{
|
||||
Gdk::Color c;
|
||||
bool missing_source = boost::dynamic_pointer_cast<SilentFileSource> (region->source ()) != NULL;
|
||||
if (missing_source) {
|
||||
set_color_from_rgba (c, UIConfiguration::instance ().color ("region list missing source"));
|
||||
} else {
|
||||
set_color_from_rgba (c, UIConfiguration::instance ().color ("region list whole file"));
|
||||
}
|
||||
row[_columns.color_] = c;
|
||||
}
|
||||
|
||||
boost::shared_ptr<AudioRegion> audioregion = boost::dynamic_pointer_cast<AudioRegion> (region);
|
||||
|
||||
PropertyChange c;
|
||||
const bool all = what_changed == c;
|
||||
|
||||
if (all || what_changed.contains (Properties::length)) {
|
||||
populate_row_position (region, row);
|
||||
}
|
||||
if (all || what_changed.contains (Properties::start) || what_changed.contains (Properties::sync_position)) {
|
||||
populate_row_sync (region, row);
|
||||
}
|
||||
if (all || what_changed.contains (Properties::fade_in)) {
|
||||
populate_row_fade_in (region, row, audioregion);
|
||||
}
|
||||
if (all || what_changed.contains (Properties::fade_out)) {
|
||||
populate_row_fade_out (region, row, audioregion);
|
||||
}
|
||||
if (all || what_changed.contains (Properties::locked)) {
|
||||
populate_row_locked (region, row);
|
||||
}
|
||||
if (all || what_changed.contains (Properties::time_domain)) {
|
||||
populate_row_glued (region, row);
|
||||
}
|
||||
if (all || what_changed.contains (Properties::muted)) {
|
||||
populate_row_muted (region, row);
|
||||
}
|
||||
if (all || what_changed.contains (Properties::opaque)) {
|
||||
populate_row_opaque (region, row);
|
||||
}
|
||||
if (all || what_changed.contains (Properties::length)) {
|
||||
populate_row_end (region, row);
|
||||
populate_row_length (region, row);
|
||||
}
|
||||
if (all) {
|
||||
populate_row_source (region, row);
|
||||
}
|
||||
if (all || what_changed.contains (Properties::name) || what_changed.contains (Properties::tags)) {
|
||||
populate_row_name (region, row);
|
||||
}
|
||||
/* CAPTURED DROPOUTS */
|
||||
row[_columns.captd_xruns] = region->source ()->n_captured_xruns ();
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::populate_row_length (boost::shared_ptr<Region> region, TreeModel::Row const& row)
|
||||
{
|
||||
char buf[16];
|
||||
|
||||
if (ARDOUR_UI::instance ()->primary_clock->mode () == AudioClock::BBT) {
|
||||
TempoMap::SharedPtr map (TempoMap::use ());
|
||||
Temporal::BBT_Time bbt; /* uninitialized until full duration works */
|
||||
// Temporal::BBT_Time bbt = map->bbt_duration_at (region->position(), region->length());
|
||||
snprintf (buf, sizeof (buf), "%03d|%02d|%04d", bbt.bars, bbt.beats, bbt.ticks);
|
||||
} else {
|
||||
format_position (timepos_t (region->length ()), buf, sizeof (buf));
|
||||
}
|
||||
|
||||
row[_columns.length] = buf;
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::populate_row_end (boost::shared_ptr<Region> region, TreeModel::Row const& row)
|
||||
{
|
||||
#ifndef SHOW_REGION_EXTRAS
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (region->last_sample () >= region->first_sample ()) {
|
||||
char buf[16];
|
||||
format_position (region->nt_last (), buf, sizeof (buf));
|
||||
row[_columns.end] = buf;
|
||||
} else {
|
||||
row[_columns.end] = "empty";
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::populate_row_position (boost::shared_ptr<Region> region, TreeModel::Row const& row)
|
||||
{
|
||||
row[_columns.position] = region->position ();
|
||||
|
||||
char buf[16];
|
||||
format_position (region->position (), buf, sizeof (buf));
|
||||
row[_columns.start] = buf;
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::populate_row_sync (boost::shared_ptr<Region> region, TreeModel::Row const& row)
|
||||
{
|
||||
#ifndef SHOW_REGION_EXTRAS
|
||||
return;
|
||||
#endif
|
||||
if (region->sync_position () == region->position ()) {
|
||||
row[_columns.sync] = _("Start");
|
||||
} else if (region->sync_position () == (region->last_sample ())) {
|
||||
row[_columns.sync] = _("End");
|
||||
} else {
|
||||
char buf[16];
|
||||
format_position (region->sync_position (), buf, sizeof (buf));
|
||||
row[_columns.sync] = buf;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::populate_row_fade_in (boost::shared_ptr<Region> region, TreeModel::Row const& row, boost::shared_ptr<AudioRegion> audioregion)
|
||||
{
|
||||
#ifndef SHOW_REGION_EXTRAS
|
||||
return;
|
||||
#endif
|
||||
if (!audioregion) {
|
||||
row[_columns.fadein] = "";
|
||||
} else {
|
||||
char buf[32];
|
||||
format_position (audioregion->fade_in ()->back ()->when, buf, sizeof (buf), audioregion->fade_in_active ());
|
||||
row[_columns.fadein] = buf;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::populate_row_fade_out (boost::shared_ptr<Region> region, TreeModel::Row const& row, boost::shared_ptr<AudioRegion> audioregion)
|
||||
{
|
||||
#ifndef SHOW_REGION_EXTRAS
|
||||
return;
|
||||
#endif
|
||||
if (!audioregion) {
|
||||
row[_columns.fadeout] = "";
|
||||
} else {
|
||||
char buf[32];
|
||||
format_position (audioregion->fade_out ()->back ()->when, buf, sizeof (buf), audioregion->fade_out_active ());
|
||||
row[_columns.fadeout] = buf;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::populate_row_locked (boost::shared_ptr<Region> region, TreeModel::Row const& row)
|
||||
{
|
||||
row[_columns.locked] = region->locked ();
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::populate_row_glued (boost::shared_ptr<Region> region, TreeModel::Row const& row)
|
||||
{
|
||||
if (region->position_time_domain () == Temporal::BeatTime) {
|
||||
row[_columns.glued] = true;
|
||||
} else {
|
||||
row[_columns.glued] = false;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::populate_row_muted (boost::shared_ptr<Region> region, TreeModel::Row const& row)
|
||||
{
|
||||
row[_columns.muted] = region->muted ();
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::populate_row_opaque (boost::shared_ptr<Region> region, TreeModel::Row const& row)
|
||||
{
|
||||
row[_columns.opaque] = region->opaque ();
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::populate_row_name (boost::shared_ptr<Region> region, TreeModel::Row const& row)
|
||||
{
|
||||
row[_columns.name] = Gtkmm2ext::markup_escape_text (region->name ());
|
||||
|
||||
if (region->data_type () == DataType::MIDI) {
|
||||
row[_columns.channels] = 0; /*TODO: some better recognition of midi regions*/
|
||||
} else {
|
||||
row[_columns.channels] = region->sources ().size ();
|
||||
}
|
||||
|
||||
row[_columns.tags] = region->tags ();
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::populate_row_source (boost::shared_ptr<Region> region, TreeModel::Row const& row)
|
||||
{
|
||||
boost::shared_ptr<ARDOUR::Source> source = region->source ();
|
||||
if (boost::dynamic_pointer_cast<SilentFileSource> (source)) {
|
||||
row[_columns.path] = _("MISSING ") + Gtkmm2ext::markup_escape_text (source->name ());
|
||||
} else {
|
||||
row[_columns.path] = Gtkmm2ext::markup_escape_text (source->name ());
|
||||
|
||||
boost::shared_ptr<FileSource> fs = boost::dynamic_pointer_cast<FileSource> (source);
|
||||
if (fs) {
|
||||
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (source);
|
||||
if (afs) {
|
||||
const string audio_directory = _session->session_directory ().sound_path ();
|
||||
if (!PBD::path_is_within (audio_directory, fs->path ())) {
|
||||
row[_columns.path] = Gtkmm2ext::markup_escape_text (fs->path ());
|
||||
}
|
||||
}
|
||||
boost::shared_ptr<SMFSource> mfs = boost::dynamic_pointer_cast<SMFSource> (source);
|
||||
if (mfs) {
|
||||
const string midi_directory = _session->session_directory ().midi_path ();
|
||||
if (!PBD::path_is_within (midi_directory, fs->path ())) {
|
||||
row[_columns.path] = Gtkmm2ext::markup_escape_text (fs->path ());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
row[_columns.captd_for] = source->captured_for ();
|
||||
row[_columns.take_id] = source->take_id ();
|
||||
|
||||
/* Natural Position (samples, an invisible column for sorting) */
|
||||
row[_columns.natural_s] = source->natural_position ();
|
||||
|
||||
/* Natural Position (text representation) */
|
||||
if (source->have_natural_position ()) {
|
||||
char buf[64];
|
||||
format_position (source->natural_position (), buf, sizeof (buf));
|
||||
row[_columns.natural_pos] = buf;
|
||||
} else {
|
||||
row[_columns.natural_pos] = X_("--");
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
RegionListBase::key_press (GdkEventKey* ev)
|
||||
{
|
||||
TreeViewColumn* col;
|
||||
|
||||
switch (ev->keyval) {
|
||||
case GDK_Tab:
|
||||
case GDK_ISO_Left_Tab:
|
||||
|
||||
if (_name_editable) {
|
||||
_name_editable->editing_done ();
|
||||
_name_editable = 0;
|
||||
}
|
||||
|
||||
if (_tags_editable) {
|
||||
_tags_editable->editing_done ();
|
||||
_tags_editable = 0;
|
||||
}
|
||||
|
||||
col = _display.get_column (0); // select&focus on name column
|
||||
|
||||
if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
|
||||
treeview_select_previous (_display, _model, col);
|
||||
} else {
|
||||
treeview_select_next (_display, _model, col);
|
||||
}
|
||||
|
||||
return true;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::name_editing_started (CellEditable* ce, const Glib::ustring& path)
|
||||
{
|
||||
_name_editable = ce;
|
||||
|
||||
/* give it a special name */
|
||||
|
||||
Gtk::Entry* e = dynamic_cast<Gtk::Entry*> (ce);
|
||||
|
||||
if (e) {
|
||||
e->set_name (X_("RegionNameEditorEntry"));
|
||||
|
||||
TreeIter iter;
|
||||
if ((iter = _model->get_iter (path))) {
|
||||
boost::shared_ptr<Region> region = (*iter)[_columns.region];
|
||||
|
||||
if (region) {
|
||||
e->set_text (region->name ());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::name_edit (const std::string& path, const std::string& new_text)
|
||||
{
|
||||
_name_editable = 0;
|
||||
|
||||
boost::shared_ptr<Region> region;
|
||||
TreeIter row_iter;
|
||||
|
||||
if ((row_iter = _model->get_iter (path))) {
|
||||
region = (*row_iter)[_columns.region];
|
||||
(*row_iter)[_columns.name] = new_text;
|
||||
}
|
||||
|
||||
if (region) {
|
||||
region->set_name (new_text);
|
||||
|
||||
populate_row_name (region, (*row_iter));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::tag_editing_started (CellEditable* ce, const Glib::ustring& path)
|
||||
{
|
||||
_tags_editable = ce;
|
||||
|
||||
/* give it a special name */
|
||||
|
||||
Gtk::Entry* e = dynamic_cast<Gtk::Entry*> (ce);
|
||||
|
||||
if (e) {
|
||||
e->set_name (X_("RegionTagEditorEntry"));
|
||||
|
||||
TreeIter iter;
|
||||
if ((iter = _model->get_iter (path))) {
|
||||
boost::shared_ptr<Region> region = (*iter)[_columns.region];
|
||||
|
||||
if (region) {
|
||||
e->set_text (region->tags ());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::tag_edit (const std::string& path, const std::string& new_text)
|
||||
{
|
||||
_tags_editable = 0;
|
||||
|
||||
boost::shared_ptr<Region> region;
|
||||
TreeIter row_iter;
|
||||
|
||||
if ((row_iter = _model->get_iter (path))) {
|
||||
region = (*row_iter)[_columns.region];
|
||||
(*row_iter)[_columns.tags] = new_text;
|
||||
}
|
||||
|
||||
if (region) {
|
||||
region->set_tags (new_text);
|
||||
|
||||
populate_row_name (region, (*row_iter));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::clear ()
|
||||
{
|
||||
_remove_region_connections.drop_connections ();
|
||||
_display.set_model (Glib::RefPtr<Gtk::TreeStore> (0));
|
||||
_model->clear ();
|
||||
_display.set_model (_model);
|
||||
|
||||
/* Clean up the maps */
|
||||
region_row_map.clear ();
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::freeze_tree_model ()
|
||||
{
|
||||
/* store sort column id and type for later */
|
||||
_model->get_sort_column_id (_sort_col_id, _sort_type);
|
||||
_change_connection.block (true);
|
||||
_display.set_model (Glib::RefPtr<Gtk::TreeStore> (0));
|
||||
_model->set_sort_column (-2, SORT_ASCENDING); //Disable sorting to gain performance
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::thaw_tree_model ()
|
||||
{
|
||||
_model->set_sort_column (_sort_col_id, _sort_type); // re-enabale sorting
|
||||
_display.set_model (_model);
|
||||
_change_connection.block (false);
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::locked_changed (std::string const& path)
|
||||
{
|
||||
TreeIter i = _model->get_iter (path);
|
||||
if (i) {
|
||||
boost::shared_ptr<ARDOUR::Region> region = (*i)[_columns.region];
|
||||
if (region) {
|
||||
region->set_locked (!(*i)[_columns.locked]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::glued_changed (std::string const& path)
|
||||
{
|
||||
TreeIter i = _model->get_iter (path);
|
||||
if (i) {
|
||||
boost::shared_ptr<ARDOUR::Region> region = (*i)[_columns.region];
|
||||
if (region) {
|
||||
/* `glued' means MusicTime, and we're toggling here */
|
||||
region->set_position_time_domain ((*i)[_columns.glued] ? Temporal::AudioTime : Temporal::BeatTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::muted_changed (std::string const& path)
|
||||
{
|
||||
TreeIter i = _model->get_iter (path);
|
||||
if (i) {
|
||||
boost::shared_ptr<ARDOUR::Region> region = (*i)[_columns.region];
|
||||
if (region) {
|
||||
region->set_muted (!(*i)[_columns.muted]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionListBase::opaque_changed (std::string const& path)
|
||||
{
|
||||
TreeIter i = _model->get_iter (path);
|
||||
if (i) {
|
||||
boost::shared_ptr<ARDOUR::Region> region = (*i)[_columns.region];
|
||||
if (region) {
|
||||
region->set_opaque (!(*i)[_columns.opaque]);
|
||||
}
|
||||
}
|
||||
}
|
||||
253
gtk2_ardour/region_list_base.h
Normal file
253
gtk2_ardour/region_list_base.h
Normal file
|
|
@ -0,0 +1,253 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2011 Carl Hetherington <carl@carlh.net>
|
||||
* Copyright (C) 2009-2011 David Robillard <d@drobilla.net>
|
||||
* Copyright (C) 2009-2018 Paul Davis <paul@linuxaudiosystems.com>
|
||||
* Copyright (C) 2018 Ben Loftis <ben@harrisonconsoles.com>
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
#ifndef _gtk_ardour_region_list_base_h_
|
||||
#define _gtk_ardour_region_list_base_h_
|
||||
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
#include <gtkmm/celleditable.h>
|
||||
#include <gtkmm/frame.h>
|
||||
#include <gtkmm/scrolledwindow.h>
|
||||
#include <gtkmm/treemodel.h>
|
||||
#include <gtkmm/treerowreference.h>
|
||||
#include <gtkmm/treestore.h>
|
||||
|
||||
#include "gtkmm2ext/utils.h"
|
||||
|
||||
#include "pbd/properties.h"
|
||||
#include "pbd/signals.h"
|
||||
|
||||
#include "ardour/session_handle.h"
|
||||
#include "ardour/types.h"
|
||||
|
||||
#include "gtkmm2ext/dndtreeview.h"
|
||||
|
||||
//#define SHOW_REGION_EXTRAS
|
||||
|
||||
namespace ARDOUR
|
||||
{
|
||||
class Region;
|
||||
class AudioRegion;
|
||||
}
|
||||
|
||||
class RegionListBase : public ARDOUR::SessionHandlePtr
|
||||
{
|
||||
public:
|
||||
RegionListBase ();
|
||||
|
||||
void set_session (ARDOUR::Session*);
|
||||
|
||||
Gtk::Widget& widget ()
|
||||
{
|
||||
return _scroller;
|
||||
}
|
||||
|
||||
void clear ();
|
||||
|
||||
void redisplay ();
|
||||
|
||||
void suspend_redisplay ()
|
||||
{
|
||||
_no_redisplay = true;
|
||||
}
|
||||
|
||||
void resume_redisplay ()
|
||||
{
|
||||
_no_redisplay = false;
|
||||
redisplay ();
|
||||
}
|
||||
|
||||
void block_change_connection (bool b)
|
||||
{
|
||||
_change_connection.block (b);
|
||||
}
|
||||
|
||||
void unselect_all ()
|
||||
{
|
||||
_display.get_selection ()->unselect_all ();
|
||||
}
|
||||
|
||||
protected:
|
||||
struct Columns : public Gtk::TreeModel::ColumnRecord {
|
||||
Columns ()
|
||||
{
|
||||
add (name); // 0
|
||||
add (channels); // 1
|
||||
add (tags); // 2
|
||||
add (start); // 3
|
||||
add (length); // 3
|
||||
add (end); // 5
|
||||
add (sync); // 6
|
||||
add (fadein); // 7
|
||||
add (fadeout); // 8
|
||||
add (locked); // 9
|
||||
add (glued); // 10
|
||||
add (muted); // 11
|
||||
add (opaque); // 12
|
||||
add (path); // 13
|
||||
add (region); // 14
|
||||
add (color_); // 15
|
||||
add (position); // 16
|
||||
/* src-list */
|
||||
add (captd_for); // 17
|
||||
add (take_id); // 18
|
||||
add (natural_pos); // 19
|
||||
add (natural_s); // 20
|
||||
add (captd_xruns);
|
||||
}
|
||||
|
||||
Gtk::TreeModelColumn<std::string> name;
|
||||
Gtk::TreeModelColumn<int> channels;
|
||||
Gtk::TreeModelColumn<std::string> tags;
|
||||
Gtk::TreeModelColumn<Temporal::timepos_t> position;
|
||||
Gtk::TreeModelColumn<std::string> start;
|
||||
Gtk::TreeModelColumn<std::string> end;
|
||||
Gtk::TreeModelColumn<std::string> length;
|
||||
Gtk::TreeModelColumn<std::string> sync;
|
||||
Gtk::TreeModelColumn<std::string> fadein;
|
||||
Gtk::TreeModelColumn<std::string> fadeout;
|
||||
Gtk::TreeModelColumn<bool> locked;
|
||||
Gtk::TreeModelColumn<bool> glued;
|
||||
Gtk::TreeModelColumn<bool> muted;
|
||||
Gtk::TreeModelColumn<bool> opaque;
|
||||
Gtk::TreeModelColumn<std::string> path;
|
||||
Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Region>> region;
|
||||
Gtk::TreeModelColumn<Gdk::Color> color_;
|
||||
Gtk::TreeModelColumn<std::string> captd_for;
|
||||
Gtk::TreeModelColumn<std::string> take_id;
|
||||
Gtk::TreeModelColumn<std::string> natural_pos;
|
||||
Gtk::TreeModelColumn<Temporal::timepos_t> natural_s;
|
||||
Gtk::TreeModelColumn<size_t> captd_xruns;
|
||||
};
|
||||
|
||||
void add_name_column ();
|
||||
void add_tag_column ();
|
||||
|
||||
template <class T>
|
||||
Gtk::TreeViewColumn* append_col (Gtk::TreeModelColumn<T> const& col, int width)
|
||||
{
|
||||
Gtk::TreeViewColumn* c = manage (new Gtk::TreeViewColumn ("", col));
|
||||
c->set_fixed_width (width);
|
||||
c->set_sizing (Gtk::TREE_VIEW_COLUMN_FIXED);
|
||||
_display.append_column (*c);
|
||||
return c;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Gtk::TreeViewColumn* append_col (Gtk::TreeModelColumn<T> const& col, std::string const& sizing_text)
|
||||
{
|
||||
int w, h;
|
||||
Glib::RefPtr<Pango::Layout> layout = _display.create_pango_layout (sizing_text);
|
||||
Gtkmm2ext::get_pixel_size (layout, w, h);
|
||||
return append_col (col, w);
|
||||
}
|
||||
|
||||
void setup_col (Gtk::TreeViewColumn*, int, Gtk::AlignmentEnum, const char*, const char*);
|
||||
void setup_toggle (Gtk::TreeViewColumn*, sigc::slot<void, std::string>);
|
||||
|
||||
void freeze_tree_model ();
|
||||
void thaw_tree_model ();
|
||||
void remove_weak_region (boost::weak_ptr<ARDOUR::Region>);
|
||||
|
||||
virtual void regions_changed (boost::shared_ptr<ARDOUR::RegionList>, PBD::PropertyChange const&);
|
||||
|
||||
void name_editing_started (Gtk::CellEditable*, const Glib::ustring&);
|
||||
void tag_editing_started (Gtk::CellEditable*, const Glib::ustring&);
|
||||
|
||||
virtual void name_edit (const std::string&, const std::string&);
|
||||
virtual void tag_edit (const std::string&, const std::string&);
|
||||
|
||||
void locked_changed (std::string const&);
|
||||
void glued_changed (std::string const&);
|
||||
void muted_changed (std::string const&);
|
||||
void opaque_changed (std::string const&);
|
||||
|
||||
virtual bool key_press (GdkEventKey*);
|
||||
virtual bool button_press (GdkEventButton*)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool focus_in (GdkEventFocus*);
|
||||
bool focus_out (GdkEventFocus*);
|
||||
|
||||
bool enter_notify (GdkEventCrossing*);
|
||||
bool leave_notify (GdkEventCrossing*);
|
||||
|
||||
void format_position (Temporal::timepos_t const& pos, char* buf, size_t bufsize, bool onoff = true);
|
||||
|
||||
void add_region (boost::shared_ptr<ARDOUR::Region>);
|
||||
|
||||
void populate_row (boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::Row const&, PBD::PropertyChange const&);
|
||||
void populate_row_used (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_position (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_end (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_sync (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_fade_in (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row, boost::shared_ptr<ARDOUR::AudioRegion>);
|
||||
void populate_row_fade_out (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row, boost::shared_ptr<ARDOUR::AudioRegion>);
|
||||
void populate_row_locked (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_muted (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_glued (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_opaque (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_length (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_name (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
void populate_row_source (boost::shared_ptr<ARDOUR::Region> region, Gtk::TreeModel::Row const& row);
|
||||
|
||||
void clock_format_changed ();
|
||||
|
||||
void drag_begin (Glib::RefPtr<Gdk::DragContext> const&);
|
||||
void drag_end (Glib::RefPtr<Gdk::DragContext> const&);
|
||||
void drag_data_get (Glib::RefPtr<Gdk::DragContext> const&, Gtk::SelectionData&, guint, guint);
|
||||
|
||||
virtual bool list_region (boost::shared_ptr<ARDOUR::Region>) const;
|
||||
|
||||
Columns _columns;
|
||||
|
||||
int _sort_col_id;
|
||||
Gtk::SortType _sort_type;
|
||||
|
||||
Gtk::CellEditable* _name_editable;
|
||||
Gtk::CellEditable* _tags_editable;
|
||||
Gtk::Widget* _old_focus;
|
||||
|
||||
Gtk::ScrolledWindow _scroller;
|
||||
Gtk::Frame _frame;
|
||||
|
||||
Gtkmm2ext::DnDTreeView<boost::shared_ptr<ARDOUR::Region>> _display;
|
||||
|
||||
Glib::RefPtr<Gtk::TreeStore> _model;
|
||||
|
||||
bool _no_redisplay;
|
||||
|
||||
typedef boost::unordered_map<boost::shared_ptr<ARDOUR::Region>, Gtk::TreeModel::iterator> RegionRowMap;
|
||||
|
||||
RegionRowMap region_row_map;
|
||||
|
||||
sigc::connection _change_connection;
|
||||
|
||||
PBD::ScopedConnection _editor_freeze_connection;
|
||||
PBD::ScopedConnection _editor_thaw_connection;
|
||||
|
||||
PBD::ScopedConnectionList _remove_region_connections;
|
||||
};
|
||||
|
||||
#endif /* _gtk_ardour_region_list_base_h_ */
|
||||
104
gtk2_ardour/source_list_base.cc
Normal file
104
gtk2_ardour/source_list_base.cc
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 "ardour/region.h"
|
||||
#include "ardour/session.h"
|
||||
|
||||
#include "gui_thread.h"
|
||||
#include "source_list_base.h"
|
||||
|
||||
#include "pbd/i18n.h"
|
||||
|
||||
using namespace Gtk;
|
||||
|
||||
SourceListBase::SourceListBase ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SourceListBase::set_session (ARDOUR::Session* s)
|
||||
{
|
||||
if (s) {
|
||||
s->SourceRemoved.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&SourceListBase::remove_weak_source, this, _1), gui_context ());
|
||||
}
|
||||
RegionListBase::set_session (s);
|
||||
}
|
||||
|
||||
void
|
||||
SourceListBase::remove_weak_source (boost::weak_ptr<ARDOUR::Source> src)
|
||||
{
|
||||
boost::shared_ptr<ARDOUR::Source> source = src.lock ();
|
||||
if (source) {
|
||||
remove_source (source);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SourceListBase::remove_source (boost::shared_ptr<ARDOUR::Source> source)
|
||||
{
|
||||
TreeModel::iterator i;
|
||||
TreeModel::Children rows = _model->children ();
|
||||
for (i = rows.begin (); i != rows.end (); ++i) {
|
||||
boost::shared_ptr<ARDOUR::Region> rr = (*i)[_columns.region];
|
||||
if (rr->source () == source) {
|
||||
RegionRowMap::iterator map_it = region_row_map.find (rr);
|
||||
assert (map_it != region_row_map.end () && i == map_it->second);
|
||||
region_row_map.erase (map_it);
|
||||
_model->erase (i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
SourceListBase::list_region (boost::shared_ptr<ARDOUR::Region> region) const
|
||||
{
|
||||
/* by definition, the Source List only shows whole-file regions
|
||||
* this roughly equates to Source objects, but preserves the stereo-ness
|
||||
* (or multichannel-ness) of a stereo source file.
|
||||
*/
|
||||
return region->whole_file ();
|
||||
}
|
||||
|
||||
void
|
||||
SourceListBase::tag_edit (const std::string& path, const std::string& new_text)
|
||||
{
|
||||
RegionListBase::tag_edit (path, new_text);
|
||||
|
||||
TreeIter row_iter;
|
||||
if ((row_iter = _model->get_iter (path))) {
|
||||
boost::shared_ptr<ARDOUR::Region> region = (*row_iter)[_columns.region];
|
||||
if (region) {
|
||||
_session->set_dirty (); // whole-file regions aren't in a playlist to catch property changes, so we need to explicitly set the session dirty
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SourceListBase::name_edit (const std::string& path, const std::string& new_text)
|
||||
{
|
||||
RegionListBase::name_edit (path, new_text);
|
||||
|
||||
TreeIter row_iter;
|
||||
if ((row_iter = _model->get_iter (path))) {
|
||||
boost::shared_ptr<ARDOUR::Region> region = (*row_iter)[_columns.region];
|
||||
if (region) {
|
||||
_session->set_dirty (); // whole-file regions aren't in a playlist to catch property changes, so we need to explicitly set the session dirty
|
||||
}
|
||||
}
|
||||
}
|
||||
39
gtk2_ardour/source_list_base.h
Normal file
39
gtk2_ardour/source_list_base.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
#ifndef _gtk_ardour_source_list_base_h_
|
||||
#define _gtk_ardour_source_list_base_h_
|
||||
|
||||
#include "region_list_base.h"
|
||||
|
||||
class SourceListBase : public RegionListBase
|
||||
{
|
||||
public:
|
||||
SourceListBase ();
|
||||
void set_session (ARDOUR::Session*);
|
||||
|
||||
protected:
|
||||
void name_edit (const std::string&, const std::string&);
|
||||
void tag_edit (const std::string&, const std::string&);
|
||||
bool list_region (boost::shared_ptr<ARDOUR::Region>) const;
|
||||
|
||||
private:
|
||||
void remove_source (boost::shared_ptr<ARDOUR::Source>);
|
||||
void remove_weak_source (boost::weak_ptr<ARDOUR::Source>);
|
||||
};
|
||||
|
||||
#endif /* _gtk_ardour_source_list_base_h_ */
|
||||
|
|
@ -108,8 +108,7 @@ TriggerPage::TriggerPage ()
|
|||
_no_strips.signal_drag_data_received ().connect (sigc::mem_fun (*this, &TriggerPage::no_strip_drag_data_received));
|
||||
|
||||
std::vector<Gtk::TargetEntry> target_table;
|
||||
target_table.push_back (Gtk::TargetEntry ("x-ardour/region.erl", Gtk::TARGET_SAME_APP));
|
||||
target_table.push_back (Gtk::TargetEntry ("x-ardour/region.esl", Gtk::TARGET_SAME_APP));
|
||||
target_table.push_back (Gtk::TargetEntry ("x-ardour/region.pbdid", Gtk::TARGET_SAME_APP));
|
||||
target_table.push_back (Gtk::TargetEntry ("text/uri-list"));
|
||||
target_table.push_back (Gtk::TargetEntry ("text/plain"));
|
||||
target_table.push_back (Gtk::TargetEntry ("application/x-rootwin-drop"));
|
||||
|
|
@ -126,6 +125,8 @@ TriggerPage::TriggerPage ()
|
|||
|
||||
_sidebar_vbox.pack_start (_sidebar_notebook);
|
||||
add_sidebar_page (_("Clips"), _trigger_clip_picker);
|
||||
add_sidebar_page (_("Sources"), _trigger_source_list.widget ());
|
||||
add_sidebar_page (_("Regions"), _trigger_region_list.widget ());
|
||||
|
||||
/* Upper pane ([slot | strips] | file browser) */
|
||||
_pane_upper.add (_strip_group_box);
|
||||
|
|
@ -265,6 +266,8 @@ TriggerPage::set_session (Session* s)
|
|||
_cue_box.set_session (s);
|
||||
_trigger_clip_picker.set_session (s);
|
||||
_master.set_session (s);
|
||||
_trigger_source_list.set_session (s);
|
||||
_trigger_region_list.set_session (s);
|
||||
|
||||
if (!_session) {
|
||||
return;
|
||||
|
|
@ -527,8 +530,9 @@ TriggerPage::no_strip_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context
|
|||
void
|
||||
TriggerPage::no_strip_drag_data_received (Glib::RefPtr<Gdk::DragContext> const& context, int /*x*/, int y, Gtk::SelectionData const& data, guint /*info*/, guint time)
|
||||
{
|
||||
if (data.get_target () == "x-ardour/region.erl" || data.get_target () == "x-ardour/region.esl") {
|
||||
boost::shared_ptr<Region> region = PublicEditor::instance ().get_dragged_region_from_sidebar ();
|
||||
if (data.get_target () == "x-ardour/region.pbdid") {
|
||||
PBD::ID rid (data.get_data_as_string ());
|
||||
boost::shared_ptr<Region> region = RegionFactory::region_by_id (rid);
|
||||
boost::shared_ptr<TriggerBox> triggerbox;
|
||||
|
||||
if (boost::dynamic_pointer_cast<AudioRegion> (region)) {
|
||||
|
|
@ -598,8 +602,8 @@ TriggerPage::drop_paths_part_two (std::vector<std::string> paths)
|
|||
InstrumentSelector is; // instantiation builds instrument-list and sets default.
|
||||
timepos_t pos (0);
|
||||
Editing::ImportDisposition disposition = Editing::ImportSerializeFiles; // or Editing::ImportDistinctFiles // TODO use drop modifier? config?
|
||||
PublicEditor::instance().do_import (midi_paths, disposition, Editing::ImportAsTrigger, SrcBest, SMFTrackName, SMFTempoIgnore, pos, is.selected_instrument (), false);
|
||||
PublicEditor::instance().do_import (audio_paths, disposition, Editing::ImportAsTrigger, SrcBest, SMFTrackName, SMFTempoIgnore, pos);
|
||||
PublicEditor::instance().do_import (midi_paths, disposition, Editing::ImportAsTrigger, SrcBest, SMFTrackNumber, SMFTempoIgnore, pos, is.selected_instrument (), false);
|
||||
PublicEditor::instance().do_import (audio_paths, disposition, Editing::ImportAsTrigger, SrcBest, SMFTrackNumber, SMFTempoIgnore, pos);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@
|
|||
#include "midi_trigger_properties_box.h"
|
||||
#include "slot_properties_box.h"
|
||||
#include "trigger_clip_picker.h"
|
||||
#include "trigger_region_list.h"
|
||||
#include "trigger_source_list.h"
|
||||
#include "trigger_master.h"
|
||||
|
||||
class TriggerStrip;
|
||||
|
|
@ -103,6 +105,8 @@ private:
|
|||
Gtk::VBox _sidebar_vbox;
|
||||
Gtk::Notebook _sidebar_notebook;
|
||||
TriggerClipPicker _trigger_clip_picker;
|
||||
TriggerSourceList _trigger_source_list;
|
||||
TriggerRegionList _trigger_region_list;
|
||||
|
||||
CueBoxWidget _cue_box;
|
||||
FittedCanvasWidget _master_widget;
|
||||
|
|
|
|||
30
gtk2_ardour/trigger_region_list.cc
Normal file
30
gtk2_ardour/trigger_region_list.cc
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 "trigger_region_list.h"
|
||||
|
||||
#include "pbd/i18n.h"
|
||||
|
||||
using namespace Gtk;
|
||||
|
||||
TriggerRegionList::TriggerRegionList ()
|
||||
{
|
||||
add_name_column ();
|
||||
setup_col (append_col (_columns.channels, "Chans "), 1, ALIGN_LEFT, _("# Ch"), _("# Channels in the region"));
|
||||
add_tag_column ();
|
||||
}
|
||||
29
gtk2_ardour/trigger_region_list.h
Normal file
29
gtk2_ardour/trigger_region_list.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
#ifndef _gtk_ardour_trigger_region_list_h_
|
||||
#define _gtk_ardour_trigger_region_list_h_
|
||||
|
||||
#include "region_list_base.h"
|
||||
|
||||
class TriggerRegionList : public RegionListBase
|
||||
{
|
||||
public:
|
||||
TriggerRegionList ();
|
||||
};
|
||||
|
||||
#endif /* _gtk_ardour_trigger_region_list_h_ */
|
||||
37
gtk2_ardour/trigger_source_list.cc
Normal file
37
gtk2_ardour/trigger_source_list.cc
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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 "ardour/region.h"
|
||||
#include "ardour/session.h"
|
||||
|
||||
#include "trigger_source_list.h"
|
||||
|
||||
#include "pbd/i18n.h"
|
||||
|
||||
using namespace Gtk;
|
||||
|
||||
TriggerSourceList::TriggerSourceList ()
|
||||
{
|
||||
add_name_column ();
|
||||
setup_col (append_col (_columns.channels, "Chans "), 1, ALIGN_LEFT, _("# Ch"), _("# Channels in the region"));
|
||||
add_tag_column ();
|
||||
|
||||
setup_col (append_col (_columns.captd_xruns, "1234567890"), 21, ALIGN_RIGHT, _("# Xruns"), _("Number of dropouts that occured during recording"));
|
||||
setup_col (append_col (_columns.take_id, "2021-01-19 02:34:03"), 18, ALIGN_LEFT, _("Take ID"), _("Take ID"));
|
||||
_display.get_column (0)->set_resizable (true);
|
||||
}
|
||||
29
gtk2_ardour/trigger_source_list.h
Normal file
29
gtk2_ardour/trigger_source_list.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (C) 2021 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.
|
||||
*/
|
||||
#ifndef _gtk_ardour_trigger_source_list_h_
|
||||
#define _gtk_ardour_trigger_source_list_h_
|
||||
|
||||
#include "source_list_base.h"
|
||||
|
||||
class TriggerSourceList : public SourceListBase
|
||||
{
|
||||
public:
|
||||
TriggerSourceList ();
|
||||
};
|
||||
|
||||
#endif /* _gtk_ardour_trigger_source_list_h_ */
|
||||
|
|
@ -801,12 +801,21 @@ TriggerEntry::drag_begin (Glib::RefPtr<Gdk::DragContext> const& context)
|
|||
/* ctx leaves scope, cr is destroyed, and pixmap surface is flush()ed */
|
||||
}
|
||||
|
||||
boost::shared_ptr<Region> region = trigger ()->region ();
|
||||
if (region) {
|
||||
PublicEditor::instance ().pbdid_dragged_dt = region->data_type ();
|
||||
} else {
|
||||
PublicEditor::instance ().pbdid_dragged_dt = DataType::NIL;
|
||||
}
|
||||
context->set_icon (pixmap->get_colormap (), pixmap, Glib::RefPtr<Gdk::Bitmap> (NULL), width / 2, height / 2);
|
||||
}
|
||||
|
||||
void
|
||||
TriggerEntry::drag_end (Glib::RefPtr<Gdk::DragContext> const&)
|
||||
{
|
||||
if (_drag_active) {
|
||||
PublicEditor::instance ().pbdid_dragged_dt = DataType::NIL;
|
||||
}
|
||||
_drag_active = false;
|
||||
}
|
||||
|
||||
|
|
@ -855,8 +864,6 @@ TriggerBoxUI::TriggerBoxUI (ArdourCanvas::Item* parent, TriggerBox& tb)
|
|||
}
|
||||
|
||||
std::vector<Gtk::TargetEntry> target_table;
|
||||
target_table.push_back (Gtk::TargetEntry ("x-ardour/region.erl", Gtk::TARGET_SAME_APP));
|
||||
target_table.push_back (Gtk::TargetEntry ("x-ardour/region.esl", Gtk::TARGET_SAME_APP));
|
||||
target_table.push_back (Gtk::TargetEntry ("x-ardour/region.pbdid", Gtk::TARGET_SAME_APP));
|
||||
target_table.push_back (Gtk::TargetEntry ("text/uri-list"));
|
||||
target_table.push_back (Gtk::TargetEntry ("text/plain"));
|
||||
|
|
@ -944,7 +951,8 @@ TriggerBoxUI::slot_at_y (int y) const
|
|||
bool
|
||||
TriggerBoxUI::drag_motion (Glib::RefPtr<Gdk::DragContext> const& context, int, int y, guint time)
|
||||
{
|
||||
bool can_drop = true;
|
||||
bool can_drop = PublicEditor::instance ().pbdid_dragged_dt == _triggerbox.data_type ();
|
||||
|
||||
uint64_t n = slot_at_y (y);
|
||||
if (n >= _slots.size ()) {
|
||||
assert (0);
|
||||
|
|
@ -986,21 +994,8 @@ TriggerBoxUI::drag_data_received (Glib::RefPtr<Gdk::DragContext> const& context,
|
|||
context->drag_finish (false, false, time);
|
||||
return;
|
||||
}
|
||||
if (data.get_target () == "x-ardour/region.erl" || data.get_target () == "x-ardour/region.esl") {
|
||||
boost::shared_ptr<Region> region = PublicEditor::instance ().get_dragged_region_from_sidebar ();
|
||||
if (region) {
|
||||
_triggerbox.set_from_selection (n, region);
|
||||
context->drag_finish (true, false, time);
|
||||
} else {
|
||||
context->drag_finish (false, false, time);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.get_target () == "x-ardour/region.pbdid") {
|
||||
/* Long term goal is to receive all information from another TriggerBox Slot,
|
||||
* not just the region.
|
||||
*/
|
||||
PBD::ID rid (data.get_data_as_string ());
|
||||
boost::shared_ptr<Region> region = RegionFactory::region_by_id (rid);
|
||||
if (region) {
|
||||
|
|
|
|||
|
|
@ -250,6 +250,7 @@ gtk2_ardour_sources = [
|
|||
'region_editor.cc',
|
||||
'region_gain_line.cc',
|
||||
'region_layering_order_editor.cc',
|
||||
'region_list_base.cc',
|
||||
'region_peak_cursor.cc',
|
||||
'region_selection.cc',
|
||||
'region_view.cc',
|
||||
|
|
@ -279,6 +280,7 @@ gtk2_ardour_sources = [
|
|||
'sfdb_ui.cc',
|
||||
'shuttle_control.cc',
|
||||
'slot_properties_box.cc',
|
||||
'source_list_base.cc',
|
||||
'soundcloud_export_selector.cc',
|
||||
'splash.cc',
|
||||
'speaker_dialog.cc',
|
||||
|
|
@ -312,6 +314,8 @@ gtk2_ardour_sources = [
|
|||
'transpose_dialog.cc',
|
||||
'trigger_clip_picker.cc',
|
||||
'trigger_page.cc',
|
||||
'trigger_region_list.cc',
|
||||
'trigger_source_list.cc',
|
||||
'trigger_strip.cc',
|
||||
'trigger_master.cc',
|
||||
'trigger_ui.cc',
|
||||
|
|
|
|||
|
|
@ -136,13 +136,15 @@ class /*LIBGTKMM2EXT_API*/ DnDTreeView : public DnDTreeViewBase
|
|||
|
||||
TreeView::on_drag_data_get (context, selection_data, info, time);
|
||||
|
||||
} else if (selection_data.get_target() == object_type) {
|
||||
} else if (selection_data.get_target() == object_type && drag_data.data_column >= 0) {
|
||||
|
||||
/* return a pointer to this object, which allows
|
||||
* the receiver to call on_drag_data_received()
|
||||
*/
|
||||
void *c = this;
|
||||
selection_data.set (8, (guchar*)&c, sizeof(void*));
|
||||
} else {
|
||||
TreeView::on_drag_data_get (context, selection_data, info, time);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -178,7 +180,7 @@ class /*LIBGTKMM2EXT_API*/ DnDTreeView : public DnDTreeViewBase
|
|||
|
||||
void get_object_drag_data (std::list<DataType>& l, Gtk::TreeView** source) const {
|
||||
|
||||
if (drag_data.source == 0) {
|
||||
if (drag_data.source == 0 || drag_data.data_column < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
4
wscript
4
wscript
|
|
@ -807,6 +807,8 @@ def options(opt):
|
|||
help='Compile with -rdynamic -- allow obtaining backtraces from within Ardour')
|
||||
opt.add_option('--no-carbon', action='store_true', default=False, dest='nocarbon',
|
||||
help='Compile without support for AU Plugins with only CARBON UI (needed for 64bit)')
|
||||
opt.add_option('--no-compile-database', action='store_true', default=False, dest='clang_compile_db',
|
||||
help='Do not call clang_compilation_database to write compile_commands.json prior to build')
|
||||
opt.add_option('--boost-sp-debug', action='store_true', default=False, dest='boost_sp_debug',
|
||||
help='Compile with Boost shared pointer debugging')
|
||||
opt.add_option('--debug-symbols', action='store_true', default=False, dest='debug_symbols',
|
||||
|
|
@ -935,7 +937,7 @@ def configure(conf):
|
|||
conf.load('compiler_cxx')
|
||||
if Options.options.dist_target == 'mingw':
|
||||
conf.load('winres')
|
||||
else:
|
||||
elif not Options.options.clang_compile_db:
|
||||
conf.load('clang_compilation_database')
|
||||
|
||||
if Options.options.dist_target == 'msvc':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue