From 2bf8faeaef975019521e3ddf286fdb98a20817c6 Mon Sep 17 00:00:00 2001 From: fgerlits Date: Thu, 25 Aug 2005 17:53:08 +0000 Subject: [PATCH] added event handling for double-click or Enter on TreeView items --- .../gLiveSupport/src/LiveModeWindow.cxx | 18 +++++++++++++++-- .../gLiveSupport/src/LiveModeWindow.h | 17 +++++++++++++--- .../gLiveSupport/src/ScratchpadWindow.cxx | 20 ++++++++++++++++++- .../gLiveSupport/src/ScratchpadWindow.h | 17 +++++++++++++--- .../gLiveSupport/src/SearchWindow.cxx | 17 +++++++++++++++- .../products/gLiveSupport/src/SearchWindow.h | 17 +++++++++++++--- 6 files changed, 93 insertions(+), 13 deletions(-) diff --git a/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx b/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx index 2f057cff7..88ef11c63 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.20 $ + Version : $Revision: 1.21 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LiveModeWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -104,6 +104,8 @@ LiveModeWindow :: LiveModeWindow (Ptr::Ref gLiveSupport, // register the signal handler for treeview entries being clicked treeView->signal_button_press_event().connect_notify(sigc::mem_fun(*this, &LiveModeWindow::onEntryClicked)); + treeView->signal_row_activated().connect(sigc::mem_fun(*this, + &LiveModeWindow::onDoubleClick)); // Add the TreeView, inside a ScrolledWindow, with the button underneath: scrolledWindow.add(*treeView); @@ -279,7 +281,7 @@ LiveModeWindow :: onOutputPlay(void) throw () /*------------------------------------------------------------------------------ - * Event handler for an entry being clicked in the list + * Event handler for an entry being clicked in the list. *----------------------------------------------------------------------------*/ void LiveModeWindow :: onEntryClicked (GdkEventButton * event) throw () @@ -309,3 +311,15 @@ LiveModeWindow :: onEntryClicked (GdkEventButton * event) throw () } } + +/*------------------------------------------------------------------------------ + * Signal handler for the user double-clicking or pressing Enter. + *----------------------------------------------------------------------------*/ +void +LiveModeWindow :: onDoubleClick(const Gtk::TreeModel::Path & path, + const Gtk::TreeViewColumn * column) + throw () +{ + onOutputPlay(); +} + diff --git a/livesupport/products/gLiveSupport/src/LiveModeWindow.h b/livesupport/products/gLiveSupport/src/LiveModeWindow.h index b12ad8d9f..70d6fe14e 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.14 $ + Version : $Revision: 1.15 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LiveModeWindow.h,v $ ------------------------------------------------------------------------------*/ @@ -74,7 +74,7 @@ using namespace LiveSupport::Widgets; * playlists. * * @author $Author: fgerlits $ - * @version $Revision: 1.14 $ + * @version $Revision: 1.15 $ */ class LiveModeWindow : public WhiteWindow, public LocalizedObject { @@ -87,7 +87,7 @@ class LiveModeWindow : public WhiteWindow, public LocalizedObject * Lists one clip per row. * * @author $Author: fgerlits $ - * @version $Revision: 1.14 $ + * @version $Revision: 1.15 $ */ class ModelColumns : public PlayableTreeModelColumnRecord { @@ -166,6 +166,17 @@ class LiveModeWindow : public WhiteWindow, public LocalizedObject void onEntryClicked(GdkEventButton * event) throw (); + /** + * Signal handler for the user double-clicking, or pressing Enter + * on one of the entries. + * + * @param event the button event recieved + */ + void + onDoubleClick(const Gtk::TreeModel::Path & path, + const Gtk::TreeViewColumn * column) + throw (); + /** * Signal handler for the "rows reordered" event. */ diff --git a/livesupport/products/gLiveSupport/src/ScratchpadWindow.cxx b/livesupport/products/gLiveSupport/src/ScratchpadWindow.cxx index 83cf91ebd..88b9a7150 100644 --- a/livesupport/products/gLiveSupport/src/ScratchpadWindow.cxx +++ b/livesupport/products/gLiveSupport/src/ScratchpadWindow.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.28 $ + Version : $Revision: 1.29 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/ScratchpadWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -119,6 +119,8 @@ ScratchpadWindow :: ScratchpadWindow (Ptr::Ref gLiveSupport, // register the signal handler for treeview entries being clicked treeView->signal_button_press_event().connect_notify(sigc::mem_fun(*this, &ScratchpadWindow::onEntryClicked)); + treeView->signal_row_activated().connect(sigc::mem_fun(*this, + &ScratchpadWindow::onDoubleClick)); // Add the TreeView, inside a ScrolledWindow, with the button underneath: scrolledWindow.add(*treeView); @@ -577,3 +579,19 @@ ScratchpadWindow :: onAddToLiveMode(void) throw () gLiveSupport->addToLiveMode(playable); } + +/*------------------------------------------------------------------------------ + * Signal handler for the user double-clicking or pressing Enter. + *----------------------------------------------------------------------------*/ +void +ScratchpadWindow :: onDoubleClick(const Gtk::TreeModel::Path & path, + const Gtk::TreeViewColumn * column) + throw () +{ + Gtk::TreeIter iter = treeModel->get_iter(path); + if (iter) { + currentRow = *iter; + onAddToLiveMode(); + } +} + diff --git a/livesupport/products/gLiveSupport/src/ScratchpadWindow.h b/livesupport/products/gLiveSupport/src/ScratchpadWindow.h index af3eae5eb..84b249291 100644 --- a/livesupport/products/gLiveSupport/src/ScratchpadWindow.h +++ b/livesupport/products/gLiveSupport/src/ScratchpadWindow.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.11 $ + Version : $Revision: 1.12 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/ScratchpadWindow.h,v $ ------------------------------------------------------------------------------*/ @@ -73,7 +73,7 @@ using namespace LiveSupport::Widgets; * playlists. * * @author $Author: fgerlits $ - * @version $Revision: 1.11 $ + * @version $Revision: 1.12 $ */ class ScratchpadWindow : public WhiteWindow, public LocalizedObject @@ -87,7 +87,7 @@ class ScratchpadWindow : public WhiteWindow, * Lists one clip per row. * * @author $Author: fgerlits $ - * @version $Revision: 1.11 $ + * @version $Revision: 1.12 $ */ class ModelColumns : public PlayableTreeModelColumnRecord { @@ -223,6 +223,17 @@ class ScratchpadWindow : public WhiteWindow, virtual void onEntryClicked(GdkEventButton * event) throw (); + /** + * Signal handler for the user double-clicking, or pressing Enter + * on one of the entries. + * + * @param event the button event recieved + */ + void + onDoubleClick(const Gtk::TreeModel::Path & path, + const Gtk::TreeViewColumn * column) + throw (); + /** * Signal handler for the "up" menu item selected from * the entry context menu. diff --git a/livesupport/products/gLiveSupport/src/SearchWindow.cxx b/livesupport/products/gLiveSupport/src/SearchWindow.cxx index cfdfe9915..87dad3ba1 100644 --- a/livesupport/products/gLiveSupport/src/SearchWindow.cxx +++ b/livesupport/products/gLiveSupport/src/SearchWindow.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.21 $ + Version : $Revision: 1.22 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SearchWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -247,6 +247,8 @@ SearchWindow :: constructSearchResultsView(void) throw () // register the signal handler for treeview entries being clicked searchResults->signal_button_press_event().connect_notify(sigc::mem_fun( *this, &SearchWindow::onEntryClicked)); + searchResults->signal_row_activated().connect(sigc::mem_fun( + *this, &SearchWindow::onDoubleClick)); // create the right-click entry context menu contextMenu = Gtk::manage(new Gtk::Menu()); @@ -452,3 +454,16 @@ SearchWindow :: onAddToLiveMode(void) throw () } } + +/*------------------------------------------------------------------------------ + * Signal handler for the user double-clicking or pressing Enter. + *----------------------------------------------------------------------------*/ +void +SearchWindow :: onDoubleClick(const Gtk::TreeModel::Path & path, + const Gtk::TreeViewColumn * column) + throw () +{ + onAddToScratchpad(); +} + + diff --git a/livesupport/products/gLiveSupport/src/SearchWindow.h b/livesupport/products/gLiveSupport/src/SearchWindow.h index 5308733e1..21da9e2ed 100644 --- a/livesupport/products/gLiveSupport/src/SearchWindow.h +++ b/livesupport/products/gLiveSupport/src/SearchWindow.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.14 $ + Version : $Revision: 1.15 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SearchWindow.h,v $ ------------------------------------------------------------------------------*/ @@ -73,7 +73,7 @@ using namespace LiveSupport::Widgets; * The Search/Browse window. * * @author $Author: fgerlits $ - * @version $Revision: 1.14 $ + * @version $Revision: 1.15 $ */ class SearchWindow : public WhiteWindow, public LocalizedObject { @@ -164,6 +164,17 @@ class SearchWindow : public WhiteWindow, public LocalizedObject void onEntryClicked(GdkEventButton * event) throw (); + /** + * Signal handler for the user double-clicking, or pressing Enter + * on one of the entries. + * + * @param event the button event recieved + */ + void + onDoubleClick(const Gtk::TreeModel::Path & path, + const Gtk::TreeViewColumn * column) + throw (); + /** * Add a playable to the scratchpad. */ @@ -181,7 +192,7 @@ class SearchWindow : public WhiteWindow, public LocalizedObject * Lists one clip per row. * * @author $Author: fgerlits $ - * @version $Revision: 1.14 $ + * @version $Revision: 1.15 $ */ class ModelColumns : public PlayableTreeModelColumnRecord {