#include "lyxfont.h"
#include "graphics/LoaderQueue.h"
+#include "io_callback.h"
+
// FIXME: move this stuff out again
#include "bufferlist.h"
#include "buffer_funcs.h"
#include "lyxfunc.h"
#include "lyxserver.h"
+#include "lyxsocket.h"
#include "BufferView.h"
#include "GView.h"
#include "xftFontLoader.h"
#include "GWorkArea.h"
-#include "support/std_sstream.h"
-#include <iomanip>
-#include <fcntl.h>
#include <boost/bind.hpp>
+#include <boost/function.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include <fcntl.h>
+
+#include <sstream>
+#include <iomanip>
//just for xforms
#include "lyx_forms.h"
#include "xformsImage.h"
#include "xforms_helpers.h"
+namespace os = lyx::support::os;
+
using std::ostringstream;
using std::string;
+using lyx::frontend::colorCache;
+using lyx::frontend::GView;
+using lyx::frontend::XformsColor;
+
extern BufferList bufferlist;
// FIXME: wrong place !
LyXServer * lyxserver;
+LyXServerSocket * lyxsocket;
bool lyx_gui::use_gui = true;
}
// emergency cleanup
- LyX::emergencyCleanup();
+ LyX::cref().emergencyCleanup();
// Get the reason for the crash.
char etxt[513];
view.show();
view.init();
- Buffer * last = 0;
-
// FIXME: some code below needs moving
lyxserver = new LyXServer(&view.getLyXFunc(), lyxrc.lyxpipes);
+ lyxsocket = new LyXServerSocket(&view.getLyXFunc(),
+ os::slashify_path(os::getTmpDir() + "/lyxsocket"));
std::vector<string>::const_iterator cit = files.begin();
std::vector<string>::const_iterator end = files.end();
- for (; cit != end; ++cit) {
- Buffer * b = bufferlist.newBuffer(*cit);
- if (loadLyXFile(b, *cit))
- last = b;
- }
-
- // switch to the last buffer successfully loaded
- if (last) {
- view.view()->buffer(last);
- }
+ for (; cit != end; ++cit)
+ view.view()->loadLyXFile(*cit, true);
// handle the batch commands the user asked for
if (!batch.empty()) {
}
// FIXME: breaks emergencyCleanup
+ delete lyxsocket;
delete lyxserver;
}
namespace {
+std::map<int, boost::shared_ptr<io_callback> > callbacks;
-bool readCallback(Glib::IOCondition /*condition*/, LyXComm * comm)
-{
- comm->read_ready();
- return true;
-}
-
+} // NS anon
-std::map<int, SigC::Connection> gReadCallbackMap;
-
-}
-
-void lyx_gui::set_read_callback(int fd, LyXComm * comm)
+void lyx_gui::register_socket_callback(int fd,
+ boost::function<void()> func)
{
- gReadCallbackMap[fd] = Glib::signal_io().connect(
- SigC::bind(SigC::slot(readCallback), comm),
- fd,
- Glib::IO_IN);
+ callbacks[fd] = boost::shared_ptr<io_callback>(new io_callback(fd, func));
}
-void lyx_gui::remove_read_callback(int fd)
+void lyx_gui::unregister_socket_callback(int fd)
{
- gReadCallbackMap[fd].disconnect();
- gReadCallbackMap.erase(fd);
+ callbacks.erase(fd);
}
-void lyx_gui::set_datasocket_callback(LyXDataSocket * /* p */)
-{}
-
-
-void lyx_gui::remove_datasocket_callback(LyXDataSocket * /* p */)
-{}
-
-
-void lyx_gui::set_serversocket_callback(LyXServerSocket * /* p */)
-{}
-
-
-void lyx_gui::remove_serversocket_callback(LyXServerSocket * /* p */)
-{}
-
-
string const lyx_gui::roman_font_name()
{
return "times";