Playlist UI tweaks: Update PlaylistSelector (gtk2_ardour part)
Window is now no longer modal Subscribes to new Track::PlaylistAdded signal Move RouteUI setting to new dedicated method Rename show_for to show Hide PlaylistSelector if DropReference signal is emitted
This commit is contained in:
parent
f6d2229c47
commit
a51e51b4f2
|
@ -48,7 +48,7 @@ PlaylistSelector::PlaylistSelector ()
|
|||
rui = 0;
|
||||
|
||||
set_name ("PlaylistSelectorWindow");
|
||||
set_modal(true);
|
||||
set_modal(false);
|
||||
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
|
||||
set_size_request (300, 200);
|
||||
|
||||
|
@ -68,7 +68,33 @@ PlaylistSelector::PlaylistSelector ()
|
|||
Button* ok_btn = add_button (_("OK"), RESPONSE_OK);
|
||||
close_btn->signal_clicked().connect (sigc::mem_fun(*this, &PlaylistSelector::close_button_click));
|
||||
ok_btn->signal_clicked().connect (sigc::mem_fun(*this, &PlaylistSelector::ok_button_click));
|
||||
}
|
||||
|
||||
void PlaylistSelector::set_rui(RouteUI* ruix)
|
||||
{
|
||||
if (rui == ruix) {
|
||||
return;
|
||||
}
|
||||
|
||||
rui = ruix;
|
||||
|
||||
boost::shared_ptr<Track> this_track = rui->track();
|
||||
|
||||
if (this_track) {
|
||||
this_track->PlaylistAdded.connect(
|
||||
signal_connections,
|
||||
invalidator(*this),
|
||||
boost::bind(&PlaylistSelector::playlist_added, this),
|
||||
gui_context()
|
||||
);
|
||||
|
||||
this_track->DropReferences.connect(
|
||||
signal_connections,
|
||||
invalidator(*this),
|
||||
boost::bind(&PlaylistSelector::ok_button_click, this),
|
||||
gui_context()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
PlaylistSelector::~PlaylistSelector ()
|
||||
|
@ -96,13 +122,11 @@ PlaylistSelector::on_unmap_event (GdkEventAny* ev)
|
|||
}
|
||||
|
||||
void
|
||||
PlaylistSelector::show_for (RouteUI* ruix)
|
||||
PlaylistSelector::redisplay()
|
||||
{
|
||||
vector<const char*> item;
|
||||
string str;
|
||||
|
||||
rui = ruix;
|
||||
|
||||
set_title (string_compose (_("Playlist for %1"), rui->route()->name()));
|
||||
|
||||
clear_map ();
|
||||
|
@ -220,6 +244,10 @@ PlaylistSelector::add_playlist_to_map (boost::shared_ptr<Playlist> pl)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!rui) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (rui->is_midi_track ()) {
|
||||
if (boost::dynamic_pointer_cast<MidiPlaylist> (pl) == 0) {
|
||||
return;
|
||||
|
@ -240,6 +268,12 @@ PlaylistSelector::add_playlist_to_map (boost::shared_ptr<Playlist> pl)
|
|||
x->second->push_back (pl);
|
||||
}
|
||||
|
||||
void
|
||||
PlaylistSelector::playlist_added()
|
||||
{
|
||||
redisplay();
|
||||
}
|
||||
|
||||
void
|
||||
PlaylistSelector::close_button_click ()
|
||||
{
|
||||
|
|
|
@ -47,7 +47,8 @@ public:
|
|||
PlaylistSelector ();
|
||||
~PlaylistSelector ();
|
||||
|
||||
void show_for (RouteUI*);
|
||||
void redisplay();
|
||||
void set_rui(RouteUI*);
|
||||
|
||||
protected:
|
||||
bool on_unmap_event (GdkEventAny*);
|
||||
|
@ -60,8 +61,10 @@ private:
|
|||
RouteUI* rui;
|
||||
|
||||
sigc::connection select_connection;
|
||||
PBD::ScopedConnectionList signal_connections;
|
||||
|
||||
void add_playlist_to_map (boost::shared_ptr<ARDOUR::Playlist>);
|
||||
void playlist_added();
|
||||
void clear_map ();
|
||||
void close_button_click ();
|
||||
void ok_button_click ();
|
||||
|
|
|
@ -1384,7 +1384,39 @@ RouteTimeAxisView::paste (samplepos_t pos, const Selection& selection, PasteCont
|
|||
void
|
||||
RouteTimeAxisView::update_playlist_tip ()
|
||||
{
|
||||
set_tooltip (playlist_button, playlist_tip ());
|
||||
RouteGroup* rg = route_group ();
|
||||
if (rg && rg->is_active() && rg->enabled_property (ARDOUR::Properties::group_select.property_id)) {
|
||||
string group_string = "." + rg->name() + ".";
|
||||
|
||||
string take_name = track()->playlist()->name();
|
||||
string::size_type idx = take_name.find(group_string);
|
||||
|
||||
if (idx != string::npos) {
|
||||
/* find the bit containing the take number / name */
|
||||
take_name = take_name.substr (idx + group_string.length());
|
||||
|
||||
/* set the playlist button tooltip to the take name */
|
||||
set_tooltip (
|
||||
playlist_button,
|
||||
string_compose(_("Take: %1.%2"),
|
||||
Gtkmm2ext::markup_escape_text (rg->name()),
|
||||
Gtkmm2ext::markup_escape_text (take_name))
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* set the playlist button tooltip to the playlist name */
|
||||
set_tooltip (playlist_button, _("Playlist") + std::string(": ") + Gtkmm2ext::markup_escape_text (track()->playlist()->name()));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
RouteTimeAxisView::show_playlist_selector ()
|
||||
{
|
||||
_editor.playlist_selector().set_rui(this);
|
||||
_editor.playlist_selector().redisplay();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue