added up and down menus to dj bag entry context menus

This commit is contained in:
maroy 2005-01-11 08:57:00 +00:00
parent 1c74debd0e
commit 59c691ea39
4 changed files with 131 additions and 4 deletions

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/DjBagWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -128,6 +128,14 @@ DjBagWindow :: DjBagWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
*getResourceUstring("addToPlaylistMenuItem"),
sigc::mem_fun(*this,
&DjBagWindow::onAddToPlaylist)));
audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("upMenuItem"),
sigc::mem_fun(*this,
&DjBagWindow::onUpItem)));
audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("downMenuItem"),
sigc::mem_fun(*this,
&DjBagWindow::onDownItem)));
audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("removeMenuItem"),
sigc::mem_fun(*this,
@ -150,6 +158,14 @@ DjBagWindow :: DjBagWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
*getResourceUstring("schedulePlaylistMenuItem"),
sigc::mem_fun(*this,
&DjBagWindow::onSchedulePlaylist)));
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("upMenuItem"),
sigc::mem_fun(*this,
&DjBagWindow::onUpItem)));
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("downMenuItem"),
sigc::mem_fun(*this,
&DjBagWindow::onDownItem)));
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("removeMenuItem"),
sigc::mem_fun(*this,
@ -280,6 +296,99 @@ DjBagWindow :: onRemoveItem(void) throw ()
}
/*------------------------------------------------------------------------------
* Event handler for the Up menu item selected from the entry conext menu
*----------------------------------------------------------------------------*/
void
DjBagWindow :: onUpItem(void) throw ()
{
Glib::RefPtr<Gtk::TreeView::Selection> refSelection =
treeView.get_selection();
if (refSelection) {
Gtk::TreeModel::iterator iter = refSelection->get_selected();
if (iter) {
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
Ptr<GLiveSupport::PlayableList>::Ref djBagContents;
GLiveSupport::PlayableList::iterator it;
GLiveSupport::PlayableList::iterator end;
djBagContents = gLiveSupport->getDjBagContents();
it = djBagContents->begin();
end = djBagContents->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 == djBagContents->begin()) {
break;
}
djBagContents->insert(--it, playable);
// move back to what we've found, and erase it
djBagContents->erase(++it);
showContents();
break;
}
it++;
}
}
}
}
/*------------------------------------------------------------------------------
* Event handler for the Down menu item selected from the entry conext menu
*----------------------------------------------------------------------------*/
void
DjBagWindow :: onDownItem(void) throw ()
{
Glib::RefPtr<Gtk::TreeView::Selection> refSelection =
treeView.get_selection();
if (refSelection) {
Gtk::TreeModel::iterator iter = refSelection->get_selected();
if (iter) {
Ptr<Playable>::Ref playable = (*iter)[modelColumns.playableColumn];
Ptr<GLiveSupport::PlayableList>::Ref djBagContents;
GLiveSupport::PlayableList::iterator it;
GLiveSupport::PlayableList::iterator end;
djBagContents = gLiveSupport->getDjBagContents();
it = djBagContents->begin();
end = djBagContents->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;
}
djBagContents->insert(++it, playable);
// move back to what we've found, and erase it
--it;
--it;
djBagContents->erase(--it);
showContents();
break;
}
it++;
}
}
}
}
/*------------------------------------------------------------------------------
* Event handler for the Delete menu item selected from the entry conext menu
*----------------------------------------------------------------------------*/

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.3 $
Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/DjBagWindow.h,v $
------------------------------------------------------------------------------*/
@ -68,7 +68,7 @@ using namespace LiveSupport::Core;
* playlists.
*
* @author $Author: maroy $
* @version $Revision: 1.3 $
* @version $Revision: 1.4 $
*/
class DjBagWindow : public Gtk::Window, public LocalizedObject
{
@ -80,7 +80,7 @@ class DjBagWindow : public Gtk::Window, public LocalizedObject
* Lists one clip per row.
*
* @author $Author: maroy $
* @version $Revision: 1.3 $
* @version $Revision: 1.4 $
*/
class ModelColumns : public Gtk::TreeModel::ColumnRecord
{
@ -192,6 +192,20 @@ class DjBagWindow : public Gtk::Window, public LocalizedObject
virtual void
onDeleteItem(void) throw ();
/**
* Signal handler for the "up" menu item selected from
* the entry context menu.
*/
virtual void
onUpItem(void) throw ();
/**
* Signal handler for the "down" menu item selected from
* the entry context menu.
*/
virtual void
onDownItem(void) throw ();
/**
* Signal handler for the "add to playlist" menu item selected from
* the entry context menu.

View File

@ -39,6 +39,8 @@ hu:table
titleColumnLabel:string { "cím" }
closeButtonLabel:string { "bezár" }
upMenuItem:string { "_Fel" }
downMenuItem:string { "_Le" }
removeMenuItem:string { "_Eltávolít" }
addToPlaylistMenuItem:string { "_Hozzáad Playlist-hez" }
schedulePlaylistMenuItem:string { "_Playlist időzítése" }

View File

@ -39,6 +39,8 @@ root:table
titleColumnLabel:string { "title" }
closeButtonLabel:string { "close" }
upMenuItem:string { "Move _Up" }
downMenuItem:string { "Move D_own" }
removeMenuItem:string { "_Remove" }
addToPlaylistMenuItem:string { "_Add To Playlist" }
schedulePlaylistMenuItem:string { "_Schedule Playlist" }