OSDN Git Service

Changed the behaviour of the review follows caret option, so that the review positio...
authorMichael Curran <mick@kulgan.net>
Mon, 22 Nov 2010 06:55:34 +0000 (16:55 +1000)
committerMichael Curran <mick@kulgan.net>
Mon, 22 Nov 2010 06:55:34 +0000 (16:55 +1000)
*NVDAObject.event_caret: only set the review position to the caret if the current navigator object is this object.
*VirtualBuffer._set_selection:  rather than unconditionally setting the review position to the new caret position, instead only do this if the current navigator object is the root of this virtualBuffer.
*TreeInterceptor._set_passthrough: if passthrough is turning on, and the focus is currently inside this treeInterceptor, and the review follows focus option is on, set the navigator object to the focus.
*TreeInterceptor._set_selection: if passthrough is turning off, and the navigator object is inside this treeInterceptor, and the review follows caret option is turned on,  set the navigator object to the root of this treeInterceptor.

source/NVDAObjects/__init__.py
source/editableText.py
source/treeInterceptorHandler.py
source/virtualBuffers/__init__.py

index 168f4da..be14e35 100644 (file)
@@ -791,7 +791,7 @@ This code is executed if a gain focus event is received by this object.
        def event_caret(self):\r
                if self is api.getFocusObject() and not eventHandler.isPendingEvents("gainFocus"):\r
                        braille.handler.handleCaretMove(self)\r
-                       if config.conf["reviewCursor"]["followCaret"]:\r
+                       if config.conf["reviewCursor"]["followCaret"] and api.getNavigatorObject() is self: \r
                                try:\r
                                        api.setReviewPosition(self.makeTextInfo(textInfos.POSITION_CARET))\r
                                except (NotImplementedError, RuntimeError):\r
index 9ca1894..4f321d3 100755 (executable)
@@ -60,7 +60,7 @@ class EditableText(ScriptableObject):
                        info = self.makeTextInfo(textInfos.POSITION_CARET)\r
                except:\r
                        return\r
-               if config.conf["reviewCursor"]["followCaret"]:\r
+               if config.conf["reviewCursor"]["followCaret"] and api.getNavigatorObject() is self:\r
                        api.setReviewPosition(info.copy())\r
                if speakUnit:\r
                        info.expand(speakUnit)\r
index ce26c17..19e44db 100644 (file)
@@ -7,6 +7,7 @@
 from logHandler import log\r
 import baseObject\r
 import api\r
+import config\r
 import braille\r
 \r
 runningTable=set()\r
@@ -100,8 +101,15 @@ class TreeInterceptor(baseObject.ScriptableObject):
                        return\r
                self._passThrough = state\r
                if state:\r
+                       if config.conf['reviewCursor']['followFocus']:\r
+                               focusObj=api.getFocusObject()\r
+                               if self is focusObj.treeInterceptor:\r
+                                       api.setNavigatorObject(focusObj)\r
                        braille.handler.handleGainFocus(api.getFocusObject())\r
                else:\r
+                       obj=api.getNavigatorObject()\r
+                       if config.conf['reviewCursor']['followCaret'] and self is obj.treeInterceptor: \r
+                               api.setNavigatorObject(self.rootNVDAObject)\r
                        braille.handler.handleGainFocus(self)\r
 \r
        _cache_shouldPrepare=True\r
index e164bb6..6942d20 100644 (file)
@@ -655,7 +655,8 @@ class VirtualBuffer(cursorManager.CursorManager, treeInterceptorHandler.TreeInte
                super(VirtualBuffer, self)._set_selection(info)\r
                if isScriptWaiting() or not info.isCollapsed:\r
                        return\r
-               api.setReviewPosition(info)\r
+               if config.conf['reviewCursor']['followCaret'] and api.getNavigatorObject() is self.rootNVDAObject:\r
+                       api.setReviewPosition(info)\r
                if reason == speech.REASON_FOCUS:\r
                        focusObj = api.getFocusObject()\r
                        if focusObj==self.rootNVDAObject:\r