+2004-07-22 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * lyxserver.C (startPipe): call register_socket_callback
+ (endPipe): call unregister_socket_callback
+
2004-07-21 Lars Gullik Bjonnes <larsbj@gullik.net>
* lyxsocket.C (LyXServerSocket): reduce max outstanding clients to 3
+2004-07-22 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * lyx_gui.h (set_read_callback,remove_read_callback): remove
+ declaration
+
2004-06-18 Lars Gullik Bjonnes <larsbj@gullik.net>
* screen.C (fitCursor): Use Debug::DEBUG
+2004-07-22 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * lyx_gui.C (register_socket_callback,unregister_socket_callback):
+ implement
+ (set_read_callback,remove_read_callback): remove implementation
+
+ * io_callback.[Ch]: new files
+ * Makefile.am (libgtk_la_SOURCES): handle them
+
2004-07-21 Lars Gullik Bjonnes <larsbj@gullik.net>
* lyx_gui.C (register_socket_callback): add stub
GView.C \
IdSc.h \
IdSc.C \
+ io_callback.h \
+ io_callback.C \
Dialogs.C \
GAboutlyx.h \
GAboutlyx.C \
--- /dev/null
+/**
+ * \file io_callback.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author John Levon
+ * \author João Luis M. Assirati
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "io_callback.h"
+
+
+io_callback::io_callback(int fd, boost::function<void()> func)
+ : func_(func)
+{
+ conn_ = Glib::signal_io().connect(SigC::slot(*this, &io_callback::data_received), fd, Glib::IO_IN);
+}
+
+
+bool io_callback::data_received(Glib::IOCondition /*condition*/)
+{
+ func_();
+ return true;
+}
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file io_callback.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author John Levon
+ * \author João Luis M. Assirati
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef IO_CALLBACK_H
+#define IO_CALLBACK_H
+
+
+#include <gtkmm.h>
+
+#include <boost/function.hpp>
+
+
+/**
+ * io_callback - a simple wrapper for asynchronous socket notification
+ *
+ * This is used by the lyxsocket to notice the socket is ready to be
+ * connected/read.
+ *
+ */
+class io_callback : public SigC::Object {
+public:
+ /// connect a connection notification from the LyXServerSocket
+ io_callback(int fd, boost::function<void()> func);
+private:
+ bool data_received(Glib::IOCondition);
+ /// our notifier
+ SigC::Connection conn_;
+ /// The callback function
+ boost::function<void()> func_;
+};
+
+#endif // IO_CALLBACK_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 <fcntl.h>
#include <boost/bind.hpp>
#include <boost/function.hpp>
+#include <boost/shared_ptr.hpp>
//just for xforms
#include "lyx_forms.h"
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";
bool font_available(LyXFont const & font);
/**
- * add a callback for I/O read notification
+ * add a callback for socket read notification
+ * @param fd socket descriptor (file/socket/etc)
*/
-void set_read_callback(int fd, LyXComm * comm);
void register_socket_callback(int fd, boost::function<void()> func);
/**
* remove a I/O read callback
- * @param fd file descriptor
+ * @param fd socket descriptor (file/socket/etc)
*/
-void remove_read_callback(int fd);
void unregister_socket_callback(int fd);
} // namespace lyx_gui
+2004-07-22 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * lyx_gui.C (set_read_callback,remove_read_callback): delete funcs
+
+ * Makefile.dialogs (MOCFILES): remove io_callback.[Ch]
+ * io_callback.[Ch]: delete files
+
2004-07-21 Lars Gullik Bjonnes <larsbj@gullik.net>
* socket_callback.C (data_received): simplify
FileDialog_private.C FileDialog_private.h \
floatplacement.C floatplacement.h \
iconpalette.C iconpalette.h \
- io_callback.C io_callback.h \
lengthcombo.C lengthcombo.h \
panelstack.C panelstack.h \
QAboutDialog.C QAboutDialog.h \
+++ /dev/null
-/**
- * \file io_callback.C
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author unknown
- * \author John Levon
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-// Qt defines a macro 'signals' that clashes with a boost namespace.
-#include "lyxserver.h"
-
-#include "io_callback.h"
-
-io_callback::io_callback(int fd, LyXComm * comm)
- : comm_(comm)
-{
- sn_.reset(new QSocketNotifier(fd, QSocketNotifier::Read, this));
- connect(sn_.get(), SIGNAL(activated(int)), this, SLOT(data_received()));
-}
-
-
-void io_callback::data_received()
-{
- comm_->read_ready();
-}
+++ /dev/null
-// -*- C++ -*-
-/**
- * \file io_callback.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author unknown
- * \author John Levon
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#ifndef IO_CALLBACK_H
-#define IO_CALLBACK_H
-
-
-#include <qobject.h>
-#include <qsocketnotifier.h>
-#include <boost/scoped_ptr.hpp>
-
-class LyXComm;
-
-/**
- * io_callback - a simple wrapper for asynchronous pipe notification
- *
- * This is used by the lyxserver to notice the pipe is ready to be
- * read.
- *
- * FIXME: this code apparently will not work on Windows.
- */
-class io_callback : public QObject {
- Q_OBJECT
-public:
- /// connect a read ready notification for fd to the LyXComm
- io_callback(int fd, LyXComm * comm);
-public slots:
- void data_received();
-private:
- /// our notifier
- boost::scoped_ptr<QSocketNotifier> sn_;
-
- LyXComm * comm_;
-};
-
-#endif // IO_CALLBACK_H
#include <boost/shared_ptr.hpp>
#include "QtView.h"
-#include "io_callback.h"
#include "lcolorcache.h"
#include "qfont_loader.h"
#include "QLImage.h"
return 0.5 * (pdm.logicalDpiX() + pdm.logicalDpiY());
}
-map<int, io_callback *> io_callbacks;
map<int, shared_ptr<socket_callback> > socket_callbacks;
} // namespace anon
}
-void set_read_callback(int fd, LyXComm * comm)
-{
- io_callbacks[fd] = new io_callback(fd, comm);
-}
-
-
-void remove_read_callback(int fd)
-{
- map<int, io_callback *>::iterator it = io_callbacks.find(fd);
- if (it != io_callbacks.end()) {
- delete it->second;
- io_callbacks.erase(it);
- }
-}
-
-
void register_socket_callback(int fd, boost::function<void()> func)
{
socket_callbacks[fd] = shared_ptr<socket_callback>(new socket_callback(fd, func));
+2004-07-22 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * lyx_gui.C (C_read_callback, set_read_callback,
+ remove_read_callback): delete funcs
+
2004-07-21 Lars Gullik Bjonnes <larsbj@gullik.net>
* lyx_gui.C (register_socket_callback): new func
return fontloader.available(font);
}
-namespace {
-
-extern "C"
-void C_read_callback(int, void * data)
-{
- LyXComm * comm = static_cast<LyXComm *>(data);
- comm->read_ready();
-}
-
-}
-
-
-void set_read_callback(int fd, LyXComm * comm)
-{
- fl_add_io_callback(fd, FL_READ, C_read_callback, comm);
-}
-
-void remove_read_callback(int fd)
-{
- fl_remove_io_callback(fd, FL_READ, C_read_callback);
-}
-
namespace {
#include "support/lyxlib.h"
#include "frontends/lyx_gui.h"
+#include <boost/bind.hpp>
+
#include <cerrno>
#include <sys/stat.h>
#include <fcntl.h>
}
if (!write) {
- lyx_gui::set_read_callback(fd, this);
+ lyx_gui::register_socket_callback(fd, boost::bind(&LyXComm::read_ready, *this));
}
return fd;
return;
if (!write) {
- lyx_gui::remove_read_callback(fd);
+ lyx_gui::unregister_socket_callback(fd);
}
#ifdef __EMX__