add functions to pan (respect panSize)

This commit is contained in:
chrys 2017-02-02 20:02:20 +01:00
parent e9332caa93
commit d88945ee01
6 changed files with 32 additions and 12 deletions

View File

@ -89,9 +89,9 @@ fixCursorOnCell=-1
# review = priority to review # review = priority to review
# last = follow last used cursor # last = follow last used cursor
cursorFollowMode=review cursorFollowMode=review
# number of cells in panning # number of cells in panning (horizontal)
# 0 = display size, >0 number of cells # 0 = display size, >0 number of cells
panSize=0 panSizeHorizontal=0
[screen] [screen]
driver=vcsaDriver driver=vcsaDriver

View File

@ -90,9 +90,9 @@ fixCursorOnCell=-1
# review = priority to review # review = priority to review
# last = follow last used cursor # last = follow last used cursor
cursorFollowMode=review cursorFollowMode=review
# number of cells in panning # number of cells in panning (horizontal)
# 0 = display size, >0 number of cells # 0 = display size, >0 number of cells
panSize=0 panSizeHorizontal=0
[screen] [screen]
driver=vcsaDriver driver=vcsaDriver

View File

@ -89,9 +89,9 @@ fixCursorOnCell=-1
# review = priority to review # review = priority to review
# last = follow last used cursor # last = follow last used cursor
cursorFollowMode=review cursorFollowMode=review
# number of cells in panning # number of cells in panning (horizontal)
# 0 = display size, >0 number of cells # 0 = display size, >0 number of cells
panSize=0 panSizeHorizontal=0
[screen] [screen]
driver=vcsaDriver driver=vcsaDriver

View File

@ -47,9 +47,9 @@ fixCursorOnCell=-1
# review = priority to review # review = priority to review
# last = follow last used cursor # last = follow last used cursor
cursorFollowMode=review cursorFollowMode=review
# number of cells in panning # number of cells in panning (horizontal)
# 0 = display size, >0 number of cells # 0 = display size, >0 number of cells
panSize=0 panSizeHorizontal=0
[screen] [screen]
driver=vcsaDriver driver=vcsaDriver

View File

@ -139,13 +139,33 @@ class outputManager():
if self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'fixCursorOnCell') == -1: if self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'fixCursorOnCell') == -1:
return self.env['runtime']['brailleDriver'].getDeviceSize()[0] return self.env['runtime']['brailleDriver'].getDeviceSize()[0]
return self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'fixCursorOnCell') return self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'fixCursorOnCell')
def getActiveOffset(self):
if self.env['output']['messageOffset']:
return self.env['output']['messageOffset']
return self.env['output']['cursorOffset']
def getHorizontalPanSize(self):
size = self.env['runtime']['brailleDriver'].getDeviceSize()
if self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'panSizeHorizontal') <= 0:
return size[0]
if self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'panSizeHorizontal') >= size[0]:
return size[0]
return self.env['runtime']['settingsManager'].getSettingAsInt('braille', 'panSizeHorizontal')
def getHorizontalPanLevel(self,offsetChange = 0):
panSize = self.getHorizontalPanSize()
offset = self.getActiveOffset()
if not offset:
offset = self.getBrailleCursor()
offsetStart = (int(offset['x'] / panSize) + offsetChange) * panSize
def panLeft(self):
return self.getHorizontalPanLevel(-1)
def panRight(self):
return self.getHorizontalPanLevel(1)
def getBrailleTextWithOffset(self, text, offset = None, cursor = None): def getBrailleTextWithOffset(self, text, offset = None, cursor = None):
if text == '': if text == '':
return '' return ''
size = self.env['runtime']['brailleDriver'].getDeviceSize() size = self.env['runtime']['brailleDriver'].getDeviceSize()
offsetText = text offsetText = text
if cursor and not offset: if cursor and not offset:
if self.env['runtime']['settingsManager'].getSetting('braille', 'cursorFollowMode').upper() == 'FIXCELL': if self.env['runtime']['settingsManager'].getSetting('braille', 'cursorFollowMode').upper() == 'FIXCELL':
#fix cell #fix cell
@ -160,7 +180,7 @@ class outputManager():
offsetStart = len(offsetText) - 1 offsetStart = len(offsetText) - 1
else: else:
# page and fallback # page and fallback
offsetStart = int(cursor / size[0]) * size[0] offsetStart = int(cursor['x'] / size[0]) * size[0]
else: else:
if not offset: if not offset:
offset = {'x':0,'y':0} offset = {'x':0,'y':0}

View File

@ -36,7 +36,7 @@ settings = {
'cursorFocusMode':'page', # page,fixCell 'cursorFocusMode':'page', # page,fixCell
'fixCursorOnCell': -1, 'fixCursorOnCell': -1,
'cursorFollowMode': 'review', # none, review, last, text 'cursorFollowMode': 'review', # none, review, last, text
'panSize': 0 # 0 display size 'panSizeHorizontal': 0 # 0 = display size
}, },
'screen':{ 'screen':{
'driver': 'vcsaDriver', 'driver': 'vcsaDriver',