enabled multiple selection for the Live Mode window;
it only works with the Delete button so far. (part of #1940)
This commit is contained in:
parent
40df10d876
commit
db8b0de70f
2 changed files with 37 additions and 21 deletions
|
@ -93,6 +93,7 @@ LiveModeWindow :: LiveModeWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
||||||
|
|
||||||
// ... and the tree view:
|
// ... and the tree view:
|
||||||
treeView = Gtk::manage(wf->createTreeView(treeModel));
|
treeView = Gtk::manage(wf->createTreeView(treeModel));
|
||||||
|
treeView->get_selection()->set_mode(Gtk::SELECTION_MULTIPLE);
|
||||||
treeView->set_reorderable(true);
|
treeView->set_reorderable(true);
|
||||||
treeView->set_headers_visible(false);
|
treeView->set_headers_visible(false);
|
||||||
treeView->set_enable_search(false);
|
treeView->set_enable_search(false);
|
||||||
|
@ -248,15 +249,32 @@ LiveModeWindow :: popTop(void) throw ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Find the selected row.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
Gtk::TreeModel::iterator
|
||||||
|
LiveModeWindow :: getSelected(void) throw ()
|
||||||
|
{
|
||||||
|
Glib::RefPtr<Gtk::TreeView::Selection> selection
|
||||||
|
= treeView->get_selection();
|
||||||
|
std::vector<Gtk::TreeModel::Path> selectedPaths
|
||||||
|
= selection->get_selected_rows();
|
||||||
|
|
||||||
|
Gtk::TreeModel::iterator it;
|
||||||
|
if (selectedPaths.size() > 0) {
|
||||||
|
it = treeModel->get_iter(selectedPaths.front());
|
||||||
|
}
|
||||||
|
return it;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Signal handler for the output play button clicked.
|
* Signal handler for the output play button clicked.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
LiveModeWindow :: onOutputPlay(void) throw ()
|
LiveModeWindow :: onOutputPlay(void) throw ()
|
||||||
{
|
{
|
||||||
Glib::RefPtr<Gtk::TreeView::Selection> refSelection =
|
Gtk::TreeModel::iterator iter = getSelected();
|
||||||
treeView->get_selection();
|
|
||||||
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
|
||||||
|
|
||||||
if (!iter) {
|
if (!iter) {
|
||||||
iter = treeModel->children().begin();
|
iter = treeModel->children().begin();
|
||||||
|
@ -340,9 +358,7 @@ bool
|
||||||
LiveModeWindow :: onKeyPressed(GdkEventKey * event) throw ()
|
LiveModeWindow :: onKeyPressed(GdkEventKey * event) throw ()
|
||||||
{
|
{
|
||||||
if (event->type == GDK_KEY_PRESS) {
|
if (event->type == GDK_KEY_PRESS) {
|
||||||
Glib::RefPtr<Gtk::TreeView::Selection> refSelection =
|
Gtk::TreeModel::iterator iter = getSelected();
|
||||||
treeView->get_selection();
|
|
||||||
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
|
||||||
|
|
||||||
if (iter) {
|
if (iter) {
|
||||||
KeyboardShortcut::Action action = gLiveSupport->findAction(
|
KeyboardShortcut::Action action = gLiveSupport->findAction(
|
||||||
|
@ -382,9 +398,7 @@ LiveModeWindow :: onKeyPressed(GdkEventKey * event) throw ()
|
||||||
void
|
void
|
||||||
LiveModeWindow :: onEditPlaylist(void) throw ()
|
LiveModeWindow :: onEditPlaylist(void) throw ()
|
||||||
{
|
{
|
||||||
Glib::RefPtr<Gtk::TreeView::Selection>
|
Gtk::TreeModel::iterator iter = getSelected();
|
||||||
refSelection = treeView->get_selection();
|
|
||||||
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
|
||||||
|
|
||||||
if (iter) {
|
if (iter) {
|
||||||
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
||||||
|
@ -408,9 +422,7 @@ LiveModeWindow :: onEditPlaylist(void) throw ()
|
||||||
void
|
void
|
||||||
LiveModeWindow :: onSchedulePlaylist(void) throw ()
|
LiveModeWindow :: onSchedulePlaylist(void) throw ()
|
||||||
{
|
{
|
||||||
Glib::RefPtr<Gtk::TreeView::Selection>
|
Gtk::TreeModel::iterator iter = getSelected();
|
||||||
refSelection = treeView->get_selection();
|
|
||||||
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
|
||||||
|
|
||||||
if (iter) {
|
if (iter) {
|
||||||
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
||||||
|
@ -433,9 +445,7 @@ LiveModeWindow :: onSchedulePlaylist(void) throw ()
|
||||||
void
|
void
|
||||||
LiveModeWindow :: onExportPlaylist(void) throw ()
|
LiveModeWindow :: onExportPlaylist(void) throw ()
|
||||||
{
|
{
|
||||||
Glib::RefPtr<Gtk::TreeView::Selection>
|
Gtk::TreeModel::iterator iter = getSelected();
|
||||||
refSelection = treeView->get_selection();
|
|
||||||
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
|
||||||
|
|
||||||
if (iter) {
|
if (iter) {
|
||||||
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
||||||
|
@ -459,9 +469,7 @@ LiveModeWindow :: onExportPlaylist(void) throw ()
|
||||||
void
|
void
|
||||||
LiveModeWindow :: onAddToPlaylist(void) throw ()
|
LiveModeWindow :: onAddToPlaylist(void) throw ()
|
||||||
{
|
{
|
||||||
Glib::RefPtr<Gtk::TreeView::Selection>
|
Gtk::TreeModel::iterator iter = getSelected();
|
||||||
refSelection = treeView->get_selection();
|
|
||||||
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
|
||||||
|
|
||||||
if (iter) {
|
if (iter) {
|
||||||
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
||||||
|
@ -482,9 +490,7 @@ LiveModeWindow :: onAddToPlaylist(void) throw ()
|
||||||
void
|
void
|
||||||
LiveModeWindow :: onUploadToHub(void) throw ()
|
LiveModeWindow :: onUploadToHub(void) throw ()
|
||||||
{
|
{
|
||||||
Glib::RefPtr<Gtk::TreeView::Selection>
|
Gtk::TreeModel::iterator iter = getSelected();
|
||||||
refSelection = treeView->get_selection();
|
|
||||||
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
|
||||||
|
|
||||||
if (iter) {
|
if (iter) {
|
||||||
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
||||||
|
|
|
@ -112,6 +112,16 @@ class LiveModeWindow : public GuiWindow
|
||||||
Gtk::Menu *
|
Gtk::Menu *
|
||||||
constructPlaylistContextMenu(void) throw ();
|
constructPlaylistContextMenu(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the selected row.
|
||||||
|
* If more than one row is selected, it returns the first one.
|
||||||
|
*
|
||||||
|
* @return an iterator for the selected row; may be invalid
|
||||||
|
* if nothing is selected.
|
||||||
|
*/
|
||||||
|
Gtk::TreeModel::iterator
|
||||||
|
getSelected(void) throw ();
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue