[Scummvm-cvs-logs] scummvm master -> 2af87fd4f02cff9f1d6b7140a8244c7c0b3ddd5a

lordhoto lordhoto at gmail.com
Tue Jan 3 02:14:40 CET 2012


This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c98a123f4c VKEYBD: Some formatting fixes.
d0ddd299a4 VKEYBD: Slight cleanup in ImageMap code.
24d99038e4 VKEYBD: Properly error out parsing if an area is defined again.
1c2a21c42b VKEYBD: Slight cleanup.
2af87fd4f0 VKEYBD: Fix cursor palette.


Commit: c98a123f4c69b7e04a116dd7501bdc80afa3afcc
    https://github.com/scummvm/scummvm/commit/c98a123f4c69b7e04a116dd7501bdc80afa3afcc
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-01-02T17:13:19-08:00

Commit Message:
VKEYBD: Some formatting fixes.

Changed paths:
    backends/vkeybd/image-map.cpp
    backends/vkeybd/image-map.h
    backends/vkeybd/polygon.cpp
    backends/vkeybd/polygon.h
    backends/vkeybd/virtual-keyboard-gui.cpp
    backends/vkeybd/virtual-keyboard-gui.h
    backends/vkeybd/virtual-keyboard-parser.cpp
    backends/vkeybd/virtual-keyboard-parser.h
    backends/vkeybd/virtual-keyboard.cpp
    backends/vkeybd/virtual-keyboard.h



diff --git a/backends/vkeybd/image-map.cpp b/backends/vkeybd/image-map.cpp
index 275ec86..e3f986e 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<String, Polygon*>::iterator it;
+	HashMap<String, Polygon *>::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<String, Polygon*>::iterator it;
+	HashMap<String, Polygon *>::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 3bd8cfa..5132c31 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 ac42cb1..08727a6 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 19a12a0..91c8d01 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 1c05d62..14a508a 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 da80ef2..d0f9c88 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 58f0c46..bbac503 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 eb25ebe..c8a2c41 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.
         <area shape="poly" coords="65,50,67,48,94,48,96,50,96,77,94,79,67,79,65,77" target="q" />
         <area shape="poly" coords="105,50,107,48,134,48,136,50,136,77,134,79,107,79,105,77" target="w" />
         <area shape="poly" coords="146,50,148,48,174,48,176,50,176,77,174,79,148,79,146,77" target="e" />
-		...
+        ...
         <area shape="poly" coords="11,89,12,88,69,88,70,89,70,116,69,117,12,117,11,116" target="caps" />
       </map>
-	</layout>
-	<layout resolution="320x200" bitmap="normal_320x200.bmp" transparent_color="255,0,255">
-	  ...
-	</layout>
+    </layout>
+    <layout resolution="320x200" bitmap="normal_320x200.bmp" transparent_color="255,0,255">
+      ...
+    </layout>
     <event name="a" type="key" code="97" ascii="97" modifiers="" />
     <event name="b" type="key" code="98" ascii="98" modifiers="" />
     <event name="c" type="key" code="99" ascii="99" modifiers="" />
-	...
-	<event name="caps" type="switch_mode" mode="caps" />
+    ...
+    <event name="caps" type="switch_mode" mode="caps" />
   </mode>
 
   <mode name="caps" resolutions="640x400">
     <layout resolution="640x400" bitmap="caps_640x480.bmp" transparent_color="255,0,255">
       <map>
         <area shape="poly" coords="65,50,67,48,94,48,96,50,96,77,94,79,67,79,65,77" target="Q" />
-		...
+        ...
       </map>
     </layout>
     <event name="A" type="key" code="97" ascii="65" modifiers="shift" />
     <event name="B" type="key" code="98" ascii="66" modifiers="shift" />
     <event name="C" type="key" code="99" ascii="67" modifiers="shift" />
-	...
+    ...
   </mode>
 </keyboard>
 
@@ -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 1dada06..7d47b70 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 21db5a4..21f149a 100644
--- a/backends/vkeybd/virtual-keyboard.h
+++ b/backends/vkeybd/virtual-keyboard.h
@@ -102,21 +102,21 @@ protected:
 		}
 	};
 
-	typedef HashMap<String, VKEvent*> VKEventMap;
+	typedef HashMap<String, VKEvent *> 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);


Commit: d0ddd299a4f19463749922859d2b5e9e5123b15f
    https://github.com/scummvm/scummvm/commit/d0ddd299a4f19463749922859d2b5e9e5123b15f
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-01-02T17:13:22-08:00

Commit Message:
VKEYBD: Slight cleanup in ImageMap code.

Changed paths:
    backends/vkeybd/image-map.cpp
    backends/vkeybd/image-map.h



diff --git a/backends/vkeybd/image-map.cpp b/backends/vkeybd/image-map.cpp
index e3f986e..359fc58 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<String, Polygon *>::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<String, Polygon *>::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 5132c31..952ba62 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<String, Polygon *> _areas;
+	typedef HashMap<String, Polygon *> AreaMap;
+	AreaMap _areas;
 };
 
 


Commit: 24d99038e44cb8ab7bf15dc3517a3deeecac0568
    https://github.com/scummvm/scummvm/commit/24d99038e44cb8ab7bf15dc3517a3deeecac0568
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-01-02T17:13:26-08:00

Commit Message:
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.

Changed paths:
    backends/vkeybd/virtual-keyboard-parser.cpp



diff --git a/backends/vkeybd/virtual-keyboard-parser.cpp b/backends/vkeybd/virtual-keyboard-parser.cpp
index bbac503..1958113 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");
 }


Commit: 1c2a21c42b9485000fd3a27c06f88d3eb1b38abc
    https://github.com/scummvm/scummvm/commit/1c2a21c42b9485000fd3a27c06f88d3eb1b38abc
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-01-02T17:13:33-08:00

Commit Message:
VKEYBD: Slight cleanup.

Changed paths:
    backends/vkeybd/virtual-keyboard.cpp
    backends/vkeybd/virtual-keyboard.h



diff --git a/backends/vkeybd/virtual-keyboard.cpp b/backends/vkeybd/virtual-keyboard.cpp
index 7d47b70..678c751 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<VirtualKeyPress>::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 21f149a..4ab5ad4 100644
--- a/backends/vkeybd/virtual-keyboard.h
+++ b/backends/vkeybd/virtual-keyboard.h
@@ -172,13 +172,13 @@ protected:
 		byte _flags;
 		String _flagsStr;
 
-
-		List<VirtualKeyPress> _keys;
+		typedef List<VirtualKeyPress> KeyPressList;
+		KeyPressList _keys;
 		String _keysStr;
 
 		bool _strChanged;
 
-		List<VirtualKeyPress>::iterator _keyPos;
+		KeyPressList::iterator _keyPos;
 		uint _strPos;
 	};
 


Commit: 2af87fd4f02cff9f1d6b7140a8244c7c0b3ddd5a
    https://github.com/scummvm/scummvm/commit/2af87fd4f02cff9f1d6b7140a8244c7c0b3ddd5a
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-01-02T17:13:40-08:00

Commit Message:
VKEYBD: Fix cursor palette.

Changed paths:
    backends/vkeybd/virtual-keyboard-gui.cpp



diff --git a/backends/vkeybd/virtual-keyboard-gui.cpp b/backends/vkeybd/virtual-keyboard-gui.cpp
index 14a508a..42f9707 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);






More information about the Scummvm-git-logs mailing list