implemented d'n'd in the Live Mode window
This commit is contained in:
parent
aa740fe757
commit
bdb8db1c19
|
@ -92,6 +92,11 @@ LiveModeWindow :: LiveModeWindow (Gtk::ToggleButton * windowOpenerButton)
|
|||
treeView->appendLineNumberColumn("", 2 /* offset */, 50);
|
||||
treeView->appendColumn("", modelColumns.infoColumn, 200);
|
||||
|
||||
treeModel = Gtk::ListStore::create(modelColumns);
|
||||
treeView->set_model(treeModel);
|
||||
treeView->connectModelSignals(treeModel);
|
||||
setupDndCallbacks();
|
||||
|
||||
treeView->signal_button_press_event().connect(sigc::mem_fun(*this,
|
||||
&LiveModeWindow::onEntryClicked),
|
||||
false /* call this first */);
|
||||
|
@ -99,14 +104,9 @@ LiveModeWindow :: LiveModeWindow (Gtk::ToggleButton * windowOpenerButton)
|
|||
&LiveModeWindow::onDoubleClick));
|
||||
treeView->signalTreeModelChanged().connect(sigc::mem_fun(*this,
|
||||
&LiveModeWindow::onTreeModelChanged));
|
||||
|
||||
treeView->signal_key_press_event().connect(sigc::mem_fun(*this,
|
||||
&LiveModeWindow::onKeyPressed));
|
||||
|
||||
treeModel = Gtk::ListStore::create(modelColumns);
|
||||
treeView->set_model(treeModel);
|
||||
treeView->connectModelSignals(treeModel);
|
||||
|
||||
glade->get_widget("cueLabel1", cueLabel);
|
||||
cueLabel->set_label(*getResourceUstring("cuePlayerLabel"));
|
||||
cuePlayer.reset(new CuePlayer(this,
|
||||
|
@ -133,7 +133,6 @@ void
|
|||
LiveModeWindow :: addItem(Ptr<Playable>::Ref playable) throw ()
|
||||
{
|
||||
addItem(treeModel->append(), playable);
|
||||
onTreeModelChanged();
|
||||
}
|
||||
|
||||
|
||||
|
@ -141,7 +140,7 @@ LiveModeWindow :: addItem(Ptr<Playable>::Ref playable) throw ()
|
|||
* Add a new item as the given row in the Live Mode Window.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
LiveModeWindow :: addItem(Gtk::TreeModel::iterator iter,
|
||||
LiveModeWindow :: addItem(Gtk::TreeIter iter,
|
||||
Ptr<Playable>::Ref playable) throw ()
|
||||
{
|
||||
|
||||
|
@ -182,7 +181,8 @@ LiveModeWindow :: addItem(Gtk::TreeModel::iterator iter,
|
|||
infoString->append("</span>");
|
||||
|
||||
row[modelColumns.infoColumn] = *infoString;
|
||||
gLiveSupport->runMainLoop();
|
||||
|
||||
onTreeModelChanged();
|
||||
}
|
||||
|
||||
|
||||
|
@ -206,6 +206,27 @@ LiveModeWindow :: addItem(Ptr<const UniqueId>::Ref id)
|
|||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Add an item to the Live Mode window at the given position, by ID.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
LiveModeWindow :: addItem(Gtk::TreeIter iter,
|
||||
Ptr<const UniqueId>::Ref id)
|
||||
throw ()
|
||||
{
|
||||
Ptr<Playable>::Ref playable;
|
||||
try {
|
||||
playable = gLiveSupport->acquirePlayable(id);
|
||||
} catch (XmlRpcException &e) {
|
||||
std::cerr << "could not acquire playable in LiveModeWindow: "
|
||||
<< e.what() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
addItem(iter, playable);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* "Pop" the first item from the top of the Live Mode Window.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
@ -217,7 +238,7 @@ LiveModeWindow :: popTop(void) throw ()
|
|||
return playable; // return a 0 pointer if auto is set to off
|
||||
}
|
||||
|
||||
Gtk::TreeModel::iterator iter = treeModel->children().begin();
|
||||
Gtk::TreeIter iter = treeModel->children().begin();
|
||||
if (iter) {
|
||||
playable = (*iter)[modelColumns.playableColumn];
|
||||
treeModel->erase(iter);
|
||||
|
@ -493,11 +514,11 @@ LiveModeWindow :: onUploadToHub(void) throw ()
|
|||
void
|
||||
LiveModeWindow :: refreshPlaylist(Ptr<Playlist>::Ref playlist) throw ()
|
||||
{
|
||||
for (Gtk::TreeModel::iterator iter = treeModel->children().begin();
|
||||
iter != treeModel->children().end(); ++iter) {
|
||||
for (Gtk::TreeIter iter = treeModel->children().begin();
|
||||
iter != treeModel->children().end(); ++iter) {
|
||||
Ptr<Playable>::Ref currentItem = (*iter)[modelColumns.playableColumn];
|
||||
if (*currentItem->getId() == *playlist->getId()) {
|
||||
addItem(iter, playlist);
|
||||
addItem(iter, currentItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -601,16 +622,15 @@ LiveModeWindow :: onRemoveMenuOption(void) throw ()
|
|||
std::vector<Gtk::TreePath> selectedPaths
|
||||
= selection->get_selected_rows();
|
||||
|
||||
std::vector<Gtk::TreeModel::iterator> selectedIters;
|
||||
std::vector<Gtk::TreeIter> selectedIters;
|
||||
for (std::vector<Gtk::TreePath>::iterator pathIt = selectedPaths.begin();
|
||||
pathIt != selectedPaths.end();
|
||||
++pathIt) {
|
||||
selectedIters.push_back(treeModel->get_iter(*pathIt));
|
||||
}
|
||||
|
||||
Gtk::TreeModel::iterator newSelection;
|
||||
for (std::vector<Gtk::TreeModel::iterator>::iterator
|
||||
iterIt = selectedIters.begin();
|
||||
Gtk::TreeIter newSelection;
|
||||
for (std::vector<Gtk::TreeIter>::iterator iterIt = selectedIters.begin();
|
||||
iterIt != selectedIters.end();
|
||||
++iterIt) {
|
||||
newSelection = *iterIt;
|
||||
|
@ -637,18 +657,17 @@ LiveModeWindow :: onTreeModelChanged(void) throw ()
|
|||
return;
|
||||
}
|
||||
|
||||
Gtk::TreeModel::iterator iter = treeModel->children().begin();
|
||||
Gtk::TreeIter iter = treeModel->children().begin();
|
||||
|
||||
if (iter) {
|
||||
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
||||
if (playable) {
|
||||
if (!savedTopPlayable || savedTopPlayable &&
|
||||
if (!savedTopPlayable ||
|
||||
*savedTopPlayable->getId() != *playable->getId()) {
|
||||
gLiveSupport->preload(playable);
|
||||
}
|
||||
savedTopPlayable = playable;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -744,3 +763,13 @@ LiveModeWindow :: hide(void) throw ()
|
|||
GuiWindow::hide();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* The name of the window for the d'n'd methods.
|
||||
*----------------------------------------------------------------------------*/
|
||||
Glib::ustring
|
||||
LiveModeWindow :: getWindowNameForDnd (void) throw ()
|
||||
{
|
||||
return bundleName;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,16 +42,19 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "GuiWindow.h"
|
||||
#include "ContentsStorable.h"
|
||||
#include "DndMethods.h"
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
#include "LiveSupport/Widgets/PlayableTreeModelColumnRecord.h"
|
||||
#include "LiveSupport/Widgets/ZebraTreeView.h"
|
||||
#include "GuiWindow.h"
|
||||
#include "ContentsStorable.h"
|
||||
#include "CuePlayer.h"
|
||||
#include "GLiveSupport.h"
|
||||
#include "ExportPlaylistWindow.h"
|
||||
#include "SchedulePlaylistWindow.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace GLiveSupport {
|
||||
|
||||
|
@ -74,7 +77,8 @@ using namespace LiveSupport::Widgets;
|
|||
* @version $Revision$
|
||||
*/
|
||||
class LiveModeWindow : public GuiWindow,
|
||||
public ContentsStorable
|
||||
public ContentsStorable,
|
||||
public DndMethods
|
||||
{
|
||||
private:
|
||||
|
||||
|
@ -146,28 +150,6 @@ class LiveModeWindow : public GuiWindow,
|
|||
Ptr<Gtk::Menu>::Ref
|
||||
constructPlaylistContextMenu(void) throw ();
|
||||
|
||||
/**
|
||||
* Return the topmost selected row.
|
||||
* Sets selectedPaths and selectedIter; does not increment it.
|
||||
*
|
||||
* @return the first selected playable item.
|
||||
*/
|
||||
Ptr<Playable>::Ref
|
||||
getFirstSelectedPlayable(void) throw ();
|
||||
|
||||
/**
|
||||
* Used to iterate over the selected rows.
|
||||
* Can only be called after onEntryClicked() has set the selectedPaths
|
||||
* and selectedIter variables.
|
||||
* Returns a 0 pointer if nothing is selected or we have reached the
|
||||
* end of the list of selected rows.
|
||||
* Increments selectedIter after reading it.
|
||||
*
|
||||
* @return the next selected playable item.
|
||||
*/
|
||||
Ptr<Playable>::Ref
|
||||
getNextSelectedPlayable(void) throw ();
|
||||
|
||||
/**
|
||||
* Check whether exactly one row is selected.
|
||||
*
|
||||
|
@ -211,16 +193,6 @@ class LiveModeWindow : public GuiWindow,
|
|||
*/
|
||||
ModelColumns modelColumns;
|
||||
|
||||
/**
|
||||
* The main container in the window.
|
||||
*/
|
||||
Gtk::VBox vBox;
|
||||
|
||||
/**
|
||||
* A scrolled window, so that the list can be scrolled.
|
||||
*/
|
||||
Gtk::ScrolledWindow scrolledWindow;
|
||||
|
||||
/**
|
||||
* The tree view, now only showing rows.
|
||||
*/
|
||||
|
@ -333,6 +305,51 @@ class LiveModeWindow : public GuiWindow,
|
|||
virtual void
|
||||
onTreeModelChanged(void) throw ();
|
||||
|
||||
/**
|
||||
* The tree view we want to implement d'n'd on.
|
||||
*/
|
||||
virtual Gtk::TreeView *
|
||||
getTreeViewForDnd (void) throw ()
|
||||
{
|
||||
return treeView;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the window for the d'n'd methods.
|
||||
*/
|
||||
virtual Glib::ustring
|
||||
getWindowNameForDnd (void) throw ();
|
||||
|
||||
/**
|
||||
* Return the topmost selected row.
|
||||
* Sets selectedPaths and selectedIter; does not increment it.
|
||||
*
|
||||
* @return the first selected playable item.
|
||||
*/
|
||||
virtual Ptr<Playable>::Ref
|
||||
getFirstSelectedPlayable (void) throw ();
|
||||
|
||||
/**
|
||||
* Used to iterate over the selected rows.
|
||||
* Reset to the first row by onEntryClicked().
|
||||
* Returns a 0 pointer if nothing is selected or we have reached
|
||||
* the end of the list of selected rows.
|
||||
*
|
||||
* @return the next selected playable item.
|
||||
*/
|
||||
virtual Ptr<Playable>::Ref
|
||||
getNextSelectedPlayable (void) throw ();
|
||||
|
||||
/**
|
||||
* Add an item to the d'n'd tree view at the given position.
|
||||
*
|
||||
* @param iter the iterator pointing to the row to be filled in.
|
||||
* @param id the ID of the item to add.
|
||||
*/
|
||||
virtual void
|
||||
addItem (Gtk::TreeIter iter,
|
||||
Ptr<const UniqueId>::Ref id) throw ();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
@ -368,7 +385,7 @@ class LiveModeWindow : public GuiWindow,
|
|||
* @param playable the playable object to be added.
|
||||
*/
|
||||
void
|
||||
addItem(Gtk::TreeModel::iterator iter,
|
||||
addItem(Gtk::TreeIter iter,
|
||||
Ptr<Playable>::Ref playable) throw ();
|
||||
|
||||
/**
|
||||
|
|
|
@ -99,6 +99,7 @@ ScratchpadWindow :: ScratchpadWindow (
|
|||
treeModel = Gtk::ListStore::create(modelColumns);
|
||||
treeView->set_model(treeModel);
|
||||
treeView->connectModelSignals(treeModel);
|
||||
setupDndCallbacks();
|
||||
|
||||
// register the signal handlers for treeview
|
||||
treeView->signal_button_press_event().connect(sigc::mem_fun(*this,
|
||||
|
@ -108,7 +109,6 @@ ScratchpadWindow :: ScratchpadWindow (
|
|||
&ScratchpadWindow::onDoubleClick));
|
||||
treeView->signal_key_press_event().connect(sigc::mem_fun(*this,
|
||||
&ScratchpadWindow::onKeyPressed));
|
||||
setupDndCallbacks();
|
||||
|
||||
// create the cue player widget
|
||||
cuePlayer.reset(new CuePlayer(this,
|
||||
|
|
|
@ -42,16 +42,16 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "GuiWindow.h"
|
||||
#include "ContentsStorable.h"
|
||||
#include "DndMethods.h"
|
||||
|
||||
#include "LiveSupport/Core/Ptr.h"
|
||||
#include "LiveSupport/Widgets/PlayableTreeModelColumnRecord.h"
|
||||
#include "LiveSupport/Widgets/ZebraTreeView.h"
|
||||
#include "CuePlayer.h"
|
||||
#include "ContentsStorable.h"
|
||||
#include "ExportPlaylistWindow.h"
|
||||
#include "SchedulePlaylistWindow.h"
|
||||
#include "DndMethods.h"
|
||||
|
||||
#include "GuiWindow.h"
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
|
@ -310,7 +310,7 @@ class ScratchpadWindow : public GuiWindow,
|
|||
* @return the first selected playable item.
|
||||
*/
|
||||
virtual Ptr<Playable>::Ref
|
||||
getFirstSelectedPlayable(void) throw ();
|
||||
getFirstSelectedPlayable (void) throw ();
|
||||
|
||||
/**
|
||||
* Used to iterate over the selected rows.
|
||||
|
@ -321,17 +321,17 @@ class ScratchpadWindow : public GuiWindow,
|
|||
* @return the next selected playable item.
|
||||
*/
|
||||
virtual Ptr<Playable>::Ref
|
||||
getNextSelectedPlayable(void) throw ();
|
||||
getNextSelectedPlayable (void) throw ();
|
||||
|
||||
/**
|
||||
* Add an item to the Scratchpad at the given position.
|
||||
* Add an item to the d'n'd tree view at the given position.
|
||||
*
|
||||
* @param iter the iterator pointing to the row to be filled in.
|
||||
* @param id the ID of the item to add.
|
||||
*/
|
||||
virtual void
|
||||
addItem(Gtk::TreeIter iter,
|
||||
Ptr<const UniqueId>::Ref id) throw ();
|
||||
addItem (Gtk::TreeIter iter,
|
||||
Ptr<const UniqueId>::Ref id) throw ();
|
||||
|
||||
|
||||
public:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||
<!--Generated with glade3 3.2.0 on Tue Aug 21 16:11:34 2007 by fgerlits@desktop-->
|
||||
<!--Generated with glade3 3.2.0 on Tue Oct 23 17:22:43 2007 by fgerlits@desktop-->
|
||||
<glade-interface>
|
||||
<widget class="GtkWindow" id="mainWindow1">
|
||||
<property name="width_request">400</property>
|
||||
|
@ -128,6 +128,7 @@
|
|||
<property name="headers_visible">False</property>
|
||||
<property name="reorderable">True</property>
|
||||
<property name="rules_hint">True</property>
|
||||
<property name="search_column">1</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
Loading…
Reference in New Issue