diff --git a/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx b/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx index deb84a67e..e03b251dd 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.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -91,11 +91,11 @@ LiveModeWindow :: LiveModeWindow (Ptr::Ref gLiveSupport, treeView->columns_autosize(); -/* + // register the signal handler for treeview entries being clicked treeView->signal_button_press_event().connect_notify(sigc::mem_fun(*this, &LiveModeWindow::onEntryClicked)); -*/ + // Add the TreeView, inside a ScrolledWindow, with the button underneath: scrolledWindow.add(*treeView); @@ -104,23 +104,23 @@ LiveModeWindow :: LiveModeWindow (Ptr::Ref gLiveSupport, vBox.pack_start(scrolledWindow); add(vBox); -/* + // create the right-click entry context menu for audio clips contextMenu = Gtk::manage(new Gtk::Menu()); Gtk::Menu::MenuList& contextMenuList = contextMenu->items(); // register the signal handlers for the popup menu try { - contextMenu.push_back(Gtk::Menu_Helpers::MenuElem( - *getResourceUstring("addToPlaylistMenuItem"), - sigc::mem_fun(*this, - &LiveModeWindow::onAddToPlaylist))); + contextMenuList.push_back(Gtk::Menu_Helpers::MenuElem( + *getResourceUstring("cueMenuItem"), + sigc::mem_fun(*this, + &LiveModeWindow::onCueMenuOption))); } catch (std::invalid_argument &e) { std::cerr << e.what() << std::endl; std::exit(1); } contextMenu->accelerate(*this); -*/ + // show set_name("liveModeWindow"); set_default_size(530, 300); @@ -137,7 +137,7 @@ LiveModeWindow :: LiveModeWindow (Ptr::Ref gLiveSupport, * Show all audio clips *----------------------------------------------------------------------------*/ void -LiveModeWindow :: showContents(void) throw () +LiveModeWindow :: showContents(void) throw () { Ptr::Ref liveModeContents; GLiveSupport::PlayableList::iterator it; @@ -173,7 +173,67 @@ LiveModeWindow :: showContents(void) throw () /*------------------------------------------------------------------------------ * Destructor. *----------------------------------------------------------------------------*/ -LiveModeWindow :: ~LiveModeWindow (void) throw () +LiveModeWindow :: ~LiveModeWindow (void) throw () { } + +/*------------------------------------------------------------------------------ + * Event handler for an entry being clicked in the list + *----------------------------------------------------------------------------*/ +void +LiveModeWindow :: onEntryClicked (GdkEventButton * event) throw () +{ + if (event->type == GDK_BUTTON_PRESS && event->button == 3) { + Glib::RefPtr refSelection = + treeView->get_selection(); + Gtk::TreeModel::iterator iter = refSelection->get_selected(); + + // if nothing is currently selected, select row at mouse pointer + if (!iter) { + Gtk::TreeModel::Path path; + Gtk::TreeViewColumn * column; + int cell_x, + cell_y; + if (treeView->get_path_at_pos(int(event->x), int(event->y), + path, column, + cell_x, cell_y)) { + refSelection->select(path); + iter = refSelection->get_selected(); + } + } + + if (iter) { + Ptr::Ref playable = + (*iter)[modelColumns.playableColumn]; + contextMenu->popup(event->button, event->time); + } + } +} + + +/*------------------------------------------------------------------------------ + * Signal handler for the cue menu option selected. + *----------------------------------------------------------------------------*/ +void +LiveModeWindow :: onCueMenuOption(void) throw () +{ + Glib::RefPtr refSelection = + treeView->get_selection(); + Gtk::TreeModel::iterator iter = refSelection->get_selected(); + + if (iter) { + Ptr::Ref playable = (*iter)[modelColumns.playableColumn]; + + try { + gLiveSupport->playAudio(playable); + } catch (XmlRpcException &e) { + std::cerr << "GLiveSupport::playAudio() error:" << std::endl + << e.what() << std::endl; + } catch (std::exception &e) { + std::cerr << "GLiveSupport::playAudio() error:" << std::endl + << e.what() << std::endl; + } + } +} + diff --git a/livesupport/products/gLiveSupport/src/LiveModeWindow.h b/livesupport/products/gLiveSupport/src/LiveModeWindow.h index a6eae652c..16e07bdc6 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.1 $ + Version : $Revision: 1.2 $ 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.1 $ + * @version $Revision: 1.2 $ */ 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.1 $ + * @version $Revision: 1.2 $ */ class ModelColumns : public ZebraTreeModelColumnRecord { @@ -164,7 +164,21 @@ class LiveModeWindow : public WhiteWindow, public LocalizedObject * The right-click context menu, * that comes up when right-clicking an entry in the entry list. */ -// Gtk::Menu * contextMenu; + Gtk::Menu * contextMenu; + + /** + * Signal handler for the mouse clicked on one of the entries. + * + * @param event the button event recieved + */ + virtual void + onEntryClicked(GdkEventButton * event) throw (); + + /** + * Signal handler for the cue menu option selected. + */ + virtual void + onCueMenuOption(void) throw (); public: diff --git a/livesupport/products/gLiveSupport/src/main.cxx b/livesupport/products/gLiveSupport/src/main.cxx index 13bbdf925..5f0f65c26 100644 --- a/livesupport/products/gLiveSupport/src/main.cxx +++ b/livesupport/products/gLiveSupport/src/main.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: maroy $ - Version : $Revision: 1.7 $ + Author : $Author: fgerlits $ + Version : $Revision: 1.8 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/main.cxx,v $ ------------------------------------------------------------------------------*/ @@ -179,7 +179,6 @@ int main ( int argc, } gLiveSupport->show(); - return 0; } diff --git a/livesupport/products/gLiveSupport/var/hu.txt b/livesupport/products/gLiveSupport/var/hu.txt index f011a4a1c..c8f1dc72c 100644 --- a/livesupport/products/gLiveSupport/var/hu.txt +++ b/livesupport/products/gLiveSupport/var/hu.txt @@ -182,6 +182,8 @@ hu:table titleColumnLabel:string { "Cím" } creatorColumnLabel:string { "Előadó" } lengthColumnLabel:string { "Hossz" } + + cueMenuItem:string { "Belehallgatni" } } } diff --git a/livesupport/products/gLiveSupport/var/root.txt b/livesupport/products/gLiveSupport/var/root.txt index 6027d63b4..9345b457d 100644 --- a/livesupport/products/gLiveSupport/var/root.txt +++ b/livesupport/products/gLiveSupport/var/root.txt @@ -184,6 +184,8 @@ root:table titleColumnLabel:string { "Title" } creatorColumnLabel:string { "Creator" } lengthColumnLabel:string { "Length" } + + cueMenuItem:string { "Cue" } } }