Commit 2a8829b5 authored by Atsuhito Kohda's avatar Atsuhito Kohda

Imported Upstream version 0.2.3

parents
This diff is collapsed.
License
=======
TeXworks is copyright (c) 2007-09 by Jonathan Kew.
Distributed under the terms of the GNU General Public License, version 2 or (at your option) any later version.
See the file COPYING for details.
The SyncTeX code is copyright (c) 2008, 2009 by JŽr™me Laurens; see synctex_parser.c for license details.
Building TeXworks
=================
Notes by Jonathan Kew, updated 2009-10-02
To build TeXworks from source, you will need to install developer packages (or equivalent) for:
- Qt4 (4.5.2 is recommended, although the application may build with versions as old as 4.3.x. Note that on GNU/Linux, TeXworks may crash when changing the spell-checking language when using Qt 4.3.x. Updating to at least Qt 4.4.0 solves this.)
http://qt.nokia.com/downloads
- Poppler (using the latest stable release, currently 0.12, is strongly recommended, although versions as old as the 0.6 series should still work)
http://poppler.freedesktop.org/
- Hunspell (release 1.2.8 is recommended; earlier 1.2.x releases may be used, although support for some non-Latin-script languages may be lacking)
http://hunspell.sourceforge.net/
- libdbus (on X11-based platforms only; not used on Mac OS X or Windows)
http://dbus.freedesktop.org/
along with their dependencies (such as Freetype, fontconfig, zlib, etc.) Details will depend on your platform. On Linux or similar systems, your package manager can probably provide all these.
After installing the necessary libraries (and their headers), check the TeXworks.pro file and update paths as necessary; some of the paths currently in the project file are specific to one of my build machines.
Once the project file is correct, run qmake to create a Makefile or Xcode project, and then run make or use Xcode to build the application. Do not run "qmake -pro" to recreate the .pro file, as it has been hand-edited.
The current TeXworks prototype has been successfully built with
- Xcode (using gcc 4) on Mac OS X (built on 10.5, but should run on 10.4 or later)
- MinGW release 5.1.4 on Windows XP (also runs on Vista and Windows 7)
- gcc 4 on GNU/Linux, various BSDs, etc.
Getting all the right libraries built and installed for the mingw32 build can be tricky. By slightly patching poppler 0.8.0, it is possible to build a version that does not depend on fontconfig (and thence on various other libraries), though it will then not work properly for PDFs with non-embedded fonts.
To avoid having to build the poppler dependencies for Windows, you can get precompiled libraries from the KDE on Windows project.
Further tips on building TeXworks from source are available on some of the wiki pages.
File added
<!DOCTYPE plist PUBLIC
"-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>tex</string>
<string>ltx</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>TeXworks-doc.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>text/plain</string>
</array>
<key>CFBundleTypeName</key>
<string>TeX Document</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSIsAppleDefaultForType</key>
<true/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>pdf</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>TeXworks-doc.icns</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/pdf</string>
</array>
<key>LSItemContentTypes</key>
<array>
<string>com.adobe.pdf</string>
</array>
<key>CFBundleTypeName</key>
<string>PDF Document</string>
</dict>
</array>
<key>CFBundleIconFile</key>
<string>TeXworks.icns</string>
<key>CFBundleGetInfoString</key>
<string>TeXworks version 0.2.3 (r.466)&#xA;(c) 2007-2009 Jonathan Kew&#xA;Released under GPL v2.0</string>
<key>CFBundleExecutable</key>
<string>TeXworks</string>
<key>CFBundleIdentifier</key>
<string>org.tug.texworks</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>0.2.3 (r.466)</string>
<key>CFBundleVersion</key>
<string>0.2.3 (r.466)</string>
<key>CSResourcesFileMapped</key>
<true/>
</dict>
</plist>
<!DOCTYPE plist PUBLIC
"-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>tex</string>
<string>ltx</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>TeXworks-doc.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>text/plain</string>
</array>
<key>CFBundleTypeName</key>
<string>TeX Document</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSIsAppleDefaultForType</key>
<true/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>pdf</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>TeXworks-doc.icns</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/pdf</string>
</array>
<key>LSItemContentTypes</key>
<array>
<string>com.adobe.pdf</string>
</array>
<key>CFBundleTypeName</key>
<string>PDF Document</string>
</dict>
</array>
<key>CFBundleIconFile</key>
<string>TeXworks.icns</string>
<key>CFBundleGetInfoString</key>
<string>TeXworks version @VER@ (r.@REV@)&#xA;(c) 2007-2009 Jonathan Kew&#xA;Released under GPL v2.0</string>
<key>CFBundleExecutable</key>
<string>TeXworks</string>
<key>CFBundleIdentifier</key>
<string>org.tug.texworks</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>@VER@ (r.@REV@)</string>
<key>CFBundleVersion</key>
<string>@VER@ (r.@REV@)</string>
<key>CSResourcesFileMapped</key>
<true/>
</dict>
</plist>
# This is part of TeXworks, an environment for working with TeX documents
# Copyright (C) 2007-08 Jonathan Kew
#
# 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, see <http://www.gnu.org/licenses/>.
#
# For links to further information, or to contact the author,
# see <http://texworks.org/>.
TEMPLATE = app
DEPENDPATH += ./src
INCLUDEPATH += ./src
MOC_DIR = ./moc
OBJECTS_DIR = ./obj
UI_DIR = ./ui
RCC_DIR = ./rcc
# comment this out if poppler's xpdf headers are not available on the build system
QMAKE_CXXFLAGS += -DHAVE_POPPLER_XPDF_HEADERS
unix:!macx {
TARGET = texworks
} else {
TARGET = TeXworks
}
QT += xml
CONFIG += rtti
unix {
system(./getDefaultBinPaths.sh):warning("Unable to determine TeX path, guessing defaults")
}
macx {
INCLUDEPATH += /usr/local/include/poppler
INCLUDEPATH += /usr/local/include/poppler/qt4
INCLUDEPATH += /usr/local/include/hunspell
LIBS += -L/usr/local/lib
LIBS += -lpoppler
LIBS += -lpoppler-qt4
LIBS += -lhunspell-1.2
QMAKE_INFO_PLIST = TeXworks.plist
CONFIG += x86 ppc
ICON = TeXworks.icns
}
unix:!macx { # on Unix-ish platforms we rely on pkgconfig, and use dbus
QT += dbus
CONFIG += link_pkgconfig
PKGCONFIG += hunspell
PKGCONFIG += poppler-qt4
PKGCONFIG += dbus-1
# Enclose the path in \\\" (which later gets expanded to \", which in turn
# gets expanded to " in the c++ code)
QMAKE_CXXFLAGS += -DTW_HELPPATH=\\\"/usr/local/share/texworks-help\\\"
}
linux-g++ {
# Qt/dbus config on Debian is broken, hence the lines below
LIBS += -lQtDBus
INCLUDEPATH += /usr/include/qt4/QtDBus
}
openbsd-g++ {
# Same bug exists in OpenBSD/qt4
LIBS += -lQtDBus
INCLUDEPATH += /usr/local/include/X11/qt4/QtDBus
}
win32 {
QTPLUGIN += qjpeg
# paths here are specific to my setup
INCLUDEPATH += c:/MinGW514/local/include
INCLUDEPATH += c:/MinGW514/local/include/poppler
INCLUDEPATH += c:/MinGW514/local/include/poppler/qt4
INCLUDEPATH += c:/MinGW514/local/include/hunspell
LIBS += -Lc:/MinGW514/local/lib
LIBS += -lpoppler-qt4
LIBS += -lpoppler
LIBS += -lfreetype
LIBS += -lhunspell-1.2
LIBS += -lz
LIBS += -lgdi32
RC_FILE = res/TeXworks.rc
}
# Input
HEADERS += src/TWApp.h \
src/TWUtils.h \
src/TeXDocument.h \
src/CompletingEdit.h \
src/TeXHighlighter.h \
src/TeXDocks.h \
src/PDFDocument.h \
src/PDFDocks.h \
src/FindDialog.h \
src/PrefsDialog.h \
src/TemplateDialog.h \
src/HardWrapDialog.h \
src/ConfirmDelete.h \
src/TWVersion.h \
src/SvnRev.h \
src/synctex_parser.h \
src/synctex_parser_utils.h
FORMS += src/TeXDocument.ui \
src/PDFDocument.ui \
src/Find.ui \
src/PDFFind.ui \
src/Replace.ui \
src/SearchResults.ui \
src/PrefsDialog.ui \
src/ToolConfig.ui \
src/TemplateDialog.ui \
src/HardWrapDialog.ui \
src/ConfirmDelete.ui
SOURCES += src/main.cpp \
src/TWApp.cpp \
src/TWUtils.cpp \
src/TeXDocument.cpp \
src/CompletingEdit.cpp \
src/TeXHighlighter.cpp \
src/TeXDocks.cpp \
src/PDFDocument.cpp \
src/PDFDocks.cpp \
src/FindDialog.cpp \
src/PrefsDialog.cpp \
src/TemplateDialog.cpp \
src/HardWrapDialog.cpp \
src/ConfirmDelete.cpp \
src/synctex_parser.c \
src/synctex_parser_utils.c
RESOURCES += res/resources.qrc \
res/resfiles.qrc
TRANSLATIONS += trans/TeXworks_ar.ts \
trans/TeXworks_ca.ts \
trans/TeXworks_cs.ts \
trans/TeXworks_de.ts \
trans/TeXworks_es.ts \
trans/TeXworks_fa.ts \
trans/TeXworks_fr.ts \
trans/TeXworks_it.ts \
trans/TeXworks_ja.ts \
trans/TeXworks_ko.ts \
trans/TeXworks_nl.ts \
trans/TeXworks_pl.ts \
trans/TeXworks_pt_BR.ts \
trans/TeXworks_ru.ts \
trans/TeXworks_sl.ts \
trans/TeXworks_tr.ts \
trans/TeXworks_zh_CN.ts
#!/bin/sh
PATHFILE=./src/DefaultBinaryPaths.h
FOUNDTEX=0
BINPATHS=":"
# append a path to $BINPATHS unless already present
appendPath()
{
NEWPATH="$1"
case "$BINPATHS" in
*:"$NEWPATH":*) echo $NEWPATH already present;;
*) # note that BINPATHS already ends with colon
BINPATHS="$BINPATHS$NEWPATH:";;
esac
}
# (1) try to find tex and ghostscript
TEX=`which tex`
if [ "$TEX" != "" ]; then
if [ -x "$TEX" ]; then
appendPath `dirname "$TEX"`
FOUNDTEX=1
fi
fi
GS=`which gs`
if [ "$GS" != "" ]; then
if [ -x "$GS" ]; then
appendPath `dirname "$GS"`
fi
fi
# (2) try to guess default TL path for the current system
# (no idea how much of this actually works....)
if [ -x /usr/share/libtool/config.guess ]; then
PLATFORM=`/usr/share/libtool/config.guess`
ARCH=`echo $PLATFORM | sed 's/-.*//;s/i.86/i386/'`
else
PLATFORM=`uname -s | tr A-Z a-z`
ARCH=`uname -m | tr A-Z a-z | sed 's/i.86/i386/'`
fi
case $PLATFORM in
*aix*) OS=aix;;
*cygwin*) OS=cygwin;;
*darwin*) OS=darwin;;
*freebsd*) OS=freebsd;;
*hpux*) OS=hpux;;
*irix*) OS=irix;;
*linux*) OS=linux;;
*netbsd*) OS=netbsd;;
*openbsd*) OS=openbsd;;
*solaris*) OS=solaris;;
*) OS=`echo $PLATFORM | sed 's/.*-//'`
esac
appendPath "/usr/local/texlive/2009/bin/$ARCH-$OS"
appendPath "/usr/local/texlive/2008/bin/$ARCH-$OS"
appendPath "/usr/local/texlive/2007/bin/$ARCH-$OS"
# (3) append default paths that we should always check
appendPath "/usr/local/bin"
appendPath "/usr/bin"
# strip leading and trailing colons from the list
BINPATHS=`echo $BINPATHS | sed 's/^://;s/:$//'`
echo "// Default paths to TeX binaries, for TeXworks" > $PATHFILE
echo "// Generated by $0" >> $PATHFILE
echo "#define DEFAULT_BIN_PATHS \"$BINPATHS\"" >> $PATHFILE
echo "configuring default paths for TeX binaries as:"
echo "$BINPATHS"
exit $FOUNDTEX
#!/bin/bash
# run at top level of texworks working copy
# ensure we are up-to-date with the repository
svn update
# get the current revision number
REV=`svn info | fgrep Revision: | cut -d ' ' -f 2`
if [ `svn status | grep -c "^[^?]"` == 0 ]; then
# make a new SvnRev.h file
echo "#define SVN_REVISION $REV" > src/SvnRev.h.new
echo "#define SVN_REVISION_STR \"$REV\"" >> src/SvnRev.h.new
# and check if it matches the existing one
diff src/SvnRev.h.new src/SvnRev.h > /dev/null
if [ $? == 0 ]; then
rm src/SvnRev.h.new
echo "revision is current"
fi
else
# if we have local modifications, we'll bump the revision number
REV=$((1+REV))
echo "#define SVN_REVISION $REV" > src/SvnRev.h.new
echo "#define SVN_REVISION_STR \"$REV\"" >> src/SvnRev.h.new
fi
# is there a new revision file?
if [ -e src/SvnRev.h.new ]; then
mv src/SvnRev.h.new src/SvnRev.h
VER=`fgrep TEXWORKS_VERSION src/TWVersion.h | cut -d '"' -f 2`
sed -e "s/@VER@/$VER/;s/@REV@/$REV/;" <TeXworks.plist.in >TeXworks.plist
cp TeXworks.plist Info.plist
echo "revision updated"
svn status # show status, as a reminder to commit the change(s)
fi
#!/bin/bash
# this script is currently only set up to run on the Mac....
QTDIR=/Developer/Applications/Qt
# the resource file list that we will build
RESFILES=res/resfiles.qrc
# first, ensure that all translations specified in the .pro are compiled
lrelease -compress TeXworks.pro
# collect any corresponding Qt translations for the languages we know about
for f in trans/TeXworks_*.qm; do
f=${f#trans/}
q=${QTDIR}/${f/TeXworks/qt}
if [ -e ${q} ]; then
cp ${q} res/resfiles/translations/
else
# no Qt-supplied file, check for a local qt_* file as well
q=trans/${f/TeXworks/qt}
if [ -e ${q} ]; then
cp ${q} res/resfiles/translations/
fi
fi
done
# other resource files are currently maintained by hand directly in the resfiles directories
# build the resfiles list
echo '<RCC>' > $RESFILES
echo '<qresource>' >> $RESFILES
# list all the hand-maintained resource files in the source tree
find res/resfiles -type f -print | fgrep -v .svn | fgrep -v .DS_Store | sed -e 's!res/\(.*\)!<file>\1</file>!' >> $RESFILES
# list the compiled translations from the trans directory
find trans -name 'TeXworks_*.qm' | sed -e 's!trans/\(.*\)!<file alias="resfiles/translations/\1">../trans/\1</file>!' >> $RESFILES
echo '</qresource>' >> $RESFILES
echo '</RCC>' >> $RESFILES
texworks poppler-patches directory
==================================
The Windows and Mac OS X builds of texworks are created using a slightly patched
version of poppler, to provide some added support for platform fonts (on OS X,
and when building with mingw32 on Windows) and to allow the use of a "local"
poppler-data directory as we cannot expect a system-wide poppler installation on
these platforms.
This directory contains the relevant patches, as used with poppler-0.12 for the
TeXworks 0.2 release.
This diff is collapsed.
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index 7cb2ffc..f92ce41 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -33,8 +33,6 @@
#pragma interface
#endif
-#include "config.h"
-
#include <assert.h>
#include "poppler-config.h"
#include <stdio.h>
diff --git a/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc
index 877db52..2310c87 100644
--- a/qt4/src/poppler-document.cc
+++ b/qt4/src/poppler-document.cc
@@ -39,6 +39,7 @@
namespace Poppler {
int DocumentData::count = 0;
+ GBool DocumentData::ownGlobalParams = gFalse;
Document *Document::load(const QString &filePath, const QByteArray &ownerPassword,
const QByteArray &userPassword)
diff --git a/qt4/src/poppler-private.h b/qt4/src/poppler-private.h
index acf3124..5d5c301 100644
--- a/qt4/src/poppler-private.h
+++ b/qt4/src/poppler-private.h
@@ -103,7 +103,11 @@ namespace Poppler {
if ( count == 0 )
{
- globalParams = new GlobalParams();
+ if ( !globalParams )
+ {
+ globalParams = new GlobalParams();
+ ownGlobalParams = gTrue;
+ }
setErrorFunction(qt4ErrorFunction);
}
count ++;
@@ -118,7 +122,15 @@ namespace Poppler {
delete m_fontInfoIterator;
count --;
- if ( count == 0 ) delete globalParams;
+ if ( count == 0 )
+ {
+ if ( ownGlobalParams )
+ {
+ delete globalParams;
+ globalParams = NULL;
+ ownGlobalParams = gFalse;
+ }
+ }
}
OutputDev *getOutputDev()
@@ -204,6 +216,7 @@ namespace Poppler {
QColor paperColor;
int m_hints;
static int count;
+ static GBool ownGlobalParams;
};
class FontInfoData
diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h
index fd384f5..4f5d639 100644
--- a/qt4/src/poppler-qt4.h
+++ b/qt4/src/poppler-qt4.h
@@ -1114,7 +1114,7 @@ QString subject = m_doc->info("Subject");
Destructor.
*/
~Document();
-
+
private:
Q_DISABLE_COPY(Document)
#include <windows.h>
#include "../src/TWVersion.h"
#include "../src/SvnRev.h"
IDI_ICON1 ICON DISCARDABLE "images/TeXworks.ico"
IDI_ICON2 ICON DISCARDABLE "images/TeXworks-doc.ico"
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_MAJOR,VER_MINOR,VER_BUGFIX,SVN_REVISION
PRODUCTVERSION VER_MAJOR,VER_MINOR,VER_BUGFIX,SVN_REVISION
FILEFLAGSMASK 0
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE 0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "TeX Users Group"
VALUE "FileDescription", "TeXworks editor & previewer"
VALUE "FileVersion", TEXWORKS_VERSION ".r" SVN_REVISION_STR
VALUE "InternalName", "TeXworks"
VALUE "LegalCopyright", "Copyright (c) 2007-2009 Jonathan Kew"
VALUE "OriginalFilename", "TeXworks.exe"
VALUE "ProductName", "TeXworks"
VALUE "ProductVersion", "TeXworks " TEXWORKS_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END