1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-07 06:06:40 +00:00

Improve handling of larger font size

This commit is contained in:
Andrei Kortunov 2022-08-17 21:51:36 +04:00
parent c3d3f3140b
commit 2cd2b42e33
6 changed files with 21 additions and 14 deletions

View file

@ -184,8 +184,8 @@ namespace MWGui
return; return;
Widgets::MWSpellPtr spellWidget; Widgets::MWSpellPtr spellWidget;
const int lineHeight = 18; const int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
MyGUI::IntCoord coord(0, 0, mSpellArea->getWidth(), 18); MyGUI::IntCoord coord(0, 0, mSpellArea->getWidth(), lineHeight);
const MWWorld::ESMStore &store = const MWWorld::ESMStore &store =
MWBase::Environment::get().getWorld()->getStore(); MWBase::Environment::get().getWorld()->getStore();

View file

@ -20,6 +20,8 @@ namespace
{ {
std::string getCountString(int count) std::string getCountString(int count)
{ {
static const int fontHeight = MWBase::Environment::get().getWindowManager()->getFontHeight();
if (count == 1) if (count == 1)
return ""; return "";
@ -29,6 +31,8 @@ namespace
return MyGUI::utility::toString(count/1000000) + "m"; return MyGUI::utility::toString(count/1000000) + "m";
else if (count > 9999) else if (count > 9999)
return MyGUI::utility::toString(count/1000) + "k"; return MyGUI::utility::toString(count/1000) + "k";
else if (fontHeight >= 18 && count > 999)
return MyGUI::utility::toString(count/1000) + "k";
else else
return MyGUI::utility::toString(count); return MyGUI::utility::toString(count);
} }

View file

@ -400,7 +400,7 @@ namespace MWGui
return; return;
Widgets::MWSkillPtr skillWidget; Widgets::MWSkillPtr skillWidget;
const int lineHeight = 18; const int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
MyGUI::IntCoord coord1(0, 0, mSkillList->getWidth(), 18); MyGUI::IntCoord coord1(0, 0, mSkillList->getWidth(), 18);
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
@ -436,8 +436,8 @@ namespace MWGui
if (mCurrentRaceId.empty()) if (mCurrentRaceId.empty())
return; return;
const int lineHeight = 18; const int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
MyGUI::IntCoord coord(0, 0, mSpellPowerList->getWidth(), 18); MyGUI::IntCoord coord(0, 0, mSpellPowerList->getWidth(), lineHeight);
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Race *race = store.get<ESM::Race>().find(mCurrentRaceId); const ESM::Race *race = store.get<ESM::Race>().find(mCurrentRaceId);

View file

@ -812,7 +812,7 @@ namespace MWGui
void SettingsWindow::layoutControlsBox() void SettingsWindow::layoutControlsBox()
{ {
const int h = 18; const int h = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
const int w = mControlsBox->getWidth() - 28; const int w = mControlsBox->getWidth() - 28;
const int noWidgetsInRow = 2; const int noWidgetsInRow = 2;
const int totalH = mControlsBox->getChildCount() / noWidgetsInRow * h; const int totalH = mControlsBox->getChildCount() / noWidgetsInRow * h;

View file

@ -5,6 +5,9 @@
#include <MyGUI_ImageBox.h> #include <MyGUI_ImageBox.h>
#include <MyGUI_Gui.h> #include <MyGUI_Gui.h>
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
#include <components/widgets/sharedstatebutton.hpp> #include <components/widgets/sharedstatebutton.hpp>
#include <components/widgets/box.hpp> #include <components/widgets/box.hpp>
@ -84,7 +87,7 @@ namespace MWGui
int curType = -1; int curType = -1;
const int spellHeight = 18; const int spellHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
mLines.clear(); mLines.clear();

View file

@ -275,18 +275,18 @@
<Property key="ButtonAutoWidth" value="true"/> <Property key="ButtonAutoWidth" value="true"/>
<Widget type="TabItem"> <Widget type="TabItem">
<Property key="Caption" value=" #{sVideo} "/> <Property key="Caption" value=" #{sVideo} "/>
<Widget type="ListBox" skin="MW_List" position="0 4 170 215" align="Left Top" name="ResolutionList"/> <Widget type="ListBox" skin="MW_List" position="0 4 185 215" align="Left Top" name="ResolutionList"/>
<Widget type="TextBox" skin="NormalText" position="182 4 170 18" align="Left Top"> <Widget type="TextBox" skin="NormalText" position="197 4 185 18" align="Left Top">
<Property key="Caption" value="#{SettingsMenu:WindowMode}"/> <Property key="Caption" value="#{SettingsMenu:WindowMode}"/>
</Widget> </Widget>
<Widget type="HBox" position="182 28 400 24"> <Widget type="HBox" position="197 28 400 24">
<Widget type="ComboBox" skin="MW_ComboBox" position="0 0 200 24" align="Left Top" name="WindowModeList"> <Widget type="ComboBox" skin="MW_ComboBox" position="0 0 200 24" align="Left Top" name="WindowModeList">
<Property key="AddItem" value="#{SettingsMenu:WindowModeFullscreen}"/> <Property key="AddItem" value="#{SettingsMenu:WindowModeFullscreen}"/>
<Property key="AddItem" value="#{SettingsMenu:WindowModeWindowedFullscreen}"/> <Property key="AddItem" value="#{SettingsMenu:WindowModeWindowedFullscreen}"/>
<Property key="AddItem" value="#{SettingsMenu:WindowModeWindowed}"/> <Property key="AddItem" value="#{SettingsMenu:WindowModeWindowed}"/>
</Widget> </Widget>
</Widget> </Widget>
<Widget type="HBox" position="182 64 400 24"> <Widget type="HBox" position="197 64 400 24">
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 24 24" align="Left Top" name="VSyncButton"> <Widget type="AutoSizedButton" skin="MW_Button" position="0 0 24 24" align="Left Top" name="VSyncButton">
<UserString key="SettingCategory" value="Video"/> <UserString key="SettingCategory" value="Video"/>
<UserString key="SettingName" value="vsync"/> <UserString key="SettingName" value="vsync"/>
@ -296,7 +296,7 @@
<Property key="Caption" value="#{SettingsMenu:VSync}"/> <Property key="Caption" value="#{SettingsMenu:VSync}"/>
</Widget> </Widget>
</Widget> </Widget>
<Widget type="HBox" position="182 94 300 24"> <Widget type="HBox" position="197 94 300 24">
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 24 24" align="Left Top" name="WindowBorderButton"> <Widget type="AutoSizedButton" skin="MW_Button" position="0 0 24 24" align="Left Top" name="WindowBorderButton">
<UserString key="SettingCategory" value="Video"/> <UserString key="SettingCategory" value="Video"/>
<UserString key="SettingName" value="window border"/> <UserString key="SettingName" value="window border"/>
@ -306,7 +306,7 @@
<Property key="Caption" value="#{SettingsMenu:WindowBorder}"/> <Property key="Caption" value="#{SettingsMenu:WindowBorder}"/>
</Widget> </Widget>
</Widget> </Widget>
<Widget type="HBox" position="182 124 300 24"> <Widget type="HBox" position="197 124 300 24">
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 24 24" align="Left Top" name="WindowBorderButton"> <Widget type="AutoSizedButton" skin="MW_Button" position="0 0 24 24" align="Left Top" name="WindowBorderButton">
<UserString key="SettingCategory" value="Post Processing"/> <UserString key="SettingCategory" value="Post Processing"/>
<UserString key="SettingName" value="enabled"/> <UserString key="SettingName" value="enabled"/>
@ -320,7 +320,7 @@
</Widget> </Widget>
</Widget> </Widget>
<Widget type="AutoSizedTextBox" skin="SandText" position="182 154 300 32" align="Left Top"> <Widget type="AutoSizedTextBox" skin="SandText" position="197 154 300 32" align="Left Top">
<Property key="Caption" value="#{SettingsMenu:FrameRateHint}"/> <Property key="Caption" value="#{SettingsMenu:FrameRateHint}"/>
</Widget> </Widget>