/**********************************************************************
 *
 *   FreeDoko a Doppelkopf-Game
 *    
 *   Copyright (C) 2001-2004  by Diether Knof and Borg Enders
 *
 *   This program is free software; you can redistribute it and/or 
 *   modify it under the terms of the GNU General Public License as 
 *   published by the Free Software Foundation; either version 2 of 
 *   the License, or (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details. 
 *   You can find this license in the file 'gpl.txt'.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 *   MA  02111-1307  USA
 *
 *  Contact:
 *    Diether Knof dknof@gmx.de
 *    Borg Enders  borg@borgsoft.de
 *
 *********************************************************************/

#include "constants.h"

#ifdef USE_UI_GTKMM

#include "icons.h"

#include "ui.h"
#include "cards.h"
#include "utils.h"
#include "splash_screen.h" // ToDo: remove it

#include "../../party/party.h"
#include "../../game/game.h"
#include "../../misc/setting.h"
#include "../../misc/translator.h"

namespace UI_GTKMM_NS {
  unsigned const Icons::NUMBER_OF_TYPES = NO_0 + 1;

  /**
   **
   ** Constructor
   **
   ** @param	-
   **
   ** @return	-
   ** 
   ** @author	Diether Knof
   **
   ** @version	0.6.1
   **
   **/
  Icons::Icons(Base* const parent) :
    Base(parent),
  icon_(),
  drawable_ref(parent->ui->splash_screen->get_root_window())
  {
    DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		  "Icons::Icons(parent)");

    this->load();

    DEBUG_RETURNING(VOID,
		    INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		    "Icons::Icons(parent)");
  } // Icons::Icons(Base* const parent)

  /**
   **
   ** Destruktor
   **
   ** @param	-
   **
   ** @return	-
   ** 
   ** @author	Diether Knof
   **
   ** @version	0.6.1
   **
   **/
  Icons::~Icons()
  {
    DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		  "Icons::~Icons()");

    DEBUG_RETURNING(VOID,
		    INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		    "Icons::~Icons()");
  } // Icons::~Icons()

  /**
   **
   ** -> result
   **
   ** @param	-
   **
   ** @return	the scaling
   **
   ** @version	0.6,1
   **
   ** @author	Diether Knof
   **
   **/
  double
    Icons::scaling() const
    {
      DEBUG_CALLING(INFO_GTKMM_CARDS && INFO_GTKMM_INIT,
		    "Icons::scaling()");

      DEBUG_RETURNING(this->ui->cards->scaling(),
		      INFO_GTKMM_CARDS && INFO_GTKMM_INIT,
		      "Icons::scaling()");
    } // double Icons::scaling() const

  /**
   **
   ** update the scaling
   **
   ** @param	-
   **
   ** @return	-
   **
   ** @version	0.6,2
   **
   ** @author	Diether Knof
   **
   **/
  void
    Icons::update_scaling()
    {
      DEBUG_CALLING(INFO_GTKMM_CARDS && INFO_GTKMM_INIT,
		    "Icons::update_scaling()");

      // the scaling value is already updated in 'Cards'

      // set the scaling of the 'ScaledPixbufRotations'
      for (vector<Gdk::ScaledPixbufRotations>::iterator
	   i = this->icon_.begin();
	   i != this->icon_.end();
	   i++)
	i->set_scaling(this->scaling());

      DEBUG_RETURNING(VOID,
		      INFO_GTKMM_CARDS && INFO_GTKMM_INIT,
		      "Icons::update_scaling()");
    } // void Icons::update_scaling()

  /**
   **
   ** -> result
   **
   ** @param	-
   **
   ** @return	maximal icon width of all icons
   ** 
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  int
    Icons::max_width() const
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		    "Icongroup::max_width()");

      int width = 0;

      for (vector<Gdk::ScaledPixbufRotations>::const_iterator
	   i = this->icon_.begin();
	   i != this->icon_.end();
	   i++)
	if (*i)
	  if (i->get_width() > width)
	    width = i->get_width();

      DEBUG_RETURNING(width,
		      INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		      "Icongroup::max_width()");
    } // int Icons::max_width() const

  /**
   **
   ** -> result
   **
   ** @param	-
   **
   ** @return	maximal icon height of all icons
   ** 
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  int
    Icons::max_height() const
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		    "Icongroup::max_height(icons)");

      int height = 0;

      for (vector<Gdk::ScaledPixbufRotations>::const_iterator
	   i = this->icon_.begin();
	   i != this->icon_.end();
	   i++)
	if (*i)
	  if (i->get_height() > height)
	    height = i->get_height();

      DEBUG_RETURNING(height,
		      INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		      "Icongroup::max_height()");
    } // int Icons::max_height()

  /**
   **
   ** -> result
   **
   ** @param	icons	the icons to look at
   **
   ** @return	maximal icon width of the icons
   ** 
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  int
    Icons::max_width(vector<Glib::RefPtr<Gdk::Pixbuf> > const& icons) const
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		    "Icongroup::max_width(icons)");

      int width = 0;

      for (vector<Glib::RefPtr<Gdk::Pixbuf> >::const_iterator
	   i = icons.begin();
	   i != icons.end();
	   i++)
	if ((*i)->get_width() > width)
	  width = (*i)->get_width();

      DEBUG_RETURNING(width,
		      INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		      "Icongroup::max_width(icons)");
    } // int Icons::max_width(vector<Glib::RefPtr<Gdk::Pixbuf> > const& icons)

  /**
   **
   ** -> result
   **
   ** @param	icons	the icons to look at
   **
   ** @return	maximal icon height of the icons
   ** 
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  int
    Icons::max_height(vector<Glib::RefPtr<Gdk::Pixbuf> > const& icons) const
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		    "Icongroup::max_height(icons)");

      int height = 0;

      for (vector<Glib::RefPtr<Gdk::Pixbuf> >::const_iterator
	   i = icons.begin();
	   i != icons.end();
	   i++)
	if ((*i)->get_height() > height)
	  height = (*i)->get_height();

      DEBUG_RETURNING(height,
		      INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		      "Icongroup::max_height(icons)");
    } // int Icons::max_height(vector<Glib::RefPtr<Gdk::Pixbuf> > const& icons)

  /**
   **
   ** -> result
   **
   ** @param	type		the type
   ** @param	rotation	the rotation
   **
   ** @return	the pixbuf of 'icon'
   **		(with rotation 'rotation')
   **
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  Glib::RefPtr<Gdk::Pixbuf> const&
    Icons::icon(Type const type, Rotation const rotation)
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		    "Icons::icon(type, rotation)");

      DEBUG_RETURNING(this->icon_[type][rotation],
		      INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		      "Icons::icon(type, rotation)");
    } // Glib::RefPtr<Gdk::Pixbuf> Icons::icon(Type const type, Rotation const rotation = UP)

  /**
   **
   ** -> result
   **
   ** @param	gametype	the gametype
   ** @param	rotation	the rotation
   **
   ** @return	the icon 'gametype'
   **		(with rotation 'rotation')
   **
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  Glib::RefPtr<Gdk::Pixbuf> const&
    Icons::icon(GAMETYPE::GameType const gametype,
		Rotation const rotation)
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		    "Icons::icon(gametype, rotation)");

      Type type = NONE;

      switch(gametype) {
      case GAMETYPE::NORMAL:
	type = RE;
	break;
      case GAMETYPE::FIVE_NINES:
	type = FIVE_NINES;
	break;
      case GAMETYPE::SIX_KINGS:
	type = SIX_KINGS;
	break;
      case GAMETYPE::POVERTY:
	if (::game_status == GAMESTATUS::GAME_POVERTY_SHIFT) {
	  type = POVERTY;
	} else { // if !(::game_status == GAMESTATUS::GAME_POVERTY_SHIFT)
	  switch (::party.game().poverty_cardno()) {
	  case 0:
	    type = POVERTY_TRUMPS_0;
	    break;
	  case 1:
	    type = POVERTY_TRUMPS_1;
	    break;
	  case 2:
	    type = POVERTY_TRUMPS_2;
	    break;
	  case 3:
	    type = POVERTY_TRUMPS_3;
	    break;
	  case UINT_MAX:
	    type = POVERTY;
	    break;
	  default:
	    DEBUG_ASSERTION(false,
			    "Icons::icon(gametype, player):\n"
			    "  gametype: poverty\n"
			    "  number of poverty cards invalid: "
			    << ::party.game().poverty_cardno());
	    type = POVERTY;
	    break;
	  } // switch (::party.game().poverty_cardno())
	} // if !(::game_status == GAMESTATUS::GAME_POVERTY_SHIFT)
	break;
      case GAMETYPE::FOX_HIGHEST_TRUMP:
	type = FOX_HIGHEST_TRUMP;
	break;
      case GAMETYPE::GENSCHER:
	type = GENSCHER;
	break;
      case GAMETYPE::MARRIAGE:
      case GAMETYPE::MARRIAGE_SOLO:
      case GAMETYPE::MARRIAGE_SILENT:
	type = MARRIAGE;
	break;
      case GAMETYPE::SOLO_DIAMOND:
	type = SOLO_DIAMOND;
	break;
      case GAMETYPE::SOLO_JACK:
	type = SOLO_JACK;
	break;
      case GAMETYPE::SOLO_QUEEN:
	type = SOLO_QUEEN;
	break;
      case GAMETYPE::SOLO_KING:
	type = SOLO_KING;
	break;
      case GAMETYPE::SOLO_QUEEN_JACK:
	type = SOLO_QUEEN_JACK;
	break;
      case GAMETYPE::SOLO_KING_JACK:
	type = SOLO_KING_JACK;
	break;
      case GAMETYPE::SOLO_KING_QUEEN:
	type = SOLO_KING_QUEEN;
	break;
      case GAMETYPE::SOLO_KOEHLER:
	type = SOLO_KOEHLER;
	break;
      case GAMETYPE::SOLO_CLUB:
	type = SOLO_CLUB;
	break;
      case GAMETYPE::SOLO_HEART:
	type = SOLO_HEART;
	break;
      case GAMETYPE::SOLO_SPADE:
	type = SOLO_SPADE;
	break;
      case GAMETYPE::SOLO_MEATLESS:
	type = SOLO_MEATLESS;
	break;
      } // switch(gametype)

      DEBUG_RETURNING(this->icon(type, rotation),
		      INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		      "Icons::icon(gametype, rotation)");
    } // Glib::RefPtr<Gdk::Pixbuf> Icons::icon(GAMETYPE::GameType const gametype, Rotation const rotation = UP)

  /**
   **
   ** -> result
   **
   ** @param	marriage_selector	the marriage selector
   ** @param	rotation		the rotation
   **
   ** @return	the icon 'marriage_selector'
   **		(with rotation 'rotation')
   **
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  Glib::RefPtr<Gdk::Pixbuf> const&
    Icons::icon(MARRIAGE_SELECTOR::MarriageSelector const marriage_selector,
		Rotation const rotation)
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		    "Icons::icon(marriage_selector, rotation)");

      Type type = NONE;

      switch(marriage_selector) {
      case MARRIAGE_SELECTOR::TEAM_SET:
	type = MARRIAGE;
	break;
      case MARRIAGE_SELECTOR::FIRST_FOREIGN:
	type = MARRIAGE_FOREIGN;
	break;
      case MARRIAGE_SELECTOR::FIRST_TRUMP:
	type = MARRIAGE_TRUMP;
	break;
      case MARRIAGE_SELECTOR::FIRST_COLOR:
	type = MARRIAGE_COLOR;
	break;
      case MARRIAGE_SELECTOR::FIRST_CLUB:
	type = MARRIAGE_CLUB;
	break;
      case MARRIAGE_SELECTOR::FIRST_SPADE:
	type = MARRIAGE_SPADE;
	break;
      case MARRIAGE_SELECTOR::FIRST_HEART:
	type = MARRIAGE_HEART;
	break;
      } // switch (marriage_selector)

      DEBUG_RETURNING(this->icon(type, rotation),
		      INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		      "Icons::icon(marriage_selector, rotation)");
    } // Glib::RefPtr<Gdk::Pixbuf> Icons::icon(MARRIAGE_SELECTOR::MarriageSelector const marriage_selector, Rotation const rotation = UP)

  /**
   **
   ** -> result
   **
   ** @param	team		the team
   ** @param	rotation	the rotation
   **
   ** @return	the icon 'team'
   **		(with rotation 'rotation')
   **
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  Glib::RefPtr<Gdk::Pixbuf> const&
    Icons::icon(TEAM::Team const team,
		Rotation const rotation)
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		    "Icons::icon(marriage_selector, rotation)");

      Type type = NONE;

      switch(team) {
      case TEAM::RE:
	type = RE;
	break;
      case TEAM::CONTRA:
	type = CONTRA;
	break;
      default:
	type = NONE;
	break;
      } // switch(team)

      DEBUG_RETURNING(this->icon(type, rotation),
		      INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		      "Icons::icon(team, rotation)");
    } // Glib::RefPtr<Gdk::Pixbuf> Icons::icon(TEAM::Team const team, Rotation const rotation = UP)

  /**
   **
   ** -> result
   **
   ** @param	announcement	the announcement
   ** @param	rotation	the rotation
   **
   ** @return	the icon 'announcement'
   **		(with rotation 'rotation')
   **
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  Glib::RefPtr<Gdk::Pixbuf> const&
    Icons::icon(Announcement const announcement,
		Rotation const rotation)
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		    "Icons::icon(announcement, rotation)");

      Type type = NONE;

      switch(announcement) {
      case ANNOUNCEMENT::NOANNOUNCEMENT:
	DEBUG_ASSERTION(false,
			"Icon::icon(announcement, rotation):\n"
			"  invalid announcement 'NOANNOUNCEMENT'");
	break;
      case ANNOUNCEMENT::NO120:
	type = NO_120;
	break;
      case ANNOUNCEMENT::NO90:
	type = NO_90;
	break;
      case ANNOUNCEMENT::NO60:
	type = NO_60;
	break;
      case ANNOUNCEMENT::NO30:
	type = NO_30;
	break;
      case ANNOUNCEMENT::NO0:
	type = NO_0;
	break;
      case ANNOUNCEMENT::REPLY:
#ifdef POSTPHONED
	DEBUG_ASSERTION(false,
			"Icon::icon(announcement, rotation):\n"
			"  invalid announcement 'REPLY'");
#else
	type = NO_120;
#endif
	break;
      case ANNOUNCEMENT::NO120_REPLY:
	type = NO_120_REPLY;
	break;
      case ANNOUNCEMENT::NO90_REPLY:
	type = NO_90_REPLY;
	break;
      case ANNOUNCEMENT::NO60_REPLY:
	type = NO_60_REPLY;
	break;
      case ANNOUNCEMENT::NO30_REPLY:
	type = NO_30_REPLY;
	break;
      case ANNOUNCEMENT::NO0_REPLY:
	type = NO_0_REPLY;
	break;
      } // switch(announcement)

      DEBUG_RETURNING(this->icon(type, rotation),
		      INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		      "Icons::icon(announcement, rotation)");
    } // Glib::RefPtr<Gdk::Pixbuf> Icons::icon(Announcement const announcement, Rotation const rotation = UP)

  /**
   **
   ** -> result
   **
   ** @param	color		the color
   ** @param	rotation	the rotation
   **
   ** @return	the swines icon of 'color'
   **		(with rotation 'rotation')
   **
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  Glib::RefPtr<Gdk::Pixbuf> const&
    Icons::swines(Card::Color const color,
		  Rotation const rotation)
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		    "Icons::swines(color, rotation)");

      Type type = NONE;

      switch(color) {
      case Card::CLUB:
	type = SWINES_CLUB;
	break;
      case Card::SPADE:
	type = SWINES_SPADE;
	break;
      case Card::HEART:
	type = SWINES_HEART;
	break;
      case Card::DIAMOND:
	type = SWINES_DIAMOND;
	break;
      default:
	DEBUG_ASSERTION(false,
			"Icon::swines(color)\n"
			"  Color is not valid\n");
      } // switch(color)

      DEBUG_RETURNING(this->icon(type, rotation),
		      INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		      "Icons::swines(color, rotation)");
    } // Glib::RefPtr<Gdk::Pixbuf> Icons::swines(Card::Color const color, Rotation const rotation = UP)

  /**
   **
   ** -> result
   **
   ** @param	color		the color
   ** @param	rotation	the rotation
   **
   ** @return	the hyperswines icon of 'color'
   **		(with rotation 'rotation')
   **
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  Glib::RefPtr<Gdk::Pixbuf> const&
    Icons::hyperswines(Card::Color const color,
		       Rotation const rotation)
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		    "Icons::hyperswines(color, rotation)");

      Type type = NONE;

      switch(color) {
      case Card::CLUB:
	type = HYPERSWINES_CLUB;
	break;
      case Card::SPADE:
	type = HYPERSWINES_SPADE;
	break;
      case Card::HEART:
	type = HYPERSWINES_HEART;
	break;
      case Card::DIAMOND:
	type = HYPERSWINES_DIAMOND;
	break;
      default:
	DEBUG_ASSERTION(false,
			"Icon::hyperswines(color)\n"
			"  Color is not valid\n");
      } // switch(color)

      DEBUG_RETURNING(this->icon(type, rotation),
		      INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		      "Icons::hyperswines(color, rotation)");
    } // Glib::RefPtr<Gdk::Pixbuf> Icons::hyperswines(Card::Color const color, Rotation const rotation = UP)

  /**
   **
   ** -> result
   **
   ** @param	color		the color
   ** @param	rotation	the rotation
   **
   ** @return	the swines-hyperswines icon of 'color'
   **		(with rotation 'rotation')
   **
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  Glib::RefPtr<Gdk::Pixbuf> const&
    Icons::swines_hyperswines(Card::Color const color,
			      Rotation const rotation)
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		    "Icons::swines_hyperswines(color, rotation)");

      Type type = NONE;

      switch(color) {
      case Card::CLUB:
	type = SWINES_HYPERSWINES_CLUB;
	break;
      case Card::SPADE:
	type = SWINES_HYPERSWINES_SPADE;
	break;
      case Card::HEART:
	type = SWINES_HYPERSWINES_HEART;
	break;
      case Card::DIAMOND:
	type = SWINES_HYPERSWINES_DIAMOND;
	break;
      default:
	DEBUG_ASSERTION(false,
			"Icon::swines_hyperswines(color)\n"
			"  Color is not valid\n");
      } // switch(color)

      DEBUG_RETURNING(this->icon(type, rotation),
		      INFO_GTKMM_ICONS && INFO_GTKMM_VALUE,
		      "Icons::swines_hyperswines(color, rotation)");
    } // Glib::RefPtr<Gdk::Pixbuf> Icons::swines_hyperswines(Card::Color const color, Rotation const rotation = UP)

  /**
   **
   ** load the icons
   **
   ** @param	-
   **
   ** @return	-
   **
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  void
    Icons::load()
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		    "Icons::load()");

      if (Glib::file_test(this->ui->cards->directory() + "/"
			  + ::setting(Setting::ICONS_DIRECTORY) + "/"
			  + "no_120"
			  + "." + ::setting(Setting::GRAPHIC_EXTENSION),
			  Glib::FILE_TEST_IS_REGULAR)) {

	  if (this->icon_.empty()) {
	    this->ui->error("Error at loading the icons from the cardset "
			    + ::setting(Setting::CARDSET) + ".\n"
			    + "Perhaps you should validate your 'FreeDokorc'-File "
			    + "(in the directory '"
			    + ::setting(Setting::PRIVATE_DATA_DIRECTORY)
			    + "').");
	  } else { // if !(this->icon_.empty())
	    this->ui->information(::translator("Error at loading the icons from the cardset "
				  + ::setting(Setting::CARDSET) + ".\n"
				  "Keeping the old icons."));
	  } // if !(this->icon_.empty())

	  DEBUG_RETURNING(VOID,
			  INFO_GTKMM_ICONS && INFO_GTKMM_UPDATE,
			  "Icons::load()");
      } // if (directory is valid)

      if (::game_status != GAMESTATUS::PROGRAMSTART) {
	this->ui->set_max_progress(1);
	this->ui->add_status_message(::translator("loading icons"));
      } // if (::game_status != GAMESTATUS::PROGRAMSTART)

      vector<Gdk::ScaledPixbufRotations> icon_new;
      for (unsigned type = 0; type < NUMBER_OF_TYPES; type++) {
	icon_new.push_back(this->load(static_cast<Type>(type),
				      this->ui->cards->directory() + "/"
				      + ::setting.value(Setting::ICONS_DIRECTORY)));
	this->ui->add_progress(1.0 / NUMBER_OF_TYPES);
      } // for (n \in names)
      if (::game_status != GAMESTATUS::PROGRAMSTART) {
	this->ui->finish_progress();
	this->ui->remove_status_message(::translator("loading icons"));
      } // if (::game_status != GAMESTATUS::PROGRAMSTART)

      this->icon_ = icon_new;

      this->update_scaling();

      DEBUG_RETURNING(VOID,
		      INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		      "Icons::load()");
    } // void Icons::load()

  /**
   **
   ** load or construct the icons
   **
   ** @param	type		the icon type
   ** @param	directory	the directory with the icons
   **
   ** @return	loaded/constructed icon
   **
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  Gdk::ScaledPixbufRotations
    Icons::load(Type const type, string const directory)
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		    "Icons::load(type, directory)");

      Gdk::ScaledPixbufRotations icon;

      switch(type) {
      case NONE:
	icon = Gdk::ScaledPixbufRotations();
	break;
      case RE:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "re" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card::CLUB_QUEEN);
	break;
      case CONTRA:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "contra" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon) {
	  icon = this->construct(Card::CLUB_QUEEN);
	  // strike out the icon
	  icon = this->construct(Card::CLUB_QUEEN);
	} // if (!icon)
	break;
      case FIVE_NINES:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "five_nines" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::CLUB, Card::NINE),
				 Card(Card::SPADE, Card::NINE),
				 Card(Card::HEART, Card::NINE),
				 Card(Card::DIAMOND, Card::NINE),
				 Card(Card::DIAMOND, Card::NINE));
	break;
      case SIX_KINGS:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "six_kings" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::CLUB, Card::KING),
				 Card(Card::CLUB, Card::KING),
				 Card(Card::SPADE, Card::KING),
				 Card(Card::HEART, Card::KING),
				 Card(Card::DIAMOND, Card::KING),
				 Card(Card::DIAMOND, Card::KING));
	break;
      case FOX_HIGHEST_TRUMP:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "fox_highest_trump" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::DIAMOND, Card::ACE),
				 Card(Card::DIAMOND, Card::TEN),
				 Card(Card::DIAMOND, Card::KING),
				 Card(Card::DIAMOND, Card::NINE));
	break;
      case MARRIAGE:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "marriage" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card::CLUB_QUEEN,
				 Card::CLUB_QUEEN);
	break;
      case MARRIAGE_FOREIGN:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "marriage.foreign" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card::CLUB_QUEEN,
				 Card::CLUB_QUEEN,
				 Card(Card::DIAMOND, Card::JACK),
				 Card(Card::SPADE, Card::ACE));
	break;
      case MARRIAGE_TRUMP:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "marriage.trump" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card::CLUB_QUEEN,
				 Card::CLUB_QUEEN,
				 Card(Card::DIAMOND, Card::JACK),
				 Card(Card::SPADE, Card::ACE));
	break;
      case MARRIAGE_COLOR:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "marriage.color" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card::CLUB_QUEEN,
				 Card::CLUB_QUEEN,
				 Card(Card::HEART, Card::ACE),
				 Card(Card::SPADE, Card::ACE));
	break;
      case MARRIAGE_CLUB:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "marriage.club" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card::CLUB_QUEEN,
				 Card::CLUB_QUEEN,
				 Card(Card::CLUB, Card::ACE),
				 Card(Card::CLUB, Card::ACE));
	break;
      case MARRIAGE_SPADE:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "marriage.spade" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card::CLUB_QUEEN,
				 Card::CLUB_QUEEN,
				 Card(Card::SPADE, Card::ACE),
				 Card(Card::SPADE, Card::ACE));
	break;
      case MARRIAGE_HEART:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "marriage.heart" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card::CLUB_QUEEN,
				 Card::CLUB_QUEEN,
				 Card(Card::HEART, Card::ACE),
				 Card(Card::HEART, Card::ACE));
	break;
      case GENSCHER:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "genscher" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::DIAMOND, Card::KING),
				 Card(Card::DIAMOND, Card::KING));
	break;
      case POVERTY:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "poverty" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::HEART, Card::QUEEN),
				 Card(Card::SPADE, Card::JACK),
				 Card(Card::DIAMOND, Card::TEN));
	break;
      case POVERTY_TRUMPS_0:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "poverty.0" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::CLUB, Card::ACE),
				 Card(Card::HEART, Card::KING),
				 Card(Card::SPADE, Card::TEN));
	break;
      case POVERTY_TRUMPS_1:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "poverty.1" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::SPADE, Card::QUEEN),
				 Card(Card::HEART, Card::NINE),
				 Card(Card::CLUB, Card::KING));
	break;
      case POVERTY_TRUMPS_2:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "poverty.2" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::DIAMOND, Card::QUEEN),
				 Card(Card::SPADE, Card::JACK),
				 Card(Card::CLUB, Card::ACE));
	break;
      case POVERTY_TRUMPS_3:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "poverty.3" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::HEART, Card::QUEEN),
				 Card(Card::CLUB, Card::JACK),
				 Card(Card::DIAMOND, Card::KING));
	break;
      case SWINES_CLUB:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "swines.club" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::CLUB, Card::ACE),
				 Card(Card::CLUB, Card::ACE));
	break;
      case SWINES_SPADE:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "swines.spade" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::SPADE, Card::ACE),
				 Card(Card::SPADE, Card::ACE));
	break;
      case SWINES_HEART:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "swines.heart" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::HEART, Card::ACE),
				 Card(Card::HEART, Card::ACE));
	break;
      case SWINES_DIAMOND:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "swines.diamond" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::DIAMOND, Card::ACE),
				 Card(Card::DIAMOND, Card::ACE));
	break;
      case HYPERSWINES_CLUB:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "hyperswines.club" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::CLUB, Card::NINE),
				 Card(Card::CLUB, Card::NINE));
	break;
      case HYPERSWINES_SPADE:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "hyperswines.spade" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::SPADE, Card::NINE),
				 Card(Card::SPADE, Card::NINE));
	break;
      case HYPERSWINES_HEART:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "hyperswines.heart" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::HEART, Card::NINE),
				 Card(Card::HEART, Card::NINE));
	break;
      case HYPERSWINES_DIAMOND:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "hyperswines.diamond" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::DIAMOND, Card::NINE),
				 Card(Card::DIAMOND, Card::NINE));
	break;
      case SWINES_HYPERSWINES_CLUB:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "swines-hyperswines.club" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::CLUB, Card::ACE),
				 Card(Card::CLUB, Card::NINE));
	break;
      case SWINES_HYPERSWINES_SPADE:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "swines-hyperswines.spade" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::SPADE, Card::ACE),
				 Card(Card::SPADE, Card::NINE));
	break;
      case SWINES_HYPERSWINES_HEART:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "swines-hyperswines.heart" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::HEART, Card::ACE),
				 Card(Card::HEART, Card::NINE));
	break;
      case SWINES_HYPERSWINES_DIAMOND:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "swines-hyperswines.diamond" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::DIAMOND, Card::ACE),
				 Card(Card::DIAMOND, Card::NINE));
	break;
      case SOLO_CLUB:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "solo.club" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::SPADE, Card::QUEEN),
				 Card(Card::HEART, Card::JACK),
				 Card(Card::CLUB, Card::ACE),
				 Card(Card::CLUB, Card::KING));
	break;
      case SOLO_SPADE:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "solo.spade" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::CLUB, Card::QUEEN),
				 Card(Card::DIAMOND, Card::JACK),
				 Card(Card::SPADE, Card::ACE),
				 Card(Card::SPADE, Card::KING));
	break;
      case SOLO_HEART:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "solo.heart" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::DIAMOND, Card::QUEEN),
				 Card(Card::CLUB, Card::JACK),
				 Card(Card::HEART, Card::ACE),
				 Card(Card::HEART, Card::KING));
	break;
      case SOLO_DIAMOND:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "solo.diamond" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::HEART, Card::QUEEN),
				 Card(Card::SPADE, Card::JACK),
				 Card(Card::DIAMOND, Card::ACE),
				 Card(Card::DIAMOND, Card::KING));
	break;
      case SOLO_JACK:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "solo.jack" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::CLUB, Card::JACK),
				 Card(Card::SPADE, Card::JACK),
				 Card(Card::HEART, Card::JACK),
				 Card(Card::DIAMOND, Card::JACK));
	break;
      case SOLO_QUEEN:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "solo.queen" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::CLUB, Card::QUEEN),
				 Card(Card::SPADE, Card::QUEEN),
				 Card(Card::HEART, Card::QUEEN),
				 Card(Card::DIAMOND, Card::QUEEN));
	break;
      case SOLO_KING:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "solo.king" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::CLUB, Card::KING),
				 Card(Card::SPADE, Card::KING),
				 Card(Card::HEART, Card::KING),
				 Card(Card::DIAMOND, Card::KING));
	break;
      case SOLO_QUEEN_JACK:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "solo.queen-jack" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::CLUB, Card::QUEEN),
				 Card(Card::SPADE, Card::QUEEN),
				 Card(Card::HEART, Card::JACK),
				 Card(Card::DIAMOND, Card::JACK));
	break;
      case SOLO_KING_JACK:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "solo.king-jack" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::CLUB, Card::KING),
				 Card(Card::SPADE, Card::KING),
				 Card(Card::HEART, Card::JACK),
				 Card(Card::DIAMOND, Card::JACK));
	break;
      case SOLO_KING_QUEEN:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "solo.king-queen" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::CLUB, Card::KING),
				 Card(Card::SPADE, Card::KING),
				 Card(Card::HEART, Card::QUEEN),
				 Card(Card::DIAMOND, Card::QUEEN));
	break;
      case SOLO_KOEHLER:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "solo.koehler" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::CLUB, Card::KING),
				 Card(Card::SPADE, Card::KING),
				 Card(Card::HEART, Card::QUEEN),
				 Card(Card::DIAMOND, Card::JACK));
	break;
      case SOLO_MEATLESS:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "solo.meatless" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));
	if (!icon)
	  icon = this->construct(Card(Card::CLUB, Card::ACE),
				 Card(Card::SPADE, Card::ACE),
				 Card(Card::HEART, Card::ACE),
				 Card(Card::DIAMOND, Card::ACE));
	break;
      case NO_120:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "no_120" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));

	if (!icon) {
	  if (this->icon_.size() <= static_cast<unsigned>(type)) {
	    // no icon loaded so far -- exiting
	    this->ui->error("Cannot construct the icon for the announcement 'no 120'.\n"
			    "Perhaps you should validate your 'FreeDokorc'-File "
			    "(in the directory '"
			    + ::setting(Setting::PRIVATE_DATA_DIRECTORY)
			    + "').\n"
			    "Exiting.");
	  } // if (this->icon_.size() <= type)
	  this->ui->information(::translator("Cannot construct the icon for the announcement '%tannouncement%'.\n"
				"Keeping the old one.",
				ANNOUNCEMENT::NO120));
	  icon = this->icon(type);
	} // if (!icon)

	break;
      case NO_90:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "no_90" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));

	if (!icon) {
	  if (this->icon_.size() <= static_cast<unsigned>(type)) {
	    // no icon loaded so far -- exiting
	    this->ui->error("Cannot construct the icon for the announcement 'no 90'.\n"
			    "Perhaps you should validate your 'FreeDokorc'-File "
			    "(in the directory '"
			    + ::setting(Setting::PRIVATE_DATA_DIRECTORY)
			    + "').\n"
			    "Exiting.");
	  } // if (this->icon_.size() <= type)
	  this->ui->information(::translator("Cannot construct the icon for the announcement '%tannouncement%'.\n"
				"Keeping the old one.",
				ANNOUNCEMENT::NO90));
	  icon = this->icon(type);
	} // if (!icon)

	break;
      case NO_60:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "no_60" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));

	if (!icon) {
	  if (this->icon_.size() <= static_cast<unsigned>(type)) {
	    // no icon loaded so far -- exiting
	    this->ui->error("Cannot construct the icon for the announcement 'no 60'.\n"
			    "Perhaps you should validate your 'FreeDokorc'-File "
			    "(in the directory '"
			    + ::setting(Setting::PRIVATE_DATA_DIRECTORY)
			    + "').\n"
			    "Exiting.");
	  } // if (this->icon_.size() <= type)
	  this->ui->information(::translator("Cannot construct the icon for the announcement '%tannouncement%'.\n"
				"Keeping the old one.",
				ANNOUNCEMENT::NO60));
	  icon = this->icon(type);
	} // if (!icon)

	break;
      case NO_30:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "no_30" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));

	if (!icon) {
	  if (this->icon_.size() <= static_cast<unsigned>(type)) {
	    // no icon loaded so far -- exiting
	    this->ui->error("Cannot construct the icon for the announcement 'no 30'.\n"
			    "Perhaps you should validate your 'FreeDokorc'-File "
			    "(in the directory '"
			    + ::setting(Setting::PRIVATE_DATA_DIRECTORY)
			    + "').\n"
			    "Exiting.");
	  } // if (this->icon_.size() <= type)
	  this->ui->information(::translator("Cannot construct the icon for the announcement '%tannouncement%'.\n"
				"Keeping the old one.",
				ANNOUNCEMENT::NO30));
	  icon = this->icon(type);
	} // if (!icon)

	break;
      case NO_0:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "no_0" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));

	if (!icon) {
	  if (this->icon_.size() <= static_cast<unsigned>(type)) {
	    // no icon loaded so far -- exiting
	    this->ui->error("Cannot construct the icon for the announcement 'no 0'.\n"
			    "Perhaps you should validate your 'FreeDokorc'-File "
			    "(in the directory '"
			    + ::setting(Setting::PRIVATE_DATA_DIRECTORY)
			    + "').\n"
			    "Exiting.");
	  } // if (this->icon_.size() <= type)
	  this->ui->information(::translator("Cannot construct the icon for the announcement '%tannouncement%'.\n"
				"Keeping the old one.",
				ANNOUNCEMENT::NO0));
	  icon = this->icon(type);
	} // if (!icon)

	break;
      case NO_120_REPLY:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "no_120_reply" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));

	if (!icon) {
	  if (this->icon_.size() <= static_cast<unsigned>(type)) {
	    // no icon loaded so far -- exiting
	    this->ui->error("Cannot construct the icon for the announcement 'no 120 reply'.\n"
			    "Perhaps you should validate your 'FreeDokorc'-File "
			    "(in the directory '"
			    + ::setting(Setting::PRIVATE_DATA_DIRECTORY)
			    + "').\n"
			    "Exiting.");
	  } // if (this->icon_.size() <= type)
	  this->ui->information(::translator("Cannot construct the icon for the announcement '%tannouncement%'.\n"
				"Keeping the old one.",
				ANNOUNCEMENT::NO120_REPLY));
	  icon = this->icon(type);
	} // if (!icon)

	break;
      case NO_90_REPLY:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "no_90_reply" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));

	if (!icon) {
	  if (this->icon_.size() <= static_cast<unsigned>(type)) {
	    // no icon loaded so far -- exiting
	    this->ui->error("Cannot construct the icon for the announcement 'no 90 reply'.\n"
			    "Perhaps you should validate your 'FreeDokorc'-File "
			    "(in the directory '"
			    + ::setting(Setting::PRIVATE_DATA_DIRECTORY)
			    + "').\n"
			    "Exiting.");
	  } // if (this->icon_.size() <= type)
	  this->ui->information(::translator("Cannot construct the icon for the announcement '%tannouncement%'.\n"
				"Keeping the old one.",
				ANNOUNCEMENT::NO90_REPLY));
	  icon = this->icon(type);
	} // if (!icon)

	break;
      case NO_60_REPLY:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "no_60_reply" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));

	if (!icon) {
	  if (this->icon_.size() <= static_cast<unsigned>(type)) {
	    // no icon loaded so far -- exiting
	    this->ui->error("Cannot construct the icon for the announcement 'no 60 reply'.\n"
			    "Perhaps you should validate your 'FreeDokorc'-File "
			    "(in the directory '"
			    + ::setting(Setting::PRIVATE_DATA_DIRECTORY)
			    + "').\n"
			    "Exiting.");
	  } // if (this->icon_.size() <= type)
	  this->ui->information(::translator("Cannot construct the icon for the announcement '%tannouncement%'.\n"
				"Keeping the old one.",
				ANNOUNCEMENT::NO60_REPLY));
	  icon = this->icon(type);
	} // if (!icon)

	break;
      case NO_30_REPLY:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "no_30_reply" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));

	if (!icon) {
	  if (this->icon_.size() <= static_cast<unsigned>(type)) {
	    // no icon loaded so far -- exiting
	    this->ui->error("Cannot construct the icon for the announcement 'no 30 reply'.\n"
			    "Perhaps you should validate your 'FreeDokorc'-File "
			    "(in the directory '"
			    + ::setting(Setting::PRIVATE_DATA_DIRECTORY)
			    + "').\n"
			    "Exiting.");
	  } // if (this->icon_.size() <= type)
	  this->ui->information(::translator("Cannot construct the icon for the announcement '%tannouncement%'.\n"
				"Keeping the old one.",
				ANNOUNCEMENT::NO30_REPLY));
	  icon = this->icon(type);
	} // if (!icon)

	break;
      case NO_0_REPLY:
	icon = Gdk::ScaledPixbufRotations(directory + "/"
					  + "no_0_reply" + "."
					  + ::setting(Setting::GRAPHIC_EXTENSION));

	if (!icon) {
	  if (this->icon_.size() <= static_cast<unsigned>(type)) {
	    // no icon loaded so far -- exiting
	    this->ui->error("Cannot construct the icon for the announcement 'no 0 reply'.\n"
			    "Perhaps you should validate your 'FreeDokorc'-File "
			    "(in the directory '"
			    + ::setting(Setting::PRIVATE_DATA_DIRECTORY)
			    + "').\n"
			    "Exiting.");
	  } // if (this->icon_.size() <= type)
	  this->ui->information(::translator("Cannot construct the icon for the announcement '%tannouncement%'.\n"
				"Keeping the old one.",
				ANNOUNCEMENT::NO0_REPLY));
	  icon = this->icon(type);
	} // if (!icon)

	break;
      } // switch(type)

      DEBUG_RETURNING(icon,
		      INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		      "Icons::load(type, directory)");
    } // Gdk::ScaledPixbufRotations Icons::load(Type const type, string const directory)

  /**
   **
   ** construct an icon from one card
   **
   ** @param	card1	first card
   **
   ** @return	constructed icon
   **
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  Gdk::ScaledPixbufRotations
    Icons::construct(Card const card1)
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		    "Icons::construct()");

      vector<Card> cards;
      cards.push_back(card1);

      DEBUG_RETURNING(this->construct(cards),
		      INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		      "Icons::construct()");
    } // Gdk::ScaledPixbufRotations Icons::construct(Card const card1)

  /**
   **
   ** construct an icon from two cards
   **
   ** @param	card1	first card
   ** @param	card2	second card
   **
   ** @return	constructed icon
   **
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  Gdk::ScaledPixbufRotations
    Icons::construct(Card const card1, Card const card2)
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		    "Icons::construct(card1, card2)");

      vector<Card> cards;
      cards.push_back(card1);
      cards.push_back(card2);

      DEBUG_RETURNING(this->construct(cards),
		      INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		      "Icons::construct(card1, card2)");
    } // Gdk::ScaledPixbufRotations Icons::construct(Card const card1, Card const card2)

  /**
   **
   ** construct an icon from six cards
   **
   ** @param	card1	first card
   ** @param	card2	second card
   ** @param	card3	third card
   **
   ** @return	constructed icon
   **
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  Gdk::ScaledPixbufRotations
    Icons::construct(Card const card1,
		     Card const card2,
		     Card const card3)
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		    "Icons::construct(card1, card2, card3)");

      vector<Card> cards;
      cards.push_back(card1);
      cards.push_back(card2);
      cards.push_back(card3);

      DEBUG_RETURNING(this->construct(cards),
		      INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		      "Icons::construct(card1, card2, card3)");
    } // Gdk::ScaledPixbufRotations Icons::construct(Card const card1, Card const card2, Card const card3)

  /**
   **
   ** construct an icon from six cards
   **
   ** @param	card1	first card
   ** @param	card2	second card
   ** @param	card3	third card
   ** @param	card4	fourth card
   **
   ** @return	constructed icon
   **
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  Gdk::ScaledPixbufRotations
    Icons::construct(Card const card1,
		     Card const card2,
		     Card const card3,
		     Card const card4)
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		    "Icons::construct(card1, card2, card3, card4)");

      vector<Card> cards;
      cards.push_back(card1);
      cards.push_back(card2);
      cards.push_back(card3);
      cards.push_back(card4);

      DEBUG_RETURNING(this->construct(cards),
		      INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		      "Icons::construct(card1, card2, card3, card)");
    } // Gdk::ScaledPixbufRotations Icons::construct(Card const card1, Card const card2, Card const card3, Card const card4)

  /**
   **
   ** construct an icon from six cards
   **
   ** @param	card1	first card
   ** @param	card2	second card
   ** @param	card3	third card
   ** @param	card4	fourth card
   ** @param	card5	fifth card
   **
   ** @return	constructed icon
   **
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  Gdk::ScaledPixbufRotations
    Icons::construct(Card const card1,
		     Card const card2,
		     Card const card3,
		     Card const card4,
		     Card const card5)
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		    "Icons::construct(card1, card2, card3, card4, card5)");

      vector<Card> cards;
      cards.push_back(card1);
      cards.push_back(card2);
      cards.push_back(card3);
      cards.push_back(card4);
      cards.push_back(card5);

      DEBUG_RETURNING(this->construct(cards),
		      INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		      "Icons::construct(card1, card2, card3, card4, card5)");
    } // Gdk::ScaledPixbufRotations Icons::construct(Card const card1, Card const card2, Card const card3, Card const card4, Card const card5)

  /**
   **
   ** construct an icon from six cards
   **
   ** @param	card1	first card
   ** @param	card2	second card
   ** @param	card3	third card
   ** @param	card4	fourth card
   ** @param	card5	fifth card
   ** @param	card6	sixth card
   **
   ** @return	constructed icon
   **
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  Gdk::ScaledPixbufRotations
    Icons::construct(Card const card1,
		     Card const card2,
		     Card const card3,
		     Card const card4,
		     Card const card5,
		     Card const card6)
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		    "Icons::construct(card1, card2, card3, card4, card5, card6)");

      vector<Card> cards;
      cards.push_back(card1);
      cards.push_back(card2);
      cards.push_back(card3);
      cards.push_back(card4);
      cards.push_back(card5);
      cards.push_back(card6);

      DEBUG_RETURNING(this->construct(cards),
		      INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		      "Icons::construct(card1, card2, card3, card4, card5, card6)");
    } // Gdk::ScaledPixbufRotations Icons::construct(Card const card1, Card const card2, Card const card3, Card const card4, Card const card5, Card const card6)

  /**
   **
   ** construct an icon from the cards
   **
   ** @param	cards	cards
   **
   ** @return	constructed icon
   **
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   ** @bug	the transparent regions are copied, too
   **
   **/
  Gdk::ScaledPixbufRotations
    Icons::construct(vector<Card> const& cards)
    {
      DEBUG_CALLING(INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		    "Icons::construct(cards)");

      // take the half height and overlap with a fourth width

      int const width = (this->ui->cards->width_original()
			 * (4 + (cards.size() - 1))
			 / 4);
      int const height = (this->ui->cards->height_original() / 2);

      Glib::RefPtr<Gdk::Pixbuf> pixbuf
	= Gdk::Pixbuf::create(this->drawable_ref,
			      this->drawable_ref->get_colormap(),
			      0, 0, 0, 0,
			      width, height
			     )->add_alpha(false, 0, 0, 0);

      for (unsigned i = 0; i < cards.size(); i++)
	this->ui->cards->card_original(cards[i])->copy_area(0, 0,
							    this->ui->cards->width_original(),
							    this->ui->cards->height_original() / 2,
							    pixbuf,
							    i * this->ui->cards->width_original() / 4, 0);


      DEBUG_RETURNING(Gdk::ScaledPixbufRotations(pixbuf->scale_simple(width * 4 / 5,
								      height * 4 / 5,
								      Gdk::INTERP_BILINEAR)),
		      INFO_GTKMM_ICONS && INFO_GTKMM_INIT,
		      "Icons::construct(cards)");
    } // Gdk::ScaledPixbufRotations Icons::construct(vector<Card> const& cards)

} // namespace UI_GTKMM_NS

#endif // #ifdef USE_UI_GTKMM
