incomplete work on mixer window treeview port
git-svn-id: svn://localhost/trunk/ardour2@45 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
8e13f13826
commit
3db47e694c
|
@ -109,9 +109,8 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, Route& rt
|
|||
playlist_button (_("p")),
|
||||
size_button (_("h")), // height
|
||||
automation_button (_("a")),
|
||||
visual_button (_("v")),
|
||||
redirect_window ("redirect window"),
|
||||
redirect_display (1)
|
||||
visual_button (_("v"))
|
||||
|
||||
{
|
||||
_has_state = true;
|
||||
subplugin_menu.set_name ("ArdourContextMenu");
|
||||
|
|
|
@ -151,22 +151,6 @@ class AudioTimeAxisView : public RouteUI, public TimeAxisView
|
|||
|
||||
gint edit_click (GdkEventButton *);
|
||||
|
||||
/* Redirect handling */
|
||||
|
||||
ArdourDialog redirect_window;
|
||||
Gtk::CList redirect_display;
|
||||
Gtk::Button redirect_add_button;
|
||||
Gtk::Button redirect_remove_button;
|
||||
Gtk::Button redirect_up_button;
|
||||
Gtk::Button redirect_down_button;
|
||||
Gtk::Button redirect_edit_button;
|
||||
Gtk::HBox redirect_button_box;
|
||||
Gtk::VBox redirect_vpacker;
|
||||
Gtk::HBox redirect_display_hpacker;
|
||||
|
||||
int redirect_selected_row;
|
||||
|
||||
|
||||
// variables to get the context menu
|
||||
// automation buttons correctly initialized
|
||||
bool show_gain_automation;
|
||||
|
|
|
@ -48,15 +48,6 @@ using namespace Gtk;
|
|||
using namespace Gtkmm2ext;
|
||||
using namespace sigc;
|
||||
|
||||
static const gchar* track_display_titles[] = {
|
||||
N_("Strips"),
|
||||
0
|
||||
};
|
||||
static const gchar* snapshot_display_titles[] = {
|
||||
N_("Snapshots"),
|
||||
0
|
||||
};
|
||||
|
||||
static const gchar* group_list_titles[] = {
|
||||
N_("***"),
|
||||
N_("Bar"),
|
||||
|
@ -73,10 +64,6 @@ Mixer_UI::Mixer_UI (AudioEngine& eng)
|
|||
: Gtk::Window (GTK_WINDOW_TOPLEVEL),
|
||||
KeyboardTarget (*this, "mixer"),
|
||||
engine (eng),
|
||||
track_display_list (internationalize (track_display_titles)),
|
||||
group_list (internationalize (group_list_titles)),
|
||||
snapshot_display (internationalize (snapshot_display_titles))
|
||||
|
||||
{
|
||||
_strip_width = Wide;
|
||||
track_menu = 0;
|
||||
|
@ -91,6 +78,7 @@ Mixer_UI::Mixer_UI (AudioEngine& eng)
|
|||
XMLNode* node = ARDOUR_UI::instance()->mixer_settings();
|
||||
set_state (*node);
|
||||
|
||||
|
||||
scroller_base.signal_add_event()s (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
|
||||
scroller_base.set_name ("MixerWindow");
|
||||
scroller_base.signal_button_release_event().connect (mem_fun(*this, &Mixer_UI::strip_scroller_button_release));
|
||||
|
@ -100,39 +88,38 @@ Mixer_UI::Mixer_UI (AudioEngine& eng)
|
|||
scroller.add_with_viewport (strip_packer);
|
||||
scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
|
||||
|
||||
track_display_list.column_titles_active();
|
||||
track_display_list.set_name ("MixerTrackDisplayList");
|
||||
track_display_list.set_shadow_type (Gtk::SHADOW_IN);
|
||||
track_display_list.set_selection_mode (GTK_SELECTION_MULTIPLE);
|
||||
track_display_list.set_reorderable (true);
|
||||
track_display_list.set_size_request (75, -1);
|
||||
track_display_model = ListStore::create (track_display_columns);
|
||||
track_display.set_model (track_display_model);
|
||||
track_display.append_column (_("Strips"));
|
||||
track_display.set_name (X_("MixerTrackDisplayList"));
|
||||
track_display.set_selection_mode (GTK_SELECTION_MULTIPLE);
|
||||
track_display.set_reorderable (true);
|
||||
track_display.set_size_request (75, -1);
|
||||
track_display.set_headers_visible (true);
|
||||
track_display.set_headers_clickable (true);
|
||||
track_display_scroller.add (track_display_list);
|
||||
track_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
|
||||
|
||||
snapshot_display.column_titles_active();
|
||||
group_display_model = ListStore::create (group_display_columns);
|
||||
group_display.set_model (group_display_model);
|
||||
group_display.append_column (_("Mix Groups"));
|
||||
group_display.set_name ("MixerGroupList");
|
||||
group_display.set_reorderable (true);
|
||||
group_display.set_size_request (true);
|
||||
group_display.set_headers_visible (true);
|
||||
group_display.set_headers_clickable (true);
|
||||
group_display_scroller.add (group_list);
|
||||
group_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
|
||||
|
||||
snapshot_display_model = ListStore::create (group_display_columns);
|
||||
snapshot_display.set_model (snapshot_display_model);
|
||||
snapshot_display.append_column (_("Mix Groups"));
|
||||
snapshot_display.set_name ("MixerSnapshotDisplayList");
|
||||
snapshot_display.set_shadow_type (Gtk::SHADOW_IN);
|
||||
snapshot_display.set_selection_mode (GTK_SELECTION_SINGLE);
|
||||
snapshot_display.set_reorderable (true);
|
||||
snapshot_display.set_size_request (75, -1);
|
||||
snapshot_display.set_reorderable (true);
|
||||
snapshot_display_scroller.add (snapshot_display);
|
||||
snapshot_display_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
|
||||
|
||||
group_list_button_label.set_text (_("Mix Groups"));
|
||||
group_list_button_label.set_name ("MixerGroupTitleButton");
|
||||
group_list_button.add (group_list_button_label);
|
||||
group_list_button.set_name ("MixerGroupTitleButton");
|
||||
|
||||
group_list.column_titles_hide();
|
||||
group_list.set_name ("MixerGroupList");
|
||||
group_list.set_shadow_type (Gtk::SHADOW_IN);
|
||||
group_list.set_selection_mode (GTK_SELECTION_MULTIPLE);
|
||||
group_list.set_reorderable (false);
|
||||
group_list.set_size_request (75, -1);
|
||||
group_list.set_column_auto_resize (0, true);
|
||||
group_list_scroller.add (group_list);
|
||||
group_list_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
|
||||
|
||||
group_list_vbox.pack_start (group_list_button, false, false);
|
||||
group_list_vbox.pack_start (group_list_scroller, true, true);
|
||||
|
||||
|
@ -191,21 +178,18 @@ Mixer_UI::Mixer_UI (AudioEngine& eng)
|
|||
set_title (_("ardour: mixer"));
|
||||
set_wmclass (_("ardour_mixer"), "Ardour");
|
||||
|
||||
delete_event.connect (bind (ptr_fun (just_hide_it),
|
||||
static_cast<Gtk::Window *>(this)));
|
||||
delete_event.connect (bind (ptr_fun (just_hide_it), static_cast<Gtk::Window *>(this)));
|
||||
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
|
||||
|
||||
snapshot_display.select_row.connect (mem_fun(*this, &Mixer_UI::snapshot_display_selected));
|
||||
track_display.get_selection()->signal_changed().connect (mem_fun(*this, &Mixer_UI::track_display_selection_changed));
|
||||
track_display_model.signal_rows_reordered().connect (mem_fun (*this, &Mixer_UI::track_display_reordered));
|
||||
track_display.signal_button_press_event().connect_notify (mem_fun (*this, &Mixer_UI::track_display_button_press));
|
||||
|
||||
track_display_list.select_row.connect (mem_fun(*this, &Mixer_UI::track_display_selected));
|
||||
track_display_list.unselect_row.connect (mem_fun(*this, &Mixer_UI::track_display_unselected));
|
||||
track_display_list.row_move.connect (mem_fun(*this, &Mixer_UI::queue_track_display_reordered));
|
||||
track_display_list.click_column.connect (mem_fun(*this, &Mixer_UI::track_column_click));
|
||||
group_display.signal_button_press_event().connect_notify (mem_fun (*this, &Mixer_UI::group_display_button_press));
|
||||
group_display.get_selection()->signal_changed().connect (mem_fun (*this, &Mixer_UI::group_display_selection_changed));
|
||||
|
||||
group_list_button.signal_clicked().connect (mem_fun(*this, &Mixer_UI::group_list_button_clicked));
|
||||
group_list.signal_button_press_event().connect (mem_fun(*this, &Mixer_UI::group_list_button_press_event));
|
||||
group_list.select_row.connect (mem_fun(*this, &Mixer_UI::group_selected));
|
||||
group_list.unselect_row.connect (mem_fun(*this, &Mixer_UI::group_unselected));
|
||||
snapshot_display.get_selection()->signal_changed().connect (mem_fun(*this, &Mixer_UI::snapshot_display_selection_changed));
|
||||
snapshot_display.signal_button_press_event().connect_notify (mem_fun (*this, &Mixer_UI::snapshot_display_button_press));
|
||||
|
||||
_plugin_selector = new PluginSelector (PluginManager::the_manager());
|
||||
_plugin_selector->signal_delete_event().connect (bind (ptr_fun (just_hide_it),
|
||||
|
@ -258,16 +242,13 @@ Mixer_UI::add_strip (Route* route)
|
|||
strip->set_width (_strip_width);
|
||||
show_strip (strip);
|
||||
|
||||
const gchar* rowdata[1];
|
||||
rowdata[0] = route->name().c_str();
|
||||
|
||||
track_display_list.freeze ();
|
||||
track_display_list.rows().push_back (rowdata);
|
||||
track_display_list.rows().back().set_data (strip);
|
||||
track_display_list.thaw ();
|
||||
TreeModel::
|
||||
TreeModel::Row row = *(track_display_model->append());
|
||||
row[columns.text] = route->name();
|
||||
row[columns.data] = strip;
|
||||
|
||||
if (strip->marked_for_display() || strip->packed()) {
|
||||
track_display_list.rows().back().select ();
|
||||
track_display.get_selection()->select (row);
|
||||
}
|
||||
|
||||
route->name_changed.connect (bind (mem_fun(*this, &Mixer_UI::strip_name_changed), strip));
|
||||
|
@ -285,16 +266,17 @@ Mixer_UI::remove_strip (MixerStrip* strip)
|
|||
{
|
||||
ENSURE_GUI_THREAD(bind (mem_fun(*this, &Mixer_UI::remove_strip), strip));
|
||||
|
||||
CList_Helpers::RowList::iterator ri;
|
||||
TreeModel::Children::iterator rows = track_display_model.children();
|
||||
TreeModel::Children::iterator ri;
|
||||
list<MixerStrip *>::iterator i;
|
||||
|
||||
if ((i = find (strips.begin(), strips.end(), strip)) != strips.end()) {
|
||||
strips.erase (i);
|
||||
}
|
||||
|
||||
for (ri = track_display_list.rows().begin(); ri != track_display_list.rows().end(); ++ri) {
|
||||
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
||||
if ((MixerStrip *) ri->get_data () == strip) {
|
||||
track_display_list.rows().erase (ri);
|
||||
track_display_model.erase (ri);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -343,12 +325,14 @@ Mixer_UI::connect_to_session (Session* sess)
|
|||
wintitle += session->name();
|
||||
set_title (wintitle);
|
||||
|
||||
track_display_list.freeze ();
|
||||
track_display_list.clear ();
|
||||
// GTK2FIX
|
||||
// track_display_list.freeze ();
|
||||
|
||||
track_display_model.clear ();
|
||||
|
||||
session->foreach_route (this, &Mixer_UI::add_strip);
|
||||
|
||||
track_display_list.thaw ();
|
||||
// track_display_list.thaw ();
|
||||
|
||||
session->going_away.connect (mem_fun(*this, &Mixer_UI::disconnect_from_session));
|
||||
session->RouteAdded.connect (mem_fun(*this, &Mixer_UI::add_strip));
|
||||
|
@ -379,21 +363,25 @@ void
|
|||
Mixer_UI::hide_all_strips (bool with_select)
|
||||
{
|
||||
MixerStrip* ms;
|
||||
CList_Helpers::RowList::iterator i;
|
||||
TreeModel::Children rows = track_display_model->children();
|
||||
TreeModel::Children::iterator i;
|
||||
|
||||
track_display_list.freeze ();
|
||||
// GTK2FIX
|
||||
// track_display_list.freeze ();
|
||||
|
||||
for (i = track_display_list.rows().begin(); i != track_display_list.rows().end(); ++i) {
|
||||
ms = (MixerStrip *) i->get_data ();
|
||||
|
||||
for (i = rows.begin(); i != rows.end(); ++i) {
|
||||
|
||||
TreeModel::Row row = (*i);
|
||||
MixerStrip* ms = row[columns.data];
|
||||
|
||||
if (with_select) {
|
||||
i->unselect ();
|
||||
track_display.get_selection()->unselect (i);
|
||||
} else {
|
||||
hide_strip (ms);
|
||||
}
|
||||
}
|
||||
|
||||
track_display_list.thaw ();
|
||||
// track_display_list.thaw ();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -405,87 +393,60 @@ Mixer_UI::unselect_all_strips ()
|
|||
void
|
||||
Mixer_UI::select_all_strips ()
|
||||
{
|
||||
CList_Helpers::RowList::iterator i;
|
||||
TreeModel::Children rows = track_display_model->children();
|
||||
TreeModel::Children::iterator i;
|
||||
|
||||
for (i = track_display_list.rows().begin(); i != track_display_list.rows().end(); ++i) {
|
||||
i->select ();
|
||||
for (i = rows.begin(); i != rows.end(); ++i) {
|
||||
track_display.get_selection()->select (i);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Mixer_UI::strip_select_op (bool audiotrack, bool select)
|
||||
{
|
||||
MixerStrip* ms;
|
||||
TreeModel::Children rows = track_display_model->children();
|
||||
TreeModel::Children::iterator i;
|
||||
|
||||
// GTK2FIX
|
||||
// track_display_list.freeze ();
|
||||
|
||||
for (i = rows.begin(); i != rows.end(); ++i) {
|
||||
ms = (MixerStrip *) (*i)[columns.data];
|
||||
|
||||
if (ms->is_audio_track() == audiotrack) {
|
||||
if (select) {
|
||||
track_display.get_selection()->select (i);
|
||||
} else {
|
||||
track_display.get_selection()->unselect (i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// track_display_list.thaw ();
|
||||
}
|
||||
|
||||
void
|
||||
Mixer_UI::select_all_audiotrack_strips ()
|
||||
{
|
||||
MixerStrip* ms;
|
||||
CList_Helpers::RowList::iterator i;
|
||||
|
||||
track_display_list.freeze ();
|
||||
|
||||
for (i = track_display_list.rows().begin(); i != track_display_list.rows().end(); ++i) {
|
||||
ms = (MixerStrip *) i->get_data ();
|
||||
|
||||
if (ms->is_audio_track()) {
|
||||
i->select ();
|
||||
}
|
||||
}
|
||||
|
||||
track_display_list.thaw ();
|
||||
strip_select_op (true, true);
|
||||
}
|
||||
|
||||
void
|
||||
Mixer_UI::unselect_all_audiotrack_strips ()
|
||||
{
|
||||
MixerStrip* ms;
|
||||
CList_Helpers::RowList::iterator i;
|
||||
|
||||
track_display_list.freeze ();
|
||||
|
||||
for (i = track_display_list.rows().begin(); i != track_display_list.rows().end(); ++i) {
|
||||
ms = (MixerStrip *) i->get_data ();
|
||||
|
||||
if (ms->is_audio_track()) {
|
||||
i->unselect ();
|
||||
}
|
||||
}
|
||||
|
||||
track_display_list.thaw ();
|
||||
strip_select_op (true, false);
|
||||
}
|
||||
|
||||
void
|
||||
Mixer_UI::select_all_audiobus_strips ()
|
||||
{
|
||||
MixerStrip* ms;
|
||||
CList_Helpers::RowList::iterator i;
|
||||
|
||||
track_display_list.freeze ();
|
||||
|
||||
for (i = track_display_list.rows().begin(); i != track_display_list.rows().end(); ++i) {
|
||||
ms = (MixerStrip *) i->get_data ();
|
||||
|
||||
if (!ms->is_audio_track()) {
|
||||
i->select ();
|
||||
}
|
||||
}
|
||||
|
||||
track_display_list.thaw ();
|
||||
strip_select_op (false, true);
|
||||
}
|
||||
|
||||
void
|
||||
Mixer_UI::unselect_all_audiobus_strips ()
|
||||
Mixer_UI::select_all_audiobus_strips ()
|
||||
{
|
||||
MixerStrip* ms;
|
||||
CList_Helpers::RowList::iterator i;
|
||||
|
||||
track_display_list.freeze ();
|
||||
|
||||
for (i = track_display_list.rows().begin(); i != track_display_list.rows().end(); ++i) {
|
||||
ms = (MixerStrip *) i->get_data ();
|
||||
|
||||
if (!ms->is_audio_track()) {
|
||||
i->unselect ();
|
||||
}
|
||||
}
|
||||
|
||||
track_display_list.thaw ();
|
||||
strip_select_op (false, false);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -568,31 +529,25 @@ Mixer_UI::snapshot_display_selected (gint row, gint col, GdkEvent* ev)
|
|||
}
|
||||
|
||||
void
|
||||
Mixer_UI::track_display_selected (gint row, gint col, GdkEvent* ev)
|
||||
Mixer_UI::track_display_selection_changed ()
|
||||
{
|
||||
MixerStrip* strip;
|
||||
|
||||
if ((strip = (MixerStrip *) track_display_list.get_row_data (row)) != 0) {
|
||||
strip->set_marked_for_display (true);
|
||||
show_strip (strip);
|
||||
TreeModel::Children rows = track_display_model->children();
|
||||
TreeModel::Children::iterator i;
|
||||
Glib::RefPtr<TreeViewSelection> selection = track_display.get_selection();
|
||||
|
||||
/* just redraw the whole thing so that we get the right order
|
||||
when we reinsert the strip.
|
||||
*/
|
||||
|
||||
track_display_reordered ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Mixer_UI::track_display_unselected (gint row, gint col, GdkEvent* ev)
|
||||
{
|
||||
MixerStrip* strip;
|
||||
|
||||
if ((strip = (MixerStrip *) track_display_list.get_row_data (row)) != 0) {
|
||||
strip->set_marked_for_display (false);
|
||||
hide_strip (strip);
|
||||
for (i = rows.begin(); i != rows.end(); ++i) {
|
||||
if (selection->is_selected (i)) {
|
||||
strip->set_marked_for_display (true);
|
||||
show_strip (strip);
|
||||
} else {
|
||||
strip->set_marked_for_display (false);
|
||||
hide_strip (strip);
|
||||
}
|
||||
}
|
||||
|
||||
track_display_reordered ();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -855,23 +810,16 @@ Mixer_UI::redisplay_snapshots ()
|
|||
return;
|
||||
}
|
||||
|
||||
snapshot_display.freeze();
|
||||
snapshot_display.rows().clear ();
|
||||
|
||||
snapshot_display_model.clear ();
|
||||
|
||||
for (vector<string*>::iterator i = states->begin(); i != states->end(); ++i) {
|
||||
string statename = *(*i);
|
||||
const char *rowtext[1];
|
||||
|
||||
rowtext[0] = statename.c_str();
|
||||
|
||||
snapshot_display.rows().push_back (rowtext);
|
||||
snapshot_display.rows().back().set_data (new string (statename), deferred_delete<string>);
|
||||
|
||||
delete *i;
|
||||
row = *(snapshot_display_model->append());
|
||||
row[visible] = statename;
|
||||
row[hidden] = statename;
|
||||
}
|
||||
|
||||
delete states;
|
||||
snapshot_display.thaw();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -23,7 +23,15 @@
|
|||
|
||||
#include <list>
|
||||
|
||||
#include <gtkmm.h>
|
||||
#include <gtkmm/box.h>
|
||||
#include <gtkmm/scrolledwindow.h>
|
||||
#include <gtkmm/eventbox.h>
|
||||
#include <gtkmm/label.h>
|
||||
#include <gtkmm/button.h>
|
||||
#include <gtkmm/frame.h>
|
||||
#include <gtkmm/paned.h>
|
||||
#include <gtkmm/menu.h>
|
||||
#include <gtkmm/treeview.h>
|
||||
|
||||
#include <ardour/ardour.h>
|
||||
#include <ardour/stateful.h>
|
||||
|
@ -80,12 +88,11 @@ class Mixer_UI : public Gtk::Window, public KeyboardTarget
|
|||
Gtk::HBox scroller_hpacker;
|
||||
Gtk::VBox mixer_scroller_vpacker;
|
||||
Gtk::VBox list_vpacker;
|
||||
Gtk::CList track_display_list;
|
||||
Gtk::CList group_list;
|
||||
Gtk::Label group_list_button_label;
|
||||
Gtk::Button group_list_button;
|
||||
Gtk::ScrolledWindow track_display_scroller;
|
||||
Gtk::ScrolledWindow group_list_scroller;
|
||||
Gtk::ScrolledWindow snapshot_display_scroller;
|
||||
Gtk::VBox group_list_vbox;
|
||||
Gtk::Frame track_display_frame;
|
||||
Gtk::Frame group_list_frame;
|
||||
|
@ -157,10 +164,45 @@ class Mixer_UI : public Gtk::Window, public KeyboardTarget
|
|||
|
||||
void group_flags_changed (void *src, ARDOUR::RouteGroup *);
|
||||
|
||||
/* snapshots */
|
||||
/* various treeviews */
|
||||
|
||||
Gtk::CList snapshot_display;
|
||||
Gtk::ScrolledWindow snapshot_display_scroller;
|
||||
template<class T> struct TextDataModelColumns : public Gtk::TreeModel::ColumnRecord {
|
||||
TrackListModelColumns() {
|
||||
add (text);
|
||||
add (data);
|
||||
}
|
||||
Gtk::TreeModelColumn<std::string> text;
|
||||
Gtk::TreeModelColumn<T*> data;
|
||||
};
|
||||
|
||||
struct TextPairModelColumns : public Gtk::TreeModel::ColumnRecord {
|
||||
TrackListModelColumns() {
|
||||
add (visible);
|
||||
add (hidden);
|
||||
}
|
||||
Gtk::TreeModelColumn<std::string> visible;
|
||||
Gtk::TreeModelColumn<std::string> hidden;
|
||||
};
|
||||
|
||||
TextDataModelColumns<ARDOUR::Route> track_display_columns;
|
||||
TextDataGroupListModelColumns<ARDOUR::RouteGroup> group_list_columns;
|
||||
TextPairModelColumns snapshot_display_columns;
|
||||
|
||||
Gtk::TreeView track_display;
|
||||
Gtk::TreeView group_display;
|
||||
Gtk::TreeView snapshot_display;
|
||||
|
||||
Glib::RefPtr<Gtk::ListStore> track_display_model;
|
||||
Glib::RefPtr<Gtk::ListStore> group_display_model;
|
||||
Glib::RefPtr<Gtk::ListStore> snapshot_display_model;
|
||||
|
||||
bool track_display_button_press (GdkEventButton*);
|
||||
bool group_display_button_press (GdkEventButton*);
|
||||
bool snapshot_display_button_press (GdkEventButton*);
|
||||
|
||||
void track_display_selection_changed ();
|
||||
void group_display_selection_changed ();
|
||||
void snapshot_display_selection_changed ();
|
||||
|
||||
void redisplay_snapshots();
|
||||
void session_state_saved (string);
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
*/
|
||||
|
||||
#include <gtkmm/button.h>
|
||||
#include <gtkmm/ctree.h>
|
||||
|
||||
#include <ardour/session_playlist.h>
|
||||
#include <ardour/diskstream.h>
|
||||
|
@ -42,14 +41,8 @@ using namespace sigc;
|
|||
using namespace Gtk;
|
||||
using namespace ARDOUR;
|
||||
|
||||
static const gchar *tree_display_titles[] = {
|
||||
N_("Playlists grouped by track"),
|
||||
0
|
||||
};
|
||||
|
||||
PlaylistSelector::PlaylistSelector ()
|
||||
: ArdourDialog ("playlist selector"),
|
||||
tree (internationalize (tree_display_titles)),
|
||||
close_button (_("close"))
|
||||
{
|
||||
rui = 0;
|
||||
|
@ -61,7 +54,11 @@ PlaylistSelector::PlaylistSelector ()
|
|||
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
|
||||
set_size_request (300, 200);
|
||||
|
||||
scroller.add_with_viewport (tree);
|
||||
model = TreeStore::create (columns);
|
||||
tree.set_model (model);
|
||||
tree.append_column (_("Playlists grouped by track"), columns.text);
|
||||
|
||||
scroller.add (tree);
|
||||
scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
|
||||
|
||||
close_button.signal_clicked().connect (mem_fun(*this, &PlaylistSelector::close_button_click));
|
||||
|
@ -91,11 +88,7 @@ PlaylistSelector::clear_map ()
|
|||
void
|
||||
PlaylistSelector::show_for (RouteUI* ruix)
|
||||
{
|
||||
using namespace CTree_Helpers;
|
||||
vector<const char*> item;
|
||||
RowList::iterator i;
|
||||
RowList::iterator tmpi;
|
||||
RowList::iterator others;
|
||||
DiskStream* this_ds;
|
||||
string str;
|
||||
|
||||
|
@ -109,19 +102,17 @@ PlaylistSelector::show_for (RouteUI* ruix)
|
|||
clear_map ();
|
||||
select_connection.disconnect ();
|
||||
|
||||
/* ---------------------------------------- */
|
||||
/* XXX MAKE ME A FUNCTION (no CTree::clear() in gtkmm 1.2) */
|
||||
gtk_ctree_remove_node (tree.gobj(), NULL);
|
||||
/* ---------------------------------------- */
|
||||
model.clear ();
|
||||
|
||||
session->foreach_playlist (this, &PlaylistSelector::add_playlist_to_map);
|
||||
|
||||
this_ds = rui->get_diskstream();
|
||||
|
||||
item.clear();
|
||||
item.push_back (_("Other tracks"));
|
||||
others = tree.rows().insert (tree.rows().begin(), Element (item));
|
||||
Gtk::TreeModel::Row others = *(model->append ());
|
||||
|
||||
others[columns.text] = _("Other tracks");
|
||||
others[columns.playlist] = 0;
|
||||
|
||||
for (DSPL_Map::iterator x = dspl_map.begin(); x != dspl_map.end(); ++x) {
|
||||
|
||||
DiskStream* ds = session->diskstream_by_id (x->first);
|
||||
|
@ -132,48 +123,52 @@ PlaylistSelector::show_for (RouteUI* ruix)
|
|||
|
||||
/* add a node for the diskstream */
|
||||
|
||||
item.clear ();
|
||||
string nodename;
|
||||
|
||||
if (ds->name().empty()) {
|
||||
item.push_back (_("unassigned"));
|
||||
nodename = _("unassigned");
|
||||
} else {
|
||||
item.push_back (ds->name().c_str());
|
||||
}
|
||||
|
||||
if (ds == this_ds) {
|
||||
i = tree.rows().insert (tree.rows().begin(),
|
||||
Gtk::CTree_Helpers::Element (item));
|
||||
} else {
|
||||
i = others->subtree().insert (others->subtree().end(),
|
||||
Gtk::CTree_Helpers::Element (item));
|
||||
nodename = ds->name().c_str();
|
||||
}
|
||||
|
||||
TreeModel::Row row;
|
||||
TreeModel::Row* selected_row = 0;
|
||||
TreePath this_path;
|
||||
|
||||
if (ds == this_ds) {
|
||||
row = *(model->prepend());
|
||||
row[columns.text] = nodename;
|
||||
row[columns.playlist] = 0;
|
||||
} else {
|
||||
row = *(model->append (others.children()));
|
||||
row[columns.text] = nodename;
|
||||
row[columns.playlist] = 0;
|
||||
}
|
||||
|
||||
/* Now insert all the playlists for this diskstream/track in a subtree */
|
||||
|
||||
list<Playlist*> *pls = x->second;
|
||||
|
||||
|
||||
for (list<Playlist*>::iterator p = pls->begin(); p != pls->end(); ++p) {
|
||||
|
||||
item.clear ();
|
||||
item.push_back ((*p)->name().c_str());
|
||||
TreeModel::Row child_row;
|
||||
|
||||
tmpi = i->subtree().insert (i->subtree().end(), Element (item));
|
||||
child_row = *(model->append (row.children()));
|
||||
child_row[columns.text] = (*p)->name();
|
||||
child_row[columns.playlist] = *p;
|
||||
|
||||
if (*p == this_ds->playlist()) {
|
||||
(*tmpi).select ();
|
||||
selected_row = &child_row;
|
||||
}
|
||||
|
||||
(*tmpi).set_data (*p);
|
||||
|
||||
}
|
||||
|
||||
if (ds == this_ds) {
|
||||
i->expand ();
|
||||
|
||||
if (selected_row != 0) {
|
||||
tree.get_selection()->select (*selected_row);
|
||||
}
|
||||
}
|
||||
|
||||
show_all ();
|
||||
select_connection = tree.tree_select_row.connect (mem_fun(*this, &PlaylistSelector::row_selected));
|
||||
select_connection = tree.get_selection()->signal_changed().connect (mem_fun(*this, &PlaylistSelector::selection_changed));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -221,11 +216,18 @@ PlaylistSelector::close_button_click ()
|
|||
}
|
||||
|
||||
void
|
||||
PlaylistSelector::row_selected (Gtk::CTree::Row row, gint col)
|
||||
PlaylistSelector::selection_changed ()
|
||||
{
|
||||
Playlist *playlist;
|
||||
|
||||
if ((playlist = (Playlist *) row.get_data()) != 0) {
|
||||
|
||||
TreeModel::iterator iter = tree.get_selection()->get_selected();
|
||||
|
||||
if (!iter) {
|
||||
/* nothing selected */
|
||||
return;
|
||||
}
|
||||
|
||||
if ((playlist = ((*iter)[columns.playlist])) != 0) {
|
||||
|
||||
AudioTrack* at;
|
||||
AudioPlaylist* apl;
|
||||
|
@ -246,4 +248,4 @@ PlaylistSelector::row_selected (Gtk::CTree::Row row, gint col)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -20,8 +20,10 @@
|
|||
#ifndef __ardour_playlist_selector_h__
|
||||
#define __ardour_playlist_selector_h__
|
||||
|
||||
#include <gtkmm.h>
|
||||
#include <gtkmm/ctree.h>
|
||||
#include <gtkmm/box.h>
|
||||
#include <gtkmm/scrolledwindow.h>
|
||||
#include <gtkmm/button.h>
|
||||
#include <gtkmm/treeview.h>
|
||||
#include <gtkmm2ext/selector.h>
|
||||
|
||||
#include <ardour_dialog.h>
|
||||
|
@ -49,7 +51,6 @@ class PlaylistSelector : public ArdourDialog
|
|||
ARDOUR::Session* session;
|
||||
Gtk::VBox vpacker;
|
||||
Gtk::ScrolledWindow scroller;
|
||||
Gtk::CTree tree;
|
||||
Gtk::Button close_button;
|
||||
DSPL_Map dspl_map;
|
||||
RouteUI* rui;
|
||||
|
@ -59,7 +60,20 @@ class PlaylistSelector : public ArdourDialog
|
|||
void add_playlist_to_map (ARDOUR::Playlist*);
|
||||
void clear_map ();
|
||||
void close_button_click ();
|
||||
void row_selected (Gtk::CTree::Row, int32_t col);
|
||||
void selection_changed ();
|
||||
|
||||
struct ModelColumns : public Gtk::TreeModel::ColumnRecord {
|
||||
ModelColumns () {
|
||||
add (text);
|
||||
add (playlist);
|
||||
}
|
||||
Gtk::TreeModelColumn<std::string> text;
|
||||
Gtk::TreeModelColumn<ARDOUR::Playlist*> playlist;
|
||||
};
|
||||
|
||||
ModelColumns columns;
|
||||
Glib::RefPtr<Gtk::TreeStore> model;
|
||||
Gtk::TreeView tree;
|
||||
};
|
||||
|
||||
#endif // __ardour_playlist_selector_h__
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <gtkmm2ext/utils.h>
|
||||
|
||||
#include "tempo_dialog.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
|
@ -82,11 +83,11 @@ TempoDialog::init (const BBT_Time& when, double bpm, bool movable)
|
|||
when_table.set_col_spacings (2);
|
||||
when_table.set_border_width (5);
|
||||
|
||||
when_table.attach (when_bar_label, 0, 1, 0, 1, 0, Gtk::FILL|Gtk::EXPAND);
|
||||
when_table.attach (when_bar_entry, 0, 1, 1, 2, 0, Gtk::FILL|Gtk::EXPAND);
|
||||
when_table.attach (when_bar_label, 0, 1, 0, 1, Gtk::AttachOptions(0), Gtk::FILL|Gtk::EXPAND);
|
||||
when_table.attach (when_bar_entry, 0, 1, 1, 2, Gtk::AttachOptions(0), Gtk::FILL|Gtk::EXPAND);
|
||||
|
||||
when_table.attach (when_beat_label, 1, 2, 0, 1, 0, 0);
|
||||
when_table.attach (when_beat_entry, 1, 2, 1, 2, 0, 0);
|
||||
when_table.attach (when_beat_label, 1, 2, 0, 1, Gtk::AttachOptions(0), Gtk::AttachOptions(0));
|
||||
when_table.attach (when_beat_entry, 1, 2, 1, 2, Gtk::AttachOptions(0), Gtk::AttachOptions(0));
|
||||
|
||||
when_frame.set_name ("MetricDialogFrame");
|
||||
when_frame.add (when_table);
|
||||
|
@ -184,26 +185,27 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova
|
|||
strings.push_back (_("thirty-second (32)"));
|
||||
|
||||
set_popdown_strings (note_types, strings);
|
||||
|
||||
|
||||
if (note_type==1.0f)
|
||||
note_types.get_entry()->set_text(_("whole (1)"));
|
||||
note_types.set_active_text (_("whole (1)"));
|
||||
else if (note_type==2.0f)
|
||||
note_types.get_entry()->set_text(_("second (2)"));
|
||||
note_types.set_active_text (_("second (2)"));
|
||||
else if (note_type==3.0f)
|
||||
note_types.get_entry()->set_text(_("third (3)"));
|
||||
note_types.set_active_text (_("third (3)"));
|
||||
else if (note_type==4.0f)
|
||||
note_types.get_entry()->set_text(_("quarter (4)"));
|
||||
note_types.set_active_text (_("quarter (4)"));
|
||||
else if (note_type==8.0f)
|
||||
note_types.get_entry()->set_text(_("eighth (8)"));
|
||||
note_types.set_active_text (_("eighth (8)"));
|
||||
else if (note_type==16.0f)
|
||||
note_types.get_entry()->set_text(_("sixteenth (16)"));
|
||||
note_types.set_active_text (_("sixteenth (16)"));
|
||||
else if (note_type==32.0f)
|
||||
note_types.get_entry()->set_text(_("thirty-second (32)"));
|
||||
note_types.set_active_text (_("thirty-second (32)"));
|
||||
else
|
||||
note_types.get_entry()->set_text(_("quarter (4)"));
|
||||
note_types.set_active_text (_("quarter (4)"));
|
||||
|
||||
/* strings.back() just happens to be the longest one to display */
|
||||
Gtkmm2ext::set_size_request_to_display_given_text (*(note_types.get_entry()), strings.back(), 7, 7);
|
||||
// GTK2FIX
|
||||
// Gtkmm2ext::set_size_request_to_display_given_text (*(note_types.get_entry()), strings.back(), 7, 7);
|
||||
|
||||
hspacer1.set_border_width (5);
|
||||
hspacer1.pack_start (note_types, false, false);
|
||||
|
@ -247,11 +249,11 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova
|
|||
when_table.set_col_spacings (2);
|
||||
when_table.set_border_width (5);
|
||||
|
||||
when_table.attach (when_bar_label, 0, 1, 0, 1, 0, Gtk::FILL|Gtk::EXPAND);
|
||||
when_table.attach (when_bar_entry, 0, 1, 1, 2, 0, Gtk::FILL|Gtk::EXPAND);
|
||||
when_table.attach (when_bar_label, 0, 1, 0, 1, Gtk::AttachOptions(0), Gtk::FILL|Gtk::EXPAND);
|
||||
when_table.attach (when_bar_entry, 0, 1, 1, 2, Gtk::AttachOptions(0), Gtk::FILL|Gtk::EXPAND);
|
||||
|
||||
when_table.attach (when_beat_label, 1, 2, 0, 1, 0, 0);
|
||||
when_table.attach (when_beat_entry, 1, 2, 1, 2, 0, 0);
|
||||
when_table.attach (when_beat_label, 1, 2, 0, 1, Gtk::AttachOptions(0), Gtk::AttachOptions(0));
|
||||
when_table.attach (when_beat_entry, 1, 2, 1, 2, Gtk::AttachOptions(0), Gtk::AttachOptions(0));
|
||||
|
||||
when_frame.set_name ("MetricDialogFrame");
|
||||
when_frame.add (when_table);
|
||||
|
@ -265,7 +267,6 @@ MeterDialog::init (const BBT_Time& when, double bpb, double note_type, bool mova
|
|||
|
||||
bpb_frame.set_name ("MetricDialogFrame");
|
||||
note_frame.set_name ("MetricDialogFrame");
|
||||
note_types.get_entry()->set_name ("MetricEntry");
|
||||
bpb_entry.set_name ("MetricEntry");
|
||||
ok_button.set_name ("MetricButton");
|
||||
cancel_button.set_name ("MetricButton");
|
||||
|
@ -293,7 +294,7 @@ MeterDialog::get_note_type ()
|
|||
{
|
||||
double note_type = 0;
|
||||
vector<const gchar *>::iterator i;
|
||||
string text = note_types.get_entry()->get_text();
|
||||
string text = note_types.get_active_text();
|
||||
|
||||
for (i = strings.begin(); i != strings.end(); ++i) {
|
||||
if (text == *i) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user