diff --git a/livesupport/products/gLiveSupport/src/GLiveSupport.cxx b/livesupport/products/gLiveSupport/src/GLiveSupport.cxx index 01bf6ce44..b86afafe8 100644 --- a/livesupport/products/gLiveSupport/src/GLiveSupport.cxx +++ b/livesupport/products/gLiveSupport/src/GLiveSupport.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.32 $ + Version : $Revision: 1.33 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $ ------------------------------------------------------------------------------*/ @@ -541,7 +541,8 @@ GLiveSupport :: addToLiveMode(Ptr::Ref playable) throw () { liveModeContents->push_back(playable); - masterPanel->updateLiveModeWindow(); + masterPanel->updateLiveModeWindow(); + addToScratchPad(playable); } diff --git a/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx b/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx index e03b251dd..d8471ee74 100644 --- a/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx +++ b/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.2 $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -114,6 +114,18 @@ LiveModeWindow :: LiveModeWindow (Ptr::Ref gLiveSupport, *getResourceUstring("cueMenuItem"), sigc::mem_fun(*this, &LiveModeWindow::onCueMenuOption))); + contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( + *getResourceUstring("upMenuItem"), + sigc::mem_fun(*this, + &LiveModeWindow::onUpMenuOption))); + contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( + *getResourceUstring("downMenuItem"), + sigc::mem_fun(*this, + &LiveModeWindow::onDownMenuOption))); + contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( + *getResourceUstring("removeMenuItem"), + sigc::mem_fun(*this, + &LiveModeWindow::onRemoveMenuOption))); } catch (std::invalid_argument &e) { std::cerr << e.what() << std::endl; std::exit(1); @@ -237,3 +249,135 @@ LiveModeWindow :: onCueMenuOption(void) throw () } } + +/*------------------------------------------------------------------------------ + * Event handler for the Up menu item selected from the entry conext menu + *----------------------------------------------------------------------------*/ +void +LiveModeWindow :: onUpMenuOption(void) throw () +{ + Glib::RefPtr refSelection = + treeView->get_selection(); + 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++; + } + } +} + + +/*------------------------------------------------------------------------------ + * Event handler for the Down menu item selected from the entry conext menu + *----------------------------------------------------------------------------*/ +void +LiveModeWindow :: onDownMenuOption(void) throw () +{ + Glib::RefPtr refSelection = + treeView->get_selection(); + 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 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++; + } + } +} + + +/*------------------------------------------------------------------------------ + * Event handler for the Remove menu item selected from the entry conext menu + *----------------------------------------------------------------------------*/ +void +LiveModeWindow :: onRemoveMenuOption(void) throw () +{ + Glib::RefPtr refSelection = + treeView->get_selection(); + 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; + } + + it++; + } +} + diff --git a/livesupport/products/gLiveSupport/src/LiveModeWindow.h b/livesupport/products/gLiveSupport/src/LiveModeWindow.h index 16e07bdc6..baf5889c1 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.2 $ + Version : $Revision: 1.3 $ 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.2 $ + * @version $Revision: 1.3 $ */ 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.2 $ + * @version $Revision: 1.3 $ */ class ModelColumns : public ZebraTreeModelColumnRecord { @@ -180,6 +180,35 @@ class LiveModeWindow : public WhiteWindow, public LocalizedObject virtual void onCueMenuOption(void) throw (); + /** + * Signal handler for the "up" menu option selected from + * the context menu. + */ + virtual void + onUpMenuOption(void) throw (); + + /** + * Signal handler for the "down" menu option selected from + * the context menu. + */ + virtual void + onDownMenuOption(void) throw (); + + /** + * Signal handler for the "remove" menu option selected from + * the context menu. + */ + 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: /** diff --git a/livesupport/products/gLiveSupport/var/hu.txt b/livesupport/products/gLiveSupport/var/hu.txt index c8f1dc72c..e876d9116 100644 --- a/livesupport/products/gLiveSupport/var/hu.txt +++ b/livesupport/products/gLiveSupport/var/hu.txt @@ -183,7 +183,10 @@ hu:table creatorColumnLabel:string { "Előadó" } lengthColumnLabel:string { "Hossz" } - cueMenuItem:string { "Belehallgatni" } + cueMenuItem:string { "Bele_hallgatni" } + upMenuItem:string { "_Fel" } + downMenuItem:string { "_Le" } + removeMenuItem:string { "_Eltávolít" } } } diff --git a/livesupport/products/gLiveSupport/var/root.txt b/livesupport/products/gLiveSupport/var/root.txt index 9345b457d..a965c8a8b 100644 --- a/livesupport/products/gLiveSupport/var/root.txt +++ b/livesupport/products/gLiveSupport/var/root.txt @@ -185,7 +185,10 @@ root:table creatorColumnLabel:string { "Creator" } lengthColumnLabel:string { "Length" } - cueMenuItem:string { "Cue" } + cueMenuItem:string { "_Cue" } + upMenuItem:string { "Move _Up" } + downMenuItem:string { "Move D_own" } + removeMenuItem:string { "_Remove" } } }