cleaned up Master Panel window open/close toggle buttons

(they used to close windows sometimes when they weren't supposed to)
This commit is contained in:
fgerlits 2005-05-03 14:15:08 +00:00
parent af576dcdb1
commit 65b62b0deb
3 changed files with 103 additions and 99 deletions

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.25 $
Version : $Revision: 1.26 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -84,7 +84,7 @@ MasterPanelWindow :: MasterPanelWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
nowPlayingWidget = Gtk::manage(new Gtk::Label("now playing"));
nowPlayingBin = Gtk::manage(widgetFactory->createDarkBlueBin());
nowPlayingBin->add(*nowPlayingWidget);
timeBin->set_size_request(-1, 104);
nowPlayingBin->set_size_request(-1, 104);
// set up the VU meter widget
vuMeterWidget = Gtk::manage(new Gtk::Label("VU meter"));
@ -331,7 +331,7 @@ MasterPanelWindow :: onUpdateTime(int dummy) throw ()
* The event when the Live Mode button has been clicked.
*----------------------------------------------------------------------------*/
void
MasterPanelWindow :: onLiveModeButtonClicked(void) throw ()
MasterPanelWindow :: updateLiveModeWindow(void) throw ()
{
if (!liveModeWindow.get()) {
Ptr<ResourceBundle>::Ref bundle;
@ -343,16 +343,12 @@ MasterPanelWindow :: onLiveModeButtonClicked(void) throw ()
}
liveModeWindow.reset(new LiveModeWindow(gLiveSupport, bundle));
liveModeWindow->show();
liveModeWindow->showContents();
return;
}
liveModeWindow->showContents();
if (!liveModeWindow->is_visible()) {
liveModeWindow->show();
liveModeWindow->showContents();
} else {
liveModeWindow->hide();
}
}
@ -361,7 +357,7 @@ MasterPanelWindow :: onLiveModeButtonClicked(void) throw ()
* The event when the upload file button has been clicked.
*----------------------------------------------------------------------------*/
void
MasterPanelWindow :: onUploadFileButtonClicked(void) throw ()
MasterPanelWindow :: onUploadFileButtonClicked(void) throw ()
{
if (!uploadFileWindow.get()) {
Ptr<ResourceBundle>::Ref bundle;
@ -389,7 +385,7 @@ MasterPanelWindow :: onUploadFileButtonClicked(void) throw ()
* The event when the Scratchpad button has been clicked.
*----------------------------------------------------------------------------*/
void
MasterPanelWindow :: onScratchpadButtonClicked(void) throw ()
MasterPanelWindow :: updateScratchpadWindow(void) throw ()
{
if (!scratchpadWindow.get()) {
Ptr<ResourceBundle>::Ref bundle;
@ -401,16 +397,12 @@ MasterPanelWindow :: onScratchpadButtonClicked(void) throw ()
}
scratchpadWindow.reset(new ScratchpadWindow(gLiveSupport, bundle));
scratchpadWindow->show();
scratchpadWindow->showContents();
return;
}
scratchpadWindow->showContents();
if (!scratchpadWindow->is_visible()) {
scratchpadWindow->show();
scratchpadWindow->showContents();
} else {
scratchpadWindow->hide();
}
}
@ -419,7 +411,7 @@ MasterPanelWindow :: onScratchpadButtonClicked(void) throw ()
* The event when the Simple Playlist Management button has been clicked.
*----------------------------------------------------------------------------*/
void
MasterPanelWindow :: onSimplePlaylistMgmtButtonClicked(void) throw ()
MasterPanelWindow :: updateSimplePlaylistMgmtWindow(void) throw ()
{
if (!simplePlaylistMgmtWindow.get()) {
Ptr<ResourceBundle>::Ref bundle;
@ -432,14 +424,12 @@ MasterPanelWindow :: onSimplePlaylistMgmtButtonClicked(void) throw ()
simplePlaylistMgmtWindow.reset(
new SimplePlaylistManagementWindow(gLiveSupport, bundle));
simplePlaylistMgmtWindow->show();
return;
}
simplePlaylistMgmtWindow->showContents();
if (!simplePlaylistMgmtWindow->is_visible()) {
simplePlaylistMgmtWindow->show();
} else {
simplePlaylistMgmtWindow->hide();
}
}
@ -448,7 +438,9 @@ MasterPanelWindow :: onSimplePlaylistMgmtButtonClicked(void) throw ()
* The event when the Scheduler button has been clicked.
*----------------------------------------------------------------------------*/
void
MasterPanelWindow :: onSchedulerButtonClicked(void) throw ()
MasterPanelWindow :: updateSchedulerWindow(
Ptr<boost::posix_time::ptime>::Ref time)
throw ()
{
if (!schedulerWindow.get()) {
Ptr<ResourceBundle>::Ref bundle;
@ -460,14 +452,16 @@ MasterPanelWindow :: onSchedulerButtonClicked(void) throw ()
}
schedulerWindow.reset(new SchedulerWindow(gLiveSupport, bundle));
schedulerWindow->show();
return;
}
if (time.get()) {
schedulerWindow->setTime(time);
}
schedulerWindow->showContents();
if (!schedulerWindow->is_visible()) {
schedulerWindow->show();
} else {
schedulerWindow->hide();
}
}
@ -476,7 +470,7 @@ MasterPanelWindow :: onSchedulerButtonClicked(void) throw ()
* The event when the Search button has been clicked.
*----------------------------------------------------------------------------*/
void
MasterPanelWindow :: onSearchButtonClicked(void) throw ()
MasterPanelWindow :: updateSearchWindow(void) throw ()
{
if (!searchWindow.get()) {
Ptr<ResourceBundle>::Ref bundle;
@ -488,14 +482,10 @@ MasterPanelWindow :: onSearchButtonClicked(void) throw ()
}
searchWindow.reset(new SearchWindow(gLiveSupport, bundle));
searchWindow->show();
return;
}
if (!searchWindow->is_visible()) {
searchWindow->show();
} else {
searchWindow->hide();
}
}

View file

@ -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/MasterPanelWindow.h,v $
------------------------------------------------------------------------------*/
@ -91,7 +91,7 @@ using namespace LiveSupport::Widgets;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.14 $
* @version $Revision: 1.15 $
*/
class MasterPanelWindow : public Gtk::Window, public LocalizedObject
{
@ -286,35 +286,76 @@ class MasterPanelWindow : public Gtk::Window, public LocalizedObject
* pressed.
*/
virtual void
onLiveModeButtonClicked(void) throw ();
onLiveModeButtonClicked(void) throw ()
{
if (!liveModeWindow ||
liveModeWindow && !liveModeWindow->is_visible()) {
updateLiveModeWindow();
} else {
liveModeWindow->hide();
}
}
/**
* Function to catch the event of the Scratchpad button being
* pressed.
*/
virtual void
onScratchpadButtonClicked(void) throw ();
onScratchpadButtonClicked(void) throw ()
{
if (!scratchpadWindow ||
scratchpadWindow && !scratchpadWindow->is_visible()) {
updateScratchpadWindow();
} else {
scratchpadWindow->hide();
}
}
/**
* Function to catch the event of the Simple Playlist
* Management button being pressed.
*/
virtual void
onSimplePlaylistMgmtButtonClicked(void) throw ();
onSimplePlaylistMgmtButtonClicked(void) throw ()
{
if (!simplePlaylistMgmtWindow ||
simplePlaylistMgmtWindow &&
!simplePlaylistMgmtWindow->is_visible()) {
updateSimplePlaylistMgmtWindow();
} else {
simplePlaylistMgmtWindow->hide();
}
}
/**
* Function to catch the event of the Scheduler button
* button being pressed.
*/
virtual void
onSchedulerButtonClicked(void) throw ();
onSchedulerButtonClicked(void) throw ()
{
if (!schedulerWindow ||
schedulerWindow && !schedulerWindow->is_visible()) {
updateSchedulerWindow();
} else {
schedulerWindow->hide();
}
}
/**
* Function to catch the event of the Search button
* button being pressed.
*/
virtual void
onSearchButtonClicked(void) throw ();
onSearchButtonClicked(void) throw ()
{
if (!searchWindow ||
searchWindow && !searchWindow->is_visible()) {
updateSearchWindow();
} else {
searchWindow->hide();
}
}
public:
@ -364,68 +405,35 @@ class MasterPanelWindow : public Gtk::Window, public LocalizedObject
* Update the Live Mode window.
*/
void
updateLiveModeWindow(void) throw ()
{
// this will create, open and display the window.
onLiveModeButtonClicked();
}
updateLiveModeWindow(void) throw ();
/**
* Update the Scratchpad window.
*/
void
updateScratchpadWindow(void) throw ()
{
// this will create, open and display the window.
onScratchpadButtonClicked();
}
updateScratchpadWindow(void) throw ();
/**
* Update the Simple Playlist Management Window
*/
void
updateSimplePlaylistMgmtWindow(void) throw ()
{
// this will create, open and display the window.
onSimplePlaylistMgmtButtonClicked();
simplePlaylistMgmtWindow->showContents();
}
updateSimplePlaylistMgmtWindow(void) throw ();
/**
* Update the Scheduler Window
*/
void
updateSchedulerWindow(void) throw ()
{
// this will create, open and display the window.
onSchedulerButtonClicked();
schedulerWindow->showContents();
}
/**
* Update the Scheduler Window to display a new time.
* Update the Scheduler Window, optionally to display a new time.
*
* @param time the time to display in the scheduler window.
*/
void
updateSchedulerWindow(Ptr<boost::posix_time::ptime>::Ref time)
throw ()
{
// this will create, open and display the window.
onSchedulerButtonClicked();
schedulerWindow->setTime(time);
schedulerWindow->showContents();
}
updateSchedulerWindow(Ptr<boost::posix_time::ptime>::Ref time =
Ptr<boost::posix_time::ptime>::Ref())
throw ();
/**
* Update the Search Window
*/
void
updateSearchWindow(void) throw ()
{
// this will create, open and display the window.
onSearchButtonClicked();
}
updateSearchWindow(void) throw ();
};
/* ================================================= external data structures */

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/SimplePlaylistManagementWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -154,6 +154,10 @@ SimplePlaylistManagementWindow :: onSaveButtonClicked (void) throw ()
title.reset(new Glib::ustring(nameEntry->get_text()));
playlist = gLiveSupport->getEditedPlaylist();
if (!playlist) {
return;
}
playlist->setTitle(title);
playlist = gLiveSupport->savePlaylist();
@ -197,23 +201,25 @@ SimplePlaylistManagementWindow :: showContents(void) throw ()
Playlist::const_iterator end;
playlist = gLiveSupport->getEditedPlaylist();
it = playlist->begin();
end = playlist->end();
entriesModel->clear();
while (it != end) {
Ptr<PlaylistElement>::Ref playlistElem = it->second;
Ptr<Playable>::Ref playable = playlistElem->getPlayable();
Gtk::TreeModel::Row row = *(entriesModel->append());
row[modelColumns.idColumn] = playable->getId();
row[modelColumns.startColumn] =
to_simple_string(*playlistElem->getRelativeOffset());
row[modelColumns.titleColumn] = *playable->getTitle();
row[modelColumns.lengthColumn] =
to_simple_string(*playable->getPlaylength());
it++;
if (playlist) {
it = playlist->begin();
end = playlist->end();
entriesModel->clear();
while (it != end) {
Ptr<PlaylistElement>::Ref playlistElem = it->second;
Ptr<Playable>::Ref playable = playlistElem->getPlayable();
Gtk::TreeModel::Row row = *(entriesModel->append());
row[modelColumns.idColumn] = playable->getId();
row[modelColumns.startColumn] =
to_simple_string(*playlistElem->getRelativeOffset());
row[modelColumns.titleColumn] = *playable->getTitle();
row[modelColumns.lengthColumn] =
to_simple_string(*playable->getPlaylength());
it++;
}
}
}