From 9f2722a944aa4ed3cfaaf263895a0a3375f46222 Mon Sep 17 00:00:00 2001 From: John Levon Date: Sun, 14 Jul 2002 01:44:15 +0000 Subject: [PATCH] xforms ? what xforms ? ps WOO-HOO !!! Rock ON ! git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4632 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 4 ++ configure.in | 6 +-- src/ChangeLog | 7 ++++ src/frontends/ChangeLog | 4 ++ src/frontends/lyx_gui.h | 6 +++ src/frontends/qt2/Alert_pimpl.C | 1 - src/frontends/qt2/ChangeLog | 7 ++++ src/frontends/qt2/Makefile.am | 2 +- src/frontends/qt2/TODO | 5 +-- src/frontends/qt2/Toolbar_pimpl.C | 2 - src/frontends/qt2/lyx_gui.C | 6 +++ src/frontends/qt2/xforms/Makefile.am | 25 ------------ src/frontends/xforms/ChangeLog | 4 ++ src/frontends/xforms/lyx_gui.C | 13 +++++++ src/lyxfunc.C | 33 ---------------- src/lyxserver.C | 58 ++++++++-------------------- src/lyxserver.h | 9 +++-- 17 files changed, 78 insertions(+), 114 deletions(-) delete mode 100644 src/frontends/qt2/xforms/Makefile.am diff --git a/ChangeLog b/ChangeLog index 5812c34f74..7200db7843 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2002-07-14 John Levon + + * configure.in: remove xforms from qt + 2002-07-04 Kayvan A. Sylvan * configure.in (LYX_USE_FRONTEND): The order of libraries is diff --git a/configure.in b/configure.in index 43864ca504..8252089805 100644 --- a/configure.in +++ b/configure.in @@ -197,10 +197,10 @@ case "$lyx_use_frontend" in qt2) QT2_DO_IT_ALL FRONTEND="qt2" - FRONTEND_GUILIB="qt2/*.lo qt2/ui/*.lo qt2/moc/*.lo qt2/ui/moc/*.lo qt2/xforms/*.lo" + FRONTEND_GUILIB="qt2/*.lo qt2/ui/*.lo qt2/moc/*.lo qt2/ui/moc/*.lo" FRONTEND_LDFLAGS="\$(QT2_LDFLAGS)" - FRONTEND_INCLUDES="-I\${srcdir}/qt2 -I\${top_srcdir}/src/frontends/xforms \$(QT2_INCLUDES)" - FRONTEND_LIBS="@XPM_LIB@ @XFORMS_LIB@ \$(QT2_LIBS)";; + FRONTEND_INCLUDES="-I\${srcdir}/qt2 \$(QT2_INCLUDES)" + FRONTEND_LIBS="\$(QT2_LIBS)";; *) LYX_ERROR(Unknown frontend $lyx_use_frontend);; esac diff --git a/src/ChangeLog b/src/ChangeLog index baab579b36..6fd3e928d9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2002-07-14 John Levon + + * lyxfunc.C: remove dead code + + * lyxserver.h: + * lyxserver.C: use lyx_guii::set_read_callback + 2002-07-13 Dekel Tsur * lyxfunc.C (dispatch): Correct cursor behaviour when exiting diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index b132925deb..5a7fc2b526 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,7 @@ +2002-07-14 John Levon + + * lyx_gui.h: add set_read_callback() + 2002-07-12 John Levon * lyx_gui.h: remove init_graphics() diff --git a/src/frontends/lyx_gui.h b/src/frontends/lyx_gui.h index d4f0c03e45..bcc68c7f94 100644 --- a/src/frontends/lyx_gui.h +++ b/src/frontends/lyx_gui.h @@ -16,6 +16,7 @@ class Dialogs; class LyXFont; +class LyXComm; /// GUI interaction namespace lyx_gui { @@ -54,6 +55,11 @@ namespace lyx_gui { * is the given font available ? */ bool font_available(LyXFont const & font); + + /** + * add a callback for I/O read notification + */ + void set_read_callback(int fd, LyXComm * comm); } #endif // LYX_GUI_H diff --git a/src/frontends/qt2/Alert_pimpl.C b/src/frontends/qt2/Alert_pimpl.C index 5939e3ddd7..1926136bf4 100644 --- a/src/frontends/qt2/Alert_pimpl.C +++ b/src/frontends/qt2/Alert_pimpl.C @@ -21,7 +21,6 @@ #include "Alert.h" #include "Alert_pimpl.h" -#include "xforms_helpers.h" using std::pair; using std::make_pair; diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index a70019723e..fe22899292 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,10 @@ +2002-07-14 John Levon + + * lyx_gui.C: add set_read_callback() + + * Makefile.am: + * xforms/*: remove + 2002-07-13 John Levon * QtView.C: add a status bar diff --git a/src/frontends/qt2/Makefile.am b/src/frontends/qt2/Makefile.am index d3099353d0..724446240f 100644 --- a/src/frontends/qt2/Makefile.am +++ b/src/frontends/qt2/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/config/common.am -SUBDIRS = xforms ui moc +SUBDIRS = ui moc EXTRA_DIST = Makefile.dialogs QDocument.C QDocument.h \ QDocumentDialog.C QDocumentDialog.h QParagraph.h QParagraph.C \ diff --git a/src/frontends/qt2/TODO b/src/frontends/qt2/TODO index 90b18a071c..2a392ea9b1 100644 --- a/src/frontends/qt2/TODO +++ b/src/frontends/qt2/TODO @@ -12,14 +12,11 @@ GraphicsImage - remove getPixmap() -LyXServer - - - remove xforms dependency - lyx_gui (qt) - move out lyxserver - do dpi + - implement set_read_callback Menubar_pimpl diff --git a/src/frontends/qt2/Toolbar_pimpl.C b/src/frontends/qt2/Toolbar_pimpl.C index fdc7858f7d..bab349e99d 100644 --- a/src/frontends/qt2/Toolbar_pimpl.C +++ b/src/frontends/qt2/Toolbar_pimpl.C @@ -20,9 +20,7 @@ #include "buffer.h" #include "lyxtextclasslist.h" #include "LyXAction.h" -#include "MathsSymbols.h" #include "gettext.h" -#include "Tooltips.h" #include "support/LAssert.h" #include "support/filetools.h" diff --git a/src/frontends/qt2/lyx_gui.C b/src/frontends/qt2/lyx_gui.C index 9ca60f1c7e..385eff39ba 100644 --- a/src/frontends/qt2/lyx_gui.C +++ b/src/frontends/qt2/lyx_gui.C @@ -142,3 +142,9 @@ bool lyx_gui::font_available(LyXFont const & font) { return fontloader.available(font); } + + +void lyx_gui::set_read_callback(int fd, LyXComm * comm) +{ + // FIXME +} diff --git a/src/frontends/qt2/xforms/Makefile.am b/src/frontends/qt2/xforms/Makefile.am deleted file mode 100644 index 4acca16703..0000000000 --- a/src/frontends/qt2/xforms/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -include $(top_srcdir)/config/common.am - -noinst_LTLIBRARIES = libqt2xforms.la - -INCLUDES = -I$(top_srcdir)/src/ -I$(top_srcdir)/src/frontends/ \ - $(SIGC_CFLAGS) -I$(top_srcdir)/images \ - $(FRONTEND_INCLUDES) $(BOOST_INCLUDES) \ - -I$(top_srcdir)/src/frontends/controllers - -nodist_libqt2xforms_la_SOURCES = \ - Color.h \ - Color.C \ - DropDown.h \ - DropDown.C \ - Tooltips.h \ - Tooltips.C \ - xforms_helpers.h \ - xforms_helpers.C - -libqt2xforms.la: link_files $(libqt2xforms_la_OBJECTS) - -link_files: - for i in $(nodist_libqt2xforms_la_SOURCES); do \ - ln -sf "$(top_srcdir)/src/frontends/xforms/$$i" . ; \ - done diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 84c084ccbb..940e8d2856 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,7 @@ +2002-07-14 John Levon + + * lyx_gui.C: add set_read_callback() + 2002-07-12 John Levon * lyx_gui.C: move init_graphics() into setup diff --git a/src/frontends/xforms/lyx_gui.C b/src/frontends/xforms/lyx_gui.C index 67c55eede8..215f55cd40 100644 --- a/src/frontends/xforms/lyx_gui.C +++ b/src/frontends/xforms/lyx_gui.C @@ -352,3 +352,16 @@ bool lyx_gui::font_available(LyXFont const & font) { return fontloader.available(font); } + +namespace { + void C_read_callback(int, void * data) + { + LyXComm * comm = static_cast(data); + comm->read_ready(); + } +} + +void lyx_gui::set_read_callback(int fd, LyXComm * comm) +{ + fl_add_io_callback(fd, FL_READ, C_read_callback, comm); +} diff --git a/src/lyxfunc.C b/src/lyxfunc.C index e1d32d92f5..19bfb7dba3 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -122,39 +122,6 @@ extern tex_accent_struct get_accent(kb_action action); extern void ShowLatexLog(); -#if 0 - -/// -class MiniBufferController : public SigC::Object { -public: - /// - MiniBufferController() { - minibuffer - .cmdReady - .connect(slot(this, - &MiniBufferController::receiveCommand)); - minibuffer - .argReady - .connect(slot(this, - &MiniBufferController::receiveArg)); - } - /// - void receiveCmd(string const & cmd) {} - /// - void receiveArg(string const & arg) {} - - -private: -}; - -namespace { - -MiniBufferController mb_ctrl; - -} -#endif - - /* === globals =========================================================== */ diff --git a/src/lyxserver.C b/src/lyxserver.C index 11f3d47aea..4a7fadbaa2 100644 --- a/src/lyxserver.C +++ b/src/lyxserver.C @@ -53,6 +53,7 @@ #include "lyxfunc.h" #include "support/lstrings.h" #include "support/lyxlib.h" +#include "frontends/lyx_gui.h" #ifdef __EMX__ #include @@ -75,23 +76,6 @@ int mkfifo(char const * __path, mode_t __mode) { #endif -/* === variables ========================================================= */ - -extern "C" { - - // C wrapper - static - void C_LyXComm_callback(int fd, void *v) - { - LyXComm::callback(fd, v); - } - -} - - -// LyXComm class - -// Open pipes void LyXComm::openConnection() { lyxerr[Debug::LYXSERVER] << "LyXComm: Opening connection" << endl; @@ -215,8 +199,9 @@ int LyXComm::startPipe(string const & filename, bool write) return -1; } - if (!write) - fl_add_io_callback(fd, FL_READ, C_LyXComm_callback, this); + if (!write) { + lyx_gui::set_read_callback(fd, this); + } return fd; } @@ -267,15 +252,13 @@ void LyXComm::emergencyCleanup() // Receives messages and sends then to client -void LyXComm::callback(int fd, void *v) +void LyXComm::read_ready() { - LyXComm * c = static_cast(v); - if (lyxerr.debugging(Debug::LYXSERVER)) { - lyxerr << "LyXComm: Receiving from fd " << fd << endl; + lyxerr << "LyXComm: Receiving from fd " << infd << endl; } - const int CMDBUFLEN = 100; + int const CMDBUFLEN = 100; char charbuf[CMDBUFLEN]; string cmd; // nb! make lsbuf a class-member for multiple sessions @@ -284,17 +267,12 @@ void LyXComm::callback(int fd, void *v) errno = 0; int status; // the single = is intended here. - while ((status = read(fd, charbuf, CMDBUFLEN-1))) - {// break and return in loop - if (status > 0) // got something - { + while ((status = read(infd, charbuf, CMDBUFLEN-1))) { + if (status > 0) { charbuf[status]= '\0'; // turn it into a c string lsbuf += strip(charbuf, '\r'); // commit any commands read - while (lsbuf.find('\n') != string::npos) // while still - // commands - // left - { + while (lsbuf.find('\n') != string::npos) { // split() grabs the entire string if // the delim /wasn't/ found. ?:-P lsbuf= split(lsbuf, cmd,'\n'); @@ -303,19 +281,15 @@ void LyXComm::callback(int fd, void *v) << ", lsbuf:" << lsbuf << ", cmd:" << cmd << endl; if (!cmd.empty()) - c->clientcb(c->client, cmd); + clientcb(client, cmd); //\n or not \n? } } - if (errno == EAGAIN) - { // EAGAIN is not really an error , it means we're - // only reading too fast for the writing process on - // the other end of the pipe. + if (errno == EAGAIN) { errno = 0; - return; // up to libforms select-loop (*crunch*) + return; } - if (errno != 0) - { + if (errno != 0) { lyxerr << "LyXComm: " << strerror(errno) << endl; if (!lsbuf.empty()) { @@ -326,8 +300,8 @@ void LyXComm::callback(int fd, void *v) break; // reset connection } } - c->closeConnection(); - c->openConnection(); + closeConnection(); + openConnection(); errno= 0; } diff --git a/src/lyxserver.h b/src/lyxserver.h index 6b69392fe6..f6d38868db 100644 --- a/src/lyxserver.h +++ b/src/lyxserver.h @@ -17,6 +17,9 @@ #endif #include "LString.h" + +#include + class LyXFunc; class LyXServer; @@ -29,7 +32,7 @@ class LyXServer; This class encapsulates all the dirty communication and thus provides a clean string interface. */ -class LyXComm { +class LyXComm : public boost::signals::trackable { public: /** When we receive a message, we send it to a client. This is one of the small things that would have been a lot @@ -55,8 +58,8 @@ public: /// Send message void send(string const &); - /// We receive messages via XForms through this callback - static void callback(int fd, void *v); + /// asynch ready-to-be-read notification + void read_ready(); private: /// the filename of the in pipe -- 2.39.5