widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #01762
[Merge] lp:~widelands-dev/widelands/handle_tab into lp:widelands
Tino has proposed merging lp:~widelands-dev/widelands/handle_tab into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1232392 in widelands: "Allow tabbing in forms"
https://bugs.launchpad.net/widelands/+bug/1232392
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/handle_tab/+merge/209406
1) Do not put a control char on tab press into input boxes
2) Allow tabbing between input fields (e.g. metaserver login)
3) some code style fixes
4) Small fix in CMakelist.txt to avoid redundant appending of linker flag on each generate
--
https://code.launchpad.net/~widelands-dev/widelands/handle_tab/+merge/209406
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/handle_tab into lp:widelands.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2014-01-19 11:47:38 +0000
+++ CMakeLists.txt 2014-03-05 09:28:15 +0000
@@ -309,7 +309,7 @@
endif (DEFINED MSVC)
IF (MINGW)
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--large-address-aware" CACHE STRING "Set by widelands CMakeLists.txt" FORCE)
+ set (CMAKE_EXE_LINKER_FLAGS "-Wl,--large-address-aware" CACHE STRING "Set by widelands CMakeLists.txt" FORCE)
message (STATUS "Enabled large address awareness on mingw32")
endif (MINGW)
=== modified file 'src/logic/playercommand.h'
--- src/logic/playercommand.h 2014-02-22 18:04:02 +0000
+++ src/logic/playercommand.h 2014-03-05 09:28:15 +0000
@@ -132,7 +132,8 @@
};
struct Cmd_BuildRoad:public PlayerCommand {
- Cmd_BuildRoad() : PlayerCommand(), path(nullptr), start(), nsteps(0), steps(nullptr) {} // For savegame loading
+ Cmd_BuildRoad() :
+ PlayerCommand(), path(nullptr), start(), nsteps(0), steps(nullptr) {} // For savegame loading
Cmd_BuildRoad (int32_t, int32_t, Path &);
Cmd_BuildRoad (StreamRead &);
=== modified file 'src/map_io/widelands_map_scripting_data_packet.cc'
--- src/map_io/widelands_map_scripting_data_packet.cc 2014-02-22 14:33:44 +0000
+++ src/map_io/widelands_map_scripting_data_packet.cc 2014-03-05 09:28:15 +0000
@@ -31,7 +31,7 @@
namespace Widelands {
namespace {
-const int SCRIPTING_DATA_PACKET_VERSION=1;
+const int SCRIPTING_DATA_PACKET_VERSION = 1;
} // namespace
/*
* ========================================================================
@@ -53,9 +53,10 @@
// wise this makes no sense.
upcast(Game, g, &egbase);
Widelands::FileRead fr;
- if (g and fr.TryOpen(fs, "scripting/globals.dump")) {
- const uint32_t sentinel = fr.Unsigned32();
- const uint32_t packet_version = fr.Unsigned32();
+ if (g and fr.TryOpen(fs, "scripting/globals.dump"))
+ {
+ const uint32_t sentinel = fr.Unsigned32();
+ const uint32_t packet_version = fr.Unsigned32();
if (sentinel != 0xDEADBEEF && packet_version != SCRIPTING_DATA_PACKET_VERSION) {
throw game_data_error(
"This savegame is from an older version of Widelands and can not be loaded any more.");
=== modified file 'src/network/netclient.h'
--- src/network/netclient.h 2014-02-22 18:04:02 +0000
+++ src/network/netclient.h 2014-03-05 09:28:15 +0000
@@ -79,9 +79,11 @@
uint32_t maxplayers,
bool savegame = false) override;
virtual void setPlayerState (uint8_t number, PlayerSettings::State state) override;
- virtual void setPlayerAI (uint8_t number, const std::string & ai, bool const random_ai = false) override;
+ virtual void setPlayerAI
+ (uint8_t number, const std::string & ai, bool const random_ai = false) override;
virtual void nextPlayerState (uint8_t number) override;
- virtual void setPlayerTribe (uint8_t number, const std::string & tribe, bool const random_tribe = false) override;
+ virtual void setPlayerTribe
+ (uint8_t number, const std::string & tribe, bool const random_tribe = false) override;
virtual void setPlayerInit (uint8_t number, uint8_t index) override;
virtual void setPlayerName (uint8_t number, const std::string & name) override;
virtual void setPlayer (uint8_t number, PlayerSettings ps) override;
=== modified file 'src/network/nethost.cc'
--- src/network/nethost.cc 2014-02-22 18:04:02 +0000
+++ src/network/nethost.cc 2014-03-05 09:28:15 +0000
@@ -211,7 +211,8 @@
h->setPlayerState(number, newstate, true);
}
- virtual void setPlayerTribe(uint8_t const number, const std::string & tribe, bool const random_tribe) override
+ virtual void setPlayerTribe
+ (uint8_t const number, const std::string & tribe, bool const random_tribe) override
{
if (number >= h->settings().players.size())
return;
=== modified file 'src/ui_basic/editbox.cc'
--- src/ui_basic/editbox.cc 2013-07-26 20:19:36 +0000
+++ src/ui_basic/editbox.cc 2014-03-05 09:28:15 +0000
@@ -226,9 +226,12 @@
switch (code.sym) {
case SDLK_ESCAPE:
cancel();
- return true;
+ return true;
+
+ case SDLK_TAB:
+ //let the panel handle the tab key
+ return false;
- case SDLK_KP_ENTER:
case SDLK_RETURN:
// Save history if active and text is not empty
if (m_history_active) {
@@ -394,7 +397,7 @@
}
}
- return Panel::handle_key(down, code);
+ return false;
}
/**
=== modified file 'src/ui_basic/panel.cc'
--- src/ui_basic/panel.cc 2014-02-25 19:45:27 +0000
+++ src/ui_basic/panel.cc 2014-03-05 09:28:15 +0000
@@ -679,8 +679,34 @@
*
* \return true if the event was processed, false otherwise
*/
-bool Panel::handle_key(bool, SDL_keysym)
+bool Panel::handle_key(bool down, SDL_keysym code)
{
+ if (down) {
+ if (_focus) {
+ Panel * p = _focus->_next;
+ switch (code.sym) {
+
+ case SDLK_TAB:
+ while (p != _focus) {
+ if (p->get_can_focus()) {
+ p->focus();
+ p->update();
+ break;
+ }
+ if (p == _lchild) {
+ p = _fchild;
+ }
+ else {
+ p = p->_next;
+ }
+ }
+ return true;
+
+ default:
+ return false;
+ }
+ }
+ }
return false;
}
=== modified file 'src/ui_fsmenu/loadgame.h'
--- src/ui_fsmenu/loadgame.h 2014-02-22 18:04:02 +0000
+++ src/ui_fsmenu/loadgame.h 2014-03-05 09:28:15 +0000
@@ -46,7 +46,8 @@
/// Select a Saved Game in Fullscreen Mode. It's a modal fullscreen menu.
struct Fullscreen_Menu_LoadGame : public Fullscreen_Menu_Base {
- Fullscreen_Menu_LoadGame(Widelands::Game &, GameSettingsProvider * gsp = nullptr, GameController * gc = nullptr);
+ Fullscreen_Menu_LoadGame
+ (Widelands::Game &, GameSettingsProvider * gsp = nullptr, GameController * gc = nullptr);
const std::string & filename() {return m_filename;}
=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc 2014-02-22 18:04:02 +0000
+++ src/wlapplication.cc 2014-03-05 09:28:15 +0000
@@ -1899,7 +1899,8 @@
s.players[number].state = PlayerSettings::stateComputer;
}
- virtual void setPlayerTribe(uint8_t const number, const std::string & tribe, bool const random_tribe) override
+ virtual void setPlayerTribe
+ (uint8_t const number, const std::string & tribe, bool const random_tribe) override
{
if (number >= s.players.size())
return;
@@ -1979,7 +1980,10 @@
virtual std::string getWinCondition() override {return s.win_condition;}
virtual void setWinCondition(std::string wc) override {s.win_condition = wc;}
- virtual void nextWinCondition() override {assert(false);} // not implemented - feel free to do so, if you need it.
+ virtual void nextWinCondition() override // not implemented - feel free to do so, if you need it
+ {
+ assert(false);
+ }
private:
GameSettings s;
Follow ups