From 6104eebe0dfe744adcc01c73c16154d5a7d0b8e1 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Fri, 22 Sep 2006 12:34:13 +0000 Subject: [PATCH] replace lyxserver and lyxsocket with theApp->server() and theApp->socket() equivalent methods. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15119 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/format.C | 8 +++----- src/frontends/Application.C | 9 --------- src/frontends/qt4/lyx_gui.C | 2 -- src/lyx_main.C | 7 ++----- src/lyxfunc.C | 5 ++--- 5 files changed, 7 insertions(+), 24 deletions(-) diff --git a/src/format.C b/src/format.C index 2ce250db95..7de79556ff 100644 --- a/src/format.C +++ b/src/format.C @@ -16,8 +16,8 @@ #include "lyxrc.h" #include "debug.h" #include "gettext.h" -#include "lyxsocket.h" +#include "frontends/Application.h" #include "frontends/Alert.h" //to be removed? #include "support/filetools.h" @@ -46,8 +46,6 @@ using std::distance; namespace fs = boost::filesystem; namespace os = lyx::support::os; -extern LyXServerSocket * lyxsocket; - namespace { string const token_from("$$i"); @@ -311,7 +309,7 @@ bool Formats::view(Buffer const & buffer, string const & filename, command = subst(command, token_from, quoteName(filename)); command = subst(command, token_path, quoteName(onlyPath(filename))); - command = subst(command, token_socket, quoteName(lyxsocket->address())); + command = subst(command, token_socket, quoteName(theApp->socket().address())); lyxerr[Debug::FILES] << "Executing command: " << command << std::endl; buffer.message(_("Executing command: ") + lyx::from_utf8(command)); @@ -370,7 +368,7 @@ bool Formats::edit(Buffer const & buffer, string const & filename, command = subst(command, token_from, quoteName(filename)); command = subst(command, token_path, quoteName(onlyPath(filename))); - command = subst(command, token_socket, quoteName(lyxsocket->address())); + command = subst(command, token_socket, quoteName(theApp->socket().address())); lyxerr[Debug::FILES] << "Executing command: " << command << std::endl; buffer.message(_("Executing command: ") + lyx::from_utf8(command)); diff --git a/src/frontends/Application.C b/src/frontends/Application.C index d590e9d678..fadd7d956c 100644 --- a/src/frontends/Application.C +++ b/src/frontends/Application.C @@ -25,11 +25,6 @@ using lyx::support::package; -// FIXME: replace all occurence of lyxserver with theApp->server(). -LyXServer * lyxserver; -// FIXME: replace all occurence of lyxsocket with theApp->socket(). -LyXServerSocket * lyxsocket; - namespace lyx { namespace frontend { @@ -87,10 +82,6 @@ int Application::start(std::string const & batch) lyx_socket_.reset(new LyXServerSocket(lyxfunc_.get(), lyx::support::os::internal_path(package().temp_dir() + "/lyxsocket"))); - // FIXME: these two lines should disappear soon (Abdel 20/09/71) - lyxserver = lyx_server_.get(); - lyxsocket = lyx_socket_.get(); - // handle the batch commands the user asked for if (!batch.empty()) { lyxfunc_->dispatch(lyxaction.lookupFunc(batch)); diff --git a/src/frontends/qt4/lyx_gui.C b/src/frontends/qt4/lyx_gui.C index 8cf90e0001..7f3d51d526 100644 --- a/src/frontends/qt4/lyx_gui.C +++ b/src/frontends/qt4/lyx_gui.C @@ -24,8 +24,6 @@ #include "LyXAction.h" #include "lyxfunc.h" #include "lyxrc.h" -#include "lyxserver.h" -#include "lyxsocket.h" #include "support/lstrings.h" diff --git a/src/lyx_main.C b/src/lyx_main.C index 1627140e71..9f2cf24573 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -35,12 +35,12 @@ #include "lyxlex.h" #include "lyxrc.h" #include "lyxtextclasslist.h" -#include "lyxserver.h" #include "MenuBackend.h" #include "mover.h" #include "ToolbarBackend.h" #include "frontends/Alert.h" +#include "frontends/Application.h" #include "frontends/lyx_gui.h" #include "frontends/LyXView.h" @@ -89,8 +89,6 @@ using std::system; #endif -extern LyXServer * lyxserver; - // This is the global bufferlist object BufferList bufferlist; @@ -661,8 +659,7 @@ void LyX::emergencyCleanup() const // a crash bufferlist.emergencyWriteAll(); - if (lyxserver) - lyxserver->emergencyCleanup(); + theApp->server().emergencyCleanup(); } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 9cc21249d4..6eb2b59217 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -51,7 +51,6 @@ #include "lyxlex.h" #include "lyxrc.h" #include "lyxrow.h" -#include "lyxserver.h" #include "lyxtextclasslist.h" #include "lyxvc.h" #include "paragraph.h" @@ -72,6 +71,7 @@ #include "insets/insetvspace.h" #include "insets/insetwrap.h" +#include "frontends/Application.h" #include "frontends/Alert.h" #include "frontends/Dialogs.h" #include "frontends/FileDialog.h" @@ -139,7 +139,6 @@ namespace fs = boost::filesystem; extern BufferList bufferlist; -extern LyXServer * lyxserver; extern boost::scoped_ptr toplevel_keymap; @@ -1120,7 +1119,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd) case LFUN_SERVER_NOTIFY: dispatch_buffer = lyx::from_utf8(keyseq.print()); - lyxserver->notifyClient(lyx::to_utf8(dispatch_buffer)); + theApp->server().notifyClient(lyx::to_utf8(dispatch_buffer)); break; case LFUN_SERVER_GOTO_FILE_ROW: {