From 81662c2b41dd0ba4c72bc80ffea59a8808478392 Mon Sep 17 00:00:00 2001 From: fgerlits Date: Thu, 17 Mar 2005 19:43:41 +0000 Subject: [PATCH] redrew the Scratchpad window and added/changed its buttons --- .../LiveSupport/Widgets/WidgetFactory.h | 14 ++- .../modules/widgets/src/WidgetFactory.cxx | 55 ++++++++- .../products/gLiveSupport/src/DjBagWindow.cxx | 112 +++++++++--------- .../products/gLiveSupport/src/DjBagWindow.h | 45 ++++--- .../gLiveSupport/src/GLiveSupport.cxx | 46 ++++--- livesupport/products/gLiveSupport/var/hu.txt | 6 +- .../products/gLiveSupport/var/root.txt | 6 +- 7 files changed, 169 insertions(+), 115 deletions(-) diff --git a/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h b/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h index 8eef7af5f..4be797617 100644 --- a/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h +++ b/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h @@ -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/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h,v $ ------------------------------------------------------------------------------*/ @@ -84,8 +84,8 @@ using namespace LiveSupport::Core; * * * - * @author $Author: maroy $ - * @version $Revision: 1.7 $ + * @author $Author: fgerlits $ + * @version $Revision: 1.8 $ */ class WidgetFactory : virtual public Configurable @@ -94,12 +94,14 @@ class WidgetFactory : /** * The types of available buttons. */ - typedef enum { pushButton, tabButton } ButtonType; + typedef enum { pushButton, tabButton } ButtonType; /** * The types of available image buttons. */ - typedef enum { deleteButton } ImageButtonType; + typedef enum { deleteButton, + smallPlayButton, smallPauseButton, smallStopButton } + ImageButtonType; private: diff --git a/livesupport/modules/widgets/src/WidgetFactory.cxx b/livesupport/modules/widgets/src/WidgetFactory.cxx index 929ab9ab0..a4f218013 100644 --- a/livesupport/modules/widgets/src/WidgetFactory.cxx +++ b/livesupport/modules/widgets/src/WidgetFactory.cxx @@ -21,8 +21,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Author : $Author: maroy $ - Version : $Revision: 1.8 $ + Author : $Author: fgerlits $ + Version : $Revision: 1.9 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/WidgetFactory.cxx,v $ ------------------------------------------------------------------------------*/ @@ -101,6 +101,42 @@ static const std::string deleteButtonPassiveName = "imageButton/delete.png"; */ static const std::string deleteButtonRollName = "imageButton/deleteRoll.png"; +/** + * The name of the passive image for the small play button. + */ +static const std::string smallPlayButtonPassiveName + = "imageButton/smallPlay.png"; + +/** + * The name of the rollover image for the small play button. + */ +static const std::string smallPlayButtonRollName + = "imageButton/smallPlayRoll.png"; + +/** + * The name of the passive image for the small pause button. + */ +static const std::string smallPauseButtonPassiveName + = "imageButton/smallPause.png"; + +/** + * The name of the rollover image for the small pause button. + */ +static const std::string smallPauseButtonRollName + = "imageButton/smallPauseRoll.png"; + +/** + * The name of the passive image for the small stop button. + */ +static const std::string smallStopButtonPassiveName + = "imageButton/smallStop.png"; + +/** + * The name of the rollover image for the small stop button. + */ +static const std::string smallStopButtonRollName + = "imageButton/smallStopRoll.png"; + /** * The name of the combo box left image. */ @@ -270,6 +306,21 @@ WidgetFactory :: createButton(ImageButtonType type) throw () rollImage = loadImage(deleteButtonRollName); break; + case smallPlayButton: + passiveImage = loadImage(smallPlayButtonPassiveName); + rollImage = loadImage(smallPlayButtonRollName); + break; + + case smallPauseButton: + passiveImage = loadImage(smallPauseButtonPassiveName); + rollImage = loadImage(smallPauseButtonRollName); + break; + + case smallStopButton: + passiveImage = loadImage(smallStopButtonPassiveName); + rollImage = loadImage(smallStopButtonRollName); + break; + default: return 0; } diff --git a/livesupport/products/gLiveSupport/src/DjBagWindow.cxx b/livesupport/products/gLiveSupport/src/DjBagWindow.cxx index 4c0d0c937..3db40d012 100644 --- a/livesupport/products/gLiveSupport/src/DjBagWindow.cxx +++ b/livesupport/products/gLiveSupport/src/DjBagWindow.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.9 $ + Version : $Revision: 1.10 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/DjBagWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -36,6 +36,7 @@ #include #include +#include "LiveSupport/Widgets/WidgetFactory.h" #include "SchedulePlaylistWindow.h" #include "DjBagWindow.h" @@ -43,6 +44,7 @@ using namespace Glib; using namespace LiveSupport::Core; +using namespace LiveSupport::Widgets; using namespace LiveSupport::GLiveSupport; /* =================================================== local data structures */ @@ -62,58 +64,50 @@ using namespace LiveSupport::GLiveSupport; DjBagWindow :: DjBagWindow (Ptr::Ref gLiveSupport, Ptr::Ref bundle) throw () - : LocalizedObject(bundle) + : WhiteWindow("", + 0xffffff, + WidgetFactory::getInstance()->getWhiteWindowCorners()), + LocalizedObject(bundle) { this->gLiveSupport = gLiveSupport; + Ptr::Ref widgetFactory = WidgetFactory::getInstance(); + try { set_title(*getResourceUstring("windowTitle")); - playButton.reset(new Gtk::Button( - *getResourceUstring("playButtonLabel"))); - pauseButton.reset(new Gtk::Button( - *getResourceUstring("pauseButtonLabel"))); - stopButton.reset(new Gtk::Button( - *getResourceUstring("stopButtonLabel"))); - closeButton.reset(new Gtk::Button( - *getResourceUstring("closeButtonLabel"))); + playButton = Gtk::manage(widgetFactory->createButton( + WidgetFactory::smallPlayButton)); + pauseButton = Gtk::manage(widgetFactory->createButton( + WidgetFactory::smallPauseButton)); + stopButton = Gtk::manage(widgetFactory->createButton( + WidgetFactory::smallStopButton)); + clearListButton = Gtk::manage(widgetFactory->createButton( + *getResourceUstring("clearListButtonLabel"))); + removeButton = Gtk::manage(widgetFactory->createButton( + *getResourceUstring("removeButtonLabel"))); } catch (std::invalid_argument &e) { std::cerr << e.what() << std::endl; } - // set up the play button playButton->set_name("playButton"); - playButton->set_flags(Gtk::CAN_FOCUS|Gtk::CAN_DEFAULT|Gtk::HAS_DEFAULT); - playButton->set_relief(Gtk::RELIEF_NORMAL); - // Register the signal handler for the button getting clicked. playButton->signal_clicked().connect(sigc::mem_fun(*this, - &DjBagWindow::onPlayButtonClicked)); + &DjBagWindow::onPlayButtonClicked)); - // set up the pause button pauseButton->set_name("pauseButton"); - pauseButton->set_flags(Gtk::CAN_FOCUS|Gtk::CAN_DEFAULT|Gtk::HAS_DEFAULT); - pauseButton->set_relief(Gtk::RELIEF_NORMAL); - // Register the signal handler for the button getting clicked. pauseButton->signal_clicked().connect(sigc::mem_fun(*this, - &DjBagWindow::onPauseButtonClicked)); + &DjBagWindow::onPauseButtonClicked)); - // set up the stop button stopButton->set_name("stopButton"); - stopButton->set_flags(Gtk::CAN_FOCUS|Gtk::CAN_DEFAULT|Gtk::HAS_DEFAULT); - stopButton->set_relief(Gtk::RELIEF_NORMAL); - // Register the signal handler for the button getting clicked. stopButton->signal_clicked().connect(sigc::mem_fun(*this, - &DjBagWindow::onStopButtonClicked)); + &DjBagWindow::onStopButtonClicked)); - // set up the close button - closeButton->set_name("closeButton"); - closeButton->set_flags(Gtk::CAN_FOCUS|Gtk::CAN_DEFAULT|Gtk::HAS_DEFAULT); - closeButton->set_relief(Gtk::RELIEF_NORMAL); - // Register the signal handler for the button getting clicked. - closeButton->signal_clicked().connect(sigc::mem_fun(*this, - &DjBagWindow::onCloseButtonClicked)); + clearListButton->set_name("clearListButton"); + clearListButton->signal_clicked().connect(sigc::mem_fun(*this, + &DjBagWindow::onClearListButtonClicked)); - set_border_width(5); - set_default_size(400, 200); + removeButton->set_name("removeButton"); + removeButton->signal_clicked().connect(sigc::mem_fun(*this, + &DjBagWindow::onRemoveItem)); add(vBox); @@ -123,25 +117,21 @@ DjBagWindow :: DjBagWindow (Ptr::Ref gLiveSupport, // Only show the scrollbars when they are necessary: scrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - vBox.pack_start(playButtonBox, Gtk::PACK_SHRINK); + vBox.pack_start(topButtonBox, Gtk::PACK_SHRINK); vBox.pack_start(scrolledWindow); - vBox.pack_start(buttonBox, Gtk::PACK_SHRINK); + vBox.pack_start(bottomButtonBox, Gtk::PACK_SHRINK); - playButtonBox.pack_start(*playButton, Gtk::PACK_SHRINK); - playButtonBox.set_border_width(5); - playButtonBox.set_layout(Gtk::BUTTONBOX_SPREAD); + topButtonBox.pack_start(audioButtonBox, Gtk::PACK_EXPAND_PADDING); + + audioButtonBox.set_border_width(5); + audioButtonBox.pack_start(*playButton, Gtk::PACK_SHRINK); + audioButtonBox.pack_start(*pauseButton, Gtk::PACK_SHRINK); + audioButtonBox.pack_start(*stopButton, Gtk::PACK_SHRINK); - playButtonBox.pack_start(*pauseButton, Gtk::PACK_SHRINK); - playButtonBox.set_border_width(5); - playButtonBox.set_layout(Gtk::BUTTONBOX_SPREAD); - - playButtonBox.pack_start(*stopButton, Gtk::PACK_SHRINK); - playButtonBox.set_border_width(5); - playButtonBox.set_layout(Gtk::BUTTONBOX_SPREAD); - - buttonBox.pack_start(*closeButton, Gtk::PACK_SHRINK); - buttonBox.set_border_width(5); - buttonBox.set_layout(Gtk::BUTTONBOX_END); + bottomButtonBox.set_border_width(5); + bottomButtonBox.set_layout(Gtk::BUTTONBOX_END); + bottomButtonBox.pack_start(*clearListButton, Gtk::PACK_SHRINK); + bottomButtonBox.pack_start(*removeButton, Gtk::PACK_SHRINK); // Create the Tree model: treeModel = Gtk::ListStore::create(modelColumns); @@ -163,7 +153,7 @@ DjBagWindow :: DjBagWindow (Ptr::Ref gLiveSupport, // create the right-click entry context menu for audio clips - audioClipMenu.reset(new Gtk::Menu()); + audioClipMenu = Gtk::manage(new Gtk::Menu()); Gtk::Menu::MenuList& audioClipMenuList = audioClipMenu->items(); // register the signal handlers for the popup menu audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem( @@ -193,7 +183,7 @@ DjBagWindow :: DjBagWindow (Ptr::Ref gLiveSupport, audioClipMenu->accelerate(*this); // create the right-click entry context menu for playlists - playlistMenu.reset(new Gtk::Menu()); + playlistMenu = Gtk::manage(new Gtk::Menu()); Gtk::Menu::MenuList& playlistMenuList = playlistMenu->items(); // register the signal handlers for the popup menu playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem( @@ -227,8 +217,13 @@ DjBagWindow :: DjBagWindow (Ptr::Ref gLiveSupport, playlistMenu->accelerate(*this); // show + set_name("scratchpadWindow"); + set_default_size(300, 300); + set_modal(false); + property_window_position().set_value(Gtk::WIN_POS_NONE); + set_resizable(true); + showContents(); - show_all_children(); } @@ -276,18 +271,21 @@ DjBagWindow :: showContents(void) throw () /*------------------------------------------------------------------------------ * Destructor. *----------------------------------------------------------------------------*/ -DjBagWindow :: ~DjBagWindow (void) throw () +DjBagWindow :: ~DjBagWindow (void) throw () { } /*------------------------------------------------------------------------------ - * Event handler for the close button getting clicked. + * Event handler for the clear list button getting clicked. *----------------------------------------------------------------------------*/ void -DjBagWindow :: onCloseButtonClicked (void) throw () +DjBagWindow :: onClearListButtonClicked (void) throw () { - hide(); + Ptr::Ref djBagContents + = gLiveSupport->getDjBagContents(); + djBagContents->clear(); + showContents(); } diff --git a/livesupport/products/gLiveSupport/src/DjBagWindow.h b/livesupport/products/gLiveSupport/src/DjBagWindow.h index 12df6a143..4bcdea294 100644 --- a/livesupport/products/gLiveSupport/src/DjBagWindow.h +++ b/livesupport/products/gLiveSupport/src/DjBagWindow.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.7 $ + Version : $Revision: 1.8 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/DjBagWindow.h,v $ ------------------------------------------------------------------------------*/ @@ -48,12 +48,15 @@ #include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/LocalizedObject.h" +#include "LiveSupport/Widgets/WhiteWindow.h" +#include "LiveSupport/Widgets/Button.h" #include "GLiveSupport.h" namespace LiveSupport { namespace GLiveSupport { using namespace LiveSupport::Core; +using namespace LiveSupport::Widgets; /* ================================================================ constants */ @@ -68,9 +71,9 @@ using namespace LiveSupport::Core; * playlists. * * @author $Author: fgerlits $ - * @version $Revision: 1.7 $ + * @version $Revision: 1.8 $ */ -class DjBagWindow : public Gtk::Window, public LocalizedObject +class DjBagWindow : public WhiteWindow, public LocalizedObject { protected: @@ -80,7 +83,7 @@ class DjBagWindow : public Gtk::Window, public LocalizedObject * Lists one clip per row. * * @author $Author: fgerlits $ - * @version $Revision: 1.7 $ + * @version $Revision: 1.8 $ */ class ModelColumns : public Gtk::TreeModel::ColumnRecord { @@ -143,46 +146,56 @@ class DjBagWindow : public Gtk::Window, public LocalizedObject Glib::RefPtr treeModel; /** - * The box containing the play button. + * The box containing the box containing the audio buttons. */ - Gtk::HButtonBox playButtonBox; + Gtk::HBox topButtonBox; + + /** + * The box containing the audio buttons. + */ + Gtk::HBox audioButtonBox; /** * The play button. */ - Ptr::Ref playButton; + ImageButton * playButton; /** * The pause button. */ - Ptr::Ref pauseButton; + ImageButton * pauseButton; /** * The stop button. */ - Ptr::Ref stopButton; + ImageButton * stopButton; /** * The box containing the close button. */ - Gtk::HButtonBox buttonBox; + Gtk::HButtonBox bottomButtonBox; /** - * The close button. + * The "clear list" button. */ - Ptr::Ref closeButton; + Button * clearListButton; + + /** + * The "delete selected item" button. + */ + Button * removeButton; /** * The right-click context menu for audio clips, * that comes up when right-clicking an entry in the entry list. */ - Ptr::Ref audioClipMenu; + Gtk::Menu * audioClipMenu; /** * The right-click context menu for playlists, * that comes up when right-clicking an entry in the entry list. */ - Ptr::Ref playlistMenu; + Gtk::Menu * playlistMenu; /** * Signal handler for the play button clicked. @@ -203,10 +216,10 @@ class DjBagWindow : public Gtk::Window, public LocalizedObject onStopButtonClicked(void) throw (); /** - * Signal handler for the close button clicked. + * Signal handler for the clear list button clicked. */ virtual void - onCloseButtonClicked(void) throw (); + onClearListButtonClicked(void) throw (); /** * Signal handler for the mouse clicked on one of the entries. diff --git a/livesupport/products/gLiveSupport/src/GLiveSupport.cxx b/livesupport/products/gLiveSupport/src/GLiveSupport.cxx index 8154c9b4f..4040b3841 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.23 $ + Version : $Revision: 1.24 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $ ------------------------------------------------------------------------------*/ @@ -416,15 +416,11 @@ LiveSupport :: GLiveSupport :: GLiveSupport :: uploadFile(Ptr::Ref audioClip) throw (XmlRpcException) { -std::cerr << "GLiveSupport :: uploadFile #1" << std::endl; storage->storeAudioClip(sessionId, audioClip); -std::cerr << "GLiveSupport :: uploadFile #2" << std::endl; // add the uploaded file to the DJ Bag, and update it djBagContents->push_front(audioClip); -std::cerr << "GLiveSupport :: uploadFile #3" << std::endl; masterPanel->updateDjBagWindow(); -std::cerr << "GLiveSupport :: uploadFile #4" << std::endl; } @@ -578,12 +574,6 @@ GLiveSupport :: playAudio(Ptr::Ref playable) std::logic_error, std::runtime_error) { - if (audioPlayerIsPaused) { - audioPlayer->start(); - audioPlayerIsPaused = false; - return; - } - stopAudio(); // stop the audio player and release old resources switch (playable->getType()) { @@ -608,6 +598,25 @@ GLiveSupport :: playAudio(Ptr::Ref playable) } +/*------------------------------------------------------------------------------ + * Pause the audio player. + *----------------------------------------------------------------------------*/ +void +LiveSupport :: GLiveSupport :: +GLiveSupport :: pauseAudio(void) + throw (std::logic_error) +{ + if (!audioPlayerIsPaused && audioPlayer->isPlaying()) { + audioPlayer->pause(); + audioPlayerIsPaused = true; + + } else if (audioPlayerIsPaused) { + audioPlayer->start(); + audioPlayerIsPaused = false; + } +} + + /*------------------------------------------------------------------------------ * Stop the audio player. *----------------------------------------------------------------------------*/ @@ -639,18 +648,3 @@ GLiveSupport :: stopAudio(void) audioPlayerIsPaused = false; } - -/*------------------------------------------------------------------------------ - * Pause the audio player. - *----------------------------------------------------------------------------*/ -void -LiveSupport :: GLiveSupport :: -GLiveSupport :: pauseAudio(void) - throw (std::logic_error) -{ - if (audioPlayer->isPlaying()) { - audioPlayer->pause(); - audioPlayerIsPaused = true; - } -} - diff --git a/livesupport/products/gLiveSupport/var/hu.txt b/livesupport/products/gLiveSupport/var/hu.txt index a2b6268ec..f67cd925d 100644 --- a/livesupport/products/gLiveSupport/var/hu.txt +++ b/livesupport/products/gLiveSupport/var/hu.txt @@ -38,10 +38,8 @@ hu:table typeColumnLabel:string { "típus" } titleColumnLabel:string { "cím" } - playButtonLabel:string { "lejátszás" } - pauseButtonLabel:string { "szünet" } - stopButtonLabel:string { "stop" } - closeButtonLabel:string { "bezár" } + clearListButtonLabel:string { "Egész lista törlése" } + removeButtonLabel:string { "Törlés" } upMenuItem:string { "_Fel" } downMenuItem:string { "_Le" } diff --git a/livesupport/products/gLiveSupport/var/root.txt b/livesupport/products/gLiveSupport/var/root.txt index 4e2f1058a..0985fa71c 100644 --- a/livesupport/products/gLiveSupport/var/root.txt +++ b/livesupport/products/gLiveSupport/var/root.txt @@ -38,10 +38,8 @@ root:table typeColumnLabel:string { "type" } titleColumnLabel:string { "title" } - playButtonLabel:string { "play" } - pauseButtonLabel:string { "pause" } - stopButtonLabel:string { "stop" } - closeButtonLabel:string { "close" } + clearListButtonLabel:string { "Clear List" } + removeButtonLabel:string { "Remove Selected Item" } upMenuItem:string { "Move _Up" } downMenuItem:string { "Move D_own" }