/**********************************************************************
 *
 *   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"

#include "ui.h"

#ifndef POSTPHONED
#ifndef RELEASE
#include <unistd.h>
#endif
#endif

#ifdef USE_UI_TEXT
#include "text/ui.h"
#endif // #ifdef USE_UI_TEXT
#ifdef USE_UI_GTKMM
#include "gtkmm/ui.h"
#endif // #ifdef USE_UI_GTKMM

#include "../card/hand.h"
#include "../misc/setting.h"
#include "../misc/translator.h"
#include "../misc/bug_report.h"

using namespace UI_TYPE;


// Nearly all functions of UI are virtual (all but UIType UI::type())


/**
 **
 ** Constructor
 ** (to be called from a child class)
 **
 ** @param	type	the UIType
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
UI::UI(UIType const type) :
type_p(type),
  status_message_(),
  progress_(0),
  progress_max_(0)
{ return ; }

/**
 **
 ** Constructor
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
UI::UI() :
type_p(UI_TYPE::NONE),
  status_message_(),
  progress_(0),
  progress_max_(0)
{ return ; }

/**
 **
 ** Constructor
 **
 ** @param	ui	the UI
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
UI::UI(UI const& ui) :
type_p(ui.type_p),
  status_message_(ui.status_message_),
  progress_(ui.progress_),
  progress_max_(ui.progress_max_)
{ return ; }

/**
 **
 ** copy operator
 **
 ** @param	ui	the UI
 **
 ** @return	the ui
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
UI&
UI::operator=(UI const& ui)
{
  this->type_p = ui.type_p;
  this->status_message_ = ui.status_message_;
  this->progress_ = ui.progress_;
  this->progress_max_ = ui.progress_max_;

  return *this;
}

/**
 **
 ** Destructor
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
UI::~UI()
{ return ; }

/**
 **
 ** create a new ui
 ** (it should just call the new-operator of the child class)
 **
 ** @param	type	type of the UI to create
 **
 ** @return	pointer of UI
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
UI*
new_UI(UIType const type)
{
  UI* ui;

  switch (type) {
  case NONE:
    ui = new UI(NONE);
    break;
#ifdef USE_UI_TEXT
  case TEXT:
    ui = new UI_Text;
    break;
#endif // #ifdef USE_UI_TEXT
#ifdef USE_UI_GTKMM
  case GTKMM_DOKO:
    ui = new UI_GTKMM_NS::UI_GTKMM;
    break;
#endif // #ifdef USE_UI_GTKMM
  default:
    ui = NULL;
  } // switch(type)

  return ui;
} // UI* new_UI(UIType const type)

/**
 **
 ** -> result
 **
 ** @param	-
 **
 ** @return	type of the UI
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
UIType
UI::type() const
{ return this->type_p; }

/**
 **
 ** Function for the initialisation of the UI.
 ** GTKMM p.e. needs the arguments of the program and picks
 ** its arguments.
 **
 ** @param	argc	number of arguments
 ** @param	argv	arguments
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::init(int& argc, char**& argv)
{ return ; }


/**
 **
 ** updates the UI
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.4.5
 **
 ** @author	Diether Knof
 **
 **/
void
UI::update()
{ return ; }

/**
 **
 ** sleeps the given time
 ** (in miliseconds, UINT_MAX for infinity)
 **
 ** @param	sleep_usec	time to sleep
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::sleep(unsigned const sleep_usec)
{ return ; }

/**
 **
 ** all language elements of the UI shall be updated
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::language_update()
{ return ; }

/**
 **
 ** the party is opened
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::party_open()
{ return ; }

/**
 **
 ** gets and sets the settings of the party
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::party_get_settings()
{ return ; }

/**
 **
 ** start of the party
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::party_start()
{ return ; }

/**
 **
 ** end of the party
 ** (p.e. to show the points and the winner)
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::party_finish()
{ return ; }

/**
 **
 ** the party will close
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::party_close()
{ return ; }


/**
 **
 ** a game is opened
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::game_open()
{ return ; }


/**
 **
 ** gets the reservations of the player 'player'
 ** Here is the first time, the hands can be shown (and should)
 **
 ** @param	player	the player that makes the reservation
 **
 ** @return	Reservation of the player 'player'
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
Reservation
UI::reservation_get(Player const& player)
{ return Reservation(); }

/**
 **
 ** the game is started
 ** (p.e. show the announcements of the other players)
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::game_start()
{ return ; }

/**
 **
 ** the game is finished
 ** (p.e. show the winner and the points of the game)
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::game_finish()
{ return ; }

/**
 **
 ** the game will close
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::game_close()
{ return ; }


/**
 **
 ** a new trick is opened
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::trick_open()
{ return ; }

/**
 **
 ** the trick 'trick' is full
 **
 ** @param	trick	the full trick
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::trick_full(Trick const& trick)
{ return ; }

/**
 **
 ** moves the trick in the pile of the winnerplayer
 **
 ** @param	trick	the full trick
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::trick_move_in_pile(Trick const& trick)
{ return ; }

/**
 **
 ** the trick is closed
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::trick_close()
{ return ; }

/**
 **
 ** gets the card, the player wishes to play
 ** (don't remove it from the hand!)
 **
 ** @param	player	the player who shall play a card
 **
 ** @return	Card to be played
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
Card
UI::card_get(Player const& player)
{ return Card(); }

/**
 **
 ** the player 'player' plays the card 'card'
 **
 ** @param	card  	the played card
 ** @param	player	the player, who has played a card
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::card_played(Card const& card, Player const& player)
{ return ; }

/**
 **
 ** the announcement 'announcement' has been made by player 'player'
 **
 ** @param	announcement	the announcement
 ** @param	player		the player, who has made the announcement
 **
 ** @return	-
 **
 ** @version	0.4.5
 **
 ** @author	Diether Knof
 **
 **/
void
UI::announcement_made(Announcement const& announcement, Player const& player)
{ return ; }

/**
 **
 ** the player has swines
 **
 ** @param	player		the player with the swines
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI::swines_announced(Player const& player)
{ return ; }

/**
 **
 ** the player has hyperswines
 **
 ** @param	player		the player with the hyperswines
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI::hyperswines_announced(Player const& player)
{ return ; }

/**
 **
 ** 'player' shifts 'cardno' cards
 **
 ** @param	player	the player who shifts the cards
 ** @param	cardno	the number of cards that are shifted
 **
 ** @return	-
 **
 ** @version	0.4.5
 **
 ** @author	Diether Knof
 **
 **/
void
UI::poverty_shift(Player const& player, unsigned const cardno)
{ return ; }

/**
 **
 ** ask 'player' whether to accept the poverty
 **
 ** @param	player	the player who is asked
 ** @param	cardno	number of cards that are given back
 **
 ** @return	-
 **
 ** @version	0.5
 **
 ** @author	Diether Knof
 **
 **/
void
UI::poverty_ask(Player const& player, unsigned const cardno)
{ return ; }

/**
 **
 ** 'player' denied to take the shifted cards
 **
 ** @param	player	the player who has denied to take the cards
 **
 ** @return	-
 **
 ** @version	0.4.5
 **
 ** @author	Diether Knof
 **
 **/
void
UI::poverty_take_denied(Player const& player)
{ return ; }

/**
 **
 ** all players have denied to take the cards
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.4.5
 **
 ** @author	Diether Knof
 **
 **/
void
UI::poverty_take_denied_by_all()
{ return ; }

/**
 **
 ** 'player' accepts to take the shifted cards
 ** and returns 'cardno' cards with 'trumpno' trumps
 **
 ** @param	player	the player who has denied to take the cards
 ** @param	cardno	number of cards that are given back
 ** @param	trumpno	number of trumps of the cards
 **
 ** @return	-
 **
 ** @version	0.4.5
 **
 ** @author	Diether Knof
 **
 **/
void
UI::poverty_take_accepted(Player const& player,
			  unsigned const cardno, unsigned const trumpno)
{ return ; }

/**
 **
 ** returns which cards the player shifts
 **
 ** @param	player	the player who shifts the cards
 **
 ** @return	the cards that are to be shifted
 **
 ** @version	0.4.5
 **
 ** @author	Diether Knof
 **
 **/
Hand
UI::poverty_shift(Player& player)
{ return Hand(); }

/**
 **
 ** returns whether 'player' accepts the shifted cards
 **
 ** @param	player	the player who shifts the cards
 ** @param	cardno	the number of shifted cards
 **
 ** @return	whether to accept the cards
 **
 ** @version	0.4.5
 **
 ** @author	Diether Knof
 **
 **/
bool
UI::poverty_take_accept(Player& player, unsigned const cardno)
{ return false; }

/**
 **
 ** changes the cards from the poverty-player
 **
 ** @param	player	the player who has accepted the cards
 ** @param	cards	the cards that are given to the player
 **
 ** @return	the cards that are returned to the poverty-player
 **
 ** @version	0.4.5
 **
 ** @author	Diether Knof
 **
 **/
Hand
UI::poverty_cards_change(Player& player, Hand const& cards)
{ return Hand(); }

/**
 **
 ** the poverty player 'player' gets 'cards'
 **
 ** @param	player	the player gets the cards
 ** @param	cards	the cards that are given to the player
 **
 ** @return	-
 **
 ** @version	0.5
 **
 ** @author	Diether Knof
 **
 **/
void
UI::poverty_cards_get_back(Player& player, Hand const& cards)
{ return ; }

/**
 **
 ** marriage: Information of the new team
 **
 ** @param	bridegroom	the player with the marriage
 ** @param	bride		the bride
 **
 ** @return	-
 **
 ** @author	Diether Knof
 **
 ** @version	0.6.1
 **
 **/
void
UI::marriage(Player const& bridegroom,
	     Player const& bride)
{ return; }

/**
 **
 ** genscher: -> result
 **
 ** @param	-
 **
 ** @return	pointer to the new teammate,
 **		NULL if the genscher is not to be announced
 **
 ** @author	Diether Knof
 **
 ** @version	0.5.4
 **
 **/
Player const*
UI::genscher_partner()
{ return NULL; } 

/**
 **
 ** genscher: Information of the new team
 **
 ** @param	player	genscher player
 ** @param	partner	partner of the gensher player
 **
 ** @return	-
 **
 ** @author	Diether Knof
 **
 ** @version	0.5.4
 **
 **/
void
UI::genscher(Player const& player,
	     Player const& partner)
{ return; }

/**
 **
 ** redraw all
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::redraw_all()
{ return ; }

/**
 **
 ** the player 'player' has to be updated
 **
 ** @param	player	the player, who has changed
 **
 ** @return	-
 **
 ** @version	0.5.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::player_update(Player const& player)
{ return ; }

/**
 **
 ** the name of the player 'player' has to be updated
 **
 ** @param	player	the player, whose name is changed
 **
 ** @return	-
 **
 ** @version	0.4.2
 **
 ** @author	Diether Knof
 **
 **/
void
UI::name_update(Player const& player)
{ return ; }

/**
 **
 ** the hand of the player 'player' has to be updated
 **
 ** @param	player	the player, whose hand is to be updated
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::hand_update(Player const& player)
{ return ; }

/**
 **
 ** the teaminfo of the player 'player' has to be updated
 **
 ** @param	player	the player whose team should be updated
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::teaminfo_update(Player const& player)
{ return ; }

/**
 **
 ** the gametype has to be updated
 ** (take the player from 'game.soloplayer()'
 **
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.4.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::gametype_update()
{ return ; }

/**
 **
 ** the rule 'type' has changed
 **
 ** @param	type		the type that has changed
 ** @param	old_value	old value
 **
 ** @return	-
 **
 ** @version	0.5.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::rule_update(int const type, void const* const old_value)
{ return ; }

/**
 **
 ** the setting 'type' has changed
 **
 ** @param	type		the type that has changed
 ** @param	old_value	old value
 **
 ** @return	-
 **
 ** @version	0.5.3
 **
 ** @author	Diether Knof
 **
 **/
void
UI::setting_update(int const type, void const* const old_value)
{ return ; }

/**
 **
 ** load the page with the help
 ** use the settings
 **
 ** @param	page	the page to be loaded
 **
 ** @return	-
 **
 ** @version	0.4.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI::help_load(string const& page)
{
  DEBUG_CALLING(INFO_UI,
		"UI::help_load(page)");

  // look, whether the file exists
  string file = (::setting(Setting::HELP_DIRECTORY)
		 + "/" + ::setting(Setting::LANGUAGE)
		 + "/" + page);
  // test, whether the file exists
  // else take the english page
  {
    ifstream istr(file.c_str(), ios::in);
    if (istr.fail())
      file = ::setting(Setting::HELP_DIRECTORY) + "/en/" + page;
    else
      istr.close();
  }

#ifdef WINDOWS
  ::system((::setting(Setting::BROWSER) + " file://" + file).c_str());
#else
  ::system((::setting(Setting::BROWSER) + " file://" + file + " &").c_str());
#endif

  DEBUG_CALLING(INFO_UI,
		"UI::help_load(page)");
} // void UI::help_load(string const& page)

/**
 **
 ** -> result
 **
 ** @param	-
 **
 ** @return	the latest status message
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
Translator::Translation
UI::status_message() const
{
  DEBUG_CALLING(INFO_UI,
		"UI::status_message()");

  if (this->status_message_.empty())
    DEBUG_RETURNING(::translator(""),
		    INFO_UI,
		    "UI::status_message()");

  DEBUG_RETURNING(this->status_message_.back(),
		  INFO_UI,
		  "UI::status_message()");
} // Translator::Translation UI::status_message() const

/**
 **
 ** adds the status message
 **
 ** @param	status_message	the new status message
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI::add_status_message(Translator::Translation const& status_message)
{
  DEBUG_CALLING(INFO_UI,
		"UI::add_status_message(status_message)");

  this->status_message_.push_back(status_message);
  this->status_message_changed(status_message);

  DEBUG_RETURNING(VOID,
		  INFO_UI,
		  "UI::add_status_message(status_message)");
} // void UI::add_status_message(Translator::Translation const& status_message)

/**
 **
 ** remove the status message
 **
 ** @param	status_message	the status message that is to be removed
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI::remove_status_message(Translator::Translation const& status_message)
{
  DEBUG_CALLING(INFO_UI,
		"UI::remove_status_message(status_message)");

  vector<Translator::Translation>::iterator pos
    = std::find(this->status_message_.begin(),
		this->status_message_.end(),
		status_message);

  DEBUG_ASSERTION((pos != this->status_message_.end()),
		  "UI::remove_status_message(status_message):\n"
		  "  message '" << status_message << "' "
		  "not found in the list");

  if (pos != this->status_message_.end())
    pos = this->status_message_.erase(pos);

  if (pos == this->status_message_.end())
    this->status_message_changed(this->status_message());

  DEBUG_RETURNING(VOID,
		  INFO_UI,
		  "UI::remove_status_message(status_message)");
} // void UI::remove_status_message(Translator::Translation const& status_message)

/**
 **
 ** the status message has changed
 **
 ** @param	status_message	the status message
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI::status_message_changed(Translator::Translation const& status_message)
{ }

/**
 **
 ** -> result
 **
 ** @param	-
 **
 ** @return	the progress
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
double
UI::progress() const
{
  DEBUG_CALLING(INFO_UI,
		"UI::progress()");

  if (this->progress_max_ == 0)
    DEBUG_RETURNING(1,
		    INFO_UI,
		    "UI::progress()");

  DEBUG_RETURNING((this->progress_ / this->progress_max_),
		  INFO_UI,
		  "UI::progress()");
} // double UI::progress() const

/**
 **
 ** sets the maximal progress
 **
 ** @param	progress_max	the maximal progress
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI::set_max_progress(double const progress_max)
{
  DEBUG_CALLING(INFO_UI,
		"UI::set_max_progress(progress_max)");

  DEBUG_ASSERTION((this->progress_max_ == 0),
		  "UI::set_max_progress(progress_max):\n"
		  "  'this->progress_max_' is already set: "
		  << this->progress_max_ << ".");

  this->progress_max_ = progress_max;
  this->progress_ = 0;
  this->progress_changed(this->progress());

  DEBUG_RETURNING(VOID,
		  INFO_UI,
		  "UI::set_max_progress(progress_max)");
} // void UI::set_max_progress(double const progress_max)

/**
 **
 ** adds 'progress' to the progress
 **
 ** @param	progress	the progress
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI::add_progress(double const progress)
{
  DEBUG_CALLING(INFO_UI,
		"UI::add_progress(progress)");

  this->progress_ += progress;
#ifdef POSTPHONED
  DEBUG_ASSERTION((this->progress() <= 1.000001),
		  "UI::add_progress(progress):\n"
		  "  'progress' is greater than 1: "
		  << this->progress());
#else
  if (this->progress() > 1.000001)
    cerr << "UI::add_progres():\n"
      << "  progress is " << this->progress() << ", greater than 1" << endl;
  else
#endif
    if (this->progress() > 1 - 0.000001)
      this->progress_ = this->progress_max_;

  this->progress_changed(this->progress());

  DEBUG_RETURNING(VOID,
		  INFO_UI,
		  "UI::add_progress(progress)");
} // void UI::add_progress(double const progress)

/**
 **
 ** the progress is finished
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI::finish_progress()
{
  DEBUG_CALLING(INFO_UI,
		"UI::finish_progress()");

#ifdef POSTPHONED
  DEBUG_ASSERTION((this->progress() == 1),
		  "UI::finish_progress():\n"
		  "  'progress' is not equal to 1: "
		  << this->progress()
		  << ", diff: " << this->progress() - 1);
#else
  if (this->progress() != 1)
    cerr << "UI::finish_progres():\n"
      << "  progress is " << this->progress() << ", not 1" << endl;
#endif

  this->progress_finished();
  this->progress_max_ = 0;
  this->progress_ = 0;

  DEBUG_RETURNING(VOID,
		  INFO_UI,
		  "UI::finish_progress()");
} // void UI::finish_progress()

/**
 **
 ** the progress has changed
 **
 ** @param	progress	the progress
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI::progress_changed(double const progress)
{ }

/**
 **
 ** the progress is finished
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI::progress_finished()
{ }

/**
 **
 ** show the message
 **
 ** @param	message		message
 **
 ** @return	-
 **
 ** @version	0.6.2
 **
 ** @author	Diether Knof
 **
 **/
void
UI::information(Translator::Translation const& message)
{
  cout << message << endl;

  return ;
}

/**
 **
 ** show the message and quit the program
 **
 ** @param	message		error message
 **
 ** @return	-
 **
 ** @version	0.6.2
 **
 ** @author	Diether Knof
 **
 **/
void
UI::error(string const& message)
{
  cerr << message << endl;

  { // create bug report
    string const filename = ::bug_report.report(message);

    cerr << ::translator("_bug found: automatic creation of report, %sfilename%, %scontact%_",
			 filename, CONTACT)
      << endl;
  } // create bug report

#ifdef ASSERTION_GENERATES_SEGFAULT
  {
    cerr << ::translator("Creating segmentation fault.") << endl;
    int const n = *(static_cast<int*>(NULL));
    (void)(n);
    cout << n << endl;
  }
#endif // #ifdef ASSERTION_GENERATES_SEGFAULT

  ::exit(EXIT_FAILURE);

  return ;
}
