*/
#include <config.h>
-#include <gtkmm.h>
#include "lyx_gui.h"
-#include "support/lyxlib.h"
-#include "support/os.h"
-#include "support/filetools.h"
-#include "support/path_defines.h"
-
#include "debug.h"
#include "funcrequest.h"
#include "gettext.h"
#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 "xftFontLoader.h"
#include "GWorkArea.h"
-#include "support/std_sstream.h"
-#include <iomanip>
-#include <fcntl.h>
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
-
//just for xforms
#include "lyx_forms.h"
#include "xformsImage.h"
#include "xforms_helpers.h"
+#include "support/lyxlib.h"
+#include "support/os.h"
+#include "support/filetools.h"
+#include "support/path_defines.h"
+
+#include <gtkmm.h>
+
+#include <boost/bind.hpp>
+#include <boost/function.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include <fcntl.h>
+
+#include <sstream>
+#include <iomanip>
+
namespace os = lyx::support::os;
using std::ostringstream;
view.show();
view.init();
- // FIXME: some code below needs moving
+ // FIXME: server 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)
- view.view()->loadLyXFile(*cit, true);
+ for_each(files.begin(), files.end(),
+ bind(&BufferView::loadLyXFile, view.view(), _1, true));
// handle the batch commands the user asked for
if (!batch.empty()) {
}
-FuncStatus lyx_gui::getStatus(FuncRequest const & /*ev*/)
+FuncStatus lyx_gui::getStatus(FuncRequest const & ev)
{
- // Nothing interesting to do here
- return FuncStatus();
+ FuncStatus flag;
+ switch (ev.action) {
+ // Add this back if the gtk doc prefs dialog includes preamble - jcs
+ /*case LFUN_DIALOG_SHOW:
+ if (ev.argument == "preamble")
+ flag.unknown(true);
+ break;*/
+ case LFUN_TOOLTIPS_TOGGLE:
+ flag.unknown(true);
+ break;
+ default:
+ break;
+ }
+
+ return flag;
}
namespace {
+std::map<int, boost::shared_ptr<io_callback> > callbacks;
-bool readCallback(Glib::IOCondition /*condition*/, LyXComm * comm)
-{
- comm->read_ready();
- return true;
-}
-
-
-std::map<int, SigC::Connection> gReadCallbackMap;
-
-}
+} // NS anon
-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::register_socket_callback(int /*fd*/,
- boost::function<void()> /*func*/)
-{}
-
-
-void lyx_gui::unregister_socket_callback(int /*fd*/)
-{}
-
-
string const lyx_gui::roman_font_name()
{
return "times";