ALL: synced with scummvm

This commit is contained in:
Pawel Kolodziejski 2012-04-07 17:58:15 +02:00
parent bf5c20d369
commit 78bacb47bb
19 changed files with 145 additions and 136 deletions

2
TODO
View file

@ -1,3 +1,3 @@
You may find it at the following link: You may find it at the following link:
http://wiki.residualvm.org/index.php?title=TODO http://wiki.residualvm.org/index.php/TODO

View file

@ -72,7 +72,6 @@ public:
virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const; virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const;
#endif #endif
virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = NULL); virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = NULL);
// ResidualVM specific method // ResidualVM specific method
virtual void launcherInitSize(uint w, uint h); virtual void launcherInitSize(uint w, uint h);
// ResidualVM specific method // ResidualVM specific method
@ -107,7 +106,6 @@ public:
virtual void warpMouse(int x, int y); virtual void warpMouse(int x, int y);
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL); virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL);
virtual void setCursorPalette(const byte *colors, uint start, uint num); virtual void setCursorPalette(const byte *colors, uint start, uint num);
// ResidualVM specific method // ResidualVM specific method
virtual bool lockMouse(bool lock); virtual bool lockMouse(bool lock);

View file

@ -206,8 +206,8 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const
// Initialize any game-specific keymaps // Initialize any game-specific keymaps
engine->initKeymap(); engine->initKeymap();
// Set default values to the custom engine options // Set default values for all of the custom engine options
const ExtraGuiOptions engineOptions = (*plugin)->getExtraGuiOptions(ConfMan.getActiveDomainName()); const ExtraGuiOptions engineOptions = (*plugin)->getExtraGuiOptions(Common::String());
for (uint i = 0; i < engineOptions.size(); i++) { for (uint i = 0; i < engineOptions.size(); i++) {
ConfMan.registerDefault(engineOptions[i].configOption, engineOptions[i].defaultState); ConfMan.registerDefault(engineOptions[i].configOption, engineOptions[i].defaultState);
} }

View file

@ -52,7 +52,6 @@ const struct GameOpt {
{ GUIO_MIDIGM, "midiGM" }, { GUIO_MIDIGM, "midiGM" },
{ GUIO_NOASPECT, "noAspect" }, { GUIO_NOASPECT, "noAspect" },
{ GUIO_EGAUNDITHER, "egaUndither" },
{ GUIO_RENDERHERCGREEN, "hercGreen" }, { GUIO_RENDERHERCGREEN, "hercGreen" },
{ GUIO_RENDERHERCAMBER, "hercAmber" }, { GUIO_RENDERHERCAMBER, "hercAmber" },

View file

@ -44,7 +44,6 @@
#define GUIO_MIDIGM "\021" #define GUIO_MIDIGM "\021"
#define GUIO_NOASPECT "\022" #define GUIO_NOASPECT "\022"
#define GUIO_EGAUNDITHER "\023"
#define GUIO_RENDERHERCGREEN "\030" #define GUIO_RENDERHERCGREEN "\030"
#define GUIO_RENDERHERCAMBER "\031" #define GUIO_RENDERHERCAMBER "\031"

View file

@ -171,12 +171,21 @@ const ExtraGuiOptions AdvancedMetaEngine::getExtraGuiOptions(const Common::Strin
if (!_extraGuiOptions) if (!_extraGuiOptions)
return ExtraGuiOptions(); return ExtraGuiOptions();
ExtraGuiOptions options;
// If there isn't any target specified, return all available GUI options.
// Only used when an engine starts in order to set option defaults.
if (target.empty()) {
for (const ADExtraGuiOptionsMap *entry = _extraGuiOptions; entry->guioFlag; ++entry)
options.push_back(entry->option);
return options;
}
// Query the GUI options // Query the GUI options
const Common::String guiOptionsString = ConfMan.get("guioptions", target); const Common::String guiOptionsString = ConfMan.get("guioptions", target);
const Common::String guiOptions = parseGameGUIOptions(guiOptionsString); const Common::String guiOptions = parseGameGUIOptions(guiOptionsString);
ExtraGuiOptions options;
// Add all the applying extra GUI options. // Add all the applying extra GUI options.
for (const ADExtraGuiOptionsMap *entry = _extraGuiOptions; entry->guioFlag; ++entry) { for (const ADExtraGuiOptionsMap *entry = _extraGuiOptions; entry->guioFlag; ++entry) {
if (guiOptions.contains(entry->guioFlag)) if (guiOptions.contains(entry->guioFlag))

View file

@ -295,7 +295,7 @@ Graphics::Surface *Surface::convertTo(const PixelFormat &dstFormat, const byte *
assert(palette); assert(palette);
for (int y = 0; y < h; y++) { for (int y = 0; y < h; y++) {
const byte *srcRow = (byte *)getBasePtr(0, y); const byte *srcRow = (const byte *)getBasePtr(0, y);
byte *dstRow = (byte *)surface->getBasePtr(0, y); byte *dstRow = (byte *)surface->getBasePtr(0, y);
for (int x = 0; x < w; x++) { for (int x = 0; x < w; x++) {
@ -317,7 +317,7 @@ Graphics::Surface *Surface::convertTo(const PixelFormat &dstFormat, const byte *
} else { } else {
// Converting from high color to high color // Converting from high color to high color
for (int y = 0; y < h; y++) { for (int y = 0; y < h; y++) {
const byte *srcRow = (byte *)getBasePtr(0, y); const byte *srcRow = (const byte *)getBasePtr(0, y);
byte *dstRow = (byte *)surface->getBasePtr(0, y); byte *dstRow = (byte *)surface->getBasePtr(0, y);
for (int x = 0; x < w; x++) { for (int x = 0; x < w; x++) {

View file

@ -35,7 +35,7 @@
#include "graphics/pixelformat.h" #include "graphics/pixelformat.h"
#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.10" #define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.11"
class OSystem; class OSystem;

View file

@ -367,8 +367,7 @@ void EditGameDialog::open() {
e = ConfMan.hasKey("gfx_mode", _domain) || e = ConfMan.hasKey("gfx_mode", _domain) ||
ConfMan.hasKey("render_mode", _domain) || ConfMan.hasKey("render_mode", _domain) ||
ConfMan.hasKey("fullscreen", _domain) || ConfMan.hasKey("fullscreen", _domain) ||
ConfMan.hasKey("aspect_ratio", _domain) || ConfMan.hasKey("aspect_ratio", _domain);
ConfMan.hasKey("disable_dithering", _domain);
_globalGraphicsOverride->setState(e); _globalGraphicsOverride->setState(e);
e = ConfMan.hasKey("music_driver", _domain) || e = ConfMan.hasKey("music_driver", _domain) ||

View file

@ -34,7 +34,9 @@
#include "common/file.h" #include "common/file.h"
#include "common/savefile.h" #include "common/savefile.h"
using namespace Common; #ifdef __DS__
#include "backends/platform/ds/arm9/source/wordcompletion.h"
#endif
namespace GUI { namespace GUI {
@ -67,21 +69,21 @@ enum {
PredictiveDialog::PredictiveDialog() : Dialog("Predictive") { PredictiveDialog::PredictiveDialog() : Dialog("Predictive") {
new StaticTextWidget(this, "Predictive.Headline", "Enter Text"); new StaticTextWidget(this, "Predictive.Headline", "Enter Text");
new ButtonWidget(this, "Predictive.Cancel" , _("Cancel") , 0, kCancelCmd); new ButtonWidget(this, "Predictive.Cancel" , _("Cancel"), 0, kCancelCmd);
new ButtonWidget(this, "Predictive.OK" , _("Ok") , 0, kOkCmd); new ButtonWidget(this, "Predictive.OK" , _("Ok") , 0, kOkCmd);
new ButtonWidget(this, "Predictive.Button1", "1 `-.&" , 0, kBut1Cmd); new ButtonWidget(this, "Predictive.Button1", "1 `-.&" , 0, kBut1Cmd);
new ButtonWidget(this, "Predictive.Button2", "2 abc" , 0, kBut2Cmd); new ButtonWidget(this, "Predictive.Button2", "2 abc" , 0, kBut2Cmd);
new ButtonWidget(this, "Predictive.Button3", "3 def" , 0, kBut3Cmd); new ButtonWidget(this, "Predictive.Button3", "3 def" , 0, kBut3Cmd);
new ButtonWidget(this, "Predictive.Button4", "4 ghi" , 0, kBut4Cmd); new ButtonWidget(this, "Predictive.Button4", "4 ghi" , 0, kBut4Cmd);
new ButtonWidget(this, "Predictive.Button5", "5 jkl" , 0, kBut5Cmd); new ButtonWidget(this, "Predictive.Button5", "5 jkl" , 0, kBut5Cmd);
new ButtonWidget(this, "Predictive.Button6", "6 mno" , 0, kBut6Cmd); new ButtonWidget(this, "Predictive.Button6", "6 mno" , 0, kBut6Cmd);
new ButtonWidget(this, "Predictive.Button7", "7 pqrs" , 0, kBut7Cmd); new ButtonWidget(this, "Predictive.Button7", "7 pqrs" , 0, kBut7Cmd);
new ButtonWidget(this, "Predictive.Button8", "8 tuv" , 0, kBut8Cmd); new ButtonWidget(this, "Predictive.Button8", "8 tuv" , 0, kBut8Cmd);
new ButtonWidget(this, "Predictive.Button9", "9 wxyz" , 0, kBut9Cmd); new ButtonWidget(this, "Predictive.Button9", "9 wxyz" , 0, kBut9Cmd);
new ButtonWidget(this, "Predictive.Button0", "0" , 0, kBut0Cmd); new ButtonWidget(this, "Predictive.Button0", "0" , 0, kBut0Cmd);
// I18N: You must leave "#" as is, only word 'next' is translatable // I18N: You must leave "#" as is, only word 'next' is translatable
new ButtonWidget(this, "Predictive.Next" , _("# next") , 0, kNextCmd); new ButtonWidget(this, "Predictive.Next" , _("# next"), 0, kNextCmd);
_addBtn = new ButtonWidget(this, "Predictive.Add", _("add") , 0, kAddCmd); _addBtn = new ButtonWidget(this, "Predictive.Add", _("add"), 0, kAddCmd);
_addBtn->setEnabled(false); _addBtn->setEnabled(false);
#ifndef DISABLE_FANCY_THEMES #ifndef DISABLE_FANCY_THEMES
@ -89,7 +91,7 @@ PredictiveDialog::PredictiveDialog() : Dialog("Predictive") {
((PicButtonWidget *)_delbtn)->useThemeTransparency(true); ((PicButtonWidget *)_delbtn)->useThemeTransparency(true);
((PicButtonWidget *)_delbtn)->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageDelbtn)); ((PicButtonWidget *)_delbtn)->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageDelbtn));
#endif #endif
_delbtn = new ButtonWidget(this, "Predictive.Delete" , _("<") , 0, kDelCmd); _delbtn = new ButtonWidget(this, "Predictive.Delete" , _("<"), 0, kDelCmd);
// I18N: Pre means 'Predictive', leave '*' as is // I18N: Pre means 'Predictive', leave '*' as is
_modebutton = new ButtonWidget(this, "Predictive.Pre", _("* Pre"), 0, kModeCmd); _modebutton = new ButtonWidget(this, "Predictive.Pre", _("* Pre"), 0, kModeCmd);
_edittext = new EditTextWidget(this, "Predictive.Word", _search, 0, 0, 0); _edittext = new EditTextWidget(this, "Predictive.Word", _search, 0, 0, 0);
@ -110,7 +112,7 @@ PredictiveDialog::PredictiveDialog() : Dialog("Predictive") {
_predictiveDict.dictLine = NULL; _predictiveDict.dictLine = NULL;
_predictiveDict.dictText = NULL; _predictiveDict.dictText = NULL;
_predictiveDict.dictLineCount = 0; _predictiveDict.dictLineCount = 0;
if (!_predictiveDict.dictText) { if (!_predictiveDict.dictText) {
loadAllDictionary(_predictiveDict); loadAllDictionary(_predictiveDict);
if (!_predictiveDict.dictText) if (!_predictiveDict.dictText)
@ -140,7 +142,7 @@ PredictiveDialog::PredictiveDialog() : Dialog("Predictive") {
_currentWord.clear(); _currentWord.clear();
_wordNumber = 0; _wordNumber = 0;
_numMatchingWords = 0; _numMatchingWords = 0;
_lastbutton = kNoAct; _lastbutton = kNoAct;
_mode = kModePre; _mode = kModePre;
@ -306,7 +308,7 @@ void PredictiveDialog::handleKeyDown(Common::KeyState state) {
} }
} }
void PredictiveDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { void PredictiveDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
ButtonId act = kNoAct; ButtonId act = kNoAct;
_navigationwithkeys = false; _navigationwithkeys = false;
@ -372,24 +374,30 @@ void PredictiveDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 d
void PredictiveDialog::processBtnActive(ButtonId button) { void PredictiveDialog::processBtnActive(ButtonId button) {
uint8 x; uint8 x;
const char *buttonStr[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" }; static const char *const buttonStr[] = {
const char *buttons[] = { "1", "2", "3",
"'-.&", "abc", "def", "4", "5", "6",
"ghi", "jkl", "mno", "7", "8", "9",
"pqrs", "tuv", "wxyz", "0"
"next", "add", };
"<",
"Cancel", "OK", static const char *const buttons[] = {
"Pre", "(0) ", NULL "'-.&", "abc", "def",
"ghi", "jkl", "mno",
"pqrs", "tuv", "wxyz",
"next", "add",
"<",
"Cancel", "OK",
"Pre", "(0) ", NULL
}; };
if (_mode == kModeAbc) { if (_mode == kModeAbc) {
if (button >= kBtn1Act && button <= kBtn9Act ) { if (button >= kBtn1Act && button <= kBtn9Act) {
if (!_lastTime) if (!_lastTime)
_lastTime = g_system->getMillis(); _lastTime = g_system->getMillis();
if (_lastPressBtn == button) { if (_lastPressBtn == button) {
_curTime = g_system->getMillis(); _curTime = g_system->getMillis();
if((_curTime - _lastTime) < kRepeatDelay) { if ((_curTime - _lastTime) < kRepeatDelay) {
button = kNextAct; button = kNextAct;
_lastTime = _curTime; _lastTime = _curTime;
} else { } else {
@ -425,13 +433,13 @@ void PredictiveDialog::processBtnActive(ButtonId button) {
if (_currentCode.size()) { if (_currentCode.size()) {
_repeatcount[_currentCode.size() - 1] = 0; _repeatcount[_currentCode.size() - 1] = 0;
_currentCode.deleteLastChar(); _currentCode.deleteLastChar();
if(_currentCode == Common::String("")) if (_currentCode.empty())
_currentWord.clear(); _currentWord.clear();
} else { } else {
if (_prefix.size()) if (_prefix.size())
_prefix.deleteLastChar(); _prefix.deleteLastChar();
} }
} else if (_prefix.size() + _currentCode.size() < MAXWORDLEN - 1) { // don't overflow the dialog line } else if (_prefix.size() + _currentCode.size() < kMaxWordLen - 1) { // don't overflow the dialog line
if (button == kBtn0Act) { // zero if (button == kBtn0Act) { // zero
_currentCode += buttonStr[9]; _currentCode += buttonStr[9];
} else { } else {
@ -461,26 +469,26 @@ void PredictiveDialog::processBtnActive(ButtonId button) {
if (_mode == kModePre) { if (_mode == kModePre) {
if (_unitedDict.dictActLine && _numMatchingWords > 1) { if (_unitedDict.dictActLine && _numMatchingWords > 1) {
_wordNumber = (_wordNumber + 1) % _numMatchingWords; _wordNumber = (_wordNumber + 1) % _numMatchingWords;
char tmp[MAXLINELEN]; char tmp[kMaxLineLen];
strncpy(tmp, _unitedDict.dictActLine, MAXLINELEN); strncpy(tmp, _unitedDict.dictActLine, kMaxLineLen);
tmp[MAXLINELEN - 1] = 0; tmp[kMaxLineLen - 1] = 0;
char *tok = strtok(tmp, " "); char *tok = strtok(tmp, " ");
for (uint8 i = 0; i <= _wordNumber; i++) for (uint8 i = 0; i <= _wordNumber; i++)
tok = strtok(NULL, " "); tok = strtok(NULL, " ");
_currentWord = Common::String(tok, _currentCode.size()); _currentWord = Common::String(tok, _currentCode.size());
} }
} else if (_mode == kModeAbc) { } else if (_mode == kModeAbc) {
x = _currentCode.size(); x = _currentCode.size();
if (x) { if (x) {
if (_currentCode.lastChar() == '1' || _currentCode.lastChar() == '7' || _currentCode.lastChar() == '9') if (_currentCode.lastChar() == '1' || _currentCode.lastChar() == '7' || _currentCode.lastChar() == '9')
_repeatcount[x - 1] = (_repeatcount[x - 1] + 1) % 4; _repeatcount[x - 1] = (_repeatcount[x - 1] + 1) % 4;
else else
_repeatcount[x - 1] = (_repeatcount[x - 1] + 1) % 3; _repeatcount[x - 1] = (_repeatcount[x - 1] + 1) % 3;
if (_currentCode.lastChar() >= '1') if (_currentCode.lastChar() >= '1')
_currentWord.setChar(buttons[_currentCode[x - 1] - '1'][_repeatcount[x - 1]], x-1); _currentWord.setChar(buttons[_currentCode[x - 1] - '1'][_repeatcount[x - 1]], x - 1);
}
} }
}
} else if (button == kAddAct) { // add } else if (button == kAddAct) { // add
if (_mode == kModeAbc) if (_mode == kModeAbc)
addWordToDict(); addWordToDict();
@ -490,17 +498,21 @@ void PredictiveDialog::processBtnActive(ButtonId button) {
// bring MRU word at the top of the list when ok'ed out of the dialog // bring MRU word at the top of the list when ok'ed out of the dialog
if (_mode == kModePre && _unitedDict.dictActLine && _numMatchingWords > 1 && _wordNumber != 0) if (_mode == kModePre && _unitedDict.dictActLine && _numMatchingWords > 1 && _wordNumber != 0)
bringWordtoTop(_unitedDict.dictActLine, _wordNumber); bringWordtoTop(_unitedDict.dictActLine, _wordNumber);
goto press;
} else if (button == kModeAct) { // Mode } else if (button == kModeAct) { // Mode
_mode++; _mode++;
_addBtn->setEnabled(false); _addBtn->setEnabled(false);
if (_mode > kModeAbc) { if (_mode > kModeAbc) {
_mode = kModePre; _mode = kModePre;
// I18N: Pre means 'Predictive', leave '*' as is // I18N: Pre means 'Predictive', leave '*' as is
_modebutton->setLabel("* Pre"); _modebutton->setLabel("* Pre");
// I18N: 'Num' means Numbers, 'Abc' means Latin alphabet input } else if (_mode == kModeNum) {
} else (_mode == kModeNum) ? _modebutton->setLabel("* Num") : (_modebutton->setLabel("* Abc"), _addBtn->setEnabled(true)); // I18N: 'Num' means Numbers
_modebutton->setLabel("* Num");
} else {
// I18N: 'Abc' means Latin alphabet input
_modebutton->setLabel("* Abc");
_addBtn->setEnabled(true);
}
// truncate current input at mode change // truncate current input at mode change
strncpy(_temp, _currentWord.c_str(), _currentCode.size()); strncpy(_temp, _currentWord.c_str(), _currentCode.size());
@ -509,26 +521,29 @@ void PredictiveDialog::processBtnActive(ButtonId button) {
_currentCode.clear(); _currentCode.clear();
_currentWord.clear(); _currentWord.clear();
memset(_repeatcount, 0, sizeof(_repeatcount)); memset(_repeatcount, 0, sizeof(_repeatcount));
_lastTime = 0; _lastTime = 0;
_lastPressBtn = kNoAct; _lastPressBtn = kNoAct;
_curTime = 0; _curTime = 0;
} else {
goto press;
} }
} }
press:
pressEditText(); pressEditText();
if (button == kOkAct) close(); if (button == kOkAct)
close();
} }
void PredictiveDialog::handleTickle() { void PredictiveDialog::handleTickle() {
if (!_lastTime) // TODO/FIXME: This code does not seem to make any sense. It is only
// triggered when _lastTime is zero and sets _lastTime to zero again
// under some condition. This should really be a nop. Probably this
// code intends to check "_lastTime" instead of "!_lastTime".
if (!_lastTime) {
if ((_curTime - _lastTime) > kRepeatDelay) { if ((_curTime - _lastTime) > kRepeatDelay) {
_lastTime = 0; _lastTime = 0;
} }
}
} }
void PredictiveDialog::mergeDicts() { void PredictiveDialog::mergeDicts() {
@ -564,9 +579,9 @@ void PredictiveDialog::mergeDicts() {
} }
} }
uint8 PredictiveDialog::countWordsInString(char *str) { uint8 PredictiveDialog::countWordsInString(const char *const str) {
// Count the number of (space separated) words in the given string. // Count the number of (space separated) words in the given string.
char *ptr; const char *ptr;
if (!str) if (!str)
return 0; return 0;
@ -591,12 +606,12 @@ void PredictiveDialog::bringWordtoTop(char *str, int wordnum) {
// by moving the word at position 'wordnum' to the front (that is, right behind // by moving the word at position 'wordnum' to the front (that is, right behind
// right behind the numerical code word at the start of the line). // right behind the numerical code word at the start of the line).
Common::Array<Common::String> words; Common::Array<Common::String> words;
char buf[MAXLINELEN]; char buf[kMaxLineLen];
if (!str) if (!str)
return; return;
strncpy(buf, str, MAXLINELEN); strncpy(buf, str, kMaxLineLen);
buf[MAXLINELEN - 1] = 0; buf[kMaxLineLen - 1] = 0;
char *word = strtok(buf, " "); char *word = strtok(buf, " ");
if (!word) { if (!word) {
debug("Predictive Dialog: Invalid dictionary line"); debug("Predictive Dialog: Invalid dictionary line");
@ -610,12 +625,12 @@ void PredictiveDialog::bringWordtoTop(char *str, int wordnum) {
Common::String tmp; Common::String tmp;
for (uint8 i = 0; i < words.size(); i++) for (uint8 i = 0; i < words.size(); i++)
tmp += words[i] + " "; tmp += words[i] + " ";
tmp.deleteLastChar(); tmp.deleteLastChar();
memcpy(str, tmp.c_str(), strlen(str)); memcpy(str, tmp.c_str(), strlen(str));
} }
int PredictiveDialog::binarySearch(char **dictLine, const String &code, int dictLineCount) { int PredictiveDialog::binarySearch(const char *const *const dictLine, const Common::String &code, const int dictLineCount) {
int hi = dictLineCount - 1; int hi = dictLineCount - 1;
int lo = 0; int lo = 0;
int line = 0; int line = 0;
@ -644,7 +659,7 @@ bool PredictiveDialog::matchWord() {
return false; return false;
// If the currently entered text is too long, it cannot match anything. // If the currently entered text is too long, it cannot match anything.
if (_currentCode.size() > MAXWORDLEN) if (_currentCode.size() > kMaxWordLen)
return false; return false;
// The entries in the dictionary consist of a code, a space, and then // The entries in the dictionary consist of a code, a space, and then
@ -664,9 +679,9 @@ bool PredictiveDialog::matchWord() {
_currentWord.clear(); _currentWord.clear();
_wordNumber = 0; _wordNumber = 0;
if (0 == strncmp(_unitedDict.dictLine[line], _currentCode.c_str(), _currentCode.size())) { if (0 == strncmp(_unitedDict.dictLine[line], _currentCode.c_str(), _currentCode.size())) {
char tmp[MAXLINELEN]; char tmp[kMaxLineLen];
strncpy(tmp, _unitedDict.dictLine[line], MAXLINELEN); strncpy(tmp, _unitedDict.dictLine[line], kMaxLineLen);
tmp[MAXLINELEN - 1] = 0; tmp[kMaxLineLen - 1] = 0;
char *tok = strtok(tmp, " "); char *tok = strtok(tmp, " ");
tok = strtok(NULL, " "); tok = strtok(NULL, " ");
_currentWord = Common::String(tok, _currentCode.size()); _currentWord = Common::String(tok, _currentCode.size());
@ -676,13 +691,13 @@ bool PredictiveDialog::matchWord() {
} }
} }
bool PredictiveDialog::searchWord(char *where, const String &whatCode) { bool PredictiveDialog::searchWord(const char *const where, const Common::String &whatCode) {
char *ptr = where; const char *ptr = where;
ptr += whatCode.size(); ptr += whatCode.size();
char *newPtr; const char *newPtr;
bool is = false; bool is = false;
while((newPtr = strchr(ptr, ' '))) { while ((newPtr = strchr(ptr, ' '))) {
if (0 == strncmp(ptr, _currentWord.c_str(), newPtr - ptr)) { if (0 == strncmp(ptr, _currentWord.c_str(), newPtr - ptr)) {
is = true; is = true;
break; break;
@ -697,7 +712,7 @@ bool PredictiveDialog::searchWord(char *where, const String &whatCode) {
return is; return is;
} }
void PredictiveDialog::addWord(Dict &dict, const String &word, const String &code) { void PredictiveDialog::addWord(Dict &dict, const Common::String &word, const Common::String &code) {
char *newLine; char *newLine;
Common::String tmpCode = code + ' '; Common::String tmpCode = code + ' ';
int line = binarySearch(dict.dictLine, tmpCode, dict.dictLineCount); int line = binarySearch(dict.dictLine, tmpCode, dict.dictLineCount);
@ -729,22 +744,22 @@ void PredictiveDialog::addWord(Dict &dict, const String &word, const String &cod
} }
} else { // if we didn't find the code, we need to INSERT new line with code and word } else { // if we didn't find the code, we need to INSERT new line with code and word
if (dict.nameDict == "user_dictionary") { if (dict.nameDict == "user_dictionary") {
// if we must INSERT new line(code and word) to user_dictionary, we need to // if we must INSERT new line(code and word) to user_dictionary, we need to
// check if there is a line that we want to INSERT in predictive dictionay // check if there is a line that we want to INSERT in predictive dictionay
int predictLine = binarySearch(_predictiveDict.dictLine, tmpCode, _predictiveDict.dictLineCount); int predictLine = binarySearch(_predictiveDict.dictLine, tmpCode, _predictiveDict.dictLineCount);
if (predictLine >= 0) { if (predictLine >= 0) {
if (searchWord(_predictiveDict.dictLine[predictLine], tmpCode)) { if (searchWord(_predictiveDict.dictLine[predictLine], tmpCode)) {
// if code and word is in predictive dictionary, we need to copy // if code and word is in predictive dictionary, we need to copy
// this line to user dictionary // this line to user dictionary
int len = (predictLine == _predictiveDict.dictLineCount - 1) ? &_predictiveDict.dictText[_predictiveDict.dictTextSize] - _predictiveDict.dictLine[predictLine] : int len = (predictLine == _predictiveDict.dictLineCount - 1) ? &_predictiveDict.dictText[_predictiveDict.dictTextSize] - _predictiveDict.dictLine[predictLine] :
_predictiveDict.dictLine[predictLine + 1] - _predictiveDict.dictLine[predictLine]; _predictiveDict.dictLine[predictLine + 1] - _predictiveDict.dictLine[predictLine];
newLine = (char *)malloc(len); newLine = (char *)malloc(len);
strncpy(newLine, _predictiveDict.dictLine[predictLine], len); strncpy(newLine, _predictiveDict.dictLine[predictLine], len);
} else { } else {
// if there is no word in predictive dictionary, we need to copy to // if there is no word in predictive dictionary, we need to copy to
// user dictionary mathed line + new word. // user dictionary mathed line + new word.
int len = (predictLine == _predictiveDict.dictLineCount - 1) ? &_predictiveDict.dictText[_predictiveDict.dictTextSize] - _predictiveDict.dictLine[predictLine] : int len = (predictLine == _predictiveDict.dictLineCount - 1) ? &_predictiveDict.dictText[_predictiveDict.dictTextSize] - _predictiveDict.dictLine[predictLine] :
_predictiveDict.dictLine[predictLine + 1] - _predictiveDict.dictLine[predictLine]; _predictiveDict.dictLine[predictLine + 1] - _predictiveDict.dictLine[predictLine];
newLine = (char *)malloc(len + word.size() + 1); newLine = (char *)malloc(len + word.size() + 1);
char *ptr = newLine; char *ptr = newLine;
strncpy(ptr, _predictiveDict.dictLine[predictLine], len); strncpy(ptr, _predictiveDict.dictLine[predictLine], len);
@ -792,7 +807,7 @@ void PredictiveDialog::addWord(Dict &dict, const String &word, const String &cod
newDictLine[k++] = dict.dictLine[i]; newDictLine[k++] = dict.dictLine[i];
} }
} }
if (!inserted) if (!inserted)
newDictLine[k] = newLine; newDictLine[k] = newLine;
_memoryList[_numMemory++] = newLine; _memoryList[_numMemory++] = newLine;
@ -817,9 +832,9 @@ void PredictiveDialog::addWord(Dict &dict, const String &word, const String &cod
} }
void PredictiveDialog::addWordToDict() { void PredictiveDialog::addWordToDict() {
if (_numMemory < MAXWORD) { if (_numMemory < kMaxWord) {
addWord(_unitedDict, _currentWord, _currentCode); addWord(_unitedDict, _currentWord, _currentCode);
addWord(_userDict, _currentWord, _currentCode); addWord(_userDict, _currentWord, _currentCode);
} else { } else {
warning("Predictive Dialog: You cannot add word to user dictionary..."); warning("Predictive Dialog: You cannot add word to user dictionary...");
} }
@ -841,7 +856,7 @@ void PredictiveDialog::loadDictionary(Common::SeekableReadStream *in, Dict &dict
in->read(dict.dictText, dict.dictTextSize); in->read(dict.dictText, dict.dictTextSize);
dict.dictText[dict.dictTextSize] = 0; dict.dictText[dict.dictTextSize] = 0;
uint32 time2 = g_system->getMillis(); uint32 time2 = g_system->getMillis();
debug("Predictive Dialog: Time to read %s: %d bytes, %d ms", ConfMan.get(dict.nameDict).c_str(), dict.dictTextSize, time2-time1); debug("Predictive Dialog: Time to read %s: %d bytes, %d ms", ConfMan.get(dict.nameDict).c_str(), dict.dictTextSize, time2 - time1);
delete in; delete in;
char *ptr = dict.dictText; char *ptr = dict.dictText;
@ -883,14 +898,14 @@ void PredictiveDialog::loadDictionary(Common::SeekableReadStream *in, Dict &dict
#endif #endif
uint32 time3 = g_system->getMillis(); uint32 time3 = g_system->getMillis();
debug("Predictive Dialog: Time to parse %s: %d, total: %d", ConfMan.get(dict.nameDict).c_str(), time3-time2, time3-time1); debug("Predictive Dialog: Time to parse %s: %d, total: %d", ConfMan.get(dict.nameDict).c_str(), time3 - time2, time3 - time1);
} }
void PredictiveDialog::loadAllDictionary(Dict &dict) { void PredictiveDialog::loadAllDictionary(Dict &dict) {
ConfMan.registerDefault(dict.nameDict, dict.fnameDict); ConfMan.registerDefault(dict.nameDict, dict.fnameDict);
if (dict.nameDict == "predictive_dictionary") { if (dict.nameDict == "predictive_dictionary") {
Common::File *inFile = new File(); Common::File *inFile = new Common::File();
if (!inFile->open(ConfMan.get(dict.nameDict))) { if (!inFile->open(ConfMan.get(dict.nameDict))) {
warning("Predictive Dialog: cannot read file: %s", dict.fnameDict.c_str()); warning("Predictive Dialog: cannot read file: %s", dict.fnameDict.c_str());
return; return;
@ -914,4 +929,4 @@ void PredictiveDialog::pressEditText() {
_edittext->draw(); _edittext->draw();
} }
} // namespace GUI } // namespace GUI

View file

@ -57,14 +57,12 @@ enum {
}; };
enum { enum {
MAXLINELEN = 80, kMaxLineLen = 80,
MAXWORDLEN = 24, kMaxWordLen = 24,
MAXWORD = 50 kMaxWord = 50
}; };
class PredictiveDialog : public GUI::Dialog { class PredictiveDialog : public GUI::Dialog {
typedef Common::String String;
public: public:
PredictiveDialog(); PredictiveDialog();
~PredictiveDialog(); ~PredictiveDialog();
@ -73,7 +71,7 @@ public:
virtual void handleKeyDown(Common::KeyState state); virtual void handleKeyDown(Common::KeyState state);
virtual void handleTickle(); virtual void handleTickle();
char * getResult() { return _predictiveResult; } const char *getResult() const { return _predictiveResult; }
private: private:
struct Dict { struct Dict {
char **dictLine; char **dictLine;
@ -81,18 +79,18 @@ private:
char *dictActLine; // using only for united dict... char *dictActLine; // using only for united dict...
int32 dictLineCount; int32 dictLineCount;
int32 dictTextSize; int32 dictTextSize;
String nameDict; Common::String nameDict;
String fnameDict; Common::String fnameDict;
}; };
uint8 countWordsInString(char *str); uint8 countWordsInString(const char *const str);
void bringWordtoTop(char *str, int wordnum); void bringWordtoTop(char *str, int wordnum);
void loadDictionary(Common::SeekableReadStream *in, Dict &dict); void loadDictionary(Common::SeekableReadStream *in, Dict &dict);
void loadAllDictionary(Dict &dict); void loadAllDictionary(Dict &dict);
void addWordToDict(); void addWordToDict();
void addWord(Dict &dict, const String &word, const String &code); void addWord(Dict &dict, const Common::String &word, const Common::String &code);
bool searchWord(char *where, const String &whatCode); bool searchWord(const char *const where, const Common::String &whatCode);
int binarySearch(char **dictLine, const String &code, int dictLineCount); int binarySearch(const char *const *const dictLine, const Common::String &code, const int dictLineCount);
bool matchWord(); bool matchWord();
void processBtnActive(ButtonId active); void processBtnActive(ButtonId active);
void pressEditText(); void pressEditText();
@ -114,20 +112,20 @@ private:
uint8 _numMatchingWords; uint8 _numMatchingWords;
char _predictiveResult[40]; char _predictiveResult[40];
String _currentCode; Common::String _currentCode;
String _currentWord; Common::String _currentWord;
String _prefix; Common::String _prefix;
uint32 _curTime, _lastTime; uint32 _curTime, _lastTime;
ButtonId _lastPressBtn; ButtonId _lastPressBtn;
char _temp[MAXWORDLEN + 1]; char _temp[kMaxWordLen + 1];
int _repeatcount[MAXWORDLEN]; int _repeatcount[kMaxWordLen];
char *_memoryList[MAXWORD]; char *_memoryList[kMaxWord];
int _numMemory; int _numMemory;
String _search; Common::String _search;
bool _navigationwithkeys; bool _navigationwithkeys;
private: private:

View file

@ -782,9 +782,6 @@
"<widget name='grFullscreenCheckbox' " "<widget name='grFullscreenCheckbox' "
"type='Checkbox' " "type='Checkbox' "
"/> " "/> "
"<widget name='grDisableDitheringCheckbox' "
"type='Checkbox' "
"/> "
"</layout> " "</layout> "
"</dialog> " "</dialog> "
"<dialog name='GlobalOptions_Audio' overlays='Dialog.GlobalOptions.TabWidget'> " "<dialog name='GlobalOptions_Audio' overlays='Dialog.GlobalOptions.TabWidget'> "
@ -1727,9 +1724,6 @@
"<widget name='grFullscreenCheckbox' " "<widget name='grFullscreenCheckbox' "
"type='Checkbox' " "type='Checkbox' "
"/> " "/> "
"<widget name='grDisableDitheringCheckbox' "
"type='Checkbox' "
"/> "
"</layout> " "</layout> "
"</dialog> " "</dialog> "
"<dialog name='GlobalOptions_Audio' overlays='Dialog.GlobalOptions.TabWidget'> " "<dialog name='GlobalOptions_Audio' overlays='Dialog.GlobalOptions.TabWidget'> "

Binary file not shown.

View file

@ -1 +1 @@
[SCUMMVM_STX0.8.10:ResidualVM Modern Theme:No Author] [SCUMMVM_STX0.8.11:ResidualVM Modern Theme:No Author]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

@ -336,9 +336,13 @@
<drawdata id = 'scrollbar_button_hover' cache = 'false' resolution = 'y<400'> <drawdata id = 'scrollbar_button_hover' cache = 'false' resolution = 'y<400'>
<drawstep func = 'roundedsq' <drawstep func = 'roundedsq'
radius = '10' radius = '10'
fill = 'none' fill = 'gradient'
fg_color = 'darkgray' gradient_start = 'brightpink'
gradient_end = 'darkpink'
stroke = '1' stroke = '1'
fg_color = 'darkred'
bevel = '1'
bevel_color = 'brightred'
/> />
<drawstep func = 'triangle' <drawstep func = 'triangle'
fg_color = 'shadowcolor' fg_color = 'shadowcolor'
@ -347,7 +351,7 @@
height = '5' height = '5'
xpos = 'right' xpos = 'right'
ypos = 'center' ypos = 'center'
padding = '0,0,2,0' padding = '0,0,1,0'
orientation = 'top' orientation = 'top'
/> />
</drawdata> </drawdata>

View file

@ -231,9 +231,6 @@
<widget name = 'grFullscreenCheckbox' <widget name = 'grFullscreenCheckbox'
type = 'Checkbox' type = 'Checkbox'
/> />
<widget name = 'grDisableDitheringCheckbox'
type = 'Checkbox'
/>
</layout> </layout>
</dialog> </dialog>

View file

@ -214,9 +214,6 @@
<widget name = 'grFullscreenCheckbox' <widget name = 'grFullscreenCheckbox'
type = 'Checkbox' type = 'Checkbox'
/> />
<widget name = 'grDisableDitheringCheckbox'
type = 'Checkbox'
/>
</layout> </layout>
</dialog> </dialog>