Merge lp:~nha/widelands/signals into lp:widelands

Proposed by Nicolai Hähnle
Status: Merged
Merged at revision: 6128
Proposed branch: lp:~nha/widelands/signals
Merge into: lp:widelands
Diff against target: 7925 lines (+1739/-1777) (has conflicts)
153 files modified
CMakeLists.txt (+9/-5)
src/CMakeLists.txt (+2/-1)
src/editor/editorinteractive.cc (+16/-10)
src/editor/editorinteractive.h (+7/-7)
src/editor/tools/editor_tool.h (+4/-2)
src/editor/ui_menus/editor_main_menu.cc (+9/-8)
src/editor/ui_menus/editor_main_menu.h (+8/-8)
src/editor/ui_menus/editor_main_menu_load_map.cc (+7/-7)
src/editor/ui_menus/editor_main_menu_load_map.h (+3/-4)
src/editor/ui_menus/editor_main_menu_map_options.cc (+22/-29)
src/editor/ui_menus/editor_main_menu_map_options.h (+1/-5)
src/editor/ui_menus/editor_main_menu_new_map.cc (+16/-16)
src/editor/ui_menus/editor_main_menu_new_map.h (+3/-3)
src/editor/ui_menus/editor_main_menu_random_map.cc (+64/-52)
src/editor/ui_menus/editor_main_menu_random_map.h (+4/-4)
src/editor/ui_menus/editor_main_menu_save_map.cc (+12/-12)
src/editor/ui_menus/editor_main_menu_save_map.h (+2/-2)
src/editor/ui_menus/editor_main_menu_save_map_make_directory.cc (+8/-6)
src/editor/ui_menus/editor_main_menu_save_map_make_directory.h (+2/-2)
src/editor/ui_menus/editor_player_menu.cc (+15/-11)
src/editor/ui_menus/editor_player_menu.h (+3/-3)
src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc (+14/-13)
src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.h (+1/-1)
src/editor/ui_menus/editor_tool_change_height_options_menu.cc (+11/-4)
src/editor/ui_menus/editor_tool_change_height_options_menu.h (+2/-2)
src/editor/ui_menus/editor_tool_change_resources_options_menu.cc (+30/-25)
src/editor/ui_menus/editor_tool_change_resources_options_menu.h (+2/-2)
src/editor/ui_menus/editor_tool_menu.cc (+3/-3)
src/editor/ui_menus/editor_tool_noise_height_options_menu.cc (+13/-6)
src/editor/ui_menus/editor_tool_noise_height_options_menu.h (+1/-1)
src/editor/ui_menus/editor_tool_place_bob_options_menu.cc (+12/-17)
src/editor/ui_menus/editor_tool_place_bob_options_menu.h (+2/-1)
src/editor/ui_menus/editor_tool_place_immovable_options_menu.cc (+15/-18)
src/editor/ui_menus/editor_tool_place_immovable_options_menu.h (+2/-1)
src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc (+14/-20)
src/editor/ui_menus/editor_tool_set_terrain_options_menu.h (+2/-1)
src/editor/ui_menus/editor_toolsize_menu.cc (+3/-2)
src/editor/ui_menus/editor_toolsize_menu.h (+1/-1)
src/logic/constructionsite.cc (+0/-1)
src/logic/dismantlesite.cc (+0/-1)
src/network/nethost.cc (+1/-1)
src/scripting/lua_ui.cc (+2/-2)
src/ui_basic/box.cc (+2/-1)
src/ui_basic/button.cc (+3/-1)
src/ui_basic/button.h (+6/-53)
src/ui_basic/checkbox.cc (+4/-7)
src/ui_basic/checkbox.h (+6/-8)
src/ui_basic/editbox.cc (+4/-13)
src/ui_basic/editbox.h (+4/-7)
src/ui_basic/helpwindow.cc (+2/-2)
src/ui_basic/icongrid.cc (+10/-12)
src/ui_basic/icongrid.h (+6/-5)
src/ui_basic/listselect.cc (+9/-8)
src/ui_basic/listselect.h (+6/-5)
src/ui_basic/m_signal.h (+0/-97)
src/ui_basic/messagebox.cc (+10/-10)
src/ui_basic/messagebox.h (+5/-5)
src/ui_basic/multilineeditbox.cc (+8/-6)
src/ui_basic/multilineeditbox.h (+2/-2)
src/ui_basic/multilinetextarea.cc (+3/-1)
src/ui_basic/object.h (+0/-43)
src/ui_basic/panel.h (+3/-2)
src/ui_basic/radiobutton.cc (+4/-4)
src/ui_basic/radiobutton.h (+4/-5)
src/ui_basic/scrollbar.cc (+2/-2)
src/ui_basic/scrollbar.h (+4/-3)
src/ui_basic/slider.cc (+31/-3)
src/ui_basic/slider.h (+15/-32)
src/ui_basic/spinbox.cc (+12/-12)
src/ui_basic/table.cc (+9/-7)
src/ui_basic/table.h (+8/-8)
src/ui_basic/wsm_checkbox.cc.OTHER (+61/-0)
src/ui_basic/wsm_checkbox.h.OTHER (+40/-0)
src/ui_fsmenu/campaign_select.cc (+22/-16)
src/ui_fsmenu/campaign_select.h (+21/-21)
src/ui_fsmenu/editor.cc (+7/-3)
src/ui_fsmenu/editor.h (+3/-3)
src/ui_fsmenu/editor_mapselect.cc (+7/-6)
src/ui_fsmenu/editor_mapselect.h (+1/-1)
src/ui_fsmenu/fileview.cc (+3/-2)
src/ui_fsmenu/fileview.h (+1/-1)
src/ui_fsmenu/launchMPG.cc (+28/-20)
src/ui_fsmenu/launchMPG.h (+2/-2)
src/ui_fsmenu/launchSPG.cc (+13/-11)
src/ui_fsmenu/launchSPG.h (+2/-2)
src/ui_fsmenu/loadgame.cc (+8/-6)
src/ui_fsmenu/loadgame.h (+3/-3)
src/ui_fsmenu/loadreplay.cc (+11/-9)
src/ui_fsmenu/loadreplay.h (+3/-3)
src/ui_fsmenu/main.cc (+37/-27)
src/ui_fsmenu/main.h (+9/-9)
src/ui_fsmenu/mapselect.cc (+7/-7)
src/ui_fsmenu/mapselect.h (+1/-1)
src/ui_fsmenu/multiplayer.cc (+13/-10)
src/ui_fsmenu/multiplayer.h (+4/-4)
src/ui_fsmenu/netsetup_ggz.cc (+22/-18)
src/ui_fsmenu/netsetup_ggz.h (+15/-15)
src/ui_fsmenu/netsetup_lan.cc (+24/-19)
src/ui_fsmenu/netsetup_lan.h (+12/-12)
src/ui_fsmenu/options.cc (+18/-11)
src/ui_fsmenu/options.h (+2/-2)
src/ui_fsmenu/singleplayer.cc (+18/-13)
src/ui_fsmenu/singleplayer.h (+4/-4)
src/wui/attack_box.cc (+9/-9)
src/wui/attack_box.h (+3/-3)
src/wui/building_statistics_menu.cc (+19/-13)
src/wui/building_statistics_menu.h (+2/-2)
src/wui/buildingwindow.cc (+62/-50)
src/wui/buildingwindow.h (+1/-1)
src/wui/bulldozeconfirm.cc (+38/-58)
src/wui/encyclopedia_window.cc (+3/-3)
src/wui/fieldaction.cc (+18/-20)
src/wui/game_chat_menu.cc (+2/-2)
src/wui/game_debug_ui.cc (+5/-4)
src/wui/game_main_menu.cc (+9/-4)
src/wui/game_main_menu.h (+4/-4)
src/wui/game_main_menu_save_game.cc (+61/-61)
src/wui/game_main_menu_save_game.h (+5/-58)
src/wui/game_message_menu.cc (+147/-66)
src/wui/game_message_menu.h (+14/-112)
src/wui/game_objectives_menu.cc (+1/-1)
src/wui/game_objectives_menu.h (+0/-1)
src/wui/game_options_menu.cc (+10/-6)
src/wui/game_options_menu.h (+6/-6)
src/wui/game_options_sound_menu.cc (+9/-9)
src/wui/gamechatpanel.cc (+4/-4)
src/wui/gamechatpanel.h (+3/-3)
src/wui/general_statistics_menu.cc (+7/-10)
src/wui/general_statistics_menu.h (+1/-1)
src/wui/interactive_base.cc (+2/-2)
src/wui/interactive_player.cc (+28/-25)
src/wui/interactive_player.h (+8/-8)
src/wui/interactive_spectator.cc (+15/-12)
src/wui/interactive_spectator.h (+6/-6)
src/wui/login_box.cc (+6/-6)
src/wui/mapview.cc (+3/-3)
src/wui/mapview.h (+4/-4)
src/wui/military_box.cc (+8/-8)
src/wui/military_box.h (+1/-1)
src/wui/minimap.cc (+9/-9)
src/wui/minimap.h (+10/-8)
src/wui/multiplayersetupgroup.cc (+20/-15)
src/wui/playerdescrgroup.cc (+19/-19)
src/wui/plot_area.h (+3/-2)
src/wui/shipwindow.cc (+5/-3)
src/wui/soldiercapacitycontrol.cc (+7/-6)
src/wui/story_message_box.cc (+2/-2)
src/wui/transport_ui.cc (+6/-7)
src/wui/ware_statistics_menu.h (+2/-2)
src/wui/warehousewindow.cc (+9/-8)
src/wui/waresqueuedisplay.cc (+8/-6)
src/wui/waresqueuedisplay.h (+2/-2)
src/wui/watchwindow.cc (+161/-157)
Contents conflict in src/ui_basic/wsm_checkbox.cc
Contents conflict in src/ui_basic/wsm_checkbox.h
To merge this branch: bzr merge lp:~nha/widelands/signals
Reviewer Review Type Date Requested Status
Tino Approve
SirVer Approve
Review via email: mp+82925@code.launchpad.net

Description of the change

Testing on Windows and Mac OS X wanted!

It's 2011, it should be possible to replace our own homebrew and limited UI::Signal code by using the boost::signals library. The syntax is much nicer and the feature set broader. For example, no "set_id" hacks are needed to identify where a signal is coming from, because you can set that implicitly on connect() time, and multiple signal recipients become possible.

The only gotcha is that boost::signals is not headers-only, so this requires linking with a part of Boost, and that needs to work on all platforms.

For some reason, I have been unable to link boost::signals statically on Debian; it fails with an entirely cryptic error message. That is not a problem of Widelands: even a completely minimalistic test project fails to link statically. So, in this branch, the CMakeLists.txt is set up to link dynamically to Boost. I'd like some feedback on how things work on other platforms and how to deal with it.

To post a comment you must log in.
Revision history for this message
Nicolai Hähnle (nha) wrote :

Note that dynamic linking on Ubuntu 11.04 does work. I don't have access to the other system right now, so I can't reproduce the exact error message. It may just be a problem with the packages on Debian, but it seems that if we default to static linking, we need to at least provide a build-time switch for that.

Revision history for this message
SirVer (sirver) wrote :

I will test this on mac os x and report back. I am also pro killing our own signal stuff; in this sweep it would be nice to also get rid of "CallbackButton" and subcalssing Button for clicks and use signals there as well.

Revision history for this message
SirVer (sirver) wrote :

okay, this is working on mac os x without any changes. If you want windows testing, you should poke tino directly - I do not think he follows development on launchpad.

Note that we must be a little careful with boost::signal. It is very well suited for replacing our UI Signals but it is said to be very slow. When we use it to signal inside the game logic very often we must take care.

review: Approve
Revision history for this message
Tino (tino79) wrote :

I follow, i follow ... ;)

I will test it on windows as soon i have some time at hand, i think tomorrow evening...
But I remember that i tried to compile Boost on win32 and failed horribly...

Revision history for this message
Nicolai Hähnle (nha) wrote :

Thank you Tino! I will wait for now until I hear back from you.

I like the idea of replacing Callback_Button and all the sub-classing. The former becomes redundant, and the latter is so terribly hackish.

I would also be careful with this inside the game logic. I stumbled across the issue due to the Observable work, and for that I hope it runs decently enough. Note that there is another potential pitfall with things like boost::signals in the game logic: the order in which slots are called is important. According to the docs, this is more or less clearly defined to be FIFO, but still it might be problematic to mix different versions of Boost across network games, if signals are used in the game logic.

Revision history for this message
SirVer (sirver) wrote :

Funny enough I just recently introduced Model and View classes into the UI in my Editor remodel. I am looking forward to replacing them/implementing them with boost::signals. I will wait for the moment till this is merged.

Revision history for this message
Tino (tino79) wrote :

Ok, i was able to compile this successfully on windows.
From my side nothing speaks against merging this...

review: Approve
Revision history for this message
SirVer (sirver) wrote :

