diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/EditTextWidget.cpp | 2 | ||||
-rw-r--r-- | gui/ListWidget.cpp | 2 | ||||
-rw-r--r-- | gui/PopUpWidget.cpp | 2 | ||||
-rw-r--r-- | gui/PopUpWidget.h | 2 | ||||
-rw-r--r-- | gui/ScrollBarWidget.cpp | 18 | ||||
-rw-r--r-- | gui/ScrollBarWidget.h | 2 | ||||
-rw-r--r-- | gui/TabWidget.cpp | 18 | ||||
-rw-r--r-- | gui/TabWidget.h | 2 | ||||
-rw-r--r-- | gui/about.cpp | 4 | ||||
-rw-r--r-- | gui/browser.cpp | 10 | ||||
-rw-r--r-- | gui/chooser.cpp | 2 | ||||
-rw-r--r-- | gui/console.cpp | 14 | ||||
-rw-r--r-- | gui/console.h | 5 | ||||
-rw-r--r-- | gui/dialog.cpp | 4 | ||||
-rw-r--r-- | gui/launcher.cpp | 16 | ||||
-rw-r--r-- | gui/message.cpp | 20 | ||||
-rw-r--r-- | gui/newgui.cpp | 16 | ||||
-rw-r--r-- | gui/newgui.h | 2 | ||||
-rw-r--r-- | gui/options.cpp | 37 | ||||
-rw-r--r-- | gui/options.h | 2 | ||||
-rw-r--r-- | gui/widget.cpp | 10 | ||||
-rw-r--r-- | gui/widget.h | 2 |
22 files changed, 94 insertions, 98 deletions
diff --git a/gui/EditTextWidget.cpp b/gui/EditTextWidget.cpp index 28b2709954..b1096e3edf 100644 --- a/gui/EditTextWidget.cpp +++ b/gui/EditTextWidget.cpp @@ -24,7 +24,7 @@ #include "newgui.h" EditTextWidget::EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text) - : StaticTextWidget(boss, x, y-1, w, h+2, text, kTextAlignLeft), _backupString(text) { + : StaticTextWidget(boss, x, y - 1, w, h + 2, text, kTextAlignLeft), _backupString(text) { _flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE; _type = kEditTextWidget; diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp index d83042bf04..860c516c30 100644 --- a/gui/ListWidget.cpp +++ b/gui/ListWidget.cpp @@ -39,7 +39,7 @@ ListWidget::ListWidget(GuiObject *boss, int x, int y, int w, int h) _caretVisible = false; _caretTime = 0; - + // FIXME: This flag should come from widget definition _editable = true; diff --git a/gui/PopUpWidget.cpp b/gui/PopUpWidget.cpp index 127a3ec9c5..7d71a3cab4 100644 --- a/gui/PopUpWidget.cpp +++ b/gui/PopUpWidget.cpp @@ -273,7 +273,7 @@ PopUpWidget::PopUpWidget(GuiObject *boss, int x, int y, int w, int h, const Stri _type = kPopUpWidget; _selectedItem = -1; - + if (!_label.isEmpty() && _labelWidth == 0) _labelWidth = g_gui.getStringWidth(_label); } diff --git a/gui/PopUpWidget.h b/gui/PopUpWidget.h index 963485e28d..f701e44984 100644 --- a/gui/PopUpWidget.h +++ b/gui/PopUpWidget.h @@ -39,7 +39,7 @@ enum { class PopUpWidget : public Widget, public CommandSender { friend class PopUpDialog; typedef Common::String String; - + struct Entry { String name; uint32 tag; diff --git a/gui/ScrollBarWidget.cpp b/gui/ScrollBarWidget.cpp index 287f058303..94af39a56d 100644 --- a/gui/ScrollBarWidget.cpp +++ b/gui/ScrollBarWidget.cpp @@ -224,24 +224,24 @@ void ScrollBarWidget::drawWidget(bool hilite) { // Up arrow gui->frameRect(_x, _y, _w, UP_DOWN_BOX_HEIGHT, gui->_color); gui->drawBitmap(up_arrow, _x, _y, - isSinglePage ? gui->_color : - (hilite && _part == kUpArrowPart) ? gui->_textcolorhi : gui->_textcolor); + isSinglePage ? gui->_color : + (hilite && _part == kUpArrowPart) ? gui->_textcolorhi : gui->_textcolor); // Down arrow gui->frameRect(_x, bottomY - UP_DOWN_BOX_HEIGHT, _w, UP_DOWN_BOX_HEIGHT, gui->_color); gui->drawBitmap(down_arrow, _x, bottomY - UP_DOWN_BOX_HEIGHT, - isSinglePage ? gui->_color : - (hilite && _part == kDownArrowPart) ? gui->_textcolorhi : gui->_textcolor); + isSinglePage ? gui->_color : + (hilite && _part == kDownArrowPart) ? gui->_textcolorhi : gui->_textcolor); // Slider if (!isSinglePage) { gui->fillRect(_x, _y + _sliderPos, _w, _sliderHeight, - (hilite && _part == kSliderPart) ? gui->_textcolorhi : gui->_textcolor); + (hilite && _part == kSliderPart) ? gui->_textcolorhi : gui->_textcolor); gui->frameRect(_x, _y + _sliderPos, _w, _sliderHeight, gui->_color); - int y = _y + _sliderPos + _sliderHeight/2; + int y = _y + _sliderPos + _sliderHeight / 2; NewGuiColor color = (hilite && _part == kSliderPart) ? gui->_color : gui->_shadowcolor; - gui->hLine(_x+2, y-2, _x+_w-3, color); - gui->hLine(_x+2, y, _x+_w-3, color); - gui->hLine(_x+2, y+2, _x+_w-3, color); + gui->hLine(_x + 2, y - 2, _x + _w - 3, color); + gui->hLine(_x + 2, y, _x + _w - 3, color); + gui->hLine(_x + 2, y + 2, _x + _w-3, color); } } diff --git a/gui/ScrollBarWidget.h b/gui/ScrollBarWidget.h index 5787da4229..4732d22667 100644 --- a/gui/ScrollBarWidget.h +++ b/gui/ScrollBarWidget.h @@ -66,7 +66,7 @@ public: void handleMouseEntered(int button) { setFlags(WIDGET_HILITED); } void handleMouseLeft(int button) { clearFlags(WIDGET_HILITED); _part = kNoPart; draw(); } void handleTickle(); - + // FIXME - this should be private, but then we also have to add accessors // for _numEntries, _entriesPerPage and _currentPos. This again leads to the question: // should these accessors force a redraw? diff --git a/gui/TabWidget.cpp b/gui/TabWidget.cpp index 934179a441..40d3a69d2f 100644 --- a/gui/TabWidget.cpp +++ b/gui/TabWidget.cpp @@ -26,7 +26,7 @@ enum { kTabHeight = 15, - + kTabLeftOffset = 4, kTabSpacing = 2, kTabPadding = 3 @@ -34,11 +34,11 @@ enum { TabWidget::TabWidget(GuiObject *boss, int x, int y, int w, int h) : Widget(boss, x, y, w, h) { - + _flags = WIDGET_ENABLED; _type = kTabWidget; _activeTab = -1; - + _tabWidth = 40; } @@ -61,7 +61,7 @@ int TabWidget::addTab(const String &title) { newTab.firstWidget = NULL; _tabs.push_back(newTab); - + int numTabs = _tabs.size(); // Determine the new tab width @@ -71,10 +71,10 @@ int TabWidget::addTab(const String &title) { int maxWidth = (_w - kTabLeftOffset) / numTabs - kTabLeftOffset; if (_tabWidth > maxWidth) _tabWidth = maxWidth; - + // Activate the new tab setActiveTab(numTabs - 1); - + return _activeTab; } @@ -102,7 +102,7 @@ void TabWidget::handleMouseDown(int x, int y, int button, int clickCount) { if (tabID >= _tabs.size()) tabID = -1; } - + // If a tab was clicked, switch to that pane if (tabID >= 0) { setActiveTab(tabID); @@ -120,7 +120,7 @@ void TabWidget::drawWidget(bool hilite) { NewGui *gui = &g_gui; // Draw horizontal line - gui->hLine(_x+1, _y + kTabHeight - 2, _x + _w - 2, gui->_shadowcolor); + gui->hLine(_x + 1, _y + kTabHeight - 2, _x + _w - 2, gui->_shadowcolor); // Iterate over all tabs and draw them int i, x = _x + kTabLeftOffset; @@ -128,7 +128,7 @@ void TabWidget::drawWidget(bool hilite) { NewGuiColor color = (i == _activeTab) ? gui->_color : gui->_shadowcolor; int yOffset = (i == _activeTab) ? 0 : 2; gui->box(x, _y + yOffset, _tabWidth, kTabHeight - yOffset, color, color); - gui->drawString(_tabs[i].title, x + kTabPadding, _y + yOffset/2 + 4, _tabWidth - 2 * kTabPadding, gui->_textcolor, kTextAlignCenter); + gui->drawString(_tabs[i].title, x + kTabPadding, _y + yOffset / 2 + 4, _tabWidth - 2 * kTabPadding, gui->_textcolor, kTextAlignCenter); x += _tabWidth + kTabSpacing; } diff --git a/gui/TabWidget.h b/gui/TabWidget.h index 938da76513..e8de6766a6 100644 --- a/gui/TabWidget.h +++ b/gui/TabWidget.h @@ -40,7 +40,7 @@ protected: public: TabWidget(GuiObject *boss, int x, int y, int w, int h); ~TabWidget(); - + virtual int16 getChildY() const; // use Dialog::releaseFocus() when changing to another tab diff --git a/gui/about.cpp b/gui/about.cpp index addb91e660..258f715db8 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -26,8 +26,8 @@ AboutDialog::AboutDialog() : Dialog(10, 20, 300, 144) { - addButton((_w - kButtonWidth)/2, 120, "OK", kCloseCmd, '\r'); // Close dialog - FIXME - + addButton((_w - kButtonWidth) / 2, 120, "OK", kCloseCmd, '\r'); // Close dialog - FIXME + Common::String version("ScummVM "); version += gScummVMVersion; new StaticTextWidget(this, 10, 10, _w - 20, kLineHeight, version, kTextAlignCenter); diff --git a/gui/browser.cpp b/gui/browser.cpp index 44d4034068..6bb54a0475 100644 --- a/gui/browser.cpp +++ b/gui/browser.cpp @@ -47,7 +47,7 @@ BrowserDialog::BrowserDialog(const char *title) _choice = NULL; // Headline - TODO: should be customizable during creation time - new StaticTextWidget(this, 10, 8, _w-2 * 10, kLineHeight, title, kTextAlignCenter); + new StaticTextWidget(this, 10, 8, _w - 2 * 10, kLineHeight, title, kTextAlignCenter); // Current path - TODO: handle long paths ? _currentPath = new StaticTextWidget(this, 10, 20, _w - 2 * 10, kLineHeight, @@ -59,8 +59,8 @@ BrowserDialog::BrowserDialog(const char *title) // Buttons addButton(10, _h - 24, "Go up", kGoUpCmd, 0); - addButton(_w-2 * (kButtonWidth+10), _h - 24, "Cancel", kCloseCmd, 0); - addButton(_w-(kButtonWidth+10), _h-24, "Choose", kChooseCmd, 0); + addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); + addButton(_w - (kButtonWidth+10), _h - 24, "Choose", kChooseCmd, 0); } BrowserDialog::~BrowserDialog() { @@ -99,7 +99,7 @@ void BrowserDialog::close() { void BrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { FilesystemNode *tmp; - + switch (cmd) { case kChooseCmd: { // If nothing is selected in the list widget, choose the current dir. @@ -150,7 +150,7 @@ void BrowserDialog::updateListing() { } _fileList->setList(list); _fileList->scrollTo(0); - + // Finally, redraw draw(); } diff --git a/gui/chooser.cpp b/gui/chooser.cpp index 646a3fb7ae..1d6a273185 100644 --- a/gui/chooser.cpp +++ b/gui/chooser.cpp @@ -28,7 +28,7 @@ enum { }; ChooserDialog::ChooserDialog(const String &title, const StringList& list, const String &buttonLabel, int height) - : Dialog(8, (200 - height) / 2, 320 -2 * 8, height) { + : Dialog(8, (200 - height) / 2, 320 - 2 * 8, height) { // Headline new StaticTextWidget(this, 10, 6, _w - 2 * 10, kLineHeight, title, kTextAlignCenter); diff --git a/gui/console.cpp b/gui/console.cpp index cc387dadbc..ec276854e4 100644 --- a/gui/console.cpp +++ b/gui/console.cpp @@ -79,7 +79,7 @@ void ConsoleDialog::reflowLayout() { // _w = _w * kCharWidth + kScrollBarWidth + 2; _h = (uint16)((_heightPercent * g_system->get_overlay_height() - 2) / kLineHeight); _h = _h * kLineHeight + 2; - + // Calculate depending values _lineWidth = (_w - kScrollBarWidth - 2) / kCharWidth; _linesPerPage = (_h - 2) / kLineHeight; @@ -205,7 +205,7 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { int len = _currentPos - _promptStartPos; assert(len >= 0); char *str = new char[len + 1]; - + // Copy the user input to str for (i = 0; i < len; i++) str[i] = _buffer[(_promptStartPos + i) % kBufferSize]; @@ -272,7 +272,7 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { } else if (modifiers == OSystem::KBD_CTRL) { specialKeys(keycode); } else if (isprint((char)ascii)) { - for (i = _promptEndPos-1; i >= _currentPos; i--) + for (i = _promptEndPos - 1; i >= _currentPos; i--) _buffer[(i + 1) % kBufferSize] = _buffer[i % kBufferSize]; _promptEndPos++; putchar((char)ascii); @@ -284,7 +284,7 @@ void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { void ConsoleDialog::insertIntoPrompt(const char* str) { unsigned int l = strlen(str); - for (int i = _promptEndPos-1; i >= _currentPos; i--) + for (int i = _promptEndPos - 1; i >= _currentPos; i--) _buffer[(i + l) % kBufferSize] = _buffer[i % kBufferSize]; for (unsigned int j = 0; j < l; ++j) { @@ -334,7 +334,7 @@ void ConsoleDialog::specialKeys(int keycode) { void ConsoleDialog::killChar() { for (int i = _currentPos; i < _promptEndPos; i++) - _buffer[i % kBufferSize] = _buffer[(i+1) % kBufferSize]; + _buffer[i % kBufferSize] = _buffer[(i + 1) % kBufferSize]; _buffer[_promptEndPos % kBufferSize] = ' '; _promptEndPos--; } @@ -361,7 +361,7 @@ void ConsoleDialog::killLastWord() { } for (int i = _currentPos; i < _promptEndPos; i++) - _buffer[i % kBufferSize] = _buffer[(i+cnt) % kBufferSize]; + _buffer[i % kBufferSize] = _buffer[(i + cnt) % kBufferSize]; _buffer[_promptEndPos % kBufferSize] = ' '; _promptEndPos -= cnt; } @@ -384,7 +384,7 @@ void ConsoleDialog::historyScroll(int direction) { _history[_historyIndex][i] = _buffer[(_promptStartPos + i) % kBufferSize]; _history[_historyIndex][i] = '\0'; } - + // Advance to the next line in the history int line = _historyLine + direction; if ((direction < 0 && line < 0) || (direction > 0 && line > _historySize)) diff --git a/gui/console.h b/gui/console.h index ebe5fc0972..7a422db710 100644 --- a/gui/console.h +++ b/gui/console.h @@ -72,10 +72,9 @@ protected: int _historySize; int _historyIndex; int _historyLine; - - + float _widthPercent, _heightPercent; - + void reflowLayout(); public: diff --git a/gui/dialog.cpp b/gui/dialog.cpp index f5d2c22250..f60728f2c1 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -56,7 +56,7 @@ void Dialog::open() { _result = 0; _visible = true; g_gui.openDialog(this); - + // Search for the first objects that wantsFocus() (if any) and give it the focus while (w && !w->wantsFocus()) { w = w->_next; @@ -239,7 +239,7 @@ void Dialog::handleMouseMoved(int x, int y, int button) { if (!w || !(w->getFlags() & WIDGET_TRACK_MOUSE)) { return; } - + w->handleMouseMoved(x - (w->getAbsX() - _x), y - (w->getAbsY() - _y), button); } diff --git a/gui/launcher.cpp b/gui/launcher.cpp index c1596d95c5..3dac816448 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -127,18 +127,18 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target) yoffset = vBorder; // GUI: Label & edit widget for the game ID - new StaticTextWidget(tab, x, yoffset+2, labelWidth, kLineHeight, "ID: ", kTextAlignRight); - _domainWidget = new EditTextWidget(tab, x+labelWidth, yoffset, _w - labelWidth - 10, kLineHeight, _domain); + new StaticTextWidget(tab, x, yoffset + 2, labelWidth, kLineHeight, "ID: ", kTextAlignRight); + _domainWidget = new EditTextWidget(tab, x + labelWidth, yoffset, _w - labelWidth - 10, kLineHeight, _domain); yoffset += 16; // GUI: Label & edit widget for the description - new StaticTextWidget(tab, x, yoffset+2, labelWidth, kLineHeight, "Name: ", kTextAlignRight); - _descriptionWidget = new EditTextWidget(tab, x+labelWidth, yoffset, _w - labelWidth - 10, kLineHeight, description); + new StaticTextWidget(tab, x, yoffset + 2, labelWidth, kLineHeight, "Name: ", kTextAlignRight); + _descriptionWidget = new EditTextWidget(tab, x + labelWidth, yoffset, _w - labelWidth - 10, kLineHeight, description); yoffset += 16; // GUI: Label for the game path new StaticTextWidget(tab, x, yoffset, labelWidth, kLineHeight, "Path: ", kTextAlignRight); - new StaticTextWidget(tab, x+labelWidth, yoffset, _w - labelWidth - 10, kLineHeight, path, kTextAlignLeft); + new StaticTextWidget(tab, x + labelWidth, yoffset, _w - labelWidth - 10, kLineHeight, path, kTextAlignLeft); yoffset += 16; // Languag popup @@ -393,7 +393,7 @@ void LauncherDialog::addGame() { // an alternate description (to distinguish multiple versions of the // game, e.g. 'Monkey German' and 'Monkey English') and set default // options for that game. - + if (_browser->runModal()) { // User made his choice... FilesystemNode *dir = _browser->getResult(); @@ -449,7 +449,7 @@ void LauncherDialog::addGame() { ConfMan.set("description", result.description, domain); } ConfMan.set("path", dir->path(), domain); - + // Display edit dialog for the new entry EditGameDialog editDialog(domain, result); if (editDialog.runModal()) { @@ -503,7 +503,7 @@ void LauncherDialog::editGame(int item) { // Write config to disk ConfMan.flushToDisk(); - + // Update the ListWidget and force a redraw updateListing(); draw(); diff --git a/gui/message.cpp b/gui/message.cpp index 4d60e876c0..5f42ffe192 100644 --- a/gui/message.cpp +++ b/gui/message.cpp @@ -43,7 +43,7 @@ MessageDialog::MessageDialog(const String &message, const char *defaultButton, c const char *start = str; int lineWidth, maxlineWidth = 0; int lineCount, okButtonPos, cancelButtonPos; - + while (*str) { if (*str == '\n') { lineWidth = addLine(lines, start, str - start); @@ -58,7 +58,7 @@ MessageDialog::MessageDialog(const String &message, const char *defaultButton, c lineWidth = addLine(lines, start, str - start); if (maxlineWidth < lineWidth) maxlineWidth = lineWidth; - + // Calculate the desired dialog size (maxing out at 300*180 for now) _w = maxlineWidth + 20; lineCount = lines.size(); @@ -72,19 +72,19 @@ MessageDialog::MessageDialog(const String &message, const char *defaultButton, c } _x = (320 - _w) / 2; _y = (200 - _h) / 2; - + for (int i = 0; i < lineCount; i++) { - new StaticTextWidget(this, 10, 10+i*kLineHeight, maxlineWidth, kLineHeight, + new StaticTextWidget(this, 10, 10 + i * kLineHeight, maxlineWidth, kLineHeight, lines[i], kTextAlignCenter); } // FIXME - allow for multiple buttons, and return in runModal() which one // was selected. if (defaultButton && altButton) { - okButtonPos = (_w - (kButtonWidth * 2))/2; - cancelButtonPos = ((_w - (kButtonWidth * 2))/2) + kButtonWidth + 10; + okButtonPos = (_w - (kButtonWidth * 2)) / 2; + cancelButtonPos = ((_w - (kButtonWidth * 2)) / 2) + kButtonWidth + 10; } else { - okButtonPos = cancelButtonPos = (_w-kButtonWidth)/2; + okButtonPos = cancelButtonPos = (_w-kButtonWidth) / 2; } if (defaultButton) @@ -112,16 +112,16 @@ int MessageDialog::addLine(StringList &lines, const char *line, int size) { newPos--; if (newPos > start) pos = newPos; - + // Add the substring from intervall [start, i-1] tmp = String(start, pos - start); lines.push_back(tmp); - + // Determine the width of the string, and adjust maxWidth accordingly width = gui->getStringWidth(tmp); if (maxWidth < width) maxWidth = width; - + start = pos; width = 0; } else { diff --git a/gui/newgui.cpp b/gui/newgui.cpp index bf79c81a34..e72520e3d8 100644 --- a/gui/newgui.cpp +++ b/gui/newgui.cpp @@ -338,9 +338,9 @@ void NewGui::blendRect(int x, int y, int w, int h, NewGuiColor color, int level) while (h--) { for (int i = 0; i < w; i++) { _system->colorToRGB(ptr[i], ar, ag, ab); - ptr[i] = _system->RGBToColor((ar+r)/(level+1), - (ag+g)/(level+1), - (ab+b)/(level+1)); + ptr[i] = _system->RGBToColor((ar + r) / (level+1), + (ag + g) / (level+1), + (ab + b) / (level+1)); } ptr += _screenPitch; } @@ -481,15 +481,13 @@ void NewGui::drawString(const String &s, int x, int y, int w, NewGuiColor color, for (; i < s.size(); ++i) { str += s[i]; } - + width = getStringWidth(str); - + } else { str = s; } - - - + if (align == kTextAlignCenter) x = x + (w - width - 1)/2; else if (align == kTextAlignRight) @@ -528,7 +526,7 @@ void NewGui::blitToBuffer(int x, int y, int w, int h, byte *buf, int pitch) { assert(buf); while (h--) { - memcpy(buf, ptr, w*2); + memcpy(buf, ptr, w * 2); ptr += _screenPitch; buf += pitch; } diff --git a/gui/newgui.h b/gui/newgui.h index 09ccd612b2..bba7806c69 100644 --- a/gui/newgui.h +++ b/gui/newgui.h @@ -57,7 +57,7 @@ public: bool empty() const { return _size <= 0; } void push(Dialog *d) { _stack[_size++] = d; } - Dialog *top() const { return _stack[_size-1]; } + Dialog *top() const { return _stack[_size - 1]; } void pop() { if (_size > 0) _stack[--_size] = 0; } int size() const { return _size; } Dialog *operator [](int i) { return _stack[i]; } diff --git a/gui/options.cpp b/gui/options.cpp index 8e995e06e5..eba1161fd1 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -66,7 +66,7 @@ OptionsDialog::OptionsDialog(const String &domain, int x, int y, int w, int h) void OptionsDialog::open() { Dialog::open(); - + // Reset result value setResult(0); @@ -74,7 +74,7 @@ void OptionsDialog::open() { // FIXME - disable GFX popup for now _gfxPopUp->setSelected(0); _gfxPopUp->setEnabled(false); - + // Fullscreen setting _fullscreenCheckbox->setState(ConfMan.getBool("fullscreen", _domain)); @@ -95,25 +95,25 @@ void OptionsDialog::open() { md++; } _midiPopUp->setSelected(md->name ? i : 0); - + // Multi midi setting _multiMidiCheckbox->setState(ConfMan.getBool("multi_midi", _domain)); - + // Native mt32 setting _mt32Checkbox->setState(ConfMan.getBool("native_mt32", _domain)); } - + if (_masterVolumeSlider) { int vol; - + vol = ConfMan.getInt("master_volume", _domain); _masterVolumeSlider->setValue(vol); _masterVolumeLabel->setValue(vol); - + vol = ConfMan.getInt("music_volume", _domain); _musicVolumeSlider->setValue(vol); _musicVolumeLabel->setValue(vol); - + vol = ConfMan.getInt("sfx_volume", _domain); _sfxVolumeSlider->setValue(vol); _sfxVolumeLabel->setValue(vol); @@ -148,7 +148,7 @@ void OptionsDialog::close() { if (_enableAudioSettings) { ConfMan.set("multi_midi", _multiMidiCheckbox->getState(), _domain); ConfMan.set("native_mt32", _mt32Checkbox->getState(), _domain); - + const MidiDriverDescription *md = getAvailableMidiDrivers(); while (md->name && md->id != (int)_midiPopUp->getSelectedTag()) md++; @@ -162,7 +162,7 @@ void OptionsDialog::close() { ConfMan.removeKey("music_driver", _domain); } } - + // Save config file ConfMan.flushToDisk(); } @@ -220,7 +220,6 @@ void OptionsDialog::setVolumeSettingsState(bool enabled) { _sfxVolumeLabel->setEnabled(enabled); } - int OptionsDialog::addGraphicControls(GuiObject *boss, int yoffset) { const int x = 10; const int w = _w - 2 * 10; @@ -291,23 +290,23 @@ int OptionsDialog::addMIDIControls(GuiObject *boss, int yoffset) { int OptionsDialog::addVolumeControls(GuiObject *boss, int yoffset) { // Volume controllers _masterVolumeSlider = new SliderWidget(boss, 5, yoffset, 185, 12, "Master volume: ", 100, kMasterVolumeChanged); - _masterVolumeLabel = new StaticTextWidget(boss, 200, yoffset+2, 24, kLineHeight, "100%", kTextAlignLeft); + _masterVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft); _masterVolumeSlider->setMinValue(0); _masterVolumeSlider->setMaxValue(255); _masterVolumeLabel->setFlags(WIDGET_CLEARBG); yoffset += 16; _musicVolumeSlider = new SliderWidget(boss, 5, yoffset, 185, 12, "Music volume: ", 100, kMusicVolumeChanged); - _musicVolumeLabel = new StaticTextWidget(boss, 200, yoffset+2, 24, kLineHeight, "100%", kTextAlignLeft); + _musicVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft); _musicVolumeSlider->setMinValue(0); _musicVolumeSlider->setMaxValue(255); _musicVolumeLabel->setFlags(WIDGET_CLEARBG); yoffset += 16; _sfxVolumeSlider = new SliderWidget(boss, 5, yoffset, 185, 12, "SFX volume: ", 100, kSfxVolumeChanged); - _sfxVolumeLabel = new StaticTextWidget(boss, 200, yoffset+2, 24, kLineHeight, "100%", kTextAlignLeft); + _sfxVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft); _sfxVolumeSlider->setMinValue(0); _sfxVolumeSlider->setMaxValue(255); _sfxVolumeLabel->setFlags(WIDGET_CLEARBG); yoffset += 16; - + _enableVolumeSettings = true; return yoffset; @@ -351,13 +350,13 @@ GlobalOptionsDialog::GlobalOptionsDialog(GameDetector &detector) #if !( defined(__DC__) || defined(__GP32__) ) // Save game path - new StaticTextWidget(tab, 5, yoffset+2, 100, kLineHeight, "Savegame path: ", kTextAlignRight); - _savePath = new StaticTextWidget(tab, 105, yoffset+2, 180, kLineHeight, "/foo/bar", kTextAlignLeft); - new ButtonWidget(tab, 105, yoffset+14, 64, 16, "Choose...", kChooseSaveDirCmd, 0); + new StaticTextWidget(tab, 5, yoffset + 2, 100, kLineHeight, "Savegame path: ", kTextAlignRight); + _savePath = new StaticTextWidget(tab, 105, yoffset + 2, 180, kLineHeight, "/foo/bar", kTextAlignLeft); + new ButtonWidget(tab, 105, yoffset + 14, 64, 16, "Choose...", kChooseSaveDirCmd, 0); #endif // TODO: joystick setting - + // Activate the first tab tab->setActiveTab(0); diff --git a/gui/options.h b/gui/options.h index 53ea5e76f0..91b6b9f9c9 100644 --- a/gui/options.h +++ b/gui/options.h @@ -52,7 +52,7 @@ protected: int addGraphicControls(GuiObject *boss, int yoffset); int addMIDIControls(GuiObject *boss, int yoffset); int addVolumeControls(GuiObject *boss, int yoffset); - + void setGraphicSettingsState(bool enabled); void setAudioSettingsState(bool enabled); void setVolumeSettingsState(bool enabled); diff --git a/gui/widget.cpp b/gui/widget.cpp index 75254fcfe9..d651bf9475 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -42,7 +42,7 @@ void Widget::draw() { if (!isVisible() || !_boss->isVisible()) return; - + int oldX = _x, oldY = _y; // Account for our relative position in the dialog @@ -140,8 +140,8 @@ void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount) { void ButtonWidget::drawWidget(bool hilite) { NewGui *gui = &g_gui; gui->drawString(_label, _x, _y, _w, - !isEnabled() ? gui->_color : - hilite ? gui->_textcolorhi : gui->_textcolor, _align); + !isEnabled() ? gui->_color : + hilite ? gui->_textcolorhi : gui->_textcolor, _align); } #pragma mark - @@ -249,8 +249,8 @@ void SliderWidget::drawWidget(bool hilite) { // Draw the 'bar' gui->fillRect(_x + _labelWidth + 2, _y + 2, valueToPos(_value), _h - 4, - !isEnabled() ? gui->_color : - hilite ? gui->_textcolorhi : gui->_textcolor); + !isEnabled() ? gui->_color : + hilite ? gui->_textcolorhi : gui->_textcolor); } int SliderWidget::valueToPos(int value) { diff --git a/gui/widget.h b/gui/widget.h index 4a7bc3a021..a0b0bc41bd 100644 --- a/gui/widget.h +++ b/gui/widget.h @@ -111,7 +111,7 @@ protected: virtual void receivedFocusWidget() {} virtual void lostFocusWidget() {} - + virtual Widget *findWidget(int x, int y) { return this; } void releaseFocus() { assert(_boss); _boss->releaseFocus(); } |