From fff0cb10d20db55a565ee79c203b5a605bcfe33a Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Fri, 13 Oct 2000 12:25:43 +0000 Subject: [PATCH] Better LaTeX error parsing, clear minibuffer when clicking, improve compilation on RH7, warn when file cannot be saved git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/lyx-1_1_5@1113 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 35 +++++++++++++++++++++++++++++++++-- lib/lyxrc.example | 4 ++++ src/LaTeX.C | 6 ++++-- src/buffer.C | 24 +++++++++++++++++++++++- src/debug.C | 7 +++++++ src/debug.h | 15 +++++++++------ src/lyx_gui.C | 7 +++---- src/lyxfunc.C | 2 +- src/mathed/formula.C | 2 +- src/minibuffer.C | 4 ++-- src/minibuffer.h | 2 +- 11 files changed, 88 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 30929b469a..50ffdb4323 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,38 @@ +2000-10-13 Jean-Marc Lasgouttes + + * src/debug.[Ch]: some fixes to help compiling with RH7.0 + wonderful compiler. + 2000-10-11 Baruch Even + * src/buffer.C (writeFile): Added test for errors on writing, this + catches all errors and not only file system full errors as intended. + +2000-10-11 Baruch Even + + * src/minibuffer.h: + * src/minibuffer.C: Changed the method ExecCommand to + PrepareForCommand to convey its real action. + * src/minibuffer.C (peek_event): Added action when mouse clicks to - clear the minibuffer. + clear the minibuffer and prepare to enter a command. + + * src/mathed/formula.C (LocalDispatch): Changed to conform with + the rename from ExecCommand to PrepareForCommand. + * src/lyxfunc.C (Dispatch): ditto. + +2000-09-14 Dekel Tsur + + * src/LaTeX.C (scanLogFile): Don't ignore a "File ended while..." + error. + +2000-10-13 Dekel Tsur + + * lib/lyxrc.example: add description for + \screen_font_encoding_menu. + + * src/lyx_gui.C (create_forms): better fix for crash with + translated interface. 2000-10-12 Jean-Marc Lasgouttes @@ -64,7 +95,7 @@ 2000-09-29 Dekel Tsur - * src/paragraph.C (TeXFootnote): Fixed bug with LTR table floats. + * src/paragraph.C (TeXFootnote): Fixed bug with RTL table floats. 2000-09-26 Jean-Marc Lasgouttes diff --git a/lib/lyxrc.example b/lib/lyxrc.example index b9dc3e77bc..db9b6a1d6d 100644 --- a/lib/lyxrc.example +++ b/lib/lyxrc.example @@ -232,6 +232,10 @@ # the same as what LaTeX calls latin1. #\screen_font_encoding iso8859-2 +# The norm for the menu/popups fonts. The default is an empty string, which +# causes to use the screen fonts norm (defined by \screen_font_encoding). +#\screen_font_encoding_menu iso8859-2 + # The font for popups. It is set to # -*-*-*-?-*-*-*-*-. # The default is: diff --git a/src/LaTeX.C b/src/LaTeX.C index 0c0a935534..002bc3b406 100644 --- a/src/LaTeX.C +++ b/src/LaTeX.C @@ -556,12 +556,14 @@ int LaTeX::scanLogFile(TeXErrors & terr) if (++count > 10) break; } while (!prefixIs(tmp, "l.")); - if (prefixIs(tmp, "l.")) { + if (prefixIs(tmp, "l.") || + contains(token, "File ended while")) { // we have a latex error retval |= TEX_ERROR; // get the line number: int line = 0; - sscanf(tmp.c_str(), "l.%d", &line); + if (prefixIs(tmp, "l.")) + sscanf(tmp.c_str(), "l.%d", &line); // get the rest of the message: string errstr(tmp, tmp.find(' ')); errstr += '\n'; diff --git a/src/buffer.C b/src/buffer.C index 773e064de7..4d5ea07797 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -1299,9 +1299,31 @@ bool Buffer::writeFile(string const & fname, bool flag) const // Write marker that shows file is complete ofs << "\n\\the_end" << endl; + ofs.close(); + // how to check if close went ok? - return true; + // Following is an attempt... (BE 20001011) + + // good() returns false if any error occured, including some + // formatting error. + // bad() returns true if something bad happened in the buffer, + // which should include file system full errors. + + bool status = true; + if (!ofs.good()) { + status = false; +#if 0 + if (ofs.bad()) { + lyxerr << "Buffer::writeFile: BAD ERROR!" << endl; + } else { + lyxerr << "Buffer::writeFile: NOT SO BAD ERROR!" + << endl; + } +#endif + } + + return status; } diff --git a/src/debug.C b/src/debug.C index ed91682a12..2aa185602d 100644 --- a/src/debug.C +++ b/src/debug.C @@ -52,6 +52,13 @@ static error_item errorTags[] = { static const int numErrorTags = sizeof(errorTags)/sizeof(error_item); + +Debug::type const Debug::ANY = Debug::type( + Debug::INFO | Debug::INIT | Debug::KEY | + Debug::PARSER | Debug::LYXRC | Debug::KBMAP | Debug::LATEX | + Debug::MATHED | Debug::FONT | Debug::TCLASS | Debug::LYXVC | + Debug::LYXSERVER | Debug::ROFF | Debug::ACTION | Debug::LYXLEX | + Debug::DEPEND | Debug::INSETS); Debug::type Debug::value(string const & val) { diff --git a/src/debug.h b/src/debug.h index 8f787f728c..615b6169f6 100644 --- a/src/debug.h +++ b/src/debug.h @@ -55,13 +55,16 @@ struct Debug { INSETS = (1 << 17) }; /// - static const type ANY = type(INFO | INIT | KEY | TOOLBAR | - PARSER | LYXRC | KBMAP | LATEX | - MATHED | FONT | TCLASS | LYXVC | - LYXSERVER | ROFF | ACTION | LYXLEX | - DEPEND | INSETS); +// static const type ANY = type(INFO | INIT | KEY | TOOLBAR | +// PARSER | LYXRC | KBMAP | LATEX | +// MATHED | FONT | TCLASS | LYXVC | +// LYXSERVER | ROFF | ACTION | LYXLEX | +// DEPEND | INSETS); /// - friend inline void operator|=(Debug::type & d1, Debug::type d2); + static type const ANY; + + /// +// friend inline void operator|=(Debug::type & d1, Debug::type d2); /** A function to convert symbolic string names on debug levels to their numerical value. diff --git a/src/lyx_gui.C b/src/lyx_gui.C index 9029523daa..583abed617 100644 --- a/src/lyx_gui.C +++ b/src/lyx_gui.C @@ -396,15 +396,14 @@ void LyXGUI::create_forms() fl_end_form(); // "default" is not part of the languages array any more. - combo_language->addto("default"); - combo_language2->addto(_("No change")); - combo_language2->addto(_("Reset")); + combo_language->addline("default"); + combo_language2->addline(_("No change")); + combo_language2->addline(_("Reset")); for(Languages::const_iterator cit = languages.begin(); cit != languages.end(); ++cit) { combo_language->addto((*cit).second.lang.c_str()); combo_language2->addto((*cit).second.lang.c_str()); } - combo_language2->select_text(_("No change")); // not really necessary, but we can do it anyway. fl_addto_choice(fd_form_document->choice_fontsize, "default|10|11|12"); diff --git a/src/lyxfunc.C b/src/lyxfunc.C index b5c1df0b50..0310cc99f9 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -687,7 +687,7 @@ string LyXFunc::Dispatch(int ac, // --- Misc ------------------------------------------- case LFUN_EXEC_COMMAND: - owner->getMiniBuffer()->ExecCommand(); + owner->getMiniBuffer()->PrepareForCommand(); break; case LFUN_CANCEL: // RVDK_PATCH_5 diff --git a/src/mathed/formula.C b/src/mathed/formula.C index bdf8d6cbcc..e6f84ad81b 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -1070,7 +1070,7 @@ InsetFormula::LocalDispatch(BufferView * bv, //------- dummy actions case LFUN_EXEC_COMMAND: - bv->owner()->getMiniBuffer()->ExecCommand(); + bv->owner()->getMiniBuffer()->PrepareForCommand(); break; default: diff --git a/src/minibuffer.C b/src/minibuffer.C index 3d63d95848..44cb5fbd03 100644 --- a/src/minibuffer.C +++ b/src/minibuffer.C @@ -128,7 +128,7 @@ int MiniBuffer::peek_event(FL_OBJECT * ob, int event, FL_Coord, FL_Coord, } } else if (event == FL_PUSH) { // This actually clears the buffer. - mini->ExecCommand(); + mini->PrepareForCommand(); } return 0; @@ -142,7 +142,7 @@ extern "C" int C_MiniBuffer_peek_event(FL_OBJECT * ob, int event, } -void MiniBuffer::ExecCommand() +void MiniBuffer::PrepareForCommand() { text.erase(); fl_set_input(the_buffer, ""); diff --git a/src/minibuffer.h b/src/minibuffer.h index 34a92e59da..896aed9f21 100644 --- a/src/minibuffer.h +++ b/src/minibuffer.h @@ -35,7 +35,7 @@ public: /// void Init(); /// - void ExecCommand(); + void PrepareForCommand(); /** allows to store and reset the contents one time. Usefull for status messages like "load font" (Matthias) */