Author: crab
Date: Thu May 14 00:46:48 2009
New Revision: 35623

URL: http://svn.gna.org/viewcvs/wesnoth?rev=35623&view=rev
Log:
Reverted r35622, as it caused Bug #13521

Modified:
    trunk/changelog
    trunk/data/gui/default/window/message.cfg
    trunk/src/gui/dialogs/message.cpp
    trunk/src/gui/dialogs/message.hpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=35623&r1=35622&r2=35623&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Thu May 14 00:46:48 2009
@@ -103,7 +103,6 @@
      now causes a capture of that village.
    * Rewrote the layout algoritm (still a work in progress)
    * Fixed an multi-character UTF-8 handling bug in the password textbox
-   * Changed the tmessage dialog to be able to show four buttons
  * WML Engine:
    * Added [show_objectives] tag and allowed [show_if] tag in [objective]
      tags. (bug #13042)

Modified: trunk/data/gui/default/window/message.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/gui/default/window/message.cfg?rev=35623&r1=35622&r2=35623&view=diff
==============================================================================
--- trunk/data/gui/default/window/message.cfg (original)
+++ trunk/data/gui/default/window/message.cfg Thu May 14 00:46:48 2009
@@ -88,73 +88,19 @@
                        [row]
 
                                [column]
+                                       border = "all"
+                                       border_size = 5
+                                       horizontal_alignment = "center"
 
-                                       [grid]  
+                                       [button]
+                                               # This button will be shown or 
hidden depending on the
+                                               # whether or not a scrollbar is 
needed to show the
+                                               # text.
+                                               id = "ok"
+                                               definition = "default"
 
-                                               [row]
-
-                                                       # This button will be 
shown or hidden depending on the
-                                                       # whether or not a 
scrollbar is needed to show the
-                                                       # text.
-                                                       [column]
-                                                               border = "all"
-                                                               border_size = 5
-                                                               
horizontal_alignment = "center"
-
-                                                               [button]
-                                                                       id = 
"left_side"
-                                                                       
definition = "default"
-
-                                                                       label = 
""
-                                                               [/button]
-
-                                                       [/column]
-
-                                                       [column]
-                                                               border = "all"
-                                                               border_size = 5
-                                                               
horizontal_alignment = "center"
-
-                                                               [button]
-                                                                       id = 
"cancel"
-                                                                       
definition = "default"
-
-                                                                       label = 
_ "Cancel"
-                                                               [/button]
-
-                                                       [/column]
-
-                                                       [column]
-                                                               border = "all"
-                                                               border_size = 5
-                                                               
horizontal_alignment = "center"
-
-                                                               [button]
-                                                                       id = 
"ok"
-                                                                       
definition = "default"
-
-                                                                       label = 
_ "Close"
-                                                               [/button]
-
-                                                       [/column]
-
-                                                       [column]
-                                                               border = "all"
-                                                               border_size = 5
-                                                               
horizontal_alignment = "center"
-
-                                                               [button]
-                                                                       id = 
"right_side"
-                                                                       
definition = "default"
-
-                                                                       label = 
""
-                                                               [/button]
-
-                                                       [/column]
-
-                                               [/row]
-
-                                       [/grid]
+                                               label = "close"
+                                       [/button]
 
                                [/column]
 
@@ -165,4 +111,3 @@
        [/resolution]
 
 [/window]
-

Modified: trunk/src/gui/dialogs/message.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/message.cpp?rev=35623&r1=35622&r2=35623&view=diff
==============================================================================
--- trunk/src/gui/dialogs/message.cpp (original)
+++ trunk/src/gui/dialogs/message.cpp Thu May 14 00:46:48 2009
@@ -16,7 +16,6 @@
 
 #include "gui/dialogs/message.hpp"
 
-#include "foreach.hpp"
 #include "gui/widgets/button.hpp"
 #include "gui/widgets/image.hpp"
 #include "gui/widgets/label.hpp"
@@ -24,53 +23,8 @@
 
 namespace gui2 {
 
-/**
- * Helper to implement private functions without modifing the header.
- *
- * The class is a helper to avoid recompilation and only has static
- * functions.
- */
-struct tmessage_implementation
-{
-       /**
-        * Initialiazes a button.
-        * 
-        * @param window              The window that contains the button.
-        * @param button_status       The button status to modify.
-        * @param id                  The id of the button.
-        */
-       static void
-       init_button(twindow& window, tmessage::tbutton_status& button_status,
-                       const std::string& id)
-       {
-               button_status.button =
-                       dynamic_cast<tbutton*>(window.find_widget(id, false));
-               VALIDATE(button_status.button, missing_widget(id));
-               button_status.button->set_visible(button_status.visible);
-
-               if(!button_status.caption.empty()) {
-                       button_status.button->set_label(button_status.caption);
-               }
-
-               if(button_status.retval != twindow::NONE) {
-                       button_status.button->set_retval(button_status.retval);
-               }
-       }
-};
-
 void tmessage::pre_show(CVideo& /*video*/, twindow& window)
 {
-       // ***** Validate the required buttons ***** ***** ***** *****
-       tmessage_implementation::
-                       init_button(window, buttons_[left_1], "left_side");
-       tmessage_implementation::
-                       init_button(window, buttons_[cancel], "cancel");
-       tmessage_implementation::
-                       init_button(window, buttons_[ok] ,"ok");
-       tmessage_implementation::
-                       init_button(window, buttons_[right_1], "right_side");
-
-       // ***** ***** ***** ***** Set up the widgets ***** ***** ***** *****
        if(!title_.empty()) {
                tlabel* title =
                        dynamic_cast<tlabel*>(window.find_widget("title", 
false));
@@ -104,54 +58,16 @@
                 * and thus not need a scrollbar. Also when the button is 
visible
                 * easy_close will always return false.
                 */
+               tbutton* button =
+                       dynamic_cast<tbutton*>(window.find_widget("ok", false));
+               VALIDATE(button, missing_widget("ok"));
+               button->set_visible(twidget::INVISIBLE);
                window.layout();
 
                if(! window.does_easy_close()) {
-                       set_button_visible(ok, twidget::VISIBLE);
+                       button->set_visible(twidget::VISIBLE);
                }
        }
-}
-
-void tmessage::post_show(twindow& /*window*/)
-{
-       foreach(tbutton_status& button_status, buttons_) {
-               button_status.button = NULL;
-       }
-}
-
-void tmessage::set_button_caption(const tbutton_id button,
-               const std::string& caption)
-{
-       buttons_[button].caption = caption;
-       if(buttons_[button].button) {
-               buttons_[button].button->set_label(caption);
-       }
-}
-
-void tmessage::set_button_visible(const tbutton_id button,
-               const twidget::tvisible visible)
-{
-       buttons_[button].visible = visible;
-       if(buttons_[button].button) {
-               buttons_[button].button->set_visible(visible);
-       }
-}
-
-void tmessage::set_button_retval(const tbutton_id button,
-               const int retval)
-{
-       buttons_[button].retval = retval;
-       if(buttons_[button].button) {
-               buttons_[button].button->set_retval(retval);
-       }
-}
-
-tmessage::tbutton_status::tbutton_status()
-       : button(NULL)
-       , caption()
-       , visible(twidget::INVISIBLE)
-       , retval(twindow::NONE)
-{
 }
 
 twindow* tmessage::build_window(CVideo& video)

Modified: trunk/src/gui/dialogs/message.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/dialogs/message.hpp?rev=35623&r1=35622&r2=35623&view=diff
==============================================================================
--- trunk/src/gui/dialogs/message.hpp (original)
+++ trunk/src/gui/dialogs/message.hpp Thu May 14 00:46:48 2009
@@ -15,22 +15,18 @@
 #ifndef GUI_DIALOGS_MESSAGE_HPP_INCLUDED
 #define GUI_DIALOGS_MESSAGE_HPP_INCLUDED
 
-#include "gui/widgets/widget.hpp"
 #include "gui/dialogs/dialog.hpp"
 
 namespace gui2 {
 
-class tbutton;
-
 /**
  * Main class to show messages to the user.
  *
- * It can be used to show a message or ask a result from the user. For the
- * most common usage cases there are helper functions defined.
+ * It can be used to show a message or ask a result from the user. For the most
+ * common usage cases there are helper functions defined.
  */
 class tmessage : public tdialog
 {
-       friend struct tmessage_implementation;
 public:
        tmessage(const std::string& title, const std::string& message,
                        const bool auto_close)
@@ -38,25 +34,7 @@
                , image_()
                , message_(message)
                , auto_close_(auto_close)
-               , buttons_(count)
        {}
-
-       enum tbutton_id {
-                 left_1 = 0
-               , cancel
-               , ok
-               , right_1
-               , count
-       };
-
-       void set_button_caption(const tbutton_id button,
-                       const std::string& caption);
-
-       void set_button_visible(const tbutton_id button,
-                       const twidget::tvisible visible);
-
-       void set_button_retval(const tbutton_id button,
-                       const int retval);
 
        /***** ***** ***** setters / getters for members ***** ****** *****/
 
@@ -71,9 +49,6 @@
 protected:
        /** Inherited from tdialog. */
        void pre_show(CVideo& video, twindow& window);
-
-       /** Inherited from tdialog. */
-       void post_show(twindow& window);
 
 private:
        /** The title for the dialog. */
@@ -94,19 +69,6 @@
         * scrollbar.
         */
        bool auto_close_;
-
-       struct tbutton_status
-       {
-               tbutton_status();
-
-               tbutton* button;
-               std::string caption;
-               twidget::tvisible visible;
-               int retval;
-       };
-
-       /** Holds a pointer to the buttons. */
-       std::vector<tbutton_status> buttons_;
 
        /** Inherited from tdialog. */
        twindow* build_window(CVideo& video);


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

Reply via email to