Nicolai, will you merge this or is there something left to be done?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2011-11-11 18:31:54 +0000
3+++ CMakeLists.txt 2011-11-26 13:22:27 +0000
4@@ -108,12 +108,12 @@
5 if (WL_UNIT_TESTS)
6 message(STATUS "Enabled unit tests")
7
8- set (BUILD_SHARED_LIBS OFF)
9- set (Boost_FIND_COMPONENTS unit_test_framework)
10- set (Boost_USE_STATIC_LIBS ON)
11+ #set (BUILD_SHARED_LIBS OFF)
12+ set (Boost_FIND_COMPONENTS unit_test_framework signals)
13+ set (Boost_USE_STATIC_LIBS OFF)
14 set (Boost_USE_MULTITHREADED ON)
15 set (Boost_DETAILED_FAILURE_MSG ON)
16- find_package(Boost 1.35.0 COMPONENTS unit_test_framework REQUIRED)
17+ find_package(Boost 1.35.0 COMPONENTS unit_test_framework signals REQUIRED)
18
19 if (NOT DEFINED MSVC)
20 string( REGEX MATCH ".a$" BOOST_STATIC_UNIT_TEST_LIB ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
21@@ -136,7 +136,11 @@
22 )
23 else (WL_UNIT_TESTS)
24 message(STATUS "Disabled Unit Tests")
25- find_package(Boost 1.35.0 REQUIRED)
26+ set (Boost_FIND_COMPONENTS signals)
27+ set (Boost_USE_STATIC_LIBS ON)
28+ set (Boost_USE_MULTITHREADED ON)
29+ set (Boost_DETAILED_FAILURE_MSG ON)
30+ find_package(Boost 1.35.0 COMPONENTS signals REQUIRED)
31 endif (WL_UNIT_TESTS)
32
33 option (WL_STRICT "If strict compilation mode is requested (almost every warning is an error)" OFF)
34
35=== modified file 'src/CMakeLists.txt'
36--- src/CMakeLists.txt 2011-09-28 07:37:12 +0000
37+++ src/CMakeLists.txt 2011-11-26 13:22:27 +0000
38@@ -116,7 +116,8 @@
39 target_link_libraries(widelands_all ${GGZ_CORE_LIBRARY})
40 target_link_libraries(widelands_all ${OPENGL_gl_LIBRARY})
41 target_link_libraries(widelands_all ${GLEW_LIBRARY})
42-if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
43+target_link_libraries(widelands_all ${Boost_LIBRARIES})
44+if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
45 target_link_libraries(widelands_all ${EXECINFO_LIBRARY})
46 endif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
47
48
49=== modified file 'src/editor/editorinteractive.cc'
50--- src/editor/editorinteractive.cc 2011-09-04 17:21:11 +0000
51+++ src/editor/editorinteractive.cc 2011-11-26 13:22:27 +0000
52@@ -1,5 +1,5 @@
53 /*
54- * Copyright (C) 2002-2003, 2006-2010 by the Widelands Development Team
55+ * Copyright (C) 2002-2003, 2006-2011 by the Widelands Development Team
56 *
57 * This program is free software; you can redistribute it and/or
58 * modify it under the terms of the GNU General Public License
59@@ -51,32 +51,38 @@
60 m_need_save (false),
61 m_realtime (WLApplication::get()->get_time()),
62
63-#define INIT_BUTTON(picture, name, callback, tooltip) \
64+#define INIT_BUTTON(picture, name, tooltip) \
65 TOOLBAR_BUTTON_COMMON_PARAMETERS(name), \
66 g_gr->get_picture(PicMod_Game, "pics/" picture ".png"), \
67- boost::bind(&Editor_Interactive::callback, boost::ref(*this)), \
68 tooltip \
69
70 m_toggle_main_menu
71 (INIT_BUTTON
72- ("menu_toggle_menu", "menu", toggle_mainmenu, _("Menu"))),
73+ ("menu_toggle_menu", "menu", _("Menu"))),
74 m_toggle_tool_menu
75 (INIT_BUTTON
76- ("editor_menu_toggle_tool_menu", "tools", tool_menu_btn, _("Tools"))),
77+ ("editor_menu_toggle_tool_menu", "tools", _("Tools"))),
78 m_toggle_toolsize_menu
79 (INIT_BUTTON
80- ("editor_menu_set_toolsize_menu", "toolsize", toolsize_menu_btn,
81+ ("editor_menu_set_toolsize_menu", "toolsize",
82 _("Toolsize"))),
83 m_toggle_minimap
84 (INIT_BUTTON
85- ("menu_toggle_minimap", "minimap", toggle_minimap, _("Minimap"))),
86+ ("menu_toggle_minimap", "minimap", _("Minimap"))),
87 m_toggle_buildhelp
88 (INIT_BUTTON
89- ("menu_toggle_buildhelp", "buildhelp", toggle_buildhelp, _("Buildhelp"))),
90+ ("menu_toggle_buildhelp", "buildhelp", _("Buildhelp"))),
91 m_toggle_player_menu
92 (INIT_BUTTON
93- ("editor_menu_player_menu", "players", toggle_playermenu, _("Players")))
94+ ("editor_menu_player_menu", "players", _("Players")))
95 {
96+ m_toggle_main_menu.sigclicked.connect(boost::bind(&Editor_Interactive::toggle_mainmenu, this));
97+ m_toggle_tool_menu.sigclicked.connect(boost::bind(&Editor_Interactive::tool_menu_btn, this));
98+ m_toggle_toolsize_menu.sigclicked.connect(boost::bind(&Editor_Interactive::toolsize_menu_btn, this));
99+ m_toggle_minimap.sigclicked.connect(boost::bind(&Editor_Interactive::toggle_minimap, this));
100+ m_toggle_buildhelp.sigclicked.connect(boost::bind(&Editor_Interactive::toggle_buildhelp, this));
101+ m_toggle_player_menu.sigclicked.connect(boost::bind(&Editor_Interactive::toggle_playermenu, this));
102+
103 m_toolbar.set_layout_toplevel(true);
104 m_toolbar.add(&m_toggle_main_menu, UI::Box::AlignLeft);
105 m_toolbar.add(&m_toggle_tool_menu, UI::Box::AlignLeft);
106@@ -92,7 +98,7 @@
107 set_display_flag(Interactive_Base::dfDebug, true);
108 #endif
109
110- fieldclicked.set(this, &Editor_Interactive::map_clicked);
111+ fieldclicked.connect(boost::bind(&Editor_Interactive::map_clicked, this));
112 }
113
114
115
116=== modified file 'src/editor/editorinteractive.h'
117--- src/editor/editorinteractive.h 2010-10-17 19:42:01 +0000
118+++ src/editor/editorinteractive.h 2011-11-26 13:22:27 +0000
119@@ -1,5 +1,5 @@
120 /*
121- * Copyright (C) 2002, 2006-2008 by the Widelands Development Team
122+ * Copyright (C) 2002, 2006-2011 by the Widelands Development Team
123 *
124 * This program is free software; you can redistribute it and/or
125 * modify it under the terms of the GNU General Public License
126@@ -147,12 +147,12 @@
127 UI::UniqueWindow::Registry m_bobmenu;
128 UI::UniqueWindow::Registry m_resourcesmenu;
129
130- UI::Callback_Button m_toggle_main_menu;
131- UI::Callback_Button m_toggle_tool_menu;
132- UI::Callback_Button m_toggle_toolsize_menu;
133- UI::Callback_Button m_toggle_minimap;
134- UI::Callback_Button m_toggle_buildhelp;
135- UI::Callback_Button m_toggle_player_menu;
136+ UI::Button m_toggle_main_menu;
137+ UI::Button m_toggle_tool_menu;
138+ UI::Button m_toggle_toolsize_menu;
139+ UI::Button m_toggle_minimap;
140+ UI::Button m_toggle_buildhelp;
141+ UI::Button m_toggle_player_menu;
142 };
143
144 #endif
145
146=== modified file 'src/editor/tools/editor_tool.h'
147--- src/editor/tools/editor_tool.h 2009-11-22 23:03:13 +0000
148+++ src/editor/tools/editor_tool.h 2011-11-26 13:22:27 +0000
149@@ -1,5 +1,5 @@
150 /*
151- * Copyright (C) 2002-2004, 2006-2008 by the Widelands Development Team
152+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
153 *
154 * This program is free software; you can redistribute it and/or
155 * modify it under the terms of the GNU General Public License
156@@ -22,6 +22,8 @@
157
158 #define MAX_TOOL_AREA 9
159
160+#include <boost/noncopyable.hpp>
161+
162 #include "logic/widelands_geometry.h"
163
164 struct Editor_Interactive;
165@@ -33,7 +35,7 @@
166 * one function (like delete_building, place building, modify building are 3
167 * tools).
168 */
169-struct Editor_Tool {
170+struct Editor_Tool : boost::noncopyable {
171 Editor_Tool(Editor_Tool & second, Editor_Tool & third) :
172 m_second(second), m_third(third)
173 {}
174
175=== modified file 'src/editor/ui_menus/editor_main_menu.cc'
176--- src/editor/ui_menus/editor_main_menu.cc 2010-10-17 19:32:07 +0000
177+++ src/editor/ui_menus/editor_main_menu.cc 2011-11-26 13:22:27 +0000
178@@ -1,5 +1,5 @@
179 /*
180- * Copyright (C) 2002-2004, 2006-2009 by the Widelands Development Team
181+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
182 *
183 * This program is free software; you can redistribute it and/or
184 * modify it under the terms of the GNU General Public License
185@@ -52,45 +52,46 @@
186 (this, "new_map",
187 hmargin, vmargin + 0 * (height + vspacing), width, height,
188 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
189- boost::bind(&Editor_Main_Menu::new_map_btn, boost::ref(*this)),
190 _("New Map")),
191 m_button_new_random_map
192 (this, "new_random_map",
193 hmargin, vmargin + 1 * (height + vspacing), width, height,
194 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
195- boost::bind(&Editor_Main_Menu::new_random_map_btn, boost::ref(*this)),
196 _("New Random Map")),
197 m_button_load_map
198 (this, "load_map",
199 hmargin, vmargin + 2 * (height + vspacing), width, height,
200 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
201- boost::bind(&Editor_Main_Menu::load_btn, boost::ref(*this)),
202 _("Load Map")),
203 m_button_save_map
204 (this, "save_map",
205 hmargin, vmargin + 3 * (height + vspacing), width, height,
206 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
207- boost::bind(&Editor_Main_Menu::save_btn, boost::ref(*this)),
208 _("Save Map")),
209 m_button_map_options
210 (this, "map_options",
211 hmargin, vmargin + 4 * (height + vspacing), width, height,
212 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
213- boost::bind(&Editor_Main_Menu::map_options_btn, boost::ref(*this)),
214 _("Map Options")),
215 m_button_view_readme
216 (this, "readme",
217 hmargin, vmargin + 5 * (height + vspacing), width, height,
218 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
219- boost::bind(&Editor_Main_Menu::readme_btn, boost::ref(*this)),
220 _("View Readme")),
221 m_button_exit_editor
222 (this, "exit",
223 hmargin, vmargin + 6 * (height + vspacing), width, height,
224 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
225- boost::bind(&Editor_Main_Menu::exit_btn, boost::ref(*this)),
226 _("Exit Editor"))
227 {
228+ m_button_new_map.sigclicked.connect(boost::bind(&Editor_Main_Menu::new_map_btn, this));
229+ m_button_new_random_map.sigclicked.connect(boost::bind(&Editor_Main_Menu::new_random_map_btn, this));
230+ m_button_load_map.sigclicked.connect(boost::bind(&Editor_Main_Menu::load_btn, this));
231+ m_button_save_map.sigclicked.connect(boost::bind(&Editor_Main_Menu::save_btn, this));
232+ m_button_map_options.sigclicked.connect(boost::bind(&Editor_Main_Menu::map_options_btn, this));
233+ m_button_view_readme.sigclicked.connect(boost::bind(&Editor_Main_Menu::readme_btn, this));
234+ m_button_exit_editor.sigclicked.connect(boost::bind(&Editor_Main_Menu::exit_btn, this));
235+
236 // Put in the default position, if necessary
237 if (get_usedefaultpos())
238 center_to_parent();
239
240=== modified file 'src/editor/ui_menus/editor_main_menu.h'
241--- src/editor/ui_menus/editor_main_menu.h 2010-10-17 19:42:01 +0000
242+++ src/editor/ui_menus/editor_main_menu.h 2011-11-26 13:22:27 +0000
243@@ -1,5 +1,5 @@
244 /*
245- * Copyright (C) 2002-2004, 2008-2009 by the Widelands Development Team
246+ * Copyright (C) 2002-2004, 2008-2011 by the Widelands Development Team
247 *
248 * This program is free software; you can redistribute it and/or
249 * modify it under the terms of the GNU General Public License
250@@ -33,13 +33,13 @@
251
252 private:
253 Editor_Interactive & eia();
254- UI::Callback_Button m_button_new_map;
255- UI::Callback_Button m_button_new_random_map;
256- UI::Callback_Button m_button_load_map;
257- UI::Callback_Button m_button_save_map;
258- UI::Callback_Button m_button_map_options;
259- UI::Callback_Button m_button_view_readme;
260- UI::Callback_Button m_button_exit_editor;
261+ UI::Button m_button_new_map;
262+ UI::Button m_button_new_random_map;
263+ UI::Button m_button_load_map;
264+ UI::Button m_button_save_map;
265+ UI::Button m_button_map_options;
266+ UI::Button m_button_view_readme;
267+ UI::Button m_button_exit_editor;
268
269 UI::UniqueWindow::Registry m_window_readme;
270
271
272=== modified file 'src/editor/ui_menus/editor_main_menu_load_map.cc'
273--- src/editor/ui_menus/editor_main_menu_load_map.cc 2010-11-03 01:04:47 +0000
274+++ src/editor/ui_menus/editor_main_menu_load_map.cc 2011-11-26 13:22:27 +0000
275@@ -1,5 +1,5 @@
276 /*
277- * Copyright (C) 2002-2004, 2006-2009 by the Widelands Development Team
278+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
279 *
280 * This program is free software; you can redistribute it and/or
281 * modify it under the terms of the GNU General Public License
282@@ -59,8 +59,8 @@
283 (this,
284 posx, posy,
285 get_inner_w() / 2 - spacing, get_inner_h() - spacing - offsy - 40);
286- m_ls->selected.set(this, &Main_Menu_Load_Map::selected);
287- m_ls->double_clicked.set(this, &Main_Menu_Load_Map::double_clicked);
288+ m_ls->selected.connect(boost::bind(&Main_Menu_Load_Map::selected, this, _1));
289+ m_ls->double_clicked.connect(boost::bind(&Main_Menu_Load_Map::double_clicked, this, _1));
290
291 posx = get_inner_w() / 2 + spacing;
292 posy += 20;
293@@ -113,21 +113,21 @@
294 posx = 5;
295 posy = get_inner_h() - 30;
296
297- m_ok_btn = new UI::Callback_Button
298+ m_ok_btn = new UI::Button
299 (this, "ok",
300 get_inner_w() / 2 - spacing - 80, posy, 80, 20,
301 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
302- boost::bind(&Main_Menu_Load_Map::clicked_ok, boost::ref(*this)),
303 _("OK"),
304 std::string(),
305 false);
306+ m_ok_btn->sigclicked.connect(boost::bind(&Main_Menu_Load_Map::clicked_ok, this));
307
308- new UI::Callback_Button
309+ UI::Button * cancelbtn = new UI::Button
310 (this, "cancel",
311 get_inner_w() / 2 + spacing, posy, 80, 20,
312 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
313- boost::bind(&Main_Menu_Load_Map::die, boost::ref(*this)),
314 _("Cancel"));
315+ cancelbtn->sigclicked.connect(boost::bind(&Main_Menu_Load_Map::die, this));
316
317 m_basedir = "maps";
318 m_curdir = "maps";
319
320=== modified file 'src/editor/ui_menus/editor_main_menu_load_map.h'
321--- src/editor/ui_menus/editor_main_menu_load_map.h 2010-10-17 19:42:01 +0000
322+++ src/editor/ui_menus/editor_main_menu_load_map.h 2011-11-26 13:22:27 +0000
323@@ -1,5 +1,5 @@
324 /*
325- * Copyright (C) 2002-2004, 2006, 2008-2009 by the Widelands Development Team
326+ * Copyright (C) 2002-2004, 2006, 2008-2011 by the Widelands Development Team
327 *
328 * This program is free software; you can redistribute it and/or
329 * modify it under the terms of the GNU General Public License
330@@ -26,11 +26,10 @@
331
332 struct Editor_Interactive;
333 namespace UI {
334-struct EditBox;
335+struct Button;
336 template <typename T> struct Listselect;
337 struct Textarea;
338 struct Multiline_Textarea;
339-struct Callback_Button;
340 };
341
342 /**
343@@ -49,7 +48,7 @@
344 UI::Textarea * m_name, * m_author, * m_size, * m_world, * m_nrplayers;
345 UI::Multiline_Textarea * m_descr;
346 UI::Listselect<const char *> * m_ls;
347- UI::Callback_Button * m_ok_btn;
348+ UI::Button * m_ok_btn;
349
350 std::string m_basedir;
351 std::string m_curdir;
352
353=== modified file 'src/editor/ui_menus/editor_main_menu_map_options.cc'
354--- src/editor/ui_menus/editor_main_menu_map_options.cc 2010-04-24 20:03:07 +0000
355+++ src/editor/ui_menus/editor_main_menu_map_options.cc 2011-11-26 13:22:27 +0000
356@@ -1,5 +1,5 @@
357 /*
358- * Copyright (C) 2002-2009 by the Widelands Development Team
359+ * Copyright (C) 2002-2011 by the Widelands Development Team
360 *
361 * This program is free software; you can redistribute it and/or
362 * modify it under the terms of the GNU General Public License
363@@ -36,20 +36,6 @@
364 }
365
366
367-Main_Menu_Map_Options::Enable_Set_Origin_Tool_Button::
368-Enable_Set_Origin_Tool_Button(Main_Menu_Map_Options & parent)
369- :
370- UI::Button
371- (&parent, "set_origin",
372- 5, parent.get_inner_h() - 25, parent.get_inner_w() - 10, 20,
373- g_gr->get_picture(PicMod_UI, "pics/but0.png"),
374- _("Set origin"),
375- _
376- ("Set the position that will have the coordinates (0, 0). This will "
377- "be the top-left corner of a generated minimap."))
378-{}
379-
380-
381 /**
382 * Create all the buttons etc...
383 */
384@@ -58,8 +44,7 @@
385 UI::Window
386 (&parent, "map_options",
387 (parent.get_w() - 200) / 2, (parent.get_h() - 300) / 2, 200, 305,
388- _("Map Options")),
389- m_enable_set_origin_tool(*this)
390+ _("Map Options"))
391 {
392
393 int32_t const offsx = 5;
394@@ -74,8 +59,8 @@
395 (this,
396 posx + ta->get_w() + spacing, posy,
397 get_inner_w() - (posx + ta->get_w() + spacing) - spacing, 20,
398- g_gr->get_picture(PicMod_UI, "pics/but1.png"), 0);
399- m_name->changedid.set(this, &Main_Menu_Map_Options::changed);
400+ g_gr->get_picture(PicMod_UI, "pics/but1.png"));
401+ m_name->changed.connect(boost::bind(&Main_Menu_Map_Options::changed, this, 0));
402 posy += height + spacing;
403 ta = new UI::Textarea(this, posx, posy - 2, _("Size:"));
404 m_size =
405@@ -97,8 +82,8 @@
406 (this,
407 posx + ta->get_w() + spacing, posy,
408 get_inner_w() - (posx + ta->get_w() + spacing) - spacing, 20,
409- g_gr->get_picture(PicMod_UI, "pics/but1.png"), 1);
410- m_author->changedid.set(this, &Main_Menu_Map_Options::changed);
411+ g_gr->get_picture(PicMod_UI, "pics/but1.png"));
412+ m_author->changed.connect(boost::bind(&Main_Menu_Map_Options::changed, this, 1));
413 posy += height + spacing;
414 m_descr =
415 new UI::Multiline_Editbox
416@@ -106,7 +91,22 @@
417 posx, posy,
418 get_inner_w() - spacing - posx, get_inner_h() - 25 - spacing - posy,
419 parent.egbase().map().get_description());
420- m_descr->changed.set(this, &Main_Menu_Map_Options::editbox_changed);
421+ m_descr->changed.connect(boost::bind(&Main_Menu_Map_Options::editbox_changed, this));
422+
423+ UI::Button * btn =
424+ new UI::Button
425+ (this, "set_origin",
426+ 5, get_inner_h() - 25, get_inner_w() - 10, 20,
427+ g_gr->get_picture(PicMod_UI, "pics/but0.png"),
428+ _("Set origin"),
429+ _
430+ ("Set the position that will have the coordinates (0, 0). This will "
431+ "be the top-left corner of a generated minimap."));
432+ btn->sigclicked.connect
433+ (boost::bind
434+ (&Editor_Interactive::select_tool, &parent,
435+ boost::ref(parent.tools.set_origin), Editor_Tool::First));
436+
437 update();
438 }
439
440@@ -149,10 +149,3 @@
441 void Main_Menu_Map_Options::editbox_changed() {
442 eia().egbase().map().set_description(m_descr->get_text().c_str());
443 }
444-
445-
446-void Main_Menu_Map_Options::Enable_Set_Origin_Tool_Button::clicked() {
447- Editor_Interactive & eia =
448- ref_cast<Main_Menu_Map_Options, UI::Panel>(*get_parent()).eia();
449- eia.select_tool(eia.tools.set_origin, Editor_Tool::First);
450-}
451
452=== modified file 'src/editor/ui_menus/editor_main_menu_map_options.h'
453--- src/editor/ui_menus/editor_main_menu_map_options.h 2009-11-30 21:33:46 +0000
454+++ src/editor/ui_menus/editor_main_menu_map_options.h 2011-11-26 13:22:27 +0000
455@@ -1,5 +1,5 @@
456 /*
457- * Copyright (C) 2002-2004, 2006-2009 by the Widelands Development Team
458+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
459 *
460 * This program is free software; you can redistribute it and/or
461 * modify it under the terms of the GNU General Public License
462@@ -45,10 +45,6 @@
463 UI::Multiline_Editbox * m_descr;
464 UI::Textarea * m_world, * m_nrplayers, * m_size;
465 UI::EditBox * m_name, * m_author;
466- struct Enable_Set_Origin_Tool_Button : UI::Button {
467- Enable_Set_Origin_Tool_Button(Main_Menu_Map_Options &);
468- void clicked();
469- } m_enable_set_origin_tool;
470 void update();
471 };
472
473
474=== modified file 'src/editor/ui_menus/editor_main_menu_new_map.cc'
475--- src/editor/ui_menus/editor_main_menu_new_map.cc 2010-10-17 19:42:01 +0000
476+++ src/editor/ui_menus/editor_main_menu_new_map.cc 2011-11-26 13:22:27 +0000
477@@ -65,19 +65,19 @@
478 (buffer, sizeof(buffer), _("Width: %u"), Widelands::MAP_DIMENSIONS[m_w]);
479 m_width = new UI::Textarea(this, posx + spacing + 20, posy, buffer);
480
481- new UI::Callback_Button
482+ UI::Button * widthupbtn = new UI::Button
483 (this, "width_up",
484 posx, posy, 20, 20,
485 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
486- g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
487- boost::bind(&Main_Menu_New_Map::button_clicked, boost::ref(*this), 0));
488+ g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"));
489+ widthupbtn->sigclicked.connect(boost::bind(&Main_Menu_New_Map::button_clicked, this, 0));
490
491- new UI::Callback_Button
492+ UI::Button * widthdownbtn = new UI::Button
493 (this, "width_down",
494 get_inner_w() - spacing - 20, posy, 20, 20,
495 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
496- g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
497- boost::bind(&Main_Menu_New_Map::button_clicked, boost::ref(*this), 1));
498+ g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"));
499+ widthdownbtn->sigclicked.connect(boost::bind(&Main_Menu_New_Map::button_clicked, this, 1));
500
501 posy += 20 + spacing + spacing;
502
503@@ -86,19 +86,19 @@
504 _("Height: %u"), Widelands::MAP_DIMENSIONS[m_h]);
505 m_height = new UI::Textarea(this, posx + spacing + 20, posy, buffer);
506
507- new UI::Callback_Button
508+ UI::Button * heightupbtn = new UI::Button
509 (this, "height_up",
510 posx, posy, 20, 20,
511 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
512- g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
513- boost::bind(&Main_Menu_New_Map::button_clicked, boost::ref(*this), 2));
514+ g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"));
515+ heightupbtn->sigclicked.connect(boost::bind(&Main_Menu_New_Map::button_clicked, this, 2));
516
517- new UI::Callback_Button
518+ UI::Button * heightdownbtn = new UI::Button
519 (this, "height_down",
520 get_inner_w() - spacing - 20, posy, 20, 20,
521 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
522- g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
523- boost::bind(&Main_Menu_New_Map::button_clicked, boost::ref(*this), 3));
524+ g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"));
525+ heightdownbtn->sigclicked.connect(boost::bind(&Main_Menu_New_Map::button_clicked, this, 3));
526
527 posy += 20 + spacing + spacing;
528
529@@ -108,21 +108,21 @@
530 while (strcmp(map.get_world_name(), m_worlds[m_currentworld].c_str()))
531 ++m_currentworld;
532
533- m_world = new UI::Callback_Button
534+ m_world = new UI::Button
535 (this, "world",
536 posx, posy, width, height,
537 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
538- boost::bind(&Main_Menu_New_Map::button_clicked, boost::ref(*this), 4),
539 Widelands::World(m_worlds[m_currentworld].c_str()).get_name());
540+ m_world->sigclicked.connect(boost::bind(&Main_Menu_New_Map::button_clicked, this, 4));
541
542 posy += height + spacing + spacing + spacing;
543
544- new UI::Callback_Button
545+ UI::Button * createbtn = new UI::Button
546 (this, "create_map",
547 posx, posy, width, height,
548 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
549- boost::bind(&Main_Menu_New_Map::clicked_create_map, boost::ref(*this)),
550 _("Create Map"));
551+ createbtn->sigclicked.connect(boost::bind(&Main_Menu_New_Map::clicked_create_map, this));
552
553 posy += height + spacing;
554 }
555
556=== modified file 'src/editor/ui_menus/editor_main_menu_new_map.h'
557--- src/editor/ui_menus/editor_main_menu_new_map.h 2010-10-17 19:42:01 +0000
558+++ src/editor/ui_menus/editor_main_menu_new_map.h 2011-11-26 13:22:27 +0000
559@@ -1,5 +1,5 @@
560 /*
561- * Copyright (C) 2002-2004, 2006-2009 by the Widelands Development Team
562+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
563 *
564 * This program is free software; you can redistribute it and/or
565 * modify it under the terms of the GNU General Public License
566@@ -26,7 +26,7 @@
567
568 struct Editor_Interactive;
569 namespace UI {
570-struct Callback_Button;
571+struct Button;
572 struct Textarea;
573 }
574
575@@ -40,7 +40,7 @@
576
577 private:
578 UI::Textarea * m_width, * m_height;
579- UI::Callback_Button * m_world;
580+ UI::Button * m_world;
581 int32_t m_w, m_h;
582 std::vector<std::string>::size_type m_currentworld;
583 std::vector<std::string> m_worlds;
584
585=== modified file 'src/editor/ui_menus/editor_main_menu_random_map.cc'
586--- src/editor/ui_menus/editor_main_menu_random_map.cc 2010-11-01 22:30:23 +0000
587+++ src/editor/ui_menus/editor_main_menu_random_map.cc 2011-11-26 13:22:27 +0000
588@@ -1,5 +1,5 @@
589 /*
590- * Copyright (C) 2002-2004, 2006-2010 by the Widelands Development Team
591+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
592 *
593 * This program is free software; you can redistribute it and/or
594 * modify it under the terms of the GNU General Public License
595@@ -74,9 +74,9 @@
596 (this,
597 posx, posy,
598 width, 20,
599- g_gr->get_picture(PicMod_UI, "pics/but1.png"), 0);
600- m_nrEditbox->changed.set
601- (this, & Main_Menu_New_Random_Map::nr_edit_box_changed);
602+ g_gr->get_picture(PicMod_UI, "pics/but1.png"));
603+ m_nrEditbox->changed.connect
604+ (boost::bind(&Main_Menu_New_Random_Map::nr_edit_box_changed, this));
605 RNG rng;
606 rng.seed(clock());
607 rng.rand();
608@@ -98,19 +98,21 @@
609 for (m_h = 0; Widelands::MAP_DIMENSIONS[m_h] < map_extent.h; ++m_h) {}
610 }
611
612- new UI::Callback_Button
613+ UI::Button * widthupbtn = new UI::Button
614 (this, "width_up",
615 posx, posy, 20, 20,
616 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
617- g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
618- boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), MAP_W_PLUS));
619+ g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"));
620+ widthupbtn->sigclicked.connect
621+ (boost::bind(&Main_Menu_New_Random_Map::button_clicked, this, MAP_W_PLUS));
622
623- new UI::Callback_Button
624+ UI::Button * widthdownbtn = new UI::Button
625 (this, "width_down",
626 get_inner_w() - spacing - 20, posy, 20, 20,
627 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
628- g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
629- boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), MAP_W_MINUS));
630+ g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"));
631+ widthdownbtn->sigclicked.connect
632+ (boost::bind(&Main_Menu_New_Random_Map::button_clicked, this, MAP_W_MINUS));
633
634 snprintf
635 (buffer, sizeof(buffer), _("Width: %u"), Widelands::MAP_DIMENSIONS[m_w]);
636@@ -126,38 +128,42 @@
637 _("Height: %u"), Widelands::MAP_DIMENSIONS[m_h]);
638 m_height = new UI::Textarea(this, posx + spacing + 20, posy, buffer);
639
640- new UI::Callback_Button
641+ UI::Button * heightupbtn = new UI::Button
642 (this, "height_up",
643 posx, posy, 20, 20,
644 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
645- g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
646- boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), MAP_H_PLUS));
647+ g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"));
648+ heightupbtn->sigclicked.connect
649+ (boost::bind(&Main_Menu_New_Random_Map::button_clicked, this, MAP_H_PLUS));
650
651- new UI::Callback_Button
652+ UI::Button * heightdownbtn = new UI::Button
653 (this, "height_down",
654 get_inner_w() - spacing - 20, posy, 20, 20,
655 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
656- g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
657- boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), MAP_H_MINUS));
658+ g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"));
659+ heightdownbtn->sigclicked.connect
660+ (boost::bind(&Main_Menu_New_Random_Map::button_clicked, this, MAP_H_MINUS));
661
662 posy += 20 + spacing + spacing;
663
664
665 // ---------- Water -----------
666
667- new UI::Callback_Button
668+ UI::Button * waterupbtn = new UI::Button
669 (this, "water_up",
670 posx, posy, 20, 20,
671 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
672- g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
673- boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), WATER_PLUS));
674+ g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"));
675+ waterupbtn->sigclicked.connect
676+ (boost::bind(&Main_Menu_New_Random_Map::button_clicked, this, WATER_PLUS));
677
678- new UI::Callback_Button
679+ UI::Button * waterdownbtn = new UI::Button
680 (this, "water_down",
681 get_inner_w() - spacing - 20, posy, 20, 20,
682 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
683- g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
684- boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), WATER_MINUS));
685+ g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"));
686+ waterdownbtn->sigclicked.connect
687+ (boost::bind(&Main_Menu_New_Random_Map::button_clicked, this, WATER_MINUS));
688
689 snprintf(buffer, sizeof(buffer), _("Water: %u %%"), m_waterval);
690 m_water = new UI::Textarea(this, posx + spacing + 20, posy, buffer);
691@@ -168,19 +174,21 @@
692
693 // ---------- Land -----------
694
695- new UI::Callback_Button
696+ UI::Button * landupbtn = new UI::Button
697 (this, "land_up",
698 posx, posy, 20, 20,
699 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
700- g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
701- boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), LAND_PLUS));
702+ g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"));
703+ landupbtn->sigclicked.connect
704+ (boost::bind(&Main_Menu_New_Random_Map::button_clicked, this, LAND_PLUS));
705
706- new UI::Callback_Button
707+ UI::Button * landdownbtn = new UI::Button
708 (this, "land_down",
709 get_inner_w() - spacing - 20, posy, 20, 20,
710 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
711- g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
712- boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), LAND_MINUS));
713+ g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"));
714+ landdownbtn->sigclicked.connect
715+ (boost::bind(&Main_Menu_New_Random_Map::button_clicked, this, LAND_MINUS));
716
717 snprintf
718 (buffer, sizeof(buffer), _("Land: %u %%"), m_landval);
719@@ -192,19 +200,21 @@
720
721 // ---------- Wasteland -----------
722
723- new UI::Callback_Button
724+ UI::Button * wastelandupbtn = new UI::Button
725 (this, "wasteland_up",
726 posx, posy, 20, 20,
727 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
728- g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
729- boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), WASTE_PLUS));
730+ g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"));
731+ wastelandupbtn->sigclicked.connect
732+ (boost::bind(&Main_Menu_New_Random_Map::button_clicked, this, WASTE_PLUS));
733
734- new UI::Callback_Button
735+ UI::Button * wastelanddownbtn = new UI::Button
736 (this, "wasteland_down",
737 get_inner_w() - spacing - 20, posy, 20, 20,
738 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
739- g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
740- boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), WASTE_MINUS));
741+ g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"));
742+ wastelanddownbtn->sigclicked.connect
743+ (boost::bind(&Main_Menu_New_Random_Map::button_clicked, this, WASTE_MINUS));
744
745 snprintf
746 (buffer, sizeof(buffer), _("Wasteland: %u %%"), m_wastelandval);
747@@ -230,9 +240,8 @@
748 Point pos(get_inner_w() - spacing - 20, posy);
749 m_island_mode = new UI::Checkbox(this, pos);
750 m_island_mode->set_state(true);
751- m_island_mode->set_id(SWITCH_ISLAND_MODE);
752- m_island_mode->changed.set
753- (this, & Main_Menu_New_Random_Map::nr_edit_box_changed);
754+ m_island_mode->changed.connect
755+ (boost::bind(&Main_Menu_New_Random_Map::button_clicked, this, SWITCH_ISLAND_MODE));
756
757 new UI::Textarea(this, posx, posy, _("Island mode:"));
758 posy += height + spacing;
759@@ -250,12 +259,12 @@
760
761 m_res_amount = 2;
762
763- m_res = new UI::Callback_Button
764+ m_res = new UI::Button
765 (this, "resources",
766 posx, posy, width, height,
767 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
768- boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), SWITCH_RES),
769 m_res_amounts[m_res_amount].c_str());
770+ m_res->sigclicked.connect(boost::bind(&Main_Menu_New_Random_Map::button_clicked, this, SWITCH_RES));
771
772 posy += height + spacing + spacing + spacing;
773
774@@ -269,12 +278,13 @@
775 while (strcmp(map.get_world_name(), m_worlds[m_currentworld].c_str()))
776 ++m_currentworld;
777
778- m_world = new UI::Callback_Button
779+ m_world = new UI::Button
780 (this, "world",
781 posx, posy, width, height,
782 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
783- boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), SWITCH_WORLD),
784 Widelands::World(m_worlds[m_currentworld].c_str()).get_name());
785+ m_world->sigclicked.connect
786+ (boost::bind(&Main_Menu_New_Random_Map::button_clicked, this, SWITCH_WORLD));
787
788 posy += height + spacing + spacing + spacing;
789
790@@ -290,29 +300,31 @@
791 (this,
792 posx, posy,
793 width, 20,
794- g_gr->get_picture(PicMod_UI, "pics/but1.png"), 0);
795+ g_gr->get_picture(PicMod_UI, "pics/but1.png"));
796 m_idEditbox->setText("abcd-efgh-ijkl-mnop");
797- m_idEditbox->changed.set
798- (this, & Main_Menu_New_Random_Map::id_edit_box_changed);
799+ m_idEditbox->changed.connect
800+ (boost::bind(&Main_Menu_New_Random_Map::id_edit_box_changed, this));
801 posy += height + spacing + spacing + spacing;
802
803
804
805 // ---------- Players -----------
806
807- new UI::Callback_Button
808+ UI::Button * playerupbtn = new UI::Button
809 (this, "player_up",
810 posx, posy, 20, 20,
811 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
812- g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
813- boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), PLAYER_PLUS));
814+ g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"));
815+ playerupbtn->sigclicked.connect
816+ (boost::bind(&Main_Menu_New_Random_Map::button_clicked, this, PLAYER_PLUS));
817
818- new UI::Callback_Button
819+ UI::Button * playerdownbtn = new UI::Button
820 (this, "player_down",
821 get_inner_w() - spacing - 20, posy, 20, 20,
822 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
823- g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
824- boost::bind(&Main_Menu_New_Random_Map::button_clicked, boost::ref(*this), PLAYER_MINUS));
825+ g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"));
826+ playerdownbtn->sigclicked.connect
827+ (boost::bind(&Main_Menu_New_Random_Map::button_clicked, this, PLAYER_MINUS));
828
829 snprintf(buffer, sizeof(buffer), _("Players: %u"), m_pn);
830 m_players = new UI::Textarea(this, posx + spacing + 20, posy, buffer);
831@@ -323,12 +335,12 @@
832
833 // ---------- "Generate Map" button ----------
834
835- m_goButton = new UI::Callback_Button
836+ m_goButton = new UI::Button
837 (this, "generate_map",
838 posx, posy, width, height,
839 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
840- boost::bind(&Main_Menu_New_Random_Map::clicked_create_map, boost::ref(*this)),
841 _("Generate Map"));
842+ m_goButton->sigclicked.connect(boost::bind(&Main_Menu_New_Random_Map::clicked_create_map, this));
843 posy += height + spacing;
844
845 set_inner_size(get_inner_w(), posy);
846
847=== modified file 'src/editor/ui_menus/editor_main_menu_random_map.h'
848--- src/editor/ui_menus/editor_main_menu_random_map.h 2010-11-05 19:36:57 +0000
849+++ src/editor/ui_menus/editor_main_menu_random_map.h 2011-11-26 13:22:27 +0000
850@@ -1,5 +1,5 @@
851 /*
852- * Copyright (C) 2002-2004, 2006-2009 by the Widelands Development Team
853+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
854 *
855 * This program is free software; you can redistribute it and/or
856 * modify it under the terms of the GNU General Public License
857@@ -65,10 +65,10 @@
858 private:
859 UI::Textarea * m_width, * m_height, * m_land;
860 UI::Textarea * m_water, * m_mountains, * m_wasteland, * m_players;
861- UI::Callback_Button * m_res;
862- UI::Callback_Button * m_world;
863+ UI::Button * m_res;
864+ UI::Button * m_world;
865 UI::Checkbox * m_island_mode;
866- UI::Callback_Button * m_goButton;
867+ UI::Button * m_goButton;
868 int32_t m_w, m_h, m_landval, m_waterval, m_wastelandval;
869 uint8_t m_pn;
870 uint32_t m_mapNumber;
871
872=== modified file 'src/editor/ui_menus/editor_main_menu_save_map.cc'
873--- src/editor/ui_menus/editor_main_menu_save_map.cc 2010-11-03 01:04:47 +0000
874+++ src/editor/ui_menus/editor_main_menu_save_map.cc 2011-11-26 13:22:27 +0000
875@@ -1,5 +1,5 @@
876 /*
877- * Copyright (C) 2002-2004, 2006-2010 by the Widelands Development Team
878+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
879 *
880 * This program is free software; you can redistribute it and/or
881 * modify it under the terms of the GNU General Public License
882@@ -65,17 +65,16 @@
883 (this,
884 posx, posy,
885 get_inner_w() / 2 - spacing, get_inner_h() - spacing - offsy - 60);
886- m_ls->clicked .set(this, &Main_Menu_Save_Map:: clicked_item);
887- m_ls->double_clicked.set(this, &Main_Menu_Save_Map::double_clicked_item);
888+ m_ls->clicked.connect(boost::bind(&Main_Menu_Save_Map::clicked_item, this, _1));
889+ m_ls->double_clicked.connect(boost::bind(&Main_Menu_Save_Map::double_clicked_item, this, _1));
890 m_editbox =
891 new UI::EditBox
892 (this,
893 posx, posy + get_inner_h() - spacing - offsy - 60 + 3,
894 get_inner_w() / 2 - spacing, 20,
895- g_gr->get_picture(PicMod_UI, "pics/but1.png"),
896- 0);
897+ g_gr->get_picture(PicMod_UI, "pics/but1.png"));
898 m_editbox->setText(parent.egbase().map().get_name());
899- m_editbox->changed.set(this, &Main_Menu_Save_Map::edit_box_changed);
900+ m_editbox->changed.connect(boost::bind(&Main_Menu_Save_Map::edit_box_changed, this));
901
902 posx = get_inner_w() / 2 + spacing;
903 posy += 20;
904@@ -128,26 +127,27 @@
905 posx = 5;
906 posy = get_inner_h() - 30;
907
908- m_ok_btn = new UI::Callback_Button
909+ m_ok_btn = new UI::Button
910 (this, "ok",
911 get_inner_w() / 2 - spacing - 80, posy, 80, 20,
912 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
913- boost::bind(&Main_Menu_Save_Map::clicked_ok, boost::ref(*this)),
914 _("OK"));
915+ m_ok_btn->sigclicked.connect(boost::bind(&Main_Menu_Save_Map::clicked_ok, boost::ref(*this)));
916
917- new UI::Callback_Button
918+ UI::Button * cancelbtn = new UI::Button
919 (this, "cancel",
920 get_inner_w() / 2 + spacing, posy, 80, 20,
921 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
922- boost::bind(&Main_Menu_Save_Map::die, boost::ref(*this)),
923 _("Cancel"));
924+ cancelbtn->sigclicked.connect(boost::bind(&Main_Menu_Save_Map::die, boost::ref(*this)));
925
926- new UI::Callback_Button
927+ UI::Button * make_directorybtn = new UI::Button
928 (this, "make_directory",
929 spacing, posy, 120, 20,
930 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
931- boost::bind(&Main_Menu_Save_Map::clicked_make_directory, boost::ref(*this)),
932 _("Make Directory"));
933+ make_directorybtn->sigclicked.connect
934+ (boost::bind(&Main_Menu_Save_Map::clicked_make_directory, boost::ref(*this)));
935
936
937 m_basedir = "maps";
938
939=== modified file 'src/editor/ui_menus/editor_main_menu_save_map.h'
940--- src/editor/ui_menus/editor_main_menu_save_map.h 2010-10-17 19:42:01 +0000
941+++ src/editor/ui_menus/editor_main_menu_save_map.h 2011-11-26 13:22:27 +0000
942@@ -26,7 +26,7 @@
943
944 struct Editor_Interactive;
945 namespace UI {
946-struct Callback_Button;
947+struct Button;
948 struct EditBox;
949 template <typename T> struct Listselect;
950 struct Multiline_Textarea;
951@@ -54,7 +54,7 @@
952 UI::Textarea * m_name, * m_author, * m_size, * m_world, * m_nrplayers;
953 UI::Multiline_Textarea * m_descr;
954 UI::Listselect<const char *> * m_ls;
955- UI::Callback_Button * m_ok_btn;
956+ UI::Button * m_ok_btn;
957
958 std::string m_basedir;
959 std::string m_curdir;
960
961=== modified file 'src/editor/ui_menus/editor_main_menu_save_map_make_directory.cc'
962--- src/editor/ui_menus/editor_main_menu_save_map_make_directory.cc 2011-11-20 12:32:35 +0000
963+++ src/editor/ui_menus/editor_main_menu_save_map_make_directory.cc 2011-11-26 13:22:27 +0000
964@@ -42,29 +42,31 @@
965 m_edit =
966 new UI::EditBox
967 (this, spacing, posy, get_inner_w() - 2 * spacing, 20,
968- g_gr->get_picture(PicMod_UI, "pics/but1.png"), 0);
969+ g_gr->get_picture(PicMod_UI, "pics/but1.png"));
970 m_edit->setText(dirname);
971 m_dirname = dirname;
972- m_edit->changed.set(this, &Main_Menu_Save_Map_Make_Directory::edit_changed);
973+ m_edit->changed.connect(boost::bind(&Main_Menu_Save_Map_Make_Directory::edit_changed, this));
974
975 posy = get_inner_h() - 30;
976
977 m_ok_button = new
978- UI::Callback_Button
979+ UI::Button
980 (this, "ok",
981 get_inner_w() / 2 - spacing - 80, posy, 80, 20,
982 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
983- boost::bind(&Main_Menu_Save_Map_Make_Directory::end_modal, boost::ref(*this), 1),
984 _("OK"),
985 std::string(),
986 m_dirname.size());
987+ m_ok_button->sigclicked.connect
988+ (boost::bind(&Main_Menu_Save_Map_Make_Directory::end_modal, boost::ref(*this), 1));
989
990- new UI::Callback_Button
991+ UI::Button * cancelbtn = new UI::Button
992 (this, "cancel",
993 get_inner_w() / 2 + spacing, posy, 80, 20,
994 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
995- boost::bind(&Main_Menu_Save_Map_Make_Directory::end_modal, boost::ref(*this), 0),
996 _("Cancel"));
997+ cancelbtn->sigclicked.connect
998+ (boost::bind(&Main_Menu_Save_Map_Make_Directory::end_modal, boost::ref(*this), 0));
999
1000 center_to_parent();
1001 }
1002
1003=== modified file 'src/editor/ui_menus/editor_main_menu_save_map_make_directory.h'
1004--- src/editor/ui_menus/editor_main_menu_save_map_make_directory.h 2010-10-17 19:42:01 +0000
1005+++ src/editor/ui_menus/editor_main_menu_save_map_make_directory.h 2011-11-26 13:22:27 +0000
1006@@ -27,7 +27,7 @@
1007
1008 namespace UI {
1009 struct EditBox;
1010-struct Callback_Button;
1011+struct Button;
1012 }
1013
1014 /**
1015@@ -44,7 +44,7 @@
1016 private:
1017 std::string m_dirname;
1018 UI::EditBox * m_edit;
1019- UI::Callback_Button * m_ok_button;
1020+ UI::Button * m_ok_button;
1021 void edit_changed();
1022 };
1023
1024
1025=== modified file 'src/editor/ui_menus/editor_player_menu.cc'
1026--- src/editor/ui_menus/editor_player_menu.cc 2011-03-19 15:09:21 +0000
1027+++ src/editor/ui_menus/editor_player_menu.cc 2011-11-26 13:22:27 +0000
1028@@ -1,5 +1,5 @@
1029 /*
1030- * Copyright (C) 2002-2004, 2006-2010 by the Widelands Development Team
1031+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
1032 *
1033 * This program is free software; you can redistribute it and/or
1034 * modify it under the terms of the GNU General Public License
1035@@ -45,7 +45,6 @@
1036 5, 5, 20, 20,
1037 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
1038 g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
1039- boost::bind(&Editor_Player_Menu::clicked_add_player, boost::ref(*this)),
1040 _("Add player"),
1041 parent.egbase().map().get_nrplayers() < MAX_PLAYERS),
1042 m_remove_last_player
1043@@ -53,10 +52,13 @@
1044 get_inner_w() - 5 - 20, 5, 20, 20,
1045 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
1046 g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
1047- boost::bind(&Editor_Player_Menu::clicked_remove_last_player, boost::ref(*this)),
1048 _("Remove last player"),
1049 1 < parent.egbase().map().get_nrplayers())
1050 {
1051+ m_add_player.sigclicked.connect(boost::bind(&Editor_Player_Menu::clicked_add_player, boost::ref(*this)));
1052+ m_remove_last_player.sigclicked.connect
1053+ (boost::bind(&Editor_Player_Menu::clicked_remove_last_player, boost::ref(*this)));
1054+
1055 int32_t const spacing = 5;
1056 int32_t const width = 20;
1057 int32_t posy = 0;
1058@@ -138,21 +140,22 @@
1059 m_plr_names[p - 1] =
1060 new UI::EditBox
1061 (this, posx, posy, 140, size,
1062- g_gr->get_picture(PicMod_UI, "pics/but0.png"), p - 1);
1063- m_plr_names[p - 1]->changedid.set
1064- (this, &Editor_Player_Menu::name_changed);
1065+ g_gr->get_picture(PicMod_UI, "pics/but0.png"));
1066+ m_plr_names[p - 1]->changed.connect
1067+ (boost::bind(&Editor_Player_Menu::name_changed, this, p - 1));
1068 posx += 140 + spacing;
1069 m_plr_names[p - 1]->setText(map.get_scenario_player_name(p));
1070 }
1071
1072 if (!m_plr_set_tribes_buts[p - 1]) {
1073 m_plr_set_tribes_buts[p - 1] =
1074- new UI::Callback_Button
1075+ new UI::Button
1076 (this, "tribe",
1077 posx, posy, 140, size,
1078 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
1079- boost::bind(&Editor_Player_Menu::player_tribe_clicked, boost::ref(*this), p - 1),
1080 std::string());
1081+ m_plr_set_tribes_buts[p - 1]->sigclicked.connect
1082+ (boost::bind(&Editor_Player_Menu::player_tribe_clicked, boost::ref(*this), p - 1));
1083 posx += 140 + spacing;
1084 }
1085 if (map.get_scenario_player_tribe(p) != "<undefined>")
1086@@ -170,13 +173,14 @@
1087 // Set Starting pos button.
1088 if (!m_plr_set_pos_buts[p - 1]) {
1089 m_plr_set_pos_buts[p - 1] =
1090- new UI::Callback_Button
1091+ new UI::Button
1092 (this, "starting_pos",
1093 posx, posy, size, size,
1094 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
1095- g_gr->get_no_picture(), // set below
1096- boost::bind(&Editor_Player_Menu::set_starting_pos_clicked, boost::ref(*this), p),
1097+ g_gr->get_no_picture(),
1098 std::string());
1099+ m_plr_set_pos_buts[p - 1]->sigclicked.connect
1100+ (boost::bind(&Editor_Player_Menu::set_starting_pos_clicked, boost::ref(*this), p));
1101 posx += size + spacing;
1102 }
1103 char text[] = "pics/fsel_editor_set_player_00_pos.png";
1104
1105=== modified file 'src/editor/ui_menus/editor_player_menu.h'
1106--- src/editor/ui_menus/editor_player_menu.h 2010-10-17 19:42:01 +0000
1107+++ src/editor/ui_menus/editor_player_menu.h 2011-11-26 13:22:27 +0000
1108@@ -35,7 +35,7 @@
1109 namespace UI {
1110 struct Textarea;
1111 struct EditBox;
1112-struct Callback_Button;
1113+struct Button;
1114 }
1115
1116 struct Editor_Player_Menu : public UI::UniqueWindow {
1117@@ -47,9 +47,9 @@
1118 UI::UniqueWindow::Registry m_allow_buildings_menu;
1119 UI::Textarea * m_nr_of_players_ta;
1120 UI::EditBox * m_plr_names[MAX_PLAYERS];
1121- UI::Callback_Button
1122+ UI::Button
1123 m_add_player, m_remove_last_player;
1124- UI::Callback_Button
1125+ UI::Button
1126 * m_plr_make_infrastructure_buts[MAX_PLAYERS],
1127 * m_plr_set_pos_buts [MAX_PLAYERS],
1128 * m_plr_set_tribes_buts [MAX_PLAYERS];
1129
1130=== modified file 'src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc'
1131--- src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc 2010-10-17 19:32:07 +0000
1132+++ src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc 2011-11-26 13:22:27 +0000
1133@@ -1,5 +1,5 @@
1134 /*
1135- * Copyright (C) 2002-2004, 2006-2008, 2010 by the Widelands Development Team
1136+ * Copyright (C) 2002-2004, 2006-2008, 2010-2011 by the Widelands Development Team
1137 *
1138 * This program is free software; you can redistribute it and/or
1139 * modify it under the terms of the GNU General Public License
1140@@ -80,7 +80,6 @@
1141 + (list_height - middle_button_height * 2 - vspacing) / 2,
1142 middle_button_width, middle_button_height,
1143 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
1144- boost::bind(&Editor_Player_Menu_Allowed_Buildings_Menu::clicked, boost::ref(*this), false),
1145 ("->"),
1146 _("Forbid"),
1147 false),
1148@@ -90,21 +89,23 @@
1149 m_forbid_button.get_y() + middle_button_height + vspacing,
1150 middle_button_width, middle_button_height,
1151 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
1152- boost::bind(&Editor_Player_Menu_Allowed_Buildings_Menu::clicked, boost::ref(*this), true),
1153 _("<-"),
1154 _("Allow"),
1155 false)
1156 {
1157- m_allowed.selected.set
1158- (this, &Editor_Player_Menu_Allowed_Buildings_Menu::allowed_selected);
1159- m_allowed.double_clicked.set
1160- (this,
1161- &Editor_Player_Menu_Allowed_Buildings_Menu::allowed_double_clicked);
1162- m_forbidden.selected.set
1163- (this, &Editor_Player_Menu_Allowed_Buildings_Menu::forbidden_selected);
1164- m_forbidden.double_clicked.set
1165- (this, &Editor_Player_Menu_Allowed_Buildings_Menu::
1166- forbidden_double_clicked);
1167+ m_forbid_button.sigclicked.connect
1168+ (boost::bind(&Editor_Player_Menu_Allowed_Buildings_Menu::clicked, boost::ref(*this), false));
1169+ m_allow_button.sigclicked.connect
1170+ (boost::bind(&Editor_Player_Menu_Allowed_Buildings_Menu::clicked, boost::ref(*this), true));
1171+
1172+ m_allowed.selected.connect
1173+ (boost::bind(&Editor_Player_Menu_Allowed_Buildings_Menu::allowed_selected, this, _1));
1174+ m_allowed.double_clicked.connect
1175+ (boost::bind(&Editor_Player_Menu_Allowed_Buildings_Menu::allowed_double_clicked, this, _1));
1176+ m_forbidden.selected.connect
1177+ (boost::bind(&Editor_Player_Menu_Allowed_Buildings_Menu::forbidden_selected, this, _1));
1178+ m_forbidden.double_clicked.connect
1179+ (boost::bind(&Editor_Player_Menu_Allowed_Buildings_Menu::forbidden_double_clicked, this, _1));
1180
1181 Widelands::Tribe_Descr const & tribe = player.tribe();
1182 Building_Index const nr_buildings = tribe.get_nrbuildings();
1183
1184=== modified file 'src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.h'
1185--- src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.h 2010-10-17 19:42:01 +0000
1186+++ src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.h 2011-11-26 13:22:27 +0000
1187@@ -43,7 +43,7 @@
1188 Widelands::Player & m_player;
1189 UI::Textarea m_allowed_label, m_forbidden_label;
1190 UI::Listselect<Widelands::Building_Index> m_allowed, m_forbidden;
1191- UI::Callback_Button m_forbid_button, m_allow_button;
1192+ UI::Button m_forbid_button, m_allow_button;
1193 void allowed_selected (uint32_t);
1194 void forbidden_selected (uint32_t);
1195 void allowed_double_clicked (uint32_t);
1196
1197=== modified file 'src/editor/ui_menus/editor_tool_change_height_options_menu.cc'
1198--- src/editor/ui_menus/editor_tool_change_height_options_menu.cc 2010-10-17 19:32:07 +0000
1199+++ src/editor/ui_menus/editor_tool_change_height_options_menu.cc 2011-11-26 13:22:27 +0000
1200@@ -50,7 +50,6 @@
1201 width, height,
1202 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
1203 g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
1204- boost::bind(&Editor_Tool_Change_Height_Options_Menu::clicked_change_by_increment, boost::ref(*this)),
1205 std::string(),
1206 increase_tool.get_change_by() < MAX_FIELD_HEIGHT_DIFF),
1207 m_change_by_decrease
1208@@ -59,7 +58,6 @@
1209 width, height,
1210 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
1211 g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
1212- boost::bind(&Editor_Tool_Change_Height_Options_Menu::clicked_change_by_decrement, boost::ref(*this)),
1213 std::string(),
1214 1 < increase_tool.get_change_by()),
1215 m_change_by_value
1216@@ -86,7 +84,6 @@
1217 width, height,
1218 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
1219 g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
1220- boost::bind(&Editor_Tool_Change_Height_Options_Menu::clicked_setto_increment, boost::ref(*this)),
1221 std::string(),
1222 increase_tool.set_tool().get_interval().min < MAX_FIELD_HEIGHT),
1223 m_set_to_decrease
1224@@ -94,7 +91,6 @@
1225 m_change_by_decrease.get_x(), m_set_to_increase.get_y(), width, height,
1226 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
1227 g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
1228- boost::bind(&Editor_Tool_Change_Height_Options_Menu::clicked_setto_decrement, boost::ref(*this)),
1229 std::string(),
1230 0 < increase_tool.set_tool().get_interval().min),
1231 m_set_to_value
1232@@ -103,6 +99,17 @@
1233 m_change_by_value.get_w(), height,
1234 UI::Align_BottomCenter)
1235 {
1236+ m_change_by_increase.sigclicked.connect
1237+ (boost::bind
1238+ (&Editor_Tool_Change_Height_Options_Menu::clicked_change_by_increment, boost::ref(*this)));
1239+ m_change_by_decrease.sigclicked.connect
1240+ (boost::bind
1241+ (&Editor_Tool_Change_Height_Options_Menu::clicked_change_by_decrement, boost::ref(*this)));
1242+ m_set_to_increase.sigclicked.connect
1243+ (boost::bind(&Editor_Tool_Change_Height_Options_Menu::clicked_setto_increment, boost::ref(*this)));
1244+ m_set_to_decrease.sigclicked.connect
1245+ (boost::bind(&Editor_Tool_Change_Height_Options_Menu::clicked_setto_decrement, boost::ref(*this)));
1246+
1247 m_change_by_increase.set_repeating(true);
1248 m_change_by_decrease.set_repeating(true);
1249 m_set_to_increase .set_repeating(true);
1250
1251=== modified file 'src/editor/ui_menus/editor_tool_change_height_options_menu.h'
1252--- src/editor/ui_menus/editor_tool_change_height_options_menu.h 2010-10-17 19:42:01 +0000
1253+++ src/editor/ui_menus/editor_tool_change_height_options_menu.h 2011-11-26 13:22:27 +0000
1254@@ -39,10 +39,10 @@
1255 private:
1256 Editor_Increase_Height_Tool & m_increase_tool;
1257 UI::Textarea m_change_by_label;
1258- UI::Callback_Button m_change_by_increase, m_change_by_decrease;
1259+ UI::Button m_change_by_increase, m_change_by_decrease;
1260 UI::Textarea m_change_by_value;
1261 UI::Textarea m_set_to_label;
1262- UI::Callback_Button m_set_to_increase, m_set_to_decrease;
1263+ UI::Button m_set_to_increase, m_set_to_decrease;
1264 UI::Textarea m_set_to_value;
1265
1266 void clicked_change_by_decrement();
1267
1268=== modified file 'src/editor/ui_menus/editor_tool_change_resources_options_menu.cc'
1269--- src/editor/ui_menus/editor_tool_change_resources_options_menu.cc 2010-11-06 16:31:40 +0000
1270+++ src/editor/ui_menus/editor_tool_change_resources_options_menu.cc 2011-11-26 13:22:27 +0000
1271@@ -1,5 +1,5 @@
1272 /*
1273- * Copyright (C) 2002-2004, 2006-2009 by the Widelands Development Team
1274+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
1275 *
1276 * This program is free software; you can redistribute it and/or
1277 * modify it under the terms of the GNU General Public License
1278@@ -52,21 +52,13 @@
1279 m_change_by_label.get_y() + m_change_by_label.get_h() + spacing(),
1280 width, height,
1281 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
1282- g_gr->get_picture(PicMod_Game, "pics/scrollbar_up.png"),
1283- boost::bind
1284- (&Editor_Tool_Change_Resources_Options_Menu::clicked_button,
1285- boost::ref(*this),
1286- Change_By_Increase)),
1287+ g_gr->get_picture(PicMod_Game, "pics/scrollbar_up.png")),
1288 m_change_by_decrease
1289 (this, "decr_change_by",
1290 get_inner_w() - hmargin() - width, m_change_by_increase.get_y(),
1291 width, height,
1292 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
1293- g_gr->get_picture(PicMod_Game, "pics/scrollbar_down.png"),
1294- boost::bind
1295- (&Editor_Tool_Change_Resources_Options_Menu::clicked_button,
1296- boost::ref(*this),
1297- Change_By_Decrease)),
1298+ g_gr->get_picture(PicMod_Game, "pics/scrollbar_down.png")),
1299 m_change_by_value
1300 (this,
1301 m_change_by_increase.get_x() + m_change_by_increase.get_w() +
1302@@ -89,20 +81,12 @@
1303 hmargin(), m_set_to_label.get_y() + m_set_to_label.get_h() + vspacing(),
1304 width, height,
1305 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
1306- g_gr->get_picture(PicMod_Game, "pics/scrollbar_up.png"),
1307- boost::bind
1308- (&Editor_Tool_Change_Resources_Options_Menu::clicked_button,
1309- boost::ref(*this),
1310- Set_To_Increase)),
1311+ g_gr->get_picture(PicMod_Game, "pics/scrollbar_up.png")),
1312 m_set_to_decrease
1313 (this, "decr_set_to",
1314 m_change_by_decrease.get_x(), m_set_to_increase.get_y(), width, height,
1315 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
1316- g_gr->get_picture(PicMod_Game, "pics/scrollbar_down.png"),
1317- boost::bind
1318- (&Editor_Tool_Change_Resources_Options_Menu::clicked_button,
1319- boost::ref(*this),
1320- Set_To_Decrease)),
1321+ g_gr->get_picture(PicMod_Game, "pics/scrollbar_down.png")),
1322 m_set_to_value
1323 (this,
1324 m_change_by_value.get_x(), m_set_to_increase.get_y(),
1325@@ -111,6 +95,27 @@
1326 m_cur_selection(this, 0, 0, _("Current Selection"), UI::Align_BottomCenter),
1327 m_increase_tool(increase_tool)
1328 {
1329+ m_change_by_increase.sigclicked.connect
1330+ (boost::bind
1331+ (&Editor_Tool_Change_Resources_Options_Menu::clicked_button,
1332+ boost::ref(*this),
1333+ Change_By_Increase));
1334+ m_change_by_decrease.sigclicked.connect
1335+ (boost::bind
1336+ (&Editor_Tool_Change_Resources_Options_Menu::clicked_button,
1337+ boost::ref(*this),
1338+ Change_By_Decrease));
1339+ m_set_to_increase.sigclicked.connect
1340+ (boost::bind
1341+ (&Editor_Tool_Change_Resources_Options_Menu::clicked_button,
1342+ boost::ref(*this),
1343+ Set_To_Increase));
1344+ m_set_to_decrease.sigclicked.connect
1345+ (boost::bind
1346+ (&Editor_Tool_Change_Resources_Options_Menu::clicked_button,
1347+ boost::ref(*this),
1348+ Set_To_Decrease));
1349+
1350 m_change_by_increase.set_repeating(true);
1351 m_change_by_decrease.set_repeating(true);
1352 m_set_to_increase .set_repeating(true);
1353@@ -136,10 +141,10 @@
1354 /
1355 (resource_pic_max_width + spacing());
1356
1357- m_radiogroup.changed.set
1358- (this, &Editor_Tool_Change_Resources_Options_Menu::selected);
1359- m_radiogroup.clicked.set
1360- (this, &Editor_Tool_Change_Resources_Options_Menu::selected);
1361+ m_radiogroup.changed.connect
1362+ (boost::bind(&Editor_Tool_Change_Resources_Options_Menu::selected, this));
1363+ m_radiogroup.clicked.connect
1364+ (boost::bind(&Editor_Tool_Change_Resources_Options_Menu::selected, this));
1365
1366 uint32_t cur_x = 0;
1367 Point pos
1368
1369=== modified file 'src/editor/ui_menus/editor_tool_change_resources_options_menu.h'
1370--- src/editor/ui_menus/editor_tool_change_resources_options_menu.h 2010-10-17 19:42:01 +0000
1371+++ src/editor/ui_menus/editor_tool_change_resources_options_menu.h 2011-11-26 13:22:27 +0000
1372@@ -46,10 +46,10 @@
1373 void clicked_button(Button);
1374 void update();
1375 UI::Textarea m_change_by_label;
1376- UI::Callback_Button m_change_by_increase, m_change_by_decrease;
1377+ UI::Button m_change_by_increase, m_change_by_decrease;
1378 UI::Textarea m_change_by_value;
1379 UI::Textarea m_set_to_label;
1380- UI::Callback_Button m_set_to_increase, m_set_to_decrease;
1381+ UI::Button m_set_to_increase, m_set_to_decrease;
1382 UI::Textarea m_set_to_value;
1383 UI::Textarea m_cur_selection;
1384 UI::Radiogroup m_radiogroup;
1385
1386=== modified file 'src/editor/ui_menus/editor_tool_menu.cc'
1387--- src/editor/ui_menus/editor_tool_menu.cc 2010-04-24 20:03:07 +0000
1388+++ src/editor/ui_menus/editor_tool_menu.cc 2011-11-26 13:22:27 +0000
1389@@ -1,5 +1,5 @@
1390 /*
1391- * Copyright (C) 2002-2004, 2006-2009 by the Widelands Development Team
1392+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
1393 *
1394 * This program is free software; you can redistribute it and/or
1395 * modify it under the terms of the GNU General Public License
1396@@ -84,8 +84,8 @@
1397 0);
1398 }
1399
1400- m_radioselect.changed.set(this, &Editor_Tool_Menu::changed_to);
1401- m_radioselect.clicked.set(this, &Editor_Tool_Menu::changed_to);
1402+ m_radioselect.changed.connect(boost::bind(&Editor_Tool_Menu::changed_to, this));
1403+ m_radioselect.clicked.connect(boost::bind(&Editor_Tool_Menu::changed_to, this));
1404
1405 if (get_usedefaultpos())
1406 center_to_parent();
1407
1408=== modified file 'src/editor/ui_menus/editor_tool_noise_height_options_menu.cc'
1409--- src/editor/ui_menus/editor_tool_noise_height_options_menu.cc 2010-11-01 15:03:31 +0000
1410+++ src/editor/ui_menus/editor_tool_noise_height_options_menu.cc 2011-11-26 13:22:27 +0000
1411@@ -59,7 +59,6 @@
1412 width, height,
1413 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
1414 g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
1415- boost::bind(&Editor_Tool_Noise_Height_Options_Menu::clicked_lower_increase, boost::ref(*this)),
1416 std::string(),
1417 noise_tool.get_interval().min < MAX_FIELD_HEIGHT),
1418 m_lower_decrease
1419@@ -69,7 +68,6 @@
1420 width, height,
1421 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
1422 g_gr->get_picture(PicMod_UI, "pics/scrollbar_down.png"),
1423- boost::bind(&Editor_Tool_Noise_Height_Options_Menu::clicked_lower_decrease, boost::ref(*this)),
1424 std::string(),
1425 0 < noise_tool.get_interval().min),
1426 m_upper_increase
1427@@ -82,7 +80,6 @@
1428 width, height,
1429 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
1430 g_gr->get_picture(PicMod_UI, "pics/scrollbar_up.png"),
1431- boost::bind(&Editor_Tool_Noise_Height_Options_Menu::clicked_upper_increase, boost::ref(*this)),
1432 std::string(),
1433 noise_tool.get_interval().max < MAX_FIELD_HEIGHT),
1434 m_upper_decrease
1435@@ -92,7 +89,6 @@
1436 width, height,
1437 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
1438 g_gr->get_picture(PicMod_Game, "pics/scrollbar_down.png"),
1439- boost::bind(&Editor_Tool_Noise_Height_Options_Menu::clicked_upper_decrease, boost::ref(*this)),
1440 std::string(),
1441 0 < noise_tool.get_interval().max),
1442 m_setto_increase
1443@@ -102,7 +98,6 @@
1444 width, height,
1445 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
1446 g_gr->get_picture(PicMod_Game, "pics/scrollbar_up.png"),
1447- boost::bind(&Editor_Tool_Noise_Height_Options_Menu::clicked_setto_increase, boost::ref(*this)),
1448 std::string(),
1449 noise_tool.set_tool().get_interval().max < MAX_FIELD_HEIGHT),
1450 m_setto_decrease
1451@@ -110,7 +105,6 @@
1452 get_inner_w() / 2, m_setto_increase.get_y(), width, height,
1453 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
1454 g_gr->get_picture(PicMod_Game, "pics/scrollbar_down.png"),
1455- boost::bind(&Editor_Tool_Noise_Height_Options_Menu::clicked_setto_decrease, boost::ref(*this)),
1456 std::string(),
1457 0 < noise_tool.set_tool().get_interval().min),
1458 m_set_label
1459@@ -120,6 +114,19 @@
1460 get_inner_w() - 2 * hspacing(), height,
1461 UI::Align_BottomCenter)
1462 {
1463+ m_lower_increase.sigclicked.connect
1464+ (boost::bind(&Editor_Tool_Noise_Height_Options_Menu::clicked_lower_increase, boost::ref(*this)));
1465+ m_lower_decrease.sigclicked.connect
1466+ (boost::bind(&Editor_Tool_Noise_Height_Options_Menu::clicked_lower_decrease, boost::ref(*this)));
1467+ m_upper_increase.sigclicked.connect
1468+ (boost::bind(&Editor_Tool_Noise_Height_Options_Menu::clicked_upper_increase, boost::ref(*this)));
1469+ m_upper_decrease.sigclicked.connect
1470+ (boost::bind(&Editor_Tool_Noise_Height_Options_Menu::clicked_upper_decrease, boost::ref(*this)));
1471+ m_setto_increase.sigclicked.connect
1472+ (boost::bind(&Editor_Tool_Noise_Height_Options_Menu::clicked_setto_increase, boost::ref(*this)));
1473+ m_setto_decrease.sigclicked.connect
1474+ (boost::bind(&Editor_Tool_Noise_Height_Options_Menu::clicked_setto_decrease, boost::ref(*this)));
1475+
1476 m_lower_increase.set_repeating(true);
1477 m_lower_decrease.set_repeating(true);
1478 m_upper_increase.set_repeating(true);
1479
1480=== modified file 'src/editor/ui_menus/editor_tool_noise_height_options_menu.h'
1481--- src/editor/ui_menus/editor_tool_noise_height_options_menu.h 2010-10-17 19:42:01 +0000
1482+++ src/editor/ui_menus/editor_tool_noise_height_options_menu.h 2011-11-26 13:22:27 +0000
1483@@ -37,7 +37,7 @@
1484 private:
1485 Editor_Noise_Height_Tool & m_noise_tool;
1486 UI::Textarea m_lower_label, m_upper_label;
1487- UI::Callback_Button
1488+ UI::Button
1489 m_lower_increase, m_lower_decrease, m_upper_increase, m_upper_decrease,
1490 m_setto_increase, m_setto_decrease;
1491 UI::Textarea m_set_label;
1492
1493=== modified file 'src/editor/ui_menus/editor_tool_place_bob_options_menu.cc'
1494--- src/editor/ui_menus/editor_tool_place_bob_options_menu.cc 2010-05-24 18:57:38 +0000
1495+++ src/editor/ui_menus/editor_tool_place_bob_options_menu.cc 2011-11-26 13:22:27 +0000
1496@@ -46,7 +46,8 @@
1497 Editor_Tool_Options_Menu(parent, registry, 100, 100, _("Bobs Menu")),
1498
1499 m_tabpanel (this, 0, 0, g_gr->get_picture(PicMod_UI, "pics/but1.png")),
1500-m_pit (pit)
1501+m_pit (pit),
1502+m_click_recursion_protect(false)
1503 {
1504 int32_t const space = 5;
1505 Widelands::World const & world = parent.egbase().map().world();
1506@@ -96,9 +97,8 @@
1507 critter_descr ? critter_descr->descname() : std::string());
1508
1509 cb.set_desired_size(width, height);
1510- cb.set_id(i);
1511 cb.set_state(m_pit.is_enabled(i));
1512- cb.changedtoid.set(this, &Editor_Tool_Place_Bob_Options_Menu::clicked);
1513+ cb.changedto.connect(boost::bind(&Editor_Tool_Place_Bob_Options_Menu::clicked, this, i, _1));
1514 m_checkboxes.push_back(&cb);
1515 box->add(&cb, UI::Align_Left);
1516 box->add_space(space);
1517@@ -117,6 +117,9 @@
1518 void Editor_Tool_Place_Bob_Options_Menu::clicked
1519 (int32_t const n, bool const t)
1520 {
1521+ if (m_click_recursion_protect)
1522+ return;
1523+
1524 // FIXME This code is erroneous. It checks the current key state. What it
1525 // FIXME needs is the key state at the time the mouse was clicked. See the
1526 // FIXME usage comment for get_key_state.
1527@@ -129,22 +132,14 @@
1528
1529 if (not multiselect) {
1530 for (uint32_t i = 0; m_pit.get_nr_enabled(); ++i) m_pit.enable(i, false);
1531+
1532 // disable all checkboxes
1533- // TODO The uint32_t cast is ugly!
1534- for
1535- (uint32_t i = 0;
1536- i < m_checkboxes.size();
1537- ++i, i += i == static_cast<uint32_t>(n))
1538- {
1539- m_checkboxes[i]->changedtoid.set
1540- (this,
1541- static_cast
1542- <void (Editor_Tool_Place_Bob_Options_Menu::*)(int32_t, bool)>
1543- (0));
1544+ m_click_recursion_protect = true;
1545+ for (uint32_t i = 0; i < m_checkboxes.size(); ++i) {
1546+ if (i != static_cast<uint32_t>(n))
1547 m_checkboxes[i]->set_state(false);
1548- m_checkboxes[i]->changedtoid.set
1549- (this, &Editor_Tool_Place_Bob_Options_Menu::clicked);
1550- }
1551+ }
1552+ m_click_recursion_protect = false;
1553 }
1554
1555 m_pit.enable(n, t);
1556
1557=== modified file 'src/editor/ui_menus/editor_tool_place_bob_options_menu.h'
1558--- src/editor/ui_menus/editor_tool_place_bob_options_menu.h 2009-09-30 18:31:29 +0000
1559+++ src/editor/ui_menus/editor_tool_place_bob_options_menu.h 2011-11-26 13:22:27 +0000
1560@@ -1,5 +1,5 @@
1561 /*
1562- * Copyright (C) 2002-2004, 2006-2008 by the Widelands Development Team
1563+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
1564 *
1565 * This program is free software; you can redistribute it and/or
1566 * modify it under the terms of the GNU General Public License
1567@@ -40,6 +40,7 @@
1568 std::vector<UI::Checkbox *> m_checkboxes;
1569 Editor_Place_Bob_Tool & m_pit;
1570 void clicked(int32_t, bool);
1571+ bool m_click_recursion_protect;
1572 };
1573
1574 #endif
1575
1576=== modified file 'src/editor/ui_menus/editor_tool_place_immovable_options_menu.cc'
1577--- src/editor/ui_menus/editor_tool_place_immovable_options_menu.cc 2010-11-01 22:30:23 +0000
1578+++ src/editor/ui_menus/editor_tool_place_immovable_options_menu.cc 2011-11-26 13:22:27 +0000
1579@@ -44,7 +44,8 @@
1580 :
1581 Editor_Tool_Options_Menu(parent, registry, 100, 100, _("Immovable Bobs Menu")),
1582 m_tabpanel(this, 0, 0, g_gr->get_picture(PicMod_UI, "pics/but1.png")),
1583-m_pit (pit)
1584+m_pit (pit),
1585+m_click_recursion_protect(false)
1586 {
1587 int32_t const space = 5;
1588 Widelands::World const & world = parent.egbase().map().world();
1589@@ -94,10 +95,9 @@
1590 (PicMod_Game, world.get_immovable_descr(i)->get_picture()));
1591
1592 cb.set_desired_size(width, height);
1593- cb.set_id(i);
1594 cb.set_state(m_pit.is_enabled(i));
1595- cb.changedtoid.set
1596- (this, &Editor_Tool_Place_Immovable_Options_Menu::clicked);
1597+ cb.changedto.connect
1598+ (boost::bind(&Editor_Tool_Place_Immovable_Options_Menu::clicked, this, i, _1));
1599 m_checkboxes.push_back(&cb);
1600 box->add(&cb, UI::Align_Left);
1601 box->add_space(space);
1602@@ -118,7 +118,11 @@
1603 /**
1604 * Called when one of the state boxes is toggled
1605 */
1606-void Editor_Tool_Place_Immovable_Options_Menu::clicked(int32_t n, bool t) {
1607+void Editor_Tool_Place_Immovable_Options_Menu::clicked(int32_t n, bool t)
1608+{
1609+ if (m_click_recursion_protect)
1610+ return;
1611+
1612 // FIXME This code is erroneous. It checks the current key state. What it
1613 // FIXME needs is the key state at the time the mouse was clicked. See the
1614 // FIXME usage comment for get_key_state.
1615@@ -131,20 +135,13 @@
1616 for (uint32_t i = 0; m_pit.get_nr_enabled(); ++i)
1617 m_pit.enable(i, false);
1618 // Disable all checkboxes
1619- const uint32_t size = m_checkboxes.size();
1620- //TODO: the uint32_t cast is ugly!
1621- for (uint32_t i = 0; i < size; ++i, i += i == static_cast<uint32_t>(n))
1622- {
1623- m_checkboxes[i]->changedtoid.set
1624- (this,
1625- static_cast
1626- <void (Editor_Tool_Place_Immovable_Options_Menu::*)
1627- (int32_t, bool)>
1628- (0));
1629- m_checkboxes[i]->set_state(false);
1630- m_checkboxes[i]->changedtoid.set
1631- (this, &Editor_Tool_Place_Immovable_Options_Menu::clicked);
1632+ const int32_t size = m_checkboxes.size();
1633+ m_click_recursion_protect = true;
1634+ for (int32_t i = 0; i < size; ++i) {
1635+ if (i != n)
1636+ m_checkboxes[i]->set_state(false);
1637 }
1638+ m_click_recursion_protect = false;
1639 }
1640
1641 m_pit.enable(n, t);
1642
1643=== modified file 'src/editor/ui_menus/editor_tool_place_immovable_options_menu.h'
1644--- src/editor/ui_menus/editor_tool_place_immovable_options_menu.h 2010-03-30 00:28:31 +0000
1645+++ src/editor/ui_menus/editor_tool_place_immovable_options_menu.h 2011-11-26 13:22:27 +0000
1646@@ -1,5 +1,5 @@
1647 /*
1648- * Copyright (C) 2002-2004, 2006-2008, 2010 by the Widelands Development Team
1649+ * Copyright (C) 2002-2004, 2006-2008, 2010-2011 by the Widelands Development Team
1650 *
1651 * This program is free software; you can redistribute it and/or
1652 * modify it under the terms of the GNU General Public License
1653@@ -44,6 +44,7 @@
1654 UI::Tab_Panel m_tabpanel;
1655 Editor_Place_Immovable_Tool & m_pit;
1656 void clicked(int32_t, bool);
1657+ bool m_click_recursion_protect;
1658 };
1659
1660 #endif
1661
1662=== modified file 'src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc'
1663--- src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc 2010-11-27 13:30:37 +0000
1664+++ src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc 2011-11-26 13:22:27 +0000
1665@@ -1,5 +1,5 @@
1666 /*
1667- * Copyright (C) 2002-2004, 2006-2009 by the Widelands Development Team
1668+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
1669 *
1670 * This program is free software; you can redistribute it and/or
1671 * modify it under the terms of the GNU General Public License
1672@@ -45,7 +45,8 @@
1673 :
1674 Editor_Tool_Options_Menu(parent, registry, 0, 0, _("Terrain Select")),
1675 m_cur_selection (this, 0, 0, 0, 20, UI::Align_Center),
1676- m_tool (tool)
1677+ m_tool (tool),
1678+ m_select_recursion_protect(false)
1679 {
1680 Widelands::World & world = parent.egbase().map().world();
1681 Widelands::Terrain_Index const nr_terrains = world.get_nr_terrains();
1682@@ -155,10 +156,9 @@
1683
1684 UI::Checkbox & cb = *new UI::Checkbox(this, pos, picture);
1685 cb.set_size(TEXTURE_WIDTH + 1, TEXTURE_HEIGHT + 1);
1686- cb.set_id(i);
1687 cb.set_state(m_tool.is_enabled(i));
1688- cb.changedtoid.set
1689- (this, &Editor_Tool_Set_Terrain_Options_Menu::selected);
1690+ cb.changedto.connect
1691+ (boost::bind(&Editor_Tool_Set_Terrain_Options_Menu::selected, this, i, _1));
1692 m_checkboxes[i] = &cb;
1693
1694 pos.x += TEXTURE_WIDTH + hspacing();
1695@@ -193,6 +193,9 @@
1696 void Editor_Tool_Set_Terrain_Options_Menu::selected
1697 (int32_t const n, bool const t)
1698 {
1699+ if (m_select_recursion_protect)
1700+ return;
1701+
1702 // FIXME This code is erroneous. It checks the current key state. What it
1703 // FIXME needs is the key state at the time the mouse was clicked. See the
1704 // FIXME usage comment for get_key_state.
1705@@ -205,22 +208,13 @@
1706 for (uint32_t i = 0; m_tool.get_nr_enabled(); ++i)
1707 m_tool.enable(i, false);
1708 // disable all checkboxes
1709- const uint32_t size = m_checkboxes.size();
1710- //TODO: the uint32_t cast is ugly!
1711- for
1712- (uint32_t i = 0; i < size;
1713- ++i, i += i == static_cast<uint32_t>(n))
1714- {
1715- m_checkboxes[i]->changedtoid.set
1716- (this,
1717- static_cast
1718- <void (Editor_Tool_Set_Terrain_Options_Menu::*)
1719- (int32_t, bool)>
1720- (0));
1721- m_checkboxes[i]->set_state(false);
1722- m_checkboxes[i]->changedtoid.set
1723- (this, &Editor_Tool_Set_Terrain_Options_Menu::selected);
1724+ m_select_recursion_protect = true;
1725+ const int32_t size = m_checkboxes.size();
1726+ for (int32_t i = 0; i < size; ++i) {
1727+ if (i != n)
1728+ m_checkboxes[i]->set_state(false);
1729 }
1730+ m_select_recursion_protect = false;
1731 }
1732
1733 m_tool.enable(n, t);
1734
1735=== modified file 'src/editor/ui_menus/editor_tool_set_terrain_options_menu.h'
1736--- src/editor/ui_menus/editor_tool_set_terrain_options_menu.h 2009-12-10 21:52:37 +0000
1737+++ src/editor/ui_menus/editor_tool_set_terrain_options_menu.h 2011-11-26 13:22:27 +0000
1738@@ -1,5 +1,5 @@
1739 /*
1740- * Copyright (C) 2002-2004, 2006-2009 by the Widelands Development Team
1741+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
1742 *
1743 * This program is free software; you can redistribute it and/or
1744 * modify it under the terms of the GNU General Public License
1745@@ -43,6 +43,7 @@
1746 Editor_Set_Terrain_Tool & m_tool;
1747 void selected(int32_t, bool);
1748 std::vector<UI::Checkbox *> m_checkboxes;
1749+ bool m_select_recursion_protect;
1750 };
1751
1752
1753
1754=== modified file 'src/editor/ui_menus/editor_toolsize_menu.cc'
1755--- src/editor/ui_menus/editor_toolsize_menu.cc 2010-10-17 19:32:07 +0000
1756+++ src/editor/ui_menus/editor_toolsize_menu.cc 2011-11-26 13:22:27 +0000
1757@@ -44,7 +44,6 @@
1758 60, 25, 20, 20,
1759 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
1760 g_gr->get_picture(PicMod_Game, "pics/scrollbar_up.png"),
1761- boost::bind(&Editor_Toolsize_Menu::increase_radius, boost::ref(*this)),
1762 std::string(),
1763 parent.get_sel_radius() < MAX_TOOL_AREA),
1764 m_decrease
1765@@ -52,10 +51,12 @@
1766 80, 25, 20, 20,
1767 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
1768 g_gr->get_picture(PicMod_Game, "pics/scrollbar_down.png"),
1769- boost::bind(&Editor_Toolsize_Menu::decrease_radius, boost::ref(*this)),
1770 std::string(),
1771 0 < parent.get_sel_radius())
1772 {
1773+ m_increase.sigclicked.connect(boost::bind(&Editor_Toolsize_Menu::increase_radius, boost::ref(*this)));
1774+ m_decrease.sigclicked.connect(boost::bind(&Editor_Toolsize_Menu::decrease_radius, boost::ref(*this)));
1775+
1776 m_increase.set_repeating(true);
1777 m_decrease.set_repeating(true);
1778 update(parent.get_sel_radius());
1779
1780=== modified file 'src/editor/ui_menus/editor_toolsize_menu.h'
1781--- src/editor/ui_menus/editor_toolsize_menu.h 2010-10-17 19:42:01 +0000
1782+++ src/editor/ui_menus/editor_toolsize_menu.h 2011-11-26 13:22:27 +0000
1783@@ -39,7 +39,7 @@
1784 void increase_radius();
1785
1786 UI::Textarea m_textarea;
1787- UI::Callback_Button m_increase, m_decrease;
1788+ UI::Button m_increase, m_decrease;
1789 };
1790
1791
1792
1793=== modified file 'src/logic/constructionsite.cc'
1794--- src/logic/constructionsite.cc 2011-11-06 14:51:46 +0000
1795+++ src/logic/constructionsite.cc 2011-11-26 13:22:27 +0000
1796@@ -24,7 +24,6 @@
1797 #include "upcast.h"
1798 #include "wexception.h"
1799
1800-#include "ui_basic/object.h" //only needed for i18n function _()
1801 #include "graphic/animation.h"
1802 #include "economy/wares_queue.h"
1803 #include "game.h"
1804
1805=== modified file 'src/logic/dismantlesite.cc'
1806--- src/logic/dismantlesite.cc 2011-11-06 23:12:36 +0000
1807+++ src/logic/dismantlesite.cc 2011-11-26 13:22:27 +0000
1808@@ -31,7 +31,6 @@
1809 #include "i18n.h"
1810 #include "sound/sound_handler.h"
1811 #include "tribe.h"
1812-#include "ui_basic/object.h" //only needed for i18n function _()
1813 #include "worker.h"
1814
1815 #include "dismantlesite.h"
1816
1817=== modified file 'src/network/nethost.cc'
1818--- src/network/nethost.cc 2011-11-07 21:55:54 +0000
1819+++ src/network/nethost.cc 2011-11-26 13:22:27 +0000
1820@@ -2627,7 +2627,7 @@
1821 ++part;
1822 if (part % 100 == 0)
1823 sendSystemChat
1824- (_("Sending part %u/%lu of file %s to %s"),
1825+ (_("Sending part %u/%zu of file %s to %s"),
1826 part, file->parts.size() + 1,
1827 file->filename.c_str(),
1828 d->settings.users.at(client.usernum).name.c_str());
1829
1830=== modified file 'src/scripting/lua_ui.cc'
1831--- src/scripting/lua_ui.cc 2011-11-20 17:06:28 +0000
1832+++ src/scripting/lua_ui.cc 2011-11-26 13:22:27 +0000
1833@@ -1,5 +1,5 @@
1834 /*
1835- * Copyright (C) 2006-2010 by the Widelands Development Team
1836+ * Copyright (C) 2006-2011 by the Widelands Development Team
1837 *
1838 * This program is free software; you can redistribute it and/or
1839 * modify it under the terms of the GNU General Public License
1840@@ -632,7 +632,7 @@
1841 int L_MapView::click(lua_State * L) {
1842 get()->warp_mouse_to_node
1843 ((*get_user_class<LuaMap::L_Field>(L, 2))->coords());
1844- get()->fieldclicked.call();
1845+ get()->fieldclicked();
1846 return 0;
1847 }
1848
1849
1850=== modified file 'src/ui_basic/box.cc'
1851--- src/ui_basic/box.cc 2011-11-09 20:16:07 +0000
1852+++ src/ui_basic/box.cc 2011-11-26 13:22:27 +0000
1853@@ -25,6 +25,7 @@
1854 #include "scrollbar.h"
1855
1856 #include <algorithm>
1857+#include <boost/bind.hpp>
1858
1859 namespace UI {
1860 /**
1861@@ -177,7 +178,7 @@
1862 m_scrollbar = new Scrollbar
1863 (this, sb_x, sb_y, sb_w,
1864 sb_h, m_orientation == Horizontal);
1865- m_scrollbar->moved.set(this, &Box::scrollbar_moved);
1866+ m_scrollbar->moved.connect(boost::bind(&Box::scrollbar_moved, this, _1));
1867 } else {
1868 m_scrollbar->set_pos(Point(sb_x, sb_y));
1869 m_scrollbar->set_size(sb_w, sb_h);
1870
1871=== modified file 'src/ui_basic/button.cc'
1872--- src/ui_basic/button.cc 2011-09-28 09:00:23 +0000
1873+++ src/ui_basic/button.cc 2011-11-26 13:22:27 +0000
1874@@ -1,5 +1,5 @@
1875 /*
1876- * Copyright (C) 2002, 2006-2010 by the Widelands Development Team
1877+ * Copyright (C) 2002, 2006-2011 by the Widelands Development Team
1878 *
1879 * This program is free software; you can redistribute it and/or
1880 * modify it under the terms of the GNU General Public License
1881@@ -267,6 +267,7 @@
1882 if (m_time_nextact < time)
1883 m_time_nextact = time;
1884 play_click();
1885+ sigclicked();
1886 clicked();
1887 // The button may not exist at this point (for example if the button
1888 // closed the dialog that it is part of). So member variables may no
1889@@ -322,6 +323,7 @@
1890 update();
1891 if (m_highlighted && m_enabled) {
1892 play_click();
1893+ sigclicked();
1894 clicked();
1895 // The button may not exist at this point (for example if the button
1896 // closed the dialog that it is part of). So member variables may no
1897
1898=== modified file 'src/ui_basic/button.h'
1899--- src/ui_basic/button.h 2011-11-05 21:32:08 +0000
1900+++ src/ui_basic/button.h 2011-11-26 13:22:27 +0000
1901@@ -1,5 +1,5 @@
1902 /*
1903- * Copyright (C) 2002, 2006, 2008-2010 by the Widelands Development Team
1904+ * Copyright (C) 2002, 2006, 2008-2011 by the Widelands Development Team
1905 *
1906 * This program is free software; you can redistribute it and/or
1907 * modify it under the terms of the GNU General Public License
1908@@ -22,10 +22,10 @@
1909
1910 #include <boost/bind.hpp>
1911 #include <boost/function.hpp>
1912+#include <boost/signal.hpp>
1913
1914 #include "constants.h"
1915 #include "panel.h"
1916-#include "m_signal.h"
1917
1918 #include "rgbcolor.h"
1919
1920@@ -86,8 +86,10 @@
1921 // If no background is drawn, the button is drawn over the current background
1922 void set_draw_flat_background(bool set);
1923
1924+ boost::signal<void ()> sigclicked;
1925+
1926 protected:
1927- virtual void clicked() = 0; /// Override this to react on the click.
1928+ virtual void clicked() {} /// Override this to react on the click.
1929
1930 bool m_highlighted; // mouse is over the button
1931 bool m_pressed; // mouse is clicked over the button
1932@@ -110,55 +112,6 @@
1933 bool m_draw_caret;
1934 };
1935
1936-
1937-/// A verion of Button that uses a function object for the callback.
1938-struct Callback_Button : public Button {
1939- Callback_Button /// for textual buttons
1940- (Panel * const parent,
1941- std::string const & name,
1942- const int32_t x, const int32_t y, const uint32_t w, const uint32_t h,
1943- const PictureID background_pictute_id,
1944- boost::function<void()> callback_function,
1945- const std::string & title_text,
1946- std::string const & tooltip_text = std::string(),
1947- bool const _enabled = true,
1948- bool const flat = false)
1949- :
1950- Button
1951- (parent, name,
1952- x, y, w, h,
1953- background_pictute_id,
1954- title_text,
1955- tooltip_text,
1956- _enabled, flat),
1957- _callback_function (callback_function)
1958- {}
1959- Callback_Button /// for pictorial buttons
1960- (Panel * const parent,
1961- std::string const & name,
1962- const int32_t x, const int32_t y, const uint32_t w, const uint32_t h,
1963- const PictureID background_pictute_id,
1964- const PictureID foreground_picture_id,
1965- boost::function<void()> callback_function,
1966- std::string const & tooltip_text = std::string(),
1967- bool const _enabled = true,
1968- bool const flat = false)
1969- :
1970- Button
1971- (parent, name,
1972- x, y, w, h,
1973- background_pictute_id,
1974- foreground_picture_id,
1975- tooltip_text,
1976- _enabled, flat),
1977- _callback_function (callback_function)
1978- {}
1979-
1980-protected:
1981- boost::function<void()> _callback_function;
1982- void clicked() {_callback_function();}
1983-};
1984-
1985-}
1986+} // namespace UI
1987
1988 #endif
1989
1990=== modified file 'src/ui_basic/checkbox.cc'
1991--- src/ui_basic/checkbox.cc 2011-11-06 12:22:20 +0000
1992+++ src/ui_basic/checkbox.cc 2011-11-26 13:22:27 +0000
1993@@ -1,5 +1,5 @@
1994 /*
1995- * Copyright (C) 2002, 2006-2010 by the Widelands Development Team
1996+ * Copyright (C) 2002, 2006-2011 by the Widelands Development Team
1997 *
1998 * This program is free software; you can redistribute it and/or
1999 * modify it under the terms of the GNU General Public License
2000@@ -50,8 +50,6 @@
2001 } else
2002 m_pic_graphics =
2003 g_gr->get_picture(PicMod_UI, "pics/checkbox_light_new.png");
2004-
2005- m_id = -1;
2006 }
2007
2008
2009@@ -93,9 +91,8 @@
2010 void Statebox::set_state(bool const on) {
2011 if (on xor ((m_flags & Is_Checked) > 1)) {
2012 set_flags(Is_Checked, on);
2013- changed .call ();
2014- changedto .call (on);
2015- changedtoid.call(m_id, on);
2016+ changed();
2017+ changedto(on);
2018 update();
2019 }
2020 }
2021@@ -168,7 +165,7 @@
2022 */
2023 void Checkbox::clicked()
2024 {
2025- clickedto.call(!get_state());
2026+ clickedto(!get_state());
2027 set_state(!get_state());
2028 play_click();
2029 }
2030
2031=== modified file 'src/ui_basic/checkbox.h'
2032--- src/ui_basic/checkbox.h 2009-09-30 18:31:29 +0000
2033+++ src/ui_basic/checkbox.h 2011-11-26 13:22:27 +0000
2034@@ -1,5 +1,5 @@
2035 /*
2036- * Copyright (C) 2004, 2006, 2008 by the Widelands Development Team
2037+ * Copyright (C) 2004, 2006, 2008-2011 by the Widelands Development Team
2038 *
2039 * This program is free software; you can redistribute it and/or
2040 * modify it under the terms of the GNU General Public License
2041@@ -20,8 +20,9 @@
2042 #ifndef UI_CHECKBOX_H
2043 #define UI_CHECKBOX_H
2044
2045+#include <boost/signals.hpp>
2046+
2047 #include "panel.h"
2048-#include "m_signal.h"
2049
2050 #include "rgbcolor.h"
2051
2052@@ -42,17 +43,15 @@
2053 std::string const & tooltip_text = std::string());
2054 ~Statebox();
2055
2056- Signal changed;
2057- Signal1<bool> changedto;
2058- Signal1<bool> clickedto; // same as changedto but only called when clicked
2059- Signal2<int32_t, bool> changedtoid;
2060+ boost::signal<void ()> changed;
2061+ boost::signal<void (bool)> changedto;
2062+ boost::signal<void (bool)> clickedto; // same as changedto but only called when clicked
2063
2064 void set_enabled(bool enabled);
2065
2066 bool get_state() const throw () {return m_flags & Is_Checked;}
2067 void set_state(bool on);
2068
2069- void set_id(int32_t n) {m_id = n;}
2070 void set_owns_custom_picture() throw () {
2071 assert(m_flags & Has_Custom_Picture);
2072 set_flags(Owns_Custom_Picture, true);
2073@@ -68,7 +67,6 @@
2074 private:
2075 virtual void clicked() = 0;
2076
2077- int32_t m_id;
2078 enum Flags {
2079 Is_Highlighted = 0x01,
2080 Is_Enabled = 0x02,
2081
2082=== modified file 'src/ui_basic/editbox.cc'
2083--- src/ui_basic/editbox.cc 2011-10-23 16:18:19 +0000
2084+++ src/ui_basic/editbox.cc 2011-11-26 13:22:27 +0000
2085@@ -44,9 +44,6 @@
2086 /// Background tile style.
2087 PictureID background;
2088
2089- /// ID. Only used for the id-flavoured signals.
2090- int32_t id;
2091-
2092 /// Maximum number of characters in the input
2093 uint32_t maxLength;
2094
2095@@ -67,7 +64,6 @@
2096 (Panel * const parent,
2097 const int32_t x, const int32_t y, const uint32_t w, const uint32_t h,
2098 const PictureID & background,
2099- const int32_t id,
2100 Align _align)
2101 :
2102 Panel(parent, x, y, w, h),
2103@@ -82,7 +78,6 @@
2104 m->fontsize = UI_FONT_SIZE_SMALL;
2105 m->fontcolor = UI_FONT_CLR_FG;
2106
2107- m->id = id;
2108 m->align = static_cast<Align>((_align & Align_Horizontal) | Align_VCenter);
2109 m->caret = 0;
2110 m->scrolloffset = 0;
2111@@ -230,8 +225,7 @@
2112 if (down) {
2113 switch (code.sym) {
2114 case SDLK_ESCAPE:
2115- cancel.call();
2116- cancelid.call(m->id);
2117+ cancel();
2118 return true;
2119
2120 case SDLK_KP_ENTER:
2121@@ -245,8 +239,7 @@
2122 m_history_position = -1;
2123 }
2124 }
2125- ok.call();
2126- okid.call(m->id);
2127+ ok();
2128 return true;
2129
2130 case SDLK_KP_PERIOD:
2131@@ -267,8 +260,7 @@
2132 m->text.erase(m->text.begin() + m->caret);
2133 m->text.erase(m->text.begin() + m->caret);
2134 check_caret();
2135- changed.call();
2136- changedid.call(m->id);
2137+ changed();
2138 update();
2139 }
2140 return true;
2141@@ -419,8 +411,7 @@
2142 (m->text.begin() + m->caret++, ((code.unicode & 0x3f) | 0x80));
2143 }
2144 check_caret();
2145- changed.call();
2146- changedid.call(m->id);
2147+ changed();
2148 update();
2149 }
2150 }
2151
2152=== modified file 'src/ui_basic/editbox.h'
2153--- src/ui_basic/editbox.h 2011-10-23 16:18:19 +0000
2154+++ src/ui_basic/editbox.h 2011-11-26 13:22:27 +0000
2155@@ -24,6 +24,7 @@
2156 #include "button.h"
2157
2158 #include <boost/scoped_ptr.hpp>
2159+#include <boost/signal.hpp>
2160 #include <SDL_keyboard.h>
2161
2162 #define CHAT_HISTORY_SIZE 5
2163@@ -41,16 +42,12 @@
2164 int32_t x, int32_t y, uint32_t w, uint32_t h,
2165 PictureID const & background =
2166 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
2167- int32_t id = 0,
2168 Align align = Align_Center);
2169 virtual ~EditBox();
2170
2171- Signal changed;
2172- Signal1<int32_t> changedid;
2173- Signal ok;
2174- Signal1<int32_t> okid;
2175- Signal cancel;
2176- Signal1<int32_t> cancelid;
2177+ boost::signal<void ()> changed;
2178+ boost::signal<void ()> ok;
2179+ boost::signal<void ()> cancel;
2180
2181 std::string const & text() const;
2182 void setText(std::string const &);
2183
2184=== modified file 'src/ui_basic/helpwindow.cc'
2185--- src/ui_basic/helpwindow.cc 2011-11-15 16:11:23 +0000
2186+++ src/ui_basic/helpwindow.cc 2011-11-26 13:22:27 +0000
2187@@ -75,13 +75,13 @@
2188 set_inner_size(in_width, in_height);
2189 set_pos(Point((g_gr->get_xres() - out_width) / 2, (g_gr->get_yres() - out_height) / 2));
2190
2191- Button * btn = new Callback_Button
2192+ Button * btn = new Button
2193 (this, "ok",
2194 in_width / 3, in_height - but_height * 3 / 2,
2195 in_width / 3, but_height,
2196 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
2197- boost::bind(&HelpWindow::pressedOk, boost::ref(*this)),
2198 _("OK"), std::string(), true, false);
2199+ btn->sigclicked.connect(boost::bind(&HelpWindow::pressedOk, boost::ref(*this)));
2200 btn->set_font(Font::get(UI_FONT_NAME, (fontsize < 12 ? 12 : fontsize)));
2201
2202 textarea->set_size(in_width - 10, in_height - 10 - (2 * but_height));
2203
2204=== modified file 'src/ui_basic/icongrid.cc'
2205--- src/ui_basic/icongrid.cc 2010-11-01 23:54:06 +0000
2206+++ src/ui_basic/icongrid.cc 2011-11-26 13:22:27 +0000
2207@@ -1,5 +1,5 @@
2208 /*
2209- * Copyright (C) 2003, 2006-2010 by the Widelands Development Team
2210+ * Copyright (C) 2003, 2006-2011 by the Widelands Development Team
2211 *
2212 * This program is free software; you can redistribute it and/or
2213 * modify it under the terms of the GNU General Public License
2214@@ -30,22 +30,19 @@
2215
2216 namespace UI {
2217
2218-struct IconGridButton : public Callback_Button {
2219+struct IconGridButton : public Button {
2220 IconGridButton
2221 (Icon_Grid & parent,
2222 std::string const & name,
2223 const int32_t x, const int32_t y, const uint32_t w, const uint32_t h,
2224 const PictureID background_pictute_id,
2225 const PictureID foreground_picture_id,
2226- void (Icon_Grid::*callback_function)(uint32_t),
2227- Icon_Grid & callback_argument_this,
2228 const uint32_t callback_argument_id,
2229 Textarea & ta, std::string const & descr)
2230 :
2231- Callback_Button
2232+ Button
2233 (&parent, name, x, y, w, h, background_pictute_id,
2234 foreground_picture_id,
2235- boost::bind(callback_function, boost::ref(callback_argument_this), callback_argument_id),
2236 "", true, true),
2237 m_icongrid(parent), m_ta(ta), m_descr(descr),
2238 _callback_argument_id(callback_argument_id)
2239@@ -59,13 +56,13 @@
2240
2241 void handle_mousein(bool const inside) {
2242 if (inside) {
2243- m_icongrid.mousein.call(_callback_argument_id);
2244+ m_icongrid.mousein(_callback_argument_id);
2245 m_ta.set_text(m_descr);
2246 } else {
2247- m_icongrid.mouseout.call(_callback_argument_id);
2248+ m_icongrid.mouseout(_callback_argument_id);
2249 m_ta.set_text("");
2250 }
2251- Callback_Button::handle_mousein(inside);
2252+ Button::handle_mousein(inside);
2253 }
2254 };
2255
2256@@ -117,17 +114,18 @@
2257 uint32_t x = (idx % m_columns) * m_cell_width;
2258 uint32_t y = (idx / m_columns) * m_cell_height;
2259
2260- new IconGridButton
2261+ UI::Button * btn = new IconGridButton
2262 (*this, name,
2263 x, y, m_cell_width, m_cell_height,
2264 g_gr->get_no_picture(), picid,
2265- &Icon_Grid::clicked_button, *this, idx, m_ta, descr);
2266+ idx, m_ta, descr);
2267+ btn->sigclicked.connect(boost::bind(&Icon_Grid::clicked_button, this, idx));
2268
2269 return idx;
2270 }
2271
2272 void Icon_Grid::clicked_button(uint32_t idx) {
2273- clicked.call(idx);
2274+ clicked(idx);
2275 play_click();
2276 }
2277
2278
2279=== modified file 'src/ui_basic/icongrid.h'
2280--- src/ui_basic/icongrid.h 2010-11-01 23:54:06 +0000
2281+++ src/ui_basic/icongrid.h 2011-11-26 13:22:27 +0000
2282@@ -1,5 +1,5 @@
2283 /*
2284- * Copyright (C) 2003, 2006-2009 by the Widelands Development Team
2285+ * Copyright (C) 2003, 2006-2011 by the Widelands Development Team
2286 *
2287 * This program is free software; you can redistribute it and/or
2288 * modify it under the terms of the GNU General Public License
2289@@ -22,10 +22,11 @@
2290
2291 #include "panel.h"
2292 #include "textarea.h"
2293-#include "m_signal.h"
2294
2295 #include <vector>
2296
2297+#include <boost/signal.hpp>
2298+
2299 namespace UI {
2300
2301 /**
2302@@ -40,9 +41,9 @@
2303 int32_t x, int32_t y, int32_t cellw, int32_t cellh,
2304 int32_t cols);
2305
2306- Signal1<int32_t> clicked;
2307- Signal1<int32_t> mouseout;
2308- Signal1<int32_t> mousein;
2309+ boost::signal<void (int32_t)> clicked;
2310+ boost::signal<void (int32_t)> mouseout;
2311+ boost::signal<void (int32_t)> mousein;
2312
2313 int32_t add
2314 (std::string const & name,
2315
2316=== modified file 'src/ui_basic/listselect.cc'
2317--- src/ui_basic/listselect.cc 2011-10-23 16:52:10 +0000
2318+++ src/ui_basic/listselect.cc 2011-11-26 13:22:27 +0000
2319@@ -1,5 +1,5 @@
2320 /*
2321- * Copyright (C) 2002, 2006-2010 by the Widelands Development Team
2322+ * Copyright (C) 2002, 2006-2011 by the Widelands Development Team
2323 *
2324 * This program is free software; you can redistribute it and/or
2325 * modify it under the terms of the GNU General Public License
2326@@ -29,6 +29,7 @@
2327
2328 #include "container_iterate.h"
2329
2330+#include <boost/bind.hpp>
2331 #include <iostream>
2332
2333 namespace UI {
2334@@ -62,7 +63,7 @@
2335
2336 set_align(align);
2337
2338- m_scrollbar.moved.set(this, &BaseListselect::set_scrollpos);
2339+ m_scrollbar.moved.connect(boost::bind(&BaseListselect::set_scrollpos, this, _1));
2340 m_scrollbar.set_singlestepsize(g_fh->get_fontheight(m_fontname, m_fontsize));
2341 m_scrollbar.set_pagesize
2342 (h - 2 * g_fh->get_fontheight(m_fontname, m_fontsize));
2343@@ -202,10 +203,10 @@
2344
2345 if (m_selection == m) {
2346 m_selection = n;
2347- selected.call(n);
2348+ selected(n);
2349 } else if (m_selection == n) {
2350 m_selection = m;
2351- selected.call(m);
2352+ selected(m);
2353 }
2354 }
2355
2356@@ -289,7 +290,7 @@
2357 }
2358 m_selection = i;
2359
2360- selected.call(m_selection);
2361+ selected(m_selection);
2362 update(0, 0, get_eff_w(), get_h());
2363 }
2364
2365@@ -444,7 +445,7 @@
2366 return false;
2367 play_click();
2368 select(y);
2369- clicked.call(m_selection);
2370+ clicked(m_selection);
2371
2372 if // check if doubleclicked
2373 (time - real_last_click_time < DOUBLE_CLICK_INTERVAL
2374@@ -452,7 +453,7 @@
2375 m_last_selection == m_selection
2376 and
2377 m_selection != no_selection_index())
2378- double_clicked.call(m_selection);
2379+ double_clicked(m_selection);
2380
2381 return true;
2382 }
2383@@ -513,7 +514,7 @@
2384 delete (m_entry_records[i]);
2385 m_entry_records.erase(m_entry_records.begin() + i);
2386 if (m_selection == i)
2387- selected.call(m_selection = no_selection_index());
2388+ selected(m_selection = no_selection_index());
2389 else if (i < m_selection)
2390 --m_selection;
2391 }
2392
2393=== modified file 'src/ui_basic/listselect.h'
2394--- src/ui_basic/listselect.h 2011-10-23 16:52:10 +0000
2395+++ src/ui_basic/listselect.h 2011-11-26 13:22:27 +0000
2396@@ -1,5 +1,5 @@
2397 /*
2398- * Copyright (C) 2002, 2006, 2008-2010 by the Widelands Development Team
2399+ * Copyright (C) 2002, 2006, 2008-2011 by the Widelands Development Team
2400 *
2401 * This program is free software; you can redistribute it and/or
2402 * modify it under the terms of the GNU General Public License
2403@@ -21,10 +21,11 @@
2404 #ifndef UI_LISTSELECT_H
2405 #define UI_LISTSELECT_H
2406
2407+#include <boost/signal.hpp>
2408+
2409 #include "align.h"
2410 #include "panel.h"
2411 #include "scrollbar.h"
2412-#include "m_signal.h"
2413
2414 #include "compile_assert.h"
2415
2416@@ -51,9 +52,9 @@
2417 bool show_check = false);
2418 ~BaseListselect();
2419
2420- Signal1<uint32_t> selected;
2421- Signal1<uint32_t> clicked;
2422- Signal1<uint32_t> double_clicked;
2423+ boost::signal<void (uint32_t)> selected;
2424+ boost::signal<void (uint32_t)> clicked;
2425+ boost::signal<void (uint32_t)> double_clicked;
2426
2427 void clear();
2428 void sort
2429
2430=== removed file 'src/ui_basic/m_signal.h'
2431--- src/ui_basic/m_signal.h 2009-11-26 20:08:24 +0000
2432+++ src/ui_basic/m_signal.h 1970-01-01 00:00:00 +0000
2433@@ -1,97 +0,0 @@
2434-/*
2435- * Copyright (C) 2002, 2006, 2008-2009 by the Widelands Development Team
2436- *
2437- * This program is free software; you can redistribute it and/or
2438- * modify it under the terms of the GNU General Public License
2439- * as published by the Free Software Foundation; either version 2
2440- * of the License, or (at your option) any later version.
2441- *
2442- * This program is distributed in the hope that it will be useful,
2443- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2444- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2445- * GNU General Public License for more details.
2446- *
2447- * You should have received a copy of the GNU General Public License
2448- * along with this program; if not, write to the Free Software
2449- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2450- *
2451- */
2452-
2453-#ifndef UI_SIGNAL_H
2454-#define UI_SIGNAL_H
2455-
2456-#include "object.h"
2457-
2458-namespace UI {
2459-/**
2460- * Provides a hook for callback function.
2461- * This is exactly what register_func used to provide but for Panel
2462- * member functions and with better type checking.
2463- *
2464- * Use as:
2465- * Signal signal;
2466- * Signal1<int32_t> signal1;
2467- *
2468- * foo->signal.set(this, &MyClass::Handler);
2469- * signal.call();
2470- * signal1.call(some_int);
2471- */
2472-class Signal : public Object {
2473- typedef void (Object::*fnT)();
2474- Object * _obj;
2475- fnT _fn;
2476-public:
2477- Signal() {_obj = 0; _fn = 0;}
2478- template<class T> void set(Object * const p, void (T::*f)()) {
2479- _obj = p;
2480- _fn = static_cast<fnT>(f);
2481- }
2482- void unset() {
2483- _fn = 0;
2484- }
2485- void call() {if (_fn) (_obj->*_fn)();}
2486-};
2487-
2488-/**
2489- * See Signal
2490- */
2491-template<typename T1> struct Signal1 : public Object {
2492- Signal1() {_obj = 0; _fn = 0;}
2493- template<class T>
2494- void set(Object * const p, void (T::*f)(T1)) {
2495- _obj = p;
2496- _fn = static_cast<fnT>(f);
2497- }
2498- void unset() {
2499- _fn = 0;
2500- }
2501- void call(T1 t1) {if (_fn) (_obj->*_fn)(t1);}
2502-private:
2503- typedef void (Object::*fnT)(T1);
2504- Object * _obj;
2505- fnT _fn;
2506-};
2507-
2508-/**
2509- * See Signal
2510- */
2511-template<typename T1, typename T2> struct Signal2 : public Object {
2512- Signal2() {_obj = 0; _fn = 0;}
2513- template<class T>
2514- void set(Object * p, void (T::*f)(T1, T2)) {
2515- _obj = p;
2516- _fn = static_cast<fnT>(f);
2517- }
2518- void unset() {
2519- _fn = 0;
2520- }
2521- void call(T1 t1, T2 t2) {if (_fn) (_obj->*_fn)(t1, t2);}
2522-private:
2523- typedef void (Object::*fnT)(T1, T2);
2524- Object * _obj;
2525- fnT _fn;
2526-};
2527-
2528-}
2529-
2530-#endif
2531
2532=== modified file 'src/ui_basic/messagebox.cc'
2533--- src/ui_basic/messagebox.cc 2011-10-23 16:52:10 +0000
2534+++ src/ui_basic/messagebox.cc 2011-11-26 13:22:27 +0000
2535@@ -1,5 +1,5 @@
2536 /*
2537- * Copyright (C) 2002-2004, 2006-2008 by the Widelands Development Team
2538+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
2539 *
2540 * This program is free software; you can redistribute it and/or
2541 * modify it under the terms of the GNU General Public License
2542@@ -83,26 +83,26 @@
2543 d->textarea->set_size(width - 10, height - 50);
2544
2545 if (type == OK) {
2546- new Callback_Button
2547+ UI::Button * okbtn = new Button
2548 (this, "ok",
2549 (get_inner_w() - 60) / 2, get_inner_h() - 30, 60, 20,
2550 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
2551- boost::bind(&WLMessageBox::pressedOk, boost::ref(*this)),
2552 _("OK"));
2553+ okbtn->sigclicked.connect(boost::bind(&WLMessageBox::pressedOk, boost::ref(*this)));
2554 } else if (type == YESNO) {
2555- new Callback_Button
2556+ UI::Button * yesbtn = new Button
2557 (this, "yes",
2558 (get_inner_w() / 2 - 60) / 2, get_inner_h() - 30, 60, 20,
2559 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
2560- boost::bind(&WLMessageBox::pressedYes, boost::ref(*this)),
2561 _("Yes"));
2562- new Callback_Button
2563+ yesbtn->sigclicked.connect(boost::bind(&WLMessageBox::pressedYes, boost::ref(*this)));
2564+ UI::Button * nobtn = new Button
2565 (this, "no",
2566 (get_inner_w() / 2 - 60) / 2 + get_inner_w() / 2, get_inner_h() - 30,
2567 60, 20,
2568 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
2569- boost::bind(&WLMessageBox::pressedNo, boost::ref(*this)),
2570 _("No"));
2571+ nobtn->sigclicked.connect(boost::bind(&WLMessageBox::pressedNo, boost::ref(*this)));
2572 }
2573 }
2574
2575@@ -165,21 +165,21 @@
2576
2577 void WLMessageBox::pressedOk()
2578 {
2579- ok.call();
2580+ ok();
2581 if (is_modal())
2582 end_modal(0);
2583 }
2584
2585 void WLMessageBox::pressedYes()
2586 {
2587- yes.call();
2588+ yes();
2589 if (is_modal())
2590 end_modal(1);
2591 }
2592
2593 void WLMessageBox::pressedNo()
2594 {
2595- no.call();
2596+ no();
2597 if (is_modal())
2598 end_modal(0);
2599 }
2600
2601=== modified file 'src/ui_basic/messagebox.h'
2602--- src/ui_basic/messagebox.h 2011-10-23 16:52:10 +0000
2603+++ src/ui_basic/messagebox.h 2011-11-26 13:22:27 +0000
2604@@ -1,5 +1,5 @@
2605 /*
2606- * Copyright (C) 2002-2004, 2006, 2008-2009 by the Widelands Development Team
2607+ * Copyright (C) 2002-2004, 2006, 2008-2011 by the Widelands Development Team
2608 *
2609 * This program is free software; you can redistribute it and/or
2610 * modify it under the terms of the GNU General Public License
2611@@ -21,10 +21,10 @@
2612 #define UI_MESSAGEBOX_H
2613
2614 #include "align.h"
2615-#include "m_signal.h"
2616 #include "window.h"
2617
2618 #include <boost/scoped_ptr.hpp>
2619+#include <boost/signal.hpp>
2620
2621 namespace UI {
2622
2623@@ -61,9 +61,9 @@
2624 MB_Type);
2625 ~WLMessageBox();
2626
2627- Signal ok;
2628- Signal yes;
2629- Signal no;
2630+ boost::signal<void ()> ok;
2631+ boost::signal<void ()> yes;
2632+ boost::signal<void ()> no;
2633
2634 void set_align(Align);
2635
2636
2637=== modified file 'src/ui_basic/multilineeditbox.cc'
2638--- src/ui_basic/multilineeditbox.cc 2011-10-23 16:18:19 +0000
2639+++ src/ui_basic/multilineeditbox.cc 2011-11-26 13:22:27 +0000
2640@@ -19,6 +19,8 @@
2641
2642 #include "multilineeditbox.h"
2643
2644+#include <boost/bind.hpp>
2645+
2646 #include "scrollbar.h"
2647 #include "constants.h"
2648 #include "graphic/font_handler.h"
2649@@ -102,7 +104,7 @@
2650 ww_valid(false),
2651 owner(o)
2652 {
2653- scrollbar.moved.set(&o, &Multiline_Editbox::scrollpos_changed);
2654+ scrollbar.moved.connect(boost::bind(&Multiline_Editbox::scrollpos_changed, &o, _1));
2655
2656 scrollbar.set_pagesize(owner.get_h() - 2 * textstyle.font->height());
2657 scrollbar.set_singlestepsize(textstyle.font->height());
2658@@ -144,7 +146,7 @@
2659 d->update();
2660 d->scroll_cursor_into_view();
2661
2662- changed.call();
2663+ changed();
2664 }
2665
2666 /**
2667@@ -254,7 +256,7 @@
2668
2669 if (d->text.size() + utf8.size() <= d->maxbytes) {
2670 d->insert(d->cursor_pos, utf8);
2671- changed.call();
2672+ changed();
2673 }
2674 }
2675
2676@@ -271,14 +273,14 @@
2677 case SDLK_DELETE:
2678 if (d->cursor_pos < d->text.size()) {
2679 d->erase_bytes(d->cursor_pos, d->next_char(d->cursor_pos));
2680- changed.call();
2681+ changed();
2682 }
2683 break;
2684
2685 case SDLK_BACKSPACE:
2686 if (d->cursor_pos > 0) {
2687 d->erase_bytes(d->prev_char(d->cursor_pos), d->cursor_pos);
2688- changed.call();
2689+ changed();
2690 }
2691 break;
2692
2693@@ -421,7 +423,7 @@
2694 case SDLK_KP_ENTER:
2695 case SDLK_RETURN:
2696 d->insert(d->cursor_pos, "\n");
2697- changed.call();
2698+ changed();
2699 break;
2700
2701 default:
2702
2703=== modified file 'src/ui_basic/multilineeditbox.h'
2704--- src/ui_basic/multilineeditbox.h 2011-10-23 16:18:19 +0000
2705+++ src/ui_basic/multilineeditbox.h 2011-11-26 13:22:27 +0000
2706@@ -21,9 +21,9 @@
2707 #define UI_MULTILINEEDITBOX_H
2708
2709 #include "panel.h"
2710-#include "m_signal.h"
2711
2712 #include <boost/scoped_ptr.hpp>
2713+#include <boost/signal.hpp>
2714
2715 namespace UI {
2716
2717@@ -37,7 +37,7 @@
2718 Multiline_Editbox
2719 (Panel *, int32_t x, int32_t y, uint32_t w, uint32_t h, const std::string & text);
2720
2721- Signal changed;
2722+ boost::signal<void ()> changed;
2723
2724 std::string const & get_text() const;
2725 void set_text(std::string const &);
2726
2727=== modified file 'src/ui_basic/multilinetextarea.cc'
2728--- src/ui_basic/multilinetextarea.cc 2011-02-20 17:01:25 +0000
2729+++ src/ui_basic/multilinetextarea.cc 2011-11-26 13:22:27 +0000
2730@@ -19,6 +19,8 @@
2731
2732 #include "multilinetextarea.h"
2733
2734+#include <boost/bind.hpp>
2735+
2736 #include "constants.h"
2737 #include "graphic/font_handler.h"
2738 #include "graphic/richtext.h"
2739@@ -54,7 +56,7 @@
2740
2741 set_align(align);
2742
2743- m_scrollbar.moved.set(this, &Multiline_Textarea::scrollpos_changed);
2744+ m_scrollbar.moved.connect(boost::bind(&Multiline_Textarea::scrollpos_changed, this, _1));
2745
2746 m_scrollbar.set_singlestepsize(g_fh->get_fontheight(UI_FONT_SMALL));
2747 m_scrollbar.set_pagesize(h - 2 * g_fh->get_fontheight(UI_FONT_BIG));
2748
2749=== removed file 'src/ui_basic/object.h'
2750--- src/ui_basic/object.h 2011-11-20 12:27:39 +0000
2751+++ src/ui_basic/object.h 1970-01-01 00:00:00 +0000
2752@@ -1,43 +0,0 @@
2753-/*
2754- * Copyright (C) 2002, 2006-2011 by the Widelands Development Team
2755- *
2756- * This program is free software; you can redistribute it and/or
2757- * modify it under the terms of the GNU General Public License
2758- * as published by the Free Software Foundation; either version 2
2759- * of the License, or (at your option) any later version.
2760- *
2761- * This program is distributed in the hope that it will be useful,
2762- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2763- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2764- * GNU General Public License for more details.
2765- *
2766- * You should have received a copy of the GNU General Public License
2767- * along with this program; if not, write to the Free Software
2768- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2769- *
2770- */
2771-
2772-#ifndef UI_OBJECT_H
2773-#define UI_OBJECT_H
2774-
2775-#include <boost/noncopyable.hpp>
2776-
2777-namespace UI {
2778-
2779-/**
2780- * Serves as a base class for UI related objects. The only purpose is
2781- * to provide the base class for signal function pointers.
2782- */
2783-struct Object : boost::noncopyable {
2784- Object() {}
2785-
2786- // Yeah right... force a VMT so that MSVC++ gets the pointers-to-members
2787- // right *sigh*
2788- // OTOH, looking at the gcc assembly, gcc seems to use a less efficient
2789- // pointer representation. Can anyone clear this up? -- Nicolai
2790- virtual ~Object() {}
2791-};
2792-
2793-}
2794-
2795-#endif
2796
2797=== modified file 'src/ui_basic/panel.h'
2798--- src/ui_basic/panel.h 2011-11-21 21:28:16 +0000
2799+++ src/ui_basic/panel.h 2011-11-26 13:22:27 +0000
2800@@ -21,7 +21,8 @@
2801 #ifndef UI_PANEL_H
2802 #define UI_PANEL_H
2803
2804-#include "object.h"
2805+#include <boost/signals/trackable.hpp>
2806+#include <boost/noncopyable.hpp>
2807
2808 #include "point.h"
2809 #include "graphic/picture_id.h"
2810@@ -58,7 +59,7 @@
2811 * its desired size changes, this automatically changes the actual size (which then invokes
2812 * \ref layout and \ref move_inside_parent).
2813 */
2814-struct Panel : public Object {
2815+struct Panel : boost::signals::trackable, boost::noncopyable {
2816 enum {
2817 pf_handle_mouse = 1, ///< receive mouse events
2818 pf_think = 2, ///< call think() function during run
2819
2820=== modified file 'src/ui_basic/radiobutton.cc'
2821--- src/ui_basic/radiobutton.cc 2011-11-06 12:22:50 +0000
2822+++ src/ui_basic/radiobutton.cc 2011-11-26 13:22:27 +0000
2823@@ -1,5 +1,5 @@
2824 /*
2825- * Copyright (C) 2002, 2006, 2008-2009 by the Widelands Development Team
2826+ * Copyright (C) 2002, 2006, 2008-2011 by the Widelands Development Team
2827 *
2828 * This program is free software; you can redistribute it and/or
2829 * modify it under the terms of the GNU General Public License
2830@@ -115,15 +115,15 @@
2831 */
2832 void Radiogroup::set_state(int32_t const state) {
2833 if (state == m_state) {
2834- clicked.call();
2835+ clicked();
2836 return;
2837 }
2838
2839 for (Radiobutton * btn = m_buttons; btn; btn = btn->m_nextbtn)
2840 btn->set_state(btn->m_id == state);
2841 m_state = state;
2842- changed.call();
2843- changedto.call(state);
2844+ changed();
2845+ changedto(state);
2846 }
2847
2848 /**
2849
2850=== modified file 'src/ui_basic/radiobutton.h'
2851--- src/ui_basic/radiobutton.h 2011-11-06 12:22:50 +0000
2852+++ src/ui_basic/radiobutton.h 2011-11-26 13:22:27 +0000
2853@@ -1,5 +1,5 @@
2854 /*
2855- * Copyright (C) 2004, 2006, 2008-2009 by the Widelands Development Team
2856+ * Copyright (C) 2004, 2006, 2008-2011 by the Widelands Development Team
2857 *
2858 * This program is free software; you can redistribute it and/or
2859 * modify it under the terms of the GNU General Public License
2860@@ -22,7 +22,6 @@
2861
2862 #include "graphic/picture_id.h"
2863 #include "point.h"
2864-#include "m_signal.h"
2865
2866 #include "checkbox.h"
2867
2868@@ -59,9 +58,9 @@
2869 Radiogroup();
2870 ~Radiogroup();
2871
2872- Signal changed;
2873- Signal1<int32_t> changedto;
2874- Signal clicked; // clicked without things changed
2875+ boost::signal<void ()> changed;
2876+ boost::signal<void (int32_t)> changedto;
2877+ boost::signal<void ()> clicked; // clicked without things changed
2878
2879 int32_t add_button
2880 (Panel * parent, Point, PictureID picid, char const * tooltip = 0, Radiobutton ** = NULL);
2881
2882=== modified file 'src/ui_basic/scrollbar.cc'
2883--- src/ui_basic/scrollbar.cc 2010-12-03 19:03:40 +0000
2884+++ src/ui_basic/scrollbar.cc 2011-11-26 13:22:27 +0000
2885@@ -1,5 +1,5 @@
2886 /*
2887- * Copyright (C) 2002, 2006-2010 by the Widelands Development Team
2888+ * Copyright (C) 2002, 2006-2011 by the Widelands Development Team
2889 *
2890 * This program is free software; you can redistribute it and/or
2891 * modify it under the terms of the GNU General Public License
2892@@ -134,7 +134,7 @@
2893 return;
2894
2895 m_pos = pos;
2896- moved.call(pos);
2897+ moved(pos);
2898
2899 update();
2900 }
2901
2902=== modified file 'src/ui_basic/scrollbar.h'
2903--- src/ui_basic/scrollbar.h 2010-12-03 19:03:40 +0000
2904+++ src/ui_basic/scrollbar.h 2011-11-26 13:22:27 +0000
2905@@ -1,5 +1,5 @@
2906 /*
2907- * Copyright (C) 2002, 2006-2010 by the Widelands Development Team
2908+ * Copyright (C) 2002, 2006-2011 by the Widelands Development Team
2909 *
2910 * This program is free software; you can redistribute it and/or
2911 * modify it under the terms of the GNU General Public License
2912@@ -20,8 +20,9 @@
2913 #ifndef UI_SCROLLBAR_H
2914 #define UI_SCROLLBAR_H
2915
2916+#include <boost/signal.hpp>
2917+
2918 #include "panel.h"
2919-#include "m_signal.h"
2920
2921 #include "rect.h"
2922
2923@@ -50,7 +51,7 @@
2924 (Panel * parent,
2925 int32_t x, int32_t y, uint32_t w, uint32_t h, bool horiz);
2926
2927- Signal1<int32_t> moved;
2928+ boost::signal<void (int32_t)> moved;
2929
2930 void set_steps(int32_t steps);
2931 void set_singlestepsize(uint32_t singlestepsize);
2932
2933=== modified file 'src/ui_basic/slider.cc'
2934--- src/ui_basic/slider.cc 2011-11-15 16:11:23 +0000
2935+++ src/ui_basic/slider.cc 2011-11-26 13:22:27 +0000
2936@@ -1,5 +1,5 @@
2937 /*
2938- * Copyright (C) 2002-2010 by the Widelands Development Team
2939+ * Copyright (C) 2002-2011 by the Widelands Development Team
2940 *
2941 * This program is free software; you can redistribute it and/or
2942 * modify it under the terms of the GNU General Public License
2943@@ -193,8 +193,8 @@
2944 */
2945 void Slider::send_value_changed()
2946 {
2947- changed.call();
2948- changedto.call(m_value);
2949+ changed();
2950+ changedto(m_value);
2951 }
2952
2953
2954@@ -549,6 +549,34 @@
2955 // DISCRETE //
2956 ////////////////////////////////////////////////////////////////////////////////
2957
2958+DiscreteSlider::DiscreteSlider
2959+ (Panel * const parent,
2960+ const int32_t x, const int32_t y, const uint32_t w, const uint32_t h,
2961+ const std::vector<std::string> labels_in,
2962+ uint32_t m_value,
2963+ const PictureID background_picture_id,
2964+ const std::string & tooltip_text,
2965+ const uint32_t cursor_size,
2966+ const bool enabled)
2967+ :
2968+ Panel (parent, x, y, w, h, tooltip_text),
2969+ slider
2970+ (this,
2971+ // here, we take into account the h_gap introduced by HorizontalSlider
2972+ w / (2 * labels_in.size()) - cursor_size / 2, 0,
2973+ w - (w / labels_in.size()) + cursor_size,
2974+ h - UI::Font::ui_small()->lineskip() - 2,
2975+ 0, labels_in.size() - 1, m_value,
2976+ background_picture_id,
2977+ tooltip_text,
2978+ cursor_size,
2979+ enabled),
2980+ labels(labels_in)
2981+{
2982+ slider.changed.connect(changed);
2983+ slider.changedto.connect(changedto);
2984+}
2985+
2986 /**
2987 * \brief Redraw the slide bar. The discrete horizontal bar is painted.
2988 *
2989
2990=== modified file 'src/ui_basic/slider.h'
2991--- src/ui_basic/slider.h 2011-11-08 22:45:39 +0000
2992+++ src/ui_basic/slider.h 2011-11-26 13:22:27 +0000
2993@@ -1,5 +1,5 @@
2994 /*
2995- * Copyright (C) 2002-2010 by the Widelands Development Team
2996+ * Copyright (C) 2002-2011 by the Widelands Development Team
2997 *
2998 * This program is free software; you can redistribute it and/or
2999 * modify it under the terms of the GNU General Public License
3000@@ -19,8 +19,9 @@
3001 #ifndef UI_SLIDER_H
3002 #define UI_SLIDER_H
3003
3004+#include <boost/signal.hpp>
3005+
3006 #include "panel.h"
3007-#include "m_signal.h"
3008 #include "graphic/font.h"
3009
3010 namespace UI {
3011@@ -84,8 +85,8 @@
3012 void set_highlighted(bool highlighted);
3013
3014 public:
3015- Signal changed;
3016- Signal1<int32_t> changedto;
3017+ boost::signal<void ()> changed;
3018+ boost::signal<void (int32_t)> changedto;
3019
3020 private:
3021 int32_t m_min_value; // cursor values
3022@@ -179,7 +180,7 @@
3023
3024 /**
3025 * \brief This class defines an discrete slide bar. We do not derive from
3026- * Slider, but rather embed it, as we need to re-size it and add the lables.
3027+ * Slider, but rather embed it, as we need to re-size it and add the labels.
3028 */
3029 struct DiscreteSlider : public Panel {
3030 DiscreteSlider
3031@@ -190,39 +191,21 @@
3032 const PictureID background_picture_id,
3033 const std::string & tooltip_text = std::string(),
3034 const uint32_t cursor_size = 20,
3035- const bool enabled = true)
3036- :
3037- Panel (parent, x, y, w, h, tooltip_text),
3038- slider
3039- (this,
3040- // here, we take into account the h_gap introduced by HorizontalSlider
3041- w / (2 * labels_in.size()) - cursor_size / 2, 0,
3042- w - (w / labels_in.size()) + cursor_size,
3043- h - UI::Font::ui_small()->lineskip() - 2,
3044- 0, labels_in.size() - 1, m_value,
3045- background_picture_id,
3046- tooltip_text,
3047- cursor_size,
3048- enabled),
3049- changed(&slider.changed),
3050- changedto(&slider.changedto),
3051- labels(labels_in)
3052- {}
3053-protected:
3054- HorizontalSlider slider;
3055-public:
3056+ const bool enabled = true);
3057+
3058 void set_labels(std::vector<std::string>);
3059
3060- Signal * changed;
3061- Signal1<int32_t> * changedto;
3062-
3063-private:
3064- std::vector<std::string> labels;
3065+ boost::signal<void ()> changed;
3066+ boost::signal<void (int32_t)> changedto;
3067
3068 protected:
3069-
3070 virtual void draw(RenderTarget & dst);
3071 virtual void layout();
3072+
3073+ HorizontalSlider slider;
3074+
3075+private:
3076+ std::vector<std::string> labels;
3077 };
3078
3079
3080
3081=== modified file 'src/ui_basic/spinbox.cc'
3082--- src/ui_basic/spinbox.cc 2010-12-04 23:11:18 +0000
3083+++ src/ui_basic/spinbox.cc 2011-11-26 13:22:27 +0000
3084@@ -59,10 +59,10 @@
3085
3086 /// The UI parts
3087 Textarea * text;
3088- Callback_Button * butPlus;
3089- Callback_Button * butMinus;
3090- Callback_Button * butTenPlus;
3091- Callback_Button * butTenMinus;
3092+ Button * butPlus;
3093+ Button * butMinus;
3094+ Button * butTenPlus;
3095+ Button * butTenMinus;
3096 };
3097
3098 /**
3099@@ -108,40 +108,40 @@
3100 sbi->text = new UI::Textarea
3101 (this, butw * 16 / 5, 0, textw, h, buf, Align_Center);
3102 sbi->butPlus =
3103- new Callback_Button
3104+ new Button
3105 (this, "+",
3106 butw * 21 / 10, 0, butw, butw,
3107 sbi->background,
3108- boost::bind(&SpinBox::changeValue, boost::ref(*this), 1),
3109 "+", _("Increase the value"),
3110 true, false);
3111+ sbi->butPlus->sigclicked.connect(boost::bind(&SpinBox::changeValue, boost::ref(*this), 1));
3112 sbi->butMinus =
3113- new Callback_Button
3114+ new Button
3115 (this, "-",
3116 w - butw * 31 / 10, 0, butw, butw,
3117 sbi->background,
3118- boost::bind(&SpinBox::changeValue, boost::ref(*this), -1),
3119 "-", _("Decrease the value"),
3120 true, false);
3121+ sbi->butMinus->sigclicked.connect(boost::bind(&SpinBox::changeValue, boost::ref(*this), -1));
3122 sbi->butPlus->set_repeating(true);
3123 sbi->butMinus->set_repeating(true);
3124 if (m_big) {
3125 sbi->butTenPlus =
3126- new Callback_Button
3127+ new Button
3128 (this, "++",
3129 0, 0, butw * 2, butw,
3130 sbi->background,
3131- boost::bind(&SpinBox::changeValue, boost::ref(*this), 10),
3132 "++", _("Increase the value by 10"),
3133 true, false);
3134+ sbi->butTenPlus->sigclicked.connect(boost::bind(&SpinBox::changeValue, boost::ref(*this), 10));
3135 sbi->butTenMinus =
3136- new Callback_Button
3137+ new Button
3138 (this, "--",
3139 w - 2 * butw, 0, butw * 2, butw,
3140 sbi->background,
3141- boost::bind(&SpinBox::changeValue, boost::ref(*this), -10),
3142 "--", _("Decrease the value by 10"),
3143 true, false);
3144+ sbi->butTenMinus->sigclicked.connect(boost::bind(&SpinBox::changeValue, boost::ref(*this), -10));
3145 sbi->butTenPlus->set_repeating(true);
3146 sbi->butTenMinus->set_repeating(true);
3147 }
3148
3149=== modified file 'src/ui_basic/table.cc'
3150--- src/ui_basic/table.cc 2011-11-20 12:29:57 +0000
3151+++ src/ui_basic/table.cc 2011-11-26 13:22:27 +0000
3152@@ -97,12 +97,13 @@
3153 c.btn = 0;
3154 if (title.size()) {
3155 c.btn =
3156- new Callback_Button
3157+ new Button
3158 (this, title,
3159 complete_width, 0, width, m_headerheight,
3160 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
3161- boost::bind(&Table::header_button_clicked, boost::ref(*this), m_columns.size()),
3162 title, "", true, false);
3163+ c.btn->sigclicked.connect
3164+ (boost::bind(&Table::header_button_clicked, boost::ref(*this), m_columns.size()));
3165 c.btn->set_font(Font::get(m_fontname, m_fontsize));
3166 }
3167 c.width = width;
3168@@ -128,7 +129,7 @@
3169 get_x() + get_w() - 24, get_y() + m_headerheight,
3170 24, get_h() - m_headerheight,
3171 false);
3172- m_scrollbar->moved.set(this, &Table::set_scrollpos);
3173+ m_scrollbar->moved.connect(boost::bind(&Table::set_scrollpos, this, _1));
3174 m_scrollbar->set_steps(1);
3175 uint32_t const lineheight = g_fh->get_fontheight(m_fontname, m_fontsize);
3176 m_scrollbar->set_singlestepsize(lineheight);
3177@@ -146,12 +147,13 @@
3178 for (uint8_t i = 0; i < col; ++i)
3179 complete_width += m_columns.at(i).width;
3180 column.btn =
3181- new Callback_Button
3182+ new Button
3183 (this, title,
3184 complete_width, 0, column.width, m_headerheight,
3185 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
3186- boost::bind(&Table::header_button_clicked, boost::ref(*this), col),
3187 title, "", true, false);
3188+ column.btn->sigclicked.connect
3189+ (boost::bind(&Table::header_button_clicked, boost::ref(*this), col));
3190 column.btn->set_font(Font::get(m_fontname, m_fontsize));
3191 } else if (column.btn and title.empty()) { // had title before, not now
3192 delete column.btn;
3193@@ -365,7 +367,7 @@
3194 and
3195 m_last_selection == m_selection
3196 and m_selection != no_selection_index())
3197- double_clicked.call(m_selection);
3198+ double_clicked(m_selection);
3199
3200 return true;
3201 }
3202@@ -390,7 +392,7 @@
3203
3204 m_selection = i;
3205
3206- selected.call(m_selection);
3207+ selected(m_selection);
3208 update(0, 0, get_eff_w(), get_h());
3209 }
3210
3211
3212=== modified file 'src/ui_basic/table.h'
3213--- src/ui_basic/table.h 2011-11-05 16:32:47 +0000
3214+++ src/ui_basic/table.h 2011-11-26 13:22:27 +0000
3215@@ -1,5 +1,5 @@
3216 /*
3217- * Copyright (C) 2002, 2006, 2008-2009 by the Widelands Development Team
3218+ * Copyright (C) 2002, 2006, 2008-2011 by the Widelands Development Team
3219 *
3220 * This program is free software; you can redistribute it and/or
3221 * modify it under the terms of the GNU General Public License
3222@@ -23,17 +23,17 @@
3223
3224 #include "align.h"
3225 #include "panel.h"
3226-#include "m_signal.h"
3227
3228 #include "compile_assert.h"
3229
3230 #include <limits>
3231 #include <vector>
3232 #include <boost/function.hpp>
3233+#include <boost/signal.hpp>
3234
3235 namespace UI {
3236 struct Scrollbar;
3237-struct Callback_Button;
3238+struct Button;
3239
3240 /// A table with columns and lines. The entries can be sorted by columns by
3241 /// clicking on the column header button.
3242@@ -53,8 +53,8 @@
3243 bool descending = false);
3244 ~Table();
3245
3246- Signal1<uint32_t> selected;
3247- Signal1<uint32_t> double_clicked;
3248+ boost::signal<void (uint32_t)> selected;
3249+ boost::signal<void (uint32_t)> double_clicked;
3250
3251 /// A column that has a title is sortable (by clicking on the title).
3252 void add_column
3253@@ -157,8 +157,8 @@
3254 bool descending = false);
3255 ~Table();
3256
3257- Signal1<uint32_t> selected;
3258- Signal1<uint32_t> double_clicked;
3259+ boost::signal<void (uint32_t)> selected;
3260+ boost::signal<void (uint32_t)> double_clicked;
3261
3262 void add_column
3263 (uint32_t width,
3264@@ -246,7 +246,7 @@
3265 struct Column;
3266 typedef std::vector<Column> Columns;
3267 struct Column {
3268- Callback_Button * btn;
3269+ Button * btn;
3270 uint32_t width;
3271 Align alignment;
3272 bool is_checkbox_column;
3273
3274=== added file 'src/ui_basic/wsm_checkbox.cc.OTHER'
3275--- src/ui_basic/wsm_checkbox.cc.OTHER 1970-01-01 00:00:00 +0000
3276+++ src/ui_basic/wsm_checkbox.cc.OTHER 2011-11-26 13:22:27 +0000
3277@@ -0,0 +1,61 @@
3278+/*
3279+ * Copyright (C) 2011 by the Widelands Development Team
3280+ *
3281+ * This program is free software; you can redistribute it and/or
3282+ * modify it under the terms of the GNU General Public License
3283+ * as published by the Free Software Foundation; either version 2
3284+ * of the License, or (at your option) any later version.
3285+ *
3286+ * This program is distributed in the hope that it will be useful,
3287+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3288+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3289+ * GNU General Public License for more details.
3290+ *
3291+ * You should have received a copy of the GNU General Public License
3292+ * along with this program; if not, write to the Free Software
3293+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3294+ *
3295+ */
3296+
3297+#include "graphic/rendertarget.h"
3298+#include "logic/item_ware_descr.h"
3299+#include "compile_assert.h"
3300+#include "checkbox.h"
3301+
3302+#include "wsm_checkbox.h"
3303+
3304+
3305+#define COLOR_BOX_HEIGHT 7
3306+#define WARES_DISPLAY_BG "pics/ware_list_bg.png"
3307+
3308+
3309+WSM_Checkbox::WSM_Checkbox
3310+ (UI::Panel * const parent,
3311+ Point const p,
3312+ PictureID const picid,
3313+ RGBColor const color)
3314+:
3315+UI::Checkbox(parent, p, g_gr->get_picture(PicMod_Game, WARES_DISPLAY_BG)),
3316+m_pic (picid),
3317+m_color (color)
3318+{
3319+}
3320+
3321+/**
3322+ * draw the normal checkbox, the picture and the color rectangle
3323+ */
3324+void WSM_Checkbox::draw(RenderTarget & dst) {
3325+ // First, draw normal.
3326+ UI::Checkbox::draw(dst);
3327+
3328+ // Now, draw a small box with the color.
3329+ assert(1 <= get_inner_w());
3330+ compile_assert(2 <= COLOR_BOX_HEIGHT);
3331+ dst.fill_rect
3332+ (Rect(Point(1, 1), get_inner_w() - 1, COLOR_BOX_HEIGHT - 2), m_color);
3333+
3334+ // and the item
3335+ dst.blit
3336+ (Point((get_inner_w() - WARE_MENU_PIC_WIDTH) / 2, COLOR_BOX_HEIGHT),
3337+ m_pic);
3338+}
3339
3340=== added file 'src/ui_basic/wsm_checkbox.h.OTHER'
3341--- src/ui_basic/wsm_checkbox.h.OTHER 1970-01-01 00:00:00 +0000
3342+++ src/ui_basic/wsm_checkbox.h.OTHER 2011-11-26 13:22:27 +0000
3343@@ -0,0 +1,40 @@
3344+/*
3345+ * Copyright (C) 2011 by the Widelands Development Team
3346+ *
3347+ * This program is free software; you can redistribute it and/or
3348+ * modify it under the terms of the GNU General Public License
3349+ * as published by the Free Software Foundation; either version 2
3350+ * of the License, or (at your option) any later version.
3351+ *
3352+ * This program is distributed in the hope that it will be useful,
3353+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3354+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3355+ * GNU General Public License for more details.
3356+ *
3357+ * You should have received a copy of the GNU General Public License
3358+ * along with this program; if not, write to the Free Software
3359+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3360+ *
3361+ */
3362+
3363+#ifndef WSM_CHECKBOX_H
3364+#define WSM_CHECKBOX_H
3365+
3366+/**
3367+ * This class is the same as an ordinary
3368+ * checkbox, the only difference is, it has
3369+ * a small rectangle on it with the color
3370+ * of the graph and it needs a picture
3371+ */
3372+struct WSM_Checkbox : public UI::Checkbox {
3373+ WSM_Checkbox(UI::Panel *, Point, PictureID picid, RGBColor);
3374+
3375+ virtual void draw(RenderTarget &);
3376+
3377+private:
3378+ PictureID m_pic;
3379+ RGBColor m_color;
3380+};
3381+
3382+
3383+#endif
3384
3385=== modified file 'src/ui_fsmenu/campaign_select.cc'
3386--- src/ui_fsmenu/campaign_select.cc 2010-12-04 23:11:18 +0000
3387+++ src/ui_fsmenu/campaign_select.cc 2011-11-26 13:22:27 +0000
3388@@ -1,5 +1,5 @@
3389 /*
3390- * Copyright (C) 2002-2009 by the Widelands Development Team
3391+ * Copyright (C) 2002-2011 by the Widelands Development Team
3392 *
3393 * This program is free software; you can redistribute it and/or
3394 * modify it under the terms of the GNU General Public License
3395@@ -70,15 +70,11 @@
3396 (this, "ok",
3397 get_w() * 71 / 100, get_h() * 9 / 10, m_butw, m_buth,
3398 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
3399- boost::bind
3400- (&Fullscreen_Menu_CampaignSelect::clicked_ok, boost::ref(*this)),
3401 _("OK"), std::string(), false, false),
3402 back
3403 (this, "back",
3404 get_w() * 71 / 100, get_h() * 17 / 20, m_butw, m_buth,
3405 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
3406- boost::bind
3407- (&Fullscreen_Menu_CampaignSelect::end_modal, boost::ref(*this), 0),
3408 _("Back"), std::string(), true, false),
3409
3410 // Campaign list
3411@@ -87,6 +83,13 @@
3412 get_w() * 47 / 2500, get_h() * 3417 / 10000,
3413 get_w() * 711 / 1250, get_h() * 6083 / 10000)
3414 {
3415+ b_ok.sigclicked.connect
3416+ (boost::bind
3417+ (&Fullscreen_Menu_CampaignSelect::clicked_ok, boost::ref(*this)));
3418+ back.sigclicked.connect
3419+ (boost::bind
3420+ (&Fullscreen_Menu_CampaignSelect::end_modal, boost::ref(*this), 0));
3421+
3422 back.set_font(font_small());
3423 b_ok.set_font(font_small());
3424
3425@@ -98,10 +101,10 @@
3426 label_campdescr .set_font(m_fn, m_fs, UI_FONT_CLR_FG);
3427 tacampdescr .set_font(m_fn, m_fs, UI_FONT_CLR_FG);
3428 m_list.set_font(m_fn, m_fs);
3429- m_list.selected .set
3430- (this, &Fullscreen_Menu_CampaignSelect::campaign_selected);
3431- m_list.double_clicked.set
3432- (this, &Fullscreen_Menu_CampaignSelect::double_clicked);
3433+ m_list.selected.connect
3434+ (boost::bind(&Fullscreen_Menu_CampaignSelect::campaign_selected, this, _1));
3435+ m_list.double_clicked.connect
3436+ (boost::bind(&Fullscreen_Menu_CampaignSelect::double_clicked, this, _1));
3437 fill_list();
3438 }
3439
3440@@ -276,15 +279,11 @@
3441 (this, "ok",
3442 get_w() * 71 / 100, get_h() * 9 / 10, m_butw, m_buth,
3443 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
3444- boost::bind
3445- (&Fullscreen_Menu_CampaignMapSelect::clicked_ok, boost::ref(*this)),
3446 _("OK"), std::string(), false, false),
3447 back
3448 (this, "back",
3449 get_w() * 71 / 100, get_h() * 17 / 20, m_butw, m_buth,
3450 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
3451- boost::bind
3452- (&Fullscreen_Menu_CampaignMapSelect::end_modal, boost::ref(*this), 0),
3453 _("Back"), std::string(), true, false),
3454
3455 // Campaign map list
3456@@ -293,6 +292,13 @@
3457 get_w() * 47 / 2500, get_h() * 3417 / 10000,
3458 get_w() * 711 / 1250, get_h() * 6083 / 10000)
3459 {
3460+ b_ok.sigclicked.connect
3461+ (boost::bind
3462+ (&Fullscreen_Menu_CampaignMapSelect::clicked_ok, boost::ref(*this)));
3463+ back.sigclicked.connect
3464+ (boost::bind
3465+ (&Fullscreen_Menu_CampaignMapSelect::end_modal, boost::ref(*this), 0));
3466+
3467 b_ok.set_font(font_small());
3468 back.set_font(font_small());
3469
3470@@ -304,9 +310,9 @@
3471 label_mapdescr.set_font(m_fn, m_fs, UI_FONT_CLR_FG);
3472 tamapdescr .set_font(m_fn, m_fs, UI_FONT_CLR_FG);
3473 m_list.set_font(m_fn, m_fs);
3474- m_list.selected.set(this, &Fullscreen_Menu_CampaignMapSelect::map_selected);
3475- m_list.double_clicked.set
3476- (this, &Fullscreen_Menu_CampaignMapSelect::double_clicked);
3477+ m_list.selected.connect(boost::bind(&Fullscreen_Menu_CampaignMapSelect::map_selected, this, _1));
3478+ m_list.double_clicked.connect
3479+ (boost::bind(&Fullscreen_Menu_CampaignMapSelect::double_clicked, this, _1));
3480 }
3481
3482
3483
3484=== modified file 'src/ui_fsmenu/campaign_select.h'
3485--- src/ui_fsmenu/campaign_select.h 2010-12-04 23:11:18 +0000
3486+++ src/ui_fsmenu/campaign_select.h 2011-11-26 13:22:27 +0000
3487@@ -1,5 +1,5 @@
3488 /*
3489- * Copyright (C) 2002-2008, 2010 by the Widelands Development Team
3490+ * Copyright (C) 2002-2008, 2010-2011 by the Widelands Development Team
3491 *
3492 * This program is free software; you can redistribute it and/or
3493 * modify it under the terms of the GNU General Public License
3494@@ -50,15 +50,15 @@
3495 uint32_t m_fs;
3496 std::string m_fn;
3497
3498- UI::Textarea title;
3499- UI::Textarea label_campname;
3500- UI::Textarea tacampname;
3501- UI::Textarea label_difficulty;
3502- UI::Textarea tadifficulty;
3503- UI::Textarea label_campdescr;
3504- UI::Multiline_Textarea tacampdescr;
3505- UI::Callback_Button b_ok, back;
3506- UI::Listselect<const char *> m_list;
3507+ UI::Textarea title;
3508+ UI::Textarea label_campname;
3509+ UI::Textarea tacampname;
3510+ UI::Textarea label_difficulty;
3511+ UI::Textarea tadifficulty;
3512+ UI::Textarea label_campdescr;
3513+ UI::Multiline_Textarea tacampdescr;
3514+ UI::Button b_ok, back;
3515+ UI::Listselect<const char *> m_list;
3516
3517 /// Variables used for exchange between the two Campaign UIs and
3518 /// Game::run_campaign
3519@@ -84,17 +84,17 @@
3520 uint32_t m_fs;
3521 std::string m_fn;
3522
3523- UI::Textarea title;
3524- UI::Textarea label_mapname;
3525- UI::Textarea tamapname;
3526- UI::Textarea label_author;
3527- UI::Textarea taauthor;
3528- UI::Textarea label_mapdescr;
3529- UI::Multiline_Textarea tamapdescr;
3530- UI::Callback_Button b_ok, back;
3531- UI::Listselect<std::string> m_list;
3532- uint32_t campaign;
3533- std::string campmapfile;
3534+ UI::Textarea title;
3535+ UI::Textarea label_mapname;
3536+ UI::Textarea tamapname;
3537+ UI::Textarea label_author;
3538+ UI::Textarea taauthor;
3539+ UI::Textarea label_mapdescr;
3540+ UI::Multiline_Textarea tamapdescr;
3541+ UI::Button b_ok, back;
3542+ UI::Listselect<std::string> m_list;
3543+ uint32_t campaign;
3544+ std::string campmapfile;
3545
3546 };
3547
3548
3549=== modified file 'src/ui_fsmenu/editor.cc'
3550--- src/ui_fsmenu/editor.cc 2010-12-04 23:11:18 +0000
3551+++ src/ui_fsmenu/editor.cc 2011-11-26 13:22:27 +0000
3552@@ -39,21 +39,25 @@
3553 (this, "new_map",
3554 m_butx, get_h() * 6 / 25, m_butw, m_buth,
3555 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
3556- boost::bind(&Fullscreen_Menu_Editor::end_modal, boost::ref(*this), static_cast<int32_t>(New_Map)),
3557 _("New Map"), std::string(), true, false),
3558 load_map
3559 (this, "load_map",
3560 m_butx, get_h() * 61 / 200, m_butw, m_buth,
3561 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
3562- boost::bind(&Fullscreen_Menu_Editor::end_modal, boost::ref(*this), static_cast<int32_t>(Load_Map)),
3563 _("Load Map"), std::string(), true, false),
3564 back
3565 (this, "back",
3566 m_butx, get_h() * 3 / 4, m_butw, m_buth,
3567 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
3568- boost::bind(&Fullscreen_Menu_Editor::end_modal, boost::ref(*this), static_cast<int32_t>(Back)),
3569 _("Back"), std::string(), true, false)
3570 {
3571+ new_map.sigclicked.connect
3572+ (boost::bind(&Fullscreen_Menu_Editor::end_modal, boost::ref(*this), static_cast<int32_t>(New_Map)));
3573+ load_map.sigclicked.connect
3574+ (boost::bind(&Fullscreen_Menu_Editor::end_modal, boost::ref(*this), static_cast<int32_t>(Load_Map)));
3575+ back.sigclicked.connect
3576+ (boost::bind(&Fullscreen_Menu_Editor::end_modal, boost::ref(*this), static_cast<int32_t>(Back)));
3577+
3578 new_map.set_font(font_small());
3579 load_map.set_font(font_small());
3580 back.set_font(font_small());
3581
3582=== modified file 'src/ui_fsmenu/editor.h'
3583--- src/ui_fsmenu/editor.h 2010-10-17 19:42:01 +0000
3584+++ src/ui_fsmenu/editor.h 2011-11-26 13:22:27 +0000
3585@@ -39,9 +39,9 @@
3586 uint32_t m_buth;
3587 uint32_t m_butx;
3588 UI::Textarea title;
3589- UI::Callback_Button new_map;
3590- UI::Callback_Button load_map;
3591- UI::Callback_Button back;
3592+ UI::Button new_map;
3593+ UI::Button load_map;
3594+ UI::Button back;
3595 };
3596
3597 #endif
3598
3599=== modified file 'src/ui_fsmenu/editor_mapselect.cc'
3600--- src/ui_fsmenu/editor_mapselect.cc 2010-12-04 23:11:18 +0000
3601+++ src/ui_fsmenu/editor_mapselect.cc 2011-11-26 13:22:27 +0000
3602@@ -1,5 +1,5 @@
3603 /*
3604- * Copyright (C) 2002-2004, 2006-2009 by the Widelands Development Team
3605+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
3606 *
3607 * This program is free software; you can redistribute it and/or
3608 * modify it under the terms of the GNU General Public License
3609@@ -87,13 +87,11 @@
3610 (this, "back",
3611 get_w() * 71 / 100, get_h() * 17 / 20, m_butw, m_buth,
3612 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
3613- boost::bind(&Fullscreen_Menu_Editor_MapSelect::end_modal, boost::ref(*this), 0),
3614 _("Back"), std::string(), true, false),
3615 m_ok
3616 (this, "ok",
3617 get_w() * 71 / 100, get_h() * 9 / 10, m_butw, m_buth,
3618 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
3619- boost::bind(&Fullscreen_Menu_Editor_MapSelect::ok, boost::ref(*this)),
3620 _("OK"), std::string(), false, false),
3621
3622 // Map list
3623@@ -105,6 +103,9 @@
3624 // Runtime variables
3625 m_curdir("maps"), m_basedir("maps")
3626 {
3627+ m_back.sigclicked.connect(boost::bind(&Fullscreen_Menu_Editor_MapSelect::end_modal, boost::ref(*this), 0));
3628+ m_ok.sigclicked.connect(boost::bind(&Fullscreen_Menu_Editor_MapSelect::ok, boost::ref(*this)));
3629+
3630 m_back.set_font(font_small());
3631 m_ok.set_font(font_small());
3632
3633@@ -123,9 +124,9 @@
3634 m_descr .set_font(m_fn, m_fs, UI_FONT_CLR_FG);
3635 m_list .set_font(m_fn, m_fs);
3636
3637- m_list.selected.set(this, &Fullscreen_Menu_Editor_MapSelect::map_selected);
3638- m_list.double_clicked.set
3639- (this, &Fullscreen_Menu_Editor_MapSelect::double_clicked);
3640+ m_list.selected.connect(boost::bind(&Fullscreen_Menu_Editor_MapSelect::map_selected, this, _1));
3641+ m_list.double_clicked.connect
3642+ (boost::bind(&Fullscreen_Menu_Editor_MapSelect::double_clicked, this, _1));
3643
3644 fill_list();
3645 }
3646
3647=== modified file 'src/ui_fsmenu/editor_mapselect.h'
3648--- src/ui_fsmenu/editor_mapselect.h 2010-10-17 19:42:01 +0000
3649+++ src/ui_fsmenu/editor_mapselect.h 2011-11-26 13:22:27 +0000
3650@@ -55,7 +55,7 @@
3651 UI::Textarea m_size, m_label_world, m_world;
3652 UI::Textarea m_label_nr_players, m_nr_players, m_label_descr;
3653 UI::Multiline_Textarea m_descr;
3654- UI::Callback_Button m_back, m_ok;
3655+ UI::Button m_back, m_ok;
3656 UI::Listselect<std::string> m_list;
3657 std::string m_parentdir, m_curdir, m_basedir;
3658 filenameset_t m_mapfiles;
3659
3660=== modified file 'src/ui_fsmenu/fileview.cc'
3661--- src/ui_fsmenu/fileview.cc 2010-12-04 23:11:18 +0000
3662+++ src/ui_fsmenu/fileview.cc 2011-11-26 13:22:27 +0000
3663@@ -1,5 +1,5 @@
3664 /*
3665- * Copyright (C) 2002, 2006-2009 by the Widelands Development Team
3666+ * Copyright (C) 2002, 2006-2011 by the Widelands Development Team
3667 *
3668 * This program is free software; you can redistribute it and/or
3669 * modify it under the terms of the GNU General Public License
3670@@ -41,9 +41,10 @@
3671 (this, "close",
3672 get_w() * 3 / 8, get_h() * 9 / 10, get_w() / 4, get_h() * 9 / 200,
3673 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
3674- boost::bind(&Fullscreen_Menu_TextView::end_modal, boost::ref(*this), 0),
3675 _("Close"), std::string(), true, false)
3676 {
3677+ close_button.sigclicked.connect(boost::bind(&Fullscreen_Menu_TextView::end_modal, boost::ref(*this), 0));
3678+
3679 close_button.set_font(font_small());
3680
3681 Profile prof(filename.c_str(), "global", "texts"); // section-less file
3682
3683=== modified file 'src/ui_fsmenu/fileview.h'
3684--- src/ui_fsmenu/fileview.h 2010-10-17 19:42:01 +0000
3685+++ src/ui_fsmenu/fileview.h 2011-11-26 13:22:27 +0000
3686@@ -47,7 +47,7 @@
3687 private:
3688 UI::Textarea title;
3689 UI::Multiline_Textarea textview;
3690- UI::Callback_Button close_button;
3691+ UI::Button close_button;
3692 };
3693
3694 /**
3695
3696=== modified file 'src/ui_fsmenu/launchMPG.cc'
3697--- src/ui_fsmenu/launchMPG.cc 2011-09-18 13:39:55 +0000
3698+++ src/ui_fsmenu/launchMPG.cc 2011-11-26 13:22:27 +0000
3699@@ -57,31 +57,34 @@
3700 uint32_t space = get_inner_w() / 40;
3701 uint32_t butw = get_inner_w() * 3 / 10;
3702 uint32_t buth = get_inner_h() * 8 / 10;
3703- UI::Button * btn = new UI::Callback_Button
3704+ UI::Button * btn = new UI::Button
3705 (this, "map",
3706 space, y, butw, buth,
3707 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
3708- boost::bind
3709- (&MapOrSaveSelectionWindow::pressedButton, boost::ref(*this), 1),
3710 _("Map"), _("Select a map"), true, false);
3711+ btn->sigclicked.connect
3712+ (boost::bind
3713+ (&MapOrSaveSelectionWindow::pressedButton, boost::ref(*this), 1));
3714 btn->set_font(font);
3715
3716- btn = new UI::Callback_Button
3717+ btn = new UI::Button
3718 (this, "saved_game",
3719 2 * space + butw, y, butw, buth,
3720 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
3721- boost::bind
3722- (&MapOrSaveSelectionWindow::pressedButton, boost::ref(*this), 2),
3723 _("Saved game"), _("Select a saved game"), true, false);
3724+ btn->sigclicked.connect
3725+ (boost::bind
3726+ (&MapOrSaveSelectionWindow::pressedButton, boost::ref(*this), 2));
3727 btn->set_font(font);
3728
3729- btn = new UI::Callback_Button
3730+ btn = new UI::Button
3731 (this, "cancel",
3732 3 * space + 2 * butw, y, butw, buth,
3733 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
3734- boost::bind
3735- (&MapOrSaveSelectionWindow::pressedButton, boost::ref(*this), 0),
3736 _("Cancel"), _("Cancel selection"), true, false);
3737+ btn->sigclicked.connect
3738+ (boost::bind
3739+ (&MapOrSaveSelectionWindow::pressedButton, boost::ref(*this), 0));
3740 btn->set_font(font);
3741 }
3742
3743@@ -108,38 +111,27 @@
3744 get_w() * 37 / 50 + m_butw - m_buth, get_h() * 3 / 20, m_buth, m_buth,
3745 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
3746 g_gr->get_picture(PicMod_UI, "pics/menu_toggle_minimap.png"),
3747- boost::bind
3748- (&Fullscreen_Menu_LaunchMPG::change_map_or_save, boost::ref(*this)),
3749 _("Change map or saved game"), false, false),
3750 m_ok
3751 (this, "ok",
3752 get_w() * 37 / 50, get_h() * 12 / 20, m_butw, m_buth,
3753 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
3754- boost::bind
3755- (&Fullscreen_Menu_LaunchMPG::start_clicked, boost::ref(*this)),
3756 _("Start game"), std::string(), false, false),
3757 m_back
3758 (this, "back",
3759 get_w() * 37 / 50, get_h() * 218 / 240, m_butw, m_buth,
3760 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
3761- boost::bind(&Fullscreen_Menu_LaunchMPG::back_clicked, boost::ref(*this)),
3762 _("Back"), std::string(), true, false),
3763 m_wincondition
3764 (this, "win_condition",
3765 get_w() * 37 / 50, get_h() * 11 / 20, m_butw, m_buth,
3766 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
3767- boost::bind
3768- (&Fullscreen_Menu_LaunchMPG::win_condition_clicked,
3769- boost::ref(*this)),
3770 "", std::string(), false, false),
3771 m_help_button
3772 (this, "help",
3773 get_w() * 37 / 50 + m_butw - m_buth, get_h() / 100, m_buth, m_buth,
3774 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
3775 g_gr->get_picture(PicMod_UI, "pics/menu_help.png"),
3776- boost::bind
3777- (&Fullscreen_Menu_LaunchMPG::help_clicked,
3778- boost::ref(*this)),
3779 _("Show the help window"), true, false),
3780
3781 // Text labels
3782@@ -173,6 +165,22 @@
3783 m_ctrl (ctrl),
3784 m_chat (0)
3785 {
3786+ m_change_map_or_save.sigclicked.connect
3787+ (boost::bind
3788+ (&Fullscreen_Menu_LaunchMPG::change_map_or_save, boost::ref(*this)));
3789+ m_ok.sigclicked.connect
3790+ (boost::bind
3791+ (&Fullscreen_Menu_LaunchMPG::start_clicked, boost::ref(*this)));
3792+ m_back.sigclicked.connect(boost::bind(&Fullscreen_Menu_LaunchMPG::back_clicked, boost::ref(*this)));
3793+ m_wincondition.sigclicked.connect
3794+ (boost::bind
3795+ (&Fullscreen_Menu_LaunchMPG::win_condition_clicked,
3796+ boost::ref(*this)));
3797+ m_help_button.sigclicked.connect
3798+ (boost::bind
3799+ (&Fullscreen_Menu_LaunchMPG::help_clicked,
3800+ boost::ref(*this)));
3801+
3802 m_back.set_font(font_small());
3803 m_ok.set_font(font_small());
3804 m_wincondition.set_font(font_small());
3805
3806=== modified file 'src/ui_fsmenu/launchMPG.h'
3807--- src/ui_fsmenu/launchMPG.h 2011-02-18 23:05:02 +0000
3808+++ src/ui_fsmenu/launchMPG.h 2011-11-26 13:22:27 +0000
3809@@ -78,8 +78,8 @@
3810 uint32_t m_fs;
3811 std::string m_fn;
3812
3813- UI::Callback_Button m_change_map_or_save, m_ok, m_back, m_wincondition;
3814- UI::Callback_Button m_help_button;
3815+ UI::Button m_change_map_or_save, m_ok, m_back, m_wincondition;
3816+ UI::Button m_help_button;
3817 UI::Textarea m_title, m_mapname, m_clients, m_players, m_map;
3818 UI::Multiline_Textarea m_map_info, m_client_info;
3819 UI::HelpWindow * m_help;
3820
3821=== modified file 'src/ui_fsmenu/launchSPG.cc'
3822--- src/ui_fsmenu/launchSPG.cc 2011-09-18 13:39:55 +0000
3823+++ src/ui_fsmenu/launchSPG.cc 2011-11-26 13:22:27 +0000
3824@@ -52,28 +52,21 @@
3825 (this, "select_map",
3826 get_w() * 7 / 10, get_h() * 3 / 10, m_butw, m_buth,
3827 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
3828- boost::bind(&Fullscreen_Menu_LaunchSPG::select_map, boost::ref(*this)),
3829 _("Select map"), std::string(), false, false),
3830 m_wincondition
3831 (this, "win_condition",
3832 get_w() * 7 / 10, get_h() * 4 / 10, m_butw, m_buth,
3833 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
3834- boost::bind
3835- (&Fullscreen_Menu_LaunchSPG::win_condition_clicked,
3836- boost::ref(*this)),
3837 "", std::string(), false, false),
3838 m_back
3839 (this, "back",
3840 get_w() * 7 / 10, get_h() * 9 / 20, m_butw, m_buth,
3841 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
3842- boost::bind(&Fullscreen_Menu_LaunchSPG::back_clicked, boost::ref(*this)),
3843 _("Back"), std::string(), true, false),
3844 m_ok
3845 (this, "ok",
3846 get_w() * 7 / 10, get_h() * 1 / 2, m_butw, m_buth,
3847 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
3848- boost::bind
3849- (&Fullscreen_Menu_LaunchSPG::start_clicked, boost::ref(*this)),
3850 _("Start game"), std::string(), false, false),
3851
3852 // Text labels
3853@@ -111,6 +104,16 @@
3854 m_ctrl (ctrl),
3855 m_is_scenario (false)
3856 {
3857+ m_select_map.sigclicked.connect(boost::bind(&Fullscreen_Menu_LaunchSPG::select_map, boost::ref(*this)));
3858+ m_wincondition.sigclicked.connect
3859+ (boost::bind
3860+ (&Fullscreen_Menu_LaunchSPG::win_condition_clicked,
3861+ boost::ref(*this)));
3862+ m_back.sigclicked.connect(boost::bind(&Fullscreen_Menu_LaunchSPG::back_clicked, boost::ref(*this)));
3863+ m_ok.sigclicked.connect
3864+ (boost::bind
3865+ (&Fullscreen_Menu_LaunchSPG::start_clicked, boost::ref(*this)));
3866+
3867
3868 // Register win condition scripts
3869 m_lua = create_LuaInterface();
3870@@ -144,15 +147,14 @@
3871 for (uint32_t i = 0; i < MAX_PLAYERS; ++i) {
3872 sprintf(posIco, "pics/fsel_editor_set_player_0%i_pos.png", i + 1);
3873 m_pos[i] =
3874- new UI::Callback_Button
3875+ new UI::Button
3876 (this, "switch_to_position",
3877 get_w() / 100, y += m_buth, get_h() * 17 / 500, get_h() * 17 / 500,
3878 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
3879 g_gr->get_picture(PicMod_Game, posIco),
3880- boost::bind
3881- (&Fullscreen_Menu_LaunchSPG::switch_to_position,
3882- boost::ref(*this), i),
3883 _("Switch to position"), false);
3884+ m_pos[i]->sigclicked.connect
3885+ (boost::bind(&Fullscreen_Menu_LaunchSPG::switch_to_position, boost::ref(*this), i));
3886 m_players[i] =
3887 new PlayerDescriptionGroup
3888 (this,
3889
3890=== modified file 'src/ui_fsmenu/launchSPG.h'
3891--- src/ui_fsmenu/launchSPG.h 2010-12-04 23:11:18 +0000
3892+++ src/ui_fsmenu/launchSPG.h 2011-11-26 13:22:27 +0000
3893@@ -75,8 +75,8 @@
3894 uint32_t m_butw;
3895 uint32_t m_buth;
3896
3897- UI::Callback_Button m_select_map, m_wincondition, m_back, m_ok;
3898- UI::Callback_Button * m_pos[MAX_PLAYERS];
3899+ UI::Button m_select_map, m_wincondition, m_back, m_ok;
3900+ UI::Button * m_pos[MAX_PLAYERS];
3901 UI::Textarea m_title, m_mapname;
3902 UI::Textarea m_name, m_type, m_team, m_tribe, m_init;
3903 GameSettingsProvider * m_settings;
3904
3905=== modified file 'src/ui_fsmenu/loadgame.cc'
3906--- src/ui_fsmenu/loadgame.cc 2011-10-23 16:52:10 +0000
3907+++ src/ui_fsmenu/loadgame.cc 2011-11-26 13:22:27 +0000
3908@@ -50,20 +50,16 @@
3909 (this, "back",
3910 get_w() * 71 / 100, get_h() * 9 / 10, m_butw, m_buth,
3911 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
3912- boost::bind(&Fullscreen_Menu_LoadGame::end_modal, boost::ref(*this), 0),
3913 _("Back"), std::string(), true, false),
3914 m_ok
3915 (this, "ok",
3916 get_w() * 71 / 100, get_h() * 15 / 20, m_butw, m_buth,
3917 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
3918- boost::bind(&Fullscreen_Menu_LoadGame::clicked_ok, boost::ref(*this)),
3919 _("OK"), std::string(), false, false),
3920 m_delete
3921 (this, "delete",
3922 get_w() * 71 / 100, get_h() * 17 / 20, m_butw, m_buth,
3923 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
3924- boost::bind
3925- (&Fullscreen_Menu_LoadGame::clicked_delete, boost::ref(*this)),
3926 _("Delete"), std::string(), false, false),
3927
3928 // Savegame list
3929@@ -90,6 +86,12 @@
3930 m_settings(gsp),
3931 m_ctrl(gc)
3932 {
3933+ m_back.sigclicked.connect(boost::bind(&Fullscreen_Menu_LoadGame::end_modal, boost::ref(*this), 0));
3934+ m_ok.sigclicked.connect(boost::bind(&Fullscreen_Menu_LoadGame::clicked_ok, boost::ref(*this)));
3935+ m_delete.sigclicked.connect
3936+ (boost::bind
3937+ (&Fullscreen_Menu_LoadGame::clicked_delete, boost::ref(*this)));
3938+
3939 m_back.set_font(font_small());
3940 m_ok.set_font(font_small());
3941 m_delete.set_font(font_small());
3942@@ -100,8 +102,8 @@
3943 m_label_gametime.set_font(m_fn, m_fs, UI_FONT_CLR_FG);
3944 m_tagametime .set_font(m_fn, m_fs, UI_FONT_CLR_FG);
3945 m_list .set_font(m_fn, m_fs);
3946- m_list.selected.set(this, &Fullscreen_Menu_LoadGame::map_selected);
3947- m_list.double_clicked.set(this, &Fullscreen_Menu_LoadGame::double_clicked);
3948+ m_list.selected.connect(boost::bind(&Fullscreen_Menu_LoadGame::map_selected, this, _1));
3949+ m_list.double_clicked.connect(boost::bind(&Fullscreen_Menu_LoadGame::double_clicked, this, _1));
3950 fill_list();
3951 }
3952
3953
3954=== modified file 'src/ui_fsmenu/loadgame.h'
3955--- src/ui_fsmenu/loadgame.h 2011-10-23 16:52:10 +0000
3956+++ src/ui_fsmenu/loadgame.h 2011-11-26 13:22:27 +0000
3957@@ -64,9 +64,9 @@
3958 std::string m_fn;
3959
3960 Widelands::Game & m_game;
3961- UI::Callback_Button m_back;
3962- UI::Callback_Button m_ok;
3963- UI::Callback_Button m_delete;
3964+ UI::Button m_back;
3965+ UI::Button m_ok;
3966+ UI::Button m_delete;
3967 UI::Listselect<const char *> m_list;
3968 UI::Textarea m_title;
3969 UI::Textarea m_label_mapname;
3970
3971=== modified file 'src/ui_fsmenu/loadreplay.cc'
3972--- src/ui_fsmenu/loadreplay.cc 2011-10-23 16:52:10 +0000
3973+++ src/ui_fsmenu/loadreplay.cc 2011-11-26 13:22:27 +0000
3974@@ -1,5 +1,5 @@
3975 /*
3976- * Copyright (C) 2007-2009 by the Widelands Development Team
3977+ * Copyright (C) 2007-2011 by the Widelands Development Team
3978 *
3979 * This program is free software; you can redistribute it and/or
3980 * modify it under the terms of the GNU General Public License
3981@@ -40,20 +40,16 @@
3982 (this, "back",
3983 get_w() * 71 / 100, get_h() * 9 / 10, m_butw, m_buth,
3984 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
3985- boost::bind(&Fullscreen_Menu_LoadReplay::end_modal, boost::ref(*this), 0),
3986 _("Back"), std::string(), true, false),
3987 m_ok
3988 (this, "ok",
3989 get_w() * 71 / 100, get_h() * 15 / 20, m_butw, m_buth,
3990 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
3991- boost::bind(&Fullscreen_Menu_LoadReplay::clicked_ok, boost::ref(*this)),
3992 _("OK"), std::string(), false, false),
3993 m_delete
3994 (this, "delete",
3995 get_w() * 71 / 100, get_h() * 17 / 20, m_butw, m_buth,
3996 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
3997- boost::bind
3998- (&Fullscreen_Menu_LoadReplay::clicked_delete, boost::ref(*this)),
3999 _("Delete"), std::string(), false, false),
4000
4001 // Replay list
4002@@ -78,11 +74,17 @@
4003 _("Gametime:"), UI::Align_Right),
4004 m_tagametime(this, get_w() * 71 / 100, get_h() * 3 / 8)
4005 {
4006+ m_back.sigclicked.connect(boost::bind(&Fullscreen_Menu_LoadReplay::end_modal, boost::ref(*this), 0));
4007+ m_ok.sigclicked.connect(boost::bind(&Fullscreen_Menu_LoadReplay::clicked_ok, boost::ref(*this)));
4008+ m_delete.sigclicked.connect
4009+ (boost::bind
4010+ (&Fullscreen_Menu_LoadReplay::clicked_delete, boost::ref(*this)));
4011+
4012 m_title.set_textstyle(ts_big());
4013- m_list .set_font(ui_fn(), fs_small());
4014- m_list .selected.set(this, &Fullscreen_Menu_LoadReplay::replay_selected);
4015- m_list .double_clicked.set
4016- (this, &Fullscreen_Menu_LoadReplay::double_clicked);
4017+ m_list.set_font(ui_fn(), fs_small());
4018+ m_list.selected.connect(boost::bind(&Fullscreen_Menu_LoadReplay::replay_selected, this, _1));
4019+ m_list.double_clicked.connect
4020+ (boost::bind(&Fullscreen_Menu_LoadReplay::double_clicked, this, _1));
4021 m_back.set_font(font_small());
4022 m_ok.set_font(font_small());
4023 fill_list();
4024
4025=== modified file 'src/ui_fsmenu/loadreplay.h'
4026--- src/ui_fsmenu/loadreplay.h 2011-10-23 16:52:10 +0000
4027+++ src/ui_fsmenu/loadreplay.h 2011-11-26 13:22:27 +0000
4028@@ -49,9 +49,9 @@
4029 uint32_t m_butw;
4030 uint32_t m_buth;
4031
4032- UI::Callback_Button m_back;
4033- UI::Callback_Button m_ok;
4034- UI::Callback_Button m_delete;
4035+ UI::Button m_back;
4036+ UI::Button m_ok;
4037+ UI::Button m_delete;
4038 UI::Listselect<std::string> m_list;
4039 UI::Textarea m_title;
4040 UI::Textarea m_label_mapname;
4041
4042=== modified file 'src/ui_fsmenu/main.cc'
4043--- src/ui_fsmenu/main.cc 2010-12-04 23:11:18 +0000
4044+++ src/ui_fsmenu/main.cc 2011-11-26 13:22:27 +0000
4045@@ -36,73 +36,46 @@
4046 (this, "play_tutorial",
4047 m_butx, get_h() * 42 / 200, m_butw, m_buth,
4048 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
4049- boost::bind
4050- (&Fullscreen_Menu_Main::end_modal, boost::ref(*this),
4051- static_cast<int32_t>(mm_playtutorial)),
4052 _("Play Tutorial"), std::string(), true, false),
4053 singleplayer
4054 (this, "single_player",
4055 m_butx, get_h() * 61 / 200, m_butw, m_buth,
4056 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
4057- boost::bind
4058- (&Fullscreen_Menu_Main::end_modal, boost::ref(*this),
4059- static_cast<int32_t>(mm_singleplayer)),
4060 _("Single Player"), std::string(), true, false),
4061 multiplayer
4062 (this, "multi_player",
4063 m_butx, get_h() * 37 / 100, m_butw, m_buth,
4064 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
4065- boost::bind
4066- (&Fullscreen_Menu_Main::end_modal, boost::ref(*this),
4067- static_cast<int32_t>(mm_multiplayer)),
4068 _("Multi Player"), std::string(), true, false),
4069 replay
4070 (this, "replay",
4071 m_butx, get_h() * 87 / 200, m_butw, m_buth,
4072 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
4073- boost::bind
4074- (&Fullscreen_Menu_Main::end_modal, boost::ref(*this),
4075- static_cast<int32_t>(mm_replay)),
4076 _("Watch Replay"), std::string(), true, false),
4077 editor
4078 (this, "editor",
4079 m_butx, get_h() * 100 / 200, m_butw, m_buth,
4080 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
4081- boost::bind
4082- (&Fullscreen_Menu_Main::end_modal, boost::ref(*this),
4083- static_cast<int32_t>(mm_editor)),
4084 _("Editor"), std::string(), true, false),
4085 options
4086 (this, "options",
4087 m_butx, get_h() * 119 / 200, m_butw, m_buth,
4088 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
4089- boost::bind
4090- (&Fullscreen_Menu_Main::end_modal, boost::ref(*this),
4091- static_cast<int32_t>(mm_options)),
4092 _("Options"), std::string(), true, false),
4093 readme
4094 (this, "readme",
4095 m_butx, get_h() * 138 / 200, m_butw, m_buth,
4096 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
4097- boost::bind
4098- (&Fullscreen_Menu_Main::end_modal, boost::ref(*this),
4099- static_cast<int32_t>(mm_readme)),
4100 _("View Readme"), std::string(), true, false),
4101 license
4102 (this, "license",
4103 m_butx, get_h() * 151 / 200, m_butw, m_buth,
4104 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
4105- boost::bind
4106- (&Fullscreen_Menu_Main::end_modal, boost::ref(*this),
4107- static_cast<int32_t>(mm_license)),
4108 _("License"), std::string(), true, false),
4109 exit
4110 (this, "exit",
4111 m_butx, get_h() * 178 / 200, m_butw, m_buth,
4112 g_gr->get_picture(PicMod_UI, "pics/but3.png"),
4113- boost::bind
4114- (&Fullscreen_Menu_Main::end_modal, boost::ref(*this),
4115- static_cast<int32_t>(mm_exit)),
4116 _("Exit Game"), std::string(), true, false),
4117
4118 // Textlabels
4119@@ -117,6 +90,43 @@
4120 (wlcr + _("by the Widelands Development Team")).c_str(),
4121 UI::Align_BottomLeft)
4122 {
4123+ playtutorial.sigclicked.connect
4124+ (boost::bind
4125+ (&Fullscreen_Menu_Main::end_modal, boost::ref(*this),
4126+ static_cast<int32_t>(mm_playtutorial)));
4127+ singleplayer.sigclicked.connect
4128+ (boost::bind
4129+ (&Fullscreen_Menu_Main::end_modal, boost::ref(*this),
4130+ static_cast<int32_t>(mm_singleplayer)));
4131+ multiplayer.sigclicked.connect
4132+ (boost::bind
4133+ (&Fullscreen_Menu_Main::end_modal, boost::ref(*this),
4134+ static_cast<int32_t>(mm_multiplayer)));
4135+ replay.sigclicked.connect
4136+ (boost::bind
4137+ (&Fullscreen_Menu_Main::end_modal, boost::ref(*this),
4138+ static_cast<int32_t>(mm_replay)));
4139+ editor.sigclicked.connect
4140+ (boost::bind
4141+ (&Fullscreen_Menu_Main::end_modal, boost::ref(*this),
4142+ static_cast<int32_t>(mm_editor)));
4143+ options.sigclicked.connect
4144+ (boost::bind
4145+ (&Fullscreen_Menu_Main::end_modal, boost::ref(*this),
4146+ static_cast<int32_t>(mm_options)));
4147+ readme.sigclicked.connect
4148+ (boost::bind
4149+ (&Fullscreen_Menu_Main::end_modal, boost::ref(*this),
4150+ static_cast<int32_t>(mm_readme)));
4151+ license.sigclicked.connect
4152+ (boost::bind
4153+ (&Fullscreen_Menu_Main::end_modal, boost::ref(*this),
4154+ static_cast<int32_t>(mm_license)));
4155+ exit.sigclicked.connect
4156+ (boost::bind
4157+ (&Fullscreen_Menu_Main::end_modal, boost::ref(*this),
4158+ static_cast<int32_t>(mm_exit)));
4159+
4160 playtutorial.set_font(font_small());
4161 singleplayer.set_font(font_small());
4162 multiplayer.set_font(font_small());
4163
4164=== modified file 'src/ui_fsmenu/main.h'
4165--- src/ui_fsmenu/main.h 2010-12-04 23:11:18 +0000
4166+++ src/ui_fsmenu/main.h 2011-11-26 13:22:27 +0000
4167@@ -47,15 +47,15 @@
4168 uint32_t m_butw;
4169 uint32_t m_buth;
4170 std::string wlcr;
4171- UI::Callback_Button playtutorial;
4172- UI::Callback_Button singleplayer;
4173- UI::Callback_Button multiplayer;
4174- UI::Callback_Button replay;
4175- UI::Callback_Button editor;
4176- UI::Callback_Button options;
4177- UI::Callback_Button readme;
4178- UI::Callback_Button license;
4179- UI::Callback_Button exit;
4180+ UI::Button playtutorial;
4181+ UI::Button singleplayer;
4182+ UI::Button multiplayer;
4183+ UI::Button replay;
4184+ UI::Button editor;
4185+ UI::Button options;
4186+ UI::Button readme;
4187+ UI::Button license;
4188+ UI::Button exit;
4189 UI::Textarea version;
4190 UI::Textarea copyright;
4191 };
4192
4193=== modified file 'src/ui_fsmenu/mapselect.cc'
4194--- src/ui_fsmenu/mapselect.cc 2011-11-15 16:11:23 +0000
4195+++ src/ui_fsmenu/mapselect.cc 2011-11-26 13:22:27 +0000
4196@@ -102,13 +102,11 @@
4197 (this, "back",
4198 get_w() * 71 / 100, get_h() * 17 / 20, m_butw, m_buth,
4199 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
4200- boost::bind(&Fullscreen_Menu_MapSelect::end_modal, boost::ref(*this), 0),
4201 _("Back"), std::string(), true, false),
4202 m_ok
4203 (this, "ok",
4204 get_w() * 71 / 100, get_h() * 9 / 10, m_butw, m_buth,
4205 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
4206- boost::bind(&Fullscreen_Menu_MapSelect::ok, boost::ref(*this)),
4207 _("OK"), std::string(), false, false),
4208
4209 // Checkbox
4210@@ -125,6 +123,9 @@
4211 m_settings(settings),
4212 m_ctrl(ctrl)
4213 {
4214+ m_back.sigclicked.connect(boost::bind(&Fullscreen_Menu_MapSelect::end_modal, boost::ref(*this), 0));
4215+ m_ok.sigclicked.connect(boost::bind(&Fullscreen_Menu_MapSelect::ok, boost::ref(*this)));
4216+
4217 m_title.set_textstyle(ts_big());
4218 m_label_load_map_as_scenario.set_textstyle(ts_small());
4219 m_label_name .set_textstyle(ts_small());
4220@@ -157,8 +158,8 @@
4221 m_load_map_as_scenario.set_state(false);
4222 m_load_map_as_scenario.set_enabled(false);
4223
4224- m_table.selected.set(this, &Fullscreen_Menu_MapSelect::map_selected);
4225- m_table.double_clicked.set(this, &Fullscreen_Menu_MapSelect::double_clicked);
4226+ m_table.selected.connect(boost::bind(&Fullscreen_Menu_MapSelect::map_selected, this, _1));
4227+ m_table.double_clicked.connect(boost::bind(&Fullscreen_Menu_MapSelect::double_clicked, this, _1));
4228
4229 UI::Box * vbox = new UI::Box
4230 (this, m_table.get_x(), m_table.get_y() - 120, UI::Box::Horizontal, m_table.get_w());
4231@@ -536,9 +537,8 @@
4232 m_tags_ordered.push_back(tag);
4233
4234 UI::Checkbox * cb = new UI::Checkbox(box, Point(0, 0));
4235- cb->set_id(id);
4236- cb->changedtoid.set
4237- (this, &Fullscreen_Menu_MapSelect::_tagbox_changed);
4238+ cb->changedto.connect
4239+ (boost::bind(&Fullscreen_Menu_MapSelect::_tagbox_changed, this, id, _1));
4240
4241 box->add(cb, UI::Box::AlignLeft, true);
4242 UI::Textarea * ta = new UI::Textarea(box, displ_name, UI::Align_CenterLeft, 100);
4243
4244=== modified file 'src/ui_fsmenu/mapselect.h'
4245--- src/ui_fsmenu/mapselect.h 2011-11-15 16:11:23 +0000
4246+++ src/ui_fsmenu/mapselect.h 2011-11-26 13:22:27 +0000
4247@@ -96,7 +96,7 @@
4248 UI::Textarea m_label_nr_players, m_nr_players;
4249 UI::Textarea m_label_descr;
4250 UI::Multiline_Textarea m_descr;
4251- UI::Callback_Button m_back, m_ok;
4252+ UI::Button m_back, m_ok;
4253 UI::Checkbox m_load_map_as_scenario;
4254 UI::Checkbox * m_show_all_maps;
4255 std::vector<UI::Checkbox *> m_tags_checkboxes;
4256
4257=== modified file 'src/ui_fsmenu/multiplayer.cc'
4258--- src/ui_fsmenu/multiplayer.cc 2010-12-04 23:11:18 +0000
4259+++ src/ui_fsmenu/multiplayer.cc 2011-11-26 13:22:27 +0000
4260@@ -47,28 +47,30 @@
4261 (this, "metaserver",
4262 m_butx, get_h() * 6 / 25, m_butw, m_buth,
4263 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
4264- boost::bind(&Fullscreen_Menu_MultiPlayer::ggzLogin, boost::ref(*this)),
4265 _("Internet game"), std::string(), true, false),
4266 lan
4267 (this, "lan",
4268 m_butx, get_h() * 61 / 200, m_butw, m_buth,
4269 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
4270- boost::bind
4271- (&Fullscreen_Menu_MultiPlayer::end_modal, boost::ref(*this),
4272- static_cast<int32_t>(Lan)),
4273 _("LAN / Direct IP"), std::string(), true, false),
4274 back
4275 (this, "back",
4276 m_butx, get_h() * 3 / 4, m_butw, m_buth,
4277 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
4278- boost::bind
4279- (&Fullscreen_Menu_MultiPlayer::end_modal, boost::ref(*this),
4280- static_cast<int32_t>(Back)),
4281 _("Back"), std::string(), true, false)
4282 {
4283+ metaserver.sigclicked.connect(boost::bind(&Fullscreen_Menu_MultiPlayer::ggzLogin, boost::ref(*this)));
4284 metaserver.set_font(font_small());
4285 lan.set_font(font_small());
4286+ lan.sigclicked.connect
4287+ (boost::bind
4288+ (&Fullscreen_Menu_MultiPlayer::end_modal, boost::ref(*this),
4289+ static_cast<int32_t>(Lan)));
4290 back.set_font(font_small());
4291+ back.sigclicked.connect
4292+ (boost::bind
4293+ (&Fullscreen_Menu_MultiPlayer::end_modal, boost::ref(*this),
4294+ static_cast<int32_t>(Back)));
4295
4296 title.set_font(m_fn, fs_big(), UI_FONT_CLR_FG);
4297
4298@@ -76,14 +78,15 @@
4299 m_auto_log = s.get_bool("auto_log", false);
4300 if (m_auto_log) {
4301 showloginbox =
4302- new UI::Callback_Button
4303+ new UI::Button
4304 (this, "login_dialog",
4305 m_butx + m_butw + m_buth / 4, get_h() * 6 / 25, m_buth, m_buth,
4306 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
4307 g_gr->get_picture(PicMod_UI, "pics/continue.png"),
4308- boost::bind
4309- (&Fullscreen_Menu_MultiPlayer::showGGZLogin, boost::ref(*this)),
4310 _("Show login dialog"), true, false);
4311+ showloginbox->sigclicked.connect
4312+ (boost::bind
4313+ (&Fullscreen_Menu_MultiPlayer::showGGZLogin, boost::ref(*this)));
4314 showloginbox->set_font(font_small());
4315 }
4316 }
4317
4318=== modified file 'src/ui_fsmenu/multiplayer.h'
4319--- src/ui_fsmenu/multiplayer.h 2010-10-17 19:42:01 +0000
4320+++ src/ui_fsmenu/multiplayer.h 2011-11-26 13:22:27 +0000
4321@@ -51,10 +51,10 @@
4322 uint32_t m_fs;
4323 std::string m_fn;
4324 UI::Textarea title;
4325- UI::Callback_Button metaserver;
4326- UI::Callback_Button * showloginbox;
4327- UI::Callback_Button lan;
4328- UI::Callback_Button back;
4329+ UI::Button metaserver;
4330+ UI::Button * showloginbox;
4331+ UI::Button lan;
4332+ UI::Button back;
4333
4334 // Values from ggz login window
4335 std::string m_nickname;
4336
4337=== modified file 'src/ui_fsmenu/netsetup_ggz.cc'
4338--- src/ui_fsmenu/netsetup_ggz.cc 2011-07-31 18:09:39 +0000
4339+++ src/ui_fsmenu/netsetup_ggz.cc 2011-11-26 13:22:27 +0000
4340@@ -76,31 +76,22 @@
4341 (this, "join_game",
4342 get_w() * 17 / 25, get_h() * 55 / 100, m_butw, m_buth,
4343 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
4344- boost::bind
4345- (&Fullscreen_Menu_NetSetupGGZ::clicked_joingame,
4346- boost::ref(*this)),
4347 _("Join this game"), std::string(), false, false),
4348 hostgame
4349 (this, "host_game",
4350 get_w() * 17 / 25, get_h() * 81 / 100, m_butw, m_buth,
4351 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
4352- boost::bind
4353- (&Fullscreen_Menu_NetSetupGGZ::clicked_hostgame,
4354- boost::ref(*this)),
4355 _("Open a new game"), std::string(), true, false),
4356 back
4357 (this, "back",
4358 get_w() * 17 / 25, get_h() * 90 / 100, m_butw, m_buth,
4359 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
4360- boost::bind
4361- (&Fullscreen_Menu_NetSetupGGZ::end_modal,
4362- boost::ref(*this), static_cast<int32_t>(CANCEL)),
4363 _("Back"), std::string(), true, false),
4364
4365 // Edit boxes
4366 servername
4367 (this, get_w() * 17 / 25, get_h() * 68 / 100, m_butw, m_buth,
4368- g_gr->get_picture(PicMod_UI, "pics/but2.png"), 0),
4369+ g_gr->get_picture(PicMod_UI, "pics/but2.png")),
4370
4371 // List
4372 usersonline
4373@@ -124,6 +115,19 @@
4374 password(pwd),
4375 reg(registered)
4376 {
4377+ joingame.sigclicked.connect
4378+ (boost::bind
4379+ (&Fullscreen_Menu_NetSetupGGZ::clicked_joingame,
4380+ boost::ref(*this)));
4381+ hostgame.sigclicked.connect
4382+ (boost::bind
4383+ (&Fullscreen_Menu_NetSetupGGZ::clicked_hostgame,
4384+ boost::ref(*this)));
4385+ back.sigclicked.connect
4386+ (boost::bind
4387+ (&Fullscreen_Menu_NetSetupGGZ::end_modal,
4388+ boost::ref(*this), static_cast<int32_t>(CANCEL)));
4389+
4390 back.set_font(font_small());
4391 joingame.set_font(font_small());
4392 hostgame.set_font(font_small());
4393@@ -139,8 +143,8 @@
4394 maxplayers .set_font(m_fn, m_fs, UI_FONT_CLR_FG);
4395 std::string server = s.get_string("servername", "");
4396 servername .setText (server);
4397- servername .changed.set
4398- (this, &Fullscreen_Menu_NetSetupGGZ::change_servername);
4399+ servername .changed.connect
4400+ (boost::bind(&Fullscreen_Menu_NetSetupGGZ::change_servername, this));
4401 servername .set_font(m_fn, m_fs, UI_FONT_CLR_FG);
4402
4403 // prepare the lists
4404@@ -153,13 +157,13 @@
4405 (0,
4406 boost::bind
4407 (&Fullscreen_Menu_NetSetupGGZ::compare_usertype, this, _1, _2));
4408- usersonline .double_clicked.set
4409- (this, &Fullscreen_Menu_NetSetupGGZ::user_doubleclicked);
4410+ usersonline .double_clicked.connect
4411+ (boost::bind(&Fullscreen_Menu_NetSetupGGZ::user_doubleclicked, this, _1));
4412 opengames .set_font(m_fn, m_fs);
4413- opengames .selected.set
4414- (this, &Fullscreen_Menu_NetSetupGGZ::server_selected);
4415- opengames .double_clicked.set
4416- (this, &Fullscreen_Menu_NetSetupGGZ::server_doubleclicked);
4417+ opengames .selected.connect
4418+ (boost::bind(&Fullscreen_Menu_NetSetupGGZ::server_selected, this, _1));
4419+ opengames .double_clicked.connect
4420+ (boost::bind(&Fullscreen_Menu_NetSetupGGZ::server_doubleclicked, this, _1));
4421
4422 // try to connect to the metaserver
4423 if (!NetGGZ::ref().usedcore())
4424
4425=== modified file 'src/ui_fsmenu/netsetup_ggz.h'
4426--- src/ui_fsmenu/netsetup_ggz.h 2011-07-31 18:09:39 +0000
4427+++ src/ui_fsmenu/netsetup_ggz.h 2011-11-26 13:22:27 +0000
4428@@ -59,21 +59,21 @@
4429 }
4430
4431 private:
4432- uint32_t m_butx;
4433- uint32_t m_butw;
4434- uint32_t m_buth;
4435- uint32_t m_lisw;
4436- uint32_t m_fs;
4437- std::string m_fn;
4438- UI::Textarea title, m_users, m_opengames;
4439- UI::Textarea m_servername;
4440- UI::Textarea m_maxplayers;
4441- UI::SpinBox maxplayers;
4442- UI::Callback_Button joingame, hostgame, back;
4443- UI::EditBox servername;
4444- UI::Table<const Net_Player * const> usersonline;
4445- UI::Listselect<Net_Open_Game> opengames;
4446- GameChatPanel chat;
4447+ uint32_t m_butx;
4448+ uint32_t m_butw;
4449+ uint32_t m_buth;
4450+ uint32_t m_lisw;
4451+ uint32_t m_fs;
4452+ std::string m_fn;
4453+ UI::Textarea title, m_users, m_opengames;
4454+ UI::Textarea m_servername;
4455+ UI::Textarea m_maxplayers;
4456+ UI::SpinBox maxplayers;
4457+ UI::Button joingame, hostgame, back;
4458+ UI::EditBox servername;
4459+ UI::Table<const Net_Player * const> usersonline;
4460+ UI::Listselect<Net_Open_Game> opengames;
4461+ GameChatPanel chat;
4462
4463 // Login information
4464 const char * nickname;
4465
4466=== modified file 'src/ui_fsmenu/netsetup_lan.cc'
4467--- src/ui_fsmenu/netsetup_lan.cc 2010-12-04 23:11:18 +0000
4468+++ src/ui_fsmenu/netsetup_lan.cc 2011-11-26 13:22:27 +0000
4469@@ -1,5 +1,5 @@
4470 /*
4471- * Copyright (C) 2004, 2006-2009 by the Widelands Development Team
4472+ * Copyright (C) 2004, 2006-2011 by the Widelands Development Team
4473 *
4474 * This program is free software; you can redistribute it and/or
4475 * modify it under the terms of the GNU General Public License
4476@@ -56,46 +56,51 @@
4477 (this, "join_game",
4478 get_w() * 16 / 25, get_h() * 5333 / 10000, m_butw, m_buth,
4479 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
4480- boost::bind
4481- (&Fullscreen_Menu_NetSetupLAN::clicked_joingame, boost::ref(*this)),
4482 _("Join this game"), std::string(), true, false),
4483 hostgame
4484 (this, "host_game",
4485 get_w() * 16 / 25, get_h() * 6083 / 10000, m_butw, m_buth,
4486 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
4487- boost::bind
4488- (&Fullscreen_Menu_NetSetupLAN::clicked_hostgame, boost::ref(*this)),
4489 _("Host a new game"), std::string(), true, false),
4490 back
4491 (this, "back",
4492 get_w() * 16 / 25, get_h() * 8333 / 10000, m_butw, m_buth,
4493 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
4494- boost::bind
4495- (&Fullscreen_Menu_NetSetupLAN::end_modal, boost::ref(*this),
4496- static_cast<int32_t>(CANCEL)),
4497 _("Back"), std::string(), true, false),
4498 loadlasthost
4499 (this, "load_previous_host",
4500 get_w() * 171 / 200, get_h() * 19 / 40, m_buth, m_buth,
4501 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
4502 g_gr->get_picture(PicMod_UI, "pics/menu_load_game.png"),
4503- boost::bind
4504- (&Fullscreen_Menu_NetSetupLAN::clicked_lasthost, boost::ref(*this)),
4505 _("Load previous host"), true, false),
4506
4507 // Edit boxes
4508 playername
4509 (this, get_w() * 16 / 25, get_h() * 3333 / 10000, m_butw, m_buth,
4510- g_gr->get_picture(PicMod_UI, "pics/but2.png"), 0),
4511+ g_gr->get_picture(PicMod_UI, "pics/but2.png")),
4512 hostname
4513 (this, get_w() * 16 / 25, get_h() * 19 / 40, get_w() * 17 / 80, m_buth,
4514- g_gr->get_picture(PicMod_UI, "pics/but2.png"), 0),
4515+ g_gr->get_picture(PicMod_UI, "pics/but2.png")),
4516
4517 // List
4518 opengames
4519 (this,
4520 get_w() * 3 / 50, get_h() * 3333 / 10000, m_lisw, get_h() * 5433 / 10000)
4521 {
4522+ joingame.sigclicked.connect
4523+ (boost::bind
4524+ (&Fullscreen_Menu_NetSetupLAN::clicked_joingame, boost::ref(*this)));
4525+ hostgame.sigclicked.connect
4526+ (boost::bind
4527+ (&Fullscreen_Menu_NetSetupLAN::clicked_hostgame, boost::ref(*this)));
4528+ back.sigclicked.connect
4529+ (boost::bind
4530+ (&Fullscreen_Menu_NetSetupLAN::end_modal, boost::ref(*this),
4531+ static_cast<int32_t>(CANCEL)));
4532+ loadlasthost.sigclicked.connect
4533+ (boost::bind
4534+ (&Fullscreen_Menu_NetSetupLAN::clicked_lasthost, boost::ref(*this)));
4535+
4536 Section & s = g_options.pull_section("global"); // for playername
4537
4538 joingame.set_font(font_small());
4539@@ -107,20 +112,20 @@
4540 m_opengames .set_textstyle(ts_small());
4541 m_playername.set_textstyle(ts_small());
4542 m_hostname .set_textstyle(ts_small());
4543- hostname .changed.set
4544- (this, &Fullscreen_Menu_NetSetupLAN::change_hostname);
4545+ hostname .changed.connect
4546+ (boost::bind(&Fullscreen_Menu_NetSetupLAN::change_hostname, this));
4547 hostname .set_font(ui_fn(), fs_small(), UI_FONT_CLR_FG);
4548 playername .setText (s.get_string("nickname", (_("nobody"))));
4549- playername .changed.set
4550- (this, &Fullscreen_Menu_NetSetupLAN::change_playername);
4551+ playername .changed.connect
4552+ (boost::bind(&Fullscreen_Menu_NetSetupLAN::change_playername, this));
4553 playername .set_font(ui_fn(), fs_small(), UI_FONT_CLR_FG);
4554 opengames .set_font(ui_fn(), fs_small());
4555 opengames .add_column(m_lisw * 2 / 5, _("Host"));
4556 opengames .add_column(m_lisw * 2 / 5, _("Map"));
4557 opengames .add_column(m_lisw / 5, _("State"));
4558- opengames .selected.set(this, &Fullscreen_Menu_NetSetupLAN::game_selected);
4559- opengames .double_clicked.set
4560- (this, &Fullscreen_Menu_NetSetupLAN::game_doubleclicked);
4561+ opengames .selected.connect(boost::bind(&Fullscreen_Menu_NetSetupLAN::game_selected, this, _1));
4562+ opengames .double_clicked.connect
4563+ (boost::bind(&Fullscreen_Menu_NetSetupLAN::game_doubleclicked, this, _1));
4564 discovery .set_callback (discovery_callback, this);
4565
4566 joingame.set_enabled(false);
4567
4568=== modified file 'src/ui_fsmenu/netsetup_lan.h'
4569--- src/ui_fsmenu/netsetup_lan.h 2010-12-04 23:11:18 +0000
4570+++ src/ui_fsmenu/netsetup_lan.h 2011-11-26 13:22:27 +0000
4571@@ -1,5 +1,5 @@
4572 /*
4573- * Copyright (C) 2004, 2006-2009 by the Widelands Development Team
4574+ * Copyright (C) 2004, 2006-2011 by the Widelands Development Team
4575 *
4576 * This program is free software; you can redistribute it and/or
4577 * modify it under the terms of the GNU General Public License
4578@@ -61,17 +61,17 @@
4579 std::string const & get_playername();
4580
4581 private:
4582- uint32_t m_butx;
4583- uint32_t m_butw;
4584- uint32_t m_buth;
4585- uint32_t m_lisw;
4586- UI::Textarea title, m_opengames;
4587- UI::Textarea m_playername, m_hostname;
4588- UI::Callback_Button joingame, hostgame, back, loadlasthost;
4589- UI::EditBox playername;
4590- UI::EditBox hostname;
4591- UI::Table<const Net_Open_Game * const> opengames;
4592- LAN_Game_Finder discovery;
4593+ uint32_t m_butx;
4594+ uint32_t m_butw;
4595+ uint32_t m_buth;
4596+ uint32_t m_lisw;
4597+ UI::Textarea title, m_opengames;
4598+ UI::Textarea m_playername, m_hostname;
4599+ UI::Button joingame, hostgame, back, loadlasthost;
4600+ UI::EditBox playername;
4601+ UI::EditBox hostname;
4602+ UI::Table<const Net_Open_Game * const> opengames;
4603+ LAN_Game_Finder discovery;
4604
4605 void game_selected (uint32_t);
4606 void game_doubleclicked (uint32_t);
4607
4608=== modified file 'src/ui_fsmenu/options.cc'
4609--- src/ui_fsmenu/options.cc 2011-02-18 14:38:56 +0000
4610+++ src/ui_fsmenu/options.cc 2011-11-26 13:22:27 +0000
4611@@ -48,19 +48,16 @@
4612 (this, "advanced_options",
4613 get_w() * 9 / 80, get_h() * 19 / 20, m_butw, m_buth,
4614 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
4615- boost::bind(&Fullscreen_Menu_Options::advanced_options, boost::ref(*this)),
4616 _("Advanced Options"), std::string(), true, false),
4617 m_cancel
4618 (this, "cancel",
4619 get_w() * 51 / 80, get_h() * 19 / 20, m_butw, m_buth,
4620 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
4621- boost::bind(&Fullscreen_Menu_Options::end_modal, boost::ref(*this), static_cast<int32_t>(om_cancel)),
4622 _("Cancel"), std::string(), true, false),
4623 m_apply
4624 (this, "apply",
4625 get_w() * 3 / 8, get_h() * 19 / 20, m_butw, m_buth,
4626 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
4627- boost::bind(&Fullscreen_Menu_Options::end_modal, boost::ref(*this), static_cast<int32_t>(om_ok)),
4628 _("Apply"), std::string(), true, false),
4629
4630 // Spinboxes
4631@@ -187,6 +184,13 @@
4632
4633 os(opt)
4634 {
4635+ m_advanced_options.sigclicked.connect
4636+ (boost::bind(&Fullscreen_Menu_Options::advanced_options, boost::ref(*this)));
4637+ m_cancel.sigclicked.connect
4638+ (boost::bind(&Fullscreen_Menu_Options::end_modal, this, static_cast<int32_t>(om_cancel)));
4639+ m_apply.sigclicked.connect
4640+ (boost::bind(&Fullscreen_Menu_Options::end_modal, this, static_cast<int32_t>(om_ok)));
4641+
4642 m_advanced_options.set_font(font_small());
4643 m_apply.set_font(font_small());
4644 m_cancel.set_font(font_small());
4645@@ -383,19 +387,11 @@
4646 (this, "cancel",
4647 get_w() * 41 / 80, get_h() * 19 / 20, m_butw, m_buth,
4648 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
4649- boost::bind
4650- (&Fullscreen_Menu_Advanced_Options::end_modal,
4651- boost::ref(*this),
4652- static_cast<int32_t>(om_cancel)),
4653 _("Cancel"), std::string(), true, false),
4654 m_apply
4655 (this, "apply",
4656 get_w() / 4, get_h() * 19 / 20, m_butw, m_buth,
4657 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
4658- boost::bind
4659- (&Fullscreen_Menu_Advanced_Options::end_modal,
4660- boost::ref(*this),
4661- static_cast<int32_t>(om_ok)),
4662 _("Apply"), std::string(), true, false),
4663
4664 // Spinboxes
4665@@ -479,6 +475,17 @@
4666
4667 os(opt)
4668 {
4669+ m_cancel.sigclicked.connect
4670+ (boost::bind
4671+ (&Fullscreen_Menu_Advanced_Options::end_modal,
4672+ boost::ref(*this),
4673+ static_cast<int32_t>(om_cancel)));
4674+ m_apply.sigclicked.connect
4675+ (boost::bind
4676+ (&Fullscreen_Menu_Advanced_Options::end_modal,
4677+ boost::ref(*this),
4678+ static_cast<int32_t>(om_ok)));
4679+
4680 m_cancel.set_font(font_small());
4681 m_apply.set_font(font_small());
4682
4683
4684=== modified file 'src/ui_fsmenu/options.h'
4685--- src/ui_fsmenu/options.h 2010-12-04 23:11:18 +0000
4686+++ src/ui_fsmenu/options.h 2011-11-26 13:22:27 +0000
4687@@ -93,7 +93,7 @@
4688 uint32_t m_vbutw;
4689 uint32_t m_butw;
4690 uint32_t m_buth;
4691- UI::Callback_Button m_advanced_options, m_cancel, m_apply;
4692+ UI::Button m_advanced_options, m_cancel, m_apply;
4693 UI::SpinBox m_sb_maxfps, m_sb_autosave;
4694 UI::SpinBox m_sb_remove_replays;
4695 UI::Textarea m_title;
4696@@ -152,7 +152,7 @@
4697 uint32_t m_butw;
4698 uint32_t m_buth;
4699
4700- UI::Callback_Button m_cancel, m_apply;
4701+ UI::Button m_cancel, m_apply;
4702 UI::SpinBox m_sb_speed, m_sb_dis_panel, m_sb_dis_border;
4703 UI::Textarea m_title;
4704 UI::Listselect<std::string> m_ui_font_list;
4705
4706=== modified file 'src/ui_fsmenu/singleplayer.cc'
4707--- src/ui_fsmenu/singleplayer.cc 2010-12-04 23:11:18 +0000
4708+++ src/ui_fsmenu/singleplayer.cc 2011-11-26 13:22:27 +0000
4709@@ -43,36 +43,41 @@
4710 (this, "new_game",
4711 m_butx, get_h() * 6 / 25, m_butw, m_buth,
4712 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
4713- boost::bind
4714- (&Fullscreen_Menu_SinglePlayer::end_modal,
4715- boost::ref(*this),
4716- static_cast<int32_t>(New_Game)),
4717 _("New Game"), std::string(), true, false),
4718 campaign
4719 (this, "campaigns",
4720 m_butx, get_h() * 61 / 200, m_butw, m_buth,
4721 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
4722- boost::bind
4723- (&Fullscreen_Menu_SinglePlayer::end_modal,
4724- boost::ref(*this),
4725- static_cast<int32_t>(Campaign)),
4726 _("Campaigns"), std::string(), true, false),
4727 load_game
4728 (this, "load_game",
4729 m_butx, get_h() * 87 / 200, m_butw, m_buth,
4730 g_gr->get_picture(PicMod_UI, "pics/but1.png"),
4731- boost::bind
4732- (&Fullscreen_Menu_SinglePlayer::end_modal,
4733- boost::ref(*this),
4734- static_cast<int32_t>(Load_Game)),
4735 _("Load Game"), std::string(), true, false),
4736 back
4737 (this, "back",
4738 m_butx, get_h() * 3 / 4, m_butw, m_buth,
4739 g_gr->get_picture(PicMod_UI, "pics/but0.png"),
4740- boost::bind(&Fullscreen_Menu_SinglePlayer::end_modal, boost::ref(*this), static_cast<int32_t>(Back)),
4741 _("Back"), std::string(), true, false)
4742 {
4743+ new_game.sigclicked.connect
4744+ (boost::bind
4745+ (&Fullscreen_Menu_SinglePlayer::end_modal,
4746+ boost::ref(*this),
4747+ static_cast<int32_t>(New_Game)));
4748+ campaign.sigclicked.connect
4749+ (boost::bind
4750+ (&Fullscreen_Menu_SinglePlayer::end_modal,
4751+ boost::ref(*this),
4752+ static_cast<int32_t>(Campaign)));
4753+ load_game.sigclicked.connect
4754+ (boost::bind
4755+ (&Fullscreen_Menu_SinglePlayer::end_modal,
4756+ boost::ref(*this),
4757+ static_cast<int32_t>(Load_Game)));
4758+ back.sigclicked.connect
4759+ (boost::bind(&Fullscreen_Menu_SinglePlayer::end_modal, boost::ref(*this), static_cast<int32_t>(Back)));
4760+
4761 back.set_font(font_small());
4762 new_game.set_font(font_small());
4763 campaign.set_font(font_small());
4764
4765=== modified file 'src/ui_fsmenu/singleplayer.h'
4766--- src/ui_fsmenu/singleplayer.h 2010-10-17 19:42:01 +0000
4767+++ src/ui_fsmenu/singleplayer.h 2011-11-26 13:22:27 +0000
4768@@ -41,10 +41,10 @@
4769 uint32_t m_fs;
4770 std::string m_fn;
4771 UI::Textarea title;
4772- UI::Callback_Button new_game;
4773- UI::Callback_Button campaign;
4774- UI::Callback_Button load_game;
4775- UI::Callback_Button back;
4776+ UI::Button new_game;
4777+ UI::Button campaign;
4778+ UI::Button load_game;
4779+ UI::Button back;
4780 };
4781
4782 #endif
4783
4784=== modified file 'src/wui/attack_box.cc'
4785--- src/wui/attack_box.cc 2010-12-04 23:11:18 +0000
4786+++ src/wui/attack_box.cc 2011-11-26 13:22:27 +0000
4787@@ -1,5 +1,5 @@
4788 /*
4789- * Copyright (C) 2002-2004, 2006-2010 by the Widelands Development Team
4790+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
4791 *
4792 * This program is free software; you can redistribute it and/or
4793 * modify it under the terms of the GNU General Public License
4794@@ -105,22 +105,22 @@
4795 return result;
4796 }
4797
4798-UI::Callback_Button & AttackBox::add_button
4799+UI::Button & AttackBox::add_button
4800 (UI::Box & parent,
4801 char const * const text,
4802 void (AttackBox::*fn)(),
4803 std::string const & tooltip_text)
4804 {
4805- UI::Callback_Button & button =
4806- *new UI::Callback_Button
4807+ UI::Button * button =
4808+ new UI::Button
4809 (&parent, text,
4810 8, 8, 26, 26,
4811 g_gr->get_picture(PicMod_UI, "pics/but2.png"),
4812- boost::bind(fn, boost::ref(*this)),
4813 text,
4814 tooltip_text);
4815- parent.add(&button, Box::AlignCenter);
4816- return button;
4817+ button->sigclicked.connect(boost::bind(fn, boost::ref(*this)));
4818+ parent.add(button, Box::AlignCenter);
4819+ return *button;
4820 }
4821
4822 void AttackBox::update_attack() {
4823@@ -198,7 +198,7 @@
4824 "pics/but2.png",
4825 _("Number of soldiers"));
4826
4827- m_slider_soldiers->changed.set(this, &AttackBox::update_attack);
4828+ m_slider_soldiers->changed.connect(boost::bind(&AttackBox::update_attack, this));
4829
4830 sprintf(buf, "%u", max_attackers);
4831 m_add_soldiers =
4832@@ -237,7 +237,7 @@
4833 m_pl->get_retreat_percentage(),
4834 "pics/but2.png",
4835 _("Supported damage before retreat"));
4836- m_slider_retreat->changed.set(this, &AttackBox::update_attack);
4837+ m_slider_retreat->changed.connect(boost::bind(&AttackBox::update_attack, this));
4838 add_text(linebox, _("Once injured"));
4839 m_slider_retreat->set_enabled(m_pl->is_retreat_change_allowed());
4840 linebox.set_visible(m_pl->is_retreat_change_allowed());
4841
4842=== modified file 'src/wui/attack_box.h'
4843--- src/wui/attack_box.h 2010-10-17 19:42:01 +0000
4844+++ src/wui/attack_box.h 2011-11-26 13:22:27 +0000
4845@@ -69,7 +69,7 @@
4846 uint32_t alignment = UI::Box::AlignTop,
4847 std::string const & fontname = UI_FONT_NAME,
4848 uint32_t fontsize = UI_FONT_SIZE_SMALL);
4849- UI::Callback_Button & add_button
4850+ UI::Button & add_button
4851 (UI::Box & parent,
4852 char const * picname,
4853 void (AttackBox::*fn)(),
4854@@ -89,8 +89,8 @@
4855 UI::Textarea * m_text_soldiers;
4856 UI::Textarea * m_text_retreat;
4857
4858- UI::Callback_Button * m_less_soldiers;
4859- UI::Callback_Button * m_add_soldiers;
4860+ UI::Button * m_less_soldiers;
4861+ UI::Button * m_add_soldiers;
4862 };
4863
4864 #endif
4865
4866=== modified file 'src/wui/building_statistics_menu.cc'
4867--- src/wui/building_statistics_menu.cc 2011-02-18 15:33:09 +0000
4868+++ src/wui/building_statistics_menu.cc 2011-11-26 13:22:27 +0000
4869@@ -114,7 +114,7 @@
4870 m_table.add_column (50, _("Prod"), UI::Align_Right);
4871 m_table.add_column (50, _("Owned"), UI::Align_Right);
4872 m_table.add_column (50, _("Build"), UI::Align_HCenter);
4873- m_table.selected.set(this, &Building_Statistics_Menu::table_changed);
4874+ m_table.selected.connect(boost::bind(&Building_Statistics_Menu::table_changed, this, _1));
4875 m_table.set_column_compare
4876 (Columns::Size,
4877 boost::bind
4878@@ -124,64 +124,70 @@
4879 m_progbar.set_total(100);
4880
4881 m_btn[Prev_Owned] =
4882- new UI::Callback_Button
4883+ new UI::Button
4884 (this, "previous_owned",
4885 JUMP_PREV_BUTTON_X, OWNED_Y, 24, 24,
4886 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
4887 g_gr->get_picture(PicMod_UI, "pics/scrollbar_left.png"),
4888- boost::bind(&Building_Statistics_Menu::clicked_jump, boost::ref(*this), Prev_Owned),
4889 _("Show previous"),
4890 false);
4891+ m_btn[Prev_Owned]->sigclicked.connect
4892+ (boost::bind(&Building_Statistics_Menu::clicked_jump, boost::ref(*this), Prev_Owned));
4893
4894 m_btn[Next_Owned] =
4895- new UI::Callback_Button
4896+ new UI::Button
4897 (this, "next_owned",
4898 JUMP_NEXT_BUTTON_X, OWNED_Y, 24, 24,
4899 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
4900 g_gr->get_picture(PicMod_UI, "pics/scrollbar_right.png"),
4901- boost::bind(&Building_Statistics_Menu::clicked_jump, boost::ref(*this), Next_Owned),
4902 _("Show next"),
4903 false);
4904+ m_btn[Next_Owned]->sigclicked.connect
4905+ (boost::bind(&Building_Statistics_Menu::clicked_jump, boost::ref(*this), Next_Owned));
4906
4907 m_btn[Prev_Construction] =
4908- new UI::Callback_Button
4909+ new UI::Button
4910 (this, "previous_constructed",
4911 JUMP_PREV_BUTTON_X, IN_BUILD_Y, 24, 24,
4912 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
4913 g_gr->get_picture(PicMod_UI, "pics/scrollbar_left.png"),
4914- boost::bind(&Building_Statistics_Menu::clicked_jump, boost::ref(*this), Prev_Construction),
4915 _("Show previous"),
4916 false);
4917+ m_btn[Prev_Construction]->sigclicked.connect
4918+ (boost::bind(&Building_Statistics_Menu::clicked_jump, boost::ref(*this), Prev_Construction));
4919
4920 m_btn[Next_Construction] =
4921- new UI::Callback_Button
4922+ new UI::Button
4923 (this, "next_constructed",
4924 JUMP_NEXT_BUTTON_X, IN_BUILD_Y, 24, 24,
4925 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
4926 g_gr->get_picture(PicMod_UI, "pics/scrollbar_right.png"),
4927- boost::bind(&Building_Statistics_Menu::clicked_jump, boost::ref(*this), Next_Construction),
4928 _("Show next"),
4929 false);
4930+ m_btn[Next_Construction]->sigclicked.connect
4931+ (boost::bind(&Building_Statistics_Menu::clicked_jump, boost::ref(*this), Next_Construction));
4932
4933 m_btn[Prev_Unproductive] =
4934- new UI::Callback_Button
4935+ new UI::Button
4936 (this, "previous_unproductive",
4937 JUMP_PREV_BUTTON_X, UNPRODUCTIVE_Y, 24, 24,
4938 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
4939 g_gr->get_picture(PicMod_UI, "pics/scrollbar_left.png"),
4940- boost::bind(&Building_Statistics_Menu::clicked_jump, boost::ref(*this), Prev_Unproductive),
4941 _("Show previous"),
4942 false);
4943+ m_btn[Prev_Unproductive]->sigclicked.connect
4944+ (boost::bind(&Building_Statistics_Menu::clicked_jump, boost::ref(*this), Prev_Unproductive));
4945
4946 m_btn[Next_Unproductive] =
4947- new UI::Callback_Button
4948+ new UI::Button
4949 (this, "next_unproductive",
4950 JUMP_NEXT_BUTTON_X, UNPRODUCTIVE_Y, 24, 24,
4951 g_gr->get_picture(PicMod_UI, "pics/but4.png"),
4952 g_gr->get_picture(PicMod_UI, "pics/scrollbar_right.png"),
4953- boost::bind(&Building_Statistics_Menu::clicked_jump, boost::ref(*this), Next_Unproductive),
4954 _("Show next"),
4955 false);
4956+ m_btn[Next_Unproductive]->sigclicked.connect
4957+ (boost::bind(&Building_Statistics_Menu::clicked_jump, boost::ref(*this), Next_Unproductive));
4958 }
4959
4960
4961
4962=== modified file 'src/wui/building_statistics_menu.h'
4963--- src/wui/building_statistics_menu.h 2011-02-18 15:33:09 +0000
4964+++ src/wui/building_statistics_menu.h 2011-11-26 13:22:27 +0000
4965@@ -28,7 +28,7 @@
4966 namespace Widelands {struct Building_Descr;}
4967 struct Interactive_Player;
4968 namespace UI {
4969-struct Callback_Button;
4970+struct Button;
4971 struct Progress_Bar;
4972 struct Textarea;
4973 }
4974@@ -62,7 +62,7 @@
4975 uint32_t m_anim;
4976 uint32_t m_lastupdate;
4977 uint32_t m_end_of_table_y;
4978- UI::Callback_Button * m_btn[6];
4979+ UI::Button * m_btn[6];
4980 int32_t m_last_building_index;
4981 uint32_t m_last_table_index;
4982
4983
4984=== modified file 'src/wui/buildingwindow.cc'
4985--- src/wui/buildingwindow.cc 2011-11-08 21:25:16 +0000
4986+++ src/wui/buildingwindow.cc 2011-11-26 13:22:27 +0000
4987@@ -1,5 +1,5 @@
4988 /*
4989- * Copyright (C) 2002-2004, 2006-2010 by the Widelands Development Team
4990+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
4991 *
4992 * This program is free software; you can redistribute it and/or
4993 * modify it under the terms of the GNU General Public License
4994@@ -164,16 +164,17 @@
4995 if (upcast(Widelands::ProductionSite const, productionsite, &m_building))
4996 if (not dynamic_cast<Widelands::MilitarySite const *>(productionsite)) {
4997 bool const is_stopped = productionsite->is_stopped();
4998- capsbuttons->add
4999- (new UI::Callback_Button
5000- (capsbuttons, is_stopped ? "continue" : "stop",
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to status/vote changes: