From c98a123f4c69b7e04a116dd7501bdc80afa3afcc Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 3 Jan 2012 01:25:16 +0100 Subject: VKEYBD: Some formatting fixes. --- backends/vkeybd/image-map.cpp | 8 +++--- backends/vkeybd/image-map.h | 4 +-- backends/vkeybd/polygon.cpp | 2 +- backends/vkeybd/polygon.h | 4 +-- backends/vkeybd/virtual-keyboard-gui.cpp | 39 ++++++++++++++--------------- backends/vkeybd/virtual-keyboard-gui.h | 8 +++--- backends/vkeybd/virtual-keyboard-parser.cpp | 24 +++++++++--------- backends/vkeybd/virtual-keyboard-parser.h | 27 ++++++++++---------- backends/vkeybd/virtual-keyboard.cpp | 6 ++--- backends/vkeybd/virtual-keyboard.h | 30 +++++++++++----------- 10 files changed, 76 insertions(+), 76 deletions(-) (limited to 'backends/vkeybd') diff --git a/backends/vkeybd/image-map.cpp b/backends/vkeybd/image-map.cpp index 275ec865ed..e3f986ee1b 100644 --- a/backends/vkeybd/image-map.cpp +++ b/backends/vkeybd/image-map.cpp @@ -35,7 +35,7 @@ ImageMap::~ImageMap() { removeAllAreas(); } -Polygon *ImageMap::createArea(const String& id) { +Polygon *ImageMap::createArea(const String &id) { if (_areas.contains(id)) { warning("Image map already contains an area with target of '%s'", id.c_str()); return 0; @@ -45,7 +45,7 @@ Polygon *ImageMap::createArea(const String& id) { return p; } -void ImageMap::removeArea(const String& id) { +void ImageMap::removeArea(const String &id) { if (!_areas.contains(id)) return; delete _areas[id]; @@ -53,7 +53,7 @@ void ImageMap::removeArea(const String& id) { } void ImageMap::removeAllAreas() { - HashMap::iterator it; + HashMap::iterator it; for (it = _areas.begin(); it != _areas.end(); ++it) { delete it->_value; } @@ -61,7 +61,7 @@ void ImageMap::removeAllAreas() { } String ImageMap::findMapArea(int16 x, int16 y) { - HashMap::iterator it; + HashMap::iterator it; for (it = _areas.begin(); it != _areas.end(); ++it) { if (it->_value->contains(x, y)) return it->_key; diff --git a/backends/vkeybd/image-map.h b/backends/vkeybd/image-map.h index 3bd8cfa0db..5132c31083 100644 --- a/backends/vkeybd/image-map.h +++ b/backends/vkeybd/image-map.h @@ -40,8 +40,8 @@ public: ~ImageMap(); - Polygon *createArea(const String& id); - void removeArea(const String& id); + Polygon *createArea(const String &id); + void removeArea(const String &id); void removeAllAreas(); String findMapArea(int16 x, int16 y); diff --git a/backends/vkeybd/polygon.cpp b/backends/vkeybd/polygon.cpp index ac42cb1d2e..08727a6fe8 100644 --- a/backends/vkeybd/polygon.cpp +++ b/backends/vkeybd/polygon.cpp @@ -42,7 +42,7 @@ bool Polygon::contains(int16 x, int16 y) const { yflag1 = (vtx1->y >= y); if (yflag0 != yflag1) { if (((vtx1->y - y) * (vtx0->x - vtx1->x) >= - (vtx1->x - x) * (vtx0->y - vtx1->y)) == yflag1) { + (vtx1->x - x) * (vtx0->y - vtx1->y)) == yflag1) { inside_flag = !inside_flag; } } diff --git a/backends/vkeybd/polygon.h b/backends/vkeybd/polygon.h index 19a12a0409..91c8d017b2 100644 --- a/backends/vkeybd/polygon.h +++ b/backends/vkeybd/polygon.h @@ -46,13 +46,13 @@ struct Polygon { } } - void addPoint(const Point& p) { + void addPoint(const Point &p) { _points.push_back(p); _bound.extend(Rect(p.x, p.y, p.x, p.y)); } void addPoint(int16 x, int16 y) { - addPoint(Point(x,y)); + addPoint(Point(x, y)); } uint getPointCount() { diff --git a/backends/vkeybd/virtual-keyboard-gui.cpp b/backends/vkeybd/virtual-keyboard-gui.cpp index 1c05d62316..14a508a82e 100644 --- a/backends/vkeybd/virtual-keyboard-gui.cpp +++ b/backends/vkeybd/virtual-keyboard-gui.cpp @@ -75,8 +75,8 @@ static void blit(Graphics::Surface *surf_dst, Graphics::Surface *surf_src, int16 VirtualKeyboardGUI::VirtualKeyboardGUI(VirtualKeyboard *kbd) : _kbd(kbd), _displaying(false), _drag(false), - _drawCaret(false), _displayEnabled(false), _firstRun(true), - _cursorAnimateTimer(0), _cursorAnimateCounter(0) { + _drawCaret(false), _displayEnabled(false), _firstRun(true), + _cursorAnimateTimer(0), _cursorAnimateCounter(0) { assert(_kbd); assert(g_system); @@ -111,7 +111,7 @@ void VirtualKeyboardGUI::initMode(VirtualKeyboard::Mode *mode) { } } -void VirtualKeyboardGUI::setupDisplayArea(Rect& r, OverlayColor forecolor) { +void VirtualKeyboardGUI::setupDisplayArea(Rect &r, OverlayColor forecolor) { _dispFont = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont); if (!fontIsSuitable(_dispFont, r)) { @@ -135,9 +135,9 @@ void VirtualKeyboardGUI::setupDisplayArea(Rect& r, OverlayColor forecolor) { _displayEnabled = true; } -bool VirtualKeyboardGUI::fontIsSuitable(const Graphics::Font *font, const Rect& rect) { +bool VirtualKeyboardGUI::fontIsSuitable(const Graphics::Font *font, const Rect &rect) { return (font->getMaxCharWidth() < rect.width() && - font->getFontHeight() < rect.height()); + font->getFontHeight() < rect.height()); } void VirtualKeyboardGUI::checkScreenChanged() { @@ -161,7 +161,7 @@ void VirtualKeyboardGUI::run() { _system->clearOverlay(); } _overlayBackup.create(_screenW, _screenH, _system->getOverlayFormat()); - _system->grabOverlay((OverlayColor*)_overlayBackup.pixels, _overlayBackup.w); + _system->grabOverlay((OverlayColor *)_overlayBackup.pixels, _overlayBackup.w); setupCursor(); @@ -171,7 +171,7 @@ void VirtualKeyboardGUI::run() { removeCursor(); - _system->copyRectToOverlay((OverlayColor*)_overlayBackup.pixels, _overlayBackup.w, 0, 0, _overlayBackup.w, _overlayBackup.h); + _system->copyRectToOverlay((OverlayColor *)_overlayBackup.pixels, _overlayBackup.w, 0, 0, _overlayBackup.w, _overlayBackup.h); if (!g_gui.isActive()) _system->hideOverlay(); _overlayBackup.free(); @@ -183,16 +183,15 @@ void VirtualKeyboardGUI::close() { } void VirtualKeyboardGUI::reset() { - _kbdBound.left = _kbdBound.top - = _kbdBound.right = _kbdBound.bottom = 0; + _kbdBound.left = _kbdBound.top = 0; + _kbdBound.right = _kbdBound.bottom = 0; _displaying = _drag = false; _firstRun = true; _lastScreenChanged = _system->getScreenChangeID(); _kbdSurface = 0; } -void VirtualKeyboardGUI::moveToDefaultPosition() -{ +void VirtualKeyboardGUI::moveToDefaultPosition() { int16 kbdW = _kbdBound.width(), kbdH = _kbdBound.height(); int16 x = 0, y = 0; if (_screenW != kbdW) { @@ -263,7 +262,7 @@ void VirtualKeyboardGUI::screenChanged() { _screenH = newScreenH; _overlayBackup.create(_screenW, _screenH, _system->getOverlayFormat()); - _system->grabOverlay((OverlayColor*)_overlayBackup.pixels, _overlayBackup.w); + _system->grabOverlay((OverlayColor *)_overlayBackup.pixels, _overlayBackup.w); if (!_kbd->checkModeResolutions()) { _displaying = false; @@ -290,19 +289,19 @@ void VirtualKeyboardGUI::mainLoop() { case Common::EVENT_LBUTTONDOWN: if (_kbdBound.contains(event.mouse)) { _kbd->handleMouseDown(event.mouse.x - _kbdBound.left, - event.mouse.y - _kbdBound.top); + event.mouse.y - _kbdBound.top); } break; case Common::EVENT_LBUTTONUP: if (_kbdBound.contains(event.mouse)) { _kbd->handleMouseUp(event.mouse.x - _kbdBound.left, - event.mouse.y - _kbdBound.top); + event.mouse.y - _kbdBound.top); } break; case Common::EVENT_MOUSEMOVE: if (_drag) move(event.mouse.x - _dragPoint.x, - event.mouse.y - _dragPoint.y); + event.mouse.y - _dragPoint.y); break; case Common::EVENT_SCREEN_CHANGED: screenChanged(); @@ -367,20 +366,20 @@ void VirtualKeyboardGUI::redraw() { } blit(&surf, _kbdSurface, _kbdBound.left - _dirtyRect.left, - _kbdBound.top - _dirtyRect.top, _kbdTransparentColor); + _kbdBound.top - _dirtyRect.top, _kbdTransparentColor); if (_displayEnabled) { blit(&surf, &_dispSurface, _dispX - _dirtyRect.left, - _dispY - _dirtyRect.top, _dispBackColor); + _dispY - _dirtyRect.top, _dispBackColor); } - _system->copyRectToOverlay((OverlayColor*)surf.pixels, surf.w, - _dirtyRect.left, _dirtyRect.top, surf.w, surf.h); + _system->copyRectToOverlay((OverlayColor *)surf.pixels, surf.w, + _dirtyRect.left, _dirtyRect.top, surf.w, surf.h); surf.free(); resetDirtyRect(); } -uint VirtualKeyboardGUI::calculateEndIndex(const String& str, uint startIndex) { +uint VirtualKeyboardGUI::calculateEndIndex(const String &str, uint startIndex) { int16 w = 0; while (w <= _dispSurface.w && startIndex < str.size()) { w += _dispFont->getCharWidth(str[startIndex++]); diff --git a/backends/vkeybd/virtual-keyboard-gui.h b/backends/vkeybd/virtual-keyboard-gui.h index da80ef2223..d0f9c884ed 100644 --- a/backends/vkeybd/virtual-keyboard-gui.h +++ b/backends/vkeybd/virtual-keyboard-gui.h @@ -121,7 +121,7 @@ private: bool _displaying; bool _firstRun; - void setupDisplayArea(Rect& r, OverlayColor forecolor); + void setupDisplayArea(Rect &r, OverlayColor forecolor); void move(int16 x, int16 y); void moveToDefaultPosition(); void screenChanged(); @@ -131,8 +131,8 @@ private: void redraw(); void forceRedraw(); void updateDisplay(); - bool fontIsSuitable(const Graphics::Font *font, const Rect& rect); - uint calculateEndIndex(const String& str, uint startIndex); + bool fontIsSuitable(const Graphics::Font *font, const Rect &rect); + uint calculateEndIndex(const String &str, uint startIndex); bool _drawCaret; int16 _caretX; @@ -141,7 +141,7 @@ private: static const int kCursorAnimateDelay = 250; int _cursorAnimateCounter; - int _cursorAnimateTimer; + int _cursorAnimateTimer; byte _cursor[2048]; void setupCursor(); void removeCursor(); diff --git a/backends/vkeybd/virtual-keyboard-parser.cpp b/backends/vkeybd/virtual-keyboard-parser.cpp index 58f0c468f6..bbac503ff9 100644 --- a/backends/vkeybd/virtual-keyboard-parser.cpp +++ b/backends/vkeybd/virtual-keyboard-parser.cpp @@ -116,7 +116,7 @@ bool VirtualKeyboardParser::parserCallback_mode(ParserNode *node) { _keyboard->_initialMode = _mode; String resolutions = node->values["resolutions"]; - StringTokenizer tok (resolutions, " ,"); + StringTokenizer tok(resolutions, " ,"); // select best resolution simply by minimising the difference between the // overlay size and the resolution dimensions. @@ -189,7 +189,7 @@ bool VirtualKeyboardParser::parserCallback_event(ParserNode *node) { } evt->type = VirtualKeyboard::kVKEventKey; - KeyState *ks = (KeyState*) malloc(sizeof(KeyState)); + KeyState *ks = (KeyState *)malloc(sizeof(KeyState)); ks->keycode = (KeyCode)atoi(node->values["code"].c_str()); ks->ascii = atoi(node->values["ascii"].c_str()); ks->flags = 0; @@ -204,7 +204,7 @@ bool VirtualKeyboardParser::parserCallback_event(ParserNode *node) { } evt->type = VirtualKeyboard::kVKEventModifier; - byte *flags = (byte*) malloc(sizeof(byte)); + byte *flags = (byte *)malloc(sizeof(byte)); if (!flags) error("[VirtualKeyboardParser::parserCallback_event] Cannot allocate memory"); @@ -218,8 +218,8 @@ bool VirtualKeyboardParser::parserCallback_event(ParserNode *node) { } evt->type = VirtualKeyboard::kVKEventSwitchMode; - String& mode = node->values["mode"]; - char *str = (char*) malloc(sizeof(char) * mode.size() + 1); + String &mode = node->values["mode"]; + char *str = (char *)malloc(sizeof(char) * mode.size() + 1); if (!str) error("[VirtualKeyboardParser::parserCallback_event] Cannot allocate memory"); @@ -302,9 +302,9 @@ bool VirtualKeyboardParser::parserCallback_map(ParserNode *node) { } bool VirtualKeyboardParser::parserCallback_area(ParserNode *node) { - String& shape = node->values["shape"]; - String& target = node->values["target"]; - String& coords = node->values["coords"]; + String &shape = node->values["shape"]; + String &target = node->values["target"]; + String &coords = node->values["coords"]; if (target.equalsIgnoreCase("display_area")) { if (!shape.equalsIgnoreCase("rect")) @@ -321,7 +321,7 @@ bool VirtualKeyboardParser::parserCallback_area(ParserNode *node) { return parserError("Area shape '" + shape + "' not known"); } -byte VirtualKeyboardParser::parseFlags(const String& flags) { +byte VirtualKeyboardParser::parseFlags(const String &flags) { if (flags.empty()) return 0; @@ -338,7 +338,7 @@ byte VirtualKeyboardParser::parseFlags(const String& flags) { return val; } -bool VirtualKeyboardParser::parseRect(Rect &rect, const String& coords) { +bool VirtualKeyboardParser::parseRect(Rect &rect, const String &coords) { int x1, y1, x2, y2; if (!parseIntegerKey(coords, 4, &x1, &y1, &x2, &y2)) return parserError("Invalid coords for rect area"); @@ -351,7 +351,7 @@ bool VirtualKeyboardParser::parseRect(Rect &rect, const String& coords) { return true; } -bool VirtualKeyboardParser::parsePolygon(Polygon &poly, const String& coords) { +bool VirtualKeyboardParser::parsePolygon(Polygon &poly, const String &coords) { StringTokenizer tok(coords, ", "); for (String st = tok.nextToken(); !st.empty(); st = tok.nextToken()) { int x, y; @@ -368,7 +368,7 @@ bool VirtualKeyboardParser::parsePolygon(Polygon &poly, const String& coords) { return true; } -bool VirtualKeyboardParser::parseRectAsPolygon(Polygon &poly, const String& coords) { +bool VirtualKeyboardParser::parseRectAsPolygon(Polygon &poly, const String &coords) { Rect rect; if (!parseRect(rect, coords)) return false; diff --git a/backends/vkeybd/virtual-keyboard-parser.h b/backends/vkeybd/virtual-keyboard-parser.h index eb25ebe6fd..c8a2c4158e 100644 --- a/backends/vkeybd/virtual-keyboard-parser.h +++ b/backends/vkeybd/virtual-keyboard-parser.h @@ -56,31 +56,31 @@ keyboard layouts for different screen resolutions. - ... + ... - - - ... - + + + ... + - ... - + ... + - ... + ... - ... + ... @@ -188,6 +188,7 @@ public: * Full parse - when loading keyboard pack for first time */ kParseFull, + /** * Just check resolutions and reload layouts if needed - following a * change in screen size @@ -257,10 +258,10 @@ protected: virtual bool closedKeyCallback(ParserNode *node); /** Parse helper functions */ - byte parseFlags(const String& flags); - bool parseRect(Rect &rect, const String& coords); - bool parsePolygon(Polygon &poly, const String& coords); - bool parseRectAsPolygon(Polygon &poly, const String& coords); + byte parseFlags(const String &flags); + bool parseRect(Rect &rect, const String &coords); + bool parsePolygon(Polygon &poly, const String &coords); + bool parseRectAsPolygon(Polygon &poly, const String &coords); }; } // End of namespace GUI diff --git a/backends/vkeybd/virtual-keyboard.cpp b/backends/vkeybd/virtual-keyboard.cpp index 1dada06951..7d47b709a7 100644 --- a/backends/vkeybd/virtual-keyboard.cpp +++ b/backends/vkeybd/virtual-keyboard.cpp @@ -160,7 +160,7 @@ String VirtualKeyboard::findArea(int16 x, int16 y) { return _currentMode->imageMap.findMapArea(x, y); } -void VirtualKeyboard::processAreaClick(const String& area) { +void VirtualKeyboard::processAreaClick(const String &area) { if (!_currentMode->events.contains(area)) return; @@ -169,10 +169,10 @@ void VirtualKeyboard::processAreaClick(const String& area) { switch (evt->type) { case kVKEventKey: // add virtual keypress to queue - _keyQueue.insertKey(*(KeyState*)evt->data); + _keyQueue.insertKey(*(KeyState *)evt->data); break; case kVKEventModifier: - _keyQueue.toggleFlags(*(byte*)(evt->data)); + _keyQueue.toggleFlags(*(byte *)(evt->data)); break; case kVKEventSwitchMode: // switch to new mode diff --git a/backends/vkeybd/virtual-keyboard.h b/backends/vkeybd/virtual-keyboard.h index 21db5a47da..21f149ae57 100644 --- a/backends/vkeybd/virtual-keyboard.h +++ b/backends/vkeybd/virtual-keyboard.h @@ -102,21 +102,21 @@ protected: } }; - typedef HashMap VKEventMap; + typedef HashMap VKEventMap; /** * Mode struct encapsulates all the data for each mode of the keyboard */ struct Mode { - String name; - String resolution; - String bitmapName; - Graphics::Surface *image; - OverlayColor transparentColor; - ImageMap imageMap; - VKEventMap events; - Rect displayArea; - OverlayColor displayFontColor; + String name; + String resolution; + String bitmapName; + Graphics::Surface *image; + OverlayColor transparentColor; + ImageMap imageMap; + VKEventMap events; + Rect displayArea; + OverlayColor displayFontColor; Mode() : image(0) {} ~Mode() { @@ -193,7 +193,7 @@ public: * The system first looks for an uncompressed keyboard pack by searching * for packName.xml in the filesystem, if this does not exist then it * searches for a compressed keyboard pack by looking for packName.zip. - * @param packName name of the keyboard pack + * @param packName name of the keyboard pack */ bool loadKeyboardPack(const String &packName); @@ -206,8 +206,8 @@ public: /** * Hides the keyboard, ending the event loop. - * @param submit if true all accumulated key presses are submitted to - * the event manager + * @param submit if true all accumulated key presses are submitted to + * the event manager */ void close(bool submit); @@ -229,7 +229,7 @@ protected: Archive *_fileArchive; friend class VirtualKeyboardGUI; - VirtualKeyboardGUI *_kbdGUI; + VirtualKeyboardGUI *_kbdGUI; KeyPressQueue _keyQueue; @@ -241,7 +241,7 @@ protected: void deleteEvents(); bool checkModeResolutions(); void switchMode(Mode *newMode); - void switchMode(const String& newMode); + void switchMode(const String &newMode); void handleMouseDown(int16 x, int16 y); void handleMouseUp(int16 x, int16 y); String findArea(int16 x, int16 y); -- cgit v1.2.3 From d0ddd299a4f19463749922859d2b5e9e5123b15f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 3 Jan 2012 01:47:31 +0100 Subject: VKEYBD: Slight cleanup in ImageMap code. --- backends/vkeybd/image-map.cpp | 7 +++---- backends/vkeybd/image-map.h | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'backends/vkeybd') diff --git a/backends/vkeybd/image-map.cpp b/backends/vkeybd/image-map.cpp index e3f986ee1b..359fc58d20 100644 --- a/backends/vkeybd/image-map.cpp +++ b/backends/vkeybd/image-map.cpp @@ -53,19 +53,18 @@ void ImageMap::removeArea(const String &id) { } void ImageMap::removeAllAreas() { - HashMap::iterator it; - for (it = _areas.begin(); it != _areas.end(); ++it) { + for (AreaMap::iterator it = _areas.begin(); it != _areas.end(); ++it) { delete it->_value; } _areas.clear(); } String ImageMap::findMapArea(int16 x, int16 y) { - HashMap::iterator it; - for (it = _areas.begin(); it != _areas.end(); ++it) { + for (AreaMap::iterator it = _areas.begin(); it != _areas.end(); ++it) { if (it->_value->contains(x, y)) return it->_key; } + return String(); } diff --git a/backends/vkeybd/image-map.h b/backends/vkeybd/image-map.h index 5132c31083..952ba624b0 100644 --- a/backends/vkeybd/image-map.h +++ b/backends/vkeybd/image-map.h @@ -35,9 +35,7 @@ namespace Common { struct Polygon; class ImageMap { - public: - ~ImageMap(); Polygon *createArea(const String &id); @@ -46,7 +44,8 @@ public: String findMapArea(int16 x, int16 y); protected: - HashMap _areas; + typedef HashMap AreaMap; + AreaMap _areas; }; -- cgit v1.2.3 From 24d99038e44cb8ab7bf15dc3517a3deeecac0568 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 3 Jan 2012 01:49:45 +0100 Subject: VKEYBD: Properly error out parsing if an area is defined again. Formerly the code did never check whether ImageMap::createArea returned a valid pointer and always just assumed so. --- backends/vkeybd/virtual-keyboard-parser.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'backends/vkeybd') diff --git a/backends/vkeybd/virtual-keyboard-parser.cpp b/backends/vkeybd/virtual-keyboard-parser.cpp index bbac503ff9..1958113578 100644 --- a/backends/vkeybd/virtual-keyboard-parser.cpp +++ b/backends/vkeybd/virtual-keyboard-parser.cpp @@ -313,10 +313,16 @@ bool VirtualKeyboardParser::parserCallback_area(ParserNode *node) { return parseRect(_mode->displayArea, coords); } else if (shape.equalsIgnoreCase("rect")) { Polygon *poly = _mode->imageMap.createArea(target); - return parseRectAsPolygon(*poly, coords); + if (!poly) + return parserError(Common::String::format("Cannot define area '%s' again", target.c_str())); + else + return parseRectAsPolygon(*poly, coords); } else if (shape.equalsIgnoreCase("poly")) { Polygon *poly = _mode->imageMap.createArea(target); - return parsePolygon(*poly, coords); + if (!poly) + return parserError(Common::String::format("Cannot define area '%s' again", target.c_str())); + else + return parsePolygon(*poly, coords); } return parserError("Area shape '" + shape + "' not known"); } -- cgit v1.2.3 From 1c2a21c42b9485000fd3a27c06f88d3eb1b38abc Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 3 Jan 2012 01:56:43 +0100 Subject: VKEYBD: Slight cleanup. --- backends/vkeybd/virtual-keyboard.cpp | 10 ++++------ backends/vkeybd/virtual-keyboard.h | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'backends/vkeybd') diff --git a/backends/vkeybd/virtual-keyboard.cpp b/backends/vkeybd/virtual-keyboard.cpp index 7d47b709a7..678c751410 100644 --- a/backends/vkeybd/virtual-keyboard.cpp +++ b/backends/vkeybd/virtual-keyboard.cpp @@ -56,11 +56,9 @@ VirtualKeyboard::~VirtualKeyboard() { } void VirtualKeyboard::deleteEvents() { - ModeMap::iterator it_m; - VKEventMap::iterator it_e; - for (it_m = _modes.begin(); it_m != _modes.end(); ++it_m) { - VKEventMap *evt = &(it_m->_value.events); - for (it_e = evt->begin(); it_e != evt->end(); ++it_e) + for (ModeMap::iterator it_m = _modes.begin(); it_m != _modes.end(); ++it_m) { + VKEventMap &evt = it_m->_value.events; + for (VKEventMap::iterator it_e = evt.begin(); it_e != evt.end(); ++it_e) delete it_e->_value; } } @@ -332,7 +330,7 @@ void VirtualKeyboard::KeyPressQueue::insertKey(KeyState key) { void VirtualKeyboard::KeyPressQueue::deleteKey() { if (_keyPos == _keys.begin()) return; - List::iterator it = _keyPos; + KeyPressList::iterator it = _keyPos; it--; _strPos -= it->strLen; while ((it->strLen)-- > 0) diff --git a/backends/vkeybd/virtual-keyboard.h b/backends/vkeybd/virtual-keyboard.h index 21f149ae57..4ab5ad446d 100644 --- a/backends/vkeybd/virtual-keyboard.h +++ b/backends/vkeybd/virtual-keyboard.h @@ -172,13 +172,13 @@ protected: byte _flags; String _flagsStr; - - List _keys; + typedef List KeyPressList; + KeyPressList _keys; String _keysStr; bool _strChanged; - List::iterator _keyPos; + KeyPressList::iterator _keyPos; uint _strPos; }; -- cgit v1.2.3 From 2af87fd4f02cff9f1d6b7140a8244c7c0b3ddd5a Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 3 Jan 2012 02:05:03 +0100 Subject: VKEYBD: Fix cursor palette. --- backends/vkeybd/virtual-keyboard-gui.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'backends/vkeybd') diff --git a/backends/vkeybd/virtual-keyboard-gui.cpp b/backends/vkeybd/virtual-keyboard-gui.cpp index 14a508a82e..42f9707ddc 100644 --- a/backends/vkeybd/virtual-keyboard-gui.cpp +++ b/backends/vkeybd/virtual-keyboard-gui.cpp @@ -435,10 +435,10 @@ void VirtualKeyboardGUI::updateDisplay() { void VirtualKeyboardGUI::setupCursor() { const byte palette[] = { - 255, 255, 255, 0, - 255, 255, 255, 0, - 171, 171, 171, 0, - 87, 87, 87, 0 + 255, 255, 255, + 255, 255, 255, + 171, 171, 171, + 87, 87, 87 }; CursorMan.pushCursorPalette(palette, 0, 4); -- cgit v1.2.3 From 426c81a7a7a4d6f47b73db1a75908b548d250e4e Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 30 Jun 2011 08:16:19 -0400 Subject: GRAPHICS: Rewrite ImageDecoder to have an improved API The new bitmap decoder class is based off the Mohawk one, and now has 8bpp decoding capability. --- backends/vkeybd/virtual-keyboard-parser.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'backends/vkeybd') diff --git a/backends/vkeybd/virtual-keyboard-parser.cpp b/backends/vkeybd/virtual-keyboard-parser.cpp index 1958113578..bb8286d1f5 100644 --- a/backends/vkeybd/virtual-keyboard-parser.cpp +++ b/backends/vkeybd/virtual-keyboard-parser.cpp @@ -34,7 +34,7 @@ #include "common/tokenizer.h" #include "common/stream.h" -#include "graphics/imagedec.h" +#include "graphics/decoders/bmp.h" namespace Common { @@ -266,11 +266,15 @@ bool VirtualKeyboardParser::parserCallback_layout(ParserNode *node) { const Graphics::PixelFormat format = g_system->getOverlayFormat(); - _mode->image = Graphics::ImageDecoder::loadFile(*file, format); - delete file; + { + Graphics::BitmapDecoder bmp; + if (!bmp.loadStream(*file)) + return parserError("Error loading bitmap '" + _mode->bitmapName + "'"); + + _mode->image = bmp.getSurface()->convertTo(format); + } - if (!_mode->image) - return parserError("Error loading bitmap '" + _mode->bitmapName + "'"); + delete file; int r, g, b; if (node->values.contains("transparent_color")) { -- cgit v1.2.3