widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #00484
[Merge] lp:~nha/widelands/signals into lp:widelands
Nicolai Hähnle has proposed merging lp:~nha/widelands/signals into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~nha/widelands/signals/+merge/82925
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.
--
https://code.launchpad.net/~nha/widelands/signals/+merge/82925
Your team Widelands Developers is requested to review the proposed merge of lp:~nha/widelands/signals into lp:widelands.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2011-11-11 18:31:54 +0000
+++ CMakeLists.txt 2011-11-21 19:06:26 +0000
@@ -108,12 +108,12 @@
if (WL_UNIT_TESTS)
message(STATUS "Enabled unit tests")
- set (BUILD_SHARED_LIBS OFF)
- set (Boost_FIND_COMPONENTS unit_test_framework)
- set (Boost_USE_STATIC_LIBS ON)
+ #set (BUILD_SHARED_LIBS OFF)
+ set (Boost_FIND_COMPONENTS unit_test_framework signals)
+ set (Boost_USE_STATIC_LIBS OFF)
set (Boost_USE_MULTITHREADED ON)
set (Boost_DETAILED_FAILURE_MSG ON)
- find_package(Boost 1.35.0 COMPONENTS unit_test_framework REQUIRED)
+ find_package(Boost 1.35.0 COMPONENTS unit_test_framework signals REQUIRED)
if (NOT DEFINED MSVC)
string( REGEX MATCH ".a$" BOOST_STATIC_UNIT_TEST_LIB ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
@@ -136,7 +136,11 @@
)
else (WL_UNIT_TESTS)
message(STATUS "Disabled Unit Tests")
- find_package(Boost 1.35.0 REQUIRED)
+ set (Boost_FIND_COMPONENTS signals)
+ set (Boost_USE_STATIC_LIBS ON)
+ set (Boost_USE_MULTITHREADED ON)
+ set (Boost_DETAILED_FAILURE_MSG ON)
+ find_package(Boost 1.35.0 COMPONENTS signals REQUIRED)
endif (WL_UNIT_TESTS)
option (WL_STRICT "If strict compilation mode is requested (almost every warning is an error)" OFF)
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2011-09-28 07:37:12 +0000
+++ src/CMakeLists.txt 2011-11-21 19:06:26 +0000
@@ -116,7 +116,8 @@
target_link_libraries(widelands_all ${GGZ_CORE_LIBRARY})
target_link_libraries(widelands_all ${OPENGL_gl_LIBRARY})
target_link_libraries(widelands_all ${GLEW_LIBRARY})
-if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+target_link_libraries(widelands_all ${Boost_LIBRARIES})
+if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
target_link_libraries(widelands_all ${EXECINFO_LIBRARY})
endif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
=== modified file 'src/editor/editorinteractive.cc'
--- src/editor/editorinteractive.cc 2011-09-04 17:21:11 +0000
+++ src/editor/editorinteractive.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2003, 2006-2010 by the Widelands Development Team
+ * Copyright (C) 2002-2003, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -92,7 +92,7 @@
set_display_flag(Interactive_Base::dfDebug, true);
#endif
- fieldclicked.set(this, &Editor_Interactive::map_clicked);
+ fieldclicked.connect(boost::bind(&Editor_Interactive::map_clicked, this));
}
=== modified file 'src/editor/ui_menus/editor_main_menu_load_map.cc'
--- src/editor/ui_menus/editor_main_menu_load_map.cc 2010-11-03 01:04:47 +0000
+++ src/editor/ui_menus/editor_main_menu_load_map.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2009 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -59,8 +59,8 @@
(this,
posx, posy,
get_inner_w() / 2 - spacing, get_inner_h() - spacing - offsy - 40);
- m_ls->selected.set(this, &Main_Menu_Load_Map::selected);
- m_ls->double_clicked.set(this, &Main_Menu_Load_Map::double_clicked);
+ m_ls->selected.connect(boost::bind(&Main_Menu_Load_Map::selected, this, _1));
+ m_ls->double_clicked.connect(boost::bind(&Main_Menu_Load_Map::double_clicked, this, _1));
posx = get_inner_w() / 2 + spacing;
posy += 20;
=== modified file 'src/editor/ui_menus/editor_main_menu_load_map.h'
--- src/editor/ui_menus/editor_main_menu_load_map.h 2010-10-17 19:42:01 +0000
+++ src/editor/ui_menus/editor_main_menu_load_map.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006, 2008-2009 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006, 2008-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -26,7 +26,6 @@
struct Editor_Interactive;
namespace UI {
-struct EditBox;
template <typename T> struct Listselect;
struct Textarea;
struct Multiline_Textarea;
=== modified file 'src/editor/ui_menus/editor_main_menu_map_options.cc'
--- src/editor/ui_menus/editor_main_menu_map_options.cc 2010-04-24 20:03:07 +0000
+++ src/editor/ui_menus/editor_main_menu_map_options.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2009 by the Widelands Development Team
+ * Copyright (C) 2002-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -74,8 +74,8 @@
(this,
posx + ta->get_w() + spacing, posy,
get_inner_w() - (posx + ta->get_w() + spacing) - spacing, 20,
- g_gr->get_picture(PicMod_UI, "pics/but1.png"), 0);
- m_name->changedid.set(this, &Main_Menu_Map_Options::changed);
+ g_gr->get_picture(PicMod_UI, "pics/but1.png"));
+ m_name->changed.connect(boost::bind(&Main_Menu_Map_Options::changed, this, 0));
posy += height + spacing;
ta = new UI::Textarea(this, posx, posy - 2, _("Size:"));
m_size =
@@ -97,8 +97,8 @@
(this,
posx + ta->get_w() + spacing, posy,
get_inner_w() - (posx + ta->get_w() + spacing) - spacing, 20,
- g_gr->get_picture(PicMod_UI, "pics/but1.png"), 1);
- m_author->changedid.set(this, &Main_Menu_Map_Options::changed);
+ g_gr->get_picture(PicMod_UI, "pics/but1.png"));
+ m_author->changed.connect(boost::bind(&Main_Menu_Map_Options::changed, this, 1));
posy += height + spacing;
m_descr =
new UI::Multiline_Editbox
@@ -106,7 +106,7 @@
posx, posy,
get_inner_w() - spacing - posx, get_inner_h() - 25 - spacing - posy,
parent.egbase().map().get_description());
- m_descr->changed.set(this, &Main_Menu_Map_Options::editbox_changed);
+ m_descr->changed.connect(boost::bind(&Main_Menu_Map_Options::editbox_changed, this));
update();
}
=== modified file 'src/editor/ui_menus/editor_main_menu_random_map.cc'
--- src/editor/ui_menus/editor_main_menu_random_map.cc 2010-11-01 22:30:23 +0000
+++ src/editor/ui_menus/editor_main_menu_random_map.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2010 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -74,9 +74,9 @@
(this,
posx, posy,
width, 20,
- g_gr->get_picture(PicMod_UI, "pics/but1.png"), 0);
- m_nrEditbox->changed.set
- (this, & Main_Menu_New_Random_Map::nr_edit_box_changed);
+ g_gr->get_picture(PicMod_UI, "pics/but1.png"));
+ m_nrEditbox->changed.connect
+ (boost::bind(&Main_Menu_New_Random_Map::nr_edit_box_changed, this));
RNG rng;
rng.seed(clock());
rng.rand();
@@ -230,9 +230,8 @@
Point pos(get_inner_w() - spacing - 20, posy);
m_island_mode = new UI::Checkbox(this, pos);
m_island_mode->set_state(true);
- m_island_mode->set_id(SWITCH_ISLAND_MODE);
- m_island_mode->changed.set
- (this, & Main_Menu_New_Random_Map::nr_edit_box_changed);
+ m_island_mode->changed.connect
+ (boost::bind(&Main_Menu_New_Random_Map::button_clicked, this, SWITCH_ISLAND_MODE));
new UI::Textarea(this, posx, posy, _("Island mode:"));
posy += height + spacing;
@@ -290,10 +289,10 @@
(this,
posx, posy,
width, 20,
- g_gr->get_picture(PicMod_UI, "pics/but1.png"), 0);
+ g_gr->get_picture(PicMod_UI, "pics/but1.png"));
m_idEditbox->setText("abcd-efgh-ijkl-mnop");
- m_idEditbox->changed.set
- (this, & Main_Menu_New_Random_Map::id_edit_box_changed);
+ m_idEditbox->changed.connect
+ (boost::bind(&Main_Menu_New_Random_Map::id_edit_box_changed, this));
posy += height + spacing + spacing + spacing;
=== modified file 'src/editor/ui_menus/editor_main_menu_save_map.cc'
--- src/editor/ui_menus/editor_main_menu_save_map.cc 2010-11-03 01:04:47 +0000
+++ src/editor/ui_menus/editor_main_menu_save_map.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2010 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -65,17 +65,16 @@
(this,
posx, posy,
get_inner_w() / 2 - spacing, get_inner_h() - spacing - offsy - 60);
- m_ls->clicked .set(this, &Main_Menu_Save_Map:: clicked_item);
- m_ls->double_clicked.set(this, &Main_Menu_Save_Map::double_clicked_item);
+ m_ls->clicked.connect(boost::bind(&Main_Menu_Save_Map::clicked_item, this, _1));
+ m_ls->double_clicked.connect(boost::bind(&Main_Menu_Save_Map::double_clicked_item, this, _1));
m_editbox =
new UI::EditBox
(this,
posx, posy + get_inner_h() - spacing - offsy - 60 + 3,
get_inner_w() / 2 - spacing, 20,
- g_gr->get_picture(PicMod_UI, "pics/but1.png"),
- 0);
+ g_gr->get_picture(PicMod_UI, "pics/but1.png"));
m_editbox->setText(parent.egbase().map().get_name());
- m_editbox->changed.set(this, &Main_Menu_Save_Map::edit_box_changed);
+ m_editbox->changed.connect(boost::bind(&Main_Menu_Save_Map::edit_box_changed, this));
posx = get_inner_w() / 2 + spacing;
posy += 20;
=== modified file 'src/editor/ui_menus/editor_main_menu_save_map_make_directory.cc'
--- src/editor/ui_menus/editor_main_menu_save_map_make_directory.cc 2011-11-20 12:32:35 +0000
+++ src/editor/ui_menus/editor_main_menu_save_map_make_directory.cc 2011-11-21 19:06:26 +0000
@@ -42,10 +42,10 @@
m_edit =
new UI::EditBox
(this, spacing, posy, get_inner_w() - 2 * spacing, 20,
- g_gr->get_picture(PicMod_UI, "pics/but1.png"), 0);
+ g_gr->get_picture(PicMod_UI, "pics/but1.png"));
m_edit->setText(dirname);
m_dirname = dirname;
- m_edit->changed.set(this, &Main_Menu_Save_Map_Make_Directory::edit_changed);
+ m_edit->changed.connect(boost::bind(&Main_Menu_Save_Map_Make_Directory::edit_changed, this));
posy = get_inner_h() - 30;
=== modified file 'src/editor/ui_menus/editor_player_menu.cc'
--- src/editor/ui_menus/editor_player_menu.cc 2011-03-19 15:09:21 +0000
+++ src/editor/ui_menus/editor_player_menu.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2010 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -138,9 +138,9 @@
m_plr_names[p - 1] =
new UI::EditBox
(this, posx, posy, 140, size,
- g_gr->get_picture(PicMod_UI, "pics/but0.png"), p - 1);
- m_plr_names[p - 1]->changedid.set
- (this, &Editor_Player_Menu::name_changed);
+ g_gr->get_picture(PicMod_UI, "pics/but0.png"));
+ m_plr_names[p - 1]->changed.connect
+ (boost::bind(&Editor_Player_Menu::name_changed, this, p - 1));
posx += 140 + spacing;
m_plr_names[p - 1]->setText(map.get_scenario_player_name(p));
}
=== modified file 'src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc'
--- src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc 2010-10-17 19:32:07 +0000
+++ src/editor/ui_menus/editor_player_menu_allowed_buildings_menu.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2008, 2010 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2008, 2010-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -95,16 +95,14 @@
_("Allow"),
false)
{
- m_allowed.selected.set
- (this, &Editor_Player_Menu_Allowed_Buildings_Menu::allowed_selected);
- m_allowed.double_clicked.set
- (this,
- &Editor_Player_Menu_Allowed_Buildings_Menu::allowed_double_clicked);
- m_forbidden.selected.set
- (this, &Editor_Player_Menu_Allowed_Buildings_Menu::forbidden_selected);
- m_forbidden.double_clicked.set
- (this, &Editor_Player_Menu_Allowed_Buildings_Menu::
- forbidden_double_clicked);
+ m_allowed.selected.connect
+ (boost::bind(&Editor_Player_Menu_Allowed_Buildings_Menu::allowed_selected, this, _1));
+ m_allowed.double_clicked.connect
+ (boost::bind(&Editor_Player_Menu_Allowed_Buildings_Menu::allowed_double_clicked, this, _1));
+ m_forbidden.selected.connect
+ (boost::bind(&Editor_Player_Menu_Allowed_Buildings_Menu::forbidden_selected, this, _1));
+ m_forbidden.double_clicked.connect
+ (boost::bind(&Editor_Player_Menu_Allowed_Buildings_Menu::forbidden_double_clicked, this, _1));
Widelands::Tribe_Descr const & tribe = player.tribe();
Building_Index const nr_buildings = tribe.get_nrbuildings();
=== modified file 'src/editor/ui_menus/editor_tool_change_resources_options_menu.cc'
--- src/editor/ui_menus/editor_tool_change_resources_options_menu.cc 2010-11-06 16:31:40 +0000
+++ src/editor/ui_menus/editor_tool_change_resources_options_menu.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2009 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -136,10 +136,10 @@
/
(resource_pic_max_width + spacing());
- m_radiogroup.changed.set
- (this, &Editor_Tool_Change_Resources_Options_Menu::selected);
- m_radiogroup.clicked.set
- (this, &Editor_Tool_Change_Resources_Options_Menu::selected);
+ m_radiogroup.changed.connect
+ (boost::bind(&Editor_Tool_Change_Resources_Options_Menu::selected, this));
+ m_radiogroup.clicked.connect
+ (boost::bind(&Editor_Tool_Change_Resources_Options_Menu::selected, this));
uint32_t cur_x = 0;
Point pos
=== modified file 'src/editor/ui_menus/editor_tool_menu.cc'
--- src/editor/ui_menus/editor_tool_menu.cc 2010-04-24 20:03:07 +0000
+++ src/editor/ui_menus/editor_tool_menu.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2009 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -84,8 +84,8 @@
0);
}
- m_radioselect.changed.set(this, &Editor_Tool_Menu::changed_to);
- m_radioselect.clicked.set(this, &Editor_Tool_Menu::changed_to);
+ m_radioselect.changed.connect(boost::bind(&Editor_Tool_Menu::changed_to, this));
+ m_radioselect.clicked.connect(boost::bind(&Editor_Tool_Menu::changed_to, this));
if (get_usedefaultpos())
center_to_parent();
=== modified file 'src/editor/ui_menus/editor_tool_place_bob_options_menu.cc'
--- src/editor/ui_menus/editor_tool_place_bob_options_menu.cc 2010-05-24 18:57:38 +0000
+++ src/editor/ui_menus/editor_tool_place_bob_options_menu.cc 2011-11-21 19:06:26 +0000
@@ -46,7 +46,8 @@
Editor_Tool_Options_Menu(parent, registry, 100, 100, _("Bobs Menu")),
m_tabpanel (this, 0, 0, g_gr->get_picture(PicMod_UI, "pics/but1.png")),
-m_pit (pit)
+m_pit (pit),
+m_click_recursion_protect(false)
{
int32_t const space = 5;
Widelands::World const & world = parent.egbase().map().world();
@@ -96,9 +97,8 @@
critter_descr ? critter_descr->descname() : std::string());
cb.set_desired_size(width, height);
- cb.set_id(i);
cb.set_state(m_pit.is_enabled(i));
- cb.changedtoid.set(this, &Editor_Tool_Place_Bob_Options_Menu::clicked);
+ cb.changedto.connect(boost::bind(&Editor_Tool_Place_Bob_Options_Menu::clicked, this, i, _1));
m_checkboxes.push_back(&cb);
box->add(&cb, UI::Align_Left);
box->add_space(space);
@@ -117,6 +117,9 @@
void Editor_Tool_Place_Bob_Options_Menu::clicked
(int32_t const n, bool const t)
{
+ if (m_click_recursion_protect)
+ return;
+
// FIXME This code is erroneous. It checks the current key state. What it
// FIXME needs is the key state at the time the mouse was clicked. See the
// FIXME usage comment for get_key_state.
@@ -129,22 +132,14 @@
if (not multiselect) {
for (uint32_t i = 0; m_pit.get_nr_enabled(); ++i) m_pit.enable(i, false);
+
// disable all checkboxes
- // TODO The uint32_t cast is ugly!
- for
- (uint32_t i = 0;
- i < m_checkboxes.size();
- ++i, i += i == static_cast<uint32_t>(n))
- {
- m_checkboxes[i]->changedtoid.set
- (this,
- static_cast
- <void (Editor_Tool_Place_Bob_Options_Menu::*)(int32_t, bool)>
- (0));
+ m_click_recursion_protect = true;
+ for (uint32_t i = 0; i < m_checkboxes.size(); ++i) {
+ if (i != static_cast<uint32_t>(n))
m_checkboxes[i]->set_state(false);
- m_checkboxes[i]->changedtoid.set
- (this, &Editor_Tool_Place_Bob_Options_Menu::clicked);
- }
+ }
+ m_click_recursion_protect = false;
}
m_pit.enable(n, t);
=== modified file 'src/editor/ui_menus/editor_tool_place_bob_options_menu.h'
--- src/editor/ui_menus/editor_tool_place_bob_options_menu.h 2009-09-30 18:31:29 +0000
+++ src/editor/ui_menus/editor_tool_place_bob_options_menu.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2008 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -40,6 +40,7 @@
std::vector<UI::Checkbox *> m_checkboxes;
Editor_Place_Bob_Tool & m_pit;
void clicked(int32_t, bool);
+ bool m_click_recursion_protect;
};
#endif
=== modified file 'src/editor/ui_menus/editor_tool_place_immovable_options_menu.cc'
--- src/editor/ui_menus/editor_tool_place_immovable_options_menu.cc 2010-11-01 22:30:23 +0000
+++ src/editor/ui_menus/editor_tool_place_immovable_options_menu.cc 2011-11-21 19:06:26 +0000
@@ -44,7 +44,8 @@
:
Editor_Tool_Options_Menu(parent, registry, 100, 100, _("Immovable Bobs Menu")),
m_tabpanel(this, 0, 0, g_gr->get_picture(PicMod_UI, "pics/but1.png")),
-m_pit (pit)
+m_pit (pit),
+m_click_recursion_protect(false)
{
int32_t const space = 5;
Widelands::World const & world = parent.egbase().map().world();
@@ -94,10 +95,9 @@
(PicMod_Game, world.get_immovable_descr(i)->get_picture()));
cb.set_desired_size(width, height);
- cb.set_id(i);
cb.set_state(m_pit.is_enabled(i));
- cb.changedtoid.set
- (this, &Editor_Tool_Place_Immovable_Options_Menu::clicked);
+ cb.changedto.connect
+ (boost::bind(&Editor_Tool_Place_Immovable_Options_Menu::clicked, this, i, _1));
m_checkboxes.push_back(&cb);
box->add(&cb, UI::Align_Left);
box->add_space(space);
@@ -118,7 +118,11 @@
/**
* Called when one of the state boxes is toggled
*/
-void Editor_Tool_Place_Immovable_Options_Menu::clicked(int32_t n, bool t) {
+void Editor_Tool_Place_Immovable_Options_Menu::clicked(int32_t n, bool t)
+{
+ if (m_click_recursion_protect)
+ return;
+
// FIXME This code is erroneous. It checks the current key state. What it
// FIXME needs is the key state at the time the mouse was clicked. See the
// FIXME usage comment for get_key_state.
@@ -131,20 +135,13 @@
for (uint32_t i = 0; m_pit.get_nr_enabled(); ++i)
m_pit.enable(i, false);
// Disable all checkboxes
- const uint32_t size = m_checkboxes.size();
- //TODO: the uint32_t cast is ugly!
- for (uint32_t i = 0; i < size; ++i, i += i == static_cast<uint32_t>(n))
- {
- m_checkboxes[i]->changedtoid.set
- (this,
- static_cast
- <void (Editor_Tool_Place_Immovable_Options_Menu::*)
- (int32_t, bool)>
- (0));
- m_checkboxes[i]->set_state(false);
- m_checkboxes[i]->changedtoid.set
- (this, &Editor_Tool_Place_Immovable_Options_Menu::clicked);
+ const int32_t size = m_checkboxes.size();
+ m_click_recursion_protect = true;
+ for (int32_t i = 0; i < size; ++i) {
+ if (i != n)
+ m_checkboxes[i]->set_state(false);
}
+ m_click_recursion_protect = false;
}
m_pit.enable(n, t);
=== modified file 'src/editor/ui_menus/editor_tool_place_immovable_options_menu.h'
--- src/editor/ui_menus/editor_tool_place_immovable_options_menu.h 2010-03-30 00:28:31 +0000
+++ src/editor/ui_menus/editor_tool_place_immovable_options_menu.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2008, 2010 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2008, 2010-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -44,6 +44,7 @@
UI::Tab_Panel m_tabpanel;
Editor_Place_Immovable_Tool & m_pit;
void clicked(int32_t, bool);
+ bool m_click_recursion_protect;
};
#endif
=== modified file 'src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc'
--- src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc 2010-11-27 13:30:37 +0000
+++ src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2009 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -45,7 +45,8 @@
:
Editor_Tool_Options_Menu(parent, registry, 0, 0, _("Terrain Select")),
m_cur_selection (this, 0, 0, 0, 20, UI::Align_Center),
- m_tool (tool)
+ m_tool (tool),
+ m_select_recursion_protect(false)
{
Widelands::World & world = parent.egbase().map().world();
Widelands::Terrain_Index const nr_terrains = world.get_nr_terrains();
@@ -155,10 +156,9 @@
UI::Checkbox & cb = *new UI::Checkbox(this, pos, picture);
cb.set_size(TEXTURE_WIDTH + 1, TEXTURE_HEIGHT + 1);
- cb.set_id(i);
cb.set_state(m_tool.is_enabled(i));
- cb.changedtoid.set
- (this, &Editor_Tool_Set_Terrain_Options_Menu::selected);
+ cb.changedto.connect
+ (boost::bind(&Editor_Tool_Set_Terrain_Options_Menu::selected, this, i, _1));
m_checkboxes[i] = &cb;
pos.x += TEXTURE_WIDTH + hspacing();
@@ -193,6 +193,9 @@
void Editor_Tool_Set_Terrain_Options_Menu::selected
(int32_t const n, bool const t)
{
+ if (m_select_recursion_protect)
+ return;
+
// FIXME This code is erroneous. It checks the current key state. What it
// FIXME needs is the key state at the time the mouse was clicked. See the
// FIXME usage comment for get_key_state.
@@ -205,22 +208,13 @@
for (uint32_t i = 0; m_tool.get_nr_enabled(); ++i)
m_tool.enable(i, false);
// disable all checkboxes
- const uint32_t size = m_checkboxes.size();
- //TODO: the uint32_t cast is ugly!
- for
- (uint32_t i = 0; i < size;
- ++i, i += i == static_cast<uint32_t>(n))
- {
- m_checkboxes[i]->changedtoid.set
- (this,
- static_cast
- <void (Editor_Tool_Set_Terrain_Options_Menu::*)
- (int32_t, bool)>
- (0));
- m_checkboxes[i]->set_state(false);
- m_checkboxes[i]->changedtoid.set
- (this, &Editor_Tool_Set_Terrain_Options_Menu::selected);
+ m_select_recursion_protect = true;
+ const int32_t size = m_checkboxes.size();
+ for (int32_t i = 0; i < size; ++i) {
+ if (i != n)
+ m_checkboxes[i]->set_state(false);
}
+ m_select_recursion_protect = false;
}
m_tool.enable(n, t);
=== modified file 'src/editor/ui_menus/editor_tool_set_terrain_options_menu.h'
--- src/editor/ui_menus/editor_tool_set_terrain_options_menu.h 2009-12-10 21:52:37 +0000
+++ src/editor/ui_menus/editor_tool_set_terrain_options_menu.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2009 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -43,6 +43,7 @@
Editor_Set_Terrain_Tool & m_tool;
void selected(int32_t, bool);
std::vector<UI::Checkbox *> m_checkboxes;
+ bool m_select_recursion_protect;
};
=== modified file 'src/logic/constructionsite.cc'
--- src/logic/constructionsite.cc 2011-11-06 14:51:46 +0000
+++ src/logic/constructionsite.cc 2011-11-21 19:06:26 +0000
@@ -24,7 +24,6 @@
#include "upcast.h"
#include "wexception.h"
-#include "ui_basic/object.h" //only needed for i18n function _()
#include "graphic/animation.h"
#include "economy/wares_queue.h"
#include "game.h"
=== modified file 'src/logic/dismantlesite.cc'
--- src/logic/dismantlesite.cc 2011-11-06 23:12:36 +0000
+++ src/logic/dismantlesite.cc 2011-11-21 19:06:26 +0000
@@ -31,7 +31,6 @@
#include "i18n.h"
#include "sound/sound_handler.h"
#include "tribe.h"
-#include "ui_basic/object.h" //only needed for i18n function _()
#include "worker.h"
#include "dismantlesite.h"
=== modified file 'src/network/nethost.cc'
--- src/network/nethost.cc 2011-11-07 21:55:54 +0000
+++ src/network/nethost.cc 2011-11-21 19:06:26 +0000
@@ -2627,7 +2627,7 @@
++part;
if (part % 100 == 0)
sendSystemChat
- (_("Sending part %u/%lu of file %s to %s"),
+ (_("Sending part %u/%zu of file %s to %s"),
part, file->parts.size() + 1,
file->filename.c_str(),
d->settings.users.at(client.usernum).name.c_str());
=== modified file 'src/scripting/lua_ui.cc'
--- src/scripting/lua_ui.cc 2011-11-20 17:06:28 +0000
+++ src/scripting/lua_ui.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006-2010 by the Widelands Development Team
+ * Copyright (C) 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -632,7 +632,7 @@
int L_MapView::click(lua_State * L) {
get()->warp_mouse_to_node
((*get_user_class<LuaMap::L_Field>(L, 2))->coords());
- get()->fieldclicked.call();
+ get()->fieldclicked();
return 0;
}
=== modified file 'src/ui_basic/box.cc'
--- src/ui_basic/box.cc 2011-11-09 20:16:07 +0000
+++ src/ui_basic/box.cc 2011-11-21 19:06:26 +0000
@@ -25,6 +25,7 @@
#include "scrollbar.h"
#include <algorithm>
+#include <boost/bind.hpp>
namespace UI {
/**
@@ -177,7 +178,7 @@
m_scrollbar = new Scrollbar
(this, sb_x, sb_y, sb_w,
sb_h, m_orientation == Horizontal);
- m_scrollbar->moved.set(this, &Box::scrollbar_moved);
+ m_scrollbar->moved.connect(boost::bind(&Box::scrollbar_moved, this, _1));
} else {
m_scrollbar->set_pos(Point(sb_x, sb_y));
m_scrollbar->set_size(sb_w, sb_h);
=== modified file 'src/ui_basic/button.h'
--- src/ui_basic/button.h 2011-11-05 21:32:08 +0000
+++ src/ui_basic/button.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 2006, 2008-2010 by the Widelands Development Team
+ * Copyright (C) 2002, 2006, 2008-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -25,7 +25,6 @@
#include "constants.h"
#include "panel.h"
-#include "m_signal.h"
#include "rgbcolor.h"
=== modified file 'src/ui_basic/checkbox.cc'
--- src/ui_basic/checkbox.cc 2011-11-06 12:22:20 +0000
+++ src/ui_basic/checkbox.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 2006-2010 by the Widelands Development Team
+ * Copyright (C) 2002, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -50,8 +50,6 @@
} else
m_pic_graphics =
g_gr->get_picture(PicMod_UI, "pics/checkbox_light_new.png");
-
- m_id = -1;
}
@@ -93,9 +91,8 @@
void Statebox::set_state(bool const on) {
if (on xor ((m_flags & Is_Checked) > 1)) {
set_flags(Is_Checked, on);
- changed .call ();
- changedto .call (on);
- changedtoid.call(m_id, on);
+ changed();
+ changedto(on);
update();
}
}
@@ -168,7 +165,7 @@
*/
void Checkbox::clicked()
{
- clickedto.call(!get_state());
+ clickedto(!get_state());
set_state(!get_state());
play_click();
}
=== modified file 'src/ui_basic/checkbox.h'
--- src/ui_basic/checkbox.h 2009-09-30 18:31:29 +0000
+++ src/ui_basic/checkbox.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2006, 2008 by the Widelands Development Team
+ * Copyright (C) 2004, 2006, 2008-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -20,8 +20,9 @@
#ifndef UI_CHECKBOX_H
#define UI_CHECKBOX_H
+#include <boost/signals.hpp>
+
#include "panel.h"
-#include "m_signal.h"
#include "rgbcolor.h"
@@ -42,17 +43,15 @@
std::string const & tooltip_text = std::string());
~Statebox();
- Signal changed;
- Signal1<bool> changedto;
- Signal1<bool> clickedto; // same as changedto but only called when clicked
- Signal2<int32_t, bool> changedtoid;
+ boost::signal<void ()> changed;
+ boost::signal<void (bool)> changedto;
+ boost::signal<void (bool)> clickedto; // same as changedto but only called when clicked
void set_enabled(bool enabled);
bool get_state() const throw () {return m_flags & Is_Checked;}
void set_state(bool on);
- void set_id(int32_t n) {m_id = n;}
void set_owns_custom_picture() throw () {
assert(m_flags & Has_Custom_Picture);
set_flags(Owns_Custom_Picture, true);
@@ -68,7 +67,6 @@
private:
virtual void clicked() = 0;
- int32_t m_id;
enum Flags {
Is_Highlighted = 0x01,
Is_Enabled = 0x02,
=== modified file 'src/ui_basic/editbox.cc'
--- src/ui_basic/editbox.cc 2011-10-23 16:18:19 +0000
+++ src/ui_basic/editbox.cc 2011-11-21 19:06:26 +0000
@@ -44,9 +44,6 @@
/// Background tile style.
PictureID background;
- /// ID. Only used for the id-flavoured signals.
- int32_t id;
-
/// Maximum number of characters in the input
uint32_t maxLength;
@@ -67,7 +64,6 @@
(Panel * const parent,
const int32_t x, const int32_t y, const uint32_t w, const uint32_t h,
const PictureID & background,
- const int32_t id,
Align _align)
:
Panel(parent, x, y, w, h),
@@ -82,7 +78,6 @@
m->fontsize = UI_FONT_SIZE_SMALL;
m->fontcolor = UI_FONT_CLR_FG;
- m->id = id;
m->align = static_cast<Align>((_align & Align_Horizontal) | Align_VCenter);
m->caret = 0;
m->scrolloffset = 0;
@@ -230,8 +225,7 @@
if (down) {
switch (code.sym) {
case SDLK_ESCAPE:
- cancel.call();
- cancelid.call(m->id);
+ cancel();
return true;
case SDLK_KP_ENTER:
@@ -245,8 +239,7 @@
m_history_position = -1;
}
}
- ok.call();
- okid.call(m->id);
+ ok();
return true;
case SDLK_KP_PERIOD:
@@ -267,8 +260,7 @@
m->text.erase(m->text.begin() + m->caret);
m->text.erase(m->text.begin() + m->caret);
check_caret();
- changed.call();
- changedid.call(m->id);
+ changed();
update();
}
return true;
@@ -419,8 +411,7 @@
(m->text.begin() + m->caret++, ((code.unicode & 0x3f) | 0x80));
}
check_caret();
- changed.call();
- changedid.call(m->id);
+ changed();
update();
}
}
=== modified file 'src/ui_basic/editbox.h'
--- src/ui_basic/editbox.h 2011-10-23 16:18:19 +0000
+++ src/ui_basic/editbox.h 2011-11-21 19:06:26 +0000
@@ -24,6 +24,7 @@
#include "button.h"
#include <boost/scoped_ptr.hpp>
+#include <boost/signal.hpp>
#include <SDL_keyboard.h>
#define CHAT_HISTORY_SIZE 5
@@ -41,16 +42,12 @@
int32_t x, int32_t y, uint32_t w, uint32_t h,
PictureID const & background =
g_gr->get_picture(PicMod_UI, "pics/but2.png"),
- int32_t id = 0,
Align align = Align_Center);
virtual ~EditBox();
- Signal changed;
- Signal1<int32_t> changedid;
- Signal ok;
- Signal1<int32_t> okid;
- Signal cancel;
- Signal1<int32_t> cancelid;
+ boost::signal<void ()> changed;
+ boost::signal<void ()> ok;
+ boost::signal<void ()> cancel;
std::string const & text() const;
void setText(std::string const &);
=== modified file 'src/ui_basic/icongrid.cc'
--- src/ui_basic/icongrid.cc 2010-11-01 23:54:06 +0000
+++ src/ui_basic/icongrid.cc 2011-11-21 19:06:26 +0000
@@ -59,10 +59,10 @@
void handle_mousein(bool const inside) {
if (inside) {
- m_icongrid.mousein.call(_callback_argument_id);
+ m_icongrid.mousein(_callback_argument_id);
m_ta.set_text(m_descr);
} else {
- m_icongrid.mouseout.call(_callback_argument_id);
+ m_icongrid.mouseout(_callback_argument_id);
m_ta.set_text("");
}
Callback_Button::handle_mousein(inside);
@@ -127,7 +127,7 @@
}
void Icon_Grid::clicked_button(uint32_t idx) {
- clicked.call(idx);
+ clicked(idx);
play_click();
}
=== modified file 'src/ui_basic/icongrid.h'
--- src/ui_basic/icongrid.h 2010-11-01 23:54:06 +0000
+++ src/ui_basic/icongrid.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003, 2006-2009 by the Widelands Development Team
+ * Copyright (C) 2003, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -22,10 +22,11 @@
#include "panel.h"
#include "textarea.h"
-#include "m_signal.h"
#include <vector>
+#include <boost/signal.hpp>
+
namespace UI {
/**
@@ -40,9 +41,9 @@
int32_t x, int32_t y, int32_t cellw, int32_t cellh,
int32_t cols);
- Signal1<int32_t> clicked;
- Signal1<int32_t> mouseout;
- Signal1<int32_t> mousein;
+ boost::signal<void (int32_t)> clicked;
+ boost::signal<void (int32_t)> mouseout;
+ boost::signal<void (int32_t)> mousein;
int32_t add
(std::string const & name,
=== modified file 'src/ui_basic/listselect.cc'
--- src/ui_basic/listselect.cc 2011-10-23 16:52:10 +0000
+++ src/ui_basic/listselect.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 2006-2010 by the Widelands Development Team
+ * Copyright (C) 2002, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -29,6 +29,7 @@
#include "container_iterate.h"
+#include <boost/bind.hpp>
#include <iostream>
namespace UI {
@@ -62,7 +63,7 @@
set_align(align);
- m_scrollbar.moved.set(this, &BaseListselect::set_scrollpos);
+ m_scrollbar.moved.connect(boost::bind(&BaseListselect::set_scrollpos, this, _1));
m_scrollbar.set_singlestepsize(g_fh->get_fontheight(m_fontname, m_fontsize));
m_scrollbar.set_pagesize
(h - 2 * g_fh->get_fontheight(m_fontname, m_fontsize));
@@ -202,10 +203,10 @@
if (m_selection == m) {
m_selection = n;
- selected.call(n);
+ selected(n);
} else if (m_selection == n) {
m_selection = m;
- selected.call(m);
+ selected(m);
}
}
@@ -289,7 +290,7 @@
}
m_selection = i;
- selected.call(m_selection);
+ selected(m_selection);
update(0, 0, get_eff_w(), get_h());
}
@@ -444,7 +445,7 @@
return false;
play_click();
select(y);
- clicked.call(m_selection);
+ clicked(m_selection);
if // check if doubleclicked
(time - real_last_click_time < DOUBLE_CLICK_INTERVAL
@@ -452,7 +453,7 @@
m_last_selection == m_selection
and
m_selection != no_selection_index())
- double_clicked.call(m_selection);
+ double_clicked(m_selection);
return true;
}
@@ -513,7 +514,7 @@
delete (m_entry_records[i]);
m_entry_records.erase(m_entry_records.begin() + i);
if (m_selection == i)
- selected.call(m_selection = no_selection_index());
+ selected(m_selection = no_selection_index());
else if (i < m_selection)
--m_selection;
}
=== modified file 'src/ui_basic/listselect.h'
--- src/ui_basic/listselect.h 2011-10-23 16:52:10 +0000
+++ src/ui_basic/listselect.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 2006, 2008-2010 by the Widelands Development Team
+ * Copyright (C) 2002, 2006, 2008-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -21,10 +21,11 @@
#ifndef UI_LISTSELECT_H
#define UI_LISTSELECT_H
+#include <boost/signal.hpp>
+
#include "align.h"
#include "panel.h"
#include "scrollbar.h"
-#include "m_signal.h"
#include "compile_assert.h"
@@ -51,9 +52,9 @@
bool show_check = false);
~BaseListselect();
- Signal1<uint32_t> selected;
- Signal1<uint32_t> clicked;
- Signal1<uint32_t> double_clicked;
+ boost::signal<void (uint32_t)> selected;
+ boost::signal<void (uint32_t)> clicked;
+ boost::signal<void (uint32_t)> double_clicked;
void clear();
void sort
=== removed file 'src/ui_basic/m_signal.h'
--- src/ui_basic/m_signal.h 2009-11-26 20:08:24 +0000
+++ src/ui_basic/m_signal.h 1970-01-01 00:00:00 +0000
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2002, 2006, 2008-2009 by the Widelands Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#ifndef UI_SIGNAL_H
-#define UI_SIGNAL_H
-
-#include "object.h"
-
-namespace UI {
-/**
- * Provides a hook for callback function.
- * This is exactly what register_func used to provide but for Panel
- * member functions and with better type checking.
- *
- * Use as:
- * Signal signal;
- * Signal1<int32_t> signal1;
- *
- * foo->signal.set(this, &MyClass::Handler);
- * signal.call();
- * signal1.call(some_int);
- */
-class Signal : public Object {
- typedef void (Object::*fnT)();
- Object * _obj;
- fnT _fn;
-public:
- Signal() {_obj = 0; _fn = 0;}
- template<class T> void set(Object * const p, void (T::*f)()) {
- _obj = p;
- _fn = static_cast<fnT>(f);
- }
- void unset() {
- _fn = 0;
- }
- void call() {if (_fn) (_obj->*_fn)();}
-};
-
-/**
- * See Signal
- */
-template<typename T1> struct Signal1 : public Object {
- Signal1() {_obj = 0; _fn = 0;}
- template<class T>
- void set(Object * const p, void (T::*f)(T1)) {
- _obj = p;
- _fn = static_cast<fnT>(f);
- }
- void unset() {
- _fn = 0;
- }
- void call(T1 t1) {if (_fn) (_obj->*_fn)(t1);}
-private:
- typedef void (Object::*fnT)(T1);
- Object * _obj;
- fnT _fn;
-};
-
-/**
- * See Signal
- */
-template<typename T1, typename T2> struct Signal2 : public Object {
- Signal2() {_obj = 0; _fn = 0;}
- template<class T>
- void set(Object * p, void (T::*f)(T1, T2)) {
- _obj = p;
- _fn = static_cast<fnT>(f);
- }
- void unset() {
- _fn = 0;
- }
- void call(T1 t1, T2 t2) {if (_fn) (_obj->*_fn)(t1, t2);}
-private:
- typedef void (Object::*fnT)(T1, T2);
- Object * _obj;
- fnT _fn;
-};
-
-}
-
-#endif
=== modified file 'src/ui_basic/messagebox.cc'
--- src/ui_basic/messagebox.cc 2011-10-23 16:52:10 +0000
+++ src/ui_basic/messagebox.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2008 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -165,21 +165,21 @@
void WLMessageBox::pressedOk()
{
- ok.call();
+ ok();
if (is_modal())
end_modal(0);
}
void WLMessageBox::pressedYes()
{
- yes.call();
+ yes();
if (is_modal())
end_modal(1);
}
void WLMessageBox::pressedNo()
{
- no.call();
+ no();
if (is_modal())
end_modal(0);
}
=== modified file 'src/ui_basic/messagebox.h'
--- src/ui_basic/messagebox.h 2011-10-23 16:52:10 +0000
+++ src/ui_basic/messagebox.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006, 2008-2009 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006, 2008-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -21,10 +21,10 @@
#define UI_MESSAGEBOX_H
#include "align.h"
-#include "m_signal.h"
#include "window.h"
#include <boost/scoped_ptr.hpp>
+#include <boost/signal.hpp>
namespace UI {
@@ -61,9 +61,9 @@
MB_Type);
~WLMessageBox();
- Signal ok;
- Signal yes;
- Signal no;
+ boost::signal<void ()> ok;
+ boost::signal<void ()> yes;
+ boost::signal<void ()> no;
void set_align(Align);
=== modified file 'src/ui_basic/multilineeditbox.cc'
--- src/ui_basic/multilineeditbox.cc 2011-10-23 16:18:19 +0000
+++ src/ui_basic/multilineeditbox.cc 2011-11-21 19:06:26 +0000
@@ -19,6 +19,8 @@
#include "multilineeditbox.h"
+#include <boost/bind.hpp>
+
#include "scrollbar.h"
#include "constants.h"
#include "graphic/font_handler.h"
@@ -102,7 +104,7 @@
ww_valid(false),
owner(o)
{
- scrollbar.moved.set(&o, &Multiline_Editbox::scrollpos_changed);
+ scrollbar.moved.connect(boost::bind(&Multiline_Editbox::scrollpos_changed, &o, _1));
scrollbar.set_pagesize(owner.get_h() - 2 * textstyle.font->height());
scrollbar.set_singlestepsize(textstyle.font->height());
@@ -144,7 +146,7 @@
d->update();
d->scroll_cursor_into_view();
- changed.call();
+ changed();
}
/**
@@ -254,7 +256,7 @@
if (d->text.size() + utf8.size() <= d->maxbytes) {
d->insert(d->cursor_pos, utf8);
- changed.call();
+ changed();
}
}
@@ -271,14 +273,14 @@
case SDLK_DELETE:
if (d->cursor_pos < d->text.size()) {
d->erase_bytes(d->cursor_pos, d->next_char(d->cursor_pos));
- changed.call();
+ changed();
}
break;
case SDLK_BACKSPACE:
if (d->cursor_pos > 0) {
d->erase_bytes(d->prev_char(d->cursor_pos), d->cursor_pos);
- changed.call();
+ changed();
}
break;
@@ -421,7 +423,7 @@
case SDLK_KP_ENTER:
case SDLK_RETURN:
d->insert(d->cursor_pos, "\n");
- changed.call();
+ changed();
break;
default:
=== modified file 'src/ui_basic/multilineeditbox.h'
--- src/ui_basic/multilineeditbox.h 2011-10-23 16:18:19 +0000
+++ src/ui_basic/multilineeditbox.h 2011-11-21 19:06:26 +0000
@@ -21,9 +21,9 @@
#define UI_MULTILINEEDITBOX_H
#include "panel.h"
-#include "m_signal.h"
#include <boost/scoped_ptr.hpp>
+#include <boost/signal.hpp>
namespace UI {
@@ -37,7 +37,7 @@
Multiline_Editbox
(Panel *, int32_t x, int32_t y, uint32_t w, uint32_t h, const std::string & text);
- Signal changed;
+ boost::signal<void ()> changed;
std::string const & get_text() const;
void set_text(std::string const &);
=== modified file 'src/ui_basic/multilinetextarea.cc'
--- src/ui_basic/multilinetextarea.cc 2011-02-20 17:01:25 +0000
+++ src/ui_basic/multilinetextarea.cc 2011-11-21 19:06:26 +0000
@@ -19,6 +19,8 @@
#include "multilinetextarea.h"
+#include <boost/bind.hpp>
+
#include "constants.h"
#include "graphic/font_handler.h"
#include "graphic/richtext.h"
@@ -54,7 +56,7 @@
set_align(align);
- m_scrollbar.moved.set(this, &Multiline_Textarea::scrollpos_changed);
+ m_scrollbar.moved.connect(boost::bind(&Multiline_Textarea::scrollpos_changed, this, _1));
m_scrollbar.set_singlestepsize(g_fh->get_fontheight(UI_FONT_SMALL));
m_scrollbar.set_pagesize(h - 2 * g_fh->get_fontheight(UI_FONT_BIG));
=== removed file 'src/ui_basic/object.h'
--- src/ui_basic/object.h 2011-11-20 12:27:39 +0000
+++ src/ui_basic/object.h 1970-01-01 00:00:00 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2002, 2006-2011 by the Widelands Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#ifndef UI_OBJECT_H
-#define UI_OBJECT_H
-
-#include <boost/noncopyable.hpp>
-
-namespace UI {
-
-/**
- * Serves as a base class for UI related objects. The only purpose is
- * to provide the base class for signal function pointers.
- */
-struct Object : boost::noncopyable {
- Object() {}
-
- // Yeah right... force a VMT so that MSVC++ gets the pointers-to-members
- // right *sigh*
- // OTOH, looking at the gcc assembly, gcc seems to use a less efficient
- // pointer representation. Can anyone clear this up? -- Nicolai
- virtual ~Object() {}
-};
-
-}
-
-#endif
=== modified file 'src/ui_basic/panel.h'
--- src/ui_basic/panel.h 2011-11-04 22:49:27 +0000
+++ src/ui_basic/panel.h 2011-11-21 19:06:26 +0000
@@ -21,7 +21,8 @@
#ifndef UI_PANEL_H
#define UI_PANEL_H
-#include "object.h"
+#include <boost/signals/trackable.hpp>
+#include <boost/noncopyable.hpp>
#include "point.h"
#include "graphic/picture_id.h"
@@ -58,7 +59,7 @@
* its desired size changes, this automatically changes the actual size (which then invokes
* \ref layout and \ref move_inside_parent).
*/
-struct Panel : public Object {
+struct Panel : boost::signals::trackable, boost::noncopyable {
enum {
pf_handle_mouse = 1, ///< receive mouse events
pf_think = 2, ///< call think() function during run
=== modified file 'src/ui_basic/radiobutton.cc'
--- src/ui_basic/radiobutton.cc 2011-11-06 12:22:50 +0000
+++ src/ui_basic/radiobutton.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 2006, 2008-2009 by the Widelands Development Team
+ * Copyright (C) 2002, 2006, 2008-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -115,15 +115,15 @@
*/
void Radiogroup::set_state(int32_t const state) {
if (state == m_state) {
- clicked.call();
+ clicked();
return;
}
for (Radiobutton * btn = m_buttons; btn; btn = btn->m_nextbtn)
btn->set_state(btn->m_id == state);
m_state = state;
- changed.call();
- changedto.call(state);
+ changed();
+ changedto(state);
}
/**
=== modified file 'src/ui_basic/radiobutton.h'
--- src/ui_basic/radiobutton.h 2011-11-06 12:22:50 +0000
+++ src/ui_basic/radiobutton.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2006, 2008-2009 by the Widelands Development Team
+ * Copyright (C) 2004, 2006, 2008-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -22,7 +22,6 @@
#include "graphic/picture_id.h"
#include "point.h"
-#include "m_signal.h"
#include "checkbox.h"
@@ -59,9 +58,9 @@
Radiogroup();
~Radiogroup();
- Signal changed;
- Signal1<int32_t> changedto;
- Signal clicked; // clicked without things changed
+ boost::signal<void ()> changed;
+ boost::signal<void (int32_t)> changedto;
+ boost::signal<void ()> clicked; // clicked without things changed
int32_t add_button
(Panel * parent, Point, PictureID picid, char const * tooltip = 0, Radiobutton ** = NULL);
=== modified file 'src/ui_basic/scrollbar.cc'
--- src/ui_basic/scrollbar.cc 2010-12-03 19:03:40 +0000
+++ src/ui_basic/scrollbar.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 2006-2010 by the Widelands Development Team
+ * Copyright (C) 2002, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -134,7 +134,7 @@
return;
m_pos = pos;
- moved.call(pos);
+ moved(pos);
update();
}
=== modified file 'src/ui_basic/scrollbar.h'
--- src/ui_basic/scrollbar.h 2010-12-03 19:03:40 +0000
+++ src/ui_basic/scrollbar.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 2006-2010 by the Widelands Development Team
+ * Copyright (C) 2002, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -20,8 +20,9 @@
#ifndef UI_SCROLLBAR_H
#define UI_SCROLLBAR_H
+#include <boost/signal.hpp>
+
#include "panel.h"
-#include "m_signal.h"
#include "rect.h"
@@ -50,7 +51,7 @@
(Panel * parent,
int32_t x, int32_t y, uint32_t w, uint32_t h, bool horiz);
- Signal1<int32_t> moved;
+ boost::signal<void (int32_t)> moved;
void set_steps(int32_t steps);
void set_singlestepsize(uint32_t singlestepsize);
=== modified file 'src/ui_basic/slider.cc'
--- src/ui_basic/slider.cc 2011-11-15 16:11:23 +0000
+++ src/ui_basic/slider.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2010 by the Widelands Development Team
+ * Copyright (C) 2002-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -193,8 +193,8 @@
*/
void Slider::send_value_changed()
{
- changed.call();
- changedto.call(m_value);
+ changed();
+ changedto(m_value);
}
@@ -549,6 +549,34 @@
// DISCRETE //
////////////////////////////////////////////////////////////////////////////////
+DiscreteSlider::DiscreteSlider
+ (Panel * const parent,
+ const int32_t x, const int32_t y, const uint32_t w, const uint32_t h,
+ const std::vector<std::string> labels_in,
+ uint32_t m_value,
+ const PictureID background_picture_id,
+ const std::string & tooltip_text,
+ const uint32_t cursor_size,
+ const bool enabled)
+ :
+ Panel (parent, x, y, w, h, tooltip_text),
+ slider
+ (this,
+ // here, we take into account the h_gap introduced by HorizontalSlider
+ w / (2 * labels_in.size()) - cursor_size / 2, 0,
+ w - (w / labels_in.size()) + cursor_size,
+ h - UI::Font::ui_small()->lineskip() - 2,
+ 0, labels_in.size() - 1, m_value,
+ background_picture_id,
+ tooltip_text,
+ cursor_size,
+ enabled),
+ labels(labels_in)
+{
+ slider.changed.connect(changed);
+ slider.changedto.connect(changedto);
+}
+
/**
* \brief Redraw the slide bar. The discrete horizontal bar is painted.
*
=== modified file 'src/ui_basic/slider.h'
--- src/ui_basic/slider.h 2011-11-08 22:45:39 +0000
+++ src/ui_basic/slider.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2010 by the Widelands Development Team
+ * Copyright (C) 2002-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -19,8 +19,9 @@
#ifndef UI_SLIDER_H
#define UI_SLIDER_H
+#include <boost/signal.hpp>
+
#include "panel.h"
-#include "m_signal.h"
#include "graphic/font.h"
namespace UI {
@@ -84,8 +85,8 @@
void set_highlighted(bool highlighted);
public:
- Signal changed;
- Signal1<int32_t> changedto;
+ boost::signal<void ()> changed;
+ boost::signal<void (int32_t)> changedto;
private:
int32_t m_min_value; // cursor values
@@ -179,7 +180,7 @@
/**
* \brief This class defines an discrete slide bar. We do not derive from
- * Slider, but rather embed it, as we need to re-size it and add the lables.
+ * Slider, but rather embed it, as we need to re-size it and add the labels.
*/
struct DiscreteSlider : public Panel {
DiscreteSlider
@@ -190,39 +191,21 @@
const PictureID background_picture_id,
const std::string & tooltip_text = std::string(),
const uint32_t cursor_size = 20,
- const bool enabled = true)
- :
- Panel (parent, x, y, w, h, tooltip_text),
- slider
- (this,
- // here, we take into account the h_gap introduced by HorizontalSlider
- w / (2 * labels_in.size()) - cursor_size / 2, 0,
- w - (w / labels_in.size()) + cursor_size,
- h - UI::Font::ui_small()->lineskip() - 2,
- 0, labels_in.size() - 1, m_value,
- background_picture_id,
- tooltip_text,
- cursor_size,
- enabled),
- changed(&slider.changed),
- changedto(&slider.changedto),
- labels(labels_in)
- {}
-protected:
- HorizontalSlider slider;
-public:
+ const bool enabled = true);
+
void set_labels(std::vector<std::string>);
- Signal * changed;
- Signal1<int32_t> * changedto;
-
-private:
- std::vector<std::string> labels;
+ boost::signal<void ()> changed;
+ boost::signal<void (int32_t)> changedto;
protected:
-
virtual void draw(RenderTarget & dst);
virtual void layout();
+
+ HorizontalSlider slider;
+
+private:
+ std::vector<std::string> labels;
};
=== modified file 'src/ui_basic/table.cc'
--- src/ui_basic/table.cc 2011-11-20 12:29:57 +0000
+++ src/ui_basic/table.cc 2011-11-21 19:06:26 +0000
@@ -128,7 +128,7 @@
get_x() + get_w() - 24, get_y() + m_headerheight,
24, get_h() - m_headerheight,
false);
- m_scrollbar->moved.set(this, &Table::set_scrollpos);
+ m_scrollbar->moved.connect(boost::bind(&Table::set_scrollpos, this, _1));
m_scrollbar->set_steps(1);
uint32_t const lineheight = g_fh->get_fontheight(m_fontname, m_fontsize);
m_scrollbar->set_singlestepsize(lineheight);
@@ -365,7 +365,7 @@
and
m_last_selection == m_selection
and m_selection != no_selection_index())
- double_clicked.call(m_selection);
+ double_clicked(m_selection);
return true;
}
@@ -390,7 +390,7 @@
m_selection = i;
- selected.call(m_selection);
+ selected(m_selection);
update(0, 0, get_eff_w(), get_h());
}
=== modified file 'src/ui_basic/table.h'
--- src/ui_basic/table.h 2011-11-05 16:32:47 +0000
+++ src/ui_basic/table.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 2006, 2008-2009 by the Widelands Development Team
+ * Copyright (C) 2002, 2006, 2008-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -23,13 +23,13 @@
#include "align.h"
#include "panel.h"
-#include "m_signal.h"
#include "compile_assert.h"
#include <limits>
#include <vector>
#include <boost/function.hpp>
+#include <boost/signal.hpp>
namespace UI {
struct Scrollbar;
@@ -53,8 +53,8 @@
bool descending = false);
~Table();
- Signal1<uint32_t> selected;
- Signal1<uint32_t> double_clicked;
+ boost::signal<void (uint32_t)> selected;
+ boost::signal<void (uint32_t)> double_clicked;
/// A column that has a title is sortable (by clicking on the title).
void add_column
@@ -157,8 +157,8 @@
bool descending = false);
~Table();
- Signal1<uint32_t> selected;
- Signal1<uint32_t> double_clicked;
+ boost::signal<void (uint32_t)> selected;
+ boost::signal<void (uint32_t)> double_clicked;
void add_column
(uint32_t width,
=== modified file 'src/ui_basic/wsm_checkbox.cc'
--- src/ui_basic/wsm_checkbox.cc 2011-10-26 19:15:59 +0000
+++ src/ui_basic/wsm_checkbox.cc 2011-11-21 19:06:26 +0000
@@ -32,7 +32,6 @@
WSM_Checkbox::WSM_Checkbox
(UI::Panel * const parent,
Point const p,
- int32_t const id,
PictureID const picid,
RGBColor const color)
:
@@ -40,7 +39,6 @@
m_pic (picid),
m_color (color)
{
- set_id(id);
}
/**
=== modified file 'src/ui_basic/wsm_checkbox.h'
--- src/ui_basic/wsm_checkbox.h 2011-10-26 19:15:59 +0000
+++ src/ui_basic/wsm_checkbox.h 2011-11-21 19:06:26 +0000
@@ -27,7 +27,7 @@
* of the graph and it needs a picture
*/
struct WSM_Checkbox : public UI::Checkbox {
- WSM_Checkbox(UI::Panel *, Point, int32_t id, PictureID picid, RGBColor);
+ WSM_Checkbox(UI::Panel *, Point, PictureID picid, RGBColor);
virtual void draw(RenderTarget &);
=== modified file 'src/ui_fsmenu/campaign_select.cc'
--- src/ui_fsmenu/campaign_select.cc 2010-12-04 23:11:18 +0000
+++ src/ui_fsmenu/campaign_select.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2009 by the Widelands Development Team
+ * Copyright (C) 2002-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -98,10 +98,10 @@
label_campdescr .set_font(m_fn, m_fs, UI_FONT_CLR_FG);
tacampdescr .set_font(m_fn, m_fs, UI_FONT_CLR_FG);
m_list.set_font(m_fn, m_fs);
- m_list.selected .set
- (this, &Fullscreen_Menu_CampaignSelect::campaign_selected);
- m_list.double_clicked.set
- (this, &Fullscreen_Menu_CampaignSelect::double_clicked);
+ m_list.selected.connect
+ (boost::bind(&Fullscreen_Menu_CampaignSelect::campaign_selected, this, _1));
+ m_list.double_clicked.connect
+ (boost::bind(&Fullscreen_Menu_CampaignSelect::double_clicked, this, _1));
fill_list();
}
@@ -304,9 +304,9 @@
label_mapdescr.set_font(m_fn, m_fs, UI_FONT_CLR_FG);
tamapdescr .set_font(m_fn, m_fs, UI_FONT_CLR_FG);
m_list.set_font(m_fn, m_fs);
- m_list.selected.set(this, &Fullscreen_Menu_CampaignMapSelect::map_selected);
- m_list.double_clicked.set
- (this, &Fullscreen_Menu_CampaignMapSelect::double_clicked);
+ m_list.selected.connect(boost::bind(&Fullscreen_Menu_CampaignMapSelect::map_selected, this, _1));
+ m_list.double_clicked.connect
+ (boost::bind(&Fullscreen_Menu_CampaignMapSelect::double_clicked, this, _1));
}
=== modified file 'src/ui_fsmenu/editor_mapselect.cc'
--- src/ui_fsmenu/editor_mapselect.cc 2010-12-04 23:11:18 +0000
+++ src/ui_fsmenu/editor_mapselect.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2009 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -123,9 +123,9 @@
m_descr .set_font(m_fn, m_fs, UI_FONT_CLR_FG);
m_list .set_font(m_fn, m_fs);
- m_list.selected.set(this, &Fullscreen_Menu_Editor_MapSelect::map_selected);
- m_list.double_clicked.set
- (this, &Fullscreen_Menu_Editor_MapSelect::double_clicked);
+ m_list.selected.connect(boost::bind(&Fullscreen_Menu_Editor_MapSelect::map_selected, this, _1));
+ m_list.double_clicked.connect
+ (boost::bind(&Fullscreen_Menu_Editor_MapSelect::double_clicked, this, _1));
fill_list();
}
=== modified file 'src/ui_fsmenu/loadgame.cc'
--- src/ui_fsmenu/loadgame.cc 2011-10-23 16:52:10 +0000
+++ src/ui_fsmenu/loadgame.cc 2011-11-21 19:06:26 +0000
@@ -100,8 +100,8 @@
m_label_gametime.set_font(m_fn, m_fs, UI_FONT_CLR_FG);
m_tagametime .set_font(m_fn, m_fs, UI_FONT_CLR_FG);
m_list .set_font(m_fn, m_fs);
- m_list.selected.set(this, &Fullscreen_Menu_LoadGame::map_selected);
- m_list.double_clicked.set(this, &Fullscreen_Menu_LoadGame::double_clicked);
+ m_list.selected.connect(boost::bind(&Fullscreen_Menu_LoadGame::map_selected, this, _1));
+ m_list.double_clicked.connect(boost::bind(&Fullscreen_Menu_LoadGame::double_clicked, this, _1));
fill_list();
}
=== modified file 'src/ui_fsmenu/loadreplay.cc'
--- src/ui_fsmenu/loadreplay.cc 2011-10-23 16:52:10 +0000
+++ src/ui_fsmenu/loadreplay.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2009 by the Widelands Development Team
+ * Copyright (C) 2007-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -79,10 +79,10 @@
m_tagametime(this, get_w() * 71 / 100, get_h() * 3 / 8)
{
m_title.set_textstyle(ts_big());
- m_list .set_font(ui_fn(), fs_small());
- m_list .selected.set(this, &Fullscreen_Menu_LoadReplay::replay_selected);
- m_list .double_clicked.set
- (this, &Fullscreen_Menu_LoadReplay::double_clicked);
+ m_list.set_font(ui_fn(), fs_small());
+ m_list.selected.connect(boost::bind(&Fullscreen_Menu_LoadReplay::replay_selected, this, _1));
+ m_list.double_clicked.connect
+ (boost::bind(&Fullscreen_Menu_LoadReplay::double_clicked, this, _1));
m_back.set_font(font_small());
m_ok.set_font(font_small());
fill_list();
=== modified file 'src/ui_fsmenu/mapselect.cc'
--- src/ui_fsmenu/mapselect.cc 2011-11-15 16:11:23 +0000
+++ src/ui_fsmenu/mapselect.cc 2011-11-21 19:06:26 +0000
@@ -157,8 +157,8 @@
m_load_map_as_scenario.set_state(false);
m_load_map_as_scenario.set_enabled(false);
- m_table.selected.set(this, &Fullscreen_Menu_MapSelect::map_selected);
- m_table.double_clicked.set(this, &Fullscreen_Menu_MapSelect::double_clicked);
+ m_table.selected.connect(boost::bind(&Fullscreen_Menu_MapSelect::map_selected, this, _1));
+ m_table.double_clicked.connect(boost::bind(&Fullscreen_Menu_MapSelect::double_clicked, this, _1));
UI::Box * vbox = new UI::Box
(this, m_table.get_x(), m_table.get_y() - 120, UI::Box::Horizontal, m_table.get_w());
@@ -536,9 +536,8 @@
m_tags_ordered.push_back(tag);
UI::Checkbox * cb = new UI::Checkbox(box, Point(0, 0));
- cb->set_id(id);
- cb->changedtoid.set
- (this, &Fullscreen_Menu_MapSelect::_tagbox_changed);
+ cb->changedto.connect
+ (boost::bind(&Fullscreen_Menu_MapSelect::_tagbox_changed, this, id, _1));
box->add(cb, UI::Box::AlignLeft, true);
UI::Textarea * ta = new UI::Textarea(box, displ_name, UI::Align_CenterLeft, 100);
=== modified file 'src/ui_fsmenu/netsetup_ggz.cc'
--- src/ui_fsmenu/netsetup_ggz.cc 2011-07-31 18:09:39 +0000
+++ src/ui_fsmenu/netsetup_ggz.cc 2011-11-21 19:06:26 +0000
@@ -100,7 +100,7 @@
// Edit boxes
servername
(this, get_w() * 17 / 25, get_h() * 68 / 100, m_butw, m_buth,
- g_gr->get_picture(PicMod_UI, "pics/but2.png"), 0),
+ g_gr->get_picture(PicMod_UI, "pics/but2.png")),
// List
usersonline
@@ -139,8 +139,8 @@
maxplayers .set_font(m_fn, m_fs, UI_FONT_CLR_FG);
std::string server = s.get_string("servername", "");
servername .setText (server);
- servername .changed.set
- (this, &Fullscreen_Menu_NetSetupGGZ::change_servername);
+ servername .changed.connect
+ (boost::bind(&Fullscreen_Menu_NetSetupGGZ::change_servername, this));
servername .set_font(m_fn, m_fs, UI_FONT_CLR_FG);
// prepare the lists
@@ -153,13 +153,13 @@
(0,
boost::bind
(&Fullscreen_Menu_NetSetupGGZ::compare_usertype, this, _1, _2));
- usersonline .double_clicked.set
- (this, &Fullscreen_Menu_NetSetupGGZ::user_doubleclicked);
+ usersonline .double_clicked.connect
+ (boost::bind(&Fullscreen_Menu_NetSetupGGZ::user_doubleclicked, this, _1));
opengames .set_font(m_fn, m_fs);
- opengames .selected.set
- (this, &Fullscreen_Menu_NetSetupGGZ::server_selected);
- opengames .double_clicked.set
- (this, &Fullscreen_Menu_NetSetupGGZ::server_doubleclicked);
+ opengames .selected.connect
+ (boost::bind(&Fullscreen_Menu_NetSetupGGZ::server_selected, this, _1));
+ opengames .double_clicked.connect
+ (boost::bind(&Fullscreen_Menu_NetSetupGGZ::server_doubleclicked, this, _1));
// try to connect to the metaserver
if (!NetGGZ::ref().usedcore())
=== modified file 'src/ui_fsmenu/netsetup_lan.cc'
--- src/ui_fsmenu/netsetup_lan.cc 2010-12-04 23:11:18 +0000
+++ src/ui_fsmenu/netsetup_lan.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2006-2009 by the Widelands Development Team
+ * Copyright (C) 2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -86,10 +86,10 @@
// Edit boxes
playername
(this, get_w() * 16 / 25, get_h() * 3333 / 10000, m_butw, m_buth,
- g_gr->get_picture(PicMod_UI, "pics/but2.png"), 0),
+ g_gr->get_picture(PicMod_UI, "pics/but2.png")),
hostname
(this, get_w() * 16 / 25, get_h() * 19 / 40, get_w() * 17 / 80, m_buth,
- g_gr->get_picture(PicMod_UI, "pics/but2.png"), 0),
+ g_gr->get_picture(PicMod_UI, "pics/but2.png")),
// List
opengames
@@ -107,20 +107,20 @@
m_opengames .set_textstyle(ts_small());
m_playername.set_textstyle(ts_small());
m_hostname .set_textstyle(ts_small());
- hostname .changed.set
- (this, &Fullscreen_Menu_NetSetupLAN::change_hostname);
+ hostname .changed.connect
+ (boost::bind(&Fullscreen_Menu_NetSetupLAN::change_hostname, this));
hostname .set_font(ui_fn(), fs_small(), UI_FONT_CLR_FG);
playername .setText (s.get_string("nickname", (_("nobody"))));
- playername .changed.set
- (this, &Fullscreen_Menu_NetSetupLAN::change_playername);
+ playername .changed.connect
+ (boost::bind(&Fullscreen_Menu_NetSetupLAN::change_playername, this));
playername .set_font(ui_fn(), fs_small(), UI_FONT_CLR_FG);
opengames .set_font(ui_fn(), fs_small());
opengames .add_column(m_lisw * 2 / 5, _("Host"));
opengames .add_column(m_lisw * 2 / 5, _("Map"));
opengames .add_column(m_lisw / 5, _("State"));
- opengames .selected.set(this, &Fullscreen_Menu_NetSetupLAN::game_selected);
- opengames .double_clicked.set
- (this, &Fullscreen_Menu_NetSetupLAN::game_doubleclicked);
+ opengames .selected.connect(boost::bind(&Fullscreen_Menu_NetSetupLAN::game_selected, this, _1));
+ opengames .double_clicked.connect
+ (boost::bind(&Fullscreen_Menu_NetSetupLAN::game_doubleclicked, this, _1));
discovery .set_callback (discovery_callback, this);
joingame.set_enabled(false);
=== modified file 'src/wui/attack_box.cc'
--- src/wui/attack_box.cc 2010-12-04 23:11:18 +0000
+++ src/wui/attack_box.cc 2011-11-21 19:06:26 +0000
@@ -198,7 +198,7 @@
"pics/but2.png",
_("Number of soldiers"));
- m_slider_soldiers->changed.set(this, &AttackBox::update_attack);
+ m_slider_soldiers->changed.connect(boost::bind(&AttackBox::update_attack, this));
sprintf(buf, "%u", max_attackers);
m_add_soldiers =
@@ -237,7 +237,7 @@
m_pl->get_retreat_percentage(),
"pics/but2.png",
_("Supported damage before retreat"));
- m_slider_retreat->changed.set(this, &AttackBox::update_attack);
+ m_slider_retreat->changed.connect(boost::bind(&AttackBox::update_attack, this));
add_text(linebox, _("Once injured"));
m_slider_retreat->set_enabled(m_pl->is_retreat_change_allowed());
linebox.set_visible(m_pl->is_retreat_change_allowed());
=== modified file 'src/wui/building_statistics_menu.cc'
--- src/wui/building_statistics_menu.cc 2011-02-18 15:33:09 +0000
+++ src/wui/building_statistics_menu.cc 2011-11-21 19:06:26 +0000
@@ -114,7 +114,7 @@
m_table.add_column (50, _("Prod"), UI::Align_Right);
m_table.add_column (50, _("Owned"), UI::Align_Right);
m_table.add_column (50, _("Build"), UI::Align_HCenter);
- m_table.selected.set(this, &Building_Statistics_Menu::table_changed);
+ m_table.selected.connect(boost::bind(&Building_Statistics_Menu::table_changed, this, _1));
m_table.set_column_compare
(Columns::Size,
boost::bind
=== modified file 'src/wui/encyclopedia_window.cc'
--- src/wui/encyclopedia_window.cc 2011-11-06 00:33:07 +0000
+++ src/wui/encyclopedia_window.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2010 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -75,9 +75,9 @@
WINDOW_WIDTH / 3, WINDOW_HEIGHT - 150, WARE_GROUPS_TABLE_WIDTH, 140),
descrTxt (this, 5, WINDOW_HEIGHT - 240, WINDOW_WIDTH - 10, 80, "")
{
- wares.selected.set(this, &EncyclopediaWindow::wareSelected);
+ wares.selected.connect(boost::bind(&EncyclopediaWindow::wareSelected, this, _1));
- prodSites.selected.set(this, &EncyclopediaWindow::prodSiteSelected);
+ prodSites.selected.connect(boost::bind(&EncyclopediaWindow::prodSiteSelected, this, _1));
condTable.add_column (WARE_PICTURE_COLUMN_WIDTH);
condTable.add_column
=== modified file 'src/wui/fieldaction.cc'
--- src/wui/fieldaction.cc 2011-11-09 20:31:17 +0000
+++ src/wui/fieldaction.cc 2011-11-21 19:06:26 +0000
@@ -65,9 +65,9 @@
const int32_t x, const int32_t y,
int32_t cols);
- UI::Signal1<Widelands::Building_Index::value_t> buildclicked;
- UI::Signal1<Widelands::Building_Index::value_t> buildmouseout;
- UI::Signal1<Widelands::Building_Index::value_t> buildmousein;
+ boost::signal<void (Widelands::Building_Index::value_t)> buildclicked;
+ boost::signal<void (Widelands::Building_Index::value_t)> buildmouseout;
+ boost::signal<void (Widelands::Building_Index::value_t)> buildmousein;
void add(Widelands::Building_Index::value_t);
@@ -91,9 +91,9 @@
(parent, x, y, BG_CELL_WIDTH, BG_CELL_HEIGHT, cols),
m_tribe(tribe)
{
- clicked.set(this, &BuildGrid::clickslot);
- mouseout.set(this, &BuildGrid::mouseoutslot);
- mousein.set(this, &BuildGrid::mouseinslot);
+ clicked.connect(boost::bind(&BuildGrid::clickslot, this, _1));
+ mouseout.connect(boost::bind(&BuildGrid::mouseoutslot, this, _1));
+ mousein.connect(boost::bind(&BuildGrid::mouseinslot, this, _1));
}
@@ -122,8 +122,7 @@
*/
void BuildGrid::clickslot(int32_t const idx)
{
- buildclicked.call
- (static_cast<int32_t>(reinterpret_cast<intptr_t>(get_data(idx))));
+ buildclicked(static_cast<int32_t>(reinterpret_cast<intptr_t>(get_data(idx))));
}
@@ -137,8 +136,7 @@
*/
void BuildGrid::mouseoutslot(int32_t idx)
{
- buildmouseout.call
- (static_cast<int32_t>(reinterpret_cast<intptr_t>(get_data(idx))));
+ buildmouseout(static_cast<int32_t>(reinterpret_cast<intptr_t>(get_data(idx))));
}
@@ -152,8 +150,7 @@
*/
void BuildGrid::mouseinslot(int32_t idx)
{
- buildmousein.call
- (static_cast<int32_t>(reinterpret_cast<intptr_t>(get_data(idx))));
+ buildmousein(static_cast<int32_t>(reinterpret_cast<intptr_t>(get_data(idx))));
}
@@ -565,12 +562,12 @@
// Allocate the tab's grid if necessary
if (!*ppgrid) {
*ppgrid = new BuildGrid(&m_tabpanel, tribe, 0, 0, 5);
- (*ppgrid)->buildclicked.set(this, &FieldActionWindow::act_build);
- (*ppgrid)->buildmouseout.set
- (this, &FieldActionWindow::building_icon_mouse_out);
+ (*ppgrid)->buildclicked.connect(boost::bind(&FieldActionWindow::act_build, this, _1));
+ (*ppgrid)->buildmouseout.connect
+ (boost::bind(&FieldActionWindow::building_icon_mouse_out, this, _1));
- (*ppgrid)->buildmousein.set
- (this, &FieldActionWindow::building_icon_mouse_in);
+ (*ppgrid)->buildmousein.connect
+ (boost::bind(&FieldActionWindow::building_icon_mouse_in, this, _1));
}
// Add it to the grid
=== modified file 'src/wui/game_chat_menu.cc'
--- src/wui/game_chat_menu.cc 2011-06-10 09:31:56 +0000
+++ src/wui/game_chat_menu.cc 2011-11-21 19:06:26 +0000
@@ -42,8 +42,8 @@
m_close_on_send = false;
- m_chat.sent.set(this, &GameChatMenu::acknowledge);
- m_chat.aborted.set(this, &GameChatMenu::acknowledge);
+ m_chat.sent.connect(boost::bind(&GameChatMenu::acknowledge, this));
+ m_chat.aborted.connect(boost::bind(&GameChatMenu::acknowledge, this));
enter_chat_message(m_close_on_send);
}
=== modified file 'src/wui/game_debug_ui.cc'
--- src/wui/game_debug_ui.cc 2010-10-17 19:42:01 +0000
+++ src/wui/game_debug_ui.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2006-2010 by the Widelands Development Team
+ * Copyright (C) 2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -255,7 +255,7 @@
assert(m_coords.y < m_map.get_height());
assert(&m_map[0] <= m_coords.field);
assert (m_coords.field < &m_map[0] + m_map.max_index());
- m_ui_bobs.selected.set(this, &FieldDebugWindow::open_bob);
+ m_ui_bobs.selected.connect(boost::bind(&FieldDebugWindow::open_bob, this, _1));
}
=== modified file 'src/wui/game_main_menu_save_game.cc'
--- src/wui/game_main_menu_save_game.cc 2011-06-10 11:30:44 +0000
+++ src/wui/game_main_menu_save_game.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2008, 2010 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2008, 2010-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -78,8 +78,8 @@
(*this, DESCRIPTION_X, DELETE_Y, DESCRIPTION_WIDTH, BUTTON_HEIGHT),
m_curdir(SaveHandler::get_base_dir())
{
- m_ls.selected.set(this, &Game_Main_Menu_Save_Game::selected);
- m_ls.double_clicked.set(this, &Game_Main_Menu_Save_Game::double_clicked);
+ m_ls.selected.connect(boost::bind(&Game_Main_Menu_Save_Game::selected, this, _1));
+ m_ls.double_clicked.connect(boost::bind(&Game_Main_Menu_Save_Game::double_clicked, this, _1));
fill_list();
=== modified file 'src/wui/game_main_menu_save_game.h'
--- src/wui/game_main_menu_save_game.h 2010-09-25 21:22:19 +0000
+++ src/wui/game_main_menu_save_game.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006, 2008, 2010 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006, 2008, 2010-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -60,7 +60,7 @@
x, y, w, h,
g_gr->get_picture(PicMod_UI, "pics/but1.png"))
{
- changed.set(&parent, &Game_Main_Menu_Save_Game::edit_box_changed);
+ changed.connect(boost::bind(&Game_Main_Menu_Save_Game::edit_box_changed, &parent));
}
bool handle_key(bool down, SDL_keysym);
} m_editbox;
=== modified file 'src/wui/game_message_menu.h'
--- src/wui/game_message_menu.h 2010-11-21 11:44:22 +0000
+++ src/wui/game_message_menu.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006, 2008-2010 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006, 2008-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -63,7 +63,7 @@
List(GameMessageMenu & parent) :
UI::Table<uintptr_t>(&parent, 5, 35, 360, 110)
{
- selected.set(&parent, &GameMessageMenu::selected);
+ selected.connect(boost::bind(&GameMessageMenu::selected, &parent, _1));
add_column (50, _("Select"), UI::Align_HCenter, true);
add_column (50, _("Status"), UI::Align_HCenter);
add_column(136, _("Title"));
=== modified file 'src/wui/game_objectives_menu.cc'
--- src/wui/game_objectives_menu.cc 2011-02-05 14:02:31 +0000
+++ src/wui/game_objectives_menu.cc 2011-11-21 19:06:26 +0000
@@ -76,7 +76,7 @@
#endif
m_player(plr)
{
- list.selected.set(this, &GameObjectivesMenu::selected);
+ list.selected.connect(boost::bind(&GameObjectivesMenu::selected, this, _1));
if (get_usedefaultpos())
center_to_parent();
}
=== modified file 'src/wui/game_options_sound_menu.cc'
--- src/wui/game_options_sound_menu.cc 2010-04-24 20:03:07 +0000
+++ src/wui/game_options_sound_menu.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 by the Widelands Development Team
+ * Copyright (C) 2007-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -81,14 +81,14 @@
}
// ready signals
- ingame_music.changedto.set
- (this, &GameOptionsSoundMenu::changed_ingame_music);
- ingame_sound.changedto.set
- (this, &GameOptionsSoundMenu::changed_ingame_sound);
- ingame_music_volume.changedto.set
- (this, &GameOptionsSoundMenu::music_volume_changed);
- ingame_sound_volume.changedto.set
- (this, &GameOptionsSoundMenu::sound_volume_changed);
+ ingame_music.changedto.connect
+ (boost::bind(&GameOptionsSoundMenu::changed_ingame_music, this, _1));
+ ingame_sound.changedto.connect
+ (boost::bind(&GameOptionsSoundMenu::changed_ingame_sound, this, _1));
+ ingame_music_volume.changedto.connect
+ (boost::bind(&GameOptionsSoundMenu::music_volume_changed, this, _1));
+ ingame_sound_volume.changedto.connect
+ (boost::bind(&GameOptionsSoundMenu::sound_volume_changed, this, _1));
uint32_t boxes_width =
STATEBOX_WIDTH + hspacing() +
=== modified file 'src/wui/gamechatpanel.cc'
--- src/wui/gamechatpanel.cc 2011-02-20 20:55:17 +0000
+++ src/wui/gamechatpanel.cc 2011-11-21 19:06:26 +0000
@@ -34,8 +34,8 @@
editbox (this, 0, h - 20, w, 20)
{
chatbox.set_scrollmode(UI::Multiline_Textarea::ScrollLog);
- editbox.ok.set(this, &GameChatPanel::keyEnter);
- editbox.cancel.set(this, &GameChatPanel::keyEscape);
+ editbox.ok.connect(boost::bind(&GameChatPanel::keyEnter, this));
+ editbox.cancel.connect(boost::bind(&GameChatPanel::keyEscape, this));
editbox.setAlign(UI::Align_Left);
editbox.activate_history(true);
@@ -81,11 +81,11 @@
m_chat.send(str);
editbox.setText("");
- sent.call();
+ sent();
}
void GameChatPanel::keyEscape()
{
editbox.setText("");
- aborted.call();
+ aborted();
}
=== modified file 'src/wui/gamechatpanel.h'
--- src/wui/gamechatpanel.h 2011-02-19 23:53:52 +0000
+++ src/wui/gamechatpanel.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 by the Widelands Development Team
+ * Copyright (C) 2008-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -43,12 +43,12 @@
/**
* Signal is called when a message has been sent by the user.
*/
- UI::Signal sent;
+ boost::signal<void ()> sent;
/**
* Signal is called when the user has aborted entering a message.
*/
- UI::Signal aborted;
+ boost::signal<void ()> aborted;
std::string const & get_edit_text() const {return editbox.text();}
void set_edit_text(std::string const & text) {editbox.setText(text);}
=== modified file 'src/wui/general_statistics_menu.cc'
--- src/wui/general_statistics_menu.cc 2011-11-06 21:26:10 +0000
+++ src/wui/general_statistics_menu.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2008 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -269,8 +269,8 @@
}
m_radiogroup.set_state(m_selected_information);
- m_radiogroup.changedto.set
- (this, &General_Statistics_Menu::radiogroup_changed);
+ m_radiogroup.changedto.connect
+ (boost::bind(&General_Statistics_Menu::radiogroup_changed, this, _1));
m_box.add(hbox2, UI::Box::AlignTop);
=== modified file 'src/wui/interactive_base.cc'
--- src/wui/interactive_base.cc 2011-10-23 16:18:19 +0000
+++ src/wui/interactive_base.cc 2011-11-21 19:06:26 +0000
@@ -100,7 +100,7 @@
(boost::bind(&QuickNavigation::view_changed,
m->quicknavigation.get(), _1, _2));
- changeview.set(this, &Interactive_Base::mainview_move);
+ changeview.connect(boost::bind(&Interactive_Base::mainview_move, this, _1, _2));
set_border_snap_distance(global_s.get_int("border_snap_distance", 0));
set_panel_snap_distance (global_s.get_int("panel_snap_distance", 10));
@@ -483,7 +483,7 @@
}
else {
m->mm = new MiniMap(*this, &m->minimap);
- m->mm->warpview.set(this, &Interactive_Base::minimap_warp);
+ m->mm->warpview.connect(boost::bind(&Interactive_Base::minimap_warp, this, _1, _2));
// make sure the viewpos marker is at the right pos to start with
const Point p = get_viewpoint();
=== modified file 'src/wui/interactive_player.cc'
--- src/wui/interactive_player.cc 2011-11-09 20:16:07 +0000
+++ src/wui/interactive_player.cc 2011-11-21 19:06:26 +0000
@@ -167,7 +167,7 @@
m_toolbar.add(&m_toggle_message_menu, UI::Box::AlignLeft);
set_player_number(plyn);
- fieldclicked.set(this, &Interactive_Player::node_action);
+ fieldclicked.connect(boost::bind(&Interactive_Player::node_action, this));
adjust_toolbar_position();
=== modified file 'src/wui/interactive_spectator.cc'
--- src/wui/interactive_spectator.cc 2011-11-06 20:04:55 +0000
+++ src/wui/interactive_spectator.cc 2011-11-21 19:06:26 +0000
@@ -96,7 +96,7 @@
adjust_toolbar_position();
// Setup all screen elements
- fieldclicked.set(this, &Interactive_Spectator::node_action);
+ fieldclicked.connect(boost::bind(&Interactive_Spectator::node_action, this));
set_display_flag(dfSpeed, true);
=== modified file 'src/wui/login_box.cc'
--- src/wui/login_box.cc 2010-10-17 19:42:01 +0000
+++ src/wui/login_box.cc 2011-11-21 19:06:26 +0000
@@ -33,13 +33,13 @@
eb_nickname =
new UI::EditBox
(this, 150, 5, 330, 20,
- g_gr->get_picture(PicMod_UI, "pics/but2.png"), 0, UI::Align_Left);
+ g_gr->get_picture(PicMod_UI, "pics/but2.png"), UI::Align_Left);
ta_password = new UI::Textarea(this, 10, 40, _("Password:"));
eb_password =
new UI::EditBox
(this, 150, 40, 330, 20,
- g_gr->get_picture(PicMod_UI, "pics/but2.png"), 0, UI::Align_Left);
+ g_gr->get_picture(PicMod_UI, "pics/but2.png"), UI::Align_Left);
pwd_warning =
new UI::Textarea
=== modified file 'src/wui/mapview.cc'
--- src/wui/mapview.cc 2010-05-17 10:21:20 +0000
+++ src/wui/mapview.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2008 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -125,7 +125,7 @@
if (m_changeview)
m_changeview(vp, jump);
- changeview.call(m_viewpoint.x, m_viewpoint.y);
+ changeview(m_viewpoint.x, m_viewpoint.y);
m_complete_redraw_needed = true;
}
@@ -160,7 +160,7 @@
{
track_sel(Point(x, y));
- fieldclicked.call();
+ fieldclicked();
} else if (btn == SDL_BUTTON_RIGHT) {
m_dragging = true;
grab_mouse(true);
=== modified file 'src/wui/mapview.h'
--- src/wui/mapview.h 2010-11-21 11:44:22 +0000
+++ src/wui/mapview.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2008 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -21,11 +21,11 @@
#define MAPVIEW_H
#include <boost/function.hpp>
+#include <boost/signal.hpp>
#include "logic/widelands_geometry.h"
#include "ui_basic/panel.h"
-#include "ui_basic/m_signal.h"
struct Interactive_Base;
@@ -53,9 +53,9 @@
*
* Parameters are x/y position in screen coordinates.
*/
- UI::Signal2<int32_t, int32_t> changeview;
+ boost::signal<void (int32_t, int32_t)> changeview;
- UI::Signal fieldclicked;
+ boost::signal<void ()> fieldclicked;
void warp_mouse_to_node(Widelands::Coords);
=== modified file 'src/wui/military_box.cc'
--- src/wui/military_box.cc 2010-12-04 23:11:18 +0000
+++ src/wui/military_box.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2010 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -146,7 +146,7 @@
m_pl->get_retreat_percentage(),
"pics/caret.png",
_("Supported damage before retreat"));
- m_slider_retreat->changed.set(this, &MilitaryBox::update);
+ m_slider_retreat->changed.connect(boost::bind(&MilitaryBox::update, this));
add_text(linebox, _("Once injured"));
m_slider_retreat->set_enabled(m_pl->is_retreat_change_allowed());
linebox.set_visible(m_pl->is_retreat_change_allowed());
=== modified file 'src/wui/minimap.cc'
--- src/wui/minimap.cc 2010-12-03 21:50:40 +0000
+++ src/wui/minimap.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2010 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -93,8 +93,7 @@
m_ibase.egbase().map().normalize_coords(c);
- ref_cast<MiniMap, UI::Panel>(*get_parent()).warpview.call
- (c.x * TRIANGLE_WIDTH, c.y * TRIANGLE_HEIGHT);
+ ref_cast<MiniMap, UI::Panel>(*get_parent()).warpview(c.x * TRIANGLE_WIDTH, c.y * TRIANGLE_HEIGHT);
return true;
}
=== modified file 'src/wui/minimap.h'
--- src/wui/minimap.h 2010-10-23 18:30:23 +0000
+++ src/wui/minimap.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006, 2008 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006, 2008-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -20,6 +20,8 @@
#ifndef MINIMAP_H
#define MINIMAP_H
+#include <boost/signal.hpp>
+
#include "ui_basic/button.h"
#include "ui_basic/unique_window.h"
@@ -34,7 +36,7 @@
MiniMap(Interactive_Base & parent, Registry *);
- UI::Signal2<int32_t, int32_t> warpview;
+ boost::signal<void (int32_t, int32_t)> warpview;
void set_view_pos(int32_t const x, int32_t const y) {
m_view.set_view_pos(x, y);
=== modified file 'src/wui/playerdescrgroup.cc'
--- src/wui/playerdescrgroup.cc 2011-10-02 14:31:33 +0000
+++ src/wui/playerdescrgroup.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 2006-2010 by the Widelands Development Team
+ * Copyright (C) 2002, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -65,8 +65,8 @@
d->plr_name = new UI::Textarea(this, xplrname, 0, xplayertype - xplrname, h);
d->plr_name->set_textstyle(UI::TextStyle::makebold(font, UI_FONT_CLR_FG));
d->btnEnablePlayer = new UI::Checkbox(this, Point(xplayertype - 23, 0));
- d->btnEnablePlayer->changedto.set
- (this, &PlayerDescriptionGroup::enable_player);
+ d->btnEnablePlayer->changedto.connect
+ (boost::bind(&PlayerDescriptionGroup::enable_player, this, _1));
d->btnPlayerType = new UI::Callback_Button
(this, "player_type",
xplayertype, 0, xplayerteam - xplayertype - 2, h,
=== modified file 'src/wui/plot_area.h'
--- src/wui/plot_area.h 2011-11-15 16:11:23 +0000
+++ src/wui/plot_area.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2007-2008 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2007-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -25,6 +25,7 @@
#include "rgbcolor.h"
+#include <boost/bind.hpp>
#include <vector>
/*
@@ -154,7 +155,7 @@
m_plot_area(plot_area),
m_last_game_time_id(plot_area.get_game_time_id())
{
- changedto->set(&plot_area, &WUIPlot_Area::set_time_id);
+ changedto.connect(boost::bind(&WUIPlot_Area::set_time_id, &plot_area, _1));
}
protected:
=== modified file 'src/wui/ware_statistics_menu.h'
--- src/wui/ware_statistics_menu.h 2011-11-07 19:41:24 +0000
+++ src/wui/ware_statistics_menu.h 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004, 2006-2008 by the Widelands Development Team
+ * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -69,7 +69,7 @@
cursor_size,
enabled)
{
- changedto->set(signal_listener, &Ware_Statistics_Menu::set_time);
+ changedto.connect(boost::bind(&Ware_Statistics_Menu::set_time, signal_listener, _1));
}
};
=== modified file 'src/wui/waresqueuedisplay.cc'
--- src/wui/waresqueuedisplay.cc 2011-11-18 12:46:21 +0000
+++ src/wui/waresqueuedisplay.cc 2011-11-21 19:06:26 +0000
@@ -203,8 +203,8 @@
break;
}
- m_priority_radiogroup->changedto.set
- (this, &WaresQueueDisplay::radiogroup_changed);
+ m_priority_radiogroup->changedto.connect
+ (boost::bind(&WaresQueueDisplay::radiogroup_changed, this, _1));
bool const can_act = m_igb.can_act(m_building.owner().player_number());
if (not can_act)
=== modified file 'src/wui/watchwindow.cc'
--- src/wui/watchwindow.cc 2011-09-26 23:26:33 +0000
+++ src/wui/watchwindow.cc 2011-11-21 19:06:26 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 2004, 2006-2009 by the Widelands Development Team
+ * Copyright (C) 2002, 2004, 2006-2011 by the Widelands Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -31,7 +31,6 @@
#include "profile/profile.h"
#include "ui_basic/button.h"
-#include "ui_basic/m_signal.h"
#include "ui_basic/window.h"
#include "upcast.h"
@@ -60,7 +59,7 @@
return ref_cast<Interactive_GameBase, UI::Panel>(*get_parent()).game();
}
- UI::Signal1<Point> warp_mainview;
+ boost::signal<void (Point)> warp_mainview;
void add_view(Widelands::Coords);
void next_view(bool first = false);
@@ -159,7 +158,7 @@
WatchWindow & parent =
ref_cast<WatchWindow, UI::Panel>(*get_parent());
Map_View & mapview = parent.mapview;
- parent.warp_mainview.call
+ parent.warp_mainview
(mapview.get_viewpoint()
+
Point(mapview.get_w() / 2, mapview.get_h() / 2));
@@ -245,9 +244,9 @@
if (_single_window)
for (uint8_t i = 0; i < NUM_VIEWS; ++i)
view_btns[i] = new View_Button(*this, i);
- mapview.fieldclicked.set(&parent, &Interactive_GameBase::node_action);
- mapview.changeview.set(this, &WatchWindow::stop_tracking_by_drag);
- warp_mainview.set(&parent, &Interactive_Base::move_view_to_point);
+ mapview.fieldclicked.connect(boost::bind(&Interactive_GameBase::node_action, &parent));
+ mapview.changeview.connect(boost::bind(&WatchWindow::stop_tracking_by_drag, this, _1, _2));
+ warp_mainview.connect(boost::bind(&Interactive_Base::move_view_to_point, &parent, _1));
add_view(coords);
next_view(true);
Follow ups