ui: Scale down unit frames larger than 72x72 in the Recruit and Recall dialogs

This is necessary to prevent all list items from being enlarged to fit
the larger units. It is a very common occurrence in campaigns featuring
the Ghost line nowadays thanks to the oversized Spectre baseframe.

This needs to be backported to 1.10.
This commit is contained in:
Ignacio R. Morelle 2013-03-05 09:53:38 +00:00
parent 0d0b347340
commit f880557b5d
3 changed files with 27 additions and 4 deletions

View file

@ -56,6 +56,8 @@ Version 1.11.1+svn:
* Allow copying the selection in the old (default) lobby using
Ctrl+C/Command+C (bug #5877)
* Color coded the resistance table in the hp display's tooltip.
* Scale down unit baseframes larger than 72x72 in the Recruit and Recall
dialogs to prevent all list entries from being enlarged to fit
* Tooltip for the movement points display shows the movement costs.
* Updating the shroud after delaying shroud updates is done gradually instead
of instantly.

View file

@ -71,7 +71,7 @@ Xu , Xu , Qxu , Qxu , Ql , Ql
[/leader]
side=1
controller=human
recruit="Ghost,Troll Whelp,Assassin,Elvish Hero,Elvish Fighter,Elvish Archer,Horseman,Mage,Elvish Shaman,Red Mage,Spearman,Swordsman,Duelist,Fencer,Elvish Captain,Elvish Ranger,Elvish Shyde,Thief,Rogue,White Mage,Mage of Light,Elvish Sharpshooter,Silver Mage,Vampire Bat,Blood Bat,Dread Bat,Soulless,Walking Corpse"
recruit="Ghost,Troll Whelp,Assassin,Elvish Hero,Elvish Fighter,Elvish Archer,Horseman,Mage,Elvish Shaman,Red Mage,Spearman,Swordsman,Duelist,Fencer,Elvish Captain,Elvish Ranger,Elvish Shyde,Thief,Rogue,White Mage,Mage of Light,Elvish Sharpshooter,Silver Mage,Vampire Bat,Blood Bat,Dread Bat,Soulless,Walking Corpse,Fire Dragon"
gold=2000
village_support=5
team_name="1"
@ -2752,6 +2752,12 @@ For game purposes, the races group into factions; for example, orcs often cooper
type=Ancient Wose
[/unit]
[unit]
side=1
x,y="recall","recall"
type=Fire Dragon
[/unit]
[lua]
code=<<
wesnoth.put_recall_unit { type = "Elvish Lady" }

View file

@ -793,8 +793,16 @@ void menu_handler::recruit(int side_num, const map_location &last_hex)
gui::dialog::default_style);
rmenu.add_button(new help::help_button(*gui_,"recruit_and_recall"),
gui::dialog::BUTTON_HELP);
rmenu.set_menu(items, &sorter);
rmenu.get_menu().sort_by(1); // otherwise it's unsorted by default
gui::menu::imgsel_style units_display_style(gui::menu::bluebg_style);
units_display_style.scale_images(font::relative_size(72), font::relative_size(72));
gui::menu* units_menu = new gui::menu(gui_->video(), items, false, -1,
gui::dialog::max_menu_width, &sorter, &units_display_style, false);
units_menu->sort_by(1); // otherwise it's unsorted by default
rmenu.set_menu(units_menu);
rmenu.set_panes(preview_panes);
recruit_res = rmenu.show();
}
@ -963,7 +971,14 @@ void menu_handler::recall(int side_num, const map_location &last_hex)
gui::dialog rmenu(*gui_, _("Recall") + get_title_suffix(side_num),
_("Select unit:") + std::string("\n"),
gui::OK_CANCEL, gui::dialog::default_style);
rmenu.set_menu(options, &sorter);
gui::menu::imgsel_style units_display_style(gui::menu::bluebg_style);
units_display_style.scale_images(font::relative_size(72), font::relative_size(72));
gui::menu* units_menu = new gui::menu(gui_->video(), options, false, -1,
gui::dialog::max_menu_width, &sorter, &units_display_style, false);
rmenu.set_menu(units_menu);
gui::filter_textbox* filter = new gui::filter_textbox(gui_->video(),
_("Filter: "), options, options_to_filter, 1, rmenu, 200);