redrew the Scratchpad window and added/changed its buttons

This commit is contained in:
fgerlits 2005-03-17 19:43:41 +00:00
parent 7f1696a88f
commit 81662c2b41
7 changed files with 169 additions and 115 deletions

View file

@ -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;
* <!ATTLIST widgetFactory path CDATA #REQUIRED >
* </code></pre>
*
* @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:

View file

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

View file

@ -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 <iostream>
#include <stdexcept>
#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<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle)
throw ()
: LocalizedObject(bundle)
: WhiteWindow("",
0xffffff,
WidgetFactory::getInstance()->getWhiteWindowCorners()),
LocalizedObject(bundle)
{
this->gLiveSupport = gLiveSupport;
Ptr<WidgetFactory>::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<GLiveSupport>::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);
playButtonBox.pack_start(*pauseButton, Gtk::PACK_SHRINK);
playButtonBox.set_border_width(5);
playButtonBox.set_layout(Gtk::BUTTONBOX_SPREAD);
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(*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<GLiveSupport>::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<GLiveSupport>::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<GLiveSupport>::Ref gLiveSupport,
playlistMenu->accelerate(*this);
// show
showContents();
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<GLiveSupport::PlayableList>::Ref djBagContents
= gLiveSupport->getDjBagContents();
djBagContents->clear();
showContents();
}

View file

@ -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<Gtk::ListStore> 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<Gtk::Button>::Ref playButton;
ImageButton * playButton;
/**
* The pause button.
*/
Ptr<Gtk::Button>::Ref pauseButton;
ImageButton * pauseButton;
/**
* The stop button.
*/
Ptr<Gtk::Button>::Ref stopButton;
ImageButton * stopButton;
/**
* The box containing the close button.
*/
Gtk::HButtonBox buttonBox;
Gtk::HButtonBox bottomButtonBox;
/**
* The close button.
* The "clear list" button.
*/
Ptr<Gtk::Button>::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<Gtk::Menu>::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<Gtk::Menu>::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.

View file

@ -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<AudioClip>::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<Playable>::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<Playable>::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;
}
}

View file

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

View file

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