Author: mordante
Date: Sun Mar 20 19:26:19 2011
New Revision: 48961

URL: http://svn.gna.org/viewcvs/wesnoth?rev=48961&view=rev
Log:
Polish ttransient_message.

The removal of a header also forced some additional files to be edited.

Modified:
    trunk/src/gui/dialogs/transient_message.cpp
    trunk/src/gui/dialogs/transient_message.hpp
    trunk/src/multiplayer_wait.cpp
    trunk/src/preferences_display.cpp

Modified: trunk/src/gui/dialogs/transient_message.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/transient_message.cpp?rev=48961&r1=48960&r2=48961&view=diff
==============================================================================
--- trunk/src/gui/dialogs/transient_message.cpp (original)
+++ trunk/src/gui/dialogs/transient_message.cpp Sun Mar 20 19:26:19 2011
@@ -18,50 +18,51 @@
 #include "gui/dialogs/transient_message.hpp"
 
 #include "gettext.hpp"
-#include "gui/widgets/image.hpp"
-#include "gui/widgets/label.hpp"
 #include "gui/widgets/settings.hpp"
-#include "gui/widgets/window.hpp"
 #include "log.hpp"
 
 namespace gui2 {
 
 REGISTER_DIALOG(transient_message)
 
-void ttransient_message::pre_show(CVideo& /*video*/, twindow& window)
+ttransient_message::ttransient_message(const std::string& title
+               , const bool title_use_markup
+               , const std::string& message
+               , const bool message_use_markup
+               , const std::string& image)
 {
-       tlabel& title = find_widget<tlabel>(&window, "title", false);
-       title.set_label(title_);
-       title.set_use_markup(title_use_markup_);
-
-       tlabel& message = find_widget<tlabel>(&window, "message", false);
-       message.set_label(message_);
-       message.set_use_markup(message_use_markup_);
-       message.set_can_wrap(true);
-
-       timage& image = find_widget<timage>(&window, "image", false);
-
-       if(!image_.empty()) {
-               image.set_image(image_);;
-       }
+       register_label2("title", true, title, title_use_markup);
+       register_label2("message", true, message, message_use_markup);
+       register_image2("image", true, image);
 }
 
-void show_transient_message(CVideo& video, const std::string& title,
-       const std::string& message, const std::string& image,
-       bool message_use_markup, bool title_use_markup)
+void show_transient_message(CVideo& video
+               , const std::string& title
+               , const std::string& message
+               , const std::string& image
+               , const bool message_use_markup
+               , const bool title_use_markup)
 {
-       ttransient_message dlg(title, title_use_markup,
-                       message, message_use_markup, image);
+       ttransient_message dlg(title
+                       , title_use_markup
+                       , message
+                       , message_use_markup
+                       , image);
+
        dlg.show(video);
 }
 
 void show_transient_error_message(CVideo& video
                , const std::string& message
                , const std::string& image
-               , bool message_use_markup)
+               , const bool message_use_markup)
 {
        LOG_STREAM(err, lg::general) << message << '\n';
-       show_transient_message(video, _("Error"), message, image, 
message_use_markup);
+       show_transient_message(video
+                       , _("Error")
+                       , message
+                       , image
+                       , message_use_markup);
 }
 
 } // namespace gui2

Modified: trunk/src/gui/dialogs/transient_message.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/transient_message.hpp?rev=48961&r1=48960&r2=48961&view=diff
==============================================================================
--- trunk/src/gui/dialogs/transient_message.hpp (original)
+++ trunk/src/gui/dialogs/transient_message.hpp Sun Mar 20 19:26:19 2011
@@ -17,7 +17,6 @@
 #define GUI_DIALOGS_TRANSIENT_MESSAGE_HPP_INCLUDED
 
 #include "gui/dialogs/dialog.hpp"
-#include "gui/widgets/control.hpp"
 
 namespace gui2 {
 
@@ -26,37 +25,14 @@
        : public tdialog
 {
 public:
-       ttransient_message(const std::string& title,
-                       bool title_use_markup,
-                       const std::string& message,
-                       bool message_use_markup,
-                       const std::string& image)
-               : title_(title)
-               , title_use_markup_(title_use_markup)
-               , message_(message)
-               , message_use_markup_(message_use_markup)
-               , image_(image)
-       {}
 
-protected:
-       /** Inherited from tdialog. */
-       void pre_show(CVideo& video, twindow& window);
+       ttransient_message(const std::string& title
+                       , const bool title_use_markup
+                       , const std::string& message
+                       , const bool message_use_markup
+                       , const std::string& image);
 
 private:
-       /** The title for the dialog. */
-       std::string title_;
-
-       /** Use markup for the title. */
-       bool title_use_markup_;
-
-       /** The message to show to the user. */
-       std::string message_;
-
-       /** Use markup for the message. */
-       bool message_use_markup_;
-
-       /** An optional image to show at the left of the text. */
-       std::string image_;
 
        /** Inherited from tdialog, implemented by REGISTER_DIALOG. */
        virtual const std::string& window_id() const;
@@ -68,7 +44,7 @@
  * This shows a dialog with a short message which can be dismissed with a
  * single click.
  *
- * @note The message _should_ be small enough to fit on the window, the test
+ * @note The message _should_ be small enough to fit on the window, the text
  * can contain newlines and will wrap when needed.
  *
  * @param video               The video which contains the surface to draw
@@ -79,11 +55,12 @@
  * @param message_use_markup  Use markup for the message?
  * @param title_use_markup    Use markup for the title?
  */
-void show_transient_message(CVideo& video, const std::string& title,
-       const std::string& message,
-       const std::string& image = std::string(),
-       bool message_use_markup = false,
-       bool title_use_markup = false);
+void show_transient_message(CVideo& video
+               , const std::string& title
+               , const std::string& message
+               , const std::string& image = std::string()
+               , const bool message_use_markup = false
+               , const bool title_use_markup = false);
 
 /**
  * Shows a transient error message to the user.
@@ -100,7 +77,7 @@
 void show_transient_error_message(CVideo& video
                , const std::string& message
                , const std::string& image = std::string()
-               , bool message_use_markup = false);
+               , const bool message_use_markup = false);
 
 } // namespace gui2
 

Modified: trunk/src/multiplayer_wait.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/multiplayer_wait.cpp?rev=48961&r1=48960&r2=48961&view=diff
==============================================================================
--- trunk/src/multiplayer_wait.cpp (original)
+++ trunk/src/multiplayer_wait.cpp Sun Mar 20 19:26:19 2011
@@ -26,6 +26,7 @@
 #include "marked-up_text.hpp"
 #include "multiplayer_wait.hpp"
 #include "statistics.hpp"
+#include "wml_exception.hpp"
 #include "wml_separators.hpp"
 #include "formula_string_utils.hpp"
 

Modified: trunk/src/preferences_display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/preferences_display.cpp?rev=48961&r1=48960&r2=48961&view=diff
==============================================================================
--- trunk/src/preferences_display.cpp (original)
+++ trunk/src/preferences_display.cpp Sun Mar 20 19:26:19 2011
@@ -25,6 +25,7 @@
 
 #include "construct_dialog.hpp"
 #include "display.hpp"
+#include "foreach.hpp"
 #include "game_preferences.hpp"
 #include "gettext.hpp"
 #include "gui/dialogs/simple_item_selector.hpp"


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to