Merge branch 'master' of git.lyx.org:lyx

This commit is contained in:
Juergen Spitzmueller 2012-08-20 09:32:04 +02:00
commit c235e73301
12 changed files with 300 additions and 63 deletions

View File

@ -5,10 +5,10 @@
# This script automates creating universal binaries of LyX on Mac. # This script automates creating universal binaries of LyX on Mac.
# Author: Bennett Helm (and extended by Konrad Hofbauer) # Author: Bennett Helm (and extended by Konrad Hofbauer)
# latest changes by Stephan Witt # latest changes by Stephan Witt
# Last modified: January 2011 # Last modified: August 2012
MAC_API=-cocoa MAC_API=-cocoa
Qt4Version="4.6.3" Qt4Version=${Qt4Version:-"4.6.3"}
Qt4SourceVersion="qt-everywhere-opensource-src-${Qt4Version}" Qt4SourceVersion="qt-everywhere-opensource-src-${Qt4Version}"
Qt4BuildSubDir="qt-${Qt4Version}-build${MAC_API}" Qt4BuildSubDir="qt-${Qt4Version}-build${MAC_API}"
@ -34,7 +34,7 @@ Qt4ConfigureOptions="${Qt4ConfigureOptions} -nomake examples -nomake demos -noma
Qt4ConfigureOptions="${Qt4ConfigureOptions} ${MAC_API}" Qt4ConfigureOptions="${Qt4ConfigureOptions} ${MAC_API}"
aspell_dictionaries="no" aspell_dictionaries="no"
hunspell_dictionaries="no" hunspell_dictionaries="yes"
aspell_deployment="yes" aspell_deployment="yes"
hunspell_deployment="yes" hunspell_deployment="yes"
@ -46,23 +46,23 @@ MACOSX_DEPLOYMENT_TARGET="10.4" # Tiger support is default
SDKROOT="/Developer/SDKs/MacOSX10.5.sdk" # Leopard build is default SDKROOT="/Developer/SDKs/MacOSX10.5.sdk" # Leopard build is default
# detection of script home # detection of script home
LyxSourceDir=`dirname "$0"` LyxSourceDir=$(dirname "$0")
if [ ! -d "${LyxSourceDir}" ]; then if [ ! -d "${LyxSourceDir}" ]; then
echo Missing LyX source directory. echo Missing LyX source directory.
exit 2 exit 2
fi fi
case "${LyxSourceDir}" in case "${LyxSourceDir}" in
/*/development) /*/development)
LyxSourceDir=`dirname "${LyxSourceDir}"` LyxSourceDir=$(dirname "${LyxSourceDir}")
;; ;;
/*) /*)
;; ;;
*/development|development) */development|development)
LyxSourceDir=`dirname "${LyxSourceDir}"` LyxSourceDir=$(dirname "${LyxSourceDir}")
LyxSourceDir=`cd "${LyxSourceDir}";pwd` LyxSourceDir=$(cd "${LyxSourceDir}";pwd)
;; ;;
*) *)
LyxSourceDir=`cd "${LyxSourceDir}";pwd` LyxSourceDir=$(cd "${LyxSourceDir}";pwd)
;; ;;
esac esac
@ -93,7 +93,7 @@ usage() {
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case "${1}" in case "${1}" in
--with-qt4-frameworks=*) --with-qt4-frameworks=*)
configure_qt4_frameworks=`echo ${1}|cut -d= -f2` configure_qt4_frameworks=$(echo ${1}|cut -d= -f2)
if [ "$configure_qt4_frameworks" = "yes" ]; then if [ "$configure_qt4_frameworks" = "yes" ]; then
unset QTDIR unset QTDIR
qt4_deployment="no" qt4_deployment="no"
@ -101,15 +101,15 @@ while [ $# -gt 0 ]; do
shift shift
;; ;;
--with-qt4-dir=*) --with-qt4-dir=*)
QTDIR=`echo ${1}|cut -d= -f2` QTDIR=$(echo ${1}|cut -d= -f2)
shift shift
;; ;;
--with-macosx-target=*) --with-macosx-target=*)
MACOSX_DEPLOYMENT_TARGET=`echo ${1}|cut -d= -f2` MACOSX_DEPLOYMENT_TARGET=$(echo ${1}|cut -d= -f2)
shift shift
;; ;;
--with-sdkroot=*) --with-sdkroot=*)
SDKROOT=`echo ${1}|cut -d= -f2` SDKROOT=$(echo ${1}|cut -d= -f2)
case "${SDKROOT}" in case "${SDKROOT}" in
10.4) 10.4)
SDKROOT="/Developer/SDKs/MacOSX10.4u.sdk" SDKROOT="/Developer/SDKs/MacOSX10.4u.sdk"
@ -127,34 +127,34 @@ while [ $# -gt 0 ]; do
shift shift
;; ;;
--aspell-deployment=*) --aspell-deployment=*)
aspell_deployment=`echo ${1}|cut -d= -f2` aspell_deployment=$(echo ${1}|cut -d= -f2)
aspell_dictionaries=$aspell_deployment aspell_dictionaries=$aspell_deployment
shift shift
;; ;;
--hunspell-deployment=*) --hunspell-deployment=*)
hunspell_deployment=`echo ${1}|cut -d= -f2` hunspell_deployment=$(echo ${1}|cut -d= -f2)
hunspell_dictionaries=$hunspell_deployment hunspell_dictionaries=$hunspell_deployment
shift shift
;; ;;
--thesaurus-deployment=*) --thesaurus-deployment=*)
thesaurus_deployment=`echo ${1}|cut -d= -f2` thesaurus_deployment=$(echo ${1}|cut -d= -f2)
shift shift
;; ;;
--qt4-deployment=*) --qt4-deployment=*)
qt4_deployment=`echo ${1}|cut -d= -f2` qt4_deployment=$(echo ${1}|cut -d= -f2)
shift shift
;; ;;
--with-arch=*) --with-arch=*)
ARCH=`echo ${1}|cut -d= -f2|tr ',' ' '` ARCH=$(echo ${1}|cut -d= -f2|tr ',' ' ')
ARCH_LIST="${ARCH_LIST} ${ARCH}" ARCH_LIST="${ARCH_LIST} ${ARCH}"
shift shift
;; ;;
--with-dmg-location=*) --with-dmg-location=*)
DMGLocation=`echo ${1}|cut -d= -f2` DMGLocation=$(echo ${1}|cut -d= -f2)
shift shift
;; ;;
--with-build-path=*) --with-build-path=*)
LyxBuildDir=`echo ${1}|cut -d= -f2` LyxBuildDir=$(echo ${1}|cut -d= -f2)
shift shift
;; ;;
--help|--help=*) --help|--help=*)
@ -171,7 +171,7 @@ while [ $# -gt 0 ]; do
shift shift
;; ;;
--only-package=*) --only-package=*)
LyxOnlyPackage=`echo ${1}|cut -d= -f2` LyxOnlyPackage=$(echo ${1}|cut -d= -f2)
shift shift
;; ;;
--*) --*)
@ -196,26 +196,26 @@ ARCH_LIST=${ARCH_LIST:-"ppc i386"}
strip="-strip" strip="-strip"
aspellstrip= aspellstrip=
LyxBuildDir=${LyxBuildDir:-`dirname "${LyxSourceDir}"`/lyx-build} LyxBuildDir=${LyxBuildDir:-$(dirname "${LyxSourceDir}")/lyx-build}
DMGLocation=${DMGLocation:-"${LyxBuildDir}"} DMGLocation=${DMGLocation:-"${LyxBuildDir}"}
ASpellSourceDir=${ASPELLDIR:-`dirname "${LyxSourceDir}"`/${ASpellSourceVersion}} ASpellSourceDir=${ASPELLDIR:-$(dirname "${LyxSourceDir}")/${ASpellSourceVersion}}
ASpellInstallDir=${ASpellInstallDir:-"${LyxBuildDir}"/SpellChecker.lib} ASpellInstallDir=${ASpellInstallDir:-"${LyxBuildDir}"/SpellChecker.lib}
HunSpellSourceDir=${HUNSPELLDIR:-`dirname "${LyxSourceDir}"`/${HunSpellSourceVersion}} HunSpellSourceDir=${HUNSPELLDIR:-$(dirname "${LyxSourceDir}")/${HunSpellSourceVersion}}
HunSpellInstallDir=${HunSpellInstallDir:-"${LyxBuildDir}"/SpellChecker.lib} HunSpellInstallDir=${HunSpellInstallDir:-"${LyxBuildDir}"/SpellChecker.lib}
Qt4SourceDir=${QT4SOURCEDIR:-`dirname "${LyxSourceDir}"`/${Qt4SourceVersion}} Qt4SourceDir=${QT4SOURCEDIR:-$(dirname "${LyxSourceDir}")/${Qt4SourceVersion}}
Qt4BuildDir=${Qt4BuildDir:-"${LyxBuildDir}"/${Qt4BuildSubDir:-"qt4-build"}} Qt4BuildDir=${Qt4BuildDir:-"${LyxBuildDir}"/${Qt4BuildSubDir:-"qt4-build"}}
DictionarySourceDir=${DICTIONARYDIR:-`dirname "${LyxSourceDir}"`/dictionaries} DictionarySourceDir=${DICTIONARYDIR:-$(dirname "${LyxSourceDir}")/dictionaries}
DocumentationDir=`dirname "${LyxSourceDir}"`/Documents DocumentationDir=$(dirname "${LyxSourceDir}")/Documents
DmgBackground="${LyxSourceDir}"/development/MacOSX/dmg-background.png DmgBackground="${LyxSourceDir}"/development/MacOSX/dmg-background.png
ASpellInstallHdr="${ASpellInstallDir}/include/aspell.h" ASpellInstallHdr="${ASpellInstallDir}/include/aspell.h"
HunSpellInstallHdr="${HunSpellInstallDir}/include/hunspell/hunspell.h" HunSpellInstallHdr="${HunSpellInstallDir}/include/hunspell/hunspell.h"
if [ -z "${LyXVersion}" ]; then if [ -z "${LyXVersion}" ]; then
LyXVersion=`grep AC_INIT "${LyxSourceDir}"/configure.ac | cut -d, -f2 | tr -d " ()"` LyXVersion=$(grep AC_INIT "${LyxSourceDir}"/configure.ac | cut -d, -f2 | tr -d " ()")
fi fi
LyXVersionSuffix=${LyXVersionSuffix:-`echo "${LyXVersion}" | cut -d. -f1-2`} LyXVersionSuffix=${LyXVersionSuffix:-$(echo "${LyXVersion}" | cut -d. -f1-2)}
LyxName="LyX" LyxName="LyX"
LyxBase="${LyxName}-${LyXVersion}" LyxBase="${LyxName}-${LyXVersion}"
@ -237,7 +237,7 @@ DMGNAME="${LyxBase}"
DMGSIZE="550m" DMGSIZE="550m"
# Check for existing SDKs # Check for existing SDKs
SDKs=`echo /Developer/SDKs/MacOSX10*sdk` SDKs=$(echo /Developer/SDKs/MacOSX10*sdk)
case "$SDKs" in case "$SDKs" in
${SDKROOT}) ${SDKROOT})
;; ;;
@ -301,7 +301,7 @@ if [ -d "${HunSpellSourceDir}" -a ! -f "${HunSpellInstallHdr}" ]; then
# we have a private HunSpell source tree at hand... # we have a private HunSpell source tree at hand...
# so let's build and install it # so let's build and install it
if [ -z "${HunSpellVersion}" ]; then if [ -z "${HunSpellVersion}" ]; then
HunSpellVersion=`grep AC_INIT "${HunSpellSourceDir}"/configure.ac | cut -d, -f2|tr -d " ()"` HunSpellVersion=$(grep AC_INIT "${HunSpellSourceDir}"/configure.ac | cut -d, -f2|tr -d " ()")
fi fi
HunSpellName="Hunspell" HunSpellName="Hunspell"
@ -322,7 +322,7 @@ if [ -d "${HunSpellSourceDir}" -a ! -f "${HunSpellInstallHdr}" ]; then
make distclean make distclean
CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export CPPFLAGS CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export CPPFLAGS
LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export LDFLAGS LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export LDFLAGS
HOSTSYSTEM=`eval "echo \\$HostSystem_$arch"` HOSTSYSTEM=$(eval "echo \\$HostSystem_$arch")
"${HunSpellSourceDir}/configure"\ "${HunSpellSourceDir}/configure"\
--prefix="${HunSpellInstallDir}"\ --prefix="${HunSpellInstallDir}"\
${HunspellConfigureOptions} ${HunspellConfigureOptions}
@ -364,7 +364,7 @@ if [ -d "${ASpellSourceDir}" -a ! -f "${ASpellInstallHdr}" -a "yes" = "${aspell_
# we have a private ASpell source tree at hand... # we have a private ASpell source tree at hand...
# so let's build and install it # so let's build and install it
if [ -z "${ASpellVersion}" ]; then if [ -z "${ASpellVersion}" ]; then
ASpellVersion=`grep AC_INIT "${ASpellSourceDir}"/configure.ac | cut -d, -f2|tr -d " ()"` ASpellVersion=$(grep AC_INIT "${ASpellSourceDir}"/configure.ac | cut -d, -f2|tr -d " ()")
fi fi
ASpellName="Aspell" ASpellName="Aspell"
@ -386,7 +386,7 @@ if [ -d "${ASpellSourceDir}" -a ! -f "${ASpellInstallHdr}" -a "yes" = "${aspell_
make distclean make distclean
CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export CPPFLAGS CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export CPPFLAGS
LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export LDFLAGS LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export LDFLAGS
HOSTSYSTEM=`eval "echo \\$HostSystem_$arch"` HOSTSYSTEM=$(eval "echo \\$HostSystem_$arch")
CXXFLAGS=-g "${ASpellSourceDir}/configure"\ CXXFLAGS=-g "${ASpellSourceDir}/configure"\
--prefix="${ASpellInstallDir}"\ --prefix="${ASpellInstallDir}"\
${AspellConfigureOptions} ${AspellConfigureOptions}
@ -442,7 +442,7 @@ build_lyx() {
( cd "${LyxSourceDir}" && sh autogen.sh ) ( cd "${LyxSourceDir}" && sh autogen.sh )
else else
find "${LyxSourceDir}" -name Makefile.am -print | while read file ; do find "${LyxSourceDir}" -name Makefile.am -print | while read file ; do
dname=`dirname "$file"` dname=$(dirname "$file")
if [ -f "$dname/Makefile.in" -a "$dname/Makefile.in" -ot "$file" ]; then if [ -f "$dname/Makefile.in" -a "$dname/Makefile.in" -ot "$file" ]; then
( cd "${LyxSourceDir}" && sh autogen.sh ) ( cd "${LyxSourceDir}" && sh autogen.sh )
break break
@ -459,8 +459,8 @@ build_lyx() {
fi fi
if [ -d "${HunSpellInstallDir}" -a "yes" = "${hunspell_deployment}" ]; then if [ -d "${HunSpellInstallDir}" -a "yes" = "${hunspell_deployment}" ]; then
HunSpellFramework=`framework_name Hunspell` HunSpellFramework=$(framework_name Hunspell)
HunSpellFramework=`basename "${HunSpellFramework}"` HunSpellFramework=$(basename "${HunSpellFramework}")
ConfigureExtraInc="--with-extra-inc=${HunSpellInstallDir}/include" ConfigureExtraInc="--with-extra-inc=${HunSpellInstallDir}/include"
ConfigureExtraLib="--with-extra-lib=${HunSpellInstallDir}/lib" ConfigureExtraLib="--with-extra-lib=${HunSpellInstallDir}/lib"
# LyXConfigureOptions="${LyXConfigureOptions} --with-hunspell-framework=${HunSpellFramework}" # LyXConfigureOptions="${LyXConfigureOptions} --with-hunspell-framework=${HunSpellFramework}"
@ -475,7 +475,7 @@ build_lyx() {
CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}" CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"
LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}" LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"
HOSTSYSTEM=`eval "echo \\$HostSystem_$arch"` HOSTSYSTEM=$(eval "echo \\$HostSystem_$arch")
if [ "$configure_qt4_frameworks" = "yes" ]; then if [ "$configure_qt4_frameworks" = "yes" ]; then
export QT4_CORE_CFLAGS="-FQtCore" export QT4_CORE_CFLAGS="-FQtCore"
@ -512,17 +512,17 @@ build_lyx() {
content_directory() { content_directory() {
target="$1" target="$1"
content=`dirname "${target}"` content=$(dirname "${target}")
content=`dirname "${content}"` content=$(dirname "${content}")
echo "${content}" echo "${content}"
} }
private_framework() { private_framework() {
fwdir=`framework_name "$1"` fwdir=$(framework_name "$1")
source="$2" source="$2"
target="$3" target="$3"
condir=`content_directory "${target}"` condir=$(content_directory "${target}")
libnm=`basename "${source}"` libnm=$(basename "${source}")
mkdir -p "${condir}/${fwdir}" mkdir -p "${condir}/${fwdir}"
if [ ! -f "${condir}/${fwdir}/${libnm}" ]; then if [ ! -f "${condir}/${fwdir}/${libnm}" ]; then
cp -p "${source}" "${condir}/${fwdir}" cp -p "${source}" "${condir}/${fwdir}"
@ -537,7 +537,7 @@ deploy_qtlibs() {
source="${QtInstallDir}" source="${QtInstallDir}"
target="$1" target="$1"
version="Versions/${QtFrameworkVersion}/" version="Versions/${QtFrameworkVersion}/"
condir=`content_directory "${target}"` condir=$(content_directory "${target}")
mkdir -p "${condir}/Resources" mkdir -p "${condir}/Resources"
test -f "${condir}/Resources/qt.conf" || cat - > "${condir}/Resources/qt.conf" <<-EOF test -f "${condir}/Resources/qt.conf" || cat - > "${condir}/Resources/qt.conf" <<-EOF
[Paths] [Paths]
@ -548,24 +548,24 @@ EOF
mkdir -p "${condir}/PlugIns" mkdir -p "${condir}/PlugIns"
find "${source}/plugins" -name \*.dylib -print | while read libname ; do find "${source}/plugins" -name \*.dylib -print | while read libname ; do
echo Copy plugin "${libname}" echo Copy plugin "${libname}"
dylib=`basename "${libname}"` dylib=$(basename "${libname}")
dirname=`dirname "${libname}"` dirname=$(dirname "${libname}")
dirname=`basename "${dirname}"` dirname=$(basename "${dirname}")
mkdir -p "${condir}/PlugIns/${dirname}" mkdir -p "${condir}/PlugIns/${dirname}"
cp -p "${libname}" "${condir}/PlugIns/${dirname}" cp -p "${libname}" "${condir}/PlugIns/${dirname}"
done done
fi fi
for libnm in ${QtLibraries} ; do for libnm in ${QtLibraries} ; do
fwdir=`framework_name "$libnm"` fwdir=$(framework_name "$libnm")
dirname=`dirname "${fwdir}"` dirname=$(dirname "${fwdir}")
mkdir -p "${condir}/${dirname}" mkdir -p "${condir}/${dirname}"
dirname=`basename "${fwdir}"` dirname=$(basename "${fwdir}")
test -d "${condir}/${fwdir}" || ( test -d "${condir}/${fwdir}" || (
echo Copy framework "${source}/lib/"`basename "${fwdir}"` echo Copy framework "${source}/lib/"$(basename "${fwdir}")
cp -pR "${source}/lib/"`basename "${fwdir}"` "${condir}/${fwdir}" cp -pR "${source}/lib/"$(basename "${fwdir}") "${condir}/${fwdir}"
echo Set library id in "${condir}/${fwdir}/${version}${libnm}" echo Set library id in "${condir}/${fwdir}/${version}${libnm}"
install_name_tool -id "@executable_path/../${fwdir}/${version}${libnm}" "${condir}/${fwdir}/${version}${libnm}" install_name_tool -id "@executable_path/../${fwdir}/${version}${libnm}" "${condir}/${fwdir}/${version}${libnm}"
find "${condir}/PlugIns" "${condir}/"`dirname "${fwdir}"` -name Headers -prune -o -type f -print | while read filename ; do find "${condir}/PlugIns" "${condir}/"$(dirname "${fwdir}") -name Headers -prune -o -type f -print | while read filename ; do
if [ "${filename}" != "${target}" ]; then if [ "${filename}" != "${target}" ]; then
otool -L "${filename}" 2>/dev/null | sort -u | while read library ; do otool -L "${filename}" 2>/dev/null | sort -u | while read library ; do
# pattern match for: /path/to/qt4/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.6.0, current version 4.6.2) # pattern match for: /path/to/qt4/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.6.0, current version 4.6.2)
@ -697,9 +697,9 @@ EOF
make_dmg() { make_dmg() {
cd "${1}" cd "${1}"
BGSIZE=`file "$DmgBackground" | awk -F , '/PNG/{print $2 }' | tr x ' '` BGSIZE=$(file "$DmgBackground" | awk -F , '/PNG/{print $2 }' | tr x ' ')
BG_W=`echo ${BGSIZE} | awk '{print $1 }'` BG_W=$(echo ${BGSIZE} | awk '{print $1 }')
BG_H=`echo ${BGSIZE} | awk '{print $2 }'` BG_H=$(echo ${BGSIZE} | awk '{print $2 }')
rm -f "${DMGNAME}.sparseimage" "${DMGNAME}.dmg" rm -f "${DMGNAME}.sparseimage" "${DMGNAME}.dmg"

View File

@ -37,5 +37,9 @@
<string>@VERSION@</string> <string>@VERSION@</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>OLYX</string> <string>OLYX</string>
<key>NSAppleScriptEnabled</key>
<string>YES</string>
<key>OSAScriptingDefinition</key>
<string>LyX.sdef</string>
</dict> </dict>
</plist> </plist>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">
<!--
This file is part of LyX, the document processor.
Licence details can be found in the file COPYING.
author: Benjamin Piwowarski
Full author contact details are available in file CREDITS.
-->
<!-- declare the namespace for using XInclude so we can include the standard suite -->
<dictionary xmlns:xi="http://www.w3.org/2003/XInclude">
<!-- use XInclude to include the standard suite -->
<!-- <xi:include href="file:///System/Library/ScriptingDefinitions/CocoaStandard.sdef" xpointer="xpointer(/dictionary/suite)"/> -->
<!-- our special scripting suite for this example -->
<suite name="Lyx" code="LYX " description="LyX scripting facilities.">
<record-type name="LyX return value" code="LyxR">
<property name="code" code="code" type="integer"
description="Error code (0 in case of success).">
<cocoa key="code"/>
</property>
<property name="message" code="mess" type="text"
description="The returned message.">
<cocoa key="message"/>
</property>
</record-type>
<command name="run" code="SLyxComm" description="run a simple command with one parameter">
<cocoa class="LyxCommand"/>
<direct-parameter description="The command to be executed.">
<type type="text" list="no"/>
</direct-parameter>
<parameter name="with argument" code="args" type="text">
<cocoa key="arg"/>
</parameter>
<result type="LyX return value" description="Contains a code (0 for success) and the message returned by LyX"/>
</command>
</suite>
</dictionary>

View File

@ -10,7 +10,7 @@ nodist_bundle_DATA = Info.plist
dist_bin_SCRIPTS = lyxeditor dist_bin_SCRIPTS = lyxeditor
dist_pkgdata_DATA = COPYING LyXapp.icns LyX.icns dist_pkgdata_DATA = COPYING LyXapp.icns LyX.icns LyX.sdef
nodist_pkgdata_DATA = lyxrc.dist nodist_pkgdata_DATA = lyxrc.dist

View File

@ -574,6 +574,7 @@ HEADERS += \
../../src/support/gzstream.h \ ../../src/support/gzstream.h \
../../src/support/lassert.h \ ../../src/support/lassert.h \
../../src/support/limited_stack.h \ ../../src/support/limited_stack.h \
../../src/support/linkback/AppleScript.h \
../../src/support/linkback/LinkBack.h \ ../../src/support/linkback/LinkBack.h \
../../src/support/linkback/LinkBackProxy.h \ ../../src/support/linkback/LinkBackProxy.h \
../../src/support/linkback/LinkBackServer.h \ ../../src/support/linkback/LinkBackServer.h \

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: LyX-2.1\n" "Project-Id-Version: LyX-2.1\n"
"Report-Msgid-Bugs-To: lyx-devel@lists.lyx.org\n" "Report-Msgid-Bugs-To: lyx-devel@lists.lyx.org\n"
"POT-Creation-Date: 2012-08-18 13:20+0200\n" "POT-Creation-Date: 2012-08-19 17:38+0200\n"
"PO-Revision-Date: 2012-04-08 11:27+0100\n" "PO-Revision-Date: 2012-04-08 11:27+0100\n"
"Last-Translator: Kornel Benko <kornel@lyx.org>\n" "Last-Translator: Kornel Benko <kornel@lyx.org>\n"
"Language-Team: Slovak <lyx-docs@lists.lyx.org>\n" "Language-Team: Slovak <lyx-docs@lists.lyx.org>\n"
@ -11765,9 +11765,9 @@ msgstr "Concrete Roman"
msgid "Zapf Chancery" msgid "Zapf Chancery"
msgstr "Zapf Chancery" msgstr "Zapf Chancery"
#: src/frontends/qt4/GuiDocument.cpp:130 #: lib/latexfonts:96
msgid "Bitstream Charter" msgid "Bitstream Charter (PSNFSS)"
msgstr "Bitstream Charter" msgstr "Bitstream Charter (PSNFSS)"
#: src/frontends/qt4/GuiDocument.cpp:128 #: src/frontends/qt4/GuiDocument.cpp:128
msgid "Computer Modern Roman" msgid "Computer Modern Roman"
@ -11781,6 +11781,18 @@ msgstr "Libertine"
msgid "Latin Modern Roman" msgid "Latin Modern Roman"
msgstr "Latin Modern Roman" msgstr "Latin Modern Roman"
#: lib/latexfonts:122
msgid "Bitstream Charter (Mathdesign)"
msgstr "Bitstream Charter (Mathdesign)"
#: lib/latexfonts:133
msgid "Utopia (Mathdesign)"
msgstr "Utopia (Mathdesign)"
#: lib/latexfonts:144
msgid "Adobe Garamond (Mathdesign)"
msgstr "Adobe Garamond (Mathdesign)"
#: src/frontends/qt4/GuiDocument.cpp:130 #: src/frontends/qt4/GuiDocument.cpp:130
msgid "New Century Schoolbook" msgid "New Century Schoolbook"
msgstr "New Century Schoolbook" msgstr "New Century Schoolbook"
@ -11793,9 +11805,29 @@ msgstr "Palatino"
msgid "Times Roman" msgid "Times Roman"
msgstr "Times Roman" msgstr "Times Roman"
#: src/frontends/qt4/GuiDocument.cpp:131 #: lib/latexfonts:180
msgid "Utopia" msgid "TeX Gyre Bonum"
msgstr "Utopia" msgstr "TeX Gyre Bonum"
#: lib/latexfonts:186
msgid "TeX Gyre Chorus"
msgstr "TeX Gyre Chorus"
#: lib/latexfonts:192
msgid "TeX Gyre Pagella"
msgstr "TeX Gyre Pagella"
#: lib/latexfonts:198
msgid "TeX Gyre Schola"
msgstr "TeX Gyre Schola"
#: lib/latexfonts:204
msgid "TeX Gyre Termes"
msgstr "TeX Gyre Termes"
#: lib/latexfonts:212
msgid "Utopia (Fourier)"
msgstr "Utopia (Fourier)"
#: src/frontends/qt4/GuiDocument.cpp:145 #: src/frontends/qt4/GuiDocument.cpp:145
msgid "Avant Garde" msgid "Avant Garde"
@ -11821,6 +11853,14 @@ msgstr "Helvetica"
msgid "Latin Modern Sans" msgid "Latin Modern Sans"
msgstr "Latin Modern Sans" msgstr "Latin Modern Sans"
#: lib/latexfonts:269
msgid "TeX Gyre Adventor"
msgstr "TeX Gyre Adventor"
#: lib/latexfonts:275
msgid "TeX Gyre Heros"
msgstr "TeX Gyre Heros"
#: src/frontends/qt4/GuiDocument.cpp:158 #: src/frontends/qt4/GuiDocument.cpp:158
msgid "Bera Mono" msgid "Bera Mono"
msgstr "Bera Mono" msgstr "Bera Mono"
@ -11845,6 +11885,10 @@ msgstr "Latin Modern Typewriter"
msgid "LuxiMono" msgid "LuxiMono"
msgstr "LuxiMono" msgstr "LuxiMono"
#: lib/latexfonts:328
msgid "TeX Gyre Cursor"
msgstr "TeX Gyre Cursor"
#: lib/latexfonts:253 #: lib/latexfonts:253
msgid "TX Typewriter" msgid "TX Typewriter"
msgstr "TX Typewriter" msgstr "TX Typewriter"
@ -24751,6 +24795,9 @@ msgstr ""
msgid "Unknown user" msgid "Unknown user"
msgstr "Neznámy používateľ" msgstr "Neznámy používateľ"
#~ msgid "Utopia"
#~ msgstr "Utopia"
#~ msgid "New documents will be assigned this language." #~ msgid "New documents will be assigned this language."
#~ msgstr "Novým dokumentom bude priradený tento jazyk." #~ msgstr "Novým dokumentom bude priradený tento jazyk."

View File

@ -72,6 +72,7 @@
#include "support/Systemcall.h" #include "support/Systemcall.h"
#ifdef Q_WS_MACX #ifdef Q_WS_MACX
#include "support/AppleScript.h"
#include "support/linkback/LinkBackProxy.h" #include "support/linkback/LinkBackProxy.h"
#endif #endif
@ -843,6 +844,8 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
/// A translator suitable for the entries in the LyX menu. /// A translator suitable for the entries in the LyX menu.
/// Only needed with Qt/Mac. /// Only needed with Qt/Mac.
installTranslator(new MenuTranslator(this)); installTranslator(new MenuTranslator(this));
///
setupApplescript();
#endif #endif
#ifdef Q_WS_X11 #ifdef Q_WS_X11

32
src/support/AppleScript.h Normal file
View File

@ -0,0 +1,32 @@
// -*- C++ -*-
/**
* \file AppleScript.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Benjamin Piwowarski
*
* Full author contact details are available in file CREDITS.
*/
#ifndef LYX_SUPPORT_APPLESCRIPT_H
#define LYX_SUPPORT_APPLESCRIPT_H
#ifdef __cplusplus
extern "C" {
#endif
/// What is returned by applescript_execute_command
typedef struct {
int code;
char *message;
} LyXFunctionResult;
LyXFunctionResult applescript_execute_command(const char *cmd, const char *args);
/// Sets up apple script support
void setupApplescript();
#ifdef __cplusplus
}
#endif
#endif

46
src/support/AppleScript.m Normal file
View File

@ -0,0 +1,46 @@
/**
* \file AppleScript.m
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Benjamin Piwowarski
*
* Full author contact details are available in file CREDITS.
*/
#import <Cocoa/Cocoa.h>
#include "AppleScript.h"
@interface LyxCommand : NSScriptCommand {
}
- (id)performDefaultImplementation;
@end
@implementation LyxCommand
- (id)performDefaultImplementation {
// Get the command and argument
NSDictionary * theArguments = [self evaluatedArguments];
NSString * directParameter = [self directParameter];
NSString *arg = [theArguments objectForKey: @"arg"];
// Execute the command
LyXFunctionResult result = applescript_execute_command([directParameter UTF8String], [arg UTF8String]);
// Construct the result record
NSString *message = [NSString stringWithCString:result.message encoding:NSUTF8StringEncoding];
free(result.message);
NSDictionary *objcResult = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:result.code], @"code", message, @"message", nil];
return objcResult;
}
@end
/// Needed by AppleScript in order to discover LyxCommand
void setupApplescript() {
}

View File

@ -0,0 +1,46 @@
// -*- C++ -*-
/**
* \file AppleScriptProxy.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Benjamin Piwowarski
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "AppleScript.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
#include "LyX.h"
#include "LyXAction.h"
#include "frontends/Application.h"
#include "support/docstring.h"
#include "support/debug.h"
using namespace std;
using namespace lyx;
extern "C" LyXFunctionResult applescript_execute_command(const char *cmd, const char *arg) {
LYXERR(Debug::ACTION, "Running command [" << cmd << "] with arguments [" << arg << "]");
FuncRequest fr(lyxaction.lookupFunc(cmd), arg);
fr.setOrigin(FuncRequest::LYXSERVER);
DispatchResult dr;
theApp()->dispatch(fr, dr);
string const rval = to_utf8(dr.message());
char *cstr =(char*) malloc((rval.size()+1)*sizeof(rval[0]));
strcpy (cstr, rval.c_str());
// Returns the result
LyXFunctionResult result;
result.code = dr.error() ? -1 : 0;
result.message = cstr;
return result;
}

View File

@ -11,6 +11,7 @@ file(GLOB moc_files ${TOP_SRC_DIR}/src/support/${LYX_MOC_FILES})
list(REMOVE_ITEM support_sources ${moc_files} .) list(REMOVE_ITEM support_sources ${moc_files} .)
if(APPLE) if(APPLE)
list(APPEND dont_merge ${TOP_SRC_DIR}/src/support/AppleSpeller.m) list(APPEND dont_merge ${TOP_SRC_DIR}/src/support/AppleSpeller.m)
list(APPEND dont_merge ${TOP_SRC_DIR}/src/support/AppleScript.m)
endif() endif()
file(GLOB support_headers ${TOP_SRC_DIR}/src/support/${LYX_HPP_FILES}) file(GLOB support_headers ${TOP_SRC_DIR}/src/support/${LYX_HPP_FILES})

View File

@ -120,6 +120,9 @@ if INSTALL_MACOSX
liblyxsupport_a_SOURCES += \ liblyxsupport_a_SOURCES += \
AppleSpeller.h \ AppleSpeller.h \
AppleSpeller.m \ AppleSpeller.m \
AppleScript.h \
AppleScript.m \
AppleScriptProxy.cpp \
linkback/LinkBack.h \ linkback/LinkBack.h \
linkback/LinkBack.m \ linkback/LinkBack.m \
linkback/LinkBackProxy.h \ linkback/LinkBackProxy.h \