diff --git a/livesupport/products/gLiveSupport/src/GLiveSupport.cxx b/livesupport/products/gLiveSupport/src/GLiveSupport.cxx index bae545074..18d6ff450 100644 --- a/livesupport/products/gLiveSupport/src/GLiveSupport.cxx +++ b/livesupport/products/gLiveSupport/src/GLiveSupport.cxx @@ -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::Ref playable) throw () { - liveModeContents->push_back(playable); - masterPanel->updateLiveModeWindow(); + masterPanel->updateLiveModeWindow(playable); addToScratchPad(playable); } diff --git a/livesupport/products/gLiveSupport/src/GLiveSupport.h b/livesupport/products/gLiveSupport/src/GLiveSupport.h index 99add87c6..ebc6c4e14 100644 --- a/livesupport/products/gLiveSupport/src/GLiveSupport.h +++ b/livesupport/products/gLiveSupport/src/GLiveSupport.h @@ -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; * schedulerClientFactory 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::Ref scratchpadContents; - /** - * The contents of the Live Mode, stored as a list. - */ - Ptr::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::Ref playable) throw (); - /** - * Return the Live Mode contents. - * - * @return the list holding the Live Mode contents. - */ - Ptr::Ref - getLiveModeContents(void) throw () - { - return liveModeContents; - } - /** * Return the currently edited playlist. * diff --git a/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx b/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx index 20d61d677..a85f852ce 100644 --- a/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx +++ b/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx @@ -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::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::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::Ref playable) throw () { - Ptr::Ref liveModeContents; - GLiveSupport::PlayableList::iterator it; - GLiveSupport::PlayableList::iterator end; - Ptr::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::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::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 refSelection = treeView->get_selection(); - Gtk::TreeModel::iterator iter = refSelection->get_selected(); + Gtk::TreeModel::iterator iter = refSelection->get_selected(); - if (iter) { - Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; - - Ptr::Ref liveModeContents; - GLiveSupport::PlayableList::iterator it; - GLiveSupport::PlayableList::iterator end; - - liveModeContents = gLiveSupport->getLiveModeContents(); - it = liveModeContents->begin(); - end = liveModeContents->end(); - while (it != end) { - Ptr::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 refSelection = treeView->get_selection(); - Gtk::TreeModel::iterator iter = refSelection->get_selected(); - + Gtk::TreeModel::iterator iter = refSelection->get_selected(); + if (iter) { - Ptr::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::Ref liveModeContents; - GLiveSupport::PlayableList::iterator it; - GLiveSupport::PlayableList::iterator end; - - liveModeContents = gLiveSupport->getLiveModeContents(); - it = liveModeContents->begin(); - end = liveModeContents->end(); - while (it != end) { - Ptr::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 refSelection = treeView->get_selection(); - Gtk::TreeModel::iterator iter = refSelection->get_selected(); - + Gtk::TreeModel::iterator iter = refSelection->get_selected(); + if (iter) { - Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; - - removeItem(playable->getId()); - showContents(); - } -} - - -/*------------------------------------------------------------------------------ - * Remove an item from the Scratchpad - *----------------------------------------------------------------------------*/ -void -LiveModeWindow :: removeItem(Ptr::Ref id) throw () -{ - Ptr::Ref liveModeContents; - GLiveSupport::PlayableList::iterator it; - GLiveSupport::PlayableList::iterator end; - - liveModeContents = gLiveSupport->getLiveModeContents(); - it = liveModeContents->begin(); - end = liveModeContents->end(); - while (it != end) { - Ptr::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); } } diff --git a/livesupport/products/gLiveSupport/src/LiveModeWindow.h b/livesupport/products/gLiveSupport/src/LiveModeWindow.h index baf5889c1..318e0c5a0 100644 --- a/livesupport/products/gLiveSupport/src/LiveModeWindow.h +++ b/livesupport/products/gLiveSupport/src/LiveModeWindow.h @@ -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::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::Ref playable) throw (); }; /* ================================================= external data structures */ diff --git a/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx b/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx index 3c57987cc..06c1bfe4c 100644 --- a/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx +++ b/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx @@ -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::Ref playable) + throw () { if (!liveModeWindow.get()) { Ptr::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(); diff --git a/livesupport/products/gLiveSupport/src/MasterPanelWindow.h b/livesupport/products/gLiveSupport/src/MasterPanelWindow.h index 20e200a34..03dada656 100644 --- a/livesupport/products/gLiveSupport/src/MasterPanelWindow.h +++ b/livesupport/products/gLiveSupport/src/MasterPanelWindow.h @@ -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; * * * @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::Ref playable + = Ptr::Ref()) + throw (); /** * Update the Scratchpad window.