mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-13 09:15:50 +00:00
This commit was manufactured by cvs2svn to create branch 'BRANCH_1_3_X'.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@9522 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
965b4c320d
commit
5a389cacb3
39
README.Cygwin
Normal file
39
README.Cygwin
Normal file
@ -0,0 +1,39 @@
|
||||
================================================================
|
||||
README for Cygwin by Ruurd Reitsma (R.A.Reitsma@wbmt.tudelft.nl)
|
||||
================================================================
|
||||
|
||||
LyX has been ported to Win32 using the Cygwin environement. The port
|
||||
consists of a few small tweaks to deal with DOS-style pathnames, so
|
||||
LyX can use Win32 TeX distros like fptex and MiKTeX. There's also a
|
||||
cygwin TeTeX port, but the native Win32 ports have a definite speed
|
||||
advantage. Besides that, nothing fancy.
|
||||
|
||||
The prerequisites are (obviously?):
|
||||
|
||||
* cygwin installation (http://www.cygwin.com/).
|
||||
* decent X server; eXceed, X-Win32, or maybe even Cygwin/XFree86.
|
||||
* working TeX installation; fpTex, MikTex.
|
||||
|
||||
It should compile out of the box, but there might be some libraries
|
||||
missing in the final link step. You'll have to add them to the Makefile
|
||||
by hand. Be sure to include -lregex, because cygwin's builtin regex is
|
||||
sortof weird (filedialogs will turn up empty...)
|
||||
|
||||
If you want to run lyx with no console windows open, there's a small
|
||||
program in development/Win32 that will set the proper environment vars
|
||||
and start lyx.
|
||||
|
||||
Compile with:
|
||||
|
||||
gcc lyxwin32.C -O2 -o lyxwin32 -static -Wall -Wno-format \
|
||||
-Wstrict-prototypes -Wmissing-prototypes -mwindows -e _mainCRTStartup
|
||||
|
||||
Also make sure the latex binaries are in your Windows path. Windvi and
|
||||
Yap are auto detected, and you might want to make a symlink to Adobe
|
||||
Acrobat so it's detected too:
|
||||
|
||||
ln -s //c/Program\ Files/adobe/Acrobat\ 4.0/Reader/AcroRd32.exe \
|
||||
/usr/bin/acroread
|
||||
|
||||
Many thanks to Steven van Dijk, Claus Hentschel and Miyata Shigeru for
|
||||
starting the porting business.
|
25
lib/lyx2lyx/lyx_1_0_0.py
Normal file
25
lib/lyx2lyx/lyx_1_0_0.py
Normal file
@ -0,0 +1,25 @@
|
||||
# This file is part of lyx2lyx
|
||||
# -*- coding: iso-8859-1 -*-
|
||||
# Copyright (C) 2004 José Matos <jamatos@lyx.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
convert = [[215, []]]
|
||||
revert = []
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
|
25
lib/lyx2lyx/lyx_1_0_1.py
Normal file
25
lib/lyx2lyx/lyx_1_0_1.py
Normal file
@ -0,0 +1,25 @@
|
||||
# This file is part of lyx2lyx
|
||||
# -*- coding: iso-8859-1 -*-
|
||||
# Copyright (C) 2004 José Matos <jamatos@lyx.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
convert = [[215, []]]
|
||||
revert = []
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
|
25
lib/lyx2lyx/lyx_1_1_4.py
Normal file
25
lib/lyx2lyx/lyx_1_1_4.py
Normal file
@ -0,0 +1,25 @@
|
||||
# This file is part of lyx2lyx
|
||||
# -*- coding: iso-8859-1 -*-
|
||||
# Copyright (C) 2004 José Matos <jamatos@lyx.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
convert = [[215, []]]
|
||||
revert = []
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
|
284
lib/lyx2lyx/lyx_1_1_6.py
Normal file
284
lib/lyx2lyx/lyx_1_1_6.py
Normal file
@ -0,0 +1,284 @@
|
||||
# This file is part of lyx2lyx
|
||||
# -*- coding: iso-8859-1 -*-
|
||||
# Copyright (C) 2002-2004 José Matos <jamatos@lyx.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
import re
|
||||
import string
|
||||
from parser_tools import find_re, find_tokens, find_token, check_token
|
||||
|
||||
|
||||
lyxtable_re = re.compile(r".*\\LyXTable$")
|
||||
def update_tabular(file):
|
||||
lines = file.body
|
||||
i=0
|
||||
while 1:
|
||||
i = find_re(lines, lyxtable_re, i)
|
||||
if i == -1:
|
||||
break
|
||||
prop_dict = {"family" : "default", "series" : "default",
|
||||
"shape" : "default", "size" : "default",
|
||||
"emph" : "default", "bar" : "default",
|
||||
"noun" : "default", "latex" : "default", "color" : "default"}
|
||||
|
||||
# remove \LyXTable
|
||||
lines[i] = lines[i][:-9]
|
||||
i = i + 1
|
||||
lines.insert(i,'')
|
||||
i = i + 1
|
||||
lines[i] = "\\begin_inset Tabular"
|
||||
i = i + 1
|
||||
head = string.split(lines[i])
|
||||
rows = int(head[0])
|
||||
columns = int(head[1])
|
||||
|
||||
tabular_line = i
|
||||
i = i +1
|
||||
lines.insert(i, '<Features rotate="%s" islongtable="%s" endhead="%s" endfirsthead="%s" endfoot="%s" endlastfoot="%s">' % (head[2],head[3],head[4],head[5],head[6],head[7]))
|
||||
|
||||
i = i +1
|
||||
|
||||
row_info = []
|
||||
cont_row = []
|
||||
for j in range(rows):
|
||||
row_info.append(string.split(lines[i]))
|
||||
if string.split(lines[i])[2] == '1':
|
||||
cont_row.append(j)
|
||||
del lines[i]
|
||||
|
||||
column_info = []
|
||||
col_info_re = re.compile(r'(\d) (\d) (\d) (".*") (".*")')
|
||||
for j in range(columns):
|
||||
column_info.append(col_info_re.match(lines[i]).groups())
|
||||
del lines[i]
|
||||
|
||||
cell_info = []
|
||||
cell_col = []
|
||||
ncells = 0
|
||||
cell_re = re.compile(r'(\d) (\d) (\d) (\d) (\d) (\d) (\d) (".*") (".*")')
|
||||
for j in range(rows):
|
||||
for k in range(columns):
|
||||
#add column location to read properties
|
||||
cell_info.append(cell_re.match(lines[i]).groups())
|
||||
cell_col.append(k)
|
||||
if lines[i][0] != "2":
|
||||
ncells = ncells + 1
|
||||
del lines[i]
|
||||
|
||||
lines[tabular_line] = '<LyXTabular version="1" rows="%s" columns="%s">' % (rows-len(cont_row),columns)
|
||||
del lines[i]
|
||||
if not lines[i]:
|
||||
del lines[i]
|
||||
|
||||
# Read cells
|
||||
l = 0
|
||||
cell_content = []
|
||||
for j in range(rows):
|
||||
cell_content.append([])
|
||||
|
||||
for j in range(rows):
|
||||
for k in range(columns):
|
||||
cell_content[j].append([])
|
||||
|
||||
for j in range(rows):
|
||||
for k in range(columns):
|
||||
m = j*columns + k
|
||||
if cell_info[m][0] == '2':
|
||||
continue
|
||||
|
||||
if l == ncells -1:
|
||||
# the end variable refers to cell end, not to file end.
|
||||
end = find_tokens(lines, ['\\layout','\\the_end','\\end_deeper','\\end_float'], i)
|
||||
else:
|
||||
end = find_token(lines, '\\newline', i)
|
||||
|
||||
if end == -1:
|
||||
file.error("Malformed LyX file.")
|
||||
|
||||
end = end - i
|
||||
while end > 0:
|
||||
cell_content[j][k].append(lines[i])
|
||||
del lines[i]
|
||||
end = end -1
|
||||
|
||||
if string.find(lines[i],'\\newline') != -1:
|
||||
del lines[i]
|
||||
l = l + 1
|
||||
|
||||
tmp = []
|
||||
tmp.append("")
|
||||
|
||||
for j in range(rows):
|
||||
if j in cont_row:
|
||||
continue
|
||||
tmp.append('<Row topline="%s" bottomline="%s" newpage="%s">' % (row_info[j][0],row_info[j][1],row_info[j][3]))
|
||||
|
||||
for k in range(columns):
|
||||
if j:
|
||||
tmp.append('<Column>')
|
||||
else:
|
||||
tmp.append('<Column alignment="%s" valignment="0" leftline="%s" rightline="%s" width=%s special=%s>' % (column_info[k][0],column_info[k][1], column_info[k][2], column_info[k][3], column_info[k][4]))
|
||||
m = j*columns + k
|
||||
|
||||
leftline = int(column_info[k][1])
|
||||
if cell_info[m][0] == '1':
|
||||
n = m + 1
|
||||
while n < rows * columns - 1 and cell_info[n][0] == '2':
|
||||
n = n + 1
|
||||
rightline = int(column_info[cell_col[n-1]][2])
|
||||
else:
|
||||
# not a multicolumn main cell
|
||||
rightline = int(column_info[k][2])
|
||||
|
||||
tmp.append('<Cell multicolumn="%s" alignment="%s" valignment="0" topline="%s" bottomline="%s" leftline="%d" rightline="%d" rotate="%s" usebox="%s" width=%s special=%s>' % (cell_info[m][0],cell_info[m][1],cell_info[m][2],cell_info[m][3],leftline,rightline,cell_info[m][5],cell_info[m][6],cell_info[m][7],cell_info[m][8]))
|
||||
tmp.append('\\begin_inset Text')
|
||||
tmp.append('')
|
||||
tmp.append('\\layout Standard')
|
||||
tmp.append('')
|
||||
|
||||
if cell_info[m][0] != '2':
|
||||
paragraph = []
|
||||
if cell_info[m][4] == '1':
|
||||
l = j
|
||||
paragraph = paragraph + cell_content[j][k]
|
||||
while cell_info[m][4] == '1':
|
||||
m = m + columns
|
||||
l = l + 1
|
||||
if l >= rows: break
|
||||
paragraph = paragraph + cell_content[l][k]
|
||||
else:
|
||||
paragraph = cell_content[j][k]
|
||||
tmp = tmp + set_paragraph_properties(paragraph, prop_dict)
|
||||
|
||||
tmp.append('\\end_inset ')
|
||||
tmp.append('</Cell>')
|
||||
tmp.append('</Column>')
|
||||
tmp.append('</Row>')
|
||||
|
||||
tmp.append('</LyXTabular>')
|
||||
tmp.append('')
|
||||
tmp.append('\\end_inset ')
|
||||
tmp.append('')
|
||||
tmp.append('')
|
||||
lines[i:i] = tmp
|
||||
|
||||
i = i + len(tmp)
|
||||
|
||||
|
||||
prop_exp = re.compile(r"\\(\S*)\s*(\S*)")
|
||||
|
||||
def set_paragraph_properties(lines, prop_dict):
|
||||
# we need to preserve the order of options
|
||||
properties = ["family","series","shape","size",
|
||||
"emph","bar","noun","latex","color"]
|
||||
prop_value = {"family" : "default", "series" : "medium",
|
||||
"shape" : "up", "size" : "normal",
|
||||
"emph" : "off", "bar" : "no",
|
||||
"noun" : "off", "latex" : "no_latex", "color" : "none"}
|
||||
|
||||
start = 0
|
||||
end = 0
|
||||
i = 0
|
||||
n = len(lines)
|
||||
|
||||
#skip empty lines
|
||||
while i<n and lines[i] == "":
|
||||
i = i + 1
|
||||
start = i
|
||||
|
||||
#catch open char properties
|
||||
while i<n and lines[i][:1] == "\\":
|
||||
result = prop_exp.match(lines[i])
|
||||
# sys.stderr.write(lines[i]+"\n")
|
||||
prop = result.group(1)
|
||||
if prop not in properties:
|
||||
break
|
||||
else:
|
||||
prop_dict[prop] = result.group(2)
|
||||
i = i + 1
|
||||
end = i
|
||||
|
||||
aux = []
|
||||
insert = 0
|
||||
for prop in properties:
|
||||
if prop_dict[prop] != 'default':
|
||||
insert = 1
|
||||
if prop == "color":
|
||||
aux.append("\\%s %s" % (prop, prop_dict[prop]))
|
||||
elif prop != "family" or prop_dict[prop] != "roman":
|
||||
aux.append("\\%s %s " % (prop, prop_dict[prop]))
|
||||
|
||||
# remove final char properties
|
||||
n = len(lines)
|
||||
changed_prop = []
|
||||
|
||||
while n:
|
||||
n = n - 1
|
||||
if not lines[n]:
|
||||
del lines[n]
|
||||
continue
|
||||
|
||||
if lines[n][:1] == '\\':
|
||||
result = prop_exp.match(lines[n])
|
||||
prop = result.group(1)
|
||||
if prop in properties:
|
||||
changed_prop.append(prop)
|
||||
prop_dict[prop] = result.group(2)
|
||||
del lines[n]
|
||||
continue
|
||||
|
||||
if check_token(lines[n],'\\end_inset'):
|
||||
# ensure proper newlines after inset end
|
||||
lines.append('')
|
||||
lines.append('')
|
||||
break
|
||||
|
||||
for line in lines[end:]:
|
||||
if line[:1] == '\\':
|
||||
result = prop_exp.match(line)
|
||||
prop = result.group(1)
|
||||
if prop in properties and prop not in changed_prop:
|
||||
prop_dict[prop] = result.group(2)
|
||||
|
||||
if not lines[start:] and not lines[end:]:
|
||||
return []
|
||||
|
||||
result = lines[:start] + aux[:] + lines[end:]
|
||||
if insert and result[0] != '':
|
||||
return [''] + result[:]
|
||||
|
||||
return result[:]
|
||||
|
||||
|
||||
def update_language(file):
|
||||
header = file.header
|
||||
i = find_token(header, "\\language", 0)
|
||||
if i == -1:
|
||||
# no language, should emit a warning
|
||||
header.append('\\language english')
|
||||
return
|
||||
# This is the lyx behaviour: defaults to english
|
||||
if string.split(header[i])[1] == 'default':
|
||||
header[i] = '\\language english'
|
||||
return
|
||||
|
||||
|
||||
convert = [[217, [update_tabular, update_language]]]
|
||||
revert = []
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
100
lib/lyx2lyx/lyx_1_3.py
Normal file
100
lib/lyx2lyx/lyx_1_3.py
Normal file
@ -0,0 +1,100 @@
|
||||
# This file is part of lyx2lyx
|
||||
# -*- coding: iso-8859-1 -*-
|
||||
# Copyright (C) 2002 Dekel Tsur <dekel@lyx.org>
|
||||
# Copyright (C) 2004 José Matos <jamatos@lyx.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
import string
|
||||
import re
|
||||
from parser_tools import find_token, find_end_of_inset, get_value,\
|
||||
find_token2, del_token
|
||||
|
||||
def change_insetgraphics(file):
|
||||
lines = file.body
|
||||
i = 0
|
||||
while 1:
|
||||
i = find_token(lines, "\\begin_inset Graphics", i)
|
||||
if i == -1:
|
||||
break
|
||||
j = find_end_of_inset(lines, i)
|
||||
|
||||
lines[i] = "\\begin_inset Graphics"
|
||||
|
||||
if get_value(lines, "display", i, j) == "default":
|
||||
j = del_token(lines, "display", i, j)
|
||||
if get_value(lines, "rotateOrigin", i, j) == "leftBaseline":
|
||||
j = del_token(lines, "rotateOrigin", i, j)
|
||||
|
||||
k = find_token2(lines, "rotate", i, j)
|
||||
if k != -1:
|
||||
del lines[k]
|
||||
j = j-1
|
||||
else:
|
||||
j = del_token(lines, "rotateAngle", i, j)
|
||||
|
||||
k = find_token2(lines, "size_type", i, j)
|
||||
if k == -1:
|
||||
k = find_token2(lines, "size_kind", i, j)
|
||||
if k != -1:
|
||||
size_type = string.split(lines[k])[1]
|
||||
del lines[k]
|
||||
j = j-1
|
||||
if size_type in ["0", "original"]:
|
||||
j = del_token(lines, "width", i, j)
|
||||
j = del_token(lines, "height", i, j)
|
||||
j = del_token(lines, "scale", i, j)
|
||||
elif size_type in ["2", "scale"]:
|
||||
j = del_token(lines, "width", i, j)
|
||||
j = del_token(lines, "height", i, j)
|
||||
if get_value(lines, "scale", i, j) == "100":
|
||||
j = del_token(lines, "scale", i, j)
|
||||
else:
|
||||
j = del_token(lines, "scale", i, j)
|
||||
|
||||
k = find_token2(lines, "lyxsize_type", i, j)
|
||||
if k == -1:
|
||||
k = find_token2(lines, "lyxsize_kind", i, j)
|
||||
if k != -1:
|
||||
lyxsize_type = string.split(lines[k])[1]
|
||||
del lines[k]
|
||||
j = j-1
|
||||
j = del_token(lines, "lyxwidth", i, j)
|
||||
j = del_token(lines, "lyxheight", i, j)
|
||||
if lyxsize_type not in ["2", "scale"] or \
|
||||
get_value(lines, "lyxscale", i, j) == "100":
|
||||
j = del_token(lines, "lyxscale", i, j)
|
||||
|
||||
i = i+1
|
||||
|
||||
|
||||
def change_tabular(file):
|
||||
lines = file.body
|
||||
i = 0
|
||||
while 1:
|
||||
i = find_token(lines, "<column", i)
|
||||
if i == -1:
|
||||
break
|
||||
if not re.search('width="0pt"', lines[i]):
|
||||
lines[i] = re.sub(' alignment=".*?"',' alignment="block"',lines[i])
|
||||
i = i+1
|
||||
|
||||
|
||||
convert = [[221, [change_insetgraphics, change_tabular]]]
|
||||
revert = []
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pass
|
55
lib/lyx2lyx/profiling.py
Executable file
55
lib/lyx2lyx/profiling.py
Executable file
@ -0,0 +1,55 @@
|
||||
#! /usr/bin/env python
|
||||
# -*- coding: iso-8859-1 -*-
|
||||
# Copyright (C) 2004 José Matos <jamatos@lyx.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# We need all this because lyx2lyx does not have the .py termination
|
||||
import imp
|
||||
lyx2lyx = imp.load_source("lyx2lyx", "lyx2lyx", open("lyx2lyx"))
|
||||
|
||||
# Profiler used in the study
|
||||
import hotshot, hotshot.stats
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
"""
|
||||
This program profiles lyx2lyx.
|
||||
Usage:
|
||||
./profiling.py option_to_lyx2lyx
|
||||
|
||||
Example:
|
||||
./profiling.py -ou.lyx ../doc/UserGuide.lyx
|
||||
"""
|
||||
|
||||
def main(argv):
|
||||
# This will only work with python >= 2.2, the version where this module was added
|
||||
prof = hotshot.Profile("lyx2lyx.prof") # Use temporary file, here?
|
||||
benchtime = prof.runcall(
|
||||
lambda : lyx2lyx.main(argv))
|
||||
prof.close()
|
||||
|
||||
# After the tests, show the profile analysis.
|
||||
stats = hotshot.stats.load("lyx2lyx.prof")
|
||||
stats.strip_dirs()
|
||||
stats.sort_stats('time', 'calls')
|
||||
stats.print_stats(20)
|
||||
|
||||
os.unlink("lyx2lyx.prof")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv)
|
78
src/frontends/qt2/ui/QPrefCygwinPathModule.ui
Normal file
78
src/frontends/qt2/ui/QPrefCygwinPathModule.ui
Normal file
@ -0,0 +1,78 @@
|
||||
<!DOCTYPE UI><UI>
|
||||
<class>QPrefCygwinPathModule</class>
|
||||
<include location="global">config.h</include>
|
||||
<include location="local">qt_helpers.h</include>
|
||||
<widget>
|
||||
<class>QWidget</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>QPrefCygwinPathModule</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>275</width>
|
||||
<height>91</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>caption</name>
|
||||
<string>Cygwin Paths</string>
|
||||
</property>
|
||||
<spacer>
|
||||
<property>
|
||||
<name>name</name>
|
||||
<cstring>Spacer1</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>orientation</name>
|
||||
<enum>Vertical</enum>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>sizeType</name>
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property>
|
||||
<name>sizeHint</name>
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget>
|
||||
<class>QCheckBox</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>pathCB</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>enabled</name>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>260</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>&Use Cygwin-style paths</string>
|
||||
</property>
|
||||
<property>
|
||||
<name>toolTip</name>
|
||||
<string></string>
|
||||
</property>
|
||||
<property>
|
||||
<name>whatsThis</name>
|
||||
<string>Select if LyX should output Cygwin-style paths rather than Windows-style paths. Useful if you're using the Cygwin teTeX rather than a native Windows MikTeX. Note, however, that you'll need to write shell script wrappers for all your converters.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</UI>
|
151
src/support/os_cygwin.C
Normal file
151
src/support/os_cygwin.C
Normal file
@ -0,0 +1,151 @@
|
||||
/**
|
||||
* \file os_cygwin.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Ruurd A. Reitsma
|
||||
* \author Claus Hentschel
|
||||
* \author Angus Leeming
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*
|
||||
* Various OS specific functions
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "support/os.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <io.h>
|
||||
|
||||
#include <sys/cygwin.h>
|
||||
|
||||
using std::endl;
|
||||
using std::string;
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace support {
|
||||
namespace os {
|
||||
|
||||
void os::init(int, char *[])
|
||||
{}
|
||||
|
||||
|
||||
string current_root()
|
||||
{
|
||||
return string("/");
|
||||
}
|
||||
|
||||
|
||||
string::size_type common_path(string const & p1, string const & p2)
|
||||
{
|
||||
string::size_type i = 0;
|
||||
string::size_type p1_len = p1.length();
|
||||
string::size_type p2_len = p2.length();
|
||||
while (i < p1_len && i < p2_len && uppercase(p1[i]) == uppercase(p2[i]))
|
||||
++i;
|
||||
if ((i < p1_len && i < p2_len)
|
||||
|| (i < p1_len && p1[i] != '/' && i == p2_len)
|
||||
|| (i < p2_len && p2[i] != '/' && i == p1_len))
|
||||
{
|
||||
if (i)
|
||||
--i; // here was the last match
|
||||
while (i && p1[i] != '/')
|
||||
--i;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
bool cygwin_path_fix_ = false;
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
string external_path(string const & p)
|
||||
{
|
||||
string dos_path;
|
||||
|
||||
// Translate from cygwin path syntax to dos path syntax
|
||||
if (cygwin_path_fix_ && is_absolute_path(p)) {
|
||||
char dp[PATH_MAX];
|
||||
cygwin_conv_to_full_win32_path(p.c_str(), dp);
|
||||
dos_path = !dp ? "" : dp;
|
||||
}
|
||||
|
||||
else return p;
|
||||
|
||||
//No backslashes in LaTeX files
|
||||
dos_path = subst(dos_path,'\\','/');
|
||||
|
||||
lyxerr[Debug::LATEX]
|
||||
<< "<Cygwin path correction> ["
|
||||
<< p << "]->>["
|
||||
<< dos_path << ']' << endl;
|
||||
return dos_path;
|
||||
}
|
||||
|
||||
|
||||
string internal_path(string const & p)
|
||||
{
|
||||
char posix_path[PATH_MAX];
|
||||
posix_path[0] = '\0';
|
||||
cygwin_conv_to_posix_path(p.c_str(), posix_path);
|
||||
return posix_path;
|
||||
}
|
||||
|
||||
|
||||
bool is_absolute_path(string const & p)
|
||||
{
|
||||
if (p.empty())
|
||||
return false;
|
||||
|
||||
bool isDosPath = (p.length() > 1 && p[1] == ':');
|
||||
bool isUnixPath = (p[0] == '/');
|
||||
|
||||
return isDosPath || isUnixPath;
|
||||
}
|
||||
|
||||
|
||||
// returns a string suitable to be passed to popen when
|
||||
// reading a pipe
|
||||
char const * popen_read_mode()
|
||||
{
|
||||
return "r";
|
||||
}
|
||||
|
||||
|
||||
string const & nulldev()
|
||||
{
|
||||
static string const nulldev_ = "/dev/null";
|
||||
return nulldev_;
|
||||
}
|
||||
|
||||
|
||||
shell_type shell()
|
||||
{
|
||||
return UNIX;
|
||||
}
|
||||
|
||||
|
||||
char path_separator()
|
||||
{
|
||||
return ':';
|
||||
}
|
||||
|
||||
|
||||
void cygwin_path_fix(bool use_cygwin_paths)
|
||||
{
|
||||
use_cygwin_paths_ = use_cygwin_paths;
|
||||
}
|
||||
|
||||
} // namespace os
|
||||
} // namespace support
|
||||
} // namespace lyx
|
Loading…
Reference in New Issue
Block a user