moved live mode window contents from GLiveSupport to LiveModeWindow
This commit is contained in:
parent
aa921acaa9
commit
3013c552a7
6 changed files with 66 additions and 171 deletions
|
@ -21,8 +21,8 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.35 $
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.36 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -582,8 +582,7 @@ LiveSupport :: GLiveSupport ::
|
|||
GLiveSupport :: addToLiveMode(Ptr<Playable>::Ref playable)
|
||||
throw ()
|
||||
{
|
||||
liveModeContents->push_back(playable);
|
||||
masterPanel->updateLiveModeWindow();
|
||||
masterPanel->updateLiveModeWindow(playable);
|
||||
addToScratchPad(playable);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.29 $
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.30 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -100,8 +100,8 @@ class MasterPanelWindow;
|
|||
* <code>schedulerClientFactory</code> elements see their
|
||||
* respective documentation.
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.29 $
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.30 $
|
||||
* @see LocalizedObject#getBundle(const xmlpp::Element &)
|
||||
* @see AuthenticationClientFactory
|
||||
* @see StorageClientFactory
|
||||
|
@ -183,11 +183,6 @@ class GLiveSupport : public LocalizedConfigurable,
|
|||
*/
|
||||
Ptr<PlayableList>::Ref scratchpadContents;
|
||||
|
||||
/**
|
||||
* The contents of the Live Mode, stored as a list.
|
||||
*/
|
||||
Ptr<PlayableList>::Ref liveModeContents;
|
||||
|
||||
/**
|
||||
* The one and only playlist that may be edited at any one time.
|
||||
*/
|
||||
|
@ -240,7 +235,6 @@ class GLiveSupport : public LocalizedConfigurable,
|
|||
GLiveSupport(void) throw ()
|
||||
{
|
||||
scratchpadContents.reset(new PlayableList());
|
||||
liveModeContents. reset(new PlayableList());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -456,17 +450,6 @@ class GLiveSupport : public LocalizedConfigurable,
|
|||
void
|
||||
addToLiveMode(Ptr<Playable>::Ref playable) throw ();
|
||||
|
||||
/**
|
||||
* Return the Live Mode contents.
|
||||
*
|
||||
* @return the list holding the Live Mode contents.
|
||||
*/
|
||||
Ptr<PlayableList>::Ref
|
||||
getLiveModeContents(void) throw ()
|
||||
{
|
||||
return liveModeContents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the currently edited playlist.
|
||||
*
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.4 $
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.5 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -88,9 +88,6 @@ LiveModeWindow :: LiveModeWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
|||
std::cerr << e.what() << std::endl;
|
||||
std::exit(1);
|
||||
}
|
||||
|
||||
treeView->columns_autosize();
|
||||
|
||||
|
||||
// register the signal handler for treeview entries being clicked
|
||||
treeView->signal_button_press_event().connect_notify(sigc::mem_fun(*this,
|
||||
|
@ -138,47 +135,28 @@ LiveModeWindow :: LiveModeWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
|
|||
set_default_size(530, 300);
|
||||
set_modal(false);
|
||||
property_window_position().set_value(Gtk::WIN_POS_NONE);
|
||||
set_resizable(true);
|
||||
|
||||
showContents();
|
||||
show_all_children();
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Show all audio clips
|
||||
* Add a new item to the Live Mode Window.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
LiveModeWindow :: showContents(void) throw ()
|
||||
LiveModeWindow :: addItem(Ptr<Playable>::Ref playable) throw ()
|
||||
{
|
||||
Ptr<GLiveSupport::PlayableList>::Ref liveModeContents;
|
||||
GLiveSupport::PlayableList::iterator it;
|
||||
GLiveSupport::PlayableList::iterator end;
|
||||
Ptr<Playable>::Ref playable;
|
||||
Gtk::TreeModel::Row row;
|
||||
|
||||
liveModeContents = gLiveSupport->getLiveModeContents();
|
||||
it = liveModeContents->begin();
|
||||
end = liveModeContents->end();
|
||||
treeModel->clear();
|
||||
int rowNumber = 0;
|
||||
int rowNumber = treeModel->children().size();
|
||||
Gtk::TreeModel::Row row = *(treeModel->append());
|
||||
|
||||
while (it != end) {
|
||||
playable = *it;
|
||||
row = *(treeModel->append());
|
||||
|
||||
row[modelColumns.playableColumn] = playable;
|
||||
row[modelColumns.titleColumn] = *playable->getTitle();
|
||||
Ptr<Glib::ustring>::Ref
|
||||
creator = playable->getMetadata("dc:creator");
|
||||
row[modelColumns.creatorColumn] = creator ? *creator : "";
|
||||
row[modelColumns.lengthColumn] = to_simple_string(
|
||||
*playable->getPlaylength() );
|
||||
row[modelColumns.rowNumberColumn] = rowNumber;
|
||||
|
||||
++it;
|
||||
++rowNumber;
|
||||
}
|
||||
row[modelColumns.playableColumn] = playable;
|
||||
row[modelColumns.titleColumn] = *playable->getTitle();
|
||||
Ptr<Glib::ustring>::Ref
|
||||
creator = playable->getMetadata("dc:creator");
|
||||
row[modelColumns.creatorColumn] = creator ? *creator : "";
|
||||
row[modelColumns.lengthColumn] = to_simple_string(
|
||||
*playable->getPlaylength() );
|
||||
row[modelColumns.rowNumberColumn] = rowNumber;
|
||||
}
|
||||
|
||||
|
||||
|
@ -258,36 +236,17 @@ LiveModeWindow :: onUpMenuOption(void) throw ()
|
|||
{
|
||||
Glib::RefPtr<Gtk::TreeView::Selection> refSelection =
|
||||
treeView->get_selection();
|
||||
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
||||
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
||||
|
||||
if (iter) {
|
||||
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
||||
|
||||
Ptr<GLiveSupport::PlayableList>::Ref liveModeContents;
|
||||
GLiveSupport::PlayableList::iterator it;
|
||||
GLiveSupport::PlayableList::iterator end;
|
||||
|
||||
liveModeContents = gLiveSupport->getLiveModeContents();
|
||||
it = liveModeContents->begin();
|
||||
end = liveModeContents->end();
|
||||
while (it != end) {
|
||||
Ptr<Playable>::Ref p= *it;
|
||||
|
||||
if (*p->getId() == *playable->getId()) {
|
||||
// move one up, and insert the same before that
|
||||
if (it == liveModeContents->begin()) {
|
||||
break;
|
||||
}
|
||||
liveModeContents->insert(--it, playable);
|
||||
// move back to what we've found, and erase it
|
||||
liveModeContents->erase(++it);
|
||||
|
||||
showContents();
|
||||
break;
|
||||
}
|
||||
|
||||
it++;
|
||||
}
|
||||
if (iter && iter != treeModel->children().begin()) {
|
||||
Gtk::TreeModel::iterator previous = iter;
|
||||
--previous;
|
||||
|
||||
int rowNumber = (*previous)[modelColumns.rowNumberColumn];
|
||||
(*iter) [modelColumns.rowNumberColumn] = rowNumber;
|
||||
(*previous)[modelColumns.rowNumberColumn] = ++rowNumber;
|
||||
|
||||
treeModel->iter_swap(previous, iter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -300,38 +259,18 @@ LiveModeWindow :: onDownMenuOption(void) throw ()
|
|||
{
|
||||
Glib::RefPtr<Gtk::TreeView::Selection> refSelection =
|
||||
treeView->get_selection();
|
||||
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
||||
|
||||
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
||||
|
||||
if (iter) {
|
||||
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
||||
Gtk::TreeModel::iterator next = iter;
|
||||
++next;
|
||||
if (next != treeModel->children().end()) {
|
||||
|
||||
int rowNumber = (*iter)[modelColumns.rowNumberColumn];
|
||||
(*next)[modelColumns.rowNumberColumn] = rowNumber;
|
||||
(*iter)[modelColumns.rowNumberColumn] = ++rowNumber;
|
||||
|
||||
Ptr<GLiveSupport::PlayableList>::Ref liveModeContents;
|
||||
GLiveSupport::PlayableList::iterator it;
|
||||
GLiveSupport::PlayableList::iterator end;
|
||||
|
||||
liveModeContents = gLiveSupport->getLiveModeContents();
|
||||
it = liveModeContents->begin();
|
||||
end = liveModeContents->end();
|
||||
while (it != end) {
|
||||
Ptr<Playable>::Ref p= *it;
|
||||
|
||||
if (*p->getId() == *playable->getId()) {
|
||||
// move two down, and insert the same before that
|
||||
++it;
|
||||
if (it == end) {
|
||||
break;
|
||||
}
|
||||
liveModeContents->insert(++it, playable);
|
||||
// move back to what we've found, and erase it
|
||||
--it;
|
||||
--it;
|
||||
liveModeContents->erase(--it);
|
||||
|
||||
showContents();
|
||||
break;
|
||||
}
|
||||
|
||||
it++;
|
||||
treeModel->iter_swap(iter, next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -345,39 +284,16 @@ LiveModeWindow :: onRemoveMenuOption(void) throw ()
|
|||
{
|
||||
Glib::RefPtr<Gtk::TreeView::Selection> refSelection =
|
||||
treeView->get_selection();
|
||||
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
||||
|
||||
Gtk::TreeModel::iterator iter = refSelection->get_selected();
|
||||
|
||||
if (iter) {
|
||||
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
|
||||
|
||||
removeItem(playable->getId());
|
||||
showContents();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Remove an item from the Scratchpad
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
LiveModeWindow :: removeItem(Ptr<const UniqueId>::Ref id) throw ()
|
||||
{
|
||||
Ptr<GLiveSupport::PlayableList>::Ref liveModeContents;
|
||||
GLiveSupport::PlayableList::iterator it;
|
||||
GLiveSupport::PlayableList::iterator end;
|
||||
|
||||
liveModeContents = gLiveSupport->getLiveModeContents();
|
||||
it = liveModeContents->begin();
|
||||
end = liveModeContents->end();
|
||||
while (it != end) {
|
||||
Ptr<Playable>::Ref playable = *it;
|
||||
|
||||
if (*playable->getId() == *id) {
|
||||
liveModeContents->erase(it);
|
||||
break;
|
||||
Gtk::TreeModel::iterator later = iter;
|
||||
int rowNumber = (*iter)[modelColumns.rowNumberColumn];
|
||||
for (++later; later != treeModel->children().end(); ++later) {
|
||||
(*later)[modelColumns.rowNumberColumn] = rowNumber++;
|
||||
}
|
||||
|
||||
it++;
|
||||
|
||||
treeModel->erase(iter);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.3 $
|
||||
Version : $Revision: 1.4 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LiveModeWindow.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -72,7 +72,7 @@ using namespace LiveSupport::Widgets;
|
|||
* playlists.
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.3 $
|
||||
* @version $Revision: 1.4 $
|
||||
*/
|
||||
class LiveModeWindow : public WhiteWindow, public LocalizedObject
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ class LiveModeWindow : public WhiteWindow, public LocalizedObject
|
|||
* Lists one clip per row.
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.3 $
|
||||
* @version $Revision: 1.4 $
|
||||
*/
|
||||
class ModelColumns : public ZebraTreeModelColumnRecord
|
||||
{
|
||||
|
@ -201,14 +201,6 @@ class LiveModeWindow : public WhiteWindow, public LocalizedObject
|
|||
virtual void
|
||||
onRemoveMenuOption(void) throw ();
|
||||
|
||||
/**
|
||||
* Remove an item from the Live Mode.
|
||||
*
|
||||
* @param id the id of the item to remove.
|
||||
*/
|
||||
void
|
||||
removeItem(Ptr<const UniqueId>::Ref id) throw ();
|
||||
|
||||
|
||||
public:
|
||||
/**
|
||||
|
@ -228,10 +220,10 @@ class LiveModeWindow : public WhiteWindow, public LocalizedObject
|
|||
~LiveModeWindow(void) throw ();
|
||||
|
||||
/**
|
||||
* Update the window contents, with the contents of the LiveMode.
|
||||
* Add a new item to the Live Mode Window.
|
||||
*/
|
||||
void
|
||||
showContents(void) throw ();
|
||||
addItem(Ptr<Playable>::Ref playable) throw ();
|
||||
};
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.27 $
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.28 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -332,7 +332,8 @@ MasterPanelWindow :: onUpdateTime(int dummy) throw ()
|
|||
* The event when the Live Mode button has been clicked.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
MasterPanelWindow :: updateLiveModeWindow(void) throw ()
|
||||
MasterPanelWindow :: updateLiveModeWindow(Ptr<Playable>::Ref playable)
|
||||
throw ()
|
||||
{
|
||||
if (!liveModeWindow.get()) {
|
||||
Ptr<ResourceBundle>::Ref bundle;
|
||||
|
@ -346,7 +347,9 @@ MasterPanelWindow :: updateLiveModeWindow(void) throw ()
|
|||
liveModeWindow.reset(new LiveModeWindow(gLiveSupport, bundle));
|
||||
}
|
||||
|
||||
liveModeWindow->showContents();
|
||||
if (playable) {
|
||||
liveModeWindow->addItem(playable);
|
||||
}
|
||||
|
||||
if (!liveModeWindow->is_visible()) {
|
||||
liveModeWindow->show();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.15 $
|
||||
Version : $Revision: 1.16 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelWindow.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -91,7 +91,7 @@ using namespace LiveSupport::Widgets;
|
|||
* </code></pre>
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.15 $
|
||||
* @version $Revision: 1.16 $
|
||||
*/
|
||||
class MasterPanelWindow : public Gtk::Window, public LocalizedObject
|
||||
{
|
||||
|
@ -405,7 +405,9 @@ class MasterPanelWindow : public Gtk::Window, public LocalizedObject
|
|||
* Update the Live Mode window.
|
||||
*/
|
||||
void
|
||||
updateLiveModeWindow(void) throw ();
|
||||
updateLiveModeWindow(Ptr<Playable>::Ref playable
|
||||
= Ptr<Playable>::Ref())
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Update the Scratchpad window.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue