From f58c9992f6a6006213123c2fc2cda0d0f055494b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 13 Dec 2014 12:03:00 +0000 Subject: Suppressed client::Dialog as it has been superceded by client::Messagebox. --- src/client/Makefile.am | 2 -- src/client/dialog.cc | 72 -------------------------------------------------- src/client/dialog.h | 48 --------------------------------- src/client/mainmenu.cc | 40 +--------------------------- src/client/mainmenu.h | 1 - 5 files changed, 1 insertion(+), 162 deletions(-) delete mode 100644 src/client/dialog.cc delete mode 100644 src/client/dialog.h (limited to 'src/client') diff --git a/src/client/Makefile.am b/src/client/Makefile.am index 5577879..1ed6446 100644 --- a/src/client/Makefile.am +++ b/src/client/Makefile.am @@ -15,7 +15,6 @@ noinst_HEADERS = \ chat.h \ client.h \ clientext.h \ - dialog.h \ entitymenu.h \ galaxymapwidget.h \ gamewindow.h \ @@ -52,7 +51,6 @@ libclient_la_SOURCES = \ chat.cc \ client.cc \ clientext.cc \ - dialog.cc \ entitymenu.cc \ galaxymapwidget.cc \ gamewindow.cc \ diff --git a/src/client/dialog.cc b/src/client/dialog.cc deleted file mode 100644 index b593388..0000000 --- a/src/client/dialog.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* - client/dialog.cc - This file is part of the Osirion project and is distributed under - the terms and conditions of the GNU General Public License version 2 -*/ - -#include "client/dialog.h" -#include "ui/ui.h" - -namespace client -{ - -Dialog::Dialog(ui::Widget * parent) : - ui::Window(parent) -{ - set_border(false); - set_background(false); - set_label("dialog"); - - dialog_widget = new ui::Widget(this); - dialog_widget->set_border(true); - dialog_widget->set_background(true); - - dialog_label = new ui::Label(dialog_widget); - dialog_label->set_border(false); - dialog_label->set_background(false); - dialog_label->set_alignment(ui::AlignTop | ui::AlignHCenter); - - dialog_button = new ui::Button(dialog_widget); -} - -Dialog::~Dialog() -{ -} - -void Dialog::set_text(const std::string &text) -{ - dialog_label->set_text(text); -} - -void Dialog::set_button(const std::string &text) -{ - dialog_button->set_text(text); -} - -void Dialog::set_command(const std::string &command) -{ - dialog_button->set_command(command); -} - -void Dialog::resize() -{ - const float padding = ui::root()->font_large()->height(); - - dialog_widget->set_size( - ui::UI::elementsize.width() * 3.0f, - ui::UI::elementsize.width() * 1.5f - ); - dialog_widget->set_location( - (width() - dialog_widget->width()) * 0.5f, - (height() - dialog_widget->height()) * 0.5f - ); - - dialog_label->set_size(dialog_widget->width() - padding * 2.0f, dialog_widget->height() - padding * 2.0f); - dialog_label->set_location(padding, padding); - - dialog_button->set_size(ui::UI::elementsize); - dialog_button->set_location((dialog_widget->width() - dialog_button->width()) * 0.5f, - dialog_widget->height() - dialog_button->height() - padding); -} - -} // namespace client diff --git a/src/client/dialog.h b/src/client/dialog.h deleted file mode 100644 index 63926f9..0000000 --- a/src/client/dialog.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - client/dialog.h - This file is part of the Osirion project and is distributed under - the terms and conditions of the GNU General Public License version 2 -*/ - -#ifndef __INCLUDED_CLIENT_DIALOG_H__ -#define __INCLUDED_CLIENT_DIALOG_H__ - -#include "ui/window.h" -#include "ui/button.h" -#include "ui/label.h" - -namespace client -{ - -/** - * @brief a generic dialog window class - * */ -class Dialog : public ui::Window -{ -public: - Dialog(ui::Widget *parent = 0); - virtual ~Dialog(); - - void set_text(const std::string &text); - - void set_button(const std::string &text); - - void set_command(const std::string &command); - -protected: - virtual void resize(); - -private: - - /// the actual dialog widget - ui::Widget *dialog_widget; - - ui::Label *dialog_label; - ui::Button *dialog_button; -}; - -} - -#endif // __INCLUDED_CLIENT_DIALOG_H__ - - diff --git a/src/client/mainmenu.cc b/src/client/mainmenu.cc index a70cad0..89c29be 100644 --- a/src/client/mainmenu.cc +++ b/src/client/mainmenu.cc @@ -5,7 +5,6 @@ */ #include "client/buttonmenu.h" -#include "client/dialog.h" #include "client/mainmenu.h" #include "client/savegamemenu.h" #include "core/core.h" @@ -63,7 +62,6 @@ void MainMenu::load_definitions() con_debug << " Loading menu definitions..." << std::endl; - Dialog *dialog = 0; ui::Label *label = 0; ui::Button *button = 0; ButtonMenu *menu = 0; @@ -74,16 +72,9 @@ void MainMenu::load_definitions() if (ini.got_section()) { if (ini.got_section("menu")) { - dialog = 0; menu = 0; continue; - // dialog - } else if (ini.got_section("dialog")) { - dialog = 0; - menu = 0; - continue; - // menu button } else if (ini.got_section("button")) { @@ -111,36 +102,7 @@ void MainMenu::load_definitions() } else if (ini.got_key()) { - if (ini.in_section("dialog")) { - if (!dialog) { - if (ini.got_key_label("label", strval)) { - dialog = new Dialog(this); - dialog->set_label(strval); - } else { - ini.unknown_error("dialog definition requires label first"); - } - } else { - if (ini.got_key_label("label", strval)) { - dialog->set_label(strval); - - } else if (ini.got_key_string("text", strval)) { - dialog->set_text(strval); - - } else if (ini.got_key_string("button", strval)) { - dialog->set_button(strval); - - } else if (ini.got_key_string("command", strval)) { - for (size_t i = 0; i <= strval.size(); i++) { - if (strval[i] == ',') strval[i] = ';'; - } - aux::strip_quotes(strval); - dialog->set_command(strval); - } else { - ini.unknown_key(); - } - } - - } else if (ini.in_section("menu")) { + if (ini.in_section("menu")) { if (ini.got_key_label("label", strval)) { diff --git a/src/client/mainmenu.h b/src/client/mainmenu.h index 8b1ec58..b4d9b17 100644 --- a/src/client/mainmenu.h +++ b/src/client/mainmenu.h @@ -9,7 +9,6 @@ #include "ui/window.h" #include "ui/bitmap.h" -#include "client/dialog.h" namespace client { -- cgit v1.2.3