mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Revise birthsign tooltip layout (#6792)
Make all description bits distinct widgets to allow proper padding Use spaces instead of line breaks to separate spells Enable word-wrapping for description text Make the tooltip wider and increase padding
This commit is contained in:
parent
a6676fd6f3
commit
c779f67967
2 changed files with 36 additions and 21 deletions
|
@ -894,7 +894,8 @@ namespace MWGui
|
||||||
widget->setUserString("ToolTipLayout", "BirthSignToolTip");
|
widget->setUserString("ToolTipLayout", "BirthSignToolTip");
|
||||||
widget->setUserString(
|
widget->setUserString(
|
||||||
"ImageTexture_BirthSignImage", Misc::ResourceHelpers::correctTexturePath(sign->mTexture, vfs));
|
"ImageTexture_BirthSignImage", Misc::ResourceHelpers::correctTexturePath(sign->mTexture, vfs));
|
||||||
std::string text = sign->mName + "\n#{fontcolourhtml=normal}" + sign->mDescription;
|
widget->setUserString("Caption_BirthSignName", sign->mName);
|
||||||
|
widget->setUserString("Caption_BirthSignDescription", sign->mDescription);
|
||||||
|
|
||||||
std::vector<const ESM::Spell*> abilities, powers, spells;
|
std::vector<const ESM::Spell*> abilities, powers, spells;
|
||||||
|
|
||||||
|
@ -915,26 +916,22 @@ namespace MWGui
|
||||||
spells.push_back(spell);
|
spells.push_back(spell);
|
||||||
}
|
}
|
||||||
|
|
||||||
using Category = std::pair<const std::vector<const ESM::Spell*>&, std::string_view>;
|
using Category = std::tuple<const std::vector<const ESM::Spell*>&, std::string_view, std::string_view>;
|
||||||
for (const auto& [category, label] : std::initializer_list<Category>{
|
std::initializer_list<Category> categories{ { abilities, "#{sBirthsignmenu1}", "Abilities" },
|
||||||
{ abilities, "sBirthsignmenu1" }, { powers, "sPowers" }, { spells, "sBirthsignmenu2" } })
|
{ powers, "#{sPowers}", "Powers" }, { spells, "#{sBirthsignmenu2}", "Spells" } };
|
||||||
|
|
||||||
|
for (const auto& [category, label, widgetName] : categories)
|
||||||
{
|
{
|
||||||
bool addHeader = true;
|
std::string text;
|
||||||
for (const ESM::Spell* spell : category)
|
if (!category.empty())
|
||||||
{
|
{
|
||||||
if (addHeader)
|
text = std::string(label) + "\n#{fontcolourhtml=normal}";
|
||||||
{
|
for (const ESM::Spell* spell : category)
|
||||||
text += "\n\n#{fontcolourhtml=header}#{";
|
text += spell->mName + ' ';
|
||||||
text += label;
|
text.pop_back();
|
||||||
text += '}';
|
|
||||||
addHeader = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
text += "\n#{fontcolourhtml=normal}" + spell->mName;
|
|
||||||
}
|
}
|
||||||
|
widget->setUserString("Caption_BirthSign" + std::string(widgetName), text);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget->setUserString("Caption_BirthSignText", text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolTips::createRaceToolTip(MyGUI::Widget* widget, const ESM::Race* playerRace)
|
void ToolTips::createRaceToolTip(MyGUI::Widget* widget, const ESM::Race* playerRace)
|
||||||
|
|
|
@ -272,16 +272,34 @@
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<!-- Birthsign tooltip -->
|
<!-- Birthsign tooltip -->
|
||||||
<Widget type="VBox" skin="HUD_Box_NoTransp" position="0 0 300 300" align="Stretch" name="BirthSignToolTip">
|
<Widget type="VBox" skin="HUD_Box_NoTransp" position="0 0 0 0" align="Stretch" name="BirthSignToolTip">
|
||||||
<Property key="AutoResize" value="true"/>
|
<Property key="AutoResize" value="true"/>
|
||||||
<Property key="Padding" value="8"/>
|
<Property key="Padding" value="10"/>
|
||||||
|
|
||||||
<!-- Birthsign image -->
|
<!-- Birthsign image -->
|
||||||
<Widget type="Widget" skin="MW_Box" position="18 13 263 137" align="Top HCenter">
|
<Widget type="Widget" skin="MW_Box" position="18 13 263 137" align="Top HCenter">
|
||||||
<Widget type="ImageBox" skin="ImageBox" position="2 2 259 133" name="BirthSignImage" align="Left Top"/>
|
<Widget type="ImageBox" skin="ImageBox" position="2 2 259 133" name="BirthSignImage" align="Top"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<Widget type="AutoSizedTextBox" skin="NormalText" position="8 154 284 138" align="Top" name="BirthSignText">
|
<Widget type="AutoSizedTextBox" skin="NormalText" align="Top" name="BirthSignName">
|
||||||
|
<Property key="TextAlign" value="Top HCenter"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
<Widget type="AutoSizedEditBox" skin="SandText" position="0 0 400 100" align="Top" name="BirthSignDescription">
|
||||||
|
<Property key="MultiLine" value="true"/>
|
||||||
|
<Property key="WordWrap" value="true"/>
|
||||||
|
<Property key="TextAlign" value="Left Top"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
<Widget type="AutoSizedTextBox" skin="NormalText" align="Top" name="BirthSignAbilities">
|
||||||
|
<Property key="TextAlign" value="Top HCenter"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
<Widget type="AutoSizedTextBox" skin="NormalText" align="Top" name="BirthSignPowers">
|
||||||
|
<Property key="TextAlign" value="Top HCenter"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
<Widget type="AutoSizedTextBox" skin="NormalText" align="Top" name="BirthSignSpells">
|
||||||
<Property key="TextAlign" value="Top HCenter"/>
|
<Property key="TextAlign" value="Top HCenter"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue