added audio clip and playlist icons in place of the "audioclip" and

"playlist" texts
(see bug #1154)
This commit is contained in:
fgerlits 2005-06-17 16:05:20 +00:00
parent c8159a7323
commit 2aed43ffe0
10 changed files with 150 additions and 66 deletions

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/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h,v $
------------------------------------------------------------------------------*/
@ -92,7 +92,7 @@ class ZebraTreeView;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.23 $
* @version $Revision: 1.24 $
*/
class WidgetFactory :
virtual public Configurable
@ -123,7 +123,9 @@ class WidgetFactory :
searchWindowTitleImage,
liveModeWindowTitleImage,
playlistsWindowTitleImage,
schedulerWindowTitleImage }
schedulerWindowTitleImage,
audioClipIconImage,
playlistIconImage }
ImageType;
@ -188,6 +190,12 @@ class WidgetFactory :
*/
Glib::RefPtr<Gdk::Pixbuf> comboBoxRightImage;
/**
* A container holding the miscallenous image pixbuf references.
*/
std::map<ImageType, Glib::RefPtr<Gdk::Pixbuf> >
imageTypePixbufs;
/**
* The default constructor.
*/
@ -352,6 +360,14 @@ class WidgetFactory :
return whiteWindowImages;
}
/**
* Return a smart pointer to a Gdk::Pixbuf holding a named image.
*
* @return the image.
*/
Glib::RefPtr<Gdk::Pixbuf>
getPixbuf(ImageType imageName) throw ();
/**
* Create and return a container holding an image.
* It is the reponsibility of the caller to dispose of the created

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.13 $
Version : $Revision: 1.14 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/ZebraTreeView.h,v $
------------------------------------------------------------------------------*/
@ -92,7 +92,7 @@ using namespace LiveSupport::Core;
* 3) connected with a TreeModelColumn using set_renderer().
*
* @author $Author: fgerlits $
* @version $Revision: 1.13 $
* @version $Revision: 1.14 $
*/
class ZebraTreeView : public Gtk::TreeView
{
@ -162,6 +162,23 @@ class ZebraTreeView : public Gtk::TreeView
int minimumWidth = 0)
throw ();
/**
* Add an image column to the TreeView.
*
* @param title the title of the column
* @param image the type of button this view will display
* @param minimumWidth the minimum width of the column, in pixels
* (optional)
* @return the number of columns after adding this one
*/
int
appendColumn(
const Glib::ustring& title,
const Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > &
modelColumn,
int minimumWidth = 0)
throw ();
/**
* Add a button column to the TreeView.
*

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.26 $
Version : $Revision: 1.27 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/WidgetFactory.cxx,v $
------------------------------------------------------------------------------*/
@ -268,6 +268,16 @@ static const std::string liveModeWindowTitleImageName
static const std::string playlistsWindowTitleImageName
= "titleImages/playlistsWindowTitle.png";
/**
* The name of the image for the audio clip icon.
*/
static const std::string audioClipIconImageName = "icons/audioClipIcon.gif";
/**
* The name of the image for the playlist icon.
*/
static const std::string playlistIconImageName = "icons/playlistIcon.gif";
/**
* The name of the image for the title of the scheduler window.
*/
@ -367,6 +377,23 @@ WidgetFactory :: configure(const xmlpp::Element & element)
// load the white window corner images
whiteWindowImages.reset(new CornerImages(path + whiteWindowPath));
// load the miscellaneous images
imageTypePixbufs[resizeImage] = loadImage(resizeImageName);
imageTypePixbufs[scratchpadWindowTitleImage]
= loadImage(scratchpadWindowTitleImageName);
imageTypePixbufs[searchWindowTitleImage]
= loadImage(searchWindowTitleImageName);
imageTypePixbufs[liveModeWindowTitleImage]
= loadImage(liveModeWindowTitleImageName);
imageTypePixbufs[playlistsWindowTitleImage]
= loadImage(playlistsWindowTitleImageName);
imageTypePixbufs[schedulerWindowTitleImage]
= loadImage(schedulerWindowTitleImageName);
imageTypePixbufs[audioClipIconImage]
= loadImage(audioClipIconImageName);
imageTypePixbufs[playlistIconImage]
= loadImage(playlistIconImageName);
}
@ -568,44 +595,22 @@ WidgetFactory :: createButton(ImageButtonType type) throw ()
/*------------------------------------------------------------------------------
* Create a resize image
* Return a Gdk::Pixbuf reference to a named image
*----------------------------------------------------------------------------*/
Glib::RefPtr<Gdk::Pixbuf>
WidgetFactory :: getPixbuf(ImageType imageName) throw ()
{
return imageTypePixbufs[imageName];
}
/*------------------------------------------------------------------------------
* Create a Gtk::Image
*----------------------------------------------------------------------------*/
Gtk::Image *
WidgetFactory :: createImage(ImageType imageName) throw ()
{
Glib::RefPtr<Gdk::Pixbuf> rawImage;
switch (imageName) {
case resizeImage:
rawImage = loadImage(resizeImageName);
break;
case scratchpadWindowTitleImage:
rawImage = loadImage(scratchpadWindowTitleImageName);
break;
case searchWindowTitleImage:
rawImage = loadImage(searchWindowTitleImageName);
break;
case liveModeWindowTitleImage:
rawImage = loadImage(liveModeWindowTitleImageName);
break;
case playlistsWindowTitleImage:
rawImage = loadImage(playlistsWindowTitleImageName);
break;
case schedulerWindowTitleImage:
rawImage = loadImage(schedulerWindowTitleImageName);
break;
default:
return 0;
}
return new Gtk::Image(rawImage);
return new Gtk::Image(getPixbuf(imageName));
}

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.16 $
Version : $Revision: 1.17 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/ZebraTreeView.cxx,v $
------------------------------------------------------------------------------*/
@ -74,7 +74,7 @@ ZebraTreeView :: ~ZebraTreeView(void) throw ()
/*------------------------------------------------------------------------------
* Add a column to the TreeView.
* Add a text column to the TreeView.
*----------------------------------------------------------------------------*/
int
ZebraTreeView :: appendColumn(
@ -87,8 +87,8 @@ ZebraTreeView :: appendColumn(
Gtk::CellRendererText* renderer = Gtk::manage(new Gtk::CellRendererText);
// the constructor packs the renderer into the TreeViewColumn
Gtk::TreeViewColumn* viewColumn = Gtk::manage(new
Gtk::TreeViewColumn(title, *renderer) );
Gtk::TreeViewColumn* viewColumn = Gtk::manage(
new Gtk::TreeViewColumn(title, *renderer) );
// and then we associate this renderer with the model column
viewColumn->add_attribute(renderer->property_markup(), modelColumn);
@ -107,6 +107,42 @@ ZebraTreeView :: appendColumn(
}
/*------------------------------------------------------------------------------
* Add an image column to the TreeView.
*----------------------------------------------------------------------------*/
int
ZebraTreeView :: appendColumn(
const Glib::ustring& title,
const Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > &
modelColumn,
int minimumWidth)
throw ()
{
// a standard cell renderer; can be replaced with a ZebraCellRenderer
Gtk::CellRendererPixbuf* renderer = Gtk::manage(
new Gtk::CellRendererPixbuf );
// the constructor packs the renderer into the TreeViewColumn
Gtk::TreeViewColumn* viewColumn = Gtk::manage(
new Gtk::TreeViewColumn(title, *renderer) );
// and then we associate this renderer with the model column
viewColumn->add_attribute(renderer->property_pixbuf(), modelColumn);
// this cell data function will do the blue-gray zebra stripes
viewColumn->set_cell_data_func(
*renderer,
sigc::mem_fun(*this, &ZebraTreeView::cellDataFunction) );
// set the minimum width of the column
if (minimumWidth) {
viewColumn->set_min_width(minimumWidth);
}
return append_column(*viewColumn);
}
/*------------------------------------------------------------------------------
* Add a button column to the TreeView.
*----------------------------------------------------------------------------*/
@ -130,8 +166,8 @@ ZebraTreeView :: appendColumn(
renderer->property_pixbuf() = passiveImage;
// the constructor packs the renderer into the TreeViewColumn
Gtk::TreeViewColumn* viewColumn = Gtk::manage(new
Gtk::TreeViewColumn(title, *renderer) );
Gtk::TreeViewColumn* viewColumn = Gtk::manage(
new Gtk::TreeViewColumn(title, *renderer) );
// this cell data function will do the blue-gray zebra stripes
viewColumn->set_cell_data_func(
@ -180,8 +216,8 @@ ZebraTreeView :: appendCenteredColumn(
renderer->property_xalign() = 0.5;
// the constructor packs the renderer into the TreeViewColumn
Gtk::TreeViewColumn* viewColumn = Gtk::manage(new
Gtk::TreeViewColumn(title, *renderer) );
Gtk::TreeViewColumn* viewColumn = Gtk::manage(
new Gtk::TreeViewColumn(title, *renderer) );
// and then we associate this renderer with the model column
viewColumn->add_attribute(renderer->property_markup(), modelColumn);
@ -217,8 +253,8 @@ ZebraTreeView :: appendLineNumberColumn(
renderer->property_xalign() = 0.5;
// the constructor packs the renderer into the TreeViewColumn
Gtk::TreeViewColumn* viewColumn = Gtk::manage(new
Gtk::TreeViewColumn(title, *renderer) );
Gtk::TreeViewColumn* viewColumn = Gtk::manage(
new Gtk::TreeViewColumn(title, *renderer) );
// this cell data function will do the blue-gray zebra stripes
// and fill in the line number from the model.rowNumberColumn

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/ScratchpadWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -108,7 +108,7 @@ ScratchpadWindow :: ScratchpadWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
// Add the TreeView's view columns:
try {
treeView->appendColumn(*getResourceUstring("typeColumnLabel"),
modelColumns.typeColumn, 60);
modelColumns.typeColumn, 20);
treeView->appendColumn(*getResourceUstring("titleColumnLabel"),
modelColumns.titleColumn, 200);
} catch (std::invalid_argument &e) {
@ -251,6 +251,8 @@ ScratchpadWindow :: showContents(void) throw ()
treeModel->clear();
int rowNumber = 0;
Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance();
while (it != end) {
playable = *it;
row = *(treeModel->append());
@ -258,11 +260,13 @@ ScratchpadWindow :: showContents(void) throw ()
row[modelColumns.playableColumn] = playable;
switch (playable->getType()) {
case Playable::AudioClipType:
row[modelColumns.typeColumn] = "audioclip";
row[modelColumns.typeColumn] = widgetFactory->getPixbuf(
WidgetFactory::audioClipIconImage);
break;
case Playable::PlaylistType:
row[modelColumns.typeColumn] = "playlist";
row[modelColumns.typeColumn] = widgetFactory->getPixbuf(
WidgetFactory::playlistIconImage);
break;
default:

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.8 $
Version : $Revision: 1.9 $
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.8 $
* @version $Revision: 1.9 $
*/
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.8 $
* @version $Revision: 1.9 $
*/
class ModelColumns : public PlayableTreeModelColumnRecord
{
@ -95,7 +95,8 @@ class ScratchpadWindow : public WhiteWindow,
/**
* The column for the type of the entry in the list
*/
Gtk::TreeModelColumn<Glib::ustring> typeColumn;
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> >
typeColumn;
/**
* The column for the title of the audio clip or playlist.

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.19 $
Version : $Revision: 1.20 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SearchWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -232,7 +232,7 @@ SearchWindow :: constructSearchResultsView(void) throw ()
// add the TreeView's view columns
try {
searchResults->appendColumn(*getResourceUstring("typeColumnLabel"),
modelColumns.typeColumn, 60);
modelColumns.typeColumn, 20);
searchResults->appendColumn(*getResourceUstring("titleColumnLabel"),
modelColumns.titleColumn, 200);
searchResults->appendColumn(*getResourceUstring("creatorColumnLabel"),
@ -324,6 +324,8 @@ SearchWindow :: onSearch(Ptr<SearchCriteria>::Ref criteria)
return;
}
Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance();
std::list<Ptr<Playable>::Ref>::const_iterator it;
treeModel->clear();
int rowNumber = 0;
@ -339,10 +341,12 @@ SearchWindow :: onSearch(Ptr<SearchCriteria>::Ref criteria)
switch (playable->getType()) {
case Playable::AudioClipType:
row[modelColumns.typeColumn] = "audioclip";
row[modelColumns.typeColumn] = widgetFactory->getPixbuf(
WidgetFactory::audioClipIconImage);
break;
case Playable::PlaylistType:
row[modelColumns.typeColumn] = "playlist";
row[modelColumns.typeColumn] = widgetFactory->getPixbuf(
WidgetFactory::playlistIconImage);
break;
default:
break;

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.13 $
Version : $Revision: 1.14 $
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.13 $
* @version $Revision: 1.14 $
*/
class SearchWindow : public WhiteWindow, public LocalizedObject
{
@ -181,7 +181,7 @@ class SearchWindow : public WhiteWindow, public LocalizedObject
* Lists one clip per row.
*
* @author $Author: fgerlits $
* @version $Revision: 1.13 $
* @version $Revision: 1.14 $
*/
class ModelColumns : public PlayableTreeModelColumnRecord
{
@ -189,7 +189,8 @@ class SearchWindow : public WhiteWindow, public LocalizedObject
/**
* The column for the type of the entry in the list
*/
Gtk::TreeModelColumn<Glib::ustring> typeColumn;
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> >
typeColumn;
/**
* The column for the title of the audio clip or playlist.

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B