added move up/down, remove pop-up menu items to Live Mode

This commit is contained in:
fgerlits 2005-04-29 12:26:08 +00:00
parent f015a8566c
commit 6fd2087a7c
5 changed files with 188 additions and 8 deletions

View file

@ -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<Playable>::Ref playable)
throw ()
{
liveModeContents->push_back(playable);
masterPanel->updateLiveModeWindow();
masterPanel->updateLiveModeWindow();
addToScratchPad(playable);
}

View file

@ -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<GLiveSupport>::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<Gtk::TreeView::Selection> refSelection =
treeView->get_selection();
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++;
}
}
}
/*------------------------------------------------------------------------------
* Event handler for the Down menu item selected from the entry conext menu
*----------------------------------------------------------------------------*/
void
LiveModeWindow :: onDownMenuOption(void) throw ()
{
Glib::RefPtr<Gtk::TreeView::Selection> refSelection =
treeView->get_selection();
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 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<Gtk::TreeView::Selection> refSelection =
treeView->get_selection();
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;
}
it++;
}
}

View file

@ -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<const UniqueId>::Ref id) throw ();
public:
/**

View file

@ -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" }
}
}

View file

@ -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" }
}
}