aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-06-03 12:33:03 +0000
committerTorbjörn Andersson2005-06-03 12:33:03 +0000
commit41f69db19f717239ca14a3cd4ef793a7829ca93e (patch)
treeaf7ab2b76f86de2991596d642808cde835c783ee
parentec958e975eb9eaac22843f8fd96df0b9a0fff6e4 (diff)
downloadscummvm-rg350-41f69db19f717239ca14a3cd4ef793a7829ca93e.tar.gz
scummvm-rg350-41f69db19f717239ca14a3cd4ef793a7829ca93e.tar.bz2
scummvm-rg350-41f69db19f717239ca14a3cd4ef793a7829ca93e.zip
Cleanup.
svn-id: r18324
-rw-r--r--gui/dialog.cpp15
-rw-r--r--gui/launcher.cpp34
-rw-r--r--gui/message.cpp17
-rw-r--r--gui/options.cpp10
4 files changed, 18 insertions, 58 deletions
diff --git a/gui/dialog.cpp b/gui/dialog.cpp
index 6fff8a66c4..915e34c128 100644
--- a/gui/dialog.cpp
+++ b/gui/dialog.cpp
@@ -296,18 +296,15 @@ ButtonWidget *Dialog::addButton(GuiObject *boss, int x, int y, const Common::Str
}
CheckboxWidget *Dialog::addCheckbox(GuiObject *boss, int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws) {
- const Graphics::Font *font;
int w, h;
if (ws == kBigWidgetSize) {
- font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
h = kBigButtonHeight;
} else {
- font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
h = kButtonHeight;
}
- w = font->getFontHeight() + 10 + font->getStringWidth(label);
+ w = g_gui.getFontHeight() + 10 + g_gui.getStringWidth(label);
return new CheckboxWidget(boss, x, y, w, h, label, cmd, hotkey, ws);
}
@@ -327,15 +324,7 @@ SliderWidget *Dialog::addSlider(GuiObject *boss, int x, int y, uint32 cmd, Widge
}
PopUpWidget *Dialog::addPopUp(GuiObject *boss, int x, int y, int w, const Common::String &label, uint labelWidth, WidgetSize ws) {
- const Graphics::Font *font;
-
- if (ws == kBigWidgetSize) {
- font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
- } else {
- font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
- }
-
- return new PopUpWidget(boss, x, y, w, font->getFontHeight() + 2, label, labelWidth, ws);
+ return new PopUpWidget(boss, x, y, w, kLineHeight, label, labelWidth, ws);
}
uint32 GuiObject::getMillis() {
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 37427f02eb..2a75620918 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -188,24 +188,14 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target)
tab->addTab("Game");
yoffset = vBorder;
- const Graphics::Font *font;
-
- if (ws == GUI::kBigWidgetSize) {
- font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
- } else {
- font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
- }
-
- int lineHeight = font->getFontHeight() + 2;
-
// GUI: Label & edit widget for the game ID
- new StaticTextWidget(tab, x, yoffset + 2, labelWidth, lineHeight, "ID: ", kTextAlignRight, ws);
- _domainWidget = new DomainEditTextWidget(tab, x + labelWidth, yoffset, _w - labelWidth - 10 - x, lineHeight, _domain, ws);
+ new StaticTextWidget(tab, x, yoffset + 2, labelWidth, kLineHeight, "ID: ", kTextAlignRight, ws);
+ _domainWidget = new DomainEditTextWidget(tab, x + labelWidth, yoffset, _w - labelWidth - 10 - x, kLineHeight, _domain, ws);
yoffset += _domainWidget->getHeight() + 3;
// GUI: Label & edit widget for the description
- new StaticTextWidget(tab, x, yoffset + 2, labelWidth, lineHeight, "Name: ", kTextAlignRight, ws);
- _descriptionWidget = new EditTextWidget(tab, x + labelWidth, yoffset, _w - labelWidth - 10 - x, lineHeight, description, ws);
+ new StaticTextWidget(tab, x, yoffset + 2, labelWidth, kLineHeight, "Name: ", kTextAlignRight, ws);
+ _descriptionWidget = new EditTextWidget(tab, x + labelWidth, yoffset, _w - labelWidth - 10 - x, kLineHeight, description, ws);
yoffset += _descriptionWidget->getHeight() + 3;
// Language popup
@@ -234,12 +224,12 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target)
// GUI: Button + Label for the game path
addButton(tab, x, yoffset, "Game Path:", kCmdGameBrowser, 0, ws);
- _gamePathWidget = new StaticTextWidget(tab, x + buttonWidth + 20, yoffset + 3, _w - (x + buttonWidth + 20) - 10, lineHeight, gamePath, kTextAlignLeft, ws);
+ _gamePathWidget = new StaticTextWidget(tab, x + buttonWidth + 20, yoffset + 3, _w - (x + buttonWidth + 20) - 10, kLineHeight, gamePath, kTextAlignLeft, ws);
yoffset += buttonHeight + 4;
// GUI: Button + Label for the additional path
addButton(tab, x, yoffset, "Extra Path:", kCmdExtraBrowser, 0, ws);
- _extraPathWidget = new StaticTextWidget(tab, x + buttonWidth + 20, yoffset + 3, _w - (x + buttonWidth + 20) - 10, lineHeight, extraPath, kTextAlignLeft, ws);
+ _extraPathWidget = new StaticTextWidget(tab, x + buttonWidth + 20, yoffset + 3, _w - (x + buttonWidth + 20) - 10, kLineHeight, extraPath, kTextAlignLeft, ws);
if (extraPath.isEmpty() || !ConfMan.hasKey("extrapath", _domain)) {
_extraPathWidget->setLabel("None");
}
@@ -247,7 +237,7 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target)
// GUI: Button + Label for the save path
addButton(tab, x, yoffset, "Save Path:", kCmdSaveBrowser, 0, ws);
- _savePathWidget = new StaticTextWidget(tab, x + buttonWidth + 20, yoffset + 3, _w - (x + buttonWidth + 20) - 10, lineHeight, savePath, kTextAlignLeft, ws);
+ _savePathWidget = new StaticTextWidget(tab, x + buttonWidth + 20, yoffset + 3, _w - (x + buttonWidth + 20) - 10, kLineHeight, savePath, kTextAlignLeft, ws);
if (savePath.isEmpty() || !ConfMan.hasKey("savepath", _domain)) {
_savePathWidget->setLabel("Default");
}
@@ -507,25 +497,19 @@ LauncherDialog::LauncherDialog(GameDetector &detector)
_h = screenH;
GUI::WidgetSize ws;
- int lineHeight;
int buttonHeight;
- const Graphics::Font *font;
int top;
if (screenW >= 400 && screenH >= 300) {
ws = GUI::kBigWidgetSize;
- font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
- lineHeight = font->getFontHeight() + 2;
buttonHeight = kBigButtonHeight;
} else {
ws = GUI::kNormalWidgetSize;
- font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
- lineHeight = font->getFontHeight() + 2;
buttonHeight = kButtonHeight;
}
// Show ScummVM version
- new StaticTextWidget(this, hBorder, 8, _w - 2*hBorder, lineHeight, gScummVMFullVersion, kTextAlignCenter, ws);
+ new StaticTextWidget(this, hBorder, 8, _w - 2*hBorder, kLineHeight, gScummVMFullVersion, kTextAlignCenter, ws);
// Add some buttons at the bottom
// TODO: Rearrange them a bit? In particular, we could put a slightly smaller space
@@ -551,7 +535,7 @@ LauncherDialog::LauncherDialog(GameDetector &detector)
// Add list with game titles
- _list = new ListWidget(this, hBorder, lineHeight + 16, _w - 2 * hBorder, top - lineHeight - 20, ws);
+ _list = new ListWidget(this, hBorder, kLineHeight + 16, _w - 2 * hBorder, top - kLineHeight - 20, ws);
_list->setEditable(false);
_list->setNumberingMode(kListNumberingOff);
diff --git a/gui/message.cpp b/gui/message.cpp
index 5185cb4cbf..233d86d22d 100644
--- a/gui/message.cpp
+++ b/gui/message.cpp
@@ -41,19 +41,14 @@ MessageDialog::MessageDialog(const Common::String &message, const char *defaultB
const int screenH = g_system->getOverlayHeight();
GUI::WidgetSize ws;
- int lineHeight;
int buttonWidth, buttonHeight;
- const Graphics::Font *font;
+
if (screenW >= 400 && screenH >= 300) {
ws = GUI::kBigWidgetSize;
- font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
- lineHeight = font->getFontHeight() + 2;
buttonWidth = kBigButtonWidth;
buttonHeight = kBigButtonHeight;
} else {
ws = GUI::kNormalWidgetSize;
- font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
- lineHeight = font->getFontHeight() + 2;
buttonWidth = kButtonWidth;
buttonHeight = kButtonHeight;
}
@@ -64,7 +59,7 @@ MessageDialog::MessageDialog(const Common::String &message, const char *defaultB
// the real size of the dialog
Common::StringList lines;
int lineCount, okButtonPos, cancelButtonPos;
- int maxlineWidth = font->wordWrapText(message, screenW - 2 * 20, lines);
+ int maxlineWidth = g_gui.getFont().wordWrapText(message, screenW - 2 * 20, lines);
// Calculate the desired dialog size (maxing out at 300*180 for now)
_w = maxlineWidth + 20;
@@ -75,10 +70,10 @@ MessageDialog::MessageDialog(const Common::String &message, const char *defaultB
_h += buttonHeight + 8;
// Limit the number of lines so that the dialog still fits on the screen.
- if (lineCount > (screenH - 20 - _h) / lineHeight) {
- lineCount = (screenH - 20 - _h) / lineHeight;
+ if (lineCount > (screenH - 20 - _h) / kLineHeight) {
+ lineCount = (screenH - 20 - _h) / kLineHeight;
}
- _h += lineCount * lineHeight;
+ _h += lineCount * kLineHeight;
// Center the dialog
_x = (screenW - _w) / 2;
@@ -86,7 +81,7 @@ MessageDialog::MessageDialog(const Common::String &message, const char *defaultB
// Each line is represented by one static text item.
for (int i = 0; i < lineCount; i++) {
- new StaticTextWidget(this, 10, 10 + i * lineHeight, maxlineWidth, lineHeight,
+ new StaticTextWidget(this, 10, 10 + i * kLineHeight, maxlineWidth, kLineHeight,
lines[i], kTextAlignCenter, ws);
}
diff --git a/gui/options.cpp b/gui/options.cpp
index 63a11a80d4..d8ab663098 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -439,18 +439,10 @@ int OptionsDialog::addVolumeControls(GuiObject *boss, int yoffset, WidgetSize ws
"Speech volume:"
};
- const Graphics::Font *font;
-
- if (ws == kBigWidgetSize) {
- font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
- } else {
- font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
- }
-
int textwidth = 0;
for (int i = 0; i < ARRAYSIZE(slider_labels); i++) {
- int width = font->getStringWidth(slider_labels[i]);
+ int width = g_gui.getStringWidth(slider_labels[i]);
if (width > textwidth)
textwidth = width;