diff --git a/development/LyX-Mac-binary-release.sh b/development/LyX-Mac-binary-release.sh
index 776d1eeca3..0c027c7a2c 100644
--- a/development/LyX-Mac-binary-release.sh
+++ b/development/LyX-Mac-binary-release.sh
@@ -5,10 +5,10 @@
# This script automates creating universal binaries of LyX on Mac.
# Author: Bennett Helm (and extended by Konrad Hofbauer)
# latest changes by Stephan Witt
-# Last modified: January 2011
+# Last modified: August 2012
MAC_API=-cocoa
-Qt4Version="4.6.3"
+Qt4Version=${Qt4Version:-"4.6.3"}
Qt4SourceVersion="qt-everywhere-opensource-src-${Qt4Version}"
Qt4BuildSubDir="qt-${Qt4Version}-build${MAC_API}"
@@ -34,7 +34,7 @@ Qt4ConfigureOptions="${Qt4ConfigureOptions} -nomake examples -nomake demos -noma
Qt4ConfigureOptions="${Qt4ConfigureOptions} ${MAC_API}"
aspell_dictionaries="no"
-hunspell_dictionaries="no"
+hunspell_dictionaries="yes"
aspell_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
# detection of script home
-LyxSourceDir=`dirname "$0"`
+LyxSourceDir=$(dirname "$0")
if [ ! -d "${LyxSourceDir}" ]; then
echo Missing LyX source directory.
exit 2
fi
case "${LyxSourceDir}" in
/*/development)
- LyxSourceDir=`dirname "${LyxSourceDir}"`
+ LyxSourceDir=$(dirname "${LyxSourceDir}")
;;
/*)
;;
*/development|development)
- LyxSourceDir=`dirname "${LyxSourceDir}"`
- LyxSourceDir=`cd "${LyxSourceDir}";pwd`
+ LyxSourceDir=$(dirname "${LyxSourceDir}")
+ LyxSourceDir=$(cd "${LyxSourceDir}";pwd)
;;
*)
- LyxSourceDir=`cd "${LyxSourceDir}";pwd`
+ LyxSourceDir=$(cd "${LyxSourceDir}";pwd)
;;
esac
@@ -93,7 +93,7 @@ usage() {
while [ $# -gt 0 ]; do
case "${1}" in
--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
unset QTDIR
qt4_deployment="no"
@@ -101,15 +101,15 @@ while [ $# -gt 0 ]; do
shift
;;
--with-qt4-dir=*)
- QTDIR=`echo ${1}|cut -d= -f2`
+ QTDIR=$(echo ${1}|cut -d= -f2)
shift
;;
--with-macosx-target=*)
- MACOSX_DEPLOYMENT_TARGET=`echo ${1}|cut -d= -f2`
+ MACOSX_DEPLOYMENT_TARGET=$(echo ${1}|cut -d= -f2)
shift
;;
--with-sdkroot=*)
- SDKROOT=`echo ${1}|cut -d= -f2`
+ SDKROOT=$(echo ${1}|cut -d= -f2)
case "${SDKROOT}" in
10.4)
SDKROOT="/Developer/SDKs/MacOSX10.4u.sdk"
@@ -127,34 +127,34 @@ while [ $# -gt 0 ]; do
shift
;;
--aspell-deployment=*)
- aspell_deployment=`echo ${1}|cut -d= -f2`
+ aspell_deployment=$(echo ${1}|cut -d= -f2)
aspell_dictionaries=$aspell_deployment
shift
;;
--hunspell-deployment=*)
- hunspell_deployment=`echo ${1}|cut -d= -f2`
+ hunspell_deployment=$(echo ${1}|cut -d= -f2)
hunspell_dictionaries=$hunspell_deployment
shift
;;
--thesaurus-deployment=*)
- thesaurus_deployment=`echo ${1}|cut -d= -f2`
+ thesaurus_deployment=$(echo ${1}|cut -d= -f2)
shift
;;
--qt4-deployment=*)
- qt4_deployment=`echo ${1}|cut -d= -f2`
+ qt4_deployment=$(echo ${1}|cut -d= -f2)
shift
;;
--with-arch=*)
- ARCH=`echo ${1}|cut -d= -f2|tr ',' ' '`
+ ARCH=$(echo ${1}|cut -d= -f2|tr ',' ' ')
ARCH_LIST="${ARCH_LIST} ${ARCH}"
shift
;;
--with-dmg-location=*)
- DMGLocation=`echo ${1}|cut -d= -f2`
+ DMGLocation=$(echo ${1}|cut -d= -f2)
shift
;;
--with-build-path=*)
- LyxBuildDir=`echo ${1}|cut -d= -f2`
+ LyxBuildDir=$(echo ${1}|cut -d= -f2)
shift
;;
--help|--help=*)
@@ -171,7 +171,7 @@ while [ $# -gt 0 ]; do
shift
;;
--only-package=*)
- LyxOnlyPackage=`echo ${1}|cut -d= -f2`
+ LyxOnlyPackage=$(echo ${1}|cut -d= -f2)
shift
;;
--*)
@@ -196,26 +196,26 @@ ARCH_LIST=${ARCH_LIST:-"ppc i386"}
strip="-strip"
aspellstrip=
-LyxBuildDir=${LyxBuildDir:-`dirname "${LyxSourceDir}"`/lyx-build}
+LyxBuildDir=${LyxBuildDir:-$(dirname "${LyxSourceDir}")/lyx-build}
DMGLocation=${DMGLocation:-"${LyxBuildDir}"}
-ASpellSourceDir=${ASPELLDIR:-`dirname "${LyxSourceDir}"`/${ASpellSourceVersion}}
+ASpellSourceDir=${ASPELLDIR:-$(dirname "${LyxSourceDir}")/${ASpellSourceVersion}}
ASpellInstallDir=${ASpellInstallDir:-"${LyxBuildDir}"/SpellChecker.lib}
-HunSpellSourceDir=${HUNSPELLDIR:-`dirname "${LyxSourceDir}"`/${HunSpellSourceVersion}}
+HunSpellSourceDir=${HUNSPELLDIR:-$(dirname "${LyxSourceDir}")/${HunSpellSourceVersion}}
HunSpellInstallDir=${HunSpellInstallDir:-"${LyxBuildDir}"/SpellChecker.lib}
-Qt4SourceDir=${QT4SOURCEDIR:-`dirname "${LyxSourceDir}"`/${Qt4SourceVersion}}
+Qt4SourceDir=${QT4SOURCEDIR:-$(dirname "${LyxSourceDir}")/${Qt4SourceVersion}}
Qt4BuildDir=${Qt4BuildDir:-"${LyxBuildDir}"/${Qt4BuildSubDir:-"qt4-build"}}
-DictionarySourceDir=${DICTIONARYDIR:-`dirname "${LyxSourceDir}"`/dictionaries}
-DocumentationDir=`dirname "${LyxSourceDir}"`/Documents
+DictionarySourceDir=${DICTIONARYDIR:-$(dirname "${LyxSourceDir}")/dictionaries}
+DocumentationDir=$(dirname "${LyxSourceDir}")/Documents
DmgBackground="${LyxSourceDir}"/development/MacOSX/dmg-background.png
ASpellInstallHdr="${ASpellInstallDir}/include/aspell.h"
HunSpellInstallHdr="${HunSpellInstallDir}/include/hunspell/hunspell.h"
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
-LyXVersionSuffix=${LyXVersionSuffix:-`echo "${LyXVersion}" | cut -d. -f1-2`}
+LyXVersionSuffix=${LyXVersionSuffix:-$(echo "${LyXVersion}" | cut -d. -f1-2)}
LyxName="LyX"
LyxBase="${LyxName}-${LyXVersion}"
@@ -237,7 +237,7 @@ DMGNAME="${LyxBase}"
DMGSIZE="550m"
# Check for existing SDKs
-SDKs=`echo /Developer/SDKs/MacOSX10*sdk`
+SDKs=$(echo /Developer/SDKs/MacOSX10*sdk)
case "$SDKs" in
${SDKROOT})
;;
@@ -301,7 +301,7 @@ if [ -d "${HunSpellSourceDir}" -a ! -f "${HunSpellInstallHdr}" ]; then
# we have a private HunSpell source tree at hand...
# so let's build and install it
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
HunSpellName="Hunspell"
@@ -322,7 +322,7 @@ if [ -d "${HunSpellSourceDir}" -a ! -f "${HunSpellInstallHdr}" ]; then
make distclean
CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export CPPFLAGS
LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export LDFLAGS
- HOSTSYSTEM=`eval "echo \\$HostSystem_$arch"`
+ HOSTSYSTEM=$(eval "echo \\$HostSystem_$arch")
"${HunSpellSourceDir}/configure"\
--prefix="${HunSpellInstallDir}"\
${HunspellConfigureOptions}
@@ -364,7 +364,7 @@ if [ -d "${ASpellSourceDir}" -a ! -f "${ASpellInstallHdr}" -a "yes" = "${aspell_
# we have a private ASpell source tree at hand...
# so let's build and install it
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
ASpellName="Aspell"
@@ -386,7 +386,7 @@ if [ -d "${ASpellSourceDir}" -a ! -f "${ASpellInstallHdr}" -a "yes" = "${aspell_
make distclean
CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export CPPFLAGS
LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"; export LDFLAGS
- HOSTSYSTEM=`eval "echo \\$HostSystem_$arch"`
+ HOSTSYSTEM=$(eval "echo \\$HostSystem_$arch")
CXXFLAGS=-g "${ASpellSourceDir}/configure"\
--prefix="${ASpellInstallDir}"\
${AspellConfigureOptions}
@@ -442,7 +442,7 @@ build_lyx() {
( cd "${LyxSourceDir}" && sh autogen.sh )
else
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
( cd "${LyxSourceDir}" && sh autogen.sh )
break
@@ -459,8 +459,8 @@ build_lyx() {
fi
if [ -d "${HunSpellInstallDir}" -a "yes" = "${hunspell_deployment}" ]; then
- HunSpellFramework=`framework_name Hunspell`
- HunSpellFramework=`basename "${HunSpellFramework}"`
+ HunSpellFramework=$(framework_name Hunspell)
+ HunSpellFramework=$(basename "${HunSpellFramework}")
ConfigureExtraInc="--with-extra-inc=${HunSpellInstallDir}/include"
ConfigureExtraLib="--with-extra-lib=${HunSpellInstallDir}/lib"
# LyXConfigureOptions="${LyXConfigureOptions} --with-hunspell-framework=${HunSpellFramework}"
@@ -475,7 +475,7 @@ build_lyx() {
CPPFLAGS="${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
export QT4_CORE_CFLAGS="-FQtCore"
@@ -512,17 +512,17 @@ build_lyx() {
content_directory() {
target="$1"
- content=`dirname "${target}"`
- content=`dirname "${content}"`
+ content=$(dirname "${target}")
+ content=$(dirname "${content}")
echo "${content}"
}
private_framework() {
- fwdir=`framework_name "$1"`
+ fwdir=$(framework_name "$1")
source="$2"
target="$3"
- condir=`content_directory "${target}"`
- libnm=`basename "${source}"`
+ condir=$(content_directory "${target}")
+ libnm=$(basename "${source}")
mkdir -p "${condir}/${fwdir}"
if [ ! -f "${condir}/${fwdir}/${libnm}" ]; then
cp -p "${source}" "${condir}/${fwdir}"
@@ -537,7 +537,7 @@ deploy_qtlibs() {
source="${QtInstallDir}"
target="$1"
version="Versions/${QtFrameworkVersion}/"
- condir=`content_directory "${target}"`
+ condir=$(content_directory "${target}")
mkdir -p "${condir}/Resources"
test -f "${condir}/Resources/qt.conf" || cat - > "${condir}/Resources/qt.conf" <<-EOF
[Paths]
@@ -548,24 +548,24 @@ EOF
mkdir -p "${condir}/PlugIns"
find "${source}/plugins" -name \*.dylib -print | while read libname ; do
echo Copy plugin "${libname}"
- dylib=`basename "${libname}"`
- dirname=`dirname "${libname}"`
- dirname=`basename "${dirname}"`
+ dylib=$(basename "${libname}")
+ dirname=$(dirname "${libname}")
+ dirname=$(basename "${dirname}")
mkdir -p "${condir}/PlugIns/${dirname}"
cp -p "${libname}" "${condir}/PlugIns/${dirname}"
done
fi
for libnm in ${QtLibraries} ; do
- fwdir=`framework_name "$libnm"`
- dirname=`dirname "${fwdir}"`
+ fwdir=$(framework_name "$libnm")
+ dirname=$(dirname "${fwdir}")
mkdir -p "${condir}/${dirname}"
- dirname=`basename "${fwdir}"`
+ dirname=$(basename "${fwdir}")
test -d "${condir}/${fwdir}" || (
- echo Copy framework "${source}/lib/"`basename "${fwdir}"`
- cp -pR "${source}/lib/"`basename "${fwdir}"` "${condir}/${fwdir}"
+ echo Copy framework "${source}/lib/"$(basename "${fwdir}")
+ cp -pR "${source}/lib/"$(basename "${fwdir}") "${condir}/${fwdir}"
echo Set library id in "${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
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)
@@ -697,9 +697,9 @@ EOF
make_dmg() {
cd "${1}"
- BGSIZE=`file "$DmgBackground" | awk -F , '/PNG/{print $2 }' | tr x ' '`
- BG_W=`echo ${BGSIZE} | awk '{print $1 }'`
- BG_H=`echo ${BGSIZE} | awk '{print $2 }'`
+ BGSIZE=$(file "$DmgBackground" | awk -F , '/PNG/{print $2 }' | tr x ' ')
+ BG_W=$(echo ${BGSIZE} | awk '{print $1 }')
+ BG_H=$(echo ${BGSIZE} | awk '{print $2 }')
rm -f "${DMGNAME}.sparseimage" "${DMGNAME}.dmg"
diff --git a/development/MacOSX/Info.plist.in b/development/MacOSX/Info.plist.in
index 3145c1a8ca..32accf4c5d 100644
--- a/development/MacOSX/Info.plist.in
+++ b/development/MacOSX/Info.plist.in
@@ -37,5 +37,9 @@
@VERSION@
CFBundleSignature
OLYX
+ NSAppleScriptEnabled
+ YES
+ OSAScriptingDefinition
+ LyX.sdef
diff --git a/development/MacOSX/LyX.sdef b/development/MacOSX/LyX.sdef
new file mode 100644
index 0000000000..41f7408ea5
--- /dev/null
+++ b/development/MacOSX/LyX.sdef
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/development/MacOSX/Makefile.am b/development/MacOSX/Makefile.am
index 4714c7f5c3..89b1a715bb 100644
--- a/development/MacOSX/Makefile.am
+++ b/development/MacOSX/Makefile.am
@@ -10,7 +10,7 @@ nodist_bundle_DATA = Info.plist
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
diff --git a/development/qmake/lyx.pro b/development/qmake/lyx.pro
index cef4569653..de5624bcf7 100644
--- a/development/qmake/lyx.pro
+++ b/development/qmake/lyx.pro
@@ -574,6 +574,7 @@ HEADERS += \
../../src/support/gzstream.h \
../../src/support/lassert.h \
../../src/support/limited_stack.h \
+../../src/support/linkback/AppleScript.h \
../../src/support/linkback/LinkBack.h \
../../src/support/linkback/LinkBackProxy.h \
../../src/support/linkback/LinkBackServer.h \
diff --git a/po/sk.po b/po/sk.po
index 4859e5ce2b..493498c5f6 100644
--- a/po/sk.po
+++ b/po/sk.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: LyX-2.1\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"
"Last-Translator: Kornel Benko \n"
"Language-Team: Slovak \n"
@@ -11765,9 +11765,9 @@ msgstr "Concrete Roman"
msgid "Zapf Chancery"
msgstr "Zapf Chancery"
-#: src/frontends/qt4/GuiDocument.cpp:130
-msgid "Bitstream Charter"
-msgstr "Bitstream Charter"
+#: lib/latexfonts:96
+msgid "Bitstream Charter (PSNFSS)"
+msgstr "Bitstream Charter (PSNFSS)"
#: src/frontends/qt4/GuiDocument.cpp:128
msgid "Computer Modern Roman"
@@ -11781,6 +11781,18 @@ msgstr "Libertine"
msgid "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
msgid "New Century Schoolbook"
msgstr "New Century Schoolbook"
@@ -11793,9 +11805,29 @@ msgstr "Palatino"
msgid "Times Roman"
msgstr "Times Roman"
-#: src/frontends/qt4/GuiDocument.cpp:131
-msgid "Utopia"
-msgstr "Utopia"
+#: lib/latexfonts:180
+msgid "TeX Gyre Bonum"
+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
msgid "Avant Garde"
@@ -11821,6 +11853,14 @@ msgstr "Helvetica"
msgid "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
msgid "Bera Mono"
msgstr "Bera Mono"
@@ -11845,6 +11885,10 @@ msgstr "Latin Modern Typewriter"
msgid "LuxiMono"
msgstr "LuxiMono"
+#: lib/latexfonts:328
+msgid "TeX Gyre Cursor"
+msgstr "TeX Gyre Cursor"
+
#: lib/latexfonts:253
msgid "TX Typewriter"
msgstr "TX Typewriter"
@@ -24751,6 +24795,9 @@ msgstr ""
msgid "Unknown user"
msgstr "Neznámy používateľ"
+#~ msgid "Utopia"
+#~ msgstr "Utopia"
+
#~ msgid "New documents will be assigned this language."
#~ msgstr "Novým dokumentom bude priradený tento jazyk."
diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp
index 701b488eab..0790b46440 100644
--- a/src/frontends/qt4/GuiApplication.cpp
+++ b/src/frontends/qt4/GuiApplication.cpp
@@ -72,6 +72,7 @@
#include "support/Systemcall.h"
#ifdef Q_WS_MACX
+#include "support/AppleScript.h"
#include "support/linkback/LinkBackProxy.h"
#endif
@@ -843,6 +844,8 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
/// A translator suitable for the entries in the LyX menu.
/// Only needed with Qt/Mac.
installTranslator(new MenuTranslator(this));
+ ///
+ setupApplescript();
#endif
#ifdef Q_WS_X11
diff --git a/src/support/AppleScript.h b/src/support/AppleScript.h
new file mode 100644
index 0000000000..6ac23b63bf
--- /dev/null
+++ b/src/support/AppleScript.h
@@ -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
\ No newline at end of file
diff --git a/src/support/AppleScript.m b/src/support/AppleScript.m
new file mode 100644
index 0000000000..bf06b02d42
--- /dev/null
+++ b/src/support/AppleScript.m
@@ -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
+#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() {
+}
+
diff --git a/src/support/AppleScriptProxy.cpp b/src/support/AppleScriptProxy.cpp
new file mode 100644
index 0000000000..23272e2caf
--- /dev/null
+++ b/src/support/AppleScriptProxy.cpp
@@ -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
+
+#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;
+}
+
diff --git a/src/support/CMakeLists.txt b/src/support/CMakeLists.txt
index b42f08cf58..521a42a255 100644
--- a/src/support/CMakeLists.txt
+++ b/src/support/CMakeLists.txt
@@ -11,6 +11,7 @@ file(GLOB moc_files ${TOP_SRC_DIR}/src/support/${LYX_MOC_FILES})
list(REMOVE_ITEM support_sources ${moc_files} .)
if(APPLE)
list(APPEND dont_merge ${TOP_SRC_DIR}/src/support/AppleSpeller.m)
+ list(APPEND dont_merge ${TOP_SRC_DIR}/src/support/AppleScript.m)
endif()
file(GLOB support_headers ${TOP_SRC_DIR}/src/support/${LYX_HPP_FILES})
diff --git a/src/support/Makefile.am b/src/support/Makefile.am
index f0819cf146..f7fad7c4cd 100644
--- a/src/support/Makefile.am
+++ b/src/support/Makefile.am
@@ -120,6 +120,9 @@ if INSTALL_MACOSX
liblyxsupport_a_SOURCES += \
AppleSpeller.h \
AppleSpeller.m \
+ AppleScript.h \
+ AppleScript.m \
+ AppleScriptProxy.cpp \
linkback/LinkBack.h \
linkback/LinkBack.m \
linkback/LinkBackProxy.h \