X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fgtk%2Flyx_gui.C;h=4218311c76cb454d2c1cd2f72c84e427547b23b7;hb=6b553bee4ce30c70537cd8e54aa12b35013d253d;hp=ac996808b3eb9d626811de3c72d788c563fdd8d7;hpb=cfd21e6a2a816d0d596b80ff3cd03ff8abedb796;p=lyx.git diff --git a/src/frontends/gtk/lyx_gui.C b/src/frontends/gtk/lyx_gui.C index ac996808b3..4218311c76 100644 --- a/src/frontends/gtk/lyx_gui.C +++ b/src/frontends/gtk/lyx_gui.C @@ -11,15 +11,9 @@ */ #include -#include #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" @@ -31,6 +25,8 @@ #include "lyxfont.h" #include "graphics/LoaderQueue.h" +#include "io_callback.h" + // FIXME: move this stuff out again #include "bufferlist.h" #include "buffer_funcs.h" @@ -45,17 +41,27 @@ #include "xftFontLoader.h" #include "GWorkArea.h" -#include "support/std_sstream.h" -#include -#include -#include -#include - //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 + +#include +#include +#include + +#include + +#include +#include + namespace os = lyx::support::os; using std::ostringstream; @@ -330,16 +336,14 @@ void lyx_gui::start(string const & batch, std::vector const & files) 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::const_iterator cit = files.begin(); - std::vector::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()) { @@ -365,10 +369,23 @@ void lyx_gui::exit() } -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; } @@ -414,44 +431,24 @@ bool lyx_gui::font_available(LyXFont const & font) namespace { +std::map > callbacks; -bool readCallback(Glib::IOCondition /*condition*/, LyXComm * comm) -{ - comm->read_ready(); - return true; -} - - -std::map gReadCallbackMap; - -} +} // NS anon -void lyx_gui::set_read_callback(int fd, LyXComm * comm) +void lyx_gui::register_socket_callback(int fd, + boost::function func) { - gReadCallbackMap[fd] = Glib::signal_io().connect( - SigC::bind(SigC::slot(readCallback), comm), - fd, - Glib::IO_IN); + callbacks[fd] = boost::shared_ptr(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 /*func*/) -{} - - -void lyx_gui::unregister_socket_callback(int /*fd*/) -{} - - string const lyx_gui::roman_font_name() { return "times";