]> git.lyx.org Git - lyx.git/blobdiff - src/Server.cpp
InsetLine.cpp: remove unused include
[lyx.git] / src / Server.cpp
index cc47b23c74b70e51252a5d95ad553a8fc80147eb..6a6ed2f837a8be8a57a48dbe5248d01368a32624 100644 (file)
           received LyX will inform the client that it's listening its
           messages, and 'bye' will inform that lyx is closing.
 
           received LyX will inform the client that it's listening its
           messages, and 'bye' will inform that lyx is closing.
 
-          See development/server_monitor.c for an example client.
+          See development/lyxserver/server_monitor.cpp for an example client.
   Purpose: implement a client/server lib for LyX
 */
 
 #include <config.h>
 
 #include "Server.h"
   Purpose: implement a client/server lib for LyX
 */
 
 #include <config.h>
 
 #include "Server.h"
+
+#include "DispatchResult.h"
 #include "FuncRequest.h"
 #include "FuncRequest.h"
+#include "LyX.h"
 #include "LyXAction.h"
 #include "LyXAction.h"
-#include "LyXFunc.h"
 
 #include "frontends/Application.h"
 
 
 #include "frontends/Application.h"
 
@@ -53,7 +55,7 @@
 #include "support/lstrings.h"
 #include "support/os.h"
 
 #include "support/lstrings.h"
 #include "support/os.h"
 
-#include <boost/bind.hpp>
+#include "support/bind.h"
 
 #ifdef _WIN32
 #include <QCoreApplication>
 
 #ifdef _WIN32
 #include <QCoreApplication>
@@ -415,6 +417,8 @@ bool LyXComm::checkStopServer(DWORD timeout)
 bool LyXComm::startPipe(DWORD index)
 {
        pipe_[index].pending_io = false;
 bool LyXComm::startPipe(DWORD index)
 {
        pipe_[index].pending_io = false;
+       pipe_[index].overlap.Offset = 0;
+       pipe_[index].overlap.OffsetHigh = 0;
 
        // Overlapped ConnectNamedPipe should return zero.
        if (ConnectNamedPipe(pipe_[index].handle, &pipe_[index].overlap)) {
 
        // Overlapped ConnectNamedPipe should return zero.
        if (ConnectNamedPipe(pipe_[index].handle, &pipe_[index].overlap)) {
@@ -664,8 +668,7 @@ void LyXComm::send(string const & msg)
                       << "\nLyXComm: Resetting connection" << endl;
                ReleaseMutex(outbuf_mutex_);
                closeConnection();
                       << "\nLyXComm: Resetting connection" << endl;
                ReleaseMutex(outbuf_mutex_);
                closeConnection();
-               if (!checkStopServer())
-                       openConnection();
+               openConnection();
        }
 }
 
        }
 }
 
@@ -837,7 +840,7 @@ int LyXComm::startPipe(string const & file, bool write)
 
        if (!write) {
                theApp()->registerSocketCallback(fd,
 
        if (!write) {
                theApp()->registerSocketCallback(fd,
-                       boost::bind(&LyXComm::read_ready, this));
+                       bind(&LyXComm::read_ready, this));
        }
 
        return fd;
        }
 
        return fd;
@@ -985,8 +988,8 @@ void ServerCallback(Server * server, string const & msg)
        server->callback(msg);
 }
 
        server->callback(msg);
 }
 
-Server::Server(LyXFunc * f, string const & pipes)
-       : numclients_(0), func_(f), pipes_(pipes, this, &ServerCallback)
+Server::Server(string const & pipes)
+       : numclients_(0), pipes_(pipes, this, &ServerCallback)
 {}
 
 
 {}
 
 
@@ -1107,17 +1110,19 @@ void Server::callback(string const & msg)
                        // The correct solution would be to have a
                        // specialized (non-gui) BufferView. But how do
                        // we do it now? Probably we should just let it
                        // The correct solution would be to have a
                        // specialized (non-gui) BufferView. But how do
                        // we do it now? Probably we should just let it
-                       // connect to the lyxfunc in the single LyXView we
+                       // connect to the lyxfunc in the single GuiView we
                        // support currently. (Lgb)
 
                        // support currently. (Lgb)
 
-                       func_->dispatch(FuncRequest(lyxaction.lookupFunc(cmd), arg));
-                       string const rval = to_utf8(func_->getMessage());
+                       FuncRequest const fr(lyxaction.lookupFunc(cmd), arg);
+                       DispatchResult dr;
+                       theApp()->dispatch(fr, dr);
+                       string const rval = to_utf8(dr.message());
 
                        // all commands produce an INFO or ERROR message
                        // in the output pipe, even if they do not return
                        // anything. See chapter 4 of Customization doc.
                        string buf;
 
                        // all commands produce an INFO or ERROR message
                        // in the output pipe, even if they do not return
                        // anything. See chapter 4 of Customization doc.
                        string buf;
-                       if (func_->errorStat())
+                       if (dr.error())
                                buf = "ERROR:";
                        else
                                buf = "INFO:";
                                buf = "ERROR:";
                        else
                                buf = "INFO:";