widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #13396
[Merge] lp:~widelands-dev/widelands/bug-1749146-multiline-editbox into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1749146-multiline-editbox into lp:widelands.
Commit message:
Fixed Editor map options panel
- Added handle_mousepress function to MultilineEditbox - this fixes the text input
- Fixed enabling/disabling of OK button in editor map options
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1749146 in widelands: "MultilineEditboxes: Entering text not possible"
https://bugs.launchpad.net/widelands/+bug/1749146
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1749146-multiline-editbox/+merge/345455
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1749146-multiline-editbox into lp:widelands.
=== modified file 'src/editor/ui_menus/main_menu_map_options.cc'
--- src/editor/ui_menus/main_menu_map_options.cc 2018-04-07 16:59:00 +0000
+++ src/editor/ui_menus/main_menu_map_options.cc 2018-05-12 05:41:58 +0000
@@ -156,12 +156,14 @@
name_.changed.connect(boost::bind(&MainMenuMapOptions::changed, this));
author_.changed.connect(boost::bind(&MainMenuMapOptions::changed, this));
descr_->changed.connect(boost::bind(&MainMenuMapOptions::changed, this));
+ hint_->changed.connect(boost::bind(&MainMenuMapOptions::changed, this));
ok_.sigclicked.connect(boost::bind(&MainMenuMapOptions::clicked_ok, boost::ref(*this)));
- ok_.set_enabled(false);
cancel_.sigclicked.connect(boost::bind(&MainMenuMapOptions::clicked_cancel, boost::ref(*this)));
update();
+ ok_.set_enabled(false);
+
name_.focus();
center_to_parent();
move_to_top();
=== modified file 'src/ui_basic/multilineeditbox.cc'
--- src/ui_basic/multilineeditbox.cc 2018-04-07 16:59:00 +0000
+++ src/ui_basic/multilineeditbox.cc 2018-05-12 05:41:58 +0000
@@ -209,6 +209,17 @@
}
/**
+ * The mouse was clicked on this editbox
+*/
+bool MultilineEditbox::handle_mousepress(const uint8_t btn, int32_t, int32_t) {
+ if (btn == SDL_BUTTON_LEFT && get_can_focus()) {
+ focus();
+ return true;
+ }
+ return false;
+}
+
+/**
* This is called by the UI code whenever a key press or release arrives
*/
bool MultilineEditbox::handle_key(bool const down, SDL_Keysym const code) {
=== modified file 'src/ui_basic/multilineeditbox.h'
--- src/ui_basic/multilineeditbox.h 2018-04-07 16:59:00 +0000
+++ src/ui_basic/multilineeditbox.h 2018-05-12 05:41:58 +0000
@@ -56,6 +56,7 @@
protected:
void draw(RenderTarget&) override;
+ bool handle_mousepress(uint8_t btn, int32_t x, int32_t y) override;
bool handle_key(bool down, SDL_Keysym) override;
bool handle_textinput(const std::string& text) override;
Follow ups