summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlpsv/psv.wx.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlpsv/psv.wx.lua')
-rw-r--r--Master/tlpkg/tlpsv/psv.wx.lua82
1 files changed, 58 insertions, 24 deletions
diff --git a/Master/tlpkg/tlpsv/psv.wx.lua b/Master/tlpkg/tlpsv/psv.wx.lua
index 4c8461f8735..6c4f470b537 100644
--- a/Master/tlpkg/tlpsv/psv.wx.lua
+++ b/Master/tlpkg/tlpsv/psv.wx.lua
@@ -5,7 +5,7 @@
-- bop@bop.com.pl
-- Copyright: (c) 2008 BOP s.c.
-- Licence: GPL
--- Current version: 5.05; 26.04.2008
+-- Current version: 5.09; 02.07.2008
--
-- 4.95 -- first working version of Lua engine
-- 4.96 -- mouse interface added (and many other changes)
@@ -21,10 +21,13 @@
-- 5.04 -- DSC reading corrected, `layer' and updating image corrected
-- 5.05 -- post-Pingwinaria release, 'layer' and printing bug corrected
-- 5.06 -- BachoTeX release
+-- 5.07 -- post BachoTeX release
+-- 5.08 -- full-screen mode
+-- 5.09 -- LaTeX/HTML help added
------------------------------------------------------------------------------]]
local PS_VIEW_NAME="PS_View"
-local PS_VIEW_VERSION=5.06
+local PS_VIEW_VERSION=5.09
local PS_VIEW_VERSION_STRING -- defined later, after locale loading
local PSV_GsPars = {"-dNOPAUSE","-dDELAYBIND","-dNOEPS"}
@@ -34,6 +37,7 @@ local gsobj={
instancechecker = nil,
gsdll = nil,
config = nil,
+ helpctrl = nil,
locale = nil,
ghostscript = nil,
image = nil,
@@ -41,11 +45,9 @@ local gsobj={
dscthread = nil,
dialog = nil,
menu = nil,
- SBsty = {},
- SBall = {},
+ SBsty = {}, SBall = {},
overlay = nil,
- bbmp = nil,
- obmp = nil,
+ bbmp = nil, obmp = nil,
}
local gswin={
@@ -83,8 +85,8 @@ local gsstat = {
update = 0,
working = false,
ready = false,
- inoverlay= false,
- drawoverlay= false,
+ inoverlay = false, drawoverlay = false,
+ -- fullscreen = false,
}
function MakeIcons()
@@ -298,7 +300,6 @@ function PrepareKeyNames()
[wx.WXK_NUMPAD_MULTIPLY]="MULTIPLY",
[wx.WXK_NUMPAD_SUBTRACT]="SUBSTRACT",
[wx.WXK_NUMPAD_ADD]="ADD",
- [wx.WXK_NUMPAD_ENTER]="RETURN",
[wx.WXK_NUMPAD_EQUAL]="EQUAL",
[wx.WXK_NUMPAD_BEGIN]="BEGIN",
--[wx.WXK_NUMPAD_DECIMAL]="",
@@ -308,6 +309,7 @@ function PrepareKeyNames()
for i = 0, 9 do s=string.format("%d",i) key_text[wx["WXK_NUMPAD" .. s]]=s end
char_text={
+ [wx.WXK_NUMPAD_ENTER]="RETURN",
[wx.WXK_RETURN]="RETURN",
[wx.WXK_BACK]="BACK",
[string.byte("`")]="GRAVE",
@@ -431,10 +433,6 @@ function SendEventCommand (c,s,...)
RunPScode:add(string.format(s,...) .. " /" .. c .. " EVENTCOMMAND")
end
-function SendDSCEventCommand (c,s,...)
- RunDSCcode:add(string.format(s,...) .. " /" .. c .. " EVENTCOMMAND")
-end
-
function SendMenuCommand (m,s)
RunInputString()
RunPScode:add("/" .. m .. " /" .. s .. " MENUCOMMAND")
@@ -453,6 +451,16 @@ function SendMouseCommandWithStatus(mouse,cmd)
SendMouseCommand (mouse.bx,mouse.by,mouse.ex,mouse.ey,cmd,mod_text[mouse.mod])
end
+function SendDSCEventCommand (c,s,...)
+ RunDSCcode:add(string.format(s,...) .. " /" .. c .. " EVENTCOMMAND")
+end
+
+function SendDSCComment(comm,begc,endc)
+-- comm=comm:gsub("[\128-\255]","#")
+ comm=comm:gsub("([\\%(%)])","\\%1")
+ SendDSCEventCommand ("DSCCOMMENT","(%s) %d %d",comm,begc,endc)
+end
+
function CallPSVhook (str)
local b=str:find(": ")
local c,l=str:sub(1,b-1),str:sub(b+2,-1)
@@ -473,6 +481,8 @@ function CallPSVhook (str)
MakeStatusLine(f,s,p[1],p[2])
elseif c=="REFRESH" then
MakeRefreshEvent(p[1])
+ elseif c=="SIZE" then
+ MakeResizeEvent(f,s,p[1],p[2])
elseif c=="DRAW" then
DrawObjectEvent(f,s,p[1],p[2],p[3])
elseif c=="HOOK" then
@@ -481,6 +491,8 @@ function CallPSVhook (str)
MakeConfigFile(f,p[1],p[2],p[3])
elseif c=="CONSOLE" then
MakeConsole(f,p[1])
+ elseif c=="HELP" then
+ MakeHelpWindow(f,p[1])
elseif c=="INFO" then
SendInfoEvent()
elseif c=="LOCALE" then
@@ -544,6 +556,23 @@ function MakeConsole(l,a)
end
end
+function MakeHelpWindow(l,a)
+ if l=="I" then
+ gsobj.helpctrl=wx.wxHtmlHelpController(wx.wxHF_DEFAULT_STYLE,frame)
+ gsobj.helpctrl:UseConfig(gsobj.config,"HelpControler")
+ gsobj.helpctrl:SetTitleFormat(PS_VIEW_NAME .. _T(" Help -- %s"))
+ local fname=wx.wxFileName(arg[0]):GetPath(wx.wxPATH_GET_VOLUME)
+ fname=wx.wxFileName(fname,a)
+ gsobj.helpctrl:AddBook(fname,false)
+-- gsobj.helpctrl=wx.wxHelpController(frame)
+-- gsobj.helpctrl:Initialize(a)
+ elseif l=="S" then
+ gsobj.helpctrl:DisplayContents()
+ elseif l=="C" then
+ gsobj.helpctrl:Display(a)
+ end
+end
+
function SendInfoEvent()
local info,infodict="","<<"
infodict=infodict.."/ProgramName (" .. PS_VIEW_NAME ..") "
@@ -586,15 +615,16 @@ function SendLocaleEvent(f,a)
SendEventCommand ("LOCALE","(%s) (%s) -1",a,a)
end
elseif f=="I" then
- SendEventCommand ("LOCALE","(%s) %d 0", gsobj.locale:GetLocale(), gsobj.locale:GetLanguage())
+ SendEventCommand ("LOCALE","(%s) (%s) 0", gsobj.locale:GetLocale(),
+ string.sub(gsobj.locale:GetName(),1,2))
elseif f=="S" then
local lang=gsobj.locale.FindLanguageInfo(a)
SetLocale(lang.Language)
end
end
-function RunLuaCode(l,a)
- if l=="R" then
+function RunLuaCode(f,a)
+ if f=="R" then
local torun=loadstring(a)
if torun then torun() end
end
@@ -692,12 +722,6 @@ function ReadDSCcomments(fname)
return 0
end
-function SendDSCComment(comm,begc,endc)
--- comm=comm:gsub("[\128-\255]","#")
- comm=comm:gsub("([\\%(%)])","\\%1")
- SendDSCEventCommand ("DSCCOMMENT","(%s) %d %d",comm,begc,endc)
-end
-
function MakeStatusLine(l,m,a,b)
if not gswin.statusBar then
if l=="C" then gswin.statusBar=frame:CreateStatusBar() end
@@ -1023,9 +1047,9 @@ function DestroyOverlay()
end
function OnPaintExtra(event)
- local dc=wx.wxPaintDC(gswin.gswindow)
+ local dc,sdc
local xd, yd, w, h, xs, ys = 0, 0, gsobj.image.w, gsobj.image.h, 0, 0
- local sdc
+ dc=wx.wxPaintDC(gswin.gswindow)
if gsstat.inoverlay then
if gsstat.drawoverlay then
dc:DrawBitmap(gsobj.bbmp,0,0,false)
@@ -1108,6 +1132,13 @@ function ClearDrawObjects()
end
end
+function MakeResizeEvent(f,s,x,y)
+ if f=="F" then
+ if s=="T" then frame:ShowFullScreen(true)
+ elseif s=="F" then frame:ShowFullScreen(false) end
+ elseif f=="S" then
+ end
+end
function MouseButtonEvent(event)
local mod=wx.wxMOD_NONE
@@ -1542,6 +1573,8 @@ function ClosePSV ()
if wx.wxIsBusy() then wx.wxEndBusyCursor() end
if gswin.gswindow then gswin.gswindow:Destroy() gswin.gswindow=nil end
if gsobj.instancechecker then gsobj.instancechecker:Destroy() end
+-- if gsobj.helparch then gsobj.helparch:Destroy() end
+-- if gsobj.helpctrl then gsobj.helpctrl:Destroy() end
-- ConfigSavePaths(gsargs)
ConfigSaveFramePosition(frame, "MainWindow")
if console then
@@ -1951,6 +1984,7 @@ function PrepareLocale()
return wx.wxGetTranslation(str)
end
PS_VIEW_VERSION_STRING=string.format(_T("%s, version %g"), PS_VIEW_NAME, PS_VIEW_VERSION)
+ print("!!!!" .. psvpars.language.. "!".. lang .. PS_VIEW_VERSION_STRING .. "\n")
end
function CreateInstanceChecker()