From edb6915f35b8a30783525b8c5616e65dbe9b55c3 Mon Sep 17 00:00:00 2001 From: "J. R. Mauro" Date: Tue, 14 Oct 2008 11:00:08 -0400 Subject: [PATCH] Hack to fix powerdot/landscape hyperlink bug * Added command line option -H --hyperlink * Added global PowerdotFix * Conditional code for hyperlink href box calculation --- accentuate | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/accentuate b/accentuate index ba68d40..d97d2df 100755 --- a/accentuate +++ b/accentuate @@ -95,6 +95,7 @@ OSDTitlePos = BottomLeft OSDPagePos = BottomRight OSDStatusPos = TopLeft UseLIRC = False +PowerdotFix = False # Support for LIRC remotes try: @@ -1490,10 +1491,19 @@ def AddHyperlink(page_offset, page, target, linkbox, pagebox): target += page_offset w = 1.0 / (pagebox[2] - pagebox[0]) h = 1.0 / (pagebox[3] - pagebox[1]) - x0 = (linkbox[0] - pagebox[0]) * w - y0 = (pagebox[3] - linkbox[3]) * h - x1 = (linkbox[2] - pagebox[0]) * w - y1 = (pagebox[3] - linkbox[1]) * h + + # Hack to fix problems with landscape/powerdot files with hyperlinks + if(PowerdotFix): + y1 = linkbox[0] * w + x1 = linkbox[3] * h + y0 = linkbox[2] * w + x0 = linkbox[1] * h + else: + x0 = (linkbox[0] - pagebox[0]) * w + y0 = (pagebox[3] - linkbox[3]) * h + x1 = (linkbox[2] - pagebox[0]) * w + y1 = (pagebox[3] - linkbox[1]) * h + href = (0, target, x0, y0, x1, y1) if GetPageProp(page, '_href'): PageProps[page]['_href'].append(href) @@ -3774,6 +3784,7 @@ Page options: implicitly sets -i -w, --wrap go back to the first page after the last page -J, --fade fade to black after the last page + -H, --hyperlink attempt to compensate for landscaped hyperlinks (hack) -a, --auto automatically advance to next page after some seconds -O, --autooverview automatically derive page visibility on overview page -O first = show pages with captions @@ -3941,16 +3952,16 @@ def ParseOptions(argv): global GhostScriptPath, pdftoppmPath, UseGhostScript, InfoScriptPath global AutoOverview, FadeToBlackAtEnd - try: # unused short options: jknqvxyzEHJKNQUVWXY + try: # unused short options: jknqvxyzEKNQUVWXY opts, args = getopt.getopt(argv, \ - "hfg:sc:i:wa:t:lo:r:T:D:B:Z:P:R:eA:mbp:u:F:S:G:d:C:ML:I:O:J", \ + "hfg:sc:i:wa:t:lo:r:T:D:B:Z:P:R:eA:mbp:u:F:S:G:d:C:ML:I:O:J:H", \ ["help", "fullscreen", "geometry=", "scale", "supersample", \ "nocache", "initialpage=", "wrap", "auto", "listtrans", "output=", \ "rotate=", "transition=", "transtime=", "mousedelay=", "boxfade=", \ "zoom=", "gspath=", "meshres=", "noext", "aspect", "memcache", \ "noback", "pages=", "poll=", "font=", "fontsize=", "gamma=", "duration=", "cursor=", "minutes", "layout=", "script=", "cache=", - "cachefile=", "autooverview=", "fade"]) + "cachefile=", "autooverview=", "fade", "hyperlink"]) except getopt.GetoptError, message: opterr(message) @@ -3971,6 +3982,8 @@ def ParseOptions(argv): Wrap = not(Wrap) if opt in ("-J", "--fade"): FadeToBlackAtEnd = not(FadeToBlackAtEnd) + if opt in ("-H", "--hyperlink"): + PowerdotFix = not(PowerdotFix) if opt in ("-O", "--autooverview"): AutoOverview = ParseAutoOverview(arg) if opt in ("-c", "--cache"): -- 2.11.4.GIT