Review: Approve Seems like this are fairly small fixes. In general (i.e. if you make bigger fixes), menus should use UI::Box for layouting as much as possible instead of absolute positioning.
I skimmed this only, but I find the formatting in some places to be weird. I think we should finally decide to format everything with clang_format and just have everything be consistent (at least in c++) by running it over the whole codebase. Otherwise just a couple of nits. Diff comments: > === removed file 'pics/singleplmenu.jpg' > Binary files pics/singleplmenu.jpg 2010-01-01 19:01:00 +0000 and > pics/singleplmenu.jpg 1970-01-01 00:00:00 +0000 differ > === renamed file 'pics/launchgamemenu.jpg' => 'pics/ui_fsmenu.jpg' > === modified file 'src/editor/ui_menus/editor_main_menu_load_map.cc' > --- src/editor/ui_menus/editor_main_menu_load_map.cc 2014-09-23 09:26:48 > +0000 > +++ src/editor/ui_menus/editor_main_menu_load_map.cc 2014-09-27 13:09:21 > +0000 > @@ -49,14 +49,14 @@ > * Create all the buttons etc... > */ > MainMenuLoadMap::MainMenuLoadMap(EditorInteractive & parent) > - : UI::Window(&parent, "load_map_menu", 0, 0, 550, 300, _("Load Map")) > + : UI::Window(&parent, "load_map_menu", 0, 0, 560, 300, _("Load Map")) > { > int32_t const spacing = 5; > int32_t const offsx = spacing; > int32_t const offsy = 10; > int32_t posx = offsx; > int32_t posy = offsy; > - int32_t const descr_label_w = 90; > + int32_t const descr_label_w = 100; > > m_ls = new UI::Listselect<const char *> > (this, > @@ -69,9 +69,9 @@ > new UI::Textarea > (this, posx, posy, descr_label_w, 20, _("Name:"), > UI::Align_CenterLeft); > m_name = > - new UI::Textarea > - (this, posx + descr_label_w, posy, 200, 20, "---", > UI::Align_CenterLeft); > - posy += 20 + spacing; > + new UI::MultilineTextarea > + (this, posx + descr_label_w, posy, 200, 40, "---", > UI::Align_CenterLeft); > + posy += 40 + spacing; > > new UI::Textarea > (this, posx, posy, 150, 20, _("Author:"), UI::Align_CenterLeft); > @@ -166,7 +166,8 @@ > > // Translate the map data > i18n::Textdomain td("maps"); > - m_name ->set_text(_(map.get_name())); > + m_name ->set_text(map.get_name()); > + m_name ->set_tooltip(map.get_name()); > m_author->set_text(map.get_author()); > m_descr ->set_text > (_(map.get_description()) + (map.get_hint().empty() ? > "" : (std::string("\n") + _(map.get_hint())))); > @@ -179,6 +180,7 @@ > m_size ->set_text(buf); > } else { > m_name ->set_text(""); > + m_name ->set_tooltip(""); clang_format? > m_author ->set_text(""); > m_descr ->set_text(""); > m_nrplayers->set_text(""); > @@ -246,7 +248,7 @@ > try { > map_loader->preload_map(true); > m_ls->add > - (FileSystem::FS_Filename(name), > + > (FileSystem::FS_FilenameWoExt(name).c_str(), > name, > g_gr->images().get > > (dynamic_cast<WidelandsMapLoader*>(map_loader.get()) > > === modified file 'src/editor/ui_menus/editor_main_menu_load_map.h' > --- src/editor/ui_menus/editor_main_menu_load_map.h 2014-09-14 11:31:58 > +0000 > +++ src/editor/ui_menus/editor_main_menu_load_map.h 2014-09-27 13:09:21 > +0000 > @@ -44,7 +44,8 @@ > > void fill_list(); > > - UI::Textarea * m_name, * m_author, * m_size, * m_nrplayers; > + UI::MultilineTextarea * m_name; > + UI::Textarea * m_author, * m_size, * m_nrplayers; > UI::MultilineTextarea * m_descr; > UI::Listselect<const char *> * m_ls; > UI::Button * m_ok_btn; > > === modified file 'src/editor/ui_menus/editor_main_menu_map_options.cc' > --- src/editor/ui_menus/editor_main_menu_map_options.cc 2014-09-10 > 14:48:40 +0000 > +++ src/editor/ui_menus/editor_main_menu_map_options.cc 2014-09-27 > 13:09:21 +0000 > @@ -44,7 +44,7 @@ > : > UI::Window > (&parent, "map_options", > - 250, (parent.get_h() - 300) / 2, 200, 305, > + 250, (parent.get_h() - 300) / 2, 305, 305, > _("Map Options")) > { > > > === modified file 'src/editor/ui_menus/editor_main_menu_random_map.cc' > --- src/editor/ui_menus/editor_main_menu_random_map.cc 2014-09-14 > 12:13:35 +0000 > +++ src/editor/ui_menus/editor_main_menu_random_map.cc 2014-09-27 > 13:09:21 +0000 > @@ -46,7 +46,7 @@ > "random_map_menu", > (parent.get_w() - 260) / 2, > (parent.get_h() - 450) / 2, > - 260, > + 305, clang_format? > 490, > _("New Random Map")), > // TRANSLATORS: The next are world names for the random map generator. > > === modified file 'src/editor/ui_menus/editor_main_menu_save_map.cc' > --- src/editor/ui_menus/editor_main_menu_save_map.cc 2014-09-23 09:26:48 > +0000 > +++ src/editor/ui_menus/editor_main_menu_save_map.cc 2014-09-27 13:09:21 > +0000 > @@ -51,14 +51,14 @@ > > > MainMenuSaveMap::MainMenuSaveMap(EditorInteractive & parent) > - : UI::Window(&parent, "save_map_menu", 0, 0, 550, 330, _("Save Map")) > + : UI::Window(&parent, "save_map_menu", 0, 0, 560, 330, _("Save Map")) > { > int32_t const spacing = 5; > int32_t const offsx = spacing; > int32_t const offsy = 10; > int32_t posx = offsx; > int32_t posy = offsy; > - int32_t const descr_label_w = 90; > + int32_t const descr_label_w = 100; > > m_ls = > new UI::Listselect<const char *> > @@ -72,7 +72,8 @@ > (this, > posx, posy + get_inner_h() - spacing - offsy - 60 + 3, > get_inner_w() / 2 - spacing, 20, > - g_gr->images().get("pics/but1.png")); > + g_gr->images().get("pics/but1.png"), > + UI::Align::Align_Left); > m_editbox->setText(parent.egbase().map().get_name()); > > m_editbox->changed.connect(boost::bind(&MainMenuSaveMap::edit_box_changed, > this)); > > @@ -80,9 +81,9 @@ > new UI::Textarea > (this, posx, posy, descr_label_w, 20, _("Name:"), > UI::Align_CenterLeft); > m_name = > - new UI::Textarea > - (this, posx + descr_label_w, posy, 200, 20, "---", > UI::Align_CenterLeft); > - posy += 20 + spacing; > + new UI::MultilineTextarea > + (this, posx + descr_label_w, posy, 200, 40, "---", > UI::Align_CenterLeft); > + posy += 40 + spacing; > > new UI::Textarea > (this, posx, posy, descr_label_w, 20, _("Author:"), > UI::Align_CenterLeft); > @@ -229,6 +230,7 @@ > m_editbox->setText(FileSystem::FS_Filename(name)); > > m_name ->set_text(map.get_name ()); > + m_name ->set_tooltip(map.get_name ()); > m_author->set_text(map.get_author ()); > m_descr ->set_text(map.get_description()); > > @@ -240,17 +242,18 @@ > m_size->set_text(buf); > } else { > m_name ->set_text(FileSystem::FS_Filename(name)); > + m_name ->set_tooltip(""); > m_author ->set_text(""); > m_nrplayers->set_text(""); > m_size ->set_text(""); > if (g_fs->IsDirectory(name)) { > - std::string dir_string = > - (boost::format("\\<%s\\>") % > _("directory")).str(); > - m_descr ->set_text(dir_string); > + m_name->set_tooltip((boost::format(_("Directory: %s")) > + > % FileSystem::FS_Filename(name)).str()); > + m_descr->set_text((boost::format("\\<%s\\>") % > _("directory")).str()); > } else { > - std::string not_map_string = > - (boost::format("\\<%s\\>") % _("Not a map > file")).str(); > - m_descr ->set_text(not_map_string); > + std::string not_map_string = _("Not a map file"); const > + m_name->set_tooltip(not_map_string); > + m_descr->set_text((boost::format("\\<%s\\>") % > not_map_string).str()); > } > > } > @@ -329,7 +332,7 @@ > try { > wml->preload_map(true); > m_ls->add > - (FileSystem::FS_Filename(name), > + > (FileSystem::FS_FilenameWoExt(name).c_str(), > name, > > g_gr->images().get("pics/ls_wlmap.png")); > } catch (const WException &) {} // we simply skip > illegal entries > > === modified file 'src/editor/ui_menus/editor_main_menu_save_map.h' > --- src/editor/ui_menus/editor_main_menu_save_map.h 2014-09-14 11:31:58 > +0000 > +++ src/editor/ui_menus/editor_main_menu_save_map.h 2014-09-27 13:09:21 > +0000 > @@ -50,7 +50,8 @@ > bool save_map(std::string, bool); > > UI::EditBox * m_editbox; > - UI::Textarea * m_name, * m_author, * m_size, * m_nrplayers; > + UI::MultilineTextarea * m_name; > + UI::Textarea * m_author, * m_size, * m_nrplayers; > UI::MultilineTextarea * m_descr; > UI::Listselect<const char *> * m_ls; > UI::Button * m_ok_btn; > > === modified file 'src/ui_basic/spinbox.cc' > --- src/ui_basic/spinbox.cc 2014-07-25 19:15:23 +0000 > +++ src/ui_basic/spinbox.cc 2014-09-27 13:09:21 +0000 > @@ -21,6 +21,8 @@ > > #include <vector> > > +#include <boost/format.hpp> > + > #include "base/deprecated.h" > #include "base/i18n.h" > #include "base/wexception.h" > @@ -98,20 +100,38 @@ > throw wexception("Not enough space to draw spinbox"); > int32_t butw = h; > int32_t textw = w - butw * 32 / 5; > + > + int32_t but_plus_x; > + int32_t but_minus_x; > + int32_t text_x; > + > + if (m_big) { > + but_plus_x = w - butw * 31 / 10; > + but_minus_x = butw * 21 / 10; > + > + } else { > + but_plus_x = w - butw; > + but_minus_x = 0; > + textw = textw + 4 * butw; > + } > while (textw <= 0) { > butw = butw * 3 / 4; > textw = w - butw * 32 / 5; > } > + text_x = (w - textw) / 2; > > - char buf[64]; > - snprintf(buf, sizeof(buf), "%i %s", sbi->value, sbi->unit.c_str()); > + std::string unit_text = std::to_string(sbi->value); const > + if (! sbi->unit.empty()) { > + /** TRANSLATORS: %i = number, %s = unit, e.g. "5 pixels" in the > advanced options */ > + unit_text = (boost::format(_("%i %s")) % sbi->value % > sbi->unit.c_str()).str(); > + } > > sbi->text = new UI::Textarea > - (this, butw * 16 / 5, 0, textw, h, buf, Align_Center); > + (this, text_x, 0, textw, h, unit_text, Align_Center); > sbi->butPlus = > new Button > (this, "+", > - w - butw * 31 / 10, 0, butw, butw, > + but_plus_x, 0, butw, butw, > sbi->background, > "+", _("Increase the value"), > true, false); > @@ -119,7 +139,7 @@ > sbi->butMinus = > new Button > (this, "-", > - butw * 21 / 10, 0, butw, butw, > + but_minus_x, 0, butw, butw, > sbi->background, > "-", _("Decrease the value"), > true, false); > @@ -145,8 +165,13 @@ > > sbi->butTenMinus->sigclicked.connect(boost::bind(&SpinBox::changeValue, > boost::ref(*this), -10)); > sbi->butTenPlus->set_repeating(true); > sbi->butTenMinus->set_repeating(true); > + m_buttons.push_back(sbi->butTenMinus); > + m_buttons.push_back(sbi->butTenPlus); > } > > + m_buttons.push_back(sbi->butMinus); > + m_buttons.push_back(sbi->butPlus); > + > set_font(UI_FONT_NAME, UI_FONT_SIZE_SMALL, UI_FONT_CLR_FG); > } > > > === modified file 'src/ui_basic/spinbox.h' > --- src/ui_basic/spinbox.h 2014-07-05 16:41:51 +0000 > +++ src/ui_basic/spinbox.h 2014-09-27 13:09:21 +0000 > @@ -21,6 +21,7 @@ > #define WL_UI_BASIC_SPINBOX_H > > #include <cstring> > +#include <list> > > #include "graphic/align.h" > #include "ui_basic/button.h" > @@ -57,6 +58,7 @@ > void add_replacement(int32_t, std::string); > void remove_replacement(int32_t); > bool has_replacement(int32_t); > + std::vector<UI::Button*> get_buttons() {return m_buttons;} return const ref instead of copying. > > private: > void update(); > @@ -66,6 +68,8 @@ > const bool m_big; > > SpinBoxImpl * sbi; > + > + std::vector<UI::Button*> m_buttons; > }; > > } > > === modified file 'src/ui_fsmenu/editor.cc' > --- src/ui_fsmenu/editor.cc 2014-09-10 14:08:25 +0000 > +++ src/ui_fsmenu/editor.cc 2014-09-27 13:09:21 +0000 > @@ -24,7 +24,7 @@ > #include "wui/text_constants.h" > > FullscreenMenuEditor::FullscreenMenuEditor() : > - FullscreenMenuBase("singleplmenu.jpg"), why did you change the backgrounds? And are some of the graphics now unused maybe? > + FullscreenMenuBase("ui_fsmenu.jpg"), > > // Values for alignment and size > m_butw (get_w() * 7 / 20), > > === modified file 'src/ui_fsmenu/launch_spg.cc' > --- src/ui_fsmenu/launch_spg.cc 2014-09-14 16:08:13 +0000 > +++ src/ui_fsmenu/launch_spg.cc 2014-09-27 13:09:21 +0000 > @@ -48,7 +48,7 @@ > (GameSettingsProvider * const settings, GameController * const ctrl, > bool /* autolaunch */) > : > - FullscreenMenuBase("launchgamemenu.jpg"), > + FullscreenMenuBase("ui_fsmenu.jpg"), > > // Values for alignment and size > m_butw (get_w() / 4), > > === modified file 'src/ui_fsmenu/multiplayer.cc' > --- src/ui_fsmenu/multiplayer.cc 2014-09-10 14:08:25 +0000 > +++ src/ui_fsmenu/multiplayer.cc 2014-09-27 13:09:21 +0000 > @@ -25,7 +25,7 @@ > #include "wui/text_constants.h" > > FullscreenMenuMultiPlayer::FullscreenMenuMultiPlayer() : > - FullscreenMenuBase("singleplmenu.jpg"), > + FullscreenMenuBase("ui_fsmenu.jpg"), > > // Values for alignment and size > m_butw (get_w() * 7 / 20), > > === modified file 'src/ui_fsmenu/netsetup_lan.cc' > --- src/ui_fsmenu/netsetup_lan.cc 2014-09-10 14:48:40 +0000 > +++ src/ui_fsmenu/netsetup_lan.cc 2014-09-27 13:09:21 +0000 > @@ -28,7 +28,7 @@ > #include "wui/text_constants.h" > > FullscreenMenuNetSetupLAN::FullscreenMenuNetSetupLAN () : > - FullscreenMenuBase("singleplmenu.jpg"), // TODO(unknown): change this > + FullscreenMenuBase("ui_fsmenu.jpg"), // TODO(unknown): change this > > // Values for alignment and size > m_butx (get_w() * 13 / 40), > > === modified file 'src/ui_fsmenu/options.cc' > --- src/ui_fsmenu/options.cc 2014-09-14 11:31:58 +0000 > +++ src/ui_fsmenu/options.cc 2014-09-27 13:09:21 +0000 > @@ -23,6 +23,7 @@ > #include <iostream> > > #include <boost/algorithm/string/predicate.hpp> > +#include <boost/format.hpp> > > #include "base/i18n.h" > #include "graphic/default_resolution.h" > @@ -90,9 +91,14 @@ > FullscreenMenuBase("optionsmenu.jpg"), > > // Values for alignment and size > - m_vbutw(get_h() * 333 / 10000), > - m_butw (get_w() / 4), > - m_buth (get_h() * 9 / 200), > + m_vbutw (get_h() * 333 / 10000), > + m_butw (get_w() / 4), > + m_buth (get_h() * 9 / 200), > + m_hmargin (get_w() * 19 / 200), > + m_padding (10), > + m_space (25), > + m_offset_first_group (get_h() * 1417 / 10000), > + m_offset_second_group(get_h() * 5833 / 10000), > > // Buttons > m_advanced_options > @@ -111,129 +117,182 @@ > g_gr->images().get("pics/but2.png"), > _("Apply"), std::string(), true, false), > > -// Spinboxes > - m_sb_maxfps > - (this, > - (get_w() / 2) - (m_vbutw * 2), get_h() * 3833 / 10000, get_w() > / 5, m_vbutw, > - opt.maxfps, 0, 100, "", > - g_gr->images().get("pics/but1.png")), > - m_sb_autosave > - (this, > - get_w() * 6767 / 10000, get_h() * 8167 / 10000, get_w() / 4, > m_vbutw, > - opt.autosave / 60, 0, 100, _("min."), > - g_gr->images().get("pics/but1.png"), true), > - > - m_sb_remove_replays > - (this, > - get_w() * 6767 / 10000, get_h() * 8631 / 10000, get_w() / 4, > m_vbutw, > - /** TRANSLATORS: Options: Remove Replays older than: */ > - /** TRANSLATORS: This will have a number added in front of it > */ > - opt.remove_replays, 0, 365, ngettext("day", "days", m_vbutw), > - g_gr->images().get("pics/but1.png"), true), > - > -// Title > - m_title > - (this, > - get_w() / 2, get_h() / 40, > - _("General Options"), UI::Align_HCenter), > - > -// First options block 'general options' > - m_fullscreen (this, Point(get_w() * 3563 / 10000, get_h() * 1667 / > 10000)), > + // Title > + m_title > + (this, > + get_w() / 2, get_h() / 40, > + _("General Options"), UI::Align_HCenter), > + > + // First options block 'general options', first column > + m_label_resolution > + (this, > + m_hmargin, m_offset_first_group, > + _("In-game resolution"), UI::Align_VCenter), > + m_reslist > + (this, > + m_hmargin, m_label_resolution.get_y() + > m_label_resolution.get_h(), > + (get_w() - 2 * m_hmargin - m_space) / 2, 95, > + UI::Align_Left, true), > + > + m_fullscreen (this, Point(m_hmargin, > + > m_reslist.get_y() + clang_format? > + > m_reslist.get_h() + m_padding)), > m_label_fullscreen > (this, > - get_w() * 1969 / 5000, get_h() * 1833 / 10000, > + m_hmargin + m_fullscreen.get_w() + m_padding, > + m_reslist.get_y() + m_reslist.get_h() + m_padding, > + m_reslist.get_w() - m_fullscreen.get_w() - m_padding, > + m_fullscreen.get_h(), > _("Fullscreen"), UI::Align_VCenter), > > - m_inputgrab (this, Point(get_w() * 3563 / 10000, get_h() * 2167 / > 10000)), > + m_inputgrab (this, Point(m_hmargin, > + > m_label_fullscreen.get_y() + > + > m_label_fullscreen.get_h() + m_padding)), > m_label_inputgrab > (this, > - get_w() * 1969 / 5000, get_h() * 2333 / 10000, > + m_hmargin + m_inputgrab.get_w() + m_padding, > + m_label_fullscreen.get_y() + m_label_fullscreen.get_h() + > m_padding, > + m_reslist.get_w() - m_inputgrab.get_w() - m_padding, > + m_inputgrab.get_h(), > _("Grab Input"), UI::Align_VCenter), > > - m_music (this, Point(get_w() * 3563 / 10000, get_h() * 2667 / 10000)), > - m_label_music > - (this, > - get_w() * 1969 / 5000, get_h() * 2833 / 10000, > - _("Enable Music"), UI::Align_VCenter), > - > - m_fx (this, Point(get_w() * 3563 / 10000, get_h() * 3167 / 10000)), > - m_label_fx > - (this, > - get_w() * 1969 / 5000, get_h() * 3333 / 10000, > - _("Enable Sound"), UI::Align_VCenter), > - > m_label_maxfps > (this, > - get_w() * 3563 / 10000, get_h() * 2 / 5, > + m_hmargin, > + m_label_inputgrab.get_y() + m_label_inputgrab.get_h() + > m_padding, > + m_reslist.get_w() - 80, m_inputgrab.get_h(), > _("Maximum FPS:"), UI::Align_VCenter), > - > - m_reslist > - (this, > - get_w() / 10, get_h() * 1667 / 10000, > - get_w() * 19 / 80, get_h() * 2833 / 10000, > - UI::Align_Left, true), > - m_label_resolution > - (this, > - get_w() * 1063 / 10000, get_h() * 1417 / 10000, > - _("In-game resolution"), UI::Align_VCenter), > - > + m_sb_maxfps > + (this, > + m_hmargin + m_reslist.get_w() - 80, m_label_maxfps.get_y(), > + 80, m_vbutw, > + opt.maxfps, 0, 99, "", > + g_gr->images().get("pics/but1.png")), > + > + > + // First options block 'general options', second column > m_label_language > (this, > - get_w() * 133 / 200, get_h() * 1417 / 10000, > + get_w() - m_hmargin - (get_w() - 2 * m_hmargin - m_space) / 2, > m_offset_first_group, > _("Language"), UI::Align_VCenter), > + // same height as m_reslist > m_language_list > (this, > - get_w() * 6563 / 10000, get_h() * 1667 / 10000, > - get_w() * 21 / 80, get_h() * 2833 / 10000, > + m_label_language.get_x(), m_label_language.get_y() + > m_label_language.get_h(), > + (get_w() - 2 * m_hmargin - m_space) / 2, m_reslist.get_h(), > UI::Align_Left, true), > > -// Title 2 > + m_music (this, Point(m_label_language.get_x(), > + > m_language_list.get_y() + > + > m_language_list.get_h() + m_padding)), > + m_label_music > + (this, > + m_label_language.get_x() + m_music.get_w() + m_padding, > + m_language_list.get_y() + m_language_list.get_h() + m_padding, > + m_language_list.get_w(), m_music.get_h(), > + _("Enable Music"), UI::Align_VCenter), > + > + m_fx (this, Point(m_label_language.get_x(), > + m_label_music.get_y() + > + m_label_music.get_h() + > m_padding)), > + m_label_fx > + (this, > + m_label_language.get_x() + m_fx.get_w() + m_padding, > + m_label_music.get_y() + m_label_music.get_h() + m_padding, > + m_language_list.get_w(), m_fx.get_h(), > + _("Enable Sound"), UI::Align_VCenter), > + > + // Second options block 'In-game options' > + // Title 2 > m_label_game_options > (this, > get_w() / 2, get_h() / 2, > _("In-game Options"), UI::Align_HCenter), > > -// Second options block 'In-game options' > - m_single_watchwin (this, Point(get_w() * 19 / 200, get_h() * 5833 / > 10000)), > + m_single_watchwin (this, Point(m_hmargin, m_offset_second_group)), > m_label_single_watchwin > (this, > - get_w() * 1313 / 10000, get_h() * 3 / 5, > - _("Use single Watchwindow Mode"), UI::Align_VCenter), > + m_single_watchwin.get_x() + m_single_watchwin.get_w() + > m_padding, > + m_offset_second_group, > + get_w() - 2 * m_hmargin - m_single_watchwin.get_w(), > m_single_watchwin.get_h(), > + _("Use single watchwindow mode"), UI::Align_VCenter), > > - m_auto_roadbuild_mode (this, Point(get_w() * 19 / 200, get_h() * 63 / > 100)), > + m_auto_roadbuild_mode (this, Point(m_single_watchwin.get_x(), > + > m_label_single_watchwin.get_y() + > + > m_label_single_watchwin.get_h() + m_padding)), > m_label_auto_roadbuild_mode > (this, > - get_w() * 1313 / 10000, get_h() * 6467 / 10000, > + m_auto_roadbuild_mode.get_x() + m_auto_roadbuild_mode.get_w() > + m_padding, > + m_label_single_watchwin.get_y() + > m_label_single_watchwin.get_h() + m_padding, > + get_w() - 2 * m_hmargin - m_auto_roadbuild_mode.get_w(), > m_auto_roadbuild_mode.get_h(), > _("Start building road after placing a flag"), > UI::Align_VCenter), > > m_show_workarea_preview > - (this, Point(get_w() * 19 / 200, get_h() * 6767 / 10000)), > + (this, Point(m_auto_roadbuild_mode.get_x(), > + > m_label_auto_roadbuild_mode.get_y() + > + > m_label_auto_roadbuild_mode.get_h() + m_padding)), > m_label_show_workarea_preview > (this, > - get_w() * 1313 / 10000, get_h() * 6933 / 10000, > + m_show_workarea_preview.get_x() + > m_show_workarea_preview.get_w() + m_padding, > + m_label_auto_roadbuild_mode.get_y() + > m_label_auto_roadbuild_mode.get_h() + m_padding, > + get_w() - 2 * m_hmargin - m_show_workarea_preview.get_w(), > m_show_workarea_preview.get_h(), > _("Show buildings area preview"), UI::Align_VCenter), > > - m_snap_windows_only_when_overlapping > - (this, Point(get_w() * 19 / 200, get_h() * 7233 / 10000)), > - m_label_snap_windows_only_when_overlapping > + m_snap_win_overlap_only > + (this, Point(m_show_workarea_preview.get_x(), > + > m_label_show_workarea_preview.get_y() + > + > m_label_show_workarea_preview.get_h() + m_padding)), > + m_label_snap_win_overlap_only > (this, > - get_w() * 1313 / 10000, get_h() * 37 / 50, > + m_snap_win_overlap_only.get_x() + > m_snap_win_overlap_only.get_w() + m_padding, > + m_label_show_workarea_preview.get_y() + > m_label_show_workarea_preview.get_h() + m_padding, > + get_w() - 2 * m_hmargin - m_snap_win_overlap_only.get_w(), > m_snap_win_overlap_only.get_h(), > _("Snap windows only when overlapping"), UI::Align_VCenter), > > - m_dock_windows_to_edges (this, Point(get_w() * 19 / 200, get_h() * 77 / > 100)), > + m_dock_windows_to_edges (this, Point(m_snap_win_overlap_only.get_x(), > + > m_label_snap_win_overlap_only.get_y() + > + > m_label_snap_win_overlap_only.get_h() + m_padding)), > m_label_dock_windows_to_edges > (this, > - get_w() * 1313 / 10000, get_h() * 7867 / 10000, > + m_dock_windows_to_edges.get_x() + > m_dock_windows_to_edges.get_w() + m_padding, > + m_label_snap_win_overlap_only.get_y() + > m_label_snap_win_overlap_only.get_h() + m_padding, > + get_w() - 2 * m_hmargin - m_dock_windows_to_edges.get_w(), > m_dock_windows_to_edges.get_h(), > _("Dock windows to edges"), UI::Align_VCenter), > > + m_sb_autosave > + (this, > + get_w() - m_hmargin - 240, > + m_dock_windows_to_edges.get_y() + > m_dock_windows_to_edges.get_h() + m_padding, > + 240, m_vbutw, > + /** TRANSLATORS: Options: Save game automatically every: */ > + /** TRANSLATORS: This will have a number added in front of it > */ > + opt.autosave / 60, 0, 100, ngettext("minute", "minutes", > opt.autosave / 60), > + g_gr->images().get("pics/but1.png"), true), > m_label_autosave > (this, > - get_w() * 1313 / 10000, get_h() * 8333 / 10000, > + m_dock_windows_to_edges.get_x(), > + m_sb_autosave.get_y(), > + get_w() - m_sb_autosave.get_w() - 2 * m_hmargin, > + m_dock_windows_to_edges.get_h(), > _("Save game automatically every"), UI::Align_VCenter), > + > + > + m_sb_remove_replays > + (this, > + get_w() - m_hmargin - 240, > + m_sb_autosave.get_y() + m_sb_autosave.get_h() + m_padding, > + 240, m_vbutw, > + /** TRANSLATORS: Options: Remove Replays older than: */ > + /** TRANSLATORS: This will have a number added in front of it > */ > + opt.remove_replays, 0, 365, ngettext("day", "days", > opt.remove_replays), > + g_gr->images().get("pics/but1.png"), true), > m_label_remove_replays > (this, > - get_w() * 1313 / 10000, get_h() * 8799 / 10000, > - _("Remove Replays older than:"), UI::Align_VCenter), > + m_label_autosave.get_x(), > + m_sb_remove_replays.get_y(), > + get_w() - m_sb_remove_replays.get_w() - 2 * m_hmargin, > + m_dock_windows_to_edges.get_h(), > + _("Remove replays older than:"), UI::Align_VCenter), > > os(opt) > { > @@ -244,51 +303,39 @@ > m_apply.sigclicked.connect > (boost::bind(&FullscreenMenuOptions::end_modal, this, > static_cast<int32_t>(om_ok))); > > - m_advanced_options.set_font(font_small()); > - m_apply.set_font(font_small()); > - m_cancel.set_font(font_small()); > - > - /** TRANSLATORS Options: Remove Replays older than: */ > + /** TRANSLATORS Options: Save game automatically every: */ > m_sb_autosave .add_replacement(0, _("Off")); > + std::vector<UI::Button*> temp_buttons = m_sb_autosave.get_buttons(); > + for (UI::Button* temp_button : temp_buttons) { > + temp_button->sigclicked.connect > + (boost::bind > + > (&FullscreenMenuOptions::update_sb_autosave_unit, > + boost::ref(*this))); > + } > /** TRANSLATORS Options: Remove Replays older than: */ > m_sb_remove_replays.add_replacement(0, _("Never")); > - /** TRANSLATORS Options: Remove Replays older than: */ > - m_sb_remove_replays.add_replacement(1, _("1 day")); > + temp_buttons = m_sb_remove_replays.get_buttons(); > + for (UI::Button* temp_button : temp_buttons) { > + temp_button->sigclicked.connect > + (boost::bind > + > (&FullscreenMenuOptions::update_sb_remove_replays_unit, > + boost::ref(*this))); > + } > > - m_sb_maxfps .set_font(ui_fn(), fs_small(), UI_FONT_CLR_FG); > - m_sb_autosave .set_font(ui_fn(), fs_small(), UI_FONT_CLR_FG); > - m_sb_remove_replays.set_font(ui_fn(), fs_small(), UI_FONT_CLR_FG); > m_title .set_textstyle(ts_big()); > - m_label_fullscreen.set_textstyle(ts_small()); > m_fullscreen .set_state(opt.fullscreen); > - m_label_inputgrab .set_textstyle(ts_small()); > m_inputgrab .set_state(opt.inputgrab); > - m_label_music .set_textstyle(ts_small()); > m_music .set_state(opt.music); > m_music .set_enabled(!g_sound_handler.lock_audio_disabling_); > - m_label_fx .set_textstyle(ts_small()); > m_fx .set_state(opt.fx); > m_fx .set_enabled(!g_sound_handler.lock_audio_disabling_); > - m_label_maxfps .set_textstyle(ts_small()); > - m_label_resolution.set_textstyle(ts_small()); > - m_reslist .set_font(ui_fn(), fs_small()); > - m_label_language .set_textstyle(ts_small()); > - m_language_list .set_font(ui_fn(), fs_small()); > > m_label_game_options .set_textstyle(ts_big()); > - m_label_single_watchwin .set_textstyle(ts_small()); > m_single_watchwin .set_state(opt.single_watchwin); > - m_label_auto_roadbuild_mode .set_textstyle(ts_small()); > m_auto_roadbuild_mode .set_state(opt.auto_roadbuild_mode); > - m_label_show_workarea_preview .set_textstyle(ts_small()); > m_show_workarea_preview .set_state(opt.show_warea); > - m_label_snap_windows_only_when_overlapping.set_textstyle(ts_small()); > - m_snap_windows_only_when_overlapping.set_state > - (opt.snap_windows_only_when_overlapping); > - m_label_dock_windows_to_edges .set_textstyle(ts_small()); > + m_snap_win_overlap_only .set_state(opt.snap_win_overlap_only); > m_dock_windows_to_edges .set_state(opt.dock_windows_to_edges); > - m_label_autosave .set_textstyle(ts_small()); > - m_label_remove_replays .set_textstyle(ts_small()); > > // GRAPHIC_TODO(unknown): this shouldn't be here List all resolutions > // take a copy to not change real video info structure > @@ -315,21 +362,21 @@ > > bool did_select_a_res = false; > for (uint32_t i = 0; i < m_resolutions.size(); ++i) { > - char buf[32]; > - // TODO(sirver): must use boost::format > - /** TRANSLATORS: Screen resolution, e.g. 800 x 600*/ > - sprintf(buf, _("%1$i x %2$i"), m_resolutions[i].xres, > m_resolutions[i].yres); > const bool selected = > m_resolutions[i].xres == opt.xres && > m_resolutions[i].yres == opt.yres; > did_select_a_res |= selected; > - m_reslist.add(buf, nullptr, nullptr, selected); > + /** TRANSLATORS: Screen resolution, e.g. 800 x 600*/ > + m_reslist.add((boost::format(_("%1% x %2%")) > + % m_resolutions[i].xres > + % > m_resolutions[i].yres).str().c_str(), > + nullptr, nullptr, selected); > } > if (!did_select_a_res) { > - char buf[32]; > - /** TRANSLATORS: Screen resolution, e.g. 800 x 600*/ > - sprintf(buf, "%1$i x %2$i", opt.xres, opt.yres); > - m_reslist.add(buf, nullptr, nullptr, true); > + m_reslist.add((boost::format(_("%1% x %2%")) > + % opt.xres > + % > opt.yres).str().c_str(), > + nullptr, nullptr, true); > uint32_t entry = m_resolutions.size(); > m_resolutions.resize(entry + 1); > m_resolutions[entry].xres = opt.xres; > @@ -348,6 +395,14 @@ > add_languages_to_list(&m_language_list, opt.language); > } > > +void FullscreenMenuOptions::update_sb_autosave_unit() { > + m_sb_autosave.setUnit(ngettext("minute", "minutes", > m_sb_autosave.getValue())); > +} > + > +void FullscreenMenuOptions::update_sb_remove_replays_unit() { > + m_sb_remove_replays.setUnit(ngettext("day", "days", > m_sb_remove_replays.getValue())); > +} > + > void FullscreenMenuOptions::advanced_options() { > FullscreenMenuAdvancedOptions aom(os); > if (aom.run() == FullscreenMenuAdvancedOptions::om_ok) { > @@ -386,13 +441,12 @@ > os.single_watchwin = m_single_watchwin.get_state(); > os.auto_roadbuild_mode = m_auto_roadbuild_mode.get_state(); > os.show_warea = m_show_workarea_preview.get_state(); > - os.snap_windows_only_when_overlapping > - = m_snap_windows_only_when_overlapping.get_state(); > + os.snap_win_overlap_only = m_snap_win_overlap_only.get_state(); > os.dock_windows_to_edges = m_dock_windows_to_edges.get_state(); > os.music = m_music.get_state(); > os.fx = m_fx.get_state(); > if (m_language_list.has_selection()) > - os.language = m_language_list.get_selected(); > + os.language = m_language_list.get_selected(); > os.autosave = m_sb_autosave.getValue(); > os.maxfps = m_sb_maxfps.getValue(); > os.remove_replays = m_sb_remove_replays.getValue(); > @@ -407,12 +461,16 @@ > FullscreenMenuAdvancedOptions::FullscreenMenuAdvancedOptions > (OptionsCtrl::OptionsStruct const opt) > : > - FullscreenMenuBase("optionsmenu.jpg"), > + FullscreenMenuBase("ui_fsmenu.jpg"), > > // Values for alignment and size > - m_vbutw (get_h() * 333 / 10000), > - m_butw (get_w() / 4), > - m_buth (get_h() * 9 / 200), > + m_vbutw (get_h() * 333 / 10000), > + m_butw (get_w() / 4), > + m_buth (get_h() * 9 / 200), > + m_hmargin (get_w() * 19 / 200), > + m_padding (10), > + m_space (25), > + m_offset_first_group (get_h() * 1417 / 10000), > > // Buttons > m_cancel > @@ -426,19 +484,6 @@ > g_gr->images().get("pics/but2.png"), > _("Apply"), std::string(), true, false), > > -// Spinboxes > - m_sb_dis_panel > - (this, > - get_w() * 18 / 25, get_h() * 63 / 100, get_w() / 4, m_vbutw, > - opt.panel_snap_distance, 0, 100, _("px."), > - g_gr->images().get("pics/but1.png")), > - m_sb_dis_border > - (this, > - get_w() * 18 / 25, get_h() * 6768 / 10000, get_w() / 4, > m_vbutw, > - opt.border_snap_distance, 0, 100, _("px."), > - g_gr->images().get("pics/but1.png")), > - > - > // Title > m_title > (this, > @@ -446,57 +491,105 @@ > _("Advanced Options"), UI::Align_HCenter), > > // First options block > + m_label_ui_font > + (this, > + m_hmargin, m_offset_first_group, > + _("Main menu font:"), UI::Align_BottomLeft), > m_ui_font_list > (this, > - get_w() / 10, get_h() * 1667 / 10000, > - get_w() / 4, get_h() * 2833 / 10000, > + m_label_ui_font.get_x(), m_label_ui_font.get_y() + > m_label_ui_font.get_h() + m_padding, > + get_w() - 2 * m_hmargin, 134, > UI::Align_Left, true), > - m_label_ui_font > - (this, > - get_w() * 1063 / 10000, get_h() * 1417 / 10000, > - _("Main menu font:"), UI::Align_VCenter), > + > + m_label_snap_dis_panel > + (this, > + m_hmargin, m_ui_font_list.get_y() + m_ui_font_list.get_h() + > m_space + m_padding, > + _("Distance for windows to snap to other panels:"), > UI::Align_VCenter), > + m_label_snap_dis_border > + (this, > + m_hmargin, m_label_snap_dis_panel.get_y() + > m_label_snap_dis_panel.get_h() + 2 * m_padding, > + _("Distance for windows to snap to borders:"), > UI::Align_VCenter), > + > + // Spinboxes > + m_sb_dis_panel > + (this, > + get_w() - m_hmargin - (get_w() / 5), > m_label_snap_dis_panel.get_y(), > + get_w() / 5, m_vbutw, > + opt.panel_snap_distance, 0, 99, ngettext("pixel", > "pixels", opt.panel_snap_distance), > + g_gr->images().get("pics/but1.png")), > + > + m_sb_dis_border > + (this, > + get_w() - m_hmargin - (get_w() / 5), > m_label_snap_dis_border.get_y(), > + get_w() / 5, m_vbutw, > + opt.border_snap_distance, 0, 99, ngettext("pixel", > "pixels", opt.border_snap_distance), > + g_gr->images().get("pics/but1.png")), > + > + m_transparent_chat (this, Point(m_hmargin, > + > m_label_snap_dis_border.get_y() + clang_format? > + > m_label_snap_dis_border.get_h() + m_space)), > + m_label_transparent_chat > + (this, > + m_hmargin + m_transparent_chat.get_w() + m_padding, > m_transparent_chat.get_y(), > + get_w() - 2 * m_hmargin - m_transparent_chat.get_w() - > m_padding, 40, > + _("Show in-game chat with transparent background"), > UI::Align_VCenter), > + > m_message_sound > - (this, Point(get_w() * 29 / 80, get_h() * 171 / 1000)), > + (this, Point(m_hmargin, > + > m_label_transparent_chat.get_y() + > + > m_label_transparent_chat.get_h() + m_padding)), > m_label_message_sound > (this, > - get_w() * 4 / 10, get_h() * 1883 / 10000, > + m_hmargin + m_message_sound.get_w() + m_padding, > m_message_sound.get_y(), > + get_w() - 2 * m_hmargin - m_message_sound.get_w() - m_padding, > 40, > _("Play a sound at message arrival."), > UI::Align_VCenter), > > -// Second options block > - m_nozip (this, Point(get_w() * 19 / 200, get_h() * 5833 / 10000)), > + m_nozip (this, Point(m_hmargin, > + > m_label_message_sound.get_y() + > + > m_label_message_sound.get_h() + m_padding)), > m_label_nozip > (this, > - get_w() * 1313 / 10000, get_h() * 3 / 5, > + m_hmargin + m_nozip.get_w() + m_padding, m_nozip.get_y(), > + get_w() - 2 * m_hmargin - m_nozip.get_w() - m_padding, 40, > _("Do not zip widelands data files (maps, replays and > savegames)."), > UI::Align_VCenter), > - m_label_snap_dis_panel > - (this, > - get_w() * 1313 / 10000, get_h() * 6467 / 10000, > - _("Distance for windows to snap to other panels:"), > UI::Align_VCenter), > - m_label_snap_dis_border > - (this, > - get_w() * 1313 / 10000, get_h() * 6933 / 10000, > - _("Distance for windows to snap to borders:"), > UI::Align_VCenter), > > - m_remove_syncstreams (this, Point(get_w() * 19 / 200, get_h() * 7220 / > 10000)), > + m_remove_syncstreams (this, Point(m_hmargin, > + > m_label_nozip.get_y() + > + > m_label_nozip.get_h() + m_padding)), > m_label_remove_syncstreams > (this, > - get_w() * 1313 / 10000, get_h() * 37 / 50, > + m_hmargin + m_remove_syncstreams.get_w() + m_padding, > m_remove_syncstreams.get_y(), > + get_w() - 2 * m_hmargin - m_remove_syncstreams.get_w() - > m_padding, 40, > _("Remove Syncstream dumps on startup"), UI::Align_VCenter), > > - m_opengl (this, Point(get_w() * 19 / 200, get_h() * 7715 / 10000)), > + m_opengl (this, Point(m_hmargin, > + > m_label_remove_syncstreams.get_y() + > + > m_label_remove_syncstreams.get_h() + m_padding)), > m_label_opengl > (this, > - get_w() * 1313 / 10000, get_h() * 7865 / 10000, > + m_hmargin + m_opengl.get_w() + m_padding, m_opengl.get_y(), > + get_w() - 2 * m_hmargin - m_opengl.get_w() - m_padding, 40, > _("OpenGL rendering"), UI::Align_VCenter), > - m_transparent_chat (this, Point(get_w() * 19 / 200, get_h() * 8180 / > 10000)), > - m_label_transparent_chat > - (this, > - get_w() * 1313 / 10000, get_h() * 8330 / 10000, > - _("Show in-game chat with transparent background"), > UI::Align_VCenter), > os(opt) > { > + std::vector<UI::Button*> temp_buttons = m_sb_dis_panel.get_buttons(); > + for (UI::Button* temp_button : temp_buttons) { > + temp_button->sigclicked.connect > + (boost::bind > + > (&FullscreenMenuAdvancedOptions::update_sb_dis_panel_unit, > + boost::ref(*this))); > + } > + > + temp_buttons = m_sb_dis_border.get_buttons(); > + for (UI::Button* temp_button : temp_buttons) { > + temp_button->sigclicked.connect > + (boost::bind > + > (&FullscreenMenuAdvancedOptions::update_sb_dis_border_unit, > + boost::ref(*this))); > + } > + > m_cancel.sigclicked.connect > (boost::bind > (&FullscreenMenuAdvancedOptions::end_modal, > @@ -508,27 +601,12 @@ > boost::ref(*this), > static_cast<int32_t>(om_ok))); > > - m_cancel.set_font(font_small()); > - m_apply.set_font(font_small()); > - > m_title .set_textstyle(ts_big()); > - m_label_message_sound .set_textstyle(ts_small()); > m_message_sound .set_state(opt.message_sound); > - m_label_nozip .set_textstyle(ts_small()); > m_nozip .set_state(opt.nozip); > - m_label_snap_dis_border.set_textstyle(ts_small()); > - m_label_snap_dis_panel .set_textstyle(ts_small()); > - m_label_remove_syncstreams.set_textstyle(ts_small()); > m_remove_syncstreams .set_state(opt.remove_syncstreams); > - m_label_opengl .set_textstyle(ts_small()); > m_opengl .set_state(opt.opengl); > - m_label_transparent_chat.set_textstyle(ts_small()); > m_transparent_chat .set_state(opt.transparent_chat); > - m_sb_dis_border .set_textstyle(ts_small()); > - m_sb_dis_panel .set_textstyle(ts_small()); > - > - m_label_ui_font.set_textstyle(ts_small()); > - m_ui_font_list .set_font(ui_fn(), fs_small()); > > // Fill the font list. > { // For use of string ui_font take a look at fullscreen_menu_base.cc > @@ -593,6 +671,14 @@ > return FullscreenMenuBase::handle_key(down, code); > } > > +void FullscreenMenuAdvancedOptions::update_sb_dis_panel_unit() { > + m_sb_dis_panel.setUnit(ngettext("pixel", "pixels", > m_sb_dis_panel.getValue())); > +} > + > +void FullscreenMenuAdvancedOptions::update_sb_dis_border_unit() { > + m_sb_dis_border.setUnit(ngettext("pixel", "pixels", > m_sb_dis_border.getValue())); > +} > + > > OptionsCtrl::OptionsStruct FullscreenMenuAdvancedOptions::get_values() { > // Write all remaining data from UI elements > @@ -642,7 +728,7 @@ > opt.single_watchwin = m_opt_section.get_bool("single_watchwin", false); > opt.auto_roadbuild_mode = m_opt_section.get_bool("auto_roadbuild_mode", > true); > opt.show_warea = m_opt_section.get_bool("workareapreview", true); > - opt.snap_windows_only_when_overlapping = > + opt.snap_win_overlap_only = > m_opt_section.get_bool("snap_windows_only_when_overlapping", false); > opt.dock_windows_to_edges = > m_opt_section.get_bool("dock_windows_to_edges", false); > opt.language = m_opt_section.get_string("language", ""); > @@ -674,7 +760,7 @@ > m_opt_section.set_bool("workareapreview", opt.show_warea); > m_opt_section.set_bool > ("snap_windows_only_when_overlapping", > - opt.snap_windows_only_when_overlapping); > + opt.snap_win_overlap_only); > m_opt_section.set_bool("dock_windows_to_edges", > opt.dock_windows_to_edges); > m_opt_section.set_bool("disable_music", !opt.music); > m_opt_section.set_bool("disable_fx", !opt.fx); > > === modified file 'src/ui_fsmenu/options.h' > --- src/ui_fsmenu/options.h 2014-09-10 14:08:25 +0000 > +++ src/ui_fsmenu/options.h 2014-09-27 13:09:21 +0000 > @@ -28,6 +28,7 @@ > #include "ui_basic/button.h" > #include "ui_basic/checkbox.h" > #include "ui_basic/listselect.h" > +#include "ui_basic/multilinetextarea.h" > #include "ui_basic/spinbox.h" > #include "ui_basic/textarea.h" > > @@ -44,7 +45,7 @@ > bool single_watchwin; > bool auto_roadbuild_mode; > bool show_warea; > - bool snap_windows_only_when_overlapping; > + bool snap_win_overlap_only; > bool dock_windows_to_edges; > bool music; > bool fx; > @@ -92,41 +93,54 @@ > bool handle_key(bool down, SDL_keysym code) override; > > private: > - uint32_t m_vbutw; > - uint32_t m_butw; > - uint32_t m_buth; > - UI::Button m_advanced_options, m_cancel, m_apply; > - UI::SpinBox m_sb_maxfps, m_sb_autosave; > - UI::SpinBox m_sb_remove_replays; > - UI::Textarea m_title; > - UI::Checkbox m_fullscreen; > - UI::Textarea m_label_fullscreen; > - UI::Checkbox m_inputgrab; > - UI::Textarea m_label_inputgrab; > - UI::Checkbox m_music; > - UI::Textarea m_label_music; > - UI::Checkbox m_fx; > - UI::Textarea m_label_fx; > - UI::Textarea m_label_maxfps; > - UI::Listselect<void *> m_reslist; > - UI::Textarea m_label_resolution; > - UI::Textarea m_label_language; > - UI::Listselect<std::string> m_language_list; > - UI::Textarea m_label_game_options; > - UI::Checkbox m_single_watchwin; > - UI::Textarea m_label_single_watchwin; > - UI::Checkbox m_auto_roadbuild_mode; > - UI::Textarea m_label_auto_roadbuild_mode; > - UI::Checkbox m_show_workarea_preview; > - UI::Textarea m_label_show_workarea_preview; > - UI::Checkbox m_snap_windows_only_when_overlapping; > - UI::Textarea > m_label_snap_windows_only_when_overlapping; > - UI::Checkbox m_dock_windows_to_edges; > - UI::Textarea m_label_dock_windows_to_edges; > - UI::Textarea m_label_autosave; > - UI::Textarea m_label_remove_replays; > - OptionsCtrl::OptionsStruct os; > - > + uint32_t const m_vbutw; > + uint32_t const m_butw; > + uint32_t const m_buth; > + uint32_t const m_hmargin; > + uint32_t const m_padding; > + uint32_t const m_space; > + uint32_t const m_offset_first_group; > + uint32_t const m_offset_second_group; > + > + UI::Button m_advanced_options, m_cancel, m_apply; > + > + UI::Textarea m_title; > + UI::Textarea m_label_resolution; > + UI::Listselect<void *> m_reslist; > + UI::Checkbox m_fullscreen; > + UI::Textarea m_label_fullscreen; > + UI::Checkbox m_inputgrab; > + UI::Textarea m_label_inputgrab; > + UI::Textarea m_label_maxfps; > + UI::SpinBox m_sb_maxfps; > + > + UI::Textarea m_label_language; > + UI::Listselect<std::string> m_language_list; > + UI::Checkbox m_music; > + UI::Textarea m_label_music; > + UI::Checkbox m_fx; > + UI::Textarea m_label_fx; > + > + UI::Textarea m_label_game_options; > + UI::Checkbox m_single_watchwin; > + UI::Textarea m_label_single_watchwin; > + UI::Checkbox m_auto_roadbuild_mode; > + UI::Textarea m_label_auto_roadbuild_mode; > + UI::Checkbox m_show_workarea_preview; > + UI::Textarea m_label_show_workarea_preview; > + UI::Checkbox m_snap_win_overlap_only; > + UI::Textarea m_label_snap_win_overlap_only; > + UI::Checkbox m_dock_windows_to_edges; > + UI::Textarea m_label_dock_windows_to_edges; > + UI::SpinBox m_sb_autosave; > + UI::Textarea m_label_autosave; > + UI::SpinBox m_sb_remove_replays; > + UI::Textarea m_label_remove_replays; > + > + OptionsCtrl::OptionsStruct os; > + > + void update_sb_autosave_unit(); > + void update_sb_remove_replays_unit(); > void advanced_options(); > > class ScreenResolution { > @@ -156,30 +170,36 @@ > bool handle_key(bool down, SDL_keysym code) override; > > private: > - uint32_t m_vbutw; > - uint32_t m_butw; > - uint32_t m_buth; > - > - UI::Button m_cancel, m_apply; > + void update_sb_dis_panel_unit(); > + void update_sb_dis_border_unit(); > + > + uint32_t const m_vbutw; > + uint32_t const m_butw; > + uint32_t const m_buth; > + uint32_t const m_hmargin; > + uint32_t const m_padding; > + uint32_t const m_space; > + uint32_t const m_offset_first_group; > + > + UI::Button m_cancel, m_apply; > + UI::Textarea m_title; > + UI::Textarea m_label_ui_font; > + UI::Listselect<std::string> m_ui_font_list; > + > + UI::Textarea m_label_snap_dis_panel, > m_label_snap_dis_border; > UI::SpinBox m_sb_dis_panel, m_sb_dis_border; > - UI::Textarea m_title; > - UI::Listselect<std::string> m_ui_font_list; > - UI::Textarea m_label_ui_font; > + UI::Checkbox m_transparent_chat; > + UI::MultilineTextarea m_label_transparent_chat; > UI::Checkbox m_message_sound; > - UI::Textarea m_label_message_sound; > + UI::MultilineTextarea m_label_message_sound; > UI::Checkbox m_nozip; > - UI::Textarea m_label_nozip; > - > - UI::Textarea m_label_snap_dis_panel, > m_label_snap_dis_border; > - > + UI::MultilineTextarea m_label_nozip; > UI::Checkbox m_remove_syncstreams; > - UI::Textarea m_label_remove_syncstreams; > + UI::MultilineTextarea m_label_remove_syncstreams; > UI::Checkbox m_opengl; > - UI::Textarea m_label_opengl; > - UI::Checkbox m_transparent_chat; > - UI::Textarea m_label_transparent_chat; > + UI::MultilineTextarea m_label_opengl; > > - OptionsCtrl::OptionsStruct os; > + OptionsCtrl::OptionsStruct os; > }; > > #endif // end of include guard: WL_UI_FSMENU_OPTIONS_H > > === modified file 'src/ui_fsmenu/singleplayer.cc' > --- src/ui_fsmenu/singleplayer.cc 2014-09-10 14:08:25 +0000 > +++ src/ui_fsmenu/singleplayer.cc 2014-09-27 13:09:21 +0000 > @@ -24,7 +24,7 @@ > #include "wui/text_constants.h" > > FullscreenMenuSinglePlayer::FullscreenMenuSinglePlayer() : > -FullscreenMenuBase("singleplmenu.jpg"), > +FullscreenMenuBase("ui_fsmenu.jpg"), > > // Values for alignment and size > m_butw (get_w() * 7 / 20), > > === modified file 'src/wui/encyclopedia_window.cc' > --- src/wui/encyclopedia_window.cc 2014-09-10 16:57:31 +0000 > +++ src/wui/encyclopedia_window.cc 2014-09-27 13:09:21 +0000 > @@ -45,8 +45,9 @@ > #define WINDOW_WIDTH std::min(700, g_gr->get_xres() - 40) > #define WINDOW_HEIGHT std::min(550, g_gr->get_yres() - 40) > > -#define QUANTITY_COLUMN_WIDTH 74 > -#define WARE_GROUPS_TABLE_WIDTH (WINDOW_WIDTH * 1 / 2 - 5) > +#define QUANTITY_COLUMN_WIDTH 100 change these to constexpr int for type safety > +#define WARE_COLUMN_WIDTH 250 > +#define PRODSITE_GROUPS_WIDTH (WINDOW_WIDTH - WARE_COLUMN_WIDTH - > QUANTITY_COLUMN_WIDTH - 10) > > using namespace Widelands; > > @@ -64,19 +65,18 @@ > WINDOW_WIDTH, WINDOW_HEIGHT, > _("Tribal Ware Encyclopedia")), > wares (this, 5, 5, WINDOW_WIDTH - 10, WINDOW_HEIGHT - 250), > - prodSites (this, 5, WINDOW_HEIGHT - 150, WINDOW_WIDTH - > WARE_GROUPS_TABLE_WIDTH - 10, 145), > + prodSites (this, 5, WINDOW_HEIGHT - 150, PRODSITE_GROUPS_WIDTH, > 145), > condTable > (this, > - WINDOW_WIDTH - WARE_GROUPS_TABLE_WIDTH - 5, WINDOW_HEIGHT - > 150, WARE_GROUPS_TABLE_WIDTH, 145), > + PRODSITE_GROUPS_WIDTH + 5, WINDOW_HEIGHT - 150, WINDOW_WIDTH - > PRODSITE_GROUPS_WIDTH - 5, 145), > descrTxt (this, 5, WINDOW_HEIGHT - 240, WINDOW_WIDTH - 10, 80, > "") > { > wares.selected.connect(boost::bind(&EncyclopediaWindow::wareSelected, > this, _1)); > > > prodSites.selected.connect(boost::bind(&EncyclopediaWindow::prodSiteSelected, > this, _1)); > condTable.add_column > - (WARE_GROUPS_TABLE_WIDTH > - - QUANTITY_COLUMN_WIDTH, > - _("Consumed ware type(s)")); > + /** TRANSLATORS: Column title in the Tribal Wares > Encyclopedia */ > + (WARE_COLUMN_WIDTH, ngettext("Consumed Ware Type", > "Consumed Ware Types", 0)); > condTable.add_column (QUANTITY_COLUMN_WIDTH, _("Quantity")); > > fillWares(); > @@ -137,6 +137,7 @@ > > void EncyclopediaWindow::prodSiteSelected(uint32_t) { > assert(prodSites.has_selection()); > + size_t no_of_wares = 0; > condTable.clear(); > const TribeDescr & tribe = iaplayer().player().tribe(); > > @@ -184,6 +185,7 @@ > for (const WareIndex& ware_index : > ware_types) { > > ware_type_descnames.push_back(tribe.get_ware_descr(ware_index)->descname()); > } > + no_of_wares = no_of_wares + > ware_types.size(); > > std::string ware_type_names = > > i18n::localize_item_list(ware_type_descnames, i18n::ConcatenateWith::OR); > @@ -206,4 +208,5 @@ > } > } > } > + condTable.set_column_title(0, ngettext("Consumed Ware Type", > "Consumed Ware Types", no_of_wares)); > } > > === modified file 'src/wui/login_box.cc' > --- src/wui/login_box.cc 2014-09-10 14:48:40 +0000 > +++ src/wui/login_box.cc 2014-09-27 13:09:21 +0000 > @@ -26,17 +26,19 @@ > > LoginBox::LoginBox(Panel & parent) > : > -Window(&parent, "login_box", 0, 0, 500, 210, _("Metaserver login")) > +Window(&parent, "login_box", 0, 0, 500, 220, _("Metaserver login")) > { > center_to_parent(); > > - ta_nickname = new UI::Textarea(this, 10, 5, _("Nickname:")); > + int32_t margin = 10; > + > + ta_nickname = new UI::Textarea(this, margin, margin, _("Nickname:")); > eb_nickname = > new UI::EditBox > - (this, 150, 5, 330, 20, > + (this, 150, margin, 330, 20, > g_gr->images().get("pics/but2.png"), UI::Align_Left); > > - ta_password = new UI::Textarea(this, 10, 40, _("Password:")); > + ta_password = new UI::Textarea(this, margin, 40, _("Password:")); > eb_password = > new UI::EditBox > (this, 150, 40, 330, 20, > @@ -44,28 +46,29 @@ > > pwd_warning = > new UI::MultilineTextarea > - (this, 10, 65, 505, 50, > + (this, margin, 65, 505, 50, > _("WARNING: Password will be shown and saved > readable!"), > UI::Align_Left); > > - cb_register = new UI::Checkbox(this, Point(10, 110)); > + cb_register = new UI::Checkbox(this, Point(margin, 110)); > ta_register = > new UI::Textarea(this, 40, 110, _("Log in to a registered > account")); > > - cb_auto_log = new UI::Checkbox(this, Point(10, 135)); > - ta_auto_log = new UI::Textarea > - (this, 40, 135, > + cb_auto_log = new UI::Checkbox(this, Point(margin, 135)); > + ta_auto_log = new UI::MultilineTextarea > + (this, 40, 135, get_inner_w() - cb_auto_log->get_w() - margin, > 35, > _("Automatically use this login information from now on.")); > > UI::Button * loginbtn = new UI::Button > (this, "login", > - (get_inner_w() / 2 - 200) / 2, 175, 200, 20, > + (get_inner_w() / 2 - 200) / 2, get_inner_h() - 20 - margin, > + 200, 20, > g_gr->images().get("pics/but0.png"), > _("Login")); > loginbtn->sigclicked.connect(boost::bind(&LoginBox::pressedLogin, > boost::ref(*this))); > UI::Button * cancelbtn = new UI::Button > (this, "cancel", > - (get_inner_w() / 2 - 200) / 2 + get_inner_w() / 2, 175, 200, > 20, > + (get_inner_w() / 2 - 200) / 2 + get_inner_w() / 2, > loginbtn->get_y(), 200, 20, > g_gr->images().get("pics/but1.png"), > _("Cancel")); > cancelbtn->sigclicked.connect(boost::bind(&LoginBox::pressedCancel, > boost::ref(*this))); > > === modified file 'src/wui/login_box.h' > --- src/wui/login_box.h 2014-09-10 14:48:40 +0000 > +++ src/wui/login_box.h 2014-09-27 13:09:21 +0000 > @@ -46,7 +46,7 @@ > UI::Textarea * ta_nickname; > UI::Textarea * ta_password; > UI::Textarea * ta_register; > - UI::Textarea * ta_auto_log; > + UI::MultilineTextarea * ta_auto_log; > UI::MultilineTextarea * pwd_warning; > }; > > -- https://code.launchpad.net/~widelands-dev/widelands/bug-1371905_2/+merge/236227 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1371905_2. _______________________________________________ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